PageSourceSearch

https://safarimap-9rqsxr9g.manus.space/assets/index-Dn0vUvPT.js

js safarimap-9rqsxr9g.manus.space collected 2026-10-03 05:04:34 UTC 2,134,228 bytes, 3,317 lines download raw bytes

vendor: 4,433 bytes, lines 1-17
1function cC(E,P){for(var k=0;k<P.length;k++){const F=P[k];if(typeof F!="string"&&!Array.isArray(F)){for(const X in F)if(X!=="default"&&!(X in E)){const te=Object.getOwnPropertyDescriptor(F,X);te&&Object.defineProperty(E,X,te.get?te:{enumerable:!0,get:()=>F[X]})}}}return Object.freeze(Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}))}(function(){const P=document.createElement("link").relList;if(P&&P.supports&&P.supports("modulepreload"))return;for(const X of document.querySelectorAll('link[rel="modulepreload"]'))F(X);new MutationObserver(X=>{for(const te of X)if(te.type==="childList")for(const fe of te.addedNodes)fe.tagName==="LINK"&&fe.rel==="modulepreload"&&F(fe)}).observe(document,{childList:!0,subtree:!0});function k(X){const te={};return X.integrity&&(te.integrity=X.integrity),X.referrerPolicy&&(te.referrerPolicy=X.referrerPolicy),X.crossOrigin==="use-credentials"?te.credentials="include":X.crossOrigin==="anonymous"?te.credentials="omit":te.credentials="same-origin",te}function F(X){if(X.ep)return;X.ep=!0;const te=k(X);fetch(X.href,te)}})();function Bx(E){return E&&E.__esModule&&Object.prototype.hasOwnProperty.call(E,"default")?E.default:E}var hv={exports:{}},Z_={};/**
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 b2;function uC(){if(b2)return Z_;b2=1;var E=Symbol.for("react.transitional.element"),P=Symbol.for("react.fragment");function k(F,X,te){var fe=null;if(te!==void 0&&(fe=""+te),X.key!==void 0&&(fe=""+X.key),"key"in X){te={};for(var a in X)a!=="key"&&(te[a]=X[a])}else te=X;return X=te.ref,{$$typeof:E,type:F,key:fe,ref:X!==void 0?X:null,props:te}}return Z_.Fragment=P,Z_.jsx=k,Z_.jsxs=k,Z_}var w2;function hC(){return w2||(w2=1,hv.exports=uC()),hv.exports}var Ce=hC(),dv={exports:{}},$_={},fv={exports:{}},pv={};/**
10 * @license React
11 * scheduler.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 T2;function dC(){return T2||(T2=1,(function(E){function P(je,St){var Tt=je.length;je.push(St);e:for(;0<Tt;){var _i=Tt-1>>>1,ei=je[_i];if(0<X(ei,St))je[_i]=St,je[Tt]=ei,Tt=_i;else break e}}function k(je){return je.length===0?null:je[0]}function F(je){if(je.length===0)return null;var St=je[0],Tt=je.pop();if(Tt!==St){je[0]=Tt;e:for(var _i=0,ei=je.length,Ue=ei>>>1;_i<Ue;){var Dt=2*(_i+1)-1,bt=je[Dt],Ht=Dt+1,ui=je[Ht];if(0>X(bt,Tt))Ht<ei&&0>X(ui,bt)?(je[_i]=ui,je[Ht]=Tt,_i=Ht):(je[_i]=bt,je[Dt]=Tt,_i=Dt);else if(Ht<ei&&0>X(ui,Tt))je[_i]=ui,je[Ht]=Tt,_i=Ht;else break e}}return St}function X(je,St){var Tt=je.sortIndex-St.sortIndex;return Tt!==0?Tt:je.id-St.id}if(E.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var te=performance;E.unstable_now=function(){return te.now()}}else{var fe=Date,a=fe.now();E.unstable_now=function(){return fe.now()-a}}var ue=[],re=[],Ee=1,oe=null,ke=3,Qe=!1,ft=!1,Ne=!1,Je=!1,mt=typeof setTimeout=="function"?setTimeout:null,pt=typeof clearTimeout=="function"?clearTimeout:null,dt=typeof setImmediate<"u"?setImmediate:null;function nt(je){for(var St=k(re);St!==null;){if(St.callback===null)F(re);else if(St.startTime<=je)F(re),St.sortIndex=St.expirationTime,P(ue,St);else break;St=k(re)}}function vt(je){if(Ne=!1,nt(je),!ft)if(k(ue)!==null)ft=!0,ut||(ut=!0,ai());else{var St=k(re);St!==null&&Si(vt,St.startTime-je)}}var ut=!1,rt=-1,wt=5,Ii=-1;function ji(){return Je?!0:!(E.unstable_now()-Ii<wt)}function Bi(){if(Je=!1,ut){var je=E.unstable_now();Ii=je;var St=!0;try{e:{ft=!1,Ne&&(Ne=!1,pt(rt),rt=-1),Qe=!0;var Tt=ke;try{t:{for(nt(je),oe=k(ue);oe!==null&&!(oe.expirationTime>je&&ji());){var _i=oe.callback;if(typeof _i=="function"){oe.callback=null,ke=oe.priorityLevel;var ei=_i(oe.expirationTime<=je);if(je=E.unstable_now(),typeof ei=="function"){oe.callback=ei,nt(je),St=!0;break t}oe===k(ue)&&F(ue),nt(je)}else F(ue);oe=k(ue)}if(oe!==null)St=!0;else{var Ue=k(re);Ue!==null&&Si(vt,Ue.startTime-je),St=!1}}break e}finally{oe=null,ke=Tt,Qe=!1}St=void 0}}finally{St?ai():ut=!1}}}var ai;if(typeof dt=="function")ai=function(){dt(Bi)};else if(typeof MessageChannel<"u"){var Vt=new MessageChannel,gi=Vt.port2;Vt.port1.onmessage=Bi,ai=function(){gi.postMessage(null)}}
vendor: 19,494 bytes, lines 17-43
17else ai=function(){mt(Bi,0)};function Si(je,St){rt=mt(function(){je(E.unstable_now())},St)}E.unstable_IdlePriority=5,E.unstable_ImmediatePriority=1,E.unstable_LowPriority=4,E.unstable_NormalPriority=3,E.unstable_Profiling=null,E.unstable_UserBlockingPriority=2,E.unstable_cancelCallback=function(je){je.callback=null},E.unstable_forceFrameRate=function(je){0>je||125<je?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):wt=0<je?Math.floor(1e3/je):5},E.unstable_getCurrentPriorityLevel=function(){return ke},E.unstable_next=function(je){switch(ke){case 1:case 2:case 3:var St=3;break;default:St=ke}var Tt=ke;ke=St;try{return je()}finally{ke=Tt}},E.unstable_requestPaint=function(){Je=!0},E.unstable_runWithPriority=function(je,St){switch(je){case 1:case 2:case 3:case 4:case 5:break;default:je=3}var Tt=ke;ke=je;try{return St()}finally{ke=Tt}},E.unstable_scheduleCallback=function(je,St,Tt){var _i=E.unstable_now();switch(typeof Tt=="object"&&Tt!==null?(Tt=Tt.delay,Tt=typeof Tt=="number"&&0<Tt?_i+Tt:_i):Tt=_i,je){case 1:var ei=-1;break;case 2:ei=250;break;case 5:ei=1073741823;break;case 4:ei=1e4;break;default:ei=5e3}return ei=Tt+ei,je={id:Ee++,callback:St,priorityLevel:je,startTime:Tt,expirationTime:ei,sortIndex:-1},Tt>_i?(je.sortIndex=Tt,P(re,je),k(ue)===null&&je===k(re)&&(Ne?(pt(rt),rt=-1):Ne=!0,Si(vt,Tt-_i))):(je.sortIndex=ei,P(ue,je),ft||Qe||(ft=!0,ut||(ut=!0,ai()))),je},E.unstable_shouldYield=ji,E.unstable_wrapCallback=function(je){var St=ke;return function(){var Tt=ke;ke=St;try{return je.apply(this,arguments)}finally{ke=Tt}}}})(pv)),pv}var S2;function fC(){return S2||(S2=1,fv.exports=dC()),fv.exports}var mv={exports:{}},An={};/**
18 * @license React
19 * react.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 E2;function pC(){if(E2)return An;E2=1;var E=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),te=Symbol.for("react.consumer"),fe=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),re=Symbol.for("react.memo"),Ee=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ke=Symbol.iterator;function Qe(Ue){return Ue===null||typeof Ue!="object"?null:(Ue=ke&&Ue[ke]||Ue["@@iterator"],typeof Ue=="function"?Ue:null)}var ft={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ne=Object.assign,Je={};function mt(Ue,Dt,bt){this.props=Ue,this.context=Dt,this.refs=Je,this.updater=bt||ft}mt.prototype.isReactComponent={},mt.prototype.setState=function(Ue,Dt){if(typeof Ue!="object"&&typeof Ue!="function"&&Ue!=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,Ue,Dt,"setState")},mt.prototype.forceUpdate=function(Ue){this.updater.enqueueForceUpdate(this,Ue,"forceUpdate")};function pt(){}pt.prototype=mt.prototype;function dt(Ue,Dt,bt){this.props=Ue,this.context=Dt,this.refs=Je,this.updater=bt||ft}var nt=dt.prototype=new pt;nt.constructor=dt,Ne(nt,mt.prototype),nt.isPureReactComponent=!0;var vt=Array.isArray;function ut(){}var rt={H:null,A:null,T:null,S:null},wt=Object.prototype.hasOwnProperty;function Ii(Ue,Dt,bt){var Ht=bt.ref;return{$$typeof:E,type:Ue,key:Dt,ref:Ht!==void 0?Ht:null,props:bt}}function ji(Ue,Dt){return Ii(Ue.type,Dt,Ue.props)}function Bi(Ue){return typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===E}function ai(Ue){var Dt={"=":"=0",":":"=2"};return"$"+Ue.replace(/[=:]/g,function(bt){return Dt[bt]})}var Vt=/\/+/g;function gi(Ue,Dt){return typeof Ue=="object"&&Ue!==null&&Ue.key!=null?ai(""+Ue.key):Dt.toString(36)}function Si(Ue){switch(Ue.status){case"fulfilled":return Ue.value;case"rejected":throw Ue.reason;default:switch(typeof Ue.status=="string"?Ue.then(ut,ut):(Ue.status="pending",Ue.then(function(Dt){Ue.status==="pending"&&(Ue.status="fulfilled",Ue.value=Dt)},function(Dt){Ue.status==="pending"&&(Ue.status="rejected",Ue.reason=Dt)})),Ue.status){case"fulfilled":return Ue.value;case"rejected":throw Ue.reason}}throw Ue}function je(Ue,Dt,bt,Ht,ui){var hi=typeof Ue;(hi==="undefined"||hi==="boolean")&&(Ue=null);var Ai=!1;if(Ue===null)Ai=!0;else switch(hi){case"bigint":case"string":case"number":Ai=!0;break;case"object":switch(Ue.$$typeof){case E:case P:Ai=!0;break;case Ee:return Ai=Ue._init,je(Ai(Ue._payload),Dt,bt,Ht,ui)}}if(Ai)return ui=ui(Ue),Ai=Ht===""?"."+gi(Ue,0):Ht,vt(ui)?(bt="",Ai!=null&&(bt=Ai.replace(Vt,"$&/")+"/"),je(ui,Dt,bt,"",function(ln){return ln})):ui!=null&&(Bi(ui)&&(ui=ji(ui,bt+(ui.key==null||Ue&&Ue.key===ui.key?"":(""+ui.key).replace(Vt,"$&/")+"/")+Ai)),Dt.push(ui)),1;Ai=0;var Oi=Ht===""?".":Ht+":";if(vt(Ue))for(var xi=0;xi<Ue.length;xi++)Ht=Ue[xi],hi=Oi+gi(Ht,xi),Ai+=je(Ht,Dt,bt,hi,ui);else if(xi=Qe(Ue),typeof xi=="function")for(Ue=xi.call(Ue),xi=0;!(Ht=Ue.next()).done;)Ht=Ht.value,hi=Oi+gi(Ht,xi++),Ai+=je(Ht,Dt,bt,hi,ui);else if(hi==="object"){if(typeof Ue.then=="function")return je(Si(Ue),Dt,bt,Ht,ui);throw Dt=String(Ue),Error("Objects are not valid as a React child (found: "+(Dt==="[object Object]"?"object with keys {"+Object.keys(Ue).join(", ")+"}":Dt)+"). If you meant to render a collection of children, use an array instead.")}return Ai}function St(Ue,Dt,bt){if(Ue==null)return Ue;var Ht=[],ui=0;return je(Ue,Ht,"","",function(hi){return Dt.call(bt,hi,ui++)}),Ht}function Tt(Ue){if(Ue._status===-1){var Dt=Ue._result;Dt=Dt(),Dt.then(function(bt){(Ue._status===0||Ue._status===-1)&&(Ue._status=1,Ue._result=bt)},function(bt){(Ue._status===0||Ue._status===-1)&&(Ue._status=2,Ue._result=bt)}),Ue._status===-1&&(Ue._status=0,Ue._result=Dt)}if(Ue._status===1)return Ue._result.default;throw Ue._result}var _i=typeof reportError=="function"?reportError:function(Ue){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Dt=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof Ue=="object"&&Ue!==null&&typeof Ue.message=="string"?String(Ue.message):String(Ue),error:Ue});if(!window.dispatchEvent(Dt))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",Ue);return}console.error(Ue)},ei={map:St,forEach:function(Ue,Dt,bt){St(Ue,function(){Dt.apply(this,arguments)},bt)},count:function(Ue){var Dt=0;return St(Ue,function(){Dt++}),Dt},toArray:function(Ue){return St(Ue,function(Dt){return Dt})||[]},only:function(Ue){if(!Bi(Ue))throw Error("React.Children.only expected to receive a single React element child.");return Ue}};return An.Activity=oe,An.Children=ei,An.Component=mt,An.Fragment=k,An.Profiler=X,An.PureComponent=dt,An.StrictMode=F,An.Suspense=ue,An.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=rt,An.__COMPILER_RUNTIME={__proto__:null,c:function(Ue){return rt.H.useMemoCache(Ue)}},An.cache=function(Ue){return function(){return Ue.apply(null,arguments)}},An.cacheSignal=function(){return null},An.cloneElement=function(Ue,Dt,bt){if(Ue==null)throw Error("The argument must be a React element, but you passed "+Ue+".");var Ht=Ne({},Ue.props),ui=Ue.key;if(Dt!=null)for(hi in Dt.key!==void 0&&(ui=""+Dt.key),Dt)!wt.call(Dt,hi)||hi==="key"||hi==="__self"||hi==="__source"||hi==="ref"&&Dt.ref===void 0||(Ht[hi]=Dt[hi]);var hi=arguments.length-2;if(hi===1)Ht.children=bt;else if(1<hi){for(var Ai=Array(hi),Oi=0;Oi<hi;Oi++)Ai[Oi]=arguments[Oi+2];Ht.children=Ai}return Ii(Ue.type,ui,Ht)},An.createContext=function(Ue){return Ue={$$typeof:fe,_currentValue:Ue,_currentValue2:Ue,_threadCount:0,Provider:null,Consumer:null},Ue.Provider=Ue,Ue.Consumer={$$typeof:te,_context:Ue},Ue},An.createElement=function(Ue,Dt,bt){var Ht,ui={},hi=null;if(Dt!=null)for(Ht in Dt.key!==void 0&&(hi=""+Dt.key),Dt)wt.call(Dt,Ht)&&Ht!=="key"&&Ht!=="__self"&&Ht!=="__source"&&(ui[Ht]=Dt[Ht]);var Ai=arguments.length-2;if(Ai===1)ui.children=bt;else if(1<Ai){for(var Oi=Array(Ai),xi=0;xi<Ai;xi++)Oi[xi]=arguments[xi+2];ui.children=Oi}if(Ue&&Ue.defaultProps)for(Ht in Ai=Ue.defaultProps,Ai)ui[Ht]===void 0&&(ui[Ht]=Ai[Ht]);return Ii(Ue,hi,ui)},An.createRef=function(){return{current:null}},An.forwardRef=function(Ue){return{$$typeof:a,render:Ue}},An.isValidElement=Bi,An.lazy=function(Ue){return{$$typeof:Ee,_payload:{_status:-1,_result:Ue},_init:Tt}},An.memo=function(Ue,Dt){return{$$typeof:re,type:Ue,compare:Dt===void 0?null:Dt}},An.startTransition=function(Ue){var Dt=rt.T,bt={};rt.T=bt;try{var Ht=Ue(),ui=rt.S;ui!==null&&ui(bt,Ht),typeof Ht=="object"&&Ht!==null&&typeof Ht.then=="function"&&Ht.then(ut,_i)}catch(hi){_i(hi)}finally{Dt!==null&&bt.types!==null&&(Dt.types=bt.types),rt.T=Dt}},An.unstable_useCacheRefresh=function(){return rt.H.useCacheRefresh()},An.use=function(Ue){return rt.H.use(Ue)},An.useActionState=function(Ue,Dt,bt){return rt.H.useActionState(Ue,Dt,bt)},An.useCallback=function(Ue,Dt){return rt.H.useCallback(Ue,Dt)},An.useContext=function(Ue){return rt.H.useContext(Ue)},An.useDebugValue=function(){},An.useDeferredValue=function(Ue,Dt){return rt.H.useDeferredValue(Ue,Dt)},An.useEffect=function(Ue,Dt){return rt.H.useEffect(Ue,Dt)},An.useEffectEvent=function(Ue){return rt.H.useEffectEvent(Ue)},An.useId=function(){return rt.H.useId()},An.useImperativeHandle=function(Ue,Dt,bt){return rt.H.useImperativeHandle(Ue,Dt,bt)},An.useInsertionEffect=function(Ue,Dt){return rt.H.useInsertionEffect(Ue,Dt)},An.useLayoutEffect=function(Ue,Dt){return rt.H.useLayoutEffect(Ue,Dt)},An.useMemo=function(Ue,Dt){return rt.H.useMemo(Ue,Dt)},An.useOptimistic=function(Ue,Dt){return rt.H.useOptimistic(Ue,Dt)},An.useReducer=function(Ue,Dt,bt){return rt.H.useReducer(Ue,Dt,bt)},An.useRef=function(Ue){return rt.H.useRef(Ue)},An.useState=function(Ue){return rt.H.useState(Ue)},An.useSyncExternalStore=function(Ue,Dt,bt){return rt.H.useSyncExternalStore(Ue,Dt,bt)},An.useTransition=function(){return rt.H.useTransition()},An.version="19.2.1",An}var A2;function kx(){return A2||(A2=1,mv.exports=pC()),mv.exports}var gv={exports:{}},vs={};/**
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 M2;function mC(){if(M2)return vs;M2=1;var E=kx();function P(ue){var re="https://react.dev/errors/"+ue;if(1<arguments.length){re+="?args[]="+encodeURIComponent(arguments[1]);for(var Ee=2;Ee<arguments.length;Ee++)re+="&args[]="+encodeURIComponent(arguments[Ee])}return"Minified React error #"+ue+"; visit "+re+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function k(){}var F={d:{f:k,r:function(){throw Error(P(522))},D:k,C:k,L:k,m:k,X:k,S:k,M:k},p:0,findDOMNode:null},X=Symbol.for("react.portal");function te(ue,re,Ee){var oe=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:X,key:oe==null?null:""+oe,children:ue,containerInfo:re,implementation:Ee}}var fe=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(ue,re){if(ue==="font")return"";if(typeof re=="string")return re==="use-credentials"?re:""}return vs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,vs.createPortal=function(ue,re){var Ee=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!re||re.nodeType!==1&&re.nodeType!==9&&re.nodeType!==11)throw Error(P(299));return te(ue,re,null,Ee)},vs.flushSync=function(ue){var re=fe.T,Ee=F.p;try{if(fe.T=null,F.p=2,ue)return ue()}finally{fe.T=re,F.p=Ee,F.d.f()}},vs.preconnect=function(ue,re){typeof ue=="string"&&(re?(re=re.crossOrigin,re=typeof re=="string"?re==="use-credentials"?re:"":void 0):re=null,F.d.C(ue,re))},vs.prefetchDNS=function(ue){typeof ue=="string"&&F.d.D(ue)},vs.preinit=function(ue,re){if(typeof ue=="string"&&re&&typeof re.as=="string"){var Ee=re.as,oe=a(Ee,re.crossOrigin),ke=typeof re.integrity=="string"?re.integrity:void 0,Qe=typeof re.fetchPriority=="string"?re.fetchPriority:void 0;Ee==="style"?F.d.S(ue,typeof re.precedence=="string"?re.precedence:void 0,{crossOrigin:oe,integrity:ke,fetchPriority:Qe}):Ee==="script"&&F.d.X(ue,{crossOrigin:oe,integrity:ke,fetchPriority:Qe,nonce:typeof re.nonce=="string"?re.nonce:void 0})}},vs.preinitModule=function(ue,re){if(typeof ue=="string")if(typeof re=="object"&&re!==null){if(re.as==null||re.as==="script"){var Ee=a(re.as,re.crossOrigin);F.d.M(ue,{crossOrigin:Ee,integrity:typeof re.integrity=="string"?re.integrity:void 0,nonce:typeof re.nonce=="string"?re.nonce:void 0})}}else re==null&&F.d.M(ue)},vs.preload=function(ue,re){if(typeof ue=="string"&&typeof re=="object"&&re!==null&&typeof re.as=="string"){var Ee=re.as,oe=a(Ee,re.crossOrigin);F.d.L(ue,Ee,{crossOrigin:oe,integrity:typeof re.integrity=="string"?re.integrity:void 0,nonce:typeof re.nonce=="string"?re.nonce:void 0,type:typeof re.type=="string"?re.type:void 0,fetchPriority:typeof re.fetchPriority=="string"?re.fetchPriority:void 0,referrerPolicy:typeof re.referrerPolicy=="string"?re.referrerPolicy:void 0,imageSrcSet:typeof re.imageSrcSet=="string"?re.imageSrcSet:void 0,imageSizes:typeof re.imageSizes=="string"?re.imageSizes:void 0,media:typeof re.media=="string"?re.media:void 0})}},vs.preloadModule=function(ue,re){if(typeof ue=="string")if(re){var Ee=a(re.as,re.crossOrigin);F.d.m(ue,{as:typeof re.as=="string"&&re.as!=="script"?re.as:void 0,crossOrigin:Ee,integrity:typeof re.integrity=="string"?re.integrity:void 0})}else F.d.m(ue)},vs.requestFormReset=function(ue){F.d.r(ue)},vs.unstable_batchedUpdates=function(ue,re){return ue(re)},vs.useFormState=function(ue,re,Ee){return fe.H.useFormState(ue,re,Ee)},vs.useFormStatus=function(){return fe.H.useHostTransitionStatus()},vs.version="19.2.1",vs}var C2;function bT(){if(C2)return gv.exports;C2=1;function E(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(E)}catch(P){console.error(P)}}return E(),gv.exports=mC(),gv.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 I2;function gC(){if(I2)return $_;I2=1;var E=fC(),P=kx(),k=bT();function F(s){var d="https://react.dev/errors/"+s;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)d+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+s+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function X(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function te(s){var d=s,_=s;if(s.alternate)for(;d.return;)d=d.return;else{s=d;do d=s,(d.flags&4098)!==0&&(_=d.return),s=d.return;while(s)}return d.tag===3?_:null}function fe(s){if(s.tag===13){var d=s.memoizedState;if(d===null&&(s=s.alternate,s!==null&&(d=s.memoizedState)),d!==null)return d.dehydrated}return null}function a(s){if(s.tag===31){var d=s.memoizedState;if(d===null&&(s=s.alternate,s!==null&&(d=s.memoizedState)),d!==null)return d.dehydrated}return null}function ue(s){if(te(s)!==s)throw Error(F(188))}function re(s){var d=s.alternate;if(!d){if(d=te(s),d===null)throw Error(F(188));return d!==s?null:s}for(var _=s,w=d;;){var z=_.return;if(z===null)break;var O=z.alternate;if(O===null){if(w=z.return,w!==null){_=w;continue}break}if(z.child===O.child){for(O=z.child;O;){if(O===_)return ue(z),s;if(O===w)return ue(z),d;O=O.sibling}throw Error(F(188))}if(_.return!==w.return)_=z,w=O;else{for(var J=!1,ve=z.child;ve;){if(ve===_){J=!0,_=z,w=O;break}if(ve===w){J=!0,w=z,_=O;break}ve=ve.sibling}if(!J){for(ve=O.child;ve;){if(ve===_){J=!0,_=O,w=z;break}if(ve===w){J=!0,w=O,_=z;break}ve=ve.sibling}if(!J)throw Error(F(189))}}if(_.alternate!==w)throw Error(F(190))}if(_.tag!==3)throw Error(F(188));return _.stateNode.current===_?s:d}function Ee(s){var d=s.tag;if(d===5||d===26||d===27||d===6)return s;for(s=s.child;s!==null;){if(d=Ee(s),d!==null)return d;s=s.sibling}return null}var oe=Object.assign,ke=Symbol.for("react.element"),Qe=Symbol.for("react.transitional.element"),ft=Symbol.for("react.portal"),Ne=Symbol.for("react.fragment"),Je=Symbol.for("react.strict_mode"),mt=Symbol.for("react.profiler"),pt=Symbol.for("react.consumer"),dt=Symbol.for("react.context"),nt=Symbol.for("react.forward_ref"),vt=Symbol.for("react.suspense"),ut=Symbol.for("react.suspense_list"),rt=Symbol.for("react.memo"),wt=Symbol.for("react.lazy"),Ii=Symbol.for("react.activity"),ji=Symbol.for("react.memo_cache_sentinel"),Bi=Symbol.iterator;function ai(s){return s===null||typeof s!="object"?null:(s=Bi&&s[Bi]||s["@@iterator"],typeof s=="function"?s:null)}var Vt=Symbol.for("react.client.reference");function gi(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Vt?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case Ne:return"Fragment";case mt:return"Profiler";case Je:return"StrictMode";case vt:return"Suspense";case ut:return"SuspenseList";case Ii:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case ft:return"Portal";case dt:return s.displayName||"Context";case pt:return(s._context.displayName||"Context")+".Consumer";case nt:var d=s.render;return s=s.displayName,s||(s=d.displayName||d.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case rt:return d=s.displayName||null,d!==null?d:gi(s.type)||"Memo";case wt:d=s._payload,s=s._init;try{return gi(s(d))}catch{}}return null}var Si=Array.isArray,je=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,St=k.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Tt={pending:!1,data:null,method:null,action:null},_i=[],ei=-1;function Ue(s){return{current:s}}function Dt(s){0>ei||(s.current=_i[ei],_i[ei]=null,ei--)}function bt(s,d){ei++,_i[ei]=s.current,s.current=d}var Ht=Ue(null),ui=Ue(null),hi=Ue(null),Ai=Ue(null);function Oi(s,d){switch(bt(hi,d),bt(ui,s),bt(Ht,null),d.nodeType){case 9:case 11:s=(s=d.documentElement)&&(s=s.namespaceURI)?Kg(s):0;break;default:if(s=d.tagName,d=d.namespaceURI)d=Kg(d),s=Km(d,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Dt(Ht),bt(Ht,s)}function xi(){Dt(Ht),Dt(ui),Dt(hi)}function ln(s){s.memoizedState!==null&&bt(Ai,s);var d=Ht.current,_=Km(d,s.type);d!==_&&(bt(ui,s),bt(Ht,_))}function Xn(s){ui.current===s&&(Dt(Ht),Dt(ui)),Ai.current===s&&(Dt(Ai),bl._currentValue=Tt)}var Or,Nn;function bo(s){if(Or===void 0)try{throw Error()}catch(_){var d=_.stack.trim().match(/\n( *(at )?)/);Or=d&&d[1]||"",Nn=-1<_.stack.indexOf(`
42    at`)?" (<anonymous>)":-1<_.stack.indexOf("@")?"@unknown:0:0":""}return`
43`+Or+s+Nn}var Ka=!1;function Qa(s,d){if(!s||Ka)return"";Ka=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var w={DetermineComponentFrameRoot:function(){try{if(d){var Jt=function(){throw Error()};if(Object.defineProperty(Jt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Jt,[])}catch(jt){var Ot=jt}Reflect.construct(s,[],Jt)}else{try{Jt.call()}catch(jt){Ot=jt}s.call(Jt.prototype)}}else{try{throw Error()}catch(jt){Ot=jt}(Jt=s())&&typeof Jt.catch=="function"&&Jt.catch(function(){})}}
vendor: 5,303 bytes, lines 43-48
43catch(jt){if(jt&&Ot&&typeof jt.stack=="string")return[jt.stack,Ot.stack]}return[null,null]}};w.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var z=Object.getOwnPropertyDescriptor(w.DetermineComponentFrameRoot,"name");z&&z.configurable&&Object.defineProperty(w.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=w.DetermineComponentFrameRoot(),J=O[0],ve=O[1];if(J&&ve){var Xe=J.split(`
44`),Pt=ve.split(`
45`);for(z=w=0;w<Xe.length&&!Xe[w].includes("DetermineComponentFrameRoot");)w++;for(;z<Pt.length&&!Pt[z].includes("DetermineComponentFrameRoot");)z++;if(w===Xe.length||z===Pt.length)for(w=Xe.length-1,z=Pt.length-1;1<=w&&0<=z&&Xe[w]!==Pt[z];)z--;for(;1<=w&&0<=z;w--,z--)if(Xe[w]!==Pt[z]){if(w!==1||z!==1)do if(w--,z--,0>z||Xe[w]!==Pt[z]){var Xt=`
46`+Xe[w].replace(" at new "," at ");return s.displayName&&Xt.includes("<anonymous>")&&(Xt=Xt.replace("<anonymous>",s.displayName)),Xt}while(1<=w&&0<=z);break}}}finally{Ka=!1,Error.prepareStackTrace=_}return(_=s?s.displayName||s.name:"")?bo(_):""}function Oo(s,d){switch(s.tag){case 26:case 27:case 5:return bo(s.type);case 16:return bo("Lazy");case 13:return s.child!==d&&d!==null?bo("Suspense Fallback"):bo("Suspense");case 19:return bo("SuspenseList");case 0:case 15:return Qa(s.type,!1);case 11:return Qa(s.type.render,!1);case 1:return Qa(s.type,!0);case 31:return bo("Activity");default:return""}}function rr(s){try{var d="",_=null;do d+=Oo(s,_),_=s,s=s.return;while(s);return d}catch(w){return`
47Error generating stack: `+w.message+`
48`+w.stack}}var wo=Object.prototype.hasOwnProperty,Ja=E.unstable_scheduleCallback,Ys=E.unstable_cancelCallback,Wr=E.unstable_shouldYield,es=E.unstable_requestPaint,pr=E.unstable_now,Bo=E.unstable_getCurrentPriorityLevel,oa=E.unstable_ImmediatePriority,ts=E.unstable_UserBlockingPriority,Sa=E.unstable_NormalPriority,bs=E.unstable_LowPriority,zr=E.unstable_IdlePriority,El=E.log,oo=E.unstable_setDisableYieldValue,ws=null,Br=null;function mr(s){if(typeof El=="function"&&oo(s),Br&&typeof Br.setStrictMode=="function")try{Br.setStrictMode(ws,s)}catch{}}var Dr=Math.clz32?Math.clz32:To,Ts=Math.log,is=Math.LN2;function To(s){return s>>>=0,s===0?32:31-(Ts(s)/is|0)|0}var ka=256,Fa=262144,ns=4194304;function vn(s){var d=s&42;if(d!==0)return d;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ki(s,d,_){var w=s.pendingLanes;if(w===0)return 0;var z=0,O=s.suspendedLanes,J=s.pingedLanes;s=s.warmLanes;var ve=w&134217727;return ve!==0?(w=ve&~O,w!==0?z=vn(w):(J&=ve,J!==0?z=vn(J):_||(_=ve&~s,_!==0&&(z=vn(_))))):(ve=w&~O,ve!==0?z=vn(ve):J!==0?z=vn(J):_||(_=w&~s,_!==0&&(z=vn(_)))),z===0?0:d!==0&&d!==z&&(d&O)===0&&(O=z&-z,_=d&-d,O>=_||O===32&&(_&4194048)!==0)?d:z}function xr(s,d){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&d)===0}function kr(s,d){switch(s){case 1:case 2:case 4:case 8:case 64:return d+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 d+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 gr(){var s=ns;return ns<<=1,(ns&62914560)===0&&(ns=4194304),s}function Ks(s){for(var d=[],_=0;31>_;_++)d.push(s);return d}function _r(s,d){s.pendingLanes|=d,d!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function _t(s,d,_,w,z,O){var J=s.pendingLanes;s.pendingLanes=_,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=_,s.entangledLanes&=_,s.errorRecoveryDisabledLanes&=_,s.shellSuspendCounter=0;var ve=s.entanglements,Xe=s.expirationTimes,Pt=s.hiddenUpdates;for(_=J&~_;0<_;){var Xt=31-Dr(_),Jt=1<<Xt;ve[Xt]=0,Xe[Xt]=-1;var Ot=Pt[Xt];if(Ot!==null)for(Pt[Xt]=null,Xt=0;Xt<Ot.length;Xt++){var jt=Ot[Xt];jt!==null&&(jt.lane&=-536870913)}_&=~Jt}w!==0&&aa(s,w,0),O!==0&&z===0&&s.tag!==0&&(s.suspendedLanes|=O&~(J&~d))}function aa(s,d,_){s.pendingLanes|=d,s.suspendedLanes&=~d;var w=31-Dr(d);s.entangledLanes|=d,s.entanglements[w]=s.entanglements[w]|1073741824|_&261930}function Wo(s,d){var _=s.entangledLanes|=d;for(s=s.entanglements;_;){var w=31-Dr(_),z=1<<w;z&d|s[w]&d&&(s[w]|=d),_&=~z}}function So(s,d){var _=d&-d;return _=(_&42)!==0?1:Ki(_),(_&(s.suspendedLanes|d))!==0?0:_}function Ki(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function De(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function $(){var s=St.p;
vendor: 7,996 bytes, line 48
48return s!==0?s:(s=window.event,s===void 0?32:Ty(s.type))}function K(s,d){var _=St.p;try{return St.p=s,d()}finally{St.p=_}}var ce=Math.random().toString(36).slice(2),we="__reactFiber$"+ce,he="__reactProps$"+ce,Ie="__reactContainer$"+ce,Ge="__reactEvents$"+ce,Pe="__reactListeners$"+ce,qe="__reactHandles$"+ce,Mt="__reactResources$"+ce,yt="__reactMarker$"+ce;function Zt(s){delete s[we],delete s[he],delete s[Ge],delete s[Pe],delete s[qe]}function ri(s){var d=s[we];if(d)return d;for(var _=s.parentNode;_;){if(d=_[Ie]||_[we]){if(_=d.alternate,d.child!==null||_!==null&&_.child!==null)for(s=t_(s);s!==null;){if(_=s[we])return _;s=t_(s)}return d}s=_,_=s.parentNode}return null}function li(s){if(s=s[we]||s[Ie]){var d=s.tag;if(d===5||d===6||d===13||d===31||d===26||d===27||d===3)return s}return null}function Mi(s){var d=s.tag;if(d===5||d===26||d===27||d===6)return s.stateNode;throw Error(F(33))}function Li(s){var d=s[Mt];return d||(d=s[Mt]={hoistableStyles:new Map,hoistableScripts:new Map}),d}function si(s){s[yt]=!0}var vi=new Set,Rn={};function or(s,d){jn(s,d),jn(s+"Capture",d)}function jn(s,d){for(Rn[s]=d,s=0;s<d.length;s++)vi.add(d[s])}var dr=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]*$"),Un={},Ji={};function Hn(s){return wo.call(Ji,s)?!0:wo.call(Un,s)?!1:dr.test(s)?Ji[s]=!0:(Un[s]=!0,!1)}function bn(s,d,_){if(Hn(d))if(_===null)s.removeAttribute(d);else{switch(typeof _){case"undefined":case"function":case"symbol":s.removeAttribute(d);return;case"boolean":var w=d.toLowerCase().slice(0,5);if(w!=="data-"&&w!=="aria-"){s.removeAttribute(d);return}}s.setAttribute(d,""+_)}}function wn(s,d,_){if(_===null)s.removeAttribute(d);else{switch(typeof _){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(d);return}s.setAttribute(d,""+_)}}function zn(s,d,_,w){if(w===null)s.removeAttribute(_);else{switch(typeof w){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(_);return}s.setAttributeNS(d,_,""+w)}}function ar(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Yr(s){var d=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Fr(s,d,_){var w=Object.getOwnPropertyDescriptor(s.constructor.prototype,d);if(!s.hasOwnProperty(d)&&typeof w<"u"&&typeof w.get=="function"&&typeof w.set=="function"){var z=w.get,O=w.set;return Object.defineProperty(s,d,{configurable:!0,get:function(){return z.call(this)},set:function(J){_=""+J,O.call(this,J)}}),Object.defineProperty(s,d,{enumerable:w.enumerable}),{getValue:function(){return _},setValue:function(J){_=""+J},stopTracking:function(){s._valueTracker=null,delete s[d]}}}}function Qs(s){if(!s._valueTracker){var d=Yr(s)?"checked":"value";s._valueTracker=Fr(s,d,""+s[d])}}function Eo(s){if(!s)return!1;var d=s._valueTracker;if(!d)return!0;var _=d.getValue(),w="";return s&&(w=Yr(s)?s.checked?"true":"false":s.value),s=w,s!==_?(d.setValue(s),!0):!1}function ko(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var rs=/[\n"\\]/g;function Gr(s){return s.replace(rs,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Yo(s,d,_,w,z,O,J,ve){s.name="",J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?s.type=J:s.removeAttribute("type"),d!=null?J==="number"?(d===0&&s.value===""||s.value!=d)&&(s.value=""+ar(d)):s.value!==""+ar(d)&&(s.value=""+ar(d)):J!=="submit"&&J!=="reset"||s.removeAttribute("value"),d!=null?Ss(s,J,ar(d)):_!=null?Ss(s,J,ar(_)):w!=null&&s.removeAttribute("value"),z==null&&O!=null&&(s.defaultChecked=!!O),z!=null&&(s.checked=z&&typeof z!="function"&&typeof z!="symbol"),ve!=null&&typeof ve!="function"&&typeof ve!="symbol"&&typeof ve!="boolean"?s.name=""+ar(ve):s.removeAttribute("name")}function Fo(s,d,_,w,z,O,J,ve){if(O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(s.type=O),d!=null||_!=null){if(!(O!=="submit"&&O!=="reset"||d!=null)){Qs(s);return}_=_!=null?""+ar(_):"",d=d!=null?""+ar(d):_,ve||d===s.value||(s.value=d),s.defaultValue=d}w=w??z,w=typeof w!="function"&&typeof w!="symbol"&&!!w,s.checked=ve?s.checked:!!w,s.defaultChecked=!!w,J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"&&(s.name=J),Qs(s)}function Ss(s,d,_){d==="number"&&ko(s.ownerDocument)===s||s.defaultValue===""+_||(s.defaultValue=""+_)}function os(s,d,_,w){if(s=s.options,d){d={};for(var z=0;z<_.length;z++)d["$"+_[z]]=!0;for(_=0;_<s.length;_++)z=d.hasOwnProperty("$"+s[_].value),s[_].selected!==z&&(s[_].selected=z),z&&w&&(s[_].defaultSelected=!0)}else{for(_=""+ar(_),d=null,z=0;z<s.length;z++){if(s[z].value===_){s[z].selected=!0,w&&(s[z].defaultSelected=!0);return}d!==null||s[z].disabled||(d=s[z])}d!==null&&(d.selected=!0)}}function Ea(s,d,_){if(d!=null&&(d=""+ar(d),d!==s.value&&(s.value=d),_==null)){s.defaultValue!==d&&(s.defaultValue=d);return}s.defaultValue=_!=null?""+ar(_):""}function Lu(s,d,_,w){if(d==null){if(w!=null){if(_!=null)throw Error(F(92));if(Si(w)){if(1<w.length)throw Error(F(93));w=w[0]}_=w}_==null&&(_=""),d=_}_=ar(d),s.defaultValue=_,w=s.textContent,w===_&&w!==""&&w!==null&&(s.value=w),Qs(s)}function Js(s,d){if(d){var _=s.firstChild;if(_&&_===s.lastChild&&_.nodeType===3){_.nodeValue=d;return}}s.textContent=d}var Em=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 lp(s,d,_){var w=d.indexOf("--")===0;_==null||typeof _=="boolean"||_===""?w?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="":w?s.setProperty(d,_):typeof _!="number"||_===0||Em.has(d)?d==="float"?s.cssFloat=_:s[d]=(""+_).trim():s[d]=_+"px"}function Xd(s,d,_){if(d!=null&&typeof d!="object")throw Error(F(62));if(s=s.style,_!=null){for(var w in _)!_.hasOwnProperty(w)||d!=null&&d.hasOwnProperty(w)||(w.indexOf("--")===0?s.setProperty(w,""):w==="float"?s.cssFloat="":s[w]="");for(var z in d)w=d[z],d.hasOwnProperty(z)&&_[z]!==w&&lp(s,z,w)}else for(var O in d)d.hasOwnProperty(O)&&lp(s,O,d[O])}function Gh(s){if(s.indexOf("-")===-1)return!1;switch(s){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 ao=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"]]),Na=/^[\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 as(s){return Na.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Kr(){}var ss=null;function ac(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Es=null,ls=null;function Al(s){var d=li(s);if(d&&(s=d.stateNode)){var _=s[he]||null;e:switch(s=d.stateNode,d.type){case"input":if(Yo(s,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name),d=_.name,_.type==="radio"&&d!=null){for(_=s;_.parentNode;)_=_.parentNode;for(_=_.querySelectorAll('input[name="'+Gr(""+d)+'"][type="radio"]'),d=0;d<_.length;d++){var w=_[d];if(w!==s&&w.form===s.form){var z=w[he]||null;if(!z)throw Error(F(90));Yo(w,z.value,z.defaultValue,z.defaultValue,z.checked,z.defaultChecked,z.type,z.name)}}for(d=0;d<_.length;d++)w=_[d],w.form===s.form&&Eo(w)}break e;case"textarea":Ea(s,_.value,_.defaultValue);break e;case"select":d=_.value,d!=null&&os(s,!!_.multiple,d,!1)}}}var Ou=!1;function cp(s,d,_){if(Ou)return s(d,_);Ou=!0;try{var w=s(d);return w}finally{if(Ou=!1,(Es!==null||ls!==null)&&(Cn(),Es&&(d=Es,s=ls,ls=Es=null,Al(d),s)))for(d=0;d<s.length;d++)Al(s[d])}}function Bu(s,d){var _=s.stateNode;if(_===null)return null;var w=_[he]||null;if(w===null)return null;_=w[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(s=s.type,w=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!w;break e;default:s=!1}if(s)return null;if(_&&typeof _!="function")throw Error(F(231,d,typeof _));return _}var Nr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nc=!1;if(Nr)try{var Ml={};Object.defineProperty(Ml,"passive",{get:function(){Nc=!0}}),window.addEventListener("test",Ml,Ml),window.removeEventListener("test",Ml,Ml)}catch{Nc=!1}var Ko=null,Uc=null,Wd=null;function Yd(){if(Wd)return Wd;var s,d=Uc,_=d.length,w,z="value"in Ko?Ko.value:Ko.textContent,O=z.length;for(s=0;s<_&&d[s]===z[s];s++);var J=_-s;for(w=1;w<=J&&d[_-w]===z[O-w];w++);return Wd=z.slice(s,1<w?1-w:void 0)}function en(s){var d=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&d===13&&(s=13)):s=d,s===10&&(s=13),32<=s||s===13?s:0}function Cl(){return!0}function Hh(){return!1}function sa(s){function d(_,w,z,O,J){this._reactName=_,this._targetInst=z,this.type=w,this.nativeEvent=O,this.target=J,this.currentTarget=null;for(var ve in s)s.hasOwnProperty(ve)&&(_=s[ve],this[ve]=_?_(O):O[ve]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?Cl:Hh,this.isPropagationStopped=Hh,this}return oe(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var _=this.nativeEvent;_&&(_.preventDefault?_.preventDefault():typeof _.returnValue!="unknown"&&(_.returnValue=!1),this.isDefaultPrevented=Cl)},stopPropagation:function(){var _=this.nativeEvent;_&&(_.stopPropagation?_.stopPropagation():typeof _.cancelBubble!="unknown"&&(_.cancelBubble=!0),this.isPropagationStopped=Cl)},persist:function(){},isPersistent:Cl}),d}var sc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lc=sa(sc),cs=oe({},sc,{view:0,detail:0}),qh=sa(cs),ku,up,el,us=oe({},cs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ao,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==el&&(el&&s.type==="mousemove"?(ku=s.screenX-el.screenX,up=s.screenY-el.screenY):up=ku=0,el=s),ku)},movementY:function(s){return"movementY"in s?s.movementY:up}}),Fu=sa(us),Am=oe({},us,{dataTransfer:0}),Vc=sa(Am),Il=oe({},cs,{relatedTarget:0}),No=sa(Il),hs=oe({},sc,{animationName:0,elapsedTime:0,pseudoElement:0}),Kd=sa(hs),Mm=oe({},sc,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),pn=sa(Mm),hp=oe({},sc,{data:0}),dp=sa(hp),Cm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mi={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"},fp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jc(s){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(s):(s=fp[s])?!!d[s]:!1}function Ao(){return jc}var Qd=oe({},cs,{key:function(s){if(s.key){var d=Cm[s.key]||s.key;if(d!=="Unidentified")return d}
vendor: 5,191 bytes, line 48
48return s.type==="keypress"?(s=en(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?mi[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ao,charCode:function(s){return s.type==="keypress"?en(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?en(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),la=sa(Qd),ni=oe({},us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dn=sa(ni),cn=oe({},cs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ao}),Qo=sa(cn),Nu=oe({},sc,{propertyName:0,elapsedTime:0,pseudoElement:0}),yn=sa(Nu),Jd=oe({},us,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Uu=sa(Jd),Gc=oe({},sc,{newState:0,oldState:0}),Uo=sa(Gc),vr=[9,13,27,32],pp=Nr&&"CompositionEvent"in window,Rl=null;Nr&&"documentMode"in document&&(Rl=document.documentMode);var mp=Nr&&"TextEvent"in window&&!Rl,Vu=Nr&&(!pp||Rl&&8<Rl&&11>=Rl),Zh=" ",ef=!1;function $h(s,d){switch(s){case"keyup":return vr.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mo(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var so=!1;function ca(s,d){switch(s){case"compositionend":return Mo(d);case"keypress":return d.which!==32?null:(ef=!0,Zh);case"textInput":return s=d.data,s===Zh&&ef?null:s;default:return null}}function gp(s,d){if(so)return s==="compositionend"||!pp&&$h(s,d)?(s=Yd(),Wd=Uc=Ko=null,so=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return Vu&&d.locale!=="ko"?null:d.data;default:return null}}var cc={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 Ur(s){var d=s&&s.nodeName&&s.nodeName.toLowerCase();return d==="input"?!!cc[s.type]:d==="textarea"}function As(s,d,_,w){Es?ls?ls.push(w):ls=[w]:Es=w,d=Jp(d,"onChange"),0<d.length&&(_=new lc("onChange","change",null,_,w),s.push({event:_,listeners:d}))}var Ua=null,br=null;function uc(s){Yp(s,0)}function bi(s){var d=Mi(s);if(Eo(d))return s}function ti(s,d){if(s==="change")return d}var Hc=!1;if(Nr){var yi;if(Nr){var ju="oninput"in document;if(!ju){var Gu=document.createElement("div");Gu.setAttribute("oninput","return;"),ju=typeof Gu.oninput=="function"}yi=ju}else yi=!1;Hc=yi&&(!document.documentMode||9<document.documentMode)}function di(){Ua&&(Ua.detachEvent("onpropertychange",tf),br=Ua=null)}function tf(s){if(s.propertyName==="value"&&bi(br)){var d=[];As(d,br,s,ac(s)),cp(uc,d)}}function _p(s,d,_){s==="focusin"?(di(),Ua=d,br=_,Ua.attachEvent("onpropertychange",tf)):s==="focusout"&&di()}function tl(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return bi(br)}function Im(s,d){if(s==="click")return bi(d)}function Hu(s,d){if(s==="input"||s==="change")return bi(d)}function ua(s,d){return s===d&&(s!==0||1/s===1/d)||s!==s&&d!==d}var ha=typeof Object.is=="function"?Object.is:ua;function Aa(s,d){if(ha(s,d))return!0;if(typeof s!="object"||s===null||typeof d!="object"||d===null)return!1;var _=Object.keys(s),w=Object.keys(d);if(_.length!==w.length)return!1;for(w=0;w<_.length;w++){var z=_[w];if(!wo.call(d,z)||!ha(s[z],d[z]))return!1}return!0}function Xh(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Va(s,d){var _=Xh(s);s=0;for(var w;_;){if(_.nodeType===3){if(w=s+_.textContent.length,s<=d&&w>=d)return{node:_,offset:d-s};s=w}e:{for(;_;){if(_.nextSibling){_=_.nextSibling;break e}_=_.parentNode}_=void 0}_=Xh(_)}}function zl(s,d){return s&&d?s===d?!0:s&&s.nodeType===3?!1:d&&d.nodeType===3?zl(s,d.parentNode):"contains"in s?s.contains(d):s.compareDocumentPosition?!!(s.compareDocumentPosition(d)&16):!1:!1}function Rm(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var d=ko(s.document);d instanceof s.HTMLIFrameElement;){try{var _=typeof d.contentWindow.location.href=="string"}catch{_=!1}if(_)s=d.contentWindow;else break;d=ko(s.document)}return d}function qc(s){var d=s&&s.nodeName&&s.nodeName.toLowerCase();return d&&(d==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||d==="textarea"||s.contentEditable==="true")}var Wh=Nr&&"documentMode"in document&&11>=document.documentMode,Dl=null,nf=null,Jo=null,rf=!1;function Yh(s,d,_){var w=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;rf||Dl==null||Dl!==ko(w)||(w=Dl,"selectionStart"in w&&qc(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focu
vendor: 22,935 bytes, line 48
48sNode:w.focusNode,focusOffset:w.focusOffset}),Jo&&Aa(Jo,w)||(Jo=w,w=Jp(nf,"onSelect"),0<w.length&&(d=new lc("onSelect","select",null,d,_),s.push({event:d,listeners:w}),d.target=Dl)))}function Ms(s,d){var _={};return _[s.toLowerCase()]=d.toLowerCase(),_["Webkit"+s]="webkit"+d,_["Moz"+s]="moz"+d,_}var ja={animationend:Ms("Animation","AnimationEnd"),animationiteration:Ms("Animation","AnimationIteration"),animationstart:Ms("Animation","AnimationStart"),transitionrun:Ms("Transition","TransitionRun"),transitionstart:Ms("Transition","TransitionStart"),transitioncancel:Ms("Transition","TransitionCancel"),transitionend:Ms("Transition","TransitionEnd")},yp={},xp={};Nr&&(xp=document.createElement("div").style,"AnimationEvent"in window||(delete ja.animationend.animation,delete ja.animationiteration.animation,delete ja.animationstart.animation),"TransitionEvent"in window||delete ja.transitionend.transition);function Zc(s){if(yp[s])return yp[s];if(!ja[s])return s;var d=ja[s],_;for(_ in d)if(d.hasOwnProperty(_)&&_ in xp)return yp[s]=d[_];return s}var of=Zc("animationend"),zm=Zc("animationiteration"),il=Zc("animationstart"),Dm=Zc("transitionrun"),Pm=Zc("transitionstart"),af=Zc("transitioncancel"),sf=Zc("transitionend"),Pl=new Map,ea="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(" ");ea.push("scrollEnd");function Ga(s,d){Pl.set(s,d),or(d,[s])}var qu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(d))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Vo=[],Cs=0,Kh=0;function $c(){for(var s=Cs,d=Kh=Cs=0;d<s;){var _=Vo[d];Vo[d++]=null;var w=Vo[d];Vo[d++]=null;var z=Vo[d];Vo[d++]=null;var O=Vo[d];if(Vo[d++]=null,w!==null&&z!==null){var J=w.pending;J===null?z.next=z:(z.next=J.next,J.next=z),w.pending=z}O!==0&&lf(_,z,O)}}function ta(s,d,_,w){Vo[Cs++]=s,Vo[Cs++]=d,Vo[Cs++]=_,Vo[Cs++]=w,Kh|=w,s.lanes|=w,s=s.alternate,s!==null&&(s.lanes|=w)}function Xc(s,d,_,w){return ta(s,d,_,w),Zu(s)}function Lt(s,d){return ta(s,null,null,d),Zu(s)}function lf(s,d,_){s.lanes|=_;var w=s.alternate;w!==null&&(w.lanes|=_);for(var z=!1,O=s.return;O!==null;)O.childLanes|=_,w=O.alternate,w!==null&&(w.childLanes|=_),O.tag===22&&(s=O.stateNode,s===null||s._visibility&1||(z=!0)),s=O,O=O.return;return s.tag===3?(O=s.stateNode,z&&d!==null&&(z=31-Dr(_),s=O.hiddenUpdates,w=s[z],w===null?s[z]=[d]:w.push(d),d.lane=_|536870912),O):null}function Zu(s){if(50<rn)throw rn=0,Fn=null,Error(F(185));for(var d=s.return;d!==null;)s=d,d=s.return;return s.tag===3?s.stateNode:null}var nl={};function rl(s,d,_,w){this.tag=s,this.key=_,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function da(s,d,_,w){return new rl(s,d,_,w)}function Ll(s){return s=s.prototype,!(!s||!s.isReactComponent)}function fa(s,d){var _=s.alternate;return _===null?(_=da(s.tag,d,s.key,s.mode),_.elementType=s.elementType,_.type=s.type,_.stateNode=s.stateNode,_.alternate=s,s.alternate=_):(_.pendingProps=d,_.type=s.type,_.flags=0,_.subtreeFlags=0,_.deletions=null),_.flags=s.flags&65011712,_.childLanes=s.childLanes,_.lanes=s.lanes,_.child=s.child,_.memoizedProps=s.memoizedProps,_.memoizedState=s.memoizedState,_.updateQueue=s.updateQueue,d=s.dependencies,_.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},_.sibling=s.sibling,_.index=s.index,_.ref=s.ref,_.refCleanup=s.refCleanup,_}function Ol(s,d){s.flags&=65011714;var _=s.alternate;return _===null?(s.childLanes=0,s.lanes=d,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=_.childLanes,s.lanes=_.lanes,s.child=_.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=_.memoizedProps,s.memoizedState=_.memoizedState,s.updateQueue=_.updateQueue,s.type=_.type,d=_.dependencies,s.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),s}function Wc(s,d,_,w,z,O){var J=0;if(w=s,typeof s=="function")Ll(s)&&(J=1);else if(typeof s=="string")J=_y(s,_,Ht.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Ii:return s=da(31,_,d,z),s.elementType=Ii,s.lanes=O,s;case Ne:return hc(_.children,z,O,d);case Je:J=8,z|=24;break;case mt:return s=da(12,_,d,z|2),s.elementType=mt,s.lanes=O,s;case vt:return s=da(13,_,d,z),s.elementType=vt,s.lanes=O,s;case ut:return s=da(19,_,d,z),s.elementType=ut,s.lanes=O,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case dt:J=10;break e;case pt:J=9;break e;case nt:J=11;break e;case rt:J=14;break e;case wt:J=16,w=null;break e}J=29,_=Error(F(130,s===null?"null":typeof s,"")),w=null}return d=da(J,_,d,z),d.elementType=s,d.type=w,d.lanes=O,d}function hc(s,d,_,w){return s=da(7,s,w,d),s.lanes=_,s}function $u(s,d,_){return s=da(6,s,null,d),s.lanes=_,s}function Lm(s){var d=da(18,null,null,0);return d.stateNode=s,d}function cf(s,d,_){return d=da(4,s.children!==null?s.children:[],s.key,d),d.lanes=_,d.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},d}var uf=new WeakMap;function po(s,d){if(typeof s=="object"&&s!==null){var _=uf.get(s);return _!==void 0?_:(d={value:s,source:d,stack:rr(d)},uf.set(s,d),d)}return{value:s,source:d,stack:rr(d)}}var Wi=[],Xu=0,hf=null,Qh=0,Ma=[],ds=0,Sn=null,ol=1,Is="";function Rs(s,d){Wi[Xu++]=Qh,Wi[Xu++]=hf,hf=s,Qh=d}function Jh(s,d,_){Ma[ds++]=ol,Ma[ds++]=Is,Ma[ds++]=Sn,Sn=s;var w=ol;s=Is;var z=32-Dr(w)-1;w&=~(1<<z),_+=1;var O=32-Dr(d)+z;if(30<O){var J=z-z%5;O=(w&(1<<J)-1).toString(32),w>>=J,z-=J,ol=1<<32-Dr(d)+z|_<<z|w,Is=O+s}else ol=1<<O|_<<z|w,Is=s}function ed(s){s.return!==null&&(Rs(s,1),Jh(s,1,0))}function Bl(s){for(;s===hf;)hf=Wi[--Xu],Wi[Xu]=null,Qh=Wi[--Xu],Wi[Xu]=null;for(;s===Sn;)Sn=Ma[--ds],Ma[ds]=null,Is=Ma[--ds],Ma[ds]=null,ol=Ma[--ds],Ma[ds]=null}function Yc(s,d){Ma[ds++]=ol,Ma[ds++]=Is,Ma[ds++]=Sn,ol=d.id,Is=d.overflow,Sn=s}var Qr=null,sr=null,Bn=!1,al=null,Ha=!1,dc=Error(F(519));function zs(s){var d=Error(F(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wu(po(d,s)),dc}function td(s){var d=s.stateNode,_=s.type,w=s.memoizedProps;switch(d[we]=s,d[he]=w,_){case"dialog":On("cancel",d),On("close",d);break;case"iframe":case"object":case"embed":On("load",d);break;case"video":case"audio":for(_=0;_<Ah.length;_++)On(Ah[_],d);break;case"source":On("error",d);break;case"img":case"image":case"link":On("error",d),On("load",d);break;case"details":On("toggle",d);break;case"input":On("invalid",d),Fo(d,w.value,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name,!0);break;case"select":On("invalid",d);break;case"textarea":On("invalid",d),Lu(d,w.value,w.defaultValue,w.children)}_=w.children,typeof _!="string"&&typeof _!="number"&&typeof _!="bigint"||d.textContent===""+_||w.suppressHydrationWarning===!0||ly(d.textContent,_)?(w.popover!=null&&(On("beforetoggle",d),On("toggle",d)),w.onScroll!=null&&On("scroll",d),w.onScrollEnd!=null&&On("scrollend",d),w.onClick!=null&&(d.onclick=Kr),d=!0):d=!1,d||zs(s,!0)}function df(s){for(Qr=s.return;Qr;)switch(Qr.tag){case 5:case 31:case 13:Ha=!1;return;case 27:case 3:Ha=!0;return;default:Qr=Qr.return}}function kl(s){if(s!==Qr)return!1;if(!Bn)return df(s),Bn=!0,!1;var d=s.tag,_;if((_=d!==3&&d!==27)&&((_=d===5)&&(_=s.type,_=!(_!=="form"&&_!=="button")||Dc(s.type,s.memoizedProps)),_=!_),_&&sr&&zs(s),df(s),d===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(F(317));sr=py(s)}else if(d===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(F(317));sr=py(s)}else d===27?(d=sr,qs(s.type)?(s=tm,tm=null,sr=s):sr=d):sr=Qr?xl(s.stateNode.nextSibling):null;return!0}function Ds(){sr=Qr=null,Bn=!1}function ff(){var s=al;return s!==null&&(Ft===null?Ft=s:Ft.push.apply(Ft,s),al=null),s}function Wu(s){al===null?al=[s]:al.push(s)}var pf=Ue(null),fs=null,sl=null;function fc(s,d,_){bt(pf,d._currentValue),d._currentValue=_}function Fl(s){s._currentValue=pf.current,Dt(pf)}function vp(s,d,_){for(;s!==null;){var w=s.alternate;if((s.childLanes&d)!==d?(s.childLanes|=d,w!==null&&(w.childLanes|=d)):w!==null&&(w.childLanes&d)!==d&&(w.childLanes|=d),s===_)break;s=s.return}}function id(s,d,_,w){var z=s.child;for(z!==null&&(z.return=s);z!==null;){var O=z.dependencies;if(O!==null){var J=z.child;O=O.firstContext;e:for(;O!==null;){var ve=O;O=z;for(var Xe=0;Xe<d.length;Xe++)if(ve.context===d[Xe]){O.lanes|=_,ve=O.alternate,ve!==null&&(ve.lanes|=_),vp(O.return,_,s),w||(J=null);break e}O=ve.next}}else if(z.tag===18){if(J=z.return,J===null)throw Error(F(341));J.lanes|=_,O=J.alternate,O!==null&&(O.lanes|=_),vp(J,_,s),J=null}else J=z.child;if(J!==null)J.return=z;else for(J=z;J!==null;){if(J===s){J=null;break}if(z=J.sibling,z!==null){z.return=J.return,J=z;break}J=J.return}z=J}}function pc(s,d,_,w){s=null;for(var z=d,O=!1;z!==null;){if(!O){if((z.flags&524288)!==0)O=!0;else if((z.flags&262144)!==0)break}if(z.tag===10){var J=z.alternate;if(J===null)throw Error(F(387));if(J=J.memoizedProps,J!==null){var ve=z.type;ha(z.pendingProps.value,J.value)||(s!==null?s.push(ve):s=[ve])}}else if(z===Ai.current){if(J=z.alternate,J===null)throw Error(F(387));J.memoizedState.memoizedState!==z.memoizedState.memoizedState&&(s!==null?s.push(bl):s=[bl])}z=z.return}s!==null&&id(d,s,_,w),d.flags|=262144}function Yu(s){for(s=s.firstContext;s!==null;){if(!ha(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Nl(s){fs=s,sl=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Co(s){return nd(fs,s)}function Kc(s,d){return fs===null&&Nl(s),nd(s,d)}function nd(s,d){var _=d._currentValue;if(d={context:d,memoizedValue:_,next:null},sl===null){if(s===null)throw Error(F(308));sl=d,s.dependencies={lanes:0,firstContext:d},s.flags|=524288}else sl=sl.next=d;return _}var Ku=typeof AbortController<"u"?AbortController:function(){var s=[],d=this.signal={aborted:!1,addEventListener:function(_,w){s.push(w)}};this.abort=function(){d.aborted=!0,s.forEach(function(_){return _()})}},rd=E.unstable_scheduleCallback,Om=E.unstable_NormalPriority,Wn={$$typeof:dt,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qu(){return{controller:new Ku,data:new Map,refCount:0}}function Ul(s){s.refCount--,s.refCount===0&&rd(Om,function(){s.controller.abort()})}var qa=null,Ju=0,Vl=0,mc=null;function eh(s,d){if(qa===null){var _=qa=[];Ju=0,Vl=Xp(),mc={status:"pending",value:void 0,then:function(w){_.push(w)}}}return Ju++,d.then(th,th),d}function th(){if(--Ju===0&&qa!==null){mc!==null&&(mc.status="fulfilled");var s=qa;qa=null,Vl=0,mc=null;for(var d=0;d<s.length;d++)(0,s[d])()}}function od(s,d){var _=[],w={status:"pending",value:null,reason:null,then:function(z){_.push(z)}};return s.then(function(){w.status="fulfilled",w.value=d;for(var z=0;z<_.length;z++)(0,_[z])(d)},function(z){for(w.status="rejected",w.reason=z,z=0;z<_.length;z++)(0,_[z])(void 0)}),w}var ad=je.S;je.S=function(s,d){fi=pr(),typeof d=="object"&&d!==null&&typeof d.then=="function"&&eh(s,d),ad!==null&&ad(s,d)};var jl=Ue(null);function sd(){var s=jl.current;return s!==null?s:Re.pooledCache}function ih(s,d){d===null?bt(jl,jl.current):bt(jl,d.pool)}function Qc(){var s=sd();return s===null?null:{parent:Wn._currentValue,pool:s}}var nh=Error(F(460)),bp=Error(F(474)),ld=Error(F(542)),cd={then:function(){}};function ud(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Bm(s,d,_){switch(_=s[_],_===void 0?s.push(d):_!==d&&(d.then(Kr,Kr),d=_),d.status){case"fulfilled":return d.value;case"rejected":throw s=d.reason,gc(s),s;default:if(typeof d.status=="string")d.then(Kr,Kr);else{if(s=Re,s!==null&&100<s.shellSuspendCounter)throw Error(F(482));s=d,s.status="pending",s.then(function(w){if(d.status==="pending"){var z=d;z.status="fulfilled",z.value=w}},function(w){if(d.status==="pending"){var z=d;z.status="rejected",z.reason=w}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw s=d.reason,gc(s),s}throw Gl=d,nh}}function ll(s){try{var d=s._init;return d(s._payload)}catch(_){throw _!==null&&typeof _=="object"&&typeof _.then=="function"?(Gl=_,nh):_}}var Gl=null;function wp(){if(Gl===null)throw Error(F(459));var s=Gl;return Gl=null,s}function gc(s){if(s===nh||s===ld)throw Error(F(483))}var _c=null,rh=0;function hd(s){var d=rh;return rh+=1,_c===null&&(_c=[]),Bm(_c,s,d)}function Jc(s,d){d=d.props.ref,s.ref=d!==void 0?d:null}function Ps(s,d){throw d.$$typeof===ke?Error(F(525)):(s=Object.prototype.toString.call(d),Error(F(31,s==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":s)))}function yc(s){function d(xt,et){if(s){var Rt=xt.deletions;Rt===null?(xt.deletions=[et],xt.flags|=16):Rt.push(et)}}function _(xt,et){if(!s)return null;for(;et!==null;)d(xt,et),et=et.sibling;return null}function w(xt){for(var et=new Map;xt!==null;)xt.key!==null?et.set(xt.key,xt):et.set(xt.index,xt),xt=xt.sibling;return et}function z(xt,et){return xt=fa(xt,et),xt.index=0,xt.sibling=null,xt}function O(xt,et,Rt){return xt.index=Rt,s?(Rt=xt.alternate,Rt!==null?(Rt=Rt.index,Rt<et?(xt.flags|=67108866,et):Rt):(xt.flags|=67108866,et)):(xt.flags|=1048576,et)}function J(xt){return s&&xt.alternate===null&&(xt.flags|=67108866),xt}function ve(xt,et,Rt,Kt){return et===null||et.tag!==6?(et=$u(Rt,xt.mode,Kt),et.return=xt,et):(et=z(et,Rt),et.return=xt,et)}function Xe(xt,et,Rt,Kt){var nn=Rt.type;return nn===Ne?Xt(xt,et,Rt.props.children,Kt,Rt.key):et!==null&&(et.elementType===nn||typeof nn=="object"&&nn!==null&&nn.$$typeof===wt&&ll(nn)===et.type)?(et=z(et,Rt.props),Jc(et,Rt),et.return=xt,et):(et=Wc(Rt.type,Rt.key,Rt.props,null,xt.mode,Kt),Jc(et,Rt),et.return=xt,et)}function Pt(xt,et,Rt,Kt){return et===null||et.tag!==4||et.stateNode.containerInfo!==Rt.containerInfo||et.stateNode.implementation!==Rt.implementation?(et=cf(Rt,xt.mode,Kt),et.return=xt,et):(et=z(et,Rt.children||[]),et.return=xt,et)}function Xt(xt,et,Rt,Kt,nn){return et===null||et.tag!==7?(et=hc(Rt,xt.mode,Kt,nn),et.return=xt,et):(et=z(et,Rt),et.return=xt,et)}function Jt(xt,et,Rt){if(typeof et=="string"&&et!==""||typeof et=="number"||typeof et=="bigint")return et=$u(""+et,xt.mode,Rt),et.return=xt,et;if(typeof et=="object"&&et!==null){switch(et.$$typeof){case Qe:return Rt=Wc(et.type,et.key,et.props,null,xt.mode,Rt),Jc(Rt,et),Rt.return=xt,Rt;case ft:return et=cf(et,xt.mode,Rt),et.return=xt,et;case wt:return et=ll(et),Jt(xt,et,Rt)}if(Si(et)||ai(et))return et=hc(et,xt.mode,Rt,null),et.return=xt,et;if(typeof et.then=="function")return Jt(xt,hd(et),Rt);if(et.$$typeof===dt)return Jt(xt,Kc(xt,et),Rt);Ps(xt,et)}return null}function Ot(xt,et,Rt,Kt){var nn=et!==null?et.key:null;if(typeof Rt=="string"&&Rt!==""||typeof Rt=="number"||typeof Rt=="bigint")return nn!==null?null:ve(xt,et,""+Rt,Kt);if(typeof Rt=="object"&&Rt!==null){switch(Rt.$$typeof){case Qe:return Rt.key===nn?Xe(xt,et,Rt,Kt):null;case ft:return Rt.key===nn?Pt(xt,et,Rt,Kt):null;case wt:return Rt=ll(Rt),Ot(xt,et,Rt,Kt)}if(Si(Rt)||ai(Rt))return nn!==null?null:Xt(xt,et,Rt,Kt,null);if(typeof Rt.then=="function")return Ot(xt,et,hd(Rt),Kt);if(Rt.$$typeof===dt)return Ot(xt,et,Kc(xt,Rt),Kt);Ps(xt,Rt)}return null}function jt(xt,et,Rt,Kt,nn){if(typeof Kt=="string"&&Kt!==""||typeof Kt=="number"||typeof Kt=="bigint")return xt=xt.get(Rt)||null,ve(et,xt,""+Kt,nn);if(typeof Kt=="object"&&Kt!==null){switch(Kt.$$typeof){case Qe:return xt=xt.get(Kt.key===null?Rt:Kt.key)||null,Xe(et,xt,Kt,nn);case ft:return xt=xt.get(Kt.key===null?Rt:Kt.key)||null,Pt(et,xt,Kt,nn);case wt:return Kt=ll(Kt),jt(xt,et,Rt,Kt,nn)}if(Si(Kt)||ai(Kt))return xt=xt.get(Rt)||null,Xt(et,xt,Kt,nn,null);if(typeof Kt.then=="function")return jt(xt,et,Rt,hd(Kt),nn);if(Kt.$$typeof===dt)return jt(xt,et,Rt,Kc(et,Kt),nn);Ps(et,Kt)}return null}function Fi(xt,et,Rt,Kt){for(var nn=null,er=null,qi=et,In=et=0,Gn=null;qi!==null&&In<Rt.length;In++){qi.index>In?(Gn=qi,qi=null):Gn=qi.sibling;var Qn=Ot(xt,qi,Rt[In],Kt);if(Qn===null){qi===null&&(qi=Gn);break}s&&qi&&Qn.alternate===null&&d(xt,qi),et=O(Qn,et,In),er===null?nn=Qn:er.sibling=Qn,er=Qn,qi=Gn}if(In===Rt.length)return _(xt,qi),Bn&&Rs(xt,In),nn;if(qi===null){for(;In<Rt.length;In++)qi=Jt(xt,Rt[In],Kt),qi!==null&&(et=O(qi,et,In),er===null?nn=qi:er.sibling=qi,er=qi);return Bn&&Rs(xt,In),nn}for(qi=w(qi);In<Rt.length;In++)Gn=jt(qi,xt,In,Rt[In],Kt),Gn!==null&&(s&&Gn.alternate!==null&&qi.delete(Gn.key===null?In:Gn.key),et=O(Gn,et,In),er===null?nn=Gn:er.sibling=Gn,er=Gn);return s&&qi.forEach(function(ec){return d(xt,ec)}),Bn&&Rs(xt,In),nn}function Qi(xt,et,Rt,Kt){if(Rt==null)throw Error(F(151));for(var nn=null,er=null,qi=et,In=et=0,Gn=null,Qn=Rt.next();qi!==null&&!Qn.done;In++,Qn=Rt.next()){qi.index>In?(Gn=qi,qi=null):Gn=qi.sibling;var ec=Ot(xt,qi,Qn.value,Kt);if(ec===null){qi===null&&(qi=Gn);break}s&&qi&&ec.alternate===null&&d(xt,qi),et=O(ec,et,In),er===null?nn=ec:er.sibling=ec,er=ec,qi=Gn}if(Qn.done)return _(xt,qi),Bn&&Rs(xt,In),nn;if(qi===null){for(;!Qn.done;In++,Qn=Rt.next())Qn=Jt(xt,Qn.value,Kt),Qn!==null&&(et=O(Qn,et,In),er===null?nn=Qn:er.sibling=Qn,er=Qn);return Bn&&Rs(xt,In),nn}for(qi=w(qi);!Qn.done;In++,Qn=Rt.next())Qn=jt(qi,xt,In,Qn.value,Kt),Qn!==null&&(s&&Qn.alternate!==null&&qi.delete(Qn.key===null?In:Qn.key),et=O(Qn,et,In),er===null?nn=Qn:er.sibling=Qn,er=Qn);return s&&qi.forEach(function(Ry){return d(xt,Ry)}),Bn&&Rs(xt,In),nn}function hr(xt,et,Rt,Kt){if(typeof Rt=="object"&&Rt!==null&&Rt.type===Ne&&Rt.key===null&&(Rt=Rt.props.children),typeof Rt=="object"&&Rt!==null){switch(Rt.$$typeof){case Qe:e:{for(var nn=Rt.key;et!==null;){if(et.key===nn){if(nn=Rt.type,nn===Ne){if(et.tag===7){_(xt,et.sibling),Kt=z(et,Rt.props.children),Kt.return=xt,xt=Kt;break e}}else if(et.elementType===nn||typeof nn=="object"&&nn!==null&&nn.$$typeof===wt&&ll(nn)===et.type){_(xt,et.sibling),Kt=z(et,Rt.props),Jc(Kt,Rt),Kt.return=xt,xt=Kt;break e}_(xt,et);break}else d(xt,et);et=et.sibling}Rt.type===Ne?(Kt=hc(Rt.props.children,xt.mode,Kt,Rt.key),Kt.return=xt,xt=Kt):(Kt=Wc(Rt.type,Rt.key,Rt.props,null,xt.mode,Kt),Jc(Kt,Rt),Kt.return=xt,xt=Kt)}return J(xt);case ft:e:{for(nn=Rt.key;et!==null;){if(et.key===nn)if(et.tag===4&&et.stateNode.containerInfo===Rt.containerInfo&&et.stateNode.implementation===Rt.implementation){_(xt,et.sibling),Kt=z(et,Rt.children||[]),Kt.return=xt,xt=Kt;break e}else{_(xt,et);break}else d(xt,et);et=et.sibling}Kt=cf(Rt,xt.mode,Kt),Kt.return=xt,xt=Kt}return J(xt);case wt:return Rt=ll(Rt),hr(xt,et,Rt,Kt)}if(Si(Rt))return Fi(xt,et,Rt,Kt);if(ai(Rt)){if(nn=ai(Rt),typeof nn!="function")throw Error(F(150));return Rt=nn.call(Rt),Qi(xt,et,Rt,Kt)}if(typeof Rt.then=="function")return hr(xt,et,hd(Rt),Kt);if(Rt.$$typeof===dt)return hr(xt,et,Kc(xt,Rt),Kt);Ps(xt,Rt)}return typeof Rt=="string"&&Rt!==""||typeof Rt=="number"||typeof Rt=="bigint"?(Rt=""+Rt,et!==null&&et.tag===6?(_(xt,et.sibling),Kt=z(et,Rt),Kt.return=xt,xt=Kt):(_(xt,et),Kt=$u(Rt,xt.mode,Kt),Kt.return=xt,xt=Kt),J(xt)):_(xt,et)}return function(xt,et,Rt,Kt){try{rh=0;var nn=hr(xt,et,Rt,Kt);return _c=null,nn}catch(qi){if(qi===nh||qi===ld)throw qi;var er=da(29,qi,null,xt.mode);return er.lanes=Kt,er.return=xt,er}finally{}}}var cl=yc(!0),Tp=yc(!1),pa=!1;function dd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function oh(s,d){s=s.updateQueue,d.updateQueue===s&&(d.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ul(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Hl(s,d,_){var w=s.updateQueue;if(w===null)return null;if(w=w.shared,(Ae&2)!==0){var z=w.pending;return z===null?d.next=d:(d.next=z.next,z.next=d),w.pending=d,d=Zu(s),lf(s,null,_),d}return ta(s,w,d,_),Zu(s)}function eu(s,d,_){if(d=d.updateQueue,d!==null&&(d=d.shared,(_&4194048)!==0)){var w=d.lanes;w&=s.pendingLanes,_|=w,d.lanes=_,Wo(s,_)}}function ah(s,d){var _=s.updateQueue,w=s.alternate;if(w!==null&&(w=w.updateQueue,_===w)){var z=null,O=null;if(_=_.firstBaseUpdate,_!==null){do{var J={lane:_.lane,tag:_.tag,payload:_.payload,callback:null,next:null};O===null?z=O=J:O=O.next=J,_=_.next}while(_!==null);O===null?z=O=d:O=O.next=d}else z=O=d;_={baseState:w.baseState,firstBaseUpdate:z,lastBaseUpdate:O,shared:w.shared,callbacks:w.callbacks},s.updateQueue=_;return}s=_.lastBaseUpdate,s===null?_.firstBaseUpdate=d:s.next=d,_.lastBaseUpdate=d}var mf=!1;function tu(){if(mf){var s=mc;if(s!==null)throw s}}function ql(s,d,_,w){mf=!1;var z=s.updateQueue;pa=!1;var O=z.firstBaseUpdate,J=z.lastBaseUpdate,ve=z.shared.pending;if(ve!==null){z.shared.pending=null;var Xe=ve,Pt=Xe.next;Xe.next=null,J===null?O=Pt:J.next=Pt,J=Xe;var Xt=s.alternate;Xt!==null&&(Xt=Xt.updateQueue,ve=Xt.lastBaseUpdate,ve!==J&&(ve===null?Xt.firstBaseUpdate=Pt:ve.next=Pt,Xt.lastBaseUpdate=Xe))}if(O!==null){var Jt=z.baseState;J=0,Xt=Pt=Xe=null,ve=O;do{var Ot=ve.lane&-536870913,jt=Ot!==ve.lane;if(jt?(Le&Ot)===Ot:(w&Ot)===Ot){Ot!==0&&Ot===Vl&&(mf=!0),Xt!==null&&(Xt=Xt.next={lane:0,tag:ve.tag,payload:ve.payload,callback:null,next:null});e:{var Fi=s,Qi=ve;Ot=d;var hr=_;switch(Qi.tag){case 1:if(Fi=Qi.payload,typeof Fi=="function"){Jt=Fi.call(hr,Jt,Ot);break e}Jt=Fi;break e;case 3:Fi.flags=Fi.flags&-65537|128;case 0:if(Fi=Qi.payload,Ot=typeof Fi=="function"?Fi.call(hr,Jt,Ot):Fi,Ot==null)break e;Jt=oe({},Jt,Ot);break e;case 2:pa=!0}}Ot=ve.callback,Ot!==null&&(s.flags|=64,jt&&(s.flags|=8192),jt=z.callbacks,jt===null?z.callbacks=[Ot]:jt.push(Ot))}else jt={lane:Ot,tag:ve.tag,payload:ve.payload,callback:ve.callback,next:null},Xt===null?(Pt=Xt=jt,Xe=Jt):Xt=Xt.next=jt,J|=Ot;if(ve=ve.next,ve===null){if(ve=z.shared.pending,ve===null)break;jt=ve,ve=jt.next,jt.next=null,z.lastBaseUpdate=jt,z.shared.pending=null}}while(!0);Xt===null&&(Xe=Jt),z.baseState=Xe,z.firstBaseUpdate=Pt,z.lastBaseUpdate=Xt,O===null&&(z.shared.lanes=0),Et|=J,s.lanes=J,s.memoizedState=Jt}}function iu(s,d){if(typeof s!="function")throw Error(F(191,s));s.call(d)}function km(s,d){var _=s.callbacks;
vendor: 2,593 bytes, line 48
48if(_!==null)for(s.callbacks=null,s=0;s<_.length;s++)iu(_[s],d)}var nu=Ue(null),gf=Ue(0);function fd(s,d){s=Ve,bt(gf,s),bt(nu,d),Ve=s|d.baseLanes}function ru(){bt(gf,Ve),bt(nu,nu.current)}function hl(){Ve=gf.current,Dt(nu),Dt(gf)}var jo=Ue(null),Io=null;function Ls(s){var d=s.alternate;bt(Jr,Jr.current&1),bt(jo,s),Io===null&&(d===null||nu.current!==null||d.memoizedState!==null)&&(Io=s)}function ou(s){bt(Jr,Jr.current),bt(jo,s),Io===null&&(Io=s)}function pd(s){s.tag===22?(bt(Jr,Jr.current),bt(jo,s),Io===null&&(Io=s)):Go()}function Go(){bt(Jr,Jr.current),bt(jo,jo.current)}function Ca(s){Dt(jo),Io===s&&(Io=null),Dt(Jr)}var Jr=Ue(0);function dl(s){for(var d=s;d!==null;){if(d.tag===13){var _=d.memoizedState;if(_!==null&&(_=_.dehydrated,_===null||Jg(_)||e_(_)))return d}else if(d.tag===19&&(d.memoizedProps.revealOrder==="forwards"||d.memoizedProps.revealOrder==="backwards"||d.memoizedProps.revealOrder==="unstable_legacy-backwards"||d.memoizedProps.revealOrder==="together")){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break;for(;d.sibling===null;){if(d.return===null||d.return===s)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var ps=0,zt=null,lr=null,cr=null,ms=!1,au=!1,xc=!1,su=0,vc=0,bc=null,Sp=0;function wr(){throw Error(F(321))}function wc(s,d){if(d===null)return!1;for(var _=0;_<d.length&&_<s.length;_++)if(!ha(s[_],d[_]))return!1;return!0}function lu(s,d,_,w,z,O){return ps=O,zt=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,je.H=s===null||s.memoizedState===null?If:Ed,xc=!1,O=_(w,z),xc=!1,au&&(O=Ep(d,_,w,z)),Os(s),O}function Os(s){je.H=ks;var d=lr!==null&&lr.next!==null;if(ps=0,cr=lr=zt=null,ms=!1,vc=0,bc=null,d)throw Error(F(300));s===null||Hr||(s=s.dependencies,s!==null&&Yu(s)&&(Hr=!0))}function Ep(s,d,_,w){zt=s;var z=0;do{if(au&&(bc=null),vc=0,au=!1,25<=z)throw Error(F(301));if(z+=1,cr=lr=null,s.updateQueue!=null){var O=s.updateQueue;O.lastEffect=null,O.events=null,O.stores=null,O.memoCache!=null&&(O.memoCache.index=0)}je.H=kp,O=d(_,w)}while(au);return O}function Fm(){var s=je.H,d=s.useState()[0];return d=typeof d.then=="function"?Tc(d):d,s=s.useState()[0],(lr!==null?lr.memoizedState:null)!==s&&(zt.flags|=1024),d}function _f(){var s=su!==0;return su=0,s}function yf(s,d,_){d.updateQueue=s.updateQueue,d.flags&=-2053,s.lanes&=~_}function md(s){if(ms){for(s=s.memoizedState;s!==null;){var d=s.queue;d!==null&&(d.pending=null),s=s.next}ms=!1}ps=0,cr=lr=zt=null,au=!1,vc=su=0,bc=null}function lo(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};
vendor: 15,563 bytes, line 48
48return cr===null?zt.memoizedState=cr=s:cr=cr.next=s,cr}function Pr(){if(lr===null){var s=zt.alternate;s=s!==null?s.memoizedState:null}else s=lr.next;var d=cr===null?zt.memoizedState:cr.next;if(d!==null)cr=d,lr=s;else{if(s===null)throw zt.alternate===null?Error(F(467)):Error(F(310));lr=s,s={memoizedState:lr.memoizedState,baseState:lr.baseState,baseQueue:lr.baseQueue,queue:lr.queue,next:null},cr===null?zt.memoizedState=cr=s:cr=cr.next=s}return cr}function sh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tc(s){var d=vc;return vc+=1,bc===null&&(bc=[]),s=Bm(bc,s,d),d=zt,(cr===null?d.memoizedState:cr.next)===null&&(d=d.alternate,je.H=d===null||d.memoizedState===null?If:Ed),s}function gd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Tc(s);if(s.$$typeof===dt)return Co(s)}throw Error(F(438,String(s)))}function xf(s){var d=null,_=zt.updateQueue;if(_!==null&&(d=_.memoCache),d==null){var w=zt.alternate;w!==null&&(w=w.updateQueue,w!==null&&(w=w.memoCache,w!=null&&(d={data:w.data.map(function(z){return z.slice()}),index:0})))}if(d==null&&(d={data:[],index:0}),_===null&&(_=sh(),zt.updateQueue=_),_.memoCache=d,_=d.data[d.index],_===void 0)for(_=d.data[d.index]=Array(s),w=0;w<s;w++)_[w]=ji;return d.index++,_}function Bs(s,d){return typeof d=="function"?d(s):d}function _d(s){var d=Pr();return yd(d,lr,s)}function yd(s,d,_){var w=s.queue;if(w===null)throw Error(F(311));w.lastRenderedReducer=_;var z=s.baseQueue,O=w.pending;if(O!==null){if(z!==null){var J=z.next;z.next=O.next,O.next=J}d.baseQueue=z=O,w.pending=null}if(O=s.baseState,z===null)s.memoizedState=O;else{d=z.next;var ve=J=null,Xe=null,Pt=d,Xt=!1;do{var Jt=Pt.lane&-536870913;if(Jt!==Pt.lane?(Le&Jt)===Jt:(ps&Jt)===Jt){var Ot=Pt.revertLane;if(Ot===0)Xe!==null&&(Xe=Xe.next={lane:0,revertLane:0,gesture:null,action:Pt.action,hasEagerState:Pt.hasEagerState,eagerState:Pt.eagerState,next:null}),Jt===Vl&&(Xt=!0);else if((ps&Ot)===Ot){Pt=Pt.next,Ot===Vl&&(Xt=!0);continue}else Jt={lane:0,revertLane:Pt.revertLane,gesture:null,action:Pt.action,hasEagerState:Pt.hasEagerState,eagerState:Pt.eagerState,next:null},Xe===null?(ve=Xe=Jt,J=O):Xe=Xe.next=Jt,zt.lanes|=Ot,Et|=Ot;Jt=Pt.action,xc&&_(O,Jt),O=Pt.hasEagerState?Pt.eagerState:_(O,Jt)}else Ot={lane:Jt,revertLane:Pt.revertLane,gesture:Pt.gesture,action:Pt.action,hasEagerState:Pt.hasEagerState,eagerState:Pt.eagerState,next:null},Xe===null?(ve=Xe=Ot,J=O):Xe=Xe.next=Ot,zt.lanes|=Jt,Et|=Jt;Pt=Pt.next}while(Pt!==null&&Pt!==d);if(Xe===null?J=O:Xe.next=ve,!ha(O,s.memoizedState)&&(Hr=!0,Xt&&(_=mc,_!==null)))throw _;s.memoizedState=O,s.baseState=J,s.baseQueue=Xe,w.lastRenderedState=O}return z===null&&(w.lanes=0),[s.memoizedState,w.dispatch]}function vf(s){var d=Pr(),_=d.queue;if(_===null)throw Error(F(311));_.lastRenderedReducer=s;var w=_.dispatch,z=_.pending,O=d.memoizedState;if(z!==null){_.pending=null;var J=z=z.next;do O=s(O,J.action),J=J.next;while(J!==z);ha(O,d.memoizedState)||(Hr=!0),d.memoizedState=O,d.baseQueue===null&&(d.baseState=O),_.lastRenderedState=O}return[O,w]}function bf(s,d,_){var w=zt,z=Pr(),O=Bn;if(O){if(_===void 0)throw Error(F(407));_=_()}else _=d();var J=!ha((lr||z).memoizedState,_);if(J&&(z.memoizedState=_,Hr=!0),z=z.queue,cu(Nm.bind(null,w,z,s),[s]),z.getSnapshot!==d||J||cr!==null&&cr.memoizedState.tag&1){if(w.flags|=2048,Sc(9,{destroy:void 0},Tf.bind(null,w,z,_,d),null),Re===null)throw Error(F(349));O||(ps&127)!==0||wf(w,d,_)}return _}function wf(s,d,_){s.flags|=16384,s={getSnapshot:d,value:_},d=zt.updateQueue,d===null?(d=sh(),zt.updateQueue=d,d.stores=[s]):(_=d.stores,_===null?d.stores=[s]:_.push(s))}function Tf(s,d,_,w){d.value=_,d.getSnapshot=w,Um(d)&&Ap(s)}function Nm(s,d,_){return _(function(){Um(d)&&Ap(s)})}function Um(s){var d=s.getSnapshot;s=s.value;try{var _=d();return!ha(s,_)}catch{return!0}}function Ap(s){var d=Lt(s,2);d!==null&&Ci(d,s,2)}function fl(s){var d=lo();if(typeof s=="function"){var _=s;if(s=_(),xc){mr(!0);try{_()}finally{mr(!1)}}}return d.memoizedState=d.baseState=s,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:s},d}function Mp(s,d,_,w){return s.baseState=_,yd(s,lr,typeof w=="function"?w:Bs)}function Cp(s,d,_,w,z){if(Td(s))throw Error(F(485));if(s=d.action,s!==null){var O={payload:z,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(J){O.listeners.push(J)}};je.T!==null?_(!0):O.isTransition=!1,w(O),_=d.pending,_===null?(O.next=d.pending=O,xd(d,O)):(O.next=_.next,d.pending=_.next=O)}}function xd(s,d){var _=d.action,w=d.payload,z=s.state;if(d.isTransition){var O=je.T,J={};je.T=J;try{var ve=_(z,w),Xe=je.S;Xe!==null&&Xe(J,ve),Ip(s,d,ve)}catch(Pt){pl(s,d,Pt)}finally{O!==null&&J.types!==null&&(O.types=J.types),je.T=O}}else try{O=_(z,w),Ip(s,d,O)}catch(Pt){pl(s,d,Pt)}}function Ip(s,d,_){_!==null&&typeof _=="object"&&typeof _.then=="function"?_.then(function(w){Vm(s,d,w)},function(w){return pl(s,d,w)}):Vm(s,d,_)}function Vm(s,d,_){d.status="fulfilled",d.value=_,ia(d),s.state=_,d=s.pending,d!==null&&(_=d.next,_===d?s.pending=null:(_=_.next,d.next=_,xd(s,_)))}function pl(s,d,_){var w=s.pending;if(s.pending=null,w!==null){w=w.next;do d.status="rejected",d.reason=_,ia(d),d=d.next;while(d!==w)}s.action=null}function ia(s){s=s.listeners;for(var d=0;d<s.length;d++)(0,s[d])()}function Zl(s,d){return d}function Ho(s,d){if(Bn){var _=Re.formState;if(_!==null){e:{var w=zt;if(Bn){if(sr){t:{for(var z=sr,O=Ha;z.nodeType!==8;){if(!O){z=null;break t}if(z=xl(z.nextSibling),z===null){z=null;break t}}O=z.data,z=O==="F!"||O==="F"?z:null}if(z){sr=xl(z.nextSibling),w=z.data==="F!";break e}}zs(w)}w=!1}w&&(d=_[0])}}return _=lo(),_.memoizedState=_.baseState=d,w={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zl,lastRenderedState:d},_.queue=w,_=uh.bind(null,zt,w),w.dispatch=_,w=fl(!1),O=wd.bind(null,zt,!1,w.queue),w=lo(),z={state:d,dispatch:null,action:s,pending:null},w.queue=z,_=Cp.bind(null,zt,z,O,_),z.dispatch=_,w.memoizedState=s,[d,_,!1]}function $l(s){var d=Pr();return Rp(d,lr,s)}function Rp(s,d,_){if(d=yd(s,d,Zl)[0],s=_d(Bs)[0],typeof d=="object"&&d!==null&&typeof d.then=="function")try{var w=Tc(d)}catch(J){throw J===nh?ld:J}else w=d;d=Pr();var z=d.queue,O=z.dispatch;return _!==d.memoizedState&&(zt.flags|=2048,Sc(9,{destroy:void 0},zp.bind(null,z,_),null)),[w,O,s]}function zp(s,d){s.action=d}function Sf(s){var d=Pr(),_=lr;if(_!==null)return Rp(d,_,s);Pr(),d=d.memoizedState,_=Pr();var w=_.queue.dispatch;return _.memoizedState=s,[d,w,!1]}function Sc(s,d,_,w){return s={tag:s,create:_,deps:w,inst:d,next:null},d=zt.updateQueue,d===null&&(d=sh(),zt.updateQueue=d),_=d.lastEffect,_===null?d.lastEffect=s.next=s:(w=_.next,_.next=s,s.next=w,d.lastEffect=s),s}function Ef(){return Pr().memoizedState}function Ia(s,d,_,w){var z=lo();zt.flags|=s,z.memoizedState=Sc(1|d,{destroy:void 0},_,w===void 0?null:w)}function mn(s,d,_,w){var z=Pr();w=w===void 0?null:w;var O=z.memoizedState.inst;lr!==null&&w!==null&&wc(w,lr.memoizedState.deps)?z.memoizedState=Sc(d,O,_,w):(zt.flags|=s,z.memoizedState=Sc(1|d,O,_,w))}function lh(s,d){Ia(8390656,8,s,d)}function cu(s,d){mn(2048,8,s,d)}function ch(s){zt.flags|=4;var d=zt.updateQueue;if(d===null)d=sh(),zt.updateQueue=d,d.events=[s];else{var _=d.events;_===null?d.events=[s]:_.push(s)}}function Dp(s){var d=Pr().memoizedState;return ch({ref:d,nextImpl:s}),function(){if((Ae&2)!==0)throw Error(F(440));return d.impl.apply(void 0,arguments)}}function Pp(s,d){return mn(4,2,s,d)}function Af(s,d){return mn(4,4,s,d)}function Ec(s,d){if(typeof d=="function"){s=s();var _=d(s);return function(){typeof _=="function"?_():d(null)}}if(d!=null)return s=s(),d.current=s,function(){d.current=null}}function qo(s,d,_){_=_!=null?_.concat([s]):null,mn(4,4,Ec.bind(null,d,s),_)}function It(){}function Ut(s,d){var _=Pr();d=d===void 0?null:d;var w=_.memoizedState;return d!==null&&wc(d,w[1])?w[0]:(_.memoizedState=[s,d],s)}function uu(s,d){var _=Pr();d=d===void 0?null:d;var w=_.memoizedState;if(d!==null&&wc(d,w[1]))return w[0];if(w=s(),xc){mr(!0);try{s()}finally{mr(!1)}}return _.memoizedState=[w,d],w}function qn(s,d,_){return _===void 0||(ps&1073741824)!==0&&(Le&261930)===0?s.memoizedState=d:(s.memoizedState=_,s=un(),zt.lanes|=s,Et|=s,_)}function Oe(s,d,_,w){return ha(_,d)?_:nu.current!==null?(s=qn(s,_,w),ha(s,d)||(Hr=!0),s):(ps&42)===0||(ps&1073741824)!==0&&(Le&261930)===0?(Hr=!0,s.memoizedState=_):(s=un(),zt.lanes|=s,Et|=s,d)}function Lp(s,d,_,w,z){var O=St.p;St.p=O!==0&&8>O?O:8;var J=je.T,ve={};je.T=ve,wd(s,!1,d,_);try{var Xe=z(),Pt=je.S;if(Pt!==null&&Pt(ve,Xe),Xe!==null&&typeof Xe=="object"&&typeof Xe.then=="function"){var Xt=od(Xe,w);Ra(s,d,Xt,_n(s))}else Ra(s,d,w,_n(s))}catch(Jt){Ra(s,d,{then:function(){},status:"rejected",reason:Jt},_n())}finally{St.p=O,J!==null&&ve.types!==null&&(J.types=ve.types),je.T=J}}function Mf(){}function vd(s,d,_,w){if(s.tag!==5)throw Error(F(476));var z=Cf(s).queue;Lp(s,z,d,Tt,_===null?Mf:function(){return Op(s),_(w)})}function Cf(s){var d=s.memoizedState;if(d!==null)return d;d={memoizedState:Tt,baseState:Tt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:Tt},next:null};var _={};return d.next={memoizedState:_,baseState:_,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:_},next:null},s.memoizedState=d,s=s.alternate,s!==null&&(s.memoizedState=d),d}function Op(s){var d=Cf(s);d.next===null&&(d=s.alternate.memoizedState),Ra(s,d.next.queue,{},_n())}function bd(){return Co(bl)}function hu(){return Pr().memoizedState}function jm(){return Pr().memoizedState}function jg(s){for(var d=s.return;d!==null;){switch(d.tag){case 24:case 3:var _=_n();s=ul(_);var w=Hl(d,s,_);w!==null&&(Ci(w,d,_),eu(w,d,_)),d={cache:Qu()},s.payload=d;return}d=d.return}}function Bp(s,d,_){var w=_n();_={lane:w,revertLane:0,gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null},Td(s)?Sd(d,_):(_=Xc(s,d,_,w),_!==null&&(Ci(_,s,w),hh(_,d,w)))}function uh(s,d,_){var w=_n();Ra(s,d,_,w)}function Ra(s,d,_,w){var z={lane:w,revertLane:0,gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null};if(Td(s))Sd(d,z);else{var O=s.alternate;if(s.lanes===0&&(O===null||O.lanes===0)&&(O=d.lastRenderedReducer,O!==null))try{var J=d.lastRenderedState,ve=O(J,_);if(z.hasEagerState=!0,z.eagerState=ve,ha(ve,J))return ta(s,d,z,0),Re===null&&$c(),!1}catch{}finally{}if(_=Xc(s,d,z,w),_!==null)return Ci(_,s,w),hh(_,d,w),!0}return!1}function wd(s,d,_,w){if(w={lane:2,revertLane:Xp(),gesture:null,action:w,hasEagerState:!1,eagerState:null,next:null},Td(s)){if(d)throw Error(F(479))}else d=Xc(s,_,w,2),d!==null&&Ci(d,s,2)}function Td(s){var d=s.alternate;return s===zt||d!==null&&d===zt}function Sd(s,d){au=ms=!0;var _=s.pending;_===null?d.next=d:(d.next=_.next,_.next=d),s.pending=d}function hh(s,d,_){if((_&4194048)!==0){var w=d.lanes;w&=s.pendingLanes,_|=w,d.lanes=_,Wo(s,_)}}var ks={readContext:Co,use:gd,useCallback:wr,useContext:wr,useEffect:wr,useImperativeHandle:wr,useLayoutEffect:wr,useInsertionEffect:wr,useMemo:wr,useReducer:wr,useRef:wr,useState:wr,useDebugValue:wr,useDeferredValue:wr,useTransition:wr,useSyncExternalStore:wr,useId:wr,useHostTransitionStatus:wr,useFormState:wr,useActionState:wr,useOptimistic:wr,useMemoCache:wr,useCacheRefresh:wr};ks.useEffectEvent=wr;var If={readContext:Co,use:gd,useCallback:function(s,d){return lo().memoizedState=[s,d===void 0?null:d],s},useContext:Co,useEffect:lh,useImperativeHandle:function(s,d,_){_=_!=null?_.concat([s]):null,Ia(4194308,4,Ec.bind(null,d,s),_)},useLayoutEffect:function(s,d){return Ia(4194308,4,s,d)},useInsertionEffect:function(s,d){Ia(4,2,s,d)},useMemo:function(s,d){var _=lo();d=d===void 0?null:d;var w=s();if(xc){mr(!0);try{s()}finally{mr(!1)}}return _.memoizedState=[w,d],w},useReducer:function(s,d,_){var w=lo();if(_!==void 0){var z=_(d);if(xc){mr(!0);try{_(d)}finally{mr(!1)}}}else z=d;return w.memoizedState=w.baseState=z,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:z},w.queue=s,s=s.dispatch=Bp.bind(null,zt,s),[w.memoizedState,s]},useRef:function(s){var d=lo();return s={current:s},d.memoizedState=s},useState:function(s){s=fl(s);var d=s.queue,_=uh.bind(null,zt,d);return d.dispatch=_,[s.memoizedState,_]},useDebugValue:It,useDeferredValue:function(s,d){var _=lo();return qn(_,s,d)},useTransition:function(){var s=fl(!1);return s=Lp.bind(null,zt,s.queue,!0,!1),lo().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,d,_){var w=zt,z=lo();if(Bn){if(_===void 0)throw Error(F(407));_=_()}else{if(_=d(),Re===null)throw Error(F(349));(Le&127)!==0||wf(w,d,_)}z.memoizedState=_;var O={value:_,getSnapshot:d};return z.queue=O,lh(Nm.bind(null,w,O,s),[s]),w.flags|=2048,Sc(9,{destroy:void 0},Tf.bind(null,w,O,_,d),null),_},useId:function(){var s=lo(),d=Re.identifierPrefix;if(Bn){var _=Is,w=ol;_=(w&~(1<<32-Dr(w)-1)).toString(32)+_,d="_"+d+"R_"+_,_=su++,0<_&&(d+="H"+_.toString(32)),d+="_"}else _=Sp++,d="_"+d+"r_"+_.toString(32)+"_";return s.memoizedState=d},useHostTransitionStatus:bd,useFormState:Ho,useActionState:Ho,useOptimistic:function(s){var d=lo();d.memoizedState=d.baseState=s;var _={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=_,d=wd.bind(null,zt,!0,_),_.dispatch=d,[s,d]},useMemoCache:xf,useCacheRefresh:function(){return lo().memoizedState=jg.bind(null,zt)},useEffectEvent:function(s){var d=lo(),_={impl:s};return d.memoizedState=_,function(){if((Ae&2)!==0)throw Error(F(440));return _.impl.apply(void 0,arguments)}}},Ed={readContext:Co,use:gd,useCallback:Ut,useContext:Co,useEffect:cu,useImperativeHandle:qo,useInsertionEffect:Pp,useLayoutEffect:Af,useMemo:uu,useReducer:_d,useRef:Ef,useState:function(){return _d(Bs)},useDebugValue:It,useDeferredValue:function(s,d){var _=Pr();return Oe(_,lr.memoizedState,s,d)},useTransition:function(){var s=_d(Bs)[0],d=Pr().memoizedState;return[typeof s=="boolean"?s:Tc(s),d]},useSyncExternalStore:bf,useId:hu,useHostTransitionStatus:bd,useFormState:$l,useActionState:$l,useOptimistic:function(s,d){var _=Pr();return Mp(_,lr,s,d)},useMemoCache:xf,useCacheRefresh:jm};Ed.useEffectEvent=Dp;var kp={readContext:Co,use:gd,useCallback:Ut,useContext:Co,useEffect:cu,useImperativeHandle:qo,useInsertionEffect:Pp,useLayoutEffect:Af,useMemo:uu,useReducer:vf,useRef:Ef,useState:function(){return vf(Bs)},useDebugValue:It,useDeferredValue:function(s,d){var _=Pr();return lr===null?qn(_,s,d):Oe(_,lr.memoizedState,s,d)},useTransition:function(){var s=vf(Bs)[0],d=Pr().memoizedState;return[typeof s=="boolean"?s:Tc(s),d]},useSyncExternalStore:bf,useId:hu,useHostTransitionStatus:bd,useFormState:Sf,useActionState:Sf,useOptimistic:function(s,d){var _=Pr();return lr!==null?Mp(_,lr,s,d):(_.baseState=s,[s,_.queue.dispatch])},useMemoCache:xf,useCacheRefresh:jm};kp.useEffectEvent=Dp;function Rf(s,d,_,w){d=s.memoizedState,_=_(w,d),_=_==null?d:oe({},d,_),s.memoizedState=_,s.lanes===0&&(s.updateQueue.baseState=_)}var zf={enqueueSetState:function(s,d,_){s=s._reactInternals;var w=_n(),z=ul(w);z.payload=d,_!=null&&(z.callback=_),d=Hl(s,z,w),d!==null&&(Ci(d,s,w),eu(d,s,w))},enqueueReplaceState:function(s,d,_){s=s._reactInternals;var w=_n(),z=ul(w);z.tag=1,z.payload=d,_!=null&&(z.callback=_),d=Hl(s,z,w),d!==null&&(Ci(d,s,w),eu(d,s,w))},enqueueForceUpdate:function(s,d){s=s._reactInternals;var _=_n(),w=ul(_);w.tag=2,d!=null&&(w.callback=d),d=Hl(s,w,_),d!==null&&(Ci(d,s,_),eu(d,s,_))}};function Zo(s,d,_,w,z,O,J){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(w,O,J):d.prototype&&d.prototype.isPureReactComponent?!Aa(_,w)||!Aa(z,O):!0}
vendor: 28,963 bytes, line 48
48function Fp(s,d,_,w){s=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(_,w),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(_,w),d.state!==s&&zf.enqueueReplaceState(d,d.state,null)}function za(s,d){var _=d;if("ref"in d){_={};for(var w in d)w!=="ref"&&(_[w]=d[w])}if(s=s.defaultProps){_===d&&(_=oe({},_));for(var z in s)_[z]===void 0&&(_[z]=s[z])}return _}function Gm(s){qu(s)}function Pn(s){console.error(s)}function Gi(s){qu(s)}function Ad(s,d){try{var _=s.onUncaughtError;_(d.value,{componentStack:d.stack})}catch(w){setTimeout(function(){throw w})}}function Xl(s,d,_){try{var w=s.onCaughtError;w(_.value,{componentStack:_.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(z){setTimeout(function(){throw z})}}function Fs(s,d,_){return _=ul(_),_.tag=3,_.payload={element:null},_.callback=function(){Ad(s,d)},_}function ml(s){return s=ul(s),s.tag=3,s}function eo(s,d,_,w){var z=_.type.getDerivedStateFromError;if(typeof z=="function"){var O=w.value;s.payload=function(){return z(O)},s.callback=function(){Xl(d,_,w)}}var J=_.stateNode;J!==null&&typeof J.componentDidCatch=="function"&&(s.callback=function(){Xl(d,_,w),typeof z!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var ve=w.stack;this.componentDidCatch(w.value,{componentStack:ve!==null?ve:""})})}function dh(s,d,_,w,z){if(_.flags|=32768,w!==null&&typeof w=="object"&&typeof w.then=="function"){if(d=_.alternate,d!==null&&pc(d,_,z,!0),_=jo.current,_!==null){switch(_.tag){case 31:case 13:return Io===null?go():_.alternate===null&&it===0&&(it=3),_.flags&=-257,_.flags|=65536,_.lanes=z,w===cd?_.flags|=16384:(d=_.updateQueue,d===null?_.updateQueue=new Set([w]):d.add(w),Ql(s,w,z)),!1;case 22:return _.flags|=65536,w===cd?_.flags|=16384:(d=_.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([w])},_.updateQueue=d):(_=d.retryQueue,_===null?d.retryQueue=new Set([w]):_.add(w)),Ql(s,w,z)),!1}throw Error(F(435,_.tag))}return Ql(s,w,z),go(),!1}if(Bn)return d=jo.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=z,w!==dc&&(s=Error(F(422),{cause:w}),Wu(po(s,_)))):(w!==dc&&(d=Error(F(423),{cause:w}),Wu(po(d,_))),s=s.current.alternate,s.flags|=65536,z&=-z,s.lanes|=z,w=po(w,_),z=Fs(s.stateNode,w,z),ah(s,z),it!==4&&(it=2)),!1;var O=Error(F(520),{cause:w});if(O=po(O,_),Wt===null?Wt=[O]:Wt.push(O),it!==4&&(it=2),d===null)return!0;w=po(w,_),_=d;do{switch(_.tag){case 3:return _.flags|=65536,s=z&-z,_.lanes|=s,s=Fs(_.stateNode,w,s),ah(_,s),!1;case 1:if(d=_.type,O=_.stateNode,(_.flags&128)===0&&(typeof d.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(pi===null||!pi.has(O))))return _.flags|=65536,z&=-z,_.lanes|=z,z=ml(z),eo(z,s,_,w),ah(_,z),!1}_=_.return}while(_!==null);return!1}var Md=Error(F(461)),Hr=!1;function mo(s,d,_,w){d.child=s===null?Tp(d,null,_,w):cl(d,s.child,_,w)}function Za(s,d,_,w,z){_=_.render;var O=d.ref;if("ref"in w){var J={};for(var ve in w)ve!=="ref"&&(J[ve]=w[ve])}else J=w;return Nl(d),w=lu(s,d,_,J,O,z),ve=_f(),s!==null&&!Hr?(yf(s,d,z),Vs(s,d,z)):(Bn&&ve&&ed(d),d.flags|=1,mo(s,d,w,z),d.child)}function Ns(s,d,_,w,z){if(s===null){var O=_.type;return typeof O=="function"&&!Ll(O)&&O.defaultProps===void 0&&_.compare===null?(d.tag=15,d.type=O,du(s,d,O,w,z)):(s=Wc(_.type,null,w,d,d.mode,z),s.ref=d.ref,s.return=d,d.child=s)}if(O=s.child,!_u(s,z)){var J=O.memoizedProps;if(_=_.compare,_=_!==null?_:Aa,_(J,w)&&s.ref===d.ref)return Vs(s,d,z)}return d.flags|=1,s=fa(O,w),s.ref=d.ref,s.return=d,d.child=s}function du(s,d,_,w,z){if(s!==null){var O=s.memoizedProps;if(Aa(O,w)&&s.ref===d.ref)if(Hr=!1,d.pendingProps=w=O,_u(s,z))(s.flags&131072)!==0&&(Hr=!0);else return d.lanes=s.lanes,Vs(s,d,z)}return fh(s,d,_,w,z)}function fu(s,d,_,w){var z=w.children,O=s!==null?s.memoizedState:null;if(s===null&&d.stateNode===null&&(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),w.mode==="hidden"){if((d.flags&128)!==0){if(O=O!==null?O.baseLanes|_:_,s!==null){for(w=d.child=s.child,z=0;w!==null;)z=z|w.lanes|w.childLanes,w=w.sibling;w=z&~O}else w=0,d.child=null;return Df(s,d,O,_,w)}if((_&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},s!==null&&ih(d,O!==null?O.cachePool:null),O!==null?fd(d,O):ru(),pd(d);else return w=d.lanes=536870912,Df(s,d,O!==null?O.baseLanes|_:_,_,w)}else O!==null?(ih(d,O.cachePool),fd(d,O),Go(),d.memoizedState=null):(s!==null&&ih(d,null),ru(),Go());return mo(s,d,z,_),d.child}function pu(s,d){return s!==null&&s.tag===22||d.stateNode!==null||(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.sibling}function Df(s,d,_,w,z){var O=sd();return O=O===null?null:{parent:Wn._currentValue,pool:O},d.memoizedState={baseLanes:_,cachePool:O},s!==null&&ih(d,null),ru(),pd(d),s!==null&&pc(s,d,w,!0),d.childLanes=z,null}function Us(s,d){return d=gh({mode:d.mode,children:d.children},s.mode),d.ref=s.ref,s.child=d,d.return=s,d}function Pf(s,d,_){return cl(d,s.child,null,_),s=Us(d,d.pendingProps),s.flags|=2,Ca(d),d.memoizedState=null,s}function $a(s,d,_){var w=d.pendingProps,z=(d.flags&128)!==0;if(d.flags&=-129,s===null){if(Bn){if(w.mode==="hidden")return s=Us(d,w),d.lanes=536870912,pu(null,s);if(ou(d),(s=sr)?(s=fy(s,Ha),s=s!==null&&s.data==="&"?s:null,s!==null&&(d.memoizedState={dehydrated:s,treeContext:Sn!==null?{id:ol,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},_=Lm(s),_.return=d,d.child=_,Qr=d,sr=null)):s=null,s===null)throw zs(d);return d.lanes=536870912,null}return Us(d,w)}var O=s.memoizedState;if(O!==null){var J=O.dehydrated;if(ou(d),z)if(d.flags&256)d.flags&=-257,d=Pf(s,d,_);else if(d.memoizedState!==null)d.child=s.child,d.flags|=128,d=null;else throw Error(F(558));else if(Hr||pc(s,d,_,!1),z=(_&s.childLanes)!==0,Hr||z){if(w=Re,w!==null&&(J=So(w,_),J!==0&&J!==O.retryLane))throw O.retryLane=J,Lt(s,J),Ci(w,s,J),Md;go(),d=Pf(s,d,_)}else s=O.treeContext,sr=xl(J.nextSibling),Qr=d,Bn=!0,al=null,Ha=!1,s!==null&&Yc(d,s),d=Us(d,w),d.flags|=4096;return d}return s=fa(s.child,{mode:w.mode,children:w.children}),s.ref=d.ref,d.child=s,s.return=d,s}function Ac(s,d){var _=d.ref;if(_===null)s!==null&&s.ref!==null&&(d.flags|=4194816);else{if(typeof _!="function"&&typeof _!="object")throw Error(F(284));(s===null||s.ref!==_)&&(d.flags|=4194816)}}function fh(s,d,_,w,z){return Nl(d),_=lu(s,d,_,w,void 0,z),w=_f(),s!==null&&!Hr?(yf(s,d,z),Vs(s,d,z)):(Bn&&w&&ed(d),d.flags|=1,mo(s,d,_,z),d.child)}function Cd(s,d,_,w,z,O){return Nl(d),d.updateQueue=null,_=Ep(d,w,_,z),Os(s),w=_f(),s!==null&&!Hr?(yf(s,d,O),Vs(s,d,O)):(Bn&&w&&ed(d),d.flags|=1,mo(s,d,_,O),d.child)}function Id(s,d,_,w,z){if(Nl(d),d.stateNode===null){var O=nl,J=_.contextType;typeof J=="object"&&J!==null&&(O=Co(J)),O=new _(w,O),d.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,O.updater=zf,d.stateNode=O,O._reactInternals=d,O=d.stateNode,O.props=w,O.state=d.memoizedState,O.refs={},dd(d),J=_.contextType,O.context=typeof J=="object"&&J!==null?Co(J):nl,O.state=d.memoizedState,J=_.getDerivedStateFromProps,typeof J=="function"&&(Rf(d,_,J,w),O.state=d.memoizedState),typeof _.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(J=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),J!==O.state&&zf.enqueueReplaceState(O,O.state,null),ql(d,w,O,z),tu(),O.state=d.memoizedState),typeof O.componentDidMount=="function"&&(d.flags|=4194308),w=!0}else if(s===null){O=d.stateNode;var ve=d.memoizedProps,Xe=za(_,ve);O.props=Xe;var Pt=O.context,Xt=_.contextType;J=nl,typeof Xt=="object"&&Xt!==null&&(J=Co(Xt));var Jt=_.getDerivedStateFromProps;Xt=typeof Jt=="function"||typeof O.getSnapshotBeforeUpdate=="function",ve=d.pendingProps!==ve,Xt||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(ve||Pt!==J)&&Fp(d,O,w,J),pa=!1;var Ot=d.memoizedState;O.state=Ot,ql(d,w,O,z),tu(),Pt=d.memoizedState,ve||Ot!==Pt||pa?(typeof Jt=="function"&&(Rf(d,_,Jt,w),Pt=d.memoizedState),(Xe=pa||Zo(d,_,Xe,w,Ot,Pt,J))?(Xt||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(d.flags|=4194308)):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=w,d.memoizedState=Pt),O.props=w,O.state=Pt,O.context=J,w=Xe):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),w=!1)}else{O=d.stateNode,oh(s,d),J=d.memoizedProps,Xt=za(_,J),O.props=Xt,Jt=d.pendingProps,Ot=O.context,Pt=_.contextType,Xe=nl,typeof Pt=="object"&&Pt!==null&&(Xe=Co(Pt)),ve=_.getDerivedStateFromProps,(Pt=typeof ve=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(J!==Jt||Ot!==Xe)&&Fp(d,O,w,Xe),pa=!1,Ot=d.memoizedState,O.state=Ot,ql(d,w,O,z),tu();var jt=d.memoizedState;J!==Jt||Ot!==jt||pa||s!==null&&s.dependencies!==null&&Yu(s.dependencies)?(typeof ve=="function"&&(Rf(d,_,ve,w),jt=d.memoizedState),(Xt=pa||Zo(d,_,Xt,w,Ot,jt,Xe)||s!==null&&s.dependencies!==null&&Yu(s.dependencies))?(Pt||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(w,jt,Xe),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(w,jt,Xe)),typeof O.componentDidUpdate=="function"&&(d.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof O.componentDidUpdate!="function"||J===s.memoizedProps&&Ot===s.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||J===s.memoizedProps&&Ot===s.memoizedState||(d.flags|=1024),d.memoizedProps=w,d.memoizedState=jt),O.props=w,O.state=jt,O.context=Xe,w=Xt):(typeof O.componentDidUpdate!="function"||J===s.memoizedProps&&Ot===s.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||J===s.memoizedProps&&Ot===s.memoizedState||(d.flags|=1024),w=!1)}return O=w,Ac(s,d),w=(d.flags&128)!==0,O||w?(O=d.stateNode,_=w&&typeof _.getDerivedStateFromError!="function"?null:O.render(),d.flags|=1,s!==null&&w?(d.child=cl(d,s.child,null,z),d.child=cl(d,null,_,z)):mo(s,d,_,z),d.memoizedState=O.state,s=d.child):s=Vs(s,d,z),s}function Lr(s,d,_,w){return Ds(),d.flags|=256,mo(s,d,_,w),d.child}var mu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mc(s){return{baseLanes:s,cachePool:Qc()}}function ph(s,d,_){return s=s!==null?s.childLanes&~_:0,d&&(s|=At),s}function Cc(s,d,_){var w=d.pendingProps,z=!1,O=(d.flags&128)!==0,J;if((J=O)||(J=s!==null&&s.memoizedState===null?!1:(Jr.current&2)!==0),J&&(z=!0,d.flags&=-129),J=(d.flags&32)!==0,d.flags&=-33,s===null){if(Bn){if(z?Ls(d):Go(),(s=sr)?(s=fy(s,Ha),s=s!==null&&s.data!=="&"?s:null,s!==null&&(d.memoizedState={dehydrated:s,treeContext:Sn!==null?{id:ol,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},_=Lm(s),_.return=d,d.child=_,Qr=d,sr=null)):s=null,s===null)throw zs(d);return e_(s)?d.lanes=32:d.lanes=536870912,null}var ve=w.children;return w=w.fallback,z?(Go(),z=d.mode,ve=gh({mode:"hidden",children:ve},z),w=hc(w,z,_,null),ve.return=d,w.return=d,ve.sibling=w,d.child=ve,w=d.child,w.memoizedState=Mc(_),w.childLanes=ph(s,J,_),d.memoizedState=mu,pu(null,w)):(Ls(d),mh(d,ve))}var Xe=s.memoizedState;if(Xe!==null&&(ve=Xe.dehydrated,ve!==null)){if(O)d.flags&256?(Ls(d),d.flags&=-257,d=gu(s,d,_)):d.memoizedState!==null?(Go(),d.child=s.child,d.flags|=128,d=null):(Go(),ve=w.fallback,z=d.mode,w=gh({mode:"visible",children:w.children},z),ve=hc(ve,z,_,null),ve.flags|=2,w.return=d,ve.return=d,w.sibling=ve,d.child=w,cl(d,s.child,null,_),w=d.child,w.memoizedState=Mc(_),w.childLanes=ph(s,J,_),d.memoizedState=mu,d=pu(null,w));else if(Ls(d),e_(ve)){if(J=ve.nextSibling&&ve.nextSibling.dataset,J)var Pt=J.dgst;J=Pt,w=Error(F(419)),w.stack="",w.digest=J,Wu({value:w,source:null,stack:null}),d=gu(s,d,_)}else if(Hr||pc(s,d,_,!1),J=(_&s.childLanes)!==0,Hr||J){if(J=Re,J!==null&&(w=So(J,_),w!==0&&w!==Xe.retryLane))throw Xe.retryLane=w,Lt(s,w),Ci(J,s,w),Md;Jg(ve)||go(),d=gu(s,d,_)}else Jg(ve)?(d.flags|=192,d.child=s.child,d=null):(s=Xe.treeContext,sr=xl(ve.nextSibling),Qr=d,Bn=!0,al=null,Ha=!1,s!==null&&Yc(d,s),d=mh(d,w.children),d.flags|=4096);return d}return z?(Go(),ve=w.fallback,z=d.mode,Xe=s.child,Pt=Xe.sibling,w=fa(Xe,{mode:"hidden",children:w.children}),w.subtreeFlags=Xe.subtreeFlags&65011712,Pt!==null?ve=fa(Pt,ve):(ve=hc(ve,z,_,null),ve.flags|=2),ve.return=d,w.return=d,w.sibling=ve,d.child=w,pu(null,w),w=d.child,ve=s.child.memoizedState,ve===null?ve=Mc(_):(z=ve.cachePool,z!==null?(Xe=Wn._currentValue,z=z.parent!==Xe?{parent:Xe,pool:Xe}:z):z=Qc(),ve={baseLanes:ve.baseLanes|_,cachePool:z}),w.memoizedState=ve,w.childLanes=ph(s,J,_),d.memoizedState=mu,pu(s.child,w)):(Ls(d),_=s.child,s=_.sibling,_=fa(_,{mode:"visible",children:w.children}),_.return=d,_.sibling=null,s!==null&&(J=d.deletions,J===null?(d.deletions=[s],d.flags|=16):J.push(s)),d.child=_,d.memoizedState=null,_)}function mh(s,d){return d=gh({mode:"visible",children:d},s.mode),d.return=s,s.child=d}function gh(s,d){return s=da(22,s,null,d),s.lanes=0,s}function gu(s,d,_){return cl(d,s.child,null,_),s=mh(d,d.pendingProps.children),s.flags|=2,d.memoizedState=null,s}function Ic(s,d,_){s.lanes|=d;var w=s.alternate;w!==null&&(w.lanes|=d),vp(s.return,d,_)}function Rd(s,d,_,w,z,O){var J=s.memoizedState;J===null?s.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:w,tail:_,tailMode:z,treeForkCount:O}:(J.isBackwards=d,J.rendering=null,J.renderingStartTime=0,J.last=w,J.tail=_,J.tailMode=z,J.treeForkCount=O)}function _h(s,d,_){var w=d.pendingProps,z=w.revealOrder,O=w.tail;w=w.children;var J=Jr.current,ve=(J&2)!==0;if(ve?(J=J&1|2,d.flags|=128):J&=1,bt(Jr,J),mo(s,d,w,_),w=Bn?Qh:0,!ve&&s!==null&&(s.flags&128)!==0)e:for(s=d.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Ic(s,_,d);else if(s.tag===19)Ic(s,_,d);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===d)break e;for(;s.sibling===null;){if(s.return===null||s.return===d)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(z){case"forwards":for(_=d.child,z=null;_!==null;)s=_.alternate,s!==null&&dl(s)===null&&(z=_),_=_.sibling;_=z,_===null?(z=d.child,d.child=null):(z=_.sibling,_.sibling=null),Rd(d,!1,z,_,O,w);break;case"backwards":case"unstable_legacy-backwards":for(_=null,z=d.child,d.child=null;z!==null;){if(s=z.alternate,s!==null&&dl(s)===null){d.child=z;break}s=z.sibling,z.sibling=_,_=z,z=s}Rd(d,!0,_,null,O,w);break;case"together":Rd(d,!1,null,null,void 0,w);break;default:d.memoizedState=null}return d.child}function Vs(s,d,_){if(s!==null&&(d.dependencies=s.dependencies),Et|=d.lanes,(_&d.childLanes)===0)if(s!==null){if(pc(s,d,_,!1),(_&d.childLanes)===0)return null}else return null;if(s!==null&&d.child!==s.child)throw Error(F(153));if(d.child!==null){for(s=d.child,_=fa(s,s.pendingProps),d.child=_,_.return=d;s.sibling!==null;)s=s.sibling,_=_.sibling=fa(s,s.pendingProps),_.return=d;_.sibling=null}return d.child}function _u(s,d){return(s.lanes&d)!==0?!0:(s=s.dependencies,!!(s!==null&&Yu(s)))}function Np(s,d,_){switch(d.tag){case 3:Oi(d,d.stateNode.containerInfo),fc(d,Wn,s.memoizedState.cache),Ds();break;case 27:case 5:ln(d);break;case 4:Oi(d,d.stateNode.containerInfo);break;case 10:fc(d,d.type,d.memoizedProps.value);break;case 31:if(d.memoizedState!==null)return d.flags|=128,ou(d),null;break;case 13:var w=d.memoizedState;if(w!==null)return w.dehydrated!==null?(Ls(d),d.flags|=128,null):(_&d.child.childLanes)!==0?Cc(s,d,_):(Ls(d),s=Vs(s,d,_),s!==null?s.sibling:null);Ls(d);break;case 19:var z=(s.flags&128)!==0;if(w=(_&d.childLanes)!==0,w||(pc(s,d,_,!1),w=(_&d.childLanes)!==0),z){if(w)return _h(s,d,_);d.flags|=128}if(z=d.memoizedState,z!==null&&(z.rendering=null,z.tail=null,z.lastEffect=null),bt(Jr,Jr.current),w)break;return null;case 22:return d.lanes=0,fu(s,d,_,d.pendingProps);case 24:fc(d,Wn,s.memoizedState.cache)}return Vs(s,d,_)}function zd(s,d,_){if(s!==null)if(s.memoizedProps!==d.pendingProps)Hr=!0;else{if(!_u(s,_)&&(d.flags&128)===0)return Hr=!1,Np(s,d,_);Hr=(s.flags&131072)!==0}else Hr=!1,Bn&&(d.flags&1048576)!==0&&Jh(d,Qh,d.index);switch(d.lanes=0,d.tag){case 16:e:{var w=d.pendingProps;if(s=ll(d.elementType),d.type=s,typeof s=="function")Ll(s)?(w=za(s,w),d.tag=1,d=Id(null,d,s,w,_)):(d.tag=0,d=fh(null,d,s,w,_));else{if(s!=null){var z=s.$$typeof;if(z===nt){d.tag=11,d=Za(null,d,s,w,_);break e}else if(z===rt){d.tag=14,d=Ns(null,d,s,w,_);break e}}throw d=gi(s)||s,Error(F(306,d,""))}}return d;case 0:return fh(s,d,d.type,d.pendingProps,_);case 1:return w=d.type,z=za(w,d.pendingProps),Id(s,d,w,z,_);case 3:e:{if(Oi(d,d.stateNode.containerInfo),s===null)throw Error(F(387));w=d.pendingProps;var O=d.memoizedState;z=O.element,oh(s,d),ql(d,w,null,_);var J=d.memoizedState;if(w=J.cache,fc(d,Wn,w),w!==O.cache&&id(d,[Wn],_,!0),tu(),w=J.element,O.isDehydrated)if(O={element:w,isDehydrated:!1,cache:J.cache},d.updateQueue.baseState=O,d.memoizedState=O,d.flags&256){d=Lr(s,d,w,_);break e}else if(w!==z){z=po(Error(F(424)),d),Wu(z),d=Lr(s,d,w,_);break e}else{switch(s=d.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(sr=xl(s.firstChild),Qr=d,Bn=!0,al=null,Ha=!0,_=Tp(d,null,w,_),d.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling}else{if(Ds(),w===z){d=Vs(s,d,_);break e}mo(s,d,w,_)}d=d.child}return d;case 26:return Ac(s,d),s===null?(_=Pc(d.type,null,d.pendingProps,null))?d.memoizedState=_:Bn||(_=d.type,s=d.pendingProps,w=em(hi.current).createElement(_),w[we]=d,w[he]=s,xa(w,_,s),si(w),d.stateNode=w):d.memoizedState=Pc(d.type,s.memoizedProps,d.pendingProps,s.memoizedState),null;case 27:return ln(d),s===null&&Bn&&(w=d.stateNode=Vf(d.type,d.pendingProps,hi.current),Qr=d,Ha=!0,z=sr,qs(d.type)?(tm=z,sr=xl(w.firstChild)):sr=z),mo(s,d,d.pendingProps.children,_),Ac(s,d),s===null&&(d.flags|=4194304),d.child;case 5:return s===null&&Bn&&((z=w=sr)&&(w=e0(w,d.type,d.pendingProps,Ha),w!==null?(d.stateNode=w,Qr=d,sr=xl(w.firstChild),Ha=!1,z=!0):z=!1),z||zs(d)),ln(d),z=d.type,O=d.pendingProps,J=s!==null?s.memoizedProps:null,w=O.children,Dc(z,O)?w=null:J!==null&&Dc(z,J)&&(d.flags|=32),d.memoizedState!==null&&(z=lu(s,d,Fm,null,null,_),bl._currentValue=z),Ac(s,d),mo(s,d,w,_),d.child;case 6:return s===null&&Bn&&((s=_=sr)&&(_=t0(_,d.pendingProps,Ha),_!==null?(d.stateNode=_,Qr=d,sr=null,s=!0):s=!1),s||zs(d)),null;case 13:return Cc(s,d,_);case 4:return Oi(d,d.stateNode.containerInfo),w=d.pendingProps,s===null?d.child=cl(d,null,w,_):mo(s,d,w,_),d.child;case 11:return Za(s,d,d.type,d.pendingProps,_);case 7:return mo(s,d,d.pendingProps,_),d.child;case 8:return mo(s,d,d.pendingProps.children,_),d.child;case 12:return mo(s,d,d.pendingProps.children,_),d.child;case 10:return w=d.pendingProps,fc(d,d.type,w.value),mo(s,d,w.children,_),d.child;case 9:return z=d.type._context,w=d.pendingProps.children,Nl(d),z=Co(z),w=w(z),d.flags|=1,mo(s,d,w,_),d.child;case 14:return Ns(s,d,d.type,d.pendingProps,_);case 15:return du(s,d,d.type,d.pendingProps,_);case 19:return _h(s,d,_);case 31:return $a(s,d,_);case 22:return fu(s,d,_,d.pendingProps);case 24:return Nl(d),w=Co(Wn),s===null?(z=sd(),z===null&&(z=Re,O=Qu(),z.pooledCache=O,O.refCount++,O!==null&&(z.pooledCacheLanes|=_),z=O),d.memoizedState={parent:w,cache:z},dd(d),fc(d,Wn,z)):((s.lanes&_)!==0&&(oh(s,d),ql(d,null,null,_),tu()),z=s.memoizedState,O=d.memoizedState,z.parent!==w?(z={parent:w,cache:w},d.memoizedState=z,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=z),fc(d,Wn,w)):(w=O.cache,fc(d,Wn,w),w!==z.cache&&id(d,[Wn],_,!0))),mo(s,d,d.pendingProps.children,_),d.child;case 29:throw d.pendingProps}throw Error(F(156,d.tag))}function gl(s){s.flags|=4}function Lf(s,d,_,w,z){if((d=(s.mode&32)!==0)&&(d=!1),d){if(s.flags|=16777216,(z&335544128)===z)if(s.stateNode.complete)s.flags|=8192;else if(hn())s.flags|=8192;else throw Gl=cd,bp}else s.flags&=-16777217}function Up(s,d){if(d.type!=="stylesheet"||(d.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!u_(d))if(hn())s.flags|=8192;else throw Gl=cd,bp}function Dd(s,d){d!==null&&(s.flags|=4),s.flags&16384&&(d=s.tag!==22?gr():536870912,s.lanes|=d,Qt|=d)}function yh(s,d){if(!Bn)switch(s.tailMode){case"hidden":d=s.tail;for(var _=null;d!==null;)d.alternate!==null&&(_=d),d=d.sibling;_===null?s.tail=null:_.sibling=null;break;case"collapsed":_=s.tail;for(var w=null;_!==null;)_.alternate!==null&&(w=_),_=_.sibling;w===null?d||s.tail===null?s.tail=null:s.tail.sibling=null:w.sibling=null}}function Ir(s){var d=s.alternate!==null&&s.alternate.child===s.child,_=0,w=0;if(d)for(var z=s.child;z!==null;)_|=z.lanes|z.childLanes,w|=z.subtreeFlags&65011712,w|=z.flags&65011712,z.return=s,z=z.sibling;else for(z=s.child;z!==null;)_|=z.lanes|z.childLanes,w|=z.subtreeFlags,w|=z.flags,z.return=s,z=z.sibling;return s.subtreeFlags|=w,s.childLanes=_,d}function Pd(s,d,_){var w=d.pendingProps;switch(Bl(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ir(d),null;case 1:return Ir(d),null;case 3:return _=d.stateNode,w=null,s!==null&&(w=s.memoizedState.cache),d.memoizedState.cache!==w&&(d.flags|=2048),Fl(Wn),xi(),_.pendingContext&&(_.context=_.pendingContext,_.pendingContext=null),(s===null||s.child===null)&&(kl(d)?gl(d):s===null||s.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,ff())),Ir(d),null;case 26:var z=d.type,O=d.memoizedState;return s===null?(gl(d),O!==null?(Ir(d),Up(d,O)):(Ir(d),Lf(d,z,null,w,_))):O?O!==s.memoizedState?(gl(d),Ir(d),Up(d,O)):(Ir(d),d.flags&=-16777217):(s=s.memoizedProps,s!==w&&gl(d),Ir(d),Lf(d,z,s,w,_)),null;case 27:if(Xn(d),_=hi.current,z=d.type,s!==null&&d.stateNode!=null)s.memoizedProps!==w&&gl(d);else{if(!w){if(d.stateNode===null)throw Error(F(166));return Ir(d),null}s=Ht.current,kl(d)?td(d):(s=Vf(z,w,_),d.stateNode=s,gl(d))}return Ir(d),null;case 5:if(Xn(d),z=d.type,s!==null&&d.stateNode!=null)s.memoizedProps!==w&&gl(d);else{if(!w){if(d.stateNode===null)throw Error(F(166));return Ir(d),null}if(O=Ht.current,kl(d))td(d);else{var J=em(hi.current);switch(O){case 1:O=J.createElementNS("http://www.w3.org/2000/svg",z);break;case 2:O=J.createElementNS("http://www.w3.org/1998/Math/MathML",z);break;default:switch(z){case"svg":O=J.createElementNS("http://www.w3.org/2000/svg",z);break;case"math":O=J.createElementNS("http://www.w3.org/1998/Math/MathML",z);break;case"script":O=J.createElement("div"),O.innerHTML="<script><\/script>",O=O.removeChild(O.firstChild);break;case"select":O=typeof w.is=="string"?J.createElement("select",{is:w.is}):J.createElement("select"),w.multiple?O.multiple=!0:w.size&&(O.size=w.size);break;default:O=typeof w.is=="string"?J.createElement(z,{is:w.is}):J.createElement(z)}}O[we]=d,O[he]=w;e:for(J=d.child;J!==null;){if(J.tag===5||J.tag===6)O.appendChild(J.stateNode);else if(J.tag!==4&&J.tag!==27&&J.child!==null){J.child.return=J,J=J.child;continue}if(J===d)break e;for(;J.sibling===null;){if(J.return===null||J.return===d)break e;J=J.return}J.sibling.return=J.return,J=J.sibling}d.stateNode=O;e:switch(xa(O,z,w),z){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}w&&gl(d)}}return Ir(d),Lf(d,d.type,s===null?null:s.memoizedProps,d.pendingProps,_),null;case 6:if(s&&d.stateNode!=null)s.memoizedProps!==w&&gl(d);else{if(typeof w!="string"&&d.stateNode===null)throw Error(F(166));if(s=hi.current,kl(d)){if(s=d.stateNode,_=d.memoizedProps,w=null,z=Qr,z!==null)switch(z.tag){case 27:case 5:w=z.memoizedProps}s[we]=d,s=!!(s.nodeValue===_||w!==null&&w.suppressHydrationWarning===!0||ly(s.nodeValue,_)),s||zs(d,!0)}else s=em(s).createTextNode(w),s[we]=d,d.stateNode=s}return Ir(d),null;case 31:if(_=d.memoizedState,s===null||s.memoizedState!==null){if(w=kl(d),_!==null){if(s===null){if(!w)throw Error(F(318));if(s=d.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(F(557));s[we]=d}else Ds(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Ir(d),s=!1}else _=ff(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=_),s=!0;if(!s)return d.flags&256?(Ca(d),d):(Ca(d),null);if((d.flags&128)!==0)throw Error(F(558))}return Ir(d),null;case 13:if(w=d.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(z=kl(d),w!==null&&w.dehydrated!==null){if(s===null){if(!z)throw Error(F(318));if(z=d.memoizedState,z=z!==null?z.dehydrated:null,!z)throw Error(F(317));z[we]=d}else Ds(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Ir(d),z=!1}else z=ff(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=z),z=!0;if(!z)return d.flags&256?(Ca(d),d):(Ca(d),null)}return Ca(d),(d.flags&128)!==0?(d.lanes=_,d):(_=w!==null,s=s!==null&&s.memoizedState!==null,_&&(w=d.child,z=null,w.alternate!==null&&w.alternate.memoizedState!==null&&w.alternate.memoizedState.cachePool!==null&&(z=w.alternate.memoizedState.cachePool.pool),O=null,w.memoizedState!==null&&w.memoizedState.cachePool!==null&&(O=w.memoizedState.cachePool.pool),O!==z&&(w.flags|=2048)),_!==s&&_&&(d.child.flags|=8192),Dd(d,d.updateQueue),Ir(d),null);case 4:return xi(),s===null&&$m(d.stateNode.containerInfo),Ir(d),null;case 10:return Fl(d.type),Ir(d),null;case 19:if(Dt(Jr),w=d.memoizedState,w===null)return Ir(d),null;if(z=(d.flags&128)!==0,O=w.rendering,O===null)if(z)yh(w,!1);else{if(it!==0||s!==null&&(s.flags&128)!==0)for(s=d.child;s!==null;){if(O=dl(s),O!==null){for(d.flags|=128,yh(w,!1),s=O.updateQueue,d.updateQueue=s,Dd(d,s),d.subtreeFlags=0,s=_,_=d.child;_!==null;)Ol(_,s),_=_.sibling;return bt(Jr,Jr.current&1|2),Bn&&Rs(d,w.treeForkCount),d.child}s=s.sibling}w.tail!==null&&pr()>Ri&&(d.flags|=128,z=!0,yh(w,!1),d.lanes=4194304)}else{if(!z)if(s=dl(O),s!==null){if(d.flags|=128,z=!0,s=s.updateQueue,d.updateQueue=s,Dd(d,s),yh(w,!0),w.tail===null&&w.tailMode==="hidden"&&!O.alternate&&!Bn)return Ir(d),null}else 2*pr()-w.renderingStartTime>Ri&&_!==536870912&&(d.flags|=128,z=!0,yh(w,!1),d.lanes=4194304);w.isBackwards?(O.sibling=d.child,d.child=O):(s=w.last,s!==null?s.sibling=O:d.child=O,w.last=O)}return w.tail!==null?(s=w.tail,w.rendering=s,w.tail=s.sibling,w.renderingStartTime=pr(),s.sibling=null,_=Jr.current,bt(Jr,z?_&1|2:_&1),Bn&&Rs(d,w.treeForkCount),s):(Ir(d),null);case 22:case 23:return Ca(d),hl(),w=d.memoizedState!==null,s!==null?s.memoizedState!==null!==w&&(d.flags|=8192):w&&(d.flags|=8192),w?(_&536870912)!==0&&(d.flags&128)===0&&(Ir(d),d.subtreeFlags&6&&(d.flags|=8192)):Ir(d),_=d.updateQueue,_!==null&&Dd(d,_.retryQueue),_=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(_=s.memoizedState.cachePool.pool),w=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(w=d.memoizedState.cachePool.pool),w!==_&&(d.flags|=2048),s!==null&&Dt(jl),null;case 24:return _=null,s!==null&&(_=s.memoizedState.cache),d.memoizedState.cache!==_&&(d.flags|=2048),Fl(Wn),Ir(d),null;case 25:return null;case 30:return null}throw Error(F(156,d.tag))}function Hm(s,d){switch(Bl(d),d.tag){case 1:return s=d.flags,s&65536?(d.flags=s&-65537|128,d):null;case 3:return Fl(Wn),xi(),s=d.flags,(s&65536)!==0&&(s&128)===0?(d.flags=s&-65537|128,d):null;case 26:case 27:case 5:return Xn(d),null;case 31:if(d.memoizedState!==null){if(Ca(d),d.alternate===null)throw Error(F(340));Ds()}return s=d.flags,s&65536?(d.flags=s&-65537|128,d):null;case 13:if(Ca(d),s=d.memoizedState,s!==null&&s.dehydrated!==null){if(d.alternate===null)throw Error(F(340));Ds()}return s=d.flags,s&65536?(d.flags=s&-65537|128,d):null;case 19:return Dt(Jr),null;case 4:return xi(),null;case 10:return Fl(d.type),null;case 22:case 23:return Ca(d),hl(),s!==null&&Dt(jl),s=d.flags,s&65536?(d.flags=s&-65537|128,d):null;case 24:return Fl(Wn),null;case 25:return null;default:return null}}function Vp(s,d){switch(Bl(d),d.tag){case 3:Fl(Wn),xi();break;case 26:case 27:case 5:Xn(d);break;case 4:xi();break;case 31:d.memoizedState!==null&&Ca(d);break;case 13:Ca(d);break;case 19:Dt(Jr);break;case 10:Fl(d.type);break;case 22:case 23:Ca(d),hl(),s!==null&&Dt(jl);break;case 24:Fl(Wn)}}function Wl(s,d){try{var _=d.updateQueue,w=_!==null?_.lastEffect:null;if(w!==null){var z=w.next;_=z;do{if((_.tag&s)===s){w=void 0;var O=_.create,J=_.inst;w=O(),J.destroy=w}_=_.next}while(_!==z)}}catch(ve){Ln(d,d.return,ve)}}function Yl(s,d,_){try{var w=d.updateQueue,z=w!==null?w.lastEffect:null;if(z!==null){var O=z.next;w=O;do{if((w.tag&s)===s){var J=w.inst,ve=J.destroy;if(ve!==void 0){J.destroy=void 0,z=d;var Xe=_,Pt=ve;try{Pt()}catch(Xt){Ln(z,Xe,Xt)}}}w=w.next}while(w!==O)}}catch(Xt){Ln(d,d.return,Xt)}}function Of(s){var d=s.updateQueue;if(d!==null){var _=s.stateNode;try{km(d,_)}catch(w){Ln(s,s.return,w)}}}function jp(s,d,_){_.props=za(s.type,s.memoizedProps),_.state=s.memoizedState;
vendor: 17,492 bytes, line 48
48try{_.componentWillUnmount()}catch(w){Ln(s,d,w)}}function xh(s,d){try{var _=s.ref;if(_!==null){switch(s.tag){case 26:case 27:case 5:var w=s.stateNode;break;case 30:w=s.stateNode;break;default:w=s.stateNode}typeof _=="function"?s.refCleanup=_(w):_.current=w}}catch(z){Ln(s,d,z)}}function js(s,d){var _=s.ref,w=s.refCleanup;if(_!==null)if(typeof w=="function")try{w()}catch(z){Ln(s,d,z)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof _=="function")try{_(null)}catch(z){Ln(s,d,z)}else _.current=null}function Gp(s){var d=s.type,_=s.memoizedProps,w=s.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":_.autoFocus&&w.focus();break e;case"img":_.src?w.src=_.src:_.srcSet&&(w.srcset=_.srcSet)}}catch(z){Ln(s,s.return,z)}}function kn(s,d,_){try{var w=s.stateNode;cy(w,s.type,_,d),w[he]=d}catch(z){Ln(s,s.return,z)}}function Hp(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&qs(s.type)||s.tag===4}function Bf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Hp(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&qs(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function qp(s,d,_){var w=s.tag;if(w===5||w===6)s=s.stateNode,d?(_.nodeType===9?_.body:_.nodeName==="HTML"?_.ownerDocument.body:_).insertBefore(s,d):(d=_.nodeType===9?_.body:_.nodeName==="HTML"?_.ownerDocument.body:_,d.appendChild(s),_=_._reactRootContainer,_!=null||d.onclick!==null||(d.onclick=Kr));else if(w!==4&&(w===27&&qs(s.type)&&(_=s.stateNode,d=null),s=s.child,s!==null))for(qp(s,d,_),s=s.sibling;s!==null;)qp(s,d,_),s=s.sibling}function kf(s,d,_){var w=s.tag;if(w===5||w===6)s=s.stateNode,d?_.insertBefore(s,d):_.appendChild(s);else if(w!==4&&(w===27&&qs(s.type)&&(_=s.stateNode),s=s.child,s!==null))for(kf(s,d,_),s=s.sibling;s!==null;)kf(s,d,_),s=s.sibling}function vh(s){var d=s.stateNode,_=s.memoizedProps;try{for(var w=s.type,z=d.attributes;z.length;)d.removeAttributeNode(z[0]);xa(d,w,_),d[we]=s,d[he]=_}catch(O){Ln(s,s.return,O)}}var _l=!1,qr=!1,yu=!1,gs=typeof WeakSet=="function"?WeakSet:Set,ur=null;function Rr(s,d){if(s=s.containerInfo,Wm=lm,s=Rm(s),qc(s)){if("selectionStart"in s)var _={start:s.selectionStart,end:s.selectionEnd};else e:{_=(_=s.ownerDocument)&&_.defaultView||window;var w=_.getSelection&&_.getSelection();if(w&&w.rangeCount!==0){_=w.anchorNode;var z=w.anchorOffset,O=w.focusNode;w=w.focusOffset;try{_.nodeType,O.nodeType}catch{_=null;break e}var J=0,ve=-1,Xe=-1,Pt=0,Xt=0,Jt=s,Ot=null;t:for(;;){for(var jt;Jt!==_||z!==0&&Jt.nodeType!==3||(ve=J+z),Jt!==O||w!==0&&Jt.nodeType!==3||(Xe=J+w),Jt.nodeType===3&&(J+=Jt.nodeValue.length),(jt=Jt.firstChild)!==null;)Ot=Jt,Jt=jt;for(;;){if(Jt===s)break t;if(Ot===_&&++Pt===z&&(ve=J),Ot===O&&++Xt===w&&(Xe=J),(jt=Jt.nextSibling)!==null)break;Jt=Ot,Ot=Jt.parentNode}Jt=jt}_=ve===-1||Xe===-1?null:{start:ve,end:Xe}}else _=null}_=_||{start:0,end:0}}else _=null;for(Ym={focusedElem:s,selectionRange:_},lm=!1,ur=d;ur!==null;)if(d=ur,s=d.child,(d.subtreeFlags&1028)!==0&&s!==null)s.return=d,ur=s;else for(;ur!==null;){switch(d=ur,O=d.alternate,s=d.flags,d.tag){case 0:if((s&4)!==0&&(s=d.updateQueue,s=s!==null?s.events:null,s!==null))for(_=0;_<s.length;_++)z=s[_],z.ref.impl=z.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&O!==null){s=void 0,_=d,z=O.memoizedProps,O=O.memoizedState,w=_.stateNode;try{var Fi=za(_.type,z);s=w.getSnapshotBeforeUpdate(Fi,O),w.__reactInternalSnapshotBeforeUpdate=s}catch(Qi){Ln(_,_.return,Qi)}}break;case 3:if((s&1024)!==0){if(s=d.stateNode.containerInfo,_=s.nodeType,_===9)Od(s);else if(_===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Od(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(F(163))}if(s=d.sibling,s!==null){s.return=d.return,ur=s;break}ur=d.return}}function Da(s,d,_){var w=_.flags;switch(_.tag){case 0:case 11:case 15:T(s,_),w&4&&Wl(5,_);break;case 1:if(T(s,_),w&4)if(s=_.stateNode,d===null)try{s.componentDidMount()}catch(J){Ln(_,_.return,J)}else{var z=za(_.type,d.memoizedProps);d=d.memoizedState;try{s.componentDidUpdate(z,d,s.__reactInternalSnapshotBeforeUpdate)}catch(J){Ln(_,_.return,J)}}w&64&&Of(_),w&512&&xh(_,_.return);break;case 3:if(T(s,_),w&64&&(s=_.updateQueue,s!==null)){if(d=null,_.child!==null)switch(_.child.tag){case 27:case 5:d=_.child.stateNode;break;case 1:d=_.child.stateNode}try{km(s,d)}catch(J){Ln(_,_.return,J)}}break;case 27:d===null&&w&4&&vh(_);case 26:case 5:T(s,_),d===null&&w&4&&Gp(_),w&512&&xh(_,_.return);break;case 12:T(s,_);break;case 31:T(s,_),w&4&&Gg(s,_);break;case 13:T(s,_),w&4&&c(s,_),w&64&&(s=_.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(_=ey.bind(null,_),i0(s,_))));break;case 22:if(w=_.memoizedState!==null||_l,!w){d=d!==null&&d.memoizedState!==null||qr,z=_l;var O=qr;_l=w,(qr=d)&&!O?I(s,_,(_.subtreeFlags&8772)!==0):T(s,_),_l=z,qr=O}break;case 30:break;default:T(s,_)}}function bh(s){var d=s.alternate;d!==null&&(s.alternate=null,bh(d)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(d=s.stateNode,d!==null&&Zt(d)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Tr=null,ma=!1;function Kl(s,d,_){for(_=_.child;_!==null;)xu(s,d,_),_=_.sibling}function xu(s,d,_){if(Br&&typeof Br.onCommitFiberUnmount=="function")try{Br.onCommitFiberUnmount(ws,_)}catch{}switch(_.tag){case 26:qr||js(_,d),Kl(s,d,_),_.memoizedState?_.memoizedState.count--:_.stateNode&&(_=_.stateNode,_.parentNode.removeChild(_));break;case 27:qr||js(_,d);var w=Tr,z=ma;qs(_.type)&&(Tr=_.stateNode,ma=!1),Kl(s,d,_),im(_.stateNode),Tr=w,ma=z;break;case 5:qr||js(_,d);case 6:if(w=Tr,z=ma,Tr=null,Kl(s,d,_),Tr=w,ma=z,Tr!==null)if(ma)try{(Tr.nodeType===9?Tr.body:Tr.nodeName==="HTML"?Tr.ownerDocument.body:Tr).removeChild(_.stateNode)}catch(O){Ln(_,d,O)}else try{Tr.removeChild(_.stateNode)}catch(O){Ln(_,d,O)}break;case 18:Tr!==null&&(ma?(s=Tr,Qg(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,_.stateNode),$f(s)):Qg(Tr,_.stateNode));break;case 4:w=Tr,z=ma,Tr=_.stateNode.containerInfo,ma=!0,Kl(s,d,_),Tr=w,ma=z;break;case 0:case 11:case 14:case 15:Yl(2,_,d),qr||Yl(4,_,d),Kl(s,d,_);break;case 1:qr||(js(_,d),w=_.stateNode,typeof w.componentWillUnmount=="function"&&jp(_,d,w)),Kl(s,d,_);break;case 21:Kl(s,d,_);break;case 22:qr=(w=qr)||_.memoizedState!==null,Kl(s,d,_),qr=w;break;default:Kl(s,d,_)}}function Gg(s,d){if(d.memoizedState===null&&(s=d.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{$f(s)}catch(_){Ln(d,d.return,_)}}}function c(s,d){if(d.memoizedState===null&&(s=d.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{$f(s)}catch(_){Ln(d,d.return,_)}}function t(s){switch(s.tag){case 31:case 13:case 19:var d=s.stateNode;return d===null&&(d=s.stateNode=new gs),d;case 22:return s=s.stateNode,d=s._retryCache,d===null&&(d=s._retryCache=new gs),d;default:throw Error(F(435,s.tag))}}function o(s,d){var _=t(s);d.forEach(function(w){if(!_.has(w)){_.add(w);var z=ty.bind(null,s,w);w.then(z,z)}})}function u(s,d){var _=d.deletions;if(_!==null)for(var w=0;w<_.length;w++){var z=_[w],O=s,J=d,ve=J;e:for(;ve!==null;){switch(ve.tag){case 27:if(qs(ve.type)){Tr=ve.stateNode,ma=!1;break e}break;case 5:Tr=ve.stateNode,ma=!1;break e;case 3:case 4:Tr=ve.stateNode.containerInfo,ma=!0;break e}ve=ve.return}if(Tr===null)throw Error(F(160));xu(O,J,z),Tr=null,ma=!1,O=z.alternate,O!==null&&(O.return=null),z.return=null}if(d.subtreeFlags&13886)for(d=d.child;d!==null;)g(d,s),d=d.sibling}var p=null;function g(s,d){var _=s.alternate,w=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:u(d,s),y(s),w&4&&(Yl(3,s,s.return),Wl(3,s),Yl(5,s,s.return));break;case 1:u(d,s),y(s),w&512&&(qr||_===null||js(_,_.return)),w&64&&_l&&(s=s.updateQueue,s!==null&&(w=s.callbacks,w!==null&&(_=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=_===null?w:_.concat(w))));break;case 26:var z=p;if(u(d,s),y(s),w&512&&(qr||_===null||js(_,_.return)),w&4){var O=_!==null?_.memoizedState:null;if(w=s.memoizedState,_===null)if(w===null)if(s.stateNode===null){e:{w=s.type,_=s.memoizedProps,z=z.ownerDocument||z;t:switch(w){case"title":O=z.getElementsByTagName("title")[0],(!O||O[yt]||O[we]||O.namespaceURI==="http://www.w3.org/2000/svg"||O.hasAttribute("itemprop"))&&(O=z.createElement(w),z.head.insertBefore(O,z.querySelector("head > title"))),xa(O,w,_),O[we]=s,si(O),w=O;break e;case"link":var J=Nd("link","href",z).get(w+(_.href||""));if(J){for(var ve=0;ve<J.length;ve++)if(O=J[ve],O.getAttribute("href")===(_.href==null||_.href===""?null:_.href)&&O.getAttribute("rel")===(_.rel==null?null:_.rel)&&O.getAttribute("title")===(_.title==null?null:_.title)&&O.getAttribute("crossorigin")===(_.crossOrigin==null?null:_.crossOrigin)){J.splice(ve,1);break t}}O=z.createElement(w),xa(O,w,_),z.head.appendChild(O);break;case"meta":if(J=Nd("meta","content",z).get(w+(_.content||""))){for(ve=0;ve<J.length;ve++)if(O=J[ve],O.getAttribute("content")===(_.content==null?null:""+_.content)&&O.getAttribute("name")===(_.name==null?null:_.name)&&O.getAttribute("property")===(_.property==null?null:_.property)&&O.getAttribute("http-equiv")===(_.httpEquiv==null?null:_.httpEquiv)&&O.getAttribute("charset")===(_.charSet==null?null:_.charSet)){J.splice(ve,1);break t}}O=z.createElement(w),xa(O,w,_),z.head.appendChild(O);break;default:throw Error(F(468,w))}O[we]=s,si(O),w=O}s.stateNode=w}else c_(z,s.type,s.stateNode);else s.stateNode=s_(z,w,s.memoizedProps);else O!==w?(O===null?_.stateNode!==null&&(_=_.stateNode,_.parentNode.removeChild(_)):O.count--,w===null?c_(z,s.type,s.stateNode):s_(z,w,s.memoizedProps)):w===null&&s.stateNode!==null&&kn(s,s.memoizedProps,_.memoizedProps)}break;case 27:u(d,s),y(s),w&512&&(qr||_===null||js(_,_.return)),_!==null&&w&4&&kn(s,s.memoizedProps,_.memoizedProps);break;case 5:if(u(d,s),y(s),w&512&&(qr||_===null||js(_,_.return)),s.flags&32){z=s.stateNode;try{Js(z,"")}catch(Fi){Ln(s,s.return,Fi)}}w&4&&s.stateNode!=null&&(z=s.memoizedProps,kn(s,z,_!==null?_.memoizedProps:z)),w&1024&&(yu=!0);break;case 6:if(u(d,s),y(s),w&4){if(s.stateNode===null)throw Error(F(162));w=s.memoizedProps,_=s.stateNode;try{_.nodeValue=w}catch(Fi){Ln(s,s.return,Fi)}}break;case 3:if(Ih=null,z=p,p=nm(d.containerInfo),u(d,s),p=z,y(s),w&4&&_!==null&&_.memoizedState.isDehydrated)try{$f(d.containerInfo)}catch(Fi){Ln(s,s.return,Fi)}yu&&(yu=!1,b(s));break;case 4:w=p,p=nm(s.stateNode.containerInfo),u(d,s),y(s),p=w;break;case 12:u(d,s),y(s);break;case 31:u(d,s),y(s),w&4&&(w=s.updateQueue,w!==null&&(s.updateQueue=null,o(s,w)));break;case 13:u(d,s),y(s),s.child.flags&8192&&s.memoizedState!==null!=(_!==null&&_.memoizedState!==null)&&(oi=pr()),w&4&&(w=s.updateQueue,w!==null&&(s.updateQueue=null,o(s,w)));break;case 22:z=s.memoizedState!==null;var Xe=_!==null&&_.memoizedState!==null,Pt=_l,Xt=qr;if(_l=Pt||z,qr=Xt||Xe,u(d,s),qr=Xt,_l=Pt,y(s),w&8192)e:for(d=s.stateNode,d._visibility=z?d._visibility&-2:d._visibility|1,z&&(_===null||Xe||_l||qr||C(s)),_=null,d=s;;){if(d.tag===5||d.tag===26){if(_===null){Xe=_=d;try{if(O=Xe.stateNode,z)J=O.style,typeof J.setProperty=="function"?J.setProperty("display","none","important"):J.display="none";else{ve=Xe.stateNode;var Jt=Xe.memoizedProps.style,Ot=Jt!=null&&Jt.hasOwnProperty("display")?Jt.display:null;ve.style.display=Ot==null||typeof Ot=="boolean"?"":(""+Ot).trim()}}catch(Fi){Ln(Xe,Xe.return,Fi)}}}else if(d.tag===6){if(_===null){Xe=d;try{Xe.stateNode.nodeValue=z?"":Xe.memoizedProps}catch(Fi){Ln(Xe,Xe.return,Fi)}}}else if(d.tag===18){if(_===null){Xe=d;try{var jt=Xe.stateNode;z?Mh(jt,!0):Mh(Xe.stateNode,!1)}catch(Fi){Ln(Xe,Xe.return,Fi)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===s)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break e;for(;d.sibling===null;){if(d.return===null||d.return===s)break e;_===d&&(_=null),d=d.return}_===d&&(_=null),d.sibling.return=d.return,d=d.sibling}w&4&&(w=s.updateQueue,w!==null&&(_=w.retryQueue,_!==null&&(w.retryQueue=null,o(s,_))));break;case 19:u(d,s),y(s),w&4&&(w=s.updateQueue,w!==null&&(s.updateQueue=null,o(s,w)));break;case 30:break;case 21:break;default:u(d,s),y(s)}}function y(s){var d=s.flags;if(d&2){try{for(var _,w=s.return;w!==null;){if(Hp(w)){_=w;break}w=w.return}if(_==null)throw Error(F(160));switch(_.tag){case 27:var z=_.stateNode,O=Bf(s);kf(s,O,z);break;case 5:var J=_.stateNode;_.flags&32&&(Js(J,""),_.flags&=-33);var ve=Bf(s);kf(s,ve,J);break;case 3:case 4:var Xe=_.stateNode.containerInfo,Pt=Bf(s);qp(s,Pt,Xe);break;default:throw Error(F(161))}}catch(Xt){Ln(s,s.return,Xt)}s.flags&=-3}d&4096&&(s.flags&=-4097)}function b(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var d=s;b(d),d.tag===5&&d.flags&1024&&d.stateNode.reset(),s=s.sibling}}function T(s,d){if(d.subtreeFlags&8772)for(d=d.child;d!==null;)Da(s,d.alternate,d),d=d.sibling}function C(s){for(s=s.child;s!==null;){var d=s;switch(d.tag){case 0:case 11:case 14:case 15:Yl(4,d,d.return),C(d);break;case 1:js(d,d.return);var _=d.stateNode;typeof _.componentWillUnmount=="function"&&jp(d,d.return,_),C(d);break;case 27:im(d.stateNode);case 26:case 5:js(d,d.return),C(d);break;case 22:d.memoizedState===null&&C(d);break;case 30:C(d);break;default:C(d)}s=s.sibling}}function I(s,d,_){for(_=_&&(d.subtreeFlags&8772)!==0,d=d.child;d!==null;){var w=d.alternate,z=s,O=d,J=O.flags;switch(O.tag){case 0:case 11:case 15:I(z,O,_),Wl(4,O);break;case 1:if(I(z,O,_),w=O,z=w.stateNode,typeof z.componentDidMount=="function")try{z.componentDidMount()}catch(Pt){Ln(w,w.return,Pt)}if(w=O,z=w.updateQueue,z!==null){var ve=w.stateNode;try{var Xe=z.shared.hiddenCallbacks;if(Xe!==null)for(z.shared.hiddenCallbacks=null,z=0;z<Xe.length;z++)iu(Xe[z],ve)}catch(Pt){Ln(w,w.return,Pt)}}_&&J&64&&Of(O),xh(O,O.return);break;case 27:vh(O);case 26:case 5:I(z,O,_),_&&w===null&&J&4&&Gp(O),xh(O,O.return);break;case 12:I(z,O,_);break;case 31:I(z,O,_),_&&J&4&&Gg(z,O);break;case 13:I(z,O,_),_&&J&4&&c(z,O);break;case 22:O.memoizedState===null&&I(z,O,_),xh(O,O.return);break;case 30:break;default:I(z,O,_)}d=d.sibling}}function B(s,d){var _=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(_=s.memoizedState.cachePool.pool),s=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(s=d.memoizedState.cachePool.pool),s!==_&&(s!=null&&s.refCount++,_!=null&&Ul(_))}function L(s,d){s=null,d.alternate!==null&&(s=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==s&&(d.refCount++,s!=null&&Ul(s))}function N(s,d,_,w){if(d.subtreeFlags&10256)for(d=d.child;d!==null;)H(s,d,_,w),d=d.sibling}function H(s,d,_,w){var z=d.flags;switch(d.tag){case 0:case 11:case 15:N(s,d,_,w),z&2048&&Wl(9,d);break;case 1:N(s,d,_,w);break;case 3:N(s,d,_,w),z&2048&&(s=null,d.alternate!==null&&(s=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==s&&(d.refCount++,s!=null&&Ul(s)));break;case 12:if(z&2048){N(s,d,_,w),s=d.stateNode;try{var O=d.memoizedProps,J=O.id,ve=O.onPostCommit;typeof ve=="function"&&ve(J,d.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(Xe){Ln(d,d.return,Xe)}}else N(s,d,_,w);break;case 31:N(s,d,_,w);break;case 13:N(s,d,_,w);break;case 23:break;case 22:O=d.stateNode,J=d.alternate,d.memoizedState!==null?O._visibility&2?N(s,d,_,w):q(s,d):O._visibility&2?N(s,d,_,w):(O._visibility|=2,j(s,d,_,w,(d.subtreeFlags&10256)!==0||!1)),z&2048&&B(J,d);break;case 24:N(s,d,_,w),z&2048&&L(d.alternate,d);break;default:N(s,d,_,w)}}function j(s,d,_,w,z){for(z=z&&((d.subtreeFlags&10256)!==0||!1),d=d.child;d!==null;){var O=s,J=d,ve=_,Xe=w,Pt=J.flags;switch(J.tag){case 0:case 11:case 15:j(O,J,ve,Xe,z),Wl(8,J);break;case 23:break;case 22:var Xt=J.stateNode;J.memoizedState!==null?Xt._visibility&2?j(O,J,ve,Xe,z):q(O,J):(Xt._visibility|=2,j(O,J,ve,Xe,z)),z&&Pt&2048&&B(J.alternate,J);break;case 24:j(O,J,ve,Xe,z),z&&Pt&2048&&L(J.alternate,J);break;default:j(O,J,ve,Xe,z)}d=d.sibling}}function q(s,d){if(d.subtreeFlags&10256)for(d=d.child;d!==null;){var _=s,w=d,z=w.flags;switch(w.tag){case 22:q(_,w),z&2048&&B(w.alternate,w);break;case 24:q(_,w),z&2048&&L(w.alternate,w);break;default:q(_,w)}d=d.sibling}}var W=8192;function ne(s,d,_){if(s.subtreeFlags&W)for(s=s.child;s!==null;)ie(s,d,_),s=s.sibling}function ie(s,d,_){switch(s.tag){case 26:ne(s,d,_),s.flags&W&&s.memoizedState!==null&&Wa(_,p,s.memoizedState,s.memoizedProps);break;case 5:ne(s,d,_);break;case 3:case 4:var w=p;p=nm(s.stateNode.containerInfo),ne(s,d,_),p=w;break;case 22:s.memoizedState===null&&(w=s.alternate,w!==null&&w.memoizedState!==null?(w=W,W=16777216,ne(s,d,_),W=w):ne(s,d,_));break;default:ne(s,d,_)}}function ee(s){var d=s.alternate;if(d!==null&&(s=d.child,s!==null)){d.child=null;do d=s.sibling,s.sibling=null,s=d;while(s!==null)}}function xe(s){var d=s.deletions;if((s.flags&16)!==0){if(d!==null)for(var _=0;_<d.length;_++){var w=d[_];ur=w,de(w,s)}ee(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)me(s),s=s.sibling}function me(s){switch(s.tag){case 0:case 11:case 15:xe(s),s.flags&2048&&Yl(9,s,s.return);break;case 3:xe(s);break;case 12:xe(s);break;case 22:var d=s.stateNode;s.memoizedState!==null&&d._visibility&2&&(s.return===null||s.return.tag!==13)?(d._visibility&=-3,ye(s)):xe(s);break;default:xe(s)}}function ye(s){var d=s.deletions;if((s.flags&16)!==0){if(d!==null)for(var _=0;_<d.length;_++){var w=d[_];ur=w,de(w,s)}ee(s)}for(s=s.child;s!==null;){switch(d=s,d.tag){case 0:case 11:case 15:Yl(8,d,d.return),ye(d);break;
vendor: 5,336 bytes, line 48
48case 22:_=d.stateNode,_._visibility&2&&(_._visibility&=-3,ye(d));break;default:ye(d)}s=s.sibling}}function de(s,d){for(;ur!==null;){var _=ur;switch(_.tag){case 0:case 11:case 15:Yl(8,_,d);break;case 23:case 22:if(_.memoizedState!==null&&_.memoizedState.cachePool!==null){var w=_.memoizedState.cachePool.pool;w!=null&&w.refCount++}break;case 24:Ul(_.memoizedState.cache)}if(w=_.child,w!==null)w.return=_,ur=w;else e:for(_=s;ur!==null;){w=ur;var z=w.sibling,O=w.return;if(bh(w),w===_){ur=null;break e}if(z!==null){z.return=O,ur=z;break e}ur=O}}}var se={getCacheForType:function(s){var d=Co(Wn),_=d.data.get(s);return _===void 0&&(_=s(),d.data.set(s,_)),_},cacheSignal:function(){return Co(Wn).controller.signal}},Te=typeof WeakMap=="function"?WeakMap:Map,Ae=0,Re=null,Be=null,Le=0,$e=0,ot=null,Fe=!1,Se=!1,Ke=!1,Ve=0,it=0,Et=0,Bt=0,Ct=0,At=0,Qt=0,Wt=null,Ft=null,Yt=!1,oi=0,fi=0,Ri=1/0,Hi=null,pi=null,zi=0,wi=null,an=null,tn=0,gn=0,Yi=null,Di=null,rn=0,Fn=null;function _n(){return(Ae&2)!==0&&Le!==0?Le&-Le:je.T!==null?Xp():$()}function un(){if(At===0)if((Le&536870912)===0||Bn){var s=Fa;Fa<<=1,(Fa&3932160)===0&&(Fa=262144),At=s}else At=536870912;return s=jo.current,s!==null&&(s.flags|=32),At}function Ci(s,d,_){(s===Re&&($e===2||$e===9)||s.cancelPendingCommit!==null)&&(co(s,0),xn(s,Le,At,!1)),_r(s,_),((Ae&2)===0||s!==Re)&&(s===Re&&((Ae&2)===0&&(Bt|=_),it===4&&xn(s,Le,At,!1)),Rc(s))}function Pi(s,d,_){if((Ae&6)!==0)throw Error(F(327));var w=!_&&(d&127)===0&&(d&s.expiredLanes)===0||xr(s,d),z=w?Zn(s,d):Pa(s,d,!0),O=w;do{if(z===0){Se&&!w&&xn(s,d,0,!1);break}else{if(_=s.current.alternate,O&&!Jn(_)){z=Pa(s,d,!1),O=!1;continue}if(z===2){if(O=d,s.errorRecoveryDisabledLanes&O)var J=0;else J=s.pendingLanes&-536870913,J=J!==0?J:J&536870912?536870912:0;if(J!==0){d=J;e:{var ve=s;z=Wt;var Xe=ve.current.memoizedState.isDehydrated;if(Xe&&(co(ve,J).flags|=256),J=Pa(ve,J,!1),J!==2){if(Ke&&!Xe){ve.errorRecoveryDisabledLanes|=O,Bt|=O,z=4;break e}O=Ft,Ft=z,O!==null&&(Ft===null?Ft=O:Ft.push.apply(Ft,O))}z=J}if(O=!1,z!==2)continue}}if(z===1){co(s,0),xn(s,d,0,!0);break}e:{switch(w=s,O=z,O){case 0:case 1:throw Error(F(345));case 4:if((d&4194048)!==d)break;case 6:xn(w,d,At,!Fe);break e;case 2:Ft=null;break;case 3:case 5:break;default:throw Error(F(329))}if((d&62914560)===d&&(z=oi+300-pr(),10<z)){if(xn(w,d,At,!Fe),ki(w,0,!0)!==0)break e;tn=d,w.timeoutHandle=Uf(Mn.bind(null,w,_,Ft,Hi,Yt,d,At,Bt,Qt,Fe,O,"Throttled",-0,0),z);break e}Mn(w,_,Ft,Hi,Yt,d,At,Bt,Qt,Fe,O,null,-0,0)}}break}while(!0);Rc(s)}function Mn(s,d,_,w,z,O,J,ve,Xe,Pt,Xt,Jt,Ot,jt){if(s.timeoutHandle=-1,Jt=d.subtreeFlags,Jt&8192||(Jt&16785408)===16785408){Jt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kr},ie(d,O,Jt);var Fi=(O&62914560)===O?oi-pr():(O&4194048)===O?fi-pr():0;if(Fi=yy(Jt,Fi),Fi!==null){tn=O,s.cancelPendingCommit=Fi(wh.bind(null,s,d,O,_,w,z,J,ve,Xe,Xt,Jt,null,Ot,jt)),xn(s,O,J,!Pt);return}}wh(s,d,O,_,w,z,J,ve,Xe)}function Jn(s){for(var d=s;;){var _=d.tag;if((_===0||_===11||_===15)&&d.flags&16384&&(_=d.updateQueue,_!==null&&(_=_.stores,_!==null)))for(var w=0;w<_.length;w++){var z=_[w],O=z.getSnapshot;z=z.value;try{if(!ha(O(),z))return!1}catch{return!1}}if(_=d.child,d.subtreeFlags&16384&&_!==null)_.return=d,d=_;else{if(d===s)break;for(;d.sibling===null;){if(d.return===null||d.return===s)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function xn(s,d,_,w){d&=~Ct,d&=~Bt,s.suspendedLanes|=d,s.pingedLanes&=~d,w&&(s.warmLanes|=d),w=s.expirationTimes;for(var z=d;0<z;){var O=31-Dr(z),J=1<<O;w[O]=-1,z&=~J}_!==0&&aa(s,_,d)}function Cn(){return(Ae&6)===0?(Eh(0),!1):!0}function Ro(){if(Be!==null){if($e===0)var s=Be.return;else s=Be,sl=fs=null,md(s),_c=null,rh=0,s=Be;for(;s!==null;)Vp(s.alternate,s),s=s.return;Be=null}}function co(s,d){var _=s.timeoutHandle;_!==-1&&(s.timeoutHandle=-1,Kx(_)),_=s.cancelPendingCommit,_!==null&&(s.cancelPendingCommit=null,_()),tn=0,Ro(),Re=s,Be=_=fa(s.current,null),Le=d,$e=0,ot=null,Fe=!1,Se=xr(s,d),Ke=!1,Qt=At=Ct=Bt=Et=it=0,Ft=Wt=null,Yt=!1,(d&8)!==0&&(d|=d&32);var w=s.entangledLanes;if(w!==0)for(s=s.entanglements,w&=d;0<w;){var z=31-Dr(w),O=1<<z;d|=s[z],w&=~O}return Ve=d,$c(),_}function Zr(s,d){zt=null,je.H=ks,d===nh||d===ld?(d=wp(),$e=3):d===bp?(d=wp(),$e=4):$e=d===Md?8:d!==null&&typeof d=="object"&&typeof d.then=="function"?6:1,ot=d,Be===null&&(it=1,Ad(s,po(d,s.current)))}function hn(){var s=jo.current;return s===null?!0:(Le&4194048)===Le?Io===null:(Le&62914560)===Le||(Le&536870912)!==0?s===Io:!1}function ga(){var s=je.H;return je.H=ks,s===null?ks:s}function uo(){var s=je.A;return je.A=se,s}function go(){it=4,Fe||(Le&4194048)!==Le&&jo.current!==null||(Se=!0),(Et&134217727)===0&&(Bt&134217727)===0||Re===null||xn(Re,Le,At,!1)}function Pa(s,d,_){var w=Ae;Ae|=2;var z=ga(),O=uo();(Re!==s||Le!==d)&&(Hi=null,co(s,d)),d=!1;var J=it;e:do try{if($e!==0&&Be!==null){var ve=Be,Xe=ot;switch($e){case 8:Ro(),J=6;break e;case 3:case 2:case 9:case 6:jo.current===null&&(d=!0);var Pt=$e;if($e=0,ot=null,Vr(s,ve,Xe,Pt),_&&Se){J=0;break e}break;default:Pt=$e,$e=0,ot=null,Vr(s,ve,Xe,Pt)}}na(),J=it;break}catch(Xt){Zr(s,Xt)}while(!0);return d&&s.shellSuspendCounter++,sl=fs=null,Ae=w,je.H=z,je.A=O,Be===null&&(Re=null,Le=0,$c()),J}function na(){for(;Be!==null;)Dn(Be)}function Zn(s,d){var _=Ae;Ae|=2;var w=ga(),z=uo();
vendor: 1,746 bytes, line 48
48Re!==s||Le!==d?(Hi=null,Ri=pr()+500,co(s,d)):Se=xr(s,d);e:do try{if($e!==0&&Be!==null){d=Be;var O=ot;t:switch($e){case 1:$e=0,ot=null,Vr(s,d,O,1);break;case 2:case 9:if(ud(O)){$e=0,ot=null,Sr(d);break}d=function(){$e!==2&&$e!==9||Re!==s||($e=7),Rc(s)},O.then(d,d);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:ud(O)?($e=0,ot=null,Sr(d)):($e=0,ot=null,Vr(s,d,O,7));break;case 5:var J=null;switch(Be.tag){case 26:J=Be.memoizedState;case 5:case 27:var ve=Be;if(J?u_(J):ve.stateNode.complete){$e=0,ot=null;var Xe=ve.sibling;if(Xe!==null)Be=Xe;else{var Pt=ve.return;Pt!==null?(Be=Pt,Yn(Pt)):Be=null}break t}}$e=0,ot=null,Vr(s,d,O,5);break;case 6:$e=0,ot=null,Vr(s,d,O,6);break;case 8:Ro(),it=6;break e;default:throw Error(F(462))}}yr();break}catch(Xt){Zr(s,Xt)}while(!0);return sl=fs=null,je.H=w,je.A=z,Ae=_,Be!==null?0:(Re=null,Le=0,$c(),it)}function yr(){for(;Be!==null&&!Wr();)Dn(Be)}function Dn(s){var d=zd(s.alternate,s,Ve);s.memoizedProps=s.pendingProps,d===null?Yn(s):Be=d}function Sr(s){var d=s,_=d.alternate;switch(d.tag){case 15:case 0:d=Cd(_,d,d.pendingProps,d.type,void 0,Le);break;case 11:d=Cd(_,d,d.pendingProps,d.type.render,d.ref,Le);break;case 5:md(d);default:Vp(_,d),d=Be=Ol(d,Ve),d=zd(_,d,Ve)}s.memoizedProps=s.pendingProps,d===null?Yn(s):Be=d}function Vr(s,d,_,w){sl=fs=null,md(d),_c=null,rh=0;var z=d.return;try{if(dh(s,z,d,_,Le)){it=1,Ad(s,po(_,s.current)),Be=null;return}}catch(O){if(z!==null)throw Be=z,O;it=1,Ad(s,po(_,s.current)),Be=null;return}d.flags&32768?(Bn||w===1?s=!0:Se||(Le&536870912)!==0?s=!1:(Fe=s=!0,(w===2||w===9||w===3||w===6)&&(w=jo.current,w!==null&&w.tag===13&&(w.flags|=16384))),_a(d,s)):Yn(d)}function Yn(s){var d=s;do{if((d.flags&32768)!==0){_a(d,Fe);return}s=d.return;var _=Pd(d.alternate,d,Ve);
vendor: 8,675 bytes, line 48
48if(_!==null){Be=_;return}if(d=d.sibling,d!==null){Be=d;return}Be=d=s}while(d!==null);it===0&&(it=5)}function _a(s,d){do{var _=Hm(s.alternate,s);if(_!==null){_.flags&=32767,Be=_;return}if(_=s.return,_!==null&&(_.flags|=32768,_.subtreeFlags=0,_.deletions=null),!d&&(s=s.sibling,s!==null)){Be=s;return}Be=s=_}while(s!==null);it=6,Be=null}function wh(s,d,_,w,z,O,J,ve,Xe){s.cancelPendingCommit=null;do Xa();while(zi!==0);if((Ae&6)!==0)throw Error(F(327));if(d!==null){if(d===s.current)throw Error(F(177));if(O=d.lanes|d.childLanes,O|=Kh,_t(s,_,O,J,ve,Xe),s===Re&&(Be=Re=null,Le=0),an=d,wi=s,tn=_,gn=O,Yi=z,Di=w,(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,iy(Sa,function(){return Hs(),null})):(s.callbackNode=null,s.callbackPriority=0),w=(d.flags&13878)!==0,(d.subtreeFlags&13878)!==0||w){w=je.T,je.T=null,z=St.p,St.p=2,J=Ae,Ae|=4;try{Rr(s,d,_)}finally{Ae=J,St.p=z,je.T=w}}zi=1,Gs(),vu(),bu()}}function Gs(){if(zi===1){zi=0;var s=wi,d=an,_=(d.flags&13878)!==0;if((d.subtreeFlags&13878)!==0||_){_=je.T,je.T=null;var w=St.p;St.p=2;var z=Ae;Ae|=4;try{g(d,s);var O=Ym,J=Rm(s.containerInfo),ve=O.focusedElem,Xe=O.selectionRange;if(J!==ve&&ve&&ve.ownerDocument&&zl(ve.ownerDocument.documentElement,ve)){if(Xe!==null&&qc(ve)){var Pt=Xe.start,Xt=Xe.end;if(Xt===void 0&&(Xt=Pt),"selectionStart"in ve)ve.selectionStart=Pt,ve.selectionEnd=Math.min(Xt,ve.value.length);else{var Jt=ve.ownerDocument||document,Ot=Jt&&Jt.defaultView||window;if(Ot.getSelection){var jt=Ot.getSelection(),Fi=ve.textContent.length,Qi=Math.min(Xe.start,Fi),hr=Xe.end===void 0?Qi:Math.min(Xe.end,Fi);!jt.extend&&Qi>hr&&(J=hr,hr=Qi,Qi=J);var xt=Va(ve,Qi),et=Va(ve,hr);if(xt&&et&&(jt.rangeCount!==1||jt.anchorNode!==xt.node||jt.anchorOffset!==xt.offset||jt.focusNode!==et.node||jt.focusOffset!==et.offset)){var Rt=Jt.createRange();Rt.setStart(xt.node,xt.offset),jt.removeAllRanges(),Qi>hr?(jt.addRange(Rt),jt.extend(et.node,et.offset)):(Rt.setEnd(et.node,et.offset),jt.addRange(Rt))}}}}for(Jt=[],jt=ve;jt=jt.parentNode;)jt.nodeType===1&&Jt.push({element:jt,left:jt.scrollLeft,top:jt.scrollTop});for(typeof ve.focus=="function"&&ve.focus(),ve=0;ve<Jt.length;ve++){var Kt=Jt[ve];Kt.element.scrollLeft=Kt.left,Kt.element.scrollTop=Kt.top}}lm=!!Wm,Ym=Wm=null}finally{Ae=z,St.p=w,je.T=_}}s.current=d,zi=2}}function vu(){if(zi===2){zi=0;var s=wi,d=an,_=(d.flags&8772)!==0;if((d.subtreeFlags&8772)!==0||_){_=je.T,je.T=null;var w=St.p;St.p=2;var z=Ae;Ae|=4;try{Da(s,d.alternate,d)}finally{Ae=z,St.p=w,je.T=_}}zi=3}}function bu(){if(zi===4||zi===3){zi=0,es();var s=wi,d=an,_=tn,w=Di;(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?zi=5:(zi=0,an=wi=null,ya(s,s.pendingLanes));var z=s.pendingLanes;if(z===0&&(pi=null),De(_),d=d.stateNode,Br&&typeof Br.onCommitFiberRoot=="function")try{Br.onCommitFiberRoot(ws,d,void 0,(d.current.flags&128)===128)}catch{}if(w!==null){d=je.T,z=St.p,St.p=2,je.T=null;try{for(var O=s.onRecoverableError,J=0;J<w.length;J++){var ve=w[J];O(ve.value,{componentStack:ve.stack})}}finally{je.T=d,St.p=z}}(tn&3)!==0&&Xa(),Rc(s),z=s.pendingLanes,(_&261930)!==0&&(z&42)!==0?s===Fn?rn++:(rn=0,Fn=s):rn=0,Eh(0)}}function ya(s,d){(s.pooledCacheLanes&=d)===0&&(d=s.pooledCache,d!=null&&(s.pooledCache=null,Ul(d)))}function Xa(){return Gs(),vu(),bu(),Hs()}function Hs(){if(zi!==5)return!1;var s=wi,d=gn;gn=0;var _=De(tn),w=je.T,z=St.p;try{St.p=32>_?32:_,je.T=null,_=Yi,Yi=null;var O=wi,J=tn;if(zi=0,an=wi=null,tn=0,(Ae&6)!==0)throw Error(F(331));var ve=Ae;if(Ae|=4,me(O.current),H(O,O.current,J,_),Ae=ve,Eh(0,!1),Br&&typeof Br.onPostCommitFiberRoot=="function")try{Br.onPostCommitFiberRoot(ws,O)}catch{}return!0}finally{St.p=z,je.T=w,ya(s,d)}}function La(s,d,_){d=po(_,d),d=Fs(s.stateNode,d,2),s=Hl(s,d,2),s!==null&&(_r(s,2),Rc(s))}function Ln(s,d,_){if(s.tag===3)La(s,s,_);else for(;d!==null;){if(d.tag===3){La(d,s,_);break}else if(d.tag===1){var w=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(pi===null||!pi.has(w))){s=po(_,s),_=ml(2),w=Hl(d,_,2),w!==null&&(eo(_,w,d,s),_r(w,2),Rc(w));break}}d=d.return}}function Ql(s,d,_){var w=s.pingCache;if(w===null){w=s.pingCache=new Te;var z=new Set;w.set(d,z)}else z=w.get(d),z===void 0&&(z=new Set,w.set(d,z));z.has(_)||(Ke=!0,z.add(_),s=Ff.bind(null,s,d,_),d.then(s,s))}function Ff(s,d,_){var w=s.pingCache;w!==null&&w.delete(d),s.pingedLanes|=s.suspendedLanes&_,s.warmLanes&=~_,Re===s&&(Le&_)===_&&(it===4||it===3&&(Le&62914560)===Le&&300>pr()-oi?(Ae&2)===0&&co(s,0):Ct|=_,Qt===Le&&(Qt=0)),Rc(s)}function Hg(s,d){d===0&&(d=gr()),s=Lt(s,d),s!==null&&(_r(s,d),Rc(s))}function ey(s){var d=s.memoizedState,_=0;d!==null&&(_=d.retryLane),Hg(s,_)}function ty(s,d){var _=0;switch(s.tag){case 31:case 13:var w=s.stateNode,z=s.memoizedState;z!==null&&(_=z.retryLane);break;case 19:w=s.stateNode;break;case 22:w=s.stateNode._retryCache;break;default:throw Error(F(314))}w!==null&&w.delete(d),Hg(s,_)}function iy(s,d){return Ja(s,d)}var Zp=null,yl=null,qm=!1,_o=!1,Th=!1,Sh=0;function Rc(s){s!==yl&&s.next===null&&(yl===null?Zp=yl=s:yl=yl.next=s),_o=!0,qm||(qm=!0,Xx())}function Eh(s,d){if(!Th&&_o){Th=!0;do for(var _=!1,w=Zp;w!==null;){if(s!==0){var z=w.pendingLanes;if(z===0)var O=0;else{var J=w.suspendedLanes,ve=w.pingedLanes;O=(1<<31-Dr(42|s)+1)-1,O&=z&~(J&~ve),O=O&201326741?O&201326741|1:O?O|2:0}O!==0&&(_=!0,Zg(w,O))}else O=Le,O=ki(w,w===Re?O:0,w.cancelPendingCommit!==null||w.timeoutHandle!==-1),(O&3)===0||xr(w,O)||(_=!0,Zg(w,O));w=w.next}while(_);Th=!1}}function $x(){qg()}function qg(){_o=qm=!1;var s=0;Sh!==0&&hy()&&(s=Sh);for(var d=pr(),_=null,w=Zp;w!==null;){var z=w.next,O=$p(w,d);O===0?(w.next=null,_===null?Zp=z:_.next=z,z===null&&(yl=_)):(_=w,(s!==0||(O&3)!==0)&&(_o=!0)),w=z}zi!==0&&zi!==5||Eh(s),Sh!==0&&(Sh=0)}function $p(s,d){for(var _=s.suspendedLanes,w=s.pingedLanes,z=s.expirationTimes,O=s.pendingLanes&-62914561;0<O;){var J=31-Dr(O),ve=1<<J,Xe=z[J];Xe===-1?((ve&_)===0||(ve&w)!==0)&&(z[J]=kr(ve,d)):Xe<=d&&(s.expiredLanes|=ve),O&=~ve}if(d=Re,_=Le,_=ki(s,s===d?_:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),w=s.callbackNode,_===0||s===d&&($e===2||$e===9)||s.cancelPendingCommit!==null)return w!==null&&w!==null&&Ys(w),s.callbackNode=null,s.callbackPriority=0;if((_&3)===0||xr(s,_)){if(d=_&-_,d===s.callbackPriority)return d;switch(w!==null&&Ys(w),De(_)){case 2:case 8:_=ts;break;case 32:_=Sa;break;case 268435456:_=zr;break;default:_=Sa}return w=ny.bind(null,s),_=Ja(_,w),s.callbackPriority=d,s.callbackNode=_,d}return w!==null&&w!==null&&Ys(w),s.callbackPriority=2,s.callbackNode=null,2}function ny(s,d){if(zi!==0&&zi!==5)return s.callbackNode=null,s.callbackPriority=0,null;var _=s.callbackNode;if(Xa()&&s.callbackNode!==_)return null;var w=Le;return w=ki(s,s===Re?w:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),w===0?null:(Pi(s,w,d),$p(s,pr()),s.callbackNode!=null&&s.callbackNode===_?ny.bind(null,s):null)}function Zg(s,d){if(Xa())return null;Pi(s,d,!0)}function Xx(){Qx(function(){(Ae&6)!==0?Ja(oa,$x):qg()})}function Xp(){if(Sh===0){var s=Vl;s===0&&(s=ka,ka<<=1,(ka&261888)===0&&(ka=256)),Sh=s}return Sh}function Jl(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:as(""+s)}function zc(s,d){var _=d.ownerDocument.createElement("input");return _.name=d.name,_.value=d.value,s.id&&_.setAttribute("form",s.id),d.parentNode.insertBefore(_,d),s=new FormData(s),_.parentNode.removeChild(_),s}function ry(s,d,_,w,z){if(d==="submit"&&_&&_.stateNode===z){var O=Jl((z[he]||null).action),J=w.submitter;J&&(d=(d=J[he]||null)?Jl(d.formAction):J.getAttribute("formAction"),d!==null&&(O=d,J=null));var ve=new lc("action","action",null,w,z);s.push({event:ve,listeners:[{instance:null,listener:function(){if(w.defaultPrevented){if(Sh!==0){var Xe=J?zc(z,J):new FormData(z);vd(_,{pending:!0,data:Xe,method:z.method,action:O},null,Xe)}}else typeof O=="function"&&(ve.preventDefault(),Xe=J?zc(z,J):new FormData(z),vd(_,{pending:!0,data:Xe,method:z.method,action:O},O,Xe))},currentTarget:z}]})}}for(var Zm=0;Zm<ea.length;Zm++){var Nf=ea[Zm],$g=Nf.toLowerCase(),Wp=Nf[0].toUpperCase()+Nf.slice(1);Ga($g,"on"+Wp)}Ga(of,"onAnimationEnd"),Ga(zm,"onAnimationIteration"),Ga(il,"onAnimationStart"),Ga("dblclick","onDoubleClick"),Ga("focusin","onFocus"),Ga("focusout","onBlur"),Ga(Dm,"onTransitionRun"),Ga(Pm,"onTransitionStart"),Ga(af,"onTransitionCancel"),Ga(sf,"onTransitionEnd"),jn("onMouseEnter",["mouseout","mouseover"]),jn("onMouseLeave",["mouseout","mouseover"]),jn("onPointerEnter",["pointerout","pointerover"]),jn("onPointerLeave",["pointerout","pointerover"]),or("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),or("onSelect","focusout contextmenu dragend focu
48sin keydown keyup mousedown mouseup selectionchange".split(" ")),or("onBeforeInput",["compositionend","keypress","textInput","paste"]),or("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),or("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),or("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ah="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(" "),oy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ah));function Yp(s,d){d=(d&4)!==0;for(var _=0;_<s.length;_++){var w=s[_],z=w.event;w=w.listeners;e:{var O=void 0;if(d)for(var J=w.length-1;0<=J;J--){var ve=w[J],Xe=ve.instance,Pt=ve.currentTarget;if(ve=ve.listener,Xe!==O&&z.isPropagationStopped())break e;O=ve,z.currentTarget=Pt;try{O(z)}catch(Xt){qu(Xt)}z.currentTarget=null,O=Xe}else for(J=0;J<w.length;J++){if(ve=w[J],Xe=ve.instance,Pt=ve.currentTarget,ve=ve.listener,Xe!==O&&z.isPropagationStopped())break e;O=ve,z.currentTarget=Pt;try{O(z)}catch(Xt){qu(Xt)}z.currentTarget=null,O=Xe}}}}function On(s,d){var _=d[Ge];_===void 0&&(_=d[Ge]=new Set);var w=s+"__bubble";_.has(w)||(wu(d,s,2,!1),_.add(w))}function Kp(s,d,_){var w=0;d&&(w|=4),wu(_,s,w,d)}var Qp="_reactListening"+Math.random().toString(36).slice(2);function $m(s){if(!s[Qp]){s[Qp]=!0,vi.forEach(function(_){_!=="selectionchange"&&(oy.has(_)||Kp(_,!1,s),Kp(_,!0,s))});var d=s.nodeType===9?s:s.ownerDocument;d===null||d[Qp]||(d[Qp]=!0,Kp("selectionchange",!1,d))}}function wu(s,d,_,w){switch(Ty(d)){case 2:var z=ig;break;case 8:z=wy;break;default:z=Hf}_=z.bind(null,d,_,s),z=void 0,!Nc||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(z=!0),w?z!==void 0?s.addEventListener(d,_,{capture:!0,passive:z}):s.addEventListener(d,_,!0):z!==void 0?s.addEventListener(d,_,{passive:z}):s.addEventListener(d,_,!1)}function Xm(s,d,_,w,z){var O=w;if((d&1)===0&&(d&2)===0&&w!==null)e:for(;;){if(w===null)return;var J=w.tag;if(J===3||J===4){var ve=w.stateNode.containerInfo;if(ve===z)break;if(J===4)for(J=w.return;J!==null;){var Xe=J.tag;if((Xe===3||Xe===4)&&J.stateNode.containerInfo===z)return;J=J.return}for(;ve!==null;){if(J=ri(ve),J===null)return;if(Xe=J.tag,Xe===5||Xe===6||Xe===26||Xe===27){w=O=J;continue e}ve=ve.parentNode}}w=w.return}cp(function(){var Pt=O,Xt=ac(_),Jt=[];e:{var Ot=Pl.get(s);if(Ot!==void 0){var jt=lc,Fi=s;switch(s){case"keypress":if(en(_)===0)break e;case"keydown":case"keyup":jt=la;break;case"focusin":Fi="focus",jt=No;break;case"focusout":Fi="blur",jt=No;break;case"beforeblur":case"afterblur":jt=No;break;case"click":if(_.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":jt=Fu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":jt=Vc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":jt=Qo;break;case of:case zm:case il:jt=Kd;break;case sf:jt=yn;break;case"scroll":case"scrollend":jt=qh;break;case"wheel":jt=Uu;break;case"copy":case"cut":case"paste":jt=pn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":jt=dn;break;case"toggle":case"beforetoggle":jt=Uo}var Qi=(d&4)!==0,hr=!Qi&&(s==="scroll"||s==="scrollend"),xt=Qi?Ot!==null?Ot+"Capture":null:Ot;Qi=[];for(var et=Pt,Rt;et!==null;){var Kt=et;if(Rt=Kt.stateNode,Kt=Kt.tag,Kt!==5&&Kt!==26&&Kt!==27||Rt===null||xt===null||(Kt=Bu(et,xt),Kt!=null&&Qi.push(Ld(et,Kt,Rt))),hr)break;et=et.return}0<Qi.length&&(Ot=new jt(Ot,Fi,null,_,Xt),Jt.push({event:Ot,listeners:Qi}))}}if((d&7)===0){e:{if(Ot=s==="mouseover"||s==="pointerover",jt=s==="mouseout"||s==="pointerout",Ot&&_!==ss&&(Fi=_.relatedTarget||_.fromElement)&&(ri(Fi)||Fi[Ie]))break e;if((jt||Ot)&&(Ot=Xt.window===Xt?Xt:(Ot=Xt.ownerDocument)?Ot.defaultView||Ot.parentWindow:window,jt?(Fi=_.relatedTarget||_.toElement,jt=Pt,Fi=Fi?ri(Fi):null,Fi!==null&&(hr=te(Fi),Qi=Fi.tag,Fi!==hr||Qi!==5&&Qi!==27&&Qi!==6)&&(Fi=null)):(jt=null,Fi=Pt),jt!==Fi)){if
vendor: 5,960 bytes, lines 48-49
48(Qi=Fu,Kt="onMouseLeave",xt="onMouseEnter",et="mouse",(s==="pointerout"||s==="pointerover")&&(Qi=dn,Kt="onPointerLeave",xt="onPointerEnter",et="pointer"),hr=jt==null?Ot:Mi(jt),Rt=Fi==null?Ot:Mi(Fi),Ot=new Qi(Kt,et+"leave",jt,_,Xt),Ot.target=hr,Ot.relatedTarget=Rt,Kt=null,ri(Xt)===Pt&&(Qi=new Qi(xt,et+"enter",Fi,_,Xt),Qi.target=Rt,Qi.relatedTarget=hr,Kt=Qi),hr=Kt,jt&&Fi)t:{for(Qi=Wx,xt=jt,et=Fi,Rt=0,Kt=xt;Kt;Kt=Qi(Kt))Rt++;Kt=0;for(var nn=et;nn;nn=Qi(nn))Kt++;for(;0<Rt-Kt;)xt=Qi(xt),Rt--;for(;0<Kt-Rt;)et=Qi(et),Kt--;for(;Rt--;){if(xt===et||et!==null&&xt===et.alternate){Qi=xt;break t}xt=Qi(xt),et=Qi(et)}Qi=null}else Qi=null;jt!==null&&ay(Jt,Ot,jt,Qi,!1),Fi!==null&&hr!==null&&ay(Jt,hr,Fi,Qi,!0)}}e:{if(Ot=Pt?Mi(Pt):window,jt=Ot.nodeName&&Ot.nodeName.toLowerCase(),jt==="select"||jt==="input"&&Ot.type==="file")var er=ti;else if(Ur(Ot))if(Hc)er=Hu;else{er=tl;var qi=_p}else jt=Ot.nodeName,!jt||jt.toLowerCase()!=="input"||Ot.type!=="checkbox"&&Ot.type!=="radio"?Pt&&Gh(Pt.elementType)&&(er=ti):er=Im;if(er&&(er=er(s,Pt))){As(Jt,er,_,Xt);break e}qi&&qi(s,Ot,Pt),s==="focusout"&&Pt&&Ot.type==="number"&&Pt.memoizedProps.value!=null&&Ss(Ot,"number",Ot.value)}switch(qi=Pt?Mi(Pt):window,s){case"focusin":(Ur(qi)||qi.contentEditable==="true")&&(Dl=qi,nf=Pt,Jo=null);break;case"focusout":Jo=nf=Dl=null;break;case"mousedown":rf=!0;break;case"contextmenu":case"mouseup":case"dragend":rf=!1,Yh(Jt,_,Xt);break;case"selectionchange":if(Wh)break;case"keydown":case"keyup":Yh(Jt,_,Xt)}var In;if(pp)e:{switch(s){case"compositionstart":var Gn="onCompositionStart";break e;case"compositionend":Gn="onCompositionEnd";break e;case"compositionupdate":Gn="onCompositionUpdate";break e}Gn=void 0}else so?$h(s,_)&&(Gn="onCompositionEnd"):s==="keydown"&&_.keyCode===229&&(Gn="onCompositionStart");Gn&&(Vu&&_.locale!=="ko"&&(so||Gn!=="onCompositionStart"?Gn==="onCompositionEnd"&&so&&(In=Yd()):(Ko=Xt,Uc="value"in Ko?Ko.value:Ko.textContent,so=!0)),qi=Jp(Pt,Gn),0<qi.length&&(Gn=new dp(Gn,s,null,_,Xt),Jt.push({event:Gn,listeners:qi}),In?Gn.data=In:(In=Mo(_),In!==null&&(Gn.data=In)))),(In=mp?ca(s,_):gp(s,_))&&(Gn=Jp(Pt,"onBeforeInput"),0<Gn.length&&(qi=new dp("onBeforeInput","beforeinput",null,_,Xt),Jt.push({event:qi,listeners:Gn}),qi.data=In)),ry(Jt,s,Pt,_,Xt)}Yp(Jt,d)})}function Ld(s,d,_){return{instance:s,listener:d,currentTarget:_}}function Jp(s,d){for(var _=d+"Capture",w=[];s!==null;){var z=s,O=z.stateNode;if(z=z.tag,z!==5&&z!==26&&z!==27||O===null||(z=Bu(s,_),z!=null&&w.unshift(Ld(s,z,O)),z=Bu(s,d),z!=null&&w.push(Ld(s,z,O))),s.tag===3)return w;s=s.return}return[]}function Wx(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function ay(s,d,_,w,z){for(var O=d._reactName,J=[];_!==null&&_!==w;){var ve=_,Xe=ve.alternate,Pt=ve.stateNode;if(ve=ve.tag,Xe!==null&&Xe===w)break;ve!==5&&ve!==26&&ve!==27||Pt===null||(Xe=Pt,z?(Pt=Bu(_,O),Pt!=null&&J.unshift(Ld(_,Pt,Xe))):z||(Pt=Bu(_,O),Pt!=null&&J.push(Ld(_,Pt,Xe)))),_=_.return}J.length!==0&&s.push({event:d,listeners:J})}var Yx=/\r\n?/g,sy=/\u0000|\uFFFD/g;function Xg(s){return(typeof s=="string"?s:""+s).replace(Yx,`
49`).replace(sy,"")}function ly(s,d){return d=Xg(d),Xg(s)===d}function Er(s,d,_,w,z,O){switch(_){case"children":typeof w=="string"?d==="body"||d==="textarea"&&w===""||Js(s,w):(typeof w=="number"||typeof w=="bigint")&&d!=="body"&&Js(s,""+w);break;case"className":wn(s,"class",w);break;case"tabIndex":wn(s,"tabindex",w);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(s,_,w);break;case"style":Xd(s,w,O);break;case"data":if(d!=="object"){wn(s,"data",w);break}case"src":case"href":if(w===""&&(d!=="a"||_!=="href")){s.removeAttribute(_);break}if(w==null||typeof w=="function"||typeof w=="symbol"||typeof w=="boolean"){s.removeAttribute(_);break}w=as(""+w),s.setAttribute(_,w);break;case"action":case"formAction":if(typeof w=="function"){s.setAttribute(_,"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 O=="function"&&(_==="formAction"?(d!=="input"&&Er(s,d,"name",z.name,z,null),Er(s,d,"formEncType",z.formEncType,z,null),Er(s,d,"formMethod",z.formMethod,z,null),Er(s,d,"formTarget",z.formTarget,z,null)):(Er(s,d,"encType",z.encType,z,null),Er(s,d,"method",z.method,z,null),Er(s,d,"target",z.target,z,null)));if(w==null||typeof w=="symbol"||typeof w=="boolean"){s.removeAttribute(_);break}w=as(""+w),s.setAttribute(_,w);break;case"onClick":w!=null&&(s.onclick=Kr);break;case"onScroll":w!=null&&On("scroll",s);break;case"onScrollEnd":w!=null&&On("scrollend",s);break;case"dangerouslySetInnerHTML":if(w!=null){if(typeof w!="object"||!("__html"in w))throw Error(F(61));if(_=w.__html,_!=null){if(z.children!=null)throw Error(F(60));s.innerHTML=_}}break;case"multiple":s.multiple=w&&typeof w!="function"&&typeof w!="symbol";break;case"muted":s.muted=w&&typeof w!="function"&&typeof w!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(w==null||typeof w=="function"||typeof w=="boolean"||typeof w=="symbol"){s.removeAttribute("xlink:href");break}_=as(""+w),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",_);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":w!=null&&typeof w!="function"&&typeof w!="symbol"?s.setAttribute(_,""+w):s.removeAttribute(_);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":w&&typeof w!="function"&&typeof w!="symbol"?s.setAttribute(_,""):s.removeAttribute(_);break;case"capture":case"download":w===!0?s.setAttribute(_,""):w!==!1&&w!=null&&typeof w!="function"&&typeof w!="symbol"?s.setAttribute(_,w):s.removeAttribute(_);break;case"cols":case"rows":case"size":case"span":w!=null&&typeof w!="function"&&typeof w!="symbol"&&!isNaN(w)&&1<=w?s.setAttribute(_,w):s.removeAttribute(_);break;case"rowSpan":case"start":w==null||typeof w=="function"||typeof w=="symbol"||isNaN(w)?s.removeAttribute(_):s.setAttribute(_,w);break;case"popover":On("beforetoggle",s),On("toggle",s),bn(s,"popover",w);break;case"xlinkActuate":zn(s,"http://www.w3.org/1999/xlink","xlink:actuate",w);break;case"xlinkArcrole":zn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",w);break;case"xlinkRole":zn(s,"http://www.w3.org/1999/xlink","xlink:role",w);break;case"xlinkShow":zn(s,"http://www.w3.org/1999/xlink","xlink:show",w);break;case"xlinkTitle":zn(s,"http://www.w3.org/1999/xlink","xlink:title",w);break;case"xlinkType":zn(s,"http://www.w3.org/1999/xlink","xlink:type",w);break;case"xmlBase":zn(s,"http://www.w3.org/XML/1998/namespace","xml:base",w);break;case"xmlLang":zn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",w);break;case"xmlSpace":zn(s,"http://www.w3.org/XML/1998/namespace","xml:space",w);break;case"is":bn(s,"is",w);break;case"innerText":case"textContent":break;default:(!(2<_.length)||_[0]!=="o"&&_[0]!=="O"||_[1]!=="n"&&_[1]!=="N")&&(_=ao.get(_)||_,bn(s,_,w))}}function Wg(s,d,_,w,z,O){switch(_){case"style":Xd(s,w,O);break;case"dangerouslySetInnerHTML":if(w!=null){if(typeof w!="object"||!("__html"in w))throw Error(F(61));if(_=w.__html,_!=null){if(z.children!=null)throw Error(F(60));s.innerHTML=_}}break;case"children":typeof w=="string"?Js(s,w):(typeof w=="number"||typeof w=="bigint")&&Js(s,""+w);break;case"onScroll":w!=null&&On("scroll",s);break;case"onScrollEnd":w!=null&&On("scrollend",s);break;case"onClick":w!=null&&(s.onclick=Kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rn.hasOwnProperty(_))e:{if(_[0]==="o"&&_[1]==="n"&&(z=_.endsWith("Capture"),d=_.slice(2,z?_.length-7:void 0),O=s[he]||null,O=O!=null?O[_]:null,typeof O=="function"&&s.removeEventListener(d,O,z),typeof w=="function")){typeof O!="function"&&O!==null&&(_ in s?s[_]=null:s.hasAttribute(_)&&s.removeAttribute(_)),s.addEventListener(d,w,z);break e}_ in s?s[_]=w:w===!0?s.setAttribute(_,""):bn(s,_,w)}}}function xa(s,d,_){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":On("error",s),On("load",s);var w=!1,z=!1,O;for(O in _)if(_.hasOwnProperty(O)){var J=_[O];if(J!=null)switch(O){case"src":w=!0;break;case"srcSet":z=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(F(137,d));default:Er(s,d,O,J,_,null)}}z&&Er(s,d,"srcSet",_.srcSet,_,null),w&&Er(s,d,"src",_.src,_,null);return;case"input":On("invalid",s);var ve=O=J=z=null,Xe=null,Pt=null;for(w in _)if(_.hasOwnProperty(w)){var Xt=_[w];if(Xt!=null)switch(w){case"name":z=Xt;break;case"type":J=Xt;break;case"checked":Xe=Xt;break;case"defaultChecked":Pt=Xt;break;case"value":O=Xt;break;case"defaultValue":ve=Xt;break;case"children":case"dangerouslySetInnerHTML":if(Xt!=null)throw Error(F(137,d));break;default:Er(s,d,w,Xt,_,null)}}Fo(s,O,ve,Xe,Pt,J,z,!1);return;case"select":On("invalid",s),w=J=O=null;for(z in _)if(_.hasOwnProperty(z)&&(ve=_[z],ve!=null))switch(z){case"value":O=ve;break;case"defaultValue":J=ve;break;case"multiple":w=ve;default:Er(s,d,z,ve,_,null)}d=O,_=J,s.multiple=!!w,d!=null?os(s,!!w,d,!1):_!=null&&os(s,!!w,_,!0);return;case"textarea":On("invalid",s),O=z=w=null;for(J in _)if(_.hasOwnProperty(J)&&(ve=_[J],ve!=null))switch(J){case"value":w=ve;break;case"defaultValue":z=ve;break;case"children":O=ve;break;case"dangerouslySetInnerHTML":if(ve!=null)throw Error(F(91));break;default:Er(s,d,J,ve,_,null)}Lu(s,w,z,O);return;case"option":for(Xe in _)if(_.hasOwnProperty(Xe)&&(w=_[Xe],w!=null))switch(Xe){case"selected":s.selected=w&&typeof w!="function"&&typeof w!="symbol";break;default:Er(s,d,Xe,w,_,null)}return;case"dialog":On("beforetoggle",s),On("toggle",s),On("cancel",s),On("close",s
vendor: 8,803 bytes, line 49
49);break;case"iframe":case"object":On("load",s);break;case"video":case"audio":for(w=0;w<Ah.length;w++)On(Ah[w],s);break;case"image":On("error",s),On("load",s);break;case"details":On("toggle",s);break;case"embed":case"source":case"link":On("error",s),On("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Pt in _)if(_.hasOwnProperty(Pt)&&(w=_[Pt],w!=null))switch(Pt){case"children":case"dangerouslySetInnerHTML":throw Error(F(137,d));default:Er(s,d,Pt,w,_,null)}return;default:if(Gh(d)){for(Xt in _)_.hasOwnProperty(Xt)&&(w=_[Xt],w!==void 0&&Wg(s,d,Xt,w,_,void 0));return}}for(ve in _)_.hasOwnProperty(ve)&&(w=_[ve],w!=null&&Er(s,d,ve,w,_,null))}function cy(s,d,_,w){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var z=null,O=null,J=null,ve=null,Xe=null,Pt=null,Xt=null;for(jt in _){var Jt=_[jt];if(_.hasOwnProperty(jt)&&Jt!=null)switch(jt){case"checked":break;case"value":break;case"defaultValue":Xe=Jt;default:w.hasOwnProperty(jt)||Er(s,d,jt,null,w,Jt)}}for(var Ot in w){var jt=w[Ot];if(Jt=_[Ot],w.hasOwnProperty(Ot)&&(jt!=null||Jt!=null))switch(Ot){case"type":O=jt;break;case"name":z=jt;break;case"checked":Pt=jt;break;case"defaultChecked":Xt=jt;break;case"value":J=jt;break;case"defaultValue":ve=jt;break;case"children":case"dangerouslySetInnerHTML":if(jt!=null)throw Error(F(137,d));break;default:jt!==Jt&&Er(s,d,Ot,jt,w,Jt)}}Yo(s,J,ve,Xe,Pt,Xt,O,z);return;case"select":jt=J=ve=Ot=null;for(O in _)if(Xe=_[O],_.hasOwnProperty(O)&&Xe!=null)switch(O){case"value":break;case"multiple":jt=Xe;default:w.hasOwnProperty(O)||Er(s,d,O,null,w,Xe)}for(z in w)if(O=w[z],Xe=_[z],w.hasOwnProperty(z)&&(O!=null||Xe!=null))switch(z){case"value":Ot=O;break;case"defaultValue":ve=O;break;case"multiple":J=O;default:O!==Xe&&Er(s,d,z,O,w,Xe)}d=ve,_=J,w=jt,Ot!=null?os(s,!!_,Ot,!1):!!w!=!!_&&(d!=null?os(s,!!_,d,!0):os(s,!!_,_?[]:"",!1));return;case"textarea":jt=Ot=null;for(ve in _)if(z=_[ve],_.hasOwnProperty(ve)&&z!=null&&!w.hasOwnProperty(ve))switch(ve){case"value":break;case"children":break;default:Er(s,d,ve,null,w,z)}for(J in w)if(z=w[J],O=_[J],w.hasOwnProperty(J)&&(z!=null||O!=null))switch(J){case"value":Ot=z;break;case"defaultValue":jt=z;break;case"children":break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(F(91));break;default:z!==O&&Er(s,d,J,z,w,O)}Ea(s,Ot,jt);return;case"option":for(var Fi in _)if(Ot=_[Fi],_.hasOwnProperty(Fi)&&Ot!=null&&!w.hasOwnProperty(Fi))switch(Fi){case"selected":s.selected=!1;break;default:Er(s,d,Fi,null,w,Ot)}for(Xe in w)if(Ot=w[Xe],jt=_[Xe],w.hasOwnProperty(Xe)&&Ot!==jt&&(Ot!=null||jt!=null))switch(Xe){case"selected":s.selected=Ot&&typeof Ot!="function"&&typeof Ot!="symbol";break;default:Er(s,d,Xe,Ot,w,jt)}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 Qi in _)Ot=_[Qi],_.hasOwnProperty(Qi)&&Ot!=null&&!w.hasOwnProperty(Qi)&&Er(s,d,Qi,null,w,Ot);for(Pt in w)if(Ot=w[Pt],jt=_[Pt],w.hasOwnProperty(Pt)&&Ot!==jt&&(Ot!=null||jt!=null))switch(Pt){case"children":case"dangerouslySetInnerHTML":if(Ot!=null)throw Error(F(137,d));break;default:Er(s,d,Pt,Ot,w,jt)}return;default:if(Gh(d)){for(var hr in _)Ot=_[hr],_.hasOwnProperty(hr)&&Ot!==void 0&&!w.hasOwnProperty(hr)&&Wg(s,d,hr,void 0,w,Ot);for(Xt in w)Ot=w[Xt],jt=_[Xt],!w.hasOwnProperty(Xt)||Ot===jt||Ot===void 0&&jt===void 0||Wg(s,d,Xt,Ot,w,jt);return}}for(var xt in _)Ot=_[xt],_.hasOwnProperty(xt)&&Ot!=null&&!w.hasOwnProperty(xt)&&Er(s,d,xt,null,w,Ot);for(Jt in w)Ot=w[Jt],jt=_[Jt],!w.hasOwnProperty(Jt)||Ot===jt||Ot==null&&jt==null||Er(s,d,Jt,Ot,w,jt)}function Yg(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function uy(){if(typeof performance.getEntriesByType=="function"){for(var s=0,d=0,_=performance.getEntriesByType("resource"),w=0;w<_.length;w++){var z=_[w],O=z.transferSize,J=z.initiatorType,ve=z.duration;if(O&&ve&&Yg(J)){for(J=0,ve=z.responseEnd,w+=1;w<_.length;w++){var Xe=_[w],Pt=Xe.startTime;if(Pt>ve)break;var Xt=Xe.transferSize,Jt=Xe.initiatorType;Xt&&Yg(Jt)&&(Xe=Xe.responseEnd,J+=Xt*(Xe<ve?1:(ve-Pt)/(Xe-Pt)))}if(--w,d+=8*(O+J)/(z.duration/1e3),s++,10<s)break}}if(0<s)return d/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Wm=null,Ym=null;function em(s){return s.nodeType===9?s:s.ownerDocument}function Kg(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Km(s,d){if(s===0)switch(d){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&d==="foreignObject"?0:s}function Dc(s,d){return s==="textarea"||s==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.children=="bigint"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var ho=null;function hy(){var s=window.event;return s&&s.type==="popstate"?s===ho?!1:(ho=s,!0):(ho=null,!1)}var Uf=typeof setTimeout=="function"?setTimeout:void 0,Kx=typeof clearTimeout=="function"?clearTimeout:void 0,dy=typeof Promise=="function"?Promise:void 0,Qx=typeof queueMicrotask=="function"?queueMicrotask:typeof dy<"u"?function(s){return dy.resolve(null).then(s).catch(Jx)}:Uf;function Jx(s){setTimeout(function(){throw s})}function qs(s){return s==="head"}function Qg(s,d){var _=d,w=0;do{var z=_.nextSibling;if(s.removeChild(_),z&&z.nodeType===8)if(_=z.data,_==="/$"||_==="/&"){if(w===0){s.removeChild(z),$f(d);return}w--}else if(_==="$"||_==="$?"||_==="$~"||_==="$!"||_==="&")w++;else if(_==="html")im(s.ownerDocument.documentElement);else if(_==="head"){_=s.ownerDocument.head,im(_);for(var O=_.firstChild;O;){var J=O.nextSibling,ve=O.nodeName;O[yt]||ve==="SCRIPT"||ve==="STYLE"||ve==="LINK"&&O.rel.toLowerCase()==="stylesheet"||_.removeChild(O),O=J}}else _==="body"&&im(s.ownerDocument.body);_=z}while(_);$f(d)}function Mh(s,d){var _=s;s=0;do{var w=_.nextSibling;if(_.nodeType===1?d?(_._stashedDisplay=_.style.display,_.style.display="none"):(_.style.display=_._stashedDisplay||"",_.getAttribute("style")===""&&_.removeAttribute("style")):_.nodeType===3&&(d?(_._stashedText=_.nodeValue,_.nodeValue=""):_.nodeValue=_._stashedText||""),w&&w.nodeType===8)if(_=w.data,_==="/$"){if(s===0)break;s--}else _!=="$"&&_!=="$?"&&_!=="$~"&&_!=="$!"||s++;_=w}while(_)}function Od(s){var d=s.firstChild;for(d&&d.nodeType===10&&(d=d.nextSibling);d;){var _=d;switch(d=d.nextSibling,_.nodeName){case"HTML":case"HEAD":case"BODY":Od(_),Zt(_);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(_.rel.toLowerCase()==="stylesheet")continue}s.removeChild(_)}}function e0(s,d,_,w){for(;s.nodeType===1;){var z=_;if(s.nodeName.toLowerCase()!==d.toLowerCase()){if(!w&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(w){if(!s[yt])switch(d){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(O=s.getAttribute("rel"),O==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(O!==z.rel||s.getAttribute("href")!==(z.href==null||z.href===""?null:z.href)||s.getAttribute("crossorigin")!==(z.crossOrigin==null?null:z.crossOrigin)||s.getAttribute("title")!==(z.title==null?null:z.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(O=s.getAttribute("src"),(O!==(z.src==null?null:z.src)||s.getAttribute("type")!==(z.type==null?null:z.type)||s.getAttribute("crossorigin")!==(z.crossOrigin==null?null:z.crossOrigin))&&O&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(d==="input"&&s.type==="hidden"){var O=z.name==null?null:""+z.name;if(z.type==="hidden"&&s.getAttribute("name")===O)return s}else return s;if(s=xl(s.nextSibling),s===null)break}return null}function t0(s,d,_){if(d==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!_||(s=xl(s.nextSibling),s===null))return null;return s}function fy(s,d){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!d||(s=xl(s.nextSibling),s===null))return null;return s}function Jg(s){return s.data==="$?"||s.data==="$~"}function e_(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function i0(s,d){var _=s.ownerDocument;if(s.data==="$~")s._reactRetry=d;else if(s.data!=="$?"||_.readyState!=="loading")d();else{var w=function(){d(),_.removeEventListener("DOMContentLoaded",w)};_.addEventListener("DOMContentLoaded",w),s._reactRetry=w}}function xl(s){for(;s!=null;s=s.nextSibling){var d=s.nodeType;if(d===1||d===3)break;if(d===8){if(d=s.data,d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"||d==="F!"||d==="F")break;
vendor: 10,253 bytes, line 49
49if(d==="/$"||d==="/&")return null}}return s}var tm=null;function py(s){s=s.nextSibling;for(var d=0;s;){if(s.nodeType===8){var _=s.data;if(_==="/$"||_==="/&"){if(d===0)return xl(s.nextSibling);d--}else _!=="$"&&_!=="$!"&&_!=="$?"&&_!=="$~"&&_!=="&"||d++}s=s.nextSibling}return null}function t_(s){s=s.previousSibling;for(var d=0;s;){if(s.nodeType===8){var _=s.data;if(_==="$"||_==="$!"||_==="$?"||_==="$~"||_==="&"){if(d===0)return s;d--}else _!=="/$"&&_!=="/&"||d++}s=s.previousSibling}return null}function Vf(s,d,_){switch(d=em(_),s){case"html":if(s=d.documentElement,!s)throw Error(F(452));return s;case"head":if(s=d.head,!s)throw Error(F(453));return s;case"body":if(s=d.body,!s)throw Error(F(454));return s;default:throw Error(F(451))}}function im(s){for(var d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Zt(s)}var Kn=new Map,Bd=new Set;function nm(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var vl=St.d;St.d={f:Qm,r:rm,D:om,C:n_,L:am,m:n0,X:r_,S:my,M:o_};function Qm(){var s=vl.f(),d=Cn();return s||d}function rm(s){var d=li(s);d!==null&&d.tag===5&&d.type==="form"?Op(d):vl.r(s)}var kd=typeof document>"u"?null:document;function i_(s,d,_){var w=kd;if(w&&typeof d=="string"&&d){var z=Gr(d);z='link[rel="'+s+'"][href="'+z+'"]',typeof _=="string"&&(z+='[crossorigin="'+_+'"]'),Bd.has(z)||(Bd.add(z),s={rel:s,crossOrigin:_,href:d},w.querySelector(z)===null&&(d=w.createElement("link"),xa(d,"link",s),si(d),w.head.appendChild(d)))}}function om(s){vl.D(s),i_("dns-prefetch",s,null)}function n_(s,d){vl.C(s,d),i_("preconnect",s,d)}function am(s,d,_){vl.L(s,d,_);var w=kd;if(w&&s&&d){var z='link[rel="preload"][as="'+Gr(d)+'"]';d==="image"&&_&&_.imageSrcSet?(z+='[imagesrcset="'+Gr(_.imageSrcSet)+'"]',typeof _.imageSizes=="string"&&(z+='[imagesizes="'+Gr(_.imageSizes)+'"]')):z+='[href="'+Gr(s)+'"]';var O=z;switch(d){case"style":O=jf(s);break;case"script":O=Ch(s)}Kn.has(O)||(s=oe({rel:"preload",href:d==="image"&&_&&_.imageSrcSet?void 0:s,as:d},_),Kn.set(O,s),w.querySelector(z)!==null||d==="style"&&w.querySelector($o(O))||d==="script"&&w.querySelector(Fd(O))||(d=w.createElement("link"),xa(d,"link",s),si(d),w.head.appendChild(d)))}}function n0(s,d){vl.m(s,d);var _=kd;if(_&&s){var w=d&&typeof d.as=="string"?d.as:"script",z='link[rel="modulepreload"][as="'+Gr(w)+'"][href="'+Gr(s)+'"]',O=z;switch(w){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":O=Ch(s)}if(!Kn.has(O)&&(s=oe({rel:"modulepreload",href:s},d),Kn.set(O,s),_.querySelector(z)===null)){switch(w){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(_.querySelector(Fd(O)))return}w=_.createElement("link"),xa(w,"link",s),si(w),_.head.appendChild(w)}}}function my(s,d,_){vl.S(s,d,_);var w=kd;if(w&&s){var z=Li(w).hoistableStyles,O=jf(s);d=d||"default";var J=z.get(O);if(!J){var ve={loading:0,preload:null};if(J=w.querySelector($o(O)))ve.loading=5;else{s=oe({rel:"stylesheet",href:s,"data-precedence":d},_),(_=Kn.get(O))&&l_(s,_);var Xe=J=w.createElement("link");si(Xe),xa(Xe,"link",s),Xe._p=new Promise(function(Pt,Xt){Xe.onload=Pt,Xe.onerror=Xt}),Xe.addEventListener("load",function(){ve.loading|=1}),Xe.addEventListener("error",function(){ve.loading|=2}),ve.loading|=4,Xo(J,d,w)}J={type:"stylesheet",instance:J,count:1,state:ve},z.set(O,J)}}}function r_(s,d){vl.X(s,d);var _=kd;if(_&&s){var w=Li(_).hoistableScripts,z=Ch(s),O=w.get(z);O||(O=_.querySelector(Fd(z)),O||(s=oe({src:s,async:!0},d),(d=Kn.get(z))&&sm(s,d),O=_.createElement("script"),si(O),xa(O,"link",s),_.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},w.set(z,O))}}function o_(s,d){vl.M(s,d);var _=kd;if(_&&s){var w=Li(_).hoistableScripts,z=Ch(s),O=w.get(z);O||(O=_.querySelector(Fd(z)),O||(s=oe({src:s,async:!0,type:"module"},d),(d=Kn.get(z))&&sm(s,d),O=_.createElement("script"),si(O),xa(O,"link",s),_.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},w.set(z,O))}}function Pc(s,d,_,w){var z=(z=hi.current)?nm(z):null;if(!z)throw Error(F(446));switch(s){case"meta":case"title":return null;case"style":return typeof _.precedence=="string"&&typeof _.href=="string"?(d=jf(_.href),_=Li(z).hoistableStyles,w=_.get(d),w||(w={type:"style",instance:null,count:0,state:null},_.set(d,w)),w):{type:"void",instance:null,count:0,state:null};case"link":if(_.rel==="stylesheet"&&typeof _.href=="string"&&typeof _.precedence=="string"){s=jf(_.href);var O=Li(z).hoistableStyles,J=O.get(s);if(J||(z=z.ownerDocument||z,J={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},O.set(s,J),(O=z.querySelector($o(s)))&&!O._p&&(J.instance=O,J.state.loading=5),Kn.has(s)||(_={rel:"preload",as:"style",href:_.href,crossOrigin:_.crossOrigin,integrity:_.integrity,media:_.media,hrefLang:_.hrefLang,referrerPolicy:_.referrerPolicy},Kn.set(s,_),O||a_(z,s,_,J.state))),d&&w===null)throw Error(F(528,""));return J}if(d&&w!==null)throw Error(F(529,""));return null;case"script":return d=_.async,_=_.src,typeof _=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Ch(_),_=Li(z).hoistableScripts,w=_.get(d),w||(w={type:"script",instance:null,count:0,state:null},_.set(d,w)),w):{type:"void",instance:null,count:0,state:null};default:throw Error(F(444,s))}}function jf(s){return'href="'+Gr(s)+'"'}function $o(s){return'link[rel="stylesheet"]['+s+"]"}function gy(s){return oe({},s,{"data-precedence":s.precedence,precedence:null})}function a_(s,d,_,w){s.querySelector('link[rel="preload"][as="style"]['+d+"]")?w.loading=1:(d=s.createElement("link"),w.preload=d,d.addEventListener("load",function(){return w.loading|=1}),d.addEventListener("error",function(){return w.loading|=2}),xa(d,"link",_),si(d),s.head.appendChild(d))}function Ch(s){return'[src="'+Gr(s)+'"]'}function Fd(s){return"script[async]"+s}function s_(s,d,_){if(d.count++,d.instance===null)switch(d.type){case"style":var w=s.querySelector('style[data-href~="'+Gr(_.href)+'"]');if(w)return d.instance=w,si(w),w;var z=oe({},_,{"data-href":_.href,"data-precedence":_.precedence,href:null,precedence:null});return w=(s.ownerDocument||s).createElement("style"),si(w),xa(w,"style",z),Xo(w,_.precedence,s),d.instance=w;case"stylesheet":z=jf(_.href);var O=s.querySelector($o(z));if(O)return d.state.loading|=4,d.instance=O,si(O),O;w=gy(_),(z=Kn.get(z))&&l_(w,z),O=(s.ownerDocument||s).createElement("link"),si(O);var J=O;return J._p=new Promise(function(ve,Xe){J.onload=ve,J.onerror=Xe}),xa(O,"link",w),d.state.loading|=4,Xo(O,_.precedence,s),d.instance=O;case"script":return O=Ch(_.src),(z=s.querySelector(Fd(O)))?(d.instance=z,si(z),z):(w=_,(z=Kn.get(O))&&(w=oe({},_),sm(w,z)),s=s.ownerDocument||s,z=s.createElement("script"),si(z),xa(z,"link",w),s.head.appendChild(z),d.instance=z);case"void":return null;default:throw Error(F(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(w=d.instance,d.state.loading|=4,Xo(w,_.precedence,s));return d.instance}function Xo(s,d,_){for(var w=_.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),z=w.length?w[w.length-1]:null,O=z,J=0;J<w.length;J++){var ve=w[J];if(ve.dataset.precedence===d)O=ve;else if(O!==z)break}O?O.parentNode.insertBefore(s,O.nextSibling):(d=_.nodeType===9?_.head:_,d.insertBefore(s,d.firstChild))}function l_(s,d){s.crossOrigin==null&&(s.crossOrigin=d.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=d.referrerPolicy),s.title==null&&(s.title=d.title)}function sm(s,d){s.crossOrigin==null&&(s.crossOrigin=d.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=d.referrerPolicy),s.integrity==null&&(s.integrity=d.integrity)}var Ih=null;function Nd(s,d,_){if(Ih===null){var w=new Map,z=Ih=new Map;z.set(_,w)}else z=Ih,w=z.get(_),w||(w=new Map,z.set(_,w));if(w.has(s))return w;for(w.set(s,null),_=_.getElementsByTagName(s),z=0;z<_.length;z++){var O=_[z];if(!(O[yt]||O[we]||s==="link"&&O.getAttribute("rel")==="stylesheet")&&O.namespaceURI!=="http://www.w3.org/2000/svg"){var J=O.getAttribute(d)||"";J=s+J;var ve=w.get(J);ve?ve.push(O):w.set(J,[O])}}return w}function c_(s,d,_){s=s.ownerDocument||s,s.head.insertBefore(_,d==="title"?s.querySelector("head > title"):null)}function _y(s,d,_){if(_===1||d.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return s=d.disabled,typeof d.precedence=="string"&&s==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function u_(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Wa(s,d,_,w){if(_.type==="stylesheet"&&(typeof w.media!="string"||matchMedia(w.media).matches!==!1)&&(_.state.loading&4)===0){if(_.instance===null){var z=jf(w.href),O=d.querySelector($o(z));if(O){d=O._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(s.count++,s=Tu.bind(s),d.then(s,s)),_.state.loading|=4,_.instance=O,si(O);return}O=d.ownerDocument||d,w=gy(w),(z=Kn.get(z))&&l_(w,z),O=O.createElement("link"),si(O);var J=O;J._p=new Promise(function(ve,Xe){J.onload=ve,J.onerror=Xe}),xa(O,"link",w),_.instance=O}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(_,d),(d=_.state.preload)&&(_.state.loading&3)===0&&(s.count++,_=Tu.bind(s),d.addEventListener("load",_),d.addEventListener("error",_))}}var Ud=0;function yy(s,d){return s.stylesheets&&s.count===0&&Gf(s,s.stylesheets),0<s.count||0<s.imgCount?function(_){var w=setTimeout(function(){if(s.stylesheets&&Gf(s,s.stylesheets),s.unsuspend){var O=s.unsuspend;s.unsuspend=null,O()}},6e4+d);0<s.imgBytes&&Ud===0&&(Ud=62500*uy());var z=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Gf(s,s.stylesheets),s.unsuspend)){var O=s.unsuspend;s.unsuspend=null,O()}},(s.imgBytes>Ud?50:800)+d);return s.unsuspend=_,function(){s.unsuspend=null,clearTimeout(w),clearTimeout(z)}}:null}function Tu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gf(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;
vendor: 10,028 bytes, line 49
49this.unsuspend=null,s()}}}var Zs=null;function Gf(s,d){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Zs=new Map,d.forEach(Rh,s),Zs=null,Tu.call(s))}function Rh(s,d){if(!(d.state.loading&4)){var _=Zs.get(s);if(_)var w=_.get(null);else{_=new Map,Zs.set(s,_);for(var z=s.querySelectorAll("link[data-precedence],style[data-precedence]"),O=0;O<z.length;O++){var J=z[O];(J.nodeName==="LINK"||J.getAttribute("media")!=="not all")&&(_.set(J.dataset.precedence,J),w=J)}w&&_.set(null,w)}z=d.instance,J=z.getAttribute("data-precedence"),O=_.get(J)||w,O===w&&_.set(null,z),_.set(J,z),this.count++,w=Tu.bind(this),z.addEventListener("load",w),z.addEventListener("error",w),O?O.parentNode.insertBefore(z,O.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(z,s.firstChild)),d.state.loading|=4}}var bl={$$typeof:dt,Provider:null,Consumer:null,_currentValue:Tt,_currentValue2:Tt,_threadCount:0};function Jm(s,d,_,w,z,O,J,ve,Xe){this.tag=1,this.containerInfo=s,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=Ks(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ks(0),this.hiddenUpdates=Ks(null),this.identifierPrefix=w,this.onUncaughtError=z,this.onCaughtError=O,this.onRecoverableError=J,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Xe,this.incompleteTransitions=new Map}function eg(s,d,_,w,z,O,J,ve,Xe,Pt,Xt,Jt){return s=new Jm(s,d,_,J,Xe,Pt,Xt,Jt,ve),d=1,O===!0&&(d|=24),O=da(3,null,null,d),s.current=O,O.stateNode=s,d=Qu(),d.refCount++,s.pooledCache=d,d.refCount++,O.memoizedState={element:w,isDehydrated:_,cache:d},dd(O),s}function tg(s){return s?(s=nl,s):nl}function xy(s,d,_,w,z,O){z=tg(z),w.context===null?w.context=z:w.pendingContext=z,w=ul(d),w.payload={element:_},O=O===void 0?null:O,O!==null&&(w.callback=O),_=Hl(s,w,d),_!==null&&(Ci(_,s,d),eu(_,s,d))}function vy(s,d){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var _=s.retryLane;s.retryLane=_!==0&&_<d?_:d}}function h_(s,d){vy(s,d),(s=s.alternate)&&vy(s,d)}function by(s){if(s.tag===13||s.tag===31){var d=Lt(s,67108864);d!==null&&Ci(d,s,67108864),h_(s,67108864)}}function d_(s){if(s.tag===13||s.tag===31){var d=_n();d=Ki(d);var _=Lt(s,d);_!==null&&Ci(_,s,d),h_(s,d)}}var lm=!0;function ig(s,d,_,w){var z=je.T;je.T=null;var O=St.p;try{St.p=2,Hf(s,d,_,w)}finally{St.p=O,je.T=z}}function wy(s,d,_,w){var z=je.T;je.T=null;var O=St.p;try{St.p=8,Hf(s,d,_,w)}finally{St.p=O,je.T=z}}function Hf(s,d,_,w){if(lm){var z=ng(w);if(z===null)Xm(s,d,w,Vd,_),um(s,w);else if(Ey(z,s,d,_,w))w.stopPropagation();else if(um(s,w),d&4&&-1<Sy.indexOf(s)){for(;z!==null;){var O=li(z);if(O!==null)switch(O.tag){case 3:if(O=O.stateNode,O.current.memoizedState.isDehydrated){var J=vn(O.pendingLanes);if(J!==0){var ve=O;for(ve.pendingLanes|=2,ve.entangledLanes|=2;J;){var Xe=1<<31-Dr(J);ve.entanglements[1]|=Xe,J&=~Xe}Rc(O),(Ae&6)===0&&(Ri=pr()+500,Eh(0))}}break;case 31:case 13:ve=Lt(O,2),ve!==null&&Ci(ve,O,2),Cn(),h_(O,2)}if(O=ng(w),O===null&&Xm(s,d,w,Vd,_),O===z)break;z=O}z!==null&&w.stopPropagation()}else Xm(s,d,w,null,_)}}function ng(s){return s=ac(s),f_(s)}var Vd=null;function f_(s){if(Vd=null,s=ri(s),s!==null){var d=te(s);if(d===null)s=null;else{var _=d.tag;if(_===13){if(s=fe(d),s!==null)return s;s=null}else if(_===31){if(s=a(d),s!==null)return s;s=null}else if(_===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;s=null}else d!==s&&(s=null)}}return Vd=s,null}function Ty(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Bo()){case oa:return 2;case ts:return 8;case Sa:case bs:return 32;case zr:return 268435456;default:return 32}default:return 32}}var cm=!1,Su=null,Lc=null,Oc=null,qf=new Map,Zf=new Map,Eu=[],Sy="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 um(s,d){switch(s){case"focusin":case"focusout":Su=null;break;case"dragenter":case"dragleave":Lc=null;break;case"mouseover":case"mouseout":Oc=null;break;case"pointerover":case"pointerout":qf.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zf.delete(d.pointerId)}}function _s(s,d,_,w,z,O){return s===null||s.nativeEvent!==O?(s={blockedOn:d,domEventName:_,eventSystemFlags:w,nativeEvent:O,targetContainers:[z]},d!==null&&(d=li(d),d!==null&&by(d)),s):(s.eventSystemFlags|=w,d=s.targetContainers,z!==null&&d.indexOf(z)===-1&&d.push(z),s)}function Ey(s,d,_,w,z){switch(d){case"focusin":return Su=_s(Su,s,d,_,w,z),!0;case"dragenter":return Lc=_s(Lc,s,d,_,w,z),!0;case"mouseover":return Oc=_s(Oc,s,d,_,w,z),!0;case"pointerover":var O=z.pointerId;return qf.set(O,_s(qf.get(O)||null,s,d,_,w,z)),!0;case"gotpointercapture":return O=z.pointerId,Zf.set(O,_s(Zf.get(O)||null,s,d,_,w,z)),!0}return!1}function Ay(s){var d=ri(s.target);if(d!==null){var _=te(d);if(_!==null){if(d=_.tag,d===13){if(d=fe(_),d!==null){s.blockedOn=d,K(s.priority,function(){d_(_)});return}}else if(d===31){if(d=a(_),d!==null){s.blockedOn=d,K(s.priority,function(){d_(_)});return}}else if(d===3&&_.stateNode.current.memoizedState.isDehydrated){s.blockedOn=_.tag===3?_.stateNode.containerInfo:null;return}}}s.blockedOn=null}function rg(s){if(s.blockedOn!==null)return!1;for(var d=s.targetContainers;0<d.length;){var _=ng(s.nativeEvent);if(_===null){_=s.nativeEvent;var w=new _.constructor(_.type,_);ss=w,_.target.dispatchEvent(w),ss=null}else return d=li(_),d!==null&&by(d),s.blockedOn=_,!1;d.shift()}return!0}function My(s,d,_){rg(s)&&_.delete(d)}function r0(){cm=!1,Su!==null&&rg(Su)&&(Su=null),Lc!==null&&rg(Lc)&&(Lc=null),Oc!==null&&rg(Oc)&&(Oc=null),qf.forEach(My),Zf.forEach(My)}function og(s,d){s.blockedOn===d&&(s.blockedOn=null,cm||(cm=!0,E.unstable_scheduleCallback(E.unstable_NormalPriority,r0)))}var ag=null;function Cy(s){ag!==s&&(ag=s,E.unstable_scheduleCallback(E.unstable_NormalPriority,function(){ag===s&&(ag=null);for(var d=0;d<s.length;d+=3){var _=s[d],w=s[d+1],z=s[d+2];if(typeof w!="function"){if(f_(w||_)===null)continue;break}var O=li(_);O!==null&&(s.splice(d,3),d-=3,vd(O,{pending:!0,data:z,method:_.method,action:w},w,z))}}))}function $f(s){function d(Xe){return og(Xe,s)}Su!==null&&og(Su,s),Lc!==null&&og(Lc,s),Oc!==null&&og(Oc,s),qf.forEach(d),Zf.forEach(d);for(var _=0;_<Eu.length;_++){var w=Eu[_];w.blockedOn===s&&(w.blockedOn=null)}for(;0<Eu.length&&(_=Eu[0],_.blockedOn===null);)Ay(_),_.blockedOn===null&&Eu.shift();if(_=(s.ownerDocument||s).$$reactFormReplay,_!=null)for(w=0;w<_.length;w+=3){var z=_[w],O=_[w+1],J=z[he]||null;if(typeof O=="function")J||Cy(_);else if(J){var ve=null;if(O&&O.hasAttribute("formAction")){if(z=O,J=O[he]||null)ve=J.formAction;else if(f_(z)!==null)continue}else ve=J.action;typeof ve=="function"?_[w+1]=ve:(_.splice(w,3),w-=3),Cy(_)}}}function Xf(){function s(O){O.canIntercept&&O.info==="react-transition"&&O.intercept({handler:function(){return new Promise(function(J){return z=J})},focusReset:"manual",scroll:"manual"})}function d(){z!==null&&(z(),z=null),w||setTimeout(_,20)}function _(){if(!w&&!navigation.transition){var O=navigation.currentEntry;O&&O.url!=null&&navigation.navigate(O.url,{state:O.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var w=!1,z=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",d),navigation.addEventListener("navigateerror",d),setTimeout(_,100),function(){w=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",d),navigation.removeEventListener("navigateerror",d),z!==null&&(z(),z=null)}}}function p_(s){this._internalRoot=s}hm.prototype.render=p_.prototype.render=function(s){var d=this._internalRoot;if(d===null)throw Error(F(409));var _=d.current,w=_n();xy(_,w,s,d,null,null)},hm.prototype.unmount=p_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var d=s.containerInfo;xy(s.current,2,null,s,null,null),Cn(),d[Ie]=null}};function hm(s){this._internalRoot=s}hm.prototype.unstable_scheduleHydration=function(s){if(s){var d=$();s={blockedOn:null,target:s,priority:d};for(var _=0;_<Eu.length&&d!==0&&d<Eu[_].priority;_++);Eu.splice(_,0,s),_===0&&Ay(s)}};var dm=P.version;if(dm!=="19.2.1")throw Error(F(527,dm,"19.2.1"));St.findDOMNode=function(s){var d=s._reactInternals;if(d===void 0)throw typeof s.render=="function"?Error(F(188)):(s=Object.keys(s).join(","),Error(F(268,s)));return s=re(d),s=s!==null?Ee(s):null,s=s===null?null:s.stateNode,s};var Iy={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:je,reconcilerVersion:"19.2.1"};
vendor: 5,136 bytes, line 49
49if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wf.isDisabled&&Wf.supportsFiber)try{ws=Wf.inject(Iy),Br=Wf}catch{}}return $_.createRoot=function(s,d){if(!X(s))throw Error(F(299));var _=!1,w="",z=Gm,O=Pn,J=Gi;return d!=null&&(d.unstable_strictMode===!0&&(_=!0),d.identifierPrefix!==void 0&&(w=d.identifierPrefix),d.onUncaughtError!==void 0&&(z=d.onUncaughtError),d.onCaughtError!==void 0&&(O=d.onCaughtError),d.onRecoverableError!==void 0&&(J=d.onRecoverableError)),d=eg(s,1,!1,null,null,_,w,null,z,O,J,Xf),s[Ie]=d.current,$m(s),new p_(d)},$_.hydrateRoot=function(s,d,_){if(!X(s))throw Error(F(299));var w=!1,z="",O=Gm,J=Pn,ve=Gi,Xe=null;return _!=null&&(_.unstable_strictMode===!0&&(w=!0),_.identifierPrefix!==void 0&&(z=_.identifierPrefix),_.onUncaughtError!==void 0&&(O=_.onUncaughtError),_.onCaughtError!==void 0&&(J=_.onCaughtError),_.onRecoverableError!==void 0&&(ve=_.onRecoverableError),_.formState!==void 0&&(Xe=_.formState)),d=eg(s,1,!0,d,_??null,w,z,Xe,O,J,ve,Xf),d.context=tg(null),_=d.current,w=_n(),w=Ki(w),z=ul(w),z.callback=null,Hl(_,z,w),_=w,d.current.lanes=_,_r(d,_),Rc(d),s[Ie]=d.current,$m(s),new hm(d)},$_.version="19.2.1",$_}var R2;function _C(){if(R2)return dv.exports;R2=1;function E(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(E)}catch(P){console.error(P)}}return E(),dv.exports=gC(),dv.exports}var yC=_C(),ze=kx();const Ti=Bx(ze),$v=cC({__proto__:null,default:Ti},[ze]),wT=ze.createContext(void 0);function xC({children:E,defaultTheme:P="light",switchable:k=!1}){const[F,X]=ze.useState(()=>k&&localStorage.getItem("theme")||P);ze.useEffect(()=>{const fe=document.documentElement;F==="dark"?fe.classList.add("dark"):fe.classList.remove("dark"),k&&localStorage.setItem("theme",F)},[F,k]);const te=k?()=>{X(fe=>fe==="light"?"dark":"light")}:void 0;return Ce.jsx(wT.Provider,{"data-loc":"client/src/contexts/ThemeContext.tsx:52",value:{theme:F,toggleTheme:te,switchable:k},children:E})}function vC(){const E=ze.useContext(wT);if(!E)throw new Error("useTheme must be used within ThemeProvider");return E}var Xv=bT();const TT=Bx(Xv);function bC(E){if(typeof document>"u")return;let P=document.head||document.getElementsByTagName("head")[0],k=document.createElement("style");k.type="text/css",P.appendChild(k),k.styleSheet?k.styleSheet.cssText=E:k.appendChild(document.createTextNode(E))}const wC=E=>{switch(E){case"success":return EC;case"info":return MC;case"warning":return AC;case"error":return CC;default:return null}},TC=Array(12).fill(0),SC=({visible:E,className:P})=>Ti.createElement("div",{className:["sonner-loading-wrapper",P].filter(Boolean).join(" "),"data-visible":E},Ti.createElement("div",{className:"sonner-spinner"},TC.map((k,F)=>Ti.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${F}`})))),EC=Ti.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ti.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),AC=Ti.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ti.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),MC=Ti.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ti.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),CC=Ti.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ti.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),IC=Ti.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ti.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ti.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),RC=()=>{const[E,P]=Ti.useState(document.hidden);return Ti.useEffect(()=>{const k=()=>{P(document.hidden)};return document.addEventListener("visibilitychange",k),()=>window.removeEventListener("visibilitychange",k)},[]),E};let Lv=1;class zC{constructor(){this.subscribe=P=>(this.subscribers.push(P),()=>{const k=this.subscribers.indexOf(P);this.subscribers.splice(k,1)}),this.publish=P=>
vendor: 3,706 bytes, line 49
49{this.subscribers.forEach(k=>k(P))},this.addToast=P=>{this.publish(P),this.toasts=[...this.toasts,P]},this.create=P=>{var k;const{message:F,...X}=P,te=typeof P?.id=="number"||((k=P.id)==null?void 0:k.length)>0?P.id:Lv++,fe=this.toasts.find(ue=>ue.id===te),a=P.dismissible===void 0?!0:P.dismissible;return this.dismissedToasts.has(te)&&this.dismissedToasts.delete(te),fe?this.toasts=this.toasts.map(ue=>ue.id===te?(this.publish({...ue,...P,id:te,title:F}),{...ue,...P,id:te,dismissible:a,title:F}):ue):this.addToast({title:F,...X,dismissible:a,id:te}),te},this.dismiss=P=>(P?(this.dismissedToasts.add(P),requestAnimationFrame(()=>this.subscribers.forEach(k=>k({id:P,dismiss:!0})))):this.toasts.forEach(k=>{this.subscribers.forEach(F=>F({id:k.id,dismiss:!0}))}),P),this.message=(P,k)=>this.create({...k,message:P}),this.error=(P,k)=>this.create({...k,message:P,type:"error"}),this.success=(P,k)=>this.create({...k,type:"success",message:P}),this.info=(P,k)=>this.create({...k,type:"info",message:P}),this.warning=(P,k)=>this.create({...k,type:"warning",message:P}),this.loading=(P,k)=>this.create({...k,type:"loading",message:P}),this.promise=(P,k)=>{if(!k)return;let F;k.loading!==void 0&&(F=this.create({...k,promise:P,type:"loading",message:k.loading,description:typeof k.description!="function"?k.description:void 0}));const X=Promise.resolve(P instanceof Function?P():P);let te=F!==void 0,fe;const a=X.then(async re=>{if(fe=["resolve",re],Ti.isValidElement(re))te=!1,this.create({id:F,type:"default",message:re});else if(PC(re)&&!re.ok){te=!1;const oe=typeof k.error=="function"?await k.error(`HTTP error! status: ${re.status}`):k.error,ke=typeof k.description=="function"?await k.description(`HTTP error! status: ${re.status}`):k.description,ft=typeof oe=="object"&&!Ti.isValidElement(oe)?oe:{message:oe};this.create({id:F,type:"error",description:ke,...ft})}else if(re instanceof Error){te=!1;const oe=typeof k.error=="function"?await k.error(re):k.error,ke=typeof k.description=="function"?await k.description(re):k.description,ft=typeof oe=="object"&&!Ti.isValidElement(oe)?oe:{message:oe};this.create({id:F,type:"error",description:ke,...ft})}else if(k.success!==void 0){te=!1;const oe=typeof k.success=="function"?await k.success(re):k.success,ke=typeof k.description=="function"?await k.description(re):k.description,ft=typeof oe=="object"&&!Ti.isValidElement(oe)?oe:{message:oe};this.create({id:F,type:"success",description:ke,...ft})}}).catch(async re=>{if(fe=["reject",re],k.error!==void 0){te=!1;const Ee=typeof k.error=="function"?await k.error(re):k.error,oe=typeof k.description=="function"?await k.description(re):k.description,Qe=typeof Ee=="object"&&!Ti.isValidElement(Ee)?Ee:{message:Ee};this.create({id:F,type:"error",description:oe,...Qe})}}).finally(()=>{te&&(this.dismiss(F),F=void 0),k.finally==null||k.finally.call(k)}),ue=()=>new Promise((re,Ee)=>a.then(()=>fe[0]==="reject"?Ee(fe[1]):re(fe[1])).catch(Ee));return typeof F!="string"&&typeof F!="number"?{unwrap:ue}:Object.assign(F,{unwrap:ue})},this.custom=(P,k)=>{const F=k?.id||Lv++;return this.create({jsx:P(F),id:F,...k}),F},this.getActiveToasts=()=>this.toasts.filter(P=>!this.dismissedToasts.has(P.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const wl=new zC,DC=(E,P)=>{const k=P?.id||Lv++;return wl.addToast({title:E,...P,id:k}),k},PC=E=>E&&typeof E=="object"&&"ok"in E&&typeof E.ok=="boolean"&&"status"in E&&typeof E.status=="number",LC=DC,OC=()=>wl.toasts,BC=()=>wl.getActiveToasts();Object.assign(LC,{success:wl.success,info:wl.info,warning:wl.warning,error:wl.error,custom:wl.custom,message:wl.message,promise:wl.promise,dismiss:wl.dismiss,loading:wl.loading},{getHistory:OC,getToasts:BC});bC
vendor: 4,787 bytes, line 49
49("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;
vendor: 10,086 bytes, line 49
49left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function 
vendor: 827 bytes, line 49
49px(E){return E.label!==void 0}const kC=3,FC="24px",NC="16px",z2=4e3,UC=356,VC=14,jC=45,GC=200;function Oh(...E){return E.filter(Boolean).join(" ")}function HC(E){const[P,k]=E.split("-"),F=[];return P&&F.push(P),k&&F.push(k),F}const qC=E=>{var P,k,F,X,te,fe,a,ue,re;const{invert:Ee,toast:oe,unstyled:ke,interacting:Qe,setHeights:ft,visibleToasts:Ne,heights:Je,index:mt,toasts:pt,expanded:dt,removeToast:nt,defaultRichColors:vt,closeButton:ut,style:rt,cancelButtonStyle:wt,actionButtonStyle:Ii,className:ji="",descriptionClassName:Bi="",duration:ai,position:Vt,gap:gi,expandByDefault:Si,classNames:je,icons:St,closeButtonAriaLabel:Tt="Close toast"}=E,[_i,ei]=Ti.useState(null),[Ue,Dt]=Ti.useState(null),[bt,Ht]=Ti.useState(!1),[ui,hi]=Ti.useState(!1),[Ai,Oi]=Ti.useState(!1),[xi,ln]=Ti.useState(!1),[Xn,Or]=Ti.useState(!1),[Nn,bo
vendor: 14,560 bytes, line 49
49]=Ti.useState(0),[Ka,Qa]=Ti.useState(0),Oo=Ti.useRef(oe.duration||ai||z2),rr=Ti.useRef(null),wo=Ti.useRef(null),Ja=mt===0,Ys=mt+1<=Ne,Wr=oe.type,es=oe.dismissible!==!1,pr=oe.className||"",Bo=oe.descriptionClassName||"",oa=Ti.useMemo(()=>Je.findIndex(ki=>ki.toastId===oe.id)||0,[Je,oe.id]),ts=Ti.useMemo(()=>{var ki;return(ki=oe.closeButton)!=null?ki:ut},[oe.closeButton,ut]),Sa=Ti.useMemo(()=>oe.duration||ai||z2,[oe.duration,ai]),bs=Ti.useRef(0),zr=Ti.useRef(0),El=Ti.useRef(0),oo=Ti.useRef(null),[ws,Br]=Vt.split("-"),mr=Ti.useMemo(()=>Je.reduce((ki,xr,kr)=>kr>=oa?ki:ki+xr.height,0),[Je,oa]),Dr=RC(),Ts=oe.invert||Ee,is=Wr==="loading";zr.current=Ti.useMemo(()=>oa*gi+mr,[oa,mr]),Ti.useEffect(()=>{Oo.current=Sa},[Sa]),Ti.useEffect(()=>{Ht(!0)},[]),Ti.useEffect(()=>{const ki=wo.current;if(ki){const xr=ki.getBoundingClientRect().height;return Qa(xr),ft(kr=>[{toastId:oe.id,height:xr,position:oe.position},...kr]),()=>ft(kr=>kr.filter(gr=>gr.toastId!==oe.id))}},[ft,oe.id]),Ti.useLayoutEffect(()=>{if(!bt)return;const ki=wo.current,xr=ki.style.height;ki.style.height="auto";const kr=ki.getBoundingClientRect().height;ki.style.height=xr,Qa(kr),ft(gr=>gr.find(_r=>_r.toastId===oe.id)?gr.map(_r=>_r.toastId===oe.id?{..._r,height:kr}:_r):[{toastId:oe.id,height:kr,position:oe.position},...gr])},[bt,oe.title,oe.description,ft,oe.id,oe.jsx,oe.action,oe.cancel]);const To=Ti.useCallback(()=>{hi(!0),bo(zr.current),ft(ki=>ki.filter(xr=>xr.toastId!==oe.id)),setTimeout(()=>{nt(oe)},GC)},[oe,nt,ft,zr]);Ti.useEffect(()=>{if(oe.promise&&Wr==="loading"||oe.duration===1/0||oe.type==="loading")return;let ki;return dt||Qe||Dr?(()=>{if(El.current<bs.current){const gr=new Date().getTime()-bs.current;Oo.current=Oo.current-gr}El.current=new Date().getTime()})():(()=>{Oo.current!==1/0&&(bs.current=new Date().getTime(),ki=setTimeout(()=>{oe.onAutoClose==null||oe.onAutoClose.call(oe,oe),To()},Oo.current))})(),()=>clearTimeout(ki)},[dt,Qe,oe,Wr,Dr,To]),Ti.useEffect(()=>{oe.delete&&(To(),oe.onDismiss==null||oe.onDismiss.call(oe,oe))},[To,oe.delete]);function ka(){var ki;if(St?.loading){var xr;return Ti.createElement("div",{className:Oh(je?.loader,oe==null||(xr=oe.classNames)==null?void 0:xr.loader,"sonner-loader"),"data-visible":Wr==="loading"},St.loading)}return Ti.createElement(SC,{className:Oh(je?.loader,oe==null||(ki=oe.classNames)==null?void 0:ki.loader),visible:Wr==="loading"})}const Fa=oe.icon||St?.[Wr]||wC(Wr);var ns,vn;return Ti.createElement("li",{tabIndex:0,ref:wo,className:Oh(ji,pr,je?.toast,oe==null||(P=oe.classNames)==null?void 0:P.toast,je?.default,je?.[Wr],oe==null||(k=oe.classNames)==null?void 0:k[Wr]),"data-sonner-toast":"","data-rich-colors":(ns=oe.richColors)!=null?ns:vt,"data-styled":!(oe.jsx||oe.unstyled||ke),"data-mounted":bt,"data-promise":!!oe.promise,"data-swiped":Xn,"data-removed":ui,"data-visible":Ys,"data-y-position":ws,"data-x-position":Br,"data-index":mt,"data-front":Ja,"data-swiping":Ai,"data-dismissible":es,"data-type":Wr,"data-invert":Ts,"data-swipe-out":xi,"data-swipe-direction":Ue,"data-expanded":!!(dt||Si&&bt),"data-testid":oe.testId,style:{"--index":mt,"--toasts-before":mt,"--z-index":pt.length-mt,"--offset":`${ui?Nn:zr.current}px`,"--initial-height":Si?"auto":`${Ka}px`,...rt,...oe.style},onDragEnd:()=>{Oi(!1),ei(null),oo.current=null},onPointerDown:ki=>{ki.button!==2&&(is||!es||(rr.current=new Date,bo(zr.current),ki.target.setPointerCapture(ki.pointerId),ki.target.tagName!=="BUTTON"&&(Oi(!0),oo.current={x:ki.clientX,y:ki.clientY})))},onPointerUp:()=>{var ki,xr,kr;if(xi||!es)return;oo.current=null;const gr=Number(((ki=wo.current)==null?void 0:ki.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ks=Number(((xr=wo.current)==null?void 0:xr.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),_r=new Date().getTime()-((kr=rr.current)==null?void 0:kr.getTime()),_t=_i==="x"?gr:Ks,aa=Math.abs(_t)/_r;if(Math.abs(_t)>=jC||aa>.11){bo(zr.current),oe.onDismiss==null||oe.onDismiss.call(oe,oe),Dt(_i==="x"?gr>0?"right":"left":Ks>0?"down":"up"),To(),ln(!0);return}else{var Wo,So;(Wo=wo.current)==null||Wo.style.setProperty("--swipe-amount-x","0px"),(So=wo.current)==null||So.style.setProperty("--swipe-amount-y","0px")}Or(!1),Oi(!1),ei(null)},onPointerMove:ki=>{var xr,kr,gr;if(!oo.current||!es||((xr=window.getSelection())==null?void 0:xr.toString().length)>0)return;const _r=ki.clientY-oo.current.y,_t=ki.clientX-oo.current.x;var aa;const Wo=(aa=E.swipeDirections)!=null?aa:HC(Vt);!_i&&(Math.abs(_t)>1||Math.abs(_r)>1)&&ei(Math.abs(_t)>Math.abs(_r)?"x":"y");let So={x:0,y:0};const Ki=De=>1/(1.5+Math.abs(De)/20);if(_i==="y"){if(Wo.includes("top")||Wo.includes("bottom"))if(Wo.includes("top")&&_r<0||Wo.includes("bottom")&&_r>0)So.y=_r;else{const De=_r*Ki(_r);So.y=Math.abs(De)<Math.abs(_r)?De:_r}}else if(_i==="x"&&(Wo.includes("left")||Wo.includes("right")))if(Wo.includes("left")&&_t<0||Wo.includes("right")&&_t>0)So.x=_t;else{const De=_t*Ki(_t);So.x=Math.abs(De)<Math.abs(_t)?De:_t}(Math.abs(So.x)>0||Math.abs(So.y)>0)&&Or(!0),(kr=wo.current)==null||kr.style.setProperty("--swipe-amount-x",`${So.x}px`),(gr=wo.current)==null||gr.style.setProperty("--swipe-amount-y",`${So.y}px`)}},ts&&!oe.jsx&&Wr!=="loading"?Ti.createElement("button",{"aria-label":Tt,"data-disabled":is,"data-close-button":!0,onClick:is||!es?()=>{}:()=>{To(),oe.onDismiss==null||oe.onDismiss.call(oe,oe)},className:Oh(je?.closeButton,oe==null||(F=oe.classNames)==null?void 0:F.closeButton)},(vn=St?.close)!=null?vn:IC):null,(Wr||oe.icon||oe.promise)&&oe.icon!==null&&(St?.[Wr]!==null||oe.icon)?Ti.createElement("div",{"data-icon":"",className:Oh(je?.icon,oe==null||(X=oe.classNames)==null?void 0:X.icon)},oe.promise||oe.type==="loading"&&!oe.icon?oe.icon||ka():null,oe.type!=="loading"?Fa:null):null,Ti.createElement("div",{"data-content":"",className:Oh(je?.content,oe==null||(te=oe.classNames)==null?void 0:te.content)},Ti.createElement("div",{"data-title":"",className:Oh(je?.title,oe==null||(fe=oe.classNames)==null?void 0:fe.title)},oe.jsx?oe.jsx:typeof oe.title=="function"?oe.title():oe.title),oe.description?Ti.createElement("div",{"data-description":"",className:Oh(Bi,Bo,je?.description,oe==null||(a=oe.classNames)==null?void 0:a.description)},typeof oe.description=="function"?oe.description():oe.description):null),Ti.isValidElement(oe.cancel)?oe.cancel:oe.cancel&&px(oe.cancel)?Ti.createElement("button",{"data-button":!0,"data-cancel":!0,style:oe.cancelButtonStyle||wt,onClick:ki=>{px(oe.cancel)&&es&&(oe.cancel.onClick==null||oe.cancel.onClick.call(oe.cancel,ki),To())},className:Oh(je?.cancelButton,oe==null||(ue=oe.classNames)==null?void 0:ue.cancelButton)},oe.cancel.label):null,Ti.isValidElement(oe.action)?oe.action:oe.action&&px(oe.action)?Ti.createElement("button",{"data-button":!0,"data-action":!0,style:oe.actionButtonStyle||Ii,onClick:ki=>{px(oe.action)&&(oe.action.onClick==null||oe.action.onClick.call(oe.action,ki),!ki.defaultPrevented&&To())},className:Oh(je?.actionButton,oe==null||(re=oe.classNames)==null?void 0:re.actionButton)},oe.action.label):null)};function D2(){if(typeof window>"u"||typeof document>"u")return"ltr";const E=document.documentElement.getAttribute("dir");return E==="auto"||!E?window.getComputedStyle(document.documentElement).direction:E}function ZC(E,P){const k={};return[E,P].forEach((F,X)=>{const te=X===1,fe=te?"--mobile-offset":"--offset",a=te?NC:FC;function ue(re){["top","right","bottom","left"].forEach(Ee=>{k[`${fe}-${Ee}`]=typeof re=="number"?`${re}px`:re})}typeof F=="number"||typeof F=="string"?ue(F):typeof F=="object"?["top","right","bottom","left"].forEach(re=>{F[re]===void 0?k[`${fe}-${re}`]=a:k[`${fe}-${re}`]=typeof F[re]=="number"?`${F[re]}px`:F[re]}):ue(a)}),k}const $C=Ti.forwardRef(function(P,k){const{id:F,invert:X,position:te="bottom-right",hotkey:fe=["altKey","KeyT"],expand:a,closeButton:ue,className:re,offset:Ee,mobileOffset:oe,theme:ke="light",richColors:Qe,duration:ft,style:Ne,visibleToasts:Je=kC,toastOptions:mt,dir:pt=D2(),gap:dt=VC,icons:nt,containerAriaLabel:vt="Notifications"}=P,[ut,rt]=Ti.useState([]),wt=Ti.useMemo(()=>F?ut.filter(bt=>bt.toasterId===F):ut.filter(bt=>!bt.toasterId),[ut,F]),Ii=Ti.useMemo(()=>Array.from(new Set([te].concat(wt.filter(bt=>bt.position).map(bt=>bt.position)))),[wt,te]),[ji,Bi]=Ti.useState([]),[ai,Vt]=Ti.useState(!1),[gi,Si]=Ti.useState(!1),[je,St]=Ti.useState(ke!=="system"?ke:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Tt=Ti.useRef(null),_i=fe.join("+").replace(/Key/g,"").replace(/Digit/g,""),ei=Ti.useRef(null),Ue=Ti.useRef(!1),Dt=Ti.useCallback(bt=>{rt(Ht=>{var ui;return(ui=Ht.find(hi=>hi.id===bt.id))!=null&&ui.delete||wl.dismiss(bt.id),Ht.filter(({id:hi})=>hi!==bt.id)})},[]);return Ti.useEffect(()=>wl.subscribe(bt=>{if(bt.dismiss){requestAnimationFrame(()=>{rt(Ht=>Ht.map(ui=>ui.id===bt.id?{...ui,delete:!0}:ui))});return}setTimeout(()=>{TT.flushSync(()=>{rt(Ht=>{const ui=Ht.findIndex(hi=>hi.id===bt.id);return ui!==-1?[...Ht.slice(0,ui),{...Ht[ui],...bt},...Ht.slice(ui+1)]:[bt,...Ht]})})})}),[ut]),Ti.useEffect(()=>{if(ke!=="system"){St(ke);return}if(ke==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?St("dark"):St("light")),typeof window>"u")return;const bt=window.matchMedia("(prefers-color-scheme: dark)");try{bt.addEventListener("change",({matches:Ht})=>{St(Ht?"dark":"light")})}catch{bt.addListener(({matches:ui})=>{try{St(ui?"dark":"light")}catch(hi){console.error(hi)}})}},[ke]),Ti.useEffect(()=>{ut.length<=1&&Vt(!1)},[ut]),Ti.useEffect(()=>{const bt=Ht=>{var ui;if(fe.every(Oi=>Ht[Oi]||Ht.code===Oi)){var Ai;Vt(!0),(Ai=Tt.current)==null||Ai.focus()}Ht.code==="Escape"&&(document.activeElement===Tt.current||(ui=Tt.current)!=null&&ui.contains(document.activeElement))&&Vt(!1)};return document.addEventListener("keydown",bt),()=>document.removeEventListener("keydown",bt)},[fe]),Ti.useEffect(()=>{if(Tt.current)return()=>{ei.current&&(ei.current.focus({preventScroll:!0}),ei.current=null,Ue.current=!1)}},[Tt.current]),Ti.createElement("section",{ref:k,"aria-label":`${vt} ${_i}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Ii.map((bt,Ht)=>{var ui;const[hi,Ai]=bt.split("-");return wt.length?Ti.createElement("ol",{key:bt,dir:pt==="auto"?D2():pt,tabIndex:-1,ref:Tt,className:re,"data-sonner-toaster":!0,"data-sonner-theme":je,"data-y-position":hi,"data-x-position":Ai,style:{"--front-toast-height":`${((ui=ji[0])==null?void 0:ui.height)||0}px`,"--width":`${UC}px`,"--gap":`${dt}px`,...Ne,...ZC(Ee,oe)},onBlur:Oi=>{Ue.current&&!Oi.currentTarget.contains(Oi.relatedTarget)&&(Ue.current=!1,ei.current&&(ei.current.focus({preventScroll:!0}),ei.current=null))},onFocus:Oi=>{Oi.target instanceof HTMLElement&&Oi.target.dataset.dismissible==="false"||Ue.current||(Ue.current=!0,ei.current=Oi.relatedTarget)},onMouseEnter:()=>Vt(!0),onMouseMove:()=>Vt(!0),onMouseLeave:()=>{gi||Vt(!1)},onDragEnd:()=>Vt(!1),onPointerDown:Oi=>{Oi.target instanceof HTMLElement&&Oi.target.dataset.dismissible==="false"||Si(!0)},onPointerUp:()=>Si(!1)},wt.filter(Oi=>!Oi.position&&Ht===0||Oi.position===bt).map((Oi,xi)=>{var ln,Xn;return Ti.createElement(qC,{key:Oi.id,icons:nt,index:xi,toast:Oi,defaultRichColors:Qe,duration:(ln=mt?.duration)!=null?ln:ft,className:mt?.className,descriptionClassName:mt?.descriptionClassName,invert:X,visibleToasts:Je,closeButton:(Xn=mt?.closeButton)!=null?Xn:ue,interacting:gi,position:bt,style:mt?.style,unstyled:mt?.unstyled,classNames:mt?.classNames,cancelButtonStyle:mt?.cancelButtonStyle,actionButtonStyle:mt?.actionButtonStyle,closeButtonAriaLabel:mt?.closeButtonAriaLabel,removeToast:Dt,toasts:wt.filter(Or=>Or.position==Oi.position),heights:ji.filter(Or=>Or.position==Oi.position),setHeights:Bi,expandByDefault:a,gap:dt,expanded:ai,swipeDirections:P.swipeDirections})})):null}))}),XC=({...E})=>{const{theme:P}=vC();return Ce.jsx($C,{"data-loc":"client/src/components/ui/sonner.tsx:8",theme:P,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...E})};function Tl(E,P,{checkForDefaultPrevented:k=!0}={}){return function(X){if(E?.(X),k===!1||!X.defaultPrevented)return P?.(X)}}function P2(E,P){if(typeof E=="function")return E(P);E!=null&&(E.current=P)}function ST(...E){return P=>{let k=!1;const F=E.map(X=>{const te=P2(X,P);return!k&&typeof te=="function"&&(k=!0),te});if(k)return()=>{for(let X=0;X<F.length;X++){const te=F[X];typeof te=="function"?te():P2(E[X],null)}}}}function Du(...E){return ze.useCallback(ST(...E),E)}function WC(E,P){const k=ze.createContext(P),F=te=>{const{children:fe,...a}=te,ue=ze.useMemo(()=>a,Object.values(a));return Ce.jsx(k.Provider,{value:ue,children:fe})};F.displayName=E+"Provider";function X(te){const fe=ze.useContext(k);if(fe)return fe;if(P!==void 0)return P;throw new Error(`\`${te}\` must be used within \`${E}\``)}return[F,X]}function Wv(E,P=[]){let k=[];function F(te,fe){const a=ze.createContext(fe),ue=k.length;k=[...k,fe];const re=oe=>{const{scope:ke,children:Qe,...ft}=oe,Ne=ke?.[E]?.[ue]||a,Je=ze.useMemo(()=>ft,Object.values(ft));return Ce.jsx(Ne.Provider,{value:Je,children:Qe})};re.displayName=te+"Provider";function Ee(oe,ke){const Qe=ke?.[E]?.[ue]||a,ft=ze.useContext(Qe);if(ft)return ft;if(fe!==void 0)return fe;throw new Error(`\`${oe}\` must be used within \`${te}\``)}return[re,Ee]}const X=()=>{const te=k.map(fe=>ze.createContext(fe));return function(a){const ue=a?.[E]||te;return ze.useMemo(()=>({[`__scope${E}`]:{...a,[E]:ue}}),[a,ue])}};return X.scopeName=E,[F,YC(X,...P)]}function YC(...E){const P=E[0];if(E.length===1)return P;const k=()=>{const F=E.map(X=>({useScope:X(),scopeName:X.scopeName}));return function(te){const fe=F.reduce((a,{useScope:ue,scopeName:re})=>{const oe=ue(te)[`__scope${re}`];return{...a,...oe}},{});return ze.useMemo(()=>({[`__scope${P.scopeName}`]:fe}),[fe])}};return k.scopeName=P.scopeName,k}function Yv(E){const P=QC(E),k=ze.forwardRef((F,X)=>{const{children:te,...fe}=F,a=ze.Children.toArray(te),ue=a.find(eI);if(ue){const re=ue.props.children,Ee=a.map(oe=>oe===ue?ze.Children.count(re)>1?ze.Children.only(null):ze.isValidElement(re)?re.props.children:null:oe);return Ce.jsx(P,{...fe,ref:X,children:ze.isValidElement(re)?ze.cloneElement(re,void 0,Ee):null})}return Ce.jsx(P,{...fe,ref:X,children:te})});return k.displayName=`${E}.Slot`,k}var KC=Yv("Slot");function QC(E){const P=ze.forwardRef((k,F)=>{const{children:X,...te}=k;if(ze.isValidElement(X)){const fe=iI(X),a=tI(te,X.props);
vendor: 5,363 bytes, line 49
49return X.type!==ze.Fragment&&(a.ref=F?ST(F,fe):fe),ze.cloneElement(X,a)}return ze.Children.count(X)>1?ze.Children.only(null):null});return P.displayName=`${E}.SlotClone`,P}var ET=Symbol("radix.slottable");function JC(E){const P=({children:k})=>Ce.jsx(Ce.Fragment,{children:k});return P.displayName=`${E}.Slottable`,P.__radixId=ET,P}function eI(E){return ze.isValidElement(E)&&typeof E.type=="function"&&"__radixId"in E.type&&E.type.__radixId===ET}function tI(E,P){const k={...P};for(const F in P){const X=E[F],te=P[F];/^on[A-Z]/.test(F)?X&&te?k[F]=(...a)=>{const ue=te(...a);return X(...a),ue}:X&&(k[F]=X):F==="style"?k[F]={...X,...te}:F==="className"&&(k[F]=[X,te].filter(Boolean).join(" "))}return{...E,...k}}function iI(E){let P=Object.getOwnPropertyDescriptor(E.props,"ref")?.get,k=P&&"isReactWarning"in P&&P.isReactWarning;return k?E.ref:(P=Object.getOwnPropertyDescriptor(E,"ref")?.get,k=P&&"isReactWarning"in P&&P.isReactWarning,k?E.props.ref:E.props.ref||E.ref)}var nI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sl=nI.reduce((E,P)=>{const k=Yv(`Primitive.${P}`),F=ze.forwardRef((X,te)=>{const{asChild:fe,...a}=X,ue=fe?k:P;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),Ce.jsx(ue,{...a,ref:te})});return F.displayName=`Primitive.${P}`,{...E,[P]:F}},{});function rI(E,P){E&&Xv.flushSync(()=>E.dispatchEvent(P))}function Pg(E){const P=ze.useRef(E);return ze.useEffect(()=>{P.current=E}),ze.useMemo(()=>(...k)=>P.current?.(...k),[])}function oI(E,P=globalThis?.document){const k=Pg(E);ze.useEffect(()=>{const F=X=>{X.key==="Escape"&&k(X)};return P.addEventListener("keydown",F,{capture:!0}),()=>P.removeEventListener("keydown",F,{capture:!0})},[k,P])}var aI="DismissableLayer",Ov="dismissableLayer.update",sI="dismissableLayer.pointerDownOutside",lI="dismissableLayer.focusOutside",L2,AT=ze.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kv=ze.forwardRef((E,P)=>{const{disableOutsidePointerEvents:k=!1,onEscapeKeyDown:F,onPointerDownOutside:X,onFocusOutside:te,onInteractOutside:fe,onDismiss:a,...ue}=E,re=ze.useContext(AT),[Ee,oe]=ze.useState(null),ke=Ee?.ownerDocument??globalThis?.document,[,Qe]=ze.useState({}),ft=Du(P,rt=>oe(rt)),Ne=Array.from(re.layers),[Je]=[...re.layersWithOutsidePointerEventsDisabled].slice(-1),mt=Ne.indexOf(Je),pt=Ee?Ne.indexOf(Ee):-1,dt=re.layersWithOutsidePointerEventsDisabled.size>0,nt=pt>=mt,vt=hI(rt=>{const wt=rt.target,Ii=[...re.branches].some(ji=>ji.contains(wt));!nt||Ii||(X?.(rt),fe?.(rt),rt.defaultPrevented||a?.())},ke),ut=dI(rt=>{const wt=rt.target;[...re.branches].some(ji=>ji.contains(wt))||(te?.(rt),fe?.(rt),rt.defaultPrevented||a?.())},ke);return oI(rt=>{pt===re.layers.size-1&&(F?.(rt),!rt.defaultPrevented&&a&&(rt.preventDefault(),a()))},ke),ze.useEffect(()=>{if(Ee)return k&&(re.layersWithOutsidePointerEventsDisabled.size===0&&(L2=ke.body.style.pointerEvents,ke.body.style.pointerEvents="none"),re.layersWithOutsidePointerEventsDisabled.add(Ee)),re.layers.add(Ee),O2(),()=>{k&&re.layersWithOutsidePointerEventsDisabled.size===1&&(ke.body.style.pointerEvents=L2)}},[Ee,ke,k,re]),ze.useEffect(()=>()=>{Ee&&(re.layers.delete(Ee),re.layersWithOutsidePointerEventsDisabled.delete(Ee),O2())},[Ee,re]),ze.useEffect(()=>{const rt=()=>Qe({});return document.addEventListener(Ov,rt),()=>document.removeEventListener(Ov,rt)},[]),Ce.jsx(Sl.div,{...ue,ref:ft,style:{pointerEvents:dt?nt?"auto":"none":void 0,...E.style},onFocusCapture:Tl(E.onFocusCapture,ut.onFocusCapture),onBlurCapture:Tl(E.onBlurCapture,ut.onBlurCapture),onPointerDownCapture:Tl(E.onPointerDownCapture,vt.onPointerDownCapture)})});Kv.displayName=aI;var cI="DismissableLayerBranch",uI=ze.forwardRef((E,P)=>{const k=ze.useContext(AT),F=ze.useRef(null),X=Du(P,F);return ze.useEffect(()=>{const te=F.current;if(te)return k.branches.add(te),()=>{k.branches.delete(te)}},[k.branches]),Ce.jsx(Sl.div,{...E,ref:X})});uI.displayName=cI;function hI(E,P=globalThis?.document){const k=Pg(E),F=ze.useRef(!1),X=ze.useRef(()=>{});return ze.useEffect(()=>{const te=a=>{if(a.target&&!F.current){let ue=function(){MT(sI,k,re,{discrete:!0})};const re={originalEvent:a};a.pointerType==="touch"?(P.removeEventListener("click",X.current),X.current=ue,P.addEventListener("click",X.current,{once:!0})):ue()}else P.removeEventListener("click",X.current);F.current=!1},fe=window.setTimeout(()=>{P.addEventListener("pointerdown",te)},0);return()=>{window.clearTimeout(fe),P.removeEventListener("pointerdown",te),P.removeEventListener("click",X.current)}},[P,k]),{onPointerDownCapture:()=>F.current=!0}}function dI(E,P=globalThis?.document){const k=Pg(E),F=ze.useRef(!1);return ze.useEffect(()=>{const X=te=>{te.target&&!F.current&&MT(lI,k,{originalEvent:te},{discrete:!1})};return P.addEventListener("focusin",X),()=>P.removeEventListener("focusin",X)},[P,k]),{onFocusCapture:()=>F.current=!0,onBlurCapture:()=>F.current=!1}}function O2(){const E=new CustomEvent(Ov);document.dispatchEvent(E)}function MT(E,P,k,{discrete:F}){const X=k.originalEvent.target,te=new CustomEvent(E,{bubbles:!1,cancelable:!0,detail:k});P&&X.addEventListener(E,P,{once:!0}),F?rI(X,te):X.dispatchEvent(te)}var rp=globalThis?.document?ze.useLayoutEffect:()=>{},fI=$v[" useId ".trim().toString()]||(()=>{}),pI=0;function _v(E){const[P,k]=ze.useState(fI());return rp(()=>{k(F=>
vendor: 19,049 bytes, line 49
49F??String(pI++))},[E]),E||(P?`radix-${P}`:"")}const mI=["top","right","bottom","left"],op=Math.min,rc=Math.max,zx=Math.round,mx=Math.floor,Uh=E=>({x:E,y:E}),gI={left:"right",right:"left",bottom:"top",top:"bottom"},_I={start:"end",end:"start"};function Bv(E,P,k){return rc(E,op(P,k))}function Zd(E,P){return typeof E=="function"?E(P):E}function $d(E){return E.split("-")[0]}function kg(E){return E.split("-")[1]}function Qv(E){return E==="x"?"y":"x"}function Jv(E){return E==="y"?"height":"width"}const yI=new Set(["top","bottom"]);function Nh(E){return yI.has($d(E))?"y":"x"}function e1(E){return Qv(Nh(E))}function xI(E,P,k){k===void 0&&(k=!1);const F=kg(E),X=e1(E),te=Jv(X);let fe=X==="x"?F===(k?"end":"start")?"right":"left":F==="start"?"bottom":"top";return P.reference[te]>P.floating[te]&&(fe=Dx(fe)),[fe,Dx(fe)]}function vI(E){const P=Dx(E);return[kv(E),P,kv(P)]}function kv(E){return E.replace(/start|end/g,P=>_I[P])}const B2=["left","right"],k2=["right","left"],bI=["top","bottom"],wI=["bottom","top"];function TI(E,P,k){switch(E){case"top":case"bottom":return k?P?k2:B2:P?B2:k2;case"left":case"right":return P?bI:wI;default:return[]}}function SI(E,P,k,F){const X=kg(E);let te=TI($d(E),k==="start",F);return X&&(te=te.map(fe=>fe+"-"+X),P&&(te=te.concat(te.map(kv)))),te}function Dx(E){return E.replace(/left|right|bottom|top/g,P=>gI[P])}function EI(E){return{top:0,right:0,bottom:0,left:0,...E}}function CT(E){return typeof E!="number"?EI(E):{top:E,right:E,bottom:E,left:E}}function Px(E){const{x:P,y:k,width:F,height:X}=E;return{width:F,height:X,top:k,left:P,right:P+F,bottom:k+X,x:P,y:k}}function F2(E,P,k){let{reference:F,floating:X}=E;const te=Nh(P),fe=e1(P),a=Jv(fe),ue=$d(P),re=te==="y",Ee=F.x+F.width/2-X.width/2,oe=F.y+F.height/2-X.height/2,ke=F[a]/2-X[a]/2;let Qe;switch(ue){case"top":Qe={x:Ee,y:F.y-X.height};break;case"bottom":Qe={x:Ee,y:F.y+F.height};break;case"right":Qe={x:F.x+F.width,y:oe};break;case"left":Qe={x:F.x-X.width,y:oe};break;default:Qe={x:F.x,y:F.y}}switch(kg(P)){case"start":Qe[fe]-=ke*(k&&re?-1:1);break;case"end":Qe[fe]+=ke*(k&&re?-1:1);break}return Qe}const AI=async(E,P,k)=>{const{placement:F="bottom",strategy:X="absolute",middleware:te=[],platform:fe}=k,a=te.filter(Boolean),ue=await(fe.isRTL==null?void 0:fe.isRTL(P));let re=await fe.getElementRects({reference:E,floating:P,strategy:X}),{x:Ee,y:oe}=F2(re,F,ue),ke=F,Qe={},ft=0;for(let Ne=0;Ne<a.length;Ne++){const{name:Je,fn:mt}=a[Ne],{x:pt,y:dt,data:nt,reset:vt}=await mt({x:Ee,y:oe,initialPlacement:F,placement:ke,strategy:X,middlewareData:Qe,rects:re,platform:fe,elements:{reference:E,floating:P}});Ee=pt??Ee,oe=dt??oe,Qe={...Qe,[Je]:{...Qe[Je],...nt}},vt&&ft<=50&&(ft++,typeof vt=="object"&&(vt.placement&&(ke=vt.placement),vt.rects&&(re=vt.rects===!0?await fe.getElementRects({reference:E,floating:P,strategy:X}):vt.rects),{x:Ee,y:oe}=F2(re,ke,ue)),Ne=-1)}return{x:Ee,y:oe,placement:ke,strategy:X,middlewareData:Qe}};async function Y_(E,P){var k;P===void 0&&(P={});const{x:F,y:X,platform:te,rects:fe,elements:a,strategy:ue}=E,{boundary:re="clippingAncestors",rootBoundary:Ee="viewport",elementContext:oe="floating",altBoundary:ke=!1,padding:Qe=0}=Zd(P,E),ft=CT(Qe),Je=a[ke?oe==="floating"?"reference":"floating":oe],mt=Px(await te.getClippingRect({element:(k=await(te.isElement==null?void 0:te.isElement(Je)))==null||k?Je:Je.contextElement||await(te.getDocumentElement==null?void 0:te.getDocumentElement(a.floating)),boundary:re,rootBoundary:Ee,strategy:ue})),pt=oe==="floating"?{x:F,y:X,width:fe.floating.width,height:fe.floating.height}:fe.reference,dt=await(te.getOffsetParent==null?void 0:te.getOffsetParent(a.floating)),nt=await(te.isElement==null?void 0:te.isElement(dt))?await(te.getScale==null?void 0:te.getScale(dt))||{x:1,y:1}:{x:1,y:1},vt=Px(te.convertOffsetParentRelativeRectToViewportRelativeRect?await te.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:pt,offsetParent:dt,strategy:ue}):pt);return{top:(mt.top-vt.top+ft.top)/nt.y,bottom:(vt.bottom-mt.bottom+ft.bottom)/nt.y,left:(mt.left-vt.left+ft.left)/nt.x,right:(vt.right-mt.right+ft.right)/nt.x}}const MI=E=>({name:"arrow",options:E,async fn(P){const{x:k,y:F,placement:X,rects:te,platform:fe,elements:a,middlewareData:ue}=P,{element:re,padding:Ee=0}=Zd(E,P)||{};if(re==null)return{};const oe=CT(Ee),ke={x:k,y:F},Qe=e1(X),ft=Jv(Qe),Ne=await fe.getDimensions(re),Je=Qe==="y",mt=Je?"top":"left",pt=Je?"bottom":"right",dt=Je?"clientHeight":"clientWidth",nt=te.reference[ft]+te.reference[Qe]-ke[Qe]-te.floating[ft],vt=ke[Qe]-te.reference[Qe],ut=await(fe.getOffsetParent==null?void 0:fe.getOffsetParent(re));let rt=ut?ut[dt]:0;(!rt||!await(fe.isElement==null?void 0:fe.isElement(ut)))&&(rt=a.floating[dt]||te.floating[ft]);const wt=nt/2-vt/2,Ii=rt/2-Ne[ft]/2-1,ji=op(oe[mt],Ii),Bi=op(oe[pt],Ii),ai=ji,Vt=rt-Ne[ft]-Bi,gi=rt/2-Ne[ft]/2+wt,Si=Bv(ai,gi,Vt),je=!ue.arrow&&kg(X)!=null&&gi!==Si&&te.reference[ft]/2-(gi<ai?ji:Bi)-Ne[ft]/2<0,St=je?gi<ai?gi-ai:gi-Vt:0;return{[Qe]:ke[Qe]+St,data:{[Qe]:Si,centerOffset:gi-Si-St,...je&&{alignmentOffset:St}},reset:je}}}),CI=function(E){return E===void 0&&(E={}),{name:"flip",options:E,async fn(P){var k,F;const{placement:X,middlewareData:te,rects:fe,initialPlacement:a,platform:ue,elements:re}=P,{mainAxis:Ee=!0,crossAxis:oe=!0,fallbackPlacements:ke,fallbackStrategy:Qe="bestFit",fallbackAxisSideDirection:ft="none",flipAlignment:Ne=!0,...Je}=Zd(E,P);if((k=te.arrow)!=null&&k.alignmentOffset)return{};const mt=$d(X),pt=Nh(a),dt=$d(a)===a,nt=await(ue.isRTL==null?void 0:ue.isRTL(re.floating)),vt=ke||(dt||!Ne?[Dx(a)]:vI(a)),ut=ft!=="none";!ke&&ut&&vt.push(...SI(a,Ne,ft,nt));const rt=[a,...vt],wt=await Y_(P,Je),Ii=[];let ji=((F=te.flip)==null?void 0:F.overflows)||[];if(Ee&&Ii.push(wt[mt]),oe){const gi=xI(X,fe,nt);Ii.push(wt[gi[0]],wt[gi[1]])}if(ji=[...ji,{placement:X,overflows:Ii}],!Ii.every(gi=>gi<=0)){var Bi,ai;const gi=(((Bi=te.flip)==null?void 0:Bi.index)||0)+1,Si=rt[gi];if(Si&&(!(oe==="alignment"?pt!==Nh(Si):!1)||ji.every(Tt=>Nh(Tt.placement)===pt?Tt.overflows[0]>0:!0)))return{data:{index:gi,overflows:ji},reset:{placement:Si}};let je=(ai=ji.filter(St=>St.overflows[0]<=0).sort((St,Tt)=>St.overflows[1]-Tt.overflows[1])[0])==null?void 0:ai.placement;if(!je)switch(Qe){case"bestFit":{var Vt;const St=(Vt=ji.filter(Tt=>{if(ut){const _i=Nh(Tt.placement);return _i===pt||_i==="y"}return!0}).map(Tt=>[Tt.placement,Tt.overflows.filter(_i=>_i>0).reduce((_i,ei)=>_i+ei,0)]).sort((Tt,_i)=>Tt[1]-_i[1])[0])==null?void 0:Vt[0];St&&(je=St);break}case"initialPlacement":je=a;break}if(X!==je)return{reset:{placement:je}}}return{}}}};function N2(E,P){return{top:E.top-P.height,right:E.right-P.width,bottom:E.bottom-P.height,left:E.left-P.width}}function U2(E){return mI.some(P=>E[P]>=0)}const II=function(E){return E===void 0&&(E={}),{name:"hide",options:E,async fn(P){const{rects:k}=P,{strategy:F="referenceHidden",...X}=Zd(E,P);switch(F){case"referenceHidden":{const te=await Y_(P,{...X,elementContext:"reference"}),fe=N2(te,k.reference);return{data:{referenceHiddenOffsets:fe,referenceHidden:U2(fe)}}}case"escaped":{const te=await Y_(P,{...X,altBoundary:!0}),fe=N2(te,k.floating);return{data:{escapedOffsets:fe,escaped:U2(fe)}}}default:return{}}}}},IT=new Set(["left","top"]);async function RI(E,P){const{placement:k,platform:F,elements:X}=E,te=await(F.isRTL==null?void 0:F.isRTL(X.floating)),fe=$d(k),a=kg(k),ue=Nh(k)==="y",re=IT.has(fe)?-1:1,Ee=te&&ue?-1:1,oe=Zd(P,E);let{mainAxis:ke,crossAxis:Qe,alignmentAxis:ft}=typeof oe=="number"?{mainAxis:oe,crossAxis:0,alignmentAxis:null}:{mainAxis:oe.mainAxis||0,crossAxis:oe.crossAxis||0,alignmentAxis:oe.alignmentAxis};return a&&typeof ft=="number"&&(Qe=a==="end"?ft*-1:ft),ue?{x:Qe*Ee,y:ke*re}:{x:ke*re,y:Qe*Ee}}const zI=function(E){return E===void 0&&(E=0),{name:"offset",options:E,async fn(P){var k,F;const{x:X,y:te,placement:fe,middlewareData:a}=P,ue=await RI(P,E);return fe===((k=a.offset)==null?void 0:k.placement)&&(F=a.arrow)!=null&&F.alignmentOffset?{}:{x:X+ue.x,y:te+ue.y,data:{...ue,placement:fe}}}}},DI=function(E){return E===void 0&&(E={}),{name:"shift",options:E,async fn(P){const{x:k,y:F,placement:X}=P,{mainAxis:te=!0,crossAxis:fe=!1,limiter:a={fn:Je=>{let{x:mt,y:pt}=Je;return{x:mt,y:pt}}},...ue}=Zd(E,P),re={x:k,y:F},Ee=await Y_(P,ue),oe=Nh($d(X)),ke=Qv(oe);let Qe=re[ke],ft=re[oe];if(te){const Je=ke==="y"?"top":"left",mt=ke==="y"?"bottom":"right",pt=Qe+Ee[Je],dt=Qe-Ee[mt];Qe=Bv(pt,Qe,dt)}if(fe){const Je=oe==="y"?"top":"left",mt=oe==="y"?"bottom":"right",pt=ft+Ee[Je],dt=ft-Ee[mt];ft=Bv(pt,ft,dt)}const Ne=a.fn({...P,[ke]:Qe,[oe]:ft});return{...Ne,data:{x:Ne.x-k,y:Ne.y-F,enabled:{[ke]:te,[oe]:fe}}}}}},PI=function(E){return E===void 0&&(E={}),{options:E,fn(P){const{x:k,y:F,placement:X,rects:te,middlewareData:fe}=P,{offset:a=0,mainAxis:ue=!0,crossAxis:re=!0}=Zd(E,P),Ee={x:k,y:F},oe=Nh(X),ke=Qv(oe);let Qe=Ee[ke],ft=Ee[oe];const Ne=Zd(a,P),Je=typeof Ne=="number"?{mainAxis:Ne,crossAxis:0}:{mainAxis:0,crossAxis:0,...Ne};if(ue){const dt=ke==="y"?"height":"width",nt=te.reference[ke]-te.floating[dt]+Je.mainAxis,vt=te.reference[ke]+te.reference[dt]-Je.mainAxis;Qe<nt?Qe=nt:Qe>vt&&(Qe=vt)}if(re){var mt,pt;const dt=ke==="y"?"width":"height",nt=IT.has($d(X)),vt=te.reference[oe]-te.floating[dt]+(nt&&((mt=fe.offset)==null?void 0:mt[oe])||0)+(nt?0:Je.crossAxis),ut=te.reference[oe]+te.reference[dt]+(nt?0:((pt=fe.offset)==null?void 0:pt[oe])||0)-(nt?Je.crossAxis:0);ft<vt?ft=vt:ft>ut&&(ft=ut)}return{[ke]:Qe,[oe]:ft}}}},LI=function(E){return E===void 0&&(E={}),{name:"size",options:E,async fn(P){var k,F;const{placement:X,rects:te,platform:fe,elements:a}=P,{apply:ue=()=>{},...re}=Zd(E,P),Ee=await Y_(P,re),oe=$d(X),ke=kg(X),Qe=Nh(X)==="y",{width:ft,height:Ne}=te.floating;let Je,mt;oe==="top"||oe==="bottom"?(Je=oe,mt=ke===(await(fe.isRTL==null?void 0:fe.isRTL(a.floating))?"start":"end")?"left":"right"):(mt=oe,Je=ke==="end"?"top":"bottom");const pt=Ne-Ee.top-Ee.bottom,dt=ft-Ee.left-Ee.right,nt=op(Ne-Ee[Je],pt),vt=op(ft-Ee[mt],dt),ut=!P.middlewareData.shift;let rt=nt,wt=vt;if((k=P.middlewareData.shift)!=null&&k.enabled.x&&(wt=dt),(F=P.middlewareData.shift)!=null&&F.enabled.y&&(rt=pt),ut&&!ke){const ji=rc(Ee.left,0),Bi=rc(Ee.right,0),ai=rc(Ee.top,0),Vt=rc(Ee.bottom,0);Qe?wt=ft-2*(ji!==0||Bi!==0?ji+Bi:rc(Ee.left,Ee.right)):rt=Ne-2*(ai!==0||Vt!==0?ai+Vt:rc(Ee.top,Ee.bottom))}await ue({...P,availableWidth:wt,availableHeight:rt});const Ii=await fe.getDimensions(a.floating);return ft!==Ii.width||Ne!==Ii.height?{reset:{rects:!0}}:{}}}};function Fx(){return typeof window<"u"}function Fg(E){return RT(E)?(E.nodeName||"").toLowerCase():"#document"}function oc(E){var P;return(E==null||(P=E.ownerDocument)==null?void 0:P.defaultView)||window}function jh(E){var P;return(P=(RT(E)?E.ownerDocument:E.document)||window.document)==null?void 0:P.documentElement}function RT(E){return Fx()?E instanceof Node||E instanceof oc(E).Node:!1}function Ru(E){return Fx()?E instanceof Element||E instanceof oc(E).Element:!1}function Vh(E){return Fx()?E instanceof HTMLElement||E instanceof oc(E).HTMLElement:!1}function V2(E){return!Fx()||typeof ShadowRoot>"u"?!1:E instanceof ShadowRoot||E instanceof oc(E).ShadowRoot}const OI=new Set(["inline","contents"]);function Q_(E){const{overflow:P,overflowX:k,overflowY:F,display:X}=zu(E);return/auto|scroll|overlay|hidden|clip/.test(P+F+k)&&!OI.has(X)}const BI=new Set(["table","td","th"]);function kI(E){return BI.has(Fg(E))}const FI=[":popover-open",":modal"];function Nx(E){return FI.some(P=>{try{return E.matches(P)}catch{return!1}})}const NI=["transform","translate","scale","rotate","perspective"],UI=["transform","translate","scale","rotate","perspective","filter"],VI=["paint","layout","strict","content"];function t1(E){const P=i1(),k=Ru(E)?zu(E):E;return NI.some(F=>k[F]?k[F]!=="none":!1)||(k.containerType?k.containerType!=="normal":!1)||!P&&(k.backdropFilter?k.backdropFilter!=="none":!1)||!P&&(k.filter?k.filter!=="none":!1)||UI.some(F=>(k.willChange||"").includes(F))||VI.some(F=>(k.contain||"").includes(F))}function jI(E){let P=ap(E);for(;Vh(P)&&!Lg(P);){if(t1(P))return P;if(Nx(P))return null;P=ap(P)}return null}function i1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const GI=new Set(["html","body","#document"]);function Lg(E){return GI.has(Fg(E))}function zu(E){return oc(E).getComputedStyle(E)}function Ux(E){return Ru(E)?{scrollLeft:E.scrollLeft,scrollTop:E.scrollTop}:{scrollLeft:E.scrollX,scrollTop:E.scrollY}}function ap(E){if(Fg(E)==="html")return E;const P=E.assignedSlot||E.parentNode||V2(E)&&E.host||jh(E);return V2(P)?P.host:P}function zT(E){const P=ap(E);return Lg(P)?E.ownerDocument?E.ownerDocument.body:E.body:Vh(P)&&Q_(P)?P:zT(P)}function K_(E,P,k){var F;P===void 0&&(P=[]),k===void 0&&(k=!0);const X=zT(E),te=X===((F=E.ownerDocument)==null?void 0:F.body),fe=oc(X);if(te){const a=Fv(fe);return P.concat(fe,fe.visualViewport||[],Q_(X)?X:[],a&&k?K_(a):[])}return P.concat(X,K_(X,[],k))}function Fv(E){return E.parent&&Object.getPrototypeOf(E.parent)?E.frameElement:null}function DT(E){const P=zu(E);let k=parseFloat(P.width)||0,F=parseFloat(P.height)||0;const X=Vh(E),te=X?E.offsetWidth:k,fe=X?E.offsetHeight:F,a=zx(k)!==te||zx(F)!==fe;return a&&(k=te,F=fe),{width:k,height:F,$:a}}function n1(E){return Ru(E)?E:E.contextElement}function zg(E){const P=n1(E);if(!Vh(P))return Uh(1);const k=P.getBoundingClientRect(),{width:F,height:X,$:te}=DT(P);let fe=(te?zx(k.width):k.width)/F,a=(te?zx(k.height):k.height)/X;return(!fe||!Number.isFinite(fe))&&(fe=1),(!a||!Number.isFinite(a))&&(a=1),{x:fe,y:a}}const HI=Uh(0);function PT(E){const P=oc(E);return!i1()||!P.visualViewport?HI:{x:P.visualViewport.offsetLeft,y:P.visualViewport.offsetTop}}function qI(E,P,k){return P===void 0&&(P=!1),!k||P&&k!==oc(E)?!1:P}function Tm(E,P,k,F){P===void 0&&(P=!1),k===void 0&&(k=!1);const X=E.getBoundingClientRect(),te=n1(E);let fe=Uh(1);P&&(F?Ru(F)&&(fe=zg(F)):fe=zg(E));const a=qI(te,k,F)?PT(te):Uh(0);let ue=(X.left+a.x)/fe.x,re=(X.top+a.y)/fe.y,Ee=X.width/fe.x,oe=X.height/fe.y;if(te){const ke=oc(te),Qe=F&&Ru(F)?oc(F):F;let ft=ke,Ne=Fv(ft);for(;Ne&&F&&Qe!==ft;){const Je=zg(Ne),mt=Ne.getBoundingClientRect(),pt=zu(Ne),dt=mt.left+(Ne.clientLeft+parseFloat(pt.paddingLeft))*Je.x,nt=mt.top+(Ne.clientTop+parseFloat(pt.paddingTop))*Je.y;ue*=Je.x,re*=Je.y,Ee*=Je.x,oe*=Je.y,ue+=dt,re+=nt,ft=oc(Ne),Ne=Fv(ft)}}return Px({width:Ee,height:oe,x:ue,y:re})}function Vx(E,P){const k=Ux(E).scrollLeft;return P?P.left+k:Tm(jh(E)).left+k}function LT(E,P){const k=E.getBoundingClientRect(),F=k.left+P.scrollLeft-Vx(E,k),X=k.top+P.scrollTop;return{x:F,y:X}}function ZI(E){let{elements:P,rect:k,offsetParent:F,strategy:X}=E;const te=X==="fixed",fe=jh(F),a=P?Nx(P.floating):!1;if(F===fe||a&&te)return k;let ue={scrollLeft:0,scrollTop:0},re=Uh(1);const Ee=Uh(0),oe=Vh(F);if((oe||!oe&&!te)&&((Fg(F)!=="body"||Q_(fe))&&(ue=Ux(F)),Vh(F))){const Qe=Tm(F);re=zg(F),Ee.x=Qe.x+F.clientLeft,Ee.y=Qe.y+F.clientTop}const ke=fe&&!oe&&!te?LT(fe,ue):Uh(0);return{width:k.width*re.x,height:k.height*re.y,x:k.x*re.x-ue.scrollLeft*re.x+Ee.x+ke.x,y:k.y*re.y-ue.scrollTop*re.y+Ee.y+ke.y}}function $I(E){return Array.from(E.getClientRects())}function XI(E){const P=jh(E),k=Ux(E),F=E.ownerDocument.body,X=rc(P.scrollWidth,P.clientWidth,F.scrollWidth,F.clientWidth),te=rc(P.scrollHeight,P.clientHeight,F.scrollHeight,F.clientHeight);let fe=-k.scrollLeft+Vx(E);const a=-k.scrollTop;return zu(F).direction==="rtl"&&(fe+=rc(P.clientWidth,F.clientWidth)-X),{width:X,height:te,x:fe,y:a}}const j2=25;function WI(E,P){const k=oc(E),F=jh(E),X=k.visualViewport;let te=F.clientWidth,fe=F.clientHeight,a=0,ue=0;if(X){te=X.width,fe=X.height;const Ee=i1();(!Ee||Ee&&P==="fixed")&&(a=X.offsetLeft,ue=X.offsetTop)}const re=Vx(F);if(re<=0){const Ee=F.ownerDocument,oe=Ee.body,ke=getComputedStyle(oe),Qe=Ee.compatMode==="CSS1Compat"&&parseFloat(ke.marginLeft)+parseFloat(ke.marginRight)||0,ft=Math.abs(F.clientWidth-oe.clientWidth-Qe);ft<=j2&&(te-=ft)}else re<=j2&&(te+=re);return{width:te,height:fe,x:a,y:ue}}const YI=new Set(["absolute","fixed"]);function KI(E,P){const k=Tm(E,!0,P==="fixed"),F=k.top+E.clientTop,X=k.left+E.clientLeft,te=Vh(E)?zg(E):Uh(1),fe=E.clientWidth*te.x,a=E.clientHeight*te.y,ue=X*te.x,re=F*te.y;return{width:fe,height:a,x:ue,y:re}}function G2(E,P,k){let F;if(P==="viewport")F=WI(E,k);else if(P==="document")F=XI(jh(E));else if(Ru(P))F=KI(P,k);else{const X=PT(E);F={x:P.x-X.x,y:P.y-X.y,width:P.width,height:P.height}}return Px(F)}function OT(E,P){const k=ap(E);return k===P||!Ru(k)||Lg(k)?!1:zu(k).position==="fixed"||OT(k,P)}function QI(E,P){const k=P.get(E);if(k)return k;let F=K_(E,[],!1).filter(a=>Ru(a)&&Fg(a)!=="body"),X=null;const te=zu(E).position==="fixed";let fe=te?ap(E):E;for(;Ru(fe)&&!Lg(fe);){const a=zu(fe),ue=t1(fe);!ue&&a.position==="fixed"&&(X=null),(te?!ue&&!X:!ue&&a.position==="static"&&!!X&&YI.has(X.position)||Q_(fe)&&!ue&&OT(E,fe))?F=F.filter(Ee=>Ee!==fe):X=a,fe=ap(fe)}return P.set(E,F),F}function JI(E){let{element:P,boundary:k,rootBoundary:F,strategy:X}=E;const fe=[...k==="clippingAncestors"?Nx(P)?[]:QI(P,this._c):[].concat(k),F],a=fe[0],ue=fe.reduce((re,Ee)=>{const oe=G2(P,Ee,X);return re.top=rc(oe.top,re.top),re.right=op(oe.right,re.right),re.bottom=op(oe.bottom,re.bottom),re.left=rc(oe.left,re.left),re},G2(P,a,X));return{width:ue.right-ue.left,height:ue.bottom-ue.top,x:ue.left,y:ue.top}}function eR(E){const{width:P,height:k}=DT(E);return{width:P,height:k}}function tR(E,P,k){const F=Vh(P),X=jh(P),te=k==="fixed",fe=Tm(E,!0,te,P);let a={scrollLeft:0,scrollTop:0};const ue=Uh(0);function re(){ue.x=Vx(X)}if(F||!F&&!te)if((Fg(P)!=="body"||Q_(X))&&(a=Ux(P)),F){const Qe=Tm(P,!0,te,P);ue.x=Qe.x+P.clientLeft,ue.y=Qe.y+P.clientTop}else X&&re();te&&!F&&X&&re();const Ee=X&&!F&&!te?LT(X,a):Uh(0),oe=fe.left+a.scrollLeft-ue.x-Ee.x,ke=fe.top+a.scrollTop-ue.y-Ee.y;return{x:oe,y:ke,width:fe.width,height:fe.height}}function yv(E){return zu(E).position==="static"}function H2(E,P){if(!Vh(E)||zu(E).position==="fixed")return null;if(P)return P(E);let k=E.offsetParent;return jh(E)===k&&(k=k.ownerDocument.body),k}function BT(E,P){const k=oc(E);if(Nx(E))return k;if(!Vh(E)){let X=ap(E);for(;X&&!Lg(X);){if(Ru(X)&&!yv(X))return X;X=ap(X)}return k}let F=H2(E,P);for(;F&&kI(F)&&yv(F);)F=H2(F,P);return F&&Lg(F)&&yv(F)&&!t1(F)?k:F||jI(E)||k}const iR=async function(E){const P=this.getOffsetParent||BT,k=this.getDimensions,F=await k(E.floating);return{reference:tR(E.reference,await P(E.floating),E.strategy),floating:{x:0,y:0,width:F.width,height:F.height}}};function nR(E){return zu(E).direction==="rtl"}const rR={convertOffsetParentRelativeRectToViewportRelativeRect:ZI,getDocumentElement:jh,getClippingRect:JI,getOffsetParent:BT,getElementRects:iR,getClientRects:$I,getDimensions:eR,getScale:zg,isElement:Ru,isRTL:nR};function kT(E,P){return E.x===P.x&&E.y===P.y&&E.width===P.width&&E.height===P.height}function oR(E,P){let k=null,F;const X=jh(E);function te(){var a;clearTimeout(F),(a=k)==null||a.disconnect(),k=null}function fe(a,ue){a===void 0&&(a=!1),ue===void 0&&(ue=1),te();const re=E.getBoundingClientRect(),{left:Ee,top:oe,width:ke,height:Qe}=re;if(a||P(),!ke||!Qe)return;
vendor: 5,106 bytes, line 49
49const ft=mx(oe),Ne=mx(X.clientWidth-(Ee+ke)),Je=mx(X.clientHeight-(oe+Qe)),mt=mx(Ee),dt={rootMargin:-ft+"px "+-Ne+"px "+-Je+"px "+-mt+"px",threshold:rc(0,op(1,ue))||1};let nt=!0;function vt(ut){const rt=ut[0].intersectionRatio;if(rt!==ue){if(!nt)return fe();rt?fe(!1,rt):F=setTimeout(()=>{fe(!1,1e-7)},1e3)}rt===1&&!kT(re,E.getBoundingClientRect())&&fe(),nt=!1}try{k=new IntersectionObserver(vt,{...dt,root:X.ownerDocument})}catch{k=new IntersectionObserver(vt,dt)}k.observe(E)}return fe(!0),te}function aR(E,P,k,F){F===void 0&&(F={});const{ancestorScroll:X=!0,ancestorResize:te=!0,elementResize:fe=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:ue=!1}=F,re=n1(E),Ee=X||te?[...re?K_(re):[],...K_(P)]:[];Ee.forEach(mt=>{X&&mt.addEventListener("scroll",k,{passive:!0}),te&&mt.addEventListener("resize",k)});const oe=re&&a?oR(re,k):null;let ke=-1,Qe=null;fe&&(Qe=new ResizeObserver(mt=>{let[pt]=mt;pt&&pt.target===re&&Qe&&(Qe.unobserve(P),cancelAnimationFrame(ke),ke=requestAnimationFrame(()=>{var dt;(dt=Qe)==null||dt.observe(P)})),k()}),re&&!ue&&Qe.observe(re),Qe.observe(P));let ft,Ne=ue?Tm(E):null;ue&&Je();function Je(){const mt=Tm(E);Ne&&!kT(Ne,mt)&&k(),Ne=mt,ft=requestAnimationFrame(Je)}return k(),()=>{var mt;Ee.forEach(pt=>{X&&pt.removeEventListener("scroll",k),te&&pt.removeEventListener("resize",k)}),oe?.(),(mt=Qe)==null||mt.disconnect(),Qe=null,ue&&cancelAnimationFrame(ft)}}const sR=zI,lR=DI,cR=CI,uR=LI,hR=II,q2=MI,dR=PI,fR=(E,P,k)=>{const F=new Map,X={platform:rR,...k},te={...X.platform,_c:F};return AI(E,P,{...X,platform:te})};var pR=typeof document<"u",mR=function(){},Ex=pR?ze.useLayoutEffect:mR;function Lx(E,P){if(E===P)return!0;if(typeof E!=typeof P)return!1;if(typeof E=="function"&&E.toString()===P.toString())return!0;let k,F,X;if(E&&P&&typeof E=="object"){if(Array.isArray(E)){if(k=E.length,k!==P.length)return!1;for(F=k;F--!==0;)if(!Lx(E[F],P[F]))return!1;return!0}if(X=Object.keys(E),k=X.length,k!==Object.keys(P).length)return!1;for(F=k;F--!==0;)if(!{}.hasOwnProperty.call(P,X[F]))return!1;for(F=k;F--!==0;){const te=X[F];if(!(te==="_owner"&&E.$$typeof)&&!Lx(E[te],P[te]))return!1}return!0}return E!==E&&P!==P}function FT(E){return typeof window>"u"?1:(E.ownerDocument.defaultView||window).devicePixelRatio||1}function Z2(E,P){const k=FT(E);return Math.round(P*k)/k}function xv(E){const P=ze.useRef(E);return Ex(()=>{P.current=E}),P}function gR(E){E===void 0&&(E={});const{placement:P="bottom",strategy:k="absolute",middleware:F=[],platform:X,elements:{reference:te,floating:fe}={},transform:a=!0,whileElementsMounted:ue,open:re}=E,[Ee,oe]=ze.useState({x:0,y:0,strategy:k,placement:P,middlewareData:{},isPositioned:!1}),[ke,Qe]=ze.useState(F);Lx(ke,F)||Qe(F);const[ft,Ne]=ze.useState(null),[Je,mt]=ze.useState(null),pt=ze.useCallback(Tt=>{Tt!==ut.current&&(ut.current=Tt,Ne(Tt))},[]),dt=ze.useCallback(Tt=>{Tt!==rt.current&&(rt.current=Tt,mt(Tt))},[]),nt=te||ft,vt=fe||Je,ut=ze.useRef(null),rt=ze.useRef(null),wt=ze.useRef(Ee),Ii=ue!=null,ji=xv(ue),Bi=xv(X),ai=xv(re),Vt=ze.useCallback(()=>{if(!ut.current||!rt.current)return;const Tt={placement:P,strategy:k,middleware:ke};Bi.current&&(Tt.platform=Bi.current),fR(ut.current,rt.current,Tt).then(_i=>{const ei={..._i,isPositioned:ai.current!==!1};gi.current&&!Lx(wt.current,ei)&&(wt.current=ei,Xv.flushSync(()=>{oe(ei)}))})},[ke,P,k,Bi,ai]);Ex(()=>{re===!1&&wt.current.isPositioned&&(wt.current.isPositioned=!1,oe(Tt=>({...Tt,isPositioned:!1})))},[re]);const gi=ze.useRef(!1);Ex(()=>(gi.current=!0,()=>{gi.current=!1}),[]),Ex(()=>{if(nt&&(ut.current=nt),vt&&(rt.current=vt),nt&&vt){if(ji.current)return ji.current(nt,vt,Vt);Vt()}},[nt,vt,Vt,ji,Ii]);const Si=ze.useMemo(()=>({reference:ut,floating:rt,setReference:pt,setFloating:dt}),[pt,dt]),je=ze.useMemo(()=>({reference:nt,floating:vt}),[nt,vt]),St=ze.useMemo(()=>{const Tt={position:k,left:0,top:0};if(!je.floating)return Tt;const _i=Z2(je.floating,Ee.x),ei=Z2(je.floating,Ee.y);return a?{...Tt,transform:"translate("+_i+"px, "+ei+"px)",...FT(je.floating)>=1.5&&{willChange:"transform"}}:{position:k,left:_i,top:ei}},[k,a,je.floating,Ee.x,Ee.y]);return ze.useMemo(()=>({...Ee,update:Vt,refs:Si,elements:je,floatingStyles:St}),[Ee,Vt,Si,je,St])}const _R=E=>{function P(k){return{}.hasOwnProperty.call(k,"current")}return{name:"arrow",options:E,fn(k){const{element:F,padding:X}=typeof E=="function"?E(k):E;return F&&P(F)?F.current!=null?q2({element:F.current,padding:X}).fn(k):{}:F?q2({element:F,padding:X}).fn(k):{}}}},yR=(E,P)=>({...sR(E),options:[E,P]}),xR=(E,P)=>({...lR(E),options:[E,P]}),vR=(E,P)=>({...dR(E),options:[E,P]}),bR=(E,P)=>({...cR(E),options:[E,P]}),wR=(E,P)=>({...uR(E),options:[E,P]}),TR=(E,P)=>({...hR(E),options:[E,P]}),SR=(E,P)=>({..._R(E),options:[E,P]});var ER="Arrow",NT=ze.forwardRef((E,P)=>{const{children:k,width:F=10,height:X=5,...te}=E;return Ce.jsx(Sl.svg,{...te,ref:P,width:F,height:X,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:E.asChild?k:Ce.jsx("polygon",{points:"0,0 30,0 15,10"})})});NT.displayName=ER;var AR=NT;function MR(E){const[P,k]=ze.useState(void 0);return rp(()=>
vendor: 10,489 bytes, line 49
49{if(E){k({width:E.offsetWidth,height:E.offsetHeight});const F=new ResizeObserver(X=>{if(!Array.isArray(X)||!X.length)return;const te=X[0];let fe,a;if("borderBoxSize"in te){const ue=te.borderBoxSize,re=Array.isArray(ue)?ue[0]:ue;fe=re.inlineSize,a=re.blockSize}else fe=E.offsetWidth,a=E.offsetHeight;k({width:fe,height:a})});return F.observe(E,{box:"border-box"}),()=>F.unobserve(E)}else k(void 0)},[E]),P}var UT="Popper",[VT,jT]=Wv(UT),[jP,GT]=VT(UT),HT="PopperAnchor",qT=ze.forwardRef((E,P)=>{const{__scopePopper:k,virtualRef:F,...X}=E,te=GT(HT,k),fe=ze.useRef(null),a=Du(P,fe),ue=ze.useRef(null);return ze.useEffect(()=>{const re=ue.current;ue.current=F?.current||fe.current,re!==ue.current&&te.onAnchorChange(ue.current)}),F?null:Ce.jsx(Sl.div,{...X,ref:a})});qT.displayName=HT;var r1="PopperContent",[CR,IR]=VT(r1),ZT=ze.forwardRef((E,P)=>{const{__scopePopper:k,side:F="bottom",sideOffset:X=0,align:te="center",alignOffset:fe=0,arrowPadding:a=0,avoidCollisions:ue=!0,collisionBoundary:re=[],collisionPadding:Ee=0,sticky:oe="partial",hideWhenDetached:ke=!1,updatePositionStrategy:Qe="optimized",onPlaced:ft,...Ne}=E,Je=GT(r1,k),[mt,pt]=ze.useState(null),dt=Du(P,Ai=>pt(Ai)),[nt,vt]=ze.useState(null),ut=MR(nt),rt=ut?.width??0,wt=ut?.height??0,Ii=F+(te!=="center"?"-"+te:""),ji=typeof Ee=="number"?Ee:{top:0,right:0,bottom:0,left:0,...Ee},Bi=Array.isArray(re)?re:[re],ai=Bi.length>0,Vt={padding:ji,boundary:Bi.filter(zR),altBoundary:ai},{refs:gi,floatingStyles:Si,placement:je,isPositioned:St,middlewareData:Tt}=gR({strategy:"fixed",placement:Ii,whileElementsMounted:(...Ai)=>aR(...Ai,{animationFrame:Qe==="always"}),elements:{reference:Je.anchor},middleware:[yR({mainAxis:X+wt,alignmentAxis:fe}),ue&&xR({mainAxis:!0,crossAxis:!1,limiter:oe==="partial"?vR():void 0,...Vt}),ue&&bR({...Vt}),wR({...Vt,apply:({elements:Ai,rects:Oi,availableWidth:xi,availableHeight:ln})=>{const{width:Xn,height:Or}=Oi.reference,Nn=Ai.floating.style;Nn.setProperty("--radix-popper-available-width",`${xi}px`),Nn.setProperty("--radix-popper-available-height",`${ln}px`),Nn.setProperty("--radix-popper-anchor-width",`${Xn}px`),Nn.setProperty("--radix-popper-anchor-height",`${Or}px`)}}),nt&&SR({element:nt,padding:a}),DR({arrowWidth:rt,arrowHeight:wt}),ke&&TR({strategy:"referenceHidden",...Vt})]}),[_i,ei]=WT(je),Ue=Pg(ft);rp(()=>{St&&Ue?.()},[St,Ue]);const Dt=Tt.arrow?.x,bt=Tt.arrow?.y,Ht=Tt.arrow?.centerOffset!==0,[ui,hi]=ze.useState();return rp(()=>{mt&&hi(window.getComputedStyle(mt).zIndex)},[mt]),Ce.jsx("div",{ref:gi.setFloating,"data-radix-popper-content-wrapper":"",style:{...Si,transform:St?Si.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ui,"--radix-popper-transform-origin":[Tt.transformOrigin?.x,Tt.transformOrigin?.y].join(" "),...Tt.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:E.dir,children:Ce.jsx(CR,{scope:k,placedSide:_i,onArrowChange:vt,arrowX:Dt,arrowY:bt,shouldHideArrow:Ht,children:Ce.jsx(Sl.div,{"data-side":_i,"data-align":ei,...Ne,ref:dt,style:{...Ne.style,animation:St?void 0:"none"}})})})});ZT.displayName=r1;var $T="PopperArrow",RR={top:"bottom",right:"left",bottom:"top",left:"right"},XT=ze.forwardRef(function(P,k){const{__scopePopper:F,...X}=P,te=IR($T,F),fe=RR[te.placedSide];return Ce.jsx("span",{ref:te.onArrowChange,style:{position:"absolute",left:te.arrowX,top:te.arrowY,[fe]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[te.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[te.placedSide],visibility:te.shouldHideArrow?"hidden":void 0},children:Ce.jsx(AR,{...X,ref:k,style:{...X.style,display:"block"}})})});XT.displayName=$T;function zR(E){return E!==null}var DR=E=>({name:"transformOrigin",options:E,fn(P){const{placement:k,rects:F,middlewareData:X}=P,fe=X.arrow?.centerOffset!==0,a=fe?0:E.arrowWidth,ue=fe?0:E.arrowHeight,[re,Ee]=WT(k),oe={start:"0%",center:"50%",end:"100%"}[Ee],ke=(X.arrow?.x??0)+a/2,Qe=(X.arrow?.y??0)+ue/2;let ft="",Ne="";return re==="bottom"?(ft=fe?oe:`${ke}px`,Ne=`${-ue}px`):re==="top"?(ft=fe?oe:`${ke}px`,Ne=`${F.floating.height+ue}px`):re==="right"?(ft=`${-ue}px`,Ne=fe?oe:`${Qe}px`):re==="left"&&(ft=`${F.floating.width+ue}px`,Ne=fe?oe:`${Qe}px`),{data:{x:ft,y:Ne}}}});function WT(E){const[P,k="center"]=E.split("-");return[P,k]}var PR=qT,LR=ZT,OR=XT,BR="Portal",YT=ze.forwardRef((E,P)=>{const{container:k,...F}=E,[X,te]=ze.useState(!1);rp(()=>te(!0),[]);const fe=k||X&&globalThis?.document?.body;return fe?TT.createPortal(Ce.jsx(Sl.div,{...F,ref:P}),fe):null});YT.displayName=BR;function kR(E,P){return ze.useReducer((k,F)=>P[k][F]??k,E)}var J_=E=>{const{present:P,children:k}=E,F=FR(P),X=typeof k=="function"?k({present:F.isPresent}):ze.Children.only(k),te=Du(F.ref,NR(X));return typeof k=="function"||F.isPresent?ze.cloneElement(X,{ref:te}):null};J_.displayName="Presence";function FR(E){const[P,k]=ze.useState(),F=ze.useRef(null),X=ze.useRef(E),te=ze.useRef("none"),fe=E?"mounted":"unmounted",[a,ue]=kR(fe,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ze.useEffect(()=>{const re=gx(F.current);te.current=a==="mounted"?re:"none"},[a]),rp(()=>{const re=F.current,Ee=X.current;if(Ee!==E){const ke=te.current,Qe=gx(re);E?ue("MOUNT"):Qe==="none"||re?.display==="none"?ue("UNMOUNT"):ue(Ee&&ke!==Qe?"ANIMATION_OUT":"UNMOUNT"),X.current=E}},[E,ue]),rp(()=>{if(P){let re;const Ee=P.ownerDocument.defaultView??window,oe=Qe=>{const Ne=gx(F.current).includes(CSS.escape(Qe.animationName));if(Qe.target===P&&Ne&&(ue("ANIMATION_END"),!X.current)){const Je=P.style.animationFillMode;P.style.animationFillMode="forwards",re=Ee.setTimeout(()=>{P.style.animationFillMode==="forwards"&&(P.style.animationFillMode=Je)})}},ke=Qe=>{Qe.target===P&&(te.current=gx(F.current))};return P.addEventListener("animationstart",ke),P.addEventListener("animationcancel",oe),P.addEventListener("animationend",oe),()=>{Ee.clearTimeout(re),P.removeEventListener("animationstart",ke),P.removeEventListener("animationcancel",oe),P.removeEventListener("animationend",oe)}}else ue("ANIMATION_END")},[P,ue]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:ze.useCallback(re=>{F.current=re?getComputedStyle(re):null,k(re)},[])}}function gx(E){return E?.animationName||"none"}function NR(E){let P=Object.getOwnPropertyDescriptor(E.props,"ref")?.get,k=P&&"isReactWarning"in P&&P.isReactWarning;return k?E.ref:(P=Object.getOwnPropertyDescriptor(E,"ref")?.get,k=P&&"isReactWarning"in P&&P.isReactWarning,k?E.props.ref:E.props.ref||E.ref)}var UR=$v[" useInsertionEffect ".trim().toString()]||rp;function VR({prop:E,defaultProp:P,onChange:k=()=>{},caller:F}){const[X,te,fe]=jR({defaultProp:P,onChange:k}),a=E!==void 0,ue=a?E:X;{const Ee=ze.useRef(E!==void 0);ze.useEffect(()=>{const oe=Ee.current;oe!==a&&console.warn(`${F} is changing from ${oe?"controlled":"uncontrolled"} to ${a?"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.`),Ee.current=a},[a,F])}const re=ze.useCallback(Ee=>{if(a){const oe=GR(Ee)?Ee(E):Ee;oe!==E&&fe.current?.(oe)}else te(Ee)},[a,E,te,fe]);return[ue,re]}function jR({defaultProp:E,onChange:P}){const[k,F]=ze.useState(E),X=ze.useRef(k),te=ze.useRef(P);return UR(()=>{te.current=P},[P]),ze.useEffect(()=>{X.current!==k&&(te.current?.(k),X.current=k)},[k,X]),[k,F,te]}function GR(E){return typeof E=="function"}var HR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),qR="VisuallyHidden",KT=ze.forwardRef((E,P)=>Ce.jsx(Sl.span,{...E,ref:P,style:{...HR,...E.style}}));KT.displayName=qR;var ZR=KT,[jx]=Wv("Tooltip",[jT]),o1=jT(),QT="TooltipProvider",$R=700,$2="tooltip.open",[XR,JT]=jx(QT),eS=E=>{const{__scopeTooltip:P,delayDuration:k=$R,skipDelayDuration:F=300,disableHoverableContent:X=!1,children:te}=E,fe=ze.useRef(!0),a=ze.useRef(!1),ue=ze.useRef(0);return ze.useEffect(()=>{const re=ue.current;return()=>window.clearTimeout(re)},[]),Ce.jsx(XR,{scope:P,isOpenDelayedRef:fe,delayDuration:k,onOpen:ze.useCallback(()=>{window.clearTimeout(ue.current),fe.current=!1},[]),onClose:ze.useCallback(()=>{window.clearTimeout(ue.current),ue.current=window.setTimeout(()=>fe.current=!0,F)},[F]),isPointerInTransitRef:a,onPointerInTransitChange:ze.useCallback(re=>{a.current=re},[]),disableHoverableContent:X,children:te})};eS.displayName=QT;var tS="Tooltip",[GP,Gx]=jx(tS),Nv="TooltipTrigger",WR=ze.forwardRef((E,P)=>{const{__scopeTooltip:k,...F}=E,X=Gx(Nv,k),te=JT(Nv,k),fe=o1(k),a=ze.useRef(null),ue=Du(P,a,X.onTriggerChange),re=ze.useRef(!1),Ee=ze.useRef(!1),oe=ze.useCallback(()=>re.current=!1,[]);return ze.useEffect(()=>()=>document.removeEventListener("pointerup",oe),[oe]),Ce.jsx(PR,{asChild:!0,...fe,children:Ce.jsx(Sl.button,{"aria-describedby":X.open?X.contentId:void 0,"data-state":X.stateAttribute,...F,ref:ue,onPointerMove:Tl(E.onPointerMove,ke=>{ke.pointerType!=="touch"&&!Ee.current&&!te.isPointerInTransitRef.current&&(X.onTriggerEnter(),Ee.current=!0)}),onPointerLeave:Tl(E.onPointerLeave,()=>{X.onTriggerLeave(),Ee.current=!1}),onPointerDown:Tl(E.onPointerDown,()=>{X.open&&X.onClose(),re.current=!0,document.addEventListener("pointerup",oe,{once:!0})}),onFocus:Tl(E.onFocus,()=>{re.current||X.onOpen()}),onBlur:Tl(E.onBlur,X.onClose),onClick:Tl(E.onClick,X.onClose)})})});WR.displayName=Nv;var YR="TooltipPortal",[HP,KR]=jx(YR,{forceMount:void 0}),Og="TooltipContent",QR=ze.forwardRef((E,P)=>{const k=KR(Og,E.__scopeTooltip),{forceMount:F=k.forceMount,side:X="top",...te}=E,fe=Gx(Og,E.__scopeTooltip);return Ce.jsx(J_,{present:F||fe.open,children:fe.disableHoverableContent?Ce.jsx(iS,{side:X,...te,ref:P}):Ce.jsx(JR,{side:X,...te,ref:P})})}),JR=ze.forwardRef((E,P)=>{const k=Gx(Og,E.__scopeTooltip),F=JT(Og,E.__scopeTooltip),X=ze.useRef(null),te=Du(P,X),[fe,a]=ze.useState(null),{trigger:ue,onClose:re}=k,Ee=X.current,{onPointerInTransitChange:oe}=F,ke=ze.useCallback(()=>{a(null),oe(!1)},[oe]),Qe=ze.useCallback((ft,Ne)=>{const Je=ft.currentTarget,mt={x:ft.clientX,y:ft.clientY},pt=rz(mt,Je.getBoundingClientRect()),dt=oz(mt,pt),nt=az(Ne.getBoundingClientRect()),vt=lz([...dt,...nt]);a(vt),oe(!0)},[oe]);return ze.useEffect(()=>()=>ke(),[ke]),ze.useEffect(()=>
vendor: 4,705 bytes, line 49
49{if(ue&&Ee){const ft=Je=>Qe(Je,Ee),Ne=Je=>Qe(Je,ue);return ue.addEventListener("pointerleave",ft),Ee.addEventListener("pointerleave",Ne),()=>{ue.removeEventListener("pointerleave",ft),Ee.removeEventListener("pointerleave",Ne)}}},[ue,Ee,Qe,ke]),ze.useEffect(()=>{if(fe){const ft=Ne=>{const Je=Ne.target,mt={x:Ne.clientX,y:Ne.clientY},pt=ue?.contains(Je)||Ee?.contains(Je),dt=!sz(mt,fe);pt?ke():dt&&(ke(),re())};return document.addEventListener("pointermove",ft),()=>document.removeEventListener("pointermove",ft)}},[ue,Ee,fe,re,ke]),Ce.jsx(iS,{...E,ref:te})}),[ez,tz]=jx(tS,{isInside:!1}),iz=JC("TooltipContent"),iS=ze.forwardRef((E,P)=>{const{__scopeTooltip:k,children:F,"aria-label":X,onEscapeKeyDown:te,onPointerDownOutside:fe,...a}=E,ue=Gx(Og,k),re=o1(k),{onClose:Ee}=ue;return ze.useEffect(()=>(document.addEventListener($2,Ee),()=>document.removeEventListener($2,Ee)),[Ee]),ze.useEffect(()=>{if(ue.trigger){const oe=ke=>{ke.target?.contains(ue.trigger)&&Ee()};return window.addEventListener("scroll",oe,{capture:!0}),()=>window.removeEventListener("scroll",oe,{capture:!0})}},[ue.trigger,Ee]),Ce.jsx(Kv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:te,onPointerDownOutside:fe,onFocusOutside:oe=>oe.preventDefault(),onDismiss:Ee,children:Ce.jsxs(LR,{"data-state":ue.stateAttribute,...re,...a,ref:P,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[Ce.jsx(iz,{children:F}),Ce.jsx(ez,{scope:k,isInside:!0,children:Ce.jsx(ZR,{id:ue.contentId,role:"tooltip",children:X||F})})]})})});QR.displayName=Og;var nS="TooltipArrow",nz=ze.forwardRef((E,P)=>{const{__scopeTooltip:k,...F}=E,X=o1(k);return tz(nS,k).isInside?null:Ce.jsx(OR,{...X,...F,ref:P})});nz.displayName=nS;function rz(E,P){const k=Math.abs(P.top-E.y),F=Math.abs(P.bottom-E.y),X=Math.abs(P.right-E.x),te=Math.abs(P.left-E.x);switch(Math.min(k,F,X,te)){case te:return"left";case X:return"right";case k:return"top";case F:return"bottom";default:throw new Error("unreachable")}}function oz(E,P,k=5){const F=[];switch(P){case"top":F.push({x:E.x-k,y:E.y+k},{x:E.x+k,y:E.y+k});break;case"bottom":F.push({x:E.x-k,y:E.y-k},{x:E.x+k,y:E.y-k});break;case"left":F.push({x:E.x+k,y:E.y-k},{x:E.x+k,y:E.y+k});break;case"right":F.push({x:E.x-k,y:E.y-k},{x:E.x-k,y:E.y+k});break}return F}function az(E){const{top:P,right:k,bottom:F,left:X}=E;return[{x:X,y:P},{x:k,y:P},{x:k,y:F},{x:X,y:F}]}function sz(E,P){const{x:k,y:F}=E;let X=!1;for(let te=0,fe=P.length-1;te<P.length;fe=te++){const a=P[te],ue=P[fe],re=a.x,Ee=a.y,oe=ue.x,ke=ue.y;Ee>F!=ke>F&&k<(oe-re)*(F-Ee)/(ke-Ee)+re&&(X=!X)}return X}function lz(E){const P=E.slice();return P.sort((k,F)=>k.x<F.x?-1:k.x>F.x?1:k.y<F.y?-1:k.y>F.y?1:0),cz(P)}function cz(E){if(E.length<=1)return E.slice();const P=[];for(let F=0;F<E.length;F++){const X=E[F];for(;P.length>=2;){const te=P[P.length-1],fe=P[P.length-2];if((te.x-fe.x)*(X.y-fe.y)>=(te.y-fe.y)*(X.x-fe.x))P.pop();else break}P.push(X)}P.pop();const k=[];for(let F=E.length-1;F>=0;F--){const X=E[F];for(;k.length>=2;){const te=k[k.length-1],fe=k[k.length-2];if((te.x-fe.x)*(X.y-fe.y)>=(te.y-fe.y)*(X.x-fe.x))k.pop();else break}k.push(X)}return k.pop(),P.length===1&&k.length===1&&P[0].x===k[0].x&&P[0].y===k[0].y?P:P.concat(k)}var uz=eS;function rS(E){var P,k,F="";if(typeof E=="string"||typeof E=="number")F+=E;else if(typeof E=="object")if(Array.isArray(E)){var X=E.length;for(P=0;P<X;P++)E[P]&&(k=rS(E[P]))&&(F&&(F+=" "),F+=k)}else for(k in E)E[k]&&(F&&(F+=" "),F+=k);return F}function oS(){for(var E,P,k=0,F="",X=arguments.length;k<X;k++)(E=arguments[k])&&(P=rS(E))&&(F&&(F+=" "),F+=P);return F}const a1="-",hz=E=>{const P=fz(E),{conflictingClassGroups:k,conflictingClassGroupModifiers:F}=E;return{getClassGroupId:fe=>{const a=fe.split(a1);return a[0]===""&&a.length!==1&&a.shift(),aS(a,P)||dz(fe)},getConflictingClassGroupIds:(fe,a)=>{const ue=k[fe]||[];return a&&F[fe]?[...ue,...F[fe]]:ue}}},aS=(E,P)=>{if(E.length===0)return P.classGroupId;const k=E[0],F=P.nextPart.get(k),X=F?aS(E.slice(1),F):void 0;if(X)return X;if(P.validators.length===0)return;const te=E.join(a1);return P.validators.find(({validator:fe})=>fe(te))?.classGroupId},X2=/^\[(.+)\]$/,dz=E=>{if(X2.test(E)){const P=X2.exec(E)[1],k=P?.substring(0,P.indexOf(":"));if(k)return"arbitrary.."+k}},fz=E=>{const{theme:P,classGroups:k}=E,F={nextPart:new Map,validators:[]};for(const X in k)Uv(k[X],F,X,P);return F},Uv=(E,P,k,F)=>
vendor: 4,286 bytes, line 49
49{E.forEach(X=>{if(typeof X=="string"){const te=X===""?P:W2(P,X);te.classGroupId=k;return}if(typeof X=="function"){if(pz(X)){Uv(X(F),P,k,F);return}P.validators.push({validator:X,classGroupId:k});return}Object.entries(X).forEach(([te,fe])=>{Uv(fe,W2(P,te),k,F)})})},W2=(E,P)=>{let k=E;return P.split(a1).forEach(F=>{k.nextPart.has(F)||k.nextPart.set(F,{nextPart:new Map,validators:[]}),k=k.nextPart.get(F)}),k},pz=E=>E.isThemeGetter,mz=E=>{if(E<1)return{get:()=>{},set:()=>{}};let P=0,k=new Map,F=new Map;const X=(te,fe)=>{k.set(te,fe),P++,P>E&&(P=0,F=k,k=new Map)};return{get(te){let fe=k.get(te);if(fe!==void 0)return fe;if((fe=F.get(te))!==void 0)return X(te,fe),fe},set(te,fe){k.has(te)?k.set(te,fe):X(te,fe)}}},Vv="!",jv=":",gz=jv.length,_z=E=>{const{prefix:P,experimentalParseClassName:k}=E;let F=X=>{const te=[];let fe=0,a=0,ue=0,re;for(let ft=0;ft<X.length;ft++){let Ne=X[ft];if(fe===0&&a===0){if(Ne===jv){te.push(X.slice(ue,ft)),ue=ft+gz;continue}if(Ne==="/"){re=ft;continue}}Ne==="["?fe++:Ne==="]"?fe--:Ne==="("?a++:Ne===")"&&a--}const Ee=te.length===0?X:X.substring(ue),oe=yz(Ee),ke=oe!==Ee,Qe=re&&re>ue?re-ue:void 0;return{modifiers:te,hasImportantModifier:ke,baseClassName:oe,maybePostfixModifierPosition:Qe}};if(P){const X=P+jv,te=F;F=fe=>fe.startsWith(X)?te(fe.substring(X.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:fe,maybePostfixModifierPosition:void 0}}if(k){const X=F;F=te=>k({className:te,parseClassName:X})}return F},yz=E=>E.endsWith(Vv)?E.substring(0,E.length-1):E.startsWith(Vv)?E.substring(1):E,xz=E=>{const P=Object.fromEntries(E.orderSensitiveModifiers.map(F=>[F,!0]));return F=>{if(F.length<=1)return F;const X=[];let te=[];return F.forEach(fe=>{fe[0]==="["||P[fe]?(X.push(...te.sort(),fe),te=[]):te.push(fe)}),X.push(...te.sort()),X}},vz=E=>({cache:mz(E.cacheSize),parseClassName:_z(E),sortModifiers:xz(E),...hz(E)}),bz=/\s+/,wz=(E,P)=>{const{parseClassName:k,getClassGroupId:F,getConflictingClassGroupIds:X,sortModifiers:te}=P,fe=[],a=E.trim().split(bz);let ue="";for(let re=a.length-1;re>=0;re-=1){const Ee=a[re],{isExternal:oe,modifiers:ke,hasImportantModifier:Qe,baseClassName:ft,maybePostfixModifierPosition:Ne}=k(Ee);if(oe){ue=Ee+(ue.length>0?" "+ue:ue);continue}let Je=!!Ne,mt=F(Je?ft.substring(0,Ne):ft);if(!mt){if(!Je){ue=Ee+(ue.length>0?" "+ue:ue);continue}if(mt=F(ft),!mt){ue=Ee+(ue.length>0?" "+ue:ue);continue}Je=!1}const pt=te(ke).join(":"),dt=Qe?pt+Vv:pt,nt=dt+mt;if(fe.includes(nt))continue;fe.push(nt);const vt=X(mt,Je);for(let ut=0;ut<vt.length;++ut){const rt=vt[ut];fe.push(dt+rt)}ue=Ee+(ue.length>0?" "+ue:ue)}return ue};function Tz(){let E=0,P,k,F="";for(;E<arguments.length;)(P=arguments[E++])&&(k=sS(P))&&(F&&(F+=" "),F+=k);return F}const sS=E=>{if(typeof E=="string")return E;let P,k="";for(let F=0;F<E.length;F++)E[F]&&(P=sS(E[F]))&&(k&&(k+=" "),k+=P);return k};function Sz(E,...P){let k,F,X,te=fe;function fe(ue){const re=P.reduce((Ee,oe)=>oe(Ee),E());return k=vz(re),F=k.cache.get,X=k.cache.set,te=a,a(ue)}function a(ue){const re=F(ue);if(re)return re;const Ee=wz(ue,k);return X(ue,Ee),Ee}return function(){return te(Tz.apply(null,arguments))}}const Ta=E=>{const P=k=>k[E]||[];return P.isThemeGetter=!0,P},lS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ez=/^\d+\/\d+$/,Az=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mz=/\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$/,Cz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Iz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Rz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mg=E=>Ez.test(E),Vn=E=>!!E&&!Number.isNaN(Number(E)),ip=E=>!!E&&Number.isInteger(Number(E)),vv=E=>E.endsWith("%")&&Vn(E.slice(0,-1)),qd=E=>Az.test(E),zz=()=>!0,Dz=E=>Mz.test(E)&&!Cz.test(E),uS=()=>!1,Pz=E=>Iz.test(E),Lz=E=>Rz.test(E),Oz=E=>!$i(E)&&!Xi(E),Bz=E=>Ng(E,fS,uS),$i=E=>lS.test(E),wm=E=>Ng(E,pS,Dz),bv=E=>Ng(E,Vz,Vn),Y2=E=>Ng(E,hS,uS),kz=E=>Ng(E,dS,Lz),_x=E=>Ng(E,mS,Pz),Xi=E=>cS.test(E),X_=E=>Ug(E,pS),Fz=E=>Ug(E,jz),K2=E=>Ug(E,hS),Nz=E=>Ug(E,fS),Uz=E=>Ug(E,dS),yx=E=>Ug(E,mS,!0),Ng=(E,P,k)=>{const F=lS.exec(E);return F?F[1]?P(F[1]):k(F[2]):!1},Ug=(E,P,k=!1)=>{const F=cS.exec(E);return F?F[1]?P(F[1]):k:!1},hS=E=>
vendor: 4,435 bytes, line 49
49E==="position"||E==="percentage",dS=E=>E==="image"||E==="url",fS=E=>E==="length"||E==="size"||E==="bg-size",pS=E=>E==="length",Vz=E=>E==="number",jz=E=>E==="family-name",mS=E=>E==="shadow",Gz=()=>{const E=Ta("color"),P=Ta("font"),k=Ta("text"),F=Ta("font-weight"),X=Ta("tracking"),te=Ta("leading"),fe=Ta("breakpoint"),a=Ta("container"),ue=Ta("spacing"),re=Ta("radius"),Ee=Ta("shadow"),oe=Ta("inset-shadow"),ke=Ta("text-shadow"),Qe=Ta("drop-shadow"),ft=Ta("blur"),Ne=Ta("perspective"),Je=Ta("aspect"),mt=Ta("ease"),pt=Ta("animate"),dt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],nt=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],vt=()=>[...nt(),Xi,$i],ut=()=>["auto","hidden","clip","visible","scroll"],rt=()=>["auto","contain","none"],wt=()=>[Xi,$i,ue],Ii=()=>[Mg,"full","auto",...wt()],ji=()=>[ip,"none","subgrid",Xi,$i],Bi=()=>["auto",{span:["full",ip,Xi,$i]},ip,Xi,$i],ai=()=>[ip,"auto",Xi,$i],Vt=()=>["auto","min","max","fr",Xi,$i],gi=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Si=()=>["start","end","center","stretch","center-safe","end-safe"],je=()=>["auto",...wt()],St=()=>[Mg,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...wt()],Tt=()=>[E,Xi,$i],_i=()=>[...nt(),K2,Y2,{position:[Xi,$i]}],ei=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ue=()=>["auto","cover","contain",Nz,Bz,{size:[Xi,$i]}],Dt=()=>[vv,X_,wm],bt=()=>["","none","full",re,Xi,$i],Ht=()=>["",Vn,X_,wm],ui=()=>["solid","dashed","dotted","double"],hi=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ai=()=>[Vn,vv,K2,Y2],Oi=()=>["","none",ft,Xi,$i],xi=()=>["none",Vn,Xi,$i],ln=()=>["none",Vn,Xi,$i],Xn=()=>[Vn,Xi,$i],Or=()=>[Mg,"full",...wt()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qd],breakpoint:[qd],color:[zz],container:[qd],"drop-shadow":[qd],ease:["in","out","in-out"],font:[Oz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qd],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qd],shadow:[qd],spacing:["px",Vn],text:[qd],"text-shadow":[qd],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mg,$i,Xi,Je]}],container:["container"],columns:[{columns:[Vn,$i,Xi,a]}],"break-after":[{"break-after":dt()}],"break-before":[{"break-before":dt()}],"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:vt()}],overflow:[{overflow:ut()}],"overflow-x":[{"overflow-x":ut()}],"overflow-y":[{"overflow-y":ut()}],overscroll:[{overscroll:rt()}],"overscroll-x":[{"overscroll-x":rt()}],"overscroll-y":[{"overscroll-y":rt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Ii()}],"inset-x":[{"inset-x":Ii()}],"inset-y":[{"inset-y":Ii()}],start:[{start:Ii()}],end:[{end:Ii()}],top:[{top:Ii()}],right:[{right:Ii()}],bottom:[{bottom:Ii()}],left:[{left:Ii()}],visibility:["visible","invisible","collapse"],z:[{z:[ip,"auto",Xi,$i]}],basis:[{basis:[Mg,"full","auto",a,...wt()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vn,Mg,"auto","initial","none",$i]}],grow:[{grow:["",Vn,Xi,$i]}],shrink:[{shrink:["",Vn,Xi,$i]}],order:[{order:[ip,"first","last","none",Xi,$i]}],"grid-cols":[{"grid-cols":ji()}],"col-start-end":[{col:Bi()}],"col-start":[{"col-start":ai()}
vendor: 11,180 bytes, line 49
49],"col-end":[{"col-end":ai()}],"grid-rows":[{"grid-rows":ji()}],"row-start-end":[{row:Bi()}],"row-start":[{"row-start":ai()}],"row-end":[{"row-end":ai()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Vt()}],"auto-rows":[{"auto-rows":Vt()}],gap:[{gap:wt()}],"gap-x":[{"gap-x":wt()}],"gap-y":[{"gap-y":wt()}],"justify-content":[{justify:[...gi(),"normal"]}],"justify-items":[{"justify-items":[...Si(),"normal"]}],"justify-self":[{"justify-self":["auto",...Si()]}],"align-content":[{content:["normal",...gi()]}],"align-items":[{items:[...Si(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Si(),{baseline:["","last"]}]}],"place-content":[{"place-content":gi()}],"place-items":[{"place-items":[...Si(),"baseline"]}],"place-self":[{"place-self":["auto",...Si()]}],p:[{p:wt()}],px:[{px:wt()}],py:[{py:wt()}],ps:[{ps:wt()}],pe:[{pe:wt()}],pt:[{pt:wt()}],pr:[{pr:wt()}],pb:[{pb:wt()}],pl:[{pl:wt()}],m:[{m:je()}],mx:[{mx:je()}],my:[{my:je()}],ms:[{ms:je()}],me:[{me:je()}],mt:[{mt:je()}],mr:[{mr:je()}],mb:[{mb:je()}],ml:[{ml:je()}],"space-x":[{"space-x":wt()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":wt()}],"space-y-reverse":["space-y-reverse"],size:[{size:St()}],w:[{w:[a,"screen",...St()]}],"min-w":[{"min-w":[a,"screen","none",...St()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[fe]},...St()]}],h:[{h:["screen","lh",...St()]}],"min-h":[{"min-h":["screen","lh","none",...St()]}],"max-h":[{"max-h":["screen","lh",...St()]}],"font-size":[{text:["base",k,X_,wm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[F,Xi,bv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",vv,$i]}],"font-family":[{font:[Fz,$i,P]}],"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:[X,Xi,$i]}],"line-clamp":[{"line-clamp":[Vn,"none",Xi,bv]}],leading:[{leading:[te,...wt()]}],"list-image":[{"list-image":["none",Xi,$i]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Xi,$i]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Tt()}],"text-color":[{text:Tt()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ui(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vn,"from-font","auto",Xi,wm]}],"text-decoration-color":[{decoration:Tt()}],"underline-offset":[{"underline-offset":[Vn,"auto",Xi,$i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:wt()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xi,$i]}],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",Xi,$i]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_i()}],"bg-repeat":[{bg:ei()}],"bg-size":[{bg:Ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ip,Xi,$i],radial:["",Xi,$i],conic:[ip,Xi,$i]},Uz,kz]}],"bg-color":[{bg:Tt()}],"gradient-from-pos":[{from:Dt()}],"gradient-via-pos":[{via:Dt()}],"gradient-to-pos":[{to:Dt()}],"gradient-from":[{from:Tt()}],"gradient-via":[{via:Tt()}],"gradient-to":[{to:Tt()}],rounded:[{rounded:bt()}],"rounded-s":[{"rounded-s":bt()}],"rounded-e":[{"rounded-e":bt()}],"rounded-t":[{"rounded-t":bt()}],"rounded-r":[{"rounded-r":bt()}],"rounded-b":[{"rounded-b":bt()}],"rounded-l":[{"rounded-l":bt()}],"rounded-ss":[{"rounded-ss":bt()}],"rounded-se":[{"rounded-se":bt()}],"rounded-ee":[{"rounded-ee":bt()}],"rounded-es":[{"rounded-es":bt()}],"rounded-tl":[{"rounded-tl":bt()}],"rounded-tr":[{"rounded-tr":bt()}],"rounded-br":[{"rounded-br":bt()}],"rounded-bl":[{"rounded-bl":bt()}],"border-w":[{border:Ht()}],"border-w-x":[{"border-x":Ht()}],"border-w-y":[{"border-y":Ht()}],"border-w-s":[{"border-s":Ht()}],"border-w-e":[{"border-e":Ht()}],"border-w-t":[{"border-t":Ht()}],"border-w-r":[{"border-r":Ht()}],"border-w-b":[{"border-b":Ht()}],"border-w-l":[{"border-l":Ht()}],"divide-x":[{"divide-x":Ht()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Ht()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ui(),"hidden","none"]}],"divide-style":[{divide:[...ui(),"hidden","none"]}],"border-color":[{border:Tt()}],"border-color-x":[{"border-x":Tt()}],"border-color-y":[{"border-y":Tt()}],"border-color-s":[{"border-s":Tt()}],"border-color-e":[{"border-e":Tt()}],"border-color-t":[{"border-t":Tt()}],"border-color-r":[{"border-r":Tt()}],"border-color-b":[{"border-b":Tt()}],"border-color-l":[{"border-l":Tt()}],"divide-color":[{divide:Tt()}],"outline-style":[{outline:[...ui(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vn,Xi,$i]}],"outline-w":[{outline:["",Vn,X_,wm]}],"outline-color":[{outline:Tt()}],shadow:[{shadow:["","none",Ee,yx,_x]}],"shadow-color":[{shadow:Tt()}],"inset-shadow":[{"inset-shadow":["none",oe,yx,_x]}],"inset-shadow-color":[{"inset-shadow":Tt()}],"ring-w":[{ring:Ht()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Tt()}],"ring-offset-w":[{"ring-offset":[Vn,wm]}],"ring-offset-color":[{"ring-offset":Tt()}],"inset-ring-w":[{"inset-ring":Ht()}],"inset-ring-color":[{"inset-ring":Tt()}],"text-shadow":[{"text-shadow":["none",ke,yx,_x]}],"text-shadow-color":[{"text-shadow":Tt()}],opacity:[{opacity:[Vn,Xi,$i]}],"mix-blend":[{"mix-blend":[...hi(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":hi()}],"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":[Vn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ai()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ai()}],"mask-image-linear-from-color":[{"mask-linear-from":Tt()}],"mask-image-linear-to-color":[{"mask-linear-to":Tt()}],"mask-image-t-from-pos":[{"mask-t-from":Ai()}],"mask-image-t-to-pos":[{"mask-t-to":Ai()}],"mask-image-t-from-color":[{"mask-t-from":Tt()}],"mask-image-t-to-color":[{"mask-t-to":Tt()}],"mask-image-r-from-pos":[{"mask-r-from":Ai()}],"mask-image-r-to-pos":[{"mask-r-to":Ai()}],"mask-image-r-from-color":[{"mask-r-from":Tt()}],"mask-image-r-to-color":[{"mask-r-to":Tt()}],"mask-image-b-from-pos":[{"mask-b-from":Ai()}],"mask-image-b-to-pos":[{"mask-b-to":Ai()}],"mask-image-b-from-color":[{"mask-b-from":Tt()}],"mask-image-b-to-color":[{"mask-b-to":Tt()}],"mask-image-l-from-pos":[{"mask-l-from":Ai()}],"mask-image-l-to-pos":[{"mask-l-to":Ai()}],"mask-image-l-from-color":[{"mask-l-from":Tt()}],"mask-image-l-to-color":[{"mask-l-to":Tt()}],"mask-image-x-from-pos":[{"mask-x-from":Ai()}],"mask-image-x-to-pos":[{"mask-x-to":Ai()}],"mask-image-x-from-color":[{"mask-x-from":Tt()}],"mask-image-x-to-color":[{"mask-x-to":Tt()}],"mask-image-y-from-pos":[{"mask-y-from":Ai()}],"mask-image-y-to-pos":[{"mask-y-to":Ai()}],"mask-image-y-from-color":[{"mask-y-from":Tt()}],"mask-image-y-to-color":[{"mask-y-to":Tt()}],"mask-image-radial":[{"mask-radial":[Xi,$i]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ai()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ai()}],"mask-image-radial-from-color":[{"mask-radial-from":Tt()}],"mask-image-radial-to-color":[{"mask-radial-to":Tt()}],"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":nt()}],"mask-image-conic-pos":[{"mask-conic":[Vn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ai()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ai()}],"mask-image-conic-from-color":[{"mask-conic-from":Tt()}],"mask-image-conic-to-color":[{"mask-conic-to":Tt()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_i()}],"mask-repeat":[{mask:ei()}],"mask-size":[{mask:Ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Xi,$i]}],filter:[{filter:["","none",Xi,$i]}],blur:[{blur:Oi()}],brightness:[{brightness:[Vn,Xi,$i]}],contrast:[{contrast:[Vn,Xi,$i]}],"drop-shadow":[{"drop-shadow":["","none",Qe,yx,_x]}],"drop-shadow-color":[{"drop-shadow":Tt()}],grayscale:[{grayscale:["",Vn,Xi,$i]}],"hue-rotate":[{"hue-rotate":[Vn,Xi,$i]}],invert:[{invert:["",Vn,Xi,$i]}],saturate:[{saturate:[Vn,Xi,$i]}],sepia:[{sepia:["",Vn,Xi,$i]}],"backdrop-filter":[{"backdrop-filter":["","none",Xi,$i]}],"backdrop-blur":[{"backdrop-blur":Oi()}],"backdrop-brightness":[{"backdrop-brightness":[Vn,Xi,$i]}],"backdrop-contrast":[{"backdrop-contrast":[Vn,Xi,$i]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vn,Xi,$i]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vn,Xi,$i]}],"backdrop-invert":[{"backdrop-invert":["",Vn,Xi,$i]}],"backdrop-opacity":[{"backdrop-opacity":[Vn,Xi,$i]}],"backdrop-saturate":[{"backdrop-saturate":[Vn,Xi,$i]}],"backdrop-sepia":[{"backdrop-sepia":["",Vn,Xi,$i]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":wt()}],"border-spacing-x":[{"border-spacing-x":wt()}],"border-spacing-y":[{"border-spacing-y":wt()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Xi,$i]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vn,"initial",Xi,$i]}],ease:[{ease:["linear","initial",mt,Xi,$i]}],delay:[{delay:[Vn,Xi,$i]}],animate:[{animate:["none",pt,Xi,$i]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[Ne,Xi,$i]}],"perspective-origin":[{"perspective-origin":vt()}],rotate:[{rotate:xi()}],"rotate-x":[{"rotate-x":xi()}],"rotate-y":[{"rotate-y":xi()}],"rotate-z":[{"rotate-z":xi()}],scale:[{scale:ln()}],"scale-x":[{"scale-x":ln()}],"scale-y":[{"scale-y":ln()}],"scale-z":[{"scale-z":ln()}],"scale-3d":["scale-3d"],skew:[{skew:Xn()}],"skew-x":[{"skew-x":Xn()}],"skew-y":[{"skew-y":Xn()}],transform:[{transform:[Xi,$i,"","none","gpu","cpu"]}],"transform-origin":[{origin:vt()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Or()}],"translate-x":[{"translate-x":Or()}],"translate-y":[{"translate-y":Or()}],"translate-z":[{"translate-z":Or()}],"translate-none":["translate-none"],accent:[{accent:Tt()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Tt()}
vendor: 4,906 bytes, line 49
49],"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",Xi,$i]}],"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":wt()}],"scroll-mx":[{"scroll-mx":wt()}],"scroll-my":[{"scroll-my":wt()}],"scroll-ms":[{"scroll-ms":wt()}],"scroll-me":[{"scroll-me":wt()}],"scroll-mt":[{"scroll-mt":wt()}],"scroll-mr":[{"scroll-mr":wt()}],"scroll-mb":[{"scroll-mb":wt()}],"scroll-ml":[{"scroll-ml":wt()}],"scroll-p":[{"scroll-p":wt()}],"scroll-px":[{"scroll-px":wt()}],"scroll-py":[{"scroll-py":wt()}],"scroll-ps":[{"scroll-ps":wt()}],"scroll-pe":[{"scroll-pe":wt()}],"scroll-pt":[{"scroll-pt":wt()}],"scroll-pr":[{"scroll-pr":wt()}],"scroll-pb":[{"scroll-pb":wt()}],"scroll-pl":[{"scroll-pl":wt()}],"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",Xi,$i]}],fill:[{fill:["none",...Tt()]}],"stroke-w":[{stroke:[Vn,X_,wm,bv]}],stroke:[{stroke:["none",...Tt()]}],"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"]}},Hz=Sz(Gz);function sp(...E){return Hz(oS(E))}function qz({delayDuration:E=0,...P}){return Ce.jsx(uz,{"data-loc":"client/src/components/ui/tooltip.tsx:11","data-slot":"tooltip-provider",delayDuration:E,...P})}const Q2=E=>typeof E=="boolean"?`${E}`:E===0?"0":E,J2=oS,Zz=(E,P)=>k=>{var F;if(P?.variants==null)return J2(E,k?.class,k?.className);const{variants:X,defaultVariants:te}=P,fe=Object.keys(X).map(re=>{const Ee=k?.[re],oe=te?.[re];if(Ee===null)return null;
vendor: 4,308 bytes, lines 49-74
49const ke=Q2(Ee)||Q2(oe);return X[re][ke]}),a=k&&Object.entries(k).reduce((re,Ee)=>{let[oe,ke]=Ee;return ke===void 0||(re[oe]=ke),re},{}),ue=P==null||(F=P.compoundVariants)===null||F===void 0?void 0:F.reduce((re,Ee)=>{let{class:oe,className:ke,...Qe}=Ee;return Object.entries(Qe).every(ft=>{let[Ne,Je]=ft;return Array.isArray(Je)?Je.includes({...te,...a}[Ne]):{...te,...a}[Ne]===Je})?[...re,oe,ke]:re},[]);return J2(E,fe,ue,k?.class,k?.className)},$z=Zz("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-transparent shadow-xs hover:bg-accent dark:bg-transparent dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function kh({className:E,variant:P,size:k,asChild:F=!1,...X}){const te=F?KC:"button";return Ce.jsx(te,{"data-loc":"client/src/components/ui/button.tsx:52","data-slot":"button",className:sp($z({variant:P,size:k,className:E})),...X})}function Xz({className:E,...P}){return Ce.jsx("div",{"data-loc":"client/src/components/ui/card.tsx:7","data-slot":"card",className:sp("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",E),...P})}function Wz({className:E,...P}){return Ce.jsx("div",{"data-loc":"client/src/components/ui/card.tsx:66","data-slot":"card-content",className:sp("px-6",E),...P})}/**
50 * @license lucide-react v0.453.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 Yz=E=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gS=(...E)=>E.filter((P,k,F)=>!!P&&F.indexOf(P)===k).join(" ");/**
55 * @license lucide-react v0.453.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 Kz={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.453.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 Qz=ze.forwardRef(({color:E="currentColor",size:P=24,strokeWidth:k=2,absoluteStrokeWidth:F,className:X="",children:te,iconNode:fe,...a},ue)=>ze.createElement("svg",{ref:ue,...Kz,width:P,height:P,stroke:E,strokeWidth:F?Number(k)*24/Number(P):k,className:gS("lucide",X),...a},[...fe.map(([re,Ee])=>ze.createElement(re,Ee)),...Array.isArray(te)?te:[te]]));/**
65 * @license lucide-react v0.453.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 jr=(E,P)=>{const k=ze.forwardRef(({className:F,...X},te)=>ze.createElement(Qz,{ref:te,iconNode:P,className:gS(`lucide-${Yz(E)}`,F),...X}));return k.displayName=`${E}`,k};/**
70 * @license lucide-react v0.453.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 Jz=jr("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}
74],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
75 * @license lucide-react v0.453.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 _S=jr("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/**
80 * @license lucide-react v0.453.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 yS=jr("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/**
85 * @license lucide-react v0.453.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 Ax=jr("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
90 * @license lucide-react v0.453.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 e3=jr("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
95 * @license lucide-react v0.453.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 t3=jr("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
100 * @license lucide-react v0.453.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 i3=jr("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
105 * @license lucide-react v0.453.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 Mx=jr("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
110 * @license lucide-react v0.453.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 wv=jr("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
115 * @license lucide-react v0.453.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 n3=jr("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
120 * @license lucide-react v0.453.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 r3=jr("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
125 * @license lucide-react v0.453.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 o3=jr("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
130 * @license lucide-react v0.453.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 a3=jr("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
135 * @license lucide-react v0.453.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 s3=jr("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
140 * @license lucide-react v0.453.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 l3=jr("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
145 * @license lucide-react v0.453.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 c3=jr("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
150 * @license lucide-react v0.453.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 Bg=jr("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
155 * @license lucide-react v0.453.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 u3=jr("MapPin",[["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"}]]);/**
160 * @license lucide-react v0.453.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 xS=jr("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/**
165 * @license lucide-react v0.453.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 h3=jr("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
170 * @license lucide-react v0.453.0 - ISC
171 *
172 * This source code is licensed under the ISC license.
173 * See the LICENSE file in the root directory of this source tree.
174 */const d3=jr("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
175 * @license lucide-react v0.453.0 - ISC
176 *
177 * This source code is licensed under the ISC license.
178 * See the LICENSE file in the root directory of this source tree.
179 */const vS=jr("RotateCcw",[["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"}]]);/**
180 * @license lucide-react v0.453.0 - ISC
181 *
182 * This source code is licensed under the ISC license.
183 * See the LICENSE file in the root directory of this source tree.
184 */const f3=jr("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
185 * @license lucide-react v0.453.0 - ISC
186 *
187 * This source code is licensed under the ISC license.
188 * See the LICENSE file in the root directory of this source tree.
189 */const eT=jr("Share2",[["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"}]]);/**
190 * @license lucide-react v0.453.0 - ISC
191 *
192 * This source code is licensed under the ISC license.
193 * See the LICENSE file in the root directory of this source tree.
194 */const p3=jr("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
195 * @license lucide-react v0.453.0 - ISC
196 *
197 * This source code is licensed under the ISC license.
198 * See the LICENSE file in the root directory of this source tree.
199 */const m3=jr("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
200 * @license lucide-react v0.453.0 - ISC
201 *
202 * This source code is licensed under the ISC license.
203 * See the LICENSE file in the root directory of this source tree.
204 */const bS=jr("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function g3(E,P){if(E instanceof RegExp)return{keys:!1,pattern:E};var k,F,X,te,fe=[],a="",ue=E.split("/");for(ue[0]||ue.shift();X=ue.shift();)k=X[0],k==="*"?(fe.push(k),a+=X[1]==="?"?"(?:/(.*))?":"/(.*)"):k===":"?(F=X.indexOf("?",1),te=X.indexOf(".",1),fe.push(X.substring(1,~F?F:~te?te:X.length)),a+=~F&&!~te?"(?:/([^/]+?))?":"/([^/]+?)",~te&&(a+=(~F?"?":"")+"\\"+X.substring(te))):a+="/"+X;return{keys:fe,pattern:new RegExp("^"+a+(P?"(?=$|/)":"/?$"),"i")}}var Tv={exports:{}},Sv={};/**
205 * @license React
206 * use-sync-external-store-shim.production.js
207 *
208 * Copyright (c) Meta Platforms, Inc. and affiliates.
209 *
210 * This source code is licensed under the MIT license found in the
211 * LICENSE file in the root directory of this source tree.
212 */var tT;function _3(){if(tT)return Sv;tT=1;var E=kx();function P(oe,ke){return oe===ke&&(oe!==0||1/oe===1/ke)||oe!==oe&&ke!==ke}var k=typeof Object.is=="function"?Object.is:P,F=E.useState,X=E.useEffect,te=E.useLayoutEffect,fe=E.useDebugValue;function a(oe,ke){var Qe=ke(),ft=F({inst:{value:Qe,getSnapshot:ke}}),Ne=ft[0].inst,Je=ft[1];return te(function(){Ne.value=Qe,Ne.getSnapshot=ke,ue(Ne)&&Je({inst:Ne})},[oe,Qe,ke]),X(function(){return ue(Ne)&&Je({inst:Ne}),oe(function(){ue(Ne)&&Je({inst:Ne})})},[oe]),fe(Qe),Qe}function ue(oe){var ke=oe.getSnapshot;oe=oe.value;try{var Qe=ke();return!k(oe,Qe)}catch{return!0}}function re(oe,ke){return ke()}var Ee=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?re:a;return Sv.useSyncExternalStore=E.useSyncExternalStore!==void 0?E.useSyncExternalStore:Ee,Sv}var iT;function y3(){return iT||(iT=1,Tv.exports=_3()),Tv.exports}var x3=y3();const v3=$v.useInsertionEffect,b3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",w3=b3?ze.useLayoutEffect:ze.useEffect,T3=v3||w3,wS=E=>{const P=ze.useRef([E,(...k)=>P[0](...k)]).current;return T3(()=>{P[0]=E}),P[1]},S3="popstate",s1="pushState",l1="replaceState",E3="hashchange",nT=[S3,s1,l1,E3],A3=E=>{for(const P of nT)addEventListener(P,E);return()=>{for(const P of nT)removeEventListener(P,E)}},TS=(E,P)=>x3.useSyncExternalStore(A3,E,P),M3=()=>location.search,C3=({ssrSearch:E=""}={})=>TS(M3,()=>E),rT=()=>location.pathname,I3=({ssrPath:E}={})=>
212TS(rT,E?()=>E:rT),R3=(E,{replace:P=!1,state:k=null}={})=>history[P?l1:s1](k,"",E),z3=(E={})=>[I3(E),R3],oT=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[oT]>"u"){for(const E of[s1,l1]){const P=history[E];history[E]=function(){const k=P.apply(this,arguments),F=new Event(E);return F.arguments=arguments,dispatchEvent(F),k}}Object.defineProperty(window,oT,{value:!0})}const D3=(E,P)=>P.toLowerCase().indexOf(E.toLowerCase())?"~"+P:P.slice(E.length)||"/",SS=(E="")=>E==="/"?"":E,P3=(E,P)=>E[0]==="~"?E.slice(1):SS(P)+E,L3=(E="",P)=>D3(Gv(SS(E)),Gv(P)),O3=E=>E[0]==="?"?E.slice(1):E,Gv=E=>{try{return decodeURI(E)}catch{return E}},B3=E=>Gv(O3(E)),ES={hook:z3,searchHook:C3,parser:g3,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:E=>E},AS=ze.createContext(ES),Vg=()=>ze.useContext(AS),MS={},CS=ze.createContext(MS),k3=()=>ze.useContext(CS),Hx=E=>{const[P,k]=E.hook(E);return[L3(E.base,P),wS((F,X)=>k(P3(F,E.base),X))]},F3=()=>Hx(Vg()),N3=()=>{const E=Vg();return B3(E.searchHook(E))},IS=(E,P,k,F)=>{const{pattern:X,keys:te}=P instanceof RegExp?{keys:!1,pattern:P}:E(P||"*",F),fe=X.exec(k)||[],[a,...ue]=fe;return a!==void 0?[!0,(()=>{const re=te!==!1?Object.fromEntries(te.map((oe,ke)=>[oe,ue[ke]])):fe.groups;let Ee={...ue};return re&&Object.assign(Ee,re),Ee})(),...F?[a]:[]]:[!1,null]},U3=({children:E,...P})=>{const k=Vg(),F=P.hook?ES:k;let X=F;const[te,fe]=P.ssrPath?.split("?")??[];fe&&(P.ssrSearch=fe,P.ssrPath=te),P.hrefs=P.hrefs??P.hook?.hrefs;let a=ze.useRef({}),ue=a.current,re=ue;for(let Ee in F){const oe=Ee==="base"?F[Ee]+(P[Ee]||""):P[Ee]||F[Ee];ue===re&&oe!==re[Ee]&&(a.current=re={...re}),re[Ee]=oe,(oe!==F[Ee]||oe!==X[Ee])&&(X=re)}return ze.createElement(AS.Provider,{value:X,children:E})},aT=({children:E,component:P},k)=>P?ze.createElement(P,{params:k}):typeof E=="function"?E(k):E,V3=E=>{let P=ze.useRef(MS);const k=P.current;return P.current=Object.keys(E).length!==Object.keys(k).length||Object.entries(E).some(([F,X])=>X!==k[F])?E:k},xx=({path:E,nest:P,match:k,...F})=>{const X=Vg(),[te]=Hx(X),[fe,a,ue]=k??IS(X.parser,E,te,P),re=V3({...k3(),...a});if(!fe)return null;const Ee=ue?ze.createElement(U3,{base:ue},aT(F,re)):aT(F,re);return ze.createElement(CS.Provider,{value:re,children:Ee})};ze.forwardRef((E,P)=>{const k=Vg(),[F,X]=Hx(k),{to:te="",href:fe=te,onClick:a,asChild:ue,children:re,className:Ee,replace:oe,state:ke,...Qe}=E,ft=wS(Je=>{Je.ctrlKey||Je.metaKey||Je.altKey||Je.shiftKey||Je.button!==0||(a?.(Je),Je.defaultPrevented||(Je.preventDefault(),X(fe,E)))}),Ne=k.hrefs(fe[0]==="~"?fe.slice(1):k.base+fe,k);return ue&&ze.isValidElement(re)?ze.cloneElement(re,{onClick:ft,href:Ne}):ze.createElement("a",{...Qe,onClick:ft,href:Ne,className:Ee?.call?Ee(F===fe):Ee,children:re,ref:P})});const Hv=E=>Array.isArray(E)?E.flatMap(P=>Hv(P&&P.type===ze.Fragment?P.props.children:P)):[E],j3=({children:E,location:P})=>{const k=Vg(),[F]=Hx(k);typeof window<"u"&&(window.__WOUTER_ROUTES__||(window.__WOUTER_ROUTES__=[]),Hv(E).forEach(te=>{if(ze.isValidElement(te)&&te.props.path){const fe=te.props.path;window.__WOUTER_ROUTES__.includes(fe)||window.__WOUTER_ROUTES__.push(fe)}}));for(const X of Hv(E)){let te=0;if(ze.isValidElement(X)&&(te=IS(k.parser,X.props.path,P||F,X.props.nest))[0])return ze.cloneElement(X,{match:te})}return null};function sT(){const[,E]=F3(),P=()=>{E("/")};return Ce.jsx("div",{"data-loc":"client/src/pages/NotFound.tsx:14",className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-slate-50 to-slate-100",children:Ce.jsx(Xz,{"data-loc":"client/src/pages/NotFound.tsx:15",className:"w-full max-w-lg mx-4 shadow-lg border-0 bg-white/80 backdrop-blur-sm",children:Ce.jsxs(Wz,{"data-loc":"client/src/pages/NotFound.tsx:16",className:"pt-8 pb-8 text-center",children:[Ce.jsx("div",{"data-loc":"client/src/pages/NotFound.tsx:17",className:"flex justify-center mb-6",children:Ce.jsxs("div",{"data-loc":"client/src/pages/NotFound.tsx:18",className:"relative",children:[Ce.jsx("div",{"data-loc":"client/src/pages/NotFound.tsx:19",className:"absolute inset-0 bg-red-100 rounded-full animate-pulse"}),Ce.jsx(e3,{"data-loc":"client/src/pages/NotFound.tsx:20",className:"relative h-16 w-16 text-red-500"})]})}),Ce.jsx("h1",{"data-loc":"client/src/pages/NotFound.tsx:24",className:"text-4xl font-bold text-slate-900 mb-2",children:"404"}),Ce.jsx("h2",{"data-loc":"client/src/pages/NotFound.tsx:26",className:"text-xl font-semibold text-slate-700 mb-4",children:"Page Not Found"}),Ce.jsxs("p",{"data-loc":"client/src/pages/NotFound.tsx:30",className:"text-slate-600 mb-8 leading-relaxed",children:["Sorry, the page you are looking for doesn't exist.",Ce.jsx("br",{"data-loc":"client/src/pages/NotFound.tsx:32"}),"It may have been moved or deleted."]}
212),Ce.jsx("div",{"data-loc":"client/src/pages/NotFound.tsx:36",className:"flex flex-col sm:flex-row gap-3 justify-center",children:Ce.jsxs(kh,{"data-loc":"client/src/pages/NotFound.tsx:37",onClick:P,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2.5 rounded-lg transition-all duration-200 shadow-md hover:shadow-lg",children:[Ce.jsx(s3,{"data-loc":"client/src/pages/NotFound.tsx:41",className:"w-4 h-4 mr-2"}),"Go Home"]})})]})})})}class G3 extends ze.Component{constructor(P){super(P),this.state={hasError:!1,error:null}}static getDerivedStateFromError(P){return{hasError:!0,error:P}}render(){return this.state.hasError?Ce.jsx("div",{"data-loc":"client/src/components/ErrorBoundary.tsx:27",className:"flex items-center justify-center min-h-screen p-8 bg-background",children:Ce.jsxs("div",{"data-loc":"client/src/components/ErrorBoundary.tsx:28",className:"flex flex-col items-center w-full max-w-2xl p-8",children:[Ce.jsx(m3,{"data-loc":"client/src/components/ErrorBoundary.tsx:29",size:48,className:"text-destructive mb-6 flex-shrink-0"}),Ce.jsx("h2",{"data-loc":"client/src/components/ErrorBoundary.tsx:34",className:"text-xl mb-4",children:"An unexpected error occurred."}),Ce.jsx("div",{"data-loc":"client/src/components/ErrorBoundary.tsx:36",className:"p-4 w-full rounded bg-muted overflow-auto mb-6",children:Ce.jsx("pre",{"data-loc":"client/src/components/ErrorBoundary.tsx:37",className:"text-sm text-muted-foreground whitespace-break-spaces",children:this.state.error?.stack})}),Ce.jsxs("button",{"data-loc":"client/src/components/ErrorBoundary.tsx:42",onClick:()=>window.location.reload(),className:sp("flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground","hover:opacity-90 cursor-pointer"),children:[Ce.jsx(vS,{"data-loc":"client/src/components/ErrorBoundary.tsx:50",size:16}),"Reload Page"]})]})}):this.props.children}}var Cx={exports:{}},H3=Cx.exports,lT;function q3(){return lT||(lT=1,(function(E,P){(function(k,F){E.exports=F()})(H3,(function(){var k,F,X;function te(a,ue){if(!k)k=ue;else if(!F)F=ue;else{var re="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+k+")(sharedChunk); ("+F+")(sharedChunk); self.onerror = null;",Ee={};k(Ee),X=ue(Ee),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(X.workerUrl=window.URL.createObjectURL(new Blob([re],{type:"text/javascript"})))}}te(["exports"],function(a){var ue=1e-6,re=typeof Float32Array<"u"?Float32Array:Array;function Ee(n,e){var i=e[0],r=e[1],l=e[2],h=e[3],f=i*h-l*r;return f?(n[0]=h*(f=1/f),n[1]=-r*f,n[2]=-l*f,n[3]=i*f,n):null}function oe(){var n=new re(9);return re!=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 ke(n,e){var i=e[0],r=e[1],l=e[2],h=e[3],f=e[4],m=e[5],x=e[6],v=e[7],S=e[8];return n[0]=f*S-m*v,n[1]=l*v-r*S,n[2]=r*m-l*f,n[3]=m*x-h*S,n[4]=i*S-l*x,n[5]=l*h-i*m,n[6]=h*v-f*x,n[7]=r*x-i*v,n[8]=i*f-r*h,n}function Qe(n,e,i){var r=e[0],l=e[1],h=e[2],f=e[3],m=e[4],x=e[5],v=e[6],S=e[7],A=e[8],M=i[0],R=i[1],D=i[2],U=i[3],G=i[4],V=i[5],Z=i[6],Y=i[7],Q=i[8];return n[0]=M*r+R*f+D*v,n[1]=M*l+R*m+D*S,n[2]=M*h+R*x+D*A,n[3]=U*r+G*f+V*v,n[4]=U*l+G*m+V*S,n[5]=U*h+G*x+V*A,n[6]=Z*r+Y*f+Q*v,n[7]=Z*l+Y*m+Q*S,n[8]=Z*h+Y*x+Q*A,n}function ft(){var n=new re(16);return re!=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}function Ne(n){var e=new re(16);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e}function Je(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 mt(n,e){var i=e[0],r=e[1],l=e[2],h=e[3],f=e[4],m=e[5],x=e[6],v=e[7],S=e[8],A=e[9],M=e[10],R=e[11],D=e[12],U=e[13],G=e[14],V=e[15],Z=i*m-r*f,Y=i*x-l*f,Q=i*v-h*f,le=r*x-l*m,ae=r*v-h*m,ge=l*v-h
vendor: 16,175 bytes, line 212
212*x,_e=S*U-A*D,pe=S*G-M*D,be=S*V-R*D,Me=A*G-M*U,Ye=A*V-R*U,Ze=M*V-R*G,We=Z*Ze-Y*Ye+Q*Me+le*be-ae*pe+ge*_e;return We?(n[0]=(m*Ze-x*Ye+v*Me)*(We=1/We),n[1]=(l*Ye-r*Ze-h*Me)*We,n[2]=(U*ge-G*ae+V*le)*We,n[3]=(M*ae-A*ge-R*le)*We,n[4]=(x*be-f*Ze-v*pe)*We,n[5]=(i*Ze-l*be+h*pe)*We,n[6]=(G*Q-D*ge-V*Y)*We,n[7]=(S*ge-M*Q+R*Y)*We,n[8]=(f*Ye-m*be+v*_e)*We,n[9]=(r*be-i*Ye-h*_e)*We,n[10]=(D*ae-U*Q+V*Z)*We,n[11]=(A*Q-S*ae-R*Z)*We,n[12]=(m*pe-f*Me-x*_e)*We,n[13]=(i*Me-r*pe+l*_e)*We,n[14]=(U*Y-D*le-G*Z)*We,n[15]=(S*le-A*Y+M*Z)*We,n):null}function pt(n,e,i){var r=e[0],l=e[1],h=e[2],f=e[3],m=e[4],x=e[5],v=e[6],S=e[7],A=e[8],M=e[9],R=e[10],D=e[11],U=e[12],G=e[13],V=e[14],Z=e[15],Y=i[0],Q=i[1],le=i[2],ae=i[3];return n[0]=Y*r+Q*m+le*A+ae*U,n[1]=Y*l+Q*x+le*M+ae*G,n[2]=Y*h+Q*v+le*R+ae*V,n[3]=Y*f+Q*S+le*D+ae*Z,n[4]=(Y=i[4])*r+(Q=i[5])*m+(le=i[6])*A+(ae=i[7])*U,n[5]=Y*l+Q*x+le*M+ae*G,n[6]=Y*h+Q*v+le*R+ae*V,n[7]=Y*f+Q*S+le*D+ae*Z,n[8]=(Y=i[8])*r+(Q=i[9])*m+(le=i[10])*A+(ae=i[11])*U,n[9]=Y*l+Q*x+le*M+ae*G,n[10]=Y*h+Q*v+le*R+ae*V,n[11]=Y*f+Q*S+le*D+ae*Z,n[12]=(Y=i[12])*r+(Q=i[13])*m+(le=i[14])*A+(ae=i[15])*U,n[13]=Y*l+Q*x+le*M+ae*G,n[14]=Y*h+Q*v+le*R+ae*V,n[15]=Y*f+Q*S+le*D+ae*Z,n}function dt(n,e,i){var r,l,h,f,m,x,v,S,A,M,R,D,U=i[0],G=i[1],V=i[2];return e===n?(n[12]=e[0]*U+e[4]*G+e[8]*V+e[12],n[13]=e[1]*U+e[5]*G+e[9]*V+e[13],n[14]=e[2]*U+e[6]*G+e[10]*V+e[14],n[15]=e[3]*U+e[7]*G+e[11]*V+e[15]):(l=e[1],h=e[2],f=e[3],m=e[4],x=e[5],v=e[6],S=e[7],A=e[8],M=e[9],R=e[10],D=e[11],n[0]=r=e[0],n[1]=l,n[2]=h,n[3]=f,n[4]=m,n[5]=x,n[6]=v,n[7]=S,n[8]=A,n[9]=M,n[10]=R,n[11]=D,n[12]=r*U+m*G+A*V+e[12],n[13]=l*U+x*G+M*V+e[13],n[14]=h*U+v*G+R*V+e[14],n[15]=f*U+S*G+D*V+e[15]),n}function nt(n,e,i){var r=i[0],l=i[1],h=i[2];return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*l,n[5]=e[5]*l,n[6]=e[6]*l,n[7]=e[7]*l,n[8]=e[8]*h,n[9]=e[9]*h,n[10]=e[10]*h,n[11]=e[11]*h,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function vt(n,e,i){var r=Math.sin(i),l=Math.cos(i),h=e[4],f=e[5],m=e[6],x=e[7],v=e[8],S=e[9],A=e[10],M=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=h*l+v*r,n[5]=f*l+S*r,n[6]=m*l+A*r,n[7]=x*l+M*r,n[8]=v*l-h*r,n[9]=S*l-f*r,n[10]=A*l-m*r,n[11]=M*l-x*r,n}function ut(n,e,i){var r=Math.sin(i),l=Math.cos(i),h=e[0],f=e[1],m=e[2],x=e[3],v=e[8],S=e[9],A=e[10],M=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=h*l-v*r,n[1]=f*l-S*r,n[2]=m*l-A*r,n[3]=x*l-M*r,n[8]=h*r+v*l,n[9]=f*r+S*l,n[10]=m*r+A*l,n[11]=x*r+M*l,n}function rt(n,e,i){var r=Math.sin(i),l=Math.cos(i),h=e[0],f=e[1],m=e[2],x=e[3],v=e[4],S=e[5],A=e[6],M=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=h*l+v*r,n[1]=f*l+S*r,n[2]=m*l+A*r,n[3]=x*l+M*r,n[4]=v*l-h*r,n[5]=S*l-f*r,n[6]=A*l-m*r,n[7]=M*l-x*r,n}function wt(n,e){return n[0]=e[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Ii(n,e,i){var r,l,h,f=i[0],m=i[1],x=i[2],v=Math.sqrt(f*f+m*m+x*x);return v<ue?null:(f*=v=1/v,m*=v,x*=v,r=Math.sin(e),l=Math.cos(e),n[0]=f*f*(h=1-l)+l,n[1]=m*f*h+x*r,n[2]=x*f*h-m*r,n[3]=0,n[4]=f*m*h-x*r,n[5]=m*m*h+l,n[6]=x*m*h+f*r,n[7]=0,n[8]=f*x*h+m*r,n[9]=m*x*h-f*r,n[10]=x*x*h+l,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n)}function ji(n,e){var i=e[0],r=e[1],l=e[2],h=e[4],f=e[5],m=e[6],x=e[8],v=e[9],S=e[10];return n[0]=Math.sqrt(i*i+r*r+l*l),n[1]=Math.sqrt(h*h+f*f+m*m),n[2]=Math.sqrt(x*x+v*v+S*S),n}function Bi(n,e){var i=e[0],r=e[1],l=e[2],h=e[3],f=i+i,m=r+r,x=l+l,v=i*f,S=r*f,A=r*m,M=l*f,R=l*m,D=l*x,U=h*f,G=h*m,V=h*x;return n[0]=1-A-D,n[1]=S+V,n[2]=M-G,n[3]=0,n[4]=S-V,n[5]=1-v-D,n[6]=R+U,n[7]=0,n[8]=M+G,n[9]=R-U,n[10]=1-v-A,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}var ai=pt;function Vt(){var n=new re(3);return re!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function gi(n){var e=new re(3);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e}function Si(n){var e=n[0],i=n[1],r=n[2];return Math.sqrt(e*e+i*i+r*r)}function je(n,e,i){var r=new re(3);return r[0]=n,r[1]=e,r[2]=i,r}function St(n,e,i,r){return n[0]=e,n[1]=i,n[2]=r,n}function Tt(n,e,i){return n[0]=e[0]+i[0],n[1]=e[1]+i[1],n[2]=e[2]+i[2],n}function _i(n,e,i){return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],n}function ei(n,e,i){return n[0]=e[0]*i[0],n[1]=e[1]*i[1],n[2]=e[2]*i[2],n}function Ue(n,e,i){return n[0]=Math.min(e[0],i[0]),n[1]=Math.min(e[1],i[1]),n[2]=Math.min(e[2],i[2]),n}function Dt(n,e,i){return n[0]=Math.max(e[0],i[0]),n[1]=Math.max(e[1],i[1]),n[2]=Math.max(e[2],i[2]),n}function bt(n,e,i){return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n}function Ht(n,e,i,r){return n[0]=e[0]+i[0]*r,n[1]=e[1]+i[1]*r,n[2]=e[2]+i[2]*r,n}function ui(n,e){var i=e[0]-n[0],r=e[1]-n[1],l=e[2]-n[2];return Math.sqrt(i*i+r*r+l*l)}function hi(n,e){var i=e[0]-n[0],r=e[1]-n[1],l=e[2]-n[2];return i*i+r*r+l*l}function Ai(n){var e=n[0],i=n[1],r=n[2];return e*e+i*i+r*r}function Oi(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n}function xi(n,e){var i=e[0],r=e[1],l=e[2],h=i*i+r*r+l*l;return h>0&&(h=1/Math.sqrt(h)),n[0]=e[0]*h,n[1]=e[1]*h,n[2]=e[2]*h,n}function ln(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function Xn(n,e,i){var r=e[0],l=e[1],h=e[2],f=i[0],m=i[1],x=i[2];return n[0]=l*x-h*m,n[1]=h*f-r*x,n[2]=r*m-l*f,n}function Or(n,e,i,r){var l=e[0],h=e[1],f=e[2];return n[0]=l+r*(i[0]-l),n[1]=h+r*(i[1]-h),n[2]=f+r*(i[2]-f),n}function Nn(n,e,i){var r=e[0],l=e[1],h=e[2],f=i[3]*r+i[7]*l+i[11]*h+i[15];return n[0]=(i[0]*r+i[4]*l+i[8]*h+i[12])/(f=f||1),n[1]=(i[1]*r+i[5]*l+i[9]*h+i[13])/f,n[2]=(i[2]*r+i[6]*l+i[10]*h+i[14])/f,n}function bo(n,e,i){var r=e[0],l=e[1],h=e[2];return n[0]=r*i[0]+l*i[3]+h*i[6],n[1]=r*i[1]+l*i[4]+h*i[7],n[2]=r*i[2]+l*i[5]+h*i[8],n}function Ka(n,e,i){var r=i[0],l=i[1],h=i[2],f=i[3],m=e[0],x=e[1],v=e[2],S=l*v-h*x,A=h*m-r*v,M=r*x-l*m;return n[0]=m+f*(S+=S)+l*(M+=M)-h*(A+=A),n[1]=x+f*A+h*S-r*M,n[2]=v+f*M+r*A-l*S,n}function Qa(n){return n[0]=0,n[1]=0,n[2]=0,n}function Oo(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]}var rr=_i,wo=ei,Ja=Si;function Ys(){var n=new re(4);return re!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function Wr(n,e,i){return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=e[3]*i,n}function es(n,e){var i=e[0],r=e[1],l=e[2],h=e[3],f=i*i+r*r+l*l+h*h;return f>0&&(f=1/Math.sqrt(f)),n[0]=i*f,n[1]=r*f,n[2]=l*f,n[3]=h*f,n}function pr(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3]}function Bo(n,e,i){var r=e[0],l=e[1],h=e[2],f=e[3];return n[0]=i[0]*r+i[4]*l+i[8]*h+i[12]*f,n[1]=i[1]*r+i[5]*l+i[9]*h+i[13]*f,n[2]=i[2]*r+i[6]*l+i[10]*h+i[14]*f,n[3]=i[3]*r+i[7]*l+i[11]*h+i[15]*f,n}function oa(){var n=new re(4);return re!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function ts(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function Sa(n,e,i){i*=.5;var r=e[0],l=e[1],h=e[2],f=e[3],m=Math.sin(i),x=Math.cos(i);return n[0]=r*x+f*m,n[1]=l*x+h*m,n[2]=h*x-l*m,n[3]=f*x-r*m,n}function bs(n,e,i){i*=.5;var r=e[0],l=e[1],h=e[2],f=e[3],m=Math.sin(i),x=Math.cos(i);return n[0]=r*x-h*m,n[1]=l*x+f*m,n[2]=h*x+r*m,n[3]=f*x-l*m,n}Vt(),Ys();var zr,El,oo,ws=es,Br=(zr=Vt(),El=je(1,0,0),oo=je(0,1,0),function(n,e,i){var r=ln(e,i);return r<-.999999?(Xn(zr,El,e),Ja(zr)<1e-6&&Xn(zr,oo,e),xi(zr,zr),(function(l,h,f){f*=.5;var m=Math.sin(f);l[0]=m*h[0],l[1]=m*h[1],l[2]=m*h[2],l[3]=Math.cos(f)})(n,zr,Math.PI),n):r>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Xn(zr,e,i),n[0]=zr[0],n[1]=zr[1],n[2]=zr[2],n[3]=1+r,ws(n,n))});function mr(){var n=new re(2);return re!=Float32Array&&(n[0]=0,n[1]=0),n}function Dr(n,e){var i=new re(2);return i[0]=n,i[1]=e,i}function Ts(n,e,i){return n[0]=e,n[1]=i,n}function is(n,e,i){return n[0]=e[0]+i[0],n[1]=e[1]+i[1],n}function To(n,e,i){return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n}function ka(n,e,i){return n[0]=e[0]*i,n[1]=e[1]*i,n}function Fa(n){var e=n[0],i=n[1];return Math.sqrt(e*e+i*i)}function ns(n,e){var i=e[0],r=e[1],l=i*i+r*r;return l>0&&(l=1/Math.sqrt(l)),n[0]=e[0]*l,n[1]=e[1]*l,n}function vn(n,e){return n[0]*e[0]+n[1]*e[1]}oa(),oa(),oe();var ki,xr,kr=To;function gr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}mr();var Ks=(function(){if(xr)return ki;function n(e,i,r,l){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(l-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=l}return xr=1,ki=n,n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,l=0;l<8;l++){var h=this.sampleCurveX(r)-e;if(Math.abs(h)<i)return r;var f=this.sampleCurveDerivativeX(r);if(Math.abs(f)<1e-6)break;r-=h/f}var m=0,x=1;for(r=e,l=0;l<20&&(h=this.sampleCurveX(r),!(Math.abs(h-e)<i));l++)e>h?m=r:x=r,r=.5*(x-m)+m;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},ki})(),_r=gr(Ks);function _t(n,e){this.x=n,this.y=e}function aa(n,e){if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(!aa(n[i],e[i]))return!1;return!0}if(typeof n=="object"&&n!==null&&e!==null){if(typeof e!="object"||Object.keys(n).length!==Object.keys(e).length)return!1;for(const i in n)if(!aa(n[i],e[i]))return!1;return!0}return n===e}_t.prototype={clone(){return new _t(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,e){return this.clone()._rotateAround(n,e)},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 e=n.x-this.x,i=n.y-this.y;return e*e+i*i},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,e){return Math.atan2(this.x*e-this.y*n,this.x*n+this.y*e)},_matMult(n){const e=n[2]*this.x+n[3]*this.y;return this.x=n[0]*this.x+n[1]*this.y,this.y=e,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 e=Math.cos(n),i=Math.sin(n),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround(n,e){const i=Math.cos(n),r=Math.sin(n),l=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=l,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:_t},_t.convert=function(n){if(n instanceof _t)return n;if(Array.isArray(n))return new _t(+n[0],+n[1]);if(n.x!==void 0&&n.y!==void 0)return new _t(+n.x,+n.y);throw new Error("Expected [x, y] or {x, y} point format")};const Wo=Math.PI/180,So=180/Math.PI;function Ki(n){return n*Wo}function De(n){return n*So}const $=[[0,0],[1,0],[1,1],[0,1]];function K(n){if(n<=0)return 0;if(n>=1)return 1;const e=n*n,i=e*n;return 4*(n<.5?i:3*(n-e)+i-.75)}function ce(n,e,i,r){const l=new _r(n,e,i,r);return function(h){return l.solve(h)}}const we=ce(.25,.1,.25,1);function he(n,e,i){return Math.min(i,Math.max(e,n))}function Ie(n,e,i){return(i=he((i-n)/(e-n),0,1))*i*(3-2*i)}function Ge(n,e,i){const r=i-e,l=((n-e)%r+r)%r+e;return l===e?i:l}function Pe(n,e,i){if(!n.length)return i(null,[]);let r=n.length;const l=new Array(n.length);let h=null;n.forEach((f,m)=>{e(f,(x,v)=>{x&&(h=x),l[m]=v,--r===0&&i(h,l)})})}let qe=1;function Mt(){return qe++}function yt(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log2(n)))}function Zt(n,e){n.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function ri(n,e,i){const r={};for(const l in n)r[l]=e.call(this,n[l],l,n);return r}function li(n,e,i){const r={};for(const l in n)e.call(this,n[l],l,n)&&(r[l]=n[l]);return r}function Mi(n){return Array.isArray(n)?n.map(Mi):typeof n=="object"&&n?ri(n,Mi):n}function Li(n,e){for(let i=0;i<n.length;i++)if(e.indexOf(n[i])>=0)return!0;return!1}const si={};function vi(n){si[n]||(typeof console<"u"&&console.warn(n),si[n]=!0)}function Rn(n,e,i){return(i.y-n.y)*(e.x-n.x)>(e.y-n.y)*(i.x-n.x)}function or(n){let e=0;for(let i,r,l=0,h=n.length,f=h-1;l<h;f=l++)i=n[l],r=n[f],e+=(r.x-i.x)*(i.y+r.y);return e}function jn([n,e,i]){const r=Ki(e+90),l=Ki(i);return{x:n*Math.cos(r)*Math.sin(l),y:n*Math.sin(r)*Math.sin(l),z:n*Math.cos(l),azimuthal:e,polar:i}}function dr(n){return(typeof self<"u"||n!==void 0)&&typeof WorkerGlobalScope<"u"&&(n!==void 0?n:self)instanceof WorkerGlobalScope}function Un(n){const e={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,r,l,h)=>{const f=l||h;return e[r]=!f||f.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Ji=null;function Hn(n,e){return[n[4*e],n[4*e+1],n[4*e+2],n[4*e+3]]}function bn(n,e,i,r){for(;e<i;){const l=e+i>>1;n[l]<r?e=l+1:i=l}return e}function wn(n,e,i,r){for(;e<i;){const l=e+i>>1;n[l]<=r?e=l+1:i=l}return e}function zn(n){return n>0?1/(1.001-n):1+n}function ar(n){return n>0?1-1/(1.001-n):-n}function Yr(n,e,i){return(n-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const Fr={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Fr.API_URL)return null;try{const n=new URL(Fr.API_URL);return n.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":n.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Qs(n){return Fr.API_URL_REGEX.test(n)}function Eo(n){return Fr.API_SPRITE_REGEX.test(n)}let ko,rs,Gr,Yo,Fo,Ss;function os(){return ko==null&&(ko=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),ko}const Ea={now:()=>Yo!==void 0?Yo:performance.now(),setNow(n){Yo=n},restoreNow(){Yo=void 0},frame(n){const e=requestAnimationFrame(n);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(n,e=0){const{width:i,height:r}=n;Fo||(Fo=document.createElement("canvas"));const l=Fo.getContext("2d",{willReadFrequently:!0});if(!l)throw new Error("failed to create canvas 2d context");return(i>Fo.width||r>Fo.height)&&(Fo.width=i,Fo.height=r),l.clearRect(-e,-e,i+2*e,r+2*e),l.drawImage(n,
2120,0,i,r),l.getImageData(-e,-e,i+2*e,r+2*e)},resolveURL:n=>(rs||(rs=document.createElement("a")),rs.href=n,rs.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Gr==null&&(Gr=window.matchMedia("(prefers-reduced-motion: reduce)")),Gr.matches)},hasCanvasFingerprintNoise(){if(Ss!==void 0)return Ss;if(!os())return Ss=!1,!1;const n=new OffscreenCanvas(85,1),e=n.getContext("2d",{willReadFrequently:!0});let i=0;for(let l=0;l<n.width;++l)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(l,0,1,1);const r=e.getImageData(0,0,n.width,n.height);i=0;for(let l=0;l<r.data.length;++l)if(l%4!=3&&i++!==r.data[l])return Ss=!0,!0;return Ss=!1,!1}};function Lu(n,e){const i=n.indexOf("?");if(i<0)return`${n}?${new URLSearchParams(e).toString()}`;const r=new URLSearchParams(n.slice(i));for(const l in e)r.set(l,e[l]);return`${n.slice(0,i)}?${r.toString()}`}function Js(n,e={persistentParams:[]}){const i=n.indexOf("?");if(i<0)return n;const r=new URLSearchParams,l=new URLSearchParams(n.slice(i));
212for(const f of e.persistentParams){const m=l.get(f);m&&r.set(f,m)}const h=r.toString();return`${n.slice(0,i)}${h.length>0?`?${h}`:""}`}const Em="mapbox-tiles";let lp=500,Xd=50;const Gh=["language","worldview","jobid"];let ao,Na;function as(){try{return caches}catch{}}function Kr(){const n=as();n&&ao==null&&(ao=n.open(Em))}let ss=1/0;const ac={supported:!1,testSupport:function(n){!Al&&ls&&(Ou?Bu(n):Es=n)}};let Es,ls,Al=!1,Ou=!1;const cp=typeof self<"u"?self:{};function Bu(n){const e=n.createTexture();n.bindTexture(n.TEXTURE_2D,e);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,ls),n.isContextLost())return;ac.supported=!0}catch{}n.deleteTexture(e),Al=!0}cp.document&&(ls=cp.document.createElement("img"),ls.onload=function(){Es&&Bu(Es),Es=null,Ou=!0},ls.onerror=function(){Al=!0,Es=null},ls.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Nr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(Nr);class Nc extends Error{constructor(e,i,r){i===401&&Qs(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ml=dr()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Ko=function(n,e){if(!(/^file:/.test(i=n.url)||/^file:/.test(Ml())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return(function(r,l){const h=new AbortController,f=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,referrer:Ml(),referrerPolicy:r.referrerPolicy,signal:h.signal});let m=!1,x=!1;const v=(S=f.url).indexOf("sku=")>0&&Qs(S);var S;r.type==="json"&&f.headers.set("Accept","application/json");const A=(R,D,U)=>{if(x)return;if(R&&R.message!=="SecurityError"&&vi(R.toString()),D&&U)return M(D);const G=Date.now();fetch(f).then(V=>{if(V.ok){const Z=v?V.clone():null;return M(V,Z,G)}return l(new Nc(V.statusText,V.status,r.url))}).catch(V=>{V.name!=="AbortError"&&l(new Error(`${V.message} ${r.url}`))})},M=(R,D,U)=>{(r.type==="arrayBuffer"?R.arrayBuffer():r.type==="json"?R.json():R.text()).then(G=>{x||(D&&U&&(function(V,Z,Y){if(Kr(),ao==null)return;const Q=Un(Z.headers.get("Cache-Control")||"");if(Q["no-store"])return;const le={status:Z.status,statusText:Z.statusText,headers:new Headers};Z.headers.forEach((_e,pe)=>le.headers.set(pe,_e)),Q["max-age"]&&le.headers.set("Expires",new Date(Y+1e3*Q["max-age"]).toUTCString());const ae=le.headers.get("Expires");if(!ae||new Date(ae).getTime()-Y<42e4)return;
212let ge=Js(V.url,{persistentParams:Gh});if(Z.status===206){const _e=V.headers.get("Range");if(!_e)return;le.status=200,ge=Lu(ge,{range:_e})}(function(_e,pe){if(Na===void 0)try{new Response(new ReadableStream),Na=!0}catch{Na=!1}Na?pe(_e.body):_e.blob().then(pe).catch(be=>vi(be.message))})(Z,_e=>{const pe=new Response((be=Z.status)!==200&&be!==404&&[101,103,204,205,304].includes(be)?null:_e,le);var be;Kr(),ao?.then(Me=>Me.put(ge,pe)).catch(Me=>vi(Me.message))})})(f,D,U),m=!0,l(null,G,R.headers))}).catch(G=>{x||l(new Error(G.message))})};return v?(function(R,D){if(Kr(),ao==null)return D(null);ao.then(U=>{let G=Js(R.url,{persistentParams:Gh});const V=R.headers.get("Range");V&&(G=Lu(G,{range:V})),U.match(G).then(Z=>{const Y=(function(Q){if(!Q)return!1;const le=new Date(Q.headers.get("Expires")||0),ae=Un(Q.headers.get("Cache-Control")||"");return Number(le)>Date.now()&&!ae["no-cache"]})(Z);U.delete(G).catch(D),Y&&U.put(G,Z.clone()).catch(D),D(null,Z,Y)}).catch(D)}).catch(D)})(f,A):A(null,null),{cancel:()=>{x=!0,m||h.abort()}}})(n,e);if(dr(self)&&self.worker.actor)return self.worker.actor.send("getResource",n,e,void 0,!0)}var i;return(function(r,l){const h=new XMLHttpRequest;h.open(r.method||"GET",r.url,!0),r.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const f in r.headers)h.setRequestHeader(f,r.headers[f]);return r.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=r.credentials==="include",h.onerror=()=>{l(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let f=h.response;if(r.type==="json")try{f=JSON.parse(h.response)}catch(x){return l(x)}const m=new Headers;h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(x=>{const v=x.split(": "),S=v.shift(),A=v.join(": ");m.append(S,A)}),l(null,f,m)}else l(new Nc(h.statusText,h.status,r.url))},h.send(r.body),{cancel:()=>h.abort()}})(n,e)},Uc=function(n,e){return Ko(Object.assign(n,{type:"arrayBuffer"}),e)};function Wd(n){const e=document.createElement("a");return e.href=n,e.protocol===location.protocol&&e.host===location.host}const Yd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let en,Cl;en=[],Cl=0;const Hh=function(n,e){if(ac.supported&&(n.headers||(n.headers={}),n.headers.accept="image/webp,*/*"),Cl>=Fr.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:n,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return en.push(h),h}Cl++;let i=!1;const r=()=>{if(!i)for(i=!0,Cl--;en.length&&Cl<Fr.MAX_PARALLEL_IMAGE_REQUESTS;){const h=en.shift(),{requestParameters:f,callback:m,cancelled:x}=h;x||(h.cancel=Hh(f,m).cancel)}},l=Uc(n,(h,f,m)=>{r(),h?e(h):f&&(self.createImageBitmap?(function(x,v){const S=new Blob([new Uint8Array(x)],{type:"image/png"});createImageBitmap(S).then(A=>{v(null,A)}).catch(A=>{v(new Error(`Could not load image because of ${A.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})})(f,(x,v)=>e(x,v,m)):(function(x,v){const S=new Image;S.onload=()=>{v(null,S),URL.revokeObjectURL(S.src),S.onload=null,requestAnimationFrame(()=>{S.src=Yd})},S.onerror=()=>v(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 A=new Blob([new Uint8Array(x)],{type:"image/png"});S.src=x.byteLength?URL.createObjectURL(A):Yd})(f,(x,v)=>e(x,v,m)))});return{cancel:()=>{l.cancel(),r()}}};var sa,sc,lc,cs={exports:{}},qh={exports:{}},ku={exports:{}},up=(function(){if(lc)return cs.exports;lc=1;var n=(sa||(sa=1,qh.exports=function(i,r){var l,h,f,m,x,v,S,A;for(h=i.length-(l=3&i.length),f=r,x=3432918353,v=461845907,A=0;A<h;)S=255&i.charCodeAt(A)|(255&i.charCodeAt(++A))<<8|(255&i.charCodeAt(++A))<<16|(255&i.charCodeAt(++A))<<24,++A,f=27492+(65535&(m=5*(65535&(f=(f^=S=(65535&(S=(S=(65535&S)*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*v+(((S>>>16)*v&65535)<<16)&4294967295)<<13|f>>>19))+((5*(f>>>16)&65535)<<16)&4294967295))+(((m>>>16)+58964&65535)<<16);
212switch(S=0,l){case 3:S^=(255&i.charCodeAt(A+2))<<16;case 2:S^=(255&i.charCodeAt(A+1))<<8;case 1:f^=S=(65535&(S=(S=(65535&(S^=255&i.charCodeAt(A)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*v+(((S>>>16)*v&65535)<<16)&4294967295}return f^=i.length,f=2246822507*(65535&(f^=f>>>16))+((2246822507*(f>>>16)&65535)<<16)&4294967295,f=3266489909*(65535&(f^=f>>>13))+((3266489909*(f>>>16)&65535)<<16)&4294967295,(f^=f>>>16)>>>0}),qh.exports),e=(sc||(sc=1,ku.exports=function(i,r){for(var l,h=i.length,f=r^h,m=0;h>=4;)l=1540483477*(65535&(l=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(l>>>16)&65535)<<16),f=1540483477*(65535&f)+((1540483477*(f>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),h-=4,++m;switch(h){case 3:f^=(255&i.charCodeAt(m+2))<<16;case 2:f^=(255&i.charCodeAt(m+1))<<8;case 1:f=1540483477*(65535&(f^=255&i.charCodeAt(m)))+((1540483477*(f>>>16)&65535)<<16)}return f=1540483477*(65535&(f^=f>>>13))+((1540483477*(f>>>16)&65535)<<16),(f^=f>>>15)>>>0}),ku.exports);return cs.exports=n,cs.exports.murmur3=n,cs.exports.murmur2=e,cs.exports})(),el=gr(up);class us{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class Fu extends us{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function Am(n,e,i){i[n]&&i[n].indexOf(e)!==-1||(i[n]=i[n]||[],i[n].push(e))}function Vc(n,e,i){if(i&&i[n]){const r=i[n].indexOf(e);r!==-1&&i[n].splice(r,1)}}class Il{on(e,i){return this._listeners=this._listeners||{},Am(e,i,this._listeners),this}off(e,i){return Vc(e,i,this._listeners),Vc(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Am(e,i,this._oneTimeListeners),this):new Promise(r=>{this.once(e,r)})}fire(e,i){const r=typeof e=="string"?new us(e,i):e,l=r.type;if(this.listens(l)){r.target=this;const h=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(const x of h)x.call(this,r);const f=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(const x of f)Vc(l,x,this._oneTimeListeners),x.call(this,r);const m=this._eventedParent;if(m){const x=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(r,x),m.fire(r)}}else r instanceof Fu&&console.error(r.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class No{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new No(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,r]=e.split("�");return new No({name:i,iconsetId:r})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return No.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var hs,Kd={},Mm=(function(){if(hs)return Kd;hs=1;var n={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};
vendor: 23,509 bytes, line 212
212function e(h){return(h=Math.round(h))<0?0:h>255?255:h}function i(h){return e(h[h.length-1]==="%"?parseFloat(h)/100*255:parseInt(h))}function r(h){return(f=h[h.length-1]==="%"?parseFloat(h)/100:parseFloat(h))<0?0:f>1?1:f;var f}function l(h,f,m){return m<0?m+=1:m>1&&(m-=1),6*m<1?h+(f-h)*m*6:2*m<1?f:3*m<2?h+(f-h)*(2/3-m)*6:h}try{Kd.parseCSSColor=function(h){var f,m=h.replace(/ /g,"").toLowerCase();if(m in n)return n[m].slice();if(m[0]==="#")return m.length===4?(f=parseInt(m.substr(1),16))>=0&&f<=4095?[(3840&f)>>4|(3840&f)>>8,240&f|(240&f)>>4,15&f|(15&f)<<4,1]:null:m.length===7&&(f=parseInt(m.substr(1),16))>=0&&f<=16777215?[(16711680&f)>>16,(65280&f)>>8,255&f,1]:null;var x=m.indexOf("("),v=m.indexOf(")");if(x!==-1&&v+1===m.length){var S=m.substr(0,x),A=m.substr(x+1,v-(x+1)).split(","),M=1;switch(S){case"rgba":if(A.length!==4)return null;M=r(A.pop());case"rgb":return A.length!==3?null:[i(A[0]),i(A[1]),i(A[2]),M];case"hsla":if(A.length!==4)return null;M=r(A.pop());case"hsl":if(A.length!==3)return null;var R=(parseFloat(A[0])%360+360)%360/360,D=r(A[1]),U=r(A[2]),G=U<=.5?U*(D+1):U+D-U*D,V=2*U-G;return[e(255*l(V,G,R+1/3)),e(255*l(V,G,R)),e(255*l(V,G,R-1/3)),M];default:return null}}return null}}catch{}return Kd})();class pn{constructor(e,i,r,l=1){this.r=e,this.g=i,this.b=r,this.a=l}static parse(e){if(!e)return;if(e instanceof pn)return e;if(typeof e!="string")return;const i=Mm.parseCSSColor(e);return i?new pn(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,r,l]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*r)},${l})`}toNonPremultipliedRenderColor(e){const{r:i,g:r,b:l,a:h}=this;return new dp(e,i,r,l,h)}toPremultipliedRenderColor(e){const{r:i,g:r,b:l,a:h}=this;return new Cm(e,i*h,r*h,l*h,h)}clone(){return new pn(this.r,this.g,this.b,this.a)}}class hp{constructor(e,i,r,l,h,f=!1){if(this.premultiplied=!1,this.premultiplied=f,e){const m=e.image.height,x=m*m;this.premultiplied?(i=h===0?0:i/h*(m-1),r=h===0?0:r/h*(m-1),l=h===0?0:l/h*(m-1)):(i*=m-1,r*=m-1,l*=m-1),i=Math.max(0,Math.min(m-1,i)),r=Math.max(0,Math.min(m-1,r)),l=Math.max(0,Math.min(m-1,l));const v=Math.floor(i),S=Math.floor(r),A=Math.floor(l),M=Math.ceil(i),R=Math.ceil(r),D=Math.ceil(l),U=i-v,G=r-S,V=l-A,Z=e.image.data,Y=4*(v+S*x+A*m),Q=4*(v+S*x+D*m),le=4*(v+R*x+A*m),ae=4*(v+R*x+D*m),ge=4*(M+S*x+A*m),_e=4*(M+S*x+D*m),pe=4*(M+R*x+A*m),be=4*(M+R*x+D*m);this.r=mi(mi(mi(Z[Y],Z[Q],V),mi(Z[le],Z[ae],V),G),mi(mi(Z[ge],Z[_e],V),mi(Z[pe],Z[be],V),G),U)/255*(this.premultiplied?h:1),this.g=mi(mi(mi(Z[Y+1],Z[Q+1],V),mi(Z[le+1],Z[ae+1],V),G),mi(mi(Z[ge+1],Z[_e+1],V),mi(Z[pe+1],Z[be+1],V),G),U)/255*(this.premultiplied?h:1),this.b=mi(mi(mi(Z[Y+2],Z[Q+2],V),mi(Z[le+2],Z[ae+2],V),G),mi(mi(Z[ge+2],Z[_e+2],V),mi(Z[pe+2],Z[be+2],V),G),U)/255*(this.premultiplied?h:1),this.a=h}else this.r=i,this.g=r,this.b=l,this.a=h}toArray(){const{r:e,g:i,b:r,a:l}=this;return[255*e,255*i,255*r,l]}toHslaArray(){let{r:e,g:i,b:r,a:l}=this;if(this.premultiplied){if(l===0)return[0,0,0,0];const D=1/l;e*=D,i*=D,r*=D}const h=Math.min(Math.max(e,0),1),f=Math.min(Math.max(i,0),1),m=Math.min(Math.max(r,0),1),x=Math.min(h,f,m),v=Math.max(h,f,m),S=v-x,A=.5*(x+v);if(S===0)return[0,0,100*A,l];const M=A>.5?S/(2-v-x):S/(v+x);let R;switch(v){case h:R=60*((f-m)/S+(f<m?6:0));break;case f:R=60*((m-h)/S+2);break;default:R=60*((h-f)/S+4)}return[R,100*M,100*A,l]}toArray01(){const{r:e,g:i,b:r,a:l}=this;return[e,i,r,l]}toArray01Scaled(e){const{r:i,g:r,b:l}=this;return[i*e,r*e,l*e]}toArray01Linear(){const{r:e,g:i,b:r,a:l}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(r,2.2),l]}}class dp extends hp{constructor(e,i,r,l,h){super(e,i,r,l,h,!1)}}class Cm extends hp{constructor(e,i,r,l,h){super(e,i,r,l,h,!0)}}function mi(n,e,i){return n*(1-i)+e*i}function fp(n,e,i){return n.map((r,l)=>mi(r,e[l],i))}pn.black=new pn(0,0,0,1),pn.white=new pn(1,1,1,1),pn.transparent=new pn(0,0,0,0),pn.red=new pn(1,0,0,1),pn.blue=new pn(0,0,1,1);var jc=Object.freeze({__proto__:null,array:fp,color:function(n,e,i){return new pn(mi(n.r,e.r,i),mi(n.g,e.g,i),mi(n.b,e.b,i),mi(n.a,e.a,i))},number:mi});class Ao extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Qd{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[r,l]of i)this.bindings[r]=l}concat(e){return new Qd(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const la={kind:"null"},ni={kind:"number"},dn={kind:"string"},cn={kind:"boolean"},Qo={kind:"color"},Nu={kind:"object"},yn={kind:"value"},Jd={kind:"collator"},Uu={kind:"formatted"},Gc={kind:"resolvedImage"};function Uo(n,e){return{kind:"array",itemType:n,N:e}}function vr(n){if(n.kind==="array"){const e=vr(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}return n.kind}const pp=[la,ni,dn,cn,Qo,Uu,Nu,Uo(yn),Gc];function Rl(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Rl(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const i of pp)if(!Rl(i,e))return null}}return`Expected ${vr(n)} but found ${vr(e)} instead.`}function mp(n,e){return e.some(i=>i.kind===n.kind)}function Vu(n,e){return e.some(i=>i==="null"?n===null:i==="array"?Array.isArray(n):i==="object"?n&&!Array.isArray(n)&&typeof n=="object":i===typeof n)}function Zh(n,e){return n.kind==="array"&&e.kind==="array"?n.N===e.N&&Zh(n.itemType,e.itemType):n.kind===e.kind}class ef{constructor(e,i,r){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class $h{constructor(e,i,r,l,h){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=r,this.fontStack=l,this.textColor=h}}class Mo{constructor(e){this.sections=e}static fromString(e){return new Mo([new $h(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof Mo?e:Mo.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const l=i.image.getPrimary().id.toString();e.push(["image",l]);continue}e.push(i.text);const r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),i.textColor&&(r["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(r)}return e}}class so{constructor(e,i={}){this.id=No.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,r,l,h;try{({id:i,params:r,sx:l,sy:h}=JSON.parse(e)||{})}catch{return null}return i?new so(i,{params:r,sx:l,sy:h}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class ca{constructor(e,i,r,l,h=!1){this.primaryId=No.from(e),this.primaryOptions=i,r&&(this.secondaryId=No.from(r)),this.secondaryOptions=l,this.available=h}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new so(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new so(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?ca.build({name:e}):e}static build(e,i,r,l){return!e||typeof e=="object"&&!("name"in e)?null:new ca(e,r,i,l)}}function gp(n,e,i,r){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[n,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[n,e,i,r]:[n,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function cc(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof pn||n instanceof ef||n instanceof Mo||n instanceof ca)return!0;if(Array.isArray(n)){for(const e of n)if(!cc(e))return!1;return!0}if(typeof n=="object"){for(const e in n)if(!cc(n[e]))return!1;return!0}return!1}function Ur(n){if(n===null)return la;if(typeof n=="string")return dn;if(typeof n=="boolean")return cn;if(typeof n=="number")return ni;if(n instanceof pn)return Qo;if(n instanceof ef)return Jd;if(n instanceof Mo)return Uu;if(n instanceof ca)return Gc;if(Array.isArray(n)){const e=n.length;let i;for(const r of n){const l=Ur(r);if(i){if(i===l)continue;i=yn;break}i=l}return Uo(i||yn,e)}return Nu}function As(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof Mo||n instanceof ca||n instanceof pn?n.toString():JSON.stringify(n)}class Ua{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!cc(e[1]))return i.error("invalid value");const r=e[1];let l=Ur(r);const h=i.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new Ua(l,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof pn?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Mo?this.value.serialize():this.value}}class br{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const uc={string:dn,number:ni,boolean:cn,object:Nu};class bi{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r,l=1;const h=e[0];if(h==="array"){let m,x;if(e.length>2){const v=e[1];if(typeof v!="string"||!(v in uc)||v==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);m=uc[v],l++}else m=yn;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);x=e[2],l++}r=Uo(m,x)}else r=uc[h];const f=[];for(;l<e.length;l++){const m=i.parse(e[l],l,yn);if(!m)return null;f.push(m)}return new bi(r,f)}evaluate(e){for(let i=0;i<this.args.length;i++){const r=this.args[i].evaluate(e);if(!Rl(this.type,Ur(r)))return r;if(i===this.args.length-1)throw new br(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${vr(Ur(r))} but was expected to be of type ${vr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const r=e.itemType;if(r.kind==="string"||r.kind==="number"||r.kind==="boolean"){i.push(r.kind);const l=e.N;(typeof l=="number"||this.args.length>1)&&i.push(l)}}return i.concat(this.args.map(r=>r.serialize()))}}class ti{constructor(e){this.type=Uu,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");const l=[];let h=!1;for(let f=1;f<=e.length-1;++f){const m=e[f];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let x=null;if(m["font-scale"]&&(x=i.parseObjectValue(m["font-scale"],f,"font-scale",ni),!x))return null;let v=null;if(m["text-font"]&&(v=i.parseObjectValue(m["text-font"],f,"text-font",Uo(dn)),!v))return null;let S=null;if(m["text-color"]&&(S=i.parseObjectValue(m["text-color"],f,"text-color",Qo),!S))return null;const A=l[l.length-1];A.scale=x,A.font=v,A.textColor=S}else{const x=i.parse(e[f],f,yn);if(!x)return null;const v=x.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:x,scale:null,font:null,textColor:null})}}return new ti(l)}evaluate(e){return new Mo(this.sections.map(i=>{const r=i.content.evaluate(e);return Zh(Ur(r),Gc)?new $h("",r,null,null,null):new $h(As(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),i.textColor&&(r["text-color"]=i.textColor.serialize()),e.push(r)}return e}}class Hc{constructor(e,i,r,l){this._imageWarnHistory={},this.type=Gc,this.namePrimary=e,this.nameSecondary=i,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),l&&(this.paramsSecondary=l.params,this.iconsetIdSecondary=l.iconset?l.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let r=1;const l=[];function h(){if(r<e.length){const m=i.parse(e[r],r++,dn);return m?(l.push({image:m,options:{}}),!0):(i.error(l.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function f(){if(r<e.length){const x=e[r];if((m=x)===null||typeof m!="object"||Array.isArray(m))return!0;const v=x.params,S=x.iconset,A=i.concat(r);if(!v&&!S)return r++,!0;if(v){if(typeof v!="object"||v.constructor!==Object)return A.error('Image options "params" should be an object'),!1;const M={},R=A.concat(void 0,"params");for(const D in v){if(!D)return R.error("Image parameter name should be non-empty"),!1;const U=R.concat(void 0,D).parse(v[D],void 0,Qo,void 0,{typeAnnotation:"coerce"});if(!U)return!1;M[D]=U}l[l.length-1].options.params=M}if(S){if(typeof S!="object"||S.constructor!==Object)return A.error('Image options "iconset" should be an object'),!1;if(!S.id)return A.error('Image options "iconset" should have an "id" property'),!1;l[l.length-1].options.iconset=S}return r++,!0}var m;return!0}for(let m=0;m<2;m++)if(!h()||!f())return;return new Hc(l[0].image,l[1]?l[1].image:void 0,l[0].options,l[1]?l[1].options:void 0)}evaluateParams(e,i){const r={};if(i){for(const l in i)if(i[l])try{r[l]=i[l].evaluate(e)}catch{continue}if(Object.keys(r).length!==0)return{params:r}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},r=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,l=ca.build(i,r,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(l&&e.availableImages){const h=l.getPrimary().id;if(l.available=e.availableImages.some(f=>No.isEqual(f,h)),l.available){const f=l.getSecondary()?l.getSecondary().id:null;f&&(l.available=e.availableImages.some(m=>No.isEqual(m,f)))}}return l}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const r={};if(i&&(r.iconset={id:i}),e){r.params={};for(const l in e)e[l]&&(r.params[l]=e[l].serialize())}return Object.keys(r).length>0?r:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function yi(n){return Gu(n)?"string":di(n)?"number":tf(n)?"boolean":Array.isArray(n)?"array":n===null?"null":ju(n)?"object":typeof n}function ju(n){return n!=null&&!Array.isArray(n)&&typeof n!="function"&&!(n instanceof String||n instanceof Number||n instanceof Boolean)&&typeof n=="object"}function Gu(n){return typeof n=="string"||n instanceof String}function di(n){return typeof n=="number"||n instanceof Number}function tf(n){return typeof n=="boolean"||n instanceof Boolean}const _p={"to-boolean":cn,"to-color":Qo,"to-number":ni,"to-string":dn};class tl{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const r=e[0],l=[];let h=la;if(r==="to-array"){if(!Array.isArray(e[1]))return null;const f=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);h=Uo(i.expectedType.itemType,f)}else{if(!(f>0&&cc(e[1][0])))return null;h=Uo(Ur(e[1][0]),f)}for(let m=0;m<f;m++){const x=e[1][m];let v;if(Array.isArray(x))v=i.parse(x,void 0,h.itemType);else{const S=yi(x);if(S!==h.itemType.kind)return i.error(`Expected ${h.itemType.kind} but found ${S}.`);v=i.registry.literal.parse(["literal",x===void 0?null:x],i)}if(!v)return null;l.push(v)}}else{if((r==="to-boolean"||r==="to-string")&&e.length!==2)return i.error("Expected one argument.");h=_p[r];for(let f=1;f<e.length;f++){const m=i.parse(e[f],f,yn);if(!m)return null;l.push(m)}}return new tl(h,l)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,r;for(const l of this.args){if(i=l.evaluate(e),r=null,i instanceof pn)return i;if(typeof i=="string"){const h=e.parseColor(i);if(h)return h}else if(Array.isArray(i)&&(r=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:gp(i[0],i[1],i[2],i[3]),!r))return new pn(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new br(r||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const r of this.args){if(i=r.evaluate(e),i===null)return 0;const l=Number(i);if(!isNaN(l))return l}throw new br(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Mo.fromString(As(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?ca.build(As(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):As(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new ti([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Hc(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Im=["Unknown","Point","LineString","Polygon"];class Hu{constructor(e,i,r){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=r}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Im[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:r,y:l}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*i-e[0])+this.featureDistanceData.bearing[1]*(l*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=pn.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class ua{constructor(e,i,r,l,h){this.name=e,this.type=i,this._evaluate=r,this.args=l,this._overloadIndex=h}evaluate(e){if(!this._evaluate){const i=ua.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const r=e[0],l=ua.definitions[r];if(!l)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(l)?l[0]:l.type,f=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=[];let x=null,v=-1;for(const[S,A]of f){if(Array.isArray(S)&&S.length!==e.length-1)continue;m.push(S),v++,x=new td(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);const M=[];let R=!1;for(let D=1;D<e.length;D++){const U=e[D],G=Array.isArray(S)?S[D-1]:S.type,V=x.parse(U,1+M.length,G);if(!V){R=!0;break}M.push(V)}if(!R)if(Array.isArray(S)&&S.length!==M.length)x.error(`Expected ${S.length} arguments, but found ${M.length} instead.`);else{for(let D=0;D<M.length;D++){const U=Array.isArray(S)?S[D]:S.type,G=M[D];x.concat(D+1).checkSubtype(U,G.type)}if(x.errors.length===0)return new ua(r,h,A,M,v)}}if(m.length===1)i.errors.push(...x.errors);else{const S=(m.length?m:f.map(([M])=>M)).map(ha).join(" | "),A=[];for(let M=1;M<e.length;M++){const R=i.parse(e[M],1+A.length);if(!R)return null;A.push(vr(R.type))}i.error(`Expected arguments of type ${S}, but found (${A.join(", ")}) instead.`)}return null}static register(e,i){ua.definitions=i;for(const r in i)e[r]=ua}}function ha(n){return Array.isArray(n)?`(${n.map(vr).join(", ")})`:`(${vr(n.type)}...)`}class Aa{constructor(e,i,r){this.type=Jd,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const r=e[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");const l=r["case-sensitive"]===void 0?i.parse(!1,1,cn):i.parseObjectValue(r["case-sensitive"],1,"case-sensitive",cn);if(!l)return null;const h=r["diacritic-sensitive"]===void 0?i.parse(!1,1,cn):i.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",cn);if(!h)return null;let f=null;return r.locale&&(f=i.parseObjectValue(r.locale,1,"locale",dn),!f)?null:new Aa(l,h,f)}evaluate(e){return new ef(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Xh(n,e,i=0,r=n.length-1,l=zl){for(;r>i;){if(r-i>600){const x=r-i+1,v=e-i+1,S=Math.log(x),A=.5*Math.exp(2*S/3),M=.5*Math.sqrt(S*A*(x-A)/x)*(v-x/2<0?-1:1);Xh(n,e,Math.max(i,Math.floor(e-v*A/x+M)),Math.min(r,Math.floor(e+(x-v)*A/x+M)),l)}const h=n[e];let f=i,m=r;
212for(Va(n,i,e),l(n[r],h)>0&&Va(n,i,r);f<m;){for(Va(n,f,m),f++,m--;l(n[f],h)<0;)f++;for(;l(n[m],h)>0;)m--}l(n[i],h)===0?Va(n,i,m):(m++,Va(n,m,r)),m<=e&&(i=m+1),e<=m&&(r=m-1)}}function Va(n,e,i){const r=n[e];n[e]=n[i],n[i]=r}function zl(n,e){return n<e?-1:n>e?1:0}function Rm(n){let e=0;for(let i,r,l=0,h=n.length,f=h-1;l<h;f=l++)i=n[l],r=n[f],e+=(r.x-i.x)*(i.y+r.y);return e}function qc(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Wh(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function Dl(n,e,i){const r=n[0]-e[0],l=n[1]-e[1],h=n[0]-i[0],f=n[1]-i[1];return r*f-h*l===0&&r*h<=0&&l*f<=0}function nf(n,e,i){return e[1]>n[1]!=i[1]>n[1]&&n[0]<(i[0]-e[0])*(n[1]-e[1])/(i[1]-e[1])+e[0]}function Jo(n,e,i=!1){let r=!1;for(let l=0,h=e.length;l<h;l++){const f=e[l];for(let m=0,x=f.length,v=x-1;m<x;v=m++){const S=f[v],A=f[m];if(Dl(n,S,A))return i;nf(n,S,A)&&(r=!r)}}return r}function rf(n,e,i,r){const l=r[0]-i[0],h=r[1]-i[1],f=(n[0]-i[0])*h-l*(n[1]-i[1]),m=(e[0]-i[0])*h-l*(e[1]-i[1]);return f>0&&m<0||f<0&&m>0}function Yh(n,e,i,r){return(l=[r[0]-i[0],r[1]-i[1]])[0]*(h=[e[0]-n[0],e[1]-n[1]])[1]-l[1]*h[0]!==0&&!(!rf(n,e,i,r)||!rf(i,r,n,e));var l,h}function Ms(n){const e=new _t(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new _t(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const r of n[0])e.x>r.x&&(e.x=r.x),e.y>r.y&&(e.y=r.y),i.x<r.x&&(i.x=r.x),i.y<r.y&&(i.y=r.y);return{min:e,max:i}}const ja=8192;function yp(n,e){const i=(180+n[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(i*l*ja),Math.round(r*l*ja)]}function xp(n,e){for(let i=0;i<e.length;i++)if(Jo(n,e[i]))return!0;return!1}function Zc(n,e,i){for(const r of i)for(let l=0,h=r.length,f=h-1;l<h;f=l++)if(Yh(n,e,r[f],r[l]))return!0;return!1}function of(n,e){for(let i=0;i<n.length;++i)if(!Jo(n[i],e))return!1;for(let i=0;i<n.length-1;++i)if(Zc(n[i],n[i+1],e))return!1;return!0}function zm(n,e){for(let i=0;i<e.length;i++)if(of(n,e[i]))return!0;return!1}function il(n,e,i){const r=[];for(let l=0;l<n.length;l++){const h=[];for(let f=0;f<n[l].length;f++){const m=yp(n[l][f],i);qc(e,m),h.push(m)}r.push(h)}return r}function Dm(n,e,i){const r=[];for(let l=0;l<n.length;l++){const h=il(n[l],e,i);r.push(h)}return r}function Pm(n,e,i,r){if(n[0]<i[0]||n[0]>i[2]){const l=.5*r;let h=n[0]-i[0]>l?-r:i[0]-n[0]>l?r:0;h===0&&(h=n[0]-i[2]>l?-r:i[2]-n[0]>l?r:0),n[0]+=h}qc(e,n)}function af(n,e,i,r){const l=Math.pow(2,r.z)*ja,h=[r.x*ja,r.y*ja],f=[];if(!n)return f;for(const m of n)for(const x of m){const v=[x.x+h[0],x.y+h[1]];Pm(v,e,i,l),f.push(v)}return f}function sf(n,e,i,r){const l=Math.pow(2,r.z)*ja,h=[r.x*ja,r.y*ja],f=[];if(!n)return f;for(const x of n){const v=[];for(const S of x){const A=[S.x+h[0],S.y+h[1]];qc(e,A),v.push(A)}f.push(v)}if(e[2]-e[0]<=l/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const x of f)for(const v of x)Pm(v,e,i,l)}var m;return f}class Pl{constructor(e,i){this.type=cn,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cc(e[1])){const r=e[1];if(r.type==="FeatureCollection")for(let l=0;l<r.features.length;++l){const h=r.features[l].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Pl(r,r.features[l].geometry)}else if(r.type==="Feature"){const l=r.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Pl(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new Pl(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,r){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],f=i.canonicalID();if(!f)return!1;if(r.type==="Polygon"){const m=il(r.coordinates,h,f),x=af(i.geometry(),l,h,f);if(!Wh(l,h))return!1;for(const v of x)if(!Jo(v,m))return!1}if(r.type==="MultiPolygon"){const m=Dm(r.coordinates,h,f),x=af(i.geometry(),l,h,f);if(!Wh(l,h))return!1;for(const v of x)if(!xp(v,m))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,r){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],f=i.canonicalID();if(!f)return!1;if(r.type==="Polygon"){const m=il(r.coordinates,h,f),x=sf(i.geometry(),l,h,f);if(!Wh(l,h))return!1;for(const v of x)if(!of(v,m))return!1}if(r.type==="MultiPolygon"){const m=Dm(r.coordinates,h,f),x=sf(i.geometry(),l,h,f);if(!Wh(l,h))return!1;for(const v of x)if(!zm(v,m))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const ea={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Ga=1/298.257223563,qu=Ga*(2-Ga),Vo=Math.PI/180;class Cs{static fromTile(e,i,r){const l=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),h=Math.atan(.5*(Math.exp(l)-Math.exp(-l)))/Vo;return new Cs(h,r)}static get units(){return ea}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!ea[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(ea).join(", ")}`);const r=6378.137*Vo*(i?ea[i]:1),l=Math.cos(e*Vo),h=1/(1-qu*(1-l*l)),f=Math.sqrt(h);this.kx=r*f*l,this.ky=r*f*h*(1-qu)}distance(e,i){const r=ta(e[0]-i[0])*this.kx,l=(e[1]-i[1])*this.ky;return Math.sqrt(r*r+l*l)}bearing(e,i){const r=ta(i[0]-e[0])*this.kx;return Math.atan2(r,(i[1]-e[1])*this.ky)/Vo}destination(e,i,r){const l=r*Vo;return this.offset(e,Math.sin(l)*i,Math.cos(l)*i)}offset(e,i,r){return[e[0]+i/this.kx,e[1]+r/this.ky]}lineDistance(e){let i=0;for(let r=0;r<e.length-1;r++)i+=this.distance(e[r],e[r+1]);return i}area(e){let i=0;for(let r=0;r<e.length;r++){const l=e[r];for(let h=0,f=l.length,m=f-1;h<f;m=h++)i+=ta(l[h][0]-l[m][0])*(l[h][1]+l[m][1])*(r?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let r=0;if(i<=0)return e[0];for(let l=0;l<e.length-1;l++){const h=e[l],f=e[l+1],m=this.distance(h,f);if(r+=m,r>i)return $c(h,f,(i-(r-m))/m)}return e[e.length-1]}pointToSegmentDistance(e,i,r){let[l,h]=i,f=ta(r[0]-l)*this.kx,m=(r[1]-h)*this.ky;if(f!==0||m!==0){const x=(ta(e[0]-l)*this.kx*f+(e[1]-h)*this.ky*m)/(f*f+m*m);x>1?(l=r[0],h=r[1]):x>0&&(l+=f/this.kx*x,h+=m/this.ky*x)}return f=ta(e[0]-l)*this.kx,m=(e[1]-h)*this.ky,Math.sqrt(f*f+m*m)}pointOnLine(e,i){let r=1/0,l=e[0][0],h=e[0][1],f=0,m=0;for(let x=0;x<e.length-1;x++){let v=e[x][0],S=e[x][1],A=ta(e[x+1][0]-v)*this.kx,M=(e[x+1][1]-S)*this.ky,R=0;A===0&&M===0||(R=(ta(i[0]-v)*this.kx*A+(i[1]-S)*this.ky*M)/(A*A+M*M),R>1?(v=e[x+1][0],S=e[x+1][1]):R>0&&(v+=A/this.kx*R,S+=M/this.ky*R)),A=ta(i[0]-v)*this.kx,M=(i[1]-S)*this.ky;const D=A*A+M*M;D<r&&(r=D,l=v,h=S,f=x,m=R)}return{point:[l,h],index:f,t:Math.max(0,Math.min(1,m))}}lineSlice(e,i,r){let l=this.pointOnLine(r,e),h=this.pointOnLine(r,i);if(l.index>h.index||l.index===h.index&&l.t>h.t){const v=l;l=h,h=v}const f=[l.point],m=l.index+1,x=h.index;!Kh(r[m],f[0])&&m<=x&&f.push(r[m]);for(let v=m+1;v<=x;v++)f.push(r[v]);return Kh(r[x],h.point)||f.push(h.point),f}lineSliceAlong(e,i,r){let l=0;const h=[];for(let f=0;f<r.length-1;f++){const m=r[f],x=r[f+1],v=this.distance(m,x);if(l+=v,l>e&&h.length===0&&h.push($c(m,x,(e-(l-v))/v)),l>=i)return h.push($c(m,x,(i-(l-v))/v)),h;l>e&&h.push(x)}return h}bufferPoint(e,i){const r=i/this.ky,l=i/this.kx;return[e[0]-l,e[1]-r,e[0]+l,e[1]+r]}bufferBBox(e,i){const r=i/this.ky,l=i/this.kx;return[e[0]-l,e[1]-r,e[2]+l,e[3]+r]}insideBBox(e,i){return ta(e[0]-i[0])>=0&&ta(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Kh(n,e){return n[0]===e[0]&&n[1]===e[1]}function $c(n,e,i){const r=ta(e[0]-n[0]);return[n[0]+r*i,n[1]+(e[1]-n[1])*i]}function ta(n){for(;n<-180;)n+=360;for(;n>180;)n-=360;return n}class Xc{constructor(e=[],i=(r,l)=>r<l?-1:r>l?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:r}=this,l=i[e];for(;e>0;){const h=e-1>>1,f=i[h];if(r(l,f)>=0)break;i[e]=f,e=h}i[e]=l}_down(e){const{data:i,compare:r}=this,l=this.length>>1,h=i[e];for(;e<l;){let f=1+(e<<1);const m=f+1;if(m<this.length&&r(i[m],i[f])<0&&(f=m),r(i[f],h)>=0)break;i[e]=i[f],e=f}
vendor: 13,199 bytes, line 212
212i[e]=h}}var Lt=8192;function lf(n,e){return e.dist-n.dist}function Zu(n){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}function nl(n){return n[1]-n[0]+1}function rl(n,e){const i=n[1]>=n[0]&&n[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function da(n,e){if(n[0]>n[1])return[null,null];const i=nl(n);if(e){if(i===2)return[n,null];const r=Math.floor(i/2);return[[n[0],n[0]+r],[n[0]+r,n[1]]]}{if(i===1)return[n,null];const r=Math.floor(i/2)-1;return[[n[0],n[0]+r],[n[0]+r+1,n[1]]]}}function Ll(n,e){const i=[1/0,1/0,-1/0,-1/0];if(!rl(e,n.length))return i;for(let r=e[0];r<=e[1];++r)qc(i,n[r]);return i}function fa(n){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<n.length;++i)for(let r=0;r<n[i].length;++r)qc(e,n[i][r]);return e}function Ol(n,e,i){if(Zu(n)||Zu(e))return NaN;let r=0,l=0;return n[2]<e[0]&&(r=e[0]-n[2]),n[0]>e[2]&&(r=n[0]-e[2]),n[1]>e[3]&&(l=n[1]-e[3]),n[3]<e[1]&&(l=e[1]-n[3]),i.distance([0,0],[r,l])}function Wc(n){return 360*n-180}function hc(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function $u(n,e){const i=Math.pow(2,e.z),r=(n.y/Lt+e.y)/i;return[Wc((n.x/Lt+e.x)/i),hc(r)]}function Lm(n,e){const i=[];for(let r=0;r<n.length;++r)i.push($u(n[r],e));return i}function cf(n,e,i){const r=i.pointOnLine(e,n).point;return i.distance(n,r)}function uf(n,e,i,r,l){const h=i.slice(r[0],r[1]+1);let f=1/0;for(let m=e[0];m<=e[1];++m)if((f=Math.min(f,cf(n[m],h,l)))===0)return 0;return f}function po(n,e,i,r,l){const h=Math.min(l.pointToSegmentDistance(n,i,r),l.pointToSegmentDistance(e,i,r)),f=Math.min(l.pointToSegmentDistance(i,n,e),l.pointToSegmentDistance(r,n,e));return Math.min(h,f)}function Wi(n,e,i,r,l){if(!rl(e,n.length)||!rl(r,i.length))return NaN;let h=1/0;for(let f=e[0];f<e[1];++f)for(let m=r[0];m<r[1];++m){if(Yh(n[f],n[f+1],i[m],i[m+1]))return 0;h=Math.min(h,po(n[f],n[f+1],i[m],i[m+1],l))}return h}function Xu(n,e,i,r,l){if(!rl(e,n.length)||!rl(r,i.length))return NaN;let h=1/0;for(let f=e[0];f<=e[1];++f)for(let m=r[0];m<=r[1];++m)if((h=Math.min(h,l.distance(n[f],i[m])))===0)return h;return h}function hf(n,e,i){if(Jo(n,e,!0))return 0;let r=1/0;for(const l of e){const h=l.length;if(h<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(l[0]!==l[h-1]&&(r=Math.min(r,i.pointToSegmentDistance(n,l[h-1],l[0])))===0||(r=Math.min(r,cf(n,l,i)))===0)return r}return r}function Qh(n,e,i,r){if(!rl(e,n.length))return NaN;for(let h=e[0];h<=e[1];++h)if(Jo(n[h],i,!0))return 0;let l=1/0;for(let h=e[0];h<e[1];++h)for(const f of i)for(let m=0,x=f.length,v=x-1;m<x;v=m++){if(Yh(n[h],n[h+1],f[v],f[m]))return 0;l=Math.min(l,po(n[h],n[h+1],f[v],f[m],r))}return l}function Ma(n,e){for(const i of n)for(let r=0;r<=i.length-1;++r)if(Jo(i[r],e,!0))return!0;return!1}function ds(n,e,i,r=1/0){const l=fa(n),h=fa(e);if(r!==1/0&&Ol(l,h,i)>=r)return r;if(Wh(l,h)){if(Ma(n,e))return 0}else if(Ma(e,n))return 0;let f=r;for(const m of n)for(let x=0,v=m.length,S=v-1;x<v;S=x++)for(const A of e)for(let M=0,R=A.length,D=R-1;M<R;D=M++){if(Yh(m[S],m[x],A[D],A[M]))return 0;f=Math.min(f,po(m[S],m[x],A[D],A[M],i))}return f}function Sn(n,e,i,r,l,h,f){if(h===null||f===null)return;const m=Ol(Ll(r,h),Ll(l,f),i);m<e&&n.push({dist:m,range1:h,range2:f})}function ol(n,e,i,r,l=1/0){let h=Math.min(r.distance(n[0],i[0][0]),l);if(h===0)return h;const f=new Xc([{dist:0,range1:[0,n.length-1],range2:[0,0]}],lf),m=e?50:100,x=fa(i);for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const S=v.range1;if(nl(S)<=m){if(!rl(S,n.length))return NaN;if(e){const A=Qh(n,S,i,r);if((h=Math.min(h,A))===0)return h}else for(let A=S[0];A<=S[1];++A){const M=hf(n[A],i,r);if((h=Math.min(h,M))===0)return h}}else{const A=da(S,e);if(A[0]!==null){const M=Ol(Ll(n,A[0]),x,r);M<h&&f.push({dist:M,range1:A[0],range2:[0,0]})}if(A[1]!==null){const M=Ol(Ll(n,A[1]),x,r);M<h&&f.push({dist:M,range1:A[1],range2:[0,0]})}}}return h}function Is(n,e,i,r,l,h=1/0){let f=Math.min(h,l.distance(n[0],i[0]));if(f===0)return f;const m=new Xc([{dist:0,range1:[0,n.length-1],range2:[0,i.length-1]}],lf),x=e?50:100,v=r?50:100;for(;m.length;){const S=m.pop();if(S.dist>=f)continue;const A=S.range1,M=S.range2;if(nl(A)<=x&&nl(M)<=v){if(!rl(A,n.length)||!rl(M,i.length))return NaN;if(e&&r?f=Math.min(f,Wi(n,A,i,M,l)):e||r?e&&!r?f=Math.min(f,uf(i,M,n,A,l)):!e&&r&&(f=Math.min(f,uf(n,A,i,M,l))):f=Math.min(f,Xu(n,A,i,M,l)),f===0)return f}else{const R=da(A,e),D=da(M,r);Sn(m,f,l,n,i,R[0],D[0]),Sn(m,f,l,n,i,R[0],D[1]),Sn(m,f,l,n,i,R[1],D[0]),Sn(m,f,l,n,i,R[1],D[1])}}return f}function Rs(n,e,i,r,l=1/0){let h=l;const f=Ll(n,[0,n.length-1]);for(const m of i)if(!(h!==1/0&&Ol(f,Ll(m,[0,m.length-1]),r)>=h)&&(h=Math.min(h,Is(n,e,m,!0,r,h)),h===0))return h;return h}function Jh(n,e,i,r,l=1/0){let h=l;const f=Ll(n,[0,n.length-1]);for(const m of i){if(h!==1/0&&Ol(f,fa(m),r)>=h)continue;const x=ol(n,e,m,r,h);if(isNaN(x))return x;if((h=Math.min(h,x))===0)return h}return h}function ed(n){return n==="Point"||n==="MultiPoint"||n==="LineString"||n==="MultiLineString"||n==="Polygon"||n==="MultiPolygon"}class Bl{constructor(e,i){this.type=ni,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(cc(e[1])){const r=e[1];if(r.type==="FeatureCollection"){for(let l=0;l<r.features.length;++l)if(ed(r.features[l].geometry.type))return new Bl(r,r.features[l].geometry)}else if(r.type==="Feature"){if(ed(r.geometry.type))return new Bl(r,r.geometry)}else if(ed(r.type))return new Bl(r,r)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),r=e.canonicalID();if(i!=null&&r!=null){if(e.geometryType()==="Point")return(function(l,h,f){const m=[];for(const v of l)for(const S of v)m.push($u(S,h));const x=new Cs(m[0][1],"meters");return f.type==="Point"||f.type==="MultiPoint"||f.type==="LineString"?Is(m,!1,f.type==="Point"?[f.coordinates]:f.coordinates,f.type==="LineString",x):f.type==="MultiLineString"?Rs(m,!1,f.coordinates,x):f.type==="Polygon"||f.type==="MultiPolygon"?Jh(m,!1,f.type==="Polygon"?[f.coordinates]:f.coordinates,x):null})(i,r,this.geometries);if(e.geometryType()==="LineString")return(function(l,h,f){const m=[];for(const v of l){const S=[];for(const A of v)S.push($u(A,h));m.push(S)}const x=new Cs(m[0][0][1],"meters");if(f.type==="Point"||f.type==="MultiPoint"||f.type==="LineString")return Rs(f.type==="Point"?[f.coordinates]:f.coordinates,f.type==="LineString",m,x);if(f.type==="MultiLineString"){let v=1/0;for(let S=0;S<f.coordinates.length;S++){const A=Rs(f.coordinates[S],!0,m,x,v);if(isNaN(A))return A;if((v=Math.min(v,A))===0)return v}return v}if(f.type==="Polygon"||f.type==="MultiPolygon"){let v=1/0;for(let S=0;S<m.length;S++){const A=Jh(m[S],!0,f.type==="Polygon"?[f.coordinates]:f.coordinates,x,v);if(isNaN(A))return A;if((v=Math.min(v,A))===0)return v}return v}return null})(i,r,this.geometries);if(e.geometryType()==="Polygon")return(function(l,h,f){const m=[];for(const v of(function(S){const A=S.length;if(A<=1)return[S];const M=[];let R,D;for(let U=0;U<A;U++){const G=Rm(S[U]);G!==0&&(S[U].area=Math.abs(G),D===void 0&&(D=G<0),D===G<0?(R&&M.push(R),R=[S[U]]):R.push(S[U]))}return R&&M.push(R),M})(l)){const S=[];for(let A=0;A<v.length;++A)S.push(Lm(v[A],h));m.push(S)}const x=new Cs(m[0][0][0][1],"meters");if(f.type==="Point"||f.type==="MultiPoint"||f.type==="LineString")return Jh(f.type==="Point"?[f.coordinates]:f.coordinates,f.type==="LineString",m,x);if(f.type==="MultiLineString"){let v=1/0;for(let S=0;S<f.coordinates.length;S++){const A=Jh(f.coordinates[S],!0,m,x,v);if(isNaN(A))return A;if((v=Math.min(v,A))===0)return v}return v}return f.type==="Polygon"||f.type==="MultiPolygon"?(function(v,S,A){let M=1/0;for(const R of v)for(const D of S){const U=ds(R,D,A,M);if(isNaN(U))return U;if((M=Math.min(M,U))===0)return M}return M})(f.type==="Polygon"?[f.coordinates]:f.coordinates,m,x):null})(i,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Yc(n){if(n instanceof ua&&(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 Pl||n instanceof Bl)return!1;if(n instanceof dc)return n.featureConstant;let e=!0;return n.eachChild(i=>{e&&!Yc(i)&&(e=!1)}),e}function Qr(n){if(n instanceof ua&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(i=>{e&&!Qr(i)&&(e=!1)}),e}function sr(n,e){if(n instanceof ua&&e.indexOf(n.name)>=0)return!1;let i=!0;return n.eachChild(r=>{i&&!sr(r,e)&&(i=!1)}),i}function Bn(n,e,i){return[n,e,i].filter(Boolean).join("�")}function al(n,e){switch(n){case"string":return As(e);case"number":return+e;case"boolean":return!!e;case"color":return pn.parse(e);case"formatted":return Mo.fromString(As(e));case"resolvedImage":return ca.build(As(e))}return e}function Ha(n,e,i,r){return r!==void 0&&(n=r*Math.round(n/r)),e!==void 0&&n<e&&(n=e),i!==void 0&&n>i&&(n=i),n}class dc{constructor(e,i,r,l=!1){this.type=e,this.key=i,this.scope=r,this.featureConstant=l}static parse(e,i){let r=i.expectedType;if(r==null&&(r=yn),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const l=i.parse(e[1],1);if(!(l instanceof Ua))return i.error("Key name of 'config' expression must be a string literal.");let h,f=!0;const m=As(l.value);if(e.length>=3){const x=i.parse(e[2],2);if(!(x instanceof Ua))return i.error("Scope of 'config' expression must be a string literal.");h=As(x.value)}if(i.options){const x=Bn(m,h,i._scope),v=i.options.get(x);v&&(f=Yc(v.value||v.default))}return new dc(r,m,h,f)}evaluate(e){const i=Bn(this.key,this.scope,e.scope),r=e.getConfig(i);if(!r)return null;const{type:l,value:h,values:f,minValue:m,maxValue:x,stepValue:v}=r,S=r.default.evaluate(e);let A=S;if(h){const M=e.scope;e.scope=(M||"").split("�").slice(1).join("�"),A=h.evaluate(e),e.scope=M}return l&&(A=al(l,A)),A===void 0||m===void 0&&x===void 0&&v===void 0||(typeof A=="number"?A=Ha(A,m,x,v):Array.isArray(A)&&(A=A.map(M=>typeof M=="number"?Ha(M,m,x,v):M))),h!==void 0&&A!==void 0&&f&&!f.includes(A)&&(A=S,l&&(A=al(l,A))),(l&&l!==this.type||A!==void 0&&!Zh(Ur(A),this.type))&&(A=al(this.type.kind,A)),A}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class zs{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const r=e[1];return i.scope.has(r)?new zs(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class td{constructor(e,i=[],r,l=new Qd,h=[],f,m,x){this.registry=e,this.path=i,this.key=i.map(v=>typeof v=="string"?`['${v}']`:`[${v}]`).join(""),this.scope=l,this.errors=h,this.expectedType=r,this._scope=f,this.options=m,this.iconImageUseTheme=x}parse(e,i,r,l,h={}){return i||r?this.concat(i,null,r,l)._parse(e,h):this._parse(e,h)}parseObjectValue(e,i,r,l,h,f={}){return this.concat(i,r,l,h)._parse(e,f)}_parse(e,i){function r(l,h,f){return f==="assert"?new bi(h,[l]):f==="coerce"?new tl(h,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(l){let h=l.parse(e,this);if(!h)return null;if(this.expectedType){const f=this.expectedType,m=h.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||m.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||m.kind!=="value"&&m.kind!=="string"){if(this.checkSubtype(f,m))return null}else h=r(h,f,i.typeAnnotation||"coerce");else h=r(h,f,i.typeAnnotation||"assert")}if(!(h instanceof Ua)&&h.type.kind!=="resolvedImage"&&df(h)){const f=new Hu(this._scope,this.options,this.iconImageUseTheme);try{h=new Ua(h.type,h.evaluate(f))}catch(m){return this.error(m.message),null}}return h}return tl.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,r,l){let h=typeof e=="number"?this.path.concat(e):this.path;h=typeof i=="string"?h.concat(i):h;const f=l?this.scope.concat(l):this.scope;return new td(this.registry,h,r||null,f,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const r=`${this.key}
212${i.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ao(r,e))}checkSubtype(e,i){const r=Rl(e,i);return r&&this.error(r),r}}function df(n){if(n instanceof zs)return df(n.boundExpression);if(n instanceof ua&&n.name==="error"||n instanceof Aa||n instanceof Pl||n instanceof Bl||n instanceof dc)return!1;const e=n instanceof tl||n instanceof bi;let i=!0;return n.eachChild(r=>{i=e?i&&df(r):i&&r instanceof Ua}),!!i&&Yc(n)&&sr(n,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function kl(n,e){const i=n.length-1;let r,l,h=0,f=i,m=0;for(;h<=f;)if(m=Math.floor((h+f)/2),r=n[m],l=n[m+1],r<=e){if(m===i||e<l)return m;h=m+1}else{if(!(r>e))throw new br("Input is not a number.");f=m-1}return 0}class Ds{constructor(e,i,r){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[l,h]of r)this.labels.push(l),this.outputs.push(h)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const r=i.parse(e[1],1,ni);if(!r)return null;const l=[];let h=null;i.expectedType&&i.expectedType.kind!=="value"&&(h=i.expectedType);for(let f=1;f<e.length;f+=2){const m=f===1?-1/0:e[f],x=e[f+1],v=f,S=f+1;if(typeof m!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',v);if(l.length&&l[l.length-1][0]>=m)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);const A=i.parse(x,S,h);if(!A)return null;h=h||A.type,l.push([m,A])}return new Ds(h,r,l)}evaluate(e){const i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(e);const l=this.input.evaluate(e);if(l<=i[0])return r[0].evaluate(e);const h=i.length;return l>=i[h-1]?r[h-1].evaluate(e):r[kl(i,l)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const ff=.95047,Wu=1.08883,pf=4/29,fs=6/29,sl=3*fs*fs,fc=fs*fs*fs,Fl=Math.PI/180,vp=180/Math.PI;function id(n){return n>fc?Math.pow(n,1/3):n/sl+pf}function pc(n){return n>fs?n*n*n:sl*(n-pf)}function Yu(n){return 255*(n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055)}function Nl(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Co(n){const e=Nl(n.r),i=Nl(n.g),r=Nl(n.b),l=id((.4124564*e+.3575761*i+.1804375*r)/ff),h=id((.2126729*e+.7151522*i+.072175*r)/1);return{l:116*h-16,a:500*(l-h),b:200*(h-id((.0193339*e+.119192*i+.9503041*r)/Wu)),alpha:n.a}}function Kc(n){let e=(n.l+16)/116,i=isNaN(n.a)?e:e+n.a/500,r=isNaN(n.b)?e:e-n.b/200;return e=1*pc(e),i=ff*pc(i),r=Wu*pc(r),new pn(Yu(3.2404542*i-1.5371385*e-.4985314*r),Yu(-.969266*i+1.8760108*e+.041556*r),Yu(.0556434*i-.2040259*e+1.0572252*r),n.alpha)}function nd(n,e,i){const r=e-n;return n+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const Ku={forward:Co,reverse:Kc,interpolate:function(n,e,i){return{l:mi(n.l,e.l,i),a:mi(n.a,e.a,i),b:mi(n.b,e.b,i),alpha:mi(n.alpha,e.alpha,i)}}},rd={forward:function(n){const{l:e,a:i,b:r}=Co(n),l=Math.atan2(r,i)*vp;return{h:l<0?l+360:l,c:Math.sqrt(i*i+r*r),l:e,alpha:n.a}},reverse:function(n){const e=n.h*Fl,i=n.c;return Kc({l:n.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:n.alpha})},interpolate:function(n,e,i){return{h:nd(n.h,e.h,i),c:mi(n.c,e.c,i),l:mi(n.l,e.l,i),alpha:mi(n.alpha,e.alpha,i)}}};var Om=Object.freeze({__proto__:null,hcl:rd,lab:Ku});class Wn{constructor(e,i,r,l,h){this.type=e,this.operator=i,this.interpolation=r,this.input=l,this.labels=[],this.outputs=[];for(const[f,m]of h)this.labels.push(f),this.outputs.push(m)}static interpolationFactor(e,i,r,l){let h=0;if(e.name==="exponential")h=Qu(i,e.base,r,l);else if(e.name==="linear")h=Qu(i,1,r,l);else if(e.name==="cubic-bezier"){const f=e.controlPoints;h=new _r(f[0],f[1],f[2],f[3]).solve(Qu(i,1,r,l))}return h}static parse(e,i){let[r,l,h,...f]=e;if(!Array.isArray(l)||l.length===0)return i.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const v=l[1];if(typeof v!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:v}}else{if(l[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const v=l.slice(1);if(v.length!==4||v.some(S=>typeof S!="number"||S<0||S>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(h=i.parse(h,2,ni),!h)return null;const m=[];let x=null;r==="interpolate-hcl"||r==="interpolate-lab"?x=Qo:i.expectedType&&i.expectedType.kind!=="value"&&(x=i.expectedType);for(let v=0;v<f.length;v+=2){const S=f[v],A=f[v+1],M=v+3,R=v+4;if(typeof S!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
212omputed expressions) for the input values.',M);if(m.length&&m[m.length-1][0]>=S)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',M);const D=i.parse(A,R,x);if(!D)return null;x=x||D.type,m.push([S,D])}return x.kind==="number"||x.kind==="color"||x.kind==="array"&&x.itemType.kind==="number"&&typeof x.N=="number"?new Wn(x,r,l,h,m):i.error(`Type ${vr(x)} is not interpolatable.`)}evaluate(e){const i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(e);const l=this.input.evaluate(e);if(l<=i[0])return r[0].evaluate(e);const h=i.length;if(l>=i[h-1])return r[h-1].evaluate(e);const f=kl(i,l),m=Wn.interpolationFactor(this.interpolation,l,i[f],i[f+1]),x=r[f].evaluate(e),v=r[f+1].evaluate(e);return this.operator==="interpolate"?jc[this.type.kind.toLowerCase()](x,v,m):this.operator==="interpolate-hcl"?rd.reverse(rd.interpolate(rd.forward(x),rd.forward(v),m)):Ku.reverse(Ku.interpolate(Ku.forward(x),Ku.forward(v),m))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let r=0;r<this.labels.length;r++)i.push(this.labels[r],this.outputs[r].serialize());return i}}function Qu(n,e,i,r){const l=r-i,h=n-i;return l===0?0:e===1?h/l:(Math.pow(e,h)-1)/(Math.pow(e,l)-1)}class Ul{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let r=null;const l=i.expectedType;l&&l.kind!=="value"&&(r=l);const h=[];for(const m of e.slice(1)){const x=i.parse(m,1+h.length,r,void 0,{typeAnnotation:"omit"});if(!x)return null;r=r||x.type,h.push(x)}const f=l&&h.some(m=>Rl(l,m.type));return new Ul(f?yn:r,h)}evaluate(e){let i,r=null,l=0;for(const h of this.args){if(l++,r=h.evaluate(e),r&&r instanceof ca&&!r.available&&(i||(i=r),r=null,l===this.args.length))return i;if(r!==null)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class qa{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let h=1;h<e.length-1;h+=2){const f=e[h];if(typeof f!="string")return i.error(`Expected string, but found ${typeof f} instead.`,h);if(/[^a-zA-Z0-9_]/.test(f))return i.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=i.parse(e[h+1],h+1);if(!m)return null;r.push([f,m])}const l=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return l?new qa(r,l):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,r]of this.bindings)e.push(i,r.serialize());return e.push(this.result.serialize()),e}}class Ju{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=i.parse(e[1],1,ni),l=i.parse(e[2],2,Uo(i.expectedType||yn));return r&&l?new Ju(l.type.itemType,r,l):null}evaluate(e){const i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new br("Array index out of bounds: negative index");if(i>=r.length)throw new br("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new br("Array index must be an integer. Use at-interpolated for fractional indices");return r[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Vl{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=i.parse(e[1],1,ni),l=i.parse(e[2],2,Uo(i.expectedType||yn));return r&&l?new Vl(l.type.itemType,r,l):null}evaluate(e){const i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new br(`Array index out of bounds: ${i} < 0.`);if(i>r.length-1)throw new br(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i===Math.floor(i))return r[i];const l=Math.floor(i),h=Math.ceil(i),f=r[l],m=r[h];if(typeof f!="number"||typeof m!="number")throw new br(`Cannot interpolate between non-number values at index ${i}.`);const x=i-l;return f*(1-x)+m*x}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class mc{constructor(e,i){this.type=cn,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=i.parse(e[1],1,yn),l=i.parse(e[2],2,yn);return r&&l?mp(r.type,[cn,dn,ni,la,yn])?new mc(r,l):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${vr(r.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(r==null)return!1;if(!Vu(i,["boolean","string","number","null"]))throw new br(`Expected first argument to be of type boolean, string, number or null, but found ${vr(Ur(i))} instead.`);if(!Vu(r,["string","array"]))throw new br(`Expected second argument to be of type array or string, but found ${vr(Ur(r))} instead.`);return r.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class eh{constructor(e,i,r){this.type=ni,this.needle=e,this.haystack=i,this.fromIndex=r}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const r=i.parse(e[1],1,yn),l=i.parse(e[2],2,yn);if(!r||!l)return null;if(!mp(r.type,[cn,dn,ni,la,yn]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${vr(r.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,ni);return h?new eh(r,l,h):null}return new eh(r,l)}evaluate(e){const i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Vu(i,["boolean","string","number","null"]))throw new br(`Expected first argument to be of type boolean, string, number or null, but found ${vr(Ur(i))} instead.`);if(!Vu(r,["string","array"]))throw new br(`Expected second argument to be of type array or string, but found ${vr(Ur(r))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return r.indexOf(i,l)}return r.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class th{constructor(e,i,r,l,h,f){this.inputType=e,this.type=i,this.input=r,this.cases=l,this.outputs=h,this.otherwise=f}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let r,l;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);const h={},f=[];for(let v=2;v<e.length-1;v+=2){let S=e[v];const A=e[v+1];Array.isArray(S)||(S=[S]);const M=i.concat(v);
vendor: 4,211 bytes, line 212
212if(S.length===0)return M.error("Expected at least one branch label.");for(const D of S){if(typeof D!="number"&&typeof D!="string")return M.error("Branch labels must be numbers or strings.");if(typeof D=="number"&&Math.abs(D)>Number.MAX_SAFE_INTEGER)return M.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof D=="number"&&Math.floor(D)!==D)return M.error("Numeric branch labels must be integer values.");if(r){if(M.checkSubtype(r,Ur(D)))return null}else r=Ur(D);if(h[String(D)]!==void 0)return M.error("Branch labels must be unique.");h[String(D)]=f.length}const R=i.parse(A,v,l);if(!R)return null;l=l||R.type,f.push(R)}const m=i.parse(e[1],1,yn);if(!m)return null;const x=i.parse(e[e.length-1],e.length-1,l);return x?m.type.kind!=="value"&&i.concat(1).checkSubtype(r,m.type)?null:new th(r,l,m,h,f,x):null}evaluate(e){const i=this.input.evaluate(e);return(Zh(Ur(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],l={};for(const f of i){const m=l[this.cases[f]];m===void 0?(l[this.cases[f]]=r.length,r.push([this.cases[f],[f]])):r[m][1].push(f)}const h=f=>this.inputType.kind==="number"?Number(f):f;for(const[f,m]of r)e.push(m.length===1?h(m[0]):m.map(h)),e.push(this.outputs[f].serialize());return e.push(this.otherwise.serialize()),e}}class od{constructor(e,i,r){this.type=e,this.branches=i,this.otherwise=r}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);const l=[];for(let f=1;f<e.length-1;f+=2){const m=i.parse(e[f],f,cn);if(!m)return null;const x=i.parse(e[f+1],f+1,r);if(!x)return null;l.push([m,x]),r=r||x.type}const h=i.parse(e[e.length-1],e.length-1,r);return h?new od(r,l,h):null}evaluate(e){for(const[i,r]of this.branches)if(i.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,r]of this.branches)e(i),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class ad{constructor(e,i,r,l){this.type=e,this.input=i,this.beginIndex=r,this.endIndex=l}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const r=i.parse(e[1],1,yn),l=i.parse(e[2],2,ni);if(!r||!l)return null;if(!mp(r.type,[Uo(yn),dn,yn]))return i.error(`Expected first argument to be of type array or string, but found ${vr(r.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,ni);return h?new ad(r.type,r,l,h):null}return new ad(r.type,r,l)}evaluate(e){const i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!Vu(i,["string","array"]))throw new br(`Expected first argument to be of type array or string, but found ${vr(Ur(i))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return i.slice(r,l)}return i.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class jl{constructor(e,i){this.type=Uo(dn),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=i.parse(e[1],1,dn),l=i.parse(e[2],2,dn);return r&&l?new jl(r,l):void 0}evaluate(e){const i=this.str.evaluate(e),r=this.delimiter.evaluate(e);return i.split(r)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function sd(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="str
212ing"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function ih(n,e,i,r){return r.compare(e,i)===0}function Qc(n,e,i){const r=n!=="=="&&n!=="!=";return class RS{constructor(h,f,m){this.type=cn,this.lhs=h,this.rhs=f,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||f.type.kind==="value"}static parse(h,f){if(h.length!==3&&h.length!==4)return f.error("Expected two or three arguments.");const m=h[0];let x=f.parse(h[1],1,yn);if(!x)return null;if(!sd(m,x.type))return f.concat(1).error(`"${m}" comparisons are not supported for type '${vr(x.type)}'.`);let v=f.parse(h[2],2,yn);if(!v)return null;if(!sd(m,v.type))return f.concat(2).error(`"${m}" comparisons are not supported for type '${vr(v.type)}'.`);if(x.type.kind!==v.type.kind&&x.type.kind!=="value"&&v.type.kind!=="value")return f.error(`Cannot compare types '${vr(x.type)}' and '${vr(v.type)}'.`);r&&(x.type.kind==="value"&&v.type.kind!=="value"?x=new bi(v.type,[x]):x.type.kind!=="value"&&v.type.kind==="value"&&(v=new bi(x.type,[v])));let S=null;if(h.length===4){if(x.type.kind!=="string"&&v.type.kind!=="string"&&x.type.kind!=="value"&&v.type.kind!=="value")return f.error("Cannot use collator to compare non-string types.");if(S=f.parse(h[3],3,Jd),!S)return null}return new RS(x,v,S)}evaluate(h){const f=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(r&&this.hasUntypedArgument){const x=Ur(f),v=Ur(m);if(x.kind!==v.kind||x.kind!=="string"&&x.kind!=="number")throw new br(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${x.kind}, ${v.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const x=Ur(f),v=Ur(m);if(x.kind!=="string"||v.kind!=="string")return e(h,f,m)}return this.collator?i(h,f,m,this.collator.evaluate(h)):e(h,f,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}serialize(){const h=[n];return this.eachChild(f=>{h.push(f.serialize())}),h}}}const nh=Qc("==",function(n,e,i){return e===i},ih),bp=Qc("!=",function(n,e,i){return e!==i},function(n,e,i,r){return!ih(0,e,i,r)}),ld=Qc("<",function(n,e,i){return e<i},function(n,e,i,r){return r.compare(e,i)<0}),cd=Qc(">",function(n,e,i){return e>i},function(n,e,i,r){return r.compare(e,i)>0}),ud=Qc("<=",function(n,e,i){return e<=i},function(n,e,i,r){return r.compare(e,i)<=0}),Bm=Qc(">=",function(n,e,i){return e>=i},function(n,e,i,r){return r.compare(e,i)>=0});class ll{constructor(e,i,r,l,h,f){this.type=dn,this.number=e,this.locale=i,this.currency=r,this.unit=l,this.minFractionDigits=h,this.maxFractionDigits=f}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const r=i.parse(e[1],1,ni);if(!r)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return i.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=i.parseObjectValue(l.locale,2,"locale",dn),!h))return null;let f=null;if(l.currency&&(f=i.parseObjectValue(l.currency,2,"currency",dn),!f))return null;let m=null;if(l.unit&&(m=i.parseObjectValue(l.unit,2,"unit",dn),!m))return null;let x=null;if(l["min-fraction-digits"]&&(x=i.parseObjectValue(l["min-fraction-digits"],2,"min-fraction-digits",ni),!x))return null;let v=null;return l["max-fraction-digits"]&&(v=i.parseObjectValue(l["max-fraction-digits"],2,"max-fraction-digits",ni),!v)?null:new ll(r,h,f,m,x,v)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Gl{constructor(e){this.type=ni,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=i.parse(e[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${vr(r.type)} instead.`):new Gl(r):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new br(`Expected value to be of type string or array, but found ${vr(Ur(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function wp(n){return function(){n=1831565813+(n|=0)|0;let e=Math.imul(n^n>>>15,1|n);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const gc={"==":nh,"!=":bp,">":cd,"<":ld,">=":Bm,"<=":ud,array:bi,at:Ju,"at-interpolated":Vl,boolean:bi,case:od,coalesce:Ul,collator:Aa,format:ti,image:Hc,in:mc,"index-of":eh,interpolate:Wn,"interpolate-hcl":Wn,"interpolate-lab":Wn,length:Gl,let:qa,literal:Ua,match:th,number:bi,"number-format":ll,object:bi,slice:ad,step:Ds,string:bi,"to-boolean":tl,"to-color":tl,"to-number":tl,"to-string":tl,var:zs,within:Pl,distance:Bl,config:dc,split:jl};function _c(n,[e,i,r,l]){e=e.evaluate(n),i=i.evaluate(n),r=r.evaluate(n);const h=l?l.evaluate(n):1,f=gp(e,i,r,h);if(f)throw new br(f);return new pn(e/255,i/255,r/255,h)}function rh(n,[e,i,r,l]){e=e.evaluate(n),i=i.evaluate(n),r=r.evaluate(n);const h=l?l.evaluate(n):1,f=(function(v,S,A,M){return typeof v=="number"&&v>=0&&v<=360?typeof S=="number"&&S>=0&&S<=100&&typeof A=="number"&&A>=0&&A<=100?M===void 0||typeof M=="number"&&M>=0&&M<=1?null:`Invalid hsla value [${[v,S,A,M].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof M=="number"?[v,S,A,M]:[v,S,A]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof M=="number"?[v,S,A,M]:[v,S,A]).join(", ")}]: 'h' must be between 0 and 360.`})(e,i,r,h);if(f)throw new br(f);const m=`hsla(${e}, ${i}%, ${r}%, ${h})`,x=pn.parse(m);
vendor: 9,379 bytes, line 212
212if(!x)throw new br(`Failed to parse HSLA color: ${m}`);return x}function hd(n,e){return n in e}function Jc(n,e){const i=e[n];return i===void 0?null:i}function Ps(n){return{type:n}}function yc(n){if(n instanceof dc)return new Set([n.key]);let e=new Set;return n.eachChild(i=>{e=new Set([...e,...yc(i)])}),e}function cl(n){if(n instanceof ua&&n.name==="is-active-floor")return!0;let e=!1;return n.eachChild(i=>{!e&&cl(i)&&(e=!0)}),e}function Tp(n){return{result:"success",value:n}}function pa(n){return{result:"error",value:n}}function dd(n,e){return!!n&&!!n.parameters&&n.parameters.indexOf(e)>-1}function oh(n){return n["property-type"]==="data-driven"}function ul(n){return dd(n.expression,"measure-light")}function Hl(n){return dd(n.expression,"zoom")}function eu(n){return!!n.expression&&n.expression.interpolated}function ah(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function mf(n){return n}function tu(n,e){const i=e.type==="color",r=n.stops&&typeof n.stops[0][0]=="object",l=r||!(r||n.property!==void 0),h=n.type||(eu(e)?"exponential":"interval");if(i&&((n=Object.assign({},n)).stops&&(n.stops=n.stops.map(v=>[v[0],pn.parse(v[1])])),n.default=pn.parse(n.default?n.default:e.default)),n.colorSpace&&n.colorSpace!=="rgb"&&!Om[n.colorSpace])throw new Error(`Unknown color space: ${n.colorSpace}`);let f,m,x;if(h==="exponential")f=nu;else if(h==="interval")f=km;else if(h==="categorical"){f=iu,m=Object.create(null);for(const v of n.stops)m[v[0]]=v[1];x=typeof n.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);f=gf}if(r){const v={},S=[];for(let R=0;R<n.stops.length;R++){const D=n.stops[R],U=D[0].zoom;v[U]===void 0&&(v[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},S.push(U)),v[U].stops.push([D[0].value,D[1]])}const A=[];for(const R of S)A.push([v[R].zoom,tu(v[R],e)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:Wn.interpolationFactor.bind(void 0,M),zoomStops:A.map(R=>R[0]),evaluate:({zoom:R},D)=>nu({stops:A,base:n.base},e,R).evaluate(R,D)}}if(l){const v=h==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:Wn.interpolationFactor.bind(void 0,v),zoomStops:n.stops.map(S=>S[0]),evaluate:({zoom:S})=>f(n,e,S,m,x)}}return{kind:"source",evaluate(v,S){const A=S&&S.properties?S.properties[n.property]:void 0;return A===void 0?ql(n.default,e.default):f(n,e,A,m,x)}}}function ql(n,e,i){return n!==void 0?n:e!==void 0?e:i!==void 0?i:void 0}function iu(n,e,i,r,l){return ql(typeof i===l?r[i]:void 0,n.default,e.default)}function km(n,e,i){if(!di(i))return ql(n.default,e.default);const r=n.stops.length;if(r===1||i<=n.stops[0][0])return n.stops[0][1];if(i>=n.stops[r-1][0])return n.stops[r-1][1];const l=kl(n.stops.map(h=>h[0]),i);return n.stops[l][1]}function nu(n,e,i){const r=n.base!==void 0?n.base:1;if(!di(i))return ql(n.default,e.default);const l=n.stops.length;if(l===1||i<=n.stops[0][0])return n.stops[0][1];if(i>=n.stops[l-1][0])return n.stops[l-1][1];const h=kl(n.stops.map(S=>S[0]),i),f=(function(S,A,M,R){const D=R-M,U=S-M;return D===0?0:A===1?U/D:(Math.pow(A,U)-1)/(Math.pow(A,D)-1)})(i,r,n.stops[h][0],n.stops[h+1][0]),m=n.stops[h][1],x=n.stops[h+1][1];let v=jc[e.type]||mf;if(n.colorSpace&&n.colorSpace!=="rgb"){const S=Om[n.colorSpace];v=(A,M)=>S.reverse(S.interpolate(S.forward(A),S.forward(M),f))}return typeof m.evaluate=="function"?{evaluate(...S){const A=m.evaluate.apply(void 0,S),M=x.evaluate.apply(void 0,S);if(A!==void 0&&M!==void 0)return v(A,M,f)}}:v(m,x,f)}function gf(n,e,i){return e.type==="color"?i=pn.parse(i):e.type==="formatted"?i=Mo.fromString(i.toString()):e.type==="resolvedImage"?i=ca.build(i.toString()):yi(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),ql(i,n.default,e.default)}ua.register(gc,{error:[{kind:"error"},[dn],(n,[e])=>{throw new br(e.evaluate(n))}],typeof:[dn,[yn],(n,[e])=>vr(Ur(e.evaluate(n)))],"to-rgba":[Uo(ni,4),[Qo],(n,[e])=>e.evaluate(n).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Uo(ni,4),[Qo],(n,[e])=>e.evaluate(n).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Qo,[ni,ni,ni],_c],rgba:[Qo,[ni,ni,ni,ni],_c],hsl:[Qo,[ni,ni,ni],rh],hsla:[Qo,[ni,ni,ni,ni],rh],has:{type:cn,overloads:[[[dn],(n,[e])=>hd(e.evaluate(n),n.properties())],[[dn,Nu],(n,[e,i])=>hd(e.evaluate(n),i.evaluate(n))]]},get:{type:yn,overloads:[[[dn],(n,[e])=>Jc(e.evaluate(n),n.properties())],[[dn,Nu],(n,[e,i])=>Jc(e.evaluate(n),i.evaluate(n))]]},"feature-state":[yn,[dn],(n,[e])=>Jc(e.evaluate(n),n.featureState||{})],properties:[Nu,[],n=>n.properties()],"geometry-type":[dn,[],n=>n.geometryType()],worldview:[dn,[],n=>n.globals.worldview||""],"is-active-floor":[cn,Ps(dn),(n,e)=>{if(!(n.globals.activeFloors&&n.globals.activeFloors.size>0))return!1;const i=n.globals.activeFloors;return e.some(r=>{const l=r.evaluate(n);return i.has(l)})}],id:[yn,[],n=>n.id()],zoom:[ni,[],n=>n.globals.zoom],pitch:[ni,[],n=>n.globals.pitch||0],"distance-from-center":[ni,[],n=>n.distanceFromCenter()],"measure-light":[ni,[dn],(n,[e])=>n.measureLight(e.evaluate(n))],"heatmap-density":[ni,[],n=>n.globals.heatmapDensity||0],"line-progress":[ni,[],n=>n.globals.lineProgress||0],"raster-value":[ni,[],n=>n.globals.rasterValue||0],"raster-particle-speed":[ni,[],n=>n.globals.rasterParticleSpeed||0],"sky-radial-progress":[ni,[],n=>n.globals.skyRadialProgress||0],accumulated:[yn,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[ni,Ps(ni),(n,e)=>{let i=0;for(const r of e)i+=r.evaluate(n);return i}],"*":[ni,Ps(ni),(n,e)=>{let i=1;for(const r of e)i*=r.evaluate(n);return i}],"-":{type:ni,overloads:[[[ni,ni],(n,[e,i])=>e.evaluate(n)-i.evaluate(n)],[[ni],(n,[e])=>-e.evaluate(n)]]},"/":[ni,[ni,ni],(n,[e,i])=>e.evaluate(n)/i.evaluate(n)],"%":[ni,[ni,ni],(n,[e,i])=>e.evaluate(n)%i.evaluate(n)],ln2:[ni,[],()=>Math.LN2],pi:[ni,[],()=>Math.PI],e:[ni,[],()=>Math.E],"^":[ni,[ni,ni],(n,[e,i])=>Math.pow(e.evaluate(n),i.evaluate(n))],sqrt:[ni,[ni],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[ni,[ni],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[ni,[ni],(n,[e])=>Math.log(e.evaluate(n))],log2:[ni,[ni],(n,[e])=>Math.log2(e.evaluate(n))],sin:[ni,[ni],(n,[e])=>Math.sin(e.evaluate(n))],cos:[ni,[ni],(n,[e])=>Math.cos(e.evaluate(n))],tan:[ni,[ni],(n,[e])=>Math.tan(e.evaluate(n))],asin:[ni,[ni],(n,[e])=>Math.asin(e.evaluate(n))],acos:[ni,[ni],(n,[e])=>Math.acos(e.evaluate(n))],atan:[ni,[ni],(n,[e])=>Math.atan(e.evaluate(n))],min:[ni,Ps(ni),(n,e)=>Math.min(...e.map(i=>i.evaluate(n)))],max:[ni,Ps(ni),(n,e)=>Math.max(...e.map(i=>i.evaluate(n)))],abs:[ni,[ni],(n,[e])=>Math.abs(e.evaluate(n))],round:[ni,[ni],(n,[e])=>{const i=e.evaluate(n);return i<0?-Math.round(-i):Math.round(i)}],floor:[ni,[ni],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[ni,[ni],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[cn,[dn,yn],(n,[e,i])=>n.properties()[e.value]===i.value],"filter-id-==":[cn,[yn],(n,[e])=>n.id()===e.value],"filter-type-==":[cn,[dn],(n,[e])=>n.geometryType()===e.value],"filter-<":[cn,[dn,yn],(n,[e,i])=>{const r=n.properties()[e.value],l=i.value;return typeof r==typeof l&&r<l}],"filter-id-<":[cn,[yn],(n,[e])=>{const i=n.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[cn,[dn,yn],(n,[e,i])=>{const r=n.properties()[e.value],l=i.value;return typeof r==typeof l&&r>l}],"filter-id->":[cn,[yn],(n,[e])=>{const i=n.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[cn,[dn,yn],(n,[e,i])=>{const r=n.properties()[e.value],l=i.value;return typeof r==typeof l&&r<=l}],"filter-id-<=":[cn,[yn],(n,[e])=>{const i=n.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[cn,[dn,yn],(n,[e,i])=>{const r=n.properties()[e.value],l=i.value;return typeof r==typeof l&&r>=l}],"filter-id->=":[cn,[yn],(n,[e])=>{const i=n.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[cn,[yn],(n,[e])=>e.value in n.properties()],"filter-has-id":[cn,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[cn,[Uo(dn)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[cn,[Uo(yn)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[cn,[dn,Uo(yn)],(n,[e,i])=>i.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[cn,[dn,Uo(yn)],(n,[e,i])=>(function(r,l,h,f){for(;h<=f;){const m=h+f>>1;if(l[m]===r)return!0;l[m]>r?f=m-1:h=m+1}return!1})(n.properties()[e.value],i.value,0,i.value.length-1)],all:{type:cn,overloads:[[[cn,cn],(n,[e,i])=>e.evaluate(n)&&i.evaluate(n)],[Ps(cn),(n,e)=>{for(const i of e)if(!i.evaluate(n))return!1;return!0}]]},any:{type:cn,overloads:[[[cn,cn],(n,[e,i])=>e.evaluate(n)||i.evaluate(n)],[Ps(cn),(n,e)=>{for(const i of e)if(i.evaluate(n))return!0;return!1}]]},"!":[cn,[cn],(n,[e])=>!e.evaluate(n)],"is-supported-script":[cn,[dn],(n,[e])=>{const i=n.globals&&n.globals.isSupportedScript;return!i||i(e.evaluate(n))}],upcase:[dn,[dn],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[dn,[dn],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[dn,Ps(yn),(n,e)=>e.map(i=>As(i.evaluate(n))).join("")],"resolved-locale":[dn,[Jd],(n,[e])=>e.evaluate(n).resolvedLocale()],random:[ni,[ni,ni,yn],(n,e)=>{const[i,r,l]=e.map(f=>f.evaluate(n));if(i>r||i===r)return i;let h;if(typeof l=="string")h=(function(f){let m=0;if(f.length===0)return m;for(let x=0;x<f.length;x++)m=(m<<5)-m+f.charCodeAt(x),m&=m;return m})(l);else{if(typeof l!="number")throw new br(`Invalid seed input: ${l}`);h=l}
212return i+wp(h)()*(r-i)}]});class fd{constructor(e,i,r,l,h){this.expression=e,this._warningHistory={},this._scope=r,this._options=l,this._iconImageUseTheme=h,this._evaluator=new Hu(r,l,h),this._defaultValue=i?(function(f){return f.type==="color"&&(ah(f.default)||Array.isArray(f.default))?new pn(0,0,0,0):f.type==="color"?pn.parse(f.default)||null:f.default===void 0?null:f.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=yc(e),this.isIndoorDependent=cl(e)}evaluateWithoutErrorHandling(e,i,r,l,h,f,m,x){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=l||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=f,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=x||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,r,l,h,f,m,x,v){this._evaluator||(this._evaluator=new Hu(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=l||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=f||null,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=x||null,this._evaluator.iconImageUseTheme=v||null;try{const S=this.expression.evaluate(this._evaluator);if(S==null||typeof S=="number"&&S!=S)return this._defaultValue;if(this._enumValues&&!(S in this._enumValues))throw new br(`Expected value to be one of ${Object.keys(this._enumValues).map(A=>JSON.stringify(A)).join(", ")}, but found ${JSON.stringify(S)} instead.`);return S}catch(S){const A=S;return this._warningHistory[A.message]||(this._warningHistory[A.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${A.message}`)),this._defaultValue}}}function ru(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in gc}function hl(n,e,i,r,l){const h=new td(gc,[],e?(function(m){const x={color:Qo,string:dn,number:ni,enum:dn,boolean:cn,formatted:Uu,resolvedImage:Gc};return m.type==="array"?Uo(x[m.value]||yn,m.length):x[m.type]})(e):void 0,void 0,void 0,i,r,l),f=h.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?Tp(new fd(f,e,i,r,l)):pa(h.errors)}class jo{constructor(e,i,r,l){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isLineProgressConstant=l,this.isStateDependent=e!=="constant"&&!Qr(i.expression),this.configDependencies=yc(i.expression),this.isIndoorDependent=cl(i.expression)}evaluateWithoutErrorHandling(e,i,r,l,h,f){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,l,h,f)}evaluate(e,i,r,l,h,f,m){return this._styleExpression.evaluate(e,i,r,l,h,f,void 0,void 0,m)}}class Io{constructor(e,i,r,l,h,f){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Qr(i.expression),this.isIndoorDependent=cl(i.expression),this.isLightConstant=h,this.isLineProgressConstant=f,this.configDependencies=yc(i.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,i,r,l,h,f){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,l,h,f)}evaluate(e,i,r,l,h,f){return this._styleExpression.evaluate(e,i,r,l,h,f)}interpolationFactor(e,i,r){return this.interpolationType?Wn.interpolationFactor(this.interpolationType,e,i,r):0}}function Ls(n,e,i,r,l){if((n=hl(n,e,i,r,l)).result==="error")return n;const h=n.value.expression,f=Yc(h);if(!f&&!oh(e))return pa([new Ao("","data expressions not supported")]);const m=sr(h,["zoom","pitch","distance-from-center"]);if(!m&&!Hl(e))return pa([new Ao("","zoom expressions not supported")]);const x=sr(h,["measure-light"]);if(!x&&!ul(e))return pa([new Ao("","measure-light expression not supported")]);const v=sr(h,["line-progress"]);if(!v&&!(function(M){return dd(M.expression,"line-progress")})(e))return pa([new Ao("","line-progress expression not supported")]);const S=e.expression&&e.expression.relaxZoomRestriction,A=pd(h);return A||m||S?A instanceof Ao?pa([A]):A instanceof Wn&&!eu(e)?pa([new Ao("",'"interpolate" expressions cannot be used with this property')]):Tp(A?new Io(f&&v?"camera":"composite",n.value,A.labels,A instanceof Wn?A.interpolation:void 0,x,v):new jo(f&&v?"constant":"source",n.value,x,v)):pa([new Ao("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ou{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,tu(this._parameters,this._specification))}static deserialize(e){return new ou(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function pd(n){let e=null;if(n instanceof qa)e=pd(n.result);else if(n instanceof Ul){for(const i of n.args)if(e=pd(i),e)break}else(n instanceof Ds||n instanceof Wn)&&n.input instanceof ua&&n.input.name==="zoom"&&(e=n);return e instanceof Ao||n.eachChild(i=>{const r=pd(i);r instanceof Ao?e=r:e&&r&&e!==r&&(e=new Ao("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var Go,Ca,Jr=(function(){if(Ca)return Go;Ca=1,Go=e;var n=3;function e(i,r,l){var h=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var f=new Int32Array(this.arrayBuffer);i=f[0],this.d=(r=f[1])+2*(l=f[2]);for(var m=0;m<this.d*this.d;m++){var x=f[n+m],v=f[n+m+1];h.push(x===v?null:f.subarray(x,v))}var S=f[n+h.length+1];this.keys=f.subarray(f[n+h.length],S),this.bboxes=f.subarray(S),this.insert=this._insertReadonly}else{this.d=r+2*l;for(var A=0;A<this.d*this.d;A++)h.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=i,this.padding=l,this.scale=r/i,this.uid=0;var M=l/r*i;this.min=-M,this.max=i+M}
212return e.prototype.insert=function(i,r,l,h,f){this._forEachCell(r,l,h,f,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(r),this.bboxes.push(l),this.bboxes.push(h),this.bboxes.push(f)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,r,l,h,f,m){this.cells[f].push(m)},e.prototype.query=function(i,r,l,h,f){var m=this.min,x=this.max;if(i<=m&&r<=m&&x<=l&&x<=h&&!f)return Array.prototype.slice.call(this.keys);var v=[];return this._forEachCell(i,r,l,h,this._queryCell,v,{},f),v},e.prototype._queryCell=function(i,r,l,h,f,m,x,v){var S=this.cells[f];if(S!==null)for(var A=this.keys,M=this.bboxes,R=0;R<S.length;R++){var D=S[R];if(x[D]===void 0){var U=4*D;(v?v(M[U+0],M[U+1],M[U+2],M[U+3]):i<=M[U+2]&&r<=M[U+3]&&l>=M[U+0]&&h>=M[U+1])?(x[D]=!0,m.push(A[D])):x[D]=!1}}},e.prototype._forEachCell=function(i,r,l,h,f,m,x,v){for(var S=this._convertToCellCoord(i),A=this._convertToCellCoord(r),M=this._convertToCellCoord(l),R=this._convertToCellCoord(h),D=S;D<=M;D++)for(var U=A;U<=R;U++){var G=this.d*U+D;if((!v||v(this._convertFromCellCoord(D),this._convertFromCellCoord(U),this._convertFromCellCoord(D+1),this._convertFromCellCoord(U+1)))&&f.call(this,i,r,l,h,G,m,x,v))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=n+this.cells.length+1+1,l=0,h=0;h<this.cells.length;h++)l+=this.cells[h].length;var f=new Int32Array(r+l+this.keys.length+this.bboxes.length);f[0]=this.extent,f[1]=this.n,f[2]=this.padding;for(var m=r,x=0;x<i.length;x++){var v=i[x];f[n+x]=m,f.set(v,m),m+=v.length}return f[n+i.length]=m,f.set(this.keys,m),f[n+i.length+1]=m+=this.keys.length,f.set(this.bboxes,m),m+=this.bboxes.length,f.buffer},Go})(),dl=gr(Jr);const ps={};function zt(n,e,i={}){Object.defineProperty(n,"_classRegistryKey",{value:e,writable:!1}),ps[e]={klass:n,omit:i.omit||[]}}zt(Object,"Object"),dl.serialize=function(n,e){const i=n.toArrayBuffer();return e&&e.add(i),{buffer:i}},dl.deserialize=function(n){return new dl(n.buffer)},Object.defineProperty(dl,"name",{value:"Grid"}),zt(dl,"Grid"),delete _t.prototype.constructor,zt(pn,"Color"),zt(Error,"Error"),zt(Mo,"Formatted"),zt($h,"FormattedSection"),zt(Nc,"AJAXError"),zt(ca,"ResolvedImage"),zt(ou,"StylePropertyFunction"),zt(fd,"StyleExpression",{omit:["_evaluator"]}),zt(No,"ImageId"),zt(so,"ImageVariant"),zt(Io,"ZoomDependentExpression"),zt(jo,"ZoomConstantExpression"),zt(ua,"CompoundExpression",{omit:["_evaluate"]});for(const n in gc)ps[gc[n]._classRegistryKey]||zt(gc[n],`Expression${n}`);function lr(n){return n&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function cr(n,e){if(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)return n;if(lr(n)||n instanceof ImageBitmap)return e&&e.add(n),n;if(ArrayBuffer.isView(n))return e&&e.add(n.buffer),n;if(n instanceof ImageData)return e&&e.add(n.data.buffer),n;if(Array.isArray(n)){const i=[];for(const r of n)i.push(cr(r,e));return i}if(n instanceof Map){const i={$name:"Map",entries:[]};for(const[r,l]of n.entries())i.entries.push(cr(r),cr(l,e));return i}if(n instanceof Set){const i={$name:"Set"};let r=0;for(const l of n.values())i[++r]=cr(l);return i}if(typeof n=="bigint")return{$name:"BigInt",value:n.toString()};if(typeof n=="object"){const i=n.constructor,r=i._classRegistryKey;if(!r)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const l=i.serialize?i.serialize(n,e):{};if(!i.serialize){for(const h in n)n.hasOwnProperty(h)&&(ps[r].omit.indexOf(h)>=0||(l[h]=cr(n[h],e)));n instanceof Error&&(l.message=n.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}throw new Error("can't serialize object of type "+typeof n)}function ms(n){if(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||lr(n)||n instanceof ImageBitmap||ArrayBuffer.isView(n)||n instanceof ImageData)return n;if(Array.isArray(n))return n.map(ms);if(typeof n=="object"){const e=n.$name||"Object";if(e==="Map"){const l=n.entries||[],h=new Map;for(let f=0;f<l.length;
vendor: 15,850 bytes, line 212
212f+=2)h.set(ms(l[f]),ms(l[f+1]));return h}if(e==="Set"){const l=new Set;for(const h of Object.keys(n))h!=="$name"&&l.add(ms(n[h]));return l}if(e==="BigInt")return BigInt(n.value);const{klass:i}=ps[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(n);const r=Object.create(i.prototype);for(const l of Object.keys(n))l!=="$name"&&(r[l]=ms(n[l]));return r}throw new Error("can't deserialize object of type "+typeof n)}const au=n=>n>=1536&&n<=1791,xc=n=>n>=1872&&n<=1919,su=n=>n>=2208&&n<=2303,vc=n=>n>=11904&&n<=12031,bc=n=>n>=12032&&n<=12255,Sp=n=>n>=12272&&n<=12287,wr=n=>n>=12288&&n<=12351,wc=n=>n>=12352&&n<=12447,lu=n=>n>=12448&&n<=12543,Os=n=>n>=12544&&n<=12591,Ep=n=>n>=12704&&n<=12735,Fm=n=>n>=12736&&n<=12783,_f=n=>n>=12784&&n<=12799,yf=n=>n>=12800&&n<=13055,md=n=>n>=13056&&n<=13311,lo=n=>n>=13312&&n<=19903,Pr=n=>n>=19968&&n<=40959,sh=n=>n>=40960&&n<=42127,Tc=n=>n>=42128&&n<=42191,gd=n=>n>=44032&&n<=55215,xf=n=>n>=63744&&n<=64255,Bs=n=>n>=64336&&n<=65023,_d=n=>n>=65040&&n<=65055,yd=n=>n>=65072&&n<=65103,vf=n=>n>=65104&&n<=65135,bf=n=>n>=65136&&n<=65279,wf=n=>n>=65280&&n<=65519;function Tf(n){for(const e of n)if(fl(e.charCodeAt(0)))return!0;return!1}function Nm(n){for(const e of n)if(!Um(e.charCodeAt(0)))return!1;return!0}function Um(n){return!(au(n)||xc(n)||su(n)||Bs(n)||bf(n))}function Ap(n){return!(n<11904||!(Ep(n)||Os(n)||yd(n)||xf(n)||md(n)||vc(n)||Fm(n)||wr(n)||lo(n)||Pr(n)||yf(n)||wf(n)||wc(n)||Sp(n)||bc(n)||_f(n)||lu(n)||_d(n)||Tc(n)||sh(n)))}function fl(n){return!(n!==746&&n!==747&&(n<4352||!(Ep(n)||Os(n)||yd(n)&&!(n>=65097&&n<=65103)||xf(n)||md(n)||vc(n)||Fm(n)||!(!wr(n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||lo(n)||Pr(n)||yf(n)||(e=>e>=12592&&e<=12687)(n)||(e=>e>=43360&&e<=43391)(n)||(e=>e>=55216&&e<=55295)(n)||(e=>e>=4352&&e<=4607)(n)||gd(n)||wc(n)||Sp(n)||(e=>e>=12688&&e<=12703)(n)||bc(n)||_f(n)||lu(n)&&n!==12540||!(!wf(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)||!(!vf(n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||(e=>e>=5120&&e<=5759)(n)||(e=>e>=6320&&e<=6399)(n)||_d(n)||(e=>e>=19904&&e<=19967)(n)||sh(n)||Tc(n))))}function Mp(n){return n===12312||n===12313||n===12316||n===12540||n===12448}function Cp(n){return!(fl(n)||(function(e){return!!((i=>i>=128&&i<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(i=>i>=8192&&i<=8303)(e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||(i=>i>=8448&&i<=8527)(e)||(i=>i>=8528&&i<=8591)(e)||(i=>i>=8960&&i<=9215)(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||(i=>i>=9216&&i<=9279)(e)&&e!==9251||(i=>i>=9280&&i<=9311)(e)||(i=>i>=9312&&i<=9471)(e)||(i=>i>=9632&&i<=9727)(e)||(i=>i>=9728&&i<=9983)(e)&&!(e>=9754&&e<=9759)||(i=>i>=11008&&i<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||wr(e)||lu(e)||(i=>i>=57344&&i<=63743)(e)||yd(e)||vf(e)||wf(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)})(n))}function xd(n){return au(n)||xc(n)||su(n)||Bs(n)||bf(n)}function Ip(n){return n>=1424&&n<=2303||Bs(n)||bf(n)}function Vm(n,e){return!(!e&&Ip(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||(i=>i>=6016&&i<=6143)(n))}function pl(n){for(const e of n)if(Ip(e.charCodeAt(0)))return!0;return!1}const ia={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Zl=null,Ho=ia.unavailable,$l=null;const Rp=function(n){n&&typeof n=="string"&&n.indexOf("NetworkError")>-1&&(Ho=ia.error),Zl&&Zl(n)};function zp(){Sf.fire(new us("pluginStateChange",{pluginStatus:Ho,pluginURL:$l}))}const Sf=new Il,Sc=function(){return Ho},Ef=function(){if(Ho!==ia.deferred||!$l)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ho=ia.loading,zp(),$l&&Uc({url:$l},n=>{n?Rp(n):(Ho=ia.loaded,zp())})},Ia={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ho===ia.loaded||Ia.applyArabicShaping!=null,isLoading:()=>Ho===ia.loading,setState(n){Ho=n.pluginStatus,$l=n.pluginURL},isParsing:()=>Ho===ia.parsing,isParsed:()=>Ho===ia.parsed,getPluginURL:()=>$l};class mn{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return(function(i,r){for(const l of i)if(!Vm(l.charCodeAt(0),r))return!1;return!0})(e,Ia.isLoaded())}}class lh{constructor(e,i,r,l,h){this.property=e,this.value=i,this.expression=(function(f,m,x,v,S){if(ah(f))return new ou(f,m);if(ru(f)||Array.isArray(f)&&f.length>0){const A=Ls(f,m,x,v,S);if(A.result==="error")throw new Error(A.value.map(M=>`${M.key}: ${M.message}`).join(", "));return A.value}{let A=f;return typeof f=="string"&&m.type==="color"&&(A=pn.parse(f)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>A}}})(i===void 0?e.specification.default:i,e.specification,r,l,h)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,r,l){return this.property.possiblyEvaluate(this,e,i,r,l)}}class cu{constructor(e,i,r,l){this.property=e,this.value=new lh(e,void 0,i,r,l)}transitioned(e,i){return new Dp(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new Dp(this.property,this.value,null,{},0)}}class ch{constructor(e,i,r,l){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=r,this._iconImageUseTheme=l,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Mi(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new cu(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new lh(this._values[e].property,i===null?void 0:Mi(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,i){i&&(this._options=i);const r=this._properties.properties;if(e)for(const l in e){const h=e[l];if(l.endsWith("-transition")){const f=l.slice(0,-11);r[f]&&this.setTransition(f,h)}else r.hasOwnProperty(l)&&this.setValue(l,h)}}getTransition(e){return Mi(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new cu(this._values[e].property)),this._values[e].transition=Mi(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const r=this.getValue(i);r!==void 0&&(e[i]=r);const l=this.getTransition(i);l!==void 0&&(e[`${i}-transition`]=l)}return e}transitioned(e,i){const r=new Pp(this._properties);for(const l of Object.keys(this._values))r._values[l]=this._values[l].transitioned(e,i._values[l]);return r}untransitioned(){const e=new Pp(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Dp{constructor(e,i,r,l,h){const f=l.delay||0,m=l.duration||0;h=h||0,this.property=e,this.value=i,this.begin=h+f,this.end=this.begin+m,e.specification.transition&&(l.delay||l.duration)&&(this.prior=r)}possiblyEvaluate(e,i,r){const l=e.now||0,h=this.value.possiblyEvaluate(e,i,r),f=this.prior;if(f){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l<this.begin)return f.possiblyEvaluate(e,i,r);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(f.possiblyEvaluate(e,i,r),h,K(m))}}return h}}class Pp{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,r){const l=new qo(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(e,i,r);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Af{constructor(e,i,r,l){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=r,this._iconImageUseTheme=l,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Mi(this._values[e].value)}setValue(e,i){this._values[e]=new lh(this._values[e].property,i===null?void 0:Mi(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const i of Object.keys(this._values)){const r=this.getValue(i);r!==void 0&&(e[i]=r)}return e}possiblyEvaluate(e,i,r,l){const h=new qo(this._properties);for(const f of Object.keys(this._values))h._values[f]=this._values[f].possiblyEvaluate(e,i,r,l);return h}isIndoorDependent(){return this._isIndoorDependent}}class Ec{constructor(e,i,r,l){this.property=e,this.value=i,this.parameters=r,this.iconImageUseTheme=l}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,r,l){return this.property.evaluate(this.value,this.parameters,e,i,r,l,this.iconImageUseTheme)}}class qo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class It{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,r){const l=jc[this.specification.type];return l?l(e,i,r):e}}class Ut{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,r,l,h){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Ec(this,{kind:"constant",value:e.expression.evaluate(i,null,{},r,l,void 0,h)},i):new Ec(this,e.expression,i,h)}interpolate(e,i,r){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ec(this,{kind:"constant",value:void 0},e.parameters);const l=jc[this.specification.type];return l?new Ec(this,{kind:"constant",value:l(e.value.value,i.value.value,r)},e.parameters):e}evaluate(e,i,r,l,h,f,m){return e.kind==="constant"?e.value:e.evaluate(i,r,l,h,f,void 0,m)}}class uu{constructor(e){this.specification=e}possiblyEvaluate(e,i,r,l){return!!e.expression.evaluate(i,null,{},r,l)}interpolate(){return!1}}class qn{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new mn(0,{});for(const r in e){const l=e[r];l.specification.overridable&&this.overridableProperties.push(r);const h=this.defaultPropertyValues[r]=new lh(l,void 0),f=this.defaultTransitionablePropertyValues[r]=new cu(l);this.defaultTransitioningPropertyValues[r]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=h.possiblyEvaluate(i)}}}zt(Ut,"DataDrivenProperty"),zt(It,"DataConstantProperty"),zt(uu,"ColorRampProperty");var Oe=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
212,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
212,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
212ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
212,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default
212":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Lp(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Mf(n){if(Array.isArray(n))return n.map(Mf);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const e={};for(const i in n)e[i]=Mf(n[i]);return e}return Lp(n)}function vd(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 e of n.slice(1))if(!vd(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Cf(n,e="",i=null,r="fill"){if(n==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};vd(n)||(n=uh(n));const l=n;let h=!0;
vendor: 18,869 bytes, lines 212-218
212try{h=(function(S){if(!hu(S))return S;let A=Mf(S);return bd(A),A=Op(A),A})(l)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
213This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
214and paste the contents of this message in the report.
215Thank you!
216Filter Expression:
217${JSON.stringify(l,null,2)}
218        `)}let f=null,m=null;if(r!=="background"&&r!=="sky"&&r!=="slot"){m=Oe[`filter_${r}`];const S=hl(h,m,e,i);if(S.result==="error")throw new Error(S.value.map(A=>`${A.key}: ${A.message}`).join(", "));f=(A,M,R)=>S.value.evaluate(A,M,{},R)}let x=null,v=null;if(h!==l){const S=hl(l,m,e,i);if(S.result==="error")throw new Error(S.value.map(A=>`${A.key}: ${A.message}`).join(", "));x=(A,M,R,D,U)=>S.value.evaluate(A,M,{},R,void 0,void 0,D,U),v=!Yc(S.value.expression)}return{filter:f,dynamicFilter:x||void 0,needGeometry:Bp(h),needFeature:!!v}}function Op(n){if(!Array.isArray(n))return n;const e=(function(i){if(jm.has(i[0])){for(let r=1;r<i.length;r++)if(hu(i[r]))return!0}return i})(n);return e===!0?e:e.map(i=>Op(i))}function bd(n){let e=!1;const i=[];if(n[0]==="case"){for(let r=1;r<n.length-1;r+=2)e=e||hu(n[r]),i.push(n[r+1]);i.push(n[n.length-1])}else if(n[0]==="match"){e=e||hu(n[1]);for(let r=2;r<n.length-1;r+=2)i.push(n[r+1]);i.push(n[n.length-1])}else if(n[0]==="step"){e=e||hu(n[1]);for(let r=1;r<n.length-1;r+=2)i.push(n[r+1])}e&&(n.length=0,n.push("any",...i));for(let r=1;r<n.length;r++)bd(n[r])}function hu(n){if(!Array.isArray(n))return!1;if((e=n[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<n.length;i++)if(hu(n[i]))return!0;return!1}const jm=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function jg(n,e){return n<e?-1:n>e?1:0}function Bp(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(Bp(n[e]))return!0;return!1}function uh(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Ra(n[1],n[2],"=="):e==="!="?Sd(Ra(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Ra(n[1],n[2],e):e==="any"?(i=n.slice(1),["any"].concat(i.map(uh))):e==="all"?["all"].concat(n.slice(1).map(uh)):e==="none"?["all"].concat(n.slice(1).map(uh).map(Sd)):e==="in"?wd(n[1],n.slice(2)):e==="!in"?Sd(wd(n[1],n.slice(2))):e==="has"?Td(n[1]):e!=="!has"||Sd(Td(n[1]));var i}function Ra(n,e,i){switch(n){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,n,e]}}function wd(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",n,["literal",e.sort(jg)]]:["filter-in-small",n,["literal",e]]}}function Td(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Sd(n){return["!",n]}const hh="�";function ks(n,e){return e?`${n}${hh}${e}`:n}let If;const Ed=()=>If||(If=new qn({"icon-size":new Ut(Oe.layout_symbol["icon-size"]),"icon-image":new Ut(Oe.layout_symbol["icon-image"]),"icon-rotate":new Ut(Oe.layout_symbol["icon-rotate"]),"icon-offset":new Ut(Oe.layout_symbol["icon-offset"]),"text-size":new Ut(Oe.layout_symbol["text-size"]),"text-rotate":new Ut(Oe.layout_symbol["text-rotate"]),"text-offset":new Ut(Oe.layout_symbol["text-offset"])}));class kp{constructor(e,i,r,l,h,f){const m=hl(e,Oe.appearance.condition);if(m.result==="success"&&(this.condition=m.value),this.name=i,r){this.properties=new qo(Ed()),this.unevaluatedLayout=new Af(Ed(),l,h,f);for(const x in r)this.unevaluatedLayout.setValue(x,r[x])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,i,r){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,r))}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){const e=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),r=this.hasProperty("icon-offset"),l=this.hasProperty("icon-rotate");return e||i||r||l}hasTextProperties(){const e=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),r=this.hasProperty("text-rotate");return e||i||r}hasProperty(e){return this.getUnevaluatedProperty(e).value!==void 0}}const Rf="-transition",zf=new Set(["fill","line","background","hillshade","raster"]);class Zo extends Il{constructor(e,i,r,l,h,f){if(super(),this.id=e.id,this.fqid=ks(this.id,r),this.type=e.type,this.scope=r,this.lut=l,this.options=h,this.iconImageUseTheme=f,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const m=hl(this.filter,Oe[`filter_${e.type}`]);m.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...m.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||m.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new Af(i.layout,this.scope,h,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){this._transitionablePaint=new ch(i.paint,this.scope,h);for(const m in e.paint)this.setPaintProperty(m,e.paint[m]);for(const m in e.layout)this.setLayoutProperty(m,e.layout[m]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new qo(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&zf.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new kp(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Rf)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const r=this._transitionablePaint,l=r._properties.properties;if(e.endsWith(Rf)){const A=e.slice(0,-11);return l[A]&&r.setTransition(A,i||void 0),!1}if(!l[e])return!1;const h=r._values[e],f=h.value.isDataDriven(),m=h.value;r.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const x=r._values[e].value,v=x.isDataDriven(),S=e.endsWith("pattern")||e==="line-dasharray";return v||f||S||this._handleOverridablePaintPropertyUpdate(e,m,x)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,r){return null}_handleOverridablePaintPropertyUpdate(e,i,r){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){const e={id:this.id,type:this.type,slot:this.slot,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.appearances.length!==0&&(e.appearances=this.appearances.map(i=>i.serialize())),li(e,(i,r)=>!(i===void 0||r==="layout"&&!Object.keys(i).length||r==="paint"&&!Object.keys(i).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ec&&oh(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Qr(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Cf(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,i,r){return{}}queryRadius(e){}queryIntersectsFeature(e,i,r,l,h,f,m,x,v,S){}}const Fp={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class za{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const Gm=new ArrayBuffer(0);class Pn{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=Gm),i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Gi(n,e=1){let i=0,r=0;return{members:n.map(l=>{const h=Fp[l.type].BYTES_PER_ELEMENT,f=i=Ad(i,Math.max(e,h)),m=l.components||1;return r=Math.max(r,h),i+=h*m,{name:l.name,type:l.type,components:m,offset:f}}),size:Ad(i,Math.max(r,e)),alignment:e}}function Ad(n,e){return Math.ceil(n/e)*e}class Xl extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){const l=2*e;return this.int16[l+0]=i,this.int16[l+1]=r,e}}Xl.prototype.bytesPerElement=4,zt(Xl,"StructArrayLayout2i4");class Fs extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,r)}emplace(e,i,r,l){const h=3*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=l,e}}Fs.prototype.bytesPerElement=6,zt(Fs,"StructArrayLayout3i6");class ml extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,l)}emplace(e,i,r,l,h){const f=4*e;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=l,this.int16[f+3]=h,e}}ml.prototype.bytesPerElement=8,zt(ml,"StructArrayLayout4i8");class eo extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}eo.prototype.bytesPerElement=4,zt(eo,"StructArrayLayout1f4");class dh extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,r)}emplace(e,i,r,l){const h=4*e,f=2*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.float32[f+1]=l,e}}dh.prototype.bytesPerElement=8,zt(dh,"StructArrayLayout2i1f8");class Md extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,r)}emplace(e,i,r,l){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=l,e}}Md.prototype.bytesPerElement=8,zt(Md,"StructArrayLayout3i8");class Hr extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,l,h)}emplace(e,i,r,l,h,f){const m=5*e;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=l,this.int16[m+3]=h,this.int16[m+4]=f,e}}Hr.prototype.bytesPerElement=10,zt(Hr,"StructArrayLayout5i10");class mo extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,r,l,h,f,m)}emplace(e,i,r,l,h,f,m,x){const v=6*e,S=12*e,A=3*e;return this.int16[v+0]=i,this.int16[v+1]=r,this.uint8[S+4]=l,this.uint8[S+5]=h,this.uint8[S+6]=f,this.uint8[S+7]=m,this.float32[A+2]=x,e}}mo.prototype.bytesPerElement=12,zt(mo,"StructArrayLayout2i4ub1f12");class Za extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,r)}emplace(e,i,r,l){const h=3*e;return this.float32[h+0]=i,this.float32[h+1]=r,this.float32[h+2]=l,e}}Za.prototype.bytesPerElement=12,zt(Za,"StructArrayLayout3f12");class Ns extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,l,h)}emplace(e,i,r,l,h,f){const m=6*e,x=3*e;return this.uint16[m+0]=i,this.uint16[m+1]=r,this.uint16[m+2]=l,this.uint16[m+3]=h,this.float32[x+2]=f,e}}Ns.prototype.bytesPerElement=12,zt(Ns,"StructArrayLayout4ui1f12");class du extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,l)}emplace(e,i,r,l,h){const f=4*e;return this.uint16[f+0]=i,this.uint16[f+1]=r,this.uint16[f+2]=l,this.uint16[f+3]=h,e}}du.prototype.bytesPerElement=8,zt(du,"StructArrayLayout4ui8");class fu extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,r,l,h,f)}emplace(e,i,r,l,h,f,m){const x=6*e;return this.int16[x+0]=i,this.int16[x+1]=r,this.int16[x+2]=l,this.int16[x+3]=h,this.int16[x+4]=f,this.int16[x+5]=m,e}}fu.prototype.bytesPerElement=12,zt(fu,"StructArrayLayout6i12");class pu extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v,S,A,M){const R=this.length;return this.resize(R+1),this.emplace(R,e,i,r,l,h,f,m,x,v,S,A,M)}emplace(e,i,r,l,h,f,m,x,v,S,A,M,R){const D=12*e;return this.int16[D+0]=i,this.int16[D+1]=r,this.int16[D+2]=l,this.int16[D+3]=h,this.uint16[D+4]=f,this.uint16[D+5]=m,this.uint16[D+6]=x,this.uint16[D+7]=v,this.int16[D+8]=S,this.int16[D+9]=A,this.int16[D+10]=M,this.int16[D+11]=R,e}}pu.prototype.bytesPerElement=24,zt(pu,"StructArrayLayout4i4ui4i24");class Df extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,r,l,h,f)}
vendor: 18,411 bytes, line 218
218emplace(e,i,r,l,h,f,m){const x=10*e,v=5*e;return this.int16[x+0]=i,this.int16[x+1]=r,this.int16[x+2]=l,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=m,e}}Df.prototype.bytesPerElement=20,zt(Df,"StructArrayLayout3i3f20");class Us extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,l)}emplace(e,i,r,l,h){const f=4*e;return this.float32[f+0]=i,this.float32[f+1]=r,this.float32[f+2]=l,this.float32[f+3]=h,e}}Us.prototype.bytesPerElement=16,zt(Us,"StructArrayLayout4f16");class Pf extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Pf.prototype.bytesPerElement=4,zt(Pf,"StructArrayLayout1ul4");class $a extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){const l=2*e;return this.uint16[l+0]=i,this.uint16[l+1]=r,e}}$a.prototype.bytesPerElement=4,zt($a,"StructArrayLayout2ui4");class Ac extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v,S,A,M,R){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,r,l,h,f,m,x,v,S,A,M,R)}emplace(e,i,r,l,h,f,m,x,v,S,A,M,R,D){const U=20*e,G=10*e;return this.int16[U+0]=i,this.int16[U+1]=r,this.int16[U+2]=l,this.int16[U+3]=h,this.int16[U+4]=f,this.float32[G+3]=m,this.float32[G+4]=x,this.float32[G+5]=v,this.float32[G+6]=S,this.int16[U+14]=A,this.uint32[G+8]=M,this.uint16[U+18]=R,this.uint16[U+19]=D,e}}Ac.prototype.bytesPerElement=40,zt(Ac,"StructArrayLayout5i4f1i1ul2ui40");class fh extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,r,l,h,f,m)}emplace(e,i,r,l,h,f,m,x){const v=8*e;return this.int16[v+0]=i,this.int16[v+1]=r,this.int16[v+2]=l,this.int16[v+4]=h,this.int16[v+5]=f,this.int16[v+6]=m,this.int16[v+7]=x,e}}fh.prototype.bytesPerElement=16,zt(fh,"StructArrayLayout3i2i2i16");class Cd extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,l,h)}emplace(e,i,r,l,h,f){const m=4*e,x=8*e;return this.float32[m+0]=i,this.float32[m+1]=r,this.float32[m+2]=l,this.int16[x+6]=h,this.int16[x+7]=f,e}}Cd.prototype.bytesPerElement=16,zt(Cd,"StructArrayLayout2f1f2i16");class Id extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,r,l,h,f)}emplace(e,i,r,l,h,f,m){const x=20*e,v=5*e;return this.uint8[x+0]=i,this.uint8[x+1]=r,this.float32[v+1]=l,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=m,e}}Id.prototype.bytesPerElement=20,zt(Id,"StructArrayLayout2ub4f20");class Lr extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,r)}emplace(e,i,r,l){const h=3*e;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=l,e}}Lr.prototype.bytesPerElement=6,zt(Lr,"StructArrayLayout3ui6");class mu extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le){const ae=this.length;return this.resize(ae+1),this.emplace(ae,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le)}emplace(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le,ae){const ge=30*e,_e=15*e,pe=60*e;return this.int16[ge+0]=i,this.int16[ge+1]=r,this.int16[ge+2]=l,this.float32[_e+2]=h,this.float32[_e+3]=f,this.uint16[ge+8]=m,this.uint16[ge+9]=x,this.uint32[_e+5]=v,this.uint32[_e+6]=S,this.uint32[_e+7]=A,this.uint16[ge+16]=M,this.uint16[ge+17]=R,this.uint16[ge+18]=D,this.float32[_e+10]=U,this.float32[_e+11]=G,this.uint8[pe+48]=V,this.uint8[pe+49]=Z,this.uint8[pe+50]=Y,this.uint32[_e+13]=Q,this.int16[ge+28]=le,this.uint8[pe+58]=ae,e}}mu.prototype.bytesPerElement=60,zt(mu,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Mc extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le,ae,ge,_e,pe,be,Me,Ye,Ze,We,lt,at,st){const He=this.length;return this.resize(He+1),this.emplace(He,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le,ae,ge,_e,pe,be,Me,Ye,Ze,We,lt,at,st)}emplace(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le,ae,ge,_e,pe,be,Me,Ye,Ze,We,lt,at,st,He){const ht=20*e,tt=40*e,gt=80*e;return this.float32[ht+0]=i,this.float32[ht+1]=r,this.int16[tt+4]=l,this.int16[tt+5]=h,this.int16[tt+6]=f,this.int16[tt+7]=m,this.int16[tt+8]=x,this.int16[tt+9]=v,this.int16[tt+10]=S,this.int16[tt+11]=A,this.int16[tt+12]=M,this.uint16[tt+13]=R,this.uint16[tt+14]=D,this.uint16[tt+15]=U,this.uint16[tt+16]=G,this.uint16[tt+17]=V,this.uint16[tt+18]=Z,this.uint16[tt+19]=Y,this.uint16[tt+20]=Q,this.uint16[tt+21]=le,this.uint16[tt+22]=ae,this.uint16[tt+23]=ge,this.uint16[tt+24]=_e,this.uint16[tt+25]=pe,this.uint16[tt+26]=be,this.uint16[tt+27]=Me,this.uint32[ht+14]=Ye,this.float32[ht+15]=Ze,this.float32[ht+16]=We,this.float32[ht+17]=lt,this.float32[ht+18]=at,this.uint8[gt+76]=st,this.uint16[tt+39]=He,e}}Mc.prototype.bytesPerElement=80,zt(Mc,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ph extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,r,l,h,f)}emplace(e,i,r,l,h,f,m){const x=6*e;return this.float32[x+0]=i,this.float32[x+1]=r,this.float32[x+2]=l,this.float32[x+3]=h,this.float32[x+4]=f,this.float32[x+5]=m,e}}ph.prototype.bytesPerElement=24,zt(ph,"StructArrayLayout6f24");class Cc extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,l,h)}emplace(e,i,r,l,h,f){const m=5*e;return this.float32[m+0]=i,this.float32[m+1]=r,this.float32[m+2]=l,this.float32[m+3]=h,this.float32[m+4]=f,e}}Cc.prototype.bytesPerElement=20,zt(Cc,"StructArrayLayout5f20");class mh extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,r,l,h,f,m)}emplace(e,i,r,l,h,f,m,x){const v=7*e;return this.float32[v+0]=i,this.float32[v+1]=r,this.float32[v+2]=l,this.float32[v+3]=h,this.float32[v+4]=f,this.float32[v+5]=m,this.float32[v+6]=x,e}}mh.prototype.bytesPerElement=28,zt(mh,"StructArrayLayout7f28");class gh extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v,S,A){const M=this.length;return this.resize(M+1),this.emplace(M,e,i,r,l,h,f,m,x,v,S,A)}emplace(e,i,r,l,h,f,m,x,v,S,A,M){const R=11*e;return this.float32[R+0]=i,this.float32[R+1]=r,this.float32[R+2]=l,this.float32[R+3]=h,this.float32[R+4]=f,this.float32[R+5]=m,this.float32[R+6]=x,this.float32[R+7]=v,this.float32[R+8]=S,this.float32[R+9]=A,this.float32[R+10]=M,e}}gh.prototype.bytesPerElement=44,zt(gh,"StructArrayLayout11f44");class gu extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v){const S=this.length;return this.resize(S+1),this.emplace(S,e,i,r,l,h,f,m,x,v)}emplace(e,i,r,l,h,f,m,x,v,S){const A=9*e;return this.float32[A+0]=i,this.float32[A+1]=r,this.float32[A+2]=l,this.float32[A+3]=h,this.float32[A+4]=f,this.float32[A+5]=m,this.float32[A+6]=x,this.float32[A+7]=v,this.float32[A+8]=S,e}}gu.prototype.bytesPerElement=36,zt(gu,"StructArrayLayout9f36");class Ic extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){const l=2*e;return this.float32[l+0]=i,this.float32[l+1]=r,e}}Ic.prototype.bytesPerElement=8,zt(Ic,"StructArrayLayout2f8");class Rd extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,l)}emplace(e,i,r,l,h){const f=6*e;return this.uint32[3*e+0]=i,this.uint16[f+2]=r,this.uint16[f+3]=l,this.uint16[f+4]=h,e}}Rd.prototype.bytesPerElement=12,zt(Rd,"StructArrayLayout1ul3ui12");class _h extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}_h.prototype.bytesPerElement=2,zt(_h,"StructArrayLayout1ui2");class Vs extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G){const V=this.length;return this.resize(V+1),this.emplace(V,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G)}emplace(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V){const Z=16*e;return this.float32[Z+0]=i,this.float32[Z+1]=r,this.float32[Z+2]=l,this.float32[Z+3]=h,this.float32[Z+4]=f,this.float32[Z+5]=m,this.float32[Z+6]=x,this.float32[Z+7]=v,this.float32[Z+8]=S,this.float32[Z+9]=A,this.float32[Z+10]=M,this.float32[Z+11]=R,this.float32[Z+12]=D,this.float32[Z+13]=U,this.float32[Z+14]=G,this.float32[Z+15]=V,e}}Vs.prototype.bytesPerElement=64,zt(Vs,"StructArrayLayout16f64");class _u extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,l,h,f,m){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,r,l,h,f,m)}emplace(e,i,r,l,h,f,m,x){const v=10*e,S=5*e;return this.uint16[v+0]=i,this.uint16[v+1]=r,this.uint16[v+2]=l,this.uint16[v+3]=h,this.float32[S+2]=f,this.float32[S+3]=m,this.float32[S+4]=x,e}}_u.prototype.bytesPerElement=20,zt(_u,"StructArrayLayout4ui3f20");class Np extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}Np.prototype.bytesPerElement=2,zt(Np,"StructArrayLayout1i2");class zd extends Pn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}zd.prototype.bytesPerElement=1,zt(zd,"StructArrayLayout1ub1");class gl extends za{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}gl.prototype.size=40;class Lf extends Ac{get(e){return new gl(this,e)}}zt(Lf,"CollisionBoxArray");class Up extends za{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Up.prototype.size=60;class Dd extends mu{get(e){return new Up(this,e)}}zt(Dd,"PlacedSymbolArray");class yh extends za{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}yh.prototype.size=80;class Ir extends Mc{get(e){return new yh(this,e)}}zt(Ir,"SymbolInstanceArray");class Pd extends eo{getoffsetX(e){return this.float32[1*e+0]}}zt(Pd,"GlyphOffsetArray");class Hm extends Xl{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}zt(Hm,"SymbolLineVertexArray");class Vp extends za{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Vp.prototype.size=12;class Wl extends Rd{get(e){return new Vp(this,e)}}zt(Wl,"FeatureIndexArray");class Yl extends $a{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}zt(Yl,"FillExtrusionCentroidArray");class Of extends za{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Of.prototype.size=6;class jp extends Fs{get(e){return new Of(this,e)}}zt(jp,"FillExtrusionWallArray");const xh=Gi([{name:"a_pos",components:2,type:"Int16"}],4),js=Gi([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Gp=Gi([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class kn{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,l){let h=this.segments[this.segments.length-1];return e>
vendor: 60,392 bytes, line 218
218kn.MAX_VERTEX_ARRAY_LENGTH&&vi(`Max vertices per segment is ${kn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>kn.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}prepareSegment(e,i,r,l){return this._prepareSegment(e,i.length,r.length,l)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,r,l){return new kn([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:l,vaos:{},sortKey:0}])}}function Hp(n,e){return 256*(n=he(Math.floor(n),0,255))+he(Math.floor(e),0,255)}kn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,zt(kn,"SegmentVector");const Bf=Gi([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),qp=Gi([{name:"a_pattern_b",components:4,type:"Uint16"}]),kf=Gi([{name:"a_dash",components:4,type:"Uint16"}]);class vh{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,r,l){this.ids.push(_l(e)),this.positions.push(i,r,l)}eachPosition(e,i){const r=_l(e);let l=0,h=this.ids.length-1;for(;l<h;){const f=l+h>>1;this.ids[f]>=r?h=f:l=f+1}for(;this.ids[l]===r;)i(this.positions[3*l],this.positions[3*l+1],this.positions[3*l+2]),l++}static serialize(e,i){const r=new Float64Array(e.ids),l=new Uint32Array(e.positions);return qr(r,l,0,r.length-1),i&&(i.add(r.buffer),i.add(l.buffer)),{ids:r,positions:l}}static deserialize(e){const i=new vh;let r;i.ids=e.ids,i.positions=e.positions;for(const l of i.ids)l!==r&&i.uniqueIds.push(l),r=l;return i.indexed=!0,i}}function _l(n){const e=+n;return Number.isSafeInteger(e)?e:el(String(n))}function qr(n,e,i,r){for(;i<r;){const l=n[i+r>>1];let h=i-1,f=r+1;for(;;){do h++;while(n[h]<l);do f--;while(n[f]>l);if(h>=f)break;yu(n,h,f),yu(e,3*h,3*f),yu(e,3*h+1,3*f+1),yu(e,3*h+2,3*f+2)}f-i<r-f?(qr(n,e,i,f),i=f+1):(qr(n,e,f+1,r),r=f)}}function yu(n,e,i){const r=n[e];n[e]=n[i],n[i]=r}zt(vh,"FeaturePositionMap");class gs{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,r){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class ur extends gs{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class Rr extends gs{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class Da extends gs{constructor(e){super(e),this.current=[0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class bh extends gs{constructor(e){super(e),this.current=[0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class Tr extends gs{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class ma extends gs{constructor(e){super(e),this.current=pn.transparent.toPremultipliedRenderColor(null)}set(e,i,r){this.fetchUniformLocation(e,i)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}const Kl=new Float32Array(16);class xu extends gs{constructor(e){super(e),this.current=Kl}set(e,i,r){if(this.fetchUniformLocation(e,i)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let l=1;l<16;l++)if(r[l]!==this.current[l]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}const Gg=new Float32Array(9),c=new Float32Array(4);class t extends gs{constructor(e){super(e),this.current=c}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let l=0;l<4;l++)if(r[l]!==this.current[l]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}}function o(n){return[Hp(255*n.r,255*n.g),Hp(255*n.b,255*n.a)]}function u(n,e,i,r,l,h,f,m){return!!n&&(n.kind==="composite"||n.kind==="source"?n.evaluate(new mn(0,{brightness:h,worldview:m}),e,i,l,r,f)==="none":n.value==="none")}class p{constructor(e,i,r,l){this.value=e,this.uniformNames=i.map(h=>`u_${h}`),this.type=r,this.context=l}setUniform(e,i,r,l,h){const f=l.constantOr(this.value);i.set(e,h,f instanceof pn?f.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):f)}getBinding(e,i){return this.type==="color"?new ma(e):new Rr(e)}}class g{constructor(e,i){this.uniformNames=i.map(r=>`u_${r}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,r,l,h){let f=null;h!=="u_pattern"&&h!=="u_dash"||(f=this.pattern),h==="u_pattern_b"&&(f=this.patternTransition),h==="u_pixel_ratio"&&(f=this.pixelRatio),f&&i.set(e,h,f)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Tr(e):new Rr(e)}}class y{constructor(e,i,r,l){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(h=>({name:`a_${h}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,i,r,l,h,f,m,x){const v=this.paintVertexArray.length,S=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new mn(0,{brightness:f,worldview:x}),i,{},h,l,m):this.expression.kind==="constant"&&this.expression.value,A=u(this.lutExpression,i,{},l,h,f,m,x);this.paintVertexArray.resize(e),this._setPaintValue(v,e,S,A?null:this.context.lut)}updatePaintArray(e,i,r,l,h,f,m,x){const v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:m,worldview:x},r,l,void 0,h):this.expression.kind==="constant"&&this.expression.value,S=u(this.lutExpression,r,l,h,void 0,m,void 0,x);this._setPaintValue(e,i,v,S?null:this.context.lut)}_setPaintValue(e,i,r,l){if(this.type==="color"){const h=o(r.toPremultipliedRenderColor(l));for(let f=e;f<i;f++)this.paintVertexArray.emplace(f,h[0],h[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class b{constructor(e,i,r,l,h,f){this.expression=e,this.uniformNames=i.map(m=>`u_${m}_t`),this.type=r,this.useIntegerZoom=l,this.context=h,this.maxValue=0,this.paintVertexAttributes=i.map(m=>({name:`a_${m}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new f}populatePaintArray(e,i,r,l,h,f,m,x){const v=this.expression.evaluate(new mn(this.context.zoom,{brightness:f,worldview:x}),i,{},h,l,m),S=this.expression.evaluate(new mn(this.context.zoom+1,{brightness:f,worldview:x}),i,{},h,l,m),A=u(this.lutExpression,i,{},l,h,f,m,x),M=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(M,e,v,S,A?null:this.context.lut)}updatePaintArray(e,i,r,l,h,f,m,x){const v=this.expression.evaluate({zoom:this.context.zoom,brightness:m,worldview:x},r,l,void 0,h),S=this.expression.evaluate({zoom:this.context.zoom+1,brightness:m,worldview:x},r,l,void 0,h),A=u(this.lutExpression,r,l,h,void 0,m,void 0,x);this._setPaintValue(e,i,v,S,A?null:this.context.lut)}_setPaintValue(e,i,r,l,h){if(this.type==="color"){const f=o(r.toPremultipliedRenderColor(h)),m=o(l.toPremultipliedRenderColor(h));for(let x=e;x<i;x++)this.paintVertexArray.emplace(x,f[0],f[1],m[0],m[1])}else{for(let f=e;f<i;f++)this.paintVertexArray.emplace(f,r,l);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,r,l,h){const f=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,m=he(this.expression.interpolationFactor(f,this.context.zoom,this.context.zoom+1),0,1);i.set(e,h,m)}getBinding(e,i){return new Rr(e)}}class T{constructor(e,i,r,l,h){this.expression=e,this.layerId=h,this.paintVertexAttributes=(r==="array"?kf:Bf).members;for(let f=0;f<i.length;++f);this.paintVertexArray=new l,this.paintTransitionVertexArray=new du}populatePaintArray(e,i,r,l){const h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(h,e,i.patterns&&i.patterns[this.layerId],r)}updatePaintArray(e,i,r,l,h,f,m){this._setPaintValues(e,i,r.patterns&&r.patterns[this.layerId],f)}_setPaintValues(e,i,r,l){if(!l||!r)return;const h=l[r[0]],f=l[r[1]];if(h){if(h){const{tl:m,br:x,pixelRatio:v}=h;for(let S=e;S<i;S++)this.paintVertexArray.emplace(S,m[0],m[1],x[0],x[1],v)}if(f){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:m,br:x}=f;for(let v=e;v<i;v++)this.paintTransitionVertexArray.emplace(v,m[0],m[1],x[0],x[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,qp.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class C{constructor(e,i,r=()=>!0){this.binders={},this._buffers=[],this.context=i;const l=[];for(const h in e.paint._values){const f=e.paint.get(h);if(h.endsWith("-use-theme")||!r(h)||!(f instanceof Ec&&oh(f.property.specification)))continue;const m=L(h,e.type),x=f.value,v=f.property.specification.type,S=!!f.property.useIntegerZoom,A=h==="line-dasharray"||h.endsWith("pattern"),M=e.paint.get(`${h}-use-theme`),R=h==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||M&&M.value.kind!=="constant";if(x.kind!=="constant"||R)if(x.kind==="source"||R||A){const D=j(h,v,"source");this.binders[h]=A?new T(x,m,v,D,e.id):new y(x,m,v,D),l.push(`/a_${h}`)}else{const D=j(h,v,"composite");this.binders[h]=new b(x,m,v,S,i,D),l.push(`/z_${h}`)}else this.binders[h]=A?new g(x.value,m):new p(x.value,m,v,i),l.push(`/u_${h}`);M&&(this.binders[h].lutExpression=M.value)}this.cacheKey=l.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof y||i instanceof b?i.maxValue:0}populatePaintArrays(e,i,r,l,h,f,m,x){for(const v in this.binders){const S=this.binders[v];S.context=this.context,(S instanceof y||S instanceof b||S instanceof T)&&S.populatePaintArray(e,i,r,l,h,f,m,x)}}setConstantPatternPositions(e,i){for(const r in this.binders){const l=this.binders[r];l instanceof g&&l.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof T?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,r,l,h,f,m,x,v,S){let A=!1;const M=Object.keys(e),R=M.length!==0&&!x,D=R?M:i.uniqueIds;this.context.lut=h.lut;for(const U in this.binders){const G=this.binders[U];if(G.context=this.context,(G instanceof y||G instanceof b||G instanceof T)&&G.expression&&G.expression.kind&&G.expression.kind!=="constant"&&(G.expression.isStateDependent===!0||G.expression.isLightConstant===!1)){const V=h.paint.get(U);G.expression=V.value;for(const Z of D){const Y=e[Z.toString()];i.eachPosition(Z,(Q,le,ae)=>{const ge=l.feature(Q);G.updatePaintArray(le,ae,ge,Y,f,m,v,S)})}if(!R)for(const Z of r.uniqueIds){const Y=e[Z.toString()];r.eachPosition(Z,(Q,le,ae)=>{const ge=l.feature(Q);G.updatePaintArray(le,ae,ge,Y,f,m,v,S)})}A=!0}}return A}defines(){const e=[];for(const i in this.binders){const r=this.binders[i];(r instanceof p||r instanceof g)&&e.push(...r.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const r in this.binders){const l=this.binders[r];if(l instanceof p||l instanceof g||l instanceof b)for(const h of l.uniformNames)i.push({name:h,property:r,binding:l.getBinding(e,h)})}return i}setUniforms(e,i,r,l,h){for(const{name:f,property:m,binding:x}of r)this.binders[m].setUniform(e,x,h,l.get(m),f)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof y||i instanceof b||i instanceof T)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof T&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const r=this.binders[i];(r instanceof y||r instanceof b||r instanceof T)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof y||i instanceof b||i instanceof T)&&i.destroy()}}}class I{constructor(e,i,r=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new C(l,i,r);this.needsUpload=!1,this._featureMap=new vh,this._featureMapWithoutIds=new vh,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,r,l,h,f,m,x,v){for(const S in this.programConfigurations)this.programConfigurations[S].populatePaintArrays(e,i,l,h,f,m,x,v);i.id!==void 0?this._featureMap.add(i.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,r,l,h,f,m,x){for(const v of r)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,v,l,h,f,m||0,x)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const B={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function L(n,e){return B[n]||[n.replace(`${e}-`,"").replace(/-/g,"_")]}const N={"line-pattern":{source:Ns,composite:Ns},"fill-pattern":{source:Ns,composite:Ns},"fill-extrusion-pattern":{source:Ns,composite:Ns},"line-dasharray":{source:du,composite:du}},H={color:{source:Ic,composite:Us},number:{source:eo,composite:Ic}};function j(n,e,i){const r=N[n];return r&&r[i]||H[e][i]}zt(p,"ConstantBinder"),zt(g,"PatternConstantBinder"),zt(y,"SourceExpressionBinder"),zt(T,"PatternCompositeBinder"),zt(b,"CompositeExpressionBinder"),zt(C,"ProgramConfiguration",{omit:["_buffers"]}),zt(I,"ProgramConfigurationSet");const q=Lt/Math.PI/2,W=64,ne=[W,32,16],ie=-q,ee=q;function xe(n,e,i,r=q){return i=Ki(i),[n*Math.sin(i)*r,-e*r,n*Math.cos(i)*r]}function me(n,e,i){return xe(Math.cos(Ki(n)),Math.sin(Ki(n)),e,i)}const ye=63710088e-1,de=2*Math.PI*ye;class se{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new se(Ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,r=this.lat*i,l=e.lat*i,h=Math.sin(r)*Math.sin(l)+Math.cos(r)*Math.cos(l)*Math.cos((e.lng-this.lng)*i);return ye*Math.acos(Math.min(h,1))}toBounds(e=0){const i=360*e/40075017,r=i/Math.cos(Math.PI/180*this.lat);return new Te({lng:this.lng-r,lat:this.lat-i},{lng:this.lng+r,lat:this.lat+i})}toEcef(e){return me(this.lat,this.lng,q+e*q/ye)}static convert(e){if(e instanceof se)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new se(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new se(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Te{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):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 se?new se(e.lng,e.lat):se.convert(e),this}setSouthWest(e){return this._sw=e instanceof se?new se(e.lng,e.lat):se.convert(e),this}extend(e){const i=this._sw,r=this._ne;let l,h;if(e instanceof se)l=e,h=e;else{if(!(e instanceof Te))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Te.convert(e)):this.extend(se.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(se.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||r?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),r.lng=Math.max(h.lng,r.lng),r.lat=Math.max(h.lat,r.lat)):(this._sw=new se(l.lng,l.lat),this._ne=new se(h.lng,h.lat)),this}getCenter(){return new se((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 se(this.getWest(),this.getNorth())}getSouthEast(){return new se(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:r}=se.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&l}static convert(e){if(e)return e instanceof Te?e:new Te(e)}}function Ae(n){return de*Math.cos(n*Math.PI/180)}function Re(n){return(180+n)/360}function Be(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Le(n,e){return n/Ae(e)}function $e(n){return 360*n-180}function ot(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function Fe(n,e){return n*Ae(ot(e))}const Se=85.051129;function Ke(n){return Math.cos(Ki(he(n,-85.051129,Se)))}function Ve(n,e){const i=he(e,0,25.5),r=Math.pow(2,i);return Ke(n)*de/(512*r)}function it(n){return 1/Math.cos(n*Math.PI/180)}function Et(n,e=0){const i=Math.exp(Math.PI*(1-(n.y+e/Lt)/(1<<n.z)*2));return 80150034*i/(i*i+1)/Lt/(1<<n.z)}class Bt{constructor(e,i,r=0){this.x=+e,this.y=+i,this.z=+r}static fromLngLat(e,i=0){const r=se.convert(e);return new Bt(Re(r.lng),Be(r.lat),Le(i,r.lat))}toLngLat(){return new se($e(this.x),ot(this.y))}toAltitude(){return Fe(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/de*it(ot(this.y))}}function Ct(n,e,i,r,l,h,f,m,x){const v=(e+r)/2,S=(i+l)/2,A=new _t(v,S);m(A),(function(M,R,D,U,G,V){const Z=D-G,Y=U-V;return Math.abs((U-R)*Z-(D-M)*Y)/Math.hypot(Z,Y)})(A.x,A.y,h.x,h.y,f.x,f.y)>=x?(Ct(n,e,i,v,S,h,A,m,x),Ct(n,v,S,r,l,A,f,m,x)):n.push(f)}function At(n,e,i){let r=n[0],l=r.x,h=r.y;e(r);const f=[r];for(let m=1;m<n.length;m++){const x=n[m],{x:v,y:S}=x;e(x),Ct(f,l,h,v,S,r,x,e,i),l=v,h=S,r=x}return f}function Qt(n,e,i,r){if(r(e,i)){const l=e.add(i)._mult(.5);Qt(n,e,l,r),Qt(n,l,i,r)}else n.push(i)}function Wt(n,e){let i=n[0];const r=[i];for(let l=1;l<n.length;l++){const h=n[l];Qt(r,i,h,e),i=h}return r}const Ft=Math.pow(2,14)-1,Yt=-Ft-1;function oi(n,e){const i=Math.round(n.x*e),r=Math.round(n.y*e);return n.x=he(i,Yt,Ft),n.y=he(r,Yt,Ft),(i<n.x||i>n.x+1||r<n.y||r>n.y+1)&&vi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),n}function fi(n,e,i){const r=n.loadGeometry(),l=n.extent,h=Lt/l;if(e&&i&&i.projection.isReprojectedInTileSpace){const f=1<<e.z,{scale:m,x,y:v,projection:S}=i,A=M=>{const R=$e((e.x+M.x/l)/f),D=ot((e.y+M.y/l)/f),U=S.project(R,D);M.x=(U.x*m-x)*l,M.y=(U.y*m-v)*l};for(let M=0;M<r.length;M++)if(n.type!==1)r[M]=At(r[M],A,1);else{const R=[];for(const D of r[M])D.x<0||D.x>=l||D.y<0||D.y>=l||(A(D),R.push(D));r[M]=R}}for(const f of r)for(const m of f)oi(m,h);return r}function Ri(n,e){return{type:n.type,id:n.id,properties:n.properties,geometry:e?fi(n):[]}}class Hi{constructor(e,i,r,l,h){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=l,this._values=h,e.readFields(pi,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,r=[];let l,h=1,f=0,m=0,x=0;for(;e.pos<i;){if(f<=0){const v=e.readVarint();h=7&v,f=v>>3}if(f--,h===1||h===2)m+=e.readSVarint(),x+=e.readSVarint(),h===1&&(l&&r.push(l),l=[]),l&&l.push(new _t(m,x));else{if(h!==7)throw new Error(`unknown command ${h}`);l&&l.push(l[0].clone())}}return l&&r.push(l),r}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let r=1,l=0,h=0,f=0,m=1/0,x=-1/0,v=1/0,S=-1/0;for(;e.pos<i;){if(l<=0){const A=e.readVarint();r=7&A,l=A>>3}if(l--,r===1||r===2)h+=e.readSVarint(),f+=e.readSVarint(),h<m&&(m=h),h>x&&(x=h),f<v&&(v=f),f>S&&(S=f);else if(r!==7)throw new Error(`unknown command ${r}`)}return[m,v,x,S]}toGeoJSON(e,i,r){const l=this.extent*Math.pow(2,r),h=this.extent*e,f=this.extent*i,m=this.loadGeometry();function x(M){return[360*(M.x+h)/l-180,360/Math.PI*Math.atan(Math.exp((1-2*(M.y+f)/l)*Math.PI))-90]}function v(M){return M.map(x)}let S;if(this.type===1){const M=[];for(const D of m)M.push(D[0]);const R=v(M);S=M.length===1?{type:"Point",coordinates:R[0]}:{type:"MultiPoint",coordinates:R}}else if(this.type===2){const M=m.map(v);S=M.length===1?{type:"LineString",coordinates:M[0]}:{type:"MultiLineString",coordinates:M}}else{if(this.type!==3)throw new Error("unknown feature type");{const M=(function(D){const U=D.length;if(U<=1)return[D];const G=[];let V,Z;for(let Y=0;Y<U;Y++){const Q=zi(D[Y]);Q!==0&&(Z===void 0&&(Z=Q<0),Z===Q<0?(V&&G.push(V),V=[D[Y]]):V&&V.push(D[Y]))}return V&&G.push(V),G})(m),R=[];for(const D of M)R.push(D.map(v));S=R.length===1?{type:"Polygon",coordinates:R[0]}:{type:"MultiPolygon",coordinates:R}}}const A={type:"Feature",geometry:S,properties:this.properties};return this.id!=null&&(A.id=this.id),A}}function pi(n,e,i){n===1?e.id=i.readVarint():n===2?(function(r,l){const h=r.readVarint()+r.pos;for(;r.pos<h;){const f=l._keys[r.readVarint()],m=l._values[r.readVarint()];l.properties[f]=m}})(i,e):n===3?e.type=i.readVarint():n===4&&(e._geometry=i.pos)}function zi(n){let e=0;for(let i,r,l=0,h=n.length,f=h-1;l<h;f=l++)i=n[l],r=n[f],e+=(r.x-i.x)*(i.y+r.y);return e}Hi.types=["Unknown","Point","LineString","Polygon"];class wi{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(an,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new Hi(this._pbf,i,this.extent,this._keys,this._values)}}function an(n,e,i){n===15?e.version=i.readVarint():n===1?e.name=i.readString():n===5?e.extent=i.readVarint():n===2?e._features.push(i.pos):n===3?e._keys.push(i.readString()):n===4&&e._values.push((function(r){let l=null;const h=r.readVarint()+r.pos;for(;r.pos<h;){const f=r.readVarint()>>3;l=f===1?r.readString():f===2?r.readFloat():f===3?r.readDouble():f===4?r.readVarint64():f===5?r.readVarint():f===6?r.readSVarint():f===7?r.readBoolean():null}if(l==null)throw new Error("unknown feature value");return l})(i))}class tn{constructor(e,i){this.layers=e.readFields(gn,{},i)}}function gn(n,e,i){if(n===3){const r=new wi(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}const Yi="3d_elevation_id",Di="level";class rn{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,r){return this.get(e,!0,i,r)}optional(e,i,r){return this.get(e,!1,i,r)}success(){return this._valid}get(e,i,r,l){const h=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&h!==void 0&&!Number.isNaN(h)?r(l?l(h):h):i&&(this._valid=!1),this}}class Fn{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,r){return this.featureFunc(e,i,r)}parseVertex(e,i,r){return this.vertexFunc(e,i,r)}}const _n=new Fn((n,e,i)=>n.reset(e).require(Yi,r=>{i.id=r}).optional("fixed_height_relative",r=>{i.constantHeight=r},Ci.decodeRelativeHeight).geometry(r=>{i.bounds=r},Ms).success(),(n,e,i)=>n.reset(e).require(Yi,r=>{i.id=r}).require("elevation_idx",r=>{i.idx=r}).require("extent",r=>{i.extent=r}).require("height_relative",r=>{i.height=r},Ci.decodeRelativeHeight).geometry(r=>{i.position=r},Ci.getPoint).success()),un=new Fn((n,e,i)=>n.reset(e).require(Yi,r=>{i.id=r}).optional("fixed_height",r=>{i.constantHeight=r},Ci.decodeMetricHeight).geometry(r=>{i.bounds=r},Ms).success(),(n,e,i)=>n.reset(e).require(Yi,r=>{i.id=r}).require("elevation_idx",r=>{i.idx=r}).require("extent",r=>{i.extent=r}).require("height",r=>{i.height=r},Ci.decodeMetricHeight).geometry(r=>{i.position=r},Ci.getPoint).success());class Ci{static getPoint(e){return Dr(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?e==="1.0.1"?un:void 0:_n}static parse(e){const i=[],r=[],l=e.length,h=new rn;for(let f=0;f<l;f++){const m=e.feature(f),x=m.properties.version,v=Ci.getVersionSchema(x);if(v===void 0){vi(`Unknown elevation feature version number ${x||"(unknown)"}`);continue}const S=m.properties.type;if(!S)continue;const A=Hi.types[m.type];if(A==="Point"&&S==="curve_point"){const M={};v.parseVertex(h,m,M)&&i.push(M)}else if(A==="Polygon"&&S==="curve_meta"){const M={};v.parseFeature(h,m,M)&&r.push(M)}}return{vertices:i,features:r}}}class Pi{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){const l=vn(i,this.dir);if(Math.abs(l)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/l;return r[0]=this.pos[0]+this.dir[0]*h,r[1]=this.pos[1]+this.dir[1]*h,!0}}class Mn{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){const l=ln(i,this.dir);if(Math.abs(l)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/l;return r[0]=this.pos[0]+this.dir[0]*h,r[1]=this.pos[1]+this.dir[1]*h,r[2]=this.pos[2]+this.dir[2]*h,!0}closestPointOnSphere(e,i,r){if((function(R,D){var U=R[0],G=R[1],V=R[2],Z=D[0],Y=D[1],Q=D[2];return Math.abs(U-Z)<=ue*Math.max(1,Math.abs(U),Math.abs(Z))&&Math.abs(G-Y)<=ue*Math.max(1,Math.abs(G),Math.abs(Y))&&Math.abs(V-Q)<=ue*Math.max(1,Math.abs(V),Math.abs(Q))})(this.pos,e)||i===0)return r[0]=r[1]=r[2]=0,!1;const[l,h,f]=this.dir,m=this.pos[0]-e[0],x=this.pos[1]-e[1],v=this.pos[2]-e[2],S=l*l+h*h+f*f,A=2*(m*l+x*h+v*f),M=A*A-4*S*(m*m+x*x+v*v-i*i);if(M<0){const R=Math.max(-A/2,0),D=m+l*R,U=x+h*R,G=v+f*R,V=Math.hypot(D,U,G);return r[0]=D*i/V,r[1]=U*i/V,r[2]=G*i/V,!1}{const R=(-A-Math.sqrt(M))/(2*S);if(R<0){const D=Math.hypot(m,x,v);return r[0]=m*i/D,r[1]=x*i/D,r[2]=v*i/D,!1}return r[0]=m+l*R,r[1]=x+h*R,r[2]=v+f*R,!0}}}class Jn{constructor(e,i,r,l,h){this.TL=e,this.TR=i,this.BR=r,this.BL=l,this.horizon=h}static fromInvProjectionMatrix(e,i,r){const l=[-1,1,1],h=[1,1,1],f=[1,-1,1],m=[-1,-1,1],x=Nn(l,l,e),v=Nn(h,h,e),S=Nn(f,f,e),A=Nn(m,m,e);return new Jn(x,v,S,A,i/r)}}function xn(n,e,i){let r=1/0,l=-1/0;const h=[];for(const f of n){rr(h,f,e);const m=ln(h,i);r=Math.min(r,m),l=Math.max(l,m)}return[r,l]}function Cn(n,e){let i=!0;for(let r=0;r<n.planes.length;r++){const l=n.planes[r];let h=0;for(let f=0;f<e.length;f++)h+=+(ln(l,e[f])+l[3]>=0);if(h===0)return 0;h!==e.length&&(i=!1)}return i?2:1}function Ro(n,e){for(const i of n.projections){const r=xn(e,n.points[0],i.axis);if(i.projection[1]<r[0]||i.projection[0]>r[1])return 0}return 1}function co(n,e){let i=0;const r=[0,0,0,0];for(let l=0;l<n.length;l++)r[0]=n[l][0],r[1]=n[l][1],r[2]=n[l][2],r[3]=1,pr(r,e)>=0&&i++;return i}class Zr{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=hn.fromPoints(this.points),this.projections=[],this.frustumEdges=[rr([],this.points[2],this.points[3]),rr([],this.points[0],this.points[3]),rr([],this.points[4],this.points[0]),rr([],this.points[5],this.points[1]),rr([],this.points[6],this.points[2]),rr([],this.points[7],this.points[3])];for(const r of this.frustumEdges){const l=[0,-r[2],r[1]],h=[r[2],0,-r[0]];this.projections.push({axis:l,projection:xn(this.points,this.points[0],l)}),this.projections.push({axis:h,projection:xn(this.points,this.points[0],h)})}}static fromInvProjectionMatrix(e,i,r,l){const h=Math.pow(2,r),f=[[-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(v=>{const S=Bo([],v,e),A=1/S[3]/i*h;return(M=S)[0]=(R=S)[0]*(D=[A,A,l?1/S[3]:A,A])[0],M[1]=R[1]*D[1],M[2]=R[2]*D[2],M[3]=R[3]*D[3],M;var M,R,D}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(v=>{const S=xi([],Xn([],rr([],f[v[0]],f[v[1]]),rr([],f[v[2]],f[v[1]]))),A=-ln(S,f[v[1]]);return S.concat(A)}),x=[];for(let v=0;v<f.length;v++)x.push([f[v][0],f[v][1],f[v][2]]);return new Zr(x,m)}intersectsPrecise(e,i,r){for(let l=0;l<i.length;l++)if(!co(e,i[l]))return 0;for(let l=0;l<this.planes.length;l++)if(!co(e,this.planes[l]))return 0;for(const l of r)for(const h of this.frustumEdges){const f=Xn([],l,h),m=Si(f);if(m===0)continue;bt(f,f,1/m);const x=xn(this.points,this.points[0],f),v=xn(e,this.points[0],f);if(x[0]>v[1]||v[0]>x[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const r=i[3];if(ln([i[0],i[1],i[2]],e)+r<0)return!1}return!0}}class hn{static fromPoints(e){const i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const l of e)Ue(i,i,l),Dt(r,r,l);return new hn(i,r)}static fromTileIdAndHeight(e,i,r){const l=1<<e.canonical.z,h=e.canonical.x,f=e.canonical.y;return new hn([h/l,f/l,i],[(h+1)/l,(f+1)/l,r])}static applyTransform(e,i){const r=e.getCorners();for(let l=0;l<r.length;++l)Nn(r[l],r[l],i);return hn.fromPoints(r)}static applyTransformFast(e,i){const r=[i[12],i[13],i[14]],l=[...r];for(let h=0;h<3;h++)for(let f=0;f<3;f++){const m=i[4*f+h],x=m*e.min[f],v=m*e.max[f];r[h]+=Math.min(x,v),l[h]+=Math.max(x,v)}return new hn(r,l)}static projectAabbCorners(e,i){const r=e.getCorners();for(let l=0;l<r.length;++l)Nn(r[l],r[l],i);return r}constructor(e,i){this.min=e,this.max=i,this.center=bt([],Tt([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],r=gi(this.min),l=gi(this.max);for(let h=0;h<i.length;h++)r[h]=i[h]?this.min[h]:this.center[h],l[h]=i[h]?this.center[h]:this.max[h];return l[2]=this.max[2],new hn(r,l)}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]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Cn(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Cn(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?Ro(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Ro(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}zt(hn,"Aabb");class ga{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,r=i[1],l=-i[0],h=(e.extent+1)*this.metersToTile;return[new _t(Math.trunc(e.position[0]+r*h),Math.trunc(e.position[1]+l*h)),new _t(Math.trunc(e.position[0]-r*h),Math.trunc(e.position[1]-l*h))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class uo{constructor(e,i,r,l,h,f){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[mr(),mr(),mr(),mr(),mr(),mr(),mr()],this.id=e,this.heightRange={min:r,max:r},this.safeArea=i,this.constantHeight=r,this.constantHeight==null&&(this.constantHeight!=null||l.length!==0)){this.vertices=l,this.edges=h,this.edges=this.edges.filter(m=>{return m.a<this.vertices.length&&m.b<this.vertices.length&&!((x=this.vertices[m.a].position)[0]===(v=this.vertices[m.b].position)[0]&&x[1]===v[1]);var x,v}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const m of this.vertices)this.vertexProps.push({dir:Dr(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,m.height),this.heightRange.max=Math.max(this.heightRange.max,m.height);for(const m of this.edges){const x=this.vertices[m.a].position,v=this.vertices[m.b].position,S=To(mr(),v,x),A=Fa(S),M=ka(mr(),S,1/A);this.edgeProps.push({vec:S,dir:M,len:A});const R=this.vertexProps[m.a].dir,D=this.vertexProps[m.b].dir;is(R,R,M),is(D,D,M)}for(const m of this.vertexProps)m.dir[0]===0&&m.dir[1]===0||ns(m.dir,m.dir);this.tessellate(f)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[r,l]=i;return mi(this.vertices[this.edges[r].a].height,this.vertices[this.edges[r].b].height,l)}computeSlopeNormal(e,i){const r=this.getClosestEdge(e);if(!r)return je(0,0,1);const l=r[0],h=this.edges[l],f=this.edgeProps[l].vec,m=je(f[0],f[1],(this.vertices[h.b].height-this.vertices[h.a].height)*i),x=je(m[1],-m[0],0);Xn(x,x,m);const v=Si(x);return v>0?bt(x,x,1/v):St(x,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,r=Number.POSITIVE_INFINITY,l=0;const[h,f,m,x,v,S,A]=this._tmpVec2;Ts(A,e.x,e.y);const M=new Pi(A,null);for(let R=0;R<this.edges.length;R++){const D=this.edges[R],U=this.edgeProps[R].dir;M.dir=U;const G=this.vertices[D.a].position,V=this.vertices[D.b].position,Z=M.intersectsPlane(G,this.vertexProps[D.a].dir,h),Y=M.intersectsPlane(V,this.vertexProps[D.b].dir,f);if(!Z||!Y)continue;To(m,f,h),To(x,A,h);const Q=vn(m,m),le=Q>0?vn(x,m)/Q:0,ae=he(le,0,1),ge=Math.abs((le-ae)*this.edgeProps[R].len);To(v,A,G),Ts(S,U[1],-U[0]);const _e=ge+Math.abs(vn(v,S));_e<r&&(i=R,r=_e,l=ae)}return[i,l]}tessellate(e){const i=Vt(),r=Vt(),l=Vt(),h=Vt();for(let f=this.edges.length-1;f>=0;--f){const m=this.edges[f].a,x=this.edges[f].b,{position:v,height:S,extent:A}=this.vertices[m],{position:M,height:R,extent:D}=this.vertices[x],U=this.vertexProps[m].dir,G=this.vertexProps[x].dir;if(St(i,v[0]/e,v[1]/e,S),St(r,M[0]/e,M[1]/e,R),St(l,U[1],-U[0],0),bt(l,l,A),St(h,G[1],-G[0],0),bt(h,h,D),this.distSqLines(je(i[0]+.5*l[0],i[1]+.5*l[1],i[2]+.5*l[2]),je(r[0]-.5*h[0],r[1]-.5*h[1],r[2]-.5*h[2]),je(i[0]-.5*l[0],i[1]-.5*l[1],i[2]-.5*l[2]),je(r[0]+.5*h[0],r[1]+.5*h[1],r[2]+.5*h[2]))<=.0025000000000000005)continue;const V=this.vertices.length,Z=is(mr(),v,M);this.vertices.push({position:ka(Z,Z,.5),height:.5*(S+R),extent:.5*(A+D)});const Y=is(mr(),U,G);this.vertexProps.push({dir:ns(Y,Y)}),this.edges.splice(f,1),this.edgeProps.splice(f,1),this.edges.push({a:m,b:V}),this.edges.push({a:V,b:x});const Q=To(mr(),this.vertices[V].position,v),le=Fa(Q),ae={vec:Q,dir:ka(mr(),Q,1/le),len:le};this.edgeProps.push(ae),this.edgeProps.push(ae)}}distSqLines(e,i,r,l){const h=_i(Vt(),i,e),f=_i(Vt(),l,r),m=_i(Vt(),e,r),x=ln(h,h),v=ln(h,f),S=ln(h,m),A=ln(f,f),M=ln(f,m),R=x*A-v*v;if(R===0)return hi(Or(h,r,l,ln(m,f)/ln(f,f)),e);const D=(x*M-v*S)/R;return hi(Or(h,e,i,(v*M-S*A)/R),Or(f,r,l,D))}}class go{static parseFrom(e,i){const r=Ci.parse(e);if(!r)return[];let{vertices:l,features:h}=r;const f=1/Et(i);h.sort((S,A)=>S.id-A.id),l.sort((S,A)=>S.id-A.id||S.idx-A.idx),l=l.filter((S,A,M)=>A===M.findIndex(R=>R.id===S.id&&R.idx===S.idx));const m=new Array;let x=0;const v=l.length;for(const S of h){if(S.constantHeight){m.push(new uo(S.id,S.bounds,S.constantHeight));continue}for(;x!==v&&l[x].id<S.id;)x++;if(x===v||l[x].id!==S.id)continue;const A=new Array,M=new Array,R=x;for(;x!==v&&l[x].id===S.id;){const D=l[x];if(A.push({position:D.position,height:D.height,extent:D.extent}),x!==R&&l[x-1].idx===D.idx-1){const U=x-R;M.push({a:U-1,b:U})}x++}m.push(new uo(S.id,S.bounds,void 0,A,M,f))}return m}static getElevationFeature(e,i){if(!i)return;const r=+e.properties[Yi];return Number.isNaN(r)?void 0:i.find(l=>l.id===r)}}class Pa{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*Lt,this.yOffset=(e.y*this.zScale-i.y)*Lt)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,r){const l=this.constantElevation(i,r);return l??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),r))}computeBiasedHeight(e,i){return i<=0?e:e+i*Ie(0,i,e>=0?e:Math.abs(.5*e))}}zt(uo,"ElevationFeature");class na{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Xl,this.indexArray=new Lr,this.segments=new kn,this.programConfigurations=new I(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new eo),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,l){}populate(e,i,r,l){const h=this.layers[0],f=[];let m=null;h.type==="circle"&&(m=h.layout.get("circle-sort-key"));for(const{feature:v,id:S,index:A,sourceLayerIndex:M}of e){const R=this.layers[0]._featureFilter.needGeometry,D=Ri(v,R);if(!this.layers[0]._featureFilter.filter(new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),D,r))continue;const U=m?m.evaluate(D,{},r):void 0,G={id:S,properties:v.properties,type:v.type,sourceLayerIndex:M,index:A,geometry:R?D.geometry:fi(v,r,l),patterns:{},sortKey:U};f.push(G)}m&&f.sort((v,S)=>v.sortKey-S.sortKey);let x=null;l.projection.name==="globe"&&(this.globeExtVertexArray=new fu,x=l.projection);for(const v of f){const{geometry:S,index:A,sourceLayerIndex:M}=v,R=e[A].feature;this.addFeature(v,S,A,i.availableImages,r,x,i.brightness,i.elevationFeatures),i.featureIndex.insert(R,S,A,M,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,r,l,h,f,m){this.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Gp.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,js.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,r,l,h,f,m,x){let v;this.elevationMode!=="none"&&(v=go.getElevationFeature(e,x));for(const S of i)for(const A of S){const M=A.x,R=A.y;if(M<0||M>=Lt||R<0||R>=Lt)continue;if(f){const G=f.projectTilePoint(M,R,h),V=f.upVector(h,M,R);this.addGlobeExtVertex(G,V),this.addGlobeExtVertex(G,V),this.addGlobeExtVertex(G,V),this.addGlobeExtVertex(G,V)}const D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),U=D.vertexLength;if(this.addCircleVertex(M,R,-1,-1),this.addCircleVertex(M,R,1,-1),this.addCircleVertex(M,R,1,1),this.addCircleVertex(M,R,-1,1),this.elevationMode!=="none"){const G=v?v.pointElevation(new _t(M,R)):0;this.hasElevation=this.hasElevation||G!==0;for(let V=0;V<4;V++)this.elevatedLayoutVertexArray.emplaceBack(G)}this.indexArray.emplaceBack(U,U+1,U+2),this.indexArray.emplaceBack(U,U+2,U+3),D.vertexLength+=4,D.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},l,h,m,void 0,this.worldview)}addCircleVertex(e,i,r,l){this.layoutVertexArray.emplaceBack(2*e+(r+1)/2,2*i+(l+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function Zn(n,e){for(let i=0;i<n.length;i++)if(ya(e,n[i]))return!0;for(let i=0;i<e.length;i++)if(ya(n,e[i]))return!0;return!!Vr(n,e)}function yr(n,e,i){return!!ya(n,e)||!!Gs(e,n,i)}function Dn(n,e){if(n.length===1)return bu(e,n[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let l=0;l<r.length;l++)if(ya(n,r[l]))return!0}for(let i=0;i<n.length;i++)if(bu(e,n[i]))return!0;for(let i=0;i<e.length;i++)if(Vr(n,e[i]))return!0;return!1}function Sr(n,e,i){if(n.length>1){if(Vr(n,e))return!0;for(let r=0;r<e.length;r++)if(Gs(e[r],n,i))return!0}for(let r=0;r<n.length;r++)if(Gs(n[r],e,i))return!0;return!1}function Vr(n,e){if(n.length===0||e.length===0)return!1;for(let i=0;i<n.length-1;i++){const r=n[i],l=n[i+1];for(let h=0;h<e.length-1;h++)if(Yn(r,l,e[h],e[h+1]))return!0}return!1}function Yn(n,e,i,r){return Rn(n,i,r)!==Rn(e,i,r)&&Rn(n,e,i)!==Rn(n,e,r)}function _a(n,e,i){return(n.x-i.x)*(e.y-i.y)-(n.y-i.y)*(e.x-i.x)}function wh(n,e,i,r){const l=_a(n,e,r),h=_a(n,e,i);if(Math.sign(l)===Math.sign(h))return;const f=_a(i,r,n),m=f+h-l;return Math.sign(f)!==Math.sign(m)?[f/(f-m),h/(h-l)]:void 0}function Gs(n,e,i){const r=i*i;if(e.length===1)return n.distSqr(e[0])<r;for(let l=1;l<e.length;l++)if(vu(n,e[l-1],e[l])<r)return!0;return!1}function vu(n,e,i){const r=e.distSqr(i);if(r===0)return n.distSqr(e);const l=((n.x-e.x)*(i.x-e.x)+(n.y-e.y)*(i.y-e.y))/r;return n.distSqr(l<0?e:l>1?i:i.sub(e)._mult(l)._add(e))}function bu(n,e){let i,r,l,h=!1;for(let f=0;f<n.length;f++){i=n[f];for(let m=0,x=i.length-1;m<i.length;x=m++)r=i[m],l=i[x],r.y>e.y!=l.y>e.y&&e.x<(l.x-r.x)*(e.y-r.y)/(l.y-r.y)+r.x&&(h=!h)}return h}function ya(n,e){let i=!1;for(let r=0,l=n.length-1;r<n.length;l=r++){const h=n[r],f=n[l];h.y>e.y!=f.y>e.y&&e.x<(f.x-h.x)*(e.y-h.y)/(f.y-h.y)+h.x&&(i=!i)}return i}function Xa(n,e,i,r,l){for(const f of n)if(e<=f.x&&i<=f.y&&r>=f.x&&l>=f.y)return!0;const h=[new _t(e,i),new _t(e,l),new _t(r,l),new _t(r,i)];if(n.length>2){for(const f of h)if(ya(n,f))return!0}for(let f=0;f<n.length-1;f++)if(Hs(n[f],n[f+1],h))return!0;return!1}function Hs(n,e,i){const r=i[0],l=i[2];if(n.x<r.x&&e.x<r.x||n.x>l.x&&e.x>l.x||n.y<r.y&&e.y<r.y||n.y>l.y&&e.y>l.y)return!1;const h=Rn(n,e,i[0]);return h!==Rn(n,e,i[1])||h!==Rn(n,e,i[2])||h!==Rn(n,e,i[3])}function La(n,e,i,r,l,h){let f=e.y-n.y,m=n.x-e.x;if(h=h||0){const x=f*f+m*m;if(x===0)return!0;const v=Math.sqrt(x);f/=v,m/=v}return!((i.x-n.x)*f+(i.y-n.y)*m-h<0||(r.x-n.x)*f+(r.y-n.y)*m-h<0||(l.x-n.x)*f+(l.y-n.y)*m-h<0)}function Ln(n,e,i,r,l,h,f){return!(La(n,e,r,l,h,f)||La(e,i,r,l,h,f)||La(i,n,r,l,h,f)||La(r,l,n,e,i,f)||La(l,h,n,e,i,f)||La(h,r,n,e,i,f))}function Ql(n,e,i){const r=e.paint.get(n).value;return r.kind==="constant"?r.value:i.programConfigurations.get(e.id).getMaxValue(n)}function Ff(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function Hg(n,e,i,r,l){if(!e[0]&&!e[1])return n;const h=_t.convert(e)._mult(l);i==="viewport"&&h._rotate(-r);const f=[];for(let m=0;m<n.length;m++)f.push(n[m].sub(h));return f}function ey(n,e,i,r){const l=_t.convert(n)._mult(r);return e==="viewport"&&l._rotate(-i),l}let ty,iy;function Zp(n,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[n*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}zt(na,"CircleBucket",{omit:["layers"]});class yl{constructor(e,i,r){this.z=e,this.x=i,this.y=r,this.key=Th(0,e,e,i,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const r=(function(h,f,m){var x=Zp(256*h,256*(f=Math.pow(2,m)-f-1),m),v=Zp(256*(h+1),256*(f+1),m);return x[0]+","+x[1]+","+v[0]+","+v[1]})(this.x,this.y,this.z),l=(function(h,f,m){let x,v="";for(let S=h;S>0;S--)x=1<<S-1,v+=(f&x?1:0)+(m&x?2:0);return v})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class qm{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Th(e,i.z,i.z,i.x,i.y)}}class _o{constructor(e,i,r,l,h){this.overscaledZ=e,this.wrap=i,this.canonical=new yl(r,+l,+h),this.key=i===0&&e===r?this.canonical.key:Th(i,e,r,l,h)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new _o(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new _o(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return Th(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-e;return Th(this.wrap*+i,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new _o(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,r=2*this.canonical.x,l=2*this.canonical.y;return[new _o(i,this.wrap,i,r,l),new _o(i,this.wrap,i,r+1,l),new _o(i,this.wrap,i,r,l+1),new _o(i,this.wrap,i,r+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new _o(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new _o(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new qm(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Th(n,e,i,r,l){const h=1<<Math.min(i,22);let f=h*(l%h)+r%h;return n&&i<22&&(f+=h*h*((n<0?-2*n-1:2*n)%(1<<2*(22-i)))),16*(32*f+i)+(e-i)}const Sh=[n=>{let e=n.canonical.x-1,i=n.wrap;return e<0&&(e=(1<<n.canonical.z)-1,i--),new _o(n.overscaledZ,i,n.canonical.z,e,n.canonical.y)},n=>{let e=n.canonical.x+1,i=n.wrap;return e===1<<n.canonical.z&&(e=0,i++),new _o(n.overscaledZ,i,n.canonical.z,e,n.canonical.y)},n=>new _o(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,(n.canonical.y===0?1<<n.canonical.z:n.canonical.y)-1),n=>new _o(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,n.canonical.y===(1<<n.canonical.z)-1?0:n.canonical.y+1)];zt(yl,"CanonicalTileID"),zt(_o,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Rc=Gi([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Eh}=Rc,$x=Gi([{name:"a_pos_3",components:3,type:"Int16"}]);var qg=Gi([{name:"a_pos",type:"Int16",components:2}]);function $p(n){return n*q/ye}const ny=[new hn([ie,ie,ie],[ee,ee,ee]),new hn([ie,ie,ie],[0,0,ee]),new hn([0,ie,ie],[ee,0,ee]),new hn([ie,0,ie],[0,ee,ee]),new hn([0,0,ie],[ee,ee,ee])];function Zg(n,e,i,r=!0){const l=bt([],n._camera.position,n.worldSize),h=[e,i,1,1];Bo(h,h,n.pixelMatrixInverse),Wr(h,h,1/h[3]);const f=xi([],rr([],h,l)),m=n.globeMatrix,x=[m[12],m[13],m[14]],v=rr([],x,l),S=Si(v),A=xi([],v),M=n.worldSize/(2*Math.PI),R=ln(A,f),D=Math.asin(M/S);if(D<Math.acos(R)){if(!r)return null;const be=[],Me=[];bt(be,f,S/R),xi(Me,rr(Me,be,v)),xi(f,Tt(f,v,bt(f,Me,Math.tan(D)*S)))}const U=[];new Mn(l,f).closestPointOnSphere(x,M,U);const G=xi([],Hn(m,0)),V=xi([],Hn(m,1)),Z=xi([],Hn(m,2)),Y=ln(G,U),Q=ln(V,U),le=ln(Z,U),ae=De(Math.asin(-Q/M));let ge=De(Math.atan2(Y,le));ge=n.center.lng+(function(be,Me){const Ye=(Me-be+180)%360-180;return Ye<-180?Ye+360:Ye})(n.center.lng,ge);const _e=Re(ge),pe=he(Be(ae),0,1);return new Bt(_e,pe)}class Xx{constructor(e,i,r){this.a=rr([],e,r),this.b=rr([],i,r),this.center=r;const l=xi([],this.a),h=xi([],this.b);this.angle=Math.acos(ln(l,h))}}function Xp(n,e){if(n.angle===0)return null;let i;return i=n.a[e]===0?1/n.angle*.5*Math.PI:1/n.angle*Math.atan(n.b[e]/n.a[e]/Math.sin(n.angle)-1/Math.tan(n.angle)),i<0||i>1?null:(function(r,l,h,f){const m=Math.sin(h);return r*(Math.sin((1-f)*h)/m)+l*(Math.sin(f*h)/m)})(n.a[e],n.b[e],n.angle,he(i,0,1))+n.center[e]}function Jl(n){if(n.z<=1)return ny[n.z+2*n.y+n.x];const e=$g(Nf(n));return hn.fromPoints(e)}function zc(n,e,i){return bt(n,n,1-i),Ht(n,n,e,i)}function ry(n,e,i){for(const r of n)Nn(r,r,e),bt(r,r,i)}function Zm(n,e,i,r){const l=e/n.worldSize,h=n.globeMatrix;if(i.z<=1){const pe=Jl(i).getCorners();return ry(pe,h,l),hn.fromPoints(pe)}const f=Nf(i,r),m=$g(f,q+$p(n._tileCoverLift));ry(m,h,l);const x=Number.MAX_VALUE,v=[-x,-x,-x],S=[x,x,x];if(f.contains(n.center)){for(const Me of m)Ue(S,S,Me),Dt(v,v,Me);v[2]=0;const pe=n.point,be=[pe.x*l,pe.y*l,0];return Ue(S,S,be),Dt(v,v,be),new hn(S,v)}if(n._tileCoverLift>0){for(const pe of m)Ue(S,S,pe),Dt(v,v,pe);return new hn(S,v)}const A=[h[12]*l,h[13]*l,h[14]*l],M=f.getCenter(),R=he(n.center.lat,-85.051129,Se),D=he(M.lat,-85.051129,Se),U=Re(n.center.lng),G=Be(R);let V=U-Re(M.lng);const Z=G-Be(D);V>.5?V-=1:V<-.5&&(V+=1);let Y=0;Math.abs(V)>Math.abs(Z)?Y=V>=0?1:3:(Y=Z>=0?0:2,Ht(A,A,[h[4]*l,h[5]*l,h[6]*l],-Math.sin(Ki(Z>=0?f.getSouth():f.getNorth()))*q));const Q=m[Y],le=m[(Y+1)%4],ae=new Xx(Q,le,A),ge=[Xp(ae,0)||Q[0],Xp(ae,1)||Q[1],Xp(ae,2)||Q[2]],_e=wu(n.zoom);if(_e>0){const pe=(function({x:Me,y:Ye,z:Ze},We,lt,at,st){const He=1/(1<<Ze);let ht=Me*He,tt=ht+He,gt=Ye*He,ct=gt+He,qt=0;const $t=(ht+tt)/2-at;return $t>.5?qt=-1:$t<-.5&&(qt=1),ht=((ht+qt)*We-(at*=We))*lt+at,tt=((tt+qt)*We-at)*lt+at,gt=(gt*We-(st*=We))*lt+st,ct=(ct*We-st)*lt+st,[[ht,ct,0],[tt,ct,0],[tt,gt,0],[ht,gt,0]]})(i,e,n._pixelsPerMercatorPixel,U,G);for(let Me=0;Me<m.length;Me++)zc(m[Me],pe[Me],_e);const be=Tt([],pe[Y],pe[(Y+1)%4]);bt(be,be,.5),zc(ge,be,_e)}for(const pe of m)Ue(S,S,pe),Dt(v,v,pe);return S[2]=Math.min(Q[2],le[2]),Ue(S,S,ge),Dt(v,v,ge),new hn(S,v)}function Nf({x:n,y:e,z:i},r=!1){const l=1/(1<<i),h=new se($e(n*l),e===(1<<i)-1&&r?-90:ot((e+1)*l)),f=new se($e((n+1)*l),e===0&&r?90:ot(e*l));return new Te(h,f)}function $g(n,e=q){const i=Ki(n.getNorth()),r=Ki(n.getSouth()),l=Math.cos(i),h=Math.cos(r),f=Math.sin(i),m=Math.sin(r),x=n.getWest(),v=n.getEast();return[xe(h,m,x,e),xe(h,m,v,e),xe(l,f,v,e),xe(l,f,x,e)]}function Wp(n,e,i,r){const l=1<<i.z,h=(n/Lt+i.x)/l;return me(ot((e/Lt+i.y)/l),$e(h),r)}function Ah({min:n,max:e}){return 16383/Math.max(e[0]-n[0],e[1]-n[1],e[2]-n[2])}const oy=new Float64Array(16);function Yp(n){const e=Ah(n),i=wt(oy,[e,e,e]);return dt(i,i,Oi([],n.min))}function On(n){const e=(function(r,l){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=l[0],r[13]=l[1],r[14]=l[2],r[15]=1,r})(oy,n.min),i=1/Ah(n);return nt(e,e,[i,i,i])}function Kp(n){const e=Lt/(2*Math.PI);return n/(2*Math.PI)/e}function Qp(n,e){return Lt/(512*Math.pow(2,n))*Ah(Jl(e))}function $m(n,e,i,r,l){const h=Kp(i),f=[n,e,-i/(2*Math.PI)],m=Je(new Float64Array(16));return dt(m,m,f),nt(m,m,[h,h,h]),vt(m,m,Ki(-l)),ut(m,m,Ki(-r)),m}function wu(n){return Ie(5,6,n)}function Xm(n,e){const i=me(e.lat,e.lng),r=(function(D){const U=me(D._center.lat,D._center.lng);let G=Xn([],je(0,1,0),U);const V=Ii([],-D.angle,U);G=Nn(G,G,V),Ii(V,-D._pitch,G);const Z=xi([],U);return bt(Z,Z,$p(D.cameraToCenterDistance/D.pixelsPerMeter)),Nn(Z,Z,V),Tt([],U,Z)})(n);return f=(l=_i([],r,i))[0],m=l[1],x=l[2],v=(h=i)[0],S=h[1],A=h[2],R=(M=Math.sqrt((f*f+m*m+x*x)*(v*v+S*S+A*A)))&&ln(l,h)/M,Math.acos(Math.min(Math.max(R,-1),1));var l,h,f,m,x,v,S,A,M,R}function Ld(n,e){return Xm(n,e)>Math.PI/2*1.01}const Jp=Ki(85),Wx=Math.cos(Jp),ay=Math.sin(Jp),Yx=ft(),sy=n=>{const e=[];return n.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),n.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function Xg(n,e,i,r,l,h,f,m,x){if(h&&n.queryGeometry.isAboveHorizon)return!1;h&&(x*=n.pixelToTileUnitsFactor);const v=n.tileID.canonical,S=i.projection.upVectorScale(v,i.center.lat,i.worldSize).metersToTile;for(const A of e)for(const M of A){const R=M.add(m),D=l&&i.elevation?i.elevation.exaggeration()*l.getElevationAt(R.x,R.y,!0):0,U=i.projection.projectTilePoint(R.x,R.y,v);if(D>0){const Y=i.projection.upVector(v,R.x,R.y);U.x+=Y[0]*S*D,U.y+=Y[1]*S*D,U.z+=Y[2]*S*D}const G=h?R:ly(U.x,U.y,U.z,r),V=h?n.tilespaceRays.map(Y=>xa(Y,D)):n.queryGeometry.screenGeometry,Z=Bo([],[U.x,U.y,U.z,1],r);if(!f&&h?x*=Z[3]/i.cameraToCenterDistance:f&&!h&&(x*=i.cameraToCenterDistance/Z[3]),h){const Y=ot((M.y/Lt+v.y)/(1<<v.z));x/=i.projection.pixelsPerMeter(Y,1)/Le(1,Y)}if(yr(V,G,x))return!0}return!1}function ly(n,e,i,r){const l=Bo([],[n,e,i,1],r);return new _t(l[0]/l[3],l[1]/l[3])}const Er=je(0,0,0),Wg=je(0,0,1);function xa(n,e){const i=Vt();return Er[2]=e,n.intersectsPlane(Er,Wg,i),new _t(i[0],i[1])}class cy extends na{}let Yg,uy,Wm,Ym;function em(n,{width:e,height:i},r,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*i*r)throw new RangeError("mismatched image size")}else l=new Uint8Array(e*i*r);return n.width=e,n.height=i,n.data=l,n}function Kg(n,e,i){const{width:r,height:l}=e;r===n.width&&l===n.height||(Km(n,e,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,r),height:Math.min(n.height,l)},i,null),n.width=r,n.height=l,n.data=e.data)}function Km(n,e,i,r,l,h,f,m){if(l.width===0||l.height===0)return e;if(l.width>n.width||l.height>n.height||i.x>n.width-l.width||i.y>n.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||r.x>e.width-l.width||r.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const x=n.data,v=e.data,S=h===4&&m;for(let A=0;A<l.height;A++){const M=((i.y+A)*n.width+i.x)*h,R=((r.y+A)*e.width+r.x)*h;if(S)for(let D=0;D<l.width;D++){const U=M+D*h+3,G=R+D*h;v[G+0]=255,v[G+1]=255,v[G+2]=255,v[G+3]=x[U]}else if(f)for(let D=0;D<l.width;D++){const U=M+D*h,G=R+D*h,V=new pn(x[U+0]/255,x[U+1]/255,x[U+2]/255,x[U+3]).toNonPremultipliedRenderColor(f).toArray();v[G+0]=V[0],v[G+1]=V[1],v[G+2]=V[2],v[G+3]=V[3]}else for(let D=0;D<l.width*h;D++)v[R+D]=x[M+D]}return e}zt(cy,"HeatmapBucket",{omit:["layers"]});class Dc{constructor(e,i){em(this,e,1,i)}resize(e){Kg(this,new Dc(e),1)}clone(){return new Dc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,l,h){Km(e,i,r,l,h,1,null)}}class ho{constructor(e,i){em(this,e,4,i)}resize(e){Kg(this,new ho(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ho({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,l,h,f,m){Km(e,i,r,l,h,4,f,m)}}class hy{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Uf(n){const e={},i=n.resolution||256,r=n.clips?n.clips.length:1,l=n.image||new ho({width:i,height:r}),h=(f,m,x)=>{e[n.evaluationKey]=x;const v=n.expression.evaluate(e),S=v?v.toNonPremultipliedRenderColor(null):null;S&&(l.data[f+m+0]=Math.floor(255*S.r),l.data[f+m+1]=Math.floor(255*S.g),l.data[f+m+2]=Math.floor(255*S.b),l.data[f+m+3]=Math.floor(255*S.a))};if(n.clips)for(let f=0,m=0;f<r;++f,m+=4*i)for(let x=0,v=0;x<i;x++,v+=4){const S=x/(i-1),{start:A,end:M}=n.clips[f];h(m,v,A*(1-S)+M*S)}else for(let f=0,m=0;f<i;f++,m+=4)h(0,m,f/(i-1));return l}zt(Dc,"AlphaImage"),zt(ho,"RGBAImage");const Kx=Gi([{name:"a_pos",components:2,type:"Int16"}],4),dy=Gi([{name:"a_road_z_offset",components:1,type:"Float32"}],4),Qx=Gi([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Jx=Gi([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function qs(n,e,i=2){const r=e&&e.length,l=r?e[0]*i:n.length;let h=Qg(n,0,l,i,!0);const f=[];if(!h||h.next===h.prev)return f;let m,x,v;if(r&&(h=(function(S,A,M,R){const D=[];for(let U=0,G=A.length;U<G;U++){const V=Qg(S,A[U]*R,U<G-1?A[U+1]*R:S.length,R,!1);V===V.next&&(V.steiner=!0),D.push(py(V))}D.sort(e_);for(let U=0;U<D.length;U++)M=i0(D[U],M);return M})(n,e,h,i)),n.length>80*i){m=n[0],x=n[1];let S=m,A=x;for(let M=i;M<l;M+=i){const R=n[M],D=n[M+1];R<m&&(m=R),D<x&&(x=D),R>S&&(S=R),D>A&&(A=D)}v=Math.max(S-m,A-x),v=v!==0?32767/v:0}return Od(h,f,i,m,x,v,0),f}function Qg(n,e,i,r,l){let h;if(l===(function(f,m,x,v){let S=0;for(let A=m,M=x-v;A<x;A+=v)S+=(f[M]-f[A])*(f[A+1]+f[M+1]),M=A;return S})(n,e,i,r)>0)for(let f=e;f<i;f+=r)h=i_(f/r|0,n[f],n[f+1],h);else for(let f=i-r;f>=e;f-=r)h=i_(f/r|0,n[f],n[f+1],h);return h&&Bd(h,h.next)&&(om(h),h=h.next),h}function Mh(n,e){if(!n)return n;e||(e=n);let i,r=n;do if(i=!1,r.steiner||!Bd(r,r.next)&&Kn(r.prev,r,r.next)!==0)r=r.next;else{if(om(r),r=e=r.prev,r===r.next)break;
vendor: 4,673 bytes, line 218
218i=!0}while(i||r!==e);return e}function Od(n,e,i,r,l,h,f){if(!n)return;!f&&h&&(function(x,v,S,A){let M=x;do M.z===0&&(M.z=tm(M.x,M.y,v,S,A)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==x);M.prevZ.nextZ=null,M.prevZ=null,(function(R){let D,U=1;do{let G,V=R;R=null;let Z=null;for(D=0;V;){D++;let Y=V,Q=0;for(let ae=0;ae<U&&(Q++,Y=Y.nextZ,Y);ae++);let le=U;for(;Q>0||le>0&&Y;)Q!==0&&(le===0||!Y||V.z<=Y.z)?(G=V,V=V.nextZ,Q--):(G=Y,Y=Y.nextZ,le--),Z?Z.nextZ=G:R=G,G.prevZ=Z,Z=G;V=Y}Z.nextZ=null,U*=2}while(D>1)})(M)})(n,r,l,h);let m=n;for(;n.prev!==n.next;){const x=n.prev,v=n.next;if(h?t0(n,r,l,h):e0(n))e.push(x.i,n.i,v.i),om(n),n=v.next,m=v.next;else if((n=v)===m){f?f===1?Od(n=fy(Mh(n),e),e,i,r,l,h,2):f===2&&Jg(n,e,i,r,l,h):Od(Mh(n),e,i,r,l,h,1);break}}}function e0(n){const e=n.prev,i=n,r=n.next;if(Kn(e,i,r)>=0)return!1;const l=e.x,h=i.x,f=r.x,m=e.y,x=i.y,v=r.y,S=Math.min(l,h,f),A=Math.min(m,x,v),M=Math.max(l,h,f),R=Math.max(m,x,v);let D=r.next;for(;D!==e;){if(D.x>=S&&D.x<=M&&D.y>=A&&D.y<=R&&Vf(l,m,h,x,f,v,D.x,D.y)&&Kn(D.prev,D,D.next)>=0)return!1;D=D.next}return!0}function t0(n,e,i,r){const l=n.prev,h=n,f=n.next;if(Kn(l,h,f)>=0)return!1;const m=l.x,x=h.x,v=f.x,S=l.y,A=h.y,M=f.y,R=Math.min(m,x,v),D=Math.min(S,A,M),U=Math.max(m,x,v),G=Math.max(S,A,M),V=tm(R,D,e,i,r),Z=tm(U,G,e,i,r);let Y=n.prevZ,Q=n.nextZ;for(;Y&&Y.z>=V&&Q&&Q.z<=Z;){if(Y.x>=R&&Y.x<=U&&Y.y>=D&&Y.y<=G&&Y!==l&&Y!==f&&Vf(m,S,x,A,v,M,Y.x,Y.y)&&Kn(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,Q.x>=R&&Q.x<=U&&Q.y>=D&&Q.y<=G&&Q!==l&&Q!==f&&Vf(m,S,x,A,v,M,Q.x,Q.y)&&Kn(Q.prev,Q,Q.next)>=0))return!1;Q=Q.nextZ}for(;Y&&Y.z>=V;){if(Y.x>=R&&Y.x<=U&&Y.y>=D&&Y.y<=G&&Y!==l&&Y!==f&&Vf(m,S,x,A,v,M,Y.x,Y.y)&&Kn(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;Q&&Q.z<=Z;){if(Q.x>=R&&Q.x<=U&&Q.y>=D&&Q.y<=G&&Q!==l&&Q!==f&&Vf(m,S,x,A,v,M,Q.x,Q.y)&&Kn(Q.prev,Q,Q.next)>=0)return!1;Q=Q.nextZ}return!0}function fy(n,e){let i=n;do{const r=i.prev,l=i.next.next;!Bd(r,l)&&nm(r,i,i.next,l)&&rm(r,l)&&rm(l,r)&&(e.push(r.i,i.i,l.i),om(i),om(i.next),i=n=l),i=i.next}while(i!==n);return Mh(i)}function Jg(n,e,i,r,l,h){let f=n;do{let m=f.next.next;for(;m!==f.prev;){if(f.i!==m.i&&im(f,m)){let x=kd(f,m);return f=Mh(f,f.next),x=Mh(x,x.next),Od(f,e,i,r,l,h,0),void Od(x,e,i,r,l,h,0)}m=m.next}f=f.next}while(f!==n)}function e_(n,e){let i=n.x-e.x;return i===0&&(i=n.y-e.y,i===0)&&(i=(n.next.y-n.y)/(n.next.x-n.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function i0(n,e){const i=(function(l,h){let f=h;const m=l.x,x=l.y;let v,S=-1/0;if(Bd(l,f))return f;do{if(Bd(l,f.next))return f.next;if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){const U=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(U<=m&&U>S&&(S=U,v=f.x<f.next.x?f:f.next,U===m))return v}f=f.next}while(f!==h);if(!v)return null;const A=v,M=v.x,R=v.y;let D=1/0;f=v;do{if(m>=f.x&&f.x>=M&&m!==f.x&&t_(x<R?m:S,x,M,R,x<R?S:m,x,f.x,f.y)){const U=Math.abs(x-f.y)/(m-f.x);rm(f,l)&&(U<D||U===D&&(f.x>v.x||f.x===v.x&&xl(v,f)))&&(v=f,D=U)}f=f.next}while(f!==A);return v})(n,e);if(!i)return e;const r=kd(i,n);return Mh(r,r.next),Mh(i,i.next)}function xl(n,e){return Kn(n.prev,n,e.prev)<0&&Kn(e.next,n,n.next)<0}function tm(n,e,i,r,l){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*l|0)|n<<8))|n<<4))|n<<2))|n<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function py(n){let e=n,i=n;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==n);return i}function t_(n,e,i,r,l,h,f,m){return(l-f)*(e-m)>=(n-f)*(h-m)&&(n-f)*(r-m)>=(i-f)*(e-m)&&(i-f)*(h-m)>=(l-f)*(r-m)}function Vf(n,e,i,r,l,h,f,m){return!(n===f&&e===m)&&t_(n,e,i,r,l,h,f,m)}function im(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!(function(i,r){let l=i;do{if(l.i!==i.i&&l.next.i!==i.i&&l.i!==r.i&&l.next.i!==r.i&&nm(l,l.next,i,r))return!0;l=l.next}while(l!==i);return!1})(n,e)&&(rm(n,e)&&rm(e,n)&&(function(i,r){let l=i,h=!1;const f=(i.x+r.x)/2,m=(i.y+r.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&f<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==i);return h})(n,e)&&(Kn(n.prev,n,e.prev)||Kn(n,e.prev,e))||Bd(n,e)&&Kn(n.prev,n,n.next)>0&&Kn(e.prev,e,e.next)>0)}function Kn(n,e,i){return(e.y-n.y)*(i.x-e.x)-(e.x-n.x)*(i.y-e.y)}function Bd(n,e){return n.x===e.x&&n.y===e.y}function nm(n,e,i,r){const l=Qm(Kn(n,e,i)),h=Qm(Kn(n,e,r)),f=Qm(Kn(i,r,n)),m=Qm(Kn(i,r,e));return l!==h&&f!==m||!(l!==0||!vl(n,i,e))||!(h!==0||!vl(n,r,e))||!(f!==0||!vl(i,n,r))||!(m!==0||!vl(i,e,r))}function vl(n,e,i){return e.x<=Math.max(n.x,i.x)&&e.x>=Math.min(n.x,i.x)&&e.y<=Math.max(n.y,i.y)&&e.y>=Math.min(n.y,i.y)}function Qm(n){return n>0?1:n<0?-1:0}function rm(n,e){return Kn(n.prev,n,n.next)<0?Kn(n,e,n.next)>=0&&Kn(n,n.prev,e)>=0:Kn(n,e,n.prev)<0||Kn(n,n.next,e)<0}
vendor: 82,818 bytes, line 218
218function kd(n,e){const i=n_(n.i,n.x,n.y),r=n_(e.i,e.x,e.y),l=n.next,h=e.prev;return n.next=e,e.prev=n,i.next=l,l.prev=i,r.next=i,i.prev=r,h.next=r,r.prev=h,r}function i_(n,e,i,r){const l=n_(n,e,i);return r?(l.next=r.next,l.prev=r,r.next.prev=l,r.next=l):(l.prev=l,l.next=l),l}function om(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 n_(n,e,i){return{i:n,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function am(n,e){const i=n.length;if(i<=1)return[n];const r=[];let l,h;for(let f=0;f<i;f++){const m=or(n[f]);m!==0&&(n[f].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(l&&r.push(l),l=[n[f]]):l.push(n[f]))}if(l&&r.push(l),e>1)for(let f=0;f<r.length;f++)r[f].length<=e||(Xh(r[f],e,1,r[f].length-1,n0),r[f]=r[f].slice(0,e));return r}function n0(n,e){return e.area-n.area}function my(n,e,i=1){if(!n)return null;const r=typeof n=="string"?ca.from(n).getPrimary():n.getPrimary(),l=typeof n=="string"?null:n.getSecondary();for(const h of[r,l]){if(!h)continue;const f=h.id.toString();e.has(f)||e.set(f,[]),h.scaleSelf(i),e.get(f).push(h)}return{primary:r.toString(),secondary:l?l.toString():null}}function r_(n,e,i,r){const l=r.patternDependencies;let h=!1;for(const f of e){const m=f.paint.get(`${n}-pattern`);m.isConstant()||(h=!0),my(m.constantOr(null),l,i)&&(h=!0)}return h}function o_(n,e,i,r,l,h){const f=h.patternDependencies;for(const m of e){const x=m.paint.get(`${n}-pattern`).value;if(x.kind!=="constant"){let v=x.evaluate({zoom:r},i,{},h.availableImages);v=v&&v.name?v.name:v;const S=my(v,f,l);if(!S)continue;const{primary:A,secondary:M}=S;A&&(i.patterns[m.id]=[A,M].filter(Boolean))}}return i}class Pc{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=Lt&&i>=Lt}static evaluate(e){if(e.length===0)return new Pc;let i=[];for(const x of e)i.push(...x.portals);if(i.length===0)return new Pc;for(const x of i){const v=x.va,S=x.vb;(Pc.isOnBorder(v.x,S.x)||Pc.isOnBorder(v.y,S.y))&&(x.type="border")}const r=i.filter(x=>x.type!=="unevaluated"),l=i.filter(x=>x.type==="unevaluated");if(l.length===0)return new Pc;l.sort((x,v)=>x.hash===v.hash?x.isTunnel===v.isTunnel?0:x.isTunnel?-1:1:x.hash<v.hash?1:-1),i=r.concat(l);let h=r.length,f=h,m=h;do if(f++,f===i.length||i[h].hash!==i[f].hash){if(f-h===2){m<h&&(i[m]=i[h],i[h]=null);const x=i[m],v=i[f-1];x.type=x.isTunnel!==v.isTunnel?"tunnel":"polygon",x.connection={a:x.connection.a,b:v.connection.a},m++}h=f}while(h!==i.length);return i.splice(m),i.sort((x,v)=>x.hash<v.hash?1:-1),{portals:i}}}zt(Pc,"ElevationPortalGraph");class jf{constructor(e,i,r){this.outPositions=e,this.outNormals=i,this.outIndices=r,this.vertexLookup=new Map}addVertex(e,i,r){let l=e[2];r!=null&&(l*=r);const h=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,f=this.vertexLookup.get(h);if(f!=null)return f;const m=this.outPositions.length;this.vertexLookup.set(h,m);const x=Math.trunc(16384*i[0]),v=Math.trunc(16384*i[1]),S=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],l),this.outNormals.emplaceBack(x,v,S),m}addTriangle(e,i,r){this.outIndices.emplaceBack(e,i,r)}addTriangles(e,i,r){if(e.length===0)return;const l=r.length===1,h=Vt(),f=Vt();for(let m=0;m<e.length;m+=3){const x=i[e[m+0]],v=i[e[m+1]],S=i[e[m+2]],A=l?r[0]:r[e[m+1]],M=l?r[0]:r[e[m+2]];St(h,x.x,x.y,l?r[0]:r[e[m+0]]);const R=this.addVertex(h,f);St(h,v.x,v.y,A);const D=this.addVertex(h,f);St(h,S.x,S.y,M);const U=this.addVertex(h,f);this.outIndices.emplaceBack(R,D,U)}}addQuad(e,i,r,l,h,f){const m=this.addVertex(e,h,f),x=this.addVertex(i,h,f),v=this.addVertex(r,h,f),S=this.addVertex(l,h,f);this.addTriangle(m,x,v),this.addTriangle(v,S,m)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class $o{constructor(e,i,r,l){this.unevaluatedPortals=new Pc,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new dh,this.vertexNormals=new Md,this.indexArray=new Lr,this.tileToMeters=Et(e),this.bridgeProgramConfigurations=new I(i,{zoom:r,lut:l},h=>h!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new I(i,{zoom:r,lut:l},h=>h!=="fill-bridge-guard-rail-color")}addVertices(e,i){const r=this.unevalVertices.length;for(let l=0;l<e.length;l++)this.unevalVertices.push(e[l]),this.unevalHeights.push(i[l]);return r}addTriangles(e,i,r){const l=r?this.unevalTunnelTriangles:this.unevalTriangles;for(const h of e)l.push(h+i)}addRenderableRing(e,i,r,l,h,f){const m=[new _t(h.min.x,h.min.y),new _t(h.max.x,h.min.y),new _t(h.max.x,h.max.y),new _t(h.min.x,h.max.y)];for(let x=0;x<r-1;x++){const v=i+x,S=v+1,A=this.unevalVertices[v],M=this.unevalVertices[S];if(!(A.x>=h.min.x&&A.x<=h.max.x&&A.y>=h.min.y&&A.y<=h.max.y||M.x>=h.min.x&&M.x<=h.max.x&&M.y>=h.min.y&&M.y<=h.max.y||Hs(A,M,m))||this.isOnBorder(A.x,M.x)||this.isOnBorder(A.y,M.y))continue;const R=$o.computeEdgeHash(this.unevalVertices[v],this.unevalVertices[S]);let D,U=this.vertexHashLookup.get($o.computePosHash(A));U!=null?D=U.next:(U=this.vertexHashLookup.get($o.computePosHash(M)),D=U!=null?U.prev:R),this.unevalEdges.push({polygonIdx:e,a:v,b:S,hash:R,portalHash:D,isTunnel:l,type:"unevaluated",featureInfo:f})}}addPortalCandidates(e,i,r,l,h){if(i.length!==0){this.vertexHashLookup.clear();for(const f of i){if(f.length===0)continue;const m=f[0];let x=$o.computeEdgeHash(m[m.length-2],m[m.length-1]);for(let v=0;v<m.length-1;v++){const S=m[v+0],A=m[v+1],M=Dr(A.x-S.x,A.y-S.y),R=Fa(M);if(R===0)continue;let D="unevaluated";const U=l.pointElevation(S),G=l.pointElevation(A);Math.abs(U)<.01&&Math.abs(G)<.01?D="entrance":(this.isOnBorder(S.x,A.x)||this.isOnBorder(S.y,A.y))&&(D="border");const V=$o.computeEdgeHash(S,A);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:S,vb:A,vab:M,length:R,hash:V,isTunnel:r,type:D});const Z=$o.computePosHash(S);this.vertexHashLookup.set(Z,{prev:x,next:V}),x=V}}}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=M=>{M.primitiveLength=this.indexArray.length-M.primitiveOffset},l=new jf(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const h=i(),f=i(),m=i(),x=(M,R)=>{M.sort((U,G)=>U.type===R&&G.type!==R?-1:U.type!==R&&G.type===R?1:0);const D=M.findIndex(U=>U.type!==R);return D>=0?D:M.length};let v=0;this.unevalEdges.length>0&&(v=x(this.unevalEdges,"none"),this.constructBridgeStructures(l,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:v},this.tileToMeters)),r(m);const S=i(),A=i();if(this.unevalEdges.length>0){const M=this.unevalEdges.splice(v),R=x(M,"tunnel")+v;this.unevalEdges.push(...M),this.constructTunnelStructures(l,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:v},{min:v,max:R})}r(S),l.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(A),l.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(f),l.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(h),this.maskSegments=kn.simpleSegment(0,A.primitiveOffset,0,A.primitiveLength),this.depthSegments=kn.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableBridgeSegments=kn.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength),this.renderableTunnelSegments=kn.simpleSegment(0,S.primitiveOffset,0,S.primitiveLength),this.shadowCasterSegments=kn.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength)}update(e,i,r,l,h,f,m,x){this.bridgeProgramConfigurations.updatePaintArrays(e,i,h,r,l,f,m,x),this.tunnelProgramConfigurations.updatePaintArrays(e,i,h,r,l,f,m,x)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,Qx.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,Jx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,i,r,l,h){const f=(m,x)=>{for(let v=0;v<x.length-1;v++){const S=x[v].featureIndex,A=x[v+1].vertexStart,M=e.feature(S);m.populatePaintArrays(A,M,S,{},r,i,l,void 0,h)}};f(this.bridgeProgramConfigurations,this.bridgeFeatureSections),f(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,r,l,h){const f=new Map;for(let m=l;m<h;m++){const x=r[m],v=x.a,S=x.b,A=$o.computePosHash(e[v]),M=$o.computePosHash(e[S]);let R=f.get(A);R||(R={},f.set(A,R));let D=f.get(M);D||(D={},f.set(M,D)),i[v]<=0&&i[S]<=0||(R.to=S,D.from=v)}return f}isTerminalVertex(e,i){const r=$o.computePosHash(this.unevalVertices[e]),l=i.get(r);return!l||!l.from||!l.to}constructBridgeStructures(e,i,r,l,h,f){e.clearVertexLookup();const m=this.computeVertexConnections(i,r,l,h.min,h.max),x=1/f,v=.5*x,S=(lt,at)=>St(lt,i[at].x,i[at].y,r[at]*x),A=Vt(),M=Vt(),R=Vt(),D=Vt(),U=Vt(),G=(lt,at)=>{const st=m.get($o.computePosHash(i[at])),He=st.from,ht=st.to;if(!He||!ht)return;S(A,He),S(M,at),S(R,ht),Qa(D),Oo(A,M)||(rr(U,M,A),xi(D,U)),Oo(R,M)||(rr(U,R,M),Tt(D,D,xi(U,U)));const tt=Ja(D);return tt>0?bt(lt,D,1/tt):void 0};let V=Number.POSITIVE_INFINITY;this.sortSubarray(l,h.min,h.max,(lt,at)=>lt.featureInfo.featureIndex-at.featureInfo.featureIndex);const Z=Vt(),Y=Vt(),Q=Vt(),le=Vt(),ae=Vt(),ge=Vt(),_e=Vt(),pe=Vt(),be=Vt(),Me=[Vt(),Vt(),Vt(),Vt()],Ye=[Vt(),Vt(),Vt(),Vt()],Ze=[{coord:new _t(0,0),height:0},{coord:new _t(0,0),height:0}],We=(lt,at)=>lt>at;for(let lt=h.min;lt<h.max;lt++){const at=l[lt];if(!at.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Ze,i,r,at,We))continue;const[st,He]=Ze;if(St(Z,st.coord.x,st.coord.y,x*st.height),St(Y,He.coord.x,He.coord.y,x*He.height),Oo(Z,Y))continue;rr(Q,Y,Z),xi(Q,Q);const ht=G(pe,at.a)||Q,tt=G(be,at.b)||Q;St(le,ht[1],-ht[0],0),xi(le,le),St(ae,tt[1],-tt[0],0),xi(ae,ae),Xn(pe,le,ht),xi(ge,pe),Xn(pe,ae,tt),xi(_e,pe),Tt(Me[0],Z,bt(pe,rr(pe,le,ge),v)),Tt(Me[1],Z,bt(pe,Tt(pe,le,ge),v)),Tt(Me[2],Z,bt(pe,ge,v)),Me[3]=Z,Tt(Ye[0],Y,bt(pe,rr(pe,ae,_e),v)),Tt(Ye[1],Y,bt(pe,Tt(pe,ae,_e),v)),Tt(Ye[2],Y,bt(pe,_e,v)),Ye[3]=Y,V=this.addFeatureSection(at.featureInfo.featureIndex,V,this.bridgeFeatureSections,e);const gt=e.addVertex(Me[0],le,f),ct=e.addVertex(Me[1],le,f),qt=e.addVertex(Ye[0],ae,f),$t=e.addVertex(Ye[1],ae,f);e.addTriangle(gt,ct,qt),e.addTriangle(ct,$t,qt);const kt=e.addVertex(Me[1],ge,f),Nt=e.addVertex(Me[2],ge,f),ci=e.addVertex(Ye[1],_e,f),ii=e.addVertex(Ye[2],_e,f);e.addTriangle(kt,Nt,ci),e.addTriangle(Nt,ii,ci),Oi(le,le),Oi(ae,ae);const Gt=e.addVertex(Me[2],le,f),Ei=e.addVertex(Me[3],le,f),Zi=e.addVertex(Ye[2],ae,f),fn=e.addVertex(Ye[3],ae,f);e.addTriangle(Gt,Ei,Zi),e.addTriangle(Ei,fn,Zi);const Ui=this.isTerminalVertex(at.a,m),En=this.isTerminalVertex(at.b,m);st.height<.01&&Ui&&e.addQuad(Me[3],Me[2],Me[1],Me[0],Oi(ht,ht),f),He.height<.01&&En&&e.addQuad(Ye[0],Ye[1],Ye[2],Ye[3],tt,f)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,r,l,h,f){e.clearVertexLookup();let m=Number.POSITIVE_INFINITY;const x=(V,Z)=>V.featureInfo.featureIndex-Z.featureInfo.featureIndex;this.sortSubarray(l,h.min,h.max,x),this.sortSubarray(l,f.min,f.max,x);const v=V=>xi(V,V),S=[{coord:new _t(0,0),height:0},{coord:new _t(0,0),height:0}],A=(V,Z)=>V<Z,M=Vt(),R=Vt(),D=Vt(),U=Vt(),G=Vt();for(let V=h.min;V<h.max;V++){if(!this.prepareEdgePoints(S,i,r,l[V],A))continue;const[Z,Y]=S,Q=v(St(G,-(Y.coord.y-Z.coord.y),Y.coord.x-Z.coord.x,0));m=this.addFeatureSection(l[V].featureInfo.featureIndex,m,this.tunnelFeatureSections,e),e.addQuad(St(M,Z.coord.x,Z.coord.y,Z.height),St(R,Y.coord.x,Y.coord.y,Y.height),St(D,Y.coord.x,Y.coord.y,l[V].isTunnel?-.1:0),St(U,Z.coord.x,Z.coord.y,l[V].isTunnel?-.1:0),Q)}for(let V=f.min;V<f.max;V++){const Z=l[V];Z.isTunnel&&([Z.a,Z.b]=[Z.b,Z.a]);const Y=i[Z.a],Q=i[Z.b],le=v(St(G,-(Q.y-Y.y),Q.x-Y.x,0));m=this.addFeatureSection(Z.featureInfo.featureIndex,m,this.tunnelFeatureSections,e),e.addQuad(St(M,Q.x,Q.y,0),St(R,Y.x,Y.y,0),St(D,Y.x,Y.y,r[Z.a]+4),St(U,Q.x,Q.y,r[Z.b]+4),le),e.addQuad(St(M,Y.x,Y.y,0),St(R,Q.x,Q.y,0),St(D,Q.x,Q.y,r[Z.b]+4),St(U,Y.x,Y.y,r[Z.a]+4),le)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,r,l){e.coord.x=i,e.coord.y=r,e.height=l}prepareEdgePoints(e,i,r,l,h){let f=i[l.a].x,m=i[l.a].y,x=i[l.b].x,v=i[l.b].y,S=r[l.a],A=r[l.b];const M=h(S,0),R=h(A,0);if(M&&R)return this.setElevatedPoint(e[0],f,m,S),this.setElevatedPoint(e[1],x,v,A),!0;if(!M&&!R)return!1;if(M){if(!R){const D=A/(A-S);x=mi(x,f,D),v=mi(v,m,D),A=mi(A,S,D)}}else{const D=S/(S-A);f=mi(f,x,D),m=mi(m,v,D),S=mi(S,A,D)}return this.setElevatedPoint(e[0],f,m,S),this.setElevatedPoint(e[1],x,v,A),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((m,x)=>m.hash===x.hash?x.polygonIdx-m.polygonIdx:x.hash>m.hash?1:-1);let r=0,l=0,h=0,f=i[r].polygonIdx;do l++,(l===i.length||i[r].hash!==i[l].hash)&&((l-r===1||i[l-1].polygonIdx!==f)&&(h<r&&(i[h]=i[r],i[r]=null),i[h].type="none",h++),r=l,r!==i.length&&(f=i[r].polygonIdx));while(r!==i.length);if(i.splice(h),i.length!==0&&e.length!==0){i.sort((v,S)=>v.portalHash<S.portalHash?1:-1);let m=0,x=0;for(;m!==i.length&&x!==e.length;){const v=i[m],S=e[x];v.portalHash>S.hash?m++:S.hash>v.portalHash?x++:(v.type=S.type,m++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=Lt&&i>=Lt}addFeatureSection(e,i,r,l){return e!==i&&(i=e,r.push({featureIndex:e,vertexStart:l.getVertexCount()}),l.clearVertexLookup()),i}sortSubarray(e,i,r,l){const h=e.slice(i,r);h.sort(l),e.splice(i,h.length,...h)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt($o.computePosHash(e))<<32n|BigInt($o.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function gy(n,e){return n>e?1:n<e?-1:0}class a_{constructor(e=gy,i=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!i}rotateLeft(e){var i=e.right;i&&(e.right=i.left,i.left&&(i.left.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.left=e),e.parent=i}rotateRight(e){var i=e.left;i&&(e.left=i.right,i.right&&(i.right.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.right=e),e.parent=i}_splay(e){for(;e.parent;){var i=e.parent;i.parent?i.left===e&&i.parent.left===i?(this.rotateRight(i.parent),this.rotateRight(i)):i.right===e&&i.parent.right===i?(this.rotateLeft(i.parent),this.rotateLeft(i)):i.left===e&&i.parent.right===i?(this.rotateRight(i),this.rotateLeft(i)):(this.rotateLeft(i),this.rotateRight(i)):i.left===e?this.rotateRight(i):this.rotateLeft(i)}}splay(e){for(var i,r,l,h,f;e.parent;)(r=(i=e.parent).parent)&&r.parent?((l=r.parent).left===r?l.left=e:l.right=e,e.parent=l):(e.parent=null,this._root=e),h=e.left,f=e.right,e===i.left?(r&&(r.left===i?(i.right?(r.left=i.right,r.left.parent=r):r.left=null,i.right=r,r.parent=i):(h?(r.right=h,h.parent=r):r.right=null,e.left=r,r.parent=e)),f?(i.left=f,f.parent=i):i.left=null,e.right=i,i.parent=e):(r&&(r.right===i?(i.left?(r.right=i.left,r.right.parent=r):r.right=null,i.left=r,r.parent=i):(f?(r.left=f,f.parent=r):r.left=null,e.right=r,r.parent=e)),h?(i.right=h,h.parent=i):i.right=null,e.left=i,i.parent=e)}replace(e,i){e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,i){var r=this._root,l=null,h=this._compare;if(this._noDuplicates)for(;r;){if(l=r,h(r.key,e)===0)return;r=h(r.key,e)<0?r.right:r.left}else for(;r;)l=r,r=h(r.key,e)<0?r.right:r.left;return r={key:e,data:i,left:null,right:null,parent:l},l?h(l.key,r.key)<0?l.right=r:l.left=r:this._root=r,this.splay(r),this._size++,r}find(e){for(var i=this._root,r=this._compare;i;){var l=r(i.key,e);if(l<0)i=i.right;else{if(!(l>0))return i;i=i.left}}return null}contains(e){for(var i=this._root,r=this._compare;i;){var l=r(e,i.key);if(l===0)return!0;i=l<0?i.left:i.right}return!1}remove(e){var i=this.find(e);if(!i)return!1;if(this.splay(i),i.left)if(i.right){var r=this.minNode(i.right);r.parent!==i&&(this.replace(r,r.right),r.right=i.right,r.right.parent=r),this.replace(i,r),r.left=i.left,r.left.parent=r}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var i=this.minNode(e.right);i.parent!==e&&(this.replace(i,i.right),i.right=e.right,i.right.parent=i),this.replace(e,i),i.left=e.left,i.left.parent=i}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var i=this.find(e);if(i){this.splay(i);var r=i.left,l=i.right,h=null;r&&(r.parent=null,h=this.maxNode(r),this.splay(h),this._root=h),l&&(r?h.right=l:this._root=l,l.parent=h),this._size--}}pop(){var e=this._root,i=null;if(e){for(;e.left;)e=e.left;i={key:e.key,data:e.data},this.remove(e.key)}return i}next(e){var i=e;if(i)if(i.right)for(i=i.right;i&&i.left;)i=i.left;else for(i=e.parent;i&&i.right===e;)e=i,i=i.parent;return i}prev(e){var i=e;if(i)if(i.left)for(i=i.left;i&&i.right;)i=i.right;else for(i=e.parent;i&&i.left===e;)e=i,i=i.parent;return i}forEach(e){for(var i=this._root,r=[],l=!1,h=0;!l;)i?(r.push(i),i=i.left):r.length>0?(e(i=r.pop(),h++),i=i.right):l=!0;return this}range(e,i,r,l){const h=[],f=this._compare;let m,x=this._root;for(;h.length!==0||x;)if(x)h.push(x),x=x.left;else{if(x=h.pop(),m=f(x.key,i),m>0)break;if(f(x.key,e)>=0&&r.call(l,x))return this;x=x.right}return this}keys(){for(var e=this._root,i=[],r=[],l=!1;!l;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),r.push(e.key),e=e.right):l=!0;return r}values(){for(var e=this._root,i=[],r=[],l=!1;!l;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),r.push(e.data),e=e.right):l=!0;return r}at(e){for(var i=this._root,r=[],l=!1,h=0;!l;)if(i)r.push(i),i=i.left;else if(r.length>0){if(i=r.pop(),h===e)return i;h++,i=i.right}else l=!0;return null}load(e=[],i=[],r=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const l=e.length;return r&&Fd(e,i,0,l-1,this._compare),this._root=Ch(null,e,i,0,l),this._size=l,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return this._root===null}get size(){return this._size}static createTree(e,i,r,l,h){return new a_(r,h).load(e,i,l)}}function Ch(n,e,i,r,l){const h=l-r;if(h>0){const f=r+Math.floor(h/2),m={key:e[f],data:i[f],parent:n};return m.left=Ch(m,e,i,r,f),m.right=Ch(m,e,i,f+1,l),m}return null}function Fd(n,e,i,r,l){if(i>=r)return;const h=n[i+r>>1];let f=i-1,m=r+1;for(;;){do f++;while(l(n[f],h)<0);do m--;while(l(n[m],h)>0);if(f>=m)break;let x=n[f];n[f]=n[m],n[m]=x,x=e[f],e[f]=e[m],e[m]=x}Fd(n,e,i,m,l),Fd(n,e,m+1,r,l)}const s_=11102230246251565e-32,Xo=134217729,l_=(3+8*s_)*s_;function sm(n,e,i,r,l){let h,f,m,x,v=e[0],S=r[0],A=0,M=0;S>v==S>-v?(h=v,v=e[++A]):(h=S,S=r[++M]);let R=0;if(A<n&&M<i)for(S>v==S>-v?(f=v+h,m=h-(f-v),v=e[++A]):(f=S+h,m=h-(f-S),S=r[++M]),h=f,m!==0&&(l[R++]=m);A<n&&M<i;)S>v==S>-v?(f=h+v,x=f-h,m=h-(f-x)+(v-x),v=e[++A]):(f=h+S,x=f-h,m=h-(f-x)+(S-x),S=r[++M]),h=f,m!==0&&(l[R++]=m);for(;A<n;)f=h+v,x=f-h,m=h-(f-x)+(v-x),v=e[++A],h=f,m!==0&&(l[R++]=m);for(;M<i;)f=h+S,x=f-h,m=h-(f-x)+(S-x),S=r[++M],h=f,m!==0&&(l[R++]=m);return h===0&&R!==0||(l[R++]=h),R}function Ih(n){return new Float64Array(n)}const Nd=Ih(4),c_=Ih(8),_y=Ih(12),u_=Ih(16),Wa=Ih(4);function Ud(n,e,i){e===null?(n.inOut=!1,n.otherInOut=!0):(n.isSubject===e.isSubject?(n.inOut=!e.inOut,n.otherInOut=e.otherInOut):(n.inOut=!e.otherInOut,n.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(n.prevInResult=!yy(e,i)||e.isVertical()?e.prevInResult:e)),n.resultTransition=yy(n,i)?(function(r,l){let h,f=!r.inOut,m=!r.otherInOut;switch(l){case 0:h=f&&m;break;case 1:h=f||m;break;case 3:h=f!==m;break;case 2:h=r.isSubject?f&&!m:m&&!f}return h?1:-1})(n,i):0}function yy(n,e){switch(n.type){case 0:switch(e){case 0:return!n.otherInOut;case 1:return n.otherInOut;case 2:return n.isSubject&&n.otherInOut||!n.isSubject&&!n.otherInOut;case 3:return!0}break;case 2:return e===0||e===1;case 3:return e===2;case 1:return!1}return!1}class Tu{constructor(e,i,r,l,h){this.left=i,this.point=e,this.otherEvent=r,this.isSubject=l??!1,this.type=h||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const i=this.point,r=this.otherEvent.point;return this.left?(i[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(i[1]-e[1])>0:(r[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(r[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return this.resultTransition!==0}clone(){const e=new Tu(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Zs(n,e){return n[0]===e[0]&&n[1]===e[1]}function Gf(n,e,i){const r=(function(l,h,f,m,x,v){const S=(h-v)*(f-x),A=(l-x)*(m-v),M=S-A;if(S===0||A===0||S>0!=A>0)return M;const R=Math.abs(S+A);return Math.abs(M)>=33306690738754716e-32*R?M:-(function(D,U,G,V,Z,Y,Q){let le,ae,ge,_e,pe,be,Me,Ye,Ze,We,lt,at,st,He,ht,tt,gt,ct;const qt=D-Z,$t=G-Z,kt=U-Y,Nt=V-Y;He=qt*Nt,be=Xo*qt,Me=be-(be-qt),Ye=qt-Me,be=Xo*Nt,Ze=be-(be-Nt),We=Nt-Ze,ht=Ye*We-(He-Me*Ze-Ye*Ze-Me*We),tt=kt*$t,be=Xo*kt,Me=be-(be-kt),Ye=kt-Me,be=Xo*$t,Ze=be-(be-$t),We=$t-Ze,gt=Ye*We-(tt-Me*Ze-Ye*Ze-Me*We),lt=ht-gt,pe=ht-lt,Nd[0]=ht-(lt+pe)+(pe-gt),at=He+lt,pe=at-He,st=He-(at-pe)+(lt-pe),lt=st-tt,pe=st-lt,Nd[1]=st-(lt+pe)+(pe-tt),ct=at+lt,pe=ct-at,Nd[2]=at-(ct-pe)+(lt-pe),Nd[3]=ct;let ci=(function(fn,Ui){let En=Ui[0];for(let on=1;on<4;on++)En+=Ui[on];return En})(0,Nd),ii=22204460492503146e-32*Q;if(ci>=ii||-ci>=ii||(pe=D-qt,le=D-(qt+pe)+(pe-Z),pe=G-$t,ge=G-($t+pe)+(pe-Z),pe=U-kt,ae=U-(kt+pe)+(pe-Y),pe=V-Nt,_e=V-(Nt+pe)+(pe-Y),le===0&&ae===0&&ge===0&&_e===0)||(ii=11093356479670487e-47*Q+l_*Math.abs(ci),ci+=qt*_e+Nt*le-(kt*ge+$t*ae),ci>=ii||-ci>=ii))return ci;He=le*Nt,be=Xo*le,Me=be-(be-le),Ye=le-Me,be=Xo*Nt,Ze=be-(be-Nt),We=Nt-Ze,ht=Ye*We-(He-Me*Ze-Ye*Ze-Me*We),tt=ae*$t,be=Xo*ae,Me=be-(be-ae),Ye=ae-Me,be=Xo*$t,Ze=be-(be-$t),We=$t-Ze,gt=Ye*We-(tt-Me*Ze-Ye*Ze-Me*We),lt=ht-gt,pe=ht-lt,Wa[0]=ht-(lt+pe)+(pe-gt),at=He+lt,pe=at-He,st=He-(at-pe)+(lt-pe),lt=st-tt,pe=st-lt,Wa[1]=st-(lt+pe)+(pe-tt),ct=at+lt,pe=ct-at,Wa[2]=at-(ct-pe)+(lt-pe),Wa[3]=ct;const Gt=sm(4,Nd,4,Wa,c_);He=qt*_e,be=Xo*qt,Me=be-(be-qt),Ye=qt-Me,be=Xo*_e,Ze=be-(be-_e),We=_e-Ze,ht=Ye*We-(He-Me*Ze-Ye*Ze-Me*We),tt=kt*ge,be=Xo*kt,Me=be-(be-kt),Ye=kt-Me,be=Xo*ge,Ze=be-(be-ge),We=ge-Ze,gt=Ye*We-(tt-Me*Ze-Ye*Ze-Me*We),lt=ht-gt,pe=ht-lt,Wa[0]=ht-(lt+pe)+(pe-gt),at=He+lt,pe=at-He,st=He-(at-pe)+(lt-pe),lt=st-tt,pe=st-lt,Wa[1]=st-(lt+pe)+(pe-tt),ct=at+lt,pe=ct-at,Wa[2]=at-(ct-pe)+(lt-pe),Wa[3]=ct;const Ei=sm(Gt,c_,4,Wa,_y);He=le*_e,be=Xo*le,Me=be-(be-le),Ye=le-Me,be=Xo*_e,Ze=be-(be-_e),We=_e-Ze,ht=Ye*We-(He-Me*Ze-Ye*Ze-Me*We),tt=ae*ge,be=Xo*ae,Me=be-(be-ae),Ye=ae-Me,be=Xo*ge,Ze=be-(be-ge),We=ge-Ze,gt=Ye*We-(tt-Me*Ze-Ye*Ze-Me*We),lt=ht-gt,pe=ht-lt,Wa[0]=ht-(lt+pe)+(pe-gt),at=He+lt,pe=at-He,st=He-(at-pe)+(lt-pe),lt=st-tt,pe=st-lt,Wa[1]=st-(lt+pe)+(pe-tt),ct=at+lt,pe=ct-at,Wa[2]=at-(ct-pe)+(lt-pe),Wa[3]=ct;const Zi=sm(Ei,_y,4,Wa,u_);return u_[Zi-1]})(l,h,f,m,x,v,R)})(n[0],n[1],e[0],e[1],i[0],i[1]);return r>0?-1:r<0?1:0}function Rh(n,e){const i=n.point,r=e.point;return i[0]>r[0]?1:i[0]<r[0]?-1:i[1]!==r[1]?i[1]>r[1]?1:-1:(function(l,h,f){return l.left!==h.left?l.left?1:-1:Gf(f,l.otherEvent.point,h.otherEvent.point)!==0?l.isBelow(h.otherEvent.point)?-1:1:!l.isSubject&&h.isSubject?1:-1})(n,e,i)}function bl(n,e,i){const r=new Tu(e,!1,n,n.isSubject),l=new Tu(e,!0,n.otherEvent,n.isSubject);return Zs(n.point,n.otherEvent.point)&&console.warn("what is that, a collapsed segment?",n),r.contourId=l.contourId=n.contourId,Rh(l,n.otherEvent)>0&&(n.otherEvent.left=!0,l.left=!1),n.otherEvent.otherEvent=l,n.otherEvent=r,i.push(l),i.push(r),i}function Jm(n,e){return n[0]*e[1]-n[1]*e[0]}function eg(n,e){return n[0]*e[0]+n[1]*e[1]}function tg(n,e,i){const r=(function(x,v,S,A){const M=[v[0]-x[0],v[1]-x[1]],R=[A[0]-S[0],A[1]-S[1]];function D(ge,_e,pe){return[ge[0]+_e*pe[0],ge[1]+_e*pe[1]]}const U=[S[0]-x[0],S[1]-x[1]];let G=Jm(M,R),V=G*G;const Z=eg(M,M);if(V>0){const ge=Jm(U,R)/G;if(ge<0||ge>1)return null;const _e=Jm(U,M)/G;return _e<0||_e>1?null:ge===0||ge===1?[D(x,ge,M)]:_e===0||_e===1?[D(S,_e,R)]:[D(x,ge,M)]}if(G=Jm(U,M),V=G*G,V>0)return null;const Y=eg(M,U)/Z,Q=Y+eg(M,R)/Z,le=Math.min(Y,Q),ae=Math.max(Y,Q);return le<=1&&ae>=0?le===1?[D(x,le>0?le:0,M)]:ae===0?[D(x,ae<1?ae:1,M)]:[D(x,le>0?le:0,M),D(x,ae<1?ae:1,M)]:null})(n.point,n.otherEvent.point,e.point,e.otherEvent.point),l=r?r.length:0;if(l===0||l===1&&(Zs(n.point,e.point)||Zs(n.otherEvent.point,e.otherEvent.point))||l===2&&n.isSubject===e.isSubject)return 0;if(l===1)return!Zs(n.point,r[0])&&!Zs(n.otherEvent.point,r[0])&&bl(n,r[0],i),!Zs(e.point,r[0])&&!Zs(e.otherEvent.point,r[0])&&bl(e,r[0],i),1;const h=[];let f=!1,m=!1;return Zs(n.point,e.point)?f=!0:Rh(n,e)===1?h.push(e,n):h.push(n,e),Zs(n.otherEvent.point,e.otherEvent.point)?m=!0:Rh(n.otherEvent,e.otherEvent)===1?h.push(e.otherEvent,n.otherEvent):h.push(n.otherEvent,e.otherEvent),f&&m||f?(e.type=1,n.type=e.inOut===n.inOut?2:3,f&&!m&&bl(h[1].otherEvent,h[0].point,i),2):m?(bl(h[0],h[1].point,i),3):h[0]!==h[3].otherEvent?(bl(h[0],h[1].point,i),bl(h[1],h[2].point,i),3):(bl(h[0],h[1].point,i),bl(h[3].otherEvent,h[2].point,i),3)}function xy(n,e){if(n===e)return 0;if(Gf(n.point,n.otherEvent.point,e.point)!==0||Gf(n.point,n.otherEvent.point,e.otherEvent.point)!==0)return Zs(n.point,e.point)?n.isBelow(e.otherEvent.point)?-1:1:n.point[0]===e.point[0]?n.point[1]<e.point[1]?-1:1:Rh(n,e)===1?e.isAbove(n.point)?-1:1:n.isBelow(e.point)?-1:1;if(n.isSubject!==e.isSubject)return n.isSubject?-1:1;{let i=n.point,r=e.point;if(i[0]===r[0]&&i[1]===r[1])return i=n.otherEvent.point,r=e.otherEvent.point,i[0]===r[0]&&i[1]===r[1]?0:(n.contourId??0)>(e.contourId??0)?1:-1}return Rh(n,e)===1?1:-1}class vy{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function h_(n,e,i,r){let l,h=n+1,f=e[n].point;const m=e.length;for(h<m&&(l=e[h].point);h<m&&l[0]===f[0]&&l[1]===f[1];){if(!i[h])return h;h++,h<m&&(l=e[h].point)}for(h=n-1;i[h]&&h>r;)h--;return h}function by(n,e,i){const r=new vy;if(n.prevInResult!=null){const l=n.prevInResult,h=l.outputContourId;if(l.resultTransition>0){const f=e[h];if(f.holeOf!=null){const m=f.holeOf;e[m].holeIds.push(i),r.holeOf=m,r.depth=e[h].depth}else e[h].holeIds.push(i),r.holeOf=h,r.depth=e[h].depth+1}else r.holeOf=null,r.depth=e[h].depth}else r.holeOf=null,r.depth=0;return r}const d_=Math.max,lm=Math.min;let ig=0;function wy(n,e,i,r,l,h){let f,m,x,v,S,A;for(f=0,m=n.length-1;f<m;f++){if(x=n[f],v=n[f+1],S=new Tu(x,!1,void 0,e),A=new Tu(v,!1,S,e),S.otherEvent=A,x[0]===v[0]&&x[1]===v[1])continue;S.contourId=A.contourId=i,h||(S.isExteriorRing=!1,A.isExteriorRing=!1),Rh(S,A)>0?A.left=!0:S.left=!0;const M=x[0],R=x[1];l[0]=lm(l[0],M),l[1]=lm(l[1],R),l[2]=d_(l[2],M),l[3]=d_(l[3],R),r.push(S),r.push(A)}}const Hf=[];function ng(n,e,i){let r=n,l=e;typeof n[0][0][0]=="number"&&(r=[n]),typeof e[0][0][0]=="number"&&(l=[e]);let h=(function(M,R,D){let U=null;return M.length*R.length===0&&(D===0?U=Hf:D===2?U=M:(D===1||D===3)&&(U=M.length===0?R:M)),U})(r,l,i);if(h)return h===Hf?null:h;const f=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],x=(function(M,R,D,U,G){const V=new Xc(void 0,Rh);let Z,Y,Q,le,ae,ge;for(Q=0,le=M.length;Q<le;Q++)for(Z=M[Q],ae=0,ge=Z.length;ae<ge;ae++)Y=ae===0,Y&&ig++,wy(Z[ae],!0,ig,V,D,Y);for(Q=0,le=R.length;Q<le;Q++)for(Z=R[Q],ae=0,ge=Z.length;ae<ge;ae++)Y=ae===0,G===2&&(Y=!1),Y&&ig++,wy(Z[ae],!1,ig,V,U,Y);return V})(r,l,f,m,i);if(h=(function(M,R,D,U,G){let V=null;return(D[0]>U[2]||U[0]>D[2]||D[1]>U[3]||U[1]>D[3])&&(G===0?V=Hf:G===2?V=M:(G===1||G===3)&&(V=M.concat(R))),V})(r,l,f,m,i),h)return h===Hf?null:h;const v=(function(M,R,D,U,G,V){const Z=new a_(xy),Y=[],Q=Math.min(U[2],G[2]);let le,ae,ge;for(;M.length!==0;){let _e=M.pop();if(Y.push(_e),V===0&&_e.point[0]>Q||V===2&&_e.point[0]>U[2])break;if(_e.left){ae=le=Z.insert(_e),ge=Z.minNode(),le=le!==ge?Z.prev(le):null,ae=Z.next(ae);const pe=le?le.key:null;let be;if(Ud(_e,pe,V),ae&&tg(_e,ae.key,M)===2&&(Ud(_e,pe,V),Ud(ae.key,_e,V)),le&&tg(le.key,_e,M)===2){let Me=le;Me=Me!==ge?Z.prev(Me):null,be=Me?Me.key:null,Ud(pe,be,V),Ud(_e,pe,V)}}else _e=_e.otherEvent,ae=le=Z.find(_e),le&&ae&&(le=le!==ge?Z.prev(le):null,ae=Z.next(ae),Z.remove(_e),ae&&le&&tg(le.key,ae.key,M))}return Y})(x,0,0,f,m,i),S=(function(M){let R,D;const U=(function(Z){let Y,Q,le,ae,ge;const _e=[];for(Q=0,le=Z.length;Q<le;Q++)Y=Z[Q],(Y.left&&Y.inResult||!Y.left&&Y.otherEvent.inResult)&&_e.push(Y);let pe=!1;for(;!pe;)for(pe=!0,Q=0,le=_e.length;Q<le;Q++)Q+1<le&&Rh(_e[Q],_e[Q+1])===1&&(ae=_e[Q],_e[Q]=_e[Q+1],_e[Q+1]=ae,pe=!1);for(Q=0,le=_e.length;Q<le;Q++)Y=_e[Q],Y.otherPos=Q;for(Q=0,le=_e.length;Q<le;Q++)Y=_e[Q],Y.left||(ge=Y.otherPos,Y.otherPos=Y.otherEvent.otherPos,Y.otherEvent.otherPos=ge);return _e})(M),G={},V=[];for(R=0,D=U.length;R<D;R++){if(G[R])continue;const Z=V.length,Y=by(U[R],V,Z),Q=ge=>{G[ge]=!0,ge<U.length&&U[ge]&&(U[ge].outputContourId=Z)};let le=R,ae=R;for(Y.points.push(U[R].point);Q(le),le=U[le].otherPos,Q(le),Y.points.push(U[le].point),le=h_(le,U,G,ae),!(le==ae||le>=U.length)&&U[le];);V.push(Y)}return V})(v),A=[];for(let M=0;M<S.length;M++){let R=S[M];if(R.isExterior()){let D=[R.points];for(let U=0;U<R.holeIds.length;U++)D.push(S[R.holeIds[U]].points);A.push(D)}}return A}function Vd(n,e,i,r){const l=[],h=r===0?(f,m,x,v,S,A)=>{f.push(new _t(A,x+(A-m)/(v-m)*(S-x)))}:(f,m,x,v,S,A)=>{f.push(new _t(m+(A-x)/(S-x)*(v-m),A))};for(const f of n){const m=[];for(const x of f){if(x.length<=2)continue;const v=[];for(let M=0;M<x.length-1;M++){const R=x[M].x,D=x[M].y,U=x[M+1].x,G=x[M+1].y,V=r===0?R:D,Z=r===0?U:G;V<e?Z>e&&h(v,R,D,U,G,e):V>i?Z<i&&h(v,R,D,U,G,i):v.push(x[M]),Z<e&&V>=e&&h(v,R,D,U,G,e),Z>i&&V<=i&&h(v,R,D,U,G,i)}let S=x[x.length-1];const A=r===0?S.x:S.y;A>=e&&A<=i&&v.push(S),v.length&&(S=v[v.length-1],v[0].x===S.x&&v[0].y===S.y||v.push(v[0]),m.push(v))}m.length&&l.push(m)}return l}function f_(n,e){const i=ng(cm(n),cm([e]),0);return i==null?[]:Su(i)}function Ty(n,e){let r=cm(n,65536);const l=[];for(;e.valid();e.next()){const[h,f]=e.get(),m=h.x*65536,x=h.y*65536,v=f.x*65536,S=f.y*65536,A=v-m,M=S-x,R=Math.hypot(A,M);if(R===0)continue;const D=Math.trunc(M/R*3),U=-Math.trunc(A/R*3);l.push([[[m,x],[v,S],[v+D,S+U],[m+D,x+U],[m,x]]])}return l.length>0&&(r=ng(r,l,2)),Su(r,1/65536,128)}function cm(n,e=1){return[n.map(i=>i.map(r=>[r.x*e,r.y*e]))]}function Su(n,e=1,i){return n.map(r=>r.map((l,h)=>{const f=l.map(m=>{let x=m[0],v=m[1];return i&&(x=Math.round(x/i)*i,v=Math.round(v/i)*i),new _t(x*e,v*e)._round()});return h>0&&f.reverse(),f}))}class Lc{constructor(e,i){this.layoutVertexArray=new Xl,this.indexArray=new Lr,this.lineIndexArray=new $a,this.triangleSegments=new kn,this.lineSegments=new kn,this.programConfigurations=new I(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new eo)}update(e,i,r,l,h,f,m,x){this.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m,x)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Kx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,dy.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,r,l,h,f,m){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,l,h,f,void 0,m)}}class Oc{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new Lc(e,!1),this.elevationBufferData=new Lc(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,l){}populate(e,i,r,l){this.hasPattern=r_("fill",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("fill-sort-key"),f=[];for(const{feature:m,id:x,index:v,sourceLayerIndex:S}of e){const A=this.layers[0]._featureFilter.needGeometry,M=Ri(m,A);if(!this.layers[0]._featureFilter.filter(new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),M,r))continue;const R=h?h.evaluate(M,{},r,i.availableImages):void 0,D={id:x,properties:m.properties,type:m.type,sourceLayerIndex:S,index:v,geometry:A?M.geometry:fi(m,r,l),patterns:{},sortKey:R};f.push(D)}h&&f.sort((m,x)=>m.sortKey-x.sortKey);for(const m of f){const{geometry:x,index:v,sourceLayerIndex:S}=m;if(this.hasPattern){const A=o_("fill",this.layers,m,this.zoom,this.pixelRatio,i);this.patternFeatures.push(A)}else this.addFeature(m,x,v,r,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[v].feature,x,v,S,this.index)}}update(e,i,r,l,h,f,m){this.bufferData.update(e,i,r,l,h,f,m,this.worldview),this.elevationBufferData.update(e,i,r,l,h,f,m,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,r,l,h,f,m,this.worldview)}addFeatures(e,i,r,l,h,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,r,l,f,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,r,l,h,f=[],m,x){const v=am(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,v,l,r,x):this.addGeometry(v,this.bufferData),this.bufferData.populatePaintArrays(e,r,h,f,l,m,this.worldview),this.elevationBufferData.populatePaintArrays(e,r,h,f,l,m,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,r,l,h){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,r,l,h,this.worldview))}addElevatedRoadFeature(e,i,r,l,h){const f=new Array,m=go.getElevationFeature(e,h);if(!m)return void this.addGeometry(i,this.bufferData);{const v=this.clipPolygonsToTile(i,1);v.length>0&&f.push({polygons:v,elevationFeature:m,elevationTileID:r})}const x={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},r),featureIndex:l};for(const v of f)if(v.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new $o(v.elevationTileID,this.layers,this.zoom,this.lut));const A=v.elevationFeature.isTunnel();let M=0;e.properties.hasOwnProperty(Di)&&(M=+e.properties[Di]),this.elevatedStructures.addPortalCandidates(v.elevationFeature.id,v.polygons,A,v.elevationFeature,M)}v.elevationFeature.constantHeight==null&&(v.polygons=this.prepareElevatedPolygons(v.polygons,v.elevationFeature,v.elevationTileID));const S=new Pa(r,v.elevationTileID);this.addElevatedGeometry(v.polygons,S,v.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,l,x)}}addElevatedGeometry(e,i,r,l,h,f){const m={elevation:r,elevationSampler:i,bias:l,index:h,featureInfo:f},[x,v]=this.addGeometry(e,this.elevationBufferData,m);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:x,max:v}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,x),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,v))}addGeometry(e,i,r){let l=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,f=null;r&&(f=r.elevationSampler.constantElevation(r.elevation,r.bias),f!=null&&(l=f,h=f));const m=(x,v,S)=>{if(r!=null)if(v.push(x),f!=null)i.elevatedLayoutVertexArray.emplaceBack(f),S.push(f);else{const A=r.elevationSampler.pointElevation(x,r.elevation,r.bias);i.elevatedLayoutVertexArray.emplaceBack(A),S.push(A),l=Math.min(l,A),h=Math.max(h,A)}};for(const x of e){let v=0;for(const Y of x)v+=Y.length;const S=i.triangleSegments.prepareSegment(v,i.layoutVertexArray,i.indexArray),A=S.vertexLength,M=[],R=[],D=[],U=[],G=[],V=i.layoutVertexArray.length;for(const Y of x){if(Y.length===0)continue;Y!==x[0]&&R.push(M.length/2);const Q=i.lineSegments.prepareSegment(Y.length,i.layoutVertexArray,i.lineIndexArray),le=Q.vertexLength;r&&G.push(i.layoutVertexArray.length-V),m(Y[0],D,U),i.layoutVertexArray.emplaceBack(Y[0].x,Y[0].y),i.lineIndexArray.emplaceBack(le+Y.length-1,le),M.push(Y[0].x),M.push(Y[0].y);for(let ae=1;ae<Y.length;ae++)m(Y[ae],D,U),i.layoutVertexArray.emplaceBack(Y[ae].x,Y[ae].y),i.lineIndexArray.emplaceBack(le+ae-1,le+ae),M.push(Y[ae].x),M.push(Y[ae].y);Q.vertexLength+=Y.length,Q.primitiveLength+=Y.length}const Z=qs(M,R);for(let Y=0;Y<Z.length;Y+=3)i.indexArray.emplaceBack(A+Z[Y],A+Z[Y+1],A+Z[Y+2]);if(Z.length>0&&r&&this.elevationMode==="hd-road-base"){const Y=r.elevation.isTunnel(),Q=r.elevation.safeArea,le=this.elevatedStructures.addVertices(D,U);this.elevatedStructures.addTriangles(Z,le,Y);const ae=G.length;if(ae>0){for(let ge=0;ge<ae-1;ge++)this.elevatedStructures.addRenderableRing(r.index,G[ge]+le,G[ge+1]-G[ge],Y,Q,r.featureInfo);this.elevatedStructures.addRenderableRing(r.index,G[ae-1]+le,D.length-G[ae-1],Y,Q,r.featureInfo)}}S.vertexLength+=v,S.primitiveLength+=Z.length/3}return[l,h]}prepareElevatedPolygons(e,i,r){const l=1/Et(r),h=[];for(const f of e){const m=Ty(f,new ga(i,l));h.push(...m)}return h}clipPolygonsToTile(e,i){const r=-i,l=-i,h=Lt+i,f=Lt+i;let m=0;const x=[],v=[];for(;m<e.length;m++){const M=e[m],R=Ms(M);(R.min.x>=r&&R.max.x<=h&&R.min.y>=l&&R.max.y<=f?x:v).push(M)}if(x.length===e.length)return e;const S=[new _t(r,l),new _t(h,l),new _t(h,f),new _t(r,f),new _t(r,l)],A=x;for(const M of v)A.push(...f_(M,S));return A}}let qf,Zf,Eu,Sy;zt(Oc,"FillBucket",{omit:["layers","patternFeatures"]}),zt(Lc,"FillBufferData"),zt($o,"ElevatedStructures");class um{constructor(e,i,r,l){if(this.triangleCount=i.length/3,this.min=new _t(0,0),this.max=new _t(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[h,f]=[e[0].clone(),e[0].clone()];for(let A=1;A<e.length;++A){const M=e[A];h.x=Math.min(h.x,M.x),h.y=Math.min(h.y,M.y),f.x=Math.max(f.x,M.x),f.y=Math.max(f.y,M.y)}if(l){const A=Math.ceil(Math.max(f.x-h.x,f.y-h.y)/l);r=Math.max(r,A)}if(r===0)return;this.min=h,this.max=f;const m=this.max.sub(this.min);m.x=Math.max(m.x,1),m.y=Math.max(m.y,1);const x=Math.max(m.x,m.y)/r;this.cellsX=Math.max(1,Math.ceil(m.x/x)),this.cellsY=Math.max(1,Math.ceil(m.y/x)),this.xScale=1/x,this.yScale=1/x;const v=[];for(let A=0;A<this.triangleCount;A++){const M=e[i[3*A+0]].sub(this.min),R=e[i[3*A+1]].sub(this.min),D=e[i[3*A+2]].sub(this.min),U=_s(Math.floor(Math.min(M.x,R.x,D.x)),this.xScale,this.cellsX),G=_s(Math.floor(Math.max(M.x,R.x,D.x)),this.xScale,this.cellsX),V=_s(Math.floor(Math.min(M.y,R.y,D.y)),this.yScale,this.cellsY),Z=_s(Math.floor(Math.max(M.y,R.y,D.y)),this.yScale,this.cellsY),Y=new _t(0,0),Q=new _t(0,0),le=new _t(0,0),ae=new _t(0,0);for(let ge=V;ge<=Z;++ge){Y.y=Q.y=ge*x,le.y=ae.y=(ge+1)*x;for(let _e=U;_e<=G;++_e)Y.x=le.x=_e*x,Q.x=ae.x=(_e+1)*x,(Ln(M,R,D,Y,Q,ae)||Ln(M,R,D,Y,ae,le))&&v.push({cellIdx:ge*this.cellsX+_e,triIdx:A})}}if(v.length===0)return;v.sort((A,M)=>A.cellIdx-M.cellIdx||A.triIdx-M.triIdx);let S=0;for(;S<v.length;){const A=v[S].cellIdx,M={start:this.payload.length,len:0};for(;S<v.length&&v[S].cellIdx===A;)++M.len,this.payload.push(v[S++].triIdx);this.cells[A]=M}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const r=_s(e.x-this.min.x,this.xScale,this.cellsX),l=_s(e.y-this.min.y,this.yScale,this.cellsY),h=this.cells[l*this.cellsX+r];if(h){this._lazyInitLookup();for(let f=0;f<h.len;f++){const m=this.payload[h.start+f],x=Math.floor(m/8),v=1<<m%8;if(!(this.lookup[x]&v)&&(this.lookup[x]|=v,i.push(m),i.length===this.triangleCount))return}}}query(e,i,r){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const l=_s(e.x-this.min.x,this.xScale,this.cellsX),h=_s(i.x-this.min.x,this.xScale,this.cellsX),f=_s(e.y-this.min.y,this.yScale,this.cellsY),m=_s(i.y-this.min.y,this.yScale,this.cellsY);for(let x=f;x<=m;x++)for(let v=l;v<=h;v++){const S=this.cells[x*this.cellsX+v];if(S)for(let A=0;A<S.len;A++){const M=this.payload[S.start+A],R=Math.floor(M/8),D=1<<M%8;if(!(this.lookup[R]&D)&&(this.lookup[R]|=D,r.push(M),r.length===this.triangleCount))return}}}}function _s(n,e,i){return Math.max(0,Math.min(i-1,Math.floor(n*e)))}zt(um,"TriangleGridIndex");class Ey{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){for(const r of this.footprints)i.push({footprint:r,id:e})}updateAppearances(e,i,r,l){}populate(e,i,r,l){const h=[];for(const{feature:f,id:m,index:x,sourceLayerIndex:v}of e){const S=this.layers[0]._featureFilter.needGeometry,A=Ri(f,S);if(!this.layers[0]._featureFilter.filter(new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),A,r))continue;const M={id:m,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:S?A.geometry:fi(f,r,l),patterns:{}};h.push(M)}for(const f of h){const{geometry:m,index:x,sourceLayerIndex:v}=f;this.addFeature(f,m,x,r,{},i.availableImages,i.brightness),i.featureIndex.insert(e[x].feature,m,x,v,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,r,l,h,f,m){}destroy(){}addFeature(e,i,r,l,h,f=[],m){for(const x of am(i,2)){const v=[],S=[],A=[],M=new _t(1/0,1/0),R=new _t(-1/0,-1/0);for(const G of x)if(G.length!==0){G!==x[0]&&A.push(S.length/2);for(let V=0;V<G.length;V++)S.push(G[V].x),S.push(G[V].y),v.push(G[V]),M.x=Math.min(M.x,G[V].x),M.y=Math.min(M.y,G[V].y),R.x=Math.max(R.x,G[V].x),R.y=Math.max(R.y,G[V].y)}const D=qs(S,A),U=new um(v,D,8,256);this.footprints.push({vertices:v,indices:D,grid:U,min:M,max:R})}}}zt(Ey,"ClipBucket",{omit:["layers"]});const Ay=Gi([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),rg=Gi([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),My=Gi([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),r0=Gi([{name:"a_centroid_pos",components:2,type:"Uint16"}]),og=Gi([{name:"a_join_normal_inside",components:3,type:"Int16"}]),ag=Gi([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Cy=Gi([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:$f}=Ay,Xf=Number.MAX_SAFE_INTEGER,p_=Xf-1;function hm(n,e,i,r){return n.order<e||n.order===Xf||!(n.clipMask&i)||(function(l,h){return h.length!==0&&h.find(f=>f===l)===void 0})(r,n.clipScope)}function dm(n,e){return n.x-e.x||n.y-e.y}function Iy(n,e){return dm(n.min,e.min)===0&&dm(n.max,e.max)===0}function Wf(n,e){return!(n.min.x>e.max.x||n.max.x<e.min.x||n.min.y>e.max.y||n.max.y<e.min.y)}function s(n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(n[i].sourceId!==e[i].sourceId||!Iy(n[i],e[i])||n[i].order!==e[i].order||n[i].clipMask!==e[i].clipMask||!aa(n[i].clipScope,e[i].clipScope))return!1;return!0}function d(n,e,i){const r=1/Lt,l=1/(1<<i.canonical.z),h=(e.x*r+i.canonical.x)*l+i.wrap,f=(e.y*r+i.canonical.y)*l;return{min:new _t((n.x*r+i.canonical.x)*l+i.wrap,(n.y*r+i.canonical.y)*l),max:new _t(h,f)}}function _(n,e,i){const r=1<<i.canonical.z,l=((e.x-i.wrap)*r-i.canonical.x)*Lt,h=(e.y*r-i.canonical.y)*Lt;return{min:new _t(((n.x-i.wrap)*r-i.canonical.x)*Lt,(n.y*r-i.canonical.y)*Lt),max:new _t(l,h)}}function w(n,e,i,r,l,h,f){const m=n.indices,x=n.vertices,v=[];for(let S=r;S<r+l;S+=3){const A=e[i[S+0]+h],M=e[i[S+1]+h],R=e[i[S+2]+h],D=Math.min(A.x,M.x,R.x),U=Math.max(A.x,M.x,R.x),G=Math.min(A.y,M.y,R.y),V=Math.max(A.y,M.y,R.y);v.length=0,n.grid.query(new _t(D,G),new _t(U,V),v);for(let Z=0;Z<v.length;Z++){const Y=v[Z];if(Ln(x[m[3*Y+0]],x[m[3*Y+1]],x[m[3*Y+2]],A,M,R,f))return!0}}return!1}function z(n,e,i,r){if(!n||!i)return!1;let l=n.vertices;if(!e.canonical.equals(r.canonical)||e.wrap!==r.wrap){if(i.vertices.length<n.vertices.length)return z(i,r,n,e);const h=e.canonical,f=r.canonical,m=Math.pow(2,f.z-h.z);l=n.vertices.map(x=>new _t((x.x+h.x*Lt)*m-f.x*Lt,(x.y+h.y*Lt)*m-f.y*Lt))}return w(i,l,n.indices,0,n.indices.length,0,0)}function O(n,e,i,r){const l=Math.pow(2,r.z-i.z);return new _t((n+i.x*Lt)*l-r.x*Lt,(e+i.y*Lt)*l-r.y*Lt)}function J(n,e){const i=[];e.grid.queryPoint(n,i);const r=e.indices,l=e.vertices;for(let h=0;h<i.length;h++){const f=i[h];if(ya([l[r[3*f+0]],l[r[3*f+1]],l[r[3*f+2]]],n))return!0}return!1}const ve=[new _t(0,0),new _t(Lt,0),new _t(Lt,Lt),new _t(0,Lt)];function Xe(n,e){const i=[];let r=[];if(!e||n.length<2)return[n];if(n.length===2)return Hs(n[0],n[1],ve)?[n]:[];for(let l=0;l<n.length+2;l++){const h=n[l%n.length],f=n[(l+1)%n.length],m=Hs(l===0?n[n.length-1]:n[(l-1)%n.length],h,ve),x=Hs(h,f,ve),v=m||x;v&&r.push(h),v&&x||r.length>0&&(r.length>1&&i.push(r),r=[])}return r.length>1&&i.push(r),i}const Pt=Hi.types,Xt=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Jt=["fill-extrusion-flood-light-ground-radius"],Ot=Math.pow(2,13),jt=Math.pow(2,15)-1,Fi=new _t(0,1),Qi=2147483648;function hr(n,e,i,r,l,h,f,m){n.emplaceBack((e<<1)+f,(i<<1)+h,(Math.floor(r*Ot)<<1)+l,Math.round(m))}function xt(n,e,i){n.emplaceBack(e.x*Lt,e.y*Lt,i?1:0)}function et(n,e,i,r,l,h){n.emplaceBack(e.x,e.y,(i.x<<1)+r,(i.y<<1)+l,h)}function Rt(n,e,i){n.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Kt{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class nn{constructor(){this.centroidXY=new _t(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new _t(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new _t(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new _t(this.max.x-this.min.x,this.max.y-this.min.y)}}class er{constructor(){this.acc=new _t(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,r){this.accCount++,this.acc._add(i);let l=!!this.borders;i.x<e.min.x?(e.min.x=i.x,l=!0):i.x>e.max.x&&(e.max.x=i.x,l=!0),i.y<e.min.y?(e.min.y=i.y,l=!0):i.y>e.max.y&&(e.max.y=i.y,l=!0),((i.x===0||i.x===Lt)&&i.x===r.x)!=((i.y===0||i.y===Lt)&&i.y===r.y)&&this.processBorderOverlap(i,r),l&&this.checkBorderIntersection(i,r)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,mi(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Lt!=e.x>Lt&&this.addBorderIntersection(1,mi(i.y,e.y,(Lt-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,mi(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Lt!=e.y>Lt&&this.addBorderIntersection(3,mi(i.x,e.x,(Lt-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[e];i<r[0]&&(r[0]=i),i>r[1]&&(r[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const r=e.x===0?0:1;this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,e.y)}else{const r=e.y===0?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,e.x)}}centroid(){return this.accCount===0?new _t(0,0):new _t(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function qi(n,e){const i=n.add(e)._unit(),r=he(n.x*i.x+n.y*i.y,-1,1);var l,h,f;return f=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(f)))/4*jt*((l=n).x*(h=e).y-l.y*h.x<0?-1:1)}const In=[n=>n.x<0,n=>n.x>Lt,n=>n.y<0,n=>n.y>Lt];function Gn(n,e,i,r){const l=[4];if(r===0)return l;i._mult(r);const h=n.sub(i),f=e.sub(i),m=[n,e,h,f];for(let x=0;x<4;x++)for(const v of m)if(In[x](v)){l.push(x);break}return l}class Qn{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new Hr,this.indexArray=new Lr,this.programConfigurations=new I(e.layers,{zoom:e.zoom,lut:e.lut},i=>Jt.includes(i)),this._segments=new kn,this.hiddenByLandmarkVertexArray=new zd,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new kn}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,r,l=!1){const h=e.length;if(h>2){let f=Math.max(0,this._segments.get().length-1);const m=this._segments._prepareSegment(4*h,this.vertexArray.length,2*this._segmentToGroundQuads[f].length);let x;f!==this._segments.get().length-1&&(f++,this._segmentToGroundQuads[f]=[],this._segmentToRegionTriCounts[f]=[0,0,0,0,0]);{const v=e[0],S=e[1];x=qi(v.sub(e[h-1])._perp()._unit(),S.sub(v)._perp()._unit())}for(let v=0;v<h;v++){const S=v===h-1?0:v+1,A=e[v],M=e[S],R=e[S===h-1?0:S+1],D=M.sub(A)._perp()._unit(),U=qi(D,R.sub(M)._perp()._unit()),G=x,V=U;if(o0(A,M,i)||l&&p1(A,i)&&p1(M,i)){x=U;continue}const Z=m.vertexLength;et(this.vertexArray,A,M,1,1,G),et(this.vertexArray,A,M,1,0,G),et(this.vertexArray,A,M,0,1,V),et(this.vertexArray,A,M,0,0,V),m.vertexLength+=4;const Y=Gn(A,M,D,r);for(const Q of Y)this._segmentToGroundQuads[f].push({id:Z,region:Q}),this._segmentToRegionTriCounts[f][Q]+=2,m.primitiveLength+=2;x=U}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let r=0;r<i;r++)this._segmentToGroundQuads[r].sort((l,h)=>l.region-h.region);for(let r=0;r<i;r++){const l=this._segmentToGroundQuads[r],h=e[r],f=this._segmentToRegionTriCounts[r];f.reduce((x,v)=>x+v,0);let m=0;for(let x=0;x<=4;x++){const v=f[x];if(v!==0){let S=this.regionSegments[x];S||(S=this.regionSegments[x]=new kn);const A={vertexOffset:h.vertexOffset,primitiveOffset:h.primitiveOffset+m,vertexLength:h.vertexLength,primitiveLength:v};S.get().push(A)}m+=v}for(let x=0;x<l.length;x++){const v=l[x].id;this.indexArray.emplaceBack(v,v+1,v+3),this.indexArray.emplaceBack(v,v+3,v+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,r,l,h,f,m){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,r,l,h,f,void 0,m)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,rg.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,My.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,r,l,h,f,m,x){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,r,l,h,f,m,x)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Qi))}updateHiddenByLandmarkRange(e,i,r){if(!this.hasData())return;const l=i+e;if(i!==0){for(let h=e;h<l;++h)this.hiddenByLandmarkVertexArray.emplace(h,r?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,ag.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class ec{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Lr,this.footprintVertices=new Xl,this.footprintSegments=[],this.layoutVertexArray=new ml,this.centroidVertexArray=new Yl,this.wallVertexArray=new jp,this.indexArray=new Lr,this.programConfigurations=new I(e.layers,{zoom:e.zoom,lut:e.lut},i=>Xt.includes(i)),this.segments=new kn,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Qn(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,l){}populate(e,i,r,l){this.features=[],this.hasPattern=r_("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Et(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:h,id:f,index:m,sourceLayerIndex:x}of e){const v=this.layers[0]._featureFilter.needGeometry,S=Ri(h,v);if(!this.layers[0]._featureFilter.filter(new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),S,r))continue;const A={id:f,sourceLayerIndex:x,index:m,geometry:v?S.geometry:fi(h,r,l),properties:h.properties,type:h.type,patterns:{}},M=this.layoutVertexArray.length,R=Pt[A.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:h.id,feature:o_("fill-extrusion",this.layers,A,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const D of A.geometry)for(const U of Xe(D,R))this.addFeature(h.id,A,[U],m,r,{},i.availableImages,l,i.brightness);else this.addFeature(h.id,A,A.geometry,m,r,{},i.availableImages,l,i.brightness);i.featureIndex.insert(h,A.geometry,m,x,this.index,M)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,r,l,h,f){for(const{featureId:m,feature:x}of this.features){const v=Pt[x.type]==="Polygon",{geometry:S}=x;if(this.wallMode)for(const A of S)for(const M of Xe(A,v))this.addFeature(m,x,[M],x.index,i,r,l,h,f);else this.addFeature(m,x,S,x.index,i,r,l,h,f)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,r,l,h,f,m){this.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m,this.worldview),this.groundEffect.update(e,i,h,r,l,f,m,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$f),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,og.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Cy.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,r0.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,r,l,h,f,m,x,v){const S=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,A=[new _t(0,0),new _t(Lt,Lt)],M=x.projection,R=M.name==="globe",D=this.wallMode||Pt[i.type]==="Polygon",U=new er;U.centroidDataIndex=this.centroidData.length;const G=new nn;G.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(G.buildingId=Number(i.properties.building_id));const V=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},h)<=0,Z=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},h);let Y;if(G.height=Z,G.vertexArrayOffset=this.layoutVertexArray.length,G.groundVertexArrayOffset=this.groundEffect.vertexArray.length,R&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new fu),this.wallMode){if(R)return void vi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(r.length!==1)return;Y=(function(be){const Me=be[0].x===be[be.length-1].x&&be[0].y===be[be.length-1].y;(function(kt){let Nt=0;const ci=kt.length;for(let ii=0;ii<ci;ii++)Nt+=(kt[(ii+1)%ci].x-kt[ii].x)*(kt[(ii+1)%ci].y+kt[ii].y);return Nt>=0})(be)||(be=be.reverse());const Ze={geometry:[],joinNormals:[],indices:[]},We=[],lt=[],at=[];let st=be.length;for(;st>=2&&be[st-1].equals(be[st-2]);)st--;if(st<(Me?3:2))return Ze;let He,ht,tt,gt,ct,qt=0;for(;qt<st-1&&be[qt].equals(be[qt+1]);)qt++;Me&&(He=be[st-2],ct=be[qt].sub(He)._unit()._perp());for(let kt=qt;kt<st;kt++){if(tt=kt===st-1?Me?be[qt+1]:void 0:be[kt+1],tt&&be[kt].equals(tt))continue;ct&&(gt=ct),He&&(ht=He),He=be[kt],ct=tt?tt.sub(He)._unit()._perp():gt,gt=gt||ct;let Nt=gt.add(ct);Nt.x===0&&Nt.y===0||Nt._unit();const ci=Nt.x*ct.x+Nt.y*ct.y,ii=ci!==0?1/ci:1/0,Gt=gt.x*ct.y-gt.y*ct.x>0;let Ei="miter";const Zi=2;Ei==="miter"&&ii>Zi&&(Ei="bevel"),Ei==="bevel"&&(ii>100&&(Ei="flipbevel"),ii<Zi&&(Ei="miter"));const fn=(Ui,En,on,Ar)=>{const sn=new _t(Ui.x,Ui.y),Tn=new _t(Ui.x,Ui.y);sn.x+=En.x*Ar,sn.y+=En.y*Ar,Tn.x-=En.x*Math.max(on,1),Tn.y-=En.y*Math.max(on,1),at.push(En),We.push(sn),lt.push(Tn)};if(Ei==="miter")Nt._mult(ii),fn(He,Nt,0,0);else if(Ei==="flipbevel")Nt=ct.mult(-1),fn(He,Nt,0,0),fn(He,Nt.mult(-1),0,0);else{const Ui=-Math.sqrt(ii*ii-1),En=Gt?Ui:0,on=Gt?0:Ui;ht&&fn(He,gt,En,on),tt&&fn(He,ct,En,on)}}Ze.geometry=[...We,...lt.reverse(),We[0]],Ze.joinNormals=[...at,...at.reverse(),at[at.length-1]];const $t=Ze.geometry.length-1;for(let kt=0;kt<$t/2;kt++)if(kt+1<$t/2){let Nt=kt,ci=kt+1,ii=$t-1-kt,Gt=$t-2-kt;Nt=Nt===0?$t-1:Nt-1,ci=ci===0?$t-1:ci-1,ii=ii===0?$t-1:ii-1,Gt=Gt===0?$t-1:Gt-1,Ze.indices.push(ii),Ze.indices.push(ci),Ze.indices.push(Nt),Ze.indices.push(ii),Ze.indices.push(Gt),Ze.indices.push(ci)}return Ze})(r[0]),r=[Y.geometry]}const Q=(be,Me)=>be<(Me.length-1)/2||be===Me.length-1,le=this.wallMode?[r]:am(r,500);for(let be=le.length-1;be>=0;be--){const Me=le[be];(Me.length===0||sE(Me[0]))&&le.splice(be,1)}let ae;if(R)ae=y1(le,A,h);else{ae=[];for(const be of le)ae.push({polygon:be,bounds:A})}const ge=D?this.edgeRadius:0,_e=ge>0&&this.zoom<17,pe=(be,Me)=>{if(be.length===0)return!1;const Ye=be[be.length-1];return Me.x===Ye.x&&Me.y===Ye.y};for(const{polygon:be,bounds:Me}of ae){let Ye=0,Ze=0;for(const st of be)D&&!st[0].equals(st[st.length-1])&&st.push(st[0]),Ze+=D?st.length-1:st.length;const We=this.segments.prepareSegment((D?5:4)*Ze,this.layoutVertexArray,this.indexArray);G.footprintSegIdx<0&&(G.footprintSegIdx=this.footprintSegments.length),G.polygonSegIdx<0&&(G.polygonSegIdx=this.polygonSegments.length);const lt={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},at=new Kt;if(at.vertexOffset=this.footprintVertices.length,at.indexOffset=3*this.footprintIndices.length,at.ringIndices=[],D){const st=[],He=[];Ye=We.vertexLength;for(let tt=0;tt<be.length;tt++){const gt=be[tt];gt.length&&tt!==0&&He.push(st.length/2);const ct=[];let qt,$t;qt=gt[1].sub(gt[0])._perp()._unit(),at.ringIndices.push(gt.length-1);for(let kt=1;kt<gt.length;kt++){const Nt=gt[kt],ci=gt[kt===gt.length-1?1:kt+1],ii=Nt.clone();if(ge){$t=ci.sub(Nt)._perp()._unit();const Gt=qt.add($t)._unit(),Ei=ge*Math.min(4,1/(qt.x*Gt.x+qt.y*Gt.y));ii.x+=Ei*Gt.x,ii.y+=Ei*Gt.y,ii.x=Math.round(ii.x),ii.y=Math.round(ii.y),qt=$t}if(!V||ge!==0&&!_e||pe(ct,ii)||ct.push(ii),hr(this.layoutVertexArray,ii.x,ii.y,0,0,1,1,0),this.wallMode){const Gt=Q(kt,gt);xt(this.wallVertexArray,Y.joinNormals[kt],!Gt)}We.vertexLength++,this.footprintVertices.emplaceBack(Nt.x,Nt.y),st.push(Nt.x,Nt.y),R&&Rt(this.layoutVertexExtArray,M.projectTilePoint(ii.x,ii.y,h),M.upVector(h,ii.x,ii.y))}V&&(ge===0||_e)&&(ct.length!==0&&pe(ct,ct[0])&&ct.pop(),this.groundEffect.addData(ct,Me,S))}const ht=this.wallMode?Y.indices:qs(st,He);for(let tt=0;tt<ht.length;tt+=3)this.footprintIndices.emplaceBack(at.vertexOffset+ht[tt+0],at.vertexOffset+ht[tt+1],at.vertexOffset+ht[tt+2]),this.indexArray.emplaceBack(Ye+ht[tt],Ye+ht[tt+2],Ye+ht[tt+1]),We.primitiveLength++;at.indexCount+=ht.length,at.vertexCount+=this.footprintVertices.length-at.vertexOffset}for(let st=0;st<be.length;st++){const He=be[st];U.startRing(G,He[0]);let ht=He.length>4&&m1(He[He.length-2],He[0],He[1]),tt=ge?aE(He[He.length-2],He[0],He[1],ge):0;const gt=[];let ct,qt,$t;qt=He[1].sub(He[0])._perp()._unit();let kt=!0;for(let Nt=1,ci=0;Nt<He.length;Nt++){let ii=He[Nt-1],Gt=He[Nt];const Ei=He[Nt===He.length-1?1:Nt+1];if(U.appendEdge(G,Gt,ii),o0(Gt,ii,Me)){ge&&(qt=Ei.sub(Gt)._perp()._unit(),kt=!kt);continue}const Zi=Gt.sub(ii)._perp(),fn=Zi.x/(Math.abs(Zi.x)+Math.abs(Zi.y)),Ui=Zi.y>0?1:0,En=ii.dist(Gt);if(ci+En>32768&&(ci=0),ge){$t=Ei.sub(Gt)._perp()._unit();let Tn=f1(ii,Gt,Ei,Ry(qt,$t),ge);isNaN(Tn)&&(Tn=0);const $n=Gt.sub(ii)._unit();ii=ii.add($n.mult(tt))._round(),Gt=Gt.add($n.mult(-Tn))._round(),tt=Tn,qt=$t,V&&this.zoom>=17&&(pe(gt,ii)||gt.push(ii),pe(gt,Gt)||gt.push(Gt))}const on=We.vertexLength,Ar=He.length>4&&m1(ii,Gt,Ei);let sn=g1(ci,ht,kt);if(hr(this.layoutVertexArray,ii.x,ii.y,fn,Ui,0,0,sn),hr(this.layoutVertexArray,ii.x,ii.y,fn,Ui,0,1,sn),this.wallMode){const Tn=Q(Nt-1,He),$n=Y.joinNormals[Nt-1];xt(this.wallVertexArray,$n,Tn),xt(this.wallVertexArray,$n,Tn)}if(ci+=En,sn=g1(ci,Ar,!kt),ht=Ar,hr(this.layoutVertexArray,Gt.x,Gt.y,fn,Ui,0,0,sn),hr(this.layoutVertexArray,Gt.x,Gt.y,fn,Ui,0,1,sn),this.wallMode){const Tn=Q(Nt,He),$n=Y.joinNormals[Nt];xt(this.wallVertexArray,$n,Tn),xt(this.wallVertexArray,$n,Tn)}if(We.vertexLength+=4,this.indexArray.emplaceBack(on+0,on+1,on+2),this.indexArray.emplaceBack(on+1,on+3,on+2),We.primitiveLength+=2,ge){const Tn=Ye+(Nt===1?He.length-2:Nt-2),$n=Nt===1?Ye:Tn+1;if(this.indexArray.emplaceBack(on+1,Tn,on+3),this.indexArray.emplaceBack(Tn,$n,on+3),We.primitiveLength+=2,ct===void 0&&(ct=on),!o0(Ei,He[Nt],Me)){const tr=Nt===He.length-1?ct:We.vertexLength;this.indexArray.emplaceBack(on+2,on+3,tr),this.indexArray.emplaceBack(on+3,tr+1,tr),this.indexArray.emplaceBack(on+3,$n,tr+1),We.primitiveLength+=3}kt=!kt}if(R){const Tn=this.layoutVertexExtArray,$n=M.projectTilePoint(ii.x,ii.y,h),tr=M.projectTilePoint(Gt.x,Gt.y,h),ir=M.upVector(h,ii.x,ii.y),Mr=M.upVector(h,Gt.x,Gt.y);Rt(Tn,$n,ir),Rt(Tn,$n,ir),Rt(Tn,tr,Mr),Rt(Tn,tr,Mr)}}D&&(Ye+=He.length-1),V&&ge&&this.zoom>=17&&(gt.length!==0&&pe(gt,gt[0])&&gt.pop(),this.groundEffect.addData(gt,Me,S,ge>0))}this.footprintSegments.push(at),lt.triangleCount=this.indexArray.length-lt.triangleArrayOffset,this.polygonSegments.push(lt),++G.footprintSegLen,++G.polygonSegLen}if(G.vertexCount=this.layoutVertexArray.length-G.vertexArrayOffset,G.groundVertexCount=this.groundEffect.vertexArray.length-G.groundVertexArrayOffset,G.vertexCount!==0){if(G.centroidXY=U.borders?Fi:this.encodeCentroid(U,G),this.centroidData.push(G),U.borders){this.featuresOnBorder.push(U);const be=this.featuresOnBorder.length-1;for(let Me=0;Me<U.borders.length;Me++)U.borders[Me][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Me].push(be)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,l,f,m,h,v,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,l,f,m,h,v,this.worldview),this.maxHeight=Math.max(this.maxHeight,Z)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,r)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){const e=[];for(let m=0;m<this.centroidData.length;m++){const x=this.centroidData[m],v=+(x.min.y+x.max.y>Lt),S=2*v+(+(x.min.x+x.max.x>Lt)^v);for(let A=0;A<x.polygonSegLen;A++){const M=x.polygonSegIdx+A;e.push({centroidIdx:m,subtile:S,polygonSegmentIdx:M,triangleSegmentIdx:this.polygonSegments[M].triangleSegIdx})}}const i=new Lr;e.sort((m,x)=>m.triangleSegmentIdx===x.triangleSegmentIdx?m.subtile-x.subtile:m.triangleSegmentIdx-x.triangleSegmentIdx);let r=0,l=0,h=0;for(const m of e){if(m.triangleSegmentIdx!==r)break;h++}const f=e.length;for(;l!==e.length;){r=e[l].triangleSegmentIdx;let m=0,x=l,v=l;for(let S=x;S<h&&e[S].subtile===m;S++)v++;for(;x!==h;){const S=e[x];m=S.subtile;const A=this.centroidData[S.centroidIdx].min.clone(),M=this.centroidData[S.centroidIdx].max.clone(),R={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let D=x;D<v;D++){const U=e[D],G=this.polygonSegments[U.polygonSegmentIdx],V=this.centroidData[U.centroidIdx].min,Z=this.centroidData[U.centroidIdx].max,Y=this.indexArray.uint16;for(let Q=G.triangleArrayOffset;Q<G.triangleArrayOffset+G.triangleCount;Q++)i.emplaceBack(Y[3*Q],Y[3*Q+1],Y[3*Q+2]);R.primitiveLength+=G.triangleCount,A.x=Math.min(A.x,V.x),A.y=Math.min(A.y,V.y),M.x=Math.max(M.x,Z.x),M.y=Math.max(M.y,Z.y)}R.primitiveLength>0&&this.triangleSubSegments.push({segment:R,min:A,max:M}),x=v;for(let D=x;D<h&&e[D].subtile===e[x].subtile;D++)v++}l=h;for(let S=l;S<f&&e[S].triangleSegmentIdx===e[l].triangleSegmentIdx;S++)h++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,r){const l=new kn;if(this.wallMode){for(const U of this.triangleSubSegments)l.segments.push(U.segment);return l}let h=0,f=0;const m=1<<e.canonical.z;if(i){const U=i.getMinMaxForTile(e);U&&(h=U.min,f=U.max)}f+=this.maxHeight;const x=e.toUnwrapped();let v;const S=[x.canonical.x/m+x.wrap,x.canonical.y/m],A=[(x.canonical.x+1)/m+x.wrap,(x.canonical.y+1)/m],M=(U,G,V)=>[U[0]*(1-V[0])+G[0]*V[0],U[1]*(1-V[1])+G[1]*V[1]],R=[],D=[];for(const U of this.triangleSubSegments){R[0]=U.min.x/Lt,R[1]=U.min.y/Lt,D[0]=U.max.x/Lt,D[1]=U.max.y/Lt;const G=M(S,A,R),V=M(S,A,D);if(new hn([G[0],G[1],h],[V[0],V[1],f]).intersectsPrecise(r)===0){v&&(l.segments.push(v),v=void 0);continue}const Z=U.segment;v&&v.vertexOffset!==Z.vertexOffset&&(l.segments.push(v),v=void 0),v?(v.vertexLength+=Z.vertexLength,v.primitiveLength+=Z.primitiveLength):v={vertexOffset:Z.vertexOffset,primitiveLength:Z.primitiveLength,vertexLength:Z.vertexLength,primitiveOffset:Z.primitiveOffset,sortKey:void 0,vaos:{}}}return v&&l.segments.push(v),l}encodeCentroid(e,i){const r=e.centroid(),l=i.span(),h=Math.min(7,Math.round(l.x*this.tileToMeter/10)),f=Math.min(7,Math.round(l.y*this.tileToMeter/10));return new _t(he(r.x,1,8191)<<3|h,he(r.y,1,8191)<<3|f)}encodeBorderCentroid(e){if(!e.borders)return new _t(0,0);const i=e.borders,r=Number.MAX_VALUE;if(i[0][0]!==r||i[1][0]!==r){const l=i[0][0]!==r?0:1;return new _t(6|(i[0][0]!==r?0:65528),(i[l][0]+i[l][1])/2<<3|6)}{const l=i[2][0]!==r?2:3;return new _t((i[l][0]+i[l][1])/2<<3|6,6|(i[2][0]!==r?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,l=e.flags&Qi?Fi:e.centroidXY,h=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==l.y||h!==l.x){for(let f=i;f<r;++f)this.centroidVertexArray.emplace(f,l.x,l.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,r){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped());if(s(this.activeReplacements,l))return;if(this.activeReplacements=l,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const f of this.centroidData)f.flags&=2147483647;const h=[];for(const f of this.activeReplacements){if(f.order<r)continue;const m=Math.max(1,Math.pow(2,f.footprintTileId.canonical.z-e.canonical.z));if(f.footprint.buildingIds)for(const x of this.centroidData)x.flags&Qi||f.min.x>x.max.x||x.min.x>f.max.x||f.min.y>x.max.y||x.min.y>f.max.y||f.footprint.buildingIds.has(x.buildingId)&&(x.flags|=Qi);else for(const x of this.centroidData)if(!(x.flags&Qi||f.min.x>x.max.x||x.min.x>f.max.x||f.min.y>x.max.y||x.min.y>f.max.y))for(let v=0;v<x.footprintSegLen;v++){const S=this.footprintSegments[x.footprintSegIdx+v];if(h.length=0,lE(this.footprintVertices,S.vertexOffset,S.vertexCount,f.footprintTileId.canonical,e.canonical,h),w(f.footprint,h,this.footprintIndices.uint16,S.indexOffset,S.indexCount,-S.vertexOffset,-m)){x.flags|=Qi;break}}}for(const f of this.centroidData)this.writeCentroidToBuffer(f);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,r){let l=!1;for(let h=0;h<r.footprintSegLen;h++){const f=this.footprintSegments[r.footprintSegIdx+h];let m=0;for(const x of f.ringIndices){for(let v=m,S=x+m-1;v<x+m;S=v++){const A=this.footprintVertices.int16[2*(v+f.vertexOffset)+0],M=this.footprintVertices.int16[2*(v+f.vertexOffset)+1],R=this.footprintVertices.int16[2*(S+f.vertexOffset)+1];M>i!=R>i&&e<(this.footprintVertices.int16[2*(S+f.vertexOffset)+0]-A)*(i-M)/(R-M)+A&&(l=!l)}m=x}}return l}getHeightAtTileCoord(e,i){let r=Number.NEGATIVE_INFINITY,l=!0;const h=4*(e+Lt)*Lt+(i+Lt);if(this.partLookup.hasOwnProperty(h)){const f=this.partLookup[h];return f?{height:f.height,hidden:!!(f.flags&Qi)}:void 0}for(const f of this.centroidData)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=r||this.footprintContainsPoint(e,i,f)&&(r=f.height,this.partLookup[h]=f,l=!!(f.flags&Qi));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:l};this.partLookup[h]=void 0}}function Ry(n,e){const i=n.add(e)._unit();return n.x*i.x+n.y*i.y}function aE(n,e,i,r){const l=e.sub(n)._perp()._unit(),h=i.sub(e)._perp()._unit();return f1(n,e,i,Ry(l,h),r)}function f1(n,e,i,r,l){const h=Math.sqrt(1-r*r);return Math.min(n.dist(e)/3,e.dist(i)/3,l*h/r)}function o0(n,e,i){return n.x<i[0].x&&e.x<i[0].x||n.x>i[1].x&&e.x>i[1].x||n.y<i[0].y&&e.y<i[0].y||n.y>i[1].y&&e.y>i[1].y}function p1(n,e){return n.x<e[0].x||n.x>e[1].x||n.y<e[0].y||n.y>e[1].y}function sE(n){return n.every(e=>e.x<=0)||n.every(e=>e.x>=Lt)||n.every(e=>e.y<=0)||n.every(e=>e.y>=Lt)}function m1(n,e,i){if(n.x<0||n.x>=Lt||e.x<0||e.x>=Lt||i.x<0||i.x>=Lt)return!1;const r=i.sub(e),l=r.perp(),h=n.sub(e);return(r.x*h.x+r.y*h.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(h.x*h.x+h.y*h.y))>-.866&&l.x*h.x+l.y*h.y<0}function g1(n,e,i){const r=e?2|n:-3&n;return i?1|r:-2&r}function _1(){const n=Math.PI/32,e=Math.tan(n),i=ye;return i*Math.sqrt(1+2*e*e)-i}function y1(n,e,i){const r=1<<i.z,l=$e(i.x/r),h=$e((i.x+1)/r),f=ot(i.y/r),m=ot((i.y+1)/r);return(function(x,v,S,A,M=0,R){const D=[];if(!x.length||!S||!A)return D;const U=(ae,ge)=>{for(const _e of ae)D.push({polygon:_e,bounds:ge})},G=Math.ceil(Math.log2(S)),V=Math.ceil(Math.log2(A)),Z=G-V,Y=[];for(let ae=0;ae<Math.abs(Z);ae++)Y.push(Z>0?0:1);for(let ae=0;ae<Math.min(G,V);ae++)Y.push(0),Y.push(1);let Q=x;if(Q=Vd(Q,v[0].y-M,v[1].y+M,1),Q=Vd(Q,v[0].x-M,v[1].x+M,0),!Q.length)return D;const le=[];for(Y.length?le.push({polygons:Q,bounds:v,depth:0}):U(Q,v);le.length;){const ae=le.pop(),ge=ae.depth,_e=Y[ge],pe=ae.bounds[0],be=ae.bounds[1],Me=_e===0?pe.x:pe.y,Ye=_e===0?be.x:be.y,Ze=R?R(_e,Me,Ye):.5*(Me+Ye),We=Vd(ae.polygons,Me-M,Ze+M,_e),lt=Vd(ae.polygons,Ze-M,Ye+M,_e);if(We.length){const at=[pe,new _t(_e===0?Ze:be.x,_e===1?Ze:be.y)];Y.length>ge+1?le.push({polygons:We,bounds:at,depth:ge+1}):U(We,at)}if(lt.length){const at=[new _t(_e===0?Ze:pe.x,_e===1?Ze:pe.y),be];Y.length>ge+1?le.push({polygons:lt,bounds:at,depth:ge+1}):U(lt,at)}}return D})(n,e,Math.ceil((h-l)/11.25),Math.ceil((f-m)/11.25),1,(x,v,S)=>{if(x===0)return .5*(v+S);{const A=ot((i.y+v/Lt)/r);return(Be(.5*(ot((i.y+S/Lt)/r)+A))*r-i.y)*Lt}})}function lE(n,e,i,r,l,h){const f=Math.pow(2,r.z-l.z);for(let m=0;m<i;m++){let x=n.int16[2*(m+e)+0],v=n.int16[2*(m+e)+1];x=(x+l.x*Lt)*f-r.x*Lt,v=(v+l.y*Lt)*f-r.y*Lt,h.push(new _t(x,v))}}let x1,v1;zt(ec,"FillExtrusionBucket",{omit:["layers","features"]}),zt(nn,"PartData"),zt(Kt,"FootprintSegment"),zt(er,"BorderCentroidData"),zt(Qn,"GroundEffect");class fm extends _t{constructor(e,i,r){super(e,i),this.z=r}}class b1 extends fm{constructor(e,i,r,l){super(e,i,r),this.w=l}}function w1(n,e,i,r){const l=i==="x"?"y":"x",h=(r-n[i])/(e[i]-n[i]);n[l]=Math.round(n[l]+(e[l]-n[l])*h),n[i]=r,n.hasOwnProperty("z")&&(n.z=mi(n.z,e.z,h)),n.hasOwnProperty("w")&&(n.w=mi(n.w,e.w,h))}function T1(n,e,i,r){const l=i,h=r;for(const f of["x","y"]){let m=n,x=e;m[f]>=x[f]&&(m=e,x=n),m[f]<l&&x[f]>l&&w1(m,x,f,l),m[f]<h&&x[f]>h&&w1(x,m,f,h)}}function zy(n,e,i,r,l,h){const f=[];for(let m=0;m<n.length;m++){const x=n[m];let v;const S=f.length;let A=0;for(let M=0;M<x.length-1;M++){let R=x[M],D=x[M+1],U=0;const G=A;let V,Z;h&&(U=Math.hypot(D.x-R.x,D.y-R.y),A+=U,V=R,Z=D),R.x<e&&D.x<e||(R.x<e?R=new _t(e,R.y+(e-R.x)/(D.x-R.x)*(D.y-R.y))._round():D.x<e&&(D=new _t(e,R.y+(e-R.x)/(D.x-R.x)*(D.y-R.y))._round()),R.y<i&&D.y<i||(R.y<i?R=new _t(R.x+(i-R.y)/(D.y-R.y)*(D.x-R.x),i)._round():D.y<i&&(D=new _t(R.x+(i-R.y)/(D.y-R.y)*(D.x-R.x),i)._round()),R.x>=r&&D.x>=r||(R.x>=r?R=new _t(r,R.y+(r-R.x)/(D.x-R.x)*(D.y-R.y))._round():D.x>=r&&(D=new _t(r,R.y+(r-R.x)/(D.x-R.x)*(D.y-R.y))._round()),R.y>=l&&D.y>=l||(R.y>=l?R=new _t(R.x+(l-R.y)/(D.y-R.y)*(D.x-R.x),l)._round():D.y>=l&&(D=new _t(R.x+(l-R.y)/(D.y-R.y)*(D.x-R.x),l)._round()),v&&R.equals(v[v.length-1])||(v=[R],f.push(v),h&&h.push({progress:{min:G+S1(V,Z,R)*U,max:1},parentIndex:m,prevPoint:V,nextPoint:Z})),v.push(D),h&&(h[h.length-1].progress.max=G+S1(V,Z,D)*U,h[h.length-1].nextPoint=Z)))))}if(h&&A>0)for(let M=S;M<f.length;M++)h[M].progress.min/=A,h[M].progress.max/=A}return f}function cE(n,e,i,r,l){if(n.length<2)return void r.push(n);const h=[];for(;e.valid();){const[v,S]=e.get();for(let A=0;A<n.length-1;A++){const M=n[A],R=n[A+1],D=wh(M,R,v,S);if(D){const[U]=D,G=new _t(mi(M.x,R.x,U),mi(M.y,R.y,U));h.push({t:A+U,distance:0,point:G})}}e.next()}if(h.length===0)return void r.push(n);h.sort((v,S)=>v.t-S.t);let f=0,m=0,x=[];for(r.push(x);f!==n.length;){if(m===h.length){for(;f!==n.length;)x.length!==0&&x[x.length-1].equals(n[f])||x.push(n[f]),f++;break}h[m].t<=f?(x.length!==0&&x[x.length-1].equals(h[m].point)||x.push(h[m].point),Math.trunc(h[m].t),m++):(x.length!==0&&x[x.length-1].equals(n[f])||x.push(n[f]),f++)}}function S1(n,e,i){return n.x!==e.x?(i.x-n.x)/(e.x-n.x):n.y!==e.y?(i.y-n.y)/(e.y-n.y):0}function m_(n,e){return n.x*e.x+n.y*e.y}function E1(n,e){if(n.length===1){let i=0;const r=e[i++];let l;for(;!l||r.equals(l);)if(l=e[i++],!l)return 1/0;for(;i<e.length;i++){const h=e[i],f=n[0],m=l.sub(r),x=h.sub(r),v=f.sub(r),S=m_(m,m),A=m_(m,x),M=m_(x,x),R=m_(v,m),D=m_(v,x),U=S*M-A*A,G=(M*R-A*D)/U,V=(S*D-A*R)/U,Z=r.z*(1-G-V)+l.z*G+h.z*V;if(isFinite(Z))return Z}return 1/0}{let i=1/0;for(const r of e)i=Math.min(i,r.z);return i}}function A1(n,e,i){let r=1/0;Dn(i,e)&&(r=E1(i,e[0]));for(let l=0;l<e.length;l++){const h=e[l],f=n[l];for(let m=0;m<h.length-1;m++){const x=h[m],v=[x,h[m+1],f[m+1],f[m],x];Zn(i,v)&&(r=Math.min(r,E1(i,v)))}}return r!==1/0&&r}function M1(n,e,i,r,l,h,f,m,x,v,S){return n.projection.name==="globe"?(function(A,M,R,D,U,G,V,Z,Y,Q,le){const ae=[],ge=[],_e=A.projection.upVectorScale(le,A.center.lat,A.worldSize).metersToTile,pe=[0,0,0,1],be=[0,0,0,1],Me=(Ze,We,lt,at)=>{Ze[0]=We,Ze[1]=lt,Ze[2]=at,Ze[3]=1},Ye=_1();R>0&&(R+=Ye),D+=Ye;for(const Ze of M){const We=[],lt=[];for(const at of Ze){const st=at.x+U.x,He=at.y+U.y,ht=A.projection.projectTilePoint(st,He,le),tt=A.projection.upVector(le,at.x,at.y);let gt=R,ct=D;if(V){const qt=C1(st,He,R,D,V,Z,Y,Q);gt+=qt.base,ct+=qt.top}R!==0?Me(pe,ht.x+tt[0]*_e*gt,ht.y+tt[1]*_e*gt,ht.z+tt[2]*_e*gt):Me(pe,ht.x,ht.y,ht.z),Me(be,ht.x+tt[0]*_e*ct,ht.y+tt[1]*_e*ct,ht.z+tt[2]*_e*ct),Nn(pe,pe,G),Nn(be,be,G),We.push(new fm(pe[0],pe[1],pe[2])),lt.push(new fm(be[0],be[1],be[2]))}ae.push(We),ge.push(lt)}return[ae,ge]})(n,e,i,r,l,h,f,m,x,v,S):f?(function(A,M,R,D,U,G,V,Z,Y){const Q=[],le=[],ae=[0,0,0,1];for(const ge of A){const _e=[],pe=[];for(const be of ge){const Me=be.x+D.x,Ye=be.y+D.y,Ze=C1(Me,Ye,M,R,G,V,Z,Y);ae[0]=Me,ae[1]=Ye,ae[2]=Ze.base,ae[3]=1,Bo(ae,ae,U),ae[3]=Math.max(ae[3],1e-5);const We=new fm(ae[0]/ae[3],ae[1]/ae[3],ae[2]/ae[3]);ae[0]=Me,ae[1]=Ye,ae[2]=Ze.top,ae[3]=1,Bo(ae,ae,U),ae[3]=Math.max(ae[3],1e-5);const lt=new fm(ae[0]/ae[3],ae[1]/ae[3],ae[2]/ae[3]);_e.push(We),pe.push(lt)}Q.push(_e),le.push(pe)}return[Q,le]})(e,i,r,l,h,f,m,x,v):(function(A,M,R,D,U){const G=[],V=[],Z=U[8]*M,Y=U[9]*M,Q=U[10]*M,le=U[11]*M,ae=U[8]*R,ge=U[9]*R,_e=U[10]*R,pe=U[11]*R;for(const be of A){const Me=[],Ye=[];for(const Ze of be){const We=Ze.x+D.x,lt=Ze.y+D.y,at=U[0]*We+U[4]*lt+U[12],st=U[1]*We+U[5]*lt+U[13],He=U[2]*We+U[6]*lt+U[14],ht=U[3]*We+U[7]*lt+U[15],tt=at+Z,gt=st+Y,ct=He+Q,qt=Math.max(ht+le,1e-5),$t=at+ae,kt=st+ge,Nt=He+_e,ci=Math.max(ht+pe,1e-5);Me.push(new fm(tt/qt,gt/qt,ct/qt)),Ye.push(new fm($t/ci,kt/ci,Nt/ci))}G.push(Me),V.push(Ye)}return[G,V]})(e,i,r,l,h)}function C1(n,e,i,r,l,h,f,m){const x=f*l.getElevationAt(n,e,!0,!0),v=h[0]!==0,S=v?h[1]===0?f*(h[0]/7-450):f*(function(A,M,R){const D=Math.floor(M[0]/8),U=Math.floor(M[1]/8),G=10*(M[0]-8*D),V=10*(M[1]-8*U),Z=A.getElevationAt(D,U,!0,!0),Y=A.getMeterToDEM(R),Q=Math.floor(.5*(G*Y-1)),le=Math.floor(.5*(V*Y-1)),ae=A.tileCoordToPixel(D,U),ge=2*Q+1,_e=2*le+1,pe=(function(lt,at,st,He,ht){return[lt.getElevationAtPixel(at,st,!0),lt.getElevationAtPixel(at+ht,st,!0),lt.getElevationAtPixel(at,st+ht,!0),lt.getElevationAtPixel(at+He,st+ht,!0)]})(A,ae.x-Q,ae.y-le,ge,_e),be=Math.abs(pe[0]-pe[1]),Me=Math.abs(pe[2]-pe[3]),Ye=Math.abs(pe[0]-pe[2])+Math.abs(pe[1]-pe[3]),Ze=Math.min(.25,.5*Y*(be+Me)/ge),We=Math.min(.25,.5*Y*Ye/_e);return Z+Math.max(Ze*G,We*V)})(l,h,m):x;return{base:x+(i===0?-1:i),top:v?Math.max(S+r,x+i+2):x+r}}class uE{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class hE{constructor(){this.tasks={},this.taskQueue=[],Zt(["process"],this),this.invoker=new uE(this.process),this.nextId=0}add(e,i){const r=this.nextId++,l=(function({type:h,isSymbolTile:f,zoom:m}){return m=m||0,h==="message"?0:h!=="maybePrepare"||f?h!=="parseTile"||f?h==="parseTile"&&f?300-m:h==="maybePrepare"&&f?400-m:500:200-m:100-m})(i);if(l===0){try{e()}finally{}return null}return this.tasks[r]={fn:e,metadata:i,priority:l,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(r=>!!this.tasks[r]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let l=0;l<this.taskQueue.length;l++){const h=this.tasks[this.taskQueue[l]];h.priority<i&&(i=h.priority,e=l)}if(e===null)return null;const r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class I1{constructor(e,i,r){this.target=e,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},Zt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
218=new hE}send(e,i,r,l,h=!1,f){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=f,this.callbacks[m]=r);const x=new Set;return this.target.postMessage({id:m,type:e,hasCallback:!!r,targetMapId:l,mustQueue:h,sourceMapId:this.mapId,data:cr(i,x)},x),{cancel:()=>{r&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:l,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const l=this.cancelCallbacks[r];delete this.cancelCallbacks[r],l&&l.cancel()}else if(i.mustQueue||dr(self)){const l=this.callbacks[r],h=this.scheduler.add(()=>this.processTask(r,i),l&&l.metadata||{type:"message"});h&&(this.cancelCallbacks[r]=h)}else this.processTask(r,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(ms(i.error)):r(null,ms(i.data)))}else{const r=new Set,l=i.hasCallback?(f,m)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:f?cr(f):null,data:cr(m,r)},r)}:()=>{},h=ms(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,h,l);else if(this.parent.getWorkerSource){const f=i.type.split("."),{source:m,scope:x}=h;this.parent.getWorkerSource(i.sourceMapId,f[0],m,x)[f[1]](h,l)}else l(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var g_={workerUrl:"",workerClass:null,workerParams:void 0};function dE(n){return g_.workerClass!=null?new g_.workerClass:new self.Worker(g_.workerUrl,Object.assign({name:n},g_.workerParams))}const a0="mapboxgl_preloaded_worker_pool";class pm{constructor(e){this.active={},this.name=e}acquire(e,i=pm.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;){const r=dE(`${this.name||""}WorkerPool: ${e}-${this.workers.length}`);this.workers.push(r)}return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[a0]}numActive(){return Object.keys(this.active).length}}pm.workerCount=2;class sg{constructor(e,i,r="Worker",l=pm.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Mt();const h=this.workerPool.acquire(this.id,l);for(let f=0;f<h.length;f++){const m=new sg.Actor(h[f],i,this.id);m.name=`${r} ${f}`,this.actors.push(m)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,r){Pe(this.actors,(l,h)=>{l.send(e,i,h)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let __,s0;function Dy(){return __||(__=new pm),__}sg.Actor=I1;const l0=4096;class fE{constructor(e){this.module=e,this.memoryStack=this.module.malloc(l0),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>l0?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>l0?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,r){this.module.setFauxFacadeOptions(e?1:0,i?1:0,r)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const m of e){const x=this.createIntArray(m.ringIndices),v=this.createFloatArray(m.coordinates);if(x===-1||v===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(m.id,m.sourceId,m.minHeight,m.height,m.roofType,v,x,m.ringIndices.length-1)}for(const m of i){let x;x=m.entrances?JSON.parse(m.entrances):[];const v=this.createFloatArray(x),S=this.createFloatArray(m.coordinates);if(v===-1||S===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(m.sourceId,m.crossPerc,m.distanceToRoad,v,x.length,S,m.coordinates.length)}if(!this.module.generateMesh()){const m=this.module.getLastError();return this.readStringBuffer(m)}
218const r=this.module.getMeshCount(),l=new Array(r);for(let m=0;m<r;m++){const x=this.module.getPositionsPtr(m),v=this.module.getPositionsLength(m),S=new Float32Array(this.module.heapF32.buffer,x,v),A=this.module.getNormalsPtr(m),M=this.module.getNormalsLength(m),R=new Float32Array(this.module.heapF32.buffer,A,M),D=this.module.getAOPtr(m),U=this.module.getAOLength(m),G=new Float32Array(this.module.heapF32.buffer,D,U),V=this.module.getUVPtr(m),Z=this.module.getUVLength(m),Y=new Float32Array(this.module.heapF32.buffer,V,Z),Q=this.module.getFauxFacadePtr(m),le=this.module.getFauxFacadeLength(m),ae=new Uint8Array(this.module.heapU8.buffer,Q,le),ge=this.module.getIndicesPtr(m),_e=this.module.getIndicesLength(m),pe=new Int16Array(this.module.heap16.buffer,ge,_e),be=this.module.getBuildingPart(m);l[m]={positions:S,normals:R,ao:G,uv:Y,isFauxFacade:ae,indices:pe,buildingPart:be}}const h=this.module.getRingCount(),f=[];for(let m=0;m<h;m++){const x=this.module.getRingPtr(m),v=this.module.getRingLength(m),S=new Float32Array(this.module.heapF32.buffer,x,v);f.push(S)}return{meshes:l,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:f}}}let y_,c0,Au,lg,u0,cg=null,ug=null,R1=null,Py=null;function z1(){return dr(self)&&self.worker.dracoUrl?self.worker.dracoUrl:c0||Fr.DRACO_URL}function D1(){if(dr(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(lg)return lg;const n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return lg=WebAssembly.validate(n)?Fr.MESHOPT_SIMD_URL:Fr.MESHOPT_URL,lg}function pE(){return Py}const P1=5120,L1=5121,O1=5122,B1=5123,k1=5125,F1=5126,Ly={[P1]:Int8Array,[L1]:Uint8Array,[O1]:Int16Array,[B1]:Uint16Array,[k1]:Uint32Array,[F1]:Float32Array},mE={[P1]:"DT_INT8",[L1]:"DT_UINT8",[O1]:"DT_INT16",[B1]:"DT_UINT16",[k1]:"DT_UINT32",[F1]:"DT_FLOAT32"},x_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function N1(n,e,i){const r=i.json.bufferViews.length,l=i.buffers.length;e.bufferView=r,i.json.bufferViews[r]={buffer:l,byteLength:n.byteLength},i.buffers[l]=n}const h0="KHR_draco_mesh_compression";function gE(n,e){const i=n.extensions&&n.extensions[h0];if(!i)return;const r=new Au.Decoder,l=G1(e,i.bufferView),h=new Au.Mesh;if(!r.DecodeArrayToMesh(l,l.byteLength,h))throw new Error("Failed to decode Draco mesh");const f=e.json.accessors[n.indices],m=Ly[f.componentType],x=f.count*m.BYTES_PER_ELEMENT,v=Au._malloc(x);m===Uint16Array?r.GetTrianglesUInt16Array(h,x,v):r.GetTrianglesUInt32Array(h,x,v),N1(Au.memory.buffer.slice(v,v+x),f,e),Au._free(v);for(const S of Object.keys(i.attributes)){const A=r.GetAttributeByUniqueId(h,i.attributes[S]),M=e.json.accessors[n.attributes[S]],R=mE[M.componentType],D=M.count*x_[M.type]*Ly[M.componentType].BYTES_PER_ELEMENT,U=Au._malloc(D);r.GetAttributeDataArrayForAllPoints(h,A,Au[R],D,U),N1(Au.memory.buffer.slice(U,U+D),M,e),Au._free(U)}r.destroy(),h.destroy(),delete n.extensions[h0]}const Oy="EXT_meshopt_compression";function _E(n,e){if(!n.extensions||!n.extensions[Oy])return;
218const i=n.extensions[Oy],r=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),l=new Uint8Array(i.count*i.byteStride);u0.decodeGltfBuffer(l,i.count,i.byteStride,r,i.mode,i.filter),n.buffer=e.buffers.length,n.byteOffset=0,e.buffers[n.buffer]=l.buffer,delete n.extensions[Oy]}const U1=1179937895,V1=new TextDecoder("utf8");function j1(n,e){return new URL(n,e).href}function yE(n,e,i,r){return fetch(j1(n.uri,r)).then(l=>l.arrayBuffer()).then(l=>{e.buffers[i]=l})}function G1(n,e){const i=n.json.bufferViews[e];return new Uint8Array(n.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function xE(n,e,i,r){if(n.uri){const l=j1(n.uri,r);return fetch(l).then(h=>h.blob()).then(h=>createImageBitmap(h)).then(h=>{e.images[i]=h})}if(n.bufferView!==void 0){const l=G1(e,n.bufferView),h=new Blob([l],{type:n.mimeType});return createImageBitmap(h).then(f=>{e.images[i]=f})}}function H1(n,e=0,i){const r={json:null,images:[],buffers:[]};if(new Uint32Array(n,e,1)[0]===U1){const S=new Uint32Array(n,e);let A=2;const M=(S[A++]>>2)-3,R=S[A++]>>2;if(A++,r.json=JSON.parse(V1.decode(S.subarray(A,A+R))),A+=R,A<M){const D=S[A++];A++;const U=e+(A<<2);r.buffers[0]=n.slice(U,U+D)}}else r.json=JSON.parse(V1.decode(new Uint8Array(n,e)));const{buffers:l,images:h,meshes:f,extensionsUsed:m,bufferViews:x}=r.json;let v=Promise.resolve();if(l){const S=[];for(let A=0;A<l.length;A++){const M=l[A];M.uri?S.push(yE(M,r,A,i)):r.buffers[A]||(r.buffers[A]=null)}v=Promise.all(S)}return v.then(()=>{const S=[],A=m&&m.includes(h0),M=m&&m.includes(Oy);if(A&&S.push((function(){if(!Au)return y_??(y_=(function(R){let D,U=null;function G(){D=new Uint8Array(U.buffer)}function V(){throw new Error("Unexpected Draco error.")}const Z={a:{a:V,d:function(Y,Q,le){return D.copyWithin(Y,Q,Q+le)},c:function(Y){const Q=D.length,le=Math.max(Y>>>0,Math.ceil(1.2*Q)),ae=Math.ceil((le-Q)/65536);try{return U.grow(ae),G(),!0}catch{return!1}},b:V}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(R,Z):R.then(Y=>Y.arrayBuffer()).then(Y=>WebAssembly.instantiate(Y,Z))).then(Y=>{const{Rb:Q,Qb:le,P:ae,T:ge,X:_e,Ja:pe,La:be,Qa:Me,Va:Ye,Wa:Ze,eb:We,jb:lt,f:at,e:st,yb:He,zb:ht,Ab:tt,Bb:gt,Db:ct,Gb:qt}=Y.instance.exports;U=st;const $t=(()=>{let kt=0,Nt=0,ci=0,ii=0;return Gt=>{ci&&(Q(ii),Q(kt),Nt+=ci,ci=kt=0),kt||(Nt+=128,kt=le(Nt));const Ei=Gt.length+7&-8;let Zi=kt;Ei>=Nt&&(ci=Ei,Zi=ii=le(Ei));for(let fn=0;fn<Gt.length;fn++)D[Zi+fn]=Gt[fn];return Zi}})();return G(),at(),{memory:st,_free:Q,_malloc:le,Mesh:class{constructor(){this.ptr=ae()}destroy(){ge(this.ptr)}},Decoder:class{constructor(){this.ptr=pe()}destroy(){lt(this.ptr)}DecodeArrayToMesh(kt,Nt,ci){const ii=$t(kt),Gt=be(this.ptr,ii,Nt,ci.ptr);return!!_e(Gt)}GetAttributeByUniqueId(kt,Nt){return{ptr:Me(this.ptr,kt.ptr,Nt)}}GetTrianglesUInt16Array(kt,Nt,ci){Ye(this.ptr,kt.ptr,Nt,ci)}GetTrianglesUInt32Array(kt,Nt,ci){Ze(this.ptr,kt.ptr,Nt,ci)}GetAttributeDataArrayForAllPoints(kt,Nt,ci,ii,Gt){We(this.ptr,kt.ptr,Nt.ptr,ci,ii,Gt)}},DT_INT8:He(),DT_UINT8:ht(),DT_INT16:tt(),DT_UINT16:gt(),DT_UINT32:ct(),DT_FLOAT32:qt()}})})(fetch(z1())),y_.then(R=>{Au=R,y_=void 0}))})()),M&&S.push((function(){if(u0)return;const R=(function(D){let U;const G=WebAssembly.instantiateStreaming(D,{}).then(Y=>{U=Y.instance,U.exports.__wasm_call_ctors()}),V={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Z={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:G,supported:!0,decodeGltfBuffer(Y,Q,le,ae,ge,_e){(function(pe,be,Me,Ye,Ze,We,lt){const at=pe.exports.sbrk,st=Ye+3&-4,He=at(st*Ze),ht=at(We.length),tt=new Uint8Array(pe.exports.memory.buffer);tt.set(We,ht);const gt=be(He,Ye,Ze,ht,We.length);if(gt===0&&lt&&lt(He,st,Ze),Me.set(tt.subarray(He,He+Ye*Ze)),at(He-at(0)),gt!==0)throw new Error(`Malformed buffer data: ${gt}`)})(U,U.exports[Z[ge]],Y,Q,le,ae,U.exports[V[_e]])}}})(fetch(D1()));return R.ready.then(()=>{u0=R})})()),h)for(let R=0;R<h.length;R++)S.push(xE(h[R],r,R,i));return(S.length?Promise.all(S):Promise.resolve()).then(()=>
vendor: 71,347 bytes, line 218
218{if(A&&f)for(const{primitives:R}of f)for(const D of R)gE(D,r);if(M&&f&&x)for(const R of x)_E(R,r);return r})})}function q1(n){return fetch(n).then(e=>e.arrayBuffer()).then(e=>H1(e,0,n))}function d0(n){switch(n){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function f0(n){switch(n){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class p0{constructor(e,i,r,l){this.context=e,this.format=r,this.useMipmap=l&&l.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:l&&l.premultiply})}update(e,i){const r=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,l=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:h}=this,{gl:f}=h,{x:m,y:x}=i&&i.position?i.position:{x:0,y:0},v=m+r,S=x+l;!this.size||this.size[0]===v&&this.size[1]===S||(f.bindTexture(f.TEXTURE_2D,null),f.deleteTexture(this.texture),this.texture=f.createTexture(),this.size=null),f.bindTexture(f.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===f.RGBA8&&(!i||i.premultiply!==!1));const A=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&v>0&&S>0){const M=this.useMipmap?Math.floor(Math.log2(Math.max(v,S)))+1:1;f.texStorage2D(f.TEXTURE_2D,M,this.format,v,S),this.size=[v,S]}this.size&&(A?f.texSubImage2D(f.TEXTURE_2D,0,m,x,d0(this.format),f0(this.format),e):"data"in e&&e.data&&f.texSubImage2D(f.TEXTURE_2D,0,m,x,r,l,d0(this.format),f0(this.format),e.data)),this.useMipmap&&f.generateMipmap(f.TEXTURE_2D)}bind(e,i,r=!1){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,r,l,h){const{context:f}=this,{gl:m}=f;m.bindTexture(m.TEXTURE_2D,this.texture),i!==this.magFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,this.useMipmap?e===m.NEAREST?m.NEAREST_MIPMAP_NEAREST:m.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,r),this.wrapS=r),l!==this.wrapT&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,l),this.wrapT=l),h!==this.compareMode&&(h?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_COMPARE_MODE,m.COMPARE_REF_TO_TEXTURE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_COMPARE_FUNC,h)):m.texParameteri(m.TEXTURE_2D,m.TEXTURE_COMPARE_MODE,m.NONE),this.compareMode=h)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class v_{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:r}=this,{gl:l}=r;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}}const vE=Gi([{name:"a_pos_3f",components:3,type:"Float32"}]),bE=Gi([{name:"a_color_3f",components:3,type:"Float32"}]),wE=Gi([{name:"a_color_4f",components:4,type:"Float32"}]),TE=Gi([{name:"a_uv_2f",components:2,type:"Float32"}]),SE=Gi([{name:"a_normal_3f",components:3,type:"Float32"}]),EE=Gi([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),AE=Gi([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Z1(n,e){const i=By(n.projection,n.zoom,n.width,n.height),r=(function(h,f,m,x,v){const S=new se(m.lng-180*Yf,m.lat),A=new se(m.lng+180*Yf,m.lat),M=h.project(S.lng,S.lat),R=h.project(A.lng,A.lat),D=-Math.atan2(R.y-M.y,R.x-M.x),U=Bt.fromLngLat(m);U.y=he(U.y,-1+Yf,1-Yf);const G=U.toLngLat(),V=h.project(G.lng,G.lat),Z=Bt.fromLngLat(G);Z.x+=Yf;const Y=Z.toLngLat(),Q=h.project(Y.lng,Y.lat),le=X1(Q.x-V.x,Q.y-V.y,D),ae=Bt.fromLngLat(G);ae.y+=Yf;const ge=ae.toLngLat(),_e=h.project(ge.lng,ge.lat),pe=X1(_e.x-V.x,_e.y-V.y,D),be=Math.abs(le.x)/Math.abs(pe.y),Me=Je([]);rt(Me,Me,-D*(1-(v?0:x)));const Ye=Je([]);return nt(Ye,Ye,[1,1-(1-be)*x,1]),Ye[4]=-pe.x/pe.y*x,rt(Ye,Ye,D),pt(Ye,Me,Ye),Ye})(n.projection,0,n.center,i,e),l=$1(n);return nt(r,r,[l,l,1]),r}function $1(n){const e=n.projection,i=By(n.projection,n.zoom,n.width,n.height),r=m0(e,n.center),l=m0(e,se.convert(e.center));return Math.pow(2,r*i+(1-i)*l)}function By(n,e,i,r,l=1/0){const h=n.range;if(!h)return 0;const f=Math.min(l,Math.max(i,r)),m=Math.log2(f/1024);return Ie(h[0]+m,h[1]+m,e)}const Yf=1/4e4;function m0(n,e){const i=he(e.lat,-85.051129,Se),r=new se(e.lng-180*Yf,i),l=new se(e.lng+180*Yf,i),h=n.project(r.lng,i),f=n.project(l.lng,i),m=Bt.fromLngLat(r),x=Bt.fromLngLat(l),v=f.x-h.x,S=f.y-h.y,A=x.x-m.x,M=x.y-m.y,R=Math.sqrt((A*A+M*M)/(v*v+S*S));return Math.log2(R)}function X1(n,e,i){const r=Math.cos(i),l=Math.sin(i);return{x:n*r-e*l,y:n*l+e*r}}function W1(n,e,i){Je(n),rt(n,n,Ki(e[2])),vt(n,n,Ki(e[0])),ut(n,n,Ki(e[1])),nt(n,n,i),pt(n,n,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function ky(n,e,i,r,l,h,f,m){const x=[i[0]-e[0],i[1]-e[1],0],v=[r[0]-e[0],r[1]-e[1],0];if(Si(x)<1e-12||Si(v)<1e-12)return ts(n);const S=Xn([],x,v);xi(S,S),_i(v,r,e),x[2]=(h-l)*m,v[2]=(f-l)*m;const A=x;return Xn(A,x,v),xi(A,A),Br(n,S,A)}function Fy(n,e,i=!1){const r=wu(e.zoom),l=(function(h,f,m){const x=f.worldSize,v=[h[12],h[13],h[14]],S=ot(v[1]/x),A=$e(v[0]/x),M=Je([]),R=Le(1,S)*x,D=Le(1,0)*x*Ve(S,f.zoom),U=1/Kp(x);let G=D*U;if(m){const Q=By(f.projection,f.zoom,f.width,f.height,1024);G=U*f.projection.pixelSpaceConversion(f.center.lat,x,Q)}const V=me(S,A);Tt(V,V,bt([],xi([],V),R*G*v[2]));const Z=(function(Q){const le=[Q[0],Q[1],Q[2]];let ae=[0,1,0];const ge=Xn([],ae,le);return Xn(ae,le,ge),Ai(ae)===0&&(ae=[0,1,0],Xn(ge,le,ae)),xi(ge,ge),xi(ae,ae),xi(le,le),[ge[0],ge[1],ge[2],0,ae[0],ae[1],ae[2],0,le[0],le[1],le[2],0,Q[0],Q[1],Q[2],1]})(V);nt(M,M,[G,G,G*R]),dt(M,M,[-v[0],-v[1],-v[2]]);const Y=pt([],f.globeMatrix,Z);return pt(Y,Y,M),pt(Y,Y,h),Y})(n,e,i);if(r>0){const h=(function(f,m){const x=m.worldSize,v=Le(1,0)*x*Ve(m.center.lat,m.zoom)/Kp(x),S=Le(1,m.center.lat)*x,A=Je([]);ut(A,A,Ki(m.center.lng)),vt(A,A,Ki(m.center.lat)),dt(A,A,[0,0,q]),nt(A,A,[v,v,v*S]);const M=m.point;return dt(A,A,[-M.x,-M.y,0]),pt(A,A,f),pt(A,m.globeMatrix,A)})(n,e);return(function(f,m,x){const v=(D,U,G)=>{const V=Si(D),Z=Si(U),Y=zc(D,U,G);return bt(Y,Y,1/Si(Y)*mi(V,Z,G))},S=v([f[0],f[1],f[2]],[m[0],m[1],m[2]],x),A=v([f[4],f[5],f[6]],[m[4],m[5],m[6]],x),M=v([f[8],f[9],f[10]],[m[8],m[9],m[10]],x),R=zc([f[12],f[13],f[14]],[m[12],m[13],m[14]],x);return[S[0],S[1],S[2],0,A[0],A[1],A[2],0,M[0],M[1],M[2],0,R[0],R[1],R[2],1]})(l,h,r)}return l}function g0(n,e,i,r){const l=hn.projectAabbCorners(r,i);let h=Number.MAX_VALUE;for(let m=0;m<l.length;++m){const x=l[m];x[0]=(.5*x[0]+.5)*e.width,x[1]=(.5-.5*x[1])*e.height,x[2]<h&&(h=x[2])}const f=(function(m){const x=[];let v=0;for(let R=1;R<m.length;R++)(m[R][0]<m[v][0]||m[R][0]===m[v][0]&&m[R][1]<m[v][1])&&(v=R);let S,A=v;const M=new Uint8Array(m.length);do{if(M[A])break;x.push(new _t(m[A][0],m[A][1])),M[A]=1,S=(A+1)%m.length;for(let R=0;R<m.length;R++){if(m[R][0]===m[S][0]&&m[R][1]===m[S][1]||m[R][0]===m[A][0]&&m[R][1]===m[A][1])continue;const D=[m[R][0]-m[A][0],m[R][1]-m[A][1]],U=[m[S][0]-m[A][0],m[S][1]-m[A][1]],G=D[0]*U[1]-D[1]*U[0];(G>0||G===0&&D[0]*U[0]+D[1]*U[1]>=0&&D[0]*D[0]+D[1]*D[1]>U[0]*U[0]+U[1]*U[1])&&(S=R)}A=S}while(A!==v);return x.length>0&&x.push(x[0]),x})(l);if(Zn(n,f))return h}const mm=64,hg={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Ny(n,e,i,r,l,h,f,m,x,v=!1){const S=i.zoom,A=i.project(r),M=Ve(r.lat,S),R=1/M;Je(n),dt(n,n,[A.x+f[0]*R,A.y+f[1]*R,f[2]]);let D=1,U=1;const G=i.worldSize;if(v){if(i.projection.name==="mercator"){let Q=0;i.elevation&&(Q=i.elevation.getAtPointOrZero(new Bt(A.x/G,A.y/G),0));const le=Bo([],[A.x,A.y,Q,1],i.projMatrix)[3]/i.cameraToCenterDistance;D=le,U=le*Ve(i.center.lat,S)}else if(i.projection.name==="globe"){const Q=Fy(n,i),le=[0,0,0,1];Bo(le,le,pt([],i.projMatrix,Q));const ae=le[3]/i.cameraToCenterDistance,ge=wu(S),_e=i.projection.pixelsPerMeter(r.lat,G)*Ve(r.lat,S),pe=i.projection.pixelsPerMeter(i.center.lat,G)*Ve(i.center.lat,S);D=ae/mi(_e,Ke(i.center.lat),ge),U=ae*M/_e,D*=pe,U*=pe}}else D=R;nt(n,n,[D,D,U]);const V=[...n],Z=e.orientation,Y=[];if(W1(Y,[Z[0]+(l?l[0]:0),Z[1]+(l?l[1]:0),Z[2]+(l?l[2]:0)],h),pt(n,V,Y),m&&i.elevation){let Q=0;const le=[];if(x&&i.elevation){Q=(function(ge,_e,pe,be,Me){const Ye=_e.elevation;if(!Ye)return 0;const Ze=hn.projectAabbCorners(pe,be),We=Le(1,Me.lat)*_e.worldSize,lt=(function(Nt,ci){const ii=[0,0,1],Gt=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Ei of Gt){const Zi=Nt[Ei.corners[0]],fn=Nt[Ei.corners[1]],Ui=Nt[Ei.corners[2]],En=[fn[0]-Zi[0],fn[1]-Zi[1],ci*(fn[2]-Zi[2])],on=Xn(En,En,[Ui[0]-Zi[0],Ui[1]-Zi[1],ci*(Ui[2]-Zi[2])]);xi(on,on),Ei.dotProductWithUp=ln(on,ii)}return Gt.sort((Ei,Zi)=>Ei.dotProductWithUp-Zi.dotProductWithUp),Gt[0].corners})(Ze,We),at=Ze[lt[0]],st=Ze[lt[1]],He=Ze[lt[2]],ht=Ze[lt[3]],tt=Ye.getAtPointOrZero(new Bt(at[0]/_e.worldSize,at[1]/_e.worldSize),0),gt=Ye.getAtPointOrZero(new Bt(st[0]/_e.worldSize,st[1]/_e.worldSize),0),ct=Ye.getAtPointOrZero(new Bt(He[0]/_e.worldSize,He[1]/_e.worldSize),0),qt=Ye.getAtPointOrZero(new Bt(ht[0]/_e.worldSize,ht[1]/_e.worldSize),0),$t=(tt+qt)/2,kt=(gt+ct)/2;return $t>kt?gt<ct?ky(ge,st,ht,at,gt,qt,tt,We):ky(ge,He,at,ht,ct,tt,qt,We):tt<qt?ky(ge,at,st,He,tt,gt,ct,We):ky(ge,ht,He,st,qt,ct,gt,We),Math.max($t,kt)})(le,i,e.aabb,n,r);const ae=pt([],Bi([],le),Y);pt(n,V,ae)}else Q=i.elevation.getAtPointOrZero(new Bt(A.x/G,A.y/G),0);Q!==0&&(n[14]+=Q)}}class Y1{constructor(e,i,r,l,h){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=r!=null?new se(r[0],r[1]):new se(0,0),this.orientation=l??[0,0,0],this.nodes=h,this.uploaded=!1,this.aabb=new hn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){pt(e.globalMatrix,i,e.localMatrix);const r=this.nodeOverrides.get(e.name);if(r!==void 0){const f=[];h=r.orientation,Je(l=f),ut(l,l,Ki(h[1])),rt(l,l,Ki(h[2])),vt(l,l,Ki(h[0])),pt(e.globalMatrix,e.globalMatrix,f)}var l,h;if(e.meshes)for(const f of e.meshes){const m=hn.applyTransformFast(f.aabb,e.globalMatrix);this.aabb.encapsulate(m)}if(e.children)for(const f of e.children)this._applyTransformations(f,e.globalMatrix)}computeBoundsAndApplyParent(){const e=Je([]);this.aabb=new hn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,r,l,h,f,m=!1){Ny(this.matrix,this,e.transform,this.position,i,r,l,h,f,m)}upload(e){if(!this.uploaded){for(const i of this.nodes)_0(i,e);for(const i of this.nodes)Uy(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)y0(e)}}function b_(n,e,i=!1){n.uploaded||(n.gfxTexture=new p0(e,n.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:n.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),n.uploaded=!0,n.image=null)}function ME(n,e,i){n.indexBuffer=e.createIndexBuffer(n.indexArray,!1,!0),n.vertexBuffer=e.createVertexBuffer(n.vertexArray,vE.members,!1,!0),n.normalArray&&(n.normalBuffer=e.createVertexBuffer(n.normalArray,SE.members,!1,!0)),n.texcoordArray&&(n.texcoordBuffer=e.createVertexBuffer(n.texcoordArray,TE.members,!1,!0)),n.colorArray&&(n.colorBuffer=e.createVertexBuffer(n.colorArray,(n.colorArray.bytesPerElement===12?bE:wE).members,!1,!0)),n.featureArray&&(n.pbrBuffer=e.createVertexBuffer(n.featureArray,AE.members,!0)),n.segments=kn.simpleSegment(0,0,n.vertexArray.length,n.indexArray.length);const r=n.material;r.pbrMetallicRoughness.baseColorTexture&&b_(r.pbrMetallicRoughness.baseColorTexture,e),r.pbrMetallicRoughness.metallicRoughnessTexture&&b_(r.pbrMetallicRoughness.metallicRoughnessTexture,e),r.normalTexture&&b_(r.normalTexture,e),r.occlusionTexture&&b_(r.occlusionTexture,e,i),r.emissionTexture&&b_(r.emissionTexture,e)}function _0(n,e,i){if(n.meshes)for(const r of n.meshes)ME(r,e,i);if(n.children)for(const r of n.children)_0(r,e,i)}function Uy(n){if(n.meshes)for(const e of n.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(n.children)for(const e of n.children)Uy(e)}function CE(n){n.pbrMetallicRoughness.baseColorTexture&&n.pbrMetallicRoughness.baseColorTexture.gfxTexture&&n.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),n.pbrMetallicRoughness.metallicRoughnessTexture&&n.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&n.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),n.normalTexture&&n.normalTexture.gfxTexture&&n.normalTexture.gfxTexture.destroy(),n.emissionTexture&&n.emissionTexture.gfxTexture&&n.emissionTexture.gfxTexture.destroy(),n.occlusionTexture&&n.occlusionTexture.gfxTexture&&n.occlusionTexture.gfxTexture.destroy()}function y0(n){if(n.meshes)for(const e of n.meshes)e.vertexBuffer&&(e.vertexBuffer.destroy(),e.indexBuffer.destroy(),e.normalBuffer&&e.normalBuffer.destroy(),e.texcoordBuffer&&e.texcoordBuffer.destroy(),e.colorBuffer&&e.colorBuffer.destroy(),e.pbrBuffer&&e.pbrBuffer.destroy(),e.segments.destroy(),e.material&&CE(e.material));if(n.children)for(const e of n.children)y0(e)}function gm(n,e){const i=n.json.bufferViews[e.bufferView],r=Ly[e.componentType];return new r(n.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==x_[e.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:x_[e.type]))}function x0(n,e,i,r){const l=Ly[e.componentType],h=(function(S){switch(S){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(l),f=n.json.bufferViews[e.bufferView],m=f.byteStride?f.byteStride/l.BYTES_PER_ELEMENT:x_[e.type],x=i.float32,v=x.length/i.capacity;for(let S=0,A=0;S<e.count*m;S+=m,A+=v)for(let M=0;M<v;M++)x[A+M]=r[S+M]*h;i._trim()}function IE(n,e,i){const r=n.indices,l=n.attributes,h={};h.indexArray=new Lr;const f=e.json.accessors[r],m=f.count/3;h.indexArray.reserve(m);const x=gm(e,f);for(let M=0;M<m;M++)h.indexArray.emplaceBack(x[3*M],x[3*M+1],x[3*M+2]);h.indexArray._trim(),h.vertexArray=new Za;const v=e.json.accessors[l.POSITION];h.vertexArray.reserve(v.count);const S=gm(e,v);for(let M=0;M<v.count;M++)h.vertexArray.emplaceBack(S[3*M],S[3*M+1],S[3*M+2]);if(h.vertexArray._trim(),h.aabb=new hn(v.min,v.max),h.centroid=(function(M,R){const D=[0,0,0],U=M.length;if(U>0){for(let G=0;G<U;G++){const V=3*M[G];D[0]+=R[V],D[1]+=R[V+1],D[2]+=R[V+2]}D[0]/=U,D[1]/=U,D[2]/=U}return D})(x,S),l.COLOR_0!==void 0){const M=e.json.accessors[l.COLOR_0],R=x_[M.type],D=gm(e,M);h.colorArray=R===3?new Za:new Us,h.colorArray.resize(M.count),x0(e,M,h.colorArray,D)}if(l.NORMAL!==void 0){h.normalArray=new Za;const M=e.json.accessors[l.NORMAL];h.normalArray.resize(M.count);const R=gm(e,M);x0(e,M,h.normalArray,R)}if(l.TEXCOORD_0!==void 0&&i.length>0){h.texcoordArray=new Ic;const M=e.json.accessors[l.TEXCOORD_0];h.texcoordArray.resize(M.count);const R=gm(e,M);x0(e,M,h.texcoordArray,R)}if(l._FEATURE_ID_RGBA4444!==void 0){const M=e.json.accessors[l._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(h.featureData=gm(e,M))}l._FEATURE_RGBA4444!==void 0&&(h.featureData=new Uint32Array(gm(e,e.json.accessors[l._FEATURE_RGBA4444]).buffer));const A=n.material;return h.material=(function(M,R){const{emissiveFactor:D=[0,0,0],alphaMode:U="OPAQUE",alphaCutoff:G=.5,normalTexture:V,occlusionTexture:Z,emissiveTexture:Y,doubleSided:Q,name:le}=M,{baseColorFactor:ae=[1,1,1,1],metallicFactor:ge=1,roughnessFactor:_e=1,baseColorTexture:pe,metallicRoughnessTexture:be}=M.pbrMetallicRoughness||{},Me=Z?R[Z.index]:void 0;if(Z&&Z.extensions&&Z.extensions.KHR_texture_transform&&Me){const Ye=Z.extensions.KHR_texture_transform;Me.offsetScale=[Ye.offset[0],Ye.offset[1],Ye.scale[0],Ye.scale[1]]}return{name:le,pbrMetallicRoughness:{baseColorFactor:new pn(...ae),metallicFactor:ge,roughnessFactor:_e,baseColorTexture:pe?R[pe.index]:void 0,metallicRoughnessTexture:be?R[be.index]:void 0},doubleSided:Q,emissiveFactor:new pn(...D),alphaMode:U,alphaCutoff:G,normalTexture:V?R[V.index]:void 0,occlusionTexture:Me,emissionTexture:Y?R[Y.index]:void 0,defined:M.defined===void 0}})(A!==void 0?e.json.materials[A]:{defined:!1},i),h}function K1(n,e,i){const{matrix:r,rotation:l,translation:h,scale:f,mesh:m,extras:x,children:v,name:S}=n,A={};if(A.name=S,A.localMatrix=r||(function(M,R,D,U){var G=R[0],V=R[1],Z=R[2],Y=R[3],Q=G+G,le=V+V,ae=Z+Z,ge=G*Q,_e=G*le,pe=G*ae,be=V*le,Me=V*ae,Ye=Z*ae,Ze=Y*Q,We=Y*le,lt=Y*ae,at=U[0],st=U[1],He=U[2];return M[0]=(1-(be+Ye))*at,M[1]=(_e+lt)*at,M[2]=(pe-We)*at,M[3]=0,M[4]=(_e-lt)*st,M[5]=(1-(ge+Ye))*st,M[6]=(Me+Ze)*st,M[7]=0,M[8]=(pe+We)*He,M[9]=(Me-Ze)*He,M[10]=(1-(ge+be))*He,M[11]=0,M[12]=D[0],M[13]=D[1],M[14]=D[2],M[15]=1,M})([],l||[0,0,0,1],h||[0,0,0],f||[1,1,1]),A.globalMatrix=Ne(A.localMatrix),m!==void 0){A.meshes=i[m];const M=A.anchor=[0,0];for(const R of A.meshes){const{min:D,max:U}=R.aabb;M[0]+=D[0]+U[0],M[1]+=D[1]+U[1]}M[0]=Math.floor(M[0]/A.meshes.length/2),M[1]=Math.floor(M[1]/A.meshes.length/2)}if(x&&(x.id&&(A.id=x.id),x.lights&&(A.lights=(function(M){if(!M.length)return[];const R=(function(Z){const Y=atob(Z),Q=new Uint8Array(Y.length);for(let le=0;le<Y.length;le++)Q[le]=Y.codePointAt(le);return Q})(M),D=[],U=R.length/24,G=new Uint16Array(R.buffer),V=new Float32Array(R.buffer);for(let Z=0;Z<U;Z++){const Y=G[2*Z*6]/30,Q=G[2*Z*6+1]/30,le=G[2*Z*6+10]/100,ae=V[6*Z+1],ge=V[6*Z+2],_e=V[6*Z+3],pe=V[6*Z+4],be=_e-ae,Me=pe-ge,Ye=Math.hypot(be,Me);D.push({pos:[ae+.5*be,ge+.5*Me,Q],normal:[Me/Ye,-be/Ye,0],width:Ye,height:Y,depth:le,points:[ae,ge,_e,pe]})}return D})(x.lights)),x.MAPBOX_geometry_bloom&&(A.isGeometryBloom=x.MAPBOX_geometry_bloom)),v){const M=[];for(const R of v)M.push(K1(e.json.nodes[R],e,i));A.children=M}return A}function RE(n){if(n.vertices.length===0||n.indices.length===0)return null;const e=new um(n.vertices,n.indices,8,256),[i,r]=[e.min.clone(),e.max.clone()];return{vertices:n.vertices,indices:n.indices,grid:e,min:i,max:r}}function zE(n){if(!n.extras||!n.extras.ground)return null;const e=n.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const r=[];for(const f of i){if(!Array.isArray(f)||f.length!==2)continue;const m=f[0],x=f[1];typeof m=="number"&&typeof x=="number"&&r.push(new _t(m,x))}if(r.length<3)return null;r.length>1&&r[r.length-1].equals(r[0])&&r.pop();let l=0;for(let f=0;f<r.length;f++){const m=r[f],x=r[(f+1)%r.length],v=r[(f+2)%r.length];l+=(m.x-x.x)*(v.y-x.y)-(v.x-x.x)*(m.y-x.y)}l>0&&r.reverse();const h=qs(r.flatMap(f=>[f.x,f.y]),[]);return h.length===0?null:{vertices:r,indices:h}}function DE(n,e){const i=[],r=[];let l=0;const h=[];for(const f of n){l=i.length;const m=f.vertexArray.float32,x=f.indexArray.uint16;for(let v=0;v<f.vertexArray.length;v++)h[0]=m[3*v+0],h[1]=m[3*v+1],h[2]=m[3*v+2],Nn(h,h,e),i.push(new _t(h[0],h[1]));for(let v=0;v<3*f.indexArray.length;v++)r.push(x[v]+l)}if(r.length%3!=0)return null;for(let f=0;f<r.length;f+=3){const m=i[r[f+0]],x=i[r[f+1]],v=i[r[f+2]];(m.x-x.x)*(v.y-x.y)-(v.x-x.x)*(m.y-x.y)>0&&([r[f+1],r[f+2]]=[r[f+2],r[f+1]])}return{vertices:i,indices:r}}function v0(n){const e=(function(x,v){const S=[],A=WebGL2RenderingContext;if(x.json.textures)for(const M of x.json.textures){const R={magFilter:A.LINEAR,minFilter:A.NEAREST,wrapS:A.REPEAT,wrapT:A.REPEAT};M.sampler!==void 0&&Object.assign(R,x.json.samplers[M.sampler]),S.push({image:v[M.source],sampler:R,uploaded:!1})}return S})(n,n.images),i=(function(x,v){const S=[];for(const A of x.json.meshes){const M=[];for(const R of A.primitives)M.push(IE(R,x,v));S.push(M)}return S})(n,e),{scenes:r,scene:l,nodes:h}=n.json,f=r?r[l||0].nodes:[...h.keys()],m=[];for(const x of f)m.push(K1(h[x],n,i));return(function(x,v,S){const A={},M=new Set;for(let R=0;R<x.length;R++){const D=S[v[R]];if(!D.extras)continue;const U=D.extras["mapbox:footprint:version"],G=D.extras["mapbox:footprint:id"];(U||G)&&M.add(R),U==="1.0.0"&&G&&(A[G]=R)}for(let R=0;R<x.length;R++){if(M.has(R))continue;const D=x[R],U=S[v[R]];if(!U.extras)continue;let G=null;D.id in A&&(G=DE(x[A[D.id]].meshes,D.localMatrix)),G||(G=zE(U)),G&&(D.footprint=RE(G))}if(M.size>0){const R=Array.from(M.values()).sort((D,U)=>D-U);for(let D=R.length-1;D>=0;D--)x.splice(R[D],1)}})(m,f,n.json.nodes),m}function PE(n){n.heightmap=new Float32Array(4096),n.heightmap.fill(-1);const e=n.vertexArray.float32,i=n.aabb.min[0]-1,r=n.aabb.min[1]-1,l=mm/(n.aabb.max[0]-i+2),h=mm/(n.aabb.max[1]-r+2);for(let f=0;f<e.length;f+=3){const m=e[f+2],x=(e[f+0]-i)*l|0,v=(e[f+1]-r)*h|0;m>n.heightmap[v*mm+x]&&(n.heightmap[v*mm+x]=m)}}function Q1(n,e,i,r,l){i.reserve(i.length+4*n.length),r.reserve(r.length+10*n.length),l.reserve(l.length+10*n.length);let h=r.length;for(const f of n){const m=Math.min(10,Math.max(4,1.3*f.height))*e,x=[-f.normal[1],f.normal[0],0],v=Math.min(.29,.1*f.width/f.depth),S=f.width-2*f.depth*e*(v+.01),A=Ht([],f.pos,x,S/2),M=Ht([],f.pos,x,-S/2),R=[A[0],A[1],A[2]+f.height],D=[M[0],M[1],M[2]+f.height],U=Ht([],f.normal,x,v);bt(U,U,m);const G=Ht([],f.normal,x,-v);bt(G,G,m),Tt(U,A,U),Tt(G,M,G),A[2]+=.1,M[2]+=.1,r.emplaceBack(U[0],U[1],U[2]),r.emplaceBack(G[0],G[1],G[2]),r.emplaceBack(A[0],A[1],A[2]),r.emplaceBack(M[0],M[1],M[2]),r.emplaceBack(R[0],R[1],R[2]),r.emplaceBack(D[0],D[1],D[2]),r.emplaceBack(A[0],A[1],A[2]),r.emplaceBack(M[0],M[1],M[2]),r.emplaceBack(U[0],U[1],U[2]),r.emplaceBack(G[0],G[1],G[2]);const V=S/m/2;l.emplaceBack(-V-v,-1,V,.8),l.emplaceBack(V+v,-1,V,.8),l.emplaceBack(-V,0,V,1.3),l.emplaceBack(V,0,V,1.3),l.emplaceBack(V+v,-.8,V,.7),l.emplaceBack(V+v,-.8,V,.7),l.emplaceBack(0,0,V,1.3),l.emplaceBack(0,0,V,1.3),l.emplaceBack(V+v,-1.2,V,.8),l.emplaceBack(V+v,-1.2,V,.8),i.emplaceBack(6+h,4+h,8+h),i.emplaceBack(7+h,9+h,5+h),i.emplaceBack(0+h,1+h,2+h),i.emplaceBack(1+h,3+h,2+h),h+=10}}function LE(n,e){const i={};i.indexArray=new Lr,i.vertexArray=new Za,i.colorArray=new Us,Q1(n,e,i.indexArray,i.vertexArray,i.colorArray);const r={defined:!0};r.emissiveFactor=pn.black;const l={};return l.baseColorFactor=pn.white,r.pbrMetallicRoughness=l,i.material=r,i.aabb=new hn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const J1=Gi([{name:"a_pos_3f",components:3,type:"Float32"}]),OE=Gi([{name:"a_normal_3",components:3,type:"Int16"}]),BE=Gi([{name:"a_centroid_3",components:3,type:"Int16"}]),eb=Gi([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),kE=Gi([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),FE=Gi([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),NE=Gi([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),UE=Gi([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),VE=Gi([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),tb=Hi.types,Vy=32767;function jE(n,e){const i=Lt+e;for(const r of n)for(const l of r)if(l.x<-e||l.x>i||l.y<-e||l.y>i)return!1;return!0}function GE(n){switch(n){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${n}`)}}class b0{constructor(){this.layoutVertexArray=new Za,this.layoutAttenuationArray=new Us,this.layoutColorArray=new $a,this.indexArray=new Lr,this.indexArrayForConflation=new Lr,this.segmentsBucket=new kn}}class w0{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new kn,this.entranceBloom=new b0;const i=66560;this.layoutVertexArray=new Za,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new Fs,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new Fs,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new $a,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new _h,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new zd,this.layoutAOArray.reserve(i),this.indexArray=new Lr,this.indexArray.reserve(66560),this.indexArrayForConflation=new Lr,this.segmentsBucket=new kn,this.entranceBloom=new b0,e&&(this.layoutFacadePaintArray=new $a,this.layoutFacadeDataArray=new du,this.layoutFacadeVerticalRangeArray=new $a)}reserve(e,i,r){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(i),r&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class ib{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Ic,this.footprintsIndices=new _h,this.footprintsMin=new _t(1/0,1/0),this.footprintsMax=new _t(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new w0(!1),this.buildingWithFacade=new w0(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new I(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new Qn(e),this.groundEffect.groundRadiusArray=new eo,this.hasAppearances=null}updateFootprints(e,i){const r=new um([],[],1),l={vertices:[],indices:new Uint32Array(0),grid:r,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:l,id:e})}updateAppearances(e,i,r,l){}prepare(){return(function(){if(Py!=null||R1!=null)return null;if(ug!=null)return ug;const e=fetch(Fr.BUILDING_GEN_URL);return ug=(function(i){let r,l,h,f,m;function x(){r=new Uint8Array(m.buffer),l=new Int16Array(m.buffer),h=new Int32Array(m.buffer),f=new Float32Array(m.buffer)}function v(){throw new Error("Unexpected BuildingGen error.")}const S=()=>{},A={a:{a:v,f:function(M){const R=r.length,D=Math.max(M>>>0,Math.ceil(1.2*R)),U=Math.ceil((D-R)/65536);try{return m.grow(U),x(),!0}catch{return!1}},g:v,b:S,c:S,d:S,e:S}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,A):i.then(M=>M.arrayBuffer()).then(M=>WebAssembly.instantiate(M,A))).then(M=>{const R=M.instance.exports;return(0,R.g)(),m=R.f,x(),new fE({setStyle:R.h,setAOOptions:R.i,setMetricOptions:R.j,setStructuralOptions:R.k,setFacadeOptions:R.l,setFauxFacadeOptions:R.m,setFacadeClassifierOptions:R.n,addFeature:R.o,addFacade:R.p,generateMesh:R.q,getLastError:R.r,getOuterRingLength:R.s,getMeshCount:R.t,getPositionsPtr:R.u,getPositionsLength:R.v,getNormalsPtr:R.w,getNormalsLength:R.x,getAOPtr:R.y,getAOLength:R.z,getUVPtr:R.A,getUVLength:R.B,getFauxFacadePtr:R.C,getFauxFacadeLength:R.D,getIndicesPtr:R.E,getIndicesLength:R.F,getBuildingPart:R.G,getRingCount:R.H,getRingPtr:R.I,getRingLength:R.J,malloc:R.K,free:R.L,heapU8:r,heap16:l,heap32:h,heapF32:f})})})(e).then(i=>(ug=null,Py=i,Py)).catch(i=>{vi("Could not load building-gen"),ug=null,R1=i}),ug})()}populate(e,i,r,l){const h=pE();if(!h)return;const f=Et(r);this.tileToMeter=f,this.brightness=i.brightness,h.setStyle({normalScale:[1,-1,f],tileToMeters:f}),h.setAOOptions(!1,.3),h.setMetricOptions(!1,16),h.setStructuralOptions(!0),h.setFacadeClassifierOptions(3);const m=new Map,x=new Map;let v=0;for(const{feature:V}of e){if(tb[V.type]!=="LineString"){m.set(V.id,V.properties.source_id);continue}const Z=this.layers[0]._featureFilter.needGeometry;if(Z&&!this.layers[0]._featureFilter.filter(new mn(this.zoom),V,r))continue;const Y=Ri(V,Z);if(!Z&&!this.layers[0]._featureFilter.filter(new mn(this.zoom),Y,r))continue;const Q=Z?Y.geometry:fi(V,r,l),le=[];for(const pe of Q)for(const be of pe)le.push(be.x),le.push(be.y);const ae={coordinates:le,crossPerc:V.properties.cross_perc,distanceToRoad:V.properties.distance_to_road,entrances:V.properties.entrances,sourceId:0},ge=V.properties.source_id;let _e=x.get(ge);_e||(_e=[],x.set(ge,_e)),_e.push(ae),++v}this.maxHeight=0;const S=new Array,A=new Set,M=V=>{V!=null&&A.add(V)},R=(V,Z)=>{V!=null&&S.push({buildingId:V,footprintIndex:Z})},D=64*(e.length-v),U=D/2;this.buildingWithFacade.reserve(D,U,!0),this.buildingWithoutFacade.reserve(2*D,2*U,!1),this.footprintsIndices.reserve(16*(e.length-v)),this.footprintsVertices.reserve(8*(e.length-v));for(const{feature:V,id:Z,index:Y,sourceLayerIndex:Q}of e){if(tb[V.type]==="LineString")continue;const le=this.layers[0]._featureFilter.needGeometry;if(le&&!this.layers[0]._featureFilter.filter(new mn(this.zoom),V,r))continue;let ae=null;if(V.properties&&V.properties.hasOwnProperty("building_id")&&(ae=Number(V.properties.building_id),A.has(ae)))continue;const ge=Ri(V,le);if(!le&&!this.layers[0]._featureFilter.filter(new mn(this.zoom),ge,r))continue;const _e=le?ge.geometry:fi(V,r,l),pe=am(_e,500);let be=!1;for(const Vi of pe)if(Vi.length!==1){be=!0;break}if(be){M(ae);continue}if(!jE(_e,163)){M(ae);continue}const Me=this.layers[0],Ye=GE(Me.layout.get("building-roof-shape").evaluate(V,{},r)),Ze=Me.layout.get("building-base").evaluate(V,{},r),We=Me.layout.get("building-height").evaluate(V,{},r),lt=Me.layout.get("building-flood-light-ground-radius").evaluate(V,{},r),at=Me.paint.get("building-ambient-occlusion-intensity"),st=lt/this.tileToMeter;V.properties["building-part"]="roof";const He=Me.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),ht=Me.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);V.properties["building-part"]="wall";const tt=Me.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),gt=Me.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);V.properties["building-part"]="window";const ct=Me.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),qt=Me.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);V.properties["building-part"]="door";const $t=Me.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),kt=Me.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);let Nt=Me.layout.get("building-flood-light-wall-radius").evaluate(V,{},r);Nt=he(Nt,0,2048);const ci=Nt/2048*Vy,ii=m.get(Z),Gt=x.get(ii)||[],Ei=Gt.length!==0&&Me.layout.get("building-facade").evaluate(V,{},r);h.setFacadeOptions(4,!0),h.setFauxFacadeOptions(Ei,!1,1);let Zi=0,fn=0,Ui=0,En=0,on=0,Ar=0,sn=0,Tn=0,$n=0,tr=0,ir=0;if(Ei){let Vi=Math.round(Me.layout.get("building-facade-floors").evaluate(V,{},r));if(Ze===0){Vi=Math.max(1,Vi-(Gt.length>0?1:0));let Cr=4;if(We>100){const no=[10,13,15];Cr=no[V.id?V.id%no.length:0]}else We<=10&&(Cr=3);h.setFacadeOptions(Cr,!0),on=(We<15?1.3:1.61803)*Cr/f}else on=Ze/f;Ar=We/f,on=Math.min(on,Ar),Ui=Me.layout.get("building-facade-unit-width").evaluate(V,{},r)/f,En=(Ar-on)/Vi,h.setFauxFacadeOptions(!0,!0,Ui);const xo=Me.layout.get("building-facade-window").evaluate(V,{},r);Zi=xo[0],fn=xo[1],sn=Math.floor(65535*Math.min(1,on/Lt)),Tn=Math.floor(65535*Math.min(1,Ar/Lt)),$n=Math.floor(255*Zi)<<8|Math.floor(255*fn),tr=Math.floor(65535*Math.min(1,Ui/Lt)),ir=Math.floor(65535*Math.min(1,En/Lt))}const Mr=Array(pe.length),zo={x:1/0,y:1/0},ra={x:-1/0,y:-1/0},$r={x:0,y:0};let io=0;for(let Vi=0;Vi<pe.length;Vi++){const xo=pe[Vi];if(xo.length>0){const Cr=[],no=Array(xo.length+1);no[0]=0;for(let nc=0;nc<xo.length;nc++){const ys=xo[nc];for(let Ws=0;Ws<ys.length;Ws++){const vo=ys[ys.length-Ws-1];zo.x=Math.min(zo.x,vo.x),zo.y=Math.min(zo.y,vo.y),ra.x=Math.max(ra.x,vo.x),ra.y=Math.max(ra.y,vo.y),$r.x+=vo.x,$r.y+=vo.y,io++,Cr.push(vo.x),Cr.push(vo.y)}no[nc+1]=Cr.length}Mr[Vi]={id:V.id?V.id:0,height:We,minHeight:Ze,sourceId:0,roofType:Ye,coordinates:Cr,ringIndices:no}}}$r.x/=io||1,$r.y/=io||1;const fo=h.generateMesh(Mr,Gt);if(typeof fo=="string"){vi(`Unable to generate building ${V.id}: ${fo}`),M(ae);continue}if(fo.meshes.length===0||fo.modifiedPolygonRings.length===0){M(ae);continue}const Ni=Ei?this.buildingWithFacade:this.buildingWithoutFacade;let nr=0;for(const Vi of fo.meshes)nr+=Vi.positions.length/3;const fr=Ni.segmentsBucket.prepareSegment(nr,Ni.layoutVertexArray,Ni.indexArray),Xs=[];let Oa=null,Do=0,Ba=-1;const zh=Ni.layoutVertexArray.length,va=zh+nr;Ni.layoutVertexArray.resize(va),Ni.layoutCentroidArray.resize(va),Ni.layoutNormalArray.resize(va),Ni.layoutAOArray.resize(va),Ni.layoutColorArray.resize(va),Ni.layoutFloodLightDataArray.resize(va),Ei&&(Ni.layoutFacadePaintArray.resize(va),Ni.layoutFacadeDataArray.resize(va),Ni.layoutFacadeVerticalRangeArray.resize(va));const dx=Ni.indexArray.length;let Tg=0,Ya=zh;for(const Vi of fo.meshes){let xo,Cr;if(Vi.buildingPart===1)xo=He,Cr=ht;else if(Vi.buildingPart===0)xo=tt,Cr=gt;else if(Vi.buildingPart===2)xo=ct,Cr=qt;else{if(Vi.buildingPart!==3)continue;xo=$t,Cr=kt}if(Cr=he(Cr,0,1),Vi.buildingPart===3){const Xr=new Array;for(let wa=0;wa<Vi.positions.length;wa+=12){const tp=Vi.positions[wa+0],Lo=Vi.positions[wa+1],xs=Vi.positions[wa+3],Fc=Vi.positions[wa+4],Lh=Vi.positions[wa+2],sv=Vi.positions[wa+8]-Lh,lv=1,q_=xs-tp,Eg=Fc-Lo,Iu=Math.hypot(q_,Eg);Xr.push({pos:[tp+.5*q_,Lo+.5*Eg,Lh],normal:[Eg/Iu,-q_/Iu,0],width:Iu,height:sv,depth:lv,points:[tp,Lo,xs,Fc]})}const Po=Ni.entranceBloom.segmentsBucket.prepareSegment(10*Xr.length,Ni.entranceBloom.layoutVertexArray,Ni.entranceBloom.indexArray),ro=Ni.entranceBloom.layoutVertexArray.length;Do=Ni.entranceBloom.indexArray.length,Q1(Xr,.5/this.tileToMeter,Ni.entranceBloom.indexArray,Ni.entranceBloom.layoutVertexArray,Ni.entranceBloom.layoutAttenuationArray);const ba=Ni.entranceBloom.layoutVertexArray.length-ro;Ba=Ni.entranceBloom.indexArray.length-Do;for(let wa=0;wa<ba;wa++)Ni.entranceBloom.layoutColorArray.emplaceBack(255*$t.r<<8|255*$t.g,255*$t.b<<8|51*kt);Po.vertexLength+=ba,Po.primitiveLength+=Ba,Oa={part:Vi.buildingPart,vertexOffset:ro,vertexLength:ba}}Ni.layoutVertexArray.float32.set(Vi.positions,3*Ya);const no=Vi.positions.length/3;for(let Xr=0;Xr<no;++Xr){const Po=3*Xr;Tg=Math.max(Tg,Vi.positions[Po+2]);const ro=Vi.normals[Po+1]*Vy,ba=Vi.normals[Po+2]*Vy,wa=3*(Ya+Xr);Ni.layoutNormalArray.int16[wa]=Vi.normals[Po]*Vy,Ni.layoutNormalArray.int16[wa+1]=ro,Ni.layoutNormalArray.int16[wa+2]=ba;const tp=Vi.ao[Xr];Ni.layoutAOArray.uint8[Ya+Xr]=255*tp;const Lo=1+(tp-1)*at,xs=255*xo.b*Lo<<8|255*Cr;Ni.layoutColorArray.uint16[2*(Ya+Xr)]=255*xo.r*Lo<<8|255*xo.g*Lo,Ni.layoutColorArray.uint16[2*(Ya+Xr)+1]=xs}const nc=Math.floor($r.x),ys=Math.floor($r.y),Ws=Math.floor(We);for(let Xr=0;Xr<no;++Xr){const Po=3*(Ya+Xr);Ni.layoutCentroidArray.int16[Po]=nc,Ni.layoutCentroidArray.int16[Po+1]=ys,Ni.layoutCentroidArray.int16[Po+2]=Ws}if(Ni.layoutFloodLightDataArray.uint16.fill(Vi.buildingPart===0?ci:0,Ya,Ya+no),Ei){const Xr=255*ct.r<<8|255*ct.g,Po=255*ct.b<<8|255*qt;for(let ro=0;ro<no;++ro){const ba=2*(Ya+ro);Ni.layoutFacadePaintArray.uint16[ba]=Xr,Ni.layoutFacadePaintArray.uint16[ba+1]=Po}for(let ro=0;ro<no;++ro)if(Vi.isFauxFacade[ro]){const ba=Math.min(65535,Math.floor(Vi.uv[2*ro]*fo.outerRingLength));Ni.layoutFacadeDataArray.emplace(Ya+ro,1|ba,$n,tr,ir),Ni.layoutFacadeVerticalRangeArray.emplace(Ya+ro,sn,Tn)}else Ni.layoutFacadeDataArray.emplace(Ya+ro,0,0,0,0),Ni.layoutFacadeVerticalRangeArray.emplace(Ya+ro,0,0)}const vo=fr.vertexLength,H_=Vi.indices.length/3,Ph=Ni.indexArray.length;Ni.indexArray.resize(Ph+H_);for(let Xr=0;Xr<H_;++Xr){const Po=3*Xr,ro=3*Ph+Po;Ni.indexArray.uint16[ro]=vo+Vi.indices[Po],Ni.indexArray.uint16[ro+1]=vo+Vi.indices[Po+1],Ni.indexArray.uint16[ro+2]=vo+Vi.indices[Po+2]}Vi.buildingPart!==1&&Vi.buildingPart!==0&&Vi.buildingPart!==2&&Vi.buildingPart!==3||Xs.push({part:Vi.buildingPart,vertexOffset:Ya,vertexLength:Vi.positions.length/3}),Ya+=no,fr.vertexLength+=no,fr.primitiveLength+=Vi.indices.length/3}this.maxHeight=Math.max(this.maxHeight,Tg);const fx=Ni.indexArray.length-dx,Dh=this.footprintsIndices.length,Hd=this.footprintsVertices.length,ep=[],ic=new _t(1/0,1/0),kc=new _t(-1/0,-1/0),G_=this.groundEffect.vertexArray.length;for(const Vi of fo.modifiedPolygonRings){const xo=[],Cr=new _t(1/0,1/0),no=new _t(-1/0,-1/0);for(let nc=0;nc<Vi.length;nc+=2){const ys=Vi.length-nc-2;Cr.x=Math.min(Cr.x,Vi[ys]),Cr.y=Math.min(Cr.y,Vi[ys+1]),no.x=Math.max(no.x,Vi[ys]),no.y=Math.max(no.y,Vi[ys+1]);const Ws=new _t(Vi[ys],Vi[ys+1]);xo.push(Ws),ep.push(Ws.x,Ws.y),this.footprintsVertices.emplaceBack(Ws.x,Ws.y)}ic.x=Math.min(ic.x,Cr.x),ic.y=Math.min(ic.y,Cr.y),kc.x=Math.max(kc.x,no.x),kc.y=Math.max(kc.y,no.y),this.groundEffect.addData(xo,[Cr,no],st)}const Sg=this.groundEffect.vertexArray.length-G_;this.groundEffect.groundRadiusArray.reserveForAdditional(Sg);for(let Vi=0;Vi<Sg;Vi++)this.groundEffect.groundRadiusArray.emplaceBack(lt);(zo.x<0||ra.x>Lt||zo.y<0||ra.y>Lt)&&this.featuresOnBorder.push({featureId:V.id,footprintIndex:this.footprints.length});{const Vi=qs(ep,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Vi.length),this.footprintsIndices.uint16.set(Vi,Dh),this.buildingIds.add(ae??V.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ic.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ic.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,kc.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,kc.y);const xo={footprintVertexOffset:Hd,footprintVertexLength:this.footprintsVertices.length-Hd,footprintIndexOffset:Dh,footprintIndexLength:this.footprintsIndices.length-Dh,min:ic,max:kc,hiddenFlags:0,indicesOffset:dx,indicesLength:fx,bloomIndicesOffset:Do,bloomIndicesLength:Ba,groundEffectVertexOffset:G_,groundEffectVertexLength:Sg,hasFauxFacade:Ei,height:Tg,promoteId:Z,feature:ge,parts:Xs,buildingBloom:Oa},Cr=this.footprints.length;V.id!==void 0&&this.featureFootprintLookup.set(V.id,Cr),R(ae,Cr),this.footprints.push(xo)}this.programConfigurations.populatePaintArrays(Ni.layoutVertexArray.length,V,Y,{},i.availableImages,r,i.brightness),this.groundEffect.addPaintPropertiesData(V,Y,{},i.availableImages,r,i.brightness),i.featureIndex.insert(V,_e,Y,Q,this.index,zh)}S.forEach(({buildingId:V,footprintIndex:Z})=>{A.has(V)&&(this.footprints[Z].hiddenFlags|=4)});const G=new Set;this.buildingIds.forEach((V,Z,Y)=>{A.has(V)||G.add(V)}),this.buildingIds=G,this.groundEffect.prepareBorderSegments()}update(e,i,r,l,h,f,m){this.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m),this.groundEffect.update(e,i,h,r,l,f,m),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const i=r=>{r.layoutVertexBuffer=e.createVertexBuffer(r.layoutVertexArray,J1.members),r.layoutNormalBuffer=e.createVertexBuffer(r.layoutNormalArray,OE.members),r.layoutCentroidBuffer=e.createVertexBuffer(r.layoutCentroidArray,BE.members),r.layoutFloodLightDataBuffer=e.createVertexBuffer(r.layoutFloodLightDataArray,VE.members),r.layoutFacadeDataArray&&r.layoutFacadeDataArray.length&&(r.layoutFacadeDataBuffer=e.createVertexBuffer(r.layoutFacadeDataArray,FE.members)),r.layoutFacadeVerticalRangeArray&&r.layoutFacadeVerticalRangeArray.length&&(r.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(r.layoutFacadeVerticalRangeArray,NE.members)),r.entranceBloom.layoutVertexArray.length&&(r.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(r.entranceBloom.layoutVertexArray,J1.members),r.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(r.entranceBloom.layoutAttenuationArray,UE.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,i,r=!0){let l=!1;const h=r?i:0,f=0|(r?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const m of e){const x=this.footprints[m],v=x.hiddenFlags&f|h;x.hiddenFlags!==v&&(x.hiddenFlags=v,l=!0,this.groundEffect.updateHiddenByLandmarkRange(x.groundEffectVertexOffset,x.groundEffectVertexLength,x.hiddenFlags!==0))}return l&&(this.indexArrayForConflationUploaded=!1),l}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=l=>{l.indexArray.length!==0&&(l.indexArrayForConflation.resize(l.indexArray.length),l.indexArrayForConflation.uint16.set(l.indexArray.uint16),l.entranceBloom.indexArrayForConflation.resize(l.entranceBloom.indexArray.length),l.entranceBloom.indexArrayForConflation.uint16.set(l.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const l of this.footprints){const h=l.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,f=l.indicesOffset+l.indicesLength;if(l.hiddenFlags!==0){for(let x=l.indicesOffset;x<f;x++)h.indexArrayForConflation.uint16[3*x+0]=0,h.indexArrayForConflation.uint16[3*x+1]=0,h.indexArrayForConflation.uint16[3*x+2]=0;const m=l.bloomIndicesOffset+l.bloomIndicesLength;for(let x=l.bloomIndicesOffset;x<m;x++)h.entranceBloom.indexArrayForConflation.uint16[3*x+0]=0,h.entranceBloom.indexArrayForConflation.uint16[3*x+1]=0,h.entranceBloom.indexArrayForConflation.uint16[3*x+2]=0}}const r=l=>{l.indexArray.length!==0&&(l.indexBuffer?l.indexBuffer.updateData(l.indexArrayForConflation):l.indexBuffer=e.createIndexBuffer(l.indexArrayForConflation,!0),l.entranceBloom.indexBuffer?l.entranceBloom.indexBuffer.updateData(l.entranceBloom.indexArrayForConflation):l.entranceBloom.indexBuffer=e.createIndexBuffer(l.entranceBloom.indexArrayForConflation,!0))};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=r=>{r.layoutColorBuffer?r.layoutColorBuffer.updateData(r.layoutColorArray):r.layoutColorBuffer=e.createVertexBuffer(r.layoutColorArray,eb.members,!0),r.layoutFacadePaintArray&&(r.layoutFacadePaintBuffer?r.layoutFacadePaintBuffer.updateData(r.layoutFacadePaintArray):r.layoutFacadePaintBuffer=e.createVertexBuffer(r.layoutFacadePaintArray,kE.members,!0)),r.entranceBloom.layoutColorBuffer?r.entranceBloom.layoutColorBuffer.updateData(r.entranceBloom.layoutColorArray):r.entranceBloom.layoutColorBuffer=e.createVertexBuffer(r.entranceBloom.layoutColorArray,eb.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const r=e.paint.get("building-ambient-occlusion-intensity");for(const l of this.footprints){if(4&l.hiddenFlags)continue;const h=i[l.promoteId],f=l.feature;f.properties["building-part"]="roof";const m=e.paint.get("building-color").evaluate(f,h,this.canonical).toPremultipliedRenderColor(this.lut),x=e.paint.get("building-emissive-strength").evaluate(f,h,this.canonical);f.properties["building-part"]="wall";const v=e.paint.get("building-color").evaluate(f,h,this.canonical).toPremultipliedRenderColor(this.lut),S=e.paint.get("building-emissive-strength").evaluate(f,h,this.canonical);f.properties["building-part"]="window";const A=e.paint.get("building-color").evaluate(f,h,this.canonical).toPremultipliedRenderColor(this.lut),M=e.paint.get("building-emissive-strength").evaluate(f,h,this.canonical);f.properties["building-part"]="door";const R=e.paint.get("building-color").evaluate(f,h,this.canonical).toPremultipliedRenderColor(this.lut),D=e.paint.get("building-emissive-strength").evaluate(f,h,this.canonical),U=l.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const V of l.parts){let Z,Y=m;V.part===1?(Y=m,Z=x):V.part===0?(Y=v,Z=S):V.part===2?(Y=A,Z=M):V.part===3&&(Y=R,Z=D),Z=he(Z,0,1);for(let Q=0;Q<V.vertexLength;Q++){const le=V.vertexOffset+Q,ae=1+(U.layoutAOArray.uint8[le]/255-1)*r;U.layoutColorArray.emplace(le,Y.r*ae*255<<8|Y.g*ae*255,Y.b*ae*255<<8|255*Z),l.hasFauxFacade&&U.layoutFacadePaintArray.emplace(le,255*A.r<<8|255*A.g,255*A.b<<8|255*M)}}const G=l.buildingBloom;if(G)for(let V=0;V<G.vertexLength;V++)U.entranceBloom.layoutColorArray.emplace(G.vertexOffset+V,255*R.r<<8|255*R.g,255*R.b<<8|51*D)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,r){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped());if(s(this.activeReplacements,l))return;this.activeReplacements=l;for(const f of this.footprints)f.hiddenFlags&=-2;const h=[];for(const f of this.activeReplacements){if(f.order<r)continue;const m=Math.max(1,Math.pow(2,f.footprintTileId.canonical.z-e.canonical.z));for(const x of this.footprints)x.min.x>f.max.x||x.max.x<f.min.x||x.min.y>f.max.y||x.max.y<f.min.y||(h.length=0,qE(this.footprintsVertices,x.footprintVertexOffset,x.footprintVertexLength,f.footprintTileId.canonical,e.canonical,h),w(f.footprint,h,this.footprintsIndices.uint16,x.footprintIndexOffset,x.footprintIndexLength,0,-m)&&(x.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(f.groundEffectVertexOffset,f.groundEffectVertexLength,f.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const i=this.featureFootprintLookup.get(e.id);return this.footprints[i]}return null}getHeightAtTileCoord(e,i){let r=Number.NEGATIVE_INFINITY,l=!0;const h=4*(e+Lt)*Lt+(i+Lt);if(this.footprintLookup.hasOwnProperty(h)){const m=this.footprintLookup[h];return m?{height:m.height,hidden:m.hiddenFlags!==0}:void 0}const f=new _t(e,i);for(const m of this.footprints)e>m.max.x||m.min.x>e||i>m.max.y||m.min.y>i||m.height<=r||HE(f,this.footprintsVertices.float32.subarray(2*m.footprintVertexOffset,2*(m.footprintVertexOffset+m.footprintVertexLength)),this.footprintsIndices.uint16.subarray(m.footprintIndexOffset,m.footprintIndexOffset+m.footprintIndexLength))&&(r=m.height,this.footprintLookup[h]=m,l=m.hiddenFlags!==0);if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:l};this.footprintLookup[h]=void 0}}function HE(n,e,i){for(let r=0;r<i.length;r+=3){const l=i[r],h=i[r+1],f=i[r+2],m=e[2*l+0],x=e[2*l+1],v=e[2*h+0],S=e[2*h+1],A=e[2*f+0],M=e[2*f+1],R=(m-A)*(n.y-M)-(x-M)*(n.x-A),D=(v-m)*(n.y-x)-(S-x)*(n.x-m);if(R<0!=D<0&&R!==0&&D!==0)continue;const U=(A-v)*(n.y-S)-(M-S)*(n.x-v);if(U===0||U<0==R+D<=0)return!0}return!1}function qE(n,e,i,r,l,h){const f=Math.pow(2,r.z-l.z);for(let m=0;m<i;m++){let x=n.float32[2*(m+e)+0],v=n.float32[2*(m+e)+1];x=(x+l.x*Lt)*f-r.x*Lt,v=(v+l.y*Lt)*f-r.y*Lt,h.push(new _t(x,v))}}let nb,rb;zt(ib,"BuildingBucket",{omit:["layers"]}),zt(w0,"BuildingGeometry"),zt(b0,"BuildingBloomGeometry");const ZE=Gi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),$E=Gi([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:XE}=ZE,WE=Gi([{name:"a_packed",components:3,type:"Float32"}]),{members:YE}=WE,KE=Gi([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:QE}=KE;class ob{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Dc({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const r=this.getKey(e,i);return this.positions[r]}trim(){const e=this.width,i=this.height=yt(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,r){const l=[];let h=e.length%2==1?-e[e.length-1]*r:0,f=e[0]*r,m=!0;l.push({left:h,right:f,isDash:m,zeroLength:e[0]===0});let x=e[0];for(let v=1;v<e.length;v++){m=!m;const S=e[v];h=x*r,x+=S,f=x*r,l.push({left:h,right:f,isDash:m,zeroLength:S===0})}return l}addRoundDash(e,i,r){const l=i/2;for(let h=-r;h<=r;h++){const f=this.width*(this.nextRow+r+h);let m=0,x=e[m];for(let v=0;v<this.width;v++){v/x.right>1&&(x=e[++m]);const S=Math.abs(v-x.left),A=Math.abs(v-x.right),M=Math.min(S,A);let R;const D=h/r*(l+1);if(x.isDash){const U=l-Math.abs(D);R=Math.sqrt(M*M+U*U)}else R=l-Math.sqrt(M*M+D*D);this.image.data[f+v]=Math.max(0,Math.min(255,R+128))}}}addRegularDash(e,i){for(let x=e.length-1;x>=0;--x){const v=e[x],S=e[x+1];v.zeroLength?e.splice(x,1):S&&S.isDash===v.isDash&&(S.left=v.left,e.splice(x,1))}const r=e[0],l=e[e.length-1];r.isDash===l.isDash&&(r.left=l.left-this.width,l.right=r.right+this.width);const h=this.width*this.nextRow;let f=0,m=e[f];for(let x=0;x<this.width;x++){x/m.right>1&&(m=e[++f]);const v=Math.abs(x-m.left),S=Math.abs(x-m.right),A=Math.min(v,S);this.image.data[h+x]=Math.max(0,Math.min(255,(m.isDash?A:-A)+i+128))}}addDash(e,i){const r=this.getKey(e,i);if(this.positions[r])return this.positions[r];const l=i==="round",h=l?7:0,f=2*h+1;if(this.nextRow+f>this.height)return vi("LineAtlas out of space"),null;e.length===0&&e.push(1);let m=0;for(let S=0;S<e.length;S++)e[S]<0&&(vi("Negative value is found in line dasharray, replacing values with 0"),e[S]=0),m+=e[S];if(m!==0){const S=this.width/m,A=this.getDashRanges(e,this.width,S);l?this.addRoundDash(A,S,h):this.addRegularDash(A,i==="square"?.5*S:0)}const x=this.nextRow+h;this.nextRow+=f;const v={tl:[x,h],br:[m,0]};return this.positions[r]=v,v}}zt(ob,"LineAtlas");const JE=Hi.types,eA=Math.cos(Math.PI/180*37.5),tA=Math.cos(Math.PI/180*5);class T0{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new mo,this.layoutVertexArray2=new Za,this.patternVertexArray=new Za,this.indexArray=new Lr,this.programConfigurations=new I(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new kn,this.maxLineLength=0,this.zOffsetVertexArray=new Za,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,l){}populate(e,i,r,l){this.hasPattern=r_("line",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Et(r);const f=this.layers[0].layout.get("line-elevation-reference");if(f==="hd-road-markup")this.elevationType="road";else{const M=this.layers[0].layout.get("line-z-offset"),R=M.isConstant()&&!M.constantOr(0);this.elevationType=f!=="sea"&&f!=="ground"&&R?"none":"offset",this.elevationType==="offset"&&f==="none"&&vi(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const m=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&m!==void 0;const x=[];for(const{feature:M,id:R,index:D,sourceLayerIndex:U}of e){const G=this.layers[0]._featureFilter.needGeometry,V=Ri(M,G);if(!this.layers[0]._featureFilter.filter(new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),V,r))continue;const Z=h?h.evaluate(V,{},r):void 0,Y={id:R,properties:M.properties,type:M.type,sourceLayerIndex:U,index:D,geometry:G?V.geometry:fi(M,r,l),patterns:{},sortKey:Z};x.push(Y)}h&&x.sort((M,R)=>M.sortKey-R.sortKey);const{lineAtlas:v,featureIndex:S}=i,A=this.addConstantDashes(v);for(const M of x){const{geometry:R,index:D,sourceLayerIndex:U}=M;if(A&&this.addFeatureDashes(M,v),this.hasPattern){const G=o_("line",this.layers,M,this.zoom,this.pixelRatio,i);this.patternFeatures.push(G)}else this.addFeature(M,R,D,r,v.positions,i.availableImages,i.brightness,i.elevationFeatures);S.insert(e[D].feature,R,D,U,this.index)}}addConstantDashes(e){let i=!1;for(const r of this.layers){const l=r.paint.get("line-dasharray").value,h=r.layout.get("line-cap").value;if(l.kind!=="constant"||h.kind!=="constant")i=!0;else{const f=h.value,m=l.value;if(!m)continue;e.addDash(m,f)}}return i}addFeatureDashes(e,i){const r=this.zoom;for(const l of this.layers){const h=l.paint.get("line-dasharray").value,f=l.layout.get("line-cap").value;if(h.kind==="constant"&&f.kind==="constant")continue;let m,x;if(h.kind==="constant"){if(m=h.value,!m)continue}else m=h.evaluate({zoom:r},e);x=f.kind==="constant"?f.value:f.evaluate({zoom:r},e),i.addDash(m,x),e.patterns[l.id]=[i.getKey(m,x)]}}update(e,i,r,l,h,f,m,x){this.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m,x)}addFeatures(e,i,r,l,h,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,r,l,f,e.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,YE)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,QE)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,$E.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,XE),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,i){let r,l;if(i&&i>0?(r=`mapbox_clip_start_${i}`,l=`mapbox_clip_end_${i}`):(r="mapbox_clip_start",l="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(r)&&e.properties.hasOwnProperty(l))return{start:+e.properties[r],end:+e.properties[l]}}addFeature(e,i,r,l,h,f,m,x){const v=this.layers[0].layout,S=v.get("line-join").evaluate(e,{}),A=v.get("line-cap").evaluate(e,{}),M=v.get("line-miter-limit"),R=v.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const D=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=v.get("line-z-offset").value;const U=this.layers[0].paint.get("line-width").value;if(U.kind!=="constant"&&U.isLineProgressConstant===!1&&(this.variableWidthValue=U),this.elevationType==="road"){const G=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,l,x,S,A,M,R)){const[V,Z]=this.clipRuntimeLinesToTile(i,1);for(let Y=0;Y<V.length;Y++){const Q=V[Y],le=Z[Y],ae={progress:{min:le.progress.min,max:le.progress.max},nextDir:this.computeSegNextDir(le,Q),prevDir:this.computeSegPrevDir(le,Q)};this.addLine(Q,e,l,S,A,M,R,ae,D&&le.parentIndex>0?le.parentIndex:null)}this.fillNonElevatedRoadSegment(G)}}else for(let G=0;G<i.length;G++)this.addLine(i[G],e,l,S,A,M,R,void 0,D&&G>0?G:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,h,f,l,m,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return zy(e,-i,-i,Lt+i,Lt+i)}clipRuntimeLinesToTile(e,i){const r=[];return[zy(e,-i,-i,Lt+i,Lt+i,r),r]}addElevatedRoadFeature(e,i,r,l,h,f,m,x){const v=[],S=go.getElevationFeature(e,l);if(S){const A=this.clipLinesToTile(i,1),M=this.prepareElevatedLines(A,S,r);for(const R of M)v.push({geometry:R,elevation:S,elevationTileID:r,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(v.length===0)return!1;for(const A of v){const M=this.layoutVertexArray.length;this.addLine(A.geometry,e,r,h,f,m,x);const R=new Pa(r,A.elevationTileID);if(A.elevation)for(let D=M;D<this.layoutVertexArray.length;D++){const U=new _t(this.layoutVertexArray.int16[6*D]>>1,this.layoutVertexArray.int16[6*D+1]>>1),G=R.pointElevation(U,A.elevation,.05);this.updateHeightRange(G),this.zOffsetVertexArray.emplaceBack(G,0,0)}else this.fillNonElevatedRoadSegment(M)}return!0}prepareElevatedLines(e,i,r){if(i.constantHeight!=null)return e;const l=[],h=1/Et(r);for(const f of e)cE(f,new ga(i,h),0,l);return l}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,r,l,h,f,m,x,v){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=v?this.lineFeatureClips(i,v):this.lineClips;const S=l==="none";this.patternJoinNone=this.hasPattern&&S,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const A=x&&x.progress.min>0,M=x&&x.progress.max<1;if(this.lineClips){let pe={min:this.lineClips.start,max:this.lineClips.end},be=1;if(x){const Ze=this.lineClips.end-this.lineClips.start;pe=(function(We,lt,at){return{min:Yr(We.min,lt,at),max:Yr(We.max,lt,at)}})(x.progress,{min:0,max:1},pe),Ze>0&&(be=(pe.max-pe.min)/Ze)}const Me=+i.properties.mapbox_clip_feature_len,Ye=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(Me)||Number.isNaN(Ye)){for(let We=0;We<e.length-1;We++)this.totalDistance+=e[We].dist(e[We+1]);const Ze=this.totalDistance/(pe.max-pe.min);this.totalFeatureLength=Number.isFinite(Ze)?Ze:0,this.lineClips.start=pe.min,this.lineClips.end=pe.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=Me,this.distance=Ye*be,this.lineClips.start=pe.min,this.lineClips.end=pe.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const R=JE[i.type]==="Polygon";let D=e.length;for(;D>=2&&e[D-1].equals(e[D-2]);)D--;let U=0;for(;U<D-1&&e[U].equals(e[U+1]);)U++;if(D<(R?3:2))return;l==="bevel"&&(f=1.05);const G=this.segments.prepareSegment(10*D,this.layoutVertexArray,this.indexArray);let V,Z,Y,Q,le,ae,ge,_e;x&&x.prevDir&&(ae=x.prevDir.perp()),x&&x.nextDir&&(ge=x.nextDir.perp()),this.e1=this.e2=-1,R&&(V=e[D-2],le=e[U].sub(V)._unit()._perp());for(let pe=U;pe<D;pe++){if(Y=pe===D-1?R?e[U+1]:void 0:e[pe+1],Y&&e[pe].equals(Y))continue;le&&(Q=le),V&&(Z=V),V=e[pe],_e=this.evaluateLineProgressFeatures(Z?Z.dist(V):0),le=Y?Y.sub(V)._unit()._perp():Q,Q=Q||le;const be=Z&&Y;let Me=be?l:R||S?"butt":h;const Ye=Q.x*le.x+Q.y*le.y;if(S){const tt=function(gt){if(gt.patternJoinNone){const ct=gt.segmentPoints.length/2,qt=gt.lineSoFar-gt.segmentStart;for(let $t=0;$t<ct;++$t){const kt=gt.segmentPoints[2*$t+1],Nt=Math.round(gt.segmentPoints[2*$t])+.5+.25*kt;gt.patternVertexArray.emplaceBack(Nt,qt,gt.segmentStart),gt.patternVertexArray.emplaceBack(Nt,qt,gt.segmentStart)}gt.segmentPoints.length=0}gt.e1=gt.e2=-1};if(be&&Ye<tA){this.updateDistance(Z,V),this.addCurrentVertex(V,Q,1,1,G,_e),tt(this),this.addCurrentVertex(V,le,-1,-1,G,_e);continue}if(Z){if(!Y){this.updateDistance(Z,V),this.addCurrentVertex(V,Q,1,1,G,_e),tt(this);continue}Me="miter"}}let Ze=Q.add(le);Ze.x===0&&Ze.y===0||Ze._unit();const We=Ze.x*le.x+Ze.y*le.y,lt=We!==0?1/We:1/0,at=2*Math.sqrt(2-2*We),st=We<eA&&Z&&Y,He=Q.x*le.y-Q.y*le.x>0,ht=this.overscaling<=16?122880/(512*this.overscaling):0;if(be&&Me==="round"){if(lt<m)Me="miter";else if(lt<=2){const tt=S0(V,-10,8202);Me=this.elevationType==="offset"&&(tt||this.hasCrossSlope)?"miter":"fakeround"}}if(Me==="miter"&&lt>f&&(Me="bevel"),Me==="bevel"&&(lt>2&&(Me="flipbevel"),lt<f&&(Me="miter")),Z&&!(Me==="miter"&&st)&&this.updateDistance(Z,V),Me==="miter")if(st){const tt=V.dist(Z);if(tt>2*ht){const ct=V.sub(V.sub(Z)._mult(ht/tt)._round());this.updateDistance(Z,ct),this.addCurrentVertex(ct,Q,0,0,G,_e),Z=ct}this.updateDistance(Z,V),Ze._mult(lt),this.addCurrentVertex(V,Ze,0,0,G,_e);const gt=V.dist(Y);if(gt>2*ht){const ct=V.add(Y.sub(V)._mult(ht/gt)._round());this.updateDistance(V,ct),this.addCurrentVertex(ct,le,0,0,G,_e),V=ct}}else Ze._mult(lt),this.addCurrentVertex(V,Ze,0,0,G,_e);else if(Me==="flipbevel"){if(lt>100)Ze=le.mult(-1);else{const tt=lt*Q.add(le).mag()/Q.sub(le).mag();Ze._perp()._mult(tt*(He?-1:1))}this.addCurrentVertex(V,Ze,0,0,G,_e),this.addCurrentVertex(V,Ze.mult(-1),0,0,G,_e)}else if(Me==="bevel"||Me==="fakeround"){_e!=null&&Z&&this.addCurrentVertex(V,ge||Q,-1,-1,G,_e);const tt=V.dist(Z)<=2*ht&&Me!=="bevel",gt=Ze.mult(He?1:-1);gt._mult(lt);const ct=le.mult(He?-1:1),qt=Q.mult(He?-1:1),$t=this.evaluateLineProgressFeatures(this.distance);if(_e==null&&(this.addHalfVertex(V,gt.x,gt.y,!1,!He,0,G,$t),tt||this.addHalfVertex(V,gt.x+2*qt.x,gt.y+2*qt.y,!1,He,0,G,$t)),Me==="fakeround"){const kt=Math.round(180*at/Math.PI/20);this.addHalfVertex(V,qt.x,qt.y,!1,He,0,G,$t);for(let Nt=0;Nt<kt;Nt++){let ci=Nt/kt;if(ci!==.5){const Gt=ci-.5;ci+=ci*Gt*(ci-1)*((1.0904+Ye*(Ye*(3.55645-1.43519*Ye)-3.2452))*Gt*Gt+(.848013+Ye*(.215638*Ye-1.06021)))}const ii=ct.sub(qt)._mult(ci)._add(qt)._unit();this.addHalfVertex(V,ii.x,ii.y,!1,He,0,G,$t)}this.addHalfVertex(V,ct.x,ct.y,!1,He,0,G,$t)}tt||_e!=null||this.addHalfVertex(V,gt.x+2*ct.x,gt.y+2*ct.y,!1,He,0,G,$t),_e!=null&&Y&&this.addCurrentVertex(V,ae||le,1,1,G,_e)}else if(Me==="butt")this.addCurrentVertex(V,Ze,0,0,G,_e);else if(Me==="square"){if(!Z){const tt=A?0:-1;this.addCurrentVertex(V,Ze,tt,tt,G,_e)}if(this.addCurrentVertex(V,Ze,0,0,G,_e),Z){const tt=M?0:1;this.addCurrentVertex(V,Ze,tt,tt,G,_e)}}else if(Me==="round"){if(Z){const tt=!be&&ge?ge:Q;this.addCurrentVertex(V,tt,0,0,G,_e),!be&&M||this.addCurrentVertex(V,tt,1,1,G,_e,!0)}if(Y){const tt=!be&&ae?ae:le;!be&&A||this.addCurrentVertex(V,tt,-1,-1,G,_e,!0),this.addCurrentVertex(V,tt,0,0,G,_e)}}}}addVerticesTo(e,i,r,l,h,f,m,x,v,S){const A=(i.w-e.w)/this.tessellationStep|0;let M=0;const R=this.scaledDistance;if(A>1){this.lineSoFar=e.w;const U=(i.x-e.x)/A,G=(i.y-e.y)/A,V=(i.z-e.z)/A,Z=(i.w-e.w)/A;for(let Y=1;Y<A;++Y){e.x+=U,e.y+=G,e.z+=V,this.lineSoFar+=Z,M+=Z;const Q=this.evaluateLineProgressFeatures(this.prevDistance+M);this.scaledDistance=(this.prevDistance+M)/this.totalDistance,this.addHalfVertex(e,r,l,S,!1,m,v,Q),this.addHalfVertex(e,h,f,S,!0,-x,v,Q)}}this.lineSoFar=i.w,this.scaledDistance=R;const D=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,r,l,S,!1,m,v,D),this.addHalfVertex(i,h,f,S,!0,-x,v,D)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):vi(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,r,l,h,f,m=!1){const x=i.x+i.y*r,v=i.y-i.x*r,S=i.y*l-i.x,A=-i.y-i.x*l;if(f!=null){const M=this.elevationType==="offset",R=-10,D=8202,U=f.zOffset,G=new b1(e.x,e.y,U,this.lineSoFar),V=!!M&&S0(e,R,D),Z=this.lineSoFar,Y=this.distance;if(this.currentVertex)if(V){const Q=this.currentVertexIsOutside,le=this.currentVertex,ae=new b1(e.x,e.y,U,this.lineSoFar);if(T1(le,ae,R,D),!S0(ae,R,D)){if(Q){this.e1=this.e2=-1,this.distance-=le.dist(G),this.lineSoFar=le.w;const ge=this.evaluateLineProgressFeatures(le.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(le,x,v,m,!1,r,h,ge),this.addHalfVertex(le,S,A,m,!0,-l,h,ge),this.prevDistance=this.distance}this.distance=this.prevDistance+le.dist(ae),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(le,ae,x,v,S,A,r,l,h,m),this.distance=Y,this.scaledDistance=this.distance/this.totalDistance}}else{const Q=this.currentVertex;if(this.currentVertexIsOutside){T1(Q,G,R,D),this.e1=this.e2=-1,this.distance-=Q.dist(G),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=Q.w;const le=this.evaluateLineProgressFeatures(Q.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(Q,x,v,m,!1,r,h,le),this.addHalfVertex(Q,S,A,m,!0,-l,h,le),this.prevDistance=this.distance,this.distance=Y,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(Q,G,x,v,S,A,r,l,h,m)}else V||(this.addHalfVertex(e,x,v,m,!1,r,h,f),this.addHalfVertex(e,S,A,m,!0,-l,h,f));this.currentVertex=G,this.currentVertexIsOutside=V,this.lineSoFar=Z}else this.addHalfVertex(e,x,v,m,!1,r,h,f),this.addHalfVertex(e,S,A,m,!0,-l,h,f)}addHalfVertex({x:e,y:i},r,l,h,f,m,x,v){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),f||this.segmentPoints.push(this.lineSoFar-this.segmentStart,m)),this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(i<<1)+(f?1:0),Math.round(63*r)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const A=mi(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,A)}const S=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),x.primitiveLength++),f?this.e2=S:this.e1=S,v!=null&&this.zOffsetVertexArray.emplaceBack(v.zOffset,v.variableWidth,v.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function S0(n,e,i){return n.x<e||n.x>i||n.y<e||n.y>i}let ab,sb;function lb(n,e,i){return e*(Lt/(n.tileSize*Math.pow(2,i-n.tileID.overscaledZ)))}zt(T0,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const cb=(n,e,i)=>(1-i)*n+i*e;function ub(n,e){return 1/lb(n,1,e.tileZoom)}function hb(n,e,i,r){return n.translatePosMatrix(r||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const db=n=>{const e=[];fb(n)&&e.push("RENDER_LINE_DASH"),n.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=n.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),n.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const r=n.layout.get("line-join").constantOr("miter")==="none",l=!!n.paint.get("line-pattern").constantOr(1);return r&&l&&e.push("LINE_JOIN_NONE"),e};function fb(n){const e=n.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let E0;const pb=()=>E0||(E0={layout:ab||(ab=new qn({"line-cap":new Ut(Oe.layout_line["line-cap"]),"line-join":new Ut(Oe.layout_line["line-join"]),"line-miter-limit":new It(Oe.layout_line["line-miter-limit"]),"line-round-limit":new It(Oe.layout_line["line-round-limit"]),"line-sort-key":new Ut(Oe.layout_line["line-sort-key"]),"line-z-offset":new Ut(Oe.layout_line["line-z-offset"]),"line-elevation-reference":new It(Oe.layout_line["line-elevation-reference"]),"line-cross-slope":new It(Oe.layout_line["line-cross-slope"]),visibility:new It(Oe.layout_line.visibility),"line-width-unit":new It(Oe.layout_line["line-width-unit"])})),paint:sb||(sb=new qn({"line-opacity":new Ut(Oe.paint_line["line-opacity"]),"line-color":new Ut(Oe.paint_line["line-color"]),"line-translate":new It(Oe.paint_line["line-translate"]),"line-translate-anchor":new It(Oe.paint_line["line-translate-anchor"]),"line-width":new Ut(Oe.paint_line["line-width"]),"line-gap-width":new Ut(Oe.paint_line["line-gap-width"]),"line-offset":new Ut(Oe.paint_line["line-offset"]),"line-blur":new Ut(Oe.paint_line["line-blur"]),"line-dasharray":new Ut(Oe.paint_line["line-dasharray"]),"line-pattern":new Ut(Oe.paint_line["line-pattern"]),"line-pattern-cross-fade":new It(Oe.paint_line["line-pattern-cross-fade"]),"line-gradient":new uu(Oe.paint_line["line-gradient"]),"line-trim-offset":new It(Oe.paint_line["line-trim-offset"]),"line-trim-fade-range":new It(Oe.paint_line["line-trim-fade-range"]),"line-trim-color":new It(Oe.paint_line["line-trim-color"]),"line-emissive-strength":new Ut(Oe.paint_line["line-emissive-strength"]),"line-border-width":new Ut(Oe.paint_line["line-border-width"]),"line-border-color":new Ut(Oe.paint_line["line-border-color"]),"line-occlusion-opacity":new It(Oe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}
vendor: 4,516 bytes, line 218
218),"line-gradient-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},E0);class iA extends Ut{possiblyEvaluate(e,i){return i=new mn(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,l){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,l)}}let w_;function mb(n,e){return e>0?e+2*n:n}const nA=Gi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rA=Gi([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),oA=Gi([{name:"a_projected_pos",components:4,type:"Float32"}],4);Gi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aA=Gi([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),sA=Gi([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),lA=Gi([{name:"a_texb",components:2,type:"Uint16"}]),cA=Gi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),uA=Gi([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Gi([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const gb=Gi([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),hA=Gi([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Gi([{name:"triangle",components:3,type:"Uint16"}]),Gi([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Gi([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
vendor: 10,465 bytes, line 218
218]),Gi([{type:"Float32",name:"offsetX"}]),Gi([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var yo=24;function dA(n,e,i){return n.sections.forEach(r=>{r.text=(function(l,h,f){const m=h.layout.get("text-transform").evaluate(f,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),Ia.applyArabicShaping&&(l=Ia.applyArabicShaping(l)),l})(r.text,e,i)}),n}const T_={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function fA(n){return n==="︶"||n==="﹈"||n==="︸"||n==="﹄"||n==="﹂"||n==="︾"||n==="︼"||n==="︺"||n==="︘"||n==="﹀"||n==="︐"||n==="︓"||n==="︔"||n==="`"||n===" ̄"||n==="︑"||n==="︒"}function pA(n){return n==="︵"||n==="﹇"||n==="︷"||n==="﹃"||n==="﹁"||n==="︽"||n==="︻"||n==="︹"||n==="︗"||n==="︿"}const A0=4294967296,_b=1/A0,yb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let jy=class{constructor(n=new Uint8Array(16)){this.buf=ArrayBuffer.isView(n)?n:new Uint8Array(n),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(n,e,i=this.length){for(;this.pos<i;){const r=this.readVarint(),l=r>>3,h=this.pos;this.type=7&r,n(l,e,this),this.pos===h&&this.skip(r)}return e}readMessage(n,e){return this.readFields(n,e,this.readVarint()+this.pos)}readFixed32(){const n=this.dataView.getUint32(this.pos,!0);return this.pos+=4,n}readSFixed32(){const n=this.dataView.getInt32(this.pos,!0);return this.pos+=4,n}readFixed64(){const n=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*A0;return this.pos+=8,n}readSFixed64(){const n=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*A0;return this.pos+=8,n}readFloat(){const n=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,n}readDouble(){const n=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,n}readVarint(n){const e=this.buf;let i,r;return r=e[this.pos++],i=127&r,r<128?i:(r=e[this.pos++],i|=(127&r)<<7,r<128?i:(r=e[this.pos++],i|=(127&r)<<14,r<128?i:(r=e[this.pos++],i|=(127&r)<<21,r<128?i:(r=e[this.pos],i|=(15&r)<<28,(function(l,h,f){const m=f.buf;let x,v;if(v=m[f.pos++],x=(112&v)>>4,v<128||(v=m[f.pos++],x|=(127&v)<<3,v<128)||(v=m[f.pos++],x|=(127&v)<<10,v<128)||(v=m[f.pos++],x|=(127&v)<<17,v<128)||(v=m[f.pos++],x|=(127&v)<<24,v<128)||(v=m[f.pos++],x|=(1&v)<<31,v<128))return dg(l,x,h);throw new Error("Expected varint not more than 10 bytes")})(i,n,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const n=this.readVarint();return n%2==1?(n+1)/-2:n/2}readBoolean(){return!!this.readVarint()}readString(){const n=this.readVarint()+this.pos,e=this.pos;return this.pos=n,n-e>=12&&yb?yb.decode(this.buf.subarray(e,n)):(function(i,r,l){let h="",f=r;for(;f<l;){const m=i[f];let x,v,S,A=null,M=m>239?4:m>223?3:m>191?2:1;if(f+M>l)break;M===1?m<128&&(A=m):M===2?(x=i[f+1],(192&x)==128&&(A=(31&m)<<6|63&x,A<=127&&(A=null))):M===3?(x=i[f+1],v=i[f+2],(192&x)==128&&(192&v)==128&&(A=(15&m)<<12|(63&x)<<6|63&v,(A<=2047||A>=55296&&A<=57343)&&(A=null))):M===4&&(x=i[f+1],v=i[f+2],S=i[f+3],(192&x)==128&&(192&v)==128&&(192&S)==128&&(A=(15&m)<<18|(63&x)<<12|(63&v)<<6|63&S,(A<=65535||A>=1114112)&&(A=null))),A===null?(A=65533,M=1):A>65535&&(A-=65536,h+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),h+=String.fromCharCode(A),f+=M}return h})(this.buf,e,n)}readBytes(){const n=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,n);return this.pos=n,e}readPackedVarint(n=[],e){const i=this.readPackedEnd();for(;this.pos<i;)n.push(this.readVarint(e));return n}readPackedSVarint(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readSVarint());return n}readPackedBoolean(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readBoolean());return n}readPackedFloat(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readFloat());return n}readPackedDouble(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readDouble());return n}readPackedFixed32(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readFixed32());return n}readPackedSFixed32(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readSFixed32());return n}readPackedFixed64(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readFixed64());return n}readPackedSFixed64(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readSFixed64());return n}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(n){const e=7&n;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(n,e){this.writeVarint(n<<3|e)}realloc(n){let e=this.length||16;for(;e<this.pos+n;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(n){this.realloc(4),this.dataView.setInt32(this.pos,n,!0),this.pos+=4}writeSFixed32(n){this.realloc(4),this.dataView.setInt32(this.pos,n,!0),this.pos+=4}writeFixed64(n){this.realloc(8),this.dataView.setInt32(this.pos,-1&n,!0),this.dataView.setInt32(this.pos+4,Math.floor(n*_b),!0),this.pos+=8}writeSFixed64(n){this.realloc(8),this.dataView.setInt32(this.pos,-1&n,!0),this.dataView.setInt32(this.pos+4,Math.floor(n*_b),!0),this.pos+=8}writeVarint(n){(n=+n||0)>268435455||n<0?(function(e,i){let r,l;if(e>=0?(r=e%4294967296|0,l=e/4294967296|0):(r=~(-e%4294967296),l=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(h,f,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)})(r,0,i),(function(h,f){const m=(7&h)<<4;f.buf[f.pos++]|=m|((h>>>=3)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h)))))})(l,i)})(n,this):(this.realloc(4),this.buf[this.pos++]=127&n|(n>127?128:0),n<=127||(this.buf[this.pos++]=127&(n>>>=7)|(n>127?128:0),n<=127||(this.buf[this.pos++]=127&(n>>>=7)|(n>127?128:0),n<=127||(this.buf[this.pos++]=n>>>7&127))))}writeSVarint(n){this.writeVarint(n<0?2*-n-1:2*n)}writeBoolean(n){this.writeVarint(+n)}writeString(n){n=String(n),this.realloc(4*n.length),this.pos++;const e=this.pos;this.pos=(function(r,l,h){for(let f,m,x=0;x<l.length;x++){if(f=l.charCodeAt(x),f>55295&&f<57344){if(!m){f>56319||x+1===l.length?(r[h++]=239,r[h++]=191,r[h++]=189):m=f;continue}if(f<56320){r[h++]=239,r[h++]=191,r[h++]=189,m=f;continue}f=m-55296<<10|f-56320|65536,m=null}else m&&(r[h++]=239,r[h++]=191,r[h++]=189,m=null);f<128?r[h++]=f:(f<2048?r[h++]=f>>6|192:(f<65536?r[h++]=f>>12|224:(r[h++]=f>>18|240,r[h++]=f>>12&63|128),r[h++]=f>>6&63|128),r[h++]=63&f|128)}return h})(this.buf,n,this.pos);const i=this.pos-e;i>=128&&xb(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(n){this.realloc(4),this.dataView.setFloat32(this.pos,n,!0),this.pos+=4}writeDouble(n){this.realloc(8),this.dataView.setFloat64(this.pos,n,!0),this.pos+=8}writeBytes(n){const e=n.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=n[i]}writeRawMessage(n,e){this.pos++;const i=this.pos;n(e,this);const r=this.pos-i;r>=128&&xb(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(n,e,i){this.writeTag(n,2),this.writeRawMessage(e,i)}writePackedVarint(n,e){e.length&&this.writeMessage(n,mA,e)}writePackedSVarint(n,e){e.length&&this.writeMessage(n,gA,e)}writePackedBoolean(n,e){e.length&&this.writeMessage(n,xA,e)}writePackedFloat(n,e){e.length&&this.writeMessage(n,_A,e)}writePackedDouble(n,e){e.length&&this.writeMessage(n,yA,e)}writePackedFixed32(n,e){e.length&&this.writeMessage(n,vA,e)}writePackedSFixed32(n,e){e.length&&this.writeMessage(n,bA,e)}writePackedFixed64(n,e){e.length&&this.writeMessage(n,wA,e)}writePackedSFixed64(n,e){e.length&&this.writeMessage(n,TA,e)}writeBytesField(n,e){this.writeTag(n,2),this.writeBytes(e)}writeFixed32Field(n,e){this.writeTag(n,5),this.writeFixed32(e)}writeSFixed32Field(n,e){this.writeTag(n,5),this.writeSFixed32(e)}writeFixed64Field(n,e){this.writeTag(n,1),this.writeFixed64(e)}writeSFixed64Field(n,e){this.writeTag(n,1),this.writeSFixed64(e)}writeVarintField(n,e){this.writeTag(n,0),this.writeVarint(e)}writeSVarintField(n,e){this.writeTag(n,0),this.writeSVarint(e)}writeStringField(n,e){this.writeTag(n,2),this.writeString(e)}writeFloatField(n,e){this.writeTag(n,5),this.writeFloat(e)}writeDoubleField(n,e){this.writeTag(n,1),this.writeDouble(e)}writeBooleanField(n,e){this.writeVarintField(n,+e)}};function dg(n,e,i){return i?4294967296*e+(n>>>0):4294967296*(e>>>0)+(n>>>0)}function xb(n,e,i){const r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(let l=i.pos-1;l>=n;l--)i.buf[l+r]=i.buf[l]}function mA(n,e){for(let i=0;i<n.length;i++)e.writeVarint(n[i])}function gA(n,e){for(let i=0;i<n.length;i++)e.writeSVarint(n[i])}function _A(n,e){for(let i=0;i<n.length;i++)e.writeFloat(n[i])}function yA(n,e){for(let i=0;i<n.length;i++)e.writeDouble(n[i])}function xA(n,e){for(let i=0;i<n.length;i++)e.writeBoolean(n[i])}function vA(n,e){for(let i=0;i<n.length;i++)e.writeFixed32(n[i])}function bA(n,e){for(let i=0;i<n.length;i++)e.writeSFixed32(n[i])}function wA(n,e){for(let i=0;i<n.length;
218i++)e.writeFixed64(n[i])}function TA(n,e){for(let i=0;i<n.length;i++)e.writeSFixed64(n[i])}function SA(n,e,i){e.glyphs=[],n===1&&i.readMessage(EA,e)}function EA(n,e,i){if(n===3){const{id:r,bitmap:l,width:h,height:f,left:m,top:x,advance:v}=i.readMessage(AA,{});e.glyphs.push({id:r,bitmap:new Dc({width:h+6,height:f+6},l),metrics:{width:h,height:f,left:m,top:x,advance:v}})}else n===4?e.ascender=i.readSVarint():n===5&&(e.descender=i.readSVarint())}function AA(n,e,i){n===1?e.id=i.readVarint():n===2?e.bitmap=i.readBytes():n===3?e.width=i.readVarint():n===4?e.height=i.readVarint():n===5?e.left=i.readSVarint():n===6?e.top=i.readSVarint():n===7&&(e.advance=i.readVarint())}const $s={horizontal:1,vertical:2,horizontalOnly:3};class S_{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const r=new S_;return r.scale=e||1,r.fontStack=i,r}static forImage(e){const i=new S_;return i.image=e,i}}class fg{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,r){const l=new fg;for(let h=0;h<e.sections.length;h++){const f=e.sections[h];f.image?l.addImageSection(f,r):l.addTextSection(f,i)}return l}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=(function(i,r){let l="";for(let h=0;h<i.length;h++){const f=i.charCodeAt(h+1)||null,m=i.charCodeAt(h-1)||null;l+=!r&&(f&&Cp(f)&&!T_[i[h+1]]||m&&Cp(m)&&!T_[i[h-1]])||!T_[i[h]]?i[h]:T_[i[h]]}return l})(this.text,e)}trim(){let e=0;for(let r=0;r<this.text.length&&Gy[this.text.charCodeAt(r)];r++)e++;let i=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&Gy[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const r=new fg;return r.text=this.text.substring(e,i),r.sectionIndex=this.sectionIndex.slice(e,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(S_.forText(e.scale,e.fontStack||i));const r=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(r)}addImageSection(e,i){const r=e.image?e.image.getPrimary():null;if(!r)return void vi("Can't add FormattedSection with an empty image.");r.scaleSelf(i);const l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCodePoint(l),this.sections.push(S_.forImage(r)),this.sectionIndex.push(this.sections.length-1)):vi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function M0(n,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U=1){const G=fg.fromFeature(n,l,U);A===$s.vertical&&G.verticalizePunctuation(M);let V=[];const Z=(function(ge,_e,pe,be,Me,Ye){if(!ge)return[];const Ze=[],We=(function(st,He,ht,tt,gt,ct){let qt=0;for(let $t=0;$t<st.length();$t++){const kt=st.getSection($t);qt+=vb(st.getCodePoint($t),kt,tt,gt,He,ct)}return qt/Math.max(1,Math.ceil(qt/ht))})(ge,_e,pe,be,Me,Ye),lt=ge.text.indexOf("​")>=0;let at=0;for(let st=0;st<ge.length();st++){const He=ge.getSection(st),ht=ge.getCodePoint(st);if(Gy[ht]||(at+=vb(ht,He,be,Me,_e,Ye)),st<ge.length()-1){const tt=Ap(ht);(MA[ht]||tt||He.image)&&Ze.push(wb(st+1,at,We,Ze,CA(ht,ge.getCodePoint(st+1),tt&&lt),!1))}}return Tb(wb(ge.length(),at,We,Ze,0,!0))})(G,v,h,e,r,R),{processBidirectionalText:Y,processStyledBidirectionalText:Q}=Ia;if(Y&&G.sections.length===1){const ge=Y(G.toString(),Z);for(const _e of ge){const pe=new fg;pe.text=_e,pe.sections=G.sections;for(let be=0;be<_e.length;be++)pe.sectionIndex.push(0);V.push(pe)}}else if(Q){const ge=Q(G.text,G.sectionIndex,Z);for(const _e of ge){const pe=new fg;pe.text=_e[0],pe.sectionIndex=_e[1],pe.sections=G.sections,V.push(pe)}}else V=(function(ge,_e){const pe=[],be=ge.text;let Me=0;for(const Ye of _e)pe.push(ge.substring(Me,Ye)),Me=Ye;return Me<be.length&&pe.push(ge.substring(Me,be.length)),pe})(G,Z);const le=[],ae={positionedLines:le,text:G.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:A,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(ge,_e,pe,be,Me,Ye,Ze,We,lt,at,st,He){let ht=0,tt=0,gt=0;const ct=We==="right"?1:We==="left"?0:.5;let qt=!1;for(const ii of Me){const Gt=ii.getSections();for(const Ei of Gt){if(Ei.image)continue;const Zi=_e[Ei.fontStack];if(Zi&&(qt=Zi.ascender!==void 0&&Zi.descender!==void 0,!qt))break}if(!qt)break}let $t=0;for(const ii of Me){ii.trim();const Gt=ii.getMaxScale(),Ei=(Gt-1)*yo,Zi={positionedGlyphs:[],lineOffset:0};ge.positionedLines[$t]=Zi;const fn=Zi.positionedGlyphs;let Ui=0;if(!ii.length()){tt+=Ye,++$t;continue}let En=0,on=0;for(let sn=0;sn<ii.length();sn++){const Tn=ii.getSection(sn),$n=ii.getSectionIndex(sn),tr=ii.getCodePoint(sn);let ir=Tn.scale,Mr=null,zo=null,ra=null,$r=yo,io=0,fo=lt;fo===$s.vertical&&Mp(tr)&&(fo=$s.horizontal);const Ni=!(fo===$s.horizontal||!st&&!fl(tr)||st&&(Gy[tr]||xd(tr)));if(Tn.image){const nr=be.get(Tn.image.toString());if(!nr)continue;ra=Tn.image,ge.iconsInText=ge.iconsInText||!0,zo=nr.paddedRect;const fr=nr.displaySize;ir=ir*yo/He,Mr={width:fr[0],height:fr[1],left:0,top:-3,advance:Ni?fr[1]:fr[0],localGlyph:!1},io=qt?-Mr.height*ir:Gt*yo-17-fr[1]*ir,$r=Mr.advance;const Xs=(Ni?fr[0]:fr[1])*ir-yo*Gt;Xs>0&&Xs>Ui&&(Ui=Xs)}else{const nr=pe[Tn.fontStack];if(!nr)continue;nr[tr]&&(zo=nr[tr]);const fr=_e[Tn.fontStack];if(!fr)continue;const Xs=fr.glyphs[tr];if(!Xs)continue;if(Mr=Xs.metrics,$r=tr!==8203?yo:0,qt){const Oa=fr.ascender!==void 0?Math.abs(fr.ascender):0,Do=fr.desce
vendor: 18,628 bytes, line 218
218nder!==void 0?Math.abs(fr.descender):0,Ba=(Oa+Do)*ir;En<Ba&&(En=Ba,on=(Oa-Do)/2*ir),io=-Oa*ir}else io=(Gt-ir)*yo-17}Ni?(ge.verticalizable=!0,fn.push({glyph:tr,image:ra,x:ht,y:tt+io,vertical:Ni,scale:ir,localGlyph:Mr.localGlyph,fontStack:Tn.fontStack,sectionIndex:$n,metrics:Mr,rect:zo}),ht+=$r*ir+at):(fn.push({glyph:tr,image:ra,x:ht,y:tt+io,vertical:Ni,scale:ir,localGlyph:Mr.localGlyph,fontStack:Tn.fontStack,sectionIndex:$n,metrics:Mr,rect:zo}),ht+=Mr.advance*ir+at)}fn.length!==0&&(gt=Math.max(ht-at,gt),qt?Sb(fn,ct,Ui,on,Ye*Gt/2):Sb(fn,ct,Ui,0,Ye/2)),ht=0;const Ar=Ye*Gt+Ui;Zi.lineOffset=Math.max(Ui,Ei),tt+=Ar,++$t}const kt=tt,{horizontalAlign:Nt,verticalAlign:ci}=C0(Ze);(function(ii,Gt,Ei,Zi,fn,Ui){const En=(Gt-Ei)*fn,on=-Ui*Zi;for(const Ar of ii)for(const sn of Ar.positionedGlyphs)sn.x+=En,sn.y+=on})(ge.positionedLines,ct,Nt,ci,gt,kt),ge.top+=-ci*kt,ge.bottom=ge.top+kt,ge.left+=-Nt*gt,ge.right=ge.left+gt,ge.hasBaseline=qt})(ae,e,i,r,V,f,m,x,A,v,M,D),!(function(ge){for(const _e of ge)if(_e.positionedGlyphs.length!==0)return!1;return!0})(le))return ae}const Gy={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},MA={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function vb(n,e,i,r,l,h){if(e.image){const f=r.get(e.image.toString());return f?f.displaySize[0]*e.scale*yo/h+l:0}{const f=i[e.fontStack],m=f&&f.glyphs[n];return m?m.metrics.advance*e.scale+l:0}}function bb(n,e,i,r){const l=Math.pow(n-e,2);return r?n<e?l/2:2*l:l+Math.abs(i)*i}function CA(n,e,i){let r=0;return n===10&&(r-=1e4),i&&(r+=150),n!==40&&n!==65288||(r+=50),e!==41&&e!==65289||(r+=50),r}function wb(n,e,i,r,l,h){let f=null,m=bb(e,i,l,h);for(const x of r){const v=bb(e-x.x,i,l,h)+x.badness;v<=m&&(f=x,m=v)}return{index:n,x:e,priorBreak:f,badness:m}}function Tb(n){return n?Tb(n.priorBreak).concat(n.index):[]}function C0(n){let e=.5,i=.5;switch(n){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Sb(n,e,i,r,l){if(!(e||i||r||l))return;const h=n.length-1,f=n[h],m=(f.x+f.metrics.advance*f.scale)*e;for(let x=0;x<=h;x++)n[x].x-=m,n[x].y+=i+r+l}function I0(n){return n.imagePrimary!==void 0&&n.top!==void 0&&n.bottom!==void 0&&n.left!==void 0&&n.right!==void 0}function Hy(n,e,i,r){const{horizontalAlign:l,verticalAlign:h}=C0(r),f=i[0]-n.displaySize[0]*l,m=i[1]-n.displaySize[1]*h;return{imagePrimary:n,imageSecondary:e,top:m,bottom:m+n.displaySize[1],left:f,right:f+n.displaySize[0]}}function R0(n,e,i,r,l,h){const f=n.imagePrimary;let m;if(f.content){const G=f.content,V=f.pixelRatio||1;m=[G[0]/V,G[1]/V,f.displaySize[0]-G[2]/V,f.displaySize[1]-G[3]/V]}const x=e.left*h,v=e.right*h;let S,A,M,R;i==="width"||i==="both"?(R=l[0]+x-r[3],A=l[0]+v+r[1]):(R=l[0]+(x+v-f.displaySize[0])/2,A=R+f.displaySize[0]);const D=e.top*h,U=e.bottom*h;return i==="height"||i==="both"?(S=l[1]+D-r[0],M=l[1]+U+r[2]):(S=l[1]+(D+U-f.displaySize[1])/2,M=S+f.displaySize[1]),{imagePrimary:f,imageSecondary:void 0,top:S,right:A,bottom:M,left:R,collisionPadding:m}}function Eb(n){return!n.imagePrimary.stretchX}function Ab(n){return!n.imagePrimary.stretchY}function Mb(n){return{width:n.right-n.left,height:n.bottom-n.top}}const jd=128;function _m(n,e,i,r){const{expression:l}=e;if(l.kind==="constant")return{kind:"constant",layoutSize:l.evaluate(new mn(n+1,{worldview:i}),void 0,void 0,void 0,r)};if(l.kind==="source")return{kind:"source"};{const{zoomStops:h,interpolationType:f}=l;let m=0;for(;m<h.length&&h[m]<=n;)m++;m=Math.max(0,m-1);let x=m;for(;x<h.length&&h[x]<n+1;)x++;x=Math.min(h.length-1,x);const v=h[m],S=h[x];return l.kind==="composite"?{kind:"composite",minZoom:v,maxZoom:S,interpolationType:f}:{kind:"camera",minZoom:v,maxZoom:S,minSize:l.evaluate(new mn(v,{worldview:i}),void 0,void 0,void 0,r),maxSize:l.evaluate(new mn(S,{worldview:i}),void 0,void 0,void 0,r),interpolationType:f}}}function z0(n,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:l}){return n.kind==="source"?r/jd:n.kind==="composite"?mi(r/jd,l/jd,i):e}function pg(n,e,i=1){let r=0,l=0;if(n.kind==="constant")l=n.layoutSize*i;else if(n.kind!=="source"){const{interpolationType:h,minZoom:f,maxZoom:m}=n,x=h?he(Wn.interpolationFactor(h,e,f,m),0,1):0;n.kind==="camera"?l=mi(n.minSize,n.maxSize,x)*i:r=x*i}return{uSizeT:r,uSize:l}}class Gd extends _t{constructor(e,i,r,l,h){super(e,i),this.angle=l,this.z=r,h!==void 0&&(this.segment=h)}clone(){return new Gd(this.x,this.y,this.z,this.angle,this.segment)}}function Cb(n,e,i,r,l){if(e.segment===void 0)return!0;let h=e,f=e.segment+1,m=0;for(;m>-i/2;){if(f--,f<0)return!1;m-=n[f].dist(h),h=n[f]}m+=n[f].dist(n[f+1]),f++;const x=[];let v=0;for(;m<i/2;){const S=n[f],A=n[f+1];if(!A)return!1;let M=n[f-1].angleTo(S)-S.angleTo(A);for(M=Math.abs((M+3*Math.PI)%(2*Math.PI)-Math.PI),x.push({distance:m,angleDelta:M}),v+=M;m-x[0].distance>r;)v-=x.shift().angleDelta;if(v>l)return!1;f++,m+=S.dist(A)}return!0}function Ib(n){let e=0;for(let i=0;i<n.length-1;i++)e+=n[i].dist(n[i+1]);return e}function Rb(n,e,i){return n?.6*e*i:0}function zb(n,e){return Math.max(n?n.right-n.left:0,e?e.right-e.left:0)}function IA(n,e,i,r,l,h){const f=Rb(i,l,h),m=zb(i,r)*h;let x=0;const v=Ib(n)/2;for(let S=0;S<n.length-1;S++){const A=n[S],M=n[S+1],R=A.dist(M);if(x+R>v){const D=(v-x)/R,U=mi(A.x,M.x,D),G=mi(A.y,M.y,D),V=new Gd(U,G,0,M.angleTo(A),S);return!f||Cb(n,V,m,f,e)?V:void 0}x+=R}}function RA(n,e,i,r,l,h,f,m,x){const v=Rb(r,h,f),S=zb(r,l),A=S*f,M=n[0].x===0||n[0].x===x||n[0].y===0||n[0].y===x;return e-A<e/4&&(e=A+e/4),Db(n,M?e/2*m%e:(S/2+2*h)*f*m%e,e,v,i,A,M,!1,x)}function Db(n,e,i,r,l,h,f,m,x){const v=h/2,S=Ib(n);let A=0,M=e-i,R=[];for(let D=0;D<n.length-1;D++){const U=n[D],G=n[D+1],V=U.dist(G),Z=G.angleTo(U);for(;M+i<A+V;){M+=i;const Y=(M-A)/V,Q=mi(U.x,G.x,Y),le=mi(U.y,G.y,Y);if(Q>=0&&Q<x&&le>=0&&le<x&&M-v>=0&&M+v<=S){const ae=new Gd(Q,le,0,Z,D);r&&!Cb(n,ae,h,r,l)||R.push(ae)}}A+=V}return m||R.length||f||(R=Db(n,A/2,i,r,l,h,f,!0,x)),R}function Pb(n){let e=0,i=0;for(const f of n)e+=f.w*f.h,i=Math.max(i,f.w);n.sort((f,m)=>m.h-f.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let l=0,h=0;for(const f of n)for(let m=r.length-1;m>=0;m--){const x=r[m];if(!(f.w>x.w||f.h>x.h)){if(f.x=x.x,f.y=x.y,h=Math.max(h,f.y+f.h),l=Math.max(l,f.x+f.w),f.w===x.w&&f.h===x.h){const v=r.pop();v&&m<r.length&&(r[m]=v)}else f.h===x.h?(x.x+=f.w,x.w-=f.w):f.w===x.w?(x.y+=f.h,x.h-=f.h):(r.push({x:x.x+f.w,y:x.y,w:x.w-f.w,h:f.h}),x.y+=f.h,x.h-=f.h);break}}return{w:l,h,fill:e/(l*h)||0}}zt(Gd,"Anchor");class E_{static getImagePositionScale(e,i,r){if(i&&e){const{sx:l,sy:h}=e;return{x:l,y:h}}return{x:r,y:r}}constructor(e,i,r,l){this.paddedRect=e;const{pixelRatio:h,version:f,stretchX:m,stretchY:x,content:v,sdf:S,usvg:A}=i;this.pixelRatio=h,this.stretchX=m,this.stretchY=x,this.content=v,this.version=f,this.padding=r,this.sdf=S,this.usvg=A,this.scale=E_.getImagePositionScale(l,A,h)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function D0(n,e,i){const r=so.parse(n),l=(function(h,f,m=[1,1]){return{x:0,y:0,w:(h.data?h.data.width:h.width*m[0])+2*f,h:(h.data?h.data.height:h.height*m[1])+2*f}})(e,i,[r.sx,r.sy]);return{bin:l,imagePosition:new E_(l,e,i,r),imageVariant:r}}class Lb{constructor(e,i,r){const l=new Map,h=new Map;this.haveRenderCallbacks=[];const f=[];this.addImages(e,l,1,f),this.addImages(i,h,2,f);const{w:m,h:x}=Pb(f),v=new ho({width:m||1,height:x||1});for(const[S,A]of e.entries()){const M=l.get(S).paddedRect;ho.copy(A.data,v,{x:0,y:0},{x:M.x+1,y:M.y+1},A.data,null,A.sdf)}for(const[S,A]of i.entries()){const M=h.get(S),R=M.paddedRect;let D=M.padding;const U=R.x+D,G=R.y+D,V=A.data.width,Z=A.data.height;D=D>1?D-1:D,ho.copy(A.data,v,{x:0,y:0},{x:U,y:G},A.data,r),ho.copy(A.data,v,{x:0,y:Z-D},{x:U,y:G-D},{width:V,height:D},r),ho.copy(A.data,v,{x:0,y:0},{x:U,y:G+Z},{width:V,height:D},r),ho.copy(A.data,v,{x:V-D,y:0},{x:U-D,y:G},{width:D,height:Z},r),ho.copy(A.data,v,{x:0,y:0},{x:U+V,y:G},{width:D,height:Z},r),ho.copy(A.data,v,{x:V-D,y:Z-D},{x:U-D,y:G-D},{width:D,height:D},r),ho.copy(A.data,v,{x:0,y:Z-D},{x:U+V,y:G-D},{width:D,height:D},r),ho.copy(A.data,v,{x:0,y:0},{x:U+V,y:G+Z},{width:D,height:D},r),ho.copy(A.data,v,{x:V-D,y:0},{x:U-D,y:G+Z},{width:D,height:D},r)}this.lut=r,this.image=v,this.iconPositions=l,this.patternPositions=h}addImages(e,i,r,l){for(const[h,f]of e.entries()){const{bin:m,imagePosition:x,imageVariant:v}=D0(h,f,r);i.set(h,x),l.push(m),f.hasRenderCallback&&this.haveRenderCallbacks.push(v.id)}}patchUpdatedImages(e,i,r,l){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(h=>e.hasImage(h,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const h of e.getUpdatedImages(r)){for(const f of this.iconPositions.keys()){const m=so.parse(f);if(No.isEqual(m.id,h)){const x=e.getImage(h,r);this.patchUpdatedImage(this.iconPositions.get(f),x,i,null)}}for(const f of this.patternPositions.keys()){const m=so.parse(f);if(No.isEqual(m.id,h)){const x=e.getImage(h,r);this.patchUpdatedImage(this.patternPositions.get(f),x,i,l||this.lut)}}}}patchUpdatedImage(e,i,r,l=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[h,f]=e.tl,m=e.sdf;if(this.lut||m){const x={width:i.data.width,height:i.data.height},v=new ho(x);ho.copy(i.data,v,{x:0,y:0},{x:0,y:0},x,l,m),r.update(v,{position:{x:h,y:f}})}else r.update(i.data,{position:{x:h,y:f}})}}zt(E_,"ImagePosition"),zt(Lb,"ImageAtlas",{omit:["lut"]});const A_=1e20;function Ob(n,e,i,r,l,h,f,m,x){for(let v=e;v<e+r;v++)Bb(n,i*h+v,h,l,f,m,x);for(let v=i;v<i+l;v++)Bb(n,v*h+e,1,r,f,m,x)}function Bb(n,e,i,r,l,h,f){h[0]=0,f[0]=-A_,f[1]=A_,l[0]=n[e];for(let m=1,x=0,v=0;m<r;m++){l[m]=n[e+m*i];const S=m*m;do{const A=h[x];v=(l[m]-l[A]+S-A*A)/(m-A)/2}while(v<=f[x]&&--x>-1);x++,h[x]=m,f[x]=v,f[x+1]=A_}for(let m=0,x=0;m<r;m++){for(;f[x+1]<m;)x++;const v=h[x],S=m-v;n[e+m*i]=l[v]+S*S}}const P0={none:0,ideographs:1,all:2};class mg{constructor(e,i,r){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=r,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const r=[],l=this.url||Fr.GLYPHS_URL;for(const h in e)for(const f of e[h])r.push({stack:h,id:f});Pe(r,({stack:h,id:f},m)=>{let x=this.entries[h];x||(x=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let v=x.glyphs[f];if(v!==void 0)return void m(null,{stack:h,id:f,glyph:v});if(v=this._tinySDF(x,h,f),v)return x.glyphs[f]=v,void m(null,{stack:h,id:f,glyph:v});const S=Math.floor(f/256);if(256*S>65535)return vi("glyphs > 65535 not supported"),void m(null,{stack:h,id:f,glyph:v});if(x.ranges[S])return void m(null,{stack:h,id:f,glyph:v});let A=x.requests[S];A||(A=x.requests[S]=[],mg.loadGlyphRange(h,S,l,this.requestManager,(M,R)=>{if(R){x.ascender=R.ascender,x.descender=R.descender;for(const D in R.glyphs)this._doesCharSupportLocalGlyph(+D)||(x.glyphs[+D]=R.glyphs[+D]);x.ranges[S]=!0}for(const D of A)D(M,R);delete x.requests[S]})),A.push((M,R)=>{M?m(M):R&&m(null,{stack:h,id:f,glyph:R.glyphs[f]||null})})},(h,f)=>{if(h)i(h);else if(f){const m={};for(const{stack:x,id:v,glyph:S}of f)m[x]===void 0&&(m[x]={}),m[x].glyphs===void 0&&(m[x].glyphs={}),m[x].glyphs[v]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics},m[x].ascender=this.entries[x].ascender,m[x].descender=this.entries[x].descender;i(null,m)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==P0.none&&(this.localGlyphMode===P0.all?!!this.localFontFamily:!!this.localFontFamily&&(Pr(e)||gd(e)||wc(e)||lu(e)||wr(e)||lo(e)||(i=e)>=131072&&i<=173791||(r=>r>=66736&&r<=66815)(e)));var i}_tinySDF(e,i,r){const l=this.localFontFamily;if(!l||!this._doesCharSupportLocalGlyph(r))return;let h=e.tinySDF;if(!h){let U="400";/bold/i.test(i)?U="900":/medium/i.test(i)?U="500":/light/i.test(i)&&(U="200"),h=e.tinySDF=new mg.TinySDF({fontFamily:l,fontWeight:U,fontSize:48,buffer:6,radius:16}),h.fontWeight=U}if(this.localGlyphs[h.fontWeight][r])return this.localGlyphs[h.fontWeight][r];const f=String.fromCodePoint(r),{data:m,width:x,height:v,glyphWidth:S,glyphHeight:A,glyphLeft:M,glyphTop:R,glyphAdvance:D}=h.draw(f);return this.localGlyphs[h.fontWeight][r]={id:r,bitmap:new Dc({width:x,height:v},m),metrics:{width:S/2,height:A/2,left:M/2,top:R/2-27,advance:D/2,localGlyph:!0}}}}function kb(n,e){return n+e[1]-e[0]}function L0(n,e,i,r,l=1){const h=[],f=n.imagePrimary,m=f.pixelRatio,x=f.paddedRect.w-2,v=f.paddedRect.h-2,S=(n.right-n.left)*l,A=(n.bottom-n.top)*l,M=f.stretchX||[[0,x]],R=f.stretchY||[[0,v]],D=M.reduce(kb,0),U=R.reduce(kb,0),G=x-D,V=v-U;let Z=0,Y=D,Q=0,le=U,ae=0,ge=G,_e=0,pe=V;if(f.content&&r){const Me=f.content;Z=qy(M,0,Me[0]),Q=qy(R,0,Me[1]),Y=qy(M,Me[0],Me[2]),le=qy(R,Me[1],Me[3]),ae=Me[0]-Z,_e=Me[1]-Q,ge=Me[2]-Me[0]-Y,pe=Me[3]-Me[1]-le}const be=(Me,Ye,Ze,We)=>{const lt=Zy(Me.stretch-Z,Y,S,n.left*l),at=$y(Me.fixed-ae,ge,Me.stretch,D),st=Zy(Ye.stretch-Q,le,A,n.top*l),He=$y(Ye.fixed-_e,pe,Ye.stretch,U),ht=Zy(Ze.stretch-Z,Y,S,n.left*l),tt=$y(Ze.fixed-ae,ge,Ze.stretch,D),gt=Zy(We.stretch-Q,le,A,n.top*l),ct=$y(We.fixed-_e,pe,We.stretch,U),qt=new _t(lt,st),$t=new _t(ht,st),kt=new _t(ht,gt),Nt=new _t(lt,gt),ci=new _t(at/m,He/m),ii=new _t(tt/m,ct/m),Gt=e*Math.PI/180;if(Gt){const on=Math.sin(Gt),Ar=Math.cos(Gt),sn=[Ar,-on,on,Ar];qt._matMult(sn),$t._matMult(sn),Nt._matMult(sn),kt._matMult(sn)}const Ei=Me.stretch+Me.fixed,Zi=Ze.stretch+Ze.fixed,fn=Ye.stretch+Ye.fixed,Ui=We.stretch+We.fixed,En=n.imageSecondary;return{tl:qt,tr:$t,bl:Nt,br:kt,texPrimary:{x:f.paddedRect.x+1+Ei,y:f.paddedRect.y+1+fn,w:Zi-Ei,h:Ui-fn},texSecondary:En?{x:En.paddedRect.x+1+Ei,y:En.paddedRect.y+1+fn,w:Zi-Ei,h:Ui-fn}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ci,pixelOffsetBR:ii,minFontScaleX:ge/m/S,minFontScaleY:pe/m/A,isSDF:i}};if(f.stretchX||f.stretchY){const Me=Fb(M,G,D),Ye=Fb(R,V,U);for(let Ze=0;Ze<Me.length-1;Ze++){const We=Me[Ze],lt=Me[Ze+1];for(let at=0;at<Ye.length-1;at++)h.push(be(We,Ye[at],lt,Ye[at+1]))}}else h.push(be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:v+1}));return h}function zA(n,e){const i=n.stretchY||[[0,n.paddedRect.h-2]];return n.stretchX||n.stretchY?Nb(n.stretchX||[[0,n.paddedRect.w-2]])*Nb(i):1}function qy(n,e,i){let r=0;for(const l of n)r+=Math.max(e,Math.min(i,l[1]))-Math.max(e,Math.min(i,l[0]));return r}function Fb(n,e,i){const r=[{fixed:-1,stretch:0}];for(const[l,h]of n){const f=r[r.length-1];r.push({fixed:l-f.stretch,stretch:f.stretch}),r.push({fixed:l-f.stretch,stretch:f.stretch+(h-l)})}return r.push({fixed:e+1,stretch:i}),r}function Nb(n){return 2*n.length+1}function Zy(n,e,i,r){return n/e*i+r}function $y(n,e,i,r){return n-e*i/r}function DA(n,e,i,r){const l=e+n.positionedLines[r].lineOffset;return r===0?i+l/2:i+(l+(e+n.positionedLines[r-1].lineOffset))/2}function Ub(n,e,i,r,l,h,f,m,x){const v=[];if(e.positionedLines.length===0)return v;const S=(x!==void 0?x:r.layout.get("text-rotate").evaluate(h,{}))*Math.PI/180,A=(function(G){const V=G[0],Z=G[1],Y=V*Z;return Y>0?[V,-Z]:Y<0?[-V,Z]:V===0?[Z,V]:[Z,-V]})(i);let M=Math.abs(e.top-e.bottom);for(const G of e.positionedLines)M-=G.lineOffset;const R=e.positionedLines.length,D=M/R;let U=e.top-i[1];for(let G=0;G<R;++G){const V=e.positionedLines[G];U=DA(e,D,U,G);for(const Z of V.positionedGlyphs){if(!Z.rect)continue;const Y=Z.rect||{};let Q=4,le=!0,ae=1,ge=0;if(Z.image){const $t=f.get(Z.image.toString());if(!$t)continue;if($t.sdf){vi("SDF images are not supported in formatted text and will be ignored.");continue}le=!1,ae=$t.pixelRatio,Q=1/ae}const _e=(l||m)&&Z.vertical,pe=Z.metrics.advance*Z.scale/2,be=Z.metrics,Me=Z.rect;if(Me===null)continue;m&&e.verticalizable&&(ge=Z.image?pe-Z.metrics.width*Z.scale/2:0);const Ye=l?[Z.x+pe,Z.y]:[0,0];let Ze=[0,0],We=[0,0],lt=!1;l||(_e?(We=[Z.x+pe+A[0],Z.y+A[1]-ge],lt=!0):Ze=[Z.x+pe+i[0],Z.y+i[1]-ge]);const at=Me.w*Z.scale/(ae*(Z.localGlyph?2:1)),st=Me.h*Z.scale/(ae*(Z.localGlyph?2:1));let He,ht,tt,gt;if(_e){const $t=Z.y-U,kt=new _t(-pe,pe-$t),Nt=-Math.PI/2,ci=new _t(...We);He=new _t(-pe+Ze[0],Ze[1]),He._rotateAround(Nt,kt)._add(ci),He.x+=-$t+pe,He.y-=(be.left-Q)*Z.scale;const ii=Z.image?be.advance*Z.scale:yo*Z.scale,Gt=String.fromCodePoint(Z.glyph);fA(Gt)?He.x+=(1-Q)*Z.scale:pA(Gt)?He.x+=ii-be.height*Z.scale+(-Q-1)*Z.scale:He.x+=Z.image||be.width+2*Q===Me.w&&be.height+2*Q===Me.h?(ii-st)/2:(ii-(be.height+2*Q)*Z.scale)/2,ht=new _t(He.x,He.y-at),tt=new _t(He.x+st,He.y),gt=new _t(He.x+st,He.y-at)}else{const $t=(be.left-Q)*Z.scale-pe+Ze[0],kt=(-be.top-Q)*Z.scale+Ze[1],Nt=$t+at,ci=kt+st;He=new _t($t,kt),ht=new _t(Nt,kt),tt=new _t($t,ci),gt=new _t(Nt,ci)}if(S){let $t;$t=l?new _t(0,0):lt?new _t(A[0],A[1]):new _t(i[0],i[1]),He._rotateAround(S,$t),ht._rotateAround(S,$t),tt._rotateAround(S,$t),gt._rotateAround(S,$t)}const ct=new _t(0,0),qt=new _t(0,0);v.push({tl:He,tr:ht,bl:tt,br:gt,texPrimary:Y,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:Ye,sectionIndex:Z.sectionIndex,isSDF:le,pixelOffsetTL:ct,pixelOffsetBR:qt,minFontScaleX:0,minFontScaleY:0})}}return v}function PA(n,e=1,i=!1){let r=1/0,l=1/0,h=-1/0,f=-1/0;const m=n[0];for(let R=0;R<m.length;R++){const D=m[R];(!R||D.x<r)&&(r=D.x),(!R||D.y<l)&&(l=D.y),(!R||D.x>h)&&(h=D.x),(!R||D.y>f)&&(f=D.y)}const x=Math.min(h-r,f-l);let v=x/2;const S=new Xc([],LA);if(x===0)return new _t(r,l);for(let R=r;R<h;R+=x)for(let D=l;D<f;D+=x)S.push(new gg(R+v,D+v,v,n));let A=(function(R){let D=0,U=0,G=0;const V=R[0];for(let Z=0,Y=V.length,Q=Y-1;Z<Y;Q=Z++){const le=V[Z],ae=V[Q],ge=le.x*ae.y-ae.x*le.y;U+=(le.x+ae.x)*ge,G+=(le.y+ae.y)*ge,D+=3*ge}return new gg(U/D,G/D,0,R)})(n),M=S.length;for(;S.length;){const R=S.pop();(R.d>A.d||!A.d)&&(A=R,i&&console.log("found best %d after %d probes",Math.round(1e4*R.d)/1e4,M)),R.max-A.d<=e||(v=R.h/2,S.push(new gg(R.p.x-v,R.p.y-v,v,n)),S.push(new gg(R.p.x+v,R.p.y-v,v,n)),S.push(new gg(R.p.x-v,R.p.y+v,v,n)),S.push(new gg(R.p.x+v,R.p.y+v,v,n)),M+=4)}return i&&(console.log(`num probes: ${M}`),console.log(`best distance: ${A.d}`)),A.p}function LA(n,e){return e.max-n.max}mg.loadGlyphRange=function(n,e,i,r,l){const h=256*e,f=h+255,m=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",n).replace("{range}",`${h}-${f}`),Nr.Glyphs);Uc(m,(x,v)=>{if(x)l(x);else if(v){const S={},A=(function(M){return new jy(M).readFields(SA,{})})(v);for(const M of A.glyphs)S[M.id]=M;
218l(null,{glyphs:S,ascender:A.ascender,descender:A.descender})}})},mg.TinySDF=class{constructor({fontSize:n=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal",lang:m=null}={}){this.buffer=e,this.cutoff=r,this.radius=i,this.lang=m;const x=this.size=n+4*e,v=this._createCanvas(x),S=this.ctx=v.getContext("2d",{willReadFrequently:!0});S.font=`${f} ${h} ${n}px ${l}`,S.textBaseline="alphabetic",S.textAlign="left",S.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(n){const e=document.createElement("canvas");return e.width=e.height=n,e}draw(n){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(n),f=Math.ceil(i),m=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),x=Math.min(this.size-this.buffer,f+Math.ceil(r)),v=m+2*this.buffer,S=x+2*this.buffer,A=Math.max(v*S,0),M=new Uint8ClampedArray(A),R={data:M,width:v,height:S,glyphWidth:m,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(m===0||x===0)return R;const{ctx:D,buffer:U,gridInner:G,gridOuter:V}=this;this.lang&&(D.lang=this.lang),D.clearRect(U,U,m,x),D.fillText(n,U,U+f);const Z=D.getImageData(U,U,m,x);V.fill(A_,0,A),G.fill(0,0,A);for(let Y=0;Y<x;Y++)for(let Q=0;Q<m;Q++){const le=Z.data[4*(Y*m+Q)+3]/255;if(le===0)continue;const ae=(Y+U)*v+Q+U;if(le===1)V[ae]=0,G[ae]=A_;else{const ge=.5-le;V[ae]=ge>0?ge*ge:0,G[ae]=ge<0?ge*ge:0}}Ob(V,0,0,v,S,v,this.f,this.v,this.z),Ob(G,U,U,m,x,v,this.f,this.v,this.z);for(let Y=0;Y<A;Y++){const Q=Math.sqrt(V[Y])-Math.sqrt(G[Y]);M[Y]=Math.round(255-255*(Q/this.radius+this.cutoff))}return R}};class gg{constructor(e,i,r,l){this.p=new _t(e,i),this.h=r,this.d=(function(h,f){let m=!1,x=1/0;for(let v=0;v<f.length;v++){const S=f[v];for(let A=0,M=S.length,R=M-1;A<M;R=A++){const D=S[A],U=S[R];D.y>h.y!=U.y>h.y&&h.x<(U.x-D.x)*(h.y-D.y)/(U.y-D.y)+D.x&&(m=!m),x=Math.min(x,vu(h,D,U))}}return(m?1:-1)*Math.sqrt(x)})(this.p,l),this.max=this.d+this.h*Math.SQRT2}}const OA=Object.keys,O0=Number.POSITIVE_INFINITY,BA=Math.sqrt(2);function Kf(n,e,i,r,l){const h=I0(n)&&n.collisionPadding?n.collisionPadding:[0,0,0,0],f={top:n.top-h[1],bottom:n.bottom+h[3],left:n.left-h[0],right:n.right+h[2],scaled:!1};return r!==void 0&&(function(m,x){m.top*=x,m.bottom*=x,m.left*=x,m.right*=x,m.scaled=!0})(f,r),i&&(function(m,x){if(!x)return;const v=Ki(x),S=new _t(m.left,m.top),A=new _t(m.right,m.top),M=new _t(m.left,m.bottom),R=new _t(m.right,m.bottom),D=new _t(0,0);S._rotateAround(v,D),A._rotateAround(v,D),M._rotateAround(v,D),R._rotateAround(v,D),m.left=Math.min(S.x,A.x,M.x,R.x),m.right=Math.max(S.x,A.x,M.x,R.x),m.top=Math.min(S.y,A.y,M.y,R.y),m.bottom=Math.max(S.y,A.y,M.y,R.y)})(f,i),l&&(f.left+=l[0],f.right+=l[0],f.top+=l[1],f.bottom+=l[1]),e?{top:Math.min(e.top,f.top),bottom:Math.max(e.bottom,f.bottom),left:Math.min(e.left,f.left),right:Math.max(e.right,f.right),scaled:e.scaled||f.scaled}:f}function Vb(n,[e,i]){let r=0,l=0;if(i===O0){e<0&&(e=0);const h=e/BA;switch(n){case"top-right":case"top-left":l=h-7;break;case"bottom-right":case"bottom-left":l=7-h;break;case"bottom":l=7-e;break;case"top":l=e-7}switch(n){case"top-right":case"bottom-right":r=-h;break;case"top-left":case"bottom-left":r=h;break;case"left":r=e;break;case"right":r=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),n){case"top-right":case"top-left":case"top":l=i-7;break;case"bottom-right":case"bottom-left":case"bottom":l=7-i}switch(n){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}}return[r,l]}function kA(n,e,i,r,l,h,f,m,x,v,S,A,M,R,D){const U=n.layers[0],G=U.appearances;if(G.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const V={iconBBox:null,iconVerticalBBox:null},Z={textBBox:null,textVerticalBBox:null},{baseIconRotate:Y,baseTextRotate:Q,iconScaleFactor:le}=(function(ge,_e,pe){const be=ge.get("icon-rotate").evaluate(_e,{},pe),Me=ge.get("text-rotate").evaluate(_e,{},pe),[Ye,Ze]=ge.get("icon-size-scale-range");return{baseIconRotate:be,baseTextRotate:Me,iconScaleFactor:he(1,Ye,Ze)}})(r,l,h);e&&(V.iconBBox=Kf(e,V.iconBBox,Y,f),i)&&(V.iconVerticalBBox=Kf(i,V.iconVerticalBBox,Y+90,f));const ae=Wy(A.horizontal);ae&&(Z.textBBox=Kf(ae,Z.textBBox,Q,1,R)),A.vertical&&(Z.textVerticalBBox=Kf(A.vertical,Z.textVerticalBBox,Q+90,1,R));for(const ge of G)ge.hasIconProperties()&&FA(V,n,U,ge,l,h,m,Y,f,x,e,v,le,S,D),ge.hasTextProperties()&&NA(Z,U,ge,l,h,R,Q,M,ae,A.vertical);return{iconBBox:V.iconBBox,iconVerticalBBox:V.iconVerticalBBox,textBBox:Z.textBBox,textVerticalBBox:Z.textVerticalBBox}}function FA(n,e,i,r,l,h,f,m,x,v,S,A,M,R,D){const{appearanceIconOffset:U,appearanceIconRotate:G,appearanceIconSize:V}=jb(r,i,l,h,f,m,x,v.iconScaleFactor);let Z=null,Y=null,Q=null;r.hasProperty("icon-image")?Q=(function(le,ae,ge,_e,pe,be,Me,Ye){let Ze=null;const We=ae.getAppearanceValueAndResolveTokens(ge,"icon-image",_e,pe,Ye);if(We){const lt=le.getResolvedImageFromTokens(We),at=ge.getUnevaluatedProperty("icon-size"),st=M_(lt,_m(le.zoom,at,le.worldview,Ye),at,pe,le.zoom,_e,le.pixelRatio,Me,le.worldview,Ye);Ze=be.get(st.iconPrimary.toString())}return Ze})(e,i,r,l,h,A,M,D):S&&(Q=S.imagePrimary),Q&&(Z=Hy(Q,null,U,R),e.allowVerticalPlacement&&(Y=Hy(Q,null,U,R))),Z&&(n.iconBBox=Kf(Z,n.iconBBox,G,V)),Y&&(n.iconVerticalBBox=Kf(Y,n.iconVerticalBBox,G+90,V))}function jb(n,e,i,r,l,h,f,m){const x=n.hasProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(n,"icon-offset",i,r,[]):null,v=x&&Array.isArray(x)?x:l,S=n.hasProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(n,"icon-rotate",i,r,[]):null,A=typeof S=="number"?S:h,M=n.hasProperty("icon-size")?e.getAppearanceValueAndResolveTokens(n,"icon-size",i,r,[]):null;return{appearanceIconOffset:v,appearanceIconRotate:A,appearanceIconSize:typeof M=="number"?M*m:f}}function NA(n,e,i,r,l,h,f,m,x,v){const{appearanceTextOffset:S,appearanceTextRotate:A,appearanceTextSize:M}=Gb(i,e,r,l,h,f,m),R=M/m;x&&(n.textBBox=Kf(x,n.textBBox,A,R,S)),v&&(n.textVerticalBBox=Kf(v,n.textVerticalBBox,A+90,R,S))}function Gb(n,e,i,r,l,h,f){const m=n.hasProperty("text-offset")?e.getAppearanceValueAndResolveTokens(n,"text-offset",i,r,[]):null,x=m&&Array.isArray(m)?[m[0]*yo,m[1]*yo]:l,v=n.hasProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(n,"text-rotate",i,r,[]):null,S=typeof v=="number"?v:h,A=n.hasProperty("text-size")?e.getAppearanceValueAndResolveTokens(n,"text-size",i,r,[]):null;return{appearanceTextOffset:x,appearanceTextRotate:S,appearanceTextSize:typeof A=="number"?A:f}}function Xy(n,e,i,r,l,h,f,m,x){if(!e||!e.usvg)return;const v=Mb(r),S=Mb(l),A=h!=="both"&&h!=="width"||!Eb(r)?1:S.width/v.width,M=h!=="both"&&h!=="height"||!Ab(r)?1:S.height/v.height;i.scaleSelf(A,M);const R=i.toString();f.set(R,i),m.set(R,e);const{imagePosition:D}=D0(R,e,1);x.set(R,D)}function Hb(n,e,i,r,l,h,f,m,x,v){if(!n)return;
218const S=(function(A,M,R,D,U,G,V){if(A.kind==="camera")return A.maxSize;if(A.kind==="composite"){const Z=M.possiblyEvaluate(new mn(A.maxZoom,{worldview:G}),R,V).evaluate(U,{},R,V),Y=M.possiblyEvaluate(new mn(A.minZoom,{worldview:G}),R,V).evaluate(U,{},R,V);return Math.max(Z,Y)}return M.possiblyEvaluate(new mn(D,{worldview:G}),R,V).evaluate(U,{},R,V)})(e,i,r,l,h,x,v);return n.scaleSelf(S*m*f)}function M_(n,e,i,r,l,h,f,m,x,v){return{iconPrimary:Hb(n.getPrimary(),e,i,r,l,h,f,m,x,v),iconSecondary:Hb(n.getSecondary(),e,i,r,l,h,f,m,x,v)}}function UA(n,e,i){if(!e)return;const r=i.get(n.toString()),l=i.get(e.toString());r&&l&&(r.paddedRect.w===l.paddedRect.w&&r.paddedRect.h===l.paddedRect.h||vi(`Mismatch in icon variant sizes: ${n.toString()} and ${e.toString()}`),r.usvg!==l.usvg&&vi(`Mismatch in icon variant image types: ${n.id} and ${e.id}`))}function qb(n,e,i,r){if(!n)return;const l=e.get(i.toString());if(n.imagePrimary=l,r){const h=e.get(r.toString());n.imageSecondary=h}}function VA(n,e){for(const i in n.horizontal)Zb(n.horizontal[i],e);Zb(n.vertical,e)}function Zb(n,e){if(n){for(const i of n.positionedLines)for(const r of i.positionedGlyphs)if(r.image!==null){const l=r.image.toString();r.rect=e.get(l).paddedRect}}}function B0(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 jA(n,e,i,r,l,h,f,m,x){const v=Wy(h.horizontal)||h.vertical,S=i.get("icon-text-fit-padding").evaluate(r,{},l);let A,M=e;return e&&x!=="none"&&(n.allowVerticalPlacement&&h.vertical&&(A=R0(e,h.vertical,x,S,m,f)),v&&(M=R0(e,v,x,S,m,f))),{defaultShapedIcon:M,verticallyShapedIcon:A}}function $b(n,e){return n*e/24}function GA(n,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z,Y,Q,le,ae,ge){let _e=f.textMaxSize.evaluate(e,{},M);_e===void 0?_e=m*f.textScaleFactor:_e*=f.textScaleFactor;const pe=n.layers[0].layout,be=$b(m,f.textScaleFactor),Me=Wy(i.horizontal)||i.vertical,Ye=n.hasAnyAppearanceProperty(["text-size","text-offset","text-rotate"]);if((G!=="none"||Ye)&&n.appearanceFeatureData&&n.featureToAppearanceIndex[e.index]<n.appearanceFeatureData.length){const kt=n.appearanceFeatureData[n.featureToAppearanceIndex[e.index]];kt&&(kt.textShaping=Me,kt.iconTextFitPadding=pe.get("icon-text-fit-padding").evaluate(e,{},M),kt.fontScale=be,kt.textScaleFactor=f.textScaleFactor)}const Ze=R.name==="globe",We=n.tilePixelRatio*_e/24,lt=(gt=n.overscaling,n.zoom>18&&gt>2&&(gt>>=1),Math.max(Lt/(512*gt),1)*pe.get("symbol-spacing")),at=pe.get("text-padding")*n.tilePixelRatio,st=pe.get("icon-padding")*n.tilePixelRatio,He=Ki(pe.get("text-max-angle")),ht=pe.get("icon-rotation-alignment")==="map"&&Y!=="point",tt=lt/2;var gt;n.hasAnyIconTextFit===!1&&G!=="none"&&(n.hasAnyIconTextFit=!0);const ct=e.properties?+e.properties[Yi]:null,qt=ct&&n.elevationFeatureIdToIndex?n.elevationFeatureIdToIndex.get(ct):65535,$t=(kt,Nt,ci)=>{if(Nt.x<0||Nt.x>=Lt||Nt.y<0||Nt.y>=Lt)return;let ii=null;if(Ze){const{x:Gt,y:Ei,z:Zi}=R.projectTilePoint(Nt.x,Nt.y,ci);ii={anchor:new Gd(Gt,Ei,Zi,0,void 0),up:R.upVector(ci,Nt.x,Nt.y)}}(function(Gt,Ei,Zi,fn,Ui,En,on,Ar,sn,Tn,$n,tr,ir,Mr,zo,ra,$r,io,fo,Ni,nr,fr,Xs,Oa,Do,Ba,zh,va,dx,Tg,Ya,fx){const Dh=Gt.addToLineVertexArray(Ei,fn);let Hd,ep,ic,kc,G_,Sg,Vi,xo=0,Cr=0,no=0,nc=0,ys=-1,Ws=-1;const vo={};let H_=el("");const Ph=Zi?Zi.anchor:Ei,Xr=va!=="none";let Po=0,ro=0;if(sn._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Lo=sn.layout.get("text-offset").evaluate(nr,{},Do);Po=Lo[0]*yo,ro=Lo[1]*yo}else Po=sn.layout.get("text-radial-offset").evaluate(nr,{},Do)*yo,ro=O0;if(Gt.allowVerticalPlacement&&Ui.vertical){const Lo=Ui.vertical;if(zo)Sg=N0(Lo),Ar&&(Vi=N0(Ar));else{const xs=sn.layout.get("text-rotate").evaluate(nr,{},Do)+90;ic=Yy(Tn,Ph,Ei,$n,tr,ir,Lo,Mr,xs,ra,fx),Ar&&(kc=Yy(Tn,Ph,Ei,$n,tr,ir,Ar,io,xs,null,Ya))}}if(En){const Lo=sn.layout.get("icon-rotate").evaluate(nr,{},Do),xs=L0(En,Lo,Xs,Xr,fr.iconScaleFactor),Fc=Ar?L0(Ar,Lo,Xs,Xr,fr.iconScaleFactor):void 0;ep=Yy(Tn,Ph,Ei,$n,tr,ir,En,io,Lo,null,Tg);const Lh=(function(Iu,tC,h2,iC,nC,d2,f2,rC,VP,cv){const p2=Iu.layers[0],m2=p2.appearances;let Ag=tC.length;if(h2&&(Ag=Math.max(Ag,h2.length)),m2.length===0)return Ag;const[oC,aC]=iC.get("icon-size-scale-range"),sC=he(1,oC,aC);for(const uv of m2){const g2=uv.getUnevaluatedProperties();if(g2._values["icon-image"].value!==void 0){const _2=p2.getAppearanceValueAndResolveTokens(uv,"icon-image",d2,f2,cv);if(_2){const y2=Iu.getResolvedImageFromTokens(_2);if(y2){const x2=uv.hasProperty("icon-size")?g2._values["icon-size"]:nC._values["icon-size"],lC=M_(y2,_m(Iu.zoom,x2,Iu.worldview,cv),x2,f2,Iu.zoom,d2,Iu.pixelRatio,sC,Iu.worldview,cv),v2=rC.get(lC.iconPrimary.toString());v2&&(Ag=Math.max(Ag,zA(v2)))}}}}return Ag})(Gt,xs,Fc,sn.layout,sn._unevaluatedLayout,nr,Do,Gt.iconAtlasPositions,0,Oa);xo=4*Lh;const sv=sn.layout.get("icon-size").evaluate(nr,{},Do,Oa),lv=fr.compositeIconSizes?fr.compositeIconSizes[0].evaluate(nr,{},Do,Oa):0,q_=fr.compositeIconSizes?fr.compositeIconSizes[1].evaluate(nr,{},Do,Oa):0,Eg=F0(Gt.layerIds[0],Gt.iconSizeData,sv,fr.iconScaleFactor,lv,q_);Gt.addSymbols(Gt.icon,xs,Eg,Ni,fo,nr,void 0,Zi,Ei,Dh.lineStartIndex,Dh.lineLength,-1,Oa,Do,Ba,zh,Gt.symbolInstances.length,Lh),ys=Gt.icon.placedSymbolArray.length-1,Fc&&(Cr=4*Lh,Gt.addSymbols(Gt.icon,Fc,Eg,Ni,fo,nr,$s.vertical,Zi,Ei,Dh.lineStartIndex,Dh.lineLength,-1,Oa,Do,Ba,zh,Gt.symbolInstances.length,Lh),Ws=Gt.icon.placedSymbolArray.length-1)}for(const Lo in Ui.horizontal){const xs=Lo,Fc=Ui.horizontal[xs];Hd||(H_=el(Fc.text),zo?G_=N0(Fc):Hd=Yy(Tn,Ph,Ei,$n,tr,ir,Fc,Mr,sn.layout.get("text-rotate").evaluate(nr,{},Do),ra,fx));const Lh=Fc.positionedLines.length===1;if(no+=Xb(Gt,Zi,Ei,Fc,on,sn,zo,nr,ra,Dh,Ui.vertical?$s.horizontal:$s.horizontalOnly,Lh?OA(Ui.horizontal):[xs],vo,ys,fr,Oa,Do,Gt.symbolInstances.length,Ba),Lh)break}Ui.vertical&&(nc+=Xb(Gt,Zi,Ei,Ui.vertical,on,sn,zo,nr,ra,Dh,$s.vertical,["vertical"],vo,Ws,fr,Oa,Do,Gt.symbolInstances.length,Ba));let ba=-1;const wa=(Lo,xs)=>Lo?Math.max(Lo,xs):xs;ba=wa(G_,ba),ba=wa(Sg,ba),ba=wa(Vi,ba);const tp=ba>-1?1:0;Gt.glyphOffsetArray.length>=65535&&vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),nr.sortKey!==void 0&&Gt.addToSortKey
vendor: 21,877 bytes, line 218
218Ranges(Gt.symbolInstances.length,nr.sortKey),Gt.symbolInstances.emplaceBack(Ei.x,Ei.y,Ph.x,Ph.y,Ph.z,vo.right>=0?vo.right:-1,vo.center>=0?vo.center:-1,vo.left>=0?vo.left:-1,vo.vertical>=0?vo.vertical:-1,ys,Ws,H_,Hd!==void 0?Hd:Gt.collisionBoxArray.length,Hd!==void 0?Hd+1:Gt.collisionBoxArray.length,ic!==void 0?ic:Gt.collisionBoxArray.length,ic!==void 0?ic+1:Gt.collisionBoxArray.length,ep!==void 0?ep:Gt.collisionBoxArray.length,ep!==void 0?ep+1:Gt.collisionBoxArray.length,kc||Gt.collisionBoxArray.length,kc?kc+1:Gt.collisionBoxArray.length,$n,no,nc,xo,Cr,tp,0,Po,ro,ba,0,Xr?1:0,dx)})(n,Nt,ii,kt,i,r,h,l,n.layers[0],n.collisionBoxArray,e.index,e.sourceLayerIndex,n.index,at,Z,v,0,st,ht,V,e,f,S,A,M,D,U,G,qt,Q,le,ae)};if(Y==="line")for(const kt of zy(e.geometry,0,0,Lt,Lt)){const Nt=RA(kt,lt,He,i.vertical||Me,r,24,We,n.overscaling,Lt);for(const ci of Nt)Me&&HA(n,Me.text,tt,ci)||$t(kt,ci,M)}else if(Y==="line-center"){for(const kt of e.geometry)if(kt.length>1){const Nt=IA(kt,He,i.vertical||Me,r,24,We);Nt&&$t(kt,Nt,M)}}else if(e.type==="Polygon")for(const kt of am(e.geometry,0)){const Nt=PA(kt,16);$t(kt[0],new Gd(Nt.x,Nt.y,0,0,void 0),M)}else if(e.type==="LineString")for(const kt of e.geometry)$t(kt,new Gd(kt[0].x,kt[0].y,0,0,void 0),M);else if(e.type==="Point")for(const kt of e.geometry)for(const Nt of kt)$t([Nt],new Gd(Nt.x,Nt.y,0,0,void 0),M)}const k0=255,ym=k0*jd;function Xb(n,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z){const Y=Ub(0,r,x,h,f,m,l,n.allowVerticalPlacement,void 0),Q=h.layout.get("text-size").evaluate(m,{},G),le=D.compositeTextSizes?D.compositeTextSizes[0].evaluate(m,{},G):0,ae=D.compositeTextSizes?D.compositeTextSizes[1].evaluate(m,{},G):0,ge=F0(n.layerIds[0],n.textSizeData,Q,D.textScaleFactor,le,ae);n.addSymbols(n.text,Y,ge,x,f,m,S,e,i,v.lineStartIndex,v.lineLength,R,U,G,Z,!1,V,Y.length);for(const _e of A)M[_e]=n.text.placedSymbolArray.length-1;return 4*Y.length}function F0(n,e,i,r,l,h){const f=e;let m=null;return f.kind==="source"?(m=[jd*i*r],m[0]>ym&&vi(`${n}: Value for "text-size" is >= ${k0}. Reduce your "text-size".`)):f.kind==="composite"&&(m=[jd*l*r,jd*h*r],(m[0]>ym||m[1]>ym)&&vi(`${n}: Value for "text-size" is >= ${k0}. Reduce your "text-size".`)),m}function Wy(n){for(const e in n)return n[e];return null}function Yy(n,e,i,r,l,h,f,m,x,v,S){let A,M,R,D;if(A=S?S.top:f.top,M=S?S.bottom:f.bottom,R=S?S.left:f.left,D=S?S.right:f.right,I0(f)&&f.collisionPadding){const U=f.collisionPadding;R-=U[0],A-=U[1],D+=U[2],M+=U[3]}if(x){const U=new _t(R,A),G=new _t(D,A),V=new _t(R,M),Z=new _t(D,M),Y=Ki(x);let Q=new _t(0,0);v&&(Q=new _t(v[0],v[1])),U._rotateAround(Y,Q),G._rotateAround(Y,Q),V._rotateAround(Y,Q),Z._rotateAround(Y,Q),R=Math.min(U.x,G.x,V.x,Z.x),D=Math.max(U.x,G.x,V.x,Z.x),A=Math.min(U.y,G.y,V.y,Z.y),M=Math.max(U.y,G.y,V.y,Z.y)}return n.emplaceBack(e.x,e.y,e.z,i.x,i.y,R,A,D,M,m,r,l,h),n.length-1}function N0(n){I0(n)&&n.collisionPadding&&(n.top-=n.collisionPadding[1],n.bottom+=n.collisionPadding[3]);const e=n.bottom-n.top;return e>0?Math.max(10,e):null}function HA(n,e,i,r){const l=n.compareText;if(e in l){const h=l[e];for(let f=h.length-1;f>=0;f--)if(r.dist(h[f])<i)return!0}else l[e]=[];return l[e].push(r),!1}function Wb(n,e){const i=n.fovAboveCenter,r=n.elevation?n.elevation.getMinElevationBelowMSL()*e:0,l=(n._camera.position[2]*n.worldSize-r)/Math.cos(n._pitch),h=Math.sin(i)*l/Math.sin(Math.max(Math.PI/2-n._pitch-i,.01));let f=Math.sin(n._pitch)*h+l;const m=l*(1/n._horizonShift);if(!n.elevation||n.elevation.exaggeration()===0){let x=Math.max(n.zoom-17,0);n.isOrthographic&&(x/=10),f*=1+x}return Math.min(1.01*f,m)}function C_(n,e){if(!e.isReprojectedInTileSpace)return{scale:1<<n.z,x:n.x,y:n.y,x2:n.x+1,y2:n.y+1,projection:e};const i=Math.pow(2,-n.z),r=n.x*i,l=(n.x+1)*i,h=n.y*i,f=(n.y+1)*i,m=$e(r),x=$e(l),v=ot(h),S=ot(f),A=e.project(m,v),M=e.project(x,v),R=e.project(x,S),D=e.project(m,S);let U=Math.min(A.x,M.x,R.x,D.x),G=Math.min(A.y,M.y,R.y,D.y),V=Math.max(A.x,M.x,R.x,D.x),Z=Math.max(A.y,M.y,R.y,D.y);const Y=i/16;function Q(ae,ge,_e,pe,be,Me){const Ye=(_e+be)/2,Ze=(pe+Me)/2,We=e.project($e(Ye),ot(Ze)),lt=Math.max(0,U-We.x,G-We.y,We.x-V,We.y-Z);U=Math.min(U,We.x),V=Math.max(V,We.x),G=Math.min(G,We.y),Z=Math.max(Z,We.y),lt>Y&&(Q(ae,We,_e,pe,Ye,Ze),Q(We,ge,Ye,Ze,be,Me))}Q(A,M,r,h,l,h),Q(M,R,l,h,l,f),Q(R,D,l,f,r,f),Q(D,A,r,f,r,h),U-=Y,G-=Y,V+=Y,Z+=Y;const le=1/Math.max(V-U,Z-G);return{scale:le,x:U*le,y:G*le,x2:V*le,y2:Z*le,projection:e}}function Yb(n,{x:e,y:i},r=0){return new _t(((e-r)*n.scale-n.x)*Lt,(i*n.scale-n.y)*Lt)}const qA=Je(new Float32Array(16));class Qf{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new se(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r,l=!0){return e._coordinatePoint(e.locationCoordinate(i,r),l)}pixelsPerMeter(e,i){return Le(1,e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return Wb(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,l){const h=e.horizonLineFromTop(!1),f=new _t(i,Math.max(h,r));return e.rayIntersectionCoordinate(e.pointRayIntersection(f,l))}pointCoordinate3D(e,i,r){const l=new _t(i,r);if(e.elevation)return e.elevation.pointCoordinate(l);{const h=this.pointCoordinate(e,l.x,l.y,0);return[h.x,h.y,h.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const r=e.horizonLineFromTop();return i.y<r}createInversionMatrix(e,i){return qA}createTileMatrix(e,i,r){let l,h,f;const m=r.canonical,x=Je(new Float64Array(16));if(this.isReprojectedInTileSpace){const v=C_(m,this);l=1,h=v.x+r.wrap*v.scale,f=v.y,nt(x,x,[l/v.scale,l/v.scale,e.pixelsPerMeter/i])}else l=i/e.zoomScale(m.z),h=(m.x+Math.pow(2,m.z)*r.wrap)*l,f=m.y*l;return dt(x,x,[h,f,0]),nt(x,x,[l/Lt,l/Lt,1]),x}upVector(e,i,r){return[0,0,1]}upVectorScale(e,i,r){return{metersToTile:1}}}class ZA extends Qf{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,r]=this.parallels=e.parallels||[29.5,45.5],l=Math.sin(Ki(i));this.n=(l+Math.sin(Ki(r)))/2,this.c=1+l*(2*this.n-l),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:r,c:l,r0:h}=this,f=Ki(e-this.center[0]),m=Ki(i),x=Math.sqrt(l-2*r*Math.sin(m))/r;return{x:x*Math.sin(f*r),y:x*Math.cos(f*r)-h,z:0}}unproject(e,i){const{n:r,c:l,r0:h}=this,f=h+i;let m=Math.atan2(e,Math.abs(f))*Math.sign(f);f*r<0&&(m-=Math.PI*Math.sign(e)*Math.sign(f));const x=Ki(this.center[0])*r;m=Ge(m,-Math.PI-x,Math.PI-x);const v=he(De(m/r)+this.center[0],-180,180),S=Math.asin(he((l-(e*e+f*f)*r*r)/(2*r),-1,1)),A=he(De(S),-85.051129,Se);return new se(v,A)}}const I_=1.340264,R_=-.081106,z_=893e-6,D_=.003796,Ky=Math.sqrt(3)/2;class $A extends Qf{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const r=Math.asin(Ky*Math.sin(i)),l=r*r,h=l*l*l;return{x:.5*(e*Math.cos(r)/(Ky*(I_+3*R_*l+h*(7*z_+9*D_*l)))/Math.PI+.5),y:1-.5*(r*(I_+R_*l+h*(z_+D_*l))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,l=r*r,h=l*l*l;for(let S,A,M,R=0;R<12&&(A=r*(I_+R_*l+h*(z_+D_*l))-i,M=I_+3*R_*l+h*(7*z_+9*D_*l),S=A/M,r=he(r-S,-Math.PI/3,Math.PI/3),l=r*r,h=l*l*l,!(Math.abs(S)<1e-12));++R);const f=Ky*e*(I_+3*R_*l+h*(7*z_+9*D_*l))/Math.cos(r),m=Math.asin(Math.sin(r)/Ky),x=he(180*f/Math.PI,-180,180),v=he(180*m/Math.PI,-85.051129,Se);return new se(x,v)}}class XA extends Qf{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const r=360*(e-.5),l=he(360*(.5-i),-85.051129,Se);return new se(r,l)}}const _g=Math.PI/2;function Qy(n){return Math.tan((_g+n)/2)}class WA extends Qf{constructor(e){super(e),this.center=e.center||[0,30];const[i,r]=this.parallels=e.parallels||[30,30];let l=Ki(i),h=Ki(r);this.southernCenter=l+h<0,this.southernCenter&&(l=-l,h=-h);const f=Math.cos(l),m=Qy(l);this.n=l===h?Math.sin(l):Math.log(f/Math.cos(h))/Math.log(Qy(h)/m),this.f=f*Math.pow(Qy(l),this.n)/this.n}project(e,i){i=Ki(i),this.southernCenter&&(i=-i),e=Ki(e-this.center[0]);const r=1e-6,{n:l,f:h}=this;h>0?i<-_g+r&&(i=-_g+r):i>_g-r&&(i=_g-r);const f=h/Math.pow(Qy(i),l);let m=f*Math.sin(l*e),x=h-f*Math.cos(l*e);return m=.5*(m/Math.PI+.5),x=.5*(x/Math.PI+.5),{x:m,y:this.southernCenter?x:1-x,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:r,f:l}=this,h=l-i,f=Math.sign(h),m=Math.sign(r)*Math.sqrt(e*e+h*h);let x=Math.atan2(e,Math.abs(h))*f;h*r<0&&(x-=Math.PI*Math.sign(e)*f);const v=he(De(x/r)+this.center[0],-180,180),S=he(De(2*Math.atan(Math.pow(l/m,1/r))-_g),-85.051129,Se);return new se(v,this.southernCenter?-S:S)}}class Kb extends Qf{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:Re(e),y:Be(i),z:0}}unproject(e,i){const r=$e(e),l=ot(i);return new se(r,l)}}const Qb=Ki(Se);class YA extends Qf{project(e,i){const r=(i=Ki(i))*i,l=r*r;return{x:.5*((e=Ki(e))*(.8707-.131979*r+l*(l*(.003971*r-.001529*l)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+r*(.015085+l*(.028874*r-.044475-.005916*l)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,l=25,h=0,f=r*r;do{f=r*r;const v=f*f;h=(r*(1.007226+f*(.015085+v*(.028874*f-.044475-.005916*v)))-i)/(1.007226+f*(.045255+v*(.259866*f-.311325-.005916*11*v))),r=he(r-h,-Qb,Qb)}while(Math.abs(h)>1e-6&&--l>0);f=r*r;const m=he(De(e/(.8707+f*(f*(f*f*f*(.003971-.001529*f)-.013791)-.131979))),-180,180),x=De(r);return new se(m,x)}}const Jb=Ki(Se);class KA extends Qf{project(e,i){i=Ki(i),e=Ki(e);const r=Math.cos(i),l=2/Math.PI,h=Math.acos(r*Math.cos(e/2)),f=Math.sin(h)/h,m=.5*(e*l+2*r*Math.sin(e/2)/f)||0,x=.5*(i+Math.sin(i)/f)||0;return{x:.5*(m/Math.PI+.5),y:1-.5*(x/Math.PI+1),z:0}}unproject(e,i){let r=e=(2*e-.5)*Math.PI,l=i=(2*(1-i)-1)*Math.PI,h=25;const f=1e-6;let m=0,x=0;do{const v=Math.cos(l),S=Math.sin(l),A=2*S*v,M=S*S,R=v*v,D=Math.cos(r/2),U=Math.sin(r/2),G=2*D*U,V=U*U,Z=1-R*D*D,Y=Z?1/Z:0,Q=Z?Math.acos(v*D)*Math.sqrt(1/Z):0,le=.5*(2*Q*v*U+2*r/Math.PI)-e,ae=.5*(Q*S+l)-i,ge=.5*Y*(R*V+Q*v*D*M)+1/Math.PI,_e=Y*(G*A/4-Q*S*U),pe=.125*Y*(A*U-Q*S*R*G),be=.5*Y*(M*D+Q*V*v)+.5,Me=_e*pe-be*ge;m=(ae*_e-le*be)/Me,x=(le*pe-ae*ge)/Me,r=he(r-m,-Math.PI,Math.PI),l=he(l-x,-Jb,Jb)}while((Math.abs(m)>f||Math.abs(x)>f)&&--h>0);return new se(De(r),De(l))}}class ew extends Qf{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Ki(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:r,cosPhi:l}=this;return{x:Ki(e)*l*r+.5,y:-Math.sin(Ki(i))/l*r+.5,z:0}}unproject(e,i){const{scale:r,cosPhi:l}=this,h=-(i-.5)/r,f=he(De((e-.5)/r)/l,-180,180),m=Math.asin(he(h*l,-1,1)),x=he(De(m),-85.051129,Se);return new se(f,x)}}class QA extends Kb{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,r){const l=Wp(e,i,r);return Nn(l,l,Yp(Jl(r))),{x:l[0],y:l[1],z:l[2]}}locationPoint(e,i,r){const l=me(i.lat,i.lng),h=xi([],l),f=r?e._centerAltitude+r:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Ht(l,l,h,Le(1,0)*Lt*f);const m=Je(new Float64Array(16));return pt(m,e.pixelMatrix,e.globeMatrix),Nn(l,l,m),new _t(l[0],l[1])}pixelsPerMeter(e,i){return Le(1,0)*i}pixelSpaceConversion(e,i,r){const l=Le(1,e)*i,h=mi(Le(1,45)*i,l,r);return this.pixelsPerMeter(e,i)/h}createTileMatrix(e,i,r){const l=On(Jl(r.canonical));return pt(new Float64Array(16),e.globeMatrix,l)}createInversionMatrix(e,i){const{center:r}=e,l=Yp(Jl(i));return ut(l,l,Ki(r.lng)),vt(l,l,Ki(r.lat)),nt(l,l,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(l)}pointCoordinate(e,i,r,l){return Zg(e,i,r,!0)||new Bt(0,0)}pointCoordinate3D(e,i,r){const l=this.pointCoordinate(e,i,r,0);return[l.x,l.y,l.z]}isPointAboveHorizon(e,i){return!Zg(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(l,h){const f=l.cameraToCenterDistance,m=l._centerAltitude*h,x=l._camera,v=l._camera.forward(),S=Tt([],bt([],v,-f),[0,0,m]),A=l.worldSize/(2*Math.PI),M=[0,0,-A],R=l.width/l.height,D=Math.tan(l.fovAboveCenter),U=bt([],x.up(),D),G=bt([],x.right(),D*R),V=xi([],Tt([],Tt([],v,U),G)),Z=[];let Y;if(new Mn(S,V).closestPointOnSphere(M,A,Z)){const Q=Tt([],Z,M),le=rr([],Q,S);Y=Math.cos(l.fovAboveCenter)*Si(le)}else{const Q=rr([],S,M),le=rr([],M,S);xi(le,le);const ae=Si(Q)-A;Y=Math.sqrt(ae*(ae+2*A));const ge=Math.acos(Y/(A+ae))-Math.acos(ln(v,le));Y*=Math.cos(ge)}return 1.01*Y})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=wu(e.zoom);if(r>0){const l=Wb(e,Le(1,e.center.lat)*e.worldSize),h=e.worldSize/(2*Math.PI),f=Math.max(e.width,e.height)/e.worldSize*Math.PI;return mi(i,l+h*(1-Math.cos(f)),Math.pow(r,10))}return i}upVector(e,i,r){return Wp(i,r,e,1)}upVectorScale(e){return{metersToTile:$p(Ah(Jl(e)))}}}function tw(n){const e=n.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(n.name){case"mercator":return new Kb(n);case"equirectangular":return new XA(n);case"naturalEarth":return new YA(n);case"equalEarth":return new $A(n);case"winkelTripel":return new KA(n);case"albers":return i?new ew(n):new ZA(n);case"lambertConformalConic":return i?new ew(n):new WA(n);case"globe":return new QA(n)}throw new Error(`Invalid projection name: ${n.name}`)}const JA=Hi.types,eM=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function P_(n,e,i,r,l,h,f,m,x,v,S,A,M){const R=m?Math.min(ym,Math.round(m[0])):0,D=m?Math.min(ym,Math.round(m[1])):0;n.emplaceBack(e,i,Math.round(32*r),Math.round(32*l),h,f,(R<<1)+(x?1:0),0+(D<<1),16*v,16*S,256*A,256*M)}function L_(n,e,i){n.emplaceBack(e,i)}function O_(n,e,i,r,l,h,f){n.emplaceBack(e,i,r,l,h,f)}const Jy=(n,e,i,r)=>{for(let l=0;l<e;l++)n.emplaceBack(i[0],i[1],i[2],r[0],r[1],r[2])};function yg(n,e,i,r,l){n.emplaceBack(e,i,r,l),n.emplaceBack(e,i,r,l),n.emplaceBack(e,i,r,l),n.emplaceBack(e,i,r,l)}function tM(n){for(const e of n.sections)if(pl(e.text))return!0;return!1}class U0{constructor(e){this.layoutVertexArray=new pu,this.indexArray=new Lr,this.programConfigurations=e,this.segments=new kn,this.dynamicLayoutVertexArray=new Us,this.opacityVertexArray=new Pf,this.placedSymbolArray=new Dd,this.iconTransitioningVertexArray=new $a,this.globeExtVertexArray=new Df,this.zOffsetVertexArray=new eo,this.orientationVertexArray=new ph,this.symbolInstanceIndices=[]}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getSymbolVertexData(e,i){const r=[],l=this.layoutVertexArray.uint16;for(let h=0;h<i;++h){const f=12*(e+h);r.push(...l.slice(f,f+12))}return r}updateSymbolVertexData(e,i,r,l,h,f,m,x,v,S,A,M,R){const D=this.layoutVertexArray.uint16,U=12*e;D[U]=i,D[U+1]=r,D[U+2]=l,D[U+3]=h,D[U+4]=f,D[U+5]=m,D[U+6]=x,D[U+7]=v,D[U+8]=S,D[U+9]=A,D[U+10]=M,D[U+11]=R}upload(e,i,r,l,h,f){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nA.members,!!f),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,oA.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,eM,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,lA.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,rA.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||h)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,aA.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,sA.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}zt(U0,"SymbolBuffers");class V0{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new kn,this.collisionVertexArray=new Id,this.collisionVertexArrayExt=new Us}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,cA.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,uA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}zt(V0,"CollisionBuffers");class ex{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(f=>f.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Je([]),this.placementViewportMatrix=Je([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=_m(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=_m(this.zoom,i["icon-size"],this.worldview,e.availableImages);const r=this.layers[0].layout,l=r.get("symbol-sort-key"),h=r.get("symbol-z-order");this.lut=e.lut,this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&l.constantOr(1)!==void 0,this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map(f=>$s[f]),this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){const i=this.layers[0].getAppearances();if(!i||i.length===0)return!1;const r=Array.isArray(e)?e:[e];return i.some(l=>r.some(h=>l.getProperty(h)!=null))}createArrays(){this.text=new U0(new I(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new U0(new I(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new Pd,this.lineVertexArray=new Hm,this.symbolInstances=new Ir}calculateGlyphDependencies(e,i,r,l,h){for(const f of e){const m=f.codePointAt(0);if(m===void 0)break;if(i[m]=!0,l&&h&&m<=65535){const x=T_[f];x&&(i[x.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,r,l,h,f,m){if(!e.hasProperty("icon-size"))return m*f;let x=1;const v=e.getUnevaluatedProperties()._values["icon-size"],S=_m(this.zoom,v,this.worldview,h),A=pg(S,i);if(S.kind!=="constant"&&S.kind!=="camera"||(x=A.uSize),S.kind==="composite"){const{minZoom:M,maxZoom:R}=S,D=v.possiblyEvaluate(new mn(M,{worldview:this.worldview}),l),U=v.possiblyEvaluate(new mn(R,{worldview:this.worldview}),l),G=D.evaluate(r,{},l,h);x=G+(U.evaluate(r,{},l,h)-G)*A.uSizeT}return S.kind==="source"&&(x=v.possiblyEvaluate(new mn(this.zoom,{worldview:this.worldview}),l).evaluate(r,{},l,h)),x*f}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const r=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!s(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?ca.build(e):e}populate(e,i,r,l){const h=this.layers[0],f=h.layout,m=this.projection.name==="globe",x=f.get("text-font"),v=f.get("text-field"),S=f.get("icon-image"),[A,M]=f.get("icon-size-scale-range"),R=he(i.scaleFactor||1,A,M),D=(v.value.kind!=="constant"||v.value.value instanceof Mo&&!v.value.value.isEmpty()||v.value.value.toString().length>0)&&(x.value.kind!=="constant"||x.value.value.length>0),U=S.value.kind!=="constant"||!!S.value.value||Object.keys(S.parameters).length>0,G=this.hasAnyAppearanceProperty("icon-image"),V=f.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!D&&!U&&!G)return;const Z=i.iconDependencies,Y=i.glyphDependencies,Q=i.availableImages,le=new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),ae=ge=>{const _e=ge.id.toString();Z.has(_e)?Z.get(_e).push(ge):Z.set(_e,[ge])};for(const ge of e){const{feature:_e,id:pe,index:be,sourceLayerIndex:Me}=ge,Ye=h._featureFilter.needGeometry,Ze=Ri(_e,Ye);
218if(!h._featureFilter.filter(le,Ze,r))continue;if(Ye||(Ze.geometry=fi(_e,r,l)),m&&_e.type!==1&&r.z<=5){const gt=Ze.geometry,ct=.98078528056,qt=($t,kt)=>ln(Wp($t.x,$t.y,r,1),Wp(kt.x,kt.y,r,1))<ct;for(let $t=0;$t<gt.length;$t++)gt[$t]=Wt(gt[$t],qt)}let We,lt;if(D){const gt=h.getValueAndResolveTokens("text-field",Ze,r,Q),ct=Mo.factory(gt);tM(ct)&&(this.hasRTLText=!0),(!this.hasRTLText||Sc()==="unavailable"||this.hasRTLText&&Ia.isParsed())&&(We=dA(ct,h,Ze))}if(U){const gt=h.getValueAndResolveTokens("icon-image",Ze,r,Q);lt=this.getResolvedImageFromTokens(gt)}const at=this.layers[0];let st=!1;if(!lt&&G){const gt=at.getAppearances();for(const ct of gt)if(ct.getProperty("icon-image")){const qt=at.getAppearanceValueAndResolveTokens(ct,"icon-image",Ze,r,Q);if(qt){lt=this.getResolvedImageFromTokens(qt),st=!0;break}}}if(!We&&!lt)continue;const He=this.sortFeaturesByKey?V.evaluate(Ze,{},r):void 0,ht={id:pe,text:We,icon:lt,index:be,sourceLayerIndex:Me,geometry:Ze.geometry,properties:_e.properties,type:JA[_e.type],sortKey:He};if(this.features.push(ht),this.featureToAppearanceIndex[be]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:pe,properties:_e.properties,usesAppearanceIconAsPlaceholder:st,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:[],layoutBasedTextVertexData:[],activeAppearance:null}),lt){const gt=at._unevaluatedLayout._values,{iconPrimary:ct,iconSecondary:qt}=M_(lt,this.iconSizeData,gt["icon-size"],r,this.zoom,ht,this.pixelRatio,R,this.worldview,Q);ae(ct),qt&&(this.hasAnySecondaryIcon=!0,ae(qt))}const tt=at.getAppearances();if(tt.length!==0&&tt.forEach(gt=>{if(!gt.getProperty("icon-image"))return;const ct=this.getCombinedIconPrimary(gt,at,Ze,r,Q,ht,R);ct&&ae(ct)}),We){const gt=x.evaluate(Ze,{},r).join(","),ct=f.get("text-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf($s.vertical)>=0;for(const qt of We.sections)if(qt.image){const $t=qt.image.getPrimary().scaleSelf(this.pixelRatio),kt=$t.id.toString(),Nt=Z.get(kt)||[];Nt.push($t),Z.set(kt,Nt)}else{const $t=Tf(We.toString()),kt=qt.fontStack||gt,Nt=Y[kt]=Y[kt]||{};this.calculateGlyphDependencies(qt.text,Nt,ct,this.allowVerticalPlacement,$t)}}}if(f.get("symbol-placement")==="line"&&(this.features=(function(ge){const _e={},pe={},be=[];let Me=0;function Ye(at){be.push(ge[at]),Me++}function Ze(at,st,He){const ht=pe[at];return delete pe[at],pe[st]=ht,be[ht].geometry[0].pop(),be[ht].geometry[0]=be[ht].geometry[0].concat(He[0]),ht}function We(at,st,He){const ht=_e[st];return delete _e[st],_e[at]=ht,be[ht].geometry[0].shift(),be[ht].geometry[0]=He[0].concat(be[ht].geometry[0]),ht}function lt(at,st,He){const ht=He?st[0][st[0].length-1]:st[0][0];return`${at}:${ht.x}:${ht.y}`}for(let at=0;at<ge.length;at++){const st=ge[at],He=st.geometry,ht=st.text?st.text.toString():null;if(!ht){Ye(at);continue}const tt=lt(ht,He),gt=lt(ht,He,!0);if(tt in pe&&gt in _e&&pe[tt]!==_e[gt]){const ct=We(tt,gt,He),qt=Ze(tt,gt,be[ct].geometry);delete _e[tt],delete pe[gt],pe[lt(ht,be[qt].geometry,!0)]=qt,be[ct].geometry=null}else tt in pe?Ze(tt,gt,He):gt in _e?We(tt,gt,He):(Ye(at),_e[tt]=Me-1,pe[gt]=Me-1)}return be.filter(at=>at.geometry)})(this.features)),f.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const ge of i.elevationFeatures)this.elevationFeatureIdToIndex.set(ge.id,this.elevationFeatures.length),this.elevationFeatures.push(ge)}}else f.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((ge,_e)=>ge.sortKey-_e.sortKey)}getCombinedIconPrimary(e,i,r,l,h,f,m){let x,v;const S=e.getUnevaluatedProperties();if(S._values["icon-image"].value!==void 0){const A=i.getAppearanceValueAndResolveTokens(e,"icon-image",r,l,h);x=this.getResolvedImageFromTokens(A)}else{const A=i.getValueAndResolveTokens("icon-image",r,l,h);x=this.getResolvedImageFromTokens(A)}if(x){const A=e.hasProperty("icon-size")?S._values["icon-size"]:i._unevaluatedLayout._values["icon-size"];v=M_(x,_m(this.zoom,A,this.worldview,h),A,l,this.zoom,f,this.pixelRatio,m,this.worldview,h).iconPrimary}return v}updateSymbolInstanceIconVertices(e,i,r,l,h,f,m,x,v,S,A,M,R,D){if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(i.activeAppearance===r)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};if(r){const U=this.getCombinedIconPrimary(r,v,l,f,m,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:i.properties,type:"Point",id:i.id},S);if(!U)return{vertexOffsetDelta:0,hasChanges:!1};const G=U.toString(),V=this.iconAtlasPositions&&this.iconAtlasPositions.get(G);if(V){const{appearanceIconOffset:Z,appearanceIconRotate:Y}=jb(r,v,l,f,M,D,R,S);let Q=Hy(V,void 0,Z,v.layout.get("icon-anchor").evaluate(l,A,f));const le=V.sdf,ae=v.layout.get("icon-text-fit").constantOr("none");ae!=="none"&&i.textShaping&&i.iconTextFitPadding&&i.fontScale&&(Q=R0(Q,i.textShaping,ae,i.iconTextFitPadding,Z,i.fontScale));
vendor: 5,820 bytes, line 218
218const ge=this.calculateEffectiveAppearanceIconSize(r,x.zoom,l,f,m,S,R),_e=0,pe=1+(Math.min(ym,Math.round(ge*jd))<<1),be=L0(Q,Y,le,ae!=="none",S);i.isUsingAppearanceIconVertexData||(i.isUsingAppearanceIconVertexData=!0,i.layoutBasedIconVertexData=this.icon.getSymbolVertexData(h,e.numIconVertices));let Me=h;for(let Ze=0;Ze<be.length;++Ze){const We=be[Ze],lt=i.layoutBasedIconVertexData[0]||e.tileAnchorX,at=i.layoutBasedIconVertexData[1]||e.tileAnchorY,st=16*We.pixelOffsetTL.x,He=16*We.pixelOffsetTL.y,ht=16*We.pixelOffsetBR.x,tt=16*We.pixelOffsetBR.y,gt=16*We.minFontScaleX,ct=16*We.minFontScaleY;this.icon.updateSymbolVertexData(Me,lt,at,Math.round(32*We.tl.x),Math.round(32*We.tl.y),We.texPrimary.x,We.texPrimary.y,_e,pe,st,He,gt,ct),this.icon.updateSymbolVertexData(Me+1,lt,at,Math.round(32*We.tr.x),Math.round(32*We.tr.y),We.texPrimary.x+We.texPrimary.w,We.texPrimary.y,_e,pe,ht,He,gt,ct),this.icon.updateSymbolVertexData(Me+2,lt,at,Math.round(32*We.bl.x),Math.round(32*We.bl.y),We.texPrimary.x,We.texPrimary.y+We.texPrimary.h,_e,pe,st,tt,gt,ct),this.icon.updateSymbolVertexData(Me+3,lt,at,Math.round(32*We.br.x),Math.round(32*We.br.y),We.texPrimary.x+We.texPrimary.w,We.texPrimary.y+We.texPrimary.h,_e,pe,ht,tt,gt,ct),Me+=4}const Ye=e.numIconVertices-4*be.length;for(let Ze=0;Ze<Ye;++Ze)this.icon.updateSymbolVertexData(Me+Ze,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else if(i.usesAppearanceIconAsPlaceholder){if(this.layers[0].appearances&&this.layers[0].appearances.length>0)return this.icon.updateSymbolVertexData(h,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(h+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(h+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(h+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}else if(i.isUsingAppearanceIconVertexData){const G=i.layoutBasedIconVertexData.length/12;for(let V=0;V<G;++V){const Z=V*12;this.icon.updateSymbolVertexData(h+V,i.layoutBasedIconVertexData[Z+0],i.layoutBasedIconVertexData[Z+1],i.layoutBasedIconVertexData[Z+2],i.layoutBasedIconVertexData[Z+3],i.layoutBasedIconVertexData[Z+4],i.layoutBasedIconVertexData[Z+5],i.layoutBasedIconVertexData[Z+6],i.layoutBasedIconVertexData[Z+7],i.layoutBasedIconVertexData[Z+8],i.layoutBasedIconVertexData[Z+9],i.layoutBasedIconVertexData[Z+10],i.layoutBasedIconVertexData[Z+11])}return i.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:G,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z){const Y=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!Y)return{vertexOffsetDelta:Y?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearance===r)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};if(r&&i.textShaping){const{appearanceTextOffset:Q,appearanceTextRotate:le,appearanceTextSize:ae}=Gb(r,m,l,f,A,R,M);i.fontScale=$b(ae,i.textScaleFactor);const ge=r.getUnevaluatedProperty("text-size");let _e=this.textSizeData,pe=G,be=V;r.hasProperty("text-size")&&(_e=_m(this.zoom,ge,this.worldview,Z),pe=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,be=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const Me=i.textShaping.bottom-A[1],Ye=i.textShaping.left-A[0],Ze=i.textShaping.right-A[0];i.textShaping.top=Q[1]+(i.textShaping.top-A[1]),i.textShaping.bottom=Q[1]+Me,i.textShaping.left=Q[0]+Ye,i.textShaping.right=Q[0]+Ze;const We=Ub(0,i.textShaping,Q,m,!1,l,v,this.allowVerticalPlacement,le),lt=ae&&_e.kind==="composite"?ge.possiblyEvaluate(new mn(pe,{}),f).evaluate(l,S,f):D,at=ae&&_e.kind==="composite"?ge.possiblyEvaluate(new mn(be,{}),f).evaluate(l,S,f):U,st=F0(r.name,_e,ae,x,lt,at),He=Array.isArray(st)?st[1]:ae,ht=0,tt=1+(Math.min(ym,Math.round(He*jd))<<1);i.isUsingAppearanceTextVertexData||(i.isUsingAppearanceTextVertexData=!0,i.layoutBasedTextVertexData=this.text.getSymbolVertexData(h,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let gt=0;gt<We.length&&gt<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++gt){const ct=We[gt],qt=ct.glyphOffset[1],$t=e.tileAnchorX,kt=e.tileAnchorY,Nt=h+4*gt;this.text.updateSymbolVertexData(Nt,$t,kt,Math.round(32*ct.tl.x),Math.round(32*(qt+ct.tl.y)),ct.texPrimary.x,ct.texPrimary.y,ht,tt,ct.pixelOffsetTL.x,ct.pixelOffsetTL.y,ct.minFontScaleX,ct.minFontScaleY),this.text.updateSymbolVertexData(Nt+1,$t,kt,Math.round(32*ct.tr.x),Math.round(32*(qt+ct.tr.y)),ct.texPrimary.x+ct.texPrimary.w,ct.texPrimary.y,ht,tt,ct.pixelOffsetBR.x,ct.pixelOffsetTL.y,ct.minFontScaleX,ct.minFontScaleY),this.text.updateSymbolVertexData(Nt+2,$t,kt,Math.round(32*ct.bl.x),Math.round(32*(qt+ct.bl.y)),ct.texPrimary.x,ct.texPrimary.y+ct.texPrimary.h,ht,tt,ct.pixelOffsetTL.x,ct.pixelOffsetBR.y,ct.minFontScaleX,ct.minFontScaleY),this.text.updateSymbolVertexData(Nt+3,$t,kt,Math.round(32*ct.br.x),Math.round(32*(qt+ct.br.y)),ct.texPrimary.x+ct.texPrimary.w,ct.texPrimary.y+ct.texPrimary.h,ht,tt,ct.pixelOffsetBR.x,ct.pixelOffsetBR.y,ct.minFontScaleX,ct.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}if(i.isUsingAppearanceTextVertexData){const le=i.layoutBasedTextVertexData.length/12;for(let ae=0;ae<le;++ae){const ge=ae*12;this.text.updateSymbolVertexData(h+ae,i.layoutBasedTextVertexData[ge+0],i.layoutBasedTextVertexData[ge+1],i.layoutBasedTextVertexData[ge+2],i.layoutBasedTextVertexData[ge+3],i.layoutBasedTextVertexData[ge+4],i.layoutBasedTextVertexData[ge+5],i.layoutBasedTextVertexData[ge+6],i.layoutBasedTextVertexData[ge+7],i.layoutBasedTextVertexData[ge+8],i.layoutBasedTextVertexData[ge+9],i.layoutBasedTextVertexData[ge+10],i.layoutBasedTextVertexData[ge+11]
218)}return i.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:le,hasChanges:!0}}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}update(e,i,r,l,h,f,m){this.text.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,h,r,l,f,m,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const r=Et(e),l=1/r;let h=!1,f=!1;for(let m=0;m<this.symbolInstances.length;m++){const x=this.symbolInstances.get(m),v=je(1,0,0),S=je(0,1,0),{numHorizontalGlyphVertices:A,numVerticalGlyphVertices:M,numIconVertices:R,numVerticalIconVertices:D}=x,U=A>0||M>0,G=R>0,V=this.elevationFeatures[x.elevationFeatureIndex];if(V){const Z=new _t(x.tileAnchorX,x.tileAnchorY),Y=.075+V.pointElevation(Z);x.zOffset!==Y&&(i=!0,x.zOffset=Y),Y!==0&&(this.hasAnyZOffset=!0);const Q=V.computeSlopeNormal(Z,l),le=Br(oa(),je(0,0,1),Q);Ka(v,v,le),Ka(S,S,le),v[2]*=r,S[2]*=r,v[0]===1&&v[1]===0&&v[2]===0&&S[0]===0&&S[1]===1&&S[2]===0||(h=h||U,f=f||G)}if(U&&(Jy(this.text.orientationVertexArray,A,v,S),Jy(this.text.orientationVertexArray,M,v,S)),G){const{placedIconSymbolIndex:Z,verticalPlacedIconSymbolIndex:Y}=x;Z>=0&&Jy(this.icon.orientationVertexArray,R,v,S),Y>=0&&Jy(this.icon.orientationVertexArray,D,v,S)}}h||(this.text.orientationVertexArray=void 0),f||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(h,f,m)=>{r+=f,r>h.length&&h.resize(r);for(let x=-f;x<0;x++)h.emplace(x+r,m)},i=(h,f,m)=>{l+=f,l>h.length&&h.resize(l);for(let x=-f;x<0;x++)h.emplace(x+l,m)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,l=0;for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h),{numHorizontalGlyphVertices:m,numVerticalGlyphVertices:x,numIconVertices:v}=f,S=f.zOffset,A=v>0;if((m>0||x>0)&&(e(this.text.zOffsetVertexArray,m,S),e(this.text.zOffsetVertexArray,x,S)),A){const{placedIconSymbolIndex:M,verticalPlacedIconSymbolIndex:R}=f;M>=0&&i(this.icon.zOffsetVertexArray,v,S),R>=0&&i(this.icon.zOffsetVertexArray,f.numVerticalIconVertices,S)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,i,r,l,h){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(f=>f.appearances&&f.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,i,r,l,h){if(!(e&&i&&r&&this.appearanceFeatureData))return!1;const f=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,m=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!f&&!m)return!1;const x=this.layers[0],v=x.layout;let S=1,A=0,M=!1;if(f){const[V,Z]=v.get("icon-size-scale-range");S=he(1,V,Z)}let R=1,D=0,U=!1;if(m){const[V,Z]=v.get("text-size-scale-range");R=he(1,V,Z)}const G=new Map;if(h&&r)for(const V of r){const Z=h.getImage(V,x.scope);if(Z){const Y=new so(V.toString());G.set(Y.toString(),Z)}}for(let V=0;V<this.symbolInstances.length;V++){const Z=this.symbolInstances.get(V),Y=this.featureToAppearanceIndex[Z.featureIndex],Q=Y!==void 0?this.appearanceFeatureData[Y]:void 0;if(!Q)continue;const le=Q.id,ae=i&&le!==void 0?i[String(le)]:void 0,ge={type:"Point",id:Q.id,properties:Q.properties,geometry:[]},_e=x.appearances&&x.appearances.find(pe=>pe.isActive({globals:l,feature:ge,canonical:e,featureState:ae}));if(m){const pe=v.get("text-size"),be=v.get("text-offset").evaluate(ge,ae,e),Me=pe.evaluate(ge,ae,e),Ye=v.get("text-rotate").evaluate(ge,ae,e),Ze=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,We=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,lt=pe.evaluate(ge,{zoom:Ze},e),at=pe.evaluate(ge,{zoom:We},e),st=this.updateSymbolInstanceTextVertices(Z,Q,_e,ge,D,e,x,R,G,ae,be,Me,Ye,lt,at,Ze,We,r);D+=st.vertexOffsetDelta,U=U||st.hasChanges}if(f){const pe=v.get("icon-offset").evaluate(ge,ae,e),be=v.get("icon-size").evaluate(ge,ae,e,r),Me=v.get("icon-rotate").evaluate(ge,ae,e),Ye=this.updateSymbolInstanceIconVertices(Z,Q,_e,ge,A,e,r,l,x,S,ae,pe,be,Me);A+=Ye.vertexOffsetDelta,M=M||Ye.hasChanges}Q.activeAppearance=_e}return M&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),U&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),M||U}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=tw(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const r=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:l,y:h}of i)this.lineVertexArray.emplaceBack(l,h);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,i,r,l,h,f,m,x,v,S,A,M,R,D,U,G,V,Z){const Y=e.indexArray,Q=e.layoutVertexArray,le=e.globeExtVertexArray,ae=e.segments.prepareSegment(4*Z,Q,Y,this.canOverlap?f.sortKey:void 0),ge=this.glyphOffsetArray.length,_e=ae.vertexLength,pe=this.allowVerticalPlacement&&m===$s.vertical?Math.PI/2:0,be=f.text&&f.text.sections;for(let Ze=0;Ze<i.length;Ze++){const{tl:We,tr:lt,bl:at,br:st,texPrimary:He,texSecondary:ht,pixelOffsetTL:tt,pixelOffsetBR:gt,minFontScaleX:ct,minFontScaleY:qt,glyphOffset:$t,isSDF:kt,sectionIndex:Nt}=i[Ze],ci=ae.vertexLength,ii=$t[1];if(P_(Q,v.x,v.y,We.x,ii+We.y,He.x,He.y,r,kt,tt.x,tt.y,ct,qt),P_(Q,v.x,v.y,lt.x,ii+lt.y,He.x+He.w,He.y,r,kt,gt.x,tt.y,ct,qt),P_(Q,v.x,v.y,at.x,ii+at.y,He.x,He.y+He.h,r,kt,tt.x,gt.
vendor: 25,486 bytes, line 218
218y,ct,qt),P_(Q,v.x,v.y,st.x,ii+st.y,He.x+He.w,He.y+He.h,r,kt,gt.x,gt.y,ct,qt),x){const{x:Gt,y:Ei,z:Zi}=x.anchor,[fn,Ui,En]=x.up;O_(le,Gt,Ei,Zi,fn,Ui,En),O_(le,Gt,Ei,Zi,fn,Ui,En),O_(le,Gt,Ei,Zi,fn,Ui,En),O_(le,Gt,Ei,Zi,fn,Ui,En),yg(e.dynamicLayoutVertexArray,Gt,Ei,Zi,pe)}else yg(e.dynamicLayoutVertexArray,v.x,v.y,v.z,pe);if(G){const Gt=ht||He;L_(e.iconTransitioningVertexArray,Gt.x,Gt.y),L_(e.iconTransitioningVertexArray,Gt.x+Gt.w,Gt.y),L_(e.iconTransitioningVertexArray,Gt.x,Gt.y+Gt.h),L_(e.iconTransitioningVertexArray,Gt.x+Gt.w,Gt.y+Gt.h)}Y.emplaceBack(ci,ci+1,ci+2),Y.emplaceBack(ci+1,ci+2,ci+3),ae.vertexLength+=4,ae.primitiveLength+=2,this.glyphOffsetArray.emplaceBack($t[0]),Ze!==i.length-1&&Nt===i[Ze+1].sectionIndex||e.programConfigurations.populatePaintArrays(Q.length,f,f.index,{},R,D,U,be&&be[Nt],this.worldview)}const Me=Z-i.length;Me!==0&&this._addNullVertices(Me,Q,r,x,le,e,G,ae,Y);const Ye=x?x.anchor:v;e.placedSymbolArray.emplaceBack(Ye.x,Ye.y,Ye.z,v.x,v.y,ge,this.glyphOffsetArray.length-ge,_e,S,A,v.segment,r?r[0]:0,r?r[1]:0,l[0],l[1],m,0,0,0,M,0),e.symbolInstanceIndices.push(V)}_addNullVertices(e,i,r,l,h,f,m,x,v){for(let S=0;S<e;S++){for(let M=0;M<4;M++)P_(i,0,0,0,0,0,0,r,!1,0,0,0,0),l&&O_(h,0,0,0,0,0,0),yg(f.dynamicLayoutVertexArray,0,0,0,0),m&&L_(f.iconTransitioningVertexArray,0,0);const A=x.vertexLength;v.emplaceBack(A,A+1,A+2),v.emplaceBack(A+1,A+2,A+3),x.vertexLength+=4,x.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,r,l,h,f,m){e.emplaceBack(i,r,l,h,f,Math.round(m.x),Math.round(m.y))}_addCollisionDebugVertices(e,i,r,l,h,f,m){const x=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),v=x.vertexLength,S=m.tileAnchorX,A=m.tileAnchorY;for(let R=0;R<4;R++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,i,e.padding,m.zOffset),this._commitLayoutVertex(r.layoutVertexArray,l,h,f,S,A,new _t(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,l,h,f,S,A,new _t(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,l,h,f,S,A,new _t(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,l,h,f,S,A,new _t(e.x1,e.y2)),x.vertexLength+=4;const M=r.indexArray;M.emplaceBack(v,v+1),M.emplaceBack(v+1,v+2),M.emplaceBack(v+2,v+3),M.emplaceBack(v+3,v),x.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,r,l,h,f){for(let m=l;m<h;m++){const x=r.get(m),v=this.getSymbolInstanceTextSize(e,f,i,m);this._addCollisionDebugVertices(x,v,this.textCollisionBox,x.projectedAnchorX,x.projectedAnchorY,x.projectedAnchorZ,f)}}_addIconDebugCollisionBoxes(e,i,r,l,h,f){for(let m=l;m<h;m++){const x=r.get(m),v=this.getSymbolInstanceIconSize(e,i,f.placedIconSymbolIndex);this._addCollisionDebugVertices(x,v,this.iconCollisionBox,x.projectedAnchorX,x.projectedAnchorY,x.projectedAnchorZ,f)}}generateCollisionDebugBuffers(e,i,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new V0(fh,gb.members,$a),this.iconCollisionBox=new V0(fh,gb.members,$a);const l=pg(this.iconSizeData,e),h=pg(this.textSizeData,e,r);for(let f=0;f<this.symbolInstances.length;f++){const m=this.symbolInstances.get(f);this._addTextDebugCollisionBoxes(h,e,i,m.textBoxStartIndex,m.textBoxEndIndex,m),this._addTextDebugCollisionBoxes(h,e,i,m.verticalTextBoxStartIndex,m.verticalTextBoxEndIndex,m),this._addIconDebugCollisionBoxes(l,e,i,m.iconBoxStartIndex,m.iconBoxEndIndex,m),this._addIconDebugCollisionBoxes(l,e,i,m.verticalIconBoxStartIndex,m.verticalIconBoxEndIndex,m)}}getSymbolInstanceTextSize(e,i,r,l){const h=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:l),f=z0(this.textSizeData,e,h)/yo;return this.tilePixelRatio*f}getSymbolInstanceIconSize(e,i,r){const l=this.icon.placedSymbolArray.get(r),h=z0(this.iconSizeData,e,l);return this.tilePixelRatio*h}_commitDebugCollisionVertexUpdate(e,i,r,l){e.emplaceBack(i,-r,-r,l),e.emplaceBack(i,r,-r,l),e.emplaceBack(i,r,r,l),e.emplaceBack(i,-r,r,l)}_updateTextDebugCollisionBoxes(e,i,r,l,h,f,m){for(let x=l;x<h;x++){const v=r.get(x),S=this.getSymbolInstanceTextSize(e,f,i,x);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,S,v.padding,f.zOffset)}}_updateIconDebugCollisionBoxes(e,i,r,l,h,f,m){for(let x=l;x<h;x++){const v=r.get(x),S=this.getSymbolInstanceIconSize(e,i,f.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,S,v.padding,f.zOffset)}}updateCollisionDebugBuffers(e,i,r,l){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const h=pg(this.iconSizeData,e,l),f=pg(this.textSizeData,e,r);for(let m=0;m<this.symbolInstances.length;m++){const x=this.symbolInstances.get(m);this._updateTextDebugCollisionBoxes(f,e,i,x.textBoxStartIndex,x.textBoxEndIndex,x,r),this._updateTextDebugCollisionBoxes(f,e,i,x.verticalTextBoxStartIndex,x.verticalTextBoxEndIndex,x,r),this._updateIconDebugCollisionBoxes(h,e,i,x.iconBoxStartIndex,x.iconBoxEndIndex,x,l),this._updateIconDebugCollisionBoxes(h,e,i,x.verticalIconBoxStartIndex,x.verticalIconBoxEndIndex,x,l)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,r,l,h,f,m,x,v){const S={};if(i<r){const{x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q,featureIndex:le}=e.get(i);S.textBox={x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q},S.textFeatureIndex=le}if(l<h){const{x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q,featureIndex:le}=e.get(l);S.verticalTextBox={x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q},S.verticalTextFeatureIndex=le}if(f<m){const{x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q,featureIndex:le}=e.get(f);S.iconBox={x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q},S.iconFeatureIndex=le}if(x<v){const{x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q,featureIndex:le}=e.get(x);S.verticalIconBox={x1:A,y1:M,x2:R,y2:D,padding:U,projectedAnchorX:G,projectedAnchorY:V,projectedAnchorZ:Z,tileAnchorX:Y,tileAnchorY:Q},S.verticalIconFeatureIndex=le}return S}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const r=e.placedSymbolArray.get(i),l=r.vertexStartIndex+4*r.numGlyphs;for(let h=r.vertexStartIndex;h<l;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),r=Math.cos(e),l=[],h=[],f=[];for(let m=0;m<this.symbolInstances.length;++m){f.push(m);const x=this.symbolInstances.get(m);l.push(0|Math.round(i*x.tileAnchorX+r*x.tileAnchorY)),h.push(x.featureIndex)}return f.sort((m,x)=>l[m]-l[x]||h[x]-h[m]),f}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const r=this.symbolInstances.get(i);this.featureSortOrder.push(r.featureIndex);const{rightJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:h,leftJustifiedTextSymbolIndex:f,verticalPlacedTextSymbolIndex:m,placedIconSymbolIndex:x,verticalPlacedIconSymbolIndex:v}=r;l>=0&&this.addIndicesForPlacedSymbol(this.text,l),h>=0&&h!==l&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&f!==h&&f!==l&&this.addIndicesForPlacedSymbol(this.text,f),m>=0&&this.addIndicesForPlacedSymbol(this.text,m),x>=0&&this.addIndicesForPlacedSymbol(this.icon,x),v>=0&&this.addIndicesForPlacedSymbol(this.icon,v)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let r;return this.elevationFeatures&&i<this.elevationFeatures.length&&(r=this.elevationFeatures[i]),r}}function iw(n,e){return e.replace(/{([^{}]+)}/g,(i,r)=>r in n?String(n[r]):"")}let nw,rw,j0;zt(ex,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),ex.addDynamicAttributes=yg;class ow{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:la,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}zt(ow,"FormatSectionOverride",{omit:["defaultValue"]});const G0=()=>j0||(j0={layout:nw||(nw=new qn({"symbol-placement":new It(Oe.layout_symbol["symbol-placement"]),"symbol-spacing":new It(Oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new It(Oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ut(Oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new It(Oe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new It(Oe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new It(Oe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new It(Oe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new It(Oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new It(Oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new It(Oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ut(Oe.layout_symbol["icon-size"]),"icon-size-scale-range":new It(Oe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ut(Oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ut(Oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ut(Oe.layout_symbol["icon-image"]),"icon-image-use-theme":new It({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ut(Oe.layout_symbol["icon-rotate"]),"icon-padding":new It(Oe.layout_symbol["icon-padding"]),"icon-keep-upright":new It(Oe.layout_symbol["icon-keep-upright"]),"icon-offset":new Ut(Oe.layout_symbol["icon-offset"]),"icon-anchor":new Ut(Oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new It(Oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new It(Oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new It(Oe.layout_symbol["text-rotation-alignment"]),"text-field":new Ut(Oe.layout_symbol["text-field"]),"text-font":new Ut(Oe.layout_symbol["text-font"]),"text-size":new Ut(Oe.layout_symbol["text-size"]),"text-size-scale-range":new It(Oe.layout_symbol["text-size-scale-range"]),"text-max-width":new Ut(Oe.layout_symbol["text-max-width"]),"text-line-height":new Ut(Oe.layout_symbol["text-line-height"]),"text-letter-spacing":new Ut(Oe.layout_symbol["text-letter-spacing"]),"text-justify":new Ut(Oe.layout_symbol["text-justify"]),"text-radial-offset":new Ut(Oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new It(Oe.layout_symbol["text-variable-anchor"]),"text-anchor":new Ut(Oe.layout_symbol["text-anchor"]),"text-max-angle":new It(Oe.layout_symbol["text-max-angle"]),"text-writing-mode":new It(Oe.layout_symbol["text-writing-mode"]),"text-rotate":new Ut(Oe.layout_symbol["text-rotate"]),"text-padding":new It(Oe.layout_symbol["text-padding"]),"text-keep-upright":new It(Oe.layout_symbol["text-keep-upright"]),"text-transform":new Ut(Oe.layout_symbol["text-transform"]),"text-offset":new Ut(Oe.layout_symbol["text-offset"]),"text-allow-overlap":new It(Oe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new It(Oe.layout_symbol["text-ignore-placement"]),"text-optional":new It(Oe.layout_symbol["text-optional"]),visibility:new It(Oe.layout_symbol.visibility)})),paint:rw||(rw=new qn({"icon-opacity":new Ut(Oe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ut(Oe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ut(Oe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ut(Oe.paint_symbol["text-emissive-strength"]),"icon-color":new Ut(Oe.paint_symbol["icon-color"]),"icon-halo-color":new Ut(Oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ut(Oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ut(Oe.paint_symbol["icon-halo-blur"]),"icon-translate":new It(Oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new It(Oe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new It(Oe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ut(Oe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ut(Oe.paint_symbol["text-occlusion-opacity"]),"text-color":new Ut(Oe.paint_symbol["text-color"],{runtimeType:Qo,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new Ut(Oe.paint_symbol["text-halo-color"]),"text-halo-width":new Ut(Oe.paint_symbol["text-halo-width"]),"text-halo-blur":new Ut(Oe.paint_symbol["text-halo-blur"]),"text-translate":new It(Oe.paint_symbol["text-translate"]),"text-translate-anchor":new It(Oe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new It(Oe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new It(Oe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new It(Oe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new It(Oe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ut(Oe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},j0);class tx extends Zo{constructor(e,i,r,l){super(e,G0(),i,r,l,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Je([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,i){super.recalculate(e,i),this.appearances&&this.appearances.forEach(l=>{l.recalculate(e,i,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const r=this.layout.get("text-writing-mode");if(r){const l=[];for(const h of r)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,r,l){return this._saturation===e&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===l||(this._colorAdjustmentMatrix=(function(h,f,m,x){h=ar(h),f=zn(f);const v=ft(),S=h/3,A=1-2*S,M=[A,S,S,0,S,A,S,0,S,S,A,0,0,0,0,1],R=.5-.5*f,D=x-m;return pt(v,[D,0,0,0,0,D,0,0,0,0,D,0,m,m,m,1],[f,0,0,0,0,f,0,0,0,0,f,0,R,R,R,1]),pt(v,v,M),v})(e,i,r,l),this._saturation=e,this._contrast=i,this._brightnessMin=r,this._brightnessMax=l),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,r,l){const h=this.layout.get(e).evaluate(i,{},r,l),f=this._unevaluatedLayout._values[e];return f.isDataDriven()||ru(f.value)||!h?h:iw(i.properties,h)}getAppearanceValueAndResolveTokens(e,i,r,l,h){const f=e.getProperty(i);if(!f)return;const m=f.evaluate(r,{},l,h),x=e.getUnevaluatedProperties()._values[i];return x.isDataDriven()||ru(x.value)||!m||typeof m!="string"?m:iw(r.properties,m)}createBucket(e){return new ex(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of G0().paint.overridableProperties){if(!tx.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),r=new ow(i),l=new fd(r,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let h=null;h=i.value.kind==="constant"||i.value.kind==="source"?new jo("source",l):new Io("composite",l,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Ec(i.property,h,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&tx.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const r=e.get("text-field"),l=G0().paint.properties[i];let h=!1;const f=m=>{for(const x of m)if(l.overrides&&l.overrides.hasOverride(x))return void(h=!0)};if(r.value.kind==="constant"&&r.value.value instanceof Mo)f(r.value.value.sections);else if(r.value.kind==="source"){const m=v=>{h||(v instanceof Ua&&Ur(v.value)===Uu?f(v.value.sections):v instanceof ti?f(v.sections):v.eachChild(m))},x=r.value;x._styleExpression&&m(x._styleExpression.expression)}return h}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,r){return{config:new C(this,{zoom:i,lut:r}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let aw,sw,lw,cw;var H0=Gi([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function ix(n,e,i,r,l,h,f,m){const x=[n,e,1,i,r,1,l,h,1],v=[f,m,1],S=ke([],x),[A,M,R]=bo(v,v,S);return Qe(x,x,[A,0,0,0,M,0,0,0,R])}function uw(n,e,i,r,l,h,f,m){const x=(function(v,S,A,M,R,D,U,G){const V=ix(0,0,1,0,1,1,0,1),Z=ix(v,S,A,M,R,D,U,G);return Qe(Z,Z,ke([],V))})(n,e,i,r,l,h,f,m);return[x[2]/x[8]/Lt,x[5]/x[8]/Lt]}function nx(n){return[n[0],Math.min(Math.max(n[1],-85.051129),Se)]}class hw extends Il{constructor(e,i,r,l){super(),this.id=e,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(l),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new us("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Hh(this.map._requestManager.transformRequest(this.url,Nr.Image),(r,l)=>{this._imageRequest=null,this._loaded=!0,r?this.fire(new Fu(r)):l&&(this.image=l instanceof HTMLImageElement?Ea.getImageData(l):l,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new v_(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new us("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof v_||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],r=e[0][1];for(const h of e)h[1]>r&&(r=h[1]),h[1]<i&&(i=h[1]);const l=(r+i)/2;if(l>Se?this.onNorthPole=!0:l<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const h=e.map(Bt.fromLngLat);this.tileID=(function(f){let m=1/0,x=1/0,v=-1/0,S=-1/0;for(const U of f)m=Math.min(m,U.x),x=Math.min(x,U.y),v=Math.max(v,U.x),S=Math.max(S,U.y);const A=Math.max(v-m,S-x),M=Math.max(0,Math.floor(-Math.log2(A))),R=Math.pow(2,M);let D=Math.floor((m+v)/2*R);return D>1&&(D-=1),new yl(M,D,Math.floor((x+S)/2*R))})(h),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new us("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof v_||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const V in this.tiles){const Z=this.tiles[V];Z.state!=="loaded"&&(Z.state="loaded",Z.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=C_(new yl(0,0,0),this.map.transform.projection),r=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!(function(V){const Z=V[1].x-V[0].x,Y=V[1].y-V[0].y,Q=V[2].x-V[1].x,le=V[2].y-V[1].y,ae=V[3].x-V[2].x,ge=V[3].y-V[2].y,_e=V[0].x-V[3].x,pe=V[0].y-V[3].y,be=Z*le-Q*Y,Me=Q*ge-ae*le,Ye=ae*pe-_e*ge,Ze=_e*Y-Z*pe;return be>0&&Me>0&&Ye>0&&Ze>0||be<0&&Me<0&&Ye<0&&Ze<0})(r))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const l=C_(this.tileID,this.map.transform.projection),[h,f,m,x]=this.coordinates.map(V=>{const Z=l.projection.project(V[0],V[1]);return Yb(l,Z)._round()});this.perspectiveTransform=uw(h.x,h.y,f.x,f.y,m.x,m.y,x.x,x.y);const v=this._boundsArray=new ml;v.emplaceBack(h.x,h.y,0,0),v.emplaceBack(f.x,f.y,Lt,0),v.emplaceBack(x.x,x.y,0,Lt),v.emplaceBack(m.x,m.y,Lt,Lt),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(v,H0.members),this.boundsSegments=kn.simpleSegment(0,0,4,2);const S=[],A=[nx((M=this.coordinates)[0]),nx(M[1]),nx(M[2]),nx(M[3])];var M;const[R,D,U,G]=(function(V){let Z=V[0][0],Y=Z,Q=V[0][1],le=Q;for(let ae=1;ae<V.length;ae++)V[ae][0]<Z?Z=V[ae][0]:V[ae][0]>Y&&(Y=V[ae][0]),V[ae][1]<Q?Q=V[ae][1]:V[ae][1]>le&&(le=V[ae][1]);return[Z,Q,Y-Z,le-Q]})(A);{const V=new ml,[Z,Y,Q,le]=(function(st){let He=st[0].x,ht=He,tt=st[0].y,gt
vendor: 5,119 bytes, line 218
218=tt;for(let ct=1;ct<st.length;ct++)st[ct].x<He?He=st[ct].x:st[ct].x>ht&&(ht=st[ct].x),st[ct].y<tt?tt=st[ct].y:st[ct].y>gt&&(gt=st[ct].y);return[He,tt,ht-He,gt-tt]})(r),ae=st=>[(st.x-Z)/Q,(st.y-Y)/le],[ge,_e,pe,be]=r.map(ae),Me=(function(st,He,ht,tt,gt,ct,qt,$t){const kt=ix(0,0,1,0,1,1,0,1);return Qe(kt,kt,ke([],ix(st,He,ht,tt,gt,ct,qt,$t)))})(ge[0],ge[1],_e[0],_e[1],pe[0],pe[1],be[0],be[1]);this.elevatedGlobePerspectiveTransform=uw(ge[0],ge[1],_e[0],_e[1],pe[0],pe[1],be[0],be[1]);const Ye=(st,He)=>{S.push(st.lng);const ht=Math.round((st.lng-R)/U*Lt),tt=Math.round((st.lat-D)/G*Lt),gt=ae(He),ct=bo([],[gt[0],gt[1],1],Me),qt=Math.round(ct[0]/ct[2]*Lt),$t=Math.round(ct[1]/ct[2]*Lt);V.emplaceBack(ht,tt,qt,$t)},Ze=r[3].x-r[0].x,We=r[3].y-r[0].y,lt=r[2].x-r[1].x,at=r[2].y-r[1].y;for(let st=0;st<65;st++){const He=st/64,ht=[r[0].x+He*Ze,r[0].y+He*We],tt=[r[1].x+He*lt,r[1].y+He*at],gt=tt[0]-ht[0],ct=tt[1]-ht[1];for(let qt=0;qt<65;qt++){const $t=qt/64,kt={x:ht[0]+gt*$t,y:ht[1]+ct*$t};Ye(i.projection.unproject(kt.x,kt.y),kt)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(V,H0.members)}{this.maxLongitudeTriangleSize=0;let V=[],Z=new Lr;const Y=(Q,le,ae)=>{Z.emplaceBack(Q,le,ae);const ge=S[Q],_e=S[le],pe=S[ae],be=Math.min(Math.min(ge,_e),pe),Me=Math.max(Math.max(ge,_e),pe)-be;Me>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Me),V.push(be+Me/2)};for(let Q=0;Q<64;Q++)for(let le=0;le<64;le++){const ae=65*Q+le,ge=ae+1,_e=ae+65,pe=_e+1;Y(ae,_e,ge),Y(ge,_e,pe)}[V,Z]=(function(Q,le){const ae=Array.from({length:Q.length},(pe,be)=>be);ae.sort((pe,be)=>Q[pe]-Q[be]);const ge=[],_e=new Lr;for(let pe=0;pe<ae.length;pe++){const be=ae[pe];ge.push(Q[be]);const Me=3*be,Ye=Me+1;_e.emplaceBack(le.uint16[Me],le.uint16[Ye],le.uint16[Ye+1])}return[ge,_e]})(V,Z),this.elevatedGlobeTrianglesCenterLongitudes=V,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(Z)}this.elevatedGlobeSegments=kn.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,U/Lt,0,G/Lt,0,0,D,R,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,r=i.gl;!this._dirty||this.texture instanceof v_||(this.texture?this.texture.update(this.image):(this.texture=new p0(i,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const r=this.elevatedGlobeTrianglesCenterLongitudes;let l=(h=e+180)+360*Math.round((r[0]-h)/360);var h;const f=new kn,m=(A,M)=>{f.segments.push({vertexOffset:0,primitiveOffset:A,vertexLength:i.segments[0].vertexLength,primitiveLength:M,sortKey:void 0,vaos:{}})},x=.51*this.maxLongitudeTriangleSize;if(Math.abs(r[0]-l)<=x){const A=wn(r,0,r.length,l+x);return A===r.length||m(A,bn(r,A+1,r.length,l+360-x)-A),f}l<r[0]&&(l+=360);const v=bn(r,0,r.length,l-x);if(v===r.length)return m(0,r.length),f;m(0,v-0);const S=wn(r,v+1,r.length,l+x);return S!==r.length&&m(S,r.length-S),f}}const q0=1024,iM=(Math.pow(q0,2)-1)/268170240;class dw extends Zo{constructor(e,i,r,l){super(e,{layout:lw||(lw=new qn({visibility:new It(Oe.layout_raster.visibility)})),paint:cw||(cw=new qn({"raster-opacity":new It(Oe.paint_raster["raster-opacity"]),"raster-color":new uu(Oe.paint_raster["raster-color"]),"raster-color-mix":new It(Oe.paint_raster["raster-color-mix"]),"raster-color-range":new It(Oe.paint_raster["raster-color-range"]),"raster-hue-rotate":new It(Oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new It(Oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new It(Oe.paint_raster["raster-brightness-max"]),"raster-saturation":new It(Oe.paint_raster["raster-saturation"]),"raster-contrast":new It(Oe.paint_raster["raster-contrast"]),"raster-resampling":new It(Oe.paint_raster["raster-resampling"]),"raster-fade-duration":new It(Oe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new It(Oe.paint_raster["raster-emissive-strength"]),"raster-array-band":new It(Oe.paint_raster["raster-array-band"]),"raster-elevation":new It(Oe.paint_raster["raster-elevation"]),"raster-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},i,r,l),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof hw&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
vendor: 19,301 bytes, line 218
218updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[r,l]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(l)||r===this._curRampRange[0]&&l===this._curRampRange[1]||(this.colorRamp=Uf({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:l}],resolution:q0}),this.colorRampTexture=null,this._curRampRange=[r,l])}is3D(e){return this.paint.get("raster-elevation")>0}}let fw,pw,mw,gw,_w;class yw extends Zo{constructor(e,i,r,l){super(e,{layout:fw||(fw=new qn({visibility:new It(Oe["layout_raster-particle"].visibility)})),paint:pw||(pw=new qn({"raster-particle-array-band":new It(Oe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new It(Oe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new uu(Oe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new It(Oe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new It(Oe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new It(Oe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new It(Oe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new It(Oe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},i,r,l),this._updateColorRamp(),this.lastInvalidatedAt=Ea.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Uf({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Ea.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class nM extends Zo{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Z0(n,e,i){const r=[0,0,1],l=ts([]);return bs(l,l,i?-Ki(n)+Math.PI:Ki(n)),Sa(l,l,-Ki(e)),Ka(r,r,l),xi(r,r)}const xw={None:0,Model:1,Symbol:2,FillExtrusion:4};class rx{constructor(e,i,r,l){this.message=(e?`${e}: `:"")+r,l&&(this.identifier=l),i!=null&&i.__line__&&(this.line=i.__line__)}}function $0(n,e){const i=n.indexOf("://")===-1;try{return new URL(n,i&&e?"http://example.com":void 0),!0}catch{return!1}}class vw{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class bw{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new Vs,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,r=this.instancedDataArray.float32;let l=Math.floor(r[i+2]);const h=1.05*(r[i+2]-l);return l/=100,[r[i]%1*1.05,r[i+1]%1*1.05,h,l]}tileCoordinatesForInstance(e){const i=16*e,r=this.instancedDataArray.float32;let l=r[i+0];return l=l>Lt?l-Lt:l,new _t(Math.trunc(l),Math.trunc(r[i+1]))}translationForInstance(e){const i=16*e,r=this.instancedDataArray.float32;return[r[i+4],r[i+5],r[i+6]]}rotationScaleForInstance(e){const i=16*e,r=this.instancedDataArray.float32;return[r[i+7],r[i+8],r[i+9],r[i+10],r[i+11],r[i+12],r[i+13],r[i+14],r[i+15]]}transformForInstance(e){const i=16*e,r=this.instancedDataArray.float32;return[r[i+7],r[i+8],r[i+9],r[i+4],r[i+10],r[i+11],r[i+12],r[i+5],r[i+13],r[i+14],r[i+15],r[i+6],0,0,0,1]}}class X0{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,l){}populate(e,i,r,l){this.tileToMeter=Et(r);const h=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const f=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?i.elevationFeatures:void 0;for(const{feature:m,id:x,index:v,sourceLayerIndex:S}of e){const A=x??(m.properties&&m.properties.hasOwnProperty("id")?m.properties.id:void 0),M=Ri(m,h);if(!this.layers[0]._featureFilter.filter(new mn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),M,r))continue;const R={id:A,sourceLayerIndex:S,index:v,geometry:h?M.geometry:fi(m,r,l),properties:m.properties,type:m.type,patterns:{}},D=this.addFeature(R,R.geometry,M,f,r);D&&i.featureIndex.insert(m,R.geometry,v,S,this.index,this.instancesPerModel[D].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let r=0;for(const l of this.modelUris){const h=e.getModel(l,i);if(!h)continue;const f=this.instancesPerModel[l];if(f){const m=.5*ui(h.aabb.max,h.aabb.min)*f.maxScale+f.maxXYTranslationDistance,x=Math.min(Lt,Math.max(m/this.tileToMeter,256));r=Math.max(x,r)}}return r}update(e,i,r,l){for(const h in this.instancesPerModel){const f=this.instancesPerModel[h];for(const m in e)f.idToFeaturesIndex.hasOwnProperty(m)&&(this.evaluate(f.features[f.idToFeaturesIndex[m]],e[m],f,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const r=this.instancesPerModel[i];for(const l of r.features){const h=this.layers[0],f=l.feature,m=this.canonical,x=h.paint.get("model-rotation").evaluate(f,{},m),v=h.paint.get("model-scale").evaluate(f,{},m),S=h.paint.get("model-translation").evaluate(f,{},m);Oo(l.rotation,x)&&Oo(l.scale,v)&&Oo(l.translation,S)||(this.evaluate(l,l.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,i,r,l){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const h=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(s(this.activeReplacements,h))return!1;this.activeReplacements=h;let f=!1;for(const m in this.instancesPerModel){const x=this.instancesPerModel[m],v=x.instancedDataArray;for(const S of x.features){const A=S.instancedDataOffset,M=S.instancedDataCount;for(let R=0;R<M;R++){const D=16*(R+A);let U=v.float32[D+0];const G=U>Lt;U=G?U-Lt:U;const V=Math.floor(U),Z=Math.floor(v.float32[D+1]);let Y=!1;for(const Q of this.activeReplacements)if(!hm(Q,r,xw.Model,l)&&!(Q.min.x>V||V>Q.max.x||Q.min.y>Z||Z>Q.max.y)&&(Y=J(O(V,Z,e.canonical,Q.footprintTileId.canonical),Q.footprint),Y))break;v.float32[D]=Y?U+Lt:U,f=f||Y!==G}}}return f}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const r=this.instancesPerModel[i];r.instancedDataArray.length<0||r.instancedDataArray.length===0||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.instancedDataArray,EE.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const r in this.instancesPerModel){const l=this.instancesPerModel[r];l.instancedDataArray.length!==0&&l.instancedDataBuffer&&l.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const r of this.modelUris)i.removeModel(r,"",!0)}addFeature(e,i,r,l,h){const f=this.layers[0],m=f.layout.get("model-id"),x=f.layout.get("model-allow-density-reduction"),v=m.evaluate(r,{},this.canonical);if(!v)return vi(`modelId is not evaluated for layer ${f.id} and it is not going to get rendered.`),v;($0(v,!1)||this.styleDefinedModelURLs[v]!==void 0)&&(this.modelUris.includes(v)||this.modelUris.push(v)),this.instancesPerModel[v]||(this.instancesPerModel[v]=new bw);const S=this.instancesPerModel[v],A=S.instancedDataArray,M=new vw(r,A.length);let R;l&&(R=go.getElevationFeature(e,l));for(const D of i)for(const U of D){if(U.x<0||U.x>=Lt||U.y<0||U.y>=Lt)continue;if(this.lookupDim!==0&&x){const V=(this.lookupDim-1)/Lt,Z=this.lookupDim*(U.y*V|0)+U.x*V|0;if(this.lookup){if(this.lookup[Z]!==0)continue;this.lookup[Z]=1}}this.instanceCount++;const G=A.length;if(A.resize(G+1),l){S.instancesRoadElevation||(S.instancesRoadElevation=[]);const V=R?R.pointElevation(new _t(U.x,U.y)):0;S.instancesRoadElevation.push(V)}S.instancesEvaluatedElevation.push(0),A.float32[16*G]=U.x,A.float32[16*G+1]=U.y}return M.instancedDataCount=S.instancedDataArray.length-M.instancedDataOffset,M.instancedDataCount>0&&(e.id&&(S.idToFeaturesIndex[e.id]=S.features.length),S.features.push(M),this.evaluate(M,{},S,!1)),v}getModelUris(){return this.modelUris}evaluate(e,i,r,l){const h=this.layers[0],f=e.feature,m=this.canonical,x=e.rotation=h.paint.get("model-rotation").evaluate(f,i,m),v=e.scale=h.paint.get("model-scale").evaluate(f,i,m),S=e.translation=h.paint.get("model-translation").evaluate(f,i,m),A=Object.assign({},h.paint.get("model-color").evaluate(f,i,m));A.a=h.paint.get("model-color-mix-intensity").evaluate(f,i,m);const M=[];this.maxVerticalOffset<S[2]&&(this.maxVerticalOffset=S[2]);const R=S[0]*S[0]+S[1]*S[1],D=R>0?Math.sqrt(R):0;r.maxScale=Math.max(Math.max(r.maxScale,v[0]),Math.max(v[1],v[2])),r.maxXYTranslationDistance=Math.max(r.maxXYTranslationDistance,D),this.maxScale=Math.max(Math.max(this.maxScale,v[0]),Math.max(v[1],v[2])),W1(M,x,v);const U=Math.round(100*A.a)+A.b/1.05;for(let G=0;G<e.instancedDataCount;++G){const V=e.instancedDataOffset+G,Z=16*V,Y=r.instancedDataArray.float32;let Q=0;l&&(Q=Y[Z+6]-r.instancesEvaluatedElevation[V]);const le=0|Y[Z+1];Y[Z]=(0|Y[Z])+A.r/1.05,Y[Z+1]=le+A.g/1.05,Y[Z+2]=U,Y[Z+3]=1/(m.z>10?this.tileToMeter:Et(m,le)),Y[Z+4]=S[0],Y[Z+5]=S[1],Y[Z+6]=S[2]+(r.instancesRoadElevation?r.instancesRoadElevation[V]:0)+Q,Y[Z+7]=M[0],Y[Z+8]=M[1],Y[Z+9]=M[2],Y[Z+10]=M[4],Y[Z+11]=M[5],Y[Z+12]=M[6],Y[Z+13]=M[8],Y[Z+14]=M[9],Y[Z+15]=M[10],r.instancesEvaluatedElevation[V]=S[2]}}}let ww,Tw;zt(X0,"ModelBucket",{omit:["layers"]}),zt(bw,"PerModelAttributes"),zt(vw,"ModelFeature");class xg{constructor(e,i,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(e,i,r){const l=r||e.findDEMTileFor(i);if(!l||!l.dem)return;const h=l.dem,f=l.tileID,m=1<<i.canonical.z-f.canonical.z;return new xg(l,h.dim/Lt/m,[(i.canonical.x/m-f.canonical.x)*h.dim,(i.canonical.y/m-f.canonical.y)*h.dim])}tileCoordToPixel(e,i){const r=i*this._scale+this._offset[1];return new _t(Math.floor(e*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(e,i,r,l){const h=e*this._scale+this._offset[0],f=i*this._scale+this._offset[1],m=Math.floor(h),x=Math.floor(f),v=this._dem;return l=!!l,r?mi(mi(v.get(m,x,l),v.get(m,x+1,l),f-x),mi(v.get(m+1,x,l),v.get(m+1,x+1,l),f-x),h-m):v.get(m,x,l)}getElevationAtPixel(e,i,r){return this._dem.get(e,i,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Le(1,e)*this._dem.stride}}const W0=new Float32Array(262144),xm=new Uint8Array(262144);function Sw(n){let e=0;if(n.meshes)for(const i of n.meshes)e=Math.max(e,i.aabb.max[2]);if(n.children)for(const i of n.children)e=Math.max(e,Sw(i));return e}function Ew(n,e,i){if(n.meshes)for(const r of n.meshes){if(r.aabb.min[0]===1/0)continue;const l=hn.applyTransform(r.aabb,n.globalMatrix);i.insert(e,l.min[0],l.min[1],l.max[0],l.max[1])}if(n.children)for(const r of n.children)Ew(r,e,i)}const Aw=["","wall","door","roof","window","lamp","logo"];class Mw{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Sw(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new hn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new hn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const r of this.node.meshes)this.node.lightMeshIndex!==e&&(r.transformedAabb=hn.applyTransformFast(r.aabb,this.node.globalMatrix),i.encapsulate(r.transformedAabb)),e++;this.aabb=i}return this.aabb}}class ox{constructor(e,i,r,l,h,f,m,x){this.id=r,this.layers=e,this.layerIds=this.layers.map(v=>v.fqid),this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id),this.modelTraits|=hg.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,l&&(this.modelTraits|=hg.HasMapboxMeshFeatures),h&&(this.modelTraits|=hg.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=f,this.worldview=x,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const v of i)this.nodesInfo.push(new Mw(v)),Ew(v,m.featureIndexArray.length,m.grid),m.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,m.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const r of this.getNodesInfo()){const l=r.node;l.footprint&&i.push({footprint:l.footprint,id:e})}}updateAppearances(e,i,r,l){}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const r=i?this.stateDependentLayers:this.layers;if(!aa(e,this.states))for(const l of r)this.evaluate(l,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const r of i){const l=r.node;this.uploaded?this.updatePbrBuffer(l):_0(l,e,!0)}for(const r of i)Uy(r.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(e,i,r){const l=e.transform.projectionOptions,h=e.style.getBrightness(),f=this.brightness!==h;if(!this.uploaded||this.dirty||l.name!==this.projection.name||B_(r.paint.get("model-color").value,f)||B_(r.paint.get("model-color-mix-intensity").value,f)||B_(r.paint.get("model-roughness").value,f)||B_(r.paint.get("model-emissive-strength").value,f)||B_(r.paint.get("model-height-based-emissive-strength-multiplier").value,f)){this.projection=l,this.brightness=h;const m=this.getNodesInfo();for(const x of m)x.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const r=this.getNodesInfo(),l=this.id.canonical;for(const h of r){const f=h.feature;h.evaluatedTranslation=i.paint.get("model-translation").evaluate(f,{},l),h.evaluatedScale=i.paint.get("model-scale").evaluate(f,{},l)}}evaluate(e,i){const r=this.getNodesInfo();for(const l of r){if(!l.node.meshes)continue;const h=l.feature,f=i&&i[h.id];if(aa(f,l.state))continue;l.state=structuredClone(f);const m=l.node.meshes&&l.node.meshes[0].featureData,x=l.evaluatedColor[2],v=l.evaluatedRMEA[2],S=this.id.canonical;if(l.hasTranslucentParts=!1,m){for(let A=0;A<Aw.length;A++){const M=Aw[A];M.length&&(h.properties.part=M);const R=e.paint.get("model-color").evaluate(h,f,S).toPremultipliedRenderColor(null),D=e.paint.get("model-color-mix-intensity").evaluate(h,f,S);l.evaluatedColor[A]=[R.r,R.g,R.b,D],l.evaluatedRMEA[A][0]=e.paint.get("model-roughness").evaluate(h,f,S),l.evaluatedRMEA[A][2]=e.paint.get("model-emissive-strength").evaluate(h,f,S),l.evaluatedRMEA[A][3]=R.a,l.emissionHeightBasedParams[A]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(h,f,S),!l.hasTranslucentParts&&R.a<1&&(l.hasTranslucentParts=!0)}delete h.properties.part,oM(l,x!==l.evaluatedColor[2]||v!==l.evaluatedRMEA[2],this.modelTraits)}else l.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(h,f,S);l.evaluatedTranslation=e.paint.get("model-translation").evaluate(h,f,S),l.evaluatedScale=e.paint.get("model-scale").evaluate(h,f,S),this.updatePbrBuffer(l.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,r,l){const h=e.findDEMTileFor(r);if(h&&(h.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(h.dem&&h.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=h.tileID.overscaledZ;const f=xg.create(e,r,h);if(!f)return;this.modelTraits&hg.HasMapboxMeshFeatures&&this.updateDEM(e,f,r,l);for(const m of this.getNodesInfo()){const x=m.node;if(!x.footprint||!x.footprint.vertices||!x.footprint.vertices.length)continue;const v=x.footprint.vertices;let S=f.getElevationAt(v[0].x,v[0].y,!0,!0);for(let A=1;A<v.length;A++)S=Math.min(S,f.getElevationAt(v[A].x,v[A].y,!0,!0));x.elevation=S}}this.terrainTile=h.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,r,l){let h=i._dem._modifiedForSources[l];if(h===void 0&&(i._dem._modifiedForSources[l]=[],h=i._dem._modifiedForSources[l]),h.includes(r.canonical))return;const f=i._dem.dim;h.push(r.canonical);let m=!1;
218for(const x of this.getNodesInfo()){const v=x.node;if(!v.footprint||!v.footprint.grid)continue;const S=v.footprint.grid,A=i.tileCoordToPixel(S.min.x,S.min.y),M=i.tileCoordToPixel(S.max.x,S.max.y),R=Math.min(Math.min(f-M.y,A.x),Math.min(A.y,f-M.x));if(R<0)continue;const D=he(R,2,5);let U=Math.max(0,A.x-D),G=Math.max(0,A.y-D),V=Math.min(M.x+D,f-1),Z=Math.min(M.y+D,f-1);for(let ae=G;ae<=Z;++ae)for(let ge=U;ge<=V;++ge)xm[ae*f+ge]=255;let Y=0,Q=0;for(let ae=0;ae<S.cellsY;++ae)for(let ge=0;ge<S.cellsX;++ge){if(!S.cells[ae*S.cellsX+ge])continue;const _e=i.tileCoordToPixel(S.min.x+ge/S.xScale,S.min.y+ae/S.yScale),pe=i.tileCoordToPixel(S.min.x+(ge+1)/S.xScale,S.min.y+(ae+1)/S.yScale);for(let be=_e.y;be<=Math.min(pe.y+1,f-1);++be)for(let Me=_e.x;Me<=Math.min(pe.x+1,f-1);++Me)xm[be*f+Me]===255&&(xm[be*f+Me]=0,Y+=i.getElevationAtPixel(Me,be),Q++)}const le=Y/Q;U=Math.max(1,A.x-D),G=Math.max(1,A.y-D),V=Math.min(M.x+D,f-2),Z=Math.min(M.y+D,f-2),m=!0;for(let ae=G;ae<=Z;++ae)for(let ge=U;ge<=V;++ge)xm[ae*f+ge]===0&&(W0[ae*f+ge]=i._dem.set(ge,ae,le));for(let ae=1;ae<D;++ae){U=Math.max(1,A.x-ae),G=Math.max(1,A.y-ae),V=Math.min(M.x+ae,f-2),Z=Math.min(M.y+ae,f-2);for(let ge=G;ge<=Z;++ge)for(let _e=U;_e<=V;++_e){const pe=ge*f+_e;if(xm[pe]===255){let be=0,Me=0,Ye=-1,Ze=-1;for(let We=-1;We<=1;++We)for(let lt=-1;lt<=1;++lt){const at=(ge+We)*f+_e+lt;if(xm[at]>=ae)continue;const st=W0[at],He=Math.abs(st);He>Me&&(be=st,Me=He,Ye=lt,Ze=We)}if(Me>.1){const We=1-(ae+.5*Math.abs(Ye*Ze))/D;let lt=i._dem.get(_e,ge)+be*We;const at=i._dem.get(_e+Ye,ge+Ze),st=i._dem.get(_e-Ye,ge-Ze,!0);(lt-at)*(lt-st)>0&&(lt=(at+st)/2),W0[pe]=i._dem.set(_e,ge,lt),xm[pe]=ae}}}}}m&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Ea.now())}setFilter(e){this.filter=e?Cf(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new mn(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Uy(i.node),y0(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const r=i.getReplacementRegionsForTile(e.toUnwrapped());for(const l of this.getNodesInfo()){const h=l.node.footprint;l.hiddenByReplacement=!!h&&!r.find(f=>f.footprint===h)}}getHeightAtTileCoord(e,i){const r=[],l=[0,0,0],h=Je([]);for(const f of this.getNodesInfo()){const m=f.node.meshes[0],x=m.transformedAabb;if(e<x.min[0]||i<x.min[1]||e>x.max[0]||i>x.max[1])continue;if(f.node.hidden===!0)return{height:1/0,maxHeight:f.feature.properties.height,hidden:!1,verticalScale:f.evaluatedScale[2]};mt(h,f.node.globalMatrix),l[0]=e,l[1]=i,Nn(l,l,h);const v=(l[0]-m.aabb.min[0])/(m.aabb.max[0]-m.aabb.min[0])*mm|0,S=Math.min(63,(l[1]-m.aabb.min[1])/(m.aabb.max[1]-m.aabb.min[1])*mm|0)*mm+Math.min(63,v),A=m.heightmap[S];if(!(A<0&&f.node.footprint))return f.hiddenByReplacement?void 0:{height:A,maxHeight:f.feature.properties.height,hidden:!1,verticalScale:f.evaluatedScale[2]};if(f.node.footprint.grid.query(new _t(e,i),new _t(e,i),r),r.length>0)return{height:void 0,maxHeight:f.feature.properties.height,hidden:f.hiddenByReplacement,verticalScale:f.evaluatedScale[2]}}}}function B_(n,e){return n instanceof jo&&!n.isLightConstant&&e}function rM(n,e,i,r,l,h,f,m){let x=(61440&e|(61440&e)>>4)>>8,v=(3840&e|(3840&e)>>4)>>4,S=240&e|(240&e)>>4;i[3]>0&&(x=mi(x,255*i[0],i[3]),v=mi(v,255*i[1],i[3]),S=mi(S,255*i[2],i[3]));const A=x<<8|v,M=S<<8|Math.floor(255*r[3]),R=(function(ae){const ge=he(ae,0,2);return Math.min(Math.round(.5*ge*255),255)})(r[2])<<8|15*r[0]<<4|15*r[1],D=he(l[0],0,1),U=he(l[1],0,1),G=he(l[2],0,1),V=he(l[3],0,1);let Z,Y,Q,le;if(D!==U&&f!==h&&U!==D){const ae=f-h;Y=1/(ae*(U-D)),Q=-(h+ae*D)/(ae*(U-D));const ge=he(l[4],-1,1);le=Math.pow(10,ge),Z=255*G<<8|255*V}else Z=65535,Y=0,Q=1,le=1;if(n.emplaceBack(A,M,R,Z,Y,Q,le),m){const ae=m.length;m.clear();for(let ge=0;ge<ae;ge++)m.emplaceBack(A,M,R,Z,Y,Q,le)}}function oM(n,e,i){const r=n.node;let l=0;const h=i&hg.HasMeshoptCompression;for(const f of r.meshes){if(r.lights&&r.lightMeshIndex===l||!f.featureData)continue;f.featureArray=new _u,f.featureArray.reserve(f.featureData.length);let m=e;for(const x of f.featureData){const v=h?65535&x:x>>16&65535,S=h?x>>16&65535:65535&x,A=(15&S)<8?15&S:0,M=n.evaluatedRMEA[A],R=n.evaluatedColor[A],D=n.emissionHeightBasedParams[A];let U;if(m&&A===2&&r.lights&&(U=new _u,U.resize(10*r.lights.length)),rM(f.featureArray,v,R,M,D,f.aabb.min[2],f.aabb.max[2],U),U&&m){m=!1;const G=r.meshes[r.lightMeshIndex];G.featureArray=U,G.featureArray._trim()}}f.featureArray._trim(),l++}}zt(ox,"Tiled3dModelBucket",{omit:["layers"]}),zt(Mw,"Tiled3dModelFeature");const aM=["id","tile","layer","source","sourceLayer","state"];class vm{constructor(e,i,r,l,h){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=r,this._y=l,this.properties=e?e.properties:{},this.id=h}clone(){const e=new vm(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of aM)this[i]!==void 0&&(e[i]=this[i]);return e}}class bm extends Il{constructor(e,i,r,l){super(),this.id=e,this.type="model",this.models=[],this._options=i,this._modelsInfo=new Map}loadGLTFFromURI(e){return q1(this.map._requestManager.transformRequest(e,Nr.Model).url)}load(){for(const e in this._options.models){const i=this._options.models[e],r=this._modelsInfo.get(e);if(r){r.modelSpec=i;const l=r.model;l&&(l.position=i.position!=null?new se(i.position[0],i.position[1]):new se(0,0),l.orientation=i.orientation!=null?i.orientation:[0,0,0],bm.applyModelSpecification(l,i),l.computeBoundsAndApplyParent(),this.models.push(l))}else this._modelsInfo.set(e,{modelSpec:i,model:null}),this.loadGLTFFromURI(i.uri).then(l=>{if(!l)return;const h=this._modelsInfo.get(e);if(!h)return;const f=v0(l),m=h.modelSpec,x=new Y1(e,m.uri,m.position,m.orientation,f);bm.applyModelSpecification(x,m),x.computeBoundsAndApplyParent(),this.models.push(x),h.model=x,this.loaded()&&this.fire(new us("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(l=>{this.fire(new Fu(new Error(`Could not load model ${e} from ${i.uri}: ${l.message}`)))})}this.loaded()&&this.fire(new us("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,i){i.nodeOverrides&&bm.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&bm.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(r=>typeof r=="string")){e.nodeOverrideNames=[];for(const r of i)e.nodeOverrideNames.push(r)}
vendor: 28,494 bytes, line 218
218else Object.entries(i).forEach(([r,l])=>{const h={orientation:[0,0,0]};if(l.hasOwnProperty("orientation")){const f=l.orientation;f&&(h.orientation=f)}e.nodeOverrides.set(r,h)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(r=>typeof r=="string")){e.materialOverrideNames=[];for(const r of i)e.materialOverrideNames.push(r)}else Object.entries(i).forEach(([r,l])=>{const h={color:new pn(1,1,1),colorMix:0,emissionStrength:0,opacity:1},f=l["model-color"];f!==void 0&&(h.color.r=f[0],h.color.g=f[1],h.color.b=f[2]);const m=l["model-color-mix-intensity"];m!==void 0&&(h.colorMix=m);const x=l["model-emissive-strength"];x!==void 0&&(h.emissionStrength=x);const v=l["model-opacity"];v!==void 0&&(h.opacity=v),e.materialOverrides.set(r,h)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(this._modelsInfo.size===0)return!0;for(const e of this._modelsInfo.values())if(e.model==null)return!1;return!0}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){const e=ks(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}setModels(e){this.models=[];const i=new Map;for(const r in e){const l=e[r];if(this._modelsInfo.has(r)){const h=this._modelsInfo.get(r);h&&h.modelSpec.uri===l.uri&&i.set(r,h)}}this._modelsInfo=i,this._options.models=e,this.load()}}function Y0(n,e,i,r){const l=1<<n.z;e.lat=ot((r/Lt+n.y)/l),e.lng=$e((i/Lt+n.x)/l)}function sM(n,e,i,r){const l=n.getNodesInfo()[e];if(!l||l.hiddenByReplacement||!l.node.meshes)return;let h=Number.MAX_VALUE;const f=l.node,m=i.tile,x=r.calculatePosMatrix(m.tileID.toUnwrapped(),r.worldSize),v=l.evaluatedScale;let S=0;r.elevation&&f.elevation&&(S=f.elevation*r.elevation.exaggeration()),dt(x,x,[(f.anchor?f.anchor[0]:0)*(v[0]-1),(f.anchor?f.anchor[1]:0)*(v[1]-1),S]),nt(x,x,v);const A=i.queryGeometry,M=A.isPointQuery()?A.screenBounds:A.screenGeometry,R=function(U){const G=pt([],x,U.globalMatrix);pt(G,r.expandedFarZProjMatrix,G);for(let V=0;V<U.meshes.length;++V){const Z=U.meshes[V];if(V===U.lightMeshIndex)continue;const Y=g0(M,r,G,Z.aabb);Y!=null&&(h=Math.min(Y,h))}if(U.children)for(const V of U.children)R(V)};if(R(f),h===Number.MAX_VALUE)return;const D=new se(0,0);return Y0(m.tileID.canonical,D,l.node.anchor[0],l.node.anchor[1]),{intersectionZ:h,position:D,feature:l.feature}}const lM={circle:class extends Zo{constructor(n,e,i,r){super(n,{layout:ty||(ty=new qn({"circle-sort-key":new Ut(Oe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new It(Oe.layout_circle["circle-elevation-reference"]),visibility:new It(Oe.layout_circle.visibility)})),paint:iy||(iy=new qn({"circle-radius":new Ut(Oe.paint_circle["circle-radius"]),"circle-color":new Ut(Oe.paint_circle["circle-color"]),"circle-blur":new Ut(Oe.paint_circle["circle-blur"]),"circle-opacity":new Ut(Oe.paint_circle["circle-opacity"]),"circle-translate":new It(Oe.paint_circle["circle-translate"]),"circle-translate-anchor":new It(Oe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new It(Oe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new It(Oe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ut(Oe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ut(Oe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ut(Oe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new It(Oe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r)}createBucket(n){return new na(n)}queryRadius(n){const e=n;return Ql("circle-radius",this,e)+Ql("circle-stroke-width",this,e)+Ff(this.paint.get("circle-translate"))}queryIntersectsFeature(n,e,i,r,l,h,f,m){const x=ey(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,n.pixelToTileUnitsFactor),v=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return Xg(n,r,h,f,m,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",x,v)}getProgramIds(){return["circle"]}getDefaultProgramParams(n,e,i){const r=sy(this);return{config:new C(this,{zoom:e,lut:i}),defines:r,overrideFog:!1}}is3D(n){return!n&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Zo{createBucket(n){return new cy(n)}constructor(n,e,i,r){super(n,{layout:Yg||(Yg=new qn({visibility:new It(Oe.layout_heatmap.visibility)})),paint:uy||(uy=new qn({"heatmap-radius":new Ut(Oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ut(Oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new It(Oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new uu(Oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new It(Oe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(n){n==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Uf({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(n){return Ql("heatmap-radius",this,n)}queryIntersectsFeature(n,e,i,r,l,h,f,m){const x=this.paint.get("heatmap-radius").evaluate(e,i);return Xg(n,r,h,f,m,!0,!0,new _t(0,0),x)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(n,e,i){return n==="heatmap"?{config:new C(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Zo{constructor(n,e,i,r){super(n,{layout:Wm||(Wm=new qn({visibility:new It(Oe.layout_hillshade.visibility)})),paint:Ym||(Ym=new qn({"hillshade-illumination-direction":new It(Oe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new It(Oe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new It(Oe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new It(Oe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new It(Oe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new It(Oe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new It(Oe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(n,e,i){return{overrideFog:!1}}},fill:class extends Zo{constructor(n,e,i,r){super(n,{layout:qf||(qf=new qn({"fill-sort-key":new Ut(Oe.layout_fill["fill-sort-key"]),visibility:new It(Oe.layout_fill.visibility),"fill-elevation-reference":new It(Oe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Ut(Oe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Zf||(Zf=new qn({"fill-antialias":new It(Oe.paint_fill["fill-antialias"]),"fill-opacity":new Ut(Oe.paint_fill["fill-opacity"]),"fill-color":new Ut(Oe.paint_fill["fill-color"]),"fill-outline-color":new Ut(Oe.paint_fill["fill-outline-color"]),"fill-translate":new It(Oe.paint_fill["fill-translate"]),"fill-translate-anchor":new It(Oe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ut(Oe.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new It(Oe.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new It(Oe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Ut(Oe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Ut(Oe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Ut(Oe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r)}getProgramIds(){const n=this.paint.get("fill-pattern"),e=n&&n.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(n,e,i){return{config:new C(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(n,e){super.recalculate(n,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(n){return new Oc(n)}queryRadius(){return Ff(this.paint.get("fill-translate"))}queryIntersectsFeature(n,e,i,r,l,h){return!n.queryGeometry.isAboveHorizon&&Dn(Hg(n.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,n.pixelToTileUnitsFactor),r)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(n){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return n!=null?e&&!n:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Zo{constructor(n,e,i,r){super(n,{layout:x1||(x1=new qn({visibility:new It(Oe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new It(Oe["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:v1||(v1=new qn({"fill-extrusion-opacity":new It(Oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new It(Oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new It(Oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new It(Oe["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new It(Oe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new It(Oe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new It(Oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new It(Oe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new It(Oe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new It(Oe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new It(Oe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new It(Oe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new It(Oe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new It(Oe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new It(Oe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new It(Oe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new It(Oe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new It(Oe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Ut(Oe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new It(Oe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new ec(n)}queryRadius(){return Ff(this.paint.get("fill-extrusion-translate"))}is3D(n){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(n,e,i,r,l,h,f,m,x){const v=ey(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,n.pixelToTileUnitsFactor),S=this.paint.get("fill-extrusion-height").evaluate(e,i),A=this.paint.get("fill-extrusion-base").evaluate(e,i),M=[0,0],R=m&&h.elevation,D=h.elevation?h.elevation.exaggeration():1,U=n.tile.getBucket(this);if(R&&U instanceof ec){const Q=U.centroidVertexArray,le=x+1;le<Q.length&&(M[0]=Q.geta_centroid_pos0(le),M[1]=Q.geta_centroid_pos1(le))}if(M[0]===0&&M[1]===1)return!1;h.projection.name==="globe"&&(r=y1([r],[new _t(0,0),new _t(Lt,Lt)],n.tileID.canonical).map(Q=>Q.polygon).flat());const G=R?m:null,[V,Z]=M1(h,r,A,S,v,f,G,M,D,h.center.lat,n.tileID.canonical),Y=n.queryGeometry;return A1(V,Z,Y.isPointQuery()?Y.screenBounds:Y.screenGeometry)}},building:class extends Zo{constructor(n,e,i,r){super(n,{layout:nb||(nb=new qn({visibility:new It(Oe.layout_building.visibility),"building-facade":new Ut(Oe.layout_building["building-facade"]),"building-facade-floors":new Ut(Oe.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ut(Oe.layout_building["building-facade-unit-width"]),"building-facade-window":new Ut(Oe.layout_building["building-facade-window"]),"building-roof-shape":new Ut(Oe.layout_building["building-roof-shape"]),"building-height":new Ut(Oe.layout_building["building-height"]),"building-base":new Ut(Oe.layout_building["building-base"]),"building-flood-light-wall-radius":new Ut(Oe.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ut(Oe.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ut(Oe.layout_building["building-flip-roof-orientation"])})),paint:rb||(rb=new qn({"building-opacity":new It(Oe.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new It(Oe.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new It(Oe.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new It(Oe.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new It(Oe.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new It(Oe.paint_building["building-vertical-scale"]),"building-cast-shadows":new It(Oe.paint_building["building-cast-shadows"]),"building-color":new Ut(Oe.paint_building["building-color"]),"building-emissive-strength":new Ut(Oe.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new It(Oe.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new It(Oe.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new It(Oe.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new It(Oe.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new It(Oe.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new ib(n)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(n){return!0}queryRadius(n){return 0}queryIntersectsFeature(n,e,i,r,l,h,f,m,x,v){let S=this.layout.get("building-height").evaluate(e,i);const A=this.layout.get("building-base").evaluate(e,i),M=n.tile.getBucket(this).getFootprint(e);if(M){if(M.hiddenFlags!==0)return!1;S=M.height}const[R,D]=M1(h,r,A,S,new _t(0,0),f,null,[0,0],1,h.center.lat,n.tileID.canonical),U=n.queryGeometry;return A1(R,D,U.isPointQuery()?U.screenBounds:U.screenGeometry)}},line:class extends Zo{constructor(n,e,i,r){const l=pb();super(n,l,e,i,r),l.layout&&(this.layout=new qo(l.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Ds,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(n,e){super.recalculate(n,e),this.paint._values["line-floorwidth"]=(()=>{if(w_)return w_;const i=pb();return w_=new iA(i.paint.properties["line-width"].specification),w_.useIntegerZoom=!0,w_})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new T0(n)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(n,e,i){const r=db(this);return{config:new C(this,{zoom:e,lut:i}),defines:r,overrideFog:!1}}queryRadius(n){const e=n,i=mb(Ql("line-width",this,e),Ql("line-gap-width",this,e)),r=Ql("line-offset",this,e);return i/2+Math.abs(r)+Ff(this.paint.get("line-translate"))}queryIntersectsFeature(n,e,i,r,l,h){if(n.queryGeometry.isAboveHorizon)return!1;const f=Hg(n.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,n.pixelToTileUnitsFactor),m=n.pixelToTileUnitsFactor/2*mb(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),x=this.paint.get("line-offset").evaluate(e,i);return x&&(r=(function(v,S){const A=[],M=new _t(0,0);for(let R=0;R<v.length;R++){const D=v[R],U=[];for(let G=0;G<D.length;G++){const V=D[G],Z=D[G+1],Y=G===0?M:V.sub(D[G-1])._unit()._perp(),Q=G===D.length-1?M:Z.sub(V)._unit()._perp(),le=Y._add(Q)._unit();le._mult(1/(le.x*Q.x+le.y*Q.y)),U.push(le._mult(S)._add(V))}A.push(U)}return A})(r,x*n.pixelToTileUnitsFactor)),(function(v,S,A){for(let M=0;M<S.length;M++){const R=S[M];if(v.length>=3){for(let D=0;D<R.length;D++)if(ya(v,R[D]))return!0}if(Sr(v,R,A))return!0}return!1})(f,r,m)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(n){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:tx,background:class extends Zo{constructor(n,e,i,r){super(n,{layout:aw||(aw=new qn({visibility:new It(Oe.layout_background.visibility)})),paint:sw||(sw=new qn({"background-pitch-alignment":new It(Oe.paint_background["background-pitch-alignment"]),"background-color":new It(Oe.paint_background["background-color"]),"background-pattern":new It(Oe.paint_background["background-pattern"]),"background-opacity":new It(Oe.paint_background["background-opacity"]),"background-emissive-strength":new It(Oe.paint_background["background-emissive-strength"]),"background-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(n,e,i){return{overrideFog:!1}}is3D(n){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:dw,"raster-particle":yw,sky:class extends Zo{constructor(n,e,i,r){super(n,{layout:mw||(mw=new qn({visibility:new It(Oe.layout_sky.visibility)})),paint:gw||(gw=new qn({"sky-type":new It(Oe.paint_sky["sky-type"]),"sky-atmosphere-sun":new It(Oe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new It(Oe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new It(Oe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new It(Oe.paint_sky["sky-gradient-radius"]),"sky-gradient":new uu(Oe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new It(Oe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new It(Oe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new It(Oe.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(n){n==="sky-gradient"?this._updateColorRamp():n!=="sky-atmosphere-sun"&&n!=="sky-atmosphere-halo-color"&&n!=="sky-atmosphere-color"&&n!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Uf({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(n){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=n.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(n,e){if(this.paint.get("sky-type")==="atmosphere"){const r=this.paint.get("sky-atmosphere-sun"),l=!r,h=n.style.light,f=h.properties.get("position");return l&&h.properties.get("anchor")==="viewport"&&vi("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),l?Z0(f.azimuthal,90-f.polar,e):Z0(r[0],90-r[1],e)}const i=this.paint.get("sky-gradient-center");return Z0(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(n){this._skyboxInvalidated=!1,this._lightPosition=n.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const n=this.paint.get("sky-type");return n==="atmosphere"?["skyboxCapture","skybox"]:n==="gradient"?["skyboxGradient"]:null}},slot:class extends Zo{constructor(n,e,i,r){super(n,{paint:_w||(_w=new qn({}))},e,null)}},model:class extends Zo{constructor(n,e,i,r){super(n,{layout:ww||(ww=new qn({visibility:new It(Oe.layout_model.visibility),"model-id":new Ut(Oe.layout_model["model-id"]),"model-allow-density-reduction":new It(Oe.layout_model["model-allow-density-reduction"])})),paint:Tw||(Tw=new qn({"model-opacity":new Ut(Oe.paint_model["model-opacity"]),"model-rotation":new Ut(Oe.paint_model["model-rotation"]),"model-scale":new Ut(Oe.paint_model["model-scale"]),"model-translation":new Ut(Oe.paint_model["model-translation"]),"model-color":new Ut(Oe.paint_model["model-color"]),"model-color-mix-intensity":new Ut(Oe.paint_model["model-color-mix-intensity"]),"model-type":new It(Oe.paint_model["model-type"]),"model-cast-shadows":new It(Oe.paint_model["model-cast-shadows"]),"model-receive-shadows":new It(Oe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new It(Oe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Ut(Oe.paint_model["model-emissive-strength"]),"model-roughness":new Ut(Oe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Ut(Oe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new It(Oe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new It(Oe.paint_model["model-front-cutoff"]),"model-elevation-reference":new It(Oe.paint_model["model-elevation-reference"]),"model-color-use-theme":new Ut({type:"string",default:"default","property-type":"data-driven"})}))},e,i,r),this.layer=n,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new X0(n)}getProgramIds(){return["model"]}is3D(n){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(n){return n instanceof ox?8191:0}queryRenderedFeatures(n,e,i){const r=e.getSource();if(!(r&&r instanceof bm))return{};const l=r,h={};h[this.id]=[];const f=h[this.id];let m=0;for(const x of l.models){const v=e.getFeatureState(this.sourceLayer,x.id),S={type:"Unknown",id:x.id,properties:x.featureProperties},A=this.paint.get("model-rotation").evaluate(S,v),M=this.paint.get("model-scale").evaluate(S,v),R=this.paint.get("model-translation").evaluate(S,v),D=this.paint.get("model-elevation-reference");let U=[];Ny(U,x,i,x.position,A,M,R,D==="ground",D==="ground",!1),i.projection.name==="globe"&&(U=Fy(U,i));const G=pt([],i.projMatrix,U),V=g0(n.isPointQuery()?n.screenBounds:n.screenGeometry,i,G,x.aabb);if(V!=null){const Z=new vm(void 0,0,0,0,x.id);Z.layer=this.layer,Z.properties=structuredClone(x.featureProperties),Z.properties.layer=this.id,Z.properties.uri=x.uri,Z.properties.orientation=x.orientation,Z.sourceLayer=this.sourceLayer,Z.geometry={type:"Point",coordinates:[x.position.lng,x.position.lat]},Z.state=v,Z.source=this.source,f.push({featureIndex:m,feature:Z,intersectionZ:V})}++m}return h}queryIntersectsFeature(n,e,i,r,l,h,f,m,x,v){if(!this.modelManager)return!1;const S=this.modelManager,A=n.tile.getBucket(this);if(!(A&&A instanceof X0))return!1;for(const M in A.instancesPerModel){const R=A.instancesPerModel[M],D=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(R.idToFeaturesIndex.hasOwnProperty(D)){const U=R.features[R.idToFeaturesIndex[D]],G=S.getModel(M,v||this.scope);if(!G)return!1;let V=[];const Z=new se(0,0),Y=A.canonical;let Q=Number.MAX_VALUE;for(let le=0;le<U.instancedDataCount;++le){const ae=16*(U.instancedDataOffset+le),ge=R.instancedDataArray.float32,_e=[ge[ae+4],ge[ae+5],ge[ae+6]];Y0(Y,Z,Math.floor(ge[ae]),Math.floor(ge[ae+1])),Ny(V,G,h,Z,U.rotation,U.scale,_e,!1,!1,!1),h.projection.name==="globe"&&(V=Fy(V,h));const pe=pt([],h.projMatrix,V),be=n.queryGeometry,Me=g0(be.isPointQuery()?be.
218screenBounds:be.screenGeometry,h,pe,G.aabb);Me!=null&&(Q=Math.min(Me,Q))}return Q!==Number.MAX_VALUE&&Q}}return!1}_handleOverridablePaintPropertyUpdate(n,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||n!=="model-color"&&n!=="model-color-mix-intensity"&&n!=="model-rotation"&&n!=="model-scale"&&n!=="model-translation"&&n!=="model-emissive-strength")}_isPropertyZoomDependent(n){const e=this._transitionablePaint._values[n];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Io}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Zo{constructor(n,e,i,r){super(n,{layout:Eu||(Eu=new qn({"clip-layer-types":new It(Oe.layout_clip["clip-layer-types"]),"clip-layer-scope":new It(Oe.layout_clip["clip-layer-scope"]),visibility:new It(Oe.layout_clip.visibility)})),paint:Sy||(Sy=new qn({}))},e,i,r)}recalculate(n,e){super.recalculate(n,e)}createBucket(n){return new Ey(n)}is3D(n){return!0}}},K0=new pn(0,0,0);function cM(n,e,i){n===1&&e.icons.push((function(r,l){return(function(h){if(h.usvg_tree.height||(h.usvg_tree.height=h.usvg_tree.width),!h.metadata)return h;const{metadata:f}=h;if(f.content_area){const{content_area:m}=f;m.left==null&&(m.left=0),m.top==null&&(m.top=m.left),m.width==null&&(m.width=h.usvg_tree.width),m.height==null&&(m.height=m.width)}if(f.text_placeholder){const{text_placeholder:m}=f;m.top==null&&(m.top=m.left),m.height==null&&(m.height=m.width)}return f.stretch_x&&f.stretch_x.length&&Cw(f,"x"),f.stretch_y&&f.stretch_y.length&&Cw(f,"y"),h})(r.readFields(uM,{name:void 0},l))})(i,i.readVarint()+i.pos))}function Cw(n,e){const i=[],r=n[`stretch_${e}`];let l=null;for(let h=0;h<r.length;h++)l===null?l=i.length===0?r[0]:i[i.length-1][1]+r[h]:(i.push([l,l+r[h]]),l=null);n[`stretch_${e}_areas`]=i}function uM(n,e,i){n===1?e.name=i.readString():n===2?e.metadata=(function(r,l){return r.readFields(hM,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},l)})(i,i.readVarint()+i.pos):n===3&&(e.usvg_tree=(function(r,l){return r.readFields(pM,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},l)})(i,i.readVarint()+i.pos),e.data="usvg_tree")}function hM(n,e,i){n===1?e.stretch_x=i.readPackedVarint():n===2?e.stretch_y=i.readPackedVarint():n===3?e.content_area=Iw(i,i.readVarint()+i.pos):n===4?e.variables.push((function(r,l){return r.readFields(fM,{name:void 0},l)})(i,i.readVarint()+i.pos)):n===5&&(e.text_placeholder=Iw(i,i.readVarint()+i.pos))}function Iw(n,e){return n.readFields(dM,{},e)}function dM(n,e,i){n===1?e.left=i.readVarint():n===2?e.width=i.readVarint():n===3?e.top=i.readVarint():n===4&&(e.height=i.readVarint())}function fM(n,e,i){n===1?e.name=i.readString():n===2&&(e.rgb_color=lx(i.readVarint()),e.value="rgb_color")}function pM(n,e,i){n===1?e.width=e.height=i.readVarint():n===2?e.height=i.readVarint():n===3?e.children.push(ax(i,i.readVarint()+i.pos)):n===4?e.linear_gradients.push((function(r,l){return r.readFields(bM,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},l)})(i,i.readVarint()+i.pos)):n===5?e.radial_gradients.push((function(r,l){return r.readFields(TM,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},l)})(i,i.readVarint()+i.pos)):n===7?e.clip_paths.push((function(r,l){return r.readFields(SM,{children:[]},l)})(i,i.readVarint()+i.pos)):n===8&&e.masks.push((function(r,l){const h=r.readFields(EM,{left:0,width:20,mask_type:1,children:[]},l);return h.height==null&&(h.height=h.width),h.top==null&&(h.top=h.left),h})(i,i.readVarint()+i.pos))}function ax(n,e){return n.readFields(mM,{},e)}function mM(n,e,i){n===1?(e.group=(function(r,l){return r.readFields(gM,{opacity:255,children:[]},l)})(i,i.readVarint()+i.pos),e.node="group"):n===2&&(e.path=(function(r,l){return r.readFields(yM,{paint_order:1,commands:[],step:1,diffs:[],rule:1},l)})(i,i.readVarint()+i.pos),e.node="path")}function gM(n,e,i){n===1?e.transform=sx(i,i.readVarint()+i.pos):n===2?e.opacity=i.readVarint():n===5?e.clip_path_idx=i.readVarint():n===6?e.mask_idx=i.readVarint():n===7&&e.children.push(ax(i,i.readVarint()+i.pos))}function sx(n,e){return n.readFields(_M,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}
218function _M(n,e,i){n===1?e.sx=i.readFloat():n===2?e.ky=i.readFloat():n===3?e.kx=i.readFloat():n===4?e.sy=i.readFloat():n===5?e.tx=i.readFloat():n===6&&(e.ty=i.readFloat())}function yM(n,e,i){n===1?e.fill=(function(r,l){return r.readFields(xM,{rgb_color:K0,paint:"rgb_color",opacity:255},l)})(i,i.readVarint()+i.pos):n===2?e.stroke=(function(r,l){return r.readFields(vM,{rgb_color:K0,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},l)})(i,i.readVarint()+i.pos):n===3?e.paint_order=i.readVarint():n===5?i.readPackedVarint(e.commands):n===6?e.step=i.readFloat():n===7?i.readPackedSVarint(e.diffs):n===8&&(e.rule=i.readVarint())}function xM(n,e,i){n===1?(e.rgb_color=lx(i.readVarint()),e.paint="rgb_color"):n===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):n===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):n===5&&(e.opacity=i.readVarint())}function lx(n){return new pn((n>>16&255)/255,(n>>8&255)/255,(255&n)/255,1)}function vM(n,e,i){n===1?(e.rgb_color=lx(i.readVarint()),e.paint="rgb_color"):n===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):n===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):n===5?i.readPackedFloat(e.dasharray):n===6?e.dashoffset=i.readFloat():n===7?e.miterlimit=i.readFloat():n===8?e.opacity=i.readVarint():n===9?e.width=i.readFloat():n===10?e.linecap=i.readVarint():n===11&&(e.linejoin=i.readVarint())}function bM(n,e,i){n===1?e.transform=sx(i,i.readVarint()+i.pos):n===2?e.spread_method=i.readVarint():n===3?e.stops.push(Rw(i,i.readVarint()+i.pos)):n===4?e.x1=i.readFloat():n===5?e.y1=i.readFloat():n===6?e.x2=i.readFloat():n===7&&(e.y2=i.readFloat())}function Rw(n,e){return n.readFields(wM,{offset:0,opacity:255,rgb_color:K0},e)}function wM(n,e,i){n===1?e.offset=i.readFloat():n===2?e.opacity=i.readVarint():n===3&&(e.rgb_color=lx(i.readVarint()))}function TM(n,e,i){n===1?e.transform=sx(i,i.readVarint()+i.pos):n===2?e.spread_method=i.readVarint():n===3?e.stops.push(Rw(i,i.readVarint()+i.pos)):n===4?e.cx=i.readFloat():n===5?e.cy=i.readFloat():n===6?e.r=i.readFloat():n===7?e.fx=i.readFloat():n===8?e.fy=i.readFloat():n===9&&(e.fr=i.readFloat())}function SM(n,e,i){n===1?e.transform=sx(i,i.readVarint()+i.pos):n===2?e.clip_path_idx=i.readVarint():n===3&&e.children.push(ax(i,i.readVarint()+i.pos))}function EM(n,e,i){n===1?e.left=e.top=i.readFloat():n===2?e.width=e.height=i.readFloat():n===3?e.top=i.readFloat():n===4?e.height=i.readFloat():n===5?e.mask_type=i.readVarint():n===6?e.mask_idx=i.readVarint():n===7&&e.children.push(ax(i,i.readVarint()+i.pos))}class AM{static calculate(e={},i=[]){const r=new Map,l=new Map;if(Object.keys(e).length===0)return r;i.forEach(h=>{l.set(h.name,h.rgb_color||new pn(0,0,0))});for(const[h,f]of Object.entries(e))l.has(h)?r.set(l.get(h).toString(),f):console.warn(`Ignoring unknown image variable "${h}"`);return r}}function vg(n,e=255,i){const r=e/255,l=n.toString(),h=i.has(l)?i.get(l).clone():n.clone();return h.a*=r,h.toString()}function k_(n,e){if(!os()){const i=document.createElement("canvas");return i.width=n,i.height=e,i}return new OffscreenCanvas(n,e)}let Q0,F_=null;function J0(n,e,i,r,l){for(const h of r.children)zw(n,e,i,h,l)}function zw(n,e,i,r,l){r.group?(n.save(),(function(h,f,m,x,v){const S=x.mask_idx!=null?m.masks[x.mask_idx]:null,A=x.clip_path_idx!=null?m.clip_paths[x.clip_path_idx]:null;if(x.transform&&(f=bg(x.transform).preMultiplySelf(f)),!(function(D,U,G){return D.opacity!==255||U||G})(x,A!=null,S!=null))return void J0(h,f,m,x,v);const M=k_(h.canvas.width,h.canvas.height),R=M.getContext("2d");J0(R,f,m,x,v),A&&Fw(R,f,m,A),S&&Nw(R,f,m,S,v),h.globalAlpha=x.opacity/255,h.drawImage(M,0,0)})(n,e,i,r.group,l),n.restore()):r.path&&(n.save(),(function(h,f,m,x,v){h.setTransform(f),x.paint_order===1?(Dw(h,m,x,v),Lw(h,m,x,v)):(Lw(h,m,x,v),Dw(h,m,x,v))})(n,e,i,r.path,l),n.restore())}function Dw(n,e,i,r){const l=i.fill;if(!l)return;const h=l.opacity/255;switch(n.save(),n.beginPath(),Uw(i,n),l.paint){case"rgb_color":n.fillStyle=vg(l.rgb_color,l.opacity,r);break;case"linear_gradient_idx":{const f=e.linear_gradients[l.linear_gradient_idx];f.transform&&n.setTransform(bg(f.transform).preMultiplySelf(n.getTransform())),n.fillStyle=Ow(n,f,h,r);break}case"radial_gradient_idx":{const f=e.radial_gradients[l.radial_gradient_idx];f.transform&&n.setTransform(bg(f.transform).preMultiplySelf(n.getTransform())),n.fillStyle=Bw(n,f,h,r)}}
vendor: 28,282 bytes, line 218
218n.fill(Pw(i)),n.restore()}function Pw(n){return n.rule===1?"nonzero":n.rule===2?"evenodd":void 0}function Lw(n,e,i,r){const l=i.stroke;if(!l)return;const h=Vw(i);n.lineWidth=l.width,n.miterLimit=l.miterlimit,n.setLineDash(l.dasharray),n.lineDashOffset=l.dashoffset;const f=l.opacity/255;switch(l.paint){case"rgb_color":n.strokeStyle=vg(l.rgb_color,l.opacity,r);break;case"linear_gradient_idx":n.strokeStyle=Ow(n,e.linear_gradients[l.linear_gradient_idx],f,r,!0);break;case"radial_gradient_idx":n.strokeStyle=Bw(n,e.radial_gradients[l.radial_gradient_idx],f,r,!0)}switch(l.linejoin){case 2:case 1:n.lineJoin="miter";break;case 3:n.lineJoin="round";break;case 4:n.lineJoin="bevel"}switch(l.linecap){case 1:n.lineCap="butt";break;case 2:n.lineCap="round";break;case 3:n.lineCap="square"}n.stroke(h)}function Ow(n,e,i,r,l=!1){if(e.stops.length===1){const M=e.stops[0];return vg(M.rgb_color,M.opacity*i,r)}const{x1:h,y1:f,x2:m,y2:x}=e;let v=new DOMPoint(h,f),S=new DOMPoint(m,x);if(l){const M=bg(e.transform);v=M.transformPoint(v),S=M.transformPoint(S)}const A=n.createLinearGradient(v.x,v.y,S.x,S.y);for(const M of e.stops)A.addColorStop(M.offset,vg(M.rgb_color,M.opacity*i,r));return A}function Bw(n,e,i,r,l=!1){if(e.stops.length===1){const V=e.stops[0];return vg(V.rgb_color,V.opacity*i,r)}const h=bg(e.transform),{fx:f,fy:m,fr:x,cx:v,cy:S,r:A}=e;let M=new DOMPoint(f,m),R=new DOMPoint(v,S),D=x,U=A;if(l){M=h.transformPoint(M),R=h.transformPoint(R);const V=(h.a+h.d)/2;D=x*V,U=e.r*V}const G=n.createRadialGradient(M.x,M.y,D,R.x,R.y,U);for(const V of e.stops)G.addColorStop(V.offset,vg(V.rgb_color,V.opacity*i,r));return G}function kw(n,e,i,r){const l=r.transform?bg(r.transform).preMultiplySelf(e):e,h=k_(n.canvas.width,n.canvas.height),f=h.getContext("2d");for(const x of r.children)if(x.group)kw(f,l,i,x.group);else if(x.path){const v=x.path,S=new Path2D;S.addPath(Vw(v),l),f.fill(S,Pw(v))}const m=r.clip_path_idx!=null?i.clip_paths[r.clip_path_idx]:null;m&&Fw(f,l,i,m),n.globalCompositeOperation="source-over",n.drawImage(h,0,0)}function Fw(n,e,i,r){const l=k_(n.canvas.width,n.canvas.height);kw(l.getContext("2d"),e,i,r),n.globalCompositeOperation="destination-in",n.drawImage(l,0,0)}function Nw(n,e,i,r,l){if(r.children.length===0)return;const h=r.mask_idx!=null?i.masks[r.mask_idx]:null;h&&Nw(n,e,i,h,l);const f=n.canvas.width,m=n.canvas.height,x=k_(f,m),v=x.getContext("2d"),S=r.width,A=r.height,M=r.left,R=r.top,D=new Path2D,U=new Path2D;U.rect(M,R,S,A),D.addPath(U,e),v.clip(D);for(const Z of r.children)zw(v,e,i,Z,l);const G=v.getImageData(0,0,f,m),V=G.data;if(r.mask_type===1)for(let Z=0;Z<V.length;Z+=4)V[Z+3]=V[Z+3]/255*(.2126*V[Z]+.7152*V[Z+1]+.0722*V[Z+2]);v.putImageData(G,0,0),n.globalCompositeOperation="destination-in",n.drawImage(x,0,0)}function bg(n){return n?new DOMMatrix([n.sx,n.ky,n.kx,n.sy,n.tx,n.ty]):new DOMMatrix}function Uw(n,e){const i=n.step;let r=n.diffs[0]*i,l=n.diffs[1]*i;e.moveTo(r,l);for(let h=0,f=2;h<n.commands.length;h++)switch(n.commands[h]){case 1:r+=n.diffs[f++]*i,l+=n.diffs[f++]*i,e.moveTo(r,l);break;case 2:r+=n.diffs[f++]*i,l+=n.diffs[f++]*i,e.lineTo(r,l);break;case 3:{const m=r+n.diffs[f++]*i,x=l+n.diffs[f++]*i;r=m+n.diffs[f++]*i,l=x+n.diffs[f++]*i,e.quadraticCurveTo(m,x,r,l);break}case 4:{const m=r+n.diffs[f++]*i,x=l+n.diffs[f++]*i,v=m+n.diffs[f++]*i,S=x+n.diffs[f++]*i;r=v+n.diffs[f++]*i,l=S+n.diffs[f++]*i,e.bezierCurveTo(m,x,v,S,r,l);break}case 5:e.closePath();break}return e}function Vw(n){return Uw(n,new Path2D)}class cx{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}zt(cx,"LRUCache");class ev{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new ho(e,e.data)}getFromCache(e,i,r){return this.cacheMap.has(r)||this.cacheMap.set(r,new cx(150)),this.cacheMap.get(r).get(ks(e.toString(),i))}setInCache(e,i,r,l){this.cacheDependenciesMap.has(l)||this.cacheDependenciesMap.set(l,new Map),this.cacheMap.has(l)||this.cacheMap.set(l,new cx(150));const h=this.cacheDependenciesMap.get(l),f=ks(e.id.toString(),r);h.get(f)||h.set(f,new Set);const m=this.cacheMap.get(l),x=e.toString();h.get(f).add(x),m.put(ks(e.toString(),r),i)}removeImagesFromCacheByIds(e,i,r=0){if(!this.cacheMap.has(r)||!this.cacheDependenciesMap.has(r))return;const l=this.cacheMap.get(r),h=this.cacheDependenciesMap.get(r);for(const f of e){const m=ks(f.toString(),i);if(h.has(m)){for(const x of h.get(m))l.delete(x);h.delete(m)}}}rasterize(e,i,r,l){const h=this.getFromCache(e,r,l);if(h)return h.clone();const f=(function(x,v){const S=AM.calculate(v.params,x.metadata?x.metadata.variables:[]),A=x.usvg_tree,M=A.width,R=A.height,D=Math.max(1,Math.round(M*v.sx)),U=Math.max(1,Math.round(R*v.sy)),G=new DOMMatrix([D/M,0,0,U/R,0,0]);return F_===null&&(F_=k_(10,10),Q0=F_.getContext("2d",{willReadFrequently:!0})),F_.width=D,F_.height=U,J0(Q0,G,A,A,S),Q0.getImageData(0,0,D,U)})(i.icon,e),m=ev._getImage(f);return this.setInCache(e,m,r,l),m.clone()}}class jw{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const r=this.toIdx(e,i);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Gw(n,e,i,r){let l=0,h=Number.MAX_VALUE;for(let f=0;f<3;f++)if(Math.abs(r[f])<1e-15){if(i[f]<n[f]||i[f]>e[f])return null}else{const m=1/r[f];let x=(n[f]-i[f])*m,v=(e[f]-i[f])*m;if(x>v){const S=x;x=v,v=S}if(x>l&&(l=x),v<h&&(h=v),l>h)return null}return l}function Hw(n,e,i,r,l,h,f,m,x,v,S){const A=r-n,M=l-e,R=h-i,D=f-n,U=m-e,G=x-i,V=S[1]*G-S[2]*U,Z=S[2]*D-S[0]*G,Y=S[0]*U-S[1]*D,Q=A*V+M*Z+R*Y;if(Math.abs(Q)<1e-15)return null;const le=1/Q,ae=v[0]-n,ge=v[1]-e,_e=v[2]-i,pe=(ae*V+ge*Z+_e*Y)*le;if(pe<0||pe>1)return null;const be=ge*R-_e*M,Me=_e*A-ae*R,Ye=ae*M-ge*A,Ze=(S[0]*be+S[1]*Me+S[2]*Ye)*le;return Ze<0||pe+Ze>1?null:(D*be+U*Me+G*Ye)*le}function qw(n,e,i){return(n-e)/(i-e)}function Zw(n,e,i,r,l,h,f,m,x){const v=1<<i,S=h-r,A=f-l,M=(n+1)/v*S+r,R=(e+0)/v*A+l,D=(e+1)/v*A+l;m[0]=(n+0)/v*S+r,m[1]=R,x[0]=M,x[1]=D}class $w{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=(function(h){const f=Math.ceil(Math.log2(h.dim/8)),m=[];let x=Math.ceil(Math.pow(2,f));const v=1/x,S=(R,D,U,G,V)=>{const Z=G?1:0,Y=(R+1)*U-Z,Q=D*U,le=(D+1)*U-Z;V[0]=R*U,V[1]=Q,V[2]=Y,V[3]=le};let A=new jw(x);const M=[];for(let R=0;R<x*x;R++){S(R%x,Math.floor(R/x),v,!1,M);const D=Jf(M[0],M[1],h),U=Jf(M[2],M[1],h),G=Jf(M[2],M[3],h),V=Jf(M[0],M[3],h);A.minimums.push(Math.min(D,U,G,V)),A.maximums.push(Math.max(D,U,G,V)),A.leaves.push(1)}for(m.push(A),x/=2;x>=1;x/=2){const R=m[m.length-1];A=new jw(x);for(let D=0;D<x*x;D++){S(D%x,Math.floor(D/x),2,!0,M);const U=R.getElevation(M[0],M[1]),G=R.getElevation(M[2],M[1]),V=R.getElevation(M[2],M[3]),Z=R.getElevation(M[0],M[3]),Y=R.isLeaf(M[0],M[1]),Q=R.isLeaf(M[2],M[1]),le=R.isLeaf(M[2],M[3]),ae=R.isLeaf(M[0],M[3]),ge=Math.min(U.min,G.min,V.min,Z.min),_e=Math.max(U.max,G.max,V.max,Z.max),pe=Y&&Q&&le&&ae;A.maximums.push(_e),A.minimums.push(ge),A.leaves.push(_e-ge<=5&&pe?1:0)}m.push(A)}return m})(this.dem),r=i.length-1,l=i[r];this._addNode(l.minimums[0],l.maximums[0],l.leaves[0]),this._construct(i,0,0,r,0)}raycastRoot(e,i,r,l,h,f,m=1){return Gw([e,i,-100],[r,l,this.maximums[0]*m],h,f)}raycast(e,i,r,l,h,f,m=1){if(!this.nodeCount)return null;const x=this.raycastRoot(e,i,r,l,h,f,m);if(x==null)return null;const v=[],S=[],A=[],M=[],R=[{idx:0,t:x,nodex:0,nodey:0,depth:0}];for(;R.length>0;){const{idx:D,t:U,nodex:G,nodey:V,depth:Z}=R.pop();if(this.leaves[D]){Zw(G,V,Z,e,i,r,l,A,M);const Q=1<<Z,le=(G+0)/Q,ae=(G+1)/Q,ge=(V+0)/Q,_e=(V+1)/Q,pe=Jf(le,ge,this.dem)*m,be=Jf(ae,ge,this.dem)*m,Me=Jf(ae,_e,this.dem)*m,Ye=Jf(le,_e,this.dem)*m,Ze=Hw(A[0],A[1],pe,M[0],A[1],be,M[0],M[1],Me,h,f),We=Hw(M[0],M[1],Me,A[0],M[1],Ye,A[0],A[1],pe,h,f),lt=Math.min(Ze!==null?Ze:Number.MAX_VALUE,We!==null?We:Number.MAX_VALUE);if(lt!==Number.MAX_VALUE)return lt;{const at=Ht([],h,f,U);if(Xw(pe,be,Ye,Me,qw(at[0],A[0],M[0]),qw(at[1],A[1],M[1]))>=at[2])return U}continue}let Y=0;for(let Q=0;Q<this._siblingOffset.length;Q++){Zw((G<<1)+this._siblingOffset[Q][0],(V<<1)+this._siblingOffset[Q][1],Z+1,e,i,r,l,A,M),A[2]=-100,M[2]=this.maximums[this.childOffsets[D]+Q]*m;const le=Gw(A,M,h,f);if(le!=null){const ae=le;v[Q]=ae;let ge=!1;for(let _e=0;_e<Y&&!ge;_e++)ae>=v[S[_e]]&&(S.splice(_e,0,Q),ge=!0);ge||(S[Y]=Q),Y++}}for(let Q=0;Q<Y;Q++){const le=S[Q];R.push({idx:this.childOffsets[D]+le,t:v[le],nodex:(G<<1)+this._siblingOffset[le][0],nodey:(V<<1)+this._siblingOffset[le][1],depth:Z+1})}}return null}_addNode(e,i,r){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,r,l,h){if(e[l].isLeaf(i,r)===1)return;this.childOffsets[h]||(this.childOffsets[h]=this.nodeCount);const f=l-1,m=e[f];let x=0,v=0;for(let S=0;S<this._siblingOffset.length;S++){const A=2*i+this._siblingOffset[S][0],M=2*r+this._siblingOffset[S][1],R=m.getElevation(A,M),D=m.isLeaf(A,M),U=this._addNode(R.min,R.max,D);D&&(x|=1<<S),v||(v=U)}for(let S=0;S<this._siblingOffset.length;S++)x&1<<S||this._construct(e,2*i+this._siblingOffset[S][0],2*r+this._siblingOffset[S][1],f,v+S)}}function Xw(n,e,i,r,l,h){return mi(mi(n,i,h),mi(e,r,h),l)}function Jf(n,e,i){const r=i.dim,l=he(n*r-.5,0,r-1),h=he(e*r-.5,0,r-1),f=Math.floor(l),m=Math.floor(h),x=Math.min(f+1,r-1),v=Math.min(m+1,r-1);return Xw(i.get(f,m),i.get(x,m),i.get(f,v),i.get(x,v),l-f,h-m)}const MM={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function CM(n,e,i){return(256*n*256+256*e+i)/10-1e4}function IM(n,e,i){return 256*n+e+i/256-32768}class ux{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,r,l=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(r&&r!=="mapbox"&&r!=="terrarium")return void vi(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const h=this.dim=i.height-2,f=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=l,this._modifiedForSources={},!l){for(let x=0;x<h;x++)f[this._idx(-1,x)]=f[this._idx(0,x)],f[this._idx(h,x)]=f[this._idx(h-1,x)],f[this._idx(x,-1)]=f[this._idx(x,0)],f[this._idx(x,h)]=f[this._idx(x,h-1)];f[this._idx(-1,-1)]=f[this._idx(0,0)],f[this._idx(h,-1)]=f[this._idx(h-1,0)],f[this._idx(-1,h)]=f[this._idx(0,h-1)],f[this._idx(h,h)]=f[this._idx(h-1,h-1)]}const m=r==="terrarium"?IM:CM;for(let x=0;x<f.length;++x){const v=4*x;this.floatView[x]=m(this.pixels[v],this.pixels[v+1],this.pixels[v+2])}this._timestamp=Ea.now()}_buildQuadTree(){this._tree=new $w(this)}get(e,i,r=!1){r&&(e=he(e,-1,this.dim),i=he(i,-1,this.dim));const l=this._idx(e,i);return this.floatView[l]}set(e,i,r){const l=this._idx(e,i),h=this.floatView[l];return this.floatView[l]=r,r-h}static getUnpackVector(e){return MM[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const r=[0,0,0,0],l=ux.getUnpackVector(i);let h=Math.floor((e+l[3])/l[2]);return r[2]=h%256,h=Math.floor(h/256),r[1]=h%256,h=Math.floor(h/256),r[0]=h,r}getPixels(){return new hy({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=i*this.dim,h=i*this.dim+this.dim,f=r*this.dim,m=r*this.dim+this.dim;switch(i){case-1:l=h-1;break;case 1:h=l+1}switch(r){case-1:f=m-1;break;case 1:m=f+1}const x=-i*this.dim,v=-r*this.dim;for(let S=f;S<m;S++)for(let A=l;A<h;A++){const M=4*this._idx(A,S),R=4*this._idx(A+x,S+v);this.pixels[M+0]=e.pixels[R+0],this.pixels[M+1]=e.pixels[R+1],this.pixels[M+2]=e.pixels[R+2],this.pixels[M+3]=e.pixels[R+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function RM(n,e,i){n===1?e.headerLength=i.readFixed32():n===2?e.x=i.readVarint():n===3?e.y=i.readVarint():n===4?e.z=i.readVarint():n===5&&e.layers.push((function(r,l){return r.readFields(OM,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},l)})(i,i.readVarint()+i.pos))}function zM(n,e,i){n===1?(e.delta_filter=(function(r,l){return r.readFields(DM,{blockSize:0},l)})(i,i.readVarint()+i.pos),e.filter="delta_filter"):n===2?(i.readVarint(),e.filter="zigzag_filter"):n===3?(i.readVarint(),e.filter="bitshuffle_filter"):n===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function DM(n,e,i){n===1&&(e.blockSize=i.readVarint())}function PM(n,e,i){n===1?(i.readVarint(),e.codec="gzip_data"):n===2?(i.readVarint(),e.codec="jpeg_image"):n===3?(i.readVarint(),e.codec="webp_image"):n===4&&(i.readVarint(),e.codec="png_image")}function LM(n,e,i){let r=0,l=0;n===1?e.firstByte=i.readFixed64():n===2?e.lastByte=i.readFixed64():n===3?e.filters.push((function(h,f){return h.readFields(zM,{},f)})(i,i.readVarint()+i.pos)):n===4?e.codec=(function(h,f){return h.readFields(PM,{},f)})(i,i.readVarint()+i.pos):n===5?l=i.readFloat():n===6?r=i.readFloat():n===7?e.bands.push(i.readString()):n===8?e.offset=i.readDouble():n===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=l),e.scale===0&&(e.scale=r)}function OM(n,e,i){n===1?e.version=i.readVarint():n===2?e.name=i.readString():n===3?e.units=i.readString():n===4?e.tileSize=i.readVarint():n===5?e.buffer=i.readVarint():n===6?e.pixelFormat=i.readVarint():n===7&&e.dataIndex.push((function(r,l){return r.readFields(LM,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},l)})(i,i.readVarint()+i.pos))}function BM(n,e,i){if(n===2)(function(r,l,h){r.readFields(kM,h,l)})(i,i.readVarint()+i.pos,e);else if(n===3)throw new Error("Not implemented")}function kM(n,e,i){if(n===1){let r=0;const l=i.readVarint()+i.pos;for(;i.pos<l;)e[r++]=i.readVarint()}}function FM(n,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let r=2;r>=1;r--){const l=r===1?1:0,h=r===2?1:0;for(let f=0;f<e[0];f++){const m=e[1]*f;for(let x=l;x<e[1];x++){const v=e[2]*(x+m);for(let S=h;S<e[2];S++){const A=e[3]*(S+v);for(let M=0;M<e[3];M++){const R=A+M;n[R]+=n[R-i]}}}}i*=e[r]}return n}function NM(n){for(let e=0,i=n.length;e<i;e++)n[e]=n[e]>>>1^-(1&n[e]);return n}function UM(n,e){switch(e){case"uint32":return n;case"uint16":for(let i=0;i<n.length;i+=2){const r=n[i],l=n[i+1];n[i]=(240&r)>>4|(61440&r)>>8|(240&l)<<4|61440&l,n[i+1]=15&r|(3840&r)>>4|(15&l)<<8|(3840&l)<<4}return n;case"uint8":for(let i=0;i<n.length;i+=4){const r=n[i],l=n[i+1],h=n[i+2],f=n[i+3];n[i+0]=(192&r)>>6|(192&l)>>4|(192&h)>>2|192&f,n[i+1]=(48&r)>>4|(48&l)>>2|48&h|(48&f)<<2,n[i+2]=(12&r)>>2|12&l|(12&h)<<2|(12&f)<<4,n[i+3]=3&r|(3&l)<<2|(3&h)<<4|(3&f)<<6}return n;default:throw new Error(`Invalid pixel format, "${e}"`)}}zt(ux,"DEMData"),zt($w,"DemMinMaxQuadTree",{omit:["dem"]});var tc=Uint8Array,N_=Uint16Array,VM=Int32Array,Ww=new tc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Yw=new tc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),jM=new tc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kw=function(n,e){for(var i=new N_(31),r=0;r<31;++r)i[r]=e+=1<<n[r-1];var l=new VM(i[30]);for(r=1;r<30;++r)for(var h=i[r];h<i[r+1];++h)l[h]=h-i[r]<<5|r;return{b:i,r:l}},Qw=Kw(Ww,2),Jw=Qw.b,GM=Qw.r;Jw[28]=258,GM[258]=28;for(var HM=Kw(Yw,0).b,e2=new N_(32768),to=0;to<32768;++to){var wg=(43690&to)>>1|(21845&to)<<1;e2[to]=((65280&(wg=(61680&(wg=(52428&wg)>>2|(13107&wg)<<2))>>4|(3855&wg)<<4))>>8|(255&wg)<<8)>>1}var U_=function(n,e,i){for(var r=n.length,l=0,h=new N_(e);l<r;++l)n[l]&&++h[n[l]-1];var f,m=new N_(e);for(l=1;l<e;++l)m[l]=m[l-1]+h[l-1]<<1;f=new N_(1<<e);var x=15-e;for(l=0;l<r;++l)if(n[l])for(var v=l<<4|n[l],S=e-n[l],A=m[n[l]-1]++<<S,M=A|(1<<S)-1;A<=M;++A)f[e2[A]>>x]=v;return f},V_=new tc(288);for(to=0;to<144;++to)V_[to]=8;for(to=144;to<256;++to)V_[to]=9;for(to=256;to<280;++to)V_[to]=7;for(to=280;to<288;++to)V_[to]=8;var t2=new tc(32);for(to=0;to<32;++to)t2[to]=5;var qM=U_(V_,9),ZM=U_(t2,5),tv=function(n){for(var e=n[0],i=1;i<n.length;++i)n[i]>e&&(e=n[i]);return e},Mu=function(n,e,i){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(7&e)&i},iv=function(n,e){var i=e/8|0;return(n[i]|n[i+1]<<8|n[i+2]<<16)>>(7&e)},$M=function(n){return(n+7)/8|0},XM=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Cu=function(n,e,i){var r=new Error(e||XM[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Cu),!i)throw r;return r},WM=new tc(0),YM=typeof TextDecoder<"u"&&new TextDecoder;try{YM.decode(WM,{stream:!0})}catch{}const KM={gzip_data:"gzip"};class Bc extends Error{constructor(e){super(e),this.name="MRTError"}}const QM={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},i2={uint32:1,uint16:2,uint8:4},JM={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let nv;class hx{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new Bc(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),r=new DataView(e);if(i[0]!==13)throw new Bc("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),r=this.getHeaderLength(e);if(i.length<r)throw new Bc(`Expected header with length >= ${r} but got buffer of length ${i.length}`);const l=new nv(i.subarray(0,r)).readFields(RM,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==l.x||this.y!==l.y||this.z!==l.z))throw new Bc(`Invalid attempt to parse header ${l.z}/${l.x}/${l.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=l.x,this.y=l.y,this.z=l.z;for(const h of l.layers)this.layers[h.name]=new n2(h,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],r=this.getLayer(e.layerName);for(let l of e.blockIndices){const h=r.dataIndex[l],f=h.firstByte-e.firstByte,m=h.lastByte-e.firstByte;if(r._blocksInProgress.has(l))continue;const x={layerName:r.name,firstByte:f,lastByte:m,pixelFormat:r.pixelFormat,blockIndex:l,blockShape:[h.bands.length].concat(r.bandShape),buffer:r.buffer,codec:h.codec.codec,filters:h.filters.map(v=>v.filter)};r._blocksInProgress.add(l),i.push(x)}return new r2(i,()=>{i.forEach(l=>r._blocksInProgress.delete(l.blockIndex))},(l,h)=>{if(i.forEach(f=>r._blocksInProgress.delete(f.blockIndex)),l)throw l;h.forEach(f=>{this.getLayer(f.layerName).processDecodedData(f)})})}}class n2{constructor({version:e,name:i,units:r,tileSize:l,pixelFormat:h,buffer:f,dataIndex:m},x){if(this.version=e,this.version!==1)throw new Bc(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=l,this.buffer=f,this.pixelFormat=QM[h],this.dataIndex=m,this.bandShape=[l+2*f,l+2*f,i2[this.pixelFormat]],this._decodedBlocks=new cx(x?x.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return i2[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[r,l]of this.dataIndex.entries()){for(const[h,f]of l.bands.entries())if(f===e)return{bandIndex:i+h,blockIndex:r,blockBandIndex:h};i+=l.bands.length}break;case"number":for(const[r,l]of this.dataIndex.entries()){if(e>=i&&e<i+l.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-i};i+=l.bands.length}break;default:throw new Bc(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,r=-1/0;const l=[],h=new Set;for(const f of e){const{blockIndex:m}=this.getBlockForBand(f);if(m<0)throw new Bc(`Invalid band: ${JSON.stringify(f)}`);const x=this.dataIndex[m];l.includes(m)||l.push(m),h.add(m),i=Math.min(i,x.firstByte),r=Math.max(r,x.lastByte)}if(h.size>this.cacheSize)throw new Bc(`Number of blocks to decode (${h.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:r,blockIndices:l}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:r}=this.getBlockForBand(e);if(i<0)throw new Bc(`Band not found: ${JSON.stringify(e)}`);const l=this._decodedBlocks.get(i.toString());if(!l)throw new Bc(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const h=this.dataIndex[i],f=this.bandShape.reduce((v,S)=>v*S,1),m=r*f,x=l.subarray(m,m+f);return{data:x,bytes:new Uint8Array(x.buffer).subarray(x.byteOffset,x.byteOffset+x.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:h.offset,scale:h.scale}}}hx.setPbf=function(n){nv=n};class r2{constructor(e,i,r){this.tasks=e,this._onCancel=i,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}hx.performDecoding=function(n,e){const i=new Uint8Array(n);return Promise.all(e.tasks.map(r=>{const{layerName:l,firstByte:h,lastByte:f,pixelFormat:m,blockShape:x,blockIndex:v,filters:S,codec:A}=r,M=i.subarray(h,f+1),R=new Uint32Array(x[0]*x[1]*x[2]);let D;if(A!=="gzip_data")throw new Bc(`Unhandled codec: ${A}`);return D=(function(U,G){if(!globalThis.DecompressionStream&&G==="gzip_data")return Promise.resolve((le=(function(_e){_e[0]==31&&_e[1]==139&&_e[2]==8||Cu(6,"invalid gzip data");var pe=_e[3],be=10;4&pe&&(be+=2+(_e[10]|_e[11]<<8));for(var Me=(pe>>3&1)+(pe>>4&1);Me>0;Me-=!_e[be++]);return be+(2&pe)})(V=U),le+8>V.length&&Cu(6,"invalid gzip data"),(function(_e,pe,be,Me){var Ye=_e.length;if(!Ye||pe.f&&!pe.l)return be||new tc(0);var Ze=!be,We=Ze||pe.i!=2,lt=pe.i;Ze&&(be=new tc(3*Ye));var at=function(Ba){var zh=be.length;if(Ba>zh){var va=new tc(Math.max(2*zh,Ba));va.set(be),be=va}},st=pe.f||0,He=pe.p||0,ht=pe.b||0,tt=pe.l,gt=pe.d,ct=pe.m,qt=pe.n,$t=8*Ye;do{if(!tt){st=Mu(_e,He,1);var kt=Mu(_e,He+1,3);if(He+=3,!kt){var Nt=_e[(sn=$M(He)+4)-4]|_e[sn-3]<<8,ci=sn+Nt;if(ci>Ye){lt&&Cu(0);break}We&&at(ht+Nt),be.set(_e.subarray(sn,ci),ht),pe.b=ht+=Nt,pe.p=He=8*ci,pe.f=st;continue}if(kt==1)tt=qM,gt=ZM,ct=9,qt=5;else if(kt==2){var ii=Mu(_e,He,31)+257,Gt=Mu(_e,He+10,15)+4,Ei=ii+Mu(_e,He+5,31)+1;He+=14;for(var Zi=new tc(Ei),fn=new tc(19),Ui=0;Ui<Gt;++Ui)fn[jM[Ui]]=Mu(_e,He+3*Ui,7);He+=3*Gt;var En=tv(fn),on=(1<<En)-1,Ar=U_(fn,En);for(Ui=0;Ui<Ei;){var sn,Tn=Ar[Mu(_e,He,on)];if(He+=15&Tn,(sn=Tn>>4)<16)Zi[Ui++]=sn;else{var $n=0,tr=0;for(sn==16?(tr=3+Mu(_e,He,3),He+=2,$n=Zi[Ui-1]):sn==17?(tr=3+Mu(_e,He,7),He+=3):sn==18&&(tr=11+Mu(_e,He,127),He+=7);tr--;)Zi[Ui++]=$n}}var ir=Zi.subarray(0,ii),Mr=Zi.subarray(ii);ct=tv(ir),qt=tv(Mr),tt=U_(ir,ct),gt=U_(Mr,qt)}else Cu(1);if(He>$t){lt&&Cu(0);break}}We&&at(ht+131072);for(var zo=(1<<ct)-1,ra=(1<<qt)-1,$r=He;;$r=He){var io=($n=tt[iv(_e,He)&zo])>>4;if((He+=15&$n)>$t){lt&&Cu(0);break}if($n||Cu(2),io<256)be[ht++]=io;else{if(io==256){$r=He,tt=null;break}var fo=io-254;io>264&&(fo=Mu(_e,He,(1<<(fr=Ww[Ui=io-257]))-1)+Jw[Ui],He+=fr);var Ni=gt[iv(_e,He)&ra],nr=Ni>>4;if(Ni||Cu(3),He+=15&Ni,Mr=HM[nr],nr>3){var fr=Yw[nr];Mr+=iv(_e,He)&(1<<fr)-1,He+=fr}if(He>$t){lt&&Cu(0);break}We&&at(ht+131072);var Xs=ht+fo;if(ht<Mr){var Oa=0-Mr,Do=Math.min(Mr,Xs);for(Oa+ht<0&&Cu(3);ht<Do;++ht)be[ht]=Me[Oa+ht]}for(;ht<Xs;++ht)be[ht]=be[ht-Mr]}}pe.l=tt,pe.p=$r,pe.b=ht,pe.f=st,tt&&(st=1,pe.m=ct,pe.d=gt,pe.n=qt)}while(!st);return ht!=be.length&&Ze?(function(Ba,zh,va){return(va==null||va>Ba.length)&&(va=Ba.length),new tc(Ba.subarray(0,va))})(be,0,ht):be.subarray(0,ht)})(V.subarray(le,-8),{i:2},new tc(((Y=V)[(Q=Y.length)-4]|Y[Q-3]<<8|Y[Q-2]<<16|Y[Q-1]<<24)>>>0),Z)));var V,Z,Y,Q,le;const ae=KM[G];if(!ae)throw new Error(`Unhandled codec: ${G}`);const ge=new globalThis.DecompressionStream(ae);return new Response(new Blob([U]).stream().pipeThrough(ge)).arrayBuffer().then(_e=>new Uint8Array(_e))})(M,A).then(U=>((function(G,V){G.readFields(BM,V)})(new nv(U),R),new JM[m](R.buffer))),D.then(U=>{for(let G=S.length-1;G>=0;G--)switch(S[G]){case"delta_filter":FM(U,x);break;case"zigzag_filter":NM(U);break;case"bitshuffle_filter":UM(U,m);break;default:throw new Bc(`Unhandled filter "${S[G]}"`)}return{layerName:l,blockIndex:v,data:U}}).catch(U=>{throw U})}))},zt(r2,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),zt(hx,"MapboxRasterTile"),zt(n2,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class o2{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const r=e[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class a2{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new dl(Lt,16,0),this.featureIndexArray=new Wl,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,r,l,h,f=0,m=0){const x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,l,h,f);const v=this.grid;for(let S=0;S<i.length;S++){const A=i[S],M=[1/0,1/0,-1/0,-1/0];for(let R=0;R<A.length;R++){const D=A[R];M[0]=Math.min(M[0],D.x),M[1]=Math.min(M[1],D.y),M[2]=Math.max(M[2],D.x),M[3]=Math.max(M[3],D.y)}m!==0&&(M[0]-=m,M[1]-=m,M[2]+=m,M[3]+=m),M[0]<Lt&&M[1]<Lt&&M[2]>=0&&M[3]>=0&&v.insert(x,M[0],M[1],M[2],M[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new tn(new jy(this.rawTileData)).layers,this.sourceLayerCoder=new o2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:r,transform:l,tileTransform:h,pixelPosMatrix:f,availableImages:m,worldview:x}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const v=i.queryRadius?i.queryRadius:0,S=r.bufferedTilespaceBounds,A=this.grid.query(S.min.x,S.min.y,S.max.x,S.max.y,(U,G,V,Z)=>Xa(r.bufferedTilespaceGeometry,U-v,G-v,V+v,Z+v));A.sort(eC);let M=null;l.elevation&&A.length>0&&(M=xg.create(l.elevation,this.tileID));const R={};let D;for(let U=0;U<A.length;U++){const G=A[U];if(G===D)continue;D=G;const V=this.featureIndexArray.get(G);let Z=null;this.is3DTile?this.loadMatchingModelFeature(R,V,e,r,l,x):this.loadMatchingFeature(R,V,e,m,x,(Y,Q,le,ae=0)=>(Z||(Z=fi(Y,this.tileID.canonical,h)),Q.queryIntersectsFeature(r,Y,le,Z,this.z,l,f,M,ae,i.scope)))}return R}loadMatchingFeature(e,i,r,l,h,f){const{featureIndex:m,bucketIndex:x,sourceLayerIndex:v,layoutVertexArrayOffset:S}=i,A=this.bucketLayerIDs[x],M=r.layers,R=Object.keys(M);if(R.length&&!Li(R,A))return;const D=r.sourceCache,U=this.sourceLayerCoder.decode(v),G=this.vtLayers[U].feature(m),V=this.getId(G,U);for(let Z=0;Z<A.length;Z++){const Y=A[Z];if(!M[Y])continue;const{styleLayer:Q,targets:le}=M[Y];let ae={};V!==void 0&&(ae=D.getFeatureState(Q.sourceLayer,V));const ge=!f||f(G,Q,ae,S);if(!ge)continue;const _e=new vm(G,this.z,this.x,this.y,V);_e.tile=this.tileID.canonical,_e.state=ae;let pe=this.serializedLayersCache.get(Y);pe||(pe=Q.serialize(),pe.id=Y,this.serializedLayersCache.set(Y,pe)),_e.source=pe.source,_e.sourceLayer=pe["source-layer"],_e.layer=Object.assign({},pe),_e.layer.paint=s2(pe.paint,Q.paint,G,ae,l),_e.layer.layout=s2(pe.layout,Q.layout,G,ae,l);let be=!1;for(const Me of le){this.updateFeatureProperties(_e,Me);const{filter:Ye}=Me;if(Ye){if(G.properties=_e.properties,Ye.needGeometry){const Ze=Ri(G,!0);if(!Ye.filter(new mn(this.tileID.overscaledZ,{worldview:h}),Ze,this.tileID.canonical))continue}else if(!Ye.filter(new mn(this.tileID.overscaledZ,{worldview:h}),G))continue}be=!0,Me.targetId&&this.addFeatureVariant(_e,Me)}be&&this.appendToResult(e,Y,m,_e,ge)}}
218loadMatchingModelFeature(e,i,r,l,h,f){const{featureIndex:m,bucketIndex:x}=i,v=this.bucketLayerIDs[x],S=r.layers,A=Object.keys(S);if(!A.length||Li(A,v))for(let M=0;M<v.length;M++){const R=v[M],{styleLayer:D,targets:U}=S[R];if(D.type!=="model")continue;const G=l.tile,V=G.getBucket(D);if(!(V&&V instanceof ox))continue;const Z=sM(V,m,l,h);if(!Z)continue;const{z:Y,x:Q,y:le}=G.tileID.canonical,{feature:ae,intersectionZ:ge,position:_e}=Z;let pe={};ae.id!==void 0&&(pe=r.sourceCache.getFeatureState(D.sourceLayer,ae.id));const be=new vm({},Y,Q,le,ae.id);be.tile=this.tileID.canonical,be.state=pe,be.properties=ae.properties,be.geometry={type:"Point",coordinates:[_e.lng,_e.lat]};let Me=this.serializedLayersCache.get(R);Me||(Me=D.serialize(),Me.id=R,this.serializedLayersCache.set(R,Me)),be.source=Me.source,be.sourceLayer=Me["source-layer"],be.layer=Object.assign({},Me);let Ye=!1;for(const Ze of U){this.updateFeatureProperties(be,Ze);const{filter:We}=Ze;if(We){if(ae.properties=be.properties,We.needGeometry){if(!We.filter(new mn(this.tileID.overscaledZ,{worldview:f}),ae,this.tileID.canonical))continue}else if(!We.filter(new mn(this.tileID.overscaledZ,{worldview:f}),ae))continue}Ye=!0,Ze.targetId&&this.addFeatureVariant(be,Ze)}Ye&&this.appendToResult(e,R,m,be,ge)}}updateFeatureProperties(e,i,r){if(i.properties){const l={};for(const h in i.properties){const f=i.properties[h].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,r);f!=null&&(l[h]=f)}e.properties=l}}addFeatureVariant(e,i,r){const l={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(l.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(l)}appendToResult(e,i,r,l,h){let f=e[i];f===void 0&&(f=e[i]=[]),f.push({featureIndex:r,feature:l,intersectionZ:h})}lookupSymbolFeatures(e,i,r,l,h,f){const m={};this.loadVTLayers();for(const x of e)this.loadMatchingFeature(m,{bucketIndex:i,sourceLayerIndex:r,featureIndex:x,layoutVertexArrayOffset:0},l,h,f);return m}loadFeature(e){const{featureIndex:i,sourceLayerIndex:r}=e;this.loadVTLayers();const l=this.sourceLayerCoder.decode(r),h=this.vtFeatures[l];if(h[i])return h[i];const f=this.vtLayers[l].feature(i);return h[i]=f,f}hasLayer(e){for(const i of this.bucketLayerIDs)for(const r of i)if(e===r)return!0;return!1}getId(e,i){let r=e.id;if(this.promoteId){const l=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(l!=null)if(Array.isArray(l)){if(!this.promoteIdExpression){const h=hl(l);if(h.result!=="success"){const f=h.value.map(m=>`${m.key}: ${m.message}`).join(", ");return void vi(`Failed to create expression for promoteId: ${f}`)}this.promoteIdExpression=h.value}r=this.promoteIdExpression.evaluate({zoom:0},e)}else r=e.properties[l];typeof r=="boolean"&&(r=Number(r))}return r}}function s2(n,e,i,r,l){return ri(n,(h,f)=>{const m=e instanceof qo?e.get(f):null;return m&&m.evaluate?m.evaluate(i,r,void 0,l):m})}function eC(n,e){return e-n}zt(a2,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const l2=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class rv{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,r]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=r>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const h=l2[15&r];if(!h)throw new Error("Unrecognized array type.");const[f]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new rv(m,f,h,e)}constructor(e,i=64,r=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const h=l2.indexOf(this.ArrayType),f=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-m%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${r}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+x,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+f+m+x),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+x,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=i,r}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ov(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,r,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:f,nodeSize:m}=this,x=[0,h.length-1,0],v=[];for(;x.length;){const S=x.pop()||0,A=x.pop()||0,M=x.pop()||0;if(A-M<=m){for(let G=M;G<=A;G++){const V=f[2*G],Z=f[2*G+1];V>=e&&V<=r&&Z>=i&&Z<=l&&v.push(h[G])}continue}const R=M+A>>1,D=f[2*R],U=f[2*R+1];D>=e&&D<=r&&U>=i&&U<=l&&v.push(h[R]),(S===0?e<=D:i<=U)&&(x.push(M),x.push(R-1),x.push(1-S)),(S===0?r>=D:l>=U)&&(x.push(R+1),x.push(A),x.push(1-S))}return v}within(e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:f}=this,m=[0,l.length-1,0],x=[],v=r*r;for(;m.length;){const S=m.pop()||0,A=m.pop()||0,M=m.pop()||0;if(A-M<=f){for(let G=M;G<=A;G++)u2(h[2*G],h[2*G+1],e,i)<=v&&x.push(l[G]);continue}const R=M+A>>1,D=h[2*R],U=h[2*R+1];u2(D,U,e,i)<=v&&x.push(l[R]),(S===0?e-r<=D:i-r<=U)&&(m.push(M),m.push(R-1),m.push(1-S)),(S===0?e+r>=D:i+r>=U)&&(m.push(R+1),m.push(A),m.push(1-S))}return x}}function ov(n,e,i,r,l,h){if(l-r<=i)return;const f=r+l>>1;c2(n,e,f,r,l,h),ov(n,e,i,r,f-1,1-h),ov(n,e,i,f+1,l,1-h)}function c2(n,e,i,r,l,h){for(;l>r;){if(l-r>600){const v=l-r+1,S=i-r+1,A=Math.log(v),M=.5*Math.exp(2*A/3),R=.5*Math.sqrt(A*M*(v-M)/v)*(S-v/2<0?-1:1);c2(n,e,i,Math.max(r,Math.floor(i-S*M/v+R)),Math.min(l,Math.floor(i+(v-S)*M/v+R)),h)}const f=e[2*i+h];let m=r,x=l;for(j_(n,e,r,i),e[2*l+h]>f&&j_(n,e,r,l);
vendor: 26,404 bytes, line 218
218m<x;){for(j_(n,e,m,x),m++,x--;e[2*m+h]<f;)m++;for(;e[2*x+h]>f;)x--}e[2*r+h]===f?j_(n,e,r,x):(x++,j_(n,e,x,l)),x<=i&&(r=x+1),i<=x&&(l=x-1)}}function j_(n,e,i,r){av(n,i,r),av(e,2*i,2*r),av(e,2*i+1,2*r+1)}function av(n,e,i){const r=n[e];n[e]=n[i],n[i]=r}function u2(n,e,i,r){const l=n-i,h=e-r;return l*l+h*h}a.$=tf,a.A=so,a.B=ks,a.C=2,a.D=sg,a.E=Il,a.F=E_,a.G=Pb,a.H=ju,a.I=No,a.J=Lp,a.K=yi,a.L=di,a.M=eu,a.N=oh,a.O=Hl,a.P=_t,a.Q=ru,a.R=Nr,a.S=Mf,a.T=p0,a.U=hl,a.V=rx,a.W=Ls,a.X=sr,a.Y=Yc,a.Z=Qr,a._=ua,a.a=function(n){return Fr.API_CDN_URL_REGEX.test(n)},a.a$=ot,a.a0=Gu,a.a1=Mm,a.a2=vd,a.a3=class extends rx{},a.a4=ah,a.a5=ul,a.a6=Oe,a.a7=function(n){const e=n.value;return e?Gu(e)?$0(e,!0)?[]:[new rx(n.key,e,`invalid url "${e}"`)]:[new rx(n.key,e,`string expected, "${yi(e)}" found`)]:[]},a.a8=ch,a.a9=qn,a.aA=he,a.aB=pt,a.aC=Bo,a.aD=q,a.aE=ya,a.aF=Re,a.aG=At,a.aH=function(n,e){const i={};for(let r=0;r<e.length;r++){const l=e[r];l in n&&(i[l]=n[l])}return i},a.aI=Te,a.aJ=Be,a.aK=class{constructor(n){this.entries={},this.scheduler=n}request(n,e,i,r){const l=this.entries[n]=this.entries[n]||{callbacks:[]};if(l.result){const[h,f]=l.result;return this.scheduler?this.scheduler.add(()=>{r(h,f)},e):r(h,f),()=>{}}return l.callbacks.push(r),l.cancel||(l.cancel=i((h,f)=>{l.result=[h,f];for(const m of l.callbacks)this.scheduler?this.scheduler.add(()=>{m(h,f)},e):m(h,f);setTimeout(()=>delete this.entries[n],3e3)})),()=>{l.result||(l.callbacks=l.callbacks.filter(h=>h!==r),l.callbacks.length||(l.cancel(),delete this.entries[n]))}}},a.aL=function(n,e,i){const r=JSON.stringify(n.request);return n.data&&(this.deduped.entries[r]={result:[null,n.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:n.isSymbolTile,zoom:n.tileZoom},l=>{const h=Uc(n.request,(f,m,x)=>{f?l(f):m&&l(null,{rawData:m,vectorTile:i?void 0:new tn(new jy(m)),responseHeaders:new Map(x.entries())})});return()=>{h.cancel(),l()}},e)},a.aM=function(n){return n?{cacheControl:n.get("Cache-Control"),expires:n.get("Expires")}:{cacheControl:void 0,expires:void 0}},a.aN=Nc,a.aO=function(n){ss++,ss>Xd&&(n.getActor().send("enforceCacheSizeLimit",lp),ss=0)},a.aP=function(n){return n<=1?1:Math.pow(2,Math.floor(Math.log2(n)))},a.aQ=_o,a.aR=dw,a.aS=yw,a.aT=se,a.aU=hw,a.aV=function(n,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let r=0;r<n.length;r++){const l=document.createElement("source");Wd(n[r])||(i.crossOrigin="Anonymous"),l.src=n[r],i.appendChild(l)}return{cancel:()=>{}}},a.aW=v_,a.aX=bm,a.aY=Zt,a.aZ=C_,a.a_=$e,a.aa=It,a.ab=class{constructor(n){this.specification=n}possiblyEvaluate(n,e){return jn(n.expression.evaluate(e))}interpolate(n,e,i){return{x:mi(n.x,e.x,i),y:mi(n.y,e.y,i),z:mi(n.z,e.z,i),azimuthal:mi(n.azimuthal,e.azimuthal,i),polar:mi(n.polar,e.polar,i)}}},a.ac=mn,a.ad=Io,a.ae=Bt,a.af=Nn,a.ag=Si,a.ah=Ie,a.ai=qo,a.aj=wu,a.ak=mi,a.al=Lt,a.am=fp,a.an=Ki,a.ao=pn,a.ap=class{constructor(n){this.specification=n}possiblyEvaluate(n,e){return(function([i,r]){const l=jn([1,i,r]);return{x:l.x,y:l.y,z:l.z}})(n.expression.evaluate(e))}interpolate(n,e,i){return{x:mi(n.x,e.x,i),y:mi(n.y,e.y,i),z:mi(n.z,e.z,i)}}},a.aq=function(n,e,i=0,r=!0){const l=new _t(i,i),h=n.sub(l),f=e.add(l),m=[h,new _t(f.x,h.y),f,new _t(h.x,f.y)];return r&&m.push(h.clone()),m},a.ar=function(n,e){const i=[];for(let r=0;r<n.length;r++){const l=Ge(r-1,-1,n.length-1),h=Ge(r+1,-1,n.length-1),f=n[r],m=n[h],x=n[l].sub(f).unit(),v=m.sub(f).unit(),S=v.angleWithSep(x.x,x.y),A=x.add(v).unit().mult(-1*e/Math.sin(S/2));i.push(f.add(A))}return i},a.as=Yb,a.at=Xa,a.au=function(n,e,i=0){return je(((e.x-i)*n.scale-n.x)*Lt,(e.y*n.scale-n.y)*Lt,Fe(e.z,e.y))},a.av=rr,a.aw=xi,a.ax=Mn,a.ay=lb,a.az=function(n){let e=1/0,i=1/0,r=-1/0,l=-1/0;for(const h of n)e=Math.min(e,h.x),i=Math.min(i,h.y),r=Math.max(r,h.x),l=Math.max(l,h.y);return{min:new _t(e,i),max:new _t(r,l)}},a.b=function(n){return Fr.API_FONTS_REGEX.test(n)},a.b$=O,a.b0=Lr,a.b1=ml,a.b2=Mt,a.b3=Lf,a.b4=ex,a.b5=function(){Ia.isLoading()||Ia.isLoaded()||Sc()!=="deferred"||Ef()},a.b6=Cf,a.b7=Ri,a.b8=vm,a.b9=Un,a.bA=Je,a.bB=rt,a.bC=ft,a.bD=function(n,e){const{x:i,y:r}=n.point,l=$m(i,r,n.worldSize/n._pixelsPerMercatorPixel,0,0);return pt(l,l,On(Jl(e)))},a.bE=Ee,a.bF=Qa,a.bG=ui,a.bH=Ht,a.bI=Xn,a.bJ=ln,a.bK=pg,a.bL=$s,a.bM=z0,a.bN=function(n,e,i,r,l){const h=5*e+2;n.float32[h+0]=i,n.float32[h+1]=r,n.float32[h+2]=l},a.bO=yg,a.bP=Dr,a.bQ=ka,a.bR=is,a.bS=kr,a.bT=Ge,a.bU=function(n,e,i,r){var l=new re(4);return l[0]=n,l[1]=e,l[2]=i,l[3]=r,l},a.bV=class{isDataAvailableAtPoint(n){const e=this._source();if(this.isUsingMockSource()||!e||n.y<0||n.y>1)return!1;const i=e.getSource().maxzoom,r=1<<i,l=Math.floor(n.x),h=Math.floor((n.x-l)*r),f=Math.floor(n.y*r),m=this.findDEMTileFor(new _o(i,l,i,h,f));return!(!m||!m.dem)}getAtPointOrZero(n,e=0){return this.getAtPoint(n,e)||0}getAtPoint(n,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const r=this._source();if(!r||n.y<0||n.y>1)return e;const l=r.getSource().maxzoom,h=1<<l,f=Math.floor(n.x),m=n.x-f,x=new _o(l,f,l,Math.floor(m*h),Math.floor(n.y*h)),v=this.findDEMTileFor(x);if(!v||!v.dem)return e;const S=v.dem,A=1<<v.tileID.canonical.z,M=(m*A-v.tileID.canonical.x)*S.dim,R=(n.y*A-v.tileID.canonical.y)*S.dim,D=Math.floor(M),U=Math.floor(R);return(i?this.exaggeration():1)*mi(mi(S.get(D,U),S.get(D,U+1),R-U),mi(S.get(D+1,U),S.get(D+1,U+1),R-U),M-D)}static getAtTileOffset(n,e,i,r){const l=1<<n.canonical.z;return r?r.pointElevation(e):i?i.getAtPointOrZero(new Bt(n.wrap+(n.canonical.x+e.x/Lt)/l,(n.canonical.y+e.y/Lt)/l)):0}static getAtTileOffsetFunc(n,e,i,r){return(l,h,f)=>{const m=this.getAtTileOffset(n,l,h,f),x=r.upVector(n.canonical,l.x,l.y);return bt(x,x,m*r.upVectorScale(n.canonical,e,i).metersToTile),x}}getForTilePoints(n,e,i,r){if(this.isUsingMockSource())return!1;const l=xg.create(this,n,r);return!!l&&(e.forEach(h=>{h[2]=this.exaggeration()*l.getElevationAt(h[0],h[1],i)}),!0)}getMinMaxForTile(n){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(n);if(!e||!e.dem)return null;const i=e.dem.tree,r=e.tileID,l=1<<n.canonical.z-r.canonical.z;let h=n.canonical.x/l-r.canonical.x,f=n.canonical.y/l-r.canonical.y,m=0;for(let x=0;x<n.canonical.z-r.canonical.z&&!i.leaves[m];x++){h*=2,f*=2;const v=2*Math.floor(f)+Math.floor(h);m=i.childOffsets[m]+v,h%=1,f%=1}return{min:this.exaggeration()*i.minimums[m],max:this.exaggeration()*i.maximums[m]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(n,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(n){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(n){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const n=this.visibleDemTiles;if(n.length===0)return null;let e=!1,i=Number.MAX_VALUE,r=Number.MIN_VALUE;for(const l of n){const h=this.getMinMaxForTile(l.tileID);h&&(i=Math.min(i,h.min),r=Math.max(r,h.max),e=!0)}return e?{min:i,max:r}:null}},a.bW=zy,a.bX=Zn,a.bY=yo,a.bZ=hm,a.b_=xw,a.ba=T0,a.bb=Oc,a.bc=fi,a.bd=Xl,a.be=_h,a.bf=qg,a.bg=kn,a.bh=qs,a.bi=H0,a.bj=function(n,e){const i=wu(e.zoom);if(i===0)return Jl(n);const r=Nf(n),l=$g(r),h=Re(r.getWest())*e.worldSize,f=Re(r.getEast())*e.worldSize,m=Be(r.getNorth())*e.worldSize,x=Be(r.getSouth())*e.worldSize,v=[h,m,0],S=[f,m,0],A=[h,x,0],M=[f,x,0],R=mt([],e.globeMatrix);return Nn(v,v,R),Nn(S,S,R),Nn(A,A,R),Nn(M,M,R),l[0]=zc(l[0],A,i),l[1]=zc(l[1],M,i),l[2]=zc(l[2],S,i),l[3]=zc(l[3],v,i),hn.fromPoints(l)},a.bk=Yp,a.bl=mt,a.bm=Wp,a.bn=zc,a.bo=Fs,a.bp=$x,a.bq=wt,a.br=dt,a.bs=hx,a.bt=jy,a.bu=Uc,a.bv=function(n,e){const i=[];for(const r in n)r in e||i.push(r);return i},a.bw=Pe,a.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.by=aa,a.bz=Ne,a.c=Eo,a.c$=function(n,e,i){let r=0;for(let l=0;l<2;++l)n[l]>0&&(r+=(n[l]-0)*(n[l]-0)),e[l]<0&&(r+=(0-e[l])*(0-e[l]));return r},a.c0=J,a.c1=C0,a.c2=Vb,a.c3=B0,a.c4=rv,a.c5=bt,a.c6=Ja,a.c7=ts,a.c8=function(n,e,i){i*=.5;var r=e[0],l=e[1],h=e[2],f=e[3],m=Math.sin(i),x=Math.cos(i);return n[0]=r*x+l*m,n[1]=l*x-r*m,n[2]=h*x+f*m,n[3]=f*x-h*m,n},a.c9=Sa,a.cA=Vt,a.cB=Zr,a.cC=$1,a.cD=yl,a.cE=Zm,a.cF=function(n,e,i,r,l,h,f,m,x){if(x.name==="globe")return Zm(n,e,new yl(i,r,l),!1);const v=C_({z:i,x:r,y:l},x);return new hn([(h+v.x/v.scale)*e,e*(v.y/v.scale),f],[(h+v.x2/v.scale)*e,e*(v.y2/v.scale),m])},a.cG=function(n,e,i){return n[0]=Math.min(e[0],i[0]),n[1]=Math.min(e[1],i[1]),n[2]=Math.min(e[2],i[2]),n[3]=Math.min(e[3],i[3]),n},a.cH=function(n,e,i){return n[0]=Math.max(e[0],i[0]),n[1]=Math.max(e[1],i[1]),n[2]=Math.max(e[2],i[2]),n[3]=Math.max(e[3],i[3]),n},a.cI=function(n){const e=Math.round((n+45+360)%360/90)%4;return $[e]},a.cJ=Se,a.cK=Wr,a.cL=6,a.cM=function(n){const e=Je(new Float64Array(16));pt(e,n.pixelMatrix,n.globeMatrix);const i=[0,ie,0],r=[0,ee,0];return Nn(i,i,e),Nn(r,r,e),[i[0]>0&&i[0]<=n.width&&i[1]>0&&i[1]<=n.height&&!Ld(n,new se(n.center.lat,90)),r[0]>0&&r[0]<=n.width&&r[1]>0&&r[1]<=n.height&&!Ld(n,new se(n.center.lat,-90))]},a.cN=function(n,e){const{scale:i}=n.tileTransform,r=i*Lt/(n.tileSize*Math.pow(2,e.zoom-n.tileID.overscaledZ+n.tileID.canonical.z));return(function(l,h,f){var m=h[1],x=h[2],v=h[3],S=f[0],A=f[1];return l[0]=h[0]*S,l[1]=m*S,l[2]=x*A,l[3]=v*A,l})(new Float32Array(4),e.inverseAdjustmentMatrix,[r,r])},a.cO=By,a.cP=ai,a.cQ=Z1,a.cR=function(n){const e=Z1(n,!0);return Ee([],[e[0],e[1],e[4],e[5]])},a.cS=nt,a.cT=Jn,a.cU=vt,a.cV=function(n){const{x:e,y:i}=n.point,{lng:r,lat:l}=n._center;return $m(e,i,n.worldSize,r,l)},a.cW=ei,a.cX=De,a.cY=Th,a.cZ=Hs,a.c_=5,a.ca=Hn,a.cb=function(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n},a.cc=Bi,a.cd=function(n,e,i,r,l){var h=1/Math.tan(e/2);if(n[0]=h/i,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=h,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,l!=null&&l!==1/0){var f=1/(r-l);n[10]=(l+r)*f,n[14]=2*l*r*f}else n[10]=-1,n[14]=-2*r;return n},a.ce=function(n,e,i,r,l,h,f){var m=1/(e-i),x=1/(r-l),v=1/(h-f);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*x,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*v,n[11]=0,n[12]=(e+i)*m,n[13]=(l+r)*x,n[14]=(f+h)*v,n[15]=1,n},a.cf=Le,a.cg=function(n,e,i){n[4*e+0]=i[0],n[4*e+1]=i[1],n[4*e+2]=i[2],n[4*e+3]=i[3]},a.ch=ur,a.ci=bh,a.cj=Rr,a.ck=Da,a.cl=xu,a.cm=tw,a.cn=function(){var n=new re(4);return re!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n},a.co=function(n,e,i){var r=e[0],l=e[1],h=e[2],f=e[3],m=Math.sin(i),x=Math.cos(i);return n[0]=r*x+h*m,n[1]=l*x+f*m,n[2]=r*-m+h*x,n[3]=l*-m+f*x,n},a.cp=function(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]&&n[3]===e[3]},a.cq=Oo,a.cr=function(n){var e=n[0],i=n[1],r=n[2],l=n[3];return Math.sqrt(e*e+i*i+r*r+l*l)},a.cs=ws,a.ct=Ka,a.cu=qm,a.cv=3,a.cw=2,a.cx=7,a.cy=6,a.cz=Or,a.d=function(n){return Fr.API_TILEJSON_REGEX.test(n)},a.d$=class{constructor(n,e,i,r){this.context=n,this.format=r,this.size=i,this.texture=n.gl.createTexture();const[l,h,f]=this.size,{gl:m}=n;m.bindTexture(m.TEXTURE_3D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&m.texImage3D(m.TEXTURE_3D,0,this.format,l,h,f,0,d0(this.format),f0(this.format),e.data)}bind(n,e){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_3D,this.texture),n!==this.minFilter&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MAG_FILTER,n),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MIN_FILTER,n),this.minFilter=n),e!==this.wrapS&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:n}=this.context;n.deleteTexture(this.texture),this.texture=null}},a.d0=function(n){return n*n*n*n*n},a.d1=Ae,a.d2=45,a.d3=Tr,a.d4=function(n,e,i){const r=Math.sqrt(n*n+e*e+i*i),l=r>0?Math.acos(i/r)*So:0;let h=n!==0||e!==0?Math.atan2(-e,-n)*So+90:0;return h<0&&(h+=360),[r,h,l]},a.d5=je,a.d6=jn,a.d7=Et,a.d8=Tt,a.d9=hn,a.dA=function(n){return n({pluginStatus:Ho,pluginURL:$l}),Sf.on("pluginStateChange",n),n},a.dB=ma,a.dC=class extends gs{constructor(n){super(n),this.current=Gg}set(n,e,i){if(this.fetchUniformLocation(n,e)){for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},a.dD=K,a.dE=function(n,e,i){const r=wu(i.zoom),l=n.style.map._antialias,h=n.terrain&&n.terrain.exaggeration()>0;return r===0&&!l&&!h},a.dF=function(n){const e=n.pixelsPerMeter,i=e/Le(1,n.center.lat),r=Je(new Float64Array(16));return dt(r,r,[n.point.x,n.point.y,0]),nt(r,r,[i,i,e]),Float32Array.from(r)},a.dG=Nf,a.dH=function(n){const e=80.051129;n=he(n,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(Ki(n))),3);return Math.round(i*(ne.length-1))},a.dI=function(n,e,i,r){const l=e.getNorth(),h=e.getSouth(),f=e.getWest(),m=e.getEast(),x=1<<n.z,v=m-f,S=l-h,A=v/W,M=-S/ne[i],R=[0,A,0,M,0,0,l,f,0];if(n.z>0){const D=180/r;Qe(R,R,[D/v+1,0,0,0,D/S+1,0,-.5*D/A,.5*D/M,1])}return R[2]=x,R[5]=n.x,R[8]=n.y,R},a.dJ=Jl,a.dK=function(n,e,i){const r=Je(new Float64Array(16)),l=(e/(1<<n)-.5)*Math.PI*2;return ut(r,i.globeMatrix,l),Float32Array.from(r)},a.dL=hy,a.dM=$p,a.dN=function(n,e){return[Math.pow(n[0],2.2)*e,Math.pow(n[1],2.2)*e,Math.pow(n[2],2.2)*e]},a.dO=oe,a.dP=function(n,e){var i=Math.sin(e),r=Math.cos(e);return n[0]=r,n[1]=i,n[2]=0,n[3]=-i,n[4]=r,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},a.dQ=bo,a.dR=Qp,a.dS=zn,a.dT=ar,a.dU=q0,a.dV=function(n,e){const i=[0,0,0];return Nn(i,i,Yp(Jl(e.canonical))),Nn(i,i,n),i},a.dW=n=>({u_matrix:new xu(n),u_texsize:new Da(n),u_pixels_to_tile_units:new t(n),u_device_pixel_ratio:new Rr(n),u_width_scale:new Rr(n),u_floor_width_scale:new Rr(n),u_image:new ur(n),u_units_to_pixels:new Da(n),u_tile_units_to_pixels:new Rr(n),u_alpha_discard_threshold:new Rr(n),u_trim_offset:new Da(n),u_trim_fade_range:new Da(n),u_trim_gradient_mix_range:new Da(n),u_trim_color:new Tr(n),u_zbias_factor:new Rr(n),u_tile_to_meter:new Rr(n),u_ground_shadow_factor:new bh(n),u_pattern_transition:new Rr(n)}),a.dX=n=>({u_matrix:new xu(n),u_pixels_to_tile_units:new t(n),u_device_pixel_ratio:new Rr(n),u_width_scale:new Rr(n),u_floor_width_scale:new Rr(n),u_units_to_pixels:new Da(n),u_dash_image:new ur(n),u_gradient_image:new ur(n),u_image_height:new Rr(n),u_texsize:new Da(n),u_tile_units_to_pixels:new Rr(n),u_alpha_discard_threshold:new Rr(n),u_trim_offset:new Da(n),u_trim_fade_range:new Da(n),u_trim_gradient_mix_range:new Da(n),u_trim_color:new Tr(n),u_zbias_factor:new Rr(n),u_tile_to_meter:new Rr(n),u_ground_shadow_factor:new bh(n)}),a.dY=n=>({u_camera_to_center_distance:new Rr(n),u_extrude_scale:new t(n),u_device_pixel_ratio:new Rr(n),u_matrix:new xu(n),u_inv_rot_matrix:new xu(n),u_merc_center:new Da(n),u_tile_id:new bh(n),u_zoom_transition:new Rr(n),u_up_dir:new bh(n),u_emissive_strength:new Rr(n)}),a.dZ=Cd,a.d_=hA,a.da=_i,a.db=function(n){return[Math.pow(n[0],1/2.2),Math.pow(n[1],1/2.2),Math.pow(n[2],1/2.2)]},a.dc=q1,a.dd=v0,a.de=Y1,a.df=$0,a.dg=function(n,e){return n.readFields(cM,{icons:[]},e)},a.dh=Dy,a.di=mg,a.dj=P0,a.dk=Ml,a.dl=Rp,a.dm=Js,a.dn=el,a.dp=Mi,a.dq=function(n){const e=n.indexOf(hh);return e>=0?n.slice(0,e):n},a.dr=function(n){return n.indexOf(hh)>=0},a.ds=function(n){const e=n.lastIndexOf(hh);return e>=0?n.slice(e+1):""},a.dt=function(n){const e=[],i=n.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),n.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},a.du=function(n,e,i,r){return n.type==="custom"?new nM(n,e):new lM[n.type](n,e,i,r)},a.dv=li,a.dw=function(n){const e=n.indexOf(hh);return e>=0?n.slice(e+1):""},a.dx=class extends vm{constructor(n,e){super(n._vectorTileFeature,n._z,n._x,n._y,n.id),n.state&&(this.state=Object.assign({},n.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=n.source,this.sourceLayer=n.sourceLayer,this.layer=n.layer)}toJSON(){const n=super.toJSON();return n.target=this.target,n.namespace=this.namespace,n}},a.dy=Sf,a.dz=Ko,a.e=Fr,a.e$=St,a.e0=sy,a.e1=(n,e,i,r,l,h)=>{const f=n.transform,m=f.projection.name==="globe";let x;if(h.paint.get("circle-pitch-alignment")==="map")if(m){const S=Qp(f.zoom,e.canonical)*f._pixelsPerMercatorPixel;x=Float32Array.from([S,0,0,S])}else x=f.calculatePixelsToTileUnitsMatrix(i);else x=new Float32Array([f.pixelsToGLUnits[0],0,0,f.pixelsToGLUnits[1]]);const v={u_camera_to_center_distance:n.transform.getCameraToCenterDistance(f.projection),u_matrix:n.translatePosMatrix(e.projMatrix,i,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Ea.devicePixelRatio,u_extrude_scale:x,u_inv_rot_matrix:Yx,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:h.paint.get("circle-emissive-strength")};if(m){v.u_inv_rot_matrix=r,v.u_merc_center=l,v.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],v.u_zoom_transition=wu(f.zoom);const S=l[0]*Lt,A=l[1]*Lt;v.u_up_dir=f.projection.upVector(new yl(0,0,0),S,A)}return v},a.e2=db,a.e3=ca,a.e4=(n,e,i,r,l,h,f,m,x,v)=>{const S=n.transform,A=S.pitch<15?cb(.07,.7,he((14-S.zoom)/5,0,1)):.07,M=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:hb(n,e,i,r),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:S.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:l,u_width_scale:h,u_floor_width_scale:f,u_image:0,u_tile_units_to_pixels:ub(e,S),u_units_to_pixels:[1/S.pixelsToGLUnits[0],1/S.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:m,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(M?null:i.lut).toArray01(),u_zbias_factor:A,u_tile_to_meter:Et(e.tileID.canonical,0),u_ground_shadow_factor:x,u_pattern_transition:v}},a.e5=(n,e,i,r,l,h,f,m,x,v)=>{const S=n.transform,A=S.calculatePixelsToTileUnitsMatrix(e),M=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",R=S.pitch<15?cb(.07,.7,he((14-S.zoom)/5,0,1)):.07;return{u_matrix:hb(n,e,i,r),u_pixels_to_tile_units:A,u_device_pixel_ratio:h,u_width_scale:f,u_floor_width_scale:m,u_units_to_pixels:[1/S.pixelsToGLUnits[0],1/S.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:l,u_texsize:fb(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:ub(e,n.transform),u_alpha_discard_threshold:0,u_trim_offset:x,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(M?null:i.lut).toArray01(),u_zbias_factor:R,u_tile_to_meter:Et(e.tileID.canonical,0),u_ground_shadow_factor:v}},a.e6=yt,a.e7=Uf,a.e8=Fe,a.e9=Sh,a.eA=function(n,e){var i=2*Math.acos(e[3]),r=Math.sin(i/2);return r>ue?(n[0]=e[0]/r,n[1]=e[1]/r,n[2]=e[2]/r):(n[0]=1,n[1]=0,n[2]=0),i},a.eB=Y0,a.eC=Ny,a.eD=Fy,a.eE=[1,1,1],a.eF=xg,a.eG=Ys,a.eH=function(n,e,i,r){var l=e[0],h=e[1],f=e[2],m=e[3];return n[0]=l+r*(i[0]-l),n[1]=h+r*(i[1]-h),n[2]=f+r*(i[2]-f),n[3]=m+r*(i[3]-m),n},a.eI=hg,a.eJ=$a,a.eK=Ic,a.eL=function(n,e,i,r,l,h,f,m,x,v,S,A,M,R,D,U){var G=new re(16);return G[0]=n,G[1]=e,G[2]=i,G[3]=r,G[4]=l,G[5]=h,G[6]=f,G[7]=m,G[8]=x,G[9]=v,G[10]=S,G[11]=A,G[12]=M,G[13]=R,G[14]=D,G[15]=U,G},a.eM=ye,a.eN=gu,a.eO=gh,a.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new _t(1/0,1/0),max:new _t(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(n,e=!1){const i=d(new _t(0,0),new _t(Lt,Lt),n),r=[];if(e&&!Wf(i,this._globalClipBounds))return r;for(const l of this._activeRegions){if(l.hiddenByOverlap||!Wf(i,l))continue;const h=_(l.min,l.max,n);r.push({min:h.min,max:h.max,sourceId:this._sourceIds[l.priority],footprint:l.footprint,footprintTileId:l.tileId,order:l.order,clipMask:l.clipMask,clipScope:l.clipScope})}return r}setSources(n){this._setSources(n.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const r of e.cache.getVisibleCoordinates()){const l=e.cache.getTile(r).buckets[e.layer];l&&l.updateFootprints(r.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(n){const e=n.getFootprints();if(e.length===0)return;const i=n.getOrder(),r=n.getClipMask(),l=n.getClipScope();for(const h of e){if(!h.footprint)continue;const f=d(h.footprint.min,h.footprint.max,h.id);this._activeRegions.push({min:f.min,max:f.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:h.id,footprint:h.footprint,order:i,clipMask:r,clipScope:l})}this._sourceIds.push(n.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||dm(e.min,i.min)||dm(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(r,l){const h=(f,m)=>f+m;return r.length-l.length||r.reduce(h,"").localeCompare(l.reduce(h,""))})(e.clipScope,i.clipScope));let n=this._activeRegions.length!==this._prevRegions.length;if(!n){let e=0;for(;!n&&e!==this._activeRegions.length;){const i=this._activeRegions[e],r=this._prevRegions[e];n=i.priority!==r.priority||!Iy(i,r)||i.order!==r.order||i.clipMask!==r.clipMask||!aa(i.clipScope,r.clipScope),this._activeRegions[e].hiddenByOverlap=r.hiddenByOverlap,++e}}if(n){++this._updateTime;for(const i of this._activeRegions)i.order!==Xf&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const r=this._activeRegions;if(i>=r.length)return i;const l=r[i].priority;for(;i<r.length&&r[i].priority===l;)++i;return i};if(this._sourceIds.length>1){let i=0,r=e(i);for(;i!==r;){let l=i;const h=i;for(;l!==r;){const f=this._activeRegions[l];f.hiddenByOverlap=!1;for(let m=0;m<h;m++){const x=this._activeRegions[m];if(!x.hiddenByOverlap&&f.order===Xf&&Wf(f,x)&&(f.hiddenByOverlap=z(f.footprint,f.tileId,x.footprint,x.tileId),f.hiddenByOverlap))break}++l}i=r,r=e(i)}}}}_setSources(n){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=n.length-1;e>=0;e--)this._addSource(n[e]);this._computeReplacement()}},a.eQ=Xf,a.eR=class{constructor(n){this._createGrid(n),this._createPoles(n)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const n of this._poleSegments)n.destroy();for(const n of this._gridSegments)n.withSkirts.destroy(),n.withoutSkirts.destroy()}_fillGridMeshWithLods(n,e){const i=new Xl,r=new Lr,l=[],h=n+1+2,f=e[0]+1,m=e[0]+1+(1+e.length),x=(v,S,A)=>{let M=v===h-1?v-2:v===0?v:v-1;return M+=A?24575:0,[M,S]};for(let v=0;v<h;++v)i.emplaceBack(...x(v,0,!0));for(let v=0;v<f;++v)for(let S=0;S<h;++S)i.emplaceBack(...x(S,v,(S===0||S===h-1)&&!0));for(let v=0;v<e.length;++v){const S=e[v];for(let A=0;A<h;++A)i.emplaceBack(...x(A,S,!0))}for(let v=0;v<e.length;++v){const S=r.length,A=e[v]+1+2,M=new Lr;for(let U=0;U<A-1;U++){const G=U===A-2,V=G?h*(m-e.length+v-U):h;for(let Z=0;Z<h-1;Z++){const Y=U*h+Z;U===0||G||Z===0||Z===h-2?(M.emplaceBack(Y+1,Y,Y+V),M.emplaceBack(Y+V,Y+V+1,Y+1)):(r.emplaceBack(Y+1,Y,Y+V),r.emplaceBack(Y+V,Y+V+1,Y+1))}}const R=kn.simpleSegment(0,S,i.length,r.length-S);for(let U=0;U<M.uint16.length;U+=3)r.emplaceBack(M.uint16[U],M.uint16[U+1],M.uint16[U+2]);const D=kn.simpleSegment(0,S,i.length,r.length-S);l.push({withoutSkirts:R,withSkirts:D})}return{vertices:i,indices:r,segments:l}}_createGrid(n){const e=this._fillGridMeshWithLods(W,ne);this._gridSegments=e.segments,this._gridBuffer=n.createVertexBuffer(e.vertices,qg.members),this._gridIndexBuffer=n.createIndexBuffer(e.indices,!0)}_createPoles(n){const e=new Lr;for(let f=0;f<=W;f++)e.emplaceBack(0,f+1,f+2);this._poleIndexBuffer=n.createIndexBuffer(e,!0);const i=new Cc,r=new Cc,l=new Cc,h=new Cc;this._poleSegments=[];for(let f=0,m=0;f<5;f++){const x=360/(1<<f);i.emplaceBack(0,-q,0,.5,0),r.emplaceBack(0,-q,0,.5,1),l.emplaceBack(0,-q,0,.5,.5),h.emplaceBack(0,-q,0,.5,.5);for(let v=0;v<=W;v++){let S=v/W,A=0;const M=mi(0,x,S),[R,D,U]=xe(Wx,ay,M,q);i.emplaceBack(R,D,U,S,A),r.emplaceBack(R,D,U,S,1-A);const G=Ki(M);S=.5+.5*Math.sin(G),A=.5+.5*Math.cos(G),l.emplaceBack(R,D,U,S,A),h.emplaceBack(R,D,U,S,1-A)}this._poleSegments.push(kn.simpleSegment(m,0,66,64)),m+=66}this._poleNorthVertexBuffer=n.createVertexBuffer(i,Eh,!1),this._poleSouthVertexBuffer=n.createVertexBuffer(r,Eh,!1),this._texturedPoleNorthVertexBuffer=n.createVertexBuffer(l,Eh,!1),this._texturedPoleSouthVertexBuffer=n.createVertexBuffer(h,Eh,!1)}getGridBuffers(n,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[n].withSkirts:this._gridSegments[n].withoutSkirts]}getPoleBuffers(n,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[n]]}},a.eS=p_,a.eT=ce,a.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},a.eV=we,a.eW=it,a.eX=function(n,e,i){return n[0]=e[0]/i[0],n[1]=e[1]/i[1],n[2]=e[2]/i[2],n},a.eY=wo,a.eZ=me,a.e_=Ai,a.ea=ec,a.eb=_1,a.ec=Qi,a.ed=450,a.ee=7,a.ef=Ve,a.eg=function(n,e){if(n===e){var i=e[1],r=e[2],l=e[3],h=e[6],f=e[7],m=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=i,n[6]=e[9],n[7]=e[13],n[8]=r,n[9]=h,n[11]=e[14],n[12]=l,n[13]=f,n[14]=m}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15];return n},a.eh=iM,a.ei=Gi,a.ej=Np,a.ek=256,a.el=On,a.em=Za,a.en=ut,a.eo=function(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[4],n[4]=e[5],n[5]=e[6],n[6]=e[8],n[7]=e[9],n[8]=e[10],n}
218,a.ep=Cc,a.eq=wp,a.er=mh,a.es=function(n,e,i,r,l){return he((n-e)/(i-e)*(l-r)+r,r,l)},a.et=bs,a.eu=function(n,e){var i=e[0],r=e[1],l=e[2],h=e[3],f=e[4],m=e[5],x=e[6],v=e[7],S=e[8],A=S*f-m*v,M=-S*h+m*x,R=v*h-f*x,D=i*A+r*M+l*R;return D?(n[0]=A*(D=1/D),n[1]=(-S*r+l*v)*D,n[2]=(m*r-l*f)*D,n[3]=M*D,n[4]=(S*i-l*x)*D,n[5]=(-m*i+l*h)*D,n[6]=R*D,n[7]=(-v*i+r*x)*D,n[8]=(f*i-r*h)*D,n):null},a.ev=2,a.ew=Oi,a.ex=oa,a.ey=ji,a.ez=function(n,e){var i=new re(3);ji(i,e);var r=1/i[0],l=1/i[1],h=1/i[2],f=e[0]*r,m=e[1]*l,x=e[2]*h,v=e[4]*r,S=e[5]*l,A=e[6]*h,M=e[8]*r,R=e[9]*l,D=e[10]*h,U=f+S+D,G=0;return U>0?(G=2*Math.sqrt(U+1),n[3]=.25*G,n[0]=(A-R)/G,n[1]=(M-x)/G,n[2]=(m-v)/G):f>S&&f>D?(G=2*Math.sqrt(1+f-S-D),n[3]=(A-R)/G,n[0]=.25*G,n[1]=(m+v)/G,n[2]=(M+x)/G):S>D?(G=2*Math.sqrt(1+S-f-D),n[3]=(M-x)/G,n[0]=(m+v)/G,n[1]=.25*G,n[2]=(A+R)/G):(G=2*Math.sqrt(1+D-f-S),n[3]=(m-v)/G,n[0]=(M+x)/G,n[1]=(A+R)/G,n[2]=.25*G),n},a.f=function(n){return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},a.f0=function([n,e,i]){const r=Math.hypot(n,e,i),l=Math.atan2(n,i),h=.5*Math.PI-Math.acos(-e/r);return new se(De(l),De(h))},a.f1=es,a.f2=m0,a.f3=function(n){const e=n.navigator?n.navigator.userAgent:null;return!!(function(i){if(Ji==null){const r=i.navigator?i.navigator.userAgent:null;Ji=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return Ji})(n)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},a.f4=function(n,e){lp=n,Xd=e},a.f5=Ld,a.f6=Xm,a.f7=function(n){const e=[0,0,0],i=Je(new Float64Array(16));return pt(i,n.pixelMatrix,n.globeMatrix),Nn(e,e,i),new _t(e[0],e[1])},a.f8=function(){const n=__;n&&(n.isPreloaded()&&n.numActive()===1?(n.release(a0),__=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.f9=function(){Dy().acquire(a0)},a.fA=ux,a.fB=Hi,a.fC=function(n){let e=0;if(new Uint32Array(n,0,1)[0]!==U1){const i=new Uint32Array(n,0,7),[,,r,l,h,f]=i;e=i.byteLength+l+h+f+h,(r!==n.byteLength||e>=n.byteLength)&&vi("Invalid b3dm header information.")}return H1(n,e)},a.fD=function(n,e){const i=v0(n);for(const r of i){for(const l of r.meshes)PE(l);r.lights&&(r.lightMeshIndex=r.meshes.length,r.meshes.push(LE(r.lights,e)))}return i},a.fE=ox,a.fF=dr,a.fG=I1,a.fH=Ia,a.fI=ia,a.fJ=function(n){Kr(),ao?.then(e=>{e.keys().then(i=>{for(let r=0;r<i.length-n;r++)e.delete(i[r]).catch(l=>vi(l.message))}).catch(i=>vi(i.message))}).catch(e=>vi(e.message))},a.fa=Sc,a.fb=function(n,e,i=!1){if(Ho===ia.deferred||Ho===ia.loading||Ho===ia.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");$l=Ea.resolveURL(n),Ho=ia.deferred,Zl=e,zp(),i||Ef()},a.fc=function(n){lg=Ea.resolveURL(n),cg||(cg=new sg(Dy(),new Il)),cg.broadcast("setMeshoptUrl",lg)},a.fd=D1,a.fe=function(n){c0=Ea.resolveURL(n),cg||(cg=new sg(Dy(),new Il)),cg.broadcast("setDracoUrl",c0)},a.ff=z1,a.fg=g_,a.fh=function(n){const e=as();if(!e)return;const i=e.delete(Em);n&&i.then(()=>n()).catch(n)},a.fi=pm,a.fj=zt,a.fk=Dc,a.fl=2,a.fm=o2,a.fn=a2,a.fo=ob,a.fp=Yi,a.fq="hd_road_elevation",a.fr=go,a.fs=ri,a.ft=Pc,a.fu=D0,a.fv=1,a.fw=function(n,e,i,r,l,h,f,m=1,x,v,S,A){n.createArrays(),n.tilePixelRatio=Lt/(512*n.overscaling),n.compareText={},n.iconsNeedLinear=!1;const M=n.layers[0].layout,R=n.layers[0]._unevaluatedLayout._values,D={};D.scaleFactor=m,D.textSizeScaleRange=M.get("text-size-scale-range"),D.iconSizeScaleRange=M.get("icon-size-scale-range");const[U,G]=D.textSizeScaleRange,[V,Z]=D.iconSizeScaleRange;D.textScaleFactor=he(D.scaleFactor,U,G),D.iconScaleFactor=he(D.scaleFactor,V,Z);const Y=R["text-size"],Q=R["icon-size"];if(n.textSizeData.kind==="composite"){const{minZoom:be,maxZoom:Me}=n.textSizeData;D.compositeTextSizes=[Y.possiblyEvaluate(new mn(be,{worldview:S}),h),Y.possiblyEvaluate(new mn(Me,{worldview:S}),h)]}if(n.iconSizeData.kind==="composite"){const{minZoom:be,maxZoom:Me}=n.iconSizeData;D.compositeIconSizes=[Q.possiblyEvaluate(new mn(be,{worldview:S}),h,A),Q.possiblyEvaluate(new mn(Me,{worldview:S}),h,A)]}D.layoutTextSize=Y.possiblyEvaluate(new mn(f+1,{worldview:S}),h),D.layoutIconSize=Q.possiblyEvaluate(new mn(f+1,{worldview:S}),h,A),D.textMaxSize=Y.possiblyEvaluate(new mn(18,{worldview:S}),h);const le=M.get("symbol-placement"),ae=M.get("text-rotation-alignment")==="map"&&le!=="point",ge=M.get("text-size");let _e=!1;const pe=[];for(const be of n.features){const Me=M.get("text-font").evaluate(be,{},h).join(","),Ye=ge.evaluate(be,{},h)*D.textScaleFactor,Ze=D.layoutTextSize.evaluate(be,{},h)*D.textScaleFactor,We=D.layoutIconSize.evaluate(be,{},h,A)*D.iconScaleFactor,lt={horizontal:{},vertical:void 0},at=be.text;
vendor: 10,357 bytes, line 218
218let st,He=[0,0];if(at){const on=at.toString(),Ar=M.get("text-letter-spacing").evaluate(be,{},h)*yo,sn=M.get("text-line-height").evaluate(be,{},h)*yo,Tn=Nm(on)?Ar:0,$n=M.get("text-anchor").evaluate(be,{},h),tr=M.get("text-variable-anchor");if(!tr){const $r=M.get("text-radial-offset").evaluate(be,{},h);if($r)He=Vb($n,[$r*yo,O0]);else{const io=M.get("text-offset").evaluate(be,{},h);He=[io[0]*yo,io[1]*yo]}}let ir=ae?"center":M.get("text-justify").evaluate(be,{},h);const Mr=le==="point",zo=Mr?M.get("text-max-width").evaluate(be,{},h)*yo:1/0,ra=$r=>{n.allowVerticalPlacement&&Tf(on)&&(lt.vertical=M0(at,e,i,l,Me,zo,sn,$n,$r,Tn,He,$s.vertical,!0,Ze,Ye,x))};if(!ae&&tr){const $r=ir==="auto"?tr.map(fo=>B0(fo)):[ir];let io=!1;for(let fo=0;fo<$r.length;fo++){const Ni=$r[fo];if(!lt.horizontal[Ni])if(io)lt.horizontal[Ni]=lt.horizontal[0];else{const nr=M0(at,e,i,l,Me,zo,sn,"center",Ni,Tn,He,$s.horizontal,!1,Ze,Ye,x);nr&&(lt.horizontal[Ni]=nr,io=nr.positionedLines.length===1)}}ra("left")}else{if(ir==="auto"&&(ir=B0($n)),Mr||M.get("text-writing-mode").indexOf("horizontal")>=0||!Tf(on)){const $r=M0(at,e,i,l,Me,zo,sn,$n,ir,Tn,He,$s.horizontal,!1,Ze,Ye,x);$r&&(lt.horizontal[ir]=$r)}ra(Mr?"left":ir)}}let ht,tt,gt,ct,qt,$t,kt=!1;const Nt=M.get("icon-text-fit").evaluate(be,{},h);if(be.icon&&be.icon.hasPrimary()){const on=M_(be.icon,n.iconSizeData,R["icon-size"],h,n.zoom,be,x,D.iconScaleFactor,S,A);ht=on.iconPrimary,gt=on.iconSecondary;const Ar=ht.toString();if(tt=r.get(Ar),tt&&(qt=M.get("icon-offset").evaluate(be,{},h),$t=M.get("icon-anchor").evaluate(be,{},h),st=Hy(l.get(Ar),gt?l.get(gt.toString()):void 0,qt,$t),kt=tt.sdf,n.sdfIcons===void 0?n.sdfIcons=tt.sdf:n.sdfIcons!==tt.sdf&&vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(tt.pixelRatio!==n.pixelRatio||M.get("icon-rotate").constantOr(1)!==0)&&(n.iconsNeedLinear=!0)),gt){const sn=gt.toString();ct=r.get(sn)}}_e=_e||!(!be.icon||!be.icon.hasSecondary());const ci=Wy(lt.horizontal)||lt.vertical;n.iconsInText||(n.iconsInText=!!ci&&ci.iconsInText);const ii=Ze*D.textScaleFactor/yo,{defaultShapedIcon:Gt,verticallyShapedIcon:Ei}=jA(n,st,M,be,h,lt,ii,qt,Nt);Nt!=="none"&&st&&(Eb(st)||Ab(st))&&(Xy(0,tt,ht,st,Gt,Nt,v,r,l),Xy(0,ct,gt,st,Gt,Nt,v,r,l),Ei&&(Xy(0,tt,ht,st,Ei,Nt,v,r,l),Xy(0,ct,gt,st,Ei,Nt,v,r,l))),st=Gt;const{iconBBox:Zi,iconVerticalBBox:fn,textBBox:Ui,textVerticalBBox:En}=kA(n,st,Ei,M,be,h,We,qt,D,l,$t,lt,Ze,He,A);pe.push({feature:be,shapedTextOrientations:lt,shapedText:ci,shapedIcon:st,iconPrimary:ht,iconSecondary:gt,iconOffset:qt,iconAnchor:$t,verticallyShapedIcon:Ei,layoutTextSize:Ze,layoutIconSize:We,textOffset:He,isSDFIcon:kt,iconTextFit:Nt,iconCollisionBounds:Zi,iconVerticalCollisionBounds:fn,textCollisionBounds:Ui,textVerticalCollisionBounds:En})}return{featureData:pe,sizes:D,hasAnySecondaryIcon:_e,textAlongLine:ae,symbolPlacement:le}},a.fx=Lb,a.fy=function(n,e,i,r,l,h,f,m,x,v){n.iconAtlasPositions=v.iconPositions;const{featureData:S,hasAnySecondaryIcon:A,sizes:M,textAlongLine:R,symbolPlacement:D}=e;for(const U of S){const{shapedIcon:G,verticallyShapedIcon:V,feature:Z,shapedTextOrientations:Y,shapedText:Q,layoutTextSize:le,textOffset:ae,isSDFIcon:ge,iconPrimary:_e,iconSecondary:pe,iconTextFit:be,iconOffset:Me,iconCollisionBounds:Ye,iconVerticalCollisionBounds:Ze,textCollisionBounds:We}=U;qb(G,v.iconPositions,_e,pe),qb(V,v.iconPositions,_e,pe),VA(Y,v.iconPositions),UA(_e,pe,v.iconPositions),(Q||G)&&GA(n,Z,Y,G,V,x,M,le,0,ae,ge,r,l,f,m,A,be,Me,R,D,Ye,Ze,We)}i&&n.generateCollisionDebugBuffers(h,n.collisionBoxArray,M.textScaleFactor)},a.fz=tn,a.g=function(n,e){return Ko(Object.assign(n,{method:"GET"}),e)},a.h=function(n){return n.indexOf("mapbox:")===0},a.i=function(n){return Fr.API_STYLE_REGEX.test(n)&&!Eo(n)},a.j=Qs,a.k=ac,a.l=function(n){return decodeURIComponent(atob(n).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},a.m=function(n,e){return Ko(Object.assign(n,{type:"json"}),e)},a.n=Hh,a.o=Ea,a.p=function(n,e){return Ko(Object.assign(n,{method:"POST"}),e)},a.q=ho,a.r=os,a.s=function(n){try{const e=self[n];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},a.t=function(){return s0||(s0=new pm("ImageRasterizer")),s0},a.u=function(){return(function n(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,n)})()},a.v=function(n){return!!n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)},a.w=vi,a.x=ev,a.y=Fu,a.z=us}),te(["./shared"],function(a){function ue(De){const $=De?De.url.toString():void 0;return $?performance.getEntriesByName($):[]}function re(De){if(typeof De=="number"||typeof De=="boolean"||typeof De=="string"||De==null)return JSON.stringify(De);if(Array.isArray(De)){let K="[";for(const ce of De)K+=`${re(ce)},`;return`${K}]`}let $="{";for(const K of Object.keys(De).sort())$+=`${K}:${re(De[K])},`;return`${$}}`}function Ee(De){let $="";for(const K of a.bx)$+=`/${re(De[K])}`;return $}function oe(De,$){return(function K(ce){return typeof ce=="string"&&ce===$||(Array.isArray(ce)?ce.some(K):!(!ce||typeof ce!="object")&&Object.values(ce).some(K))})(De)}class ke{constructor($){this.keyCache={},this._layers={},this._layerConfigs={},$&&this.replace($)}replace($,K){this._layerConfigs={},this._layers={},this.update($,[],K)}update($,K,ce){this._options=ce;for(const he of $)this._layerConfigs[he.id]=he,(this._layers[he.id]=a.du(he,this.scope,null,this._options)).compileFilter(ce),this.keyCache[he.id]&&delete this.keyCache[he.id];for(const he of K)delete this.keyCache[he],delete this._layerConfigs[he],delete this._layers[he];this.familiesBySource={};const we=(function(he,Ie){const Ge={};for(let qe=0;qe<he.length;qe++){const Mt=he[qe];let yt=Ie&&Ie[Mt.id];yt||(Mt.type==="symbol"?yt=Mt.id:(yt=Ee(Mt),Mt.type==="line"&&Mt.paint&&oe(Mt.paint["line-width"],"line-progress")&&(yt+=`/${re(Mt.paint["line-width"])}`))),Ie&&(Ie[Mt.id]=yt);let Zt=Ge[yt];Zt||(Zt=Ge[yt]=[]),Zt.push(Mt)}const Pe=[];for(const qe in Ge)Pe.push(Ge[qe]);return Pe})(Object.values(this._layerConfigs),this.keyCache);for(const he of we){const Ie=he.map(Zt=>this._layers[Zt.id]),Ge=Ie[0];if(Ge.visibility==="none")continue;const Pe=Ge.source||"";let qe=this.familiesBySource[Pe];qe||(qe=this.familiesBySource[Pe]={});const Mt=Ge.sourceLayer||"_geojsonTileLayer";let yt=qe[Mt];yt||(yt=qe[Mt]=[]),yt.push(Ie)}}}const Qe=1*a.fl;class ft{constructor($){const K={},ce=[];for(const Ge in $){const Pe=$[Ge],qe=K[Ge]={};for(const Mt in Pe.glyphs){const yt=Pe.glyphs[+Mt];if(!yt||yt.bitmap.width===0||yt.bitmap.height===0)continue;const Zt=yt.metrics.localGlyph?Qe:1,ri={x:0,y:0,w:yt.bitmap.width+2*Zt,h:yt.bitmap.height+2*Zt};ce.push(ri),qe[Mt]=ri}}const{w:we,h:he}=a.G(ce),Ie=new a.fk({width:we||1,height:he||1});for(const Ge in $){const Pe=$[Ge];for(const qe in Pe.glyphs){const Mt=Pe.glyphs[+qe];if(!Mt||Mt.bitmap.width===0||Mt.bitmap.height===0)continue;const yt=K[Ge][qe],Zt=Mt.metrics.localGlyph?Qe:1;a.fk.copy(Mt.bitmap,Ie,{x:0,y:0},{x:yt.x+Zt,y:yt.y+Zt},Mt.bitmap)}}this.image=Ie,this.positions=K}}function Ne(De,$,K){De[$]?K&&(De[$].center=K):De[$]={floorIds:new Set,center:K||[0,0],floors:{}}}function Je(De,$,K,ce){for(const we of $)Ne(De,we),De[we].floors[K]=ce,De[we].floorIds.add(K)}function mt(De){return{id:De.properties.id.toString(),center:De.properties.center.toString().split(";").map(Number)}}function pt(De){return{id:De.properties.id.toString(),isDefault:!!De.properties.is_default&&De.properties.is_default,connections:De.properties.connected_floor_ids?new Set(De.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:De.properties.conflicted_floor_ids?new Set(De.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:De.properties.building_ids?new Set(De.properties.building_ids.toString().split(";")):new Set,name:De.properties.name.toString(),zIndex:De.properties.z_index}}function dt(De,$){return $.every(K=>De.properties&&De.properties[K]!=null)}function nt(De){return dt(De,["type","id","name"])&&De.properties.type==="building"}function vt(De){return dt(De,["type","id","name","z_index"])&&De.properties.type==="floor"}a.fj(ft,"GlyphAtlas");class ut{constructor($){this.tileID=new a.aQ($.tileID.overscaledZ,$.tileID.wrap,$.tileID.canonical.z,$.tileID.canonical.x,$.tileID.canonical.y),this.tileZoom=$.tileZoom,this.uid=$.uid,this.zoom=$.zoom,this.lut=$.lut,this.canonical=$.tileID.canonical,this.pixelRatio=$.pixelRatio,this.tileSize=$.tileSize,this.source=$.source,this.scope=$.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=$.showCollisionBoxes,this.collectResourceTiming=!!$.request&&$.request.collectResourceTiming,this.promoteId=$.promoteId,this.isSymbolTile=$.isSymbolTile,this.tileTransform=a.aZ($.tileID.canonical,$.projection),this.projection=$.projection,this.worldview=$.worldview,this.localizableLayerIds=$.localizableLayerIds,this.brightness=$.brightness,this.extraShadowCaster=!!$.extraShadowCaster,this.tessellationStep=$.tessellationStep,this.scaleFactor=$.scaleFactor,this.worldview=$.worldview,this.indoor=$.indoor}parse($,K,ce,we,he,Ie){this.status="parsing",this.data=$,this.collisionBoxArray=new a.b3;const Ge=new a.fm(Object.keys($.layers).sort()),Pe=new a.fn(this.tileID,this.promoteId);Pe.bucketLayerIDs=[];const qe={},Mt=new a.fo(256,256),yt={featureIndex:Pe,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Mt,availableImages:ce,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const Mi=this.indoor.indoorState.activeFloorsVisible,Li=(function(si,vi,Rn){const or=(function(Un,Ji){if(!Un)return a.w("No source layers defined in indoor specification"),Ji;if(Un.size===0)return Ji;const Hn=Un.difference(Ji);for(const bn of Hn)a.w(`Missing source layer required in indoor specification: ${bn}`);return Ji.intersection(Ji)})(vi.sourceLayers,new Set(Object.keys(si.layers))),jn=vi.indoorState,dr=(function(Un,Ji,Hn,bn){const wn=new Set,zn=new Set,ar=new Set,Yr=new Map,Fr={},Qs=Eo=>{const ko=Yr.get(Eo)||new Set;for(const rs of wn)if((Yr.get(rs)||new Set).has(Eo)||ko.has(rs))return!0;return!1};for(const Eo of Ji){const ko=Un.layers[Eo];if(ko)for(let rs=0;rs<ko.length;rs++){const Gr=ko.feature(rs);if(nt(Gr)){const{id:Yo,center:Fo}=mt(Gr);Ne(Fr,Yo,Fo),wn.add(Yo);continue}
218if(vt(Gr)){const{id:Yo,isDefault:Fo,connections:Ss,conflicts:os,buildings:Ea,name:Lu,zIndex:Js}=pt(Gr);Je(Fr,Ea,Yo,{name:Lu,zIndex:Js}),Yr.set(Yo,os),(Yo===bn||Ss.has(bn))&&wn.add(Yo),zn.add(Yo),Fo&&ar.add(Yo)}}else a.w(`indoor source layer not found: ${Eo}`)}if(Hn)for(const Eo of Hn)zn.has(Eo)&&(Qs(Eo)||wn.add(Eo));for(const Eo of ar)wn.has(Eo)||Qs(Eo)||wn.add(Eo);return{buildings:Fr,activeFloors:wn}})(si,or,jn.lastActiveFloors,jn.selectedFloorId);return Rn.send("setIndoorData",dr),dr})($,this.indoor,he);yt.activeFloors=Mi?Li.activeFloors:void 0}const Zt=[],ri=K.familiesBySource[this.source];for(const Mi in ri){const Li=$.layers[Mi];if(!Li)continue;let si=!1,vi=!1,Rn=!1;for(const Ji of ri[Mi])Ji[0].type==="symbol"?si=!0:vi=!0,Ji[0].is3D()&&Ji[0].type!=="model"&&(Rn=!0);if(this.extraShadowCaster&&!Rn||this.isSymbolTile===!0&&!si||this.isSymbolTile===!1&&!vi)continue;Li.version===1&&a.w(`Vector tile source "${this.source}" layer "${Mi}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const or=Ge.encode(Mi),jn=[],dr=this.localizableLayerIds&&this.localizableLayerIds.has(Mi);let Un=!1;for(let Ji=0,Hn=0;Ji<Li.length;Ji++){const bn=Li.feature(Ji),wn=Pe.getId(bn,Mi),zn=bn.properties?bn.properties.worldview:null;if(dr&&this.worldview&&typeof zn=="string")if(zn==="all")bn.properties.$localized=!0;else{if(!zn.split(",").includes(this.worldview))continue;bn.properties.$localized=!0,bn.properties.worldview=this.worldview}!Un&&bn.properties&&bn.properties.hasOwnProperty(a.fp)&&(Un=!0),jn.push({feature:bn,id:wn,index:Hn,sourceLayerIndex:or}),Hn++}Un&&!yt.elevationFeatures&&$.layers.hasOwnProperty(a.fq)&&(yt.elevationFeatures=a.fr.parseFrom($.layers[a.fq],this.canonical));for(const Ji of ri[Mi]){const Hn=Ji[0];if(this.extraShadowCaster&&(!Hn.is3D()||Hn.type==="model")||this.isSymbolTile!==void 0&&Hn.type==="symbol"!==this.isSymbolTile||Hn.minzoom&&this.zoom<Math.floor(Hn.minzoom)||Hn.maxzoom&&this.zoom>=Hn.maxzoom||Hn.visibility==="none")continue;rt(Ji,this.zoom,yt.brightness,ce,this.worldview);const bn=qe[Hn.id]=Hn.createBucket({index:Pe.bucketLayerIDs.length,layers:Ji,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:or,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:we,worldview:this.worldview,localizable:dr,availableImages:ce});Pe.bucketLayerIDs.push(Ji.map(zn=>a.B(zn.id,zn.scope)));let wn=bn.prepare?bn.prepare():null;wn!=null?(wn=wn.then(()=>bn.populate(jn,yt,this.tileID.canonical,this.tileTransform)),Zt.push(wn)):bn.populate(jn,yt,this.tileID.canonical,this.tileTransform)}}const li=()=>{let Mi,Li,si,vi,Rn,or;Mt.trim();const jn={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},dr=()=>{if(Mi)return this.status="done",Ie(Mi);if(this.extraShadowCaster)this.status="done",Ie(null,{buckets:Object.values(qe).filter(Ji=>!Ji.isEmpty()),featureIndex:Pe,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:yt.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Li&&si&&vi){const Ji=new ft(Li),Hn=new Map;for(const[zn,ar]of si.entries()){const{imagePosition:Yr}=a.fu(zn,ar,a.fv);Hn.set(zn,Yr)}const bn={};for(const zn in qe){const ar=qe[zn];ar instanceof a.b4&&(rt(ar.layers,this.zoom,yt.brightness,ce,this.worldview),bn[zn]=a.fw(ar,Li,Ji.positions,si,Hn,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Rn,this.worldview,ce))}const wn={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(he,si,Rn,()=>{wn.iconsPending=!1,Un(bn,Ji,wn)}),this.rasterizeIfNeeded(he,vi,or,()=>{wn.patternsPending=!1,Un(bn,Ji,wn)})}},Un=(Ji,Hn,bn,wn)=>{if(bn.iconsPending||bn.patternsPending)return;const zn=new a.fx(si,vi,this.lut);for(const ar in qe){const Yr=qe[ar];if(ar in Ji)a.fy(Yr,Ji[ar],this.showCollisionBoxes,ce,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,si,zn);else if(Yr.hasPattern&&(Yr instanceof a.ba||Yr instanceof a.bb||Yr instanceof a.ea)){rt(Yr.layers,this.zoom,yt.brightness,ce,this.worldview);const Fr=Object.fromEntries(zn.patternPositions);Yr.addFeatures(yt,this.tileID.canonical,Fr,ce,this.tileTransform,this.brightness)}}this.status="done",Ie(null,{buckets:Object.values(qe).filter(ar=>!ar.isEmpty()),featureIndex:Pe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Hn.image,lineAtlas:Mt,imageAtlas:zn,brightness:yt.brightness})};if(!this.extraShadowCaster){const Ji=a.fs(yt.glyphDependencies,wn=>Object.keys(wn).map(Number));Object.keys(Ji).length?he.send("getGlyphs",{uid:this.uid,stacks:Ji},(wn,zn)=>{Mi||(Mi=wn,Li=zn,dr())},void 0,!1,jn):Li={};const Hn=Array.from(yt.iconDependencies.keys()).map(wn=>a.I.parse(wn));Hn.length?he.send("getImages",{images:Hn,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(wn,zn)=>{Mi||(Mi=wn,si=new Map,Rn=this.updateImageMapAndGetImageTaskQueue(si,zn,yt.iconDependencies),dr())},void 0,!1,jn):(si=new Map,Rn=new Map);const bn=Array.from(yt.patternDependencies.keys()).map(wn=>a.I.parse(wn));bn.length?he.send("getImages",{images:bn,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(wn,zn)=>{Mi||(Mi=wn,vi=new Map,or=this.updateImageMapAndGetImageTaskQueue(vi,zn,yt.patternDependencies),dr())},void 0,!1,jn):(vi=new Map,or=new Map)}if(yt.elevationFeatures&&yt.elevationFeatures.length>0){const Ji=[];for(const bn of Object.values(qe))if(bn instanceof a.bb){const wn=bn.getUnevaluatedPortalGraph();wn&&Ji.push(wn)}const Hn=a.ft.evaluate(Ji);for(const bn of Object.values(qe))if(bn instanceof a.bb){const wn=$.layers[Ge.decode(bn.sourceLayerIndex)];bn.setEvaluatedPortalGraph(Hn,wn,this.tileID.canonical,yt.availableImages,yt.brightness)}}dr()};Zt.length>0?Promise.allSettled(Zt).then(li).catch(Ie):li()}updateParameters($){this.scaleFactor=$.scaleFactor,this.showCollisionBoxes=$.showCollisionBoxes,this.projection=$.projection,this.brightness=$.brightness,this.tileTransform=a.aZ($.tileID.canonical,$.projection),this.extraShadowCaster=$.extraShadowCaster,this.lut=$.lut,this.worldview=$.worldview,this.indoor=$.indoor}rasterizeIfNeeded($,K,ce,we){Array.from(K.values()).some(he=>he.usvg)?this.rasterize($,K,ce,we):we()}updateImageMapAndGetImageTaskQueue($,K,ce){const we=new Map;for(const he of K.keys()){const Ie=ce.get(he)||[];for(const Ge of Ie){const Pe=Ge.toString(),qe=K.get(Ge.id.toString());qe.usvg?we.has(Pe)||(we.set(Pe,Ge),$.set(Pe,Object.assign({},qe))):$.set(Pe,qe)}}return we}rasterize($,K,ce,we){this.rasterizeTask=$.send("rasterizeImages",{scope:this.scope,tasks:ce},(he,Ie)=>{if(!he)for(const[Ge,Pe]of Ie.entries()){const qe=Object.assign(K.get(Ge),{data:Pe});K.set(Ge,qe)}we()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function rt(De,$,K,ce,we){const he=new a.ac($,{brightness:K,worldview:we});for(const Ie of De)Ie.recalculate(he,ce)}class wt extends a.E{constructor($,K,ce,we,he,Ie,Ge){super(),this.actor=$,this.layerIndex=K,this.availableImages=ce,this.availableModels=we,this.loadVectorData=Ie||a.aL,this.loading={},this.loaded={},this.deduped=new a.aK($.scheduler),this.isSpriteLoaded=he,this.scheduler
218=$.scheduler,this.brightness=Ge}loadTile($,K){const ce=$.uid,we=$&&$.request,he=we&&we.collectResourceTiming,Ie=this.loading[ce]=new ut($);Ie.abort=this.loadVectorData($,(Ge,Pe)=>{const qe=!this.loading[ce];if(delete this.loading[ce],Ie.cancelRasterize(),qe||Ge||!Pe)return Ie.status="done",qe||(this.loaded[ce]=Ie),K(Ge);const Mt=Pe.rawData,yt={},Zt=a.aM(Pe.responseHeaders);Zt&&Zt.expires&&(yt.expires=Zt.expires),Zt&&Zt.cacheControl&&(yt.cacheControl=Zt.cacheControl),Ie.vectorTile=Pe.vectorTile||new a.fz(new a.bt(Mt));const ri=()=>{Ie.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(li,Mi)=>{if(li||!Mi)return K(li);const Li={};if(he){const si=ue(we);si.length>0&&(Li.resourceTiming=JSON.parse(JSON.stringify(si)))}K(null,Object.assign({rawTileData:Mt.slice(0),responseHeaders:Pe.responseHeaders},Mi,yt,Li))})};this.isSpriteLoaded?ri():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(ri,{type:"parseTile",isSymbolTile:$.isSymbolTile,zoom:$.tileZoom}):ri()}),this.loaded=this.loaded||{},this.loaded[ce]=Ie})}reloadTile($,K){const ce=this.loaded,we=$.uid;if(ce&&ce[we]){const he=ce[we];he.updateParameters($);const Ie=(Ge,Pe)=>{const qe=he.reloadCallback;qe&&(delete he.reloadCallback,he.parse(he.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,qe)),K(Ge,Pe)};he.status==="parsing"?he.reloadCallback=Ie:he.status==="done"&&(he.vectorTile?he.parse(he.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ie):Ie())}else K(null,void 0)}abortTile($,K){const ce=$.uid,we=this.loading[ce];we&&(we.abort&&we.abort(),delete this.loading[ce]),K()}removeTile($,K){const ce=this.loaded,we=$.uid;ce&&ce[we]&&delete ce[we],K()}}class Ii{loadTile($,K){const{uid:ce,encoding:we,rawImageData:he,padding:Ie}=$,Ge=ImageBitmap&&he instanceof ImageBitmap?this.getImageData(he,Ie):he;K(null,new a.fA(ce,Ge,we,Ie<1))}reloadTile($,K){K(null,null)}abortTile($,K){K()}removeTile($,K){K()}getImageData($,K){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas($.width,$.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=$.width,this.offscreenCanvas.height=$.height,this.offscreenCanvasContext.drawImage($,0,0,$.width,$.height);const ce=this.offscreenCanvasContext.getImageData(-K,-K,$.width+2*K,$.height+2*K);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),ce}}a.bs.setPbf(a.bt);class ji{constructor($){this._mrt=new a.bs($.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=$.uid,this.tileID=$.tileID,this.source=$.source}parse($,K){const ce=this._mrt;this.status="parsing",this._entireBuffer=$;try{ce.parseHeader($),this._isHeaderLoaded=!0;const we=[];for(const he in ce.layers){const Ie=ce.getLayer(he),Ge=Ie.getDataRange(Ie.getBandList()),Pe=ce.createDecodingTask(Ge),qe=$.slice(Ge.firstByte,Ge.lastByte+1),Mt=a.bs.performDecoding(qe,Pe).then(yt=>Pe.complete(null,yt)).catch(yt=>Pe.complete(yt,null));we.push(Mt)}Promise.allSettled(we).then(()=>K(null,ce)).catch(he=>K(he))}catch(we){K(we)}}}class Bi{constructor($){this.actor=$,this.loading={},this.loaded={}}loadTile($,K){const ce=$.uid,we=$.request,he=this.loading[ce]=new ji($),{cancel:Ie}=a.bu(we,(Ge,Pe,qe)=>{const Mt=!this.loading[ce];if(delete this.loading[ce],Mt||Ge||!Pe)return he.status="done",Mt||(this.loaded[ce]=he),K(Ge);he.parse(Pe,(yt,Zt)=>{if(yt||!Zt)return K(yt);K(null,Zt,qe)}),this.loaded[ce]=he});he.abort=Ie}reloadTile($,K){K(null,void 0)}abortTile($,K){const ce=$.uid,we=this.loading[ce];we&&(we.abort&&we.abort(),delete this.loading[ce]),K()}removeTile($,K){const ce=$.uid;this.loaded[ce]&&delete this.loaded[ce],K()}decodeRasterArray($,K){a.bs.performDecoding($.buffer,$.task).then(ce=>K(null,ce)).catch(ce=>K(ce))}}const ai=a.fB.prototype.toGeoJSON;class Vt{constructor($){this._feature=$,this.extent=a.al,this.type=$.type,this.properties=$.tags,"id"in $&&!isNaN($.id)&&(this.id=parseInt($.id,10))}loadGeometry(){if(this._feature.type===1){const $=[];for(const K of this._feature.geometry)$.push([new a.P(K[0],K[1])]);return $}{const $=[];for(const K of this._feature.geometry){const ce=[];for(const we of K)ce.push(new a.P(we[0],we[1]));$.push(ce)}return $}}toGeoJSON($,K,ce){return ai.call(this,$,K,ce)}}class gi{constructor($,K){this.name=$,this.extent=a.al,this.length=K.length,this._jsonFeatures=K}feature($){return new Vt(this._jsonFeatures[$])}}class Si{constructor($){this.layers={},this.extent=a.al;for(const K of Object.keys($))this.layers[K]=new gi(K,$[K])}}const je=64/4096;class St{constructor(){this.features=new Map}clear(){this.features.clear()}load($=[],K){for(const ce of $){const we=ce.id;if(we==null)continue;let he=this.features.get(we);he&&this.updateCache(he,K),ce.geometry?(he=_i(ce),this.updateCache(he,K),this.features.set(we,he)):this.features.delete(we),this.updateCache(he,K)}}updateCache($,K){for(const{canonical:ce,uid:we}of Object.values(K)){const{z:he,x:Ie,y:Ge}=ce;Tt($,Math.pow(2,he),Ie,Ge)&&delete K[we]}}getTile($,K,ce){const we=Math.pow(2,$),he=[];for(const Ie of this.features.values())Tt(Ie,we,K,ce)&&he.push(bt(Ie,we,K,ce));return{features:he}}getFeatures(){return[...this.features.values()]}}function Tt({minX:De,minY:$,maxX:K,maxY:ce},we,he,Ie){return De<(he+1+je)/we&&$<(Ie+1+je)/we&&K>(he-je)/we&&ce>(Ie-je)/we}function _i(De){const{id:$,geometry:K,properties:ce}=De;if(!K)return;if(K.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:we,coordinates:he}=K,Ie={id:$,type:1,geometry:[],tags:ce,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Ge=Ie.geometry;if(we==="Point")ei(he,Ge,Ie);else if(we==="MultiPoint")for(const Pe of he)ei(Pe,Ge,Ie);else if(we==="LineString")Ie.type=2,Ue(he,Ge,Ie);else if(we==="MultiLineString")Ie.type=2,Dt(he,Ge,Ie);else if(we==="Polygon")Ie.type=3,Dt(he,Ge,Ie,!0);else{if(we!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Ie.type=3;for(const Pe of he)Dt(Pe,Ge,Ie,!0)}return Ie}function ei([De,$],K,ce){const we=a.aF(De);let he=a.aJ($);he=he<0?0:he>1?1:he,K.push(we,he),ce.minX=Math.min(ce.minX,we),ce.minY=Math.min(ce.minY,he),ce.maxX=Math.max(ce.maxX,we),ce.maxY=Math.max(ce.maxY,he)}function Ue(De,$,K,ce=!1,we=!1){const he=[];for(const Ie of De)ei(Ie,he,K);$.push(he),ce&&(function(Ie,Ge){let Pe=0;for(let qe=0,Mt=Ie.length,yt=Mt-2;qe<Mt;
218yt=qe,qe+=2)Pe+=(Ie[qe]-Ie[yt])*(Ie[qe+1]+Ie[yt+1]);if(Pe>0===Ge)for(let qe=0,Mt=Ie.length;qe<Mt/2;qe+=2){const yt=Ie[qe],Zt=Ie[qe+1];Ie[qe]=Ie[Mt-2-qe],Ie[qe+1]=Ie[Mt-1-qe],Ie[Mt-2-qe]=yt,Ie[Mt-1-qe]=Zt}})(he,we)}function Dt(De,$,K,ce=!1){for(let we=0;we<De.length;we++)Ue(De[we],$,K,ce,we===0)}function bt(De,$,K,ce){const{id:we,type:he,geometry:Ie,tags:Ge}=De,Pe=[];if(he===1)(function(qe,Mt,yt,Zt,ri){for(let li=0;li<qe.length;li+=2){const Mi=Math.round(a.al*(qe[li+0]*Mt-yt)),Li=Math.round(a.al*(qe[li+1]*Mt-Zt));ri.push([Mi,Li])}})(Ie,$,K,ce,Pe);else if(he===2)for(const qe of Ie)Ht(qe,$,K,ce,Pe);else if(he===3)for(const qe of Ie)ui(qe,$,K,ce,Pe);return{id:we,type:he,geometry:Pe,tags:Ge}}function Ht(De,$,K,ce,we){const Ie=a.al+128;let Ge;for(let Pe=0;Pe<De.length-2;Pe+=2){let qe=Math.round(a.al*(De[Pe+0]*$-K)),Mt=Math.round(a.al*(De[Pe+1]*$-ce)),yt=Math.round(a.al*(De[Pe+2]*$-K)),Zt=Math.round(a.al*(De[Pe+3]*$-ce));const ri=yt-qe,li=Zt-Mt;qe<-128&&yt<-128||(qe<-128?(Mt+=Math.round(li*((-128-qe)/ri)),qe=-128):yt<-128&&(Zt=Mt+Math.round(li*((-128-qe)/ri)),yt=-128),Mt<-128&&Zt<-128||(Mt<-128?(qe+=Math.round(ri*((-128-Mt)/li)),Mt=-128):Zt<-128&&(yt=qe+Math.round(ri*((-128-Mt)/li)),Zt=-128),qe>=Ie&&yt>=Ie||(qe>=Ie?(Mt+=Math.round(li*((Ie-qe)/ri)),qe=Ie):yt>=Ie&&(Zt=Mt+Math.round(li*((Ie-qe)/ri)),yt=Ie),Mt>=Ie&&Zt>=Ie||(Mt>=Ie?(qe+=Math.round(ri*((Ie-Mt)/li)),Mt=Ie):Zt>=Ie&&(yt=qe+Math.round(ri*((Ie-Mt)/li)),Zt=Ie),Ge&&qe===Ge[Ge.length-1][0]&&Mt===Ge[Ge.length-1][1]||(Ge=[[qe,Mt]],we.push(Ge)),Ge.push([yt,Zt])))))}}function ui(De,$,K,ce,we){const he=(K-je)/$,Ie=(ce-je)/$,Ge=(K+1+je)/$,Pe=(ce+1+je)/$;function qe(Zt,ri){let li=0;return Zt<he?li|=1:Zt>Ge&&(li|=2),ri<Ie?li|=4:ri>Pe&&(li|=8),li}let Mt=[];for(let Zt=1;Zt<=8;Zt*=2){let ri=De[De.length-2],li=De[De.length-1],Mi=!(qe(ri,li)&Zt);for(let Li=0;Li<De.length;Li+=2){const si=De[Li],vi=De[Li+1],Rn=!(qe(si,vi)&Zt);Rn!==Mi&&(8&Zt?Mt.push(ri+(si-ri)*(Pe-li)/(vi-li),Pe):4&Zt?Mt.push(ri+(si-ri)*(Ie-li)/(vi-li),Ie):2&Zt?Mt.push(Ge,li+(vi-li)*(Ge-ri)/(si-ri)):1&Zt&&Mt.push(he,li+(vi-li)*(he-ri)/(si-ri))),Rn&&Mt.push(si,vi),ri=si,li=vi,Mi=Rn}if(!(De=Mt).length||Zt===8)break;Mt=[]}const yt=[];for(let Zt=0;Zt<Mt.length;Zt+=2)yt.push([Math.round(a.al*(Mt[Zt]*$-K)),Math.round(a.al*(Mt[Zt+1]*$-ce))]);yt.length&&we.push(yt)}function hi({name:De,features:$},K){K.writeStringField(1,De),K.writeVarintField(5,a.al);const ce=new Map,we=new Map,he={keys:ce,values:we,feature:null};for(const Ie of $)he.feature=Ie,K.writeMessage(2,Ai,he);for(const Ie of ce.keys())K.writeStringField(3,Ie);for(const Ie of we.keys())K.writeMessage(4,Or,Ie)}function Ai(De,$){const K=De.feature;K.id!==void 0&&Number.isSafeInteger(+K.id)&&$.writeVarintField(1,+K.id),K.tags&&$.writeMessage(2,Oi,De),$.writeVarintField(3,K.type),$.writeMessage(4,Xn,K)}function Oi({keys:De,values:$,feature:K},ce){for(const we of Object.keys(K.tags)){let he=K.tags[we];if(he===null)continue;let Ie=De.get(we);Ie===void 0&&(Ie=De.size,De.set(we,Ie)),ce.writeVarint(Ie);const Ge=typeof he;Ge!=="string"&&Ge!=="boolean"&&Ge!=="number"&&(he=JSON.stringify(he));let Pe=$.get(he);Pe===void 0&&(Pe=$.size,$.set(he,Pe)),ce.writeVarint(Pe)}}function xi(De,$){return($<<3)+(7&De)}function ln(De){return De<<1^De>>31}function Xn(De,$){const{geometry:K,type:ce}=De;let we=0,he=0;if(ce===1){$.writeVarint(xi(1,K.length));for(const Ie of K){const Ge=Ie[0]-we,Pe=Ie[1]-he;$.writeVarint(ln(Ge)),$.writeVarint(ln(Pe)),we+=Ge,he+=Pe}}else for(const Ie of K){if(Ie.length===0)continue;$.writeVarint(xi(1,1));const Ge=Ie.length-(ce===3?1:0);for(let Pe=0;Pe<Ge;Pe++){Pe===1&&$.writeVarint(xi(2,Ge-1));const qe=Ie[Pe][0]-we,Mt=Ie[Pe][1]-he;$.writeVarint(ln(qe)),$.writeVarint(ln(Mt)),we+=qe,he+=Mt}ce===3&&$.writeVarint(xi(7,1))}}function Or(De,$){const K=typeof De;K==="string"?$.writeStringField(1,De):K==="boolean"?$.writeBooleanField(7,De):K==="number"&&(De%1!=0?$.writeDoubleField(3,De):De<0?$.writeSVarintField(6,De):$.writeVarintField(5,De))}const Nn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:De=>De},bo=Math.fround||(Ka=new Float32Array(1),De=>
vendor: 15,822 bytes, line 218
218(Ka[0]=+De,Ka[0]));var Ka;class Qa{constructor($){this.options=Object.assign(Object.create(Nn),$),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load($){const{log:K,minZoom:ce,maxZoom:we}=this.options;K&&console.time("total time");const he=`prepare ${$.length} points`;K&&console.time(he),this.points=$;const Ie=[];for(let Pe=0;Pe<$.length;Pe++){const qe=$[Pe];if(!qe.geometry)continue;const[Mt,yt]=qe.geometry.coordinates,Zt=bo(wo(Mt)),ri=bo(Ja(yt));Ie.push(Zt,ri,1/0,Pe,-1,1),this.options.reduce&&Ie.push(0)}let Ge=this.trees[we+1]=this._createTree(Ie);K&&console.timeEnd(he);for(let Pe=we;Pe>=ce;Pe--){const qe=+Date.now();Ge=this.trees[Pe]=this._createTree(this._cluster(Ge,Pe)),K&&console.log("z%d: %d clusters in %dms",Pe,Ge.numItems,+Date.now()-qe)}return K&&console.timeEnd("total time"),this}getClusters($,K){let ce=(($[0]+180)%360+360)%360-180;const we=Math.max(-90,Math.min(90,$[1]));let he=$[2]===180?180:(($[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,$[3]));if($[2]-$[0]>=360)ce=-180,he=180;else if(ce>he){const yt=this.getClusters([ce,we,180,Ie],K),Zt=this.getClusters([-180,we,he,Ie],K);return yt.concat(Zt)}const Ge=this.trees[this._limitZoom(K)],Pe=Ge.range(wo(ce),Ja(Ie),wo(he),Ja(we)),qe=Ge.data,Mt=[];for(const yt of Pe){const Zt=this.stride*yt;Mt.push(qe[Zt+5]>1?Oo(qe,Zt,this.clusterProps):this.points[qe[Zt+3]])}return Mt}getChildren($){const K=this._getOriginId($),ce=this._getOriginZoom($),we="No cluster with the specified id.",he=this.trees[ce];if(!he)throw new Error(we);const Ie=he.data;if(K*this.stride>=Ie.length)throw new Error(we);const Ge=this.options.radius/(this.options.extent*Math.pow(2,ce-1)),Pe=he.within(Ie[K*this.stride],Ie[K*this.stride+1],Ge),qe=[];for(const Mt of Pe){const yt=Mt*this.stride;Ie[yt+4]===$&&qe.push(Ie[yt+5]>1?Oo(Ie,yt,this.clusterProps):this.points[Ie[yt+3]])}if(qe.length===0)throw new Error(we);return qe}getLeaves($,K,ce){const we=[];return this._appendLeaves(we,$,K=K||10,ce=ce||0,0),we}getTile($,K,ce){const we=this.trees[this._limitZoom($)],he=Math.pow(2,$),{extent:Ie,radius:Ge}=this.options,Pe=Ge/Ie,qe=(ce-Pe)/he,Mt=(ce+1+Pe)/he,yt={features:[]};return this._addTileFeatures(we.range((K-Pe)/he,qe,(K+1+Pe)/he,Mt),we.data,K,ce,he,yt),K===0&&this._addTileFeatures(we.range(1-Pe/he,qe,1,Mt),we.data,he,ce,he,yt),K===he-1&&this._addTileFeatures(we.range(0,qe,Pe/he,Mt),we.data,-1,ce,he,yt),yt.features.length?yt:null}getClusterExpansionZoom($){let K=this._getOriginZoom($)-1;for(;K<=this.options.maxZoom;){const ce=this.getChildren($);if(K++,ce.length!==1)break;$=ce[0].properties.cluster_id}return K}_appendLeaves($,K,ce,we,he){const Ie=this.getChildren(K);for(const Ge of Ie){const Pe=Ge.properties;if(Pe&&Pe.cluster?he+Pe.point_count<=we?he+=Pe.point_count:he=this._appendLeaves($,Pe.cluster_id,ce,we,he):he<we?he++:$.push(Ge),$.length===ce)break}return he}_createTree($){const K=new a.c4($.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ce=0;ce<$.length;ce+=this.stride)K.add($[ce],$[ce+1]);return K.finish(),K.data=$,K}_addTileFeatures($,K,ce,we,he,Ie){for(const Ge of $){const Pe=Ge*this.stride,qe=K[Pe+5]>1;let Mt,yt,Zt;if(qe)Mt=rr(K,Pe,this.clusterProps),yt=K[Pe],Zt=K[Pe+1];else{const Mi=this.points[K[Pe+3]];Mt=Mi.properties;const[Li,si]=Mi.geometry.coordinates;yt=wo(Li),Zt=Ja(si)}const ri={type:1,geometry:[[Math.round(this.options.extent*(yt*he-ce)),Math.round(this.options.extent*(Zt*he-we))]],tags:Mt};let li;li=qe||this.options.generateId?K[Pe+3]:this.points[K[Pe+3]].id,li!==void 0&&(ri.id=li),Ie.features.push(ri)}}_limitZoom($){return Math.max(this.options.minZoom,Math.min(Math.floor(+$),this.options.maxZoom+1))}_cluster($,K){const{radius:ce,extent:we,reduce:he,minPoints:Ie}=this.options,Ge=ce/(we*Math.pow(2,K)),Pe=$.data,qe=[],Mt=this.stride;for(let yt=0;yt<Pe.length;yt+=Mt){if(Pe[yt+2]<=K)continue;Pe[yt+2]=K;const Zt=Pe[yt],ri=Pe[yt+1],li=$.within(Pe[yt],Pe[yt+1],Ge),Mi=Pe[yt+5];let Li=Mi;for(const si of li){const vi=si*Mt;Pe[vi+2]>K&&(Li+=Pe[vi+5])}if(Li>Mi&&Li>=Ie){let si,vi=Zt*Mi,Rn=ri*Mi,or=-1;const jn=(yt/Mt<<5)+(K+1)+this.points.length;for(const dr of li){const Un=dr*Mt;if(Pe[Un+2]<=K)continue;Pe[Un+2]=K;const Ji=Pe[Un+5];vi+=Pe[Un]*Ji,Rn+=Pe[Un+1]*Ji,Pe[Un+4]=jn,he&&(si||(si=this._map(Pe,yt,!0),or=this.clusterProps.length,this.clusterProps.push(si)),he(si,this._map(Pe,Un)))}Pe[yt+4]=jn,qe.push(vi/Li,Rn/Li,1/0,jn,-1,Li),he&&qe.push(or)}else{for(let si=0;si<Mt;si++)qe.push(Pe[yt+si]);if(Li>1)for(const si of li){const vi=si*Mt;if(!(Pe[vi+2]<=K)){Pe[vi+2]=K;for(let Rn=0;Rn<Mt;Rn++)qe.push(Pe[vi+Rn])}}}}return qe}_getOriginId($){return $-this.points.length>>5}_getOriginZoom($){return($-this.points.length)%32}_map($,K,ce){if($[K+5]>1){const Ie=this.clusterProps[$[K+6]];return ce?Object.assign({},Ie):Ie}const we=this.points[$[K+3]].properties,he=this.options.map(we);return ce&&he===we?Object.assign({},he):he}}function Oo(De,$,K){return{type:"Feature",id:De[$+3],properties:rr(De,$,K),geometry:{type:"Point",coordinates:[(ce=De[$],360*(ce-.5)),Ys(De[$+1])]}};var ce}function rr(De,$,K){const ce=De[$+5],we=ce>=1e4?`${Math.round(ce/1e3)}k`:ce>=1e3?Math.round(ce/100)/10+"k":ce,he=De[$+6],Ie=he===-1?{}:Object.assign({},K[he]);return Object.assign(Ie,{cluster:!0,cluster_id:De[$+3],point_count:ce,point_count_abbreviated:we})}function wo(De){return De/360+.5}function Ja(De){const $=Math.sin(De*Math.PI/180),K=.5-.25*Math.log((1+$)/(1-$))/Math.PI;return K<0?0:K>1?1:K}function Ys(De){const $=(180-360*De)*Math.PI/180;return 360*Math.atan(Math.exp($))/Math.PI-90}function Wr(De,$,K,ce){let we=ce;const he=$+(K-$>>1);let Ie,Ge=K-$;const Pe=De[$],qe=De[$+1],Mt=De[K],yt=De[K+1];for(let Zt=$+3;Zt<K;Zt+=3){const ri=es(De[Zt],De[Zt+1],Pe,qe,Mt,yt);if(ri>we)Ie=Zt,we=ri;else if(ri===we){const li=Math.abs(Zt-he);li<Ge&&(Ie=Zt,Ge=li)}}we>ce&&(Ie-$>3&&Wr(De,$,Ie,ce),De[Ie+2]=we,K-Ie>3&&Wr(De,Ie,K,ce))}function es(De,$,K,ce,we,he){let Ie=we-K,Ge=he-ce;if(Ie!==0||Ge!==0){const Pe=((De-K)*Ie+($-ce)*Ge)/(Ie*Ie+Ge*Ge);Pe>1?(K=we,ce=he):Pe>0&&(K+=Ie*Pe,ce+=Ge*Pe)}return Ie=De-K,Ge=$-ce,Ie*Ie+Ge*Ge}function pr(De,$,K,ce){const we={id:De??null,type:$,geometry:K,tags:ce,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if($==="Point"||$==="MultiPoint"||$==="LineString")Bo(we,K);else if($==="Polygon")Bo(we,K[0]);else if($==="MultiLineString")for(const he of K)Bo(we,he);else if($==="MultiPolygon")for(const he of K)Bo(we,he[0]);return we}function Bo(De,$){for(let K=0;K<$.length;K+=3)De.minX=Math.min(De.minX,$[K]),De.minY=Math.min(De.minY,$[K+1]),De.maxX=Math.max(De.maxX,$[K]),De.maxY=Math.max(De.maxY,$[K+1])}function oa(De,$,K,ce){if(!$.geometry)return;const we=$.geometry.coordinates;if(we&&we.length===0)return;const he=$.geometry.type,Ie=Math.pow(K.tolerance/((1<<K.maxZoom)*K.extent),2);let Ge=[],Pe=$.id;if(K.promoteId?Pe=$.properties[K.promoteId]:K.generateId&&(Pe=ce||0),he==="Point")ts(we,Ge);else if(he==="MultiPoint")for(const qe of we)ts(qe,Ge);else if(he==="LineString")Sa(we,Ge,Ie,!1);else if(he==="MultiLineString"){if(K.lineMetrics){for(const qe of we)Ge=[],Sa(qe,Ge,Ie,!1),De.push(pr(Pe,"LineString",Ge,$.properties));return}bs(we,Ge,Ie,!1)}else if(he==="Polygon")bs(we,Ge,Ie,!0);else{if(he!=="MultiPolygon"){if(he==="GeometryCollection"){for(const qe of $.geometry.geometries)oa(De,{id:Pe,geometry:qe,properties:$.properties},K,ce);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const qe of we){const Mt=[];bs(qe,Mt,Ie,!0),Ge.push(Mt)}}De.push(pr(Pe,he,Ge,$.properties))}function ts(De,$){$.push(zr(De[0]),El(De[1]),0)}function Sa(De,$,K,ce){let we,he,Ie=0;for(let Pe=0;Pe<De.length;Pe++){const qe=zr(De[Pe][0]),Mt=El(De[Pe][1]);$.push(qe,Mt,0),Pe>0&&(Ie+=ce?(we*Mt-qe*he)/2:Math.sqrt(Math.pow(qe-we,2)+Math.pow(Mt-he,2))),we=qe,he=Mt}const Ge=$.length-3;$[2]=1,Wr($,0,Ge,K),$[Ge+2]=1,$.size=Math.abs(Ie),$.start=0,$.end=$.size}function bs(De,$,K,ce){for(let we=0;we<De.length;we++){const he=[];Sa(De[we],he,K,ce),$.push(he)}}function zr(De){return De/360+.5}function El(De){const $=Math.sin(De*Math.PI/180),K=.5-.25*Math.log((1+$)/(1-$))/Math.PI;return K<0?0:K>1?1:K}function oo(De,$,K,ce,we,he,Ie,Ge){if(ce/=$,he>=(K/=$)&&Ie<ce)return De;if(Ie<K||he>=ce)return null;const Pe=[];for(const qe of De){const Mt=qe.geometry;let yt=qe.type;const Zt=we===0?qe.minX:qe.minY,ri=we===0?qe.maxX:qe.maxY;if(Zt>=K&&ri<ce){Pe.push(qe);continue}if(ri<K||Zt>=ce)continue;let li=[];if(yt==="Point"||yt==="MultiPoint")ws(Mt,li,K,ce,we);else if(yt==="LineString")Br(Mt,li,K,ce,we,!1,Ge.lineMetrics);else if(yt==="MultiLineString")Dr(Mt,li,K,ce,we,!1);else if(yt==="Polygon")Dr(Mt,li,K,ce,we,!0);else if(yt==="MultiPolygon")for(const Mi of Mt){const Li=[];Dr(Mi,Li,K,ce,we,!0),Li.length&&li.push(Li)}if(li.length){if(Ge.lineMetrics&&yt==="LineString"){for(const Mi of li)Pe.push(pr(qe.id,yt,Mi,qe.tags));continue}yt!=="LineString"&&yt!=="MultiLineString"||(li.length===1?(yt="LineString",li=li[0]):yt="MultiLineString"),yt!=="Point"&&yt!=="MultiPoint"||(yt=li.length===3?"Point":"MultiPoint"),Pe.push(pr(qe.id,yt,li,qe.tags))}}return Pe.length?Pe:null}function ws(De,$,K,ce,we){for(let he=0;he<De.length;he+=3){const Ie=De[he+we];Ie>=K&&Ie<=ce&&Ts($,De[he],De[he+1],De[he+2])}}function Br(De,$,K,ce,we,he,Ie){let Ge=mr(De);const Pe=we===0?is:To;let qe,Mt,yt=De.start;for(let Li=0;Li<De.length-3;Li+=3){const si=De[Li],vi=De[Li+1],Rn=De[Li+2],or=De[Li+3],jn=De[Li+4],dr=we===0?si:vi,Un=we===0?or:jn;let Ji=!1;Ie&&(qe=Math.sqrt(Math.pow(si-or,2)+Math.pow(vi-jn,2))),dr<K?Un>K&&(Mt=Pe(Ge,si,vi,or,jn,K),Ie&&(Ge.start=yt+qe*Mt)):dr>ce?Un<ce&&(Mt=Pe(Ge,si,vi,or,jn,ce),Ie&&(Ge.start=yt+qe*Mt)):Ts(Ge,si,vi,Rn),Un<K&&dr>=K&&(Mt=Pe(Ge,si,vi,or,jn,K),Ji=!0),Un>ce&&dr<=ce&&(Mt=Pe(Ge,si,vi,or,jn,ce),Ji=!0),!he&&Ji&&(Ie&&(Ge.end=yt+qe*Mt),$.push(Ge),Ge=mr(De)),Ie&&(yt+=qe)}let Zt=De.length-3;const ri=De[Zt],li=De[Zt+1],Mi=we===0?ri:li;Mi>=K&&Mi<=ce&&Ts(Ge,ri,li,De[Zt+2]),Zt=Ge.length-3,he&&Zt>=3&&(Ge[Zt]!==Ge[0]||Ge[Zt+1]!==Ge[1])&&Ts(Ge,Ge[0],Ge[1],Ge[2]),Ge.length&&$.push(Ge)}function mr(De){const $=[];return $.size=De.size,$.start=De.start,$.end=De.end,$}function Dr(De,$,K,ce,we,he){for(const Ie of De)Br(Ie,$,K,ce,we,he,!1)}function Ts(De,$,K,ce){De.push($,K,ce)}function is(De,$,K,ce,we,he){const Ie=(he-$)/(ce-$);return Ts(De,he,K+(we-K)*Ie,1),Ie}function To(De,$,K,ce,we,he){const Ie=(he-K)/(we-K);return Ts(De,$+(ce-$)*Ie,he,1),Ie}function ka(De,$){const K=[];for(let ce=0;ce<De.length;ce++){const we=De[ce],he=we.type;let Ie;if(he==="Point"||he==="MultiPoint"||he==="LineString")Ie=Fa(we.geometry,$);else if(he==="MultiLineString"||he==="Polygon"){Ie=[];for(const Ge of we.geometry)Ie.push(Fa(Ge,$))}else if(he==="MultiPolygon"){Ie=[];for(const Ge of we.geometry){const Pe=[];for(const qe of Ge)Pe.push(Fa(qe,$));Ie.push(Pe)}}K.push(pr(we.id,he,Ie,we.tags))}return K}function Fa(De,$){const K=[];K.size=De.size,De.start!==void 0&&(K.start=De.start,K.end=De.end);for(let ce=0;ce<De.length;ce+=3)K.push(De[ce]+$,De[ce+1],De[ce+2]);return K}function ns(De,$){if(De.transformed)return De;const K=1<<De.z,ce=De.x,we=De.y;for(const he of De.features){const Ie=he.geometry,Ge=he.type;if(he.geometry=[],Ge===1)for(let Pe=0;Pe<Ie.length;Pe+=2)he.geometry.push(vn(Ie[Pe],Ie[Pe+1],$,K,ce,we));else for(let Pe=0;Pe<Ie.length;Pe++){const qe=[];for(let Mt=0;Mt<Ie[Pe].length;Mt+=2)qe.push(vn(Ie[Pe][Mt],Ie[Pe][Mt+1],$,K,ce,we));he.geometry.push(qe)}}return De.transformed=!0,De}function vn(De,$,K,ce,we,he){return[Math.round(K*(De*ce-we)),Math.round(K*($*ce-he))]}function ki(De,$,K,ce,we){const he=$===we.maxZoom?0:we.tolerance/((1<<$)*we.extent),Ie={features:[],numPoints:0,numSimplified:0,numFeatures:De.length,source:null,x:K,y:ce,z:$,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Ge of De)xr(Ie,Ge,he,we);return Ie}function xr(De,$,K,ce){const we=$.geometry,he=$.type,Ie=[];if(De.minX=Math.min(De.minX,$.minX),De.minY=Math.min(De.minY,$.minY),De.maxX=Math.max(De.maxX,$.maxX),De.maxY=Math.max(De.maxY,$.maxY),he==="Point"||he==="MultiPoint")for(let Ge=0;Ge<we.length;Ge+=3)Ie.push(we[Ge],we[Ge+1]),De.numPoints++,De.numSimplified++;else if(he==="LineString")kr(Ie,we,De,K,!1,!1);else if(he==="MultiLineString"||he==="Polygon")for(let Ge=0;Ge<we.length;Ge++)kr(Ie,we[Ge],De,K,he==="Polygon",Ge===0);else if(he==="MultiPolygon")for(let Ge=0;Ge<we.length;Ge++){const Pe=we[Ge];for(let qe=0;qe<Pe.length;qe++)kr(Ie,Pe[qe],De,K,!0,qe===0)}if(Ie.length){let Ge=$.tags||null;if(he==="LineString"&&ce.lineMetrics){Ge={};for(const qe in $.tags)Ge[qe]=$.tags[qe];Ge.mapbox_clip_start=we.start/we.size,Ge.mapbox_clip_end=we.end/we.size}const Pe={geometry:Ie,type:he==="Polygon"||he==="MultiPolygon"?3:he==="LineString"||he==="MultiLineString"?2:1,tags:Ge};$.id!==null&&(Pe.id=$.id),De.features.push(Pe)}}function kr(De,$,K,ce,we,he){const Ie=ce*ce;if(ce>0&&$.size<(we?Ie:ce))return void(K.numPoints+=$.length/3);const Ge=[];for(let Pe=0;Pe<$.length;Pe+=3)(ce===0||$[Pe+2]>Ie)&&(K.numSimplified++,Ge.push($[Pe],$[Pe+1])),K.numPoints++;we&&(function(Pe,qe){let Mt=0;for(let yt=0,Zt=Pe.length,ri=Zt-2;yt<Zt;ri=yt,yt+=2)Mt+=(Pe[yt]-Pe[ri])*(Pe[yt+1]+Pe[ri+1]);if(Mt>0===qe)for(let yt=0,Zt=Pe.length;yt<Zt/2;yt+=2){const ri=Pe[yt],li=Pe[yt+1];Pe[yt]=Pe[Zt-2-yt],Pe[yt+1]=Pe[Zt-1-yt],Pe[Zt-2-yt]=ri,Pe[Zt-1-yt]=li}})(Ge,he),De.push(Ge)}const gr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ks{constructor($,K){const ce=(K=this.options=(function(he,Ie){for(const Ge in Ie)he[Ge]=Ie[Ge];return he})(Object.create(gr),K)).debug;if(ce&&console.time("preprocess data"),K.maxZoom<0||K.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(K.promoteId&&K.generateId)throw new Error("promoteId and generateId cannot be used together.");let we=(function(he,Ie){const Ge=[];if(he.type==="FeatureCollection")for(let Pe=0;Pe<he.features.length;Pe++)oa(Ge,he.features[Pe],Ie,Pe);else oa(Ge,he.type==="Feature"?he:{geometry:he},Ie);return Ge})($,K);this.tiles={},this.tileCoords=[],ce&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",K.indexMaxZoom,K.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),we=(function(he,Ie){const Ge=Ie.buffer/Ie.extent;let Pe=he;const qe=oo(he,1,-1-Ge,Ge,0,-1,2,Ie),Mt=oo(he,1,1-Ge,2+Ge,0,-1,2,Ie);return(qe||Mt)&&(Pe=oo(he,1,-Ge,1+Ge,0,-1,2,Ie)||[],qe&&(Pe=ka(qe,1).concat(Pe)),Mt&&(Pe=Pe.concat(ka(Mt,-1)))),Pe})(we,K),we.length&&this.splitTile(we,0,0,0),ce&&(we.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($,K,ce,we,he,Ie,Ge){const Pe=[$,K,ce,we],qe=this.options,Mt=qe.debug;for(;Pe.length;){we=Pe.pop(),ce=Pe.pop(),K=Pe.pop(),$=Pe.pop();const yt=1<<K,Zt=_r(K,ce,we);let ri=this.tiles[Zt];if(!ri&&(Mt>1&&console.time("creation"),ri=this.tiles[Zt]=ki($,K,ce,we,qe),this.tileCoords.push({z:K,x:ce,y:we}),Mt)){Mt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",K,ce,we,ri.numFeatures,ri.numPoints,ri.numSimplified),console.timeEnd("creation"));const Ji=`z${K}`;this.stats[Ji]=(this.stats[Ji]||0)+1,this.total++}if(ri.source=$,he==null){if(K===qe.indexMaxZoom||ri.numPoints<=qe.indexMaxPoints)continue}else{if(K===qe.maxZoom||K===he)continue;if(he!=null){const Ji=he-K;if(ce!==Ie>>Ji||we!==Ge>>Ji)continue}}if(ri.source=null,$.length===0)continue;Mt>1&&console.time("clipping");const li=.5*qe.buffer/qe.extent,Mi=.5-li,Li=.5+li,si=1+li;let vi=null,Rn=null,or=null,jn=null,dr=oo($,yt,ce-li,ce+Li,0,ri.minX,ri.maxX,qe),Un=oo($,yt,ce+Mi,ce+si,0,ri.minX,ri.maxX,qe);$=null,dr&&(vi=oo(dr,yt,we-li,we+Li,1,ri.minY,ri.maxY,qe),Rn=oo(dr,yt,we+Mi,we+si,1,ri.minY,ri.maxY,qe),dr=null),Un&&(or=oo(Un,yt,we-li,we+Li,1,ri.minY,ri.maxY,qe),jn=oo(Un,yt,we+
218Mi,we+si,1,ri.minY,ri.maxY,qe),Un=null),Mt>1&&console.timeEnd("clipping"),Pe.push(vi||[],K+1,2*ce,2*we),Pe.push(Rn||[],K+1,2*ce,2*we+1),Pe.push(or||[],K+1,2*ce+1,2*we),Pe.push(jn||[],K+1,2*ce+1,2*we+1)}}getTile($,K,ce){$=+$,K=+K,ce=+ce;const we=this.options,{extent:he,debug:Ie}=we;if($<0||$>24)return null;const Ge=1<<$,Pe=_r($,K=K+Ge&Ge-1,ce);if(this.tiles[Pe])return ns(this.tiles[Pe],he);Ie>1&&console.log("drilling down to z%d-%d-%d",$,K,ce);let qe,Mt=$,yt=K,Zt=ce;for(;!qe&&Mt>0;)Mt--,yt>>=1,Zt>>=1,qe=this.tiles[_r(Mt,yt,Zt)];return qe&&qe.source?(Ie>1&&(console.log("found parent tile z%d-%d-%d",Mt,yt,Zt),console.time("drilling down")),this.splitTile(qe.source,Mt,yt,Zt,$,K,ce),Ie>1&&console.timeEnd("drilling down"),this.tiles[Pe]?ns(this.tiles[Pe],he):null):null}}function _r(De,$,K){return 32*((1<<De)*K+$)+De}function _t(De,$){const K=De.tileID.canonical;if(!this._geoJSONIndex)return void $(null,null);const ce=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!ce)return void $(null,null);const we=qe=>qe.tags&&"3d_elevation_id"in qe.tags&&"source"in qe.tags&&qe.tags.source==="elevation",he=ce.features.filter(qe=>we(qe));let Ie={_geojsonTileLayer:ce.features};he.length>0&&(Ie={_geojsonTileLayer:ce.features.filter(qe=>!we(qe)),hd_road_elevation:he});const Ge=new Si(Ie),Pe=(function(qe){const Mt=new a.bt;for(const yt of Object.keys(qe))Mt.writeMessage(3,hi,{name:yt,features:qe[yt]});return Mt.finish()})(Ie).buffer;$(null,{vectorTile:Ge,rawData:Pe})}class aa extends wt{constructor($,K,ce,we,he,Ie,Ge){super($,K,ce,we,he,_t,Ge),Ie&&(this.loadGeoJSON=Ie),this._dynamicIndex=new St}loadData($,K){const ce=$&&$.request,we=ce&&ce.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON($,(he,Ie)=>{if(he||!Ie)return K(he);if(typeof Ie!="object")return K(new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`));{try{if($.filter){const Pe=a.U($.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Pe.result==="error")throw new Error(Pe.value.map(qe=>`${qe.key}: ${qe.message}`).join(", "));Ie.features=Ie.features.filter(qe=>Pe.value.evaluate({zoom:0},qe))}$.dynamic?(Ie.type==="Feature"&&(Ie={type:"FeatureCollection",features:[Ie]}),$.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Ie.features,this.loaded),$.cluster&&(Ie.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=$.cluster?new Qa((function({superclusterOptions:Pe,clusterProperties:qe}){if(!qe||!Pe)return Pe;const Mt={},yt={},Zt={accumulated:null,zoom:0},ri={properties:null},li=Object.keys(qe);for(const Mi of li){const[Li,si]=qe[Mi],vi=a.U(si),Rn=a.U(typeof Li=="string"?[Li,["accumulated"],["get",Mi]]:Li);Mt[Mi]=vi.value,yt[Mi]=Rn.value}return Pe.map=Mi=>{ri.properties=Mi;const Li={};for(const si of li)Li[si]=Mt[si].evaluate(Zt,ri);return Li},Pe.reduce=(Mi,Li)=>{ri.properties=Li;for(const si of li)Zt.accumulated=Mi[si],Mi[si]=yt[si].evaluate(Zt,ri)},Pe})($)).load(Ie.features):$.dynamic?this._dynamicIndex:(function(Pe,qe){return new Ks(Pe,qe)})(Ie,$.geojsonVtOptions)}catch(Pe){return K(Pe)}const Ge={};
218if(we){const Pe=ue(ce);Pe&&(Ge.resourceTiming={},Ge.resourceTiming[$.source]=JSON.parse(JSON.stringify(Pe)))}K(null,Ge)}})}reloadTile($,K){const ce=this.loaded;return ce&&ce[$.uid]?$.partial?K(null,void 0):super.reloadTile($,K):this.loadTile($,K)}loadGeoJSON($,K){if($.request)a.m($.request,K);else{if(typeof $.data!="string")return K(new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return K(null,JSON.parse($.data))}catch{return K(new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom($,K){try{K(null,this._geoJSONIndex.getClusterExpansionZoom($.clusterId))}catch(ce){K(ce)}}getClusterChildren($,K){try{K(null,this._geoJSONIndex.getChildren($.clusterId))}catch(ce){K(ce)}}getClusterLeaves($,K){try{K(null,this._geoJSONIndex.getLeaves($.clusterId,$.limit,$.offset))}catch(ce){K(ce)}}}class Wo{constructor($,K,ce){this.tileID=new a.aQ($.tileID.overscaledZ,$.tileID.wrap,$.tileID.canonical.z,$.tileID.canonical.x,$.tileID.canonical.y),this.tileZoom=$.tileZoom,this.uid=$.uid,this.zoom=$.zoom,this.canonical=$.tileID.canonical,this.pixelRatio=$.pixelRatio,this.tileSize=$.tileSize,this.source=$.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=$.projection,this.brightness=K,this.worldview=ce}parse($,K,ce,we){this.status="parsing";const he=new a.aQ(ce.tileID.overscaledZ,ce.tileID.wrap,ce.tileID.canonical.z,ce.tileID.canonical.x,ce.tileID.canonical.y),Ie=[],Ge=K.familiesBySource[ce.source],Pe=new a.fn(he,ce.promoteId);Pe.bucketLayerIDs=[],Pe.is3DTile=!0,a.fC($).then(qe=>{if(!qe)return we(new Error("Could not parse tile"));const Mt=qe.json.extensionsUsed&&qe.json.extensionsUsed.includes("MAPBOX_mesh_features")||qe.json.asset.extras&&qe.json.asset.extras.MAPBOX_mesh_features,yt=qe.json.extensionsUsed&&qe.json.extensionsUsed.includes("EXT_meshopt_compression"),Zt=new a.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const ri in Ge)for(const li of Ge[ri]){const Mi=li[0];Pe.bucketLayerIDs.push(li.map(vi=>a.B(vi.id,vi.scope))),Mi.recalculate(Zt,[]);const Li=a.fD(qe,1/a.d7(ce.tileID.canonical)),si=new a.fE(li,Li,he,Mt,yt,this.brightness,Pe,this.worldview);Mt||(si.needsUpload=!0),Ie.push(si),si.evaluate(Mi)}this.status="done",we(null,{buckets:Ie,featureIndex:Pe,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(qe=>we(new Error(qe.message)))}}class So{constructor($,K,ce,we,he,Ie,Ge,Pe){this.actor=$,this.layerIndex=K,this.availableImages=ce,this.availableModels=we,this.brightness=Ge,this.loading={},this.loaded={},this.worldview=Pe}loadTile($,K){const ce=$.uid,we=this.loading[ce]=new Wo($,this.brightness,this.worldview);a.bu($.request,(he,Ie)=>{const Ge=!this.loading[ce];return delete this.loading[ce],Ge||he?(we.status="done",Ge||(this.loaded[ce]=we),K(he)):Ie&&Ie.byteLength!==0?void we.parse(Ie,this.layerIndex,$,(Pe,qe)=>{we.status="done",this.loaded=this.loaded||{},this.loaded[ce]=we,Pe||!qe?K(Pe):K(null,qe)}):(we.status="done",this.loaded[ce]=we,K())})}reloadTile($,K){const ce=this.loaded,we=$.uid;if(ce&&ce[we]){const he=ce[we];he.projection=$.projection,he.brightness=$.brightness;const Ie=(Ge,Pe)=>{he.reloadCallback&&(delete he.reloadCallback,this.loadTile($,K)),K(Ge,Pe)};he.status==="parsing"?he.reloadCallback=Ie:he.status==="done"&&this.loadTile($,K)}}abortTile($,K){const ce=$.uid;this.loading[ce]&&delete this.loading[ce],K()}removeTile($,K){const ce=this.loaded,we=$.uid;ce&&ce[we]&&delete ce[we],K()}}class Ki{constructor($){this.self=$,this.actor=new a.fG($,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new a.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=a.cm({name:"mercator"}),this.workerSourceTypes={vector:wt,geojson:aa,"raster-dem":Ii,"raster-array":Bi,"batched-model":So},this.workerSources={},this.self.registerWorkerSource=(K,ce)=>{if(this.workerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.workerSourceTypes[K]=ce},this.self.registerRTLTextPlugin=K=>{if(a.fH.isParsed())throw new Error("RTL text plugin already registered.");a.fH.setState({pluginStatus:a.fI.parsed,pluginURL:a.fH.getPluginURL()}),a.fH.applyArabicShaping=K.applyArabicShaping,a.fH.processBidirectionalText=K.processBidirectionalText,a.fH.processStyledBidirectionalText=K.processStyledBidirectionalText;
218for(const ce of this.rtlPluginParsingListeners)ce(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches($,K,ce){delete this.layerIndexes[$],delete this.availableImages[$],delete this.availableModels[$],delete this.workerSources[$],ce()}checkIfReady($,K,ce){ce()}setReferrer($,K){this.referrer=K}spriteLoaded($,K){this.isSpriteLoaded[$]||(this.isSpriteLoaded[$]={});const{scope:ce,isLoaded:we}=K;if(this.isSpriteLoaded[$][ce]=we,this.workerSources[$]&&this.workerSources[$][ce])for(const he in this.workerSources[$][ce]){const Ie=this.workerSources[$][ce][he];for(const Ge in Ie){const Pe=Ie[Ge];Pe instanceof wt&&(Pe.isSpriteLoaded=we,Pe.fire(new a.z("isSpriteLoaded")))}}}setImages($,K,ce){this.availableImages[$]||(this.availableImages[$]={});const{scope:we,images:he}=K;if(this.availableImages[$][we]=he,this.workerSources[$]&&this.workerSources[$][we]){for(const Ie in this.workerSources[$][we]){const Ge=this.workerSources[$][we][Ie];for(const Pe in Ge)Ge[Pe].availableImages=he}ce()}else ce()}setModels($,{scope:K,models:ce},we){if(this.availableModels[$]||(this.availableModels[$]={}),this.availableModels[$][K]=ce,this.workerSources[$]&&this.workerSources[$][K]){for(const he in this.workerSources[$][K]){const Ie=this.workerSources[$][K][he];for(const Ge in Ie)Ie[Ge].availableModels=ce}we()}else we()}setProjection($,K){this.projections[$]=a.cm(K)}setBrightness($,K,ce){this.brightness=K,ce()}setWorldview($,K,ce){this.worldview=K,ce()}setLayers($,K,ce){this.getLayerIndex($,K.scope).replace(K.layers,K.options),ce()}updateLayers($,K,ce){this.getLayerIndex($,K.scope).update(K.layers,K.removedIds,K.options),ce()}loadTile($,K,ce){K.projection=this.projections[$]||this.defaultProjection,this.getWorkerSource($,K.type,K.source,K.scope).loadTile(K,ce)}decodeRasterArray($,K,ce){this.getWorkerSource($,K.type,K.source,K.scope).decodeRasterArray(K,ce)}reloadTile($,K,ce){K.projection=this.projections[$]||this.defaultProjection,this.getWorkerSource($,K.type,K.source,K.scope).reloadTile(K,ce)}abortTile($,K,ce){this.getWorkerSource($,K.type,K.source,K.scope).abortTile(K,ce)}removeTile($,K,ce){this.getWorkerSource($,K.type,K.source,K.scope).removeTile(K,ce)}removeSource($,K,ce){if(!(this.workerSources[$]&&this.workerSources[$][K.scope]&&this.workerSources[$][K.scope][K.type]&&this.workerSources[$][K.scope][K.type][K.source]))return;const we=this.workerSources[$][K.scope][K.type][K.source];delete this.workerSources[$][K.scope][K.type][K.source],we.removeSource!==void 0?we.removeSource(K,ce):ce()}loadWorkerSource($,K,ce){try{this.self.importScripts(K.url),ce()}catch(we){ce(we)}}syncRTLPluginState($,K,ce){if(a.fH.isParsed())ce(null,!0);else if(a.fH.isParsing())this.rtlPluginParsingListeners.push(ce);else try{a.fH.setState(K);const we=a.fH.getPluginURL();!a.fH.isLoaded()||a.fH.isParsed()||a.fH.isParsing()||we==null||(a.fH.setState({pluginStatus:a.fI.parsing,pluginURL:a.fH.getPluginURL()}),this.self.importScripts(we),a.fH.isParsed()?ce(null,!0):this.rtlPluginParsingListeners.push(ce))}catch(we){ce(we)}}setDracoUrl($,K){this.dracoUrl=K}getAvailableImages($,K){this.availableImages[$]||(this.availableImages[$]={});let ce=this.availableImages[$][K];return ce||(ce=[]),ce}getAvailableModels($,K){this.availableModels[$]||(this.availableModels[$]={});let ce=this.availableModels[$][K];return ce||(ce={}),ce}getLayerIndex($,K){this.layerIndexes[$]||(this.layerIndexes[$]={});let ce=this.layerIndexes[$][K];return ce||(ce=this.layerIndexes[$][K]=new ke,ce.scope=K),ce}getWorkerSource($,K,ce,we){const he=this.workerSources;return he[$]||(he[$]={}),he[$][we]||(he[$][we]={}),he[$][we][K]||(he[$][we][K]={}),this.isSpriteLoaded[$]||(this.isSpriteLoaded[$]={}),he[$][we][K][ce]||(he[$][we][K][ce]=new this.workerSourceTypes[K]({send:(Ie,Ge,Pe,qe,Mt,yt)=>this.actor.send(Ie,Ge,Pe,$,Mt,yt),scheduler:this.actor.scheduler},this.getLayerIndex($,we),this.getAvailableImages($,we),this.getAvailableModels($,we),this.isSpriteLoaded[$][we],void 0,this.brightness,this.worldview)),he[$][we][K][ce]}rasterizeImagesWorker($,K,ce){const we=new Map;for(const[he,{image:Ie,imageVariant:Ge}]of K.tasks.entries()){const Pe=this.imageRasterizer.rasterize(Ge,Ie,K.scope,$);we.set(he,Pe)}ce(void 0,we)}removeRasterizedImages($,K,ce){this.imageRasterizer.removeImagesFromCacheByIds(K.imageIds,K.scope,$),ce()}enforceCacheSizeLimit($,K){a.fJ(K)}getWorkerPerformanceMetrics($,K,ce){ce(void 0,void 0)}}return a.fF(self)&&(self.worker=new Ki(self)),Ki}),te(["./shared"],function(a){var ue="3.18.1";const re={create:"create",load:"load",fullLoad:"fullLoad"},Ee={mark(c){performance.mark(c)},measure(c,t,o){performance.measure(c,t,o)}};function oe(c){const t=c.name.split("?")[0];return a.a(t)&&t.includes("mapbox-gl.js")?"javascript":a.a(t)&&t.includes("mapbox-gl.css")?"css":a.b(t)?"fontRange":a.c(t)?"sprite":a.i(t)?"style":a.d(t)?"tilejson":"other"}var ke,Qe={},ft=(function(){if(ke)return Qe;function c(u){return!t(u)}function t(u){return typeof window>"u"||typeof document>"u"?"not a browser":(function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var g,y,b=new Blob([""],{type:"text/javascript"}),T=URL.createObjectURL(b);try{y=new Worker(T),g=!0}catch{g=!1}return y&&y.terminate(),URL.revokeObjectURL(T),g})()?(function(){var g=document.createElement("canvas");g.width=g.height=1;var y=g.getContext("2d");if(!y)return!1;var b=y.getImageData(0,0,1,1);return b&&b.width===g.width})()?(o[p=u&&u.failIfMajorPerformanceCaveat]===void 0&&(o[p]=(function(g){var y,b=(function(T){var 
218C=document.createElement("canvas"),I=Object.create(c.webGLContextAttributes);return I.failIfMajorPerformanceCaveat=T,C.getContext("webgl2",I)})(g);if(!b)return!1;try{y=b.createShader(b.VERTEX_SHADER)}catch{return!1}return!(!y||b.isContextLost())&&(b.shaderSource(y,"void main() {}"),b.compileShader(y),b.getShaderParameter(y,b.COMPILE_STATUS)===!0)})(p)),o[p]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var p}ke=1,Qe.supported=c,Qe.notSupportedReason=t;var o={};return c.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},Qe})();function Ne(c,t,o){const u=document.createElement(c);return t!=null&&(u.className=t),o&&o.appendChild(u),u}function Je(c,t,o){const u=document.createElementNS("http://www.w3.org/2000/svg",c);for(const p of Object.keys(t))u.setAttributeNS(null,p,String(t[p]));return o&&o.appendChild(u),u}const mt=typeof document<"u"?document.documentElement&&document.documentElement.style:null,pt=mt&&mt.userSelect!==void 0?"userSelect":"WebkitUserSelect";let dt;function nt(){mt&&pt&&(dt=mt[pt],mt[pt]="none")}function vt(){mt&&pt&&(mt[pt]=dt)}function ut(c){c.preventDefault(),c.stopPropagation(),window.removeEventListener("click",ut,!0)}function rt(){window.addEventListener("click",ut,!0),window.setTimeout(()=>{window.removeEventListener("click",ut,!0)},0)}function wt(c,t){const o=c.getBoundingClientRect();return Bi(c,o,t)}function Ii(c,t){const o=c.getBoundingClientRect(),u=[];for(let p=0;p<t.length;p++)u.push(Bi(c,o,t[p]));return u}function ji(c){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&c.button===2&&c.ctrlKey?0:c.button}function Bi(c,t,o){const u=c.offsetWidth===t.width?1:c.offsetWidth/t.width;return new a.P((o.clientX-t.left)*u,(o.clientY-t.top)*u)}const ai="01",Vt="NO_ACCESS_TOKEN";class gi{constructor(t,o,u){this._transformRequestFn=t,this._customAccessToken=o,this._silenceAuthErrors=!!u,this._createSkuToken()}_createSkuToken(){const t=(function(){let o="";for(let u=0;u<10;u++)o+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",ai,o].join(""),tokenExpiresAt:Date.now()+432e5}})();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}normalizeStyleURL(t,o){if(!a.h(t))return t;const u=je(t);return u.params.push(`sdk=js-${ue}`),u.path=`/styles/v1${u.path}`,this._makeAPIURL(u,this._customAccessToken||o)}normalizeGlyphsURL(t,o){if(!a.h(t))return t;const u=je(t);return u.path=`/fonts/v1${u.path}`,this._makeAPIURL(u,this._customAccessToken||o)}normalizeModelURL(t,o){if(!a.h(t))return t;const u=je(t);return u.path=`/models/v1${u.path}`,this._makeAPIURL(u,this._customAccessToken||o)}normalizeSourceURL(t,o,u,p){if(!a.h(t))return t;const g=je(t);return g.path=`/v4/${g.authority}.json`,g.params.push("secure"),u&&g.params.push(`language=${u}`),p&&g.params.push(`worldview=${p}`),this._makeAPIURL(g,this._customAccessToken||o)}normalizeIconsetURL(t,o){const u=je(t);return a.h(t)?(u.path=`/styles/v1${u.path}/iconset.pbf`,this._makeAPIURL(u,this._customAccessToken||o)):St(u)}normalizeSpriteURL(t,o,u,p){const g=je(t);return a.h(t)?(g.path=`/styles/v1${g.path}/sprite${o}${u}`,this._makeAPIURL(g,this._customAccessToken||p)):(g.path+=`${o}${u}`,St(g))}normalizeTileURL(t,o,u){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!a.h(t))return t;const p=je(t);p.path=p.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${o||u&&p.authority!=="raster"&&u===512?"@2x":""}${a.k.supported?".webp":"$1"}`),p.authority==="raster"?p.path=`/${a.e.RASTER_URL_PREFIX}${p.path}`:p.authority==="rasterarrays"?p.path=`/${a.e.RASTERARRAYS_URL_PREFIX}${p.path}`:p.authority==="3dtiles"?p.path=`/${a.e.TILES3D_URL_PREFIX}${p.path}`:(p.path=p.path.replace(/^.+\/v4\//,"/"),p.path=`/${a.e.TILE_URL_VERSION}${p.path}`);const g=this._customAccessToken||(function(y){for(const b of y){const T=b.match(/^access_token=(.*)$/);if(T)return T[1]}return null})(p.params)||a.e.ACCESS_TOKEN;return a.e.REQUIRE_ACCESS_TOKEN&&g&&this._skuToken&&p.params.push(`sku=${this._skuToken}`),this._makeAPIURL(p,g)}canonicalizeTileURL(t,o){const u=je(t);if(!u.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!u.path.match(/\.[\w]+$/))return t;let p="mapbox://";u.path.match(/^\/raster\/v1\//)?p+=`raster/${u.path.replace(`/${a.e.RASTER_URL_PREFIX}/`,"")}`:u.path.match(/^\/rasterarrays\/v1\//)?p+=`rasterarrays/${u.path.replace(`/${a.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:p+=`tiles/${u.path.replace(`/${a.e.TILE_URL_VERSION}/`,"")}`;let g=u.params;return o&&(g=g.filter(y=>!y.match(/^access_token=/))),g.length&&(p+=`?${g.join("&")}`),p}canonicalizeTileset(t,o){const u=!!o&&a.h(o),p=[];for(const g of t.tiles||[])a.j(g)?p.push(this.canonicalizeTileURL(g,u)):p.push(g);return p}_makeAPIURL(t,o){const u="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",p=je(a.e.API_URL);if(t.protocol=p.protocol,t.authority=p.authority,t.protocol==="http"){const g=t.params.indexOf("secure");g>=0&&t.params.splice(g,1)}if(p.path!=="/"&&(t.path=`${p.path}${t.path}`),!a.e.REQUIRE_ACCESS_TOKEN)return St(t);if(o=o||a.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!o)throw new Error(`An API access token is required to use Mapbox GL. ${u}`);
218if(o[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${u}`)}return t.params=t.params.filter(g=>g.indexOf("access_token")===-1),t.params.push(`access_token=${o||""}`),St(t)}}const Si=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function je(c){const t=c.match(Si);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function St(c){const t=c.params.length?`?${c.params.join("&")}`:"";return`${c.protocol}://${c.authority}${c.path}${t}`}const Tt="mapbox.eventData";function _i(c){if(!c)return null;const t=c.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(a.l(t[1]))}catch{return null}}class ei{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const o=_i(a.e.ACCESS_TOKEN);let u="";return u=o&&o.u?a.f(o.u):a.e.ACCESS_TOKEN||"",t?`${Tt}.${t}:${u}`:`${Tt}:${u}`}fetchEventData(){const t=a.s("localStorage"),o=this.getStorageKey(),u=this.getStorageKey("uuid"),p=this.getStorageKey("uuidTimestamp");if(t)try{const g=localStorage.getItem(o);g&&(this.eventData=JSON.parse(g));const y=localStorage.getItem(u);y&&(this.anonId=y);const b=localStorage.getItem(p);b&&(this.anonIdTimestamp=Number(b));const T=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<T)&&this.refreshUUID()}catch{a.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=a.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=a.s("localStorage"),o=this.getStorageKey(),u=this.getStorageKey("uuid"),p=this.getStorageKey("uuidTimestamp"),g=this.anonId,y=this.anonIdTimestamp;if(t&&g)try{localStorage.setItem(u,g),Object.keys(this.eventData).length>=1&&localStorage.setItem(o,JSON.stringify(this.eventData)),y&&localStorage.setItem(p,y.toString())}catch{a.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,o,u,p){if(!a.e.EVENTS_URL)return;const g=je(a.e.EVENTS_URL);g.params.push(`access_token=${p||a.e.ACCESS_TOKEN||""}`);const y={event:this.type,created:new Date(t).toISOString()},b=o?Object.assign(y,o):y,T={url:St(g),headers:{"Content-Type":"text/plain"},body:JSON.stringify([b])};this.pendingRequest=a.p(T,C=>{this.pendingRequest=null,u(C),this.saveEventData(),this.processRequests(p)})}queueRequest(t,o){this.queue.push(t),this.processRequests(o)}}class Ue extends ei{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!a.e.EVENTS_URL||!t&&!a.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID();const o=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:o},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:o,payload:u}=this.queue.shift();this.postEvent(o,u,()=>{},t)}}const Dt=new class extends ei{constructor(c){super("appUserTurnstile"),this._customAccessToken=c}postTurnstileEvent(c,t){a.e.EVENTS_URL&&a.e.ACCESS_TOKEN&&Array.isArray(c)&&c.some(o=>a.h(o)||a.j(o))&&this.queueRequest(Date.now(),t)}processRequests(c){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=_i(a.e.ACCESS_TOKEN),o=t?t.u:a.e.ACCESS_TOKEN;let u=o!==this.eventData.tokenU;a.v(this.anonId)||(this.refreshUUID(),u=!0);const p=this.queue.shift();if(this.eventData.lastSuccess){const g=new Date(this.eventData.lastSuccess),y=new Date(p),b=(p-this.eventData.lastSuccess)/864e5;u=u||b>=1||b<-1||g.getDate()!==y.getDate()}else u=!0;u?this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:ue,skuId:ai,"enabled.telemetry":!1,userId:this.anonId},g=>{g||(this.eventData.lastSuccess=p,this.eventData.tokenU=o)},c):this.processRequests()}},bt=Dt.postTurnstileEvent.bind(Dt),Ht=new class extends ei{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(c,t,o,u){this.skuToken=t,this.errorCb=u,a.e.EVENTS_URL&&(o||a.e.ACCESS_TOKEN?this.queueRequest({id:c,timestamp:Date.now()},o):this.errorCb(new Error(Vt)))}processRequests(c){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID(),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:ue,skuId:ai,skuToken:this.skuToken,userId:this.anonId},u=>{u?this.errorCb(u):t&&(this.success[t]=!0)},c))}remove(){this.errorCb=null}},ui=Ht.postMapLoadEvent.bind(Ht),hi=new class extends ei{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(c){let t=this.mapInstanceIdMap.get(c);return t||(t=a.u(),this.mapInstanceIdMap.set(c,t)),t}getEventId(c){const t=this.eventIdPerMapInstanceMap.get(c)||0;return this.eventIdPerMapInstanceMap.set(c,t+1),t}postStyleLoadEvent(c,t){const{map:o,style:u,importedStyles:p}=t;if(!a.e.EVENTS_URL||!c&&!a.e.ACCESS_TOKEN)return;const g=this.getMapInstanceId(o),y={mapInstanceId:g,eventId:this.getEventId(g),style:u};p.length&&(y.importedStyles=p),this.queueRequest({timestamp:Date.now(),payload:y},c)}processRequests(c){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:o}=this.queue.shift();this.postEvent(t,o,()=>{}
vendor: 13,431 bytes, line 218
218,c)}},Ai=hi.postStyleLoadEvent.bind(hi),Oi=new Ue({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),xi=Oi.postMetricsEvent.bind(Oi),ln=new Ue({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Xn=ln.postMetricsEvent.bind(ln),Or=new class extends ei{constructor(){super("gljs.performance")}postPerformanceEvent(c,t){a.e.EVENTS_URL&&(c||a.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},c)}processRequests(c){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:o}=this.queue.shift(),u=(function(p){const g=performance.getEntriesByType("resource"),y=performance.getEntriesByType("mark"),b=(function(N){const H={};if(N){for(const j in N)if(j!=="other")for(const q of N[j]){const W=`${j}ResolveRangeMin`,ne=`${j}ResolveRangeMax`,ie=`${j}RequestCount`,ee=`${j}RequestCachedCount`;H[W]=Math.min(H[W]||1/0,q.startTime),H[ne]=Math.max(H[ne]||-1/0,q.responseEnd);const xe=me=>{H[me]===void 0&&(H[me]=0),++H[me]};q.transferSize!==void 0&&q.transferSize===0&&xe(ee),xe(ie)}}return H})((function(N,H){const j={};if(N)for(const q of N){const W=H(q);j[W]===void 0&&(j[W]=[]),j[W].push(q)}return j})(g,oe)),T=window.devicePixelRatio,C=navigator.connection||navigator.mozConnection||navigator.webkitConnection,I=C?C.effectiveType:void 0,B={counters:[],metadata:[],attributes:[]},L=(N,H,j)=>{j!=null&&N.push({name:H,value:j.toString()})};for(const N in b)L(B.counters,N,b[N]);if(p.interactionRange[0]!==1/0&&p.interactionRange[1]!==-1/0&&(L(B.counters,"interactionRangeMin",p.interactionRange[0]),L(B.counters,"interactionRangeMax",p.interactionRange[1])),y)for(const N of Object.values(re)){const H=y.find(j=>j.name===N);H&&L(B.counters,N,H.startTime)}return L(B.counters,"visibilityHidden",p.visibilityHidden),L(B.attributes,"style",(function(N){if(N)for(const H of N){const j=H.name.split("?")[0];if(a.i(j)){const q=j.split("/").slice(-2);if(q.length===2)return`mapbox://styles/${q[0]}/${q[1]}`}}})(g)),L(B.attributes,"terrainEnabled",p.terrainEnabled?"true":"false"),L(B.attributes,"fogEnabled",p.fogEnabled?"true":"false"),L(B.attributes,"projection",p.projection),L(B.attributes,"zoom",p.zoom),L(B.metadata,"devicePixelRatio",T),L(B.metadata,"connectionEffectiveType",I),L(B.metadata,"navigatorUserAgent",navigator.userAgent),L(B.metadata,"screenWidth",window.screen.width),L(B.metadata,"screenHeight",window.screen.height),L(B.metadata,"windowWidth",window.innerWidth),L(B.metadata,"windowHeight",window.innerHeight),L(B.metadata,"mapWidth",p.width/T),L(B.metadata,"mapHeight",p.height/T),L(B.metadata,"webglRenderer",p.renderer),L(B.metadata,"webglVendor",p.vendor),L(B.metadata,"sdkVersion",ue),L(B.metadata,"sdkIdentifier","mapbox-gl-js"),B})(o);for(const p of u.metadata);for(const p of u.counters);for(const p of u.attributes);this.postEvent(t,u,()=>{},c)}},Nn=Or.postPerformanceEvent.bind(Or),bo=new class extends ei{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(c,t,o,u){if(!a.e.API_URL||!a.e.SESSION_PATH)return;const p=je(a.e.API_URL+a.e.SESSION_PATH);p.params.push(`sku=${t||""}`),p.params.push(`access_token=${u||a.e.ACCESS_TOKEN||""}`);const g={url:St(p),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a.g(g,y=>{this.pendingRequest=null,o(y),this.saveEventData(),this.processRequests(u)})}getSessionAPI(c,t,o,u){this.skuToken=t,this.errorCb=u,a.e.SESSION_PATH&&a.e.API_URL&&(o||a.e.ACCESS_TOKEN?this.queueRequest({id:c,timestamp:Date.now()},o):this.errorCb(new Error(Vt)))}processRequests(c){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||this.getSession(o,this.skuToken,u=>{u?this.errorCb(u):t&&(this.success[t]=!0)},c)}remove(){this.errorCb=null}},Ka=bo.getSessionAPI.bind(bo),Qa=new Set;function Oo(c,t){t?Qa.add(c):Qa.delete(c)}class rr{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,o){this._updatedSourceCaches[t]=o,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const o=t.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(t.id),this.setDirty()}removeLayer(t){const o=t.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][t.id]=t,this._updatedLayers[o].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const o in this._updatedLayers)t[o]=t[o]||{},t[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)t[o]=t[o]||{},t[o].removedIds=Object.keys(this._removedLayers[o]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,o){this._updatedImages[o]=this._updatedImages[o]||new Set,this._updatedImages[o].add(a.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function wo(c){const{userImage:t}=c;return!!(t&&t.render&&t.render())&&(c.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ja extends a.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&a.r()&&(this.imageRasterizerDispatcher=new a.D(a.t(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new a.q({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const o=this.atlasTexture.get(t);o&&(o.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,o){this.imageProviders.has(o)||this.imageProviders.set(o,new Map),this.imageProviders.get(o).set(t.id,t)}removeImageProvider(t,o){this.imageProviders.has(o)&&this.imageProviders.get(o).delete(t)}getPendingImageProviders(){const t=[];for(const o of this.imageProviders.values())for(const u of o.values())u.hasPendingRequests()&&t.push(u);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new a.x),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,o){if(this.loaded.get(o)!==t&&(this.loaded.set(o,t),t)){for(const{ids:u,callback:p}of this.requestors)this._notify(u,o,p);this.requestors=[]}}hasImage(t,o){return!!this.getImage(t,o)}getImage(t,o){return this.images.get(o).get(t.toString())}addImage(t,o,u){this._validate(t,u)&&this.images.get(o).set(t.toString(),u)}_validate(t,o){let u=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new a.y(new Error(`Image "${t.name}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new a.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new a.y(new Error(`Image "${t.name}" has invalid "content" value`))),u=!1),u}_validateStretch(t,o){if(!t)return!0;let u=0;for(const p of t){if(p[0]<u||p[1]<p[0]||o<p[1])return!1;u=p[1]}return!0}_validateContent(t,o){return t?t.length!==4||!o.usvg&&(t[0]<0||o.data.width<t[0]||t[1]<0||o.data.height<t[1]||t[2]<0||o.data.width<t[2]||t[3]<0||o.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,o,u){const p=this.images.get(o).get(t.toString());u.version=p.version+1,this.images.get(o).set(t.toString(),u),this.updatedImages.get(o).add(t),this.removeFromImageRasterizerCache(t,o)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,o){this.spriteFormat!=="raster"&&(a.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:o}):this.imageRasterizer.removeImagesFromCacheByIds([t],o))}removeImage(t,o){const u=this.images.get(o),p=u.get(t.toString());u.delete(t.toString()),this.patterns.get(o).delete(t.toString()),this.removeFromImageRasterizerCache(t,o),p.userImage&&p.userImage.onRemove&&p.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(o=>a.I.from(o))}getImages(t,o,u){const p=[],g=[],y=this.imageProviders.get(o);for(const I of t){if(!I.iconsetId){p.push(I);continue}const B=y.get(I.iconsetId);B&&(this.getImage(I,o)?g.push(I):B.addPendingRequest(I))}if(p.length===0)return void this._notify(g,o,u);let b=!0;const T=!!this.loaded.get(o),C=this.images.get(o);if(!T)for(const I of p)C.has(I.toString())||(b=!1);T||b?this._notify(p,o,u):this.requestors.push({ids:p,scope:o,callback:u})}rasterizeImages(t,o){const u=new Map,{tasks:p,scope:g}=t;for(const[y,b]of p.entries()){const T=this.getImage(b.id,g);T&&u.set(y,{image:T,imageVariant:b})}this._rasterizeImages(g,u,o)}_rasterizeImages(t,o,u){if(a.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:o,scope:t},u);else{const p=new Map;for(const[g,{image:y,imageVariant:b}]of o.entries())p.set(g,this.imageRasterizer.rasterize(b,y,t,0));u(void 0,p)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,o,u){const p=this.images.get(o),g=new Map;for(const y of t){if(!p.get(y.toString())){if(y.iconsetId)continue;this.fire(new a.z("styleimagemissing",{id:y.name}))}const b=p.get(y.toString());if(!b){a.w(`Image "${y.name}" 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.`);continue}const T={data:b.usvg?null:b.data.clone(),pixelRatio:b.pixelRatio,sdf:b.sdf,usvg:b.usvg,version:b.version,stretchX:b.stretchX,stretchY:b.stretchY,content:b.content,hasRenderCallback:!!(b.userImage&&b.userImage.render)};b.usvg&&Object.assign(T,{width:b.icon.usvg_tree.width,height:b.icon.usvg_tree.height}),g.set(a.I.toString(y),T)}u(null,g)}getPixelSize(t){const{width:o,height:u}=this.atlasImage.get(t);return{width:o,height:u}}getPattern(t,o,u){const p=t.toString(),g=this.patterns.get(o),y=g.get(p),b=this.getImage(t,o);if(!b)return null;if(y){if(y.position.version===b.version)return y.position;y.position.version=b.version}else{if(b.usvg&&!b.data){const T=this.getPatternInFlightId(p,o);if(this.patternsInFlight.has(T))return null;this.patternsInFlight.add(T);const C=new a.A(t).scaleSelf(a.o.devicePixelRatio),I=new Map([[C.toString(),{image:b,imageVariant:C}]]);return this._rasterizeImages(o,I,(B,L)=>this.storePatternImage(C,o,b,u,L)),null}this.storePattern(t,o,b)}return this._updatePatternAtlas(o,u),g.get(p).position}getPatternInFlightId(t,o){return a.B(t,o)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,o,u,p,g){const y=t.toString(),b=g?g.get(y):void 0;b&&(u.data=b,this.storePattern(t.id,o,u),this._updatePatternAtlas(o,p),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),o)))}storePattern(t,o,u){const p={w:u.data.width+2*a.C,h:u.data.height+2*a.C,x:0,y:0},g=new a.F(p,u,a.C);this.patterns.get(o).set(t.toString(),{bin:p,position:g})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,o){const u=t.gl;let p=this.atlasTexture.get(o);p?this.dirty&&(p.update(this.atlasImage.get(o)),this.dirty=!1):(p=new a.T(t,this.atlasImage.get(o),u.RGBA8),this.atlasTexture.set(o,p)),p.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(t,o){const u=this.patterns.get(t),p=Array.from(u.values()).map(({bin:C})=>C),{w:g,h:y}=a.G(p),b=this.atlasImage.get(t);b.resize({width:g||1,height:y||1});const T=this.images.get(t);for(const[C,{bin:I,position:B}]of u.entries()){let L=B.padding;const N=I.x+L,H=I.y+L,j=T.get(C).data,q=j.width,W=j.height;L=L>1?L-1:L,a.q.copy(j,b,{x:0,y:0},{x:N,y:H},{width:q,height:W},o),a.q.copy(j,b,{x:0,y:W-L},{x:N,y:H-L},{width:q,height:L},o),a.q.copy(j,b,{x:0,y:0},{x:N,y:H+W},{width:q,height:L},o),a.q.copy(j,b,{x:q-L,y:0},{x:N-L,y:H},{width:L,height:W},o),a.q.copy(j,b,{x:0,y:0},{x:N+q,y:H},{width:L,height:W},o),a.q.copy(j,b,{x:q-L,y:W-L},{x:N-L,y:H-L},{width:L,height:L},o),a.q.copy(j,b,{x:0,y:W-L},{x:N+q,y:H-L},{width:L,height:L},o),a.q.copy(j,b,{x:0,y:0},{x:N+q,y:H+W},{width:L,height:L},o),a.q.copy(j,b,{x:q-L,y:0},{x:N-L,y:H+W},{width:L,height:L},o)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
218dispatchRenderCallbacks(t,o){const u=this.images.get(o);for(const p of t){if(this.callbackDispatchedThisFrame.get(o).has(p.toString()))continue;this.callbackDispatchedThisFrame.get(o).add(p.toString());const g=u.get(p.toString());wo(g)&&this.updateImage(p,o,g)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ys(c){const t=c.value,o=c.valueSpec,u=c.style,p=c.styleSpec,g=c.key,y=c.arrayElementValidator||vn;if(!Array.isArray(t))return[new a.V(g,t,`array expected, ${a.K(t)} found`)];if(o.length&&t.length!==o.length)return[new a.V(g,t,`array length ${o.length} expected, length ${t.length} found`)];if(o["min-length"]&&t.length<o["min-length"])return[new a.V(g,t,`array length at least ${o["min-length"]} expected, length ${t.length} found`)];let b={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};p.$version<7&&(b.function=o.function),a.H(o.value)&&(b=o.value);let T=[];for(let C=0;C<t.length;C++)T=T.concat(y({array:t,arrayIndex:C,value:t[C],valueSpec:b,style:u,styleSpec:p,key:`${g}[${C}]`},!0));return T}function Wr(c){const t=c.key,o=c.value,u=c.valueSpec;if(!a.L(o))return[new a.V(t,o,`number expected, ${a.K(o)} found`)];if(o!=o)return[new a.V(t,o,"number expected, NaN found")];if("minimum"in u){let p=u.minimum;if(Array.isArray(u.minimum)&&(p=u.minimum[c.arrayIndex]),o<p)return[new a.V(t,o,`${o} is less than the minimum value ${p}`)]}if("maximum"in u){let p=u.maximum;if(Array.isArray(u.maximum)&&(p=u.maximum[c.arrayIndex]),o>p)return[new a.V(t,o,`${o} is greater than the maximum value ${p}`)]}return[]}function es(c){const t=c.key,o=c.value;if(!a.H(o))return[new a.V(t,o,`object expected, ${a.K(o)} found`)];const u=c.valueSpec,p=a.J(o.type);let g,y,b,T={};const C=p!=="categorical"&&o.property===void 0,I=!C,B=(function(j){const q=j.stops;return Array.isArray(q)&&Array.isArray(q[0])&&a.H(q[0][0])})(o),L=ki({key:c.key,value:c.value,valueSpec:c.styleSpec.function,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(j){if(p==="identity")return[new a.V(j.key,j.value,'identity function may not have a "stops" property')];let q=[];const W=j.value;return q=q.concat(Ys({key:j.key,value:W,valueSpec:j.valueSpec,style:j.style,styleSpec:j.styleSpec,arrayElementValidator:N})),Array.isArray(W)&&W.length===0&&q.push(new a.V(j.key,W,"array must have at least one stop")),q},default:function(j){return vn({key:j.key,value:j.value,valueSpec:u,style:j.style,styleSpec:j.styleSpec})}}});return p==="identity"&&C&&L.push(new a.V(c.key,c.value,'missing required property "property"')),p==="identity"||o.stops||L.push(new a.V(c.key,c.value,'missing required property "stops"')),p==="exponential"&&u.expression&&!a.M(u)&&L.push(new a.V(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>
218=8&&(I&&!a.N(u)?L.push(new a.V(c.key,c.value,"property functions not supported")):C&&!a.O(u)&&L.push(new a.V(c.key,c.value,"zoom functions not supported"))),p!=="categorical"&&!B||o.property!==void 0||L.push(new a.V(c.key,c.value,'"property" property is required')),L;function N(j){let q=[];const W=j.value,ne=j.key;if(!Array.isArray(W))return[new a.V(ne,W,`array expected, ${a.K(W)} found`)];if(W.length!==2)return[new a.V(ne,W,`array length 2 expected, length ${W.length} found`)];if(B){if(!a.H(W[0]))return[new a.V(ne,W,`object expected, ${a.K(W[0])} found`)];const ie=W[0];if(ie.zoom===void 0)return[new a.V(ne,W,"object stop key must have zoom")];if(ie.value===void 0)return[new a.V(ne,W,"object stop key must have value")];const ee=a.J(ie.zoom);if(typeof ee!="number")return[new a.V(ne,ie.zoom,"stop zoom values must be numbers")];if(b&&b>ee)return[new a.V(ne,ie.zoom,"stop zoom values must appear in ascending order")];ee!==b&&(b=ee,y=void 0,T={}),q=q.concat(ki({key:`${ne}[0]`,value:W[0],valueSpec:{zoom:{}},style:j.style,styleSpec:j.styleSpec,objectElementValidators:{zoom:Wr,value:H}}))}else q=q.concat(H({key:`${ne}[0]`,value:W[0],style:j.style,styleSpec:j.styleSpec},W));return a.Q(a.S(W[1]))?q.concat([new a.V(`${ne}[1]`,W[1],"expressions are not allowed in function stops.")]):q.concat(vn({key:`${ne}[1]`,value:W[1],valueSpec:u,style:j.style,styleSpec:j.styleSpec}))}function H(j,q){const W=a.K(j.value),ne=a.J(j.value),ie=j.value!==null?j.value:q;if(g){if(W!==g)return[new a.V(j.key,ie,`${W} stop domain type must match previous stop domain type ${g}`)]}else g=W;if(W!=="number"&&W!=="string"&&W!=="boolean"&&typeof ne!="number"&&typeof ne!="string"&&typeof ne!="boolean")return[new a.V(j.key,ie,"stop domain value must be a number, string, or boolean")];if(W!=="number"&&p!=="categorical"){let ee=`number expected, ${W} found`;return a.N(u)&&p===void 0&&(ee+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new a.V(j.key,ie,ee)]}return p!=="categorical"||W!=="number"||typeof ne=="number"&&isFinite(ne)&&Math.floor(ne)===ne?p!=="categorical"&&W==="number"&&typeof ne=="number"&&typeof y=="number"&&y!==void 0&&ne<y?[new a.V(j.key,ie,"stop domain values must appear in ascending order")]:(y=ne,p==="categorical"&&ne in T?[new a.V(j.key,ie,"stop domain values must be unique")]:(T[ne]=!0,[])):[new a.V(j.key,ie,`integer expected, found ${String(ne)}`)]}}function pr(c){const t=(c.expressionContext==="property"?a.W:a.U)(a.S(c.value),c.valueSpec);if(t.result==="error")return t.value.map(u=>new a.V(`${c.key}${u.key}`,c.value,u.message));const o=t.value.expression||t.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!o.outputDefined())return[new a.V(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!a.Z(o))return[new a.V(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter")return Bo(o,c);if(c.expressionContext==="appearance")return oa(o,c);if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!a.X(o,["zoom","feature-state"]))return[new a.V(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!a.Y(o))return[new a.V(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Bo(c,t){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const p of t.valueSpec.expression.parameters)o.delete(p);if(o.size===0)return[];const u=[];return c instanceof a._&&o.has(c.name)?[new a.V(t.key,t.value,`["${c.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(c.eachChild(p=>{u.push(...Bo(p,t))}),u)}function oa(c,t){const o=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const p of t.valueSpec.expression.parameters)o.add(p);if(o.size===0)return[];const u=[];return c instanceof a._&&!o.has(c.name)?[new a.V(t.key,t.value,`["${c.name}"] is not an allowed parameter`)]:(c.eachChild(p=>{u.push(...oa(p,t))}),u)}function ts(c){const t=c.key,o=c.value,u=c.valueSpec,p=[];return Array.isArray(u.values)?u.values.indexOf(a.J(o))===-1&&p.push(new a.V(t,o,`expected one of [${u.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(u.values).indexOf(a.J(o))===-1&&p.push(new a.V(t,o,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(o)} found`)),p}function Sa(c){return a.a2(a.S(c.value))?pr(Object.assign({},c,{expressionContext:"filter",valueSpec:c.styleSpec[`filter_${c.layerType||"fill"}`]})):bs(c)}function bs(c){const t=c.value,o=c.key;if(!Array.isArray(t))return[new a.V(o,t,`array expected, ${a.K(t)} found`)];if(t.length<1)return[new a.V(o,t,"filter array must have at least 1 element")];const u=c.styleSpec;let p=ts({key:`${o}[0]`,value:t[0],valueSpec:u.filter_operator});const g=()=>{t.length>=2&&(a.a0(t[1])||p.push(new a.V(`${o}[1]`,t[1],`string expected, ${a.K(t[1])} found`)));for(let y=2;y<t.length;y++)a.J(t[1])==="$type"?p=p.concat(ts({key:`${o}[${y}]`,value:t[y],valueSpec:u.geometry_type})):a.a0(t[y])||a.L(t[y])||a.$(t[y])||p.push(new a.V(`${o}[${y}]`,t[y],`string, number, or boolean expected, ${a.K(t[y])} found.`))};
218switch(a.J(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&a.J(t[1])==="$type"&&p.push(new a.V(o,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&p.push(new a.V(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),g();break;case"==":case"!=":t.length!==3&&p.push(new a.V(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),g();break;case"in":case"!in":g();break;case"any":case"all":case"none":for(let y=1;y<t.length;y++)p=p.concat(bs({key:`${o}[${y}]`,value:t[y],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":t.length!==2?p.push(new a.V(o,t,`filter array for "${t[0]}" operator must have 2 elements`)):a.a0(t[1])||p.push(new a.V(`${o}[1]`,t[1],`string expected, ${a.K(t[1])} found`))}return p}function zr(c,t){const o=c.key,u=c.style,p=c.layer,g=c.styleSpec,y=c.value,b=c.objectKey,T=g[`${t}_${c.layerType}`];if(!T)return[];const C=b.match(/^(.*)-use-theme$/);if(C&&T[C[1]])return a.Q(a.S(y))?[].concat(vn({key:o,value:y,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:u,styleSpec:g,expressionContext:"property",propertyType:t,propertyKey:b})):vn({key:o,value:y,valueSpec:{type:"string"},style:u,styleSpec:g});const I=b.match(/^(.*)-transition$/);if(t==="paint"&&I&&T[I[1]]&&T[I[1]].transition)return vn({key:o,value:y,valueSpec:g.transition,style:u,styleSpec:g});const B=c.valueSpec||T[b];if(!B)return[new a.a3(o,y,`unknown property "${b}"`)];let L;if(a.a0(y)&&a.N(B)&&!B.tokens&&(L=/^{([^}]+)}$/.exec(y))){const H=`\`{ "type": "identity", "property": ${L?JSON.stringify(L[1]):'"_"'} }\``;return[new a.V(o,y,`"${b}" does not support interpolation syntax
219Use an identity property function instead: ${H}.`)]}const N=[];if(c.layerType==="symbol")b!=="text-field"||!u||u.glyphs||u.imports||N.push(new a.V(o,y,'use of "text-field" requires a style "glyphs" property')),b==="text-font"&&a.a4(a.S(y))&&a.J(y.type)==="identity"&&N.push(new a.V(o,y,'"text-font" does not support identity functions'));else if(c.layerType==="model"&&t==="paint"&&p&&p.layout&&p.layout.hasOwnProperty("model-id")&&a.N(B)&&(a.a5(B)||a.O(B))){const H=a.W(a.S(y),B).value,j="expression"in H&&H.expression||"_styleExpression"in H&&H._styleExpression&&H._styleExpression.expression;j&&!a.X(j,["measure-light"])&&(b==="model-emissive-strength"&&a.Y(j)&&a.Z(j)||N.push(new a.V(o,y,`${b} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return N.concat(vn({key:c.key,value:y,valueSpec:B,style:u,styleSpec:g,expressionContext:"property",propertyType:t,propertyKey:b}))}function El(c){return zr(c,"paint")}function oo(c){return zr(c,"layout")}function ws(c){let t=[];const o=c.value,u=c.key,p=c.style,g=c.styleSpec;if(!a.H(o))return[new a.V(u,o,"object expected")];o.type||o.ref||t.push(new a.V(u,o,'either "type" or "ref" is required'));let y=a.J(o.type);const b=a.J(o.ref);if(o.id){const T=a.J(o.id);for(let C=0;C<c.arrayIndex;C++){const I=p.layers[C];a.J(I.id)===T&&t.push(new a.V(u,o.id,`duplicate layer id "${T}", previously used at line ${I.id.__line__}`))}}if("ref"in o){let T;["type","source","source-layer","filter","layout"].forEach(C=>{C in o&&t.push(new a.V(u,o[C],`"${C}" is prohibited for ref layers`))}),p.layers.forEach(C=>{a.J(C.id)===b&&(T=C)}),T?T.ref?t.push(new a.V(u,o.ref,"ref cannot reference another ref layer")):y=a.J(T.type):typeof b=="string"&&t.push(new a.V(u,o.ref,`ref layer "${b}" not found`))}else if(y!=="background"&&y!=="sky"&&y!=="slot")if(o.source)if(a.a0(o.source)){const T=p.sources&&p.sources[o.source],C=T&&a.J(T.type);T?C==="vector"&&y==="raster"?t.push(new a.V(u,o.source,`layer "${o.id}" requires a raster source`)):C==="raster"&&y!=="raster"?t.push(new a.V(u,o.source,`layer "${o.id}" requires a vector source`)):C!=="vector"||o["source-layer"]?C==="raster-dem"&&y!=="hillshade"?t.push(new a.V(u,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):C!=="raster-array"||["raster","raster-particle"].includes(y)?y==="line"&&o.paint&&(o.paint["line-gradient"]||o.paint["line-trim-offset"])&&C==="geojson"&&!T.lineMetrics?t.push(new a.V(u,o,`layer "${o.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):y==="raster-particle"&&C!=="raster-array"&&t.push(new a.V(u,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):t.push(new a.V(u,o.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new a.V(u,o,`layer "${o.id}" must specify a "source-layer"`)):t.push(new a.V(u,o.source,`source "${o.source}" not found`))}else t.push(new a.V(`${u}.source`,o.source,'"source" must be a string'));else t.push(new a.V(u,o,'missing required property "source"'));return t=t.concat(ki({key:u,value:o,valueSpec:g.layer,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{"*":()=>[],type:()=>vn({key:`${u}.type`,value:o.type,valueSpec:g.layer.type,style:c.style,styleSpec:c.styleSpec,object:o,objectKey:"type"}),filter:T=>Sa(Object.assign({layerType:y},T)),layout:T=>ki({layer:o,key:T.key,value:T.value,valueSpec:{},style:T.style,styleSpec:T.styleSpec,objectElementValidators:{"*":C=>oo(Object.assign({layerType:y},C))}}),paint:T=>ki({layer:o,key:T.key,value:T.value,valueSpec:{},style:T.style,styleSpec:T.styleSpec,objectElementValidators:{"*":C=>El(Object.assign({layerType:y,layer:o},C))}}),appearances(T){const C=Ys({key:T.key,value:T.value,valueSpec:T.valueSpec,style:T.style,styleSpec:T.styleSpec,arrayElementValidator:L=>(function(N){const{key:H,layer:j,layerType:q}=N,W=a.J(N.value),ne=a.J(W.name),ie=a.J(W.condition),ee=ki({key:H,value:W,valueSpec:N.styleSpec.appearance,style:N.style,styleSpec:N.styleSpec,objectElementValidators:{condition:xe=>(function(me){const ye=[];return ye.push(...pr({key:me.key,value:me.object.condition,valueSpec:a.a6.appearance.condition,expressionContext:"appearance"})),ye})(Object.assign({layer:j,layerType:q},xe)),properties:xe=>(function(me){const ye=[],{styleSpec:de,layer:se,layerType:Te}=me,Ae=de[`paint_${Te}`],Re=de[`layout_${Te}`],Be=me.object[me.objectKey];for(const Le in Be){const $e=Le in Ae?"paint":Le in Re?"layout":void 0;if(!$e){ye.push(new a.V(me.key,Le,`unknown property "${Le}" for layer type "${Te}"`));continue}const ot=Object.assign({},me,{key:`${me.key}.${Le}
219`,object:Be,objectKey:Le,layer:se,layerType:Te,value:Be[Le],valueSpec:$e==="paint"?Ae[Le]:Re[Le]});ye.push(...zr(ot,$e))}return ye})(Object.assign({layer:j,layerType:q},xe))}});return ne!=="hidden"&&ie===void 0&&ee.push(new a.V(N.key,"name",'Appearance with name different than "hidden" must have a condition')),ee})(Object.assign({layerType:y,layer:o},L))}),I=Array.isArray(T.value)?T.value:[],B=new Set;return I.forEach((L,N)=>{const H=a.J(L.name);if(H)if(B.has(H)){const j=a.J(o.id);C.push(new a.V(T.key,H,`Duplicated appearance name "${H}" for layer "${j}"`))}else B.add(H)}),C}}})),t}function Br({key:c,value:t}){return a.a0(t)?[]:[new a.V(c,t,`string expected, ${a.K(t)} found`)]}const mr={promoteId:function c({key:t,value:o}){if(a.a0(o))return Br({key:t,value:o});if(Array.isArray(o)){const p=[],g=a.S(o),y=a.U(g);return y.result==="error"&&y.value.forEach(b=>{p.push(new a.V(`${t}${b.key}`,null,`${b.message}`))}),a.X(y.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||p.push(new a.V(`${t}`,null,"promoteId expression should be only feature dependent")),p}if(!a.H(o))return[new a.V(t,o,`string, expression or object expected, "${a.K(o)}" found`)];const u=[];for(const p in o)u.push(...c({key:`${t}.${p}`,value:o[p]}));return u}};function Dr(c){const t=c.value,o=c.key,u=c.styleSpec,p=c.style;if(!a.H(t))return[new a.V(o,t,`object expected, ${a.K(t)} found`)];if(!("type"in t))return[new a.V(o,t,'"type" is required')];const g=a.J(t.type);let y=[];switch(["vector","raster","raster-dem","raster-array"].includes(g)&&("url"in t||"tiles"in t||y.push(new a.a3(o,t,'Either "url" or "tiles" is required.'))),g){case"vector":case"raster":case"raster-dem":case"raster-array":return y=y.concat(ki({key:o,value:t,valueSpec:u[`source_${g.replace("-","_")}`],style:c.style,styleSpec:u,objectElementValidators:mr})),y;case"geojson":if(y=ki({key:o,value:t,valueSpec:u.source_geojson,style:p,styleSpec:u,objectElementValidators:mr}),"cluster"in t&&"clusterProperties"in t){if(!a.H(t.clusterProperties))return[new a.V(`${o}.clusterProperties`,t,`object expected, ${a.K(t)} found`)];for(const b in t.clusterProperties){const T=t.clusterProperties[b];if(!Array.isArray(T))return[new a.V(`${o}.clusterProperties.${b}`,T,"array expected")];const[C,I]=T,B=typeof C=="string"?[C,["accumulated"],["get",b]]:C;y.push(...pr({key:`${o}.${b}.map`,value:I,expressionContext:"cluster-map"})),y.push(...pr({key:`${o}.${b}.reduce`,value:B,expressionContext:"cluster-reduce"}))}}return y;case"video":return ki({key:o,value:t,valueSpec:u.source_video,style:p,styleSpec:u});case"image":return ki({key:o,value:t,valueSpec:u.source_image,style:p,styleSpec:u});case"canvas":return[new a.V(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ts({key:`${o}.type`,value:t.type,valueSpec:{values:Ts(u)}})}}function Ts(c){return c.source.reduce((t,o)=>{const u=c[o];return u.type.type==="enum"&&(t=t.concat(Object.keys(u.type.values||{}))),t},[])}function is(c){const t=c.value,o=c.styleSpec,u=o.light,p=c.style;if(t===void 0)return[];if(!a.H(t))return[new a.V("light",t,`object expected, ${a.K(t)} found`)];let g=[];for(const y in t){const b=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);g=g.concat(T&&u[T[1]]?vn({key:y,value:t[y],valueSpec:{type:"string"},style:p,styleSpec:o}):b&&u[b[1]]&&u[b[1]].transition?vn({key:y,value:t[y],valueSpec:o.transition,style:p,styleSpec:o}):u[y]?vn({key:y,value:t[y],valueSpec:u[y],style:p,styleSpec:o}):[new a.V(y,t[y],`unknown property "${y}"`)])}return g}function To(c){const t=c.value;if(!t)return[];const o=c.key;if(!a.H(t))return[new a.V(o,t,`object expected, ${a.K(t)} found`)];let u=[];const p=c.styleSpec,g=p["light-3d"],y=c.style,b=c.style.lights;for(const I of["type","id"])if(!(I in t))return u=u.concat([new a.V(o,t,`missing property "${I}"`)]),u;if(!a.a0(t.type))return u=u.concat([new a.V(`${o}.type`,t.type,"string expected")]),u;if(b)for(let I=0;I<c.arrayIndex;I++){const B=a.J(t.type),L=b[I];a.J(L.type)===B&&u.push(new a.V(o,t.id,`duplicate light type "${t.type}", previously defined at line ${L.id.__line__}`))}const T=`properties_light_${t.type}`;if(!(T in p))return u=u.concat([new a.V(`${o}.type`,t,`Invalid light type ${t.type}`)]),u;const C=p[T];for(const I in t)if(I==="properties"){const B=t[I];if(!a.H(B))return u=u.concat([new a.V("properties",B,`object expected, ${a.K(B)} found`)]),u;for(const L in B){const N=L.match(/^(.*)-transition$/),H=L.match(/^(.*)-use-theme$/);u=u.concat(H&&C[H[1]]?vn({key:I,value:B[L],valueSpec:{type:"string"},style:y,styleSpec:p}):N&&C[N[1]]&&C[N[1]].transition?vn({key:I,value:t[I],valueSpec:p.transition,style:y,styleSpec:p}):C[L]?vn({key:L,value:B[L],valueSpec:C[L],style:y,styleSpec:p}):[new a.a3(c.key,B[L],`unknown property "${L}"`)])}}else u=u.concat(g[I]?vn({key:I,value:t[I],valueSpec:g[I],style:y,styleSpec:p}):[new a.a3(I,t[I],`unknown property "${I}"`)]);return u}function ka(c){const t=c.value,o=c.key,u=c.style,p=c.styleSpec,g=p.terrain;if(t==null)return[];if(!a.H(t))return[new a.V("terrain",t,`object expected, ${a.K(t)} found`)];let y=[];for(const b in t){const T=b.match(/^(.*)-transition$/),C=b.match(/^(.*)-use-theme$/);y=y.concat(C&&g[C[1]]?vn({key:b,value:t[b],valueSpec:{type:"string"},style:u,styleSpec:p}):T&&g[T[1]]&&g[T[1]].transition?vn({key:b,value:t[b],valueSpec:p.transition,style:u,styleSpec:p}):g[b]?vn({key:b,value:t[b],valueSpec:g[b],style:u,styleSpec:p}):[new a.a3(b,t[b],`unknown property "${b}
219"`)])}if(t.source)if(a.a0(t.source)){const b=u.sources&&u.sources[t.source],T=b&&a.J(b.type);b?T!=="raster-dem"&&y.push(new a.V(`${o}.source`,t.source,`terrain cannot be used with a source of type ${T}, it only be used with a "raster-dem" source type`)):y.push(new a.V(`${o}.source`,t.source,`source "${t.source}" not found`))}else y.push(new a.V(`${o}.source`,t.source,"source must be a string"));else y.push(new a.V(o,t,'terrain is missing required property "source"'));return y}function Fa(c){const t=c.value,o=c.style,u=c.styleSpec,p=u.fog;if(t===void 0)return[];if(!a.H(t))return[new a.V("fog",t,`object expected, ${a.K(t)} found`)];let g=[];for(const y in t){const b=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);g=g.concat(T&&p[T[1]]?vn({key:y,value:t[y],valueSpec:{type:"string"},style:o,styleSpec:u}):b&&p[b[1]]&&p[b[1]].transition?vn({key:y,value:t[y],valueSpec:u.transition,style:o,styleSpec:u}):p[y]?vn({key:y,value:t[y],valueSpec:p[y],style:o,styleSpec:u}):[new a.a3(y,t[y],`unknown property "${y}"`)])}return g}const ns={"*":()=>[],array:Ys,boolean:function(c){const t=c.value,o=c.key;return a.$(t)?[]:[new a.V(o,t,`boolean expected, ${a.K(t)} found`)]},number:Wr,color:function({key:c,value:t}){return a.a0(t)?a.a1.parseCSSColor(t)===null?[new a.V(c,t,`color expected, "${t}" found`)]:[]:[new a.V(c,t,`color expected, ${a.K(t)} found`)]},enum:ts,filter:Sa,function:es,layer:ws,object:ki,source:Dr,model:a.a7,light:is,"light-3d":To,terrain:ka,fog:Fa,string:Br,formatted:function(c){return Br(c).length===0?[]:pr(c)},resolvedImage:function(c){return Br(c).length===0?[]:pr(c)},projection:function(c){const t=c.value,o=c.styleSpec,u=o.projection,p=c.style;if(a.H(t)){let g=[];for(const y in t)g=g.concat(vn({key:y,value:t[y],valueSpec:u[y],style:p,styleSpec:o}));return g}return a.a0(t)?[]:[new a.V("projection",t,`object or string expected, ${a.K(t)} found`)]},import:function(c){const t=c.key,{value:o,styleSpec:u}=c;if(!a.H(o))return[new a.V(t,o,"import must be an object")];const{data:p,...g}=o;Object.defineProperty(g,"__line__",{value:o.__line__,enumerable:!1});let y=ki(Object.assign({},c,{value:g,valueSpec:u.import}));return a.J(g.id)===""&&y.push(new a.V(`${c.key}.id`,g,"import id can't be an empty string")),p&&(y=y.concat(kr(p,u,{key:`${c.key}.data`}))),y},iconset:function(c){const t=c.value,o=c.key,u=c.styleSpec,p=c.style;if(!a.H(t))return[new a.V(o,t,"object expected")];if(!t.type)return[new a.V(o,t,'"type" is required')];const g=a.J(t.type);let y=[];if(y=y.concat(ki({key:o,value:t,valueSpec:u[`iconset_${g}`],style:p,styleSpec:u})),(function(b,T){return!(b!=="source"||!T.source)})(g,t)){const b=p.sources&&p.sources[t.source],T=b&&a.J(b.type);b?T!=="raster-array"&&y.push(new a.V(o,t.source,`iconset cannot be used with a source of type ${String(T)}, it only be used with a "raster-array" source type`)):y.push(new a.V(o,t.source,`source "${t.source}" not found`))}return y}};function vn(c,t=!1){const o=c.value,u=c.valueSpec,p=c.styleSpec;if(u.expression){if(a.a4(a.J(o)))return es(c);if(a.Q(a.S(o)))return pr(c)}if(u.type&&ns[u.type]){const g=ns[u.type](c);return t===!0&&g.length>0&&Array.isArray(c.value)?pr(c):g}return ki(Object.assign({},c,{valueSpec:u.type?p[u.type]:u}))}function ki(c){const t=c.key,o=c.value,u=c.valueSpec||{},p=c.objectElementValidators||{},g=c.style,y=c.styleSpec;if(!a.H(o))return[new a.V(t,o,`object expected, ${a.K(o)} found`)];let b=[];for(const T in o){const C=T.split(".")[0];let I;p[C]?I=p[C]:u[C]?I=vn:p["*"]?I=p["*"]:u["*"]&&(I=vn),I?b=b.concat(I({key:(t&&`${t}.`)+T,value:o[T],valueSpec:u[C]||u["*"],style:g,styleSpec:y,object:o,objectKey:T},o)):b.push(new a.a3(t,o[T],`unknown property "${T}"`))}for(const T in u){if(p[T])continue;const C=u[T];C.required&&C.default===void 0&&o[T]===void 0&&b.push(new a.V(t,o,`missing required property "${T}"`))}return b}function xr({key:c,value:t}){const o=Br({key:c,value:t});if(o.length)return o;const u=t;return u.indexOf("{fontstack}")===-1&&o.push(new a.V(c,t,'"glyphs" url must include a "{fontstack}" token')),u.indexOf("{range}")===-1&&o.push(new a.V(c,t,'"glyphs" url must include a "{range}" token')),o}function kr(c,t=a.a6,o={}){return ki({key:o.key||"",value:c,valueSpec:Object.assign(t.$root,{"*":{type:"*"}}),styleSpec:t,style:c,objectElementValidators:{glyphs:xr}})}function gr(c,t=a.a6){return he(kr(c,t))}const Ks=c=>he(Dr(c)),_r=c=>he(is(c)),_t=c=>he(To(c)),aa=c=>he(ka(c)),Wo=c=>he(Fa(c)),So=c=>
219he((function(t){const o=t.value,u=t.style,p=t.styleSpec,g=p.snow;if(o===void 0)return[];if(!a.H(o))return[new a.V("snow",o,`object expected, ${a.K(o)} found`)];let y=[];for(const b in o){const T=b.match(/^(.*)-transition$/);y=y.concat(T&&g[T[1]]&&g[T[1]].transition?vn({key:b,value:o[b],valueSpec:p.transition,style:u,styleSpec:p}):g[b]?vn({key:b,value:o[b],valueSpec:g[b],style:u,styleSpec:p}):[new a.a3(b,o[b],`unknown property "${b}"`)])}return y})(c)),Ki=c=>he((function(t){const o=t.value,u=t.style,p=t.styleSpec,g=p.rain;if(o===void 0)return[];if(!a.H(o))return[new a.V("rain",o,`object expected, ${a.K(o)} found`)];let y=[];for(const b in o){const T=b.match(/^(.*)-transition$/);y=y.concat(T&&g[T[1]]&&g[T[1]].transition?vn({key:b,value:o[b],valueSpec:p.transition,style:u,styleSpec:p}):g[b]?vn({key:b,value:o[b],valueSpec:g[b],style:u,styleSpec:p}):[new a.a3(b,o[b],`unknown property "${b}"`)])}return y})(c)),De=c=>he(ws(c)),$=c=>he(Sa(c)),K=c=>he(El(c)),ce=c=>he(oo(c)),we=c=>he(a.a7(c));function he(c){return c.slice().sort((t,o)=>t.line&&o.line?t.line-o.line:0)}function Ie(c,t){let o=!1;if(t&&t.length)for(const u of t)u instanceof a.a3?a.w(u.message):(c.fire(new a.y(new Error(u.message))),o=!0);return o}const Ge=a.a6.light;let Pe;class qe extends a.E{constructor(t,o="flat"){super(),this._transitionable=new a.a8(Pe||(Pe=new a.a9({anchor:new a.aa(Ge.anchor),position:new a.ab(Ge.position),color:new a.aa(Ge.color),intensity:new a.aa(Ge.intensity)}))),this.setLight(t,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o,u={}){this._validate(_r,t,u)||(this._transitionable.setTransitionOrValue(t),this.id=o)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,u){return(!u||u.validate!==!1)&&Ie(this,t.call(gr,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}const Mt=a.a6.terrain;let yt=class extends a.E{constructor(c,t,o,u,p){super(),this.scope=o,this._transitionable=new a.a8(new a.a9({source:new a.aa(Mt.source),exaggeration:new a.aa(Mt.exaggeration)}),o,u),this._transitionable.setTransitionOrValue(c,u),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=p}get(){return this._transitionable.serialize()}set(c,t){this._transitionable.setTransitionOrValue(c,t)}updateTransitions(c){this._transitioning=this._transitionable.transitioned(c,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(c){this.properties=this._transitioning.possiblyEvaluate(c)}getExaggeration(c){return this._transitioning.possiblyEvaluate(new a.ac(c,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const c=this._transitionable._values.exaggeration;if(!c)return null;const t=c.value.expression;if(!t)return null;let o=-1,u=-1,p=1;for(const g of t.zoomStops)p=t.evaluate(new a.ac(g,{worldview:this.worldview})),p>.01?(o=g,u=-1):u=g;return p<.01&&o>0&&u>o?[o,u]:null}isZoomDependent(){const c=this._transitionable._values.exaggeration;return c!=null&&c.value!=null&&c.value.expression!=null&&c.value.expression instanceof a.ad}};const Zt=.05;function ri(c,t,o,u){const p=a.ah(45,65,o),[g,y]=li(c,u);let b=1-Math.min(1,Math.exp((t-g)/(y-g)*-6));return b*=b*b,b=Math.min(1,1.00747*b),b*p*c.alpha}function li(c,t){const o=.5/Math.tan(.5*t);return[c.range[0]+o,c.range[1]+o]}function Mi(c,t,o,u,p){const g=a.af([],[t,o,u],p.mercatorFogMatrix);return ri(c,a.ag(g),p.pitch,p._fov)}function Li(c,t,o,u,p,g,y){const b=[[o,u,0],[p,u,0],[p,g,0],[o,g,0]];let T=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(const I of b){const B=a.af([],I,t),L=a.ag(B);T=Math.min(T,L),C=Math.max(C,L)}return[ri(c,T,y.pitch,y._fov),ri(c,C,y.pitch,y._fov)]}const si=a.a6.fog;class vi extends a.E{constructor(t,o,u,p){super();const g=new a.a9({range:new a.aa(si.range),color:new a.aa(si.color),"color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new a.aa(si["high-color"]),"high-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new a.aa(si["space-color"]),"space-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}
219),"horizon-blend":new a.aa(si["horizon-blend"]),"star-intensity":new a.aa(si["star-intensity"]),"vertical-range":new a.aa(si["vertical-range"])});this._transitionable=new a.a8(g,u,new Map(p)),this.set(t,p),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new a.ai(g),this.scope=u}get state(){const t=this._transform,o=t.projection.name==="globe",u=a.aj(t.zoom),p=this.properties.get("range"),g=[.5,3];return{range:o?[a.ak(g[0],p[0],u),a.ak(g[1],p[1],u)]:p,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,o,u={}){if(this._validate(Wo,t,u))return;const p=Object.assign({},t);for(const g of Object.keys(si))p[g]===void 0&&(p[g]=si[g].default);this._options=p,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.ah(45,65,t))*o.a}getOpacityAtLatLng(t,o){return this._transform.projection.supportsFog?(function(u,p,g){const y=a.ae.fromLngLat(p),b=g.elevation?g.elevation.getAtPointOrZero(y):0;return Mi(u,y.x,y.y,b,g)})(this.state,t,o):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Li(this.state,o,0,0,a.al,a.al,this._transform)}getOpacityForBounds(t,o,u,p,g){return this._transform.projection.supportsFog?Li(this.state,t,o,u,p,g,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?li(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const u of o){const p=t.points[u];let g;if(p[2]>=0)g=p;else{const y=t.points[u-4];g=a.am(y,p,y[2]/(y[2]-p[2]))}if(Mi(this.state,g[0],g[1],0,this._transform)>=Zt)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,u){return(!u||u.validate!==!1)&&Ie(this,t.call(gr,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}let Rn,or,jn,dr=class extends a.E{constructor(c,t,o,u){super();const p=Rn||(Rn=new a.a9({density:new a.aa(a.a6.snow.density),intensity:new a.aa(a.a6.snow.intensity),color:new a.aa(a.a6.snow.color),opacity:new a.aa(a.a6.snow.opacity),vignette:new a.aa(a.a6.snow.vignette),"vignette-color":new a.aa(a.a6.snow["vignette-color"]),"center-thinning":new a.aa(a.a6.snow["center-thinning"]),direction:new a.aa(a.a6.snow.direction),"flake-size":new a.aa(a.a6.snow["flake-size"])}));this._transitionable=new a.a8(p,o,new Map(u)),this.set(c,u),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(p),this.scope=o}get state(){const c=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),u=a.an(o[0]),p=-Math.max(a.an(o[1]),.01),g=[Math.cos(u)*Math.cos(p),Math.sin(u)*Math.cos(p),Math.sin(p)],y=this.properties.get("vignette"),b=this.properties.get("vignette-color");return b.a=y,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(t.r,t.g,t.b,t.a*c),direction:g,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:b}}get(){return this._transitionable.serialize()}set(c,t,o={}){if(this._validate(So,c,o))return;const u=Object.assign({},c),p=a.a6.snow;for(const g of Object.keys(p))u[g]===void 0&&(u[g]=p[g].default);this._options=u,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(c){this._transitionable.setTransitionOrValue(this._options,new Map(c))}updateTransitions(c){this._transitioning=this._transitionable.transitioned(c,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(c){this.properties=this._transitioning.possiblyEvaluate(c)}
vendor: 13,929 bytes, line 219
219_validate(c,t,o){return(!o||o.validate!==!1)&&Ie(this,c.call(gr,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}},Un=class extends a.E{constructor(c,t,o,u){super();const p=or||(or=new a.a9({density:new a.aa(a.a6.rain.density),intensity:new a.aa(a.a6.rain.intensity),color:new a.aa(a.a6.rain.color),opacity:new a.aa(a.a6.rain.opacity),vignette:new a.aa(a.a6.rain.vignette),"vignette-color":new a.aa(a.a6.rain["vignette-color"]),"center-thinning":new a.aa(a.a6.rain["center-thinning"]),direction:new a.aa(a.a6.rain.direction),"droplet-size":new a.aa(a.a6.rain["droplet-size"]),"distortion-strength":new a.aa(a.a6.rain["distortion-strength"])}));this._transitionable=new a.a8(p,o,new Map(u)),this.set(c,u),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(p),this.scope=o}get state(){const c=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),u=a.an(o[0]),p=-Math.max(a.an(o[1]),.01),g=[Math.cos(u)*Math.cos(p),Math.sin(u)*Math.cos(p),Math.sin(p)],y=this.properties.get("vignette-color");return y.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(t.r,t.g,t.b,t.a*c),direction:g,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(c,t,o={}){if(this._validate(Ki,c,o))return;const u=Object.assign({},c),p=a.a6.rain;for(const g of Object.keys(p))u[g]===void 0&&(u[g]=p[g].default);this._options=u,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(c){this._transitionable.setTransitionOrValue(this._options,new Map(c))}updateTransitions(c){this._transitioning=this._transitionable.transitioned(c,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(c){this.properties=this._transitioning.possiblyEvaluate(c)}_validate(c,t,o){return(!o||o.validate!==!1)&&Ie(this,c.call(gr,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}};class Ji extends a.E{constructor(t,o,u,p){super(),this.scope=u,this._options=t,this.properties=new a.ai(o),this._transitionable=new a.a8(o,u,new Map(p)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,o){this._options=t,this._transitionable.setTransitionOrValue(t.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const Hn=()=>jn||(jn=new a.a9({color:new a.aa(a.a6.properties_light_ambient.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_ambient.intensity)}));let bn;const wn=()=>bn||(bn=new a.a9({direction:new a.ap(a.a6.properties_light_directional.direction),color:new a.aa(a.a6.properties_light_directional.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_directional.intensity),"cast-shadows":new a.aa(a.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new a.aa(a.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new a.aa(a.a6.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new a.aa(a.a6.properties_light_directional["shadow-draw-before-layer"])}));class zn{constructor(t,o,u){this.screenBounds=t,this.cameraPoint=u.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=o,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,u)}static createFromScreenPoints(t,o){let u,p;if(t instanceof a.P||typeof t[0]=="number"){const g=a.P.convert(t);u=[g],p=o.isPointAboveHorizon(g)}else{const g=a.P.convert(t[0]),y=a.P.convert(t[1]),b=g.add(y)._div(2);u=[g,y],p=a.aq(g,y).every(T=>o.isPointAboveHorizon(T))&&o.isPointAboveHorizon(b)}return new zn(u,p,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return a.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],p=a.aq(o,u,0,!1);return this.cameraPoint.y>u.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<u.x?p.splice(3,0,this.cameraPoint):this.cameraPoint.x>=u.x?p[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(p[3]=this.cameraPoint)),a.ar(p,t)}bufferedCameraGeometryGlobe(t){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],p=a.aq(o,u,t),g=this.cameraPoint.clone();switch(3*((g.y>o.y)+(g.y>u.y))+((g.x>o.x)+(g.x>u.x))){case 0:p[0]=g,p[4]=g.clone();break;case 1:p.splice(1,0,g);break;case 2:p[1]=g;break;case 3:p.splice(4,0,g);break;case 5:p.splice(2,0,g);break;case 6:p[3]=g;break;case 7:p.splice(3,0,g);break;case 8:p[2]=g}return p}containsTile(t,o,u,p=0){const g=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/o._pixelsPerMercatorPixel+1,y=u?this._bufferedCameraMercator(g,o):this._bufferedScreenMercator(g,o);let b=t.tileID.wrap+(y.unwrapped?p:0);const T=y.polygon.map(q=>a.as(t.tileTransform,q,b));if(!a.at(T,0,0,a.al,a.al))return;b=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?p:0);const C=this.screenGeometryMercator.polygon.map(q=>a.au(t.tileTransform,q,b)),I=C.map(q=>new a.P(q[0],q[1])),B=o.getFreeCameraOptions().position||new a.ae(0,0,0),L=a.au(t.tileTransform,B,b),N=C.map(q=>{const W=a.av(q,q,L);return a.aw(W,W),new a.ax(L,W)}),H=a.ay(t,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:I,tilespaceRays:N,bufferedTilespaceGeometry:T,bufferedTilespaceBounds:(j=a.az(T),j.min.x=a.aA(j.min.x,0,a.al),j.min.y=a.aA(j.min.y,0,a.al),j.max.x=a.aA(j.max.x,0,a.al),j.max.y=a.aA(j.max.y,0,a.al),j),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:H};var j}_bufferedScreenMercator(t,o){const u=Fr(t);if(this._screenRaycastCache[u])return this._screenRaycastCache[u];{let p;return p=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),o):{polygon:this.bufferedScreenGeometry(t).map(g=>o.pointCoordinate3D(g)),unwrapped:!0},this._screenRaycastCache[u]=p,p}}_bufferedCameraMercator(t,o){const u=Fr(t);if(this._cameraRaycastCache[u])return this._cameraRaycastCache[u];{let p;return p=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),o):{polygon:this.bufferedCameraGeometry(t).map(g=>o.pointCoordinate3D(g)),unwrapped:!0},this._cameraRaycastCache[u]=p,p}}_projectAndResample(t,o){const u=(function(g,y){const b=a.aB([],y.pixelMatrix,y.globeMatrix),T=[0,-a.aD,0,1],C=[0,a.aD,0,1],I=[0,0,0,1];a.aC(T,T,b),a.aC(C,C,b),a.aC(I,I,b);const B=new a.P(T[0]/T[3],T[1]/T[3]),L=new a.P(C[0]/C[3],C[1]/C[3]),N=a.aE(g,B)&&T[3]<I[3],H=a.aE(g,L)&&C[3]<I[3];if(!N&&!H)return null;const j=(function(ye,de,se){for(let Te=1;Te<ye.length;Te++){const Ae=Yr(de.pointCoordinate3D(ye[Te-1]).x),Re=Yr(de.pointCoordinate3D(ye[Te]).x);if(se<0){if(Ae<Re)return{idx:Te,t:-Ae/(Re-1-Ae)}}else if(Re<Ae)return{idx:Te,t:(1-Ae)/(Re+1-Ae)}}return null})(g,y,N?-1:1);if(!j)return null;const{idx:q,t:W}=j;let ne=q>1?ar(g.slice(0,q),y):[],ie=q<g.length?ar(g.slice(q),y):[];ne=ne.map(ye=>new a.P(Yr(ye.x),ye.y)),ie=ie.map(ye=>new a.P(Yr(ye.x),ye.y));const ee=[...ne];ee.length===0&&ee.push(ie[ie.length-1]);const xe=a.ak(ee[ee.length-1].y,(ie.length===0?ne[0]:ie[0]).y,W);let me;return me=N?[new a.P(0,xe),new a.P(0,0),new a.P(1,0),new a.P(1,xe)]:[new a.P(1,xe),new a.P(1,1),new a.P(0,1),new a.P(0,xe)],ee.push(...me),ie.length===0?ee.push(ne[0]):ee.push(...ie),{polygon:ee.map(ye=>new a.ae(ye.x,ye.y)),unwrapped:!1}})(t,o);if(u)return u;const p=(function(g,y){let b=!1,T=-1/0,C=0;for(let B=0;B<g.length-1;B++)g[B].x>T&&(T=g[B].x,C=B);for(let B=0;B<g.length-1;B++){const L=(C+B)%(g.length-1),N=g[L],H=g[L+1];Math.abs(N.x-H.x)>.5&&(N.x<H.x?(N.x+=1,L===0&&(g[g.length-1].x+=1)):(H.x+=1,L+1===g.length-1&&(g[0].x+=1)),b=!0)}const I=a.aF(y.center.lng);return b&&I<Math.abs(I-1)&&g.forEach(B=>{B.x-=1}),{polygon:g,unwrapped:b}})(ar(t,o).map(g=>new a.P(Yr(g.x),g.y)),o);return{polygon:p.polygon.map(g=>new a.ae(g.x,g.y)),unwrapped:p.unwrapped}}}function ar(c,t){return a.aG(c,o=>{const u=t.pointCoordinate3D(o);o.x=u.x,o.y=u.y},1/256)}function Yr(c){return c<0?1+c%1:c%1}function Fr(c){return 100*c|0}function Qs(c,t,o,u,p){const g=function(b,T){if(b)return p(b);if(T){if(c.url&&T.tiles&&c.tiles&&delete c.tiles,T.variants){if(!Array.isArray(T.variants))return p(new Error("variants must be an array"));for(const I of T.variants){if(I==null||typeof I!="object"||I.constructor!==Object)return p(new Error("variant must be an object"));if(!Array.isArray(I.capabilities))return p(new Error("capabilities must be an array"));if(I.capabilities.length===1&&I.capabilities[0]==="meshopt"){T=Object.assign(T,I);break}}}const C=a.aH(Object.assign({},T,c),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);C.tiles=t.canonicalizeTileset(C,c.url),p(null,C)}},y=(function(b,T,C){if(!b)return null;if(!T&&!C)return b;C=C||b.worldview_default;const I=Object.values(b.language||{});if(I.length===0)return null;const B=Object.values(b.worldview||{});if(B.length===0)return null;const L=I.every(H=>H===T),N=B.every(H=>H===C);return L&&N?b:T in(b.language_options||{})||C in(b.worldview_options||{})?null:b.language_options&&b.worldview_options?b:null})(c.data,o,u);return y?a.o.frame(()=>g(null,y)):c.url?a.m(t.transformRequest(t.normalizeSourceURL(c.url,null,o,u),a.R.Source),g):a.o.frame(()=>{const{data:b,...T}=c;g(null,T)})}function Eo(c,t){const o=Math.pow(2,t.z),u=Math.floor(a.aF(c.getWest())*o),p=Math.floor(a.aJ(c.getNorth())*o),g=Math.ceil(a.aF(c.getEast())*o),y=Math.ceil(a.aJ(c.getSouth())*o);return t.x>=u&&t.x<g&&t.y>=p&&t.y<y}class ko{constructor(t,o,u){this.bounds=t?a.aI.convert(this.validateBounds(t)):null,this.minzoom=o||0,this.maxzoom=u||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const o of t)this.extraBounds.push(a.aI.convert(this.validateBounds(o)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!Eo(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const o of this.extraBounds)if(Eo(o,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const o=new ko(t.bounds,t.minzoom,t.maxzoom);return o.addExtraBounds(t.extra_bounds),o}}class rs extends a.E{constructor(t,o,u,p){if(super(),this.id=t,this.dispatcher=u,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,a.aH(o,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},o),this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p),this._tileWorkers={},this._deduped=new a.aK}load(t){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,u=this.map.getWorldview();this._tileJSONRequest=Qs(this._options,this.map._requestManager,o,u,(p,g)=>{if(this._tileJSONRequest=null,this._loaded=!0,p)o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),u&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${u}`),this.fire(new a.y(p));else if(g){if(Object.assign(this,g),this.hasWorldviews=!!g.worldview_options,g.worldview_default&&(this.worldviewDefault=g.worldview_default),g.vector_layers){this.vectorLayers=g.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const y of g.vector_layers)this.vectorLayerIds.push(y.id),g.worldview&&g.worldview[y.source]&&this.localizableLayerIds.add(y.id)}this.tileBounds=ko.fromTileJSON(g),bt(g.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}t&&t(p)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,o){const u=t.tileID.canonical.url(this.tiles,this.scheme),p=this.map._requestManager.normalizeTileURL(u),g=this.map._requestManager.transformRequest(p,a.R.Tile),y=this.map.style?this.map.style.getLut(this.scope):null,b=y?{image:y.image.clone()}:null,T={request:g,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:b,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
219ype,source:this.id,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&a.h(u)&&(T.localizableLayerIds=this.localizableLayerIds),T.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=o:t.request=t.actor.send("reloadTile",T,C.bind(this));else if(t.actor=this._tileWorkers[p]=this._tileWorkers[p]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",T,C.bind(this),void 0,!0);else{const I=a.aL.call({deduped:this._deduped},T,(B,L)=>{if(B||!L)C.call(this,B);else{const N=a.aM(L.responseHeaders);T.data={rawData:L.rawData.slice(0),expires:N.expires,cacheControl:N.cacheControl},t.actor&&t.actor.send("loadTile",T,C.bind(this),void 0,!0)}},!0);t.request={cancel:I}}function C(I,B){return delete t.request,t.aborted?o(null):I&&I instanceof a.aN&&I.status!==404?o(I):(B&&B.resourceTiming&&(t.resourceTiming=B.resourceTiming),this.map._refreshExpiredTiles&&B&&t.setExpiryData(B),t.loadVectorData(B,this.map.painter),a.aO(this.dispatcher),o(null,B),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
vendor: 4,029 bytes, line 219
219ype,source:this.id,scope:this.scope})}unloadTile(t,o){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Gr extends a.E{constructor(t,o,u,p){super(),this.id=t,this.dispatcher=u,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},o),Object.assign(this,a.aH(o,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const o=this.map.getWorldview();this._tileJSONRequest=Qs(this._options,this.map._requestManager,null,o,(u,p)=>{this._tileJSONRequest=null,this._loaded=!0,u?this.fire(new a.y(u)):p&&(Object.assign(this,p),p.raster_layers&&(this.rasterLayers=p.raster_layers,this.rasterLayerIds=this.rasterLayers.map(g=>g.id)),this.tileBounds=ko.fromTileJSON(p),bt(p.tiles),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(u)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,o){const u=a.o.devicePixelRatio>=2,p=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),u,this.tileSize);t.request=a.n(this.map._requestManager.transformRequest(p,a.R.Tile),(g,y,b)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(g)return t.state="errored",o(g);if(!y)return o(null);const T=a.aM(b);this.map._refreshExpiredTiles&&t.setExpiryData(T),t.setTexture(y,this.map.painter),t.state="loaded",a.aO(this.dispatcher),o(null)})}abortTile(t,o){t.request&&(t.request.cancel(),delete t.request),o&&o()}unloadTile(t,o){t.texture&&t.texture instanceof a.T?(t.destroy(!1),t.texture&&t.texture instanceof a.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),o&&o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Yo([c,t],o,u,{scaled:p=!0}={}){const{tileSize:g,buffer:y}=u,{x:b,y:T,z:C}=o;if(!isFinite(b)||!isFinite(T)||!isFinite(C))throw new Error("Invalid MRT header");const I=2**C,B=I*a.aF(c),L=I*a.aJ(t);return(function([N,H],j,{scaled:q=!0}={}){if(!j)throw new Error("bandView is undefined");const{data:W,tileSize:ne,buffer:ie,offset:ee,scale:xe,dimension:me}=j;if(N<-ie||N>ne+ie||H<-ie||H>ne+ie)throw new Error(`Point (${N}, ${H}) out of bounds for tileSize=${ne}, buffer=${ie}`);const ye=(H+ie)*(ne+2*ie)+(N+ie);if(new Uint32Array(W.buffer)[ye]===4294967295)return null;let de=[];de=q?[]:new j.data.constructor(me);for(let se=0;se<me;se++)de[se]=Math.round(1e12*(W[me*ye+se]*xe+ee))/1e12;return de})([Math.min(Math.max(-y,Math.floor((B-b)*g)),g-1+y),Math.min(Math.max(-y,Math.floor((L-T)*g)),g-1+y)],u,{scaled:p})}class Fo extends Gr{constructor(t,o,u,p){super(t,o,u,p),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},o)}triggerRepaint(t){const o=this.map.painter._terrain,u=this.map.style.getSourceCache(this.id);o&&o.enabled&&u&&o._clearRenderCacheForTile(u.id,t.tileID),this.map.triggerRepaint()}loadTile(t,o){const u=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),p=this.map._requestManager.transformRequest(u,a.R.Tile),g={request:p,uid:t.uid,tileID:t.tileID,type:this.t
219ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=p,t.actor||(t.actor=this.dispatcher.getActor());const y=(b,T,C)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(b)return b.name==="AbortError"?void 0:(t.state="errored",o(b));if(this.map._refreshExpiredTiles&&T){const I=a.aM(C);t.setExpiryData(I)}if(this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){if(!T)return o(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=T}o(null)};t.request=this.partial?t.fetchHeader(void 0,y.bind(this)):t.actor.send("loadTile",g,y.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,o){const u=t.texturePerLayer;if(t.flushAllQueues(),u.size){t.destroy(!1);for(const p of u.values())this.map.painter.saveTileTexture(p)}else t.destroy()}prepareTile(t,o,u,p){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(o,u,p,(g,y)=>{if(g)return t.state="errored",this.fire(new a.y(g)),void this.triggerRepaint(t);y&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(u,y,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const o=this.rasterLayers.find(({id:g})=>g===t),u=o&&o.fields,p=u&&u.bands&&u.bands;return p?p[0]:0}getTextureDescriptor(t,o,u){if(!t)return;const p=o.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!p)return;let g=null;o instanceof a.aR?g=o.paint.get("raster-array-band"):o instanceof a.aS&&(g=o.paint.get("raster-particle-array-band"));const y=g||this.getInitialBand(p);if(y==null)return;if(!t.textureDescriptorPerLayer.get(o.id))return void this.prepareTile(t,p,o.id,y);if(t.updateNeeded(o.id,y)&&!u)return;const b=t.textureDescriptorPerLayer.get(o.id);return Object.assign({},b,{texture:t.texturePerLayer.get(o.id)})}getImages(t,o){const u=new Map;for(const p of t)for(const g of o){const[y,b]=g.split("/"),T=p.getLayer(y);if(!T||!T.hasBand(b)||!T.hasDataForBand(b))continue;const{bytes:C,tileSize:I,buffer:B}=T.getBandView(b),L=I+2*B,N={data:new a.q({width:L,height:L},C),pixelRatio:2,sdf:!1,usvg:!1,version:0};u.set(g,N)}return u}queryRasterArrayValueByBandId(t,o,u){const p=o._mrt;return new Promise(g=>{const y={},b=new Set;for(const[T,C]of Object.entries(p.layers)){if(u.layerName&&T!==u.layerName)continue;const I={};y[T]=I;for(const{bands:B}of C.dataIndex)for(const L of B)u.bands&&!u.bands.includes(L)||(b.add(a.B(T,L)),o.fetchBand(T,null,L,N=>{a.o.frame(()=>{I[L]=N?null:Yo([t.lng,t.lat],p,C.getBandView(L)),b.delete(a.B(T,L)),b.size===0&&g(y)})},!1))}b.size===0&&g(y)})}_loadTileForQuery(t,o){if(this._loadTileLoaded[t.uid])return void o(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(o);this._loadTilePending[t.uid]=[o];const u=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),p=this.map._requestManager.transformRequest(u,a.R.Tile);t.actor.send("loadTile",{request:p,uid:t.uid,tileID:t.tileID,type:this.t
219ype,source:this.id,scope:this.scope,partial:!1},(g,y,b)=>{if(g)return this._loadTilePending[t.uid].forEach(T=>T(g,null)),void delete this._loadTilePending[t.uid];if(!y)return this._loadTilePending[t.uid].forEach(T=>T(null,null)),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&y){const T=a.aM(b);t.setExpiryData(T)}t._mrt=y,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach(T=>T(null,y)),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]},void 0,!0)}queryRasterArrayValueByAllBands(t,o,u){return new Promise((p,g)=>{this._loadTileForQuery(o,(y,b)=>{y?g(y):p(b?this.queryRasterArrayValueByBandId(t,o,u):null)})})}queryRasterArrayValue(t,o){const u=a.aT.convert(t),p=this.findLoadedParent(u);return p&&p._mrt?o.bands||!this.partial?this.queryRasterArrayValueByBandId(u,p,o):this.queryRasterArrayValueByAllBands(u,p,o):Promise.resolve(null)}findLoadedParent(t){const o=a.ae.fromLngLat(t,this.map.transform.tileSize),u=this.maxzoom+1,p=1<<u,g=Math.floor(o.x),y=Math.floor((o.x-g)*p),b=Math.floor(o.y*p),T=this.map.style.getSourceCache(this.id),C=new a.aQ(u,g,u,y,b);return T.findLoadedParent(C,this.minzoom)}}const Ss={vector:rs,raster:Gr,"raster-dem":class extends Gr{constructor(c,t,o,u){super(c,t,o,u),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(c,t){const o=this.map._requestManager.normalizeTileURL(c.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function u(p,g){p&&(c.state="errored",t(p)),g&&(c.dem=g,c.dem.onDeserialize(),c.needsHillshadePrepare=!0,c.needsDEMTextureUpload=!0,c.state="loaded",t(null))}c.request=a.n(this.map._requestManager.transformRequest(o,a.R.Tile),(function(p,g,y){if(delete c.request,c.aborted)c.state="unloaded",t(null);else if(p)c.state="errored",t(p);else if(g){const b=a.aM(y);this.map._refreshExpiredTiles&&c.setExpiryData(b);const T=ImageBitmap&&g instanceof ImageBitmap&&a.r(),C=1-(g.width-a.aP(g.width))/2;C<1||c.neighboringTiles||(c.neighboringTiles=this._getNeighboringTiles(c.tileID));const I=T?g:a.o.getImageData(g,C),B={uid:c.uid,tileID:c.tileID,source:this.id,type:this.t
219ype,scope:this.scope,rawImageData:I,encoding:this.encoding,padding:C};c.actor&&c.state!=="expired"||(c.actor=this.dispatcher.getActor(),c.actor.send("loadTile",B,u.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(c){const t=c.canonical,o=Math.pow(2,t.z),u=(t.x-1+o)%o,p=t.x===0?c.wrap-1:c.wrap,g=(t.x+1+o)%o,y=t.x+1===o?c.wrap+1:c.wrap,b={};return b[new a.aQ(c.overscaledZ,p,t.z,u,t.y).key]={backfilled:!1},b[new a.aQ(c.overscaledZ,y,t.z,g,t.y).key]={backfilled:!1},t.y>0&&(b[new a.aQ(c.overscaledZ,p,t.z,u,t.y-1).key]={backfilled:!1},b[new a.aQ(c.overscaledZ,c.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},b[new a.aQ(c.overscaledZ,y,t.z,g,t.y-1).key]={backfilled:!1}),t.y+1<o&&(b[new a.aQ(c.overscaledZ,p,t.z,u,t.y+1).key]={backfilled:!1},b[new a.aQ(c.overscaledZ,c.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},b[new a.aQ(c.overscaledZ,y,t.z,g,t.y+1).key]={backfilled:!1}),b}},"raster-array":Fo,geojson:class extends a.E{constructor(c,t,o,u){super(),this.id=c,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(u),this._data=t.data,this._options=Object.assign({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const p=a.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*p,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*p,extent:a.al,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:a.al,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*p,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(c){this.map=c,this.setData(this._data)}setData(c){return this._data=c,this._updateWorkerData(),this}updateData(c){if(!this._options.dynamic)return this.fire(new a.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof c!="string"&&(c.type==="Feature"&&(c={type:"FeatureCollection",features:[c]}),c.type!=="FeatureCollection"))return this.fire(new a.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof c!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const o of this._data.features)t.set(o.id,o);for(const o of c.features)t.set(o.id,o);this._data.features=[...t.values()]}else this._data=c;return this._updateWorkerData(!0),this}getClusterExpansionZoom(c,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:c,source:this.id,scope:this.scope},t),this}getClusterChildren(c,t){return this.actor.send("geojson.getClusterChildren",{clusterId:c,source:this.id,scope:this.scope},t),this}getClusterLeaves(c,t,o,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:c,limit:t,offset:o},u),this}_updateWorkerData(c=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new a.z("dataloading",{dataType:"source"})),this._loaded=!1;const t=Object.assign({append:c},this.workerOptions);t.scope=this.scope;const o=this._data;typeof o=="string"?(t.request=this.map._requestManager.transformRequest(a.o.resolveURL(o),a.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(o),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(u,p)=>{if(this._loaded=!0,this._pendingLoad=null,u)this.fire(new a.y(u));else{const g={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&p&&p.resourceTiming&&p.resourceTiming[this.id]&&(g.resourceTiming=p.resourceTiming[this.id]),c&&(this._partialReload=!0),this.fire(new a.z("data",g)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(c),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const c=a.B(this.id,this.scope);this.map.style.clearSource(c),this._updateWorkerData()}loadTile(c,t){const o=c.actor?"reloadTile":"loadTile";c.actor=this.actor;const u=this.map.style?this.map.style.getLut(this.scope):null,p=u?{image:u.image.clone()}
219:null,g=this._partialReload,y={type:this.type,uid:c.uid,tileID:c.tileID,tileZoom:c.tileZoom,zoom:c.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:p,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:c.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:g,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};c.request=this.actor.send(o,y,(b,T)=>g&&!T?(c.state="loaded",t(null)):(delete c.request,c.destroy(!1),c.aborted?t(null):b?t(b):(c.loadVectorData(T,this.map.painter,o==="reloadTile"),t(null))),void 0,o==="loadTile")}abortTile(c){c.request&&(c.request.cancel(),delete c.request),c.aborted=!0}unloadTile(c,t){this.actor.send("removeTile",{uid:c.uid,type:this.type,source:this.id,scope:this.scope}),c.destroy()}onRemove(c){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
219,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.aU{constructor(c,t,o,u){super(c,t,o,u),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const c=this.options;this.urls=[];for(const t of c.urls)this.urls.push(this.map._requestManager.transformRequest(t,a.R.Source).url);a.aV(this.urls,(t,o)=>{this._loaded=!0,t?this.fire(new a.y(t)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(c){if(this.video){const t=this.video.seekable;c<t.start(0)||c>t.end(0)?this.fire(new a.y(new a.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=c}}getVideo(){return this.video}onAdd(c){this.map||(this.map=c,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 c=this.map.painter.context,t=c.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(c,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(c)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.aU,model:a.aX,"batched-model":class extends a.E{constructor(c,t,o,u){super(),this.type="batched-model",this.id=c,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=o,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(u)}onAdd(c){this.map=c,this.load()}reload(){this.cancelTileJSONRequest();const c=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(c))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(c){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map.getWorldview();this._tileJSONRequest=Qs(this._options,this.map._requestManager,t,o,(u,p)=>{this._tileJSONRequest=null,this._loaded=!0,u?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new a.y(u))):p&&(Object.assign(this,p),p.bounds&&(this.tileBounds=new ko(p.bounds,this.minzoom,this.maxzoom)),bt(p.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),c&&c(u)})}hasTransition(){return!1}hasTile(c){return!this.tileBounds||this.tileBounds.contains(c.canonical)}loaded(){return this._loaded}loadTile(c,t){const o=this.map._requestManager.normalizeTileURL(c.tileID.canonical.url(this.tiles,this.scheme)),u={request:this.map._requestManager.transformRequest(o,a.R.Tile),data:void 0,uid:c.uid,tileID:c.tileID,tileZoom:c.tileZoom,zoom:c.tileID.overscaledZ,tileSize:this.tileSize*c.tileID.overscaleFactor(),type:this.t
219ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:c.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:a.o.devicePixelRatio,promoteId:this.promoteId};if(c.actor&&c.state!=="expired")if(c.state==="loading")c.reloadCallback=t;else{if(c.buckets){const g=Object.values(c.buckets);for(const y of g)y.dirty=!0;return void(c.state="loaded")}c.request=c.actor.send("reloadTile",u,p.bind(this))}else c.actor=this.dispatcher.getActor(),c.request=c.actor.send("loadTile",u,p.bind(this),void 0,!0);function p(g,y){return c.aborted?t(null):g&&g.status!==404?t(g):(this.map._refreshExpiredTiles&&y&&c.setExpiryData(y),c.loadModelData(y,this.map.painter),c.state="loaded",void t(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends a.aU{constructor(c,t,o,u){super(c,t,o,u),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(g=>typeof g!="number"))||this.fire(new a.y(new a.V(`sources.${c}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.y(new a.V(`sources.${c}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new a.y(new a.V(`sources.${c}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new a.y(new a.V(`sources.${c}`,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 a.y(new a.V(`sources.${c}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){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 a.y(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(c){this.map=c,this.load(),this.canvas&&this.animate&&this.play()}onRemove(c){this.pause()}prepare(){let c=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,c=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,c=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!c&&!this._playing||this.texture instanceof a.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const c of[this.canvas.width,this.canvas.height])if(isNaN(c)||c<=0)return!0;return!1}},custom:class extends a.E{constructor(c,t,o,u){super(),this.id=c,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=t,this.setEventedParent(u),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new ko(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,a.aH(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(c){this.map=c,this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(c),this.load()}onRemove(c){this._implementation.onRemove&&this._implementation.onRemove(c)}hasTile(c){if(this._implementation.hasTile){const{x:t,y:o,z:u}=c.canonical;return this._implementation.hasTile({x:t,y:o,z:u})}return!this.tileBounds||this.tileBounds.contains(c.canonical)}loadTile(c,t){const{x:o,y:u,z:p}=c.tileID.canonical,g=new AbortController;c.request=Promise.resolve(this._implementation.loadTile({x:o,y:u,z:p},{signal:g.signal})).then((function(y){return delete c.request,c.aborted?(c.state="unloaded",t(null)):y===void 0?(c.state="errored",t(null)):y===null?(this.loadTileData(c,{width:this.tileSize,height:this.tileSize,data:null}),c.state="loaded",t(null)):(function(b){return b instanceof ImageData||b instanceof HTMLCanvasElement||b instanceof ImageBitmap||b instanceof HTMLImageElement})(y)?(this.loadTileData(c,y),c.state="loaded",void t(null)):(c.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(y=>{y.name!=="AbortError"&&(c.state="errored",t(y))}),c.request.cancel=()=>g.abort()}loadTileData(c,t){c.setTexture(t,this.map.painter)}unloadTile(c,t){if(c.texture&&c.texture instanceof a.T?(c.destroy(!1),c.texture&&c.texture instanceof a.T&&this.map.painter.saveTileTexture(c.texture)):c.destroy(),this._implementation.unloadTile){const{x:o,y:u,z:p}=c.tileID.canonical;this._implementation.unloadTile({x:o,y:u,z:p})}t&&t()}abortTile(c,t){c.request&&c.request.cancel&&(c.request.cancel(),delete c.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(c=>({x:c.canonical.x,y:c.canonical.y,z:c.canonical.z}))}_clearTiles(){const c=a.B(this.id,this.scope);this.map.style.clearSource(c)}
vendor: 47,068 bytes, line 219
219_update(){this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}}},os=function(c,t,o,u){const p=new Ss[t.type](c,t,o,u);if(p.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${p.id}`);return a.aY(["load","abort","unload","serialize","prepare"],p),p};function Ea(c,t,o=""){return`${o}:${t.id||""}:${t.layer.id}:${(function(u){if("layerId"in u)return`layer:${u.layerId}`;{const{featuresetId:p,importId:g}=u;return`featureset:${p}${g?`:import:${g}`:""}`}})(c.target)}`}function Lu(c,t,o,u=""){if(c.uniqueFeatureID){const p=Ea(c,t,u);if(o.has(p))return!0;o.add(p)}return!1}function Js(c,t,o,u,p=!1,g=void 0){const y=t.sourceCache.transform,b=t.sourceCache.tilesIn(c,t.has3DLayers,p);b.sort(Xd);const T=[];for(const C of b){const I=C.tile.queryRenderedFeatures(t,C,o,u,y,p,g);Object.keys(I).length&&T.push({wrappedTileID:C.tile.tileID.wrapped().key,queryResults:I})}for(const C in t.layers){const I=t.layers[C];if(I.styleLayer){const B=I.styleLayer.queryRenderedFeatures(c,t.sourceCache,u);Object.keys(B).length&&T.push({wrappedTileID:0,queryResults:B})}}return T.length===0?{}:(function(C){const I={},B={};for(const L of C){const N=L.queryResults,H=L.wrappedTileID,j=B[H]=B[H]||{};for(const q in N){const W=N[q],ne=j[q]=j[q]||{},ie=I[q]=I[q]||[];for(const ee of W)ne[ee.featureIndex]||(ne[ee.featureIndex]=!0,ie.push(ee))}}return I})(T)}function Em(c,t,o,u,p,g){const y={},b=u.queryRenderedSymbols(c),T=[];for(const C of Object.keys(b).map(Number))T.push(p[C]);T.sort(Xd);for(const C of T){const I=C.featureIndex.lookupSymbolFeatures(b[C.bucketInstanceId],C.bucketIndex,C.sourceLayerIndex,t,o,g);for(const B in I){const L=y[B]=y[B]||[],N=I[B];N.sort((H,j)=>{const q=C.featureSortOrder;if(q){const W=q.indexOf(H.featureIndex);return q.indexOf(j.featureIndex)-W}return j.featureIndex-H.featureIndex});for(const H of N)L.push(H)}}return y}function lp(c,t){const o=c.getRenderableIds().map(g=>c.getTileByID(g)),u=[],p={};for(let g=0;g<o.length;g++){const y=o[g],b=y.tileID.canonical.key;p[b]||(p[b]=!0,y.querySourceFeatures(u,t))}return u}function Xd(c,t){const o=c.tileID,u=t.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}function Gh(c,t){const o={};if(!t)return o;for(const u of c){const p=u.layerIds.map(g=>t.getLayer(g)).filter(Boolean);if(p.length!==0){u.layers=p,u.stateDependentLayerIds&&(u.stateDependentLayers=u.stateDependentLayerIds.map(g=>p.filter(y=>y.id===g)[0]));for(const g of p)o[g.fqid]=u}}return o}const ao=32,Na=33,as=new Uint16Array(8184);for(let c=0;c<2046;c++){let t=c+2,o=0,u=0,p=0,g=0,y=0,b=0;for(1&t?p=g=y=ao:o=u=b=ao;(t>>=1)>1;){const C=o+p>>1,I=u+g>>1;1&t?(p=o,g=u,o=y,u=b):(o=p,u=g,p=y,g=b),y=C,b=I}const T=4*c;as[T+0]=o,as[T+1]=u,as[T+2]=p,as[T+3]=g}const Kr=new Uint16Array(2178),ss=new Uint8Array(1089),ac=new Uint16Array(1089);function Es(c){return c===0?-.03125:c===32?.03125:0}const ls={type:2,extent:a.al,loadGeometry:()=>[[new a.P(0,0),new a.P(a.al+1,0),new a.P(a.al+1,a.al+1),new a.P(0,a.al+1),new a.P(0,0)]]};class Al{constructor(t,o,u,p,g,y){this.tileID=t,this.uid=a.b2(),this.uses=0,this.tileSize=o,this.tileZoom=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=g,p&&p.style&&(this._lastUpdatedBrightness=p.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",p&&p.transform&&(this.projection=p.transform.projection),this.worldview=y,this._hasAppearances=null}registerFadeDuration(t){const o=t+this.timeAdded;o<a.o.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=a.aZ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,o,u){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Gh(t.buckets,o.style),this.hasSymbolBuckets=!1;for(const p in this.buckets){const g=this.buckets[p];if(g instanceof a.b4){if(this.hasSymbolBuckets=!0,!u)break;g.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const p in this.buckets){const g=this.buckets[p];if(g instanceof a.b4&&g.hasRTLText){this.hasRTLText=!0,a.b5();break}}this.queryPadding=0;for(const p in this.buckets){const g=this.buckets[p],y=o.style.getOwnLayer(p);if(!y)continue;const b=y.queryRadius(g);this.queryPadding=Math.max(this.queryPadding,b)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new a.b3}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,o,u){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Gh(t.buckets,o.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t,o){for(const g in this.buckets){const y=this.buckets[g];if(y.uploadPending()){let b={},T=[],C={zoom:0,pitch:0,brightness:0,worldview:""};if(o){if(o.style){T=o.style.listImages();const I=y.layers[0],B=I.sourceLayer||"_geojsonTileLayer",L=o.style.getLayerSourceCache(I);L&&(b=L._state.getState(B,void 0))}C={zoom:o.transform.zoom||0,pitch:o.transform.pitch||0,brightness:o.style.getBrightness()||0,worldview:o.worldview||""}}y.upload(t,this.tileID.canonical,b,T,C)}}const u=t.gl,p=this.imageAtlas;p&&!p.uploaded&&(this.imageAtlasTexture=new a.T(t,p.image,u.RGBA8,{useMipmap:!!p.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new a.T(t,this.glyphAtlasImage,u.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new a.T(t,this.lineAtlas.image,u.R8),this.lineAtlas.uploaded=!0)}prepare(t,o,u){if(this.imageAtlas&&this.imageAtlasTexture&&o){const g=o.style.getLut(u);this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,u,g)}if(!o||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const p=o.style.getBrightness();this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(o)),(this._lastUpdatedBrightness||p||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&p&&Math.abs(this._lastUpdatedBrightness-p)<.001||(this.updateBuckets(o,this._lastUpdatedBrightness!==p),this._lastUpdatedBrightness=p))}evaluateQueryRenderedFeaturePadding(){let t=0;for(const o in this.buckets){const u=this.buckets[o];u.evaluateQueryRenderedFeaturePadding&&(t=Math.max(t,u.evaluateQueryRenderedFeaturePadding()))}return t}queryRenderedFeatures(t,o,u,p,g,y,b){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const T=this.evaluateQueryRenderedFeaturePadding(),C=(function(I,B){const L=a.bq([],[.5*I.width,.5*-I.height,1]);return a.br(L,L,[1,-1,0]),a.aB(L,L,I.calculateProjMatrix(B.toUnwrapped())),Float32Array.from(L)})(g,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:o,pixelPosMatrix:C,transform:p,availableImages:u,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:T,scope:b})}querySourceFeatures(t,o){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const p=u.loadVTLayers(),g=o?o.sourceLayer:"",y=p._geojsonTileLayer||p[g];if(!y)return;const b=a.b6(o&&o.filter),{z:T,x:C,y:I}=this.tileID.canonical,B={z:T,x:C,y:I};for(let L=0;L<y.length;L++){const N=y.feature(L);if(b.needGeometry){const q=a.b7(N,!0);if(!b.filter(new a.ac(this.tileID.overscaledZ,{worldview:this.worldview}),q,this.tileID.canonical))continue}else if(!b.filter(new a.ac(this.tileID.overscaledZ,{worldview:this.worldview}),N))continue;const H=u.getId(N,g),j=new a.b8(N,T,C,I,H);j.tile=B,t.push(j)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const o=this.expirationTime;if(t.cacheControl){const u=a.b9(t.cacheControl);u["max-age"]&&(this.expirationTime=Date.now()+1e3*u["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const u=Date.now();let p=!1;if(this.expirationTime>u)p=!1;else if(o)if(this.expirationTime<o)p=!0;else{const g=this.expirationTime-o;g?this.expirationTime=u+Math.max(g,3e4):p=!0}else p=!0;p?(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)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}hasAppearances(t){for(const o in this.buckets)if(t.style.hasLayer(o)&&this.buckets[o].layers.some(u=>u.appearances&&u.appearances.length>0))return!0;return!1}updateBuckets(t,o){if(!this.latestFeatureIndex||!t.style)return;const u=t.style.listImages(),p=t.style.getBrightness();for(const g in this.buckets){if(!t.style.hasLayer(g))continue;const y=this.buckets[g],b=y.layers[0],T=b.sourceLayer||"_geojsonTileLayer",C=t.style.getLayerSourceCache(b);let I={};C&&(I=C._state.getState(T,void 0));const B=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},L=Object.keys(I).length>0&&!o;y.hasAppearances=y.layers.some(j=>j.appearances&&j.appearances.length>0);const N=L?y.stateDependentLayers:y.layers;if(L&&y.stateDependentLayers.length!==0||o){const j=this.latestFeatureIndex.loadVTLayers();y.update(I,j[T],u,B,N,o,p)}if(L&&y.stateDependentLayers.length!==0||o||y.hasAppearances){const j={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview};y.updateAppearances(this.tileID.canonical,I,u,j,t.imageManager)}(y instanceof a.ba||y instanceof a.bb)&&t._terrain&&t._terrain.enabled&&C&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(C.id,this.tileID);const H=t&&t.style&&t.style.getOwnLayer(g);H&&(this.queryPadding=Math.max(this.queryPadding,H.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.o.now()+t}setTexture(t,o){const u=o.context,p=u.gl;this.texture=this.texture||o.getTileTexture(t.width),this.texture&&this.texture instanceof a.T?this.texture.update(t):(this.texture=new a.T(u,t,p.RGBA8,{useMipmap:!0}),this.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE))}setDependencies(t,o){const u={};for(const p of o)u[p]=!0;this.dependencies[t]=u}hasDependency(t,o){for(const u of t){const p=this.dependencies[u];if(p){for(const g of o)if(p[g])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const u=a.bc(ls,this.tileID.canonical,this.tileTransform)[0],p=new a.bd,g=new a.be;for(let y=0;y<u.length;y++){const{x:b,y:T}=u[y];p.emplaceBack(b,T),g.emplaceBack(y)}g.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(g),this._tileDebugBuffer=t.createVertexBuffer(p,a.bf.members),this._tileDebugSegments=a.bg.simpleSegment(0,0,p.length,g.length)}_makeTileBoundsBuffers(t,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const u=a.bc(ls,this.tileID.canonical,this.tileTransform)[0];let p,g;if(this.isRaster){const y=(function(b,T){const C=a.aZ(b,T),I=Math.pow(2,b.z);for(let q=0;q<Na;q++)for(let W=0;W<Na;W++){const ne=a.a_((b.x+(W+Es(W))/ao)/I),ie=a.a$((b.y+(q+Es(q))/ao)/I),ee=T.project(ne,ie),xe=q*Na+W;Kr[2*xe+0]=Math.round((ee.x*C.scale-C.x)*a.al),Kr[2*xe+1]=Math.round((ee.y*C.scale-C.y)*a.al)}ss.fill(0),ac.fill(0);for(let q=2045;q>=0;q--){const W=4*q,ne=as[W+0],ie=as[W+1],ee=as[W+2],xe=as[W+3],me=ne+ee>>1,ye=ie+xe>>1,de=me+ye-ie,se=ye+ne-me,Te=ie*Na+ne,Ae=xe*Na+ee,Re=ye*Na+me,Be=Math.hypot((Kr[2*Te+0]+Kr[2*Ae+0])/2-Kr[2*Re+0],(Kr[2*Te+1]+Kr[2*Ae+1])/2-Kr[2*Re+1])>=16;ss[Re]=ss[Re]||(Be?1:0),q<1022&&(ss[Re]=ss[Re]||ss[(ie+se>>1)*Na+(ne+de>>1)]||ss[(xe+se>>1)*Na+(ee+de>>1)])}const B=new a.b1,L=new a.b0;let N=0;function H(q,W){const ne=W*Na+q;return ac[ne]===0&&(B.emplaceBack(Kr[2*ne+0],Kr[2*ne+1],q*a.al/ao,W*a.al/ao),ac[ne]=++N),ac[ne]-1}function j(q,W,ne,ie,ee,xe){const me=q+ne>>1,ye=W+ie>>1;if(Math.abs(q-ee)+Math.abs(W-xe)>1&&ss[ye*Na+me])j(ee,xe,q,W,me,ye),j(ne,ie,ee,xe,me,ye);else{const de=H(q,W),se=H(ne,ie),Te=H(ee,xe);L.emplaceBack(de,se,Te)}}return j(0,0,ao,ao,ao,0),j(ao,ao,0,0,0,ao),{vertices:B,indices:L}})(this.tileID.canonical,o);p=y.vertices,g=y.indices}else{p=new a.b1,g=new a.b0;for(const{x:b,y:T}of u)p.emplaceBack(b,T,0,0);const y=a.bh(p.int16.subarray(0,4*p.length),void 0,4);for(let b=0;b<y.length;b+=3)g.emplaceBack(y[b],y[b+1],y[b+2])}this._tileBoundsBuffer=t.createVertexBuffer(p,a.bi.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(g),this._tileBoundsSegments=a.bg.simpleSegment(0,0,p.length,g.length)}_makeGlobeTileDebugBuffers(t,o){const u=o.projection;if(!u||u.name!=="globe"||o.freezeTileCoverage)return;const p=this.tileID.canonical,g=a.bj(p,o),y=a.bk(g),b=a.aj(o.zoom);let T;b>0&&(T=a.bl(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,p,o,y,T,b),this._makeGlobeTileDebugTextBuffer(t,p,o,y,T,b)}_globePoint(t,o,u,p,g,y,b){let T=a.bm(t,o,u);if(y){const C=1<<u.z,I=a.aF(p.center.lng),B=a.aJ(p.center.lat),L=(u.x+.5)/C-I;let N=0;L>.5?N=-1:L<-.5&&(N=1);let H=(t/a.al+u.x)/C+N,j=(o/a.al+u.y)/C;H=(H-I)*p._pixelsPerMercatorPixel+I,j=(j-B)*p._pixelsPerMercatorPixel+B;const q=[H*p.worldSize,j*p.worldSize,0];a.af(q,q,y),T=a.bn(T,q,b)}return a.af(T,T,g)}_makeGlobeTileDebugBorderBuffer(t,o,u,p,g,y){const b=new a.bd,T=new a.be,C=new a.bo,I=(L,N,H,j,q)=>{const W=(H-L)/(q-1),ne=(j-N)/(q-1),ie=b.length;for(let ee=0;ee<q;ee++){const xe=L+ee*W,me=N+ee*ne;b.emplaceBack(xe,me);const ye=this._globePoint(xe,me,o,u,p,g,y);C.emplaceBack(ye[0],ye[1],ye[2]),T.emplaceBack(ie+ee)}},B=a.al;I(0,0,B,0,16),I(B,0,B,B,16),I(B,B,0,B,16),I(0,B,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(T),this._tileDebugBuffer=t.createVertexBuffer(b,a.bf.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(C,a.bp.members),this._tileDebugSegments=a.bg.simpleSegment(0,0,b.length,T.length)}_makeGlobeTileDebugTextBuffer(t,o,u,p,g,y){const b=a.al/4,T=new a.bd,C=new a.b0,I=new a.bo,B=25;C.reserve(32),T.reserve(B),I.reserve(B);const L=(N,H)=>B*N+H;for(let N=0;N<B;N++){const H=N*b;for(let j=0;j<B;j++){const q=j*b;T.emplaceBack(q,H);const W=this._globePoint(q,H,o,u,p,g,y);I.emplaceBack(W[0],W[1],W[2])}}for(let N=0;N<4;N++)for(let H=0;H<4;H++){const j=L(N,H),q=L(N,H+1),W=L(N+1,H),ne=L(N+1,H+1);C.emplaceBack(j,q,W),C.emplaceBack(W,q,ne)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(C),this._tileDebugTextBuffer=t.createVertexBuffer(T,a.bf.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(I,a.bp.members),this._tileDebugTextSegments=a.bg.simpleSegment(0,0,B,32)}destroy(t=!0){for(const o in this.buckets)this.buckets[o].destroy(t);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),t&&this.texture&&this.texture instanceof a.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof a.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}a.bs.setPbf(a.bt);class Ou extends Al{constructor(t,o,u,p,g){super(t,o,u,p,g),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,o,u){const p=u.context,g=p.gl;let y=this.texturePerLayer.get(t)||u.getTileTexture(o.width);y&&y instanceof a.T?y.update(o,{premultiply:!1}):y=new a.T(p,o,g.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,y)}flushQueues(t){const o=this._workQueuePerLayer.get(t)||[],u=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()();for(;u.length;)u.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const o=this._workQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const o=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}}fetchHeader(t=16384,o){const u=this._mrt=new a.bs(30),p=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=a.bu(p,(g,y,b)=>{if(g)o(g);else try{const T=u.getHeaderLength(y);if(T>t)return void(this.request=this.fetchHeader(T,o));u.parseHeader(y),this._isHeaderLoaded=!0;let C=0;for(const I of Object.values(u.layers))C=Math.max(C,I.dataIndex[I.dataIndex.length-1].lastByte);y.byteLength>=C&&(this.entireBuffer=y),o(null,this.entireBuffer||y,b)}catch(T){o(T)}}),this.request}fetchBandForRender(t,o,u,p){this.fetchBand(t,o,u,g=>{if(g)return void p(g);this.updateTextureDescriptor(t,o,u);const y=this.textureDescriptorPerLayer.get(o);p(null,y?y.img:null)})}fetchBand(t,o,u,p,g=!0){const y=this._mrt;if(!this._isHeaderLoaded||!y)return void p(new Error("Tile header is not ready"));const b=this.actor;if(!b)return void p(new Error("Can't fetch tile band without an actor"));let T;const C=a.B(String(u),a.B(this.tileID.key,t));let I=this._taskQueue.get(C);I?I.add(p):(I=new Set,I.add(p),this._taskQueue.set(C,I));const B=(j,q)=>{T.complete(j,q),j?p(j):(I.forEach(W=>W(null,q)),this._taskQueue.delete(C))},L=(j,q)=>{if(j)return p(j);const W=b.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:q,task:T},B,void 0,!0);if(o!==null){const ne=this._workQueuePerLayer.get(o)||[];ne.push(()=>{W&&W.cancel(),T.cancel()}),this._workQueuePerLayer.has(o)||this._workQueuePerLayer.set(o,ne)}};let N;try{N=y.getLayer(t)}catch(j){if(this.state==="reloading")return;throw j}if(!N)return void p(new Error(`Unknown sourceLayer "${t}"`));if(N.hasDataForBand(u))return I.forEach(j=>j(null,null)),void this._taskQueue.delete(C);const H=N.getDataRange([u]);if(T=y.createDecodingTask(H),!T||T.tasks.length)if(o!==null&&this.flushQueues(o),this.entireBuffer)L(null,this.entireBuffer.slice(H.firstByte,H.lastByte+1));else{const j=Object.assign({},this.requestParams,{headers:{Range:`bytes=${H.firstByte}-${H.lastByte}`}}),q=a.bu(j,L);if(o!==null){const W=this._fetchQueuePerLayer.get(o)||[];W.push(()=>{q.cancel(),T.cancel()}),this._fetchQueuePerLayer.has(o)||this._fetchQueuePerLayer.set(o,W)}}}updateNeeded(t,o){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==o||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(t,o,u){if(!this._mrt)return;const p=this._mrt.getLayer(t);if(!p||!p.hasBand(u)||!p.hasDataForBand(u))return;const{bytes:g,tileSize:y,buffer:b,offset:T,scale:C}=p.getBandView(u),I=y+2*b,B=new a.q({width:I,height:I},g),L=this.texturePerLayer.get(o);L&&L instanceof a.T&&L.update(B,{premultiply:!1}),this.textureDescriptorPerLayer.set(o,{layer:t,band:u,img:B,buffer:b,offset:T,tileSize:y,format:p.pixelFormat,mix:[C,256*C,65536*C,16777216*C]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const o of this.texturePerLayer.values())o&&o instanceof a.T&&o.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class cp{constructor(t,o){this.max=t,this.onRemove=o,this.reset()}reset(){for(const t in this.data)for(const o of this.data[t])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(t,o,u){const p=t.wrapped().key;this.data[p]===void 0&&(this.data[p]=[]);const g={value:o,timeout:void 0};if(u!==void 0&&(g.timeout=setTimeout(()=>{this.remove(t,g)},u)),this.data[p].push(g),this.order.push(p),this.order.length>this.max){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const o=this.data[t].shift();return o.timeout&&clearTimeout(o.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),o.value}getByKey(t){const o=this.data[t];return o?o[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,o){if(!this.has(t))return this;const u=t.wrapped().key,p=o===void 0?0:this.data[u].indexOf(o),g=this.data[u][p];return this.data[u].splice(p,1),g.timeout&&clearTimeout(g.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(g.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(t){const o=[];for(const u in this.data)for(const p of this.data[u])t(p.value)||o.push(p);for(const u of o)this.remove(u.value.tileID,u)}}class Bu{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,o,u){const p=String(o);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][p]=this.stateChanges[t][p]||{},Object.assign(this.stateChanges[t][p],u),this.deletedStates[t]===null){this.deletedStates[t]={};for(const g in this.state[t])g!==p&&(this.deletedStates[t][g]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][p]===null){this.deletedStates[t][p]={};for(const g in this.state[t][p])u[g]||(this.deletedStates[t][p][g]=null)}else for(const g in u)this.deletedStates[t]&&this.deletedStates[t][p]&&this.deletedStates[t][p][g]===null&&delete this.deletedStates[t][p][g]}removeFeatureState(t,o,u){if(this.deletedStates[t]===null)return;const p=String(o);if(this.deletedStates[t]=this.deletedStates[t]||{},u&&o!==void 0)this.deletedStates[t][p]!==null&&(this.deletedStates[t][p]=this.deletedStates[t][p]||{},this.deletedStates[t][p][u]=null);else if(o!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][p])for(u in this.deletedStates[t][p]={},this.stateChanges[t][p])this.deletedStates[t][p][u]=null;else this.deletedStates[t][p]=null;else this.deletedStates[t]=null}getState(t,o){const u=this.state[t]||{},p=this.stateChanges[t]||{},g=this.deletedStates[t];if(g===null)return{};if(o!==void 0){const b=String(o),T=Object.assign({},u[b],p[b]);if(g){const C=g[o];if(C===null)return{};for(const I in C)delete T[I]}return T}const y=Object.assign({},u,p);if(g)for(const b in g)delete y[b];return y}initializeTileState(t,o){t.refreshFeatureState(o)}coalesceChanges(t,o){const u={};for(const p in this.stateChanges){this.state[p]=this.state[p]||{};const g={};for(const y in this.stateChanges[p])this.state[p][y]||(this.state[p][y]={}),Object.assign(this.state[p][y],this.stateChanges[p][y]),g[y]=this.state[p][y];u[p]=g}for(const p in this.deletedStates){this.state[p]=this.state[p]||{};const g={};if(this.deletedStates[p]===null)for(const y in this.state[p])g[y]={},this.state[p][y]={};else for(const y in this.deletedStates[p]){if(this.deletedStates[p][y]===null)this.state[p][y]={};else if(this.state[p][y])for(const b of Object.keys(this.deletedStates[p][y]))delete this.state[p][y][b];g[y]=this.state[p][y]}u[p]=u[p]||{},Object.assign(u[p],g)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const p in t)t[p].refreshFeatureState(o)}}class Nr extends a.E{constructor(t,o,u){super(),this.id=t,this._onlySymbols=u,o.on("data",p=>{p.dataType==="source"&&p.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&p.dataType==="source"&&p.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new cp(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Bu,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,o){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,o)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const u=this._tiles[o];u.upload(t,this.map?this.map.painter:void 0),u.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Nc).map(t=>t.key)}getRenderableIds(t,o){const u=[];for(const p in this._tiles)this._isIdRenderable(+p,t,o)&&u.push(this._tiles[p]);return t?u.sort((p,g)=>{const y=p.tileID,b=g.tileID,T=new a.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),C=new a.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-b.overscaledZ||C.y-T.y||C.x-T.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Nc).map(p=>p.key)}hasRenderableParent(t){const o=this.findLoadedParent(t,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(t,o,u){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(o||!this._tiles[t].holdingForFade())&&(u||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,o){const u=this._tiles[t];u&&(u.state!=="loading"&&(u.state=o),this._loadTile(u,this._tileLoaded.bind(this,u,t,o)))}_tileLoaded(t,o,u,p,g){if(p){if(t.state="errored",p.status!==404)this._source.fire(new a.y(p,{tile:t}));else{if(this._source.fire(new a.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const b=this.map.painter.terrain;this.update(this.transform,b.getScaledDemTileSize(),!0),b.resetTileLookupCache(this.id)}else this.update(this.transform)}return}t.timeAdded=a.o.now(),u==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let y=new Map;g&&g.responseHeaders&&(y=g.responseHeaders),this._source.fire(new a.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:y}))}_backfillDEM(t){const o=this.getRenderableIds();for(let p=0;p<o.length;p++){const g=o[p];if(t.neighboringTiles&&t.neighboringTiles[g]){const y=this.getTileByID(g);u(t,y),u(y,t)}}function u(p,g){if(!p.dem||p.dem.borderReady)return;p.needsHillshadePrepare=!0,p.needsDEMTextureUpload=!0;let y=g.tileID.canonical.x-p.tileID.canonical.x;const b=g.tileID.canonical.y-p.tileID.canonical.y,T=Math.pow(2,p.tileID.canonical.z),C=g.tileID.key;y===0&&b===0||Math.abs(b)>1||(Math.abs(y)>1&&(Math.abs(y+T)===1?y+=T:Math.abs(y-T)===1&&(y-=T)),g.dem&&p.dem&&(p.dem.backfillBorder(g.dem,y,b),p.neighboringTiles&&p.neighboringTiles[C]&&(p.neighboringTiles[C].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,o,u,p){for(const g in this._tiles){let y=this._tiles[g];if(p[g]||!y.hasData()||y.tileID.overscaledZ<=o||y.tileID.overscaledZ>u)continue;let b=y.tileID;for(;y&&y.tileID.overscaledZ>o+1;){const C=y.tileID.scaledTo(y.tileID.overscaledZ-1);y=this._tiles[C.key],y&&y.hasData()&&(b=C)}let T=b;for(;T.overscaledZ>o;)if(T=T.scaledTo(T.overscaledZ-1),t[T.key]){p[b.key]=b;break}}}findLoadedParent(t,o){if(t.key in this._loadedParentTiles){const u=this._loadedParentTiles[t.key];return u&&u.tileID.overscaledZ>=o?u:null}for(let u=t.overscaledZ-1;u>=o;u--){const p=t.scaledTo(u),g=this._getLoadedTile(p);if(g)return g}}_getLoadedTile(t){const o=this._tiles[t.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,o){o=o||this._source.tileSize;const u=Math.ceil(t.width/o)+1,p=Math.ceil(t.height/o)+1,g=Math.floor(u*p*5),y=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,g):g,b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(b)}handleWrapJump(t){const o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,o){const u={};for(const p in this._tiles){const g=this._tiles[p];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+o),u[g.tileID.key]=g}this._tiles=u;for(const p in this._timers)clearTimeout(this._timers[p]),delete this._timers[p];for(const p in this._tiles)this._setTileReloadTimer(+p,this._tiles[p])}}update(t,o,u,p,g){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!u)return;this.updateCacheSize(t,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const y=this._source.type==="batched-model";let b,T=this._source.maxzoom;const C=this.map&&this.map.painter?this.map.painter._terrain:null;if(C&&C.sourceCache===this&&C.attenuationRange()){const L=C.attenuationRange()[0],N=Math.floor(L)-Math.log2(C.getDemUpscale());T>N&&(T=N)}if(this.used||this.usedForTerrain){if(this._source.tileID)b=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(L=>new a.aQ(L.canonical.z,L.wrap,L.canonical.z,L.canonical.x,L.canonical.y));else if(this.tileCoverLift!==0){const L=t.clone();L.tileCoverLift=this.tileCoverLift,b=L.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:T,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:y}),this._source.minzoom<=1&&t.projection.name==="globe"&&(b.push(new a.aQ(1,0,1,0,0)),b.push(new a.aQ(1,0,1,1,0)),b.push(new a.aQ(1,0,1,0,1)),b.push(new a.aQ(1,0,1,1,1)))}else if(b=t.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:T,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:y}),this._source.hasTile){const L=this._source.hasTile.bind(this._source);b=b.filter(N=>L(N))}}else b=[];if(b.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Ml(this._source.type)){const L=t.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!u}),N=Math.min(L,this._source.maxzoom);if(y){const H=t.extendTileCover(b,N);for(const j of H)b.push(j)}else if(g){const H=t.extendTileCoverToNearPlane(b,this.transform.getFrustum(N),N);for(const j of H)b.push(j)}else if(this.castsShadows&&p){const H=t.extendTileCover(b,N,p,16);for(const j of H)this._shadowCasterTiles[j.key]=!0,b.push(j)}}const I=this._updateRetainedTiles(b);if(Ml(this._source.type)&&b.length!==0){const L={},N={},H=Object.keys(I);for(const q of H){const W=I[q],ne=this._tiles[q];if(!ne||ne.fadeEndTime&&ne.fadeEndTime<=a.o.now())continue;const ie=this.findLoadedParent(W,Math.max(W.overscaledZ-Nr.maxOverzooming,this._source.minzoom));ie&&(this._addTile(ie.tileID),L[ie.tileID.key]=ie.tileID),N[q]=W}const j=b[b.length-1].overscaledZ;for(const q in this._tiles){const W=this._tiles[q];if(I[q]||!W.hasData())continue;let ne=W.tileID;for(;ne.overscaledZ>j;){ne=ne.scaledTo(ne.overscaledZ-1);const ie=this._tiles[ne.key];if(ie&&ie.hasData()&&N[ne.key]){I[q]=W.tileID;break}}}for(const q in L)I[q]||(this._coveredTiles[q]=!0,I[q]=L[q])}for(const L in I)this._tiles[L].clearFadeHold();const B=a.bv(this._tiles,I);for(const L of B){const N=this._tiles[L];N.hasSymbolBuckets&&!N.holdingForFade()?N.setHoldDuration(this.map._fadeDuration):N.hasSymbolBuckets&&!N.symbolFadeFinished()||this._removeTile(+L)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const o={};if(t.length===0)return o;const u={},p=t.reduce((C,I)=>Math.min(C,I.overscaledZ),1/0),g=t[0].overscaledZ,y=Math.max(g-Nr.maxOverzooming,this._source.minzoom),b=Math.max(g+Nr.maxUnderzooming,this._source.minzoom),T={};for(const C of t){const I=this._addTile(C);o[C.key]=C,I.hasData()||p<this._source.maxzoom&&(T[C.key]=C)}this._retainLoadedChildren(T,p,b,o);for(const C of t){let I=this._tiles[C.key];if(I.hasData())continue;if(C.canonical.z>=this._source.maxzoom){const L=C.children(this._source.maxzoom)[0],N=this.getTile(L);if(N&&N.hasData()){o[L.key]=L;continue}}else{const L=C.children(this._source.maxzoom);if(o[L[0].key]&&o[L[1].key]&&o[L[2].key]&&o[L[3].key])continue}let B=I.wasRequested();for(let L=C.overscaledZ-1;L>=y;--L){const N=C.scaledTo(L);if(u[N.key]||(u[N.key]=!0,I=this.getTile(N),!I&&B&&(I=this._addTile(N)),I&&(o[N.key]=N,B=I.wasRequested(),I.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const o=[];let u,p=this._tiles[t].tileID;for(;p.overscaledZ>0;){if(p.key in this._loadedParentTiles){u=this._loadedParentTiles[p.key];break}o.push(p.key);const g=p.scaledTo(p.overscaledZ-1);if(u=this._getLoadedTile(g),u)break;p=g}for(const g of o)this._loadedParentTiles[g]=u}}_addTile(t){let o=this._tiles[t.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),o;o=this._cache.getAndRemove(t),o&&(this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,o)));const u=!!o;if(!u){const p=this.map?this.map.painter:null,g=this._source.tileSize*t.overscaleFactor();o=this._source.type==="raster-array"?new Ou(t,g,this.transform.tileZoom,p,this._isRaster):new Al(t,g,this.transform.tileZoom,p,this._isRaster,this._source.worldview),this._loadTile(o,this._tileLoaded.bind(this,o,t.key,o.state))}return o.uses++,this._tiles[t.key]=o,u||this._source.fire(new a.z("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const u=o.getExpiryTimeout();u&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},u))}_removeTile(t){const o=this._tiles[t];o&&(o.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,o,u){const p=[],g=this.transform;if(!g)return p;const y=g.projection.name==="globe",b=a.aF(g.center.lng);for(const T in this._tiles){const C=this._tiles[T];if(u&&C.clearQueryDebugViz(),C.holdingForFade())continue;let I;if(y){const B=C.tileID.canonical;if(B.z===0){const L=[Math.abs(a.aA(b,...Ko(B,-1))-b),Math.abs(a.aA(b,...Ko(B,1))-b)];I=[0,2*L.indexOf(Math.min(...L))-1]}else{const L=[Math.abs(a.aA(b,...Ko(B,-1))-b),Math.abs(a.aA(b,...Ko(B,0))-b),Math.abs(a.aA(b,...Ko(B,1))-b)];I=[L.indexOf(Math.min(...L))-1]}}else I=[0];for(const B of I){const L=t.containsTile(C,g,o,B);L&&p.push(L)}}return p}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,o){const u=this.getRenderableIds(t,o).map(g=>this._tiles[g].tileID),p=this.transform.projection.name==="globe";for(const g of u)g.projMatrix=this.transform.calculateProjMatrix(g.toUnwrapped()),g.expandedProjMatrix=p?this.transform.calculateProjMatrix(g.toUnwrapped(),!1,!0):g.projMatrix;return u}sortCoordinatesByDistance(t){const o=t.slice(),u=this.transform._camera.position,p=this.transform._camera.forward(),g={};for(const y of o){const b=1/(1<<y.canonical.z);g[y.key]=((y.canonical.x+.5)*b+y.wrap-u[0])*p[0]+((y.canonical.y+.5)*b-u[1])*p[1]-u[2]*p[2]}return o.sort((y,b)=>g[y.key]-g[b.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(Ml(this._source.type))for(const t in this._tiles){const o=this._tiles[t];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=a.o.now())return!0}return!1}setFeatureState(t,o,u){this._state.updateState(t=t||"_geojsonTileLayer",o,u)}removeFeatureState(t,o,u){this._state.removeFeatureState(t=t||"_geojsonTileLayer",o,u)}getFeatureState(t,o){return this._state.getState(t=t||"_geojsonTileLayer",o)}setDependencies(t,o,u){const p=this._tiles[t];p&&p.setDependencies(o,u)}reloadTilesForDependencies(t,o){for(const u in this._tiles)this._tiles[u].hasDependency(t,o)&&this._reloadTile(+u,"reloading");this._cache.filter(u=>!u.hasDependency(t,o))}_preloadTiles(t,o){if(!this._sourceLoaded){const T=()=>{this._sourceLoaded&&(this._source.off("data",T),this._preloadTiles(t,o))};return void this._source.on("data",T)}const u=new Map,p=Array.isArray(t)?t:[t],g=this.map.painter.terrain,y=this.usedForTerrain&&g?g.getScaledDemTileSize():this._source.tileSize;for(const T of p){const C=T.coveringTiles({tileSize:y,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const I of C)u.set(I.key,I);this.usedForTerrain&&T.updateElevation(!1)}const b=Array.from(u.values());a.bw(b,(T,C)=>{const I=new Al(T,this._source.tileSize*T.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(I,B=>{this._source.type==="raster-dem"&&I.dem&&this._backfillDEM(I),C(B,I)})},o)}}function Nc(c,t){const o=Math.abs(2*c.wrap)-+(c.wrap<0),u=Math.abs(2*t.wrap)-+(t.wrap<0);return c.overscaledZ-t.overscaledZ||u-o||t.canonical.y-c.canonical.y||t.canonical.x-c.canonical.x}function Ml(c){return c==="raster"||c==="image"||c==="video"||c==="custom"}function Ko(c,t){const o=1<<c.z;return[c.x/o+t,(c.x+1)/o+t]}Nr.maxOverzooming=10,Nr.maxUnderzooming=3;class Uc{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,o=!1;for(const u in this.style._mergedLayers){const p=this.style._mergedLayers[u];if(p.type==="fill-extrusion"||p.type==="building")this.layers.push({layer:p,visible:t,visibilityChanged:o});else if(p.type==="model"){const g=this.style.getLayerSource(p);g&&g.type==="batched-model"&&this.layers.push({layer:p,visible:t,visibilityChanged:o})}}}onNewFrame(t){this.layersGotHidden=!1;for(const o of this.layers){const u=o.layer;let p=!1;u.type==="fill-extrusion"?p=!u.isHidden(t)&&u.paint.get("fill-extrusion-opacity")>0:u.type==="building"?p=!u.isHidden(t)&&u.paint.get("building-opacity")>0:u.type==="model"&&(p=!u.isHidden(t)&&u.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!p&&o.visible,o.visible=p}}updateZOffset(t,o){this.currentBuildingBuckets=[];for(const p of this.layers){const g=p.layer,y=this.style.getLayerSourceCache(g);let b=1;g.type==="fill-extrusion"?b=p.visible?g.paint.get("fill-extrusion-vertical-scale"):0:g.type==="building"&&(b=p.visible?g.paint.get("building-vertical-scale"):0);let T=y?y.getTile(o):null;if(!T&&y)for(const C in y._tiles){const I=y._tiles[C];if(o.canonical.isChildOf(I.tileID.canonical)){T=I;break}}this.currentBuildingBuckets.push({bucket:T?T.getBucket(g):null,tileID:T?T.tileID:o,verticalScale:b})}t.hasAnyZOffset=!1;let u=!1;for(let p=0;p<t.symbolInstances.length;p++){const g=t.symbolInstances.get(p),y=g.zOffset,b=this._getHeightAtTileOffset(o,g.tileAnchorX,g.tileAnchorY);g.zOffset=b!==Number.NEGATIVE_INFINITY?b:y,u||y===g.zOffset||(u=!0),t.hasAnyZOffset||g.zOffset===0||(t.hasAnyZOffset=!0)}u&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,o,u,p){let g=o,y=u;if(t.canonical.z!==p.canonical.z){const b=p.canonical,T=1/(1<<t.canonical.z-b.z);g=(o+t.canonical.x*a.al)*T-b.x*a.al|0,y=(u+t.canonical.y*a.al)*T-b.y*a.al|0}return{tileX:g,tileY:y}}_getHeightAtTileOffset(t,o,u){let p,g;for(let y=0;y<this.layers.length;++y){const b=this.layers[y].layer;if(b.type!=="fill-extrusion"&&b.type!=="building")continue;const{bucket:T,tileID:C,verticalScale:I}=this.currentBuildingBuckets[y];if(!T)continue;const{tileX:B,tileY:L}=this._mapCoordToOverlappingTile(t,o,u,C),N=T.getHeightAtTileCoord(B,L);N&&N.height!==void 0&&(N.hidden?p=N.height:g=Math.max(N.height*I,g||0))}if(g!==void 0)return g;for(let y=0;y<this.layers.length;++y){const b=this.layers[y];if(b.layer.type!=="model"||!b.visible)continue;const{bucket:T,tileID:C}=this.currentBuildingBuckets[y];if(!T)continue;const{tileX:I,tileY:B}=this._mapCoordToOverlappingTile(t,o,u,C),L=T.getHeightAtTileCoord(I,B);if(L&&!L.hidden)return L.height===void 0&&p!==void 0?Math.min(L.maxHeight,p)*L.verticalScale:L.height?L.height*L.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Wd(c,t){const o={};for(const u in c)u!=="ref"&&(o[u]=c[u]);return a.bx.forEach(u=>{u in t&&(o[u]=t[u])}),o}function Yd(c){c=c.slice();const t=Object.create(null);for(let o=0;o<c.length;o++)t[c[o].id]=c[o];for(let o=0;o<c.length;o++)"ref"in c[o]&&(c[o]=Wd(c[o],t[c[o].ref]));return c}const en={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function Cl(c,t,o){o.push({command:en.addSource,args:[c,t[c]]})}function Hh(c,t,o){t.push({command:en.removeSource,args:[c]}),o[c]=!0}function sa(c,t,o,u){Hh(c,o,u),Cl(c,t,o)}function sc(c,t,o){let u;for(u in c[o])if(c[o].hasOwnProperty(u)&&u!=="data"&&!a.by(c[o][u],t[o][u]))return!1;for(u in t[o])if(t[o].hasOwnProperty(u)&&u!=="data"&&!a.by(c[o][u],t[o][u]))return!1;return!0}function lc(c,t,o,u,p,g){let y;for(y in t=t||{},c=c||{})c.hasOwnProperty(y)&&(a.by(c[y],t[y])||o.push({command:g,args:[u,y,t[y],p]}
vendor: 5,314 bytes, line 219
219));for(y in t)t.hasOwnProperty(y)&&!c.hasOwnProperty(y)&&(a.by(c[y],t[y])||o.push({command:g,args:[u,y,t[y],p]}))}function cs(c){return c.id}function qh(c,t){return c[t.id]=t,c}function ku(c,t,o){const u=t.createTileMatrix(c,c.worldSize,o.toUnwrapped());return a.aB(new Float32Array(16),c.projMatrix,u)}function up(c,t,o){if(t.projection.name===o.projection.name)return c.projMatrix;const u=o.clone();return u.setProjection(t.projection),ku(u,t.getProjection(),c)}function el(c,t,o){return t.name===o.projection.name?c.projMatrix:ku(o,t,c)}class us{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=a.aA(t,0,1);let o=1,u=this._distances[o];const p=t*this.paddedLength+this.padding;for(;u<p&&o<this._distances.length;)u=this._distances[++o];const g=o-1,y=this._distances[g],b=u-y,T=b>0?(p-y)/b:0;return this.points[g].mult(1-T).add(this.points[o].mult(T))}}class Fu{constructor(t,o,u){const p=this.boxCells=[],g=this.circleCells=[];this.xCellCount=Math.ceil(t/u),this.yCellCount=Math.ceil(o/u);for(let y=0;y<this.xCellCount*this.yCellCount;y++)p.push([]),g.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,u,p,g){this._forEachCell(o,u,p,g,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(p),this.bboxes.push(g)}insertCircle(t,o,u,p){this._forEachCell(o-p,u-p,o+p,u+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(u),this.circles.push(p)}_insertBoxCell(t,o,u,p,g,y){this.boxCells[g].push(y)}_insertCircleCell(t,o,u,p,g,y){this.circleCells[g].push(y)}_query(t,o,u,p,g,y){if(u<0||t>this.width||p<0||o>this.height)return!g&&[];const b=[];if(t<=0&&o<=0&&this.width<=u&&this.height<=p){if(g)return!0;for(let T=0;T<this.boxKeys.length;T++)b.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const C=this.circles[3*T],I=this.circles[3*T+1],B=this.circles[3*T+2];b.push({key:this.circleKeys[T],x1:C-B,y1:I-B,x2:C+B,y2:I+B})}return y?b.filter(y):b}return this._forEachCell(t,o,u,p,this._queryCell,b,{hitTest:g,seenUids:{box:{},circle:{}}},y),g?b.length>0:b}_queryCircle(t,o,u,p,g){const y=t-u,b=t+u,T=o-u,C=o+u;if(b<0||y>this.width||C<0||T>this.height)return!p&&[];const I=[];return this._forEachCell(y,T,b,C,this._queryCellCircle,I,{hitTest:p,circle:{x:t,y:o,radius:u},seenUids:{box:{},circle:{}}},g),p?I.length>0:I}query(t,o,u,p,g){return this._query(t,o,u,p,!1,g)}hitTest(t,o,u,p,g){return this._query(t,o,u,p,!0,g)}hitTestCircle(t,o,u,p){return this._queryCircle(t,o,u,!0,p)}_queryCell(t,o,u,p,g,y,b,T){const C=b.seenUids,I=this.boxCells[g];if(I!==null){const L=this.bboxes;for(const N of I)if(!C.box[N]){C.box[N]=!0;const H=4*N;if(t<=L[H+2]&&o<=L[H+3]&&u>=L[H+0]&&p>=L[H+1]&&(!T||T(this.boxKeys[N]))){if(b.hitTest)return y.push(!0),!0;y.push({key:this.boxKeys[N],x1:L[H],y1:L[H+1],x2:L[H+2],y2:L[H+3]})}}}const B=this.circleCells[g];if(B!==null){const L=this.circles;for(const N of B)if(!C.circle[N]){C.circle[N]=!0;const H=3*N;if(this._circleAndRectCollide(L[H],L[H+1],L[H+2],t,o,u,p)&&(!T||T(this.circleKeys[N]))){if(b.hitTest)return y.push(!0),!0;{const j=L[H],q=L[H+1],W=L[H+2];y.push({key:this.circleKeys[N],x1:j-W,y1:q-W,x2:j+W,y2:q+W})}}}}}_queryCellCircle(t,o,u,p,g,y,b,T){const C=b.circle,I=b.seenUids,B=this.boxCells[g];if(B!==null){const N=this.bboxes;for(const H of B)if(!I.box[H]){I.box[H]=!0;const j=4*H;if(this._circleAndRectCollide(C.x,C.y,C.radius,N[j+0],N[j+1],N[j+2],N[j+3])&&(!T||T(this.boxKeys[H])))return y.push(!0),!0}}const L=this.circleCells[g];if(L!==null){const N=this.circles;for(const H of L)if(!I.circle[H]){I.circle[H]=!0;const j=3*H;if(this._circlesCollide(N[j],N[j+1],N[j+2],C.x,C.y,C.radius)&&(!T||T(this.circleKeys[H])))return y.push(!0),!0}}}_forEachCell(t,o,u,p,g,y,b,T){const C=this._convertToXCellCoord(t),I=this._convertToYCellCoord(o),B=this._convertToXCellCoord(u),L=this._convertToYCellCoord(p);for(let N=C;N<=B;N++)for(let H=I;H<=L;H++)if(g.call(this,t,o,u,p,this.xCellCount*H+N,y,b,T))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,o,u,p,g,y){const b=p-t,T=g-o,C=u+y;return C*C>b*b+T*T}_circleAndRectCollide(t,o,u,p,g,y,b){const T=(y-p)/2,C=Math.abs(t-(p+T));if(C>T+u)return!1;const I=(b-g)/2,B=Math.abs(o-(g+I));if(B>I+u)return!1;if(C<=T||B<=I)return!0;const L=C-T,N=B-I;return L*L+N*N<=u*u}}const Am=Math.tan(85*Math.PI/180);function Vc(c,t,o,u,p,g,y){const b=a.bC();if(o)if(g.name==="globe"){const T=a.bD(p,t);a.aB(b,b,T)}else{const T=a.bE([],y);b[0]=T[0],b[1]=T[1],b[4]=T[2],b[5]=T[3],u||a.bB(b,b,p.angle)}
vendor: 39,965 bytes, line 219
219else a.aB(b,p.labelPlaneMatrix,c);return b}function Il(c,t,o,u,p,g,y){const b=Vc(c,t,o,u,p,g,y);return g.name==="globe"&&o||(b[2]=b[6]=b[10]=b[14]=0),b}function No(c,t,o,u,p,g,y){if(o){if(g.name==="globe"){const b=Vc(c,t,o,u,p,g,y);return a.bl(b,b),a.aB(b,c,b),b}{const b=a.bz(c),T=a.bA([]);return T[0]=y[0],T[1]=y[1],T[4]=y[2],T[5]=y[3],a.aB(b,b,T),u||a.bB(b,b,-p.angle),b}}return p.glCoordMatrix}function hs(c,t,o,u){const p=[c,t,o,1];o?a.aC(p,p,u):Qd(p,p,u);const g=p[3];return p[0]/=g,p[1]/=g,p[2]/=g,p}function Kd(c,t){return Math.min(.5+c/t*.5,1.5)}function Mm(c,t){const o=c[0]/c[3],u=c[1]/c[3];return o>=-t[0]&&o<=t[0]&&u>=-t[1]&&u<=t[1]}function pn(c,t,o,u,p,g,y,b,T,C,I=1){const B=o.transform,L=u?c.textSizeData:c.iconSizeData,N=a.bK(L,o.transform.zoom,I),H=B.projection.name==="globe",j=[256/o.width*2+1,256/o.height*2+1],q=u?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;q.clear();let W=null;H&&(W=u?c.text.globeExtVertexArray:c.icon.globeExtVertexArray);const ne=c.lineVertexArray,ie=u?c.text.placedSymbolArray:c.icon.placedSymbolArray,ee=o.transform.width/o.transform.height;let xe,me=!1;for(let ye=0;ye<ie.length;ye++){const de=ie.get(ye),{numGlyphs:se,writingMode:Te}=de;if(Te!==a.bL.vertical||me||xe===a.bL.horizontal||(me=!0),xe=Te,(de.hidden||Te===a.bL.vertical)&&!me){Ao(se,q);continue}me=!1;const Ae=new a.P(de.tileAnchorX,de.tileAnchorY),Re=c.elevationType==="road",Be=!!B.elevation||Re;let{x:Le,y:$e,z:ot}=B.projection.projectTilePoint(Ae.x,Ae.y,C.canonical),Fe=null;if(Be){const Yt=Re?c.getElevationFeatureForText(ye):null;Fe={getElevation:T,elevation:B.elevation,elevationFeature:Yt};const[oi,fi,Ri]=T(Ae,B.elevation,Yt);Le+=oi,$e+=fi,ot+=Ri}const Se=[Le,$e,ot,1];if(a.aC(Se,Se,t),!Mm(Se,j)){Ao(se,q);continue}const Ke=Se[3],Ve=Kd(o.transform.getCameraToCenterDistance(B.projection),Ke),it=a.bM(L,N,de),Et=y?it/Ve:it*Ve,Bt=hs(Le,$e,ot,p);if(Bt[3]<=0){Ao(se,q);continue}let Ct={};const At=a.an(c.layers[0].layout.get("text-max-angle")),Qt=Math.cos(At),Wt=y?null:Fe,Ft=Cm(de,Et,!1,b,t,p,g,c.glyphOffsetArray,ne,q,W,Bt,Ae,Ct,ee,Wt,B.projection,C,y,Qt);me=Ft.useVertical,Wt&&Ft.needsFlipping&&(Ct={}),(Ft.notEnoughRoom||me||Ft.needsFlipping&&Cm(de,Et,!0,b,t,p,g,c.glyphOffsetArray,ne,q,W,Bt,Ae,Ct,ee,Wt,B.projection,C,y,Qt).notEnoughRoom)&&Ao(se,q)}u?(c.text.dynamicLayoutVertexBuffer.updateData(q),W&&c.text.globeExtVertexBuffer&&c.text.globeExtVertexBuffer.updateData(W)):(c.icon.dynamicLayoutVertexBuffer.updateData(q),W&&c.icon.globeExtVertexBuffer&&c.icon.globeExtVertexBuffer.updateData(W))}function hp(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q){const{lineStartIndex:W,glyphStartIndex:ne,segment:ie}=b,ee=ne+b.numGlyphs,xe=W+b.lineLength,me=t.getoffsetX(ne),ye=t.getoffsetX(ee-1),de=jc(c*me,o,u,p,g,y,ie,W,xe,T,C,I,B,L,!0,N,H,j,q);if(!de)return null;const se=jc(c*ye,o,u,p,g,y,ie,W,xe,T,C,I,B,L,!0,N,H,j,q);return se?{first:de,last:se}:null}function dp(c,t,o,u){return c===a.bL.horizontal&&Math.abs(u)>Math.abs(o)?{useVertical:!0}:c===a.bL.vertical?u>0?{needsFlipping:!0}:null:t!==0&&(function(p,g){return p===0||Math.abs(g/p)>Am})(o,u)?t===1?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function Cm(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W,ne,ie){const ee=t/24,xe=c.lineOffsetX*ee,me=c.lineOffsetY*ee,{lineStartIndex:ye,glyphStartIndex:de,numGlyphs:se,segment:Te,writingMode:Ae,flipState:Re}=c,Be=ye+c.lineLength,Le=$e=>{if(I){const[Ke,Ve,it]=$e.up,Et=C.length;a.bN(I,Et+0,Ke,Ve,it),a.bN(I,Et+1,Ke,Ve,it),a.bN(I,Et+2,Ke,Ve,it),a.bN(I,Et+3,Ke,Ve,it)}const[ot,Fe,Se]=$e.point;a.bO(C,ot,Fe,Se,$e.angle)};if(se>1){const $e=hp(ee,b,xe,me,o,B,L,c,T,g,N,j,!1,q,W,ne,ie);if(!$e)return{notEnoughRoom:!0};if(u&&!o){let[ot,Fe,Se]=$e.first.point,[Ke,Ve,it]=$e.last.point;[ot,Fe]=hs(ot,Fe,Se,y),[Ke,Ve]=hs(Ke,Ve,it,y);const Et=dp(Ae,Re,(Ke-ot)*H,Ve-Fe);if(c.flipState=Et&&Et.needsFlipping?1:2,Et)return Et}Le($e.first);for(let ot=de+1;ot<de+se-1;ot++){const Fe=jc(ee*b.getoffsetX(ot),xe,me,o,B,L,Te,ye,Be,T,g,N,j,!1,!1,q,W,ne,ie);if(!Fe)return C.length-=4*(ot-de),{notEnoughRoom:!0};Le(Fe)}Le($e.last)}else{if(u&&!o){const ot=hs(L.x,L.y,0,p),Fe=ye+Te+1,Se=new a.P(T.getx(Fe),T.gety(Fe)),Ke=hs(Se.x,Se.y,0,p),Ve=Ke[3]>0?Ke:fp(L,Se,ot,1,p,void 0,q,W.canonical),it=dp(Ae,Re,(Ve[0]-ot[0])*H,Ve[1]-ot[1]);if(c.flipState=it&&it.needsFlipping?1:2,it)return it}const $e=jc(ee*b.getoffsetX(de),xe,me,o,B,L,Te,ye,Be,T,g,N,j,!1,!1,q,W,ne,ie);if(!$e)return{notEnoughRoom:!0};Le($e)}return{}}function mi(c,t,o,u,p){const{x:g,y,z:b}=u.projectTilePoint(c.x,c.y,t);if(!p)return hs(g,y,b,o);const[T,C,I]=p.getElevation(c,p.elevation,p.elevationFeature);return hs(g+T,y+C,b+I,o)}function fp(c,t,o,u,p,g,y,b){const T=mi(c.sub(t)._unit()._add(c),b,p,y,g);return a.av(T,o,T),a.aw(T,T),a.bH(T,o,T,u)}function jc(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W,ne){const ie=u?c-t:c+t;let ee=ie>0?1:-1,xe=0;u&&(ee*=-1,xe=Math.PI),ee<0&&(xe+=Math.PI);let me=b+y+(ee>0?0:1)|0,ye=p,de=p,se=0,Te=0;const Ae=Math.abs(ie),Re=[],Be=[];let Le=g,$e=Le,ot=a.bF([]);const Fe=()=>fp($e,Le,de,Ae-se+1,I,L,j,q.canonical);for(;se+Te<=Ae;){if(me+=ee,me<b||me>=T)return null;if(de=ye,$e=Le,Re.push(de),N&&Be.push($e),Le=new a.P(C.getx(me),C.gety(me)),ye=B[me],!ye){const Wt=mi(Le,q.canonical,I,j,L);ye=Wt[3]>0?B[me]=Wt:Fe()}se+=Te;const At=a.av([],ye,de),Qt=a.bG(de,ye);if(o&&Qt>0&&Te>0&&a.bJ(ot,At)/(Te*Qt)<ne)return null;Te=Qt,ot=At}H&&L&&(B[me]&&(ye=Fe(),Te=a.bG(de,ye),ot=a.av([],ye,de)),B[me]=ye);const Se=(Ae-se)/Te,Ke=Le.sub($e)._mult(Se)._add($e),Ve=a.bH([],de,ot,Se);let it=[0,0,1],Et=ot[0],Bt=ot[1];if(W&&(it=j.upVector(q.canonical,Ke.x,Ke.y),it[0]!==0||it[1]!==0||it[2]!==1)){const At=[it[2],0,-it[0]],Qt=a.bI([],it,At);a.aw(At,At),a.aw(Qt,Qt),Et=a.bJ(ot,At),Bt=a.bJ(ot,Qt)}if(o){const At=a.bI([],it,ot);a.aw(At,At),a.bH(Ve,Ve,At,o*ee)}const Ct=xe+Math.atan2(Bt,Et);return Re.push(Ve),N&&Be.push(Ke),{point:Ve,angle:Ct,path:Re,tilePath:Be,up:it}}function Ao(c,t){const o=t.length,u=o+4*c;t.resize(u),t.float32.fill(-1/0,4*o,4*u)}function Qd(c,t,o){const u=t[0],p=t[1];return c[0]=o[0]*u+o[4]*p+o[12],c[1]=o[1]*u+o[5]*p+o[13],c[3]=o[3]*u+o[7]*p+o[15],c}const la=100;class ni{constructor(t,o,u=new Fu(t.width+200,t.height+200,25),p=new Fu(t.width+200,t.height+200,25)){this.transform=t,this.grid=u,this.ignoredGrid=p,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+la,this.screenBottomBoundary=t.height+la,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=o}placeCollisionBox(t,o,u,p,g,y,b,T,C,I,B){let L=u.projectedAnchorX,N=u.projectedAnchorY,H=u.projectedAnchorZ;const j=u.tileAnchorX,q=u.tileAnchorY,W=u.elevation,ne=u.tileID,ie=t.getProjection();if(W&&ne){const[Be,Le,$e]=ie.upVector(ne.canonical,u.tileAnchorX,u.tileAnchorY),ot=ie.upVectorScale(ne.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;L+=Be*W*ot,N+=Le*W*ot,H+=$e*W*ot}const ee=t.projection.name==="globe",xe=t.projection.name==="globe"?a.aj(this.transform.zoom):0;if(ne&&ee&&xe<1&&!y){const Be=1<<ne.canonical.z,Le=a.bP(j,q);a.bQ(Le,Le,1/a.al),a.bR(Le,Le,a.bP(ne.canonical.x,ne.canonical.y)),a.bQ(Le,Le,1/Be),a.bS(Le,Le,a.bP(p[0],p[1])),Le[0]=a.bT(Le[0],-.5,.5),a.bQ(Le,Le,a.al);const $e=a.bU(Le[0],Le[1],a.al/(2*Math.PI),1);a.aC($e,$e,g),L=a.ak(L,$e[0],xe),N=a.ak(N,$e[1],xe),H=a.ak(H,$e[2],xe)}const me=this.projectAndGetPerspectiveRatio(I,L,N,H,u.tileID,ie.name==="globe"||!!W||this.transform.pitch>0,ie),ye=C*me.perspectiveRatio,de=(u.x1*o+b.x-u.padding)*ye+me.point.x,se=(u.y1*o+b.y-u.padding)*ye+me.point.y,Te=(u.x2*o+b.x+u.padding)*ye+me.point.x,Ae=(u.y2*o+b.y+u.padding)*ye+me.point.y,Re=me.perspectiveRatio<=.55||me.occluded;return!this.isInsideGrid(de,se,Te,Ae)||!T&&this.grid.hitTest(de,se,Te,Ae,B)||Re?{box:[],offscreen:!1,occluded:me.occluded}:{box:[de,se,Te,Ae],offscreen:this.isOffscreen(de,se,Te,Ae),occluded:!1}}placeCollisionCircles(t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q){const W=[],ne=this.transform.elevation,ie=t.getProjection(),ee=t.elevationType==="road",xe=!!ne||ee,me=a.bV.getAtTileOffsetFunc(q,this.transform.center.lat,this.transform.worldSize,ie),ye=new a.P(u.tileAnchorX,u.tileAnchorY),de=new a.P(u.tileAnchorX,u.tileAnchorY);let{x:se,y:Te,z:Ae}=ie.projectTilePoint(de.x,de.y,q.canonical),Re=null;if(xe){const Qt=ee?t.getElevationFeatureForText(p):null;Re={getElevation:me,elevation:ne,elevationFeature:Qt};const[Wt,Ft,Yt]=me(ye,ne,Qt);se+=Wt,Te+=Ft,Ae+=Yt}const Be=ie.name==="globe",Le=this.projectAndGetPerspectiveRatio(T,se,Te,Ae,q,Be||!!ne||this.transform.pitch>0,ie),{perspectiveRatio:$e}=Le,ot=(L?b/$e:b*$e)/a.bY,Fe=hs(se,Te,Ae,C),Se=u.lineOffsetX*ot,Ke=u.lineOffsetY*ot,Ve=a.an(t.layers[0].layout.get("text-max-angle")),it=Math.cos(Ve),Et=Le.signedDistanceFromCamera>0?hp(ot,y,Se,Ke,ee&&u.flipState===1,Fe,de,u,g,C,{},xe&&!L?Re:null,L&&xe,ie,q,L,it):null;let Bt=!1,Ct=!1,At=!0;if(Et&&!Le.occluded){const Qt=.5*H*$e+j,Wt=new a.P(-100,-100),Ft=new a.P(this.screenRightBoundary,this.screenBottomBoundary),Yt=new us,{first:oi,last:fi}=Et,Ri=oi.path.length;let Hi=[];for(let wi=Ri-1;wi>=1;wi--)Hi.push(oi.path[wi]);for(let wi=1;wi<fi.path.length;wi++)Hi.push(fi.path[wi]);const pi=2.5*Qt;I&&(Hi=Hi.map(([wi,an,tn],gn)=>(xe&&!Be&&(tn=me(gn<Ri-1?oi.tilePath[Ri-1-gn]:fi.tilePath[gn-Ri+2],ne,Re.elevationFeature)[2]),hs(wi,an,tn,I))),Hi.some(wi=>wi[3]<=0)&&(Hi=[]));let zi=[];if(Hi.length>0){let wi=1/0,an=-1/0,tn=1/0,gn=-1/0;for(const Yi of Hi)wi=Math.min(wi,Yi[0]),tn=Math.min(tn,Yi[1]),an=Math.max(an,Yi[0]),gn=Math.max(gn,Yi[1]);an>=Wt.x&&wi<=Ft.x&&gn>=Wt.y&&tn<=Ft.y&&(zi=[Hi.map(Yi=>new a.P(Yi[0],Yi[1]))],(wi<Wt.x||an>Ft.x||tn<Wt.y||gn>Ft.y)&&(zi=a.bW(zi,Wt.x,Wt.y,Ft.x,Ft.y)))}for(const wi of zi){Yt.reset(wi,.25*Qt);let an=0;an=Yt.length<=.5*Qt?1:Math.ceil(Yt.paddedLength/pi)+1;for(let tn=0;tn<an;tn++){const gn=tn/Math.max(an-1,1),Yi=Yt.lerp(gn),Di=Yi.x+la,rn=Yi.y+la;W.push(Di,rn,Qt,0);const Fn=Di-Qt,_n=rn-Qt,un=Di+Qt,Ci=rn+Qt;if(At=At&&this.isOffscreen(Fn,_n,un,Ci),Ct=Ct||this.isInsideGrid(Fn,_n,un,Ci),!o&&this.grid.hitTestCircle(Di,rn,Qt,N)&&(Bt=!0,!B))return{circles:[],offscreen:!1,collisionDetected:Bt,occluded:!1}}}}return{circles:!B&&Bt||!Ct?[]:W,offscreen:At,collisionDetected:Bt,occluded:Le.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,p=1/0,g=-1/0,y=-1/0;for(const I of t){const B=new a.P(I.x+la,I.y+la);u=Math.min(u,B.x),p=Math.min(p,B.y),g=Math.max(g,B.x),y=Math.max(y,B.y),o.push(B)}const b=this.grid.query(u,p,g,y).concat(this.ignoredGrid.query(u,p,g,y)),T={},C={};for(const I of b){const B=I.key;if(T[B.bucketInstanceId]===void 0&&(T[B.bucketInstanceId]={}),T[B.bucketInstanceId][B.featureIndex])continue;const L=[new a.P(I.x1,I.y1),new a.P(I.x2,I.y1),new a.P(I.x2,I.y2),new a.P(I.x1,I.y2)];a.bX(o,L)&&(T[B.bucketInstanceId][B.featureIndex]=!0,C[B.bucketInstanceId]===void 0&&(C[B.bucketInstanceId]=[]),C[B.bucketInstanceId].push(B.featureIndex))}return C}insertCollisionBox(t,o,u,p,g){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:g},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,u,p,g){const y=o?this.ignoredGrid:this.grid,b={bucketInstanceId:u,featureIndex:p,collisionGroupID:g};for(let T=0;T<t.length;T+=4)y.insertCircle(b,t[T],t[T+1],t[T+2])}projectAndGetPerspectiveRatio(t,o,u,p,g,y,b){const T=[o,u,p,1];let C=!1;p||this.transform.pitch>0?(a.aC(T,T,t),this.fogState&&g&&b.name!=="globe"&&(C=(function(L,N,H,j,q,W){const ne=W.calculateFogTileMatrix(q),ie=[N,H,j];return a.af(ie,ie,ne),ri(L,a.ag(ie),W.pitch,W._fov)})(this.fogState,o,u,p,g.toUnwrapped(),this.transform)>.9)):Qd(T,T,t);const I=T[3];return{point:new a.P((T[0]/I+1)/2*this.transform.width+la,(-T[1]/I+1)/2*this.transform.height+la),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(b)/I*.5,1.5),signedDistanceFromCamera:I,occluded:y&&T[2]>I||C}}isOffscreen(t,o,u,p){return u<la||t>=this.screenRightBoundary||p<la||o>this.screenBottomBoundary}isInsideGrid(t,o,u,p){return u>=0&&t<this.gridRightBoundary&&p>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const t=a.bA([]);return a.br(t,t,[-100,-100,0]),t}}class dn{constructor(t,o,u,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):p&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class cn{constructor(t,o,u,p,g,y=!1){this.text=new dn(t?t.text:null,o,u,g),this.icon=new dn(t?t.icon:null,o,p,g),this.clipped=y}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Qo{constructor(t,o,u,p=!1){this.text=t,this.icon=o,this.skipFade=u,this.clipped=p}}class Nu{constructor(){this.invProjMatrix=a.bC(),this.viewportMatrix=a.bC(),this.circles=[]}}class yn{constructor(t,o,u,p,g){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=p,this.tileID=g}}class Jd{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[t]}}function Uu(c,t,o,u,p){const{horizontalAlign:g,verticalAlign:y}=a.c1(c),b=-(g-.5)*t,T=-(y-.5)*o,C=a.c2(c,u);return new a.P(b+C[0]*p,T+C[1]*p)}function Gc(c,t,o,u,p){const g=new a.P(c,t);return o&&g._rotate(u?p:-p),g}class Uo{constructor(t,o,u,p,g,y){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new ni(this.transform,g),this.buildingIndex=y,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Jd(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,o,u,p,g=1){const y=u.getBucket(o),b=u.latestFeatureIndex;if(!y||!b||o.fqid!==y.layerIds[0])return;const T=y.layers[0].layout,C=y.layers[0].paint,I=u.collisionBoxArray,B=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),L=u.tileSize/a.al,N=u.tileID.toUnwrapped();this.transform.setProjection(y.projection);const H=(j=u.tileID,q=y.getProjection(),W=this.transform,q.name===this.projection?W.calculateProjMatrix(j.toUnwrapped()):ku(W,q,j));var j,q,W;const ne=T.get("text-pitch-alignment")==="map",ie=T.get("text-rotation-alignment")==="map";o.compileFilter(o.options);const ee=o.dynamicFilter(),xe=o.dynamicFilterNeedsFeature(),me=this.transform.calculatePixelsToTileUnitsMatrix(u),ye=Il(H,u.tileID.canonical,ne,ie,this.transform,y.getProjection(),me);let de=null;const se=y.getProjection().createInversionMatrix(this.transform,u.tileID.canonical);if(ne){const Se=No(H,u.tileID.canonical,ne,ie,this.transform,y.getProjection(),me);de=a.aB([],this.transform.labelPlaneMatrix,Se)}let Te=null;ee&&u.latestFeatureIndex&&(Te={unwrappedTileID:N,dynamicFilter:ee,dynamicFilterNeedsFeature:xe}),this.retainedQueryData[y.bucketInstanceId]=new yn(y.bucketInstanceId,b,y.sourceLayerIndex,y.index,u.tileID);const[Ae,Re]=y.layers[0].layout.get("text-size-scale-range"),Be=a.aA(g,Ae,Re),[Le,$e]=T.get("icon-size-scale-range"),ot=a.aA(g,Le,$e),Fe={bucket:y,layout:T,paint:C,posMatrix:H,invMatrix:se,mercatorCenter:[a.aF(this.transform.center.lng),a.aJ(this.transform.center.lat)],textLabelPlaneMatrix:ye,labelToScreenMatrix:de,clippingData:Te,scale:B,textPixelRatio:L,holdingForFade:u.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:a.bK(y.textSizeData,this.transform.zoom,Be),partiallyEvaluatedIconSize:a.bK(y.iconSizeData,this.transform.zoom,ot),collisionGroup:this.collisionGroups.get(y.sourceID),latestFeatureIndex:u.latestFeatureIndex};if(p)for(const Se of y.sortKeyRanges){const{sortKey:Ke,symbolInstanceStart:Ve,symbolInstanceEnd:it}=Se;t.push({sortKey:Ke,symbolInstanceStart:Ve,symbolInstanceEnd:it,parameters:Fe})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:Fe})}attemptAnchorPlacement(t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W,ne,ie,ee,xe){const{textOffset0:me,textOffset1:ye,crossTileID:de}=j,se=[me,ye],Te=Uu(t,y,b,se,T),Ae=this.collisionIndex.placeCollisionBox(W,T,o,u,p,g,Gc(Te.x,Te.y,C,I,this.transform.angle),H,B,L,N.predicate);if(ie){const Re=W.getSymbolInstanceIconSize(xe,this.transform.zoom,j.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(W,Re,ie,u,p,g,Gc(Te.x,Te.y,C,I,this.transform.angle),H,B,L,N.predicate).box.length===0)return}if(Ae.box.length>0){let Re;return this.prevPlacement&&this.prevPlacement.variableOffsets[de]&&this.prevPlacement.placements[de]&&this.prevPlacement.placements[de].text&&(Re=this.prevPlacement.variableOffsets[de].anchor),this.variableOffsets[de]={textOffset:se,width:y,height:b,anchor:t,textScale:T,prevAnchor:Re},this.markUsedJustification(W,t,j,ne),W.allowVerticalPlacement&&(this.markUsedOrientation(W,ne,j),this.placedOrientations[de]=ne),{shift:Te,placedGlyphBoxes:Ae}}}placeLayerBucketPart(t,o,u,p,g=1){const{bucket:y,layout:b,paint:T,posMatrix:C,textLabelPlaneMatrix:I,labelToScreenMatrix:B,clippingData:L,textPixelRatio:N,mercatorCenter:H,invMatrix:j,holdingForFade:q,collisionBoxArray:W,partiallyEvaluatedTextSize:ne,partiallyEvaluatedIconSize:ie,collisionGroup:ee,latestFeatureIndex:xe}=t.parameters,me=b.get("text-optional"),ye=b.get("icon-optional"),de=b.get("text-allow-overlap"),se=b.get("icon-allow-overlap"),Te=b.get("text-rotation-alignment")==="map",Ae=b.get("icon-rotation-alignment")==="map",Re=b.get("text-pitch-alignment")==="map",Be=T.get("symbol-z-offset"),Le=b.get("symbol-elevation-reference")==="sea",$e=b.get("symbol-placement"),[ot,Fe]=b.get("text-size-scale-range"),[Se,Ke]=b.get("icon-size-scale-range"),Ve=a.aA(g,ot,Fe),it=a.aA(g,Se,Ke),Et=b.get("text-variable-anchor"),Bt=Te&&$e!=="point",Ct=Ae&&$e!=="point",At=Et&&y.hasTextData(),Qt=y.hasIconTextFit()&&At&&y.hasIconData();this.transform.setProjection(y.projection);const Wt=At||Bt,Ft=Ct||Qt;let Yt=de&&(se||!y.hasIconData()||ye),oi=se&&(de||!y.hasTextData()||me);const fi=!Be.isConstant();!y.collisionArrays&&W&&y.deserializeCollisionBoxes(W),u&&p&&y.updateCollisionDebugBuffers(this.transform.zoom,W,Ve,it);const Ri=(pi,zi,wi)=>{const{crossTileID:an,numVerticalGlyphVertices:tn}=pi;let gn=null;if(L&&L.dynamicFilterNeedsFeature||fi){const Zn=this.retainedQueryData[y.bucketInstanceId];gn=xe.loadFeature({featureIndex:pi.featureIndex,bucketIndex:Zn.bucketIndex,sourceLayerIndex:Zn.sourceLayerIndex,layoutVertexArrayOffset:0});const yr=gn.properties?gn.properties.worldview:null;if(y.localizable&&y.worldview&&typeof yr=="string")if(yr==="all")gn.properties.$localized=!0;else{if(!yr.split(",").includes(y.worldview))return;gn.properties.$localized=!0,gn.properties.worldview=y.worldview}}if(L&&!(0,L.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:y.worldview},gn,this.retainedQueryData[y.bucketInstanceId].tileID.canonical,new a.P(pi.tileAnchorX,pi.tileAnchorY),this.transform.calculateDistanceTileData(L.unwrappedTileID)))return this.placements[an]=new Qo(!1,!1,!1,!0),void o.add(an);const Yi=Be.evaluate(gn,{});if(o.has(an))return;if(q)return void(this.placements[an]=new Qo(!1,!1,!1));let Di=!1,rn=!1,Fn=!0,_n=!1,un=!1,Ci=null,Pi={box:null,offscreen:null,occluded:null},Mn={box:null},Jn=null,xn=null,Cn=null,Ro=0,co=0,Zr=0;wi.textFeatureIndex?Ro=wi.textFeatureIndex:pi.useRuntimeCollisionCircles&&(Ro=pi.featureIndex),wi.verticalTextFeatureIndex&&(co=wi.verticalTextFeatureIndex);const hn=y.elevationFeatures?y.elevationFeatures[pi.elevationFeatureIndex]:void 0,ga=Zn=>{Zn.tileID=this.retainedQueryData[y.bucketInstanceId].tileID;const yr=this.transform.elevation;Zn.elevation=Le?Yi:Yi+a.bV.getAtTileOffset(Zn.tileID,new a.P(Zn.tileAnchorX,Zn.tileAnchorY),yr,hn),Zn.elevation+=pi.zOffset},uo=wi.textBox;if(uo){ga(uo);const Zn=Dn=>{let Sr=a.bL.horizontal;if(y.allowVerticalPlacement&&!Dn&&this.prevPlacement){const Vr=this.prevPlacement.placedOrientations[an];Vr&&(this.placedOrientations[an]=Vr,Sr=Vr,this.markUsedOrientation(y,Sr,pi))}return Sr},yr=(Dn,Sr)=>{if(y.allowVerticalPlacement&&tn>0&&wi.verticalTextBox){for(const Vr of y.writingModes)if(Vr===a.bL.vertical?(Pi=Sr(),Mn=Pi):Pi=Dn(),Pi&&Pi.box&&Pi.box.length)break}else Pi=Dn()};if(Et){let Dn=Et;if(this.prevPlacement&&this.prevPlacement.variableOffsets[an]){const Yn=this.prevPlacement.variableOffsets[an];Dn.indexOf(Yn.anchor)>0&&(Dn=Dn.filter(_a=>_a!==Yn.anchor),Dn.unshift(Yn.anchor))}const Sr=(Yn,_a,wh)=>{const Gs=y.getSymbolInstanceTextSize(ne,pi,this.transform.zoom,zi),vu=(Yn.x2-Yn.x1)*Gs+2*Yn.padding,bu=(Yn.y2-Yn.y1)*Gs+2*Yn.padding,ya=pi.hasIconTextFit&&!se?_a:null;ya&&ga(ya);let Xa={box:[],offscreen:!1,occluded:!1};const Hs=de?2*Dn.length:Dn.length;for(let La=0;La<Hs;++La){const Ln=this.attemptAnchorPlacement(Dn[La%Dn.length],Yn,H,j,Wt,vu,bu,Gs,Te,Re,N,C,ee,La>=Dn.length,pi,zi,y,wh,ya,ne,ie);if(Ln&&(Xa=Ln.placedGlyphBoxes,Xa&&Xa.box&&Xa.box.length)){Di=!0,Ci=Ln.shift;break}}return Xa};yr(()=>Sr(uo,wi.iconBox,a.bL.horizontal),()=>{const Yn=wi.verticalTextBox;return Yn&&ga(Yn),y.allowVerticalPlacement&&!(Pi&&Pi.box&&Pi.box.length)&&tn>0&&Yn?Sr(Yn,wi.verticalIconBox,a.bL.vertical):{box:null,offscreen:null,occluded:null}}),Pi&&(Di=Pi.box,Fn=Pi.offscreen,_n=Pi.occluded);const Vr=Zn(!(!Pi||!Pi.box));if(!Di&&this.prevPlacement){const Yn=this.prevPlacement.variableOffsets[an];Yn&&(this.variableOffsets[an]=Yn,this.markUsedJustification(y,Yn.anchor,pi,Vr))}}else{const Dn=(Sr,Vr)=>{const Yn=y.getSymbolInstanceTextSize(ne,pi,this.transform.zoom,zi),_a=this.collisionIndex.placeCollisionBox(y,Yn,Sr,H,j,Wt,new a.P(0,0),de,N,C,ee.predicate);return _a&&_a.box&&_a.box.length&&(this.markUsedOrientation(y,Vr,pi),this.placedOrientations[an]=Vr),_a};yr(()=>Dn(uo,a.bL.horizontal),()=>{const Sr=wi.verticalTextBox;return y.allowVerticalPlacement&&tn>0&&Sr?(ga(Sr),Dn(Sr,a.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Zn(!!(Pi&&Pi.box&&Pi.box.length))}}if(Jn=Pi,Di=Jn&&Jn.box&&Jn.box.length>0,Fn=Jn&&Jn.offscreen,_n=Jn&&Jn.occluded,pi.useRuntimeCollisionCircles){const Zn=pi.centerJustifiedTextSymbolIndex>=0?pi.centerJustifiedTextSymbolIndex:pi.verticalPlacedTextSymbolIndex,yr=y.text.placedSymbolArray.get(Zn),Dn=a.bM(y.textSizeData,ne,yr),Sr=b.get("text-padding");xn=this.collisionIndex.placeCollisionCircles(y,de,yr,Zn,y.lineVertexArray,y.glyphOffsetArray,Dn,C,I,B,u,Re,ee.predicate,pi.collisionCircleDiameter*Dn/a.bY,Sr,this.retainedQueryData[y.bucketInstanceId].tileID),Di=de||xn.circles.length>0&&!xn.collisionDetected,Fn=Fn&&xn.offscreen,_n=xn.occluded}if(wi.iconFeatureIndex&&(Zr=wi.iconFeatureIndex),wi.iconBox){const Zn=yr=>{ga(yr);const Dn=pi.hasIconTextFit&&Ci?Gc(Ci.x,Ci.y,Te,Re,this.transform.angle):new a.P(0,0),Sr=y.getSymbolInstanceIconSize(ie,this.transform.zoom,pi.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(y,Sr,yr,H,j,Ft,Dn,se,N,C,ee.predicate)};Mn&&Mn.box&&Mn.box.length&&wi.verticalIconBox?(Cn=Zn(wi.verticalIconBox),rn=Cn.box.length>0):(Cn=Zn(wi.iconBox),rn=Cn.box.length>0),Fn=Fn&&Cn.offscreen,un=Cn.occluded}const go=me||pi.numHorizontalGlyphVertices===0&&tn===0,Pa=ye||pi.numIconVertices===0;if(go||Pa?Pa?go||(rn=rn&&Di):Di=rn&&Di:rn=Di=rn&&Di,Di&&Jn&&Jn.box&&this.collisionIndex.insertCollisionBox(Jn.box,b.get("text-ignore-placement"),y.bucketInstanceId,Mn&&Mn.box&&co?co:Ro,ee.ID),rn&&Cn&&this.collisionIndex.insertCollisionBox(Cn.box,b.get("icon-ignore-placement"),y.bucketInstanceId,Zr,ee.ID),xn&&(Di&&this.collisionIndex.insertCollisionCircles(xn.circles,b.get("text-ignore-placement"),y.bucketInstanceId,Ro,ee.ID),u)){const Zn=y.bucketInstanceId;let yr=this.collisionCircleArrays[Zn];yr===void 0&&(yr=this.collisionCircleArrays[Zn]=new Nu);for(let Dn=0;Dn<xn.circles.length;Dn+=4)yr.circles.push(xn.circles[Dn+0]),yr.circles.push(xn.circles[Dn+1]),yr.circles.push(xn.circles[Dn+2]),yr.circles.push(xn.collisionDetected?1:0)}const na=y.projection.name!=="globe";Yt=Yt&&(na||!_n),oi=oi&&(na||!un),this.placements[an]=new Qo(Di||Yt,rn||oi,Fn||y.justReloaded),o.add(an)},Hi=this.retainedQueryData[y.bucketInstanceId].tileID;if(y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,Hi),y.elevationType==="road"&&y.updateRoadElevation(Hi.canonical),y.updateZOffset(),y.sortFeaturesByY){const pi=y.getSortedSymbolIndexes(this.transform.angle);for(let zi=pi.length-1;zi>=0;--zi){const wi=pi[zi];Ri(y.symbolInstances.get(wi),wi,y.collisionArrays[wi])}y.hasAnyZOffset&&a.w(`${y.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(y.hasAnyZOffset){const pi=y.getSortedIndexesByZOffset();for(let zi=0;zi<pi.length;++zi){const wi=pi[zi];Ri(y.symbolInstances.get(wi),wi,y.collisionArrays[wi])}}else for(let pi=t.symbolInstanceStart;pi<t.symbolInstanceEnd;pi++)Ri(y.symbolInstances.get(pi),pi,y.collisionArrays[pi]);if(u&&y.bucketInstanceId in this.collisionCircleArrays){const pi=this.collisionCircleArrays[y.bucketInstanceId];a.bl(pi.invProjMatrix,C),pi.viewportMatrix=this.collisionIndex.getViewportMatrix()}y.justReloaded=!1}markUsedJustification(t,o,u,p){const{leftJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:T,crossTileID:C}=u,I=a.c3(o),B=p===a.bL.vertical?T:I==="left"?g:I==="center"?y:I==="right"?b:-1;g>=0&&(t.text.placedSymbolArray.get(g).crossTileID=B>=0&&g!==B?0:C),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=B>=0&&y!==B?0:C),b>=0&&(t.text.placedSymbolArray.get(b).crossTileID=B>=0&&b!==B?0:C),T>=0&&(t.text.placedSymbolArray.get(T).crossTileID=B>=0&&T!==B?0:C)}markUsedOrientation(t,o,u){const p=o===a.bL.horizontal||o===a.bL.horizontalOnly?o:0,g=o===a.bL.vertical?o:0,{leftJustifiedTextSymbolIndex:y,centerJustifiedTextSymbolIndex:b,rightJustifiedTextSymbolIndex:T,verticalPlacedTextSymbolIndex:C}=u,I=t.text.placedSymbolArray;y>=0&&(I.get(y).placedOrientation=p),b>=0&&(I.get(b).placedOrientation=p),T>=0&&(I.get(T).placedOrientation=p),C>=0&&(I.get(C).placedOrientation=g)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const p=o?o.symbolFadeChange(t):1,g=o?o.opacities:{},y=o?o.variableOffsets:{},b=o?o.placedOrientations:{};for(const T in this.placements){const C=this.placements[T],I=g[T];I?(this.opacities[T]=new cn(I,p,C.text,C.icon,null,C.clipped),u=u||C.text!==I.text.placed||C.icon!==I.icon.placed):(this.opacities[T]=new cn(null,p,C.text,C.icon,C.skipFade,C.clipped),u=u||C.text||C.icon)}for(const T in g){const C=g[T];if(!this.opacities[T]){const I=new cn(C,p,!1,!1);I.isHidden()||(this.opacities[T]=I,u=u||C.text.placed||C.icon.placed)}}for(const T in y)this.variableOffsets[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.variableOffsets[T]=y[T]);for(const T in b)this.placedOrientations[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.placedOrientations[T]=b[T]);u?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o,u,p){p&&(this.lastReplacementSourceUpdateTime=p.updateTime);const g=new Set;for(const y of o){const b=y.getBucket(t);b&&y.latestFeatureIndex&&t.fqid===b.layerIds[0]&&(this.updateBucketOpacities(b,g,y,y.collisionBoxArray,u,p,y.tileID,t.scope),b.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(b,y.tileID),b.elevationType==="road"&&b.updateRoadElevation(y.tileID.canonical),b.updateZOffset())}}updateBucketOpacities(t,o,u,p,g,y,b,T){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const C=t.layers[0].layout,I=t.layers[0].paint,B=!!t.layers[0].dynamicFilter(),L=new cn(null,0,!1,!1,!0),N=C.get("text-allow-overlap"),H=C.get("icon-allow-overlap"),j=C.get("text-variable-anchor"),q=C.get("text-rotation-alignment")==="map",W=C.get("text-pitch-alignment")==="map",ne=I.get("symbol-z-offset"),ie=C.get("symbol-elevation-reference")==="sea",ee=!ne.isConstant(),xe=new cn(null,0,N&&(H||!t.hasIconData()||C.get("icon-optional")),H&&(N||!t.hasTextData()||C.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);const me=(de,se,Te)=>{for(let Ae=0;Ae<se/4;Ae++)de.opacityVertexArray.emplaceBack(Te)};let ye=0;y&&t.updateReplacement(b,y);for(let de=0;de<t.symbolInstances.length;de++){const se=t.symbolInstances.get(de),{numHorizontalGlyphVertices:Te,numVerticalGlyphVertices:Ae,crossTileID:Re,numIconVertices:Be,tileAnchorX:Le,tileAnchorY:$e}=se;let ot=null;const Fe=this.retainedQueryData[t.bucketInstanceId];ee&&se&&Fe&&(ot=u.latestFeatureIndex.loadFeature({featureIndex:se.featureIndex,bucketIndex:Fe.bucketIndex,sourceLayerIndex:Fe.sourceLayerIndex,layoutVertexArrayOffset:0}));const Se=ne.evaluate(ot,{}),Ke=o.has(Re);let Ve=this.opacities[Re];Ke?Ve=L:Ve||(Ve=xe,this.opacities[Re]=Ve),o.add(Re);const it=Te>0||Ae>0,Et=Be>0,Bt=this.placedOrientations[Re],Ct=Bt===a.bL.vertical,At=Bt===a.bL.horizontal||Bt===a.bL.horizontalOnly;!it&&!Et||Ve.isHidden()||ye++;let Qt=!1;if((it||Et)&&y)for(const Wt of t.activeReplacements){if(a.bZ(Wt,g,a.b_.Symbol,T)||Wt.min.x>Le||Le>Wt.max.x||Wt.min.y>$e||$e>Wt.max.y)continue;const Ft=a.b$(Le,$e,b.canonical,Wt.footprintTileId.canonical);if(Qt=a.c0(Ft,Wt.footprint),Qt)break}if(it){const Wt=Qt?so:Mo(Ve.text);me(t.text,Te,Ct?so:Wt),me(t.text,Ae,At?so:Wt);const Ft=Ve.text.isHidden(),{leftJustifiedTextSymbolIndex:Yt,centerJustifiedTextSymbolIndex:oi,rightJustifiedTextSymbolIndex:fi,verticalPlacedTextSymbolIndex:Ri}=se,Hi=t.text.placedSymbolArray,pi=Ft||Ct?1:0;Yt>=0&&(Hi.get(Yt).hidden=pi),oi>=0&&(Hi.get(oi).hidden=pi),fi>=0&&(Hi.get(fi).hidden=pi),Ri>=0&&(Hi.get(Ri).hidden=Ft||At?1:0);const zi=this.variableOffsets[Re];zi&&this.markUsedJustification(t,zi.anchor,se,Bt);const wi=this.placedOrientations[Re];wi&&(this.markUsedJustification(t,"left",se,wi),this.markUsedOrientation(t,wi,se))}if(Et){const Wt=Qt?so:Mo(Ve.icon),{placedIconSymbolIndex:Ft,verticalPlacedIconSymbolIndex:Yt}=se,oi=t.icon.placedSymbolArray,fi=Ve.icon.isHidden()?1:0;Ft>=0&&(me(t.icon,Be,Ct?so:Wt),oi.get(Ft).hidden=fi),Yt>=0&&(me(t.icon,se.numVerticalIconVertices,At?so:Wt),oi.get(Yt).hidden=fi)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Wt=t.collisionArrays[de];if(Wt){let Ft=new a.P(0,0),Yt=!0;if(Wt.textBox||Wt.verticalTextBox){if(j){const fi=this.variableOffsets[Re];fi?(Ft=Uu(fi.anchor,fi.width,fi.height,fi.textOffset,fi.textScale),q&&Ft._rotate(W?this.transform.angle:-this.transform.angle)):Yt=!1}B&&(Yt=!Ve.clipped),Wt.textBox&&vr(t.textCollisionBox.collisionVertexArray,Ve.text.placed,!Yt||Ct,Se,ie,Ft.x,Ft.y),Wt.verticalTextBox&&vr(t.textCollisionBox.collisionVertexArray,Ve.text.placed,!Yt||At,Se,ie,Ft.x,Ft.y)}const oi=Yt&&!!(!At&&Wt.verticalIconBox);Wt.iconBox&&vr(t.iconCollisionBox.collisionVertexArray,Ve.icon.placed,oi,Se,ie,se.hasIconTextFit?Ft.x:0,se.hasIconTextFit?Ft.y:0),Wt.verticalIconBox&&vr(t.iconCollisionBox.collisionVertexArray,Ve.icon.placed,!oi,Se,ie,se.hasIconTextFit?Ft.x:0,se.hasIconTextFit?Ft.y:0)}}}if(t.fullyClipped=ye===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const de=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=de.invProjMatrix,t.placementViewportMatrix=de.viewportMatrix,t.collisionCircleArray=de.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,o){const u=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*u>t}isStale(){return this.stale}setStale(){this.stale=!0}}function vr(c,t,o,u,p,g,y){c.emplaceBack(t?1:0,o?1:0,g||0,y||0,u,p?1:0),c.emplaceBack(t?1:0,o?1:0,g||0,y||0,u,p?1:0),c.emplaceBack(t?1:0,o?1:0,g||0,y||0,u,p?1:0),c.emplaceBack(t?1:0,o?1:0,g||0,y||0,u,p?1:0)}const pp=Math.pow(2,25),Rl=Math.pow(2,24),mp=Math.pow(2,17),Vu=Math.pow(2,16),Zh=Math.pow(2,9),ef=Math.pow(2,8),$h=Math.pow(2,1);function Mo(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;const t=c.placed?1:0,o=Math.floor(127*c.opacity);return o*pp+t*Rl+o*mp+t*Vu+o*Zh+t*ef+o*$h+t}const so=0;class ca{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,o,u,p,g,y){const b=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(b,p,t[this._currentTileIndex],this._sortAcrossTiles,y),this._currentTileIndex++,g())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,b.sort((T,C)=>T.sortKey-C.sortKey));this._currentPartIndex<b.length;){const T=b[this._currentPartIndex];if(o.placeLayerBucketPart(T,this._seenCrossTileIDs,u,T.symbolInstanceStart===0,y),this._currentPartIndex++,g())return!0}return!1}}class gp{startNewPlacement(t,o,u,p,g,y,b,T){return this.placement=new Uo(t,p,g,y,b,T),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=u,this._fadeDuration=p,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(t,o,u,p,g){const y=a.o.now(),b=()=>{const T=a.o.now()-y;return!this.isFullPlacementRequested()&&this._fadeDuration!==0&&T>2};for(;this._currentPlacementIndex>=0;){const T=o[t[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(T.type==="symbol"&&T.visibility!=="none"&&(!T.minzoom||T.minzoom<=C)&&(!T.maxzoom||T.maxzoom>C)){const I=T,B=I.layout.get("symbol-z-elevate"),L=I.layout.get("symbol-sort-key").constantOr(1)!==void 0,N=I.layout.get("symbol-z-order"),H=N==="viewport-y"||N==="auto"&&!(N!=="viewport-y"&&L),j=I.layout.get("text-allow-overlap")||I.layout.get("icon-allow-overlap")||I.layout.get("text-ignore-placement")||I.layout.get("icon-ignore-placement"),q=H&&j,W=this._inProgressLayer=this._inProgressLayer||new ca(I),ne=a.B(T.source,T.scope);if(W.continuePlacement(B||q?p[ne]:u[ne],this.placement,this._showCollisionBoxes,T,b,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const cc=512/a.al/2;class Ur{constructor(t,o,u){this.tileID=t,this.bucketInstanceId=u,this.index=new a.c4(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const p=t.canonical.x*a.al,g=t.canonical.y*a.al;for(let y=0;y<o.length;y++){const{key:b,crossTileID:T,tileAnchorX:C,tileAnchorY:I}=o.get(y),B=Math.floor((p+C)*cc),L=Math.floor((g+I)*cc);this.index.add(B,L),this.keys.push(b),this.crossTileIDs.push(T)}this.index.finish()}findMatches(t,o,u){const p=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),g=cc/Math.pow(2,o.canonical.z-this.tileID.canonical.z),y=o.canonical.x*a.al,b=o.canonical.y*a.al;for(let T=0;T<t.length;T++){const C=t.get(T);if(C.crossTileID)continue;const{key:I,tileAnchorX:B,tileAnchorY:L}=C,N=Math.floor((y+B)*g),H=Math.floor((b+L)*g),j=this.index.range(N-p,H-p,N+p,H+p).sort((q,W)=>q-W);for(const q of j){const W=this.crossTileIDs[q];if(this.keys[q]===I&&!u.has(W)){u.add(W),C.crossTileID=W;break}}}}}class As{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ua{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const u in this.indexes){const p=this.indexes[u],g={};for(const y in p){const b=p[y];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+o),g[b.tileID.key]=b}this.indexes[u]=g}this.lng=t}addBucket(t,o,u){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let g=0;g<o.symbolInstances.length;g++)o.symbolInstances.get(g).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const p=this.usedCrossTileIDs[t.overscaledZ];for(const g in this.indexes){const y=this.indexes[g];if(Number(g)>t.overscaledZ)for(const b in y){const T=y[b];T.tileID.isChildOf(t)&&T.findMatches(o.symbolInstances,t,p)}else{const b=y[t.scaledTo(Number(g)).key];b&&b.findMatches(o.symbolInstances,t,p)}}for(let g=0;g<o.symbolInstances.length;g++){const y=o.symbolInstances.get(g);y.crossTileID||(y.crossTileID=u.generate(),p.add(y.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ur(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(const u of o.crossTileIDs)this.usedCrossTileIDs[t].delete(u)}removeStaleBuckets(t){let o=!1;for(const u in this.indexes){const p=this.indexes[u];for(const g in p)t[p[g].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,p[g]),delete p[g],o=!0)}return o}}class br{constructor(){this.layerIndexes={},this.crossTileIDs=new As,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,u,p){let g=this.layerIndexes[t.fqid];g===void 0&&(g=this.layerIndexes[t.fqid]=new Ua);let y=!1;const b={};p.name!=="globe"&&g.handleWrapJump(u);for(const T of o){const C=T.getBucket(t);C&&t.fqid===C.layerIds[0]&&(C.bucketInstanceId||(C.bucketInstanceId=++this.maxBucketInstanceId),g.addBucket(T.tileID,C,this.crossTileIDs)&&(y=!0),b[C.bucketInstanceId]=!0)}return g.removeStaleBuckets(b)&&(y=!0),y}pruneUnusedLayers(t){const o={};t.forEach(u=>{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}const uc=771;class bi{constructor(t,o,u,p){this.blendFunction=t,this.blendColor=o.toNonPremultipliedRenderColor(null),this.mask=u,this.blendEquation=p}}bi.Replace=[1,0,1,0],bi.disabled=new bi(bi.Replace,a.ao.transparent,[!1,!1,!1,!1]),bi.unblended=new bi(bi.Replace,a.ao.transparent,[!0,!0,!0,!0]),bi.alphaBlended=new bi([1,uc,1,uc],a.ao.transparent,[!0,!0,!0,!0]),bi.alphaBlendedNonPremultiplied=new bi([770,uc,770,uc],a.ao.transparent,[!0,!0,!0,!0]),bi.multiply=new bi([774,0,774,0],a.ao.transparent,[!0,!0,!0,!0]),bi.additive=new bi([1,1,1,1],a.ao.transparent,[!0,!0,!0,!0]);class ti{constructor(t,o,u){this.func=t,this.mask=o,this.range=u}}ti.ReadOnly=!1,ti.ReadWrite=!0,ti.disabled=new ti(519,ti.ReadOnly,[0,1]);const Hc=7680;class yi{constructor(t,o,u,p,g,y){this.test=t,this.ref=o,this.mask=u,this.fail=p,this.depthFail=g,this.pass=y}}yi.disabled=new yi({func:519,mask:0},0,0,Hc,Hc,Hc);const ju=1029,Gu=2305;class di{constructor(t,o,u){this.enable=t,this.mode=o,this.frontFace=u}}function tf(c,t){const o=a.ca(c,3);a.cc(c,t),a.cg(c,3,o)}function _p(c,t){const o=a.c7([]);return a.c8(o,o,-t),a.c9(o,o,-c),o}
vendor: 4,910 bytes, line 219
219function tl(c,t){const o=[c[0],c[1],0],u=[t[0],t[1],0];if(a.ag(o)>=1e-15){const y=a.aw([],o);a.c5(u,y,a.bJ(u,y)),t[0]=u[0],t[1]=u[1]}const p=a.bI([],t,c);if(a.c6(p)<1e-15)return null;const g=Math.atan2(-p[1],p[0]);return _p(Math.atan2(Math.sqrt(c[0]*c[0]+c[1]*c[1]),-c[2]),g)}di.disabled=new di(!1,ju,Gu),di.backCCW=new di(!0,ju,Gu),di.backCW=new di(!0,ju,2304),di.frontCW=new di(!0,1028,2304),di.frontCCW=new di(!0,1028,Gu);class Im{constructor(t,o){this.position=t,this.orientation=o}get position(){return this._position}set position(t){if(t){const o=t instanceof a.ae?t:new a.ae(t[0],t[1],t[2]);this._renderWorldCopies&&(o.x=a.bT(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(t,o,u){if(this.orientation=null,!this.position)return;const p=this.position,g=u||(this._elevation?this._elevation.getAtPointOrZero(a.ae.fromLngLat(t)):0),y=a.ae.fromLngLat(t,g),b=[y.x-p.x,y.y-p.y,y.z-p.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=tl(b,o)}setPitchBearing(t,o){this.orientation=_p(a.an(t),a.an(-o))}}class Hu{constructor(t,o){this._transform=a.bA([]),this.orientation=o,this.position=t}get mercatorPosition(){const t=this.position;return new a.ae(t[0],t[1],t[2])}get position(){const t=a.ca(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var o;t&&a.cg(this._transform,3,[(o=t)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||a.c7([]),t&&tf(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,o){this._orientation=_p(t,o),tf(this._transform,this._orientation)}forward(){const t=a.ca(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=a.ca(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=a.ca(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,o){const u=new Float64Array(16);return a.bl(u,this.getWorldToCamera(t,o)),u}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,o,u){const p=this.position;a.c5(p,p,-t);const g=new Float64Array(16);return a.bq(g,[u,u,u]),a.br(g,g,p),g[10]*=o,g}getWorldToCamera(t,o){const u=new Float64Array(16),p=new Float64Array(4),g=this.position;return a.cb(p,this._orientation),a.c5(g,g,-t),a.cc(u,p),a.br(u,u,g),u[1]*=-1,u[5]*=-1,u[9]*=-1,u[13]*=-1,u[8]*=o,u[9]*=o,u[10]*=o,u[11]*=o,u}getCameraToClipPerspective(t,o,u,p){const g=new Float64Array(16);return a.cd(g,t,o,u,p),g}getCameraToClipOrthographic(t,o,u,p,g,y){const b=new Float64Array(16);return a.ce(b,t,o,u,p,g,y),b}getDistanceToElevation(t,o=!1){const u=t===0?0:a.cf(t,o?a.a$(this.position[1]):this.position[1]),p=this.forward();return(u-this.position[2])/p[2]}clone(){return new Hu([...this.position],[...this.orientation])}}const ua=(c,t)=>({u_matrix:c,u_ground_shadow_factor:t});class ha{constructor(t=0,o=0,u=0,p=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(u)||u<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=u,this.right=p}interpolate(t,o,u){return o.top!=null&&t.top!=null&&(this.top=a.ak(t.top,o.top,u)),o.bottom!=null&&t.bottom!=null&&(this.bottom=a.ak(t.bottom,o.bottom,u)),o.left!=null&&t.left!=null&&(this.left=a.ak(t.left,o.left,u)),o.right!=null&&t.right!=null&&(this.right=a.ak(t.right,o.right,u)),this}getCenter(t,o){const u=a.aA((this.left+t-this.right)/2,0,t),p=a.aA((this.top+o-this.bottom)/2,0,o);return new a.P(u,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ha(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Aa=15;class Xh{constructor(t,o,u,p,g,y,b){this.tileSize=512,this._renderWorldCopies=g===void 0||g,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=u??0,this._maxPitch=p??60,this.setProjection(y),this.setMaxBounds(b),this.width=0,this.height=0,this._center=new a.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ha,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Hu,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new Xh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 25,486 bytes, line 219
219xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Aa}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,o=!1){const u=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||u)&&this._updateCameraOnTerrain(),(t||u)&&this._constrainCamera(o),this._calcMatrices()}getProjection(){return a.aH(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=a.cm(this.projectionOptions);const u=this.getProjection(),p=!a.by(o,u);return p&&this._calcMatrices(),this.mercatorFromTransition=!1,p}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=a.cm({name:"mercator"});const o=t!==this.projection.name;return o&&this._calcMatrices(),o}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return a.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return a.bT(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const o=-t*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=a.cn(),a.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=a.aA(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=a.an(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,o=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!o||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const u=this._elevation;o||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&u.exaggeration()&&this._centerAltitudeValidForExaggeration!==u.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*u.exaggeration(),this._centerAltitudeValidForExaggeration=u.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=u.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],u=this.horizonLineFromTop();let p=0,g=0;for(let y=0;y<o.length;y++){const b=new a.P(o[y][0]*this.width,u+o[y][1]*(this.height-u)),T=t.pointCoordinate(b);if(!T)continue;const C=1/Math.hypot(T[0]-this._camera.position[0],T[1]-this._camera.position[1]);p+=T[3]*C,g+=C}return g===0?NaN:p/g}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),u=this.pixelsPerMeter/this.worldSize*o,p=this._mercatorZfromZoom(t),g=this._mercatorZfromZoom(this._maxZoom),y=Math.max(p-u,g);this._setZoom(this._zoomFromMercatorZ(y))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}equals(t){const o=this.elevation,u=t.elevation,p=o!=null!=(u!=null)||o&&u&&o.exaggeration()!==u.exaggeration();return this.width===t.width&&this.height===t.height&&this.center.lng===t.center.lng&&this.center.lat===t.center.lat&&this.zoom===t.zoom&&this.bearing===t.bearing&&this.pitch===t.pitch&&this.fov===t.fov&&this.projection.name===t.projection.name&&this._edgeInsets.equals(t.padding)&&!p}computeZoomRelativeTo(t){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let u;u=t.z<this._camera.position[2]?[o.x,o.y,o.z]:[t.x,t.y,t.z];const p=a.ag(a.av([],this._camera.position,u));return a.aA(this._zoomFromMercatorZ(p),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let o=!1;if(t.orientation&&!a.cp(t.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(t.orientation)),t.position){const u=[t.position.x,t.position.y,t.position.z];a.cq(u,this._camera.position)||(this._setCameraPosition(u),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,o=new Im;return o.position=new a.ae(t[0],t[1],t[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(t){if(!a.cr(t))return!1;a.cs(t,t);const o=a.ct([],[0,0,-1],t),u=a.ct([],[0,-1,0],t);if(u[2]<0)return!1;const p=tl(o,u);return!!p&&(this._camera.orientation=p,!0)}_setCameraPosition(t){const o=this.zoomScale(this.minZoom)*this.tileSize,u=this.zoomScale(this.maxZoom)*this.tileSize,p=this.cameraToCenterDistance;t[2]=a.aA(t[2],p/u,p/o),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,u){this._unmodified=!1,this._edgeInsets.interpolate(t,o,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new a.cu(0,t)];if(this.renderWorldCopies){const u=this.pointCoordinate(new a.P(0,0)),p=this.pointCoordinate(new a.P(this.width,0)),g=this.pointCoordinate(new a.P(this.width,this.height)),y=this.pointCoordinate(new a.P(0,this.height)),b=Math.floor(Math.min(u.x,p.x,g.x,y.x)),T=Math.floor(Math.max(u.x,p.x,g.x,y.x)),C=1;for(let I=b-C;I<=T+C;I++)I!==0&&o.push(new a.cu(I,t))}return o}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,o,u,p){let g=[];const y=u!=null,b=!y;if(b&&this.zoom<o||y&&u[0]===0&&u[1]===0)return g;const T=new Set,C=(B,L,N,H,j)=>{const q=a.cY(L,B,N,H,j);T.has(q)||(g.push(new a.aQ(B,L,N,H,j)),T.add(q))};for(let B=0;B<t.length;B++){const L=t[B];if(b&&L.canonical.z!==o||y&&p!==void 0&&p>L.canonical.z)continue;const N=L.canonical,H=L.overscaledZ,j=L.wrap,q=1<<N.z,W=N.x+1<q,ne=N.x>0,ie=N.y+1<q,ee=N.y>0,xe=L.wrap-(ne?0:1),me=L.wrap+(W?0:1),ye=ne?N.x-1:q-1,de=W?N.x+1:0;if(y)u[0]<0?(C(H,me,N.z,de,N.y),u[1]<0&&ie&&(C(H,j,N.z,N.x,N.y+1),C(H,me,N.z,de,N.y+1)),u[1]>0&&ee&&(C(H,j,N.z,N.x,N.y-1),C(H,me,N.z,de,N.y-1))):u[0]>0?(C(H,xe,N.z,ye,N.y),u[1]<0&&ie&&(C(H,j,N.z,N.x,N.y+1),C(H,xe,N.z,ye,N.y+1)),u[1]>0&&ee&&(C(H,j,N.z,N.x,N.y-1),C(H,xe,N.z,ye,N.y-1))):u[1]<0&&ie?C(H,j,N.z,N.x,N.y+1):ee&&C(H,j,N.z,N.x,N.y-1);else{const se=L.visibleQuadrants;1&se&&(C(H,xe,N.z,ye,N.y),ee&&(C(H,j,N.z,N.x,N.y-1),C(H,xe,N.z,ye,N.y-1))),2&se&&(C(H,me,N.z,de,N.y),ee&&(C(H,j,N.z,N.x,N.y-1),C(H,me,N.z,de,N.y-1))),4&se&&(C(H,xe,N.z,ye,N.y),ie&&(C(H,j,N.z,N.x,N.y+1),C(H,xe,N.z,ye,N.y+1))),8&se&&(C(H,me,N.z,de,N.y),ie&&(C(H,j,N.z,N.x,N.y+1),C(H,me,N.z,de,N.y+1)))}}const I=[];for(const B of g)g.some(L=>B.isChildOf(L))||I.push(B);if(g=I.filter(B=>!t.some(L=>!!(B.overscaledZ<o&&L.isChildOf(B))||B.equals(L)||B.isChildOf(L))),b){const B=1<<o,L=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),N=[B*L.x,B*L.y],H=4,j=H*H;g=g.filter(q=>{const W=q.canonical.x+.5-N[0],ne=q.canonical.y+.5-N[1];return W*W+ne*ne<j})}return g}extendTileCoverToNearPlane(t,o,u){const p=[],g=new Set;for(const ne of t)g.add(ne.key);const y=(ne,ie,ee,xe,me)=>{const ye=a.cY(ie,ne,ee,xe,me);g.has(ye)||(p.push(new a.aQ(ne,ie,ee,xe,me)),g.add(ye))},b=t.reduce((ne,ie)=>Math.max(ne,ie.overscaledZ),u),T=1<<u,C=[new a.P(0,0),new a.P(a.al,0),new a.P(a.al,a.al),new a.P(0,a.al)],I=new a.P(0,0),B=new a.P(0,0),L=(ne,ie)=>{const ee=Math.floor(ne[0]),xe=Math.floor(ne[1]),me=(ne[0]-ee)*a.al,ye=(ne[1]-xe)*a.al,de=Math.floor(ie[0]),se=Math.floor(ie[1]),Te=(ie[0]-de)*a.al,Ae=(ie[1]-se)*a.al;for(let Re=-1;Re<=1;Re++){const Be=ee+Re;if(!(Be<0||Be>=T)){I.x=me-Re*a.al,B.x=Te-(Be-de)*a.al;for(let Le=-1;Le<=1;Le++){const $e=xe+Le;I.y=ye-Le*a.al,B.y=Ae-($e-se)*a.al,a.cZ(I,B,C)&&y(b,0,u,Be,$e)}}}},N=o.points,H=N[a.cv],j=N[a.cw],q=this._projectToGround(H,N[a.cx]),W=this._projectToGround(j,N[a.cy]);return L(H,q),L(j,W),p}_projectToGround(t,o){return a.cz(a.cA(),t,o,t[2]/(t[2]-o[2]))}coveringTiles(t){let o=this.coveringZoomLevel(t);const u=o,p=this.elevation&&this.elevation.exaggeration(),g=p&&!t.isTerrainDEM,y=this.projection.name==="mercator";if(t.minzoom!==void 0&&o<t.minzoom)return[];t.maxzoom!==void 0&&o>t.maxzoom&&(o=t.maxzoom);const b=this.locationCoordinate(this.center),T=this.center.lat,C=1<<o,I=[C*b.x,C*b.y,0],B=this.projection.name==="globe",L=!B,N=a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,L),H=B?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),j=C*a.cf(1,this.center.lat),q=this._camera.position[2]/a.cf(1,this.center.lat),W=[C*H.x,C*H.y,q*(L?1:j)],ne=B||p,ie=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),ee=this.isLODDisabled(!0)?o:0;let xe;if(this._elevation&&t.isTerrainDEM)xe=1e4*this._elevation.exaggeration();else if(this._elevation){const Se=this._elevation.getMinMaxForVisibleTiles();xe=Se?Se.max:this._centerAltitude}else xe=this._centerAltitude;const me=t.isTerrainDEM?-xe:this._elevation?this._elevation.getMinElevationBelowMSL():0,ye=this.projection.isReprojectedInTileSpace?a.cC(this):1,de=Se=>{const Ve=new a.ae(Se.x+25e-6,Se.y,Se.z),it=new a.ae(Se.x,Se.y+25e-6,Se.z),Et=Se.toLngLat(),Bt=Ve.toLngLat(),Ct=it.toLngLat(),At=this.locationCoordinate(Et),Qt=this.locationCoordinate(Bt),Wt=this.locationCoordinate(Ct),Ft=Math.hypot(Qt.x-At.x,Qt.y-At.y),Yt=Math.hypot(Wt.x-At.x,Wt.y-At.y);return Math.sqrt(Ft*Yt)*ye/25e-6},se=Se=>{const Ke=xe,Ve=me;return{aabb:a.cF(this,C,0,0,0,Se,Ve,Ke,this.projection),zoom:0,x:0,y:0,minZ:Ve,maxZ:Ke,wrap:Se,fullyVisible:!1}},Te=[];let Ae=[];const Re=o,Be=t.reparseOverscaled?u:o,Le=(q-this._centerAltitude)*j,$e=Se=>{if(!this._elevation||!Se.tileID||!y)return;const Ke=this._elevation.getMinMaxForTile(Se.tileID),Ve=Se.aabb;Ke?(Ve.min[2]=Ke.min,Ve.max[2]=Ke.max,Ve.center[2]=(Ve.min[2]+Ve.max[2])/2):(Se.shouldSplit=Fe(Se),Se.shouldSplit||(Ve.min[2]=Ve.max[2]=Ve.center[2]=this._centerAltitude))},ot=(Se,Ke)=>{if(.707*Ke<Se)return 1;const Ve=Ke/Se;return Ve/(1.4144271570014144+(Math.pow(1.1,Ve-1.4144271570014144+1)-1)/(1.1-1)-1)},Fe=Se=>{if(Se.zoom<ee)return!0;if(Se.zoom===Re)return!1;if(Se.shouldSplit!=null)return Se.shouldSplit;const Ke=Se.aabb.distanceX(W),Ve=Se.aabb.distanceY(W);let it=Le,Et=1;if(B){it=Se.aabb.distanceZ(W);const Yt=Math.pow(2,Se.zoom),oi=a.a$((Se.y+1)/Yt),fi=a.a$(Se.y/Yt),Ri=Math.min(Math.max(T,oi),fi),Hi=a.d1(Ri)/a.d1(T);if(Et=Ri===T?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Hi/this._mercatorScaleRatio),this.zoom<=a.c_&&Se.zoom===Re-1&&Hi>=.9)return!0}else if(g&&(it=Se.aabb.distanceZ(W)*j),this.projection.isReprojectedInTileSpace&&u<=5){const Yt=Math.pow(2,Se.zoom),oi=de(new a.ae((Se.x+.5)/Yt,(Se.y+.5)/Yt));Et=oi>.85?1:oi}if(!y&&!B){const Yt=Math.sqrt(Ke*Ke+Ve*Ve+it*it);let oi=(1<<Re-Se.zoom)*ie*Et;return oi*=ot(Math.max(it,Le),Yt),Yt<oi}let Bt=Number.MAX_VALUE,Ct=0;const At=Se.aabb.getCorners(),Qt=[];for(const Yt of At){a.av(Qt,Yt,W),B||(g?Qt[2]*=j:Qt[2]=Le);const oi=a.bJ(Qt,this._camera.forward());oi<Bt&&(Bt=oi,Ct=Math.abs(Qt[2]))}let Wt=(1<<Re-Se.zoom)*ie*Et;if(Wt*=ot(Math.max(Ct,Le),Bt),Bt<Wt)return!0;const Ft=Se.aabb.closestPoint(I);return Ft[0]===I[0]&&Ft[1]===I[1]};if(this.renderWorldCopies)for(let Se=1;Se<=3;Se++)Te.push(se(-Se)),Te.push(se(Se));for(Te.push(se(0));Te.length>0;){const Se=Te.pop(),Ke=Se.x,Ve=Se.y;let it=Se.fullyVisible;const Et=()=>this.projection.name==="globe"&&(Se.y===0||Se.y===(1<<Se.zoom)-1);if(!it){let Bt=ne?Se.aabb.intersects(N):Se.aabb.intersectsFlat(N);if(Bt===0&&Et()){const Ct=new a.cD(Se.zoom,Ke,Ve);Bt=a.cE(this,C,Ct,!0).intersects(N)}if(Bt===0)continue;it=Bt===2}if(Se.zoom===Re||!Fe(Se)){const Bt=Se.zoom===Re?Be:Se.zoom;if(t.minzoom&&t.minzoom>Bt)continue;let Ct=0;if(!it){let Ft=ne?Se.aabb.intersectsPrecise(N):Se.aabb.intersectsPreciseFlat(N);if(Ft===0&&Et()){const Yt=new a.cD(Se.zoom,Ke,Ve);Ft=a.cE(this,C,Yt,!0).intersectsPrecise(N)}if(Ft===0)continue;if(t.calculateQuadrantVisibility)if(N.containsPoint(Se.aabb.center))Ct=15;else for(let Yt=0;Yt<4;Yt++)Se.aabb.quadrant(Yt).intersects(N)!==0&&(Ct|=1<<Yt)}const At=I[0]-(.5+Ke+(Se.wrap<<Se.zoom))*(1<<o-Se.zoom),Qt=I[1]-.5-Ve,Wt=Se.tileID?Se.tileID:new a.aQ(Bt,Se.wrap,Se.zoom,Ke,Ve);t.calculateQuadrantVisibility&&(Wt.visibleQuadrants=Ct),Ae.push({tileID:Wt,distanceSq:At*At+Qt*Qt});continue}for(let Bt=0;Bt<4;Bt++){const Ct=(Ke<<1)+Bt%2,At=(Ve<<1)+(Bt>>1),Qt={aabb:y?Se.aabb.quadrant(Bt):a.cF(this,C,Se.zoom+1,Ct,At,Se.wrap,Se.minZ,Se.maxZ,this.projection),zoom:Se.zoom+1,x:Ct,y:At,wrap:Se.wrap,fullyVisible:it,tileID:void 0,shouldSplit:void 0,minZ:Se.minZ,maxZ:Se.maxZ};g&&!B&&(Qt.tileID=new a.aQ(Se.zoom+1===Re?Be:Se.zoom+1,Se.wrap,Se.zoom+1,Ct,At),$e(Qt)),Te.push(Qt)}}if(this.fogCullDistSq){const Se=this.fogCullDistSq,Ke=this.horizonLineFromTop();Ae=Ae.filter(Ve=>{const it=[0,0,0,1],Et=[a.al,a.al,0,1],Bt=this.calculateFogTileMatrix(Ve.tileID.toUnwrapped());a.aC(it,it,Bt),a.aC(Et,Et,Bt);const Ct=a.cG([],it,Et),At=a.cH([],it,Et),Qt=a.c$(Ct,At);if(Qt===0)return!0;let Wt=!1;const Ft=this._elevation;if(Ft&&Qt>Se&&Ke!==0){const Yt=this.calculateProjMatrix(Ve.tileID.toUnwrapped());let oi;t.isTerrainDEM||(oi=Ft.getMinMaxForTile(Ve.tileID)),oi||(oi={min:me,max:xe});const fi=a.cI(this.rotation),Ri=[fi[0]*a.al,fi[1]*a.al,oi.max];a.af(Ri,Ri,Yt),Wt=(1-Ri[1])*this.height*.5<Ke}return Qt<Se||Wt})}return Ae.sort((Se,Ke)=>Se.distanceSq-Ke.distanceSq).map(Se=>Se.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log2(t)}project(t){const o=a.aA(t.lat,-a.cJ,a.cJ),u=this.projection.project(t.lng,o);return new a.P(u.x*this.worldSize,u.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,o){let u,p;const g=this.centerPoint;if(this.projection.name==="globe"){const b=this.worldSize;u=(o.x-g.x)/b,p=(o.y-g.y)/b}else{const b=this.pointCoordinate(o),T=this.pointCoordinate(g);u=b.x-T.x,p=b.y-T.y}const y=this.locationCoordinate(t);this.setLocation(new a.ae(y.x-u,y.y-p))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,o){return this.projection.locationPoint(this,t,o)}locationPoint3D(t,o){return this.projection.locationPoint(this,t,o,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,o){return this.coordinateLocation(this.pointCoordinate3D(t,o))}locationCoordinate(t,o){const u=o?a.cf(o,t.lat):void 0,p=this.projection.project(t.lng,t.lat);return new a.ae(p.x,p.y,u)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,o){const u=o??this._centerAltitude,p=[t.x,t.y,0,1],g=[t.x,t.y,1,1];a.aC(p,p,this.pixelMatrixInverse),a.aC(g,g,this.pixelMatrixInverse);const y=g[3];a.cK(p,p,1/p[3]),a.cK(g,g,1/y);const b=p[2],T=g[2];return{p0:p,p1:g,t:b===T?0:(u-b)/(T-b)}}screenPointToMercatorRay(t){const o=[t.x,t.y,0,1],u=[t.x,t.y,1,1];return a.aC(o,o,this.pixelMatrixInverse),a.aC(u,u,this.pixelMatrixInverse),a.cK(o,o,1/o[3]),a.cK(u,u,1/u[3]),o[2]=a.cf(o[2],this._center.lat)*this.worldSize,u[2]=a.cf(u[2],this._center.lat)*this.worldSize,a.cK(o,o,1/this.worldSize),a.cK(u,u,1/this.worldSize),new a.ax([o[0],o[1],o[2]],a.aw([],a.av([],u,o)))}rayIntersectionCoordinate(t){const{p0:o,p1:u,t:p}=t,g=a.cf(o[2],this._center.lat),y=a.cf(u[2],this._center.lat);return new a.ae(a.ak(o[0],u[0],p)/this.worldSize,a.ak(o[1],u[1],p)/this.worldSize,a.ak(g,y,p))}pointCoordinate(t,o=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,o)}pointCoordinate3D(t,o){if(!this.elevation)return this.pointCoordinate(t,o);let u=this.projection.pointCoordinate3D(this,t.x,t.y);if(u)return new a.ae(u[0],u[1],u[2]);let p=0,g=this.horizonLineFromTop();if(t.y>g)return this.pointCoordinate(t,o);const y=.02*g,b=t.clone();for(let T=0;T<10&&g-p>y;T++){b.y=a.ak(p,g,.66);const C=this.projection.pointCoordinate3D(this,b.x,b.y);C?(g=b.y,u=C):p=b.y}return u?new a.ae(u[0],u[1],u[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=a.cL)return!this.isPointAboveHorizon(t);const o=this.pointCoordinate(t);return o.y>=0&&o.y<=1}_coordinatePoint(t,o){const u=o&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,p=[t.x*this.worldSize,t.y*this.worldSize,u+t.toAltitude(),1];return a.aC(p,p,this.pixelMatrix),p[3]>0?new a.P(p[0]/p[3],p[1]/p[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:o}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,p=this.width-this._edgeInsets.right,g=this.pointLocation3D(new a.P(o,t)),y=this.pointLocation3D(new a.P(p,t)),b=this.pointLocation3D(new a.P(p,u)),T=this.pointLocation3D(new a.P(o,u));let C=Math.min(g.lng,y.lng,b.lng,T.lng),I=Math.max(g.lng,y.lng,b.lng,T.lng),B=Math.min(g.lat,y.lat,b.lat,T.lat),L=Math.max(g.lat,y.lat,b.lat,T.lat);const N=Math.pow(2,-this.zoom)/16*270,H=this.projection.name==="globe"?1:4,j=(q,W,ne,ie,ee)=>{const xe=(q+ne)/2,me=(W+ie)/2,ye=new a.P(xe,me),{lng:de,lat:se}=this.pointLocation3D(ye),Te=Math.max(0,C-de,B-se,de-I,se-L);C=Math.min(C,de),I=Math.max(I,de),B=Math.min(B,se),L=Math.max(L,se),(ee<H||Te>N)&&(j(q,W,xe,me,ee+1),j(xe,me,ne,ie,ee+1))};if(j(o,t,p,t,1),j(p,t,p,u,1),j(p,u,o,u,1),j(o,u,o,t,1),this.projection.name==="globe"){const[q,W]=a.cM(this);q?(L=90,I=180,C=-180):W&&(B=-90,I=180,C=-180)}return new a.aI(new a.aT(C,B),new a.aT(I,L))}_getBoundsRectangular(t,o){const{top:u,left:p}=this._edgeInsets,g=this.height-this._edgeInsets.bottom,y=this.width-this._edgeInsets.right,b=new a.P(p,u),T=new a.P(y,u),C=new a.P(y,g),I=new a.P(p,g);let B=this.pointCoordinate(b,t),L=this.pointCoordinate(T,t);const N=this.pointCoordinate(C,o),H=this.pointCoordinate(I,o),j=(q,W)=>(W.y-q.y)/(W.x-q.x);return B.y>1&&L.y>=0?B=new a.ae((1-H.y)/j(H,B)+H.x,1):B.y<0&&L.y<=1&&(B=new a.ae(-H.y/j(H,B)+H.x,0)),L.y>1&&B.y>=0?L=new a.ae((1-N.y)/j(N,L)+N.x,1):L.y<0&&B.y<=1&&(L=new a.ae(-N.y/j(N,L)+N.x,0)),new a.aI().extend(this.coordinateLocation(B)).extend(this.coordinateLocation(L)).extend(this.coordinateLocation(H)).extend(this.coordinateLocation(N))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const o=t.visibleDemTiles.reduce((u,p)=>{if(p.dem){const g=p.dem.tree;u.min=Math.min(u.min,g.minimums[0]),u.max=Math.max(u.max,g.maximums[0])}return u},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(o.min*t.exaggeration(),o.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,u=this.height/2-o*(1-this._horizonShift);return t?Math.max(0,u):u}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-a.cJ,this.maxLat=a.cJ,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=a.aF(this.minLng)*this.tileSize,this.worldMaxX=a.aF(this.maxLng)*this.tileSize,this.worldMinY=a.aJ(this.maxLat)*this.tileSize,this.worldMaxY=a.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,o){return this.projection.createTileMatrix(this,o,t)}calculateDistanceTileData(t){const o=t.key,u=this._distanceTileDataCache;if(u[o])return u[o];const p=t.canonical,g=1/this.height,y=this.cameraWorldSize,b=y/this.zoomScale(p.z),T=(p.x+Math.pow(2,p.z)*t.wrap)*b,C=p.y*b,I=this.point;I.x*=y/this.worldSize,I.y*=y/this.worldSize;const B=this.angle,L=Math.sin(-B),N=-Math.cos(-B);return u[o]={bearing:[L,N],center:[(I.x-T)*g,(I.y-C)*g],scale:b/a.al*g},u[o]}calculateFogTileMatrix(t){const o=t.key,u=this._fogTileMatrixCache;if(u[o])return u[o];const p=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return a.aB(p,this.worldToFogMatrix,p),u[o]=new Float32Array(p),u[o]}calculateProjMatrix(t,o=!1,u=!1){const p=t.key;let g;if(g=u?this._expandedProjMatrixCache:o?this._alignedProjMatrixCache:this._projMatrixCache,g[p])return g[p];const y=this.calculatePosMatrix(t,this.worldSize);let b;return b=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:u?this.expandedFarZProjMatrix:o?this.alignedProjMatrix:this.projMatrix,a.aB(y,b,
219y),g[p]=new Float32Array(y),g[p]}calculatePixelsToTileUnitsMatrix(t){const o=t.tileID.key,u=this._pixelsToTileUnitsCache;if(u[o])return u[o];const p=a.cN(t,this);return u[o]=p,u[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,o=a.bq([],[t,t,t]);return a.aB(o,o,this.globeMatrix),o}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const o=a.cf(1,this._center.lat)*this.worldSize,u=this._computeCameraPosition(o),p=this._camera.forward(),g=a.cf(1,this._center.lat);u[2]/=g,p[2]/=g,a.aw(p,p);const y=t.raycast(u,p,t.exaggeration());if(y){const b=a.bH([],u,p,y),T=new a.ae(b[0],b[1],a.cf(b[2],a.a$(b[1]))),C=(T.z+a.ag([T.x-u[0],T.y-u[1],T.z-u[2]*g]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(C),this._centerAltitude=T.toAltitude(),this._center=this.coordinateLocation(T),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const o=this._elevation,u=a.cf(1,this._center.lat)*this.worldSize,p=this._computeCameraPosition(u),g=o.getAtPointOrZero(new a.ae(...p)),y=this.pixelsPerMeter/this.worldSize*g,b=this._minimumHeightOverTerrain(),T=p[2]-y;if(T<=b)if(T<0||t){const C=this.locationCoordinate(this._center,this._centerAltitude),I=[p[0],p[1],C.z-p[2]],B=a.ag(I);I[2]-=(b-T)/this._pixelsPerMercatorPixel;const L=a.ag(I);if(L===0)return;a.c5(I,I,B/L*this._pixelsPerMercatorPixel),this._camera.position=[p[0],p[1],C.z*this._pixelsPerMercatorPixel-I[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const L=this.center;return L.lat=a.aA(L.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(L.lng=a.aA(L.lng,this.minLng,this.maxLng)),this.center=L,void(this._constraining=!1)}const o=this._unmodified,{x:u,y:p}=this.point;let g=0,y=u,b=p;const T=this.width/2,C=this.height/2,I=this.worldMinY*this.scale,B=this.worldMaxY*this.scale;if(p-C<I&&(b=I+C),p+C>B&&(b=B-C),B-I<this.height&&(g=Math.max(g,this.height/(B-I)),b=(B+I)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const L=this.worldMinX*this.scale,N=this.worldMaxX*this.scale,H=this.worldSize/2-(L+N)/2;y=(u+H+this.worldSize)%this.worldSize-H,y-T<L&&(y=L+T),y+T>N&&(y=N-T),N-L<this.width&&(g=Math.max(g,this.width/(N-L)),y=(N+L)/2)}y===u&&b===p||this._allowWorldUnderZoom||(this.center=this.unproject(new a.P(y,b))),g&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(g)),this._constrainCamera(),this._unmodified=o,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.projection.name==="globe",u=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=a.cf(1,this.center.lat)/a.cf(1,a.d2));const p=a.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,p),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const g=this.projection.zAxisUnit==="meters"?u:1,y=this._camera.getWorldToCamera(this.worldSize,g);let b;const T=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(T[8]=2*-t.x/this.width,T[9]=2*t.y/this.height,this.isOrthographic){let se=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),Te=se*this.aspect,Ae=-Te,Re=-se;Te-=t.x,Ae-=t.x,se+=t.y,Re+=t.y,b=this._camera.getCameraToClipOrthographic(Ae,Te,Re,se,this._nearZ,this._farZ),((Be,Le,$e,ot)=>{for(let Fe=0;Fe<16;Fe++)Be[Fe]=a.ak(Le[Fe],$e[Fe],ot)})(b,b,T,a.d0(this.pitch>=Aa?1:this.pitch/Aa))}else b=T;const C=a.cP([],T,y);let I=a.cP([],b,y);if(this.projection.isReprojectedInTileSpace){const se=this.locationCoordinate(this.center),Te=a.bA([]);a.br(Te,Te,[se.x*this.worldSize,se.y*this.worldSize,0]),a.aB(Te,Te,a.cQ(this)),a.br(Te,Te,[-se.x*this.worldSize,-se.y*this.worldSize,0]),a.aB(I,I,Te),a.aB(C,C,Te),this.inverseAdjustmentMatrix=a.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.cS([],I,[this.worldSize,this.worldSize,this.worldSize/g,1]),this.projMatrix=I,this.invProjMatrix=a.bl(new Float64Array(16),this.projMatrix),o){const se=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);se[8]=2*-t.x/this.width,se[9]=2*t.y/this.height,this.expandedFarZProjMatrix=a.cP([],se,y)}else this.expandedFarZProjMatrix=this.projMatrix;const B=a.bl([],b);this.frustumCorners=a.cT.fromInvProjectionMatrix(B,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!o);const L=new Float32Array(16);a.bA(L),a.cS(L,L,[1,-1,1]),a.cU(L,L,this._pitch),a.bB(L,L,this.angle);const N=a.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.bz(N);const H=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;N[8]=2*-t.x/this.width,N[9]=2*(t.y+H)/this.height,this.skyboxMatrix=a.aB(L,N,L);const j=this.point,q=j.x,W=j.y,ne=this.width%2/2,ie=this.height%2/2,ee=Math.cos(this.angle),xe=Math.sin(this.angle),me=q-Math.round(q)+ee*ne+xe*ie,ye=W-Math.round(W)+ee*ie+xe*ne,de=new Float64Array(I);if(a.br(de,de,[me>.5?me-1:me,ye>.5?ye-1:ye,0]),this.alignedProjMatrix=de,I=a.bC(),a.cS(I,I,[this.width/2,-this.height/2,1]),a.br(I,I,[1,-1,0]),this.labelPlaneMatr
219ix=I,I=a.bC(),a.cS(I,I,[1,-1,1]),a.br(I,I,[-1,-1,0]),a.cS(I,I,[2/this.width,2/this.height,1]),this.glCoordMatrix=I,this.pixelMatrix=a.aB(new Float64Array(16),this.labelPlaneMatrix,C),this._calcFogMatrices(),this._distanceTileDataCache={},I=a.bl(new Float64Array(16),this.pixelMatrix),!I)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=I,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.cV(this);const se=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.af(se,se,y),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=I;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,o=this.cameraPixelsPerMeter,u=this._camera.position,p=1/this.height/this._pixelsPerMercatorPixel,g=[t,t,o];a.c5(g,g,p),a.c5(u,u,-1),a.cW(u,u,g);const y=a.bC();a.br(y,y,u),a.cS(y,y,g),this.mercatorFogMatrix=y,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,o,p)}_computeCameraPosition(t){const o=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,u=this._camera.forward(),p=this.point,g=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-t/this.worldSize*this._centerAltitude;return[p.x/this.worldSize-u[0]*g,p.y/this.worldSize-u[1]*g,t/this.worldSize*this._centerAltitude-u[2]*g]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),u=this._camera.position[2],p=t[2];let g=1;this.projection.wrap&&(this.center=this.center.wrap()),p>0&&(g=Math.min((o-u)/p,1)),this._camera.position=a.bH([],this._camera.position,t,g),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,o=this._camera.forward(),{pitch:u,bearing:p}=this._camera.getPitchBearing(),g=a.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,y=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.an(this._maxPitch)),b=Math.max((t[2]-g)/Math.cos(u),y),T=this._zoomFromMercatorZ(b);a.bH(t,t,o,b),this._pitch=a.aA(u,a.an(this.minPitch),a.an(this.maxPitch)),this.angle=a.bT(p,-Math.PI,Math.PI),this._setZoom(a.aA(T,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.ae(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let o=0,u=a.cL,p=0,g=1/0;for(;u-o>1e-6&&u>o;){const y=o+.5*(u-o),b=this.tileSize*Math.pow(2,y),T=this.getCameraToCenterDistance(this.projection,y,b),C=this.scaleZoom(T/(Math.max(0,t)*this.tileSize)),I=Math.abs(y-C);I<g&&(g=I,p=y),y<C?o=y:u=y}return p}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(a.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,o){const u=Math.min(t.x,o.x),p=Math.max(t.x,o.x),g=Math.min(t.y,o.y),y=Math.max(t.y,o.y);if(g<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const b=[new a.P(u,g),new a.P(p,y),new a.P(u,y),new a.P(p,g)],T=this.renderWorldCopies?-3:0,C=this.renderWorldCopies?4:1;for(const I of b){const B=this.pointRayIntersection(I);if(B.t<0)return!0;const L=this.rayIntersectionCoordinate(B);if(L.x<T||L.y<0||L.x>C||L.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(t,o){const u=a.ag(a.av([],this._camera.position,t)),p=this._zoomFromMercatorZ(u)+o;return u-this._mercatorZfromZoom(p)}getCameraPoint(){if(this.projection.name==="globe"){const t=(function([o,u,p],g){const y=[o,u,p,1];a.aC(y,y,g);const b=y[3]=Math.max(y[3],1e-6);
219return y[0]/=b,y[1]/=b,y[2]/=b,y})([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,t))}}getCameraToCenterDistance(t,o=this.zoom,u=this.worldSize){const p=a.cO(t,o,this.width,this.height,1024),g=t.pixelSpaceConversion(this.center.lat,u,p);let y=.5/Math.tan(.5*this._fov)*this.height*g;return this.isOrthographic&&(y=a.ak(1,y,a.d0(this.pitch>=Aa?1:this.pitch/Aa))),y}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.aB(t,t,this.globeMatrix),t}getFrustum(t){return a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Va=(c,t)=>{if(t>0&&c.terrain&&a.w("Cutoff is currently disabled on terrain"),t<=0||c.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=c.transform,u=Math.max(Math.abs(o._zoom-(c.minCutoffZoom-1)),1),p=o.isLODDisabled(!1)?a.ah(60,45,o.pitch):a.ah(30,15,o.pitch),g=o._farZ-o._nearZ,y=t*o.height,b=((1-(T=p))*o.cameraToCenterDistance+T*(o._farZ+y))*u;var T;return{shouldRenderCutoff:p<1,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(b-o._nearZ)/g,(b-y-o._nearZ)/g]}}},zl=2048;class Rm{constructor(t,o){this.aabb=t,this.lastCascade=o}}class qc{add(t,o){const u=this.receivers[t.key];u!==void 0?(u.aabb.min[0]=Math.min(u.aabb.min[0],o.min[0]),u.aabb.min[1]=Math.min(u.aabb.min[1],o.min[1]),u.aabb.min[2]=Math.min(u.aabb.min[2],o.min[2]),u.aabb.max[0]=Math.max(u.aabb.max[0],o.max[0]),u.aabb.max[1]=Math.max(u.aabb.max[1],o.max[1]),u.aabb.max[2]=Math.max(u.aabb.max[2],o.max[2])):this.receivers[t.key]=new Rm(o,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,o,u){const p=a.d9.fromPoints(t.points);let g=0;for(const y in this.receivers){const b=this.receivers[y];if(!b||!p.intersectsAabb(b.aabb))continue;b.aabb.min=p.closestPoint(b.aabb.min),b.aabb.max=p.closestPoint(b.aabb.max);const T=b.aabb.getCorners();for(let C=0;C<u.length;C++){let I=!0;for(const B of T){const L=[B[0]*o,B[1]*o,B[2]];if(a.af(L,L,u[C].matrix),L[0]<-1||L[0]>1||L[1]<-1||L[1]>1){I=!1;break}}if(b.lastCascade=C,g=Math.max(g,C),I)break}}return g+1}}class Wh{constructor(t){this.painter=t,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new qc,this._depthMode=new ti(t.context.gl.LEQUAL,ti.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,o){const u=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!o||!o.properties)return;const p=o.properties.get("shadow-intensity"),g=o.properties.get("shadow-draw-before-layer");if(!o.shadowsEnabled()||p<=0)return;let y=-1,b=0;for(const W of u.style.order){const ne=u.style._mergedLayers[W];ne.hasShadowPass()&&!ne.isHidden(t.zoom)&&(y=b),g&&g===W&&(this._drawShadowAfterLayer=b>0?b-1:0),b+=1}if(this._enabled=y>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=y);const T=u.context,C=zl,I=zl;if(this._cascades.length===0||zl!==this._cascades[0].texture.size[0]){this._cascades=[];for(let W=0;W<2;++W){const ne=u._shadowMapDebug,ie=T.gl,ee=T.createFramebuffer(C,I,ne?1:0,"texture"),xe=new a.T(T,{width:C,height:I,data:null},ie.DEPTH_COMPONENT16);if(ee.depthAttachment.set(xe.texture),ne){const me=new a.T(T,{width:C,height:I,data:null},ie.RGBA8);ee.colorAttachment0.set(me.texture)}this._cascades.push({framebuffer:ee,texture:xe,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.cB,scale:0})}}this.shadowDirection=nf(o);let B=0;if(t.elevation){const W=t.elevation,ne=[1e4,-1e4];W.visibleDemTiles.filter(ie=>ie.dem).forEach(ie=>{const ee=ie.dem.tree;ne[0]=Math.min(ne[0],ee.minimums[0]),ne[1]=Math.max(ne[1],ee.maximums[0])}),ne[0]!==1e4&&(B=(ne[1]-ne[0])*W.exaggeration())}const L=1.5*t.cameraToCenterDistance,N=3*L,H=new Float64Array(16);for(let W=0;W<this._cascades.length;++W){const ne=this._cascades[W];let ie=t.height/50,ee=1;W===0?ee=L:(ie=L,ee=N);const[xe,me]=rf(t,this.shadowDirection,ie,ee,zl,B);ne.scale=t.scale,ne.matrix=xe,ne.boundingSphereRadius=me,a.bl(H,ne.matrix),ne.frustum=a.cB.fromInvProjectionMatrix(H,1,0,!0),ne.far=ee}const j=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[j].far,this._cascades[j].far],this._uniformValues.u_shadow_intensity=p,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=zl,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=u.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const q=u.transform.elevation;for(const W of this._groundShadowTiles){let ne={min:0,max:0};if(q){const ie=q.getMinMaxForTile(W);ie&&(ne=ie)}this.addShadowReceiver(W.toUnwrapped(),ne.min,ne.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,o){if(!this.enabled)return;const u=this.painter,p=u.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(u.transform.getFrustum(0),u.transform.worldSize,this._cascades),p.viewport.set([0,0,zl,zl]);for(let g=0;g<this._numCascadesToRender;++g){u.currentShadowCascade=g,p.bindFramebuffer.set(this._cascades[g].framebuffer.framebuffer),p.clear({color:a.ao.white,depth:1});for(const y of t.order){const b=t._mergedLayers[y];if(!b.hasShadowPass()||b.isHidden(u.transform.zoom))continue;const T=t.getLayerSourceCache(b),C=T?o[T.id]:void 0;(b.type==="model"||C&&C.length)&&u.renderLayer(u,T,b,C)}}u.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,o=t.style,u=t.context,p=u.gl,g=o.directionalLight,y=o.ambientLight;if(!g||!y)return;const b=[],T=Va(t,t.longestCutoffRange);T.shouldRenderCutoff&&b.push("RENDER_CUTOFF"),b.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&b.push("NORMAL_OFFSET");const C=Jo(o,g,y),I=new ti(p.LEQUAL,ti.ReadOnly,t.depthRangeFor3D),B=new yi({func:p.EQUAL,mask:255},0,255,p.KEEP,p.KEEP,p.KEEP);for(const L of this._groundShadowTiles){const N=L.toUnwrapped(),H=t.isTileAffectedByFog(L),j=t.getOrCreateProgram("groundShadow",{defines:b,overrideFog:H});this.setupShadows(N,j),t.uploadCommonUniforms(u,j,N,null,T);const q=ua(t.transform.calculateProjMatrix(N),C);j.draw(t,p.TRIANGLES,I,B,bi.multiply,di.disabled,q,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?bi.unblended:bi.disabled}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(t){const o=this.painter.transform,u=o.calculatePosMatrix(t,o.worldSize);return a.aB(u,this._cascades[this.painter.currentShadowCascade].matrix,u),Float32Array.from(u)}
219calculateShadowPassMatrixFromMatrix(t){const o=a.bz(t);return a.aB(o,this._cascades[this.painter.currentShadowCascade].matrix,t),o}setupShadows(t,o,u){if(!this.enabled)return;const p=this.painter.transform,g=this.painter.context,y=g.gl,b=this._uniformValues,T=new Float64Array(16),C=p.calculatePosMatrix(t,p.worldSize);for(let I=0;I<this._cascades.length;I++)a.aB(T,this._cascades[I].matrix,C),b[I===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),g.activeTexture.set(y.TEXTURE0+11+I),this._cascades[I].texture.bindExtraParam(y.LINEAR,y.LINEAR,y.CLAMP_TO_EDGE,y.CLAMP_TO_EDGE,y.GREATER);if(this.useNormalOffset=!!u,this.useNormalOffset){const I=a.d7(t.canonical),B=2/p.tileSize*a.al/zl,L=B*this._cascades[0].boundingSphereRadius,N=B*this._cascades[this._cascades.length-1].boundingSphereRadius,H=(u==="vector-tile"?1:3)*(function(j){const q=a.aA((j-22)/-22,0,1);return .125*(1-q)+4*q})(p.zoom);b.u_shadow_normal_offset=[I,L*H,N*H],b.u_shadow_bias=[1e-4,.0012,.012]}else b.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(g,b)}setupShadowsFromMatrix(t,o,u=!1){if(!this.enabled)return;const p=this.painter.context,g=p.gl,y=this._uniformValues,b=new Float64Array(16);for(let T=0;T<2;T++)a.aB(b,this._cascades[T].matrix,t),y[T===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(b),p.activeTexture.set(g.TEXTURE0+11+T),this._cascades[T].texture.bindExtraParam(g.LINEAR,g.LINEAR,g.CLAMP_TO_EDGE,g.CLAMP_TO_EDGE,g.GREATER);this.useNormalOffset=u,u?(y.u_shadow_normal_offset=[1,3,3],y.u_shadow_bias=[6e-5,.0012,.012]):y.u_shadow_bias=[36e-5,.0012,.012],o.setShadowUniformValues(p,y)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,o,u,p){if(p[2]>=0)return{};const g=(function(T,C,I){const B=I/(1<<T.canonical.z);return new a.d9([T.canonical.x*B+T.wrap*I,T.canonical.y*B+T.wrap*I,0],[(T.canonical.x+1)*B+T.wrap*I,(T.canonical.y+1)*B+T.wrap*I,C])})(t,o,u).getCorners(),y=o/-p[2];p[0]<0?(a.d8(g[0],g[0],[p[0]*y,0,0]),a.d8(g[3],g[3],[p[0]*y,0,0])):p[0]>0&&(a.d8(g[1],g[1],[p[0]*y,0,0]),a.d8(g[2],g[2],[p[0]*y,0,0])),p[1]<0?(a.d8(g[0],g[0],[0,p[1]*y,0]),a.d8(g[1],g[1],[0,p[1]*y,0])):p[1]>0&&(a.d8(g[2],g[2],[0,p[1]*y,0]),a.d8(g[3],g[3],[0,p[1]*y,0]));const b={};return b.vertices=g,b.planes=[Dl(g[1],g[0],g[4]),Dl(g[2],g[1],g[5]),Dl(g[3],g[2],g[6]),Dl(g[0],g[3],g[7])],b}addShadowReceiver(t,o,u){this._receivers.add(t,a.d9.fromTileIdAndHeight(t,o,u))}getMaxCascadeForTile(t){const o=this._receivers.get(t);return o&&o.lastCascade?o.lastCascade:0}}function Dl(c,t,o){const u=a.av([],o,t),p=a.av([],c,t),g=a.bI([],u,p),y=a.ag(g);return y===0?[0,0,1,0]:(a.c5(g,g,1/y),[g[0],g[1],g[2],-a.bJ(g,t)])}function nf(c){const t=c.properties.get("direction"),o=a.d4(t.x,t.y,t.z);o[2]=a.aA(o[2],0,75);const u=a.d6([o[0],o[1],o[2]]);return a.d5(u.x,u.y,u.z)}function Jo(c,t,o){const u=t.properties.get("color-use-theme")==="none",p=t.properties.get("color"),g=t.properties.get("intensity"),y=t.properties.get("direction"),b=[y.x,y.y,y.z],T=o.properties.get("color-use-theme")==="none",C=o.properties.get("color"),I=o.properties.get("intensity"),B=Math.max(a.bJ([0,0,1],b),0),L=[0,0,0];a.c5(L,C.toPremultipliedRenderColor(T?null:c.getLut(t.scope)).toArray01Linear().slice(0,3),I);const N=[0,0,0];return a.c5(N,p.toPremultipliedRenderColor(u?null:c.getLut(o.scope)).toArray01Linear().slice(0,3),B*g),a.db([L[0]>0?L[0]/(L[0]+N[0]):0,L[1]>0?L[1]/(L[1]+N[1]):0,L[2]>0?L[2]/(L[2]+N[2]):0])}function rf(c,t,o,u,p,g){const y=c.zoom,b=c.scale,T=c.worldSize,C=1/T,I=c.aspect,B=Math.sqrt(1+I*I)*Math.tan(.5*c.fovX),L=B*B,N=u-o,H=u+o;let j,q;L>N/H?(j=u,q=u*B):(j=.5*H*(1+L),q=.5*Math.sqrt(N*N+2*(u*u+o*o)*L+H*H*L*L));const W=c.projection.pixelsPerMeter(c.center.lat,T),ne=c._camera.getCameraToWorldMercator(),ie=[0,0,-j*C];a.af(ie,ie,ne);let ee=q*C;const xe=function(it){return it[0]/=b,it[1]/=b,it[2]=a.cf(it[2],c._center.lat),it},me=c._edgeInsets;if(!(me.left===0&&me.top===0&&me.right===0&&me.bottom===0||me.left===me.right&&me.top===me.bottom)){const it=c._camera.getWorldToCamera(c.worldSize,c.projection.zAxisUnit==="meters"?W:1),Et=c._camera.getCameraToClipPerspective(c._fov,c.width/c.height,o,u);Et[8]=2*-c.centerOffset.x/c.width,Et[9]=2*c.centerOffset.y/c.height;const Bt=new Float64Array(16);a.cP(Bt,Et,it);const Ct=new Float64Array(16);a.bl(Ct,Bt);const At=a.cB.fromInvProjectionMatrix(Ct,T,y,!0);for(const Qt of At.points){const Wt=xe(Qt);ee=Math.max(ee,a.c6(a.da([],ie,Wt)))}}ee*=p/(p-1);const ye=Math.acos(t[2]),de=Math.atan2(-t[0],-t[1]),se=new Hu;se.position=ie,se.setPitchBearing(ye,de);const Te=se.getWorldToCamera(T,W),Ae=ee*T,Re=Math.min(c._mercatorZfromZoom(17)*T*-2,-2*Ae),Be=se.getCameraToClipOrthographic(-Ae,Ae,-Ae,Ae,Re,(Ae+g*W)/t[2]),Le=new Float64Array(16);a.aB(Le,Be,Te);const $e=a.d5(Math.floor(1e6*ie[0])/1e6*T,Math.floor(1e6*ie[1])/1e6*T,0),ot=.5*p,Fe=[0,0,0];a.af(Fe,$e,Le),a.c5(Fe,Fe,ot);const Se=[Math.floor(Fe[0]),Math.floor(Fe[1]),Math.floor(Fe[2])],Ke=[0,0,0];a.av(Ke,Fe,Se),a.c5(Ke,Ke,-1/ot);const Ve=new Float64Array(16);return a.bA(Ve),a.br(Ve,Ve,Ke),a.aB(Le,Ve,Le),[Le,Ae]}class Yh extends a.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,o){return a.dc(this.requestManager.transformRequest(o,a.R.Model).url).then(u=>{if(!u)return;const p=a.dd(u),g=new a.de(t,o,void 0,void 0,p);return g.computeBoundsAndApplyParent(),g}).catch(u=>{if(u&&u.status===404)return null;this.fire(new a.y(new Error(`Could not load model ${t} from ${o}: ${u.message}`)))})}load(t,o,u={forceReload:!1}){this.models[o]||(this.models[o]={});const p=Object.keys(t),g=[],y=[];for(const b of p){const T=t[b];this.hasURLBeenRequested(T)&&!u.forceReload||(this.modelByURL[T]={modelId:b,scope:o},g.push(this.loadModel(b,T)),y.push(b)),this.models[o][b]||(this.models[o][b]={model:null,numReferences:1})}this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+y.length,Promise.allSettled(g).then(b=>{for(let T=0;T<b.length;T++){const{status:C}=b[T];
vendor: 5,045 bytes, line 219
219if(C==="rejected")continue;const{value:I}=b[T];this.models[o][y[T]]||(this.models[o][y[T]]={model:null,numReferences:1}),this.models[o][y[T]].model=I}this.numModelsLoading[o]-=y.length,this.fire(new a.z("data",{dataType:"style"}))}).catch(b=>{this.fire(new a.y(new Error(`Could not load models: ${b.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,o,u={exactIdMatch:!1}){return!!(u.exactIdMatch?this.getModel(t,o):this.getModelByURL(this.modelUris[o][t]))}getModel(t,o){return this.models[o]||(this.models[o]={}),this.models[o][t]?this.models[o][t].model:void 0}getModelByURL(t){if(!t)return null;const o=this.modelByURL[t];return o?this.models[o.scope][o.modelId].model:null}hasModelBeenAdded(t,o){return this.models[o]&&this.models[o][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,o,u){this.models[u]||(this.models[u]={}),this.modelUris[u]||(this.modelUris[u]={});const p=this.requestManager.normalizeModelURL(o);if((this.hasModel(t,u,{exactIdMatch:!0})||this.hasModelBeenAdded(t,u))&&this.modelUris[u][t]===p)this.models[u][t].numReferences++;else if(this.hasURLBeenRequested(p)){const{scope:g,modelId:y}=this.modelByURL[p];this.models[g][y].numReferences++}else this.modelUris[u][t]=p,this.load({[t]:this.modelUris[u][t]},u)}addModelURLs(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const u=this.modelUris[o];for(const p in t)u[p]=this.requestManager.normalizeModelURL(t[p])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const u={};for(const p of t)this.hasModel(p,o,{exactIdMatch:!0})||this.hasURLBeenRequested(p)?this.models[o][p].numReferences++:this.modelUris[o][p]&&!this.hasURLBeenRequested(p)?u[p]=this.modelUris[o][p]:!this.hasURLBeenRequested(p)&&a.df(p,!1)&&(this.modelUris[o][p]=this.requestManager.normalizeModelURL(p),u[p]=this.modelUris[o][p]);this.load(u,o)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,o,u=!1,p=!1){if(this.models[o]&&this.models[o][t]&&(this.models[o][t].numReferences--,this.models[o][t].numReferences===0||p)){const g=this.modelUris[o][t];u||delete this.modelUris[o][t],delete this.modelByURL[g];const y=this.models[o][t].model;if(!y)return;delete this.models[o][t],y.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const o of Object.keys(this.models[t])){const u=this.models[t][o].model;delete this.models[t][o],u&&u.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,o){this.models[o]||(this.models[o]={});for(const u in this.models[o])this.models[o][u].model&&this.models[o][u].model.upload(t.context)}}const Ms=a.a6.colorTheme,ja=new a.a9({data:new a.aa(Ms.data)});function yp(c){if(!c.metadata||!c.metadata.content_area)return;const t=a.o.devicePixelRatio,{left:o,top:u,width:p,height:g}=c.metadata.content_area,y=o*t,b=u*t;return[y,b,y+p*t,b+g*t]}function xp(c){if(c)return c.map(([t,o])=>[t*a.o.devicePixelRatio,o*a.o.devicePixelRatio])}class Zc{constructor(t,o,u){this.id=t,this.scope=o,this.sourceCache=u,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const o=this.sourceCache.getVisibleCoordinates();if(o.length===0)return t;const u=this.sourceCache.getSource();if(!(u instanceof Fo))return t;const p=o.map(y=>this.sourceCache.getTile(y)),g=u.getImages(p,Array.from(this.pendingRequests));for(const[y,b]of g)t.set(a.I.from({name:y,iconsetId:this.id}),b),this.pendingRequests.delete(y);for(const y of this.pendingRequests)this.missingRequests.add(y);return this.pendingRequests.clear(),t}}class of{constructor(){a.aY(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=Ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.style&&this._map.style.indoorManager.on("selector-update",o=>this._onIndoorUpdate(o)),this._container}_createButton(t,o){const u=Ne("button",t,this._container);return u.type="button",u.addEventListener("click",o),u}_createSeparator(){return Ne("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(t,o){this._map&&(t.setAttribute("aria-label",o),t.textContent=o)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.style&&(this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return this._model=t,void(this._container.style.display="none");const o=this._model;this._model=t,this._container.style.display="inline-block",this._container.style.borderRadius="8px",o&&Array.from(this._container.children).forEac
219h(u=>u.remove()),t.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(t.floors,t.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const t=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const o=this._map;this._model&&o&&o._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});Ne("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(t),this._createSeparator()}_updateBuildingsButtonState(){const t=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");t&&this._model&&(this._model.activeFloorsVisible?t.classList.remove("mapboxgl-ctrl-level-button-selected"):t.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(t,o){for(let u=0;u<t.length;u++){const p=t[u],g=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(p.id)}),y=(p.name||"").trim(),b=p.zIndex.toString(),T=y?Array.from(y).slice(0,3).join(""):b;this._setButtonTitle(g,T),this._model&&p.id===this._model.selectedFloorId&&o&&g.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(g),u<t.length-1&&this._createSeparator()}}}class zm extends a.E{constructor(t){super(),this._style=t,this._buildings={},this._indoorControl=null,this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},a.aY(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",this._updateUI),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI),this._updateUI())})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null,this._removeIndoorControl()}selectFloor(t){t===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=t,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(t){this._activeFloorsVisible=t,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(t){for(const[o,u]of Object.entries(t.buildings))if(this._buildings[o])for(const p of u.floorIds)this._buildings[o].floors[p]||(this._buildings[o].floors[p]=u.floors[p]);else this._buildings[o]=u;for(const o of t.activeFloors)this._activeFloors.add(o);this._updateIndoorSelector()}getIndoorTileOptions(t,o){const u=this._style.getIndoorSourceLayers(t,o);return u&&this._indoorState?{sourceLayers:u,indoorState:this._indoorState}:null}_addIndoorControl(){this._indoorControl||(this._indoorControl=new of,this._style.map.addControl(this._indoorControl,"right"))}_removeIndoorControl(){this._indoorControl&&(this._indoorControl.onRemove(),this._indoorControl=null)}_updateUI(){const t=this._style.map.transform,o=(function(u,p,g,y){let b=null,T=Number.MAX_SAFE_INTEGER;if(y<16)return null;for(const[C,I]of Object.entries(u)){const B=I.center;if(B){const L=p.distanceTo(a.aT.convert(B));L<T&&g.contains(B)&&(T=L,b=C)}}return b})(this._buildings,t.center,t.getBounds(),t.zoom);o!==this._closestBuildingId&&(this._closestBuildingId=o,this._updateIndoorSelector())}_updateIndoorSelector(){const t=this._buildings,o=this._closestBuildingId,u=o&&t?t[o]:void 0;if(!u)return this._removeIndoorControl(),void this.fire(new a.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));this._addIndoorControl();let p=null;for(const y of u.floorIds)if(this._activeFloors&&this._activeFloors.has(y)){p=y;break}const g=Array.from(u.floorIds).map(y=>({id:y,name:u.floors[y].name,zIndex:u.floors[y].zIndex})).sort((y,b)=>b.zIndex-y.zIndex).filter((y,b,T)=>b===0||y.zIndex!==T[b-1].zIndex);this.fire(new a.z("selector-update",{selectedFloorId:p,activeFloorsVisible:this._activeFloorsVisible,floors:g}))}_updateActiveFloors(){const t=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:t,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}const il=(c,t)=>Ie(c,t&&t.filter(o=>o.identifier!=="source.canvas")),Dm=a.aH(en,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Pm=a.aH(en,["setCenter","setZoom","setBearing","setP
219itch"]),af=new Set(["background","sky","slot","custom"]),sf={version:8,layers:[],sources:{}},Pl={duration:300,delay:0};class ea extends a.E{constructor(t,o={}){super(),this.map=t,this.scope=o.scope||"",this.globalId=null,this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition=Object.assign({},Pl),this._buildingIndex=new Uc(this),this.crossTileSymbolIndex=new br,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=o.styleChanges||new rr,this._hasDataDrivenEmissive=!1,this.indoorManager=new zm(this),this.dispatcher=o.dispatcher?o.dispatcher:new a.D(a.dh(),this),o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new Ja(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new a.di(t._requestManager,o.localFontFamily?a.dj.all:o.localIdeographFontFamily?a.dj.ideographs:a.dj.none,o.localFontFamily||o.localIdeographFontFamily),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new Yh(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._configDependentLayers=o.configDependentLayers?o.configDependentLayers:new Set,this._indoorDependentLayers=o.indoorDependentLayers?o.indoorDependentLayers:new Set,this._config=o.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:o.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=o.initialConfig,this.dispatcher.broadcast("setReferrer",a.dk());const u=this;this._rtlTextPluginCallback=ea.registerForPluginStateChange(p=>{u.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL},(g,y)=>{if(a.dl(g),y&&y.every(b=>b))for(const b in u._sourceCaches){const T=u._sourceCaches[b],C=T.getSource().type;C!=="vector"&&C!=="geojson"||T.reload()}})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const g=this.getOwnSource(p.sourceId);if(g&&g.vectorLayerIds)for(const y in this._layers){const b=this._layers[y];b.source===g.id&&this._validateLayer(b)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(a.h(t))return t;const o=a.dm(t);if(!o.startsWith("http"))try{return new URL(o,location.href).toString()}catch{return o}return o}return`json://${a.dn(JSON.stringify(t))}`}_diffStyle(t,o,u){this.globalId=this._getGlobalId(t);const p=(g,y)=>{try{y(null,this.setState(g,u))}catch(b){y(b,!1)}};if(typeof t=="string"){const g=this.map._requestManager.normalizeStyleURL(t),y=this.map._requestManager.transformRequest(g,a.R.Style);a.m(y,(b,T)=>{b?this.fire(new a.y(b)):T&&p(T,o)})}else typeof t=="object"&&p(t,o)}loadURL(t,o={}){this.fire(new a.z("dataloading",{dataType:"style"}));const u=typeof o.validate=="boolean"?o.validate:!a.h(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,o.accessToken),this.resolvedImports.add(t);const p=this.importsCache.get(t);if(p)return this._load(p,u);const g=this.map._requestManager.transformRequest(t,a.R.Style);this._request=a.m(g,(y,b)=>{if(this._request=null,y)this.fire(new a.y(y));else if(b)return this.importsCache.set(t,b),this._load(b,u)})}loadJSON(t,o={}){this.fire(new a.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=a.o.frame(()=>{this._request=null,this._load(t,o.validate!==!1)})}loadEmpty(){this.fire(new a.z("dataloading",{dataType:"style"})),this._load(sf,!1)}_loadImports(t,o,u){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const p=[];for(const g of t){const y=this._createFragmentStyle(g),b=new Promise(I=>{y.once("style.import.load",I),y.once("error",I)}).then(()=>this.mergeAll());if(p.push(b),this.resolvedImports.has(g.url)){y.loadEmpty();continue}const T=g.data||this.importsCache.get(g.url);T?(y.loadJSON(T,{validate:o}),this._isInternalStyle(T)&&(y.globalId=null)):g.url?y.loadURL(g.url,{validate:o}):y.loadEmpty();const C={style:y,id:g.id,config:g.config};if(u){const I=this.fragments.findIndex(({id:B})=>B===u);this.fragments=this.fragments.slice(0,I).concat(C).concat(this.fragments.slice(I))}else this.fragments.push(C)}return Promise.allSettled(p)}getImportGlobalIds(t=this,o=new Set){for(const u of t.fragments)u.style.globalId&&o.add(u.style.globalId),this.getImportGlobalIds(u.style,o);return[...o.values()]}_createFragmentStyle(t){const o=this.scope?a.B(t.id,this.scope):t.id;let u;const p=this._initialConfig&&this._initialConfig[o];(t.config||p)&&(u=Object.assign({},t.config,p));const g=new ea(this.map,{scope:o,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:u,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indo
219orDependentLayers});return g.setEventedParent(this.map,{style:g}),g}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,o){if(this._isInternalStyle(t)){const g=Object.assign({},sf,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(g,o)}if(this.updateConfig(this._config,t.schema),o&&il(this,gr(t)))return;this._loaded=!0,this.stylesheet=a.dp(t);const u=()=>{for(const T in t.sources)this.addSource(T,t.sources[T],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const T in t.iconsets)this.addIconset(T,t.iconsets[T]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const g=Yd(this.stylesheet.layers);if(this._order=g.map(T=>T.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const T=this.stylesheet.lights[0];this.light=new qe(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new qe(this.stylesheet.light)),this._layers={};for(const T of g){const C=a.du(T,this.scope,this._styleColorTheme.lut,this.options);C.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(C.fqid),C.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(C.fqid),this._hasAppearances=this._hasAppearances||C.getAppearances().length!==0,C.setEventedParent(this,{layer:{id:C.id}}),this._layers[C.id]=C;const I=this.getOwnLayerSourceCache(C),B=!!this.directionalLight&&this.directionalLight.shadowsEnabled();I&&C.canCastShadows()&&B&&(I.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new a.z("data",{dataType:"style"}));const b=this.isRootStyle();t.imports?this._loadImports(t.imports,o).then(()=>{this._reloadImports(),this.fire(new a.z(b?"style.load":"style.import.load"))}).catch(T=>{this.fire(new a.y(new Error("Failed to load imports",T))),this.fire(new a.z(b?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new a.z(b?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(p){const g=this._evaluateColorThemeData(p);this._loadColorTheme(g).then(()=>{u()}).catch(y=>{a.w(`Couldn't load color theme from the stylesheet: ${y}`),u()})}else this._styleColorTheme.lut=null,u()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(t=>t.style.hasAppearances())}mergeAll(){let t,o,u,p,g,y,b,T,C,I;const B={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(L=>{if(L.stylesheet){if(L.light!=null&&(t=L.light),L.stylesheet.lights)for(const N of L.stylesheet.lights)N.type==="ambient"&&L.ambientLight!=null&&(o=L.ambientLight),N.type==="directional"&&L.directionalLight!=null&&(u=L.directionalLight);p=this._prioritizeTerrain(p,L.terrain,L.stylesheet.terrain),L.stylesheet.fog&&L.fog!=null&&(g=L.fog),L.stylesheet.snow&&L.snow!=null&&(y=L.snow),L.stylesheet.rain&&L.rain!=null&&(b=L.rain),L.stylesheet.camera!=null&&(I=L.stylesheet.camera),L.stylesheet.projection!=null&&(T=L.stylesheet.projection),L.stylesheet.transition!=null&&(C=L.stylesheet.transition),B[L.scope]=L._styleColorTheme}}),this.light=t,this.ambientLight=o,this.directionalLight=u,this.fog=g,this.snow=y,this.rain=b,this._styleColorThemeForScope=B,p===null?delete this.terrain:this.terrain=p,this.camera=I||{"camera-projection":"perspective"},this.projection=T||{name:"mercator"},this.transition=Object.assign({},Pl,C),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(t){const o=u=>
vendor: 5,871 bytes, line 219
219{for(const p of u.fragments)o(p.style);t(u)};o(this)}_prioritizeTerrain(t,o,u){const p=t&&t.drapeRenderMode===0;return u===null?o&&o.drapeRenderMode===0?o:p?t:null:o!=null&&(!t||p||o&&o.drapeRenderMode===1)?o:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{t=this._prioritizeTerrain(t,o.terrain,o.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(t=o.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},o={},u={};this.forEachFragmentStyle(p=>{for(const g in p._sourceCaches){const y=a.B(g,p.scope);t[y]=p._sourceCaches[g]}for(const g in p._otherSourceCaches){const y=a.B(g,p.scope);o[y]=p._otherSourceCaches[g]}for(const g in p._symbolSourceCaches){const y=a.B(g,p.scope);u[y]=p._symbolSourceCaches[g]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=u}mergeIndoor(){this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const o of Object.values(t.stylesheet.indoor)){const u=o,p=a.B(u.sourceId,t.scope);this._mergedIndoor[p]=new Set(u.sourceLayers||[])}})}mergeLayers(){const t={},o=[],u={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(y=>{for(const b of y._order){const T=y._layers[b];if(T.type==="slot"){const C=a.dq(b);if(t[C])continue;t[C]=[]}T.slot&&t[T.slot]?t[T.slot].push(T):o.push(T)}}),this._mergedOrder=[];let p=-1;const g=(y=[])=>{for(const b of y)if(b.type==="slot"){const T=a.dq(b.id);t[T]&&g(t[T]),this._mergedSlots.push(T)}else{const T=a.B(b.id,b.scope);this._mergedOrder.push(T),u[T]=b,b.is3D(!!this.terrain)&&(this._has3DLayers=!0,p=this._mergedOrder.length-1),b.type==="circle"&&(this._hasCircleLayers=!0),b.type==="symbol"&&(this._hasSymbolLayers=!0),b.type==="clip"&&(this._clipLayerPresent=!0)}};if(g(o),this._has3DLayers){const y={};for(let b=0;b<this._mergedOrder.length;++b){const T=this._mergedOrder[b];y[T]=b===p?1:b<p?u[T].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((b,T)=>y[b]-y[T])}this._mergedLayers=u,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(o,u,p){const g=Object.assign({},u);for(const b of Object.keys(Ms))g[b]===void 0&&(g[b]=Ms[b].default);const y=new a.a8(ja,o,new Map(p));return y.setTransitionOrValue(g,p),y.untransitioned().possiblyEvaluate(new a.ac(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const o=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((u,p)=>{const g="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void u();let y=t;y.startsWith(g)||(y=g+y);const b=a.I.from("mapbox-reserved-lut"),T=new Image;T.src=y,T.onerror=()=>{this._styleColorTheme.lutLoading=!1,p(new Error("Failed to load image data"))},T.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==o)return void u();this._styleColorTheme.lutLoading=!1;const{width:C,height:I,data:B}=a.o.getImageData(T);if(I>32)return void p(new Error("The height of the image must be less than or equal to 32 pixels."));if(C!==I*I)return void p(new Error("The width of the image must be equal to the height squared."));this.getImage(b)&&this.removeImage(b),this.addImage(b,{data:new a.q({width:C,height:I},B),pixelRatio:1,sdf:!1,usvg:!1,version:0});const L=this.imageManager.getImage(b,this.scope);L?(this._styleColorTheme.lut={image:L.data,data:t},u()):p(new Error("Missing LUT image."))}})}getLut(t){const o=this._styleColorThemeForScope[t];return o?o.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=(function(o,u,p){let g,y,b;const T=a.o.devicePixelRatio>1?"@2x":"";let C=a.m(u.transformRequest(u.normalizeSpriteURL(o,T,".json"),a.R.SpriteJSON),(L,N)=>{C=null,b||(b=L,g=N,B())}),I=a.n(u.transformRequest(u.normalizeSpriteURL(o,T,".png"),a.R.SpriteImage),(L,N)=>{I=null,b||(b=L,y=N,B())});function B(){if(b)p(b);else if(g&&y){const L=a.o.getImageData(y),N={};for(const H in g){const{width:j,height:q,x:W,y:ne,sdf:ie,pixelRatio:ee,stretchX:xe,stretchY:me,content:ye}=g[H],de=new a.q({width:j,height:q});a.q.copy(L,de,{x:W,y:ne},{x:0,y:0},{width:j,height:q},null),N[H]={data:de,pixelRatio:ee!==void 0?ee:1,sdf:ie!==void 0&&ie,stretchX:xe,stretchY:me,content:ye,usvg:!1,version:0}}p(null,N)}}return{cancel(){C&&(C.cancel(),C=null),I&&(I.cancel(),I=null)}}})(t,this.map._requestManager,(o,u)=>{if(this._spriteRequest=null,o)this.fire(new a.y(o));else if(u){const p=new Map;for(const g in u)p.set(a.I.from(g),u[g]);this.addImages(p)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))})}
219addIconset(t,o){if(o.type==="sprite")return void this._loadSprite(o.url);const u=this.getOwnSourceCache(o.source);if(!u)return void this.fire(new a.y(new Error(`Source "${o.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const p=u.getSource();if(p.type!=="raster-array")return void this.fire(new a.y(new Error(`Source "${o.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));p.partial=!1;const g=new Zc(t,this.scope,u);this.imageManager.addImageProvider(g,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!a.h(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const o=this.map._spriteFormat==="auto";var u,p;this._spriteRequest=(p=(g,y)=>{if(this._spriteRequest=null,g)o?this._loadSprite(t):this.fire(new a.y(g));else if(y){const b=new Map;for(const T in y)b.set(a.I.from(T),y[T]);this.addImages(b)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))},a.bu((u=this.map._requestManager).transformRequest(u.normalizeIconsetURL(t),a.R.Iconset),(g,y)=>{if(g)return void p(g);const b={},T=a.dg(new a.bt(y));for(const C of T.icons){const I={version:1,pixelRatio:a.o.devicePixelRatio,content:yp(C),stretchX:C.metadata?xp(C.metadata.stretch_x_areas):void 0,stretchY:C.metadata?xp(C.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:C};b[C.name]=I}p(null,b)}))}_validateLayer(t){const o=this.getOwnSource(t.source);if(!o)return;const u=t.sourceLayer;u&&(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(u)===-1)&&this.fire(new a.y(new Error(`Source layer "${u}" does not exist on source "${o.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,o)=>{const u=this.fragments[o];return u&&u.style&&(t.data=u.style.serialize()),t})}_serializeSources(){const t={};for(const o in this._sourceCaches){const u=this._sourceCaches[o].getSource();t[u.id]||(t[u.id]=u.serialize())}return t}_serializeLayers(t){const o=[];for(const u of t){const p=this._layers[u];p&&p.type!=="custom"&&o.push(p.serialize())}return o}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];if(o._transitionablePaint&&o._transitionablePaint._values){const u=o._transitionablePaint._values["line-emissive-strength"];if(u&&u.value&&u.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const o=this.getOwnLayer(t);if(o)return o;this.fire(new a.y(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const o=this.getOwnSource(t);if(o)return o;this.fire(new a.y(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,o){const u=this.map.painter;if(u)for(let p=t.minzoom||0;p<(t.maxzoom||25.5);p++){const g=t.getProgramIds();if(g)for(const y of g){const b=t.getDefaultProgramParams(y,o.zoom,this._styleColorTheme.lut);b&&(u.style=this,this.fog&&(u._fogVisible=!0,b.overrideFog=!0,u.getOrCreateProgram(y,b)),u._fogVisible=!1,b.overrideFog=!1,u.getOrCreateProgram(y,b),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(b.overrideRtt=!0,u.getOrCreateProgram(y,b)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const o=this.calculateLightsBrightness();t.brightness=o||0,o!==this._brightness&&(this._brightness=o,this.dispatcher.broadcast("setBrightness",o)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const u=this._changes.isDirty();let p=!1;if(this._changes.isDirty()){const b=this._changes.getLayerUpdatesByScope();for(const T in b){const{updatedIds:C,removedIds:I}=b[T];(C||I)&&(this._updateWorkerLayers(T,C,I),p=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const g={};for(const b in this._mergedSourceCaches){const T=this._mergedSourceCaches[b];
219g[b]=T.used,T.used=!1,T.tileCoverLift=0}for(const b of this._mergedOrder){const T=this._mergedLayers[b];if(T.visibility!=="none"&&T.recalculate(t,this._availableImages),!T.isHidden(t.zoom)){const C=this.getLayerSourceCache(T);C&&(C.used=!0,C.tileCoverLift=Math.max(C.tileCoverLift,T.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(T,t)}):this.precompilePrograms(T,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&p&&this.mergeLayers();const y=this.imageManager.getPendingImageProviders();for(const b of y)b.sourceCache.used=!0;for(const b in g){const T=this._mergedSourceCaches[b];g[b]!==T.used&&T.getSource().fire(new a.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),u&&this.fire(new a.z("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const o of t){const u=o.resolvePendingRequests(),p=this.getFragmentStyle(o.scope);p&&p.addImages(u)}}_updateTilesForChangedImages(){const t={};for(const o in this._mergedSourceCaches){const u=this._mergedSourceCaches[o].getSource().scope;t[u]=t[u]||this._changes.getUpdatedImages(u),t[u].length!==0&&this._mergedSourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t[u])}for(const o in t)this._changes.resetUpdatedImages(o)}_updateWorkerLayers(t,o,u){const p=this.getFragmentStyle(t);p&&this.dispatcher.broadcast("updateLayers",{layers:o?p._serializeLayers(o):[],scope:t,removedIds:u||[],options:p.options})}setState(t,o){if(this._checkLoaded(),il(this,gr(t)))return!1;(t=a.dp(t)).layers=Yd(t.layers);const u=(function(y,b){if(!y)return[{command:en.setStyle,args:[b]}];let T=[];try{if(!a.by(y.version,b.version))return[{command:en.setStyle,args:[b]}];if(a.by(y.center,b.center)||T.push({command:en.setCenter,args:[b.center]}),a.by(y.zoom,b.zoom)||T.push({command:en.setZoom,args:[b.zoom]}),a.by(y.bearing,b.bearing)||T.push({command:en.setBearing,args:[b.bearing]}),a.by(y.pitch,b.pitch)||T.push({command:en.setPitch,args:[b.pitch]}),a.by(y.sprite,b.sprite)||T.push({command:en.setSprite,args:[b.sprite]}),a.by(y.glyphs,b.glyphs)||T.push({command:en.setGlyphs,args:[b.glyphs]}),a.by(y.imports,b.imports)||(function(N=[],H=[],j){H=H||[];const q=(N=N||[]).map(cs),W=H.map(cs),ne=N.reduce(qh,{}),ie=H.reduce(qh,{}),ee=q.slice();let xe,me,ye,de;for(xe=0,me=0;xe<q.length;xe++)ye=q[xe],ie.hasOwnProperty(ye)?me++:(j.push({command:en.removeImport,args:[ye]}),ee.splice(ee.indexOf(ye,me),1));for(xe=0,me=0;xe<W.length;xe++)ye=W[W.length-1-xe],ee[ee.length-1-xe]!==ye&&(ne.hasOwnProperty(ye)?(j.push({command:en.removeImport,args:[ye]}),ee.splice(ee.lastIndexOf(ye,ee.length-me),1)):me++,de=ee[ee.length-xe],j.push({command:en.addImport,args:[ie[ye],de]}),ee.splice(ee.length-xe,0,ye));for(const se of H){const Te=ne[se.id];Te&&(delete Te.data,a.by(Te,se)||j.push({command:en.updateImport,args:[se.id,se]}))}})(y.imports,b.imports,T),a.by(y.transition,b.transition)||T.push({command:en.setTransition,args:[b.transition]}),a.by(y.light,b.light)||T.push({command:en.setLight,args:[b.light]}),a.by(y.fog,b.fog)||T.push({command:en.setFog,args:[b.fog]}),a.by(y.snow,b.snow)||T.push({command:en.setSnow,args:[b.snow]}),a.by(y.rain,b.rain)||T.push({command:en.setRain,args:[b.rain]}),a.by(y.projection,b.projection)||T.push({command:en.setProjection,args:[b.projection]}),a.by(y.lights,b.lights)||T.push({command:en.setLights,args:[b.lights]}),a.by(y.camera,b.camera)||T.push({command:en.setCamera,args:[b.camera]}),a.by(y.iconsets,b.iconsets)||(function(N,H,j){let q;for(q in H=H||{},N=N||{})N.hasOwnProperty(q)&&(H.hasOwnProperty(q)||j.push({command:en.removeIconset,args:[q]}));for(q in H){if(!H.hasOwnProperty(q))continue;const W=H[q];N.hasOwnProperty(q)?a.by(N[q],W)||(j.push({command:en.removeIconset,args:[q]}),j.push({command:en.addIconset,args:[q,W]})):j.push({command:en.addIconset,args:[q,W]})}})(y.iconsets,b.iconsets,T),!a.by(y["color-theme"],b["color-theme"]))return[{command:en.setStyle,args:[b]}];const C={},I=[];(function(N,H,j,q){let W;for(W in H=H||{},N=N||{})N.hasOwnProperty(W)&&(H.hasOwnProperty(W)||Hh(W,j,q));for(W in H){if(!H.hasOwnProperty(W))continue;const ne=H[W];N.hasOwnProperty(W)?a.by(N[W],ne)||(N[W].type==="geojson"&&ne.type==="geojson"&&sc(N,H,W)?j.push({command:en.setGeoJSONSourceData,args:[W,ne.data]}):sa(W,H,j,q)):Cl(W,H,j)}})(y.sources,b.sources,I,C);const B=[];
219y.layers&&y.layers.forEach(N=>{N.source&&C[N.source]?T.push({command:en.removeLayer,args:[N.id]}):B.push(N)});let L=y.terrain;L&&C[L.source]&&(T.push({command:en.setTerrain,args:[void 0]}),L=void 0),T=T.concat(I),a.by(L,b.terrain)||T.push({command:en.setTerrain,args:[b.terrain]}),(function(N,H,j){H=H||[];const q=(N=N||[]).map(cs),W=H.map(cs),ne=N.reduce(qh,{}),ie=H.reduce(qh,{}),ee=q.slice(),xe=Object.create(null);let me,ye,de,se,Te,Ae,Re;for(me=0,ye=0;me<q.length;me++)de=q[me],ie.hasOwnProperty(de)?ye++:(j.push({command:en.removeLayer,args:[de]}),ee.splice(ee.indexOf(de,ye),1));for(me=0,ye=0;me<W.length;me++)de=W[W.length-1-me],ee[ee.length-1-me]!==de&&(ne.hasOwnProperty(de)?(j.push({command:en.removeLayer,args:[de]}),ee.splice(ee.lastIndexOf(de,ee.length-ye),1)):ye++,Ae=ee[ee.length-me],j.push({command:en.addLayer,args:[ie[de],Ae]}),ee.splice(ee.length-me,0,de),xe[de]=!0);for(me=0;me<W.length;me++)if(de=W[me],se=ne[de],Te=ie[de],!xe[de]&&!a.by(se,Te))if(a.by(se.source,Te.source)&&a.by(se["source-layer"],Te["source-layer"])&&a.by(se.type,Te.type)){for(Re in lc(se.layout,Te.layout,j,de,null,en.setLayoutProperty),lc(se.paint,Te.paint,j,de,null,en.setPaintProperty),a.by(se.slot,Te.slot)||j.push({command:en.setSlot,args:[de,Te.slot]}),a.by(se.filter,Te.filter)||j.push({command:en.setFilter,args:[de,Te.filter]}),a.by(se.minzoom,Te.minzoom)&&a.by(se.maxzoom,Te.maxzoom)||j.push({command:en.setLayerZoomRange,args:[de,Te.minzoom,Te.maxzoom]}),se)se.hasOwnProperty(Re)&&Re!=="layout"&&Re!=="paint"&&Re!=="filter"&&Re!=="metadata"&&Re!=="minzoom"&&Re!=="maxzoom"&&Re!=="slot"&&(Re.indexOf("paint.")===0?lc(se[Re],Te[Re],j,de,Re.slice(6),en.setPaintProperty):a.by(se[Re],Te[Re])||j.push({command:en.setLayerProperty,args:[de,Re,Te[Re]]}));for(Re in Te)Te.hasOwnProperty(Re)&&!se.hasOwnProperty(Re)&&Re!=="layout"&&Re!=="paint"&&Re!=="filter"&&Re!=="metadata"&&Re!=="minzoom"&&Re!=="maxzoom"&&Re!=="slot"&&(Re.indexOf("paint.")===0?lc(se[Re],Te[Re],j,de,Re.slice(6),en.setPaintProperty):a.by(se[Re],Te[Re])||j.push({command:en.setLayerProperty,args:[de,Re,Te[Re]]}))}else j.push({command:en.removeLayer,args:[de]}),Ae=ee[ee.lastIndexOf(de)+1],j.push({command:en.addLayer,args:[Te,Ae]})})(B,b.layers,T)}catch(C){console.warn("Unable to compute style diff:",C),T=[{command:en.setStyle,args:[b]}]}return T})(this.serialize(),t).filter(y=>!(y.command in Pm));if(u.length===0)return!1;const p=u.filter(y=>!(y.command in Dm));if(p.length>0)throw new Error(`Unimplemented: ${p.map(y=>y.command).join(", ")}.`);const g=[];return u.forEach(y=>{g.push(this[y.command](...y.args))}),o&&Promise.all(g).then(o).catch(o),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[o,u]of t.entries()){if(this.getImage(o))return this.fire(new a.y(new Error(`An image with the name "${o.name}" already exists.`)));this.imageManager.addImage(o,this.scope,u),this._changes.updateImage(o,this.scope)}return this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this}addImage(t,o){return this.getImage(t)?this.fire(new a.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,o),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this)}updateImage(t,o,u=!1){this.imageManager.updateImage(t,this.scope,o),u&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new a.z("data",{dataType:"style"})),this}addModel(t,o,u={}
vendor: 9,883 bytes, line 219
219){return this._checkLoaded(),this._validate(we,`models.${t}`,o,null,u)||(this.modelManager.addModel(t,o,this.getActualScope()),this.fire(new a.z("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,o,u={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(Ks,`sources.${t}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const p=os(t,o,this.dispatcher,this);p.scope=this.scope,p.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(p.id),source:p.serialize(),sourceId:p.id}));const g=y=>{const b=(y?"symbol:":"other:")+p.id,T=a.B(b,this.scope),C=this._sourceCaches[b]=new Nr(T,p,y);(y?this._symbolSourceCaches:this._otherSourceCaches)[p.id]=C,C.onAdd(this.map)};g(!1),o.type!=="vector"&&o.type!=="geojson"||g(!0),p.onAdd&&p.onAdd(this.map),u.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const o=this.getOwnSource(t);if(!o)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new a.y(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new a.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const p=Object.entries(this.stylesheet.iconsets).find(([g,y])=>y.type==="source"&&y.source===t);if(p)return this.fire(new a.y(new Error(`Source "${t}" cannot be removed while iconset "${p[0]}" is using it.`)))}const u=this.getOwnSourceCaches(t);for(const p of u){const g=a.dq(p.id);delete this._sourceCaches[g],this._changes.discardSourceCacheUpdate(p.id),p.fire(new a.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:p.getSource().id})),p.setEventedParent(null),p.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,o){this._checkLoaded(),this.getOwnSource(t).setData(o),this._changes.setDirty()}getOwnSource(t){const o=this.getOwnSourceCache(t);return o&&o.getSource()}getOwnSources(){const t=[];for(const o in this._otherSourceCaches){const u=this.getOwnSourceCache(o);u&&t.push(u.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const o in t){const u=t[o]._tiles;for(const p in u){const g=u[p];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();for(const g of t){if(this._validate(_t,"lights",g))return;switch(g.type){case"ambient":if(this.ambientLight){const y=this.ambientLight;y.set(g),y.updateTransitions(o)}else this.ambientLight=new Ji(g,Hn(),this.scope,this.options);break;case"directional":if(this.directionalLight){const y=this.directionalLight;y.set(g),y.updateTransitions(o)}else this.directionalLight=new Ji(g,wn(),this.scope,this.options)}}const u=Object.assign(o,{worldview:this.map.getWorldview()}),p=new a.ac(this.z||0,u);this.ambientLight&&this.ambientLight.recalculate(p),this.directionalLight&&this.directionalLight.recalculate(p),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,o=this.ambientLight;if(!t||!o)return;const u=L=>.2126*(L[0]<=.03928?L[0]/12.92:Math.pow((L[0]+.055)/1.055,2.4))+.7152*(L[1]<=.03928?L[1]/12.92:Math.pow((L[1]+.055)/1.055,2.4))+.0722*(L[2]<=.03928?L[2]/12.92:Math.pow((L[2]+.055)/1.055,2.4)),p=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),g=t.properties.get("intensity"),y=t.properties.get("direction"),b=1-a.d4(y.x,y.y,y.z)[2]/90,T=u(p)*g*b,C=o.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),I=o.properties.get("intensity"),B=u(C)*I;return Number(((T+B)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(a.dr(t)){const o=a.ds(t),u=this.fragments.find(({id:g})=>g===o);if(!u)return;const p=a.dq(t);return u.style.getFragmentStyle(p)}{const o=this.fragments.find(({id:u})=>u===t);return o?o.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const o={},u=(p,g="")=>`${p}::${g}`;this._featuresetSelectors={};for(const p in t){const g=this._featuresetSelectors[p]=[];for(const y of t[p].selectors){if(y.featureNamespace){const T=this.getOwnLayer(y.layer);if(!T){a.w(`Layer is undefined for selector: ${y.layer}`);continue}const C=u(T.source,T.sourceLayer);if(C in o&&o[C]!==y.featureNamespace){a.w(`"featureNamespace ${y.featureNamespace} of featureset ${p}'s selector is not associated to the same source, skip this selector`);continue}o[C]=y.featureNamespace}let b;if(y.properties)for(const T in y.properties){const C=a.U(y.properties[T]);C.result==="success"&&(b=b||{},b[T]=C.value)}g.push({layerId:y.layer,namespace:y.featureNamespace,properties:b,uniqueFeatureID:y._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const o=this.getFragmentStyle(t);if(!o||!o.stylesheet.featuresets)return[];const u=[];for(const p in o.stylesheet.featuresets)u.push({featuresetId:p,importId:o.scope?o.scope:void 0});return u}getFeaturesetLayers(t,o){const u=this.getFragmentStyle(o),p=u.stylesheet.featuresets;if(!p||!p[t])return this.fire(new a.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const g=[];for(const y of p[t].selectors){const b=u.getOwnLayer(y.layer);b&&g.push(b)}return g}getConfigProperty(t,o){const u=this.getFragmentStyle(t);if(!u)return null;const p=a.B(o,u.scope),g=u.options.get(p),y=g?g.value||g.default:null;return y?y.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,o){const u=a.B(t,o);return this._mergedIndoor[u]}setIndoorData(t,o){this.indoorManager.setIndoorData(o)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,o,u){const p=this.getFragmentStyle(t);if(!p)return;const g=p.stylesheet.schema;if(!g||!g[o])return;const y=a.U(u);if(y.result!=="success")return void il(this,y.value);const b=y.value.expression,T=a.B(o,p.scope),C=p.options.get(T);if(!C)return;let I;const{minValue:B,maxValue:L,stepValue:N,type:H,values:j}=g[o],q=a.U(g[o].default);q.result==="success"&&(I=q.value.expression),I?(this.options.set(T,Object.assign({},C,{value:b,default:I,minValue:B,maxValue:L,stepValue:N,type:H,values:j})),this.updateConfigDependencies(o)):this.fire(new a.y(new Error(`No schema defined for the config option "${o}" in the "${t}" fragment.`)))}getConfig(t){const o=this.getFragmentStyle(t);if(!o)return null;const u=o.stylesheet.schema;if(!u)return null;const p={};for(const g in u){const y=a.B(g,o.scope),b=o.options.get(y),T=b?b.value||b.default:null;p[g]=T?T.serialize():null}return p}setConfig(t,o){const u=this.getFragmentStyle(t);u&&(u.updateConfig(o,u.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const o=this.getFragmentStyle(t);return o?o.stylesheet.schema:null}setSchema(t,o){const u=this.getFragmentStyle(t);u&&(u.stylesheet.schema=o,u.updateConfig(u._config,o),this.updateConfigDependencies())}updateConfig(t,o){if(this._config=t,t||o)if(o)for(const u in o){let p,g;const y=a.U(o[u].default);if(y.result==="success"&&(p=y.value.expression),t&&t[u]!==void 0){const L=a.U(t[u]);L.result==="success"&&(g=L.value.expression)}const{minValue:b,maxValue:T,stepValue:C,type:I,values:B}=o[u];if(p){const L=a.B(u,this.scope);this.options.set(L,{default:p,value:g,minValue:b,maxValue:T,stepValue:C,type:I,values:B})}else this.fire(new a.y(new Error(`No schema defined for config option "${u}".`)))}else this.fire(new a.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t,o=()=>!0){for(const u of t){const p=this.getLayer(u);p&&o(p)&&(p.possiblyEvaluateVisibility(),this._updateLayer(p),this._changes.setDirty())}}updateConfigDependencies(t){this._updateLayers(this._configDependentLayers,o=>!t||o.expressionDependencies.configDependencies.has(t)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(o=>{const u=o._styleColorTheme.colorThemeOverride?o._styleColorTheme.colorThemeOverride:o._styleColorTheme.colorTheme;if(u){const p=o._evaluateColorThemeData(u);(!o._styleColorTheme.lut&&p!==""||o._styleColorTheme.lut&&p!==o._styleColorTheme.lut.data)&&o.setColorTheme(u)}}),this._changes.setDirty()}addLayer(t,o,u={}){this._checkLoaded();const p=t.id;if(this._layers[p])return void this.fire(new a.y(new Error(`Layer with i
219d "${p}" already exists on this map`)));let g;if(t.type==="custom"){if(il(this,a.dt(t)))return;g=a.du(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(p,t.source),t=a.dp(t),t=Object.assign(t,{source:p})),this._validate(De,`layers.${p}`,t,{arrayIndex:-1},u))return;g=a.du(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(g),g.setEventedParent(this,{layer:{id:p}})}const y=a.B(g.source,g.scope);g.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(y),g.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(y);let b=this._order.length;if(o){const B=this._order.indexOf(o);if(B===-1)return void this.fire(new a.y(new Error(`Layer with id "${o}" does not exist on this map.`)));g.slot&&g.slot!==this._layers[o].slot?a.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):b=B}this._order.splice(b,0,p),this._handleLayerOrderChange(),this._layers[p]=g;const T=this.getOwnLayerSourceCache(g),C=!!this.directionalLight&&this.directionalLight.shadowsEnabled();T&&g.canCastShadows()&&C&&(T.castsShadows=!0);const I=this._changes.getRemovedLayer(g);if(I&&g.source&&T&&g.type!=="custom"){this._changes.discardLayerRemoval(g);const B=a.B(g.source,g.scope);I.type!==g.type?this._changes.updateSourceCache(B,"clear"):(this._changes.updateSourceCache(B,"reload"),T.pause())}this._updateLayer(g),g.onAdd&&g.onAdd(this.map),g.scope=this.scope,this.mergeLayers()}moveLayer(t,o){this._checkLoaded();const u=this._checkLayer(t);if(!u||t===o)return;const p=this._order.indexOf(t);this._order.splice(p,1);let g=this._order.length;if(o){const y=this._order.indexOf(o);
219if(y===-1)return void this.fire(new a.y(new Error(`Layer with id "${o}" does not exist on this map.`)));u.slot&&u.slot!==this._layers[o].slot?a.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):g=y}this._order.splice(g,0,t),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(t){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;o.setEventedParent(null);const u=this._order.indexOf(t);this._order.splice(u,1),delete this._layers[t],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(o.fqid),this._indoorDependentLayers.delete(o.fqid),this._changes.removeLayer(o);const p=this.getOwnLayerSourceCache(o);if(p&&p.castsShadows){let g=!1;for(const y in this._layers)if(this._layers[y].source===o.source&&this._layers[y].canCastShadows()){g=!0;break}p.castsShadows=g}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const o in this._layers)if(this._layers[o].type===t)return!0;return!1}setLayerZoomRange(t,o,u){this._checkLoaded();const p=this._checkLayer(t);p&&(p.minzoom===o&&p.maxzoom===u||(o!=null&&(p.minzoom=o),u!=null&&(p.maxzoom=u),this._updateLayer(p)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,o){this._checkLoaded();const u=this._checkLayer(t);u&&u.slot!==o&&(u.slot=o,this._updateLayer(u))}setFilter(t,o,u={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!a.by(p.filter,o))return o==null?(p.filter=void 0,void this._updateLayer(p)):void(this._validate($,`layers.${p.id}.filter`,o,{layerType:p.type},u)||(p.filter=a.dp(o),this._updateLayer(p)))}getFilter(t){const o=this._checkLayer(t);if(o)return a.dp(o.filter)}setLayoutProperty(t,o,u,p={}){this._checkLoaded();const g=this._checkLayer(t);if(g&&!a.by(g.getLayoutProperty(o),u)){if(u!=null&&(!p||p.validate!==!1)&&il(g,ce.call(gr,{key:`layers.${t}.layout.${o}`,layerType:g.type,objectKey:o,value:u,styleSpec:a.a6,style:{glyphs:!0,sprite:!0}})))return;g.setLayoutProperty(o,u),g.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(g.fqid),g.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(g.fqid),this._updateLayer(g)}}setLayerProperty(t,o,u,p={}){this._checkLoaded();const g=this._checkLayer(t);g&&(o==="appearances"?(g.setAppearances(u),this._changes.setDirty()):g.isPaintProperty(o)?this.setPaintProperty(t,o,u,p):this.setLayoutProperty(t,o,u,p))}getLayoutProperty(t,o){const u=this._checkLayer(t);if(u)return u.getLayoutProperty(o)}setPaintProperty(t,o,u,p={}){this._checkLoaded();const g=this._checkLayer(t);if(!g||a.by(g.getPaintProperty(o),u)||u!=null&&(!p||p.validate!==!1)&&il(g,K.call(gr,{key:`layers.${t}.paint.${o}`,layerType:g.type,objectKey:o,value:u,styleSpec:a.a6})))return;const y=g.setPaintProperty(o,u);g.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(g.fqid),g.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(g.fqid),y&&this._updateLayer(g),this._changes.updatePaintProperties(g)}getPaintProperty(t,o){const u=this._checkLayer(t);if(u)return u.getPaintProperty(o)}setFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:T,importId:C}=t.target,I=this.getFragmentStyle(C),B=I.getFeaturesetLayers(T);for(const{source:L,sourceLayer:N}of B)I.setFeatureState({id:t.id,source:L,sourceLayer:N},o)}else if("layerId"in t.target){const{layerId:T}=t.target,C=this.getLayer(T);this.setFeatureState({id:t.id,source:C.source,sourceLayer:C.sourceLayer},o)}return}const u=t.source,p=t.sourceLayer,g=this._checkSource(u);if(!g)return;const y=g.type;if(y==="geojson"&&p)return void this.fire(new a.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(y==="vector"&&!p)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided.")));const b=this.getOwnSourceCaches(u);for(const T of b)T.setFeatureState(p,t.id,o)}removeFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:T,importId:C}=t.target,I=this.getFragmentStyle(C),B=I.getFeaturesetLayers(T);for(const{source:L,sourceLayer:N}of B)I.removeFeatureState({id:t.id,source:L,sourceLayer:N},o)}else if("layerId"in t.target){const{layerId:T}=t.target,C=this.getLayer(T);this.removeFeatureState({id:t.id,source:C.source,sourceLayer:C.sourceLayer},o)}return}const u=t.source,p=this._checkSource(u);if(!p)return;const g=p.type,y=g==="vector"?t.sourceLayer:void 0;if(g==="vector"&&!y)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new a.y(new Error("A feature id is required to remove its specific state property.")));const b=this.getOwnSourceCaches(u);for(const T of b)T.removeFeatureState(y,t.id,o)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let g;if("featuresetId"in t.target){const{featuresetId:y,importId:b}=t.target,T=this.getFragmentStyle(b),C=T.getFeaturesetLayers(y);for(const{source:I,sourceLayer:B}of C){const L=T.getFeatureState({id:t.id,source:I,sourceLayer:B});if(L&&!g)g=L;else if(!a.by(g,L))return void this.fire(new a.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:y}=t.target,b=this.getLayer(y);
vendor: 19,509 bytes, line 219
219g=this.getFeatureState({id:t.id,source:b.source,sourceLayer:b.sourceLayer})}return g}const o=t.source,u=t.sourceLayer,p=this._checkSource(o);if(p){if(p.type!=="vector"||u)return t.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(u,t.id);this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),o=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return a.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:o,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},u=>u!==void 0)}_updateFilteredLayers(t){for(const o of Object.values(this._mergedLayers))t(o)&&this._updateLayer(o)}_updateLayer(t){this._changes.updateLayer(t);const o=this.getLayerSourceCache(t),u=a.B(t.source,t.scope),p=this._changes.getUpdatedSourceCaches();t.source&&!p[u]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(u,"reload"),o.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const o=b=>this._mergedLayers[b].is3D(!!this.terrain),u=this.order,p={},g=[];for(let b=u.length-1;b>=0;b--){const T=u[b];if(o(T)){p[T]=b;for(const C of t){const I=C[T];if(I)for(const B of I)g.push(B)}}}g.sort((b,T)=>T.intersectionZ-b.intersectionZ);const y=[];for(let b=u.length-1;b>=0;b--){const T=u[b];if(o(T))for(let C=g.length-1;C>=0;C--){const I=g[C].feature;if(I.layer&&p[I.layer.id]<b)break;y.push(I),g.pop()}else for(const C of t){const I=C[T];if(I)for(const B of I)y.push(B.feature)}}return y}queryRasterValue(t,o,u){const p=this.getOwnSource(t);return p?p.type!=="raster-array"?(this.fire(new a.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):p.queryRasterArrayValue(o,u):(this.fire(new a.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,o,u){let p;o&&!Array.isArray(o)&&o.filter&&(this._validate($,"queryRenderedFeatures.filter",o.filter,null,o),p=a.b6(o.filter));const g={},y=I=>{if(af.has(I.type))return;const B=this.getOwnLayerSourceCache(I),L=g[B.id]=g[B.id]||{sourceCache:B,layers:{},has3DLayers:!1};I.is3D(!!this.terrain)&&(L.has3DLayers=!0),L.layers[I.fqid]=L.layers[I.fqid]||{styleLayer:I,targets:[]},L.layers[I.fqid].targets.push({filter:p})};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new a.y(new Error("parameters.layers must be an Array."))),[];for(const I of o.layers){const B=this._layers[I];if(!B)return this.fire(new a.y(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];y(B)}}else for(const I in this._layers)y(this._layers[I]);const b=this._queryRenderedFeatures(t,g,u),T=this._flattenAndSortRenderedFeatures(b),C=[];for(const I of T)a.dw(I.layer.id)===this.scope&&C.push(I);return C}queryRenderedFeatureset(t,o,u){let p;o&&!Array.isArray(o)&&o.filter&&(this._validate($,"queryRenderedFeatures.filter",o.filter,null,o),p=a.b6(o.filter));const g="mock",y=[];if(o&&o.target)y.push(Object.assign({},o,{targetId:g,filter:p}));else{const I=this.getFeaturesetDescriptors();for(const B of I)y.push({targetId:g,filter:p,target:B});for(const{style:B}of this.fragments){const L=B.getFeaturesetDescriptors();for(const N of L)y.push({targetId:g,filter:p,target:N})}}const b=this.queryRenderedTargets(t,y,u),T=[],C=new Set;for(const I of b)for(const B of I.variants[g])Lu(B,I,C)||T.push(new a.dx(I,B));return T}queryRenderedTargets(t,o,u){const p={},g=(b,T,C,I)=>{const B=p[T.id]=p[T.id]||{sourceCache:T,layers:{},has3DLayers:!1};if(B.layers[b.fqid]=B.layers[b.fqid]||{styleLayer:b,targets:[]},b.is3D(!!this.terrain)&&(B.has3DLayers=!0),!I)return C.uniqueFeatureID=!1,void B.layers[b.fqid].targets.push(C);B.layers[b.fqid].targets.push(Object.assign({},C,{namespace:I.namespace,properties:I.properties,uniqueFeatureID:I.uniqueFeatureID}))};for(const b of o)if("featuresetId"in b.target){const{featuresetId:T,importId:C}=b.target,I=this.getFragmentStyle(C);if(!I||!I._featuresetSelectors)continue;const B=I._featuresetSelectors[T];if(!B){this.fire(new a.y(new Error(`The featureset '${T}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const L of B){const N=I.getOwnLayer(L.layerId);N&&!af.has(N.type)&&g(N,I.getOwnLayerSourceCache(N),b,L)}}else if("layerId"in b.target){const{layerId:T}=b.target,C=this.getLayer(T);if(!C||af.has(C.type))continue;g(C,this.getLayerSourceCache(C),b)}const y=this._queryRenderedFeatures(t,p,u);return this._flattenAndSortRenderedFeatures(y)}_queryRenderedFeatures(t,o,u){const p=[],g=!!this.map._showQueryGeometry,y=zn.createFromScreenPoints(t,u);for(const b in o){const T=Js(y,o[b],this._availableImages,u,g,this.getActualScope());Object.keys(T).length&&p.push(T)}if(this.placement)for(const b in o){if(!o[b].sourceCache._onlySymbols)continue;const T=Em(y.screenGeometry,o[b],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(T).length&&p.push(T)}return p}querySourceFeatures(t,o){const u=o&&o.filter;u&&this._validate($,"querySourceFeatures.filter",u,null,o);let p=[];const g=this.getOwnSourceCaches(t);for(const y of g)p=p.concat(lp(y,o));return p}addSourceType(t,o,u){return ea.getSourceType(t)?u(new Error(`A source type called "${t}" already exists.`)):(ea.setSourceType(t,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:o.workerSourceURL},u):u(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,o,u={}){this._checkLoaded();const p=this.light.getLight();let g=!1;for(const b in t)if(!a.by(t[b],p[b])){g=!0;break}if(!g)return;const y=this._getTransitionParameters();this.light.setLight(t,o,u),this.light.updateTransitions(y)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=a.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,o=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),o===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let u=t;const p=!("source"in t)||t.source==null;if(o===1){if(this.disableElevatedTerrain)return;if("source"in u&&typeof u.source=="object"){const b="terrain-dem-src";this.addSource(b,u.source),u=a.dp(u),u=Object.assign(u,{source:b})}const g=Object.assign({},u),y={};if(this.terrain&&p){g.source=this.terrain.get().source;const b=this.terrain?this.getFragmentStyle(this.terrain.scope):null;b&&(y.style=b.serialize())}if(this._validate(aa,"terrain",g,y))return}if(!this.terrain||this.terrain.scope!==this.scope&&!p||this.terrain&&o!==this.terrain.drapeRenderMode){if(!u)return;this._createTerrain(u,o),this.fire(new a.z("data",{dataType:"style"}))}else{const g=this.terrain,y=g.get();for(const b of Object.keys(a.a6.terrain))!u.hasOwnProperty(b)&&a.a6.terrain[b].default&&(u[b]=a.a6.terrain[b].default);for(const b in t)if(!a.by(t[b],y[b])){g.set(t,this.options),this.stylesheet.terrain=t;const T=this._getTransitionParameters({duration:0});g.updateTransitions(T),this.fire(new a.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const o=this.fog=new vi(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_createSnow(t){const o=this.snow=new dr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_createRain(t){const o=this.rain=new Un(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const o=this.fog;if(!a.by(o.get(),t)){o.set(t,this.options),this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const o=this.snow;if(!a.by(o.get(),t)){o.set(t,this.options),this.stylesheet.snow=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const o=this.rain;if(!a.by(o.get(),t)){o.set(t,this.options),this.stylesheet.rain=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const p in this._layers)this._layers[p].lut=this._styleColorTheme.lut;for(const p in this._sourceCaches)this._sourceCaches[p].clearTiles()},o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!o)return this._styleColorTheme.lut=null,void t();const u=this._evaluateColorThemeData(o);this._loadColorTheme(u).then(()=>{this.fire(new a.z("colorthemeset")),t()}).catch(p=>{a.w(`Couldn't set color theme: ${p}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&a.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,o){const u=this.getFragmentStyle(t);u&&(u._styleColorTheme.colorThemeOverride=o,u._reloadColorTheme())}_getTransitionParameters(t){return{now:a.o.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],o=[];for(const u of this._mergedOrder)this.isLayerDraped(this._mergedLayers[u])?t.push(u):o.push(u);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...o)}_createTerrain(t,o){const u=this.terrain=new yt(t,o,this.scope,this.options,this.map.getWorldview());o===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const p=this._getTransitionParameters({duration:0});u.updateTransitions(p)}_force3DLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="symbol"&&this._updateLayer(o)}}_validate(t,o,u,p,g={}){if(g&&g.validate===!1)return!1;const y=Object.assign({},this.serialize());return il(this,t.call(gr,Object.assign({key:o,style:y,value:u,styleSpec:a.a6},p)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const o=this.getSourceCaches(t);for(const u of o)u.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];o._clear&&o._clear()}}reloadSource(t){const o=this.getSourceCaches(t);for(const u of o)u.resume(),u.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let o;this.directionalLight&&(o=nf(this.directionalLight));const u=new Set,p=new Set;for(const g in this._mergedLayers){const y=this._mergedLayers[g];y.type==="building"&&u.add(y.source),y.hasElevation()&&!p.has(y.source)&&p.add(y.source)}for(const g in this._mergedSourceCaches){const y=this._mergedSourceCaches[g],b=p.has(y._source.id);u.has(y._source.id)&&(y._source.reparseOverscaled=!1),y.update(t,void 0,void 0,o,b)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const o=this._sourceCaches[t];o.resume(),o.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new a.z("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new gp),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(t,o,u,p,g){this.pauseablePlacement||(this.pauseablePlacement=new gp);let y=!1,b=!1;const T={},C={};for(const j of this._mergedOrder){const q=this._mergedLayers[j];if(q.type!=="symbol")continue;const W=a.B(q.source,q.scope);let ne=T[W];if(!ne){const ee=this.getLayerSourceCache(q);if(!ee)continue;const xe=ee.getRenderableIds(!0).map(me=>ee.getTileByID(me));C[W]=xe.slice(),ne=T[W]=xe.sort((me,ye)=>ye.tileID.overscaledZ-me.tileID.overscaledZ||(me.tileID.isLessThan(ye.tileID)?-1:1))}const ie=this.crossTileSymbolIndex.addLayer(q,ne,t.center.lng,t.projection);y=y||ie}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const I=!!(this.placement&&!t.equals(this.placement.transform)),B=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!g||this.placement.lastReplacementSourceUpdateTime!==g.updateTime)),L=I||B||y,N=(L||this.pauseablePlacement.isStale())&&u===0,H=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.o.now(),t.zoom)&&u!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||N||H)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(t,this._mergedOrder,o,u,p,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex)),this.pauseablePlacement.isDone()?L&&u!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,T,C,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.o.now()),b=!0),y&&this.pauseablePlacement.setStale()),b||y){this._buildingIndex.onNewFrame(t.zoom);for(let j=0;j<this._mergedOrder.length;j++){const q=this._mergedLayers[this._mergedOrder[j]];if(q.type!=="symbol"||q.visibility==="none")continue;const W=this.isLayerClipped(q);this.placement.updateLayerOpacities(q,T[a.B(q.source,q.scope)],j,W?g:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(a.o.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,o){this._checkLoaded();const u=this.stylesheet.imports=this.stylesheet.imports||[];if(u.findIndex(({id:g})=>g===t.id)!==-1)return void this.fire(new a.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!o)return u.push(t),this._loadImports([t],!0);const p=u.findIndex(({id:g})=>g===o);return p===-1&&this.fire(new a.y(new Error(`Import with id "${o}" does not exist on this map.`))),this.stylesheet.imports=u.slice(0,p).concat(t).concat(u.slice(p)),this._loadImports([t],!0,o)}updateImport(t,o){this._checkLoaded();const u=this.stylesheet.imports||[],p=this.getImportIndex(t);return p===-1?this:typeof o=="string"?(this.setImportUrl(t,o),this):(o.url&&o.url!==u[p].url&&this.setImportUrl(t,o.url),a.by(o.config,u[p].config)||this.setImportConfig(t,o.config,o.data.schema),a.by(o.data,u[p].data)||this.setImportData(t,o.data),this)}moveImport(t,o){this._checkLoaded();let u=this.stylesheet.imports||[];const p=this.getImportIndex(t);if(p===-1)return this;const g=this.getImportIndex(o);if(g===-1)return this;const y=u[p],b=this.fragments[p];return u=u.filter(({id:T})=>T!==t),this.fragments=this.fragments.filter(({id:T})=>T!==t),this.stylesheet.imports=u.slice(0,g).concat(y).concat(u.slice(g)),this.fragments=this.fragments.slice(0,g).concat(b).concat(this.fragments.slice(g)),this.mergeLayers(),this}setImportUrl(t,o){this._checkLoaded();const u=this.stylesheet.imports||[],p=this.getImportIndex(t);if(p===-1)return this;u[p].url=o;const g=this.fragments[p];return g.style=this._createFragmentStyle(u[p]),g.style.on("style.import.load",()=>this.mergeAll()),g.style.loadURL(o),this}setImportData(t,o){this._checkLoaded();const u=this.getImportIndex(t),p=this.stylesheet.imports||[];return u===-1?this:o?(this.fragments[u].style.setState(o),this._reloadImports(),this):(delete p[u].data,this.setImportUrl(t,p[u].url))}setImportConfig(t,o,u){this._checkLoaded();const p=this.getImportIndex(t),g=this.stylesheet.imports||[];if(p===-1)return this;o?g[p].config=o:delete g[p].config;const y=this.fragments[p];u&&y.style.stylesheet&&(y.style.stylesheet.schema=u);const b=y.style.stylesheet&&y.style.stylesheet.schema;return y.config=o,y.style.updateConfig(o,b),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const o=this.stylesheet.imports||[],u=this.getImportIndex(t);u!==-1&&(o.splice(u,1),this.fragments[u].style._remove(),this.fragments.splice(u,1),this._reloadImports())}getImportIndex(t){const o=(this.stylesheet.imports||[]).findIndex(u=>u.id===t);return o===-1&&this.fire(new a.y(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),o}
219getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const o in this._mergedOtherSourceCaches){const u=this._mergedOtherSourceCaches[o];u&&t.push(u.getSource())}return t}getSource(t,o){const u=this.getSourceCache(t,o);return u&&u.getSource()}getLayerSource(t){const o=this.getLayerSourceCache(t);return o&&o.getSource()}getSourceCache(t,o){const u=a.B(t,o);return this._mergedOtherSourceCaches[u]}getLayerSourceCache(t){const o=a.B(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[o]:this._mergedOtherSourceCaches[o]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const o=[];return this._mergedOtherSourceCaches[t]&&o.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&o.push(this._mergedSymbolSourceCaches[t]),o}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const o in t){const u=t[o];u==="reload"?this.reloadSource(o):u==="clear"&&this.clearSource(o)}}updateLayers(t){const o=this._changes.getUpdatedPaintProperties();for(const u of o){const p=this.getLayer(u);p&&p.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,o,u){this.imageManager.getImages(o.images,o.scope,u),this._updateTilesForChangedImages();const p=y=>{if(y){const b=o.images.map(T=>a.I.toString(T));y.setDependencies(o.tileID.key,o.type,b)}},g=a.B(o.source,o.scope);p(this._mergedOtherSourceCaches[g]),p(this._mergedSymbolSourceCaches[g]),o.images.some(y=>y.iconsetId)&&this.fire(new a.z("data",{dataType:"style"}))}rasterizeImages(t,o,u){this.imageManager.rasterizeImages(o,u)}getGlyphs(t,o,u){this.glyphManager.getGlyphs(o.stacks,u)}getResource(t,o,u){return a.dz(o,u)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const o=[];return this._otherSourceCaches[t]&&o.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&o.push(this._symbolSourceCaches[t]),o}_isSourceCacheLoaded(t){const o=this.getOwnSourceCaches(t);return o.length===0?(this.fire(new a.y(new Error(`There is no source with ID '${t}'`))),!1):o.every(u=>u.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,o){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const u=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),p=t.type==="building";if(t.is3D(!!this.terrain)){if(u||p||o&&o.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}ea.getSourceType=function(c){return Ss[c]},ea.setSourceType=function(c,t){Ss[c]=t},ea.registerForPluginStateChange=a.dA;var Ga=`
220#define EPSILON 0.0000001
221#define PI 3.141592653589793
222#ifdef RENDER_CUTOFF
223float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
224#endif`,qu=`
225#ifdef DUAL_SOURCE_BLENDING
226layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
227#else
228layout(location=0) out vec4 glFragColor;
229#endif
230#ifdef USE_MRT1
231layout(location=1) out vec4 out_Target1;
232#endif
233highp float unpack_depth(highp vec4 rgba_depth)
234{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
235#ifdef INDICATOR_CUTOUT
236uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
237#endif
238vec4 applyCutout(vec4 color,float height) {
239#ifdef INDICATOR_CUTOUT
240float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
240float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
241#else
242return color;
243#endif
244}
245#ifdef DEBUG_WIREFRAME
246#define HANDLE_WIREFRAME_DEBUG \\
247glFragColor=vec4(0.7,0.0,0.0,0.7); \\
248gl_FragDepth=gl_FragCoord.z-0.0001;
249#else
250#define HANDLE_WIREFRAME_DEBUG
251#endif
252#ifdef RENDER_CUTOFF
253uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
254#endif
255vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,Vo=`
256#define EXTENT 8192.0
257#define RAD_TO_DEG 180.0/PI
258#define DEG_TO_RAD PI/180.0
259#define GLOBE_RADIUS EXTENT/PI/2.0
260float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
261#ifdef PROJECTION_GLOBE_VIEW
262vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
263#ifndef PROJECTED_POS_ON_VIEWPORT
264float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
265#else
266return vec3(0.0);
267#endif
268}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
269#endif
270vec2 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(
271unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
272);}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 vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
273#ifdef RENDER_CUTOFF
274uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
275#endif
276const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
277{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}
278#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer
279#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib
280#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib
281#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib
282#define DECLARE_MATERIAL_TABLE_INFO
283#endif`,Cs="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
283void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Kh=`
284#define ELEVATION_SCALE 7.0
285#define ELEVATION_OFFSET 450.0
286#ifdef PROJECTION_GLOBE_VIEW
287uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
288mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
289#else
290vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
291#endif
292#ifdef TERRAIN
293uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
294#ifdef TERRAIN_DEM_FLOAT_FORMAT
295vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
296#else
297float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
298#endif
299}float prevElevation(vec2 apos) {
300#ifdef TERRAIN_DEM_FLOAT_FORMAT
301vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
302#else
303float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
304#endif
305}
306#ifdef TERRAIN_VERTEX_MORPHING
307float elevation(vec2 apos) {
308#ifdef ZERO_EXAGGERATION
309return 0.0;
310#endif
311float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
312#else
313float elevation(vec2 apos) {
314#ifdef ZERO_EXAGGERATION
315return 0.0;
316#endif
317return currentElevation(apos);}
318#endif
319vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
320#else
321float elevation(vec2 pos) { return 0.0; }
322#endif
323#ifdef DEPTH_OCCLUSION
324uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;
325#ifdef DEPTH_D24
326float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}
327#else
328highp float unpack_depth_rgba(vec4 rgba_depth)
329{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
330#endif
331bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
332#ifdef CLIP_ZERO_TO_ONE
333coord.z=-1.0+2.0*coord.z; 
334#endif
335#ifdef DEPTH_D24
336float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
337#else
338float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
339#endif
340return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
340size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
341#ifdef DEPTH_D24
342highp vec4 depth=vec4(
343texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r
344);depth=unpack_depth4(depth);
345#else
346highp vec4 depth=vec4(
347unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))
348);
349#endif
350return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;
351#ifdef CLIP_ZERO_TO_ONE
352coord.z=-1.0+2.0*coord.z; 
353#endif
354int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {
355#ifdef DEPTH_D24
356highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
357#else
358highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
359#endif
360res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;
361#ifdef CLIP_ZERO_TO_ONE
362coord.z=-1.0+2.0*coord.z; 
363#endif
364highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}
365#else
366bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
367#endif`,$c=`#ifdef FOG
368uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
369#endif`,ta=`#ifdef FOG
370uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;
371#ifdef FLIP_Y
372uv.y=1.0-uv.y;
373#endif
374highp vec3 ray_dir=mix(
375mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
375vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
376#endif`,Xc=`#ifdef RASTER_ARRAY
377uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
378);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)
379);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
380#endif`,Lt=`#ifdef RASTER_ARRAY
381uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}
382#endif
383uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,lf=`#ifdef RENDER_SHADOWS
384uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
385#endif`,Zu=`#ifdef RENDER_SHADOWS
386precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
386p float bias) {
387#ifdef CLIP_ZERO_TO_ONE
388highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
389#else
390highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
391#endif
392return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;
393#ifdef SHADOWS_SINGLE_CASCADE
394vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);
395#else
396light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);
397#endif
398}highp float calculate_shadow_bias(float NDotL) {
399#ifdef NORMAL_OFFSET
400return 0.5*u_shadow_bias.x;
401#else
402return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
403#endif
404}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)
405{highp vec2 biasUV=vec2(
406pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
407#endif`;const nl=/#include\s+"([^"]+)"/g,rl=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,da=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Ll=new Set(["ifdef","ifndef","elif","if","defined"]),fa=new Set;po(Ga,fa),po(Vo,fa),po(qu,fa);const Ol={"_prelude_fog.vertex.glsl":$c,"_prelude_terrain.vertex.glsl":Kh,"_prelude_shadow.vertex.glsl":lf,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer
408#define MATERIAL_TABLE_DEBUG 0
409uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;
410#if MATERIAL_TABLE_DEBUG
411vec4 colorDebug;
412#endif
413};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}
413float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { 
414if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; 
415}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { 
416iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;
417#if MATERIAL_TABLE_DEBUG
418const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green;
419#endif
420uint offset=0u;
421#if MATERIAL_TABLE_DEBUG
422bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}
423#endif
424offset++;
425#if MATERIAL_TABLE_DEBUG
426uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}
427#endif
428offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);
429#if MATERIAL_TABLE_DEBUG
430if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}
431#endif
432uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);
433#if MATERIAL_TABLE_DEBUG
434if(keepFinding)
435{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}}
436#endif
437offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;
438#if MATERIAL_TABLE_DEBUG
439if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}
440#endif
441info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)
442{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);}
443#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)
444#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)
445#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)
446#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));
447#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;
448#endif`,"_prelude_fog.fragment.glsl":ta,"_prelude_shadow.fragment.glsl":Zu,"_prelude_lighting.glsl":`
449#ifdef LIGHTING_3D_MODE
450uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
450));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
451#endif`,"_prelude_raster_array.glsl":Xc,"_prelude_raster_particle.glsl":Lt},Wc={};Wi("",Kh),Wi(ta,$c),Wi(Zu,lf),Wi(Xc,""),Wi(Lt,"");const hc=Wi(qu,Vo),$u=Ga,Lm=[`
452#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
453#extension GL_EXT_blend_func_extended : require
454#endif`,"precision mediump float;",$u,hc.fragmentSource].join(`
455`),cf=["precision highp float;",$u,hc.vertexSource].join(`
456`);var uf={background:Wi(`#include "_prelude_fog.fragment.glsl"
457#include "_prelude_lighting.glsl"
458uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;
459#ifdef LIGHTING_3D_MODE
460in vec4 v_color;
461#endif
462void main() {vec4 out_color;
463#ifdef LIGHTING_3D_MODE
464out_color=v_color;
465#else
466out_color=u_color;
467#endif
468#ifdef FOG
469out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
470#endif
471glFragColor=out_color*u_opacity;
472#ifdef USE_MRT1
473out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
474#endif
475#ifdef OVERDRAW_INSPECTOR
476glFragColor=vec4(1.0);
477#endif
478HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
479#include "_prelude_lighting.glsl"
480in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;
481#ifdef LIGHTING_3D_MODE
482uniform mediump vec4 u_color;out vec4 v_color;
483#endif
484void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
485#ifdef LIGHTING_3D_MODE
486v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
487#endif
488#ifdef FOG
489v_fog_pos=fog_position(a_pos);
490#endif
491}`),backgroundPattern:Wi(`#include "_prelude_fog.fragment.glsl"
492#include "_prelude_lighting.glsl"
493uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
494#ifdef LIGHTING_3D_MODE
495out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
496#endif
497#ifdef FOG
498out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
499#endif
500glFragColor=out_color*u_opacity;
501#ifdef USE_MRT1
502out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
503#endif
504#ifdef OVERDRAW_INSPECTOR
505glFragColor=vec4(1.0);
506#endif
507HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
508uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
509#ifdef FOG
510v_fog_pos=fog_position(a_pos);
511#endif
512}`),building:Wi(`#include "_prelude_fog.fragment.glsl"
513#include "_prelude_shadow.fragment.glsl"
514#include "_prelude_lighting.glsl"
515const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;
516#ifdef BUILDING_FAUX_FACADE
517in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;
518#endif
519#ifdef RENDER_SHADOWS
520in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
521#endif
522#ifdef FLOOD_LIGHT
523in highp float v_flood_radius;in float v_has_flood_light;
524#endif
525uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}
526#ifdef BUILDING_FAUX_FACADE
527float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
528#if 0
529if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;
530#else
531if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;
532#endif
533return out_color;}
534#endif
535vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;
536#ifdef BUILDING_FAUX_FACADE
537if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
538#endif
539vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
540#ifdef RENDER_SHADOWS
541#ifdef RENDER_CUTOFF
542shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
543#else
544shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
545#endif
546#else
547shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir);
548#endif
549color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
550#ifdef FLOOD_LIGHT
551float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);
552#endif
553color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
554#ifdef FOG
555color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
556#endif
557color*=u_opacity;
558#ifdef INDICATOR_CUTOUT
559color=applyCutout(color,v_pos.z);
560#endif
561#ifdef FEATURE_CUTOUT
562color=apply_feature_cutout(color,gl_FragCoord);
563#endif
564glFragColor=color; 
565#ifdef DEBUG_SHOW_NORMALS
566color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
567#endif
568#ifdef OVERDRAW_INSPECTOR
569glFragColor=vec4(1.0);
570#endif
571HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
572#include "_prelude_shadow.vertex.glsl"
573in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
574#ifdef BUILDING_FAUX_FACADE
575out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;
576#endif
577#ifdef RENDER_SHADOWS
578uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
579#endif
580#ifdef FLOOD_LIGHT
581out highp float v_flood_radius;out float v_has_flood_light;
582#endif
583const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
584#ifdef BUILDING_FAUX_FACADE
585mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}
586#endif
587#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
588#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
589void main() {
590#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
591#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
592#ifdef FLOOD_LIGHT
593v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);
594#endif
595vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;
596#ifdef BUILDING_FAUX_FACADE
597v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;}
598#endif
599v_pos=a_pos_3f;
600#ifdef RENDER_CUTOFF
601vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
602#endif
603#ifdef RENDER_SHADOWS
604vec3 shadow_pos=v_pos;
605#ifdef NORMAL_OFFSET
606vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
607#endif
608v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);
609#endif
610#ifdef FOG
611v_fog_pos=fog_position(v_pos);
612#endif
613gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Wi(`in vec4 v_color_emissive;
614#pragma mapbox: define-attribute highp vec4 bloom_attenuation
615#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
616float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
617#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
618float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
618opacity*=saturate(1.0-distance*distance);
619#endif
620#ifdef RENDER_CUTOFF
621opacity*=v_cutoff_opacity;
622#endif
623glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
624#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
625#pragma mapbox: define-attribute highp vec4 bloom_attenuation
626out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
627#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
628#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
629#ifdef HAS_ATTRIBUTE_a_part_color_emissive
630vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
631#else
632v_color_emissive=vec4(1.0);
633#endif
634gl_Position=u_matrix*vec4(a_pos_3f,1.0);
635#ifdef RENDER_CUTOFF
636v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
637#endif
638}`),buildingDepth:Wi(`in highp float v_depth;void main() {
639#ifndef DEPTH_TEXTURE
640glFragColor=pack_depth(v_depth);
641#endif
642}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Wi(`#include "_prelude_fog.fragment.glsl"
643#include "_prelude_lighting.glsl"
644in vec3 v_data;in float v_visibility;
645#pragma mapbox: define highp vec4 color
646#pragma mapbox: define mediump float radius
647#pragma mapbox: define lowp float blur
648#pragma mapbox: define lowp float opacity
649#pragma mapbox: define highp vec4 stroke_color
650#pragma mapbox: define mediump float stroke_width
651#pragma mapbox: define lowp float stroke_opacity
652uniform float u_emissive_strength;void main() {
653#pragma mapbox: initialize highp vec4 color
654#pragma mapbox: initialize mediump float radius
655#pragma mapbox: initialize lowp float blur
656#pragma mapbox: initialize lowp float opacity
657#pragma mapbox: initialize highp vec4 stroke_color
658#pragma mapbox: initialize mediump float stroke_width
659#pragma mapbox: initialize lowp float stroke_opacity
660vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 
661smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
662smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
663antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
664);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
665#ifdef LIGHTING_3D_MODE
666out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
667#endif
668#ifdef FOG
669out_color=fog_apply_premultiplied(out_color,v_fog_pos);
670#endif
671glFragColor=out_color*(v_visibility*opacity_t);
672#ifdef OVERDRAW_INSPECTOR
673glFragColor=vec4(1.0);
674#endif
675}`,`#include "_prelude_fog.vertex.glsl"
676#include "_prelude_terrain.vertex.glsl"
677#define NUM_VISIBILITY_RINGS 2
678#define INV_SQRT2 0.70710678
679#define ELEVATION_BIAS 0.0001
680#define NUM_SAMPLES_PER_RING 16
681uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
682#ifdef PROJECTION_GLOBE_VIEW
683in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
684#endif
685#ifdef ELEVATED_ROADS
686in float a_circle_z_offset;
687#endif
688out vec3 v_data;out float v_visibility;
689#pragma mapbox: define highp vec4 color
690#pragma mapbox: define mediump float radius
691#pragma mapbox: define lowp float blur
692#pragma mapbox: define lowp float opacity
693#pragma mapbox: define highp vec4 stroke_color
694#pragma mapbox: define mediump float stroke_width
695#pragma mapbox: define lowp float stroke_opacity
696vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
696iew_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
697#if defined(TERRAIN)
698return elevation(pos)+ELEVATION_BIAS;
699#else
700return 0.0;
701#endif
702}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
703#ifdef PITCH_WITH_MAP
704#ifdef PROJECTION_GLOBE_VIEW
705return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
706#else
707return u_matrix*( world_center+vec4(sample_offset,0,0) );
708#endif
709#else
710return projected_center+vec4(sample_offset,0,0);
711#endif
712}float get_sample_step() {
713#ifdef PITCH_WITH_MAP
714return 2.0*PI/float(NUM_SAMPLES_PER_RING);
715#else
716return PI/float(NUM_SAMPLES_PER_RING);
717#endif
718}void main() {
719#pragma mapbox: initialize highp vec4 color
720#pragma mapbox: initialize mediump float radius
721#pragma mapbox: initialize lowp float blur
722#pragma mapbox: initialize lowp float opacity
723#pragma mapbox: initialize highp vec4 stroke_color
724#pragma mapbox: initialize mediump float stroke_width
725#pragma mapbox: initialize lowp float stroke_opacity
726vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
727#ifdef PROJECTION_GLOBE_VIEW
728vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
729#else 
730surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
731#endif
732#ifdef ELEVATED_ROADS
733world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
734#endif
735vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
736#ifdef PITCH_WITH_MAP
737#ifdef SCALE_WITH_MAP
738view_scale=1.0;
739#else
740view_scale=projected_center.w/u_camera_to_center_distance;
741#endif
742#else
743#ifdef SCALE_WITH_MAP
744view_scale=u_camera_to_center_distance;
745#else
746view_scale=projected_center.w;
747#endif
748#endif
749gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
750#ifdef TERRAIN
751float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
752#ifdef PITCH_WITH_MAP
753float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
754#else
755occlusion_world_center=world_center;occlusion_projected_center=projected_center;
756#endif
757for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
758#else
759visibility=1.0;
760#endif
761#ifdef PROJECTION_GLOBE_VIEW
762visibility=1.0;
763#endif
764v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
765#ifdef FOG
766v_fog_pos=fog_position(world_center.xyz);
767#endif
768}`),clippingMask:Wi("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Wi(`#include "_prelude_fog.fragment.glsl"
769uniform highp float u_intensity;in vec2 v_extrude;
770#pragma mapbox: define highp float weight
771#define GAUSS_COEF 0.3989422804014327
772void main() {
773#pragma mapbox: initialize highp float weight
774float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
775#ifdef FOG
776if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
777#endif
778#ifdef OVERDRAW_INSPECTOR
779glFragColor=vec4(1.0);
780#endif
781HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
782#include "_prelude_fog.vertex.glsl"
783uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
784#ifdef PROJECTION_GLOBE_VIEW
785in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
786#endif
787out vec2 v_extrude;
788#pragma mapbox: define highp float weight
789#pragma mapbox: define mediump float radius
790const highp float ZERO=1.0/255.0/16.0;
791#define GAUSS_COEF 0.3989422804014327
792void main() {
793#pragma mapbox: initialize highp float weight
794#pragma mapbox: initialize mediump float radius
795vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
796#ifdef PROJECTION_GLOBE_VIEW
797vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
798#else
799pos=vec3(tilePos+extrude,elevation(tilePos));
800#endif
801gl_Position=u_matrix*vec4(pos,1);
802#ifdef FOG
803v_fog_pos=fog_position(pos);
804#endif
805}`),heatmapTexture:Wi(`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));glFragColor=color*u_opacity;
806#ifdef OVERDRAW_INSPECTOR
807glFragColor=vec4(0.0);
808#endif
809HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Wi("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
810in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
811#ifdef PROJECTION_GLOBE_VIEW
812uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
813#endif
814out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
815#ifdef PROJECTION_GLOBE_VIEW
816#ifndef PROJECTED_POS_ON_VIEWPORT
817vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
818#endif
819#endif
820vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
8210.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Wi("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
822mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
8230.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Wi("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
824in vec2 a_pos;
825#ifdef PROJECTION_GLOBE_VIEW
826in vec3 a_pos_3;
827#endif
828out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
829#ifdef PROJECTION_GLOBE_VIEW
830gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
831#else
832gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
833#endif
834}`),elevatedStructuresDepth:Wi(`void main() {
835#ifndef DEPTH_TEXTURE
836glFragColor=vec4(0.);
837#endif
838}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Wi(`#ifdef DEPTH_RECONSTRUCTION
839in float v_height;
840#endif
841void main() {
842#ifdef DEPTH_RECONSTRUCTION
843if (v_height >=0.0)
844discard;
845#else
846#ifdef FEATURE_CUTOUT
847apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord);
848#endif
849#endif
850glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
851#ifdef DEPTH_RECONSTRUCTION
852out float v_height;
853#endif
854void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
855#ifdef DEPTH_RECONSTRUCTION
856if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
857#endif
858gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Wi(`#include "_prelude_fog.fragment.glsl"
859#include "_prelude_lighting.glsl"
860#include "_prelude_shadow.fragment.glsl"
861in vec3 v_normal;in float v_height;
862#ifdef RENDER_SHADOWS
863in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
864#endif
865vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
865vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
866{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;
867#pragma mapbox: define highp vec4 structure_color
868void main() {
869#pragma mapbox: initialize highp vec4 structure_color
870vec3 color=structure_color.xyz;
871#ifdef LIGHTING_3D_MODE
872vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);
873#ifdef RENDER_SHADOWS
874float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
875#else
876color=apply_lighting(color,transformed_normal);
877#endif
878color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}
879#endif
880#ifdef FOG
881color=fog_apply(color,v_fog_pos);
882#endif
883vec4 out_color=vec4(color,1.0);
884#ifdef INDICATOR_CUTOUT
885out_color=applyCutout(out_color,v_height);
886#endif
887#ifdef FEATURE_CUTOUT
888out_color=apply_feature_cutout(out_color,gl_FragCoord);
889#endif
890glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
891#include "_prelude_shadow.vertex.glsl"
892in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
893#ifdef RENDER_SHADOWS
894uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;
895#endif
896#pragma mapbox: define highp vec4 structure_color
897void main() {
898#pragma mapbox: initialize highp vec4 structure_color
899v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);
900#ifdef RENDER_SHADOWS
901vec3 shd_pos0=pos;vec3 shd_pos1=pos;
902#ifdef NORMAL_OFFSET
903vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
904#endif
905v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
906#endif
907#ifdef FOG
908v_fog_pos=fog_position(a_pos);
909#endif
910}`),fill:Wi(`#include "_prelude_fog.fragment.glsl"
911#include "_prelude_lighting.glsl"
912#include "_prelude_shadow.fragment.glsl"
913#pragma mapbox: define highp vec4 color
914#pragma mapbox: define lowp float opacity
915uniform float u_emissive_strength;
916#ifdef RENDER_SHADOWS
917uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
918#endif
919#ifdef ELEVATED_ROADS
920in highp float v_road_z_offset;
921#endif
922#ifdef INDICATOR_CUTOUT
923in highp float v_z_offset;
924#endif
925void main() {
926#pragma mapbox: initialize highp vec4 color
927#pragma mapbox: initialize lowp float opacity
928vec4 out_color=color;
929#ifdef LIGHTING_3D_MODE
930out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
931#ifdef RENDER_SHADOWS
932float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
933#endif
934#endif
935#ifdef FOG
936out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
937#endif
938out_color*=opacity;
939#ifdef INDICATOR_CUTOUT
940if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
941#endif
942#ifdef FEATURE_CUTOUT
943out_color=apply_feature_cutout(out_color,gl_FragCoord);
944#endif
945glFragColor=out_color;
946#ifdef USE_MRT1
947out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
948#endif
949#ifdef OVERDRAW_INSPECTOR
950glFragColor=vec4(1.0);
951#endif
952HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
953#include "_prelude_shadow.vertex.glsl"
954in vec2 a_pos;
955#ifdef ELEVATED_ROADS
956in float a_road_z_offset;out highp float v_road_z_offset;
957#endif
958#ifdef RENDER_SHADOWS
959uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
960#endif
961#ifdef INDICATOR_CUTOUT
962out highp float v_z_offset;
963#endif
964uniform mat4 u_matrix;
965#pragma mapbox: define highp vec4 color
966#pragma mapbox: define lowp float opacity
967#pragma mapbox: define highp float z_offset
968void main() {
969#pragma mapbox: initialize highp vec4 color
970#pragma mapbox: initialize lowp float opacity
971#pragma mapbox: initialize highp float z_offset
972#ifdef ELEVATED_ROADS
973z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
974#endif
975float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
976#ifdef RENDER_SHADOWS
977vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
978#ifdef NORMAL_OFFSET
979vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
980#endif
981v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
982#endif
983#ifdef FOG
984v_fog_pos=fog_position(a_pos);
985#endif
986#ifdef INDICATOR_CUTOUT
987v_z_offset=z_offset;
988#endif
989}`),fillOutline:Wi(`#include "_prelude_fog.fragment.glsl"
990#include "_prelude_lighting.glsl"
991#include "_prelude_shadow.fragment.glsl"
992in highp vec2 v_pos;uniform float u_emissive_strength;
993#ifdef RENDER_SHADOWS
994uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
995#endif
996#pragma mapbox: define highp vec4 outline_color
997#pragma mapbox: define lowp float opacity
998void main() {
999#pragma mapbox: initialize highp vec4 outline_color
1000#pragma mapbox: initialize lowp float opacity
1001float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
1002#ifdef LIGHTING_3D_MODE
1003out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1004#ifdef RENDER_SHADOWS
1005float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1006#endif
1007#endif
1008#ifdef FOG
1009out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1010#endif
1011#ifdef FEATURE_CUTOUT
1012out_color=apply_feature_cutout(out_color,gl_FragCoord);
1013#endif
1014glFragColor=out_color*(alpha*opacity);
1015#ifdef USE_MRT1
1016out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1017#endif
1018#ifdef OVERDRAW_INSPECTOR
1019glFragColor=vec4(1.0);
1020#endif
1021HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1022#include "_prelude_shadow.vertex.glsl"
1023in vec2 a_pos;
1024#ifdef ELEVATED_ROADS
1025in float a_road_z_offset;
1026#endif
1027#ifdef RENDER_SHADOWS
1028uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1029#endif
1030uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
1031#pragma mapbox: define highp vec4 outline_color
1032#pragma mapbox: define lowp float opacity
1033#pragma mapbox: define highp float z_offset
1034void main() {
1035#pragma mapbox: initialize highp vec4 outline_color
1036#pragma mapbox: initialize lowp float opacity
1037#pragma mapbox: initialize highp float z_offset
1038#ifdef ELEVATED_ROADS
1039z_offset+=a_road_z_offset;
1040#endif
1041float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
1042#ifdef FLIP_Y
1043v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
1044#else
1045v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
1046#endif
1047#ifdef RENDER_SHADOWS
1048vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
1049#ifdef NORMAL_OFFSET
1050vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1051#endif
1052v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1053#endif
1054#ifdef FOG
1055v_fog_pos=fog_position(a_pos);
1056#endif
1057}`),fillOutlinePattern:Wi(`#include "_prelude_fog.fragment.glsl"
1058#include "_prelude_lighting.glsl"
1059#include "_prelude_shadow.fragment.glsl"
1060uniform vec2 u_texsize;uniform sampler2D u_image;
1061#ifdef FILL_PATTERN_TRANSITION
1062uniform float u_pattern_transition;
1063#endif
1064uniform float u_emissive_strength;
1065#ifdef APPLY_LUT_ON_GPU
1066uniform highp sampler3D u_lutTexture;
1067#endif
1068#ifdef RENDER_SHADOWS
1069uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1070#endif
1071in highp vec2 v_pos;in highp vec2 v_pos_world;
1072#pragma mapbox: define lowp float opacity
1073#pragma mapbox: define lowp vec4 pattern
1074#ifdef FILL_PATTERN_TRANSITION
1075#pragma mapbox: define mediump vec4 pattern_b
1076#endif
1077void main() {
1078#pragma mapbox: initialize lowp float opacity
1079#pragma mapbox: initialize mediump vec4 pattern
1080#ifdef FILL_PATTERN_TRANSITION
1081#pragma mapbox: initialize mediump vec4 pattern_b
1082#endif
1083vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1084#ifdef APPLY_LUT_ON_GPU
1085out_color=applyLUT(u_lutTexture,out_color);
1086#endif
1087#ifdef FILL_PATTERN_TRANSITION
1088vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1089#endif
1090#ifdef LIGHTING_3D_MODE
1091out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1092#ifdef RENDER_SHADOWS
1093float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1094#endif
1095#endif
1096#ifdef FEATURE_CUTOUT
1097out_color=apply_feature_cutout(out_color,gl_FragCoord);
1098#endif
1099#ifdef FOG
1100out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1101#endif
1102glFragColor=out_color*(alpha*opacity);
1103#ifdef USE_MRT1
1104out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1105#endif
1106#ifdef OVERDRAW_INSPECTOR
1107glFragColor=vec4(1.0);
1108#endif
1109HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1110#include "_prelude_shadow.vertex.glsl"
1111uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
1112#ifdef ELEVATED_ROADS
1113in float a_road_z_offset;
1114#endif
1115#ifdef RENDER_SHADOWS
1116uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1117#endif
1118out highp vec2 v_pos;out highp vec2 v_pos_world;
1119#pragma mapbox: define lowp float opacity
1120#pragma mapbox: define lowp vec4 pattern
1121#ifdef FILL_PATTERN_TRANSITION
1122#pragma mapbox: define mediump vec4 pattern_b
1123#endif
1124#pragma mapbox: define lowp float pixel_ratio
1125#pragma mapbox: define highp float z_offset
1126void main() {
1127#pragma mapbox: initialize lowp float opacity
1128#pragma mapbox: initialize mediump vec4 pattern
1129#ifdef FILL_PATTERN_TRANSITION
1130#pragma mapbox: initialize mediump vec4 pattern_b
1131#endif
1132#pragma mapbox: initialize lowp float pixel_ratio
1133#pragma mapbox: initialize highp float z_offset
1134vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
1135#ifdef ELEVATED_ROADS
1136z_offset+=a_road_z_offset;
1137#endif
1138float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
1139#ifdef FLIP_Y
1140v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
1141#else
1142v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
1143#endif
1144#ifdef RENDER_SHADOWS
1145vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
1146#ifdef NORMAL_OFFSET
1147vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1148#endif
1149v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1150#endif
1151#ifdef FOG
1152v_fog_pos=fog_position(a_pos);
1153#endif
1154}`),fillPattern:Wi(`#include "_prelude_fog.fragment.glsl"
1155#include "_prelude_lighting.glsl"
1156#include "_prelude_shadow.fragment.glsl"
1157uniform vec2 u_texsize;uniform sampler2D u_image;
1158#ifdef FILL_PATTERN_TRANSITION
1159uniform float u_pattern_transition;
1160#endif
1161in highp vec2 v_pos;uniform float u_emissive_strength;
1162#ifdef RENDER_SHADOWS
1163uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1164#endif
1165#ifdef ELEVATED_ROADS
1166in highp float v_road_z_offset;
1167#endif
1168#ifdef APPLY_LUT_ON_GPU
1169uniform highp sampler3D u_lutTexture;
1170#endif
1171#pragma mapbox: define lowp float opacity
1172#pragma mapbox: define lowp vec4 pattern
1173#ifdef FILL_PATTERN_TRANSITION
1174#pragma mapbox: define mediump vec4 pattern_b
1175#endif
1176void main() {
1177#pragma mapbox: initialize lowp float opacity
1178#pragma mapbox: initialize mediump vec4 pattern
1179#ifdef FILL_PATTERN_TRANSITION
1180#pragma mapbox: initialize mediump vec4 pattern_b
1181#endif
1182vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1183#ifdef APPLY_LUT_ON_GPU
1184out_color=applyLUT(u_lutTexture,out_color);
1185#endif
1186#ifdef FILL_PATTERN_TRANSITION
1187vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1188#endif
1189#ifdef LIGHTING_3D_MODE
1190out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1191#ifdef RENDER_SHADOWS
1192float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1193#ifdef ELEVATED_ROADS
1194out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1195#else
1196out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1197#endif
1198#endif
1199#endif
1200#ifdef FEATURE_CUTOUT
1201out_color=apply_feature_cutout(out_color,gl_FragCoord);
1202#endif
1203#ifdef FOG
1204out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1205#endif
1206glFragColor=out_color*opacity;
1207#ifdef USE_MRT1
1208out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1209#endif
1210#ifdef OVERDRAW_INSPECTOR
1211glFragColor=vec4(1.0);
1212#endif
1213HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1214#include "_prelude_shadow.vertex.glsl"
1215uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
1216#ifdef ELEVATED_ROADS
1217in float a_road_z_offset;out highp float v_road_z_offset;
1218#endif
1219#ifdef RENDER_SHADOWS
1220uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1221#endif
1222out highp vec2 v_pos;
1223#pragma mapbox: define lowp float opacity
1224#pragma mapbox: define lowp vec4 pattern
1225#ifdef FILL_PATTERN_TRANSITION
1226#pragma mapbox: define mediump vec4 pattern_b
1227#endif
1228#pragma mapbox: define lowp float pixel_ratio
1229#pragma mapbox: define highp float z_offset
1230void main() {
1231#pragma mapbox: initialize lowp float opacity
1232#pragma mapbox: initialize mediump vec4 pattern
1233#pragma mapbox: initialize lowp float pixel_ratio
1234#pragma mapbox: initialize highp float z_offset
1235#ifdef FILL_PATTERN_TRANSITION
1236#pragma mapbox: initialize mediump vec4 pattern_b
1237#endif
1238vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
1239#ifdef ELEVATED_ROADS
1240z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
1241#endif
1242float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pa
1242ttern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
1243#ifdef RENDER_SHADOWS
1244vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
1245#ifdef NORMAL_OFFSET
1246vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1247#endif
1248v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1249#endif
1250#ifdef FOG
1251v_fog_pos=fog_position(a_pos);
1252#endif
1253}`),fillExtrusion:Wi(`#include "_prelude_fog.fragment.glsl"
1254#include "_prelude_shadow.fragment.glsl"
1255#include "_prelude_lighting.glsl"
1256in vec4 v_color;in vec4 v_flat;
1257#ifdef RENDER_SHADOWS
1258in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
1259#endif
1260uniform lowp float u_opacity;
1261#ifdef FAUX_AO
1262uniform lowp vec2 u_ao;in vec2 v_ao;
1263#endif
1264#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1265in vec4 v_roof_color;
1266#endif
1267#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1268in highp vec3 v_normal;
1269#endif
1270uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
1271#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1272in float v_flood_radius;in float v_has_floodlight;
1273#endif
1274in float v_height;
1275#pragma mapbox: define highp float emissive_strength
1276void main() {
1277#pragma mapbox: initialize highp float emissive_strength
1278#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1279vec3 normal=normalize(v_normal);
1280#endif
1281float z;vec4 color=v_color;
1282#ifdef ZERO_ROOF_RADIUS
1283z=float(normal.z > 0.00001);
1284#ifdef LIGHTING_3D_MODE
1285normal=mix(normal,vec3(0.0,0.0,1.0),z);
1286#else
1287color=mix(v_color,v_roof_color,z);
1288#endif
1289#endif
1290float h=max(0.0,v_height);float ao_shade=1.0;
1291#ifdef FAUX_AO
1292float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
1293#ifdef ZERO_ROOF_RADIUS
1294concave*=(1.0-z);
1295#endif
1296float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
1297#ifdef LIGHTING_3D_MODE
1298#ifdef FLOOD_LIGHT
1299color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
1300#else
1301color.rgb*=ao_shade;
1302#endif
1303#else
1304color.rgb*=ao_shade;
1305#endif
1306#endif
1307#ifdef LIGHTING_3D_MODE
1308float flood_radiance=0.0;
1309#ifdef FLOOD_LIGHT
1310flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
1311#endif
1312#ifdef RENDER_SHADOWS
1313#ifdef FLOOD_LIGHT
1314float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
1315#else
1316float shadowed_lighting_factor;
1317#ifdef RENDER_CUTOFF
1318shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
1319#else
1320shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
1321#endif
1322color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
1323#endif
1324#else
1325color.rgb=apply_lighting(color.rgb,normal);
1326#ifdef FLOOD_LIGHT
1327color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
1328#endif
1329#endif
1330color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
1331#endif
1332#ifdef FOG
1333color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
1334#endif
1335#ifdef INDICATOR_CUTOUT
1336color=applyCutout(color,h);
1337#endif
1338#ifdef FEATURE_CUTOUT
1339color=apply_feature_cutout(color,gl_FragCoord);
1340#endif
1341glFragColor=color;
1342#ifdef OVERDRAW_INSPECTOR
1343glFragColor=vec4(1.0);
1344#endif
1345HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1346#include "_prelude_terrain.vertex.glsl"
1347#include "_prelude_shadow.vertex.glsl"
1348#include "_prelude_lighting.glsl"
1349#include "_prelude_material_table.vertex.glsl"
1350uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1351#ifdef RENDER_WALL_MODE
1352in vec3 a_join_normal_inside;
1353#endif
1354#ifdef PROJECTION_GLOBE_VIEW
1355in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1356#endif
1357#ifdef TERRAIN
1358uniform int u_height_type;uniform int u_base_type;
1359#endif
1360uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
1361#ifdef RENDER_SHADOWS
1362uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
1363#endif
1364#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1365out vec4 v_roof_color;
1366#endif
1367#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1368out highp vec3 v_normal;
1369#endif
1370#ifdef FAUX_AO
1371uniform lowp vec2 u_ao;out vec2 v_ao;
1372#endif
1373#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1374out float v_flood_radius;out float v_has_floodlight;
1375#endif
1376out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1377#pragma mapbox: define highp float base
1378#pragma mapbox: define highp float height
1379#pragma mapbox: define highp vec4 color
1380#pragma mapbox: define highp float flood_light_wall_radius
1381#pragma mapbox: define highp float line_width
1382#pragma mapbox: define highp float emissive_strength
1383void main() {DECLARE_MATERIAL_TABLE_INFO
1384#pragma mapbox: initialize highp float base
1385#pragma mapbox: initialize highp float height
1386#pragma mapbox: initialize highp vec4 color
1387#pragma mapbox: initialize highp float flood_light_wall_radius
1388#pragma mapbox: initialize highp float line_width
1389#pragma mapbox: initialize highp float emissive_strength
1390base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
1391#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1392v_normal=normal;
1393#endif
1394base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1395#if defined(HAS_CENTROID) || defined(TERRAIN)
1396centroid_pos=a_centroid_pos;
1397#endif
1398float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1399#ifdef TERRAIN
1400bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1401#else
1402h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
1403#endif
1404#ifdef PROJECTION_GLOBE_VIEW
1405float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1406#endif
1407float cutoff=1.0;vec3 scaled_pos=pos;
1408#ifdef RENDER_CUTOFF
1409vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
1410#ifdef CLIP_ZERO_TO_ONE
1411cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1412#else
1413cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1414#endif
1415if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
1416#endif
1417float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1418#ifdef RENDER_WALL_MODE
1419vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1420#endif
1421gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1422#ifdef RENDER_SHADOWS
1423vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1424#ifdef NORMAL_OFFSET
1425vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1426#endif
1427v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);
1428#endif
1429float NdotL=0.0;float colorvalue=0.0;
1430#ifndef LIGHTING_3D_MODE
1431colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
1432(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1433#endif
1434#ifdef FAUX_AO
1435float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1436#ifdef TERRAIN
1437top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1438#endif
1439v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1440#ifdef PROJECTION_GLOBE_VIEW
1441top_height+=u_height_lift;
1442#endif
1443gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1444#endif
1445#ifdef LIGHTING_3D_MODE
1446#ifdef FLOOD_LIGHT
1447float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
1448#endif
1449v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);
1450#else
1451v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
1452#endif
1453#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1454float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
1455#endif
1456#ifdef FOG
1457v_fog_pos=fog_position(pos);
1458#endif
1459}`),fillExtrusionDepth:Wi(`in highp float v_depth;void main() {
1460#ifndef DEPTH_TEXTURE
1461glFragColor=pack_depth(v_depth);
1462#endif
1463}`,`#include "_prelude_terrain.vertex.glsl"
1464#include "_prelude_material_table.vertex.glsl"
1465uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1466#ifdef TERRAIN
1467uniform int u_height_type;uniform int u_base_type;
1468#endif
1469in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1470#ifdef RENDER_WALL_MODE
1471in vec3 a_join_normal_inside;
1472#endif
1473#pragma mapbox: define highp float base
1474#pragma mapbox: define highp float height
1475#pragma mapbox: define highp float line_width
1476#pragma mapbox: define highp vec4 color
1477out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO
1478#pragma mapbox: initialize highp float base
1479#pragma mapbox: initialize highp float height
1480#pragma mapbox: initialize highp float line_width
1481#pragma mapbox: initialize highp vec4 color
1482base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1483#if defined(HAS_CENTROID) || defined(TERRAIN)
1484centroid_pos=a_centroid_pos;
1485#endif
1486vec3 pos;
1487#ifdef TERRAIN
1488bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1489#else
1490pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1491#endif
1492#ifdef RENDER_WALL_MODE
1493vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1494#endif
1495float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Wi(`#include "_prelude_fog.fragment.glsl"
1496#include "_prelude_lighting.glsl"
1497uniform vec2 u_texsize;uniform sampler2D u_image;
1498#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1499uniform float u_pattern_transition;
1500#endif
1501#ifdef FAUX_AO
1502uniform lowp vec2 u_ao;in vec3 v_ao;
1503#endif
1504#ifdef LIGHTING_3D_MODE
1505in vec3 v_normal;
1506#endif
1507#ifdef APPLY_LUT_ON_GPU
1508uniform highp sampler3D u_lutTexture;
1509#endif
1510in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1511#pragma mapbox: define highp float base
1512#pragma mapbox: define highp float height
1513#pragma mapbox: define mediump vec4 pattern
1514#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1515#pragma mapbox: define mediump vec4 pattern_b
1516#endif
1517#pragma mapbox: define highp float pixel_ratio
1518void main() {
1519#pragma mapbox: initialize highp float base
1520#pragma mapbox: initialize highp float height
1521#pragma mapbox: initialize mediump vec4 pattern
1522#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1523#pragma mapbox: initialize mediump vec4 pattern_b
1524#endif
1525#pragma mapbox: initialize highp float pixel_ratio
1526vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1527#ifdef APPLY_LUT_ON_GPU
1528out_color=applyLUT(u_lutTexture,out_color);
1529#endif
1530#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1531vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1532#endif
1533#ifdef LIGHTING_3D_MODE
1534out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1535#else
1536out_color=out_color*v_lighting;
1537#endif
1538#ifdef FAUX_AO
1539float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1539),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
1540#endif
1541#ifdef FOG
1542out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1543#endif
1544#ifdef INDICATOR_CUTOUT
1545out_color=applyCutout(out_color,height);
1546#endif
1547glFragColor=out_color;
1548#ifdef OVERDRAW_INSPECTOR
1549glFragColor=vec4(1.0);
1550#endif
1551HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1552#include "_prelude_terrain.vertex.glsl"
1553#include "_prelude_lighting.glsl"
1554#include "_prelude_material_table.vertex.glsl"
1555uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1556#ifdef RENDER_WALL_MODE
1557in vec3 a_join_normal_inside;
1558#endif
1559#ifdef PROJECTION_GLOBE_VIEW
1560in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1561#endif
1562#ifdef TERRAIN
1563uniform int u_height_type;uniform int u_base_type;
1564#endif
1565out highp vec2 v_pos;out vec4 v_lighting;
1566#ifdef FAUX_AO
1567uniform lowp vec2 u_ao;out vec3 v_ao;
1568#endif
1569#ifdef LIGHTING_3D_MODE
1570out vec3 v_normal;
1571#endif
1572#pragma mapbox: define highp float base
1573#pragma mapbox: define highp float height
1574#pragma mapbox: define highp vec4 color
1575#pragma mapbox: define mediump vec4 pattern
1576#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1577#pragma mapbox: define mediump vec4 pattern_b
1578#endif
1579#pragma mapbox: define highp float pixel_ratio
1580#pragma mapbox: define highp float line_width
1581void main() {DECLARE_MATERIAL_TABLE_INFO
1582#pragma mapbox: initialize highp float base
1583#pragma mapbox: initialize highp float height
1584#pragma mapbox: initialize highp vec4 color
1585#pragma mapbox: initialize mediump vec4 pattern
1586#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1587#pragma mapbox: initialize mediump vec4 pattern_b
1588#endif
1589#pragma mapbox: initialize highp float pixel_ratio
1590#pragma mapbox: initialize highp float line_width
1591vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
1592#if defined(HAS_CENTROID) || defined(TERRAIN)
1593centroid_pos=a_centroid_pos;
1594#endif
1595float ele=0.0;float h=z;vec3 p;float c_ele;
1596#ifdef TERRAIN
1597bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
1598#else
1599p=vec3(pos_nx.xy,z);
1600#endif
1601#ifdef PROJECTION_GLOBE_VIEW
1602float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1603#endif
1604#ifdef RENDER_WALL_MODE
1605vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
1606#endif
1607float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
1608? pos_nx.xy
1609: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
1610#ifdef LIGHTING_3D_MODE
1611NdotL=calculate_NdotL(normal);
1612#else
1613NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1614#endif
1615if (normal.y !=0.0) {float r=0.84;
1616#ifndef LIGHTING_3D_MODE
1617r=mix(0.7,0.98,1.0-u_lightintensity);
1618#endif
1619NdotL*=(
1620(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1621#ifdef FAUX_AO
1622float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1623#ifdef TERRAIN
1624top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1625#endif
1626v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1627#ifdef PROJECTION_GLOBE_VIEW
1628top_height+=u_height_lift;
1629#endif
1630gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1631#endif
1632#ifdef LIGHTING_3D_MODE
1633v_normal=normal;
1634#else
1635v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1636#endif
1637#ifdef FOG
1638v_fog_pos=fog_position(p);
1639#endif
1640}`),groundShadow:Wi(`#include "_prelude_shadow.fragment.glsl"
1641precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1642#ifdef FOG
1643in float v_fog_opacity;
1644#endif
1645void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
1646#ifdef RENDER_CUTOFF
1647shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1648#endif
1649#ifdef FOG
1650shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1651#endif
1652#ifdef INDICATOR_CUTOUT
1653shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1654#endif
1655glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1656uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
1657#ifdef FOG
1658out float v_fog_opacity;
1659#endif
1660void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);
1661#ifdef FOG
1662v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
1663#endif
1664}`),fillExtrusionGroundEffect:Wi(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
1665#ifdef SDF_SUBPASS
1666in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
1667#ifdef FOG
1668in highp float v_fog;
1669#endif
1670#endif
1671void main() {
1672#ifdef CLEAR_SUBPASS
1673vec4 color=vec4(1.0);
1674#ifdef CLEAR_FROM_TEXTURE
1675color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1676#endif
1677glFragColor=color;
1678#else
1679#ifdef SDF_SUBPASS
1680highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
1681#ifdef FOG
1682fog=v_fog;
1683#endif
1684#ifdef RENDER_CUTOFF
1685fog*=v_cutoff_opacity;
1686#endif
1687glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1688#else
1689#ifdef USE_MRT1
1690out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
1691#else
1692vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1693#ifdef OVERDRAW_INSPECTOR
1694color=vec4(1.0);
1695#endif
1696glFragColor=color;
1697#endif
1698#endif
1699HANDLE_WIREFRAME_DEBUG;
1700#endif
1701}`,`#include "_prelude_fog.vertex.glsl"
1702in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
1703#ifdef SDF_SUBPASS
1704out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1705#ifdef FOG
1706out highp float v_fog;
1707#endif
1708#endif
1709uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1710#pragma mapbox: define highp float flood_light_ground_radius
1711const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1712#pragma mapbox: initialize highp float flood_light_ground_radius
1713vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
1714#ifdef SDF_SUBPASS
1715v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
1716#ifdef FOG
1717v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1718#endif
1719#endif
1720float hidden_by_landmark=0.0;
1721#ifdef HAS_CENTROID
1722hidden_by_landmark=a_hidden_by_landmark;
1723#endif
1724float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));
1725#ifdef RENDER_CUTOFF
1726v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1727#endif
1728}`),hillshadePrepare:Wi(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
1729(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1730)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1731deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"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:Wi(`#include "_prelude_fog.fragment.glsl"
1732#include "_prelude_lighting.glsl"
1733uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
1734#ifdef LIGHTING_3D_MODE
1735glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1736#endif
1737#ifdef FOG
1738glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1739#endif
1740#ifdef USE_MRT1
1741out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1742#endif
1743#ifdef OVERDRAW_INSPECTOR
1744glFragColor=vec4(1.0);
1745#endif
1746HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1747uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
1748#ifdef FOG
1749v_fog_pos=fog_position(a_pos);
1750#endif
1751}`),line:Wi(`#include "_prelude_fog.fragment.glsl"
1752#include "_prelude_lighting.glsl"
1753#include "_prelude_shadow.fragment.glsl"
1754uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1754uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1755#ifdef ELEVATED_ROADS
1756in highp float v_road_z_offset;
1757#endif
1758#ifdef VARIABLE_LINE_WIDTH
1759in float stub_side;
1760#endif
1761#ifdef RENDER_LINE_DASH
1762uniform sampler2D u_dash_image;in vec2 v_tex;
1763#endif
1764#ifdef RENDER_LINE_GRADIENT
1765uniform sampler2D u_gradient_image;
1766#endif
1767#ifdef INDICATOR_CUTOUT
1768in highp float v_z_offset;
1769#endif
1770#ifdef RENDER_SHADOWS
1771uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1772#endif
1773float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
1774#pragma mapbox: define highp vec4 color
1775#pragma mapbox: define lowp float floorwidth
1776#pragma mapbox: define lowp vec4 dash
1777#pragma mapbox: define lowp float blur
1778#pragma mapbox: define lowp float opacity
1779#pragma mapbox: define mediump float side_z_offset
1780#pragma mapbox: define lowp float border_width
1781#pragma mapbox: define lowp vec4 border_color
1782#pragma mapbox: define lowp float emissive_strength
1783float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1784#pragma mapbox: initialize highp vec4 color
1785#pragma mapbox: initialize lowp float floorwidth
1786#pragma mapbox: initialize lowp vec4 dash
1787#pragma mapbox: initialize lowp float blur
1788#pragma mapbox: initialize lowp float opacity
1789#pragma mapbox: initialize mediump float side_z_offset
1790#pragma mapbox: initialize lowp float border_width
1791#pragma mapbox: initialize lowp vec4 border_color
1792#pragma mapbox: initialize lowp float emissive_strength
1793float dist=length(v_normal)*v_width2.s;
1794#ifdef VARIABLE_LINE_WIDTH
1795blur=mix(blur,0.0,stub_side);
1796#endif
1797float blur2=(u_width_scale*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);
1798#ifdef VARIABLE_LINE_WIDTH
1799alpha=mix(alpha,1.0,stub_side);
1800#endif
1801alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;
1802#ifdef RENDER_LINE_DASH
1803float sdfdist=texture(u_dash_image,v_tex).r;
1803float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1804#endif
1805highp vec4 out_color;
1806#ifdef RENDER_LINE_GRADIENT
1807out_color=texture(u_gradient_image,v_uv.xy);
1808#else
1809out_color=color;
1810#endif
1811float trim_alpha=1.0;
1812#ifdef RENDER_LINE_TRIM_OFFSET
1813highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;
1814#ifdef RENDER_LINE_GRADIENT
1815gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);
1816#endif
1817highp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
1818#endif
1819if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1820#ifdef RENDER_LINE_BORDER
1821#ifndef VARIABLE_LINE_WIDTH
1822float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
1823#endif
1824#endif
1825#ifdef LIGHTING_3D_MODE
1826out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1827#ifdef RENDER_SHADOWS
1828float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1829#ifdef ELEVATED_ROADS
1830out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1831#else
1832out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1833#endif
1834#endif
1835#endif
1836#ifdef FOG
1837out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1838#endif
1839out_color*=(alpha*opacity);
1840#ifdef INDICATOR_CUTOUT
1841out_color=applyCutout(out_color,v_z_offset);
1842#endif
1843#ifdef FEATURE_CUTOUT
1844out_color=apply_feature_cutout(out_color,gl_FragCoord);
1845#endif
1846glFragColor=out_color;
1847#ifdef DUAL_SOURCE_BLENDING
1848glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1849#else
1850#ifdef USE_MRT1
1851out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1852#endif
1853#endif
1854#ifdef OVERDRAW_INSPECTOR
1855glFragColor=vec4(1.0);
1856#endif
1857HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1858#include "_prelude_shadow.vertex.glsl"
1859#include "_prelude_terrain.vertex.glsl"
1860#define EXTRUDE_SCALE 0.015873016
1861in vec2 a_pos_normal;in vec4 a_data;
1862#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1863in vec3 a_z_offset_width;
1864#endif
1865#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1866in highp vec3 a_packed;
1867#endif
1868#ifdef RENDER_LINE_DASH
1869in float a_linesofar;
1870#endif
1871uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;
1872#ifdef ELEVATED
1873uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1874#ifdef ELEVATION_REFERENCE_SEA
1875return 0.0;
1876#else
1877return elevation(apos);
1878#endif
1879}
1880#endif
1881out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;
1882#ifdef ELEVATED_ROADS
1883out highp float v_road_z_offset;
1884#endif
1885#ifdef VARIABLE_LINE_WIDTH
1886out float stub_side;
1887#endif
1888#ifdef RENDER_LINE_DASH
1889uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1890#endif
1891#ifdef RENDER_LINE_GRADIENT
1892uniform float u_image_height;
1893#endif
1894#ifdef INDICATOR_CUTOUT
1895out highp float v_z_offset;
1896#endif
1897#ifdef RENDER_SHADOWS
1898uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1899#endif
1900#pragma mapbox: define highp vec4 color
1901#pragma mapbox: define lowp float floorwidth
1902#pragma mapbox: define lowp vec4 dash
1903#pragma mapbox: define lowp float blur
1904#pragma mapbox: define lowp float opacity
1905#pragma mapbox: define mediump float gapwidth
1906#pragma mapbox: define lowp float offset
1907#pragma mapbox: define mediump float width
1908#pragma mapbox: define mediump float side_z_offset
1909#pragma mapbox: define lowp float border_width
1910#pragma mapbox: define lowp vec4 border_color
1911#pragma mapbox: define lowp float emissive_strength
1912void main() {
1913#pragma mapbox: initialize highp vec4 color
1914#pragma mapbox: initialize lowp float floorwidth
1915#pragma mapbox: initialize lowp vec4 dash
1916#pragma mapbox: initialize lowp float blur
1917#pragma mapbox: initialize lowp float opacity
1918#pragma mapbox: initialize mediump float gapwidth
1919#pragma mapbox: initialize lowp float offset
1920#pragma mapbox: initialize mediump float width
1921#pragma mapbox: initialize mediump float side_z_offset
1922#pragma mapbox: initialize lowp float border_width
1923#pragma mapbox: initialize lowp vec4 border_color
1924#pragma mapbox: initialize lowp float emissive_strength
1925float a_z_offset;
1926#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1927a_z_offset=a_z_offset_width.x;
1928#endif
1929float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;gapwidth=gapwidth/2.0;float halfwidth;
1930#ifdef VARIABLE_LINE_WIDTH
1931bool left=normal.y==1.0;float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal;offset=border_width >
1931 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;
1932#else
1933halfwidth=(u_width_scale*width)/2.0;
1934#endif
1935float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1936#ifdef ELEVATED_ROADS
1937v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1938#else
1939#ifdef ELEVATED
1940vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1941#ifdef CROSS_SLOPE_VERTICAL
1942float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1943#else
1944#ifdef CROSS_SLOPE_HORIZONTAL
1945float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1946#else
1947float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1948#endif
1949#endif
1950gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1951#else
1952gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1953#endif
1954#endif
1955#ifdef ELEVATED_ROADS
1956#ifdef RENDER_SHADOWS
1957vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1958#ifdef NORMAL_OFFSET
1959vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1960#endif
1961v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1962#endif
1963#endif
1964#ifndef RENDER_TO_TEXTURE
1965float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1966#else
1967v_gamma_scale=1.0;
1968#endif
1969#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1970highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];
1971#ifdef RENDER_LINE_GRADIENT
1972highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);
1973#else
1974v_uv=vec3(a_uv_x,0.0,line_progress);
1975#endif
1976#endif
1977#ifdef RENDER_LINE_DASH
1978float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
1979#endif
1980v_width2=vec2(outset,inset);
1981#ifdef FOG
1982v_fog_pos=fog_position(pos);
1983#endif
1984#ifdef INDICATOR_CUTOUT
1985v_z_offset=a_z_offset;
1986#endif
1987}`),linePattern:Wi(`#include "_prelude_fog.fragment.glsl"
1988#include "_prelude_lighting.glsl"
1989#include "_prelude_shadow.fragment.glsl"
1990uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
1990uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1991#ifdef APPLY_LUT_ON_GPU
1992uniform highp sampler3D u_lutTexture;
1993#endif
1994#ifdef LINE_PATTERN_TRANSITION
1995uniform float u_pattern_transition;
1996#endif
1997in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1998#ifdef RENDER_LINE_TRIM_OFFSET
1999in highp vec3 v_uv;
2000#endif
2001#ifdef ELEVATED_ROADS
2002in highp float v_road_z_offset;
2003#endif
2004#ifdef LINE_JOIN_NONE
2005in vec2 v_pattern_data;
2006#endif
2007#ifdef INDICATOR_CUTOUT
2008in highp float v_z_offset;
2009#endif
2010#ifdef RENDER_SHADOWS
2011uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
2012#endif
2013#pragma mapbox: define mediump vec4 pattern
2014#ifdef LINE_PATTERN_TRANSITION
2015#pragma mapbox: define mediump vec4 pattern_b
2016#endif
2017#pragma mapbox: define mediump float pixel_ratio
2018#pragma mapbox: define mediump float blur
2019#pragma mapbox: define mediump float opacity
2020#pragma mapbox: define lowp float emissive_strength
2021void main() {
2022#pragma mapbox: initialize mediump vec4 pattern
2023#ifdef LINE_PATTERN_TRANSITION
2024#pragma mapbox: initialize mediump vec4 pattern_b
2025#endif
2026#pragma mapbox: initialize mediump float pixel_ratio
2027#pragma mapbox: initialize mediump float blur
2028#pragma mapbox: initialize mediump float opacity
2029#pragma mapbox: initialize lowp float emissive_strength
2030vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
2031#ifdef APPLY_LUT_ON_GPU
2032color=applyLUT(u_lutTexture,color);
2033#endif
2034#ifdef LINE_PATTERN_TRANSITION
2035vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
2036#endif
2037#ifdef RENDER_LINE_TRIM_OFFSET
2038highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}
2039#endif
2040#ifdef LINE_JOIN_NONE
2041highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}
2042#endif
2043#ifdef LIGHTING_3D_MODE
2044color=apply_lighting_with_emission_ground(color,emissive_strength);
2045#ifdef RENDER_SHADOWS
2046float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
2047#ifdef ELEVATED_ROADS
2048color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2049#else
2050color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2051#endif
2052#endif
2053#endif
2054#ifdef FOG
2055color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2056#endif
2057color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
2058#ifdef INDICATOR_CUTOUT
2059color=applyCutout(color,v_z_offset);
2060#endif
2061glFragColor=color;
2062#ifdef DUAL_SOURCE_BLENDING
2063glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
2064#else
2065#ifdef USE_MRT1
2066out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2067#endif
2068#endif
2069#ifdef OVERDRAW_INSPECTOR
2070glFragColor=vec4(1.0);
2071#endif
2072HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2073#include "_prelude_shadow.vertex.glsl"
2074#include "_prelude_terrain.vertex.glsl"
2075#define scale 0.015873016
2076in vec2 a_pos_normal;in vec4 a_data;
2077#if defined(ELEVATED) || defined(ELEVATED_ROADS)
2078in vec3 a_z_offset_width;
2079#endif
2080#ifdef RENDER_LINE_TRIM_OFFSET
2081in highp vec3 a_packed;
2082#endif
2083in highp float a_linesofar;
2084#ifdef LINE_JOIN_NONE
2085in highp vec3 a_pattern_data;out vec2 v_pattern_data;
2086#endif
2087#ifdef INDICATOR_CUTOUT
2088out highp float v_z_offset;
2089#endif
2090uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;
2091#ifdef ELEVATED
2092uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
2093#ifdef ELEVATION_REFERENCE_SEA
2094return 0.0;
2095#else
2096return elevation(apos);
2097#endif
2098}
2099#endif
2100out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
2101#ifdef RENDER_LINE_TRIM_OFFSET
2102out highp vec3 v_uv;
2103#endif
2104#ifdef ELEVATED_ROADS
2105out highp float v_road_z_offset;
2106#endif
2107#ifdef RENDER_SHADOWS
2108uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
2109#endif
2110#pragma mapbox: define mediump float blur
2111#pragma mapbox: define mediump float opacity
2112#pragma mapbox: define mediump float offset
2113#pragma mapbox: define mediump float gapwidth
2114#pragma mapbox: define mediump float width
2115#pragma mapbox: define mediump float floorwidth
2116#pragma mapbox: define mediump vec4 pattern
2117#ifdef LINE_PATTERN_TRANSITION
2118#pragma mapbox: define mediump vec4 pattern_b
2119#endif
2120#pragma mapbox: define mediump float pixel_ratio
2121#pragma mapbox: define lowp float emissive_strength
2122void main() {
2123#pragma mapbox: initialize mediump float blur
2124#pragma mapbox: initialize mediump float opacity
2125#pragma mapbox: initialize mediump float offset
2126#pragma mapbox: initialize mediump float gapwidth
2127#pragma mapbox: initialize mediump float width
2128#pragma mapbox: initialize mediump float floorwidth
2129#pragma mapbox: initialize mediump vec4 pattern
2130#ifdef LINE_PATTERN_TRANSITION
2131#pragma mapbox: initialize mediump vec4 pattern_b
2132#endif
2133#pragma mapbox: initialize mediump float pixel_ratio
2134#pragma mapbox: initialize lowp float emissive_strength
2135float a_z_offset;
2136#if defined(ELEVATED) || defined(ELEVATED_ROADS)
2137a_z_offset=a_z_offset_width.x;
2138#endif
2139float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
2139vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
2140#ifdef ELEVATED_ROADS
2141v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
2142#else
2143#ifdef ELEVATED
2144vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
2145#ifdef CROSS_SLOPE_VERTICAL
2146float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
2147#else
2148#ifdef CROSS_SLOPE_HORIZONTAL
2149float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
2150#else
2151float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
2152#endif
2153#endif
2154gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
2155#else
2156gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
2157#endif
2158#endif
2159#ifdef ELEVATED_ROADS
2160#ifdef RENDER_SHADOWS
2161vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
2162#ifdef NORMAL_OFFSET
2163vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
2164#endif
2165v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
2166#endif
2167#endif
2168#ifndef RENDER_TO_TEXTURE
2169float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
2170#else
2171v_gamma_scale=1.0;
2172#endif
2173#ifdef RENDER_LINE_TRIM_OFFSET
2174highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
2175#endif
2176v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
2177#ifdef LINE_JOIN_NONE
2178v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
2179#endif
2180#ifdef FOG
2181v_fog_pos=fog_position(pos);
2182#endif
2183#ifdef INDICATOR_CUTOUT
2184v_z_offset=a_z_offset;
2185#endif
2186}`),raster:Wi(`#include "_prelude_fog.fragment.glsl"
2187#include "_prelude_lighting.glsl"
2188#include "_prelude_raster_array.glsl"
2189uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;
2190#ifdef PROJECTION_GLOBE_VIEW
2191in float v_split_fade;
2192#endif
2193uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;
2194#ifndef RASTER_ARRAY
2195uniform highp sampler2D u_image0;uniform sampler2D u_image1;
2196#endif
2197#ifdef RASTER_COLOR
2198uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
2199#endif
2200void main() {vec4 color0,color1,color;vec2 value;
2201#ifdef RASTER_COLOR
2202#ifdef RASTER_ARRAY
2203#ifdef RASTER_ARRAY_LINEAR
2204value=mix(
2205raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
2206);
2207#else
2208value=mix(
2209raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
2210);
2211#endif
2212if (value.y > 0.0) value.x/=value.y;
2213#else
2214color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
2215#endif
2216color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
2217#else
2218color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
2219#endif
2220color.a*=u_opacity;
2221#ifdef GLOBE_POLES
2222color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
2223#endif
2224vec3 rgb=color.rgb;rgb=vec3(
2225dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
2226#ifdef LIGHTING_3D_MODE
2227out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
2228#endif
2229#ifdef FOG
2230highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
2231#endif
2232glFragColor=vec4(out_color*color.a,color.a);
2233#ifdef PROJECTION_GLOBE_VIEW
2234glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
2235#endif
2236#ifdef RENDER_CUTOFF
2237glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
2238#endif
2239#ifdef OVERDRAW_INSPECTOR
2240glFragColor=vec4(1.0);
2241#endif
2242#ifdef USE_MRT1
2243out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2244#endif
2245HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2246uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
2247#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2248#ifdef GLOBE_POLES
2249in vec3 a_globe_pos;in vec2 a_uv;
2250#else
2251in vec2 a_pos;in vec2 a_texture_pos;
2252#endif
2253out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
2254#ifdef PROJECTION_GLOBE_VIEW
2255out float v_split_fade;
2256#endif
2257void main() {vec2 uv;
2258#ifdef GLOBE_POLES
2259vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
2260#ifdef FOG
2261v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
2262#endif
2263#else
2264float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
2265#ifdef PROJECTION_GLOBE_VIEW
2266vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
2267v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
2267if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
2268#ifdef FOG
2269v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2270#endif
2271#else
2272gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
2273#ifdef FOG
2274v_fog_pos=fog_position(a_pos);
2275#endif
2276#endif
2277#endif
2278v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
2279#ifdef RENDER_CUTOFF
2280v_depth=gl_Position.z;
2281#endif
2282}`),rasterParticle:Wi(`#include "_prelude_fog.fragment.glsl"
2283#include "_prelude_lighting.glsl"
2284uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;
2285#ifdef LIGHTING_3D_MODE
2286out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
2287#endif
2288#ifdef FOG
2289highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
2290#endif
2291glFragColor=vec4(out_color*color.a,color.a);
2292#ifdef OVERDRAW_INSPECTOR
2293glFragColor=vec4(1.0);
2294#endif
2295HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2296uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
2297#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2298in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
2299#ifdef PROJECTION_GLOBE_VIEW
2300vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
2301#ifdef FOG
2302v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2303#endif
2304#else
2305uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
2306#ifdef FOG
2307v_fog_pos=fog_position(a_pos);
2308#endif
2309#endif
2310v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Wi("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl"
2311in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
2312mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Wi("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Wi(`#include "_prelude_raster_particle.glsl"
2313uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
2313vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(
2314linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
2315);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Wi(`#include "_prelude_lighting.glsl"
2316#include "_prelude_shadow.fragment.glsl"
2317#define SDF_PX 8.0
2318#define SDF 1.0
2319#define ICON 0.0
2320uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;
2321#ifdef ICON_TRANSITION
2322uniform float u_icon_transition;
2323#endif
2324#ifdef COLOR_ADJUSTMENT
2325uniform mat4 u_color_adj_mat;
2326#endif
2327#ifdef INDICATOR_CUTOUT
2328in highp float v_z_offset;
2329#else
2330#ifdef RENDER_SHADOWS
2331in highp float v_z_offset;
2332#endif
2333#endif
2334in vec2 v_tex_a;
2335#ifdef ICON_TRANSITION
2336in vec2 v_tex_b;
2337#endif
2338in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
2339#ifdef RENDER_TEXT_AND_SYMBOL
2340in float is_sdf;in vec2 v_tex_a_icon;
2341#endif
2342#ifdef RENDER_SHADOWS
2343uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
2344#endif
2345#ifdef APPLY_LUT_ON_GPU
2346uniform highp sampler3D u_lutTexture;
2347#endif
2348#pragma mapbox: define highp vec4 fill_color
2349#pragma mapbox: define highp vec4 halo_color
2350#pragma mapbox: define lowp float opacity
2351#pragma mapbox: define lowp float halo_width
2352#pragma mapbox: define lowp float halo_blur
2353#pragma mapbox: define lowp float emissive_strength
2354void main() {
2355#pragma mapbox: initialize highp vec4 fill_color
2356#pragma mapbox: initialize highp vec4 halo_color
2357#pragma mapbox: initialize lowp float opacity
2358#pragma mapbox: initialize lowp float halo_width
2359#pragma mapbox: initialize lowp float halo_blur
2360#pragma mapbox: initialize lowp float emissive_strength
2361vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
2362#ifdef RENDER_TEXT_AND_SYMBOL
2363if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
2364#ifdef OVERDRAW_INSPECTOR
2365glFragColor=vec4(1.0);
2366#endif
2367return;}
2368#endif
2369#ifdef RENDER_SDF
2370float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;
2371#else
2372#ifdef ICON_TRANSITION
2373vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);
2374#else
2375out_color=texture(u_texture,v_tex_a);
2376#endif
2377#ifdef APPLY_LUT_ON_GPU
2378out_color=applyLUT(u_lutTexture,out_color);
2379#endif
2380#ifdef COLOR_ADJUSTMENT
2381out_color=u_color_adj_mat*out_color;
2382#endif
2383#endif
2384out_color*=opacity*fade_opacity;
2385#ifdef LIGHTING_3D_MODE
2386out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
2387#ifdef RENDER_SHADOWS
2388float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
2389#ifdef TERRAIN
2390out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2391#else
2392out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2393#endif
2394#endif
2395#endif
2396#ifdef INDICATOR_CUTOUT
2397out_color=applyCutout(out_color,v_z_offset);
2398#endif
2399#ifdef FEATURE_CUTOUT
2400out_color=apply_feature_cutout(out_color,gl_FragCoord);
2401#endif
2402glFragColor=out_color;
2403#ifdef OVERDRAW_INSPECTOR
2404glFragColor=vec4(1.0);
2405#endif
2406HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2407#include "_prelude_shadow.vertex.glsl"
2408#define USING_APPEARANCE 1.0
2409in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
2410#ifdef Z_OFFSET
2411in float a_auto_z_offset;
2412#endif
2413#ifdef PROJECTION_GLOBE_VIEW
2414in vec3 a_globe_anchor;in vec3 a_globe_normal;
2415#endif
2416#ifdef ICON_TRANSITION
2417in vec2 a_texb;
2418#endif
2419#ifdef OCCLUSION_QUERIES
2420in float a_occlusion_query_opacity;
2421#endif
2422#ifdef ELEVATED_ROADS
2423in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2424#endif
2425#ifdef INDICATOR_CUTOUT
2426out highp float v_z_offset;
2427#else
2428#ifdef RENDER_SHADOWS
2429out highp float v_z_offset;
2430#endif
2431#endif
2432uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
2433#ifdef PROJECTION_GLOBE_VIEW
2434uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
2435#endif
2436out vec2 v_tex_a;
2437#ifdef ICON_TRANSITION
2438out vec2 v_tex_b;
2439#endif
2440out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2441#ifdef RENDER_TEXT_AND_SYMBOL
2442out float is_sdf;out vec2 v_tex_a_icon;
2443#endif
2444#ifdef RENDER_SHADOWS
2445uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
2446#endif
2447#pragma mapbox: define highp vec4 fill_color
2448#pragma mapbox: define highp vec4 halo_color
2449#pragma mapbox: define lowp float opacity
2450#pragma mapbox: define lowp float halo_width
2451#pragma mapbox: define lowp float halo_blur
2452#pragma mapbox: define lowp float emissive_strength
2453#pragma mapbox: define lowp float occlusion_opacity
2454#pragma mapbox: define lowp float z_offset
2455void main() {
2456#pragma mapbox: initialize highp vec4 fill_color
2457#pragma mapbox: initialize highp vec4 halo_color
2458#pragma mapbox: initialize lowp float opacity
2459#pragma mapbox: initialize lowp float halo_width
2460#pragma mapbox: initialize lowp float halo_blur
2461#pragma mapbox: initialize lowp float emissive_strength
2462#pragma mapbox: initialize lowp float occlusion_opacity
2463#pragma mapbox: initialize lowp float z_offset
2464vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);
2465#ifdef Z_OFFSET
2466e+=a_auto_z_offset;
2467#endif
2468vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2469#ifdef PROJECTION_GLOBE_VIEW
2470mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
2471#else
2472world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2473#endif
2474vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
2475camera_to_anchor_distance/u_camera_to_center_distance :
2476u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
24770.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
2478#ifdef PROJECTION_GLOBE_VIEW
2479vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;
2480#else
2481offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2482#endif
2483vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2484#ifdef PROJECTION_GLOBE_VIEW
2485#ifdef PROJECTED_POS_ON_VIEWPORT
2486projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2487#else
2488vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);    
2489#endif
2490#else
2491projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2492#endif
2493highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
2494#ifdef TERRAIN
2495#ifdef PITCH_WITH_MAP_TERRAIN
2496vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2497#endif
2498#endif
2499#ifdef Z_OFFSET
2500z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2501#else
2502z+=u_pitch_with_map ? z_offset : 0.0;
2503#endif
2504float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));
2505#ifdef DEPTH_OCCLUSION
2506float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2507#endif
2508#ifdef OCCLUSION_QUERIES
2509float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2510#endif
2511#ifdef Z_TEST_OCCLUSION
2512out_fade_opacity*=occlusion_opacity;
2513#endif
2514float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2515#ifdef PROJECTION_GLOBE_VIEW
2516vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2517#else
2518#ifdef ELEVATED_ROADS
2519vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2520#else
2521pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2522#endif
2523#endif
2524gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;
2525#ifdef RENDER_TEXT_AND_SYMBOL
2526is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2527#endif
2528#ifdef ICON_TRANSITION
2529v_tex_b=a_texb/u_texsize;
2530#endif
2531#ifdef RENDER_SHADOWS
2532vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2533#ifdef NORMAL_OFFSET
2534vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
2535#endif
2536v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
2537#endif
2538#ifdef INDICATOR_CUTOUT
2539v_z_offset=e;
2540#else
2541#ifdef RENDER_SHADOWS
2542v_z_offset=e;
2543#endif
2544#endif
2545}`),terrainRaster:Wi(`#include "_prelude_fog.fragment.glsl"
2546#include "_prelude_shadow.fragment.glsl"
2547#include "_prelude_lighting.glsl"
2548uniform sampler2D u_image0;
2549#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2550uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2551#endif
2552in vec2 v_pos0;
2553#ifdef FOG
2554in float v_fog_opacity;
2555#endif
2556#ifdef RENDER_SHADOWS
2557in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2558#endif
2559uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2560#ifdef LIGHTING_3D_MODE
2561const vec3 normal=vec3(0.0,0.0,1.0);
2562#ifdef RENDER_SHADOWS
2563float cutoffOpacity=1.0;
2564#ifdef RENDER_CUTOFF
2565cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2566#endif
2567#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2568float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
2569#else
2570float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
2571#endif
2572#else
2573float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2574#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2575float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;
2576#endif
2577#endif
2578#else
2579color=image_color;
2580#endif
2581#ifdef FOG
2582#ifdef ZERO_EXAGGERATION
2583color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2584#else
2585color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2586#endif
2587#endif
2588glFragColor=color;
2589#ifdef OVERDRAW_INSPECTOR
2590glFragColor=vec4(1.0);
2591#endif
2592HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2593#include "_prelude_terrain.vertex.glsl"
2594uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
2595#ifdef FOG
2596out float v_fog_opacity;
2597#endif
2598#ifdef RENDER_SHADOWS
2599uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
2600#endif
2601void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
2602#ifdef FOG
2603#ifdef ZERO_EXAGGERATION
2604v_fog_pos=fog_position(decodedPos);
2605#else
2606v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2607#endif
2608#endif
2609#ifdef RENDER_SHADOWS
2610vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
2611#endif
2612}`),terrainDepth:Wi("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2613uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Wi(`#include "_prelude_fog.fragment.glsl"
2614in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
2615cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2615nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
2616#ifdef FOG
2617sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2618#endif
2619sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2620#ifdef OVERDRAW_INSPECTOR
2621glFragColor=vec4(1.0);
2622#endif
2623}`,Cs),skyboxGradient:Wi(`#include "_prelude_fog.fragment.glsl"
2624in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
2625#ifdef FOG
2626color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2627#endif
2628color*=u_opacity;glFragColor=color;
2629#ifdef OVERDRAW_INSPECTOR
2630glFragColor=vec4(1.0);
2631#endif
2632}`,Cs),skyboxCapture:Wi
vendor: 3,792 bytes, lines 2632-2643
2632(`
2633in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
2634#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2635#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2636#define MIE_G                   0.76
2637#define DENSITY_HEIGHT_SCALE_R  8000.0
2638#define DENSITY_HEIGHT_SCALE_M  1200.0
2639#define PLANET_RADIUS           6360e3
2640#define ATMOSPHERE_RADIUS       6420e3
2641#define SAMPLE_STEPS            10
2642#define DENSITY_STEPS           4
2643float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2643Raster:Wi(`#include "_prelude_fog.fragment.glsl"
2644#include "_prelude_lighting.glsl"
2645uniform sampler2D u_image0;
2646#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2647uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2648#endif
2649uniform float u_far_z_cutoff;in vec2 v_pos0;
2650#ifndef FOG
2651uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
2652#endif
2653void main() {vec4 color;
2654#ifdef CUSTOM_ANTIALIASING
2655highp vec2 uv=gl_FragCoord.xy/u_viewport;
2656#ifdef FLIP_Y
2657uv.y=1.0-uv.y;
2658#endif
2659highp vec3 ray_dir=mix(
2660mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
2661#ifdef LIGHTING_3D_MODE
2662#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2663float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);
2664#else
2665raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2666#endif
2667#else
2668color=vec4(raster.rgb*antialias,raster.a*antialias);
2669#endif
2670#else
2671color=texture(u_image0,v_pos0);
2672#ifdef LIGHTING_3D_MODE
2673#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2674float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;
2675#else
2676color=apply_lighting_ground(color);
2677#endif
2678#endif
2679#endif
2680#ifdef FOG
2681color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2682#endif
2683color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2684#ifdef OVERDRAW_INSPECTOR
2685glFragColor=vec4(1.0);
2686#endif
2687HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2688#include "_prelude_terrain.vertex.glsl"
2689uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
2690#ifdef GLOBE_POLES
2691in vec3 a_globe_pos;in vec2 a_uv;
2692#else
2693in vec2 a_pos;
2694#endif
2695out vec2 v_pos0;void main() {
2696#ifdef GLOBE_POLES
2697vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2698#else
2699float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
2700#endif
2701v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2702#ifdef GLOBE_POLES
2703vec3 up_vector=globe_derived_up_vector;
2704#else
2705vec3 up_vector=elevationVector(tile_pos);
2706#endif
2707float height=elevation(tile_pos);globe_pos+=up_vector*height;
2708#ifndef GLOBE_POLES
2709globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2710#endif
2711#ifdef GLOBE_POLES
2712vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2713#else
2714vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
2715#endif
2716gl_Position=u_proj_matrix*interpolated_pos;
2717#ifdef FOG
2718v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2719#endif
2720}`),globeAtmosphere:Wi(`#include "_prelude_fog.fragment.glsl"
2721uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
2722#ifdef PROJECTION_GLOBE_VIEW
2723globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
2724#ifdef ALPHA_PASS
2725glFragColor=vec4(0,0,0,0);return;
2726#else
2727#ifdef NATIVE
2728glFragColor=vec4(1,1,1,1);
2729#else
2730glFragColor=vec4(0,0,0,1);
2731#endif
2732return;
2733#endif
2734}
2735#endif
2736highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
27370.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2738#ifdef PROJECTION_GLOBE_VIEW
2739highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
2740PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
2741#else
2742horizon_angle=horizon_angle_mercator;
2743#endif
2744horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2744vec3 color_stop_2=u_space_color.rgb;
2745#ifdef ALPHA_PASS
2746float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
2747#else
2748vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);
2749#endif
2750}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
2751mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
2752mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Wi(`#include "_prelude_fog.fragment.glsl"
2753#include "_prelude_shadow.fragment.glsl"
2754#include "_prelude_lighting.glsl"
2755uniform float u_opacity;
2756#ifdef DITHERED_DISCARD
2757uniform float u_dithered_discard_threshold;
2758#endif
2759uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2760#ifdef RENDER_SHADOWS
2761in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2762#endif
2763#ifdef OCCLUSION_TEXTURE_TRANSFORM
2764uniform vec4 u_occlusionTextureTransform;
2765#endif
2766#pragma mapbox: define-attribute highp vec3 normal_3f
2767#pragma mapbox: define-attribute highp vec3 color_3f
2768#pragma mapbox: define-attribute highp vec4 color_4f
2769#pragma mapbox: define-attribute highp vec2 uv_2f
2770#pragma mapbox: initialize-attribute highp vec3 normal_3f
2771#pragma mapbox: initialize-attribute highp vec3 color_3f
2772#pragma mapbox: initialize-attribute highp vec4 color_4f
2773#pragma mapbox: initialize-attribute highp vec2 uv_2f
2774#ifdef HAS_ATTRIBUTE_a_pbr
2775in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2776#endif
2777#ifdef HAS_TEXTURE_u_baseColorTexture
2778uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2779#endif
2780#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2781uniform sampler2D u_metallicRoughnessTexture;
2782#endif
2783#ifdef HAS_TEXTURE_u_occlusionTexture
2784uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2785#endif
2786#ifdef HAS_TEXTURE_u_normalTexture
2787uniform sampler2D u_normalTexture;
2788#endif
2789#ifdef HAS_TEXTURE_u_emissionTexture
2790uniform sampler2D u_emissionTexture;
2791#endif
2792#ifdef APPLY_LUT_ON_GPU
2793uniform highp sampler3D u_lutTexture;
2794#endif
2795#ifdef TERRAIN_FRAGMENT_OCCLUSION
2796in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2797#ifdef DEPTH_D24
2798highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2799#else
2800highp float unpack_depth_rgba(highp vec4 rgba_depth)
2801{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
2802#endif
2803bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2804#ifdef FLIP_Y
2805coord.y=1.0-coord.y;
2806#endif
2807#ifdef DEPTH_D24
2808highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2809#else
2810highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2811#endif
2812return v_depth > depth+0.0005;}
2813#endif
2814#define saturate(_x) clamp(_x,0.,1.)
2815vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
2816{
2817#ifdef LIGHTING_3D_MODE
2818vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2819#ifdef RENDER_SHADOWS
2820lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2821#else
2822lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2823#endif
2824return apply_lighting(albedo,transformed_normal,lighting_factor);
2825#else
2826vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2826Color),vec3(1.0));return c3;
2827#endif
2828}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2829#ifdef HAS_ATTRIBUTE_a_color_3f
2830albedo*=vec4(color_3f,1.0);
2831#endif
2832#ifdef HAS_ATTRIBUTE_a_pbr
2833#else
2834#ifdef HAS_ATTRIBUTE_a_color_4f
2835albedo*=color_4f;
2836#endif
2837#endif
2838#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2839vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2840#ifdef UNPREMULT_TEXTURE_IN_SHADER
2841if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2842#endif
2843if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2844#endif
2845vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2846#ifdef APPLY_LUT_ON_GPU
2847color=applyLUT(u_lutTexture,color);
2848#endif
2849return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2850#ifdef HAS_TEXTURE_u_normalTexture
2851highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;
2852#ifdef FLIP_Y
2853T=-T;B=-B;
2854#endif
2855highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
2856#else
2857return mat3(1.0);
2858#endif
2859}highp vec3 getNormal(){highp vec3 n;
2860#ifdef HAS_ATTRIBUTE_a_normal_3f
2861n=normalize(normal_3f);
2862#else
2863highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));
2864#ifdef FLIP_Y
2865n=normalize(cross(fdx,fdy));
2866#else
2867n=normalize(cross(fdx,fdy))*-1.0;
2868#endif
2869#endif
2870#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2871vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
2872#endif
2873return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
2874#ifdef HAS_ATTRIBUTE_a_pbr
2875mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2876#endif
2877#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2878vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2879#endif
2880const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
2881{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
2882{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2883{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
2884{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
2885{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
2886{
2887#ifdef LIGHTING_3D_MODE
2888return mat.diffuseColor;
2889#else
2890return mat.diffuseColor/PI;
2891#endif
2892}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2893{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
2894{vec3 env_light=vec3(0.65,0.65,0.65);
2895#ifdef LIGHTING_3D_MODE
2896float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2897#endif
2898vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
2899{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
2900#ifdef RENDER_SHADOWS
2901lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2902#else
2903lighting_factor=NdotL;
2904#endif
2905vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2905Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2906#if !defined(LIGHTING_3D_MODE)
2907const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
2908#endif
2909color*=intensityFactor;return color;}void main() {
2910#ifdef TERRAIN_FRAGMENT_OCCLUSION
2911if (isOccluded()) {discard;}
2912#endif
2913vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2914#ifdef LIGHTING_3D_MODE
2915lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2916#endif
2917vec4 finalColor;
2918#ifdef DIFFUSE_SHADED
2919vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2920#ifdef HAS_TEXTURE_u_occlusionTexture
2921float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2922#endif
2923finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2924#else
2925Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2926#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2927#ifdef OCCLUSION_TEXTURE_TRANSFORM
2928vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2929#else
2930vec2 uv=uv_2f;
2931#endif
2932ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2933#endif
2934vec4 emissive=u_emissiveFactor;
2935#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2936emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2937#endif
2938#ifdef APPLY_LUT_ON_GPU
2939float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2940#endif
2941color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2942#ifdef HAS_ATTRIBUTE_a_pbr
2943float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;
2944#ifdef APPLY_LUT_ON_GPU
2945color_mix=applyLUT(u_lutTexture,color_mix);
2946#endif
2947color=mix(color,color_mix,min(1.0,resEmission));
2948#ifdef HAS_ATTRIBUTE_a_color_4f
2949float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2949y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
2950#endif
2951#endif
2952vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2953#endif
2954#ifdef DITHERED_DISCARD
2955if (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}
2956#endif
2957#ifdef FOG
2958finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2959#endif
2960#ifdef RENDER_CUTOFF
2961finalColor*=v_cutoff_opacity;
2962#endif
2963#ifdef INDICATOR_CUTOUT
2964finalColor=applyCutout(finalColor,v_position_height.w);
2965#endif
2966#ifdef FEATURE_CUTOUT
2967finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
2968#endif
2969glFragColor=finalColor;
2970#ifdef OVERDRAW_INSPECTOR
2971glFragColor=vec4(1.0);
2972#endif
2973HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2974#include "_prelude_shadow.vertex.glsl"
2975in vec3 a_pos_3f;
2976#pragma mapbox: define-attribute highp vec3 normal_3f
2977#pragma mapbox: define-attribute highp vec2 uv_2f
2978#pragma mapbox: define-attribute highp vec3 color_3f
2979#pragma mapbox: define-attribute highp vec4 color_4f
2980#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2981#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2982uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2983#ifdef INSTANCED_ARRAYS
2984in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2985#else
2986uniform highp mat4 u_normal_matrix;
2987#endif
2988#ifdef RENDER_SHADOWS
2989uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
2990#endif
2991out vec4 v_position_height;out lowp vec4 v_color_mix;
2992#ifdef TERRAIN_FRAGMENT_OCCLUSION
2993out highp float v_depth;
2994#endif
2995#ifdef HAS_ATTRIBUTE_a_pbr
2996out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2997#endif
2998vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2999#pragma mapbox: initialize-attribute highp vec3 normal_3f
3000#pragma mapbox: initialize-attribute highp vec2 uv_2f
3001#pragma mapbox: initialize-attribute highp vec3 color_3f
3002#pragma mapbox: initialize-attribute highp vec4 color_4f
3003#pragma mapbox: initialize-attribute-custom highp vec4 pbr
3004#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
3005highp mat4 normal_matrix;
3006#ifdef INSTANCED_ARRAYS
3007normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
3008#else
3009normal_matrix=u_normal_matrix;
3010#endif
3011vec3 local_pos;mat3 rs;
3012#ifdef MODEL_POSITION_ON_GPU
3013vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
3014#else
3015local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
3016#endif
3017v_position_height.w=a_pos_3f.z;
3018#ifdef HAS_ATTRIBUTE_a_pbr
3019vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
3020#endif
3021#ifdef FOG
3022v_fog_pos=fog_position(local_pos);
3023#endif
3024#ifdef RENDER_CUTOFF
3025v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
3026#endif
3027#ifdef TERRAIN_FRAGMENT_OCCLUSION
3028v_depth=gl_Position.z/gl_Position.w;
3029#ifdef CLIP_ZERO_TO_ONE
3030v_depth=-1.0+2.0*v_depth; 
3031#endif
3032#endif
3033#ifdef HAS_ATTRIBUTE_a_normal_3f
3034#ifdef MODEL_POSITION_ON_GPU
3035float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
3036#else
3037normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
3038#endif
3039#endif
3040#ifdef HAS_ATTRIBUTE_a_pbr
3041#ifdef HAS_ATTRIBUTE_a_color_4f
3042v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
3043#endif
3044#endif
3045#ifdef RENDER_SHADOWS
3046vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
3047#ifdef NORMAL_OFFSET
3048#ifdef HAS_ATTRIBUTE_a_normal_3f
3049#ifdef MODEL_POSITION_ON_GPU
3050vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
3051#else
3052vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
3053#endif
3054#endif
3055#endif
3056v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;
3057#endif
3058}`),modelDepth:Wi(`in highp float v_depth;void main() {
3059#ifndef DEPTH_TEXTURE
3060glFragColor=pack_depth(v_depth);
3061#endif
3062}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
3063#ifdef MODEL_POSITION_ON_GPU
3064#ifdef INSTANCED_ARRAYS
3065in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
3066#else
3067uniform highp mat4 u_instance;
3068#endif
3069uniform highp mat4 u_node_matrix;
3070#endif
3071void main() {
3072#ifdef MODEL_POSITION_ON_GPU
3073highp mat4 instance;
3074#ifdef INSTANCED_ARRAYS
3075instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
3076#else
3077instance=u_instance;
3078#endif
3079vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
3079rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);
3080#else
3081gl_Position=u_matrix*vec4(a_pos_3f,1);
3082#endif
3083v_depth=gl_Position.z/gl_Position.w;}`),stars:Wi(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
3084{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
3085in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Wi("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",`
3086in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
3087uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
3088uniform float u_horizontalOscillationRate; 
3089uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
3090localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Wi("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",`
3091in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
3092uniform float u_velocity; 
3093uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
3093pos*=halfBoxSize; 
3094pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+
3095localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Wi("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Wi("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
3096in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;
3097#ifdef TERRAIN
3098float e=elevation(world_pos.xy);world_pos.z+=e;
3099#endif
3100vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function po(c,t){const o=c.split(`
3101`);for(let u of o){if(u=u.trimStart(),u[0]!=="#"||!u.includes("if")||u.startsWith("#endif"))continue;const p=u.match(da);if(p)for(const g of p)Ll.has(g)||t.add(g)}}function Wi(c,t){const o=new Set,u=[],p=[];c=c.replace(nl,(y,b)=>(p.push(b),"")),t=t.replace(nl,(y,b)=>(u.push(b),""));let g=new Set(fa);po(c,g),po(t,g);for(const y of[...u,...p])Wc[y]||(Wc[y]=new Set,po(Ol[y],Wc[y])),g=new Set([...g,...Wc[y]]);return{fragmentSource:c=c.replace(rl,(y,b,T,C,I)=>(o.add(I),b==="define"?`
3102#ifndef HAS_UNIFORM_u_${I}
3103in ${T} ${C} ${I};
3104#else
3105uniform ${T} ${C} u_${I};
3106#endif
3107`:b==="initialize"?`
3108#ifdef HAS_UNIFORM_u_${I}
3109    ${T} ${C} ${I} = u_${I};
3110#endif
3111`:b==="define-attribute"?`
3112#ifdef HAS_ATTRIBUTE_a_${I}
3113    in ${T} ${C} ${I};
3114#endif
3115`:b==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(rl,(y,b,T,C,I)=>{const B=`MATERIAL_ATTRIBUTE_OFFSET_${I}`,L=C==="float"?"vec2":C,N=`GET_ATTRIBUTE_${L}(a_${I}, materialInfo, ${B})`,H=I.match(/color/)?"color":L;return b==="define-attribute-vertex-shader-only"?`
3116#ifdef HAS_ATTRIBUTE_a_${I}
3117in ${T} ${C} a_${I};
3118#endif
3119`:o.has(I)?b==="define"?`
3120#ifndef HAS_UNIFORM_u_${I}
3121uniform lowp float u_${I}_t;
3122    #if !defined(${B})
3123        in ${T} ${L} a_${I};
3124    #endif
3125out ${T} ${C} ${I};
3126#else
3127uniform ${T} ${C} u_${I};
3128#endif
3129`:b==="initialize"?H==="vec4"?`
3130#ifndef HAS_UNIFORM_u_${I}
3131    ${I} = a_${I};
3132#else
3133    ${T} ${C} ${I} = u_${I};
3134#endif
3135`:`
3136#if !defined(HAS_UNIFORM_u_${I})
3137    #ifdef ${B}
3138        ${I} = unpack_mix_${H}(${N}, u_${I}_t);
3139    #else
3140        ${I} = unpack_mix_${H}(a_${I}, u_${I}_t);
3141    #endif
3142#else
3143    ${T} ${C} ${I} = u_${I};
3144#endif
3145`:b==="define-attribute"?`
3146#ifdef HAS_ATTRIBUTE_a_${I}
3147    in ${T} ${C} a_${I};
3148    out ${T} ${C} ${I};
3149#endif
3150`:b==="initialize-attribute"?`
3151#ifdef HAS_ATTRIBUTE_a_${I}
3152    ${I} = a_${I};
3153#endif
3154`:void 0:b==="define"?`
3155#ifndef HAS_UNIFORM_u_${I}
3156uniform lowp float u_${I}_t;
3157    #if !defined(${B})
3158        in ${T} ${L} a_${I};
3159    #endif
3160#else
3161uniform ${T} ${C} u_${I};
3162#endif
3163`:b==="define-instanced"?H==="mat4"?`
3164#ifdef INSTANCED_ARRAYS
3165in vec4 a_${I}0;
3166in vec4 a_${I}1;
3167in vec4 a_${I}2;
3168in vec4 a_${I}3;
3169#else
3170uniform ${T} ${C} u_${I};
3171#endif
3172`:`
3173#ifdef INSTANCED_ARRAYS
3174in ${T} ${L} a_${I};
3175#else
3176uniform ${T} ${C} u_${I};
3177#endif
3178`:b==="initialize-attribute-custom"?`
3179#ifdef HAS_ATTRIBUTE_a_${I}
3180    ${T} ${C} ${I} = a_${I};
3181#endif
3182`:H==="vec4"?`
3183#ifndef HAS_UNIFORM_u_${I}
3184    #ifdef ${B}
3185        ${T} ${C} ${I} = ${N};
3186    #else
3187        ${T} ${C} ${I} = a_${I};
3188    #endif
3189#else
3190    ${T} ${C} ${I} = u_${I};
3191#endif
3192`:`
3193#ifndef HAS_UNIFORM_u_${I}
3194    #ifdef ${B}
3195        ${T} ${C} ${I} = unpack_mix_${H}(${N}, u_${I}_t);
3196    #else
3197        ${T} ${C} ${I} = unpack_mix_${H}(a_${I}, u_${I}_t);
3198    #endif
3199#else
3200    ${T} ${C} ${I} = u_${I};
3201#endif
3202`}),usedDefines:g,vertexIncludes:u,fragmentIncludes:p}}class Xu{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,o,u,p,g,y,b,T){this.context=t;let C=this.boundPaintVertexBuffers.length!==p.length;for(let B=0;!C&&B<p.length;B++)this.boundPaintVertexBuffers[B]!==p[B]&&(C=!0);let I=this.boundDynamicVertexBuffers.length!==b.length;for(let B=0;!I&&B<b.length;
vendor: 43,554 bytes, lines 3202-3203
3202B++)this.boundDynamicVertexBuffers[B]!==b[B]&&(I=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==u||C||I||this.boundIndexBuffer!==g||this.boundVertexOffset!==y)this.freshBind(o,u,p,g,y,b,T);else{t.bindVertexArrayOES.set(this.vao);for(const B of b)B&&(B.bind(),T&&B.instanceCount&&B.setVertexAttribDivisor(t.gl,o,T));g&&g.dynamicDraw&&g.bind()}}freshBind(t,o,u,p,g,y,b){const T=this.context,C=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=p,this.boundVertexOffset=g,this.boundDynamicVertexBuffers=y,o.enableAttributes(C,t),o.bind(),o.setVertexAttribPointers(C,t,g);for(const I of u)I.enableAttributes(C,t),I.bind(),I.setVertexAttribPointers(C,t,g);for(const I of y)I&&(I.enableAttributes(C,t),I.bind(),I.setVertexAttribPointers(C,t,g),b&&I.instanceCount&&I.setVertexAttribDivisor(C,t,b));p&&p.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function hf(c,t){const o=Math.pow(2,t.canonical.z),u=t.canonical.y;return[new a.ae(0,u/o).toLngLat().lat,new a.ae(0,(u+1)/o).toLngLat().lat]}function Qh(c,t,o,u,p,g,y){const b=c.context,T=b.gl,C=o.hillshadeFBO;if(!C)return;c.prepareDrawTile();const I=c.isTileAffectedByFog(t),B=[];c.terrain&&c.terrain.renderingToTexture&&c.emissiveMode==="mrt-fallback"&&B.push("USE_MRT1");const L=c.getOrCreateProgram("hillshade",{overrideFog:I,defines:B});b.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,C.colorAttachment0.get());const N=((W,ne,ie,ee)=>{const xe=ie.paint.get("hillshade-shadow-color"),me=ie.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ye=ie.paint.get("hillshade-highlight-color"),de=ie.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",se=ie.paint.get("hillshade-accent-color"),Te=ie.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Ae=ie.paint.get("hillshade-emissive-strength");let Re=a.an(ie.paint.get("hillshade-illumination-direction"));if(ie.paint.get("hillshade-illumination-anchor")==="viewport")Re-=W.transform.angle;else if(W.style&&W.style.enable3dLights()&&W.style.directionalLight){const Le=W.style.directionalLight.properties.get("direction"),$e=a.d4(Le.x,Le.y,Le.z);Re=a.an($e[1])}const Be=!W.options.moving;return{u_matrix:ee||W.transform.calculateProjMatrix(ne.tileID.toUnwrapped(),Be),u_image:0,u_latrange:hf(0,ne.tileID),u_light:[ie.paint.get("hillshade-exaggeration"),Re],u_shadow:xe.toPremultipliedRenderColor(me?null:ie.lut),u_highlight:ye.toPremultipliedRenderColor(de?null:ie.lut),u_emissive_strength:Ae,u_accent:se.toPremultipliedRenderColor(Te?null:ie.lut)}})(c,o,u,c.terrain?t.projMatrix:null);c.uploadCommonUniforms(b,L,t.toUnwrapped());const{tileBoundsBuffer:H,tileBoundsIndexBuffer:j,tileBoundsSegments:q}=c.getTileBoundsBuffers(o);L.draw(c,T.TRIANGLES,p,g,y,di.disabled,N,u.id,H,j,q)}function Ma(c,t,o){if(!t.needsDEMTextureUpload)return;const u=c.context,p=u.gl;u.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||c.getTileTexture(o.stride);const g=o.getPixels();t.demTexture?t.demTexture.update(g,{premultiply:!1}):t.demTexture=new a.T(u,g,p.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function ds(c,t,o){const u=c.context,p=u.gl;if(!t.dem)return;const g=t.dem;if(u.activeTexture.set(p.TEXTURE1),Ma(c,t,g),!t.demTexture)return;t.demTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE);const y=g.dim;u.activeTexture.set(p.TEXTURE0);let b=t.hillshadeFBO;if(!b){const L=new a.T(u,{width:y,height:y,data:null},p.RGBA8);L.bind(p.LINEAR,p.CLAMP_TO_EDGE),b=t.hillshadeFBO=u.createFramebuffer(y,y,1,"renderbuffer"),b.colorAttachment0.set(L.texture)}u.bindFramebuffer.set(b.framebuffer),u.viewport.set([0,0,y,y]);const{tileBoundsBuffer:T,tileBoundsIndexBuffer:C,tileBoundsSegments:I}=c.getMercatorTileBoundsBuffers(),B=[];c.linearFloatFilteringSupported()&&B.push("TERRAIN_DEM_FLOAT_FORMAT"),c.terrain&&c.terrain.renderingToTexture&&c.emissiveMode==="mrt-fallback"&&B.push("USE_MRT1"),c.getOrCreateProgram("hillshadePrepare",{defines:B}).draw(c,p.TRIANGLES,ti.disabled,yi.disabled,bi.unblended,di.disabled,((L,N)=>{const H=N.stride,j=a.bC();return a.ce(j,0,a.al,-a.al,0,0,1),a.br(j,j,[0,-a.al,0]),{u_matrix:j,u_image:1,u_dimension:[H,H],u_zoom:L.overscaledZ}})(t.tileID,g),o.id,T,C,I),t.needsHillshadePrepare=!1}class Sn{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ol extends Sn{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Is extends Sn{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Rs extends Sn{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Jh extends Sn{getDefault(){return[!0,!0,!0,!0]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ed extends Sn{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Bl extends Sn{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Yc extends Sn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Qr extends Sn{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class sr extends Sn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class Bn extends Sn{getDefault(){return[0,1]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class al extends Sn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ha extends Sn{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class dc extends Sn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class zs extends Sn{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class td extends Sn{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class df extends Sn{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class kl extends Sn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class Ds extends Sn{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ff extends Sn{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Wu=class extends Sn{getDefault(){return null}set(c){(c!==this.current||this.dirty)&&(this.gl.useProgram(c),this.current=c,this.dirty=!1)}};class pf extends Sn{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class fs extends Sn{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class sl extends Sn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class fc extends Sn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Fl extends Sn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class vp extends Sn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class id extends Sn{getDefault(){return null}set(t){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class pc extends Sn{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Yu extends Sn{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Nl extends Sn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Co extends Sn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Kc extends Sn{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class nd extends Kc{constructor(t,o,u=0){super(t,o),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+u}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachmentPoint,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ku extends Kc{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class rd extends Kc{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Om extends Ku{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Wn=(c,t,o,u)=>({u_matrix:c,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:o,u_emissive_texture_available:u}),Qu=(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q)=>({u_proj_matrix:Float32Array.from(c),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(u),u_merc_matrix:o,u_zoom_transition:p,u_merc_center:g,u_image0:0,u_image1:1,u_frustum_tl:y,u_frustum_tr:b,u_frustum_br:T,u_frustum_bl:C,u_globe_pos:I,u_globe_radius:B,u_viewport:L,u_grid_matrix:q?Float32Array.from(q):new Float32Array(9),u_skirt_height:N,u_far_z_cutoff:H,u_emissive_texture_available:j});function Ul(c,t){return c!=null&&t!=null&&!(!c.hasData()||!t.hasData())&&c.demTexture!=null&&t.demTexture!=null&&c.tileID.key!==t.tileID.key}const qa=new class{constructor(){this.operations={}}newMorphing(c,t,o,u,p){if(c in this.operations){const g=this.operations[c];g.to.tileID.key!==o.tileID.key&&(g.queued=o)}else this.operations[c]={startTime:u,phase:0,duration:p,from:t,to:o,queued:null}}getMorphValuesForProxy(c){if(!(c in this.operations))return null;const t=this.operations[c];return{from:t.from,to:t.to,phase:t.phase}}update(c){for(const t in this.operations){const o=this.operations[t];for(o.phase=(c-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,c)){delete this.operations[t];break}}}_nextOp(c,t){return!!c.queued&&(c.from=c.to,c.to=c.queued,c.queued=null,c.phase=0,c.startTime=t,!0)}_validOp(c){return c.from.hasData()&&c.to.hasData()}},Ju={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Vl(c,t,o){if(t===0)return 0;const u=t<1&&o===514?.25/t:1;return 6*Math.pow(1.5,22-c)*Math.max(t,1)*u}function mc(c,t){const o=1<<c.z;return!t&&(c.x===0||c.x===o-1)||c.y===0||c.y===o-1}function eh(c,t){if(!c.style||!c.style.enable3dLights())return;const o=c.context,u=o.gl;o.activeTexture.set(u.TEXTURE1),t?t.bind(u.LINEAR,u.CLAMP_TO_EDGE):c.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}const th=c=>({u_matrix:c});function od(c,t,o,u,p){if(p>0){const g=a.o.now(),y=(g-c.timeAdded)/p,b=t?(g-t.timeAdded)/p:-1,T=o.getSource(),C=u.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),I=!t||Math.abs(t.tileID.overscaledZ-C)>Math.abs(c.tileID.overscaledZ-C),B=I&&c.refreshedUponExpiration?1:a.aA(I?y:1-b,0,1);return t?{opacity:1,mix:1-B,isFading:y<1}:{opacity:B,mix:0,isFading:y<1}}return{opacity:1,mix:0,isFading:!1}}class ad extends Nr{constructor(t){const o=os("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",o,!1),o.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,o){t.state="loaded",o(null)}}class jl extends Nr{constructor(t){const o=os("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",o,!1),o.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,o,u){if(t.freezeTileCoverage)return;this.transform=t;const p=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((g,y)=>{if(g[y.key]="",!this._tiles[y.key]){const b=new Al(y,this._source.tileSize*y.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);b.state="loaded",this._tiles[y.key]=b}return g},{});for(const g in this._tiles)g in p||(this.freeFBO(g),this._tiles[g].unloadVectorData(),delete this._tiles[g])}freeFBO(t){const o=this.proxyCachedFBO[t];if(o!==void 0){const u=Object.values(o);this.renderCachePool.push(...u),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class sd extends a.aQ{constructor(t,o,u){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=o,this.projMatrix=u}}class ih extends a.bV{constructor(t,o){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[u,p,g]=(function(){const T=new a.bd,C=new a.b0,I=131;T.reserve(17161),C.reserve(33800);const B=a.al/128,L=a.al+B/2,N=L+B;for(let j=-B;j<N;j+=B)for(let q=-B;q<N;q+=B){const W=q<0||q>L||j<0||j>L?24575:0,ne=a.aA(Math.round(q),0,a.al),ie=a.aA(Math.round(j),0,a.al);T.emplaceBack(ne+W,ie)}const H=(j,q)=>{const W=q*I+j;C.emplaceBack(W+1,W,W+I),C.emplaceBack(W+I,W+I+1,W+1)};for(let j=1;j<129;j++)for(let q=1;q<129;q++)H(q,j);return[0,129].forEach(j=>{for(let q=0;q<130;q++)H(q,j),H(j,q)}),[T,C,32768]})(),y=t.context;this.gridBuffer=y.createVertexBuffer(u,a.bf.members),this.gridIndexBuffer=y.createIndexBuffer(p),this.gridSegments=a.bg.simpleSegment(0,0,u.length,p.length),this.gridNoSkirtSegments=a.bg.simpleSegment(0,0,u.length,g),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new jl(o.map),this.orthoMatrix=a.bC(),a.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.al,0,a.al,0,1);const b=y.gl;this._overlapStencilMode=new yi({func:b.GEQUAL,mask:255},0,255,b.KEEP,b.KEEP,b.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new ad(o.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,o,u){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const p=t.terrain.properties,g=t.terrain.drapeRenderMode===0,y=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.o.now();const b=t.terrain&&t.terrain.scope,T=p.get("source"),C=g?this._mockSourceCache:t.getSourceCache(T,b);if(!C)return void a.w(`Couldn't find terrain source "${T}".`);if(this.sourceCache=C,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=y?this.calculateExaggeration(o):p.get("exaggeration"),!o.projection.requiresDraping&&y&&this._exaggeration===0)return void this._disable();this.enabled=!0;const I=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
3203This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const B=this.getScaledDemTileSize();this.sourceCache.update(o,B,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,I(),this._initializing=!0),I(),o.updateElevation(!0,u),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=o.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const o=this._previousCameraAltitude,u=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=u;const p=o!=null?u-o:Number.MAX_VALUE;if(Math.abs(p)<2)return this._exaggeration;const g=t.zoom,y=this._style.terrain;if(!this._previousUpdateTimestamp)return y.getExaggeration(g);let b=g-this._previousZoom;const T=this._previousUpdateTimestamp;let C=g;this._evaluationZoom!=null&&(C=this._evaluationZoom,Math.abs(g-C)>.5&&(b=.5*(g-C+b)),b*p<0&&(C+=b)),this._evaluationZoom=C;const I=y.getExaggeration(C),B=I===y.getExaggeration(Math.max(0,C-.1));if(B&&Math.abs(I-this._exaggeration)<.01)return I;let L=Math.min(.1,.00375*(this._updateTimestamp-T));return(B||I<.1||Math.abs(b)<1e-4)&&(L=Math.min(.2,4*L)),a.ak(this._exaggeration,I,L)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.dataType==="source"&&t.coord?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,u=this.painter.transform;this._initializing&&(this._initializing=u._centerAltitude===0&&this.getAtPointOrZero(a.ae.fromLngLat(u.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const p=this.proxyCoords=o.getIds().map(T=>{const C=o.getTileByID(T).tileID;return C.projMatrix=u.calculateProjMatrix(C.toUnwrapped()),C});(function(T,C){const I=C.transform.pointCoordinate(C.transform.getCameraPoint()),B=new a.P(I.x,I.y);T.sort((L,N)=>{if(N.overscaledZ-L.overscaledZ)return N.overscaledZ-L.overscaledZ;const H=new a.P(L.canonical.x+(1<<L.canonical.z)*L.wrap,L.canonical.y),j=new a.P(N.canonical.x+(1<<N.canonical.z)*N.wrap,N.canonical.y),q=B.mult(1<<L.canonical.z);return q.x-=.5,q.y-=.5,q.distSqr(H)-q.distSqr(j)})})(p,this.painter);const g=this.proxyToSource||{};this.proxyToSource={},p.forEach(T=>{this.proxyToSource[T.key]={}}),this.terrainTileForTile={};const y=this._style._mergedSourceCaches;for(const T in y){const C=y[T];if(!C.used||(C!==this.sourceCache&&this.resetTileLookupCache(C.id),this._setupProxiedCoordsForOrtho(C,t[T],g),C.usedForTerrain))continue;const I=t[T];C.getSource().reparseOverscaled&&this._assignTerrainTiles(I)}this.proxiedCoords[o.id]=p.map(T=>new sd(T,T.key,this.orthoMatrix)),this._assignTerrainTiles(p),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(g),this.renderingToTexture=!1;const b={};this._visibleDemTiles=[];for(const T of this.proxyCoords){const C=this.terrainTileForTile[T.key];if(!C)continue;const I=C.tileID.key;I in b||(this._visibleDemTiles.push(C),b[I]=I)}}_assignTerrainTiles(t){this._initializing||t.forEach(o=>{if(this.terrainTileForTile[o.key])return;const u=this._findTileCoveringTileID(o,this.sourceCache);u&&(this.terrainTileForTile[o.key]=u)})}_prepareDEMTextures(){const t=this.painter.context,o=t.gl;for(const u in this.terrainTileForTile){const p=this.terrainTileForTile[u],g=p.dem;!g||p.demTexture&&!p.needsDEMTextureUpload||(t.activeTexture.set(o.TEXTURE1),Ma(this.painter,p,g))}}_prepareDemTileUniforms(t,o,u,p){if(!o||o.demTexture==null)return!1;const g=t.tileID.canonical,y=Math.pow(2,o.tileID.canonical.z-g.z),b=p||"";return u[`u_dem_tl${b}`]=[g.x*y%1,g.y*y%1],u[`u_dem_scale${b}`]=y,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const o=this._visibleDemTiles.reduce((u,p)=>{if(!p.dem)return u;const g=p.dem.tree.minimums[0];return g>0&&t++,u+g},0);return t?o/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,o=t.gl;t.activeTexture.set(o.TEXTURE2);const u=this._getLoadedAreaMinimum(),p=new a.dL({width:1,height:1},new Float32Array([u]));this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(p,{premultiply:!1}):g=this._emptyDEMTexture=new a.T(t,p,o.R32F,{premultiply:!1}),g}setupElevationDraw(t,o,u){const p=this.painter.context,g=p.gl,y={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};y.u_exaggeration=this.exaggeration();let b=null,T=null,C=1;if(u&&u.morphing&&this._useVertexMorphing){const N=u.morphing.srcDemTile,H=u.morphing.dstDemTile;C=u.morphing.phase,N&&H&&(this._prepareDemTileUniforms(t,N,y,"_prev")&&(T=N),this._prepareDemTileUniforms(t,H,y)&&(b=H))}const I=N=>N&&N.demTexture&&this.painter.linearFloatFilteringSupported()?g.LINEAR:g.NEAREST;let B=null;var L;if(this.enabled?T&&b?(B=b.demTexture,p.activeTexture.set(g.TEXTURE4),T.demTexture.bind(I(T),g.CLAMP_TO_EDGE),y.u_dem_lerp=C):(b=this.terrainTileForTile[t.tileID.key],B=this._prepareDemTileUniforms(t,b,y)?b.demTexture:this.emptyDEMTexture):B=this.emptyDEMTexture,p.activeTexture.set(g.TEXTURE2),B&&(y.u_dem_size=(L=B).size[0]===1?1:L.size[0]-2,B.bind(I(b),g.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(u&&u.useDepthForOcclusion,o,y),u&&u.useMeterToDem&&b){const N=(1<<b.tileID.canonical.z)*a.cf(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;y.u_meter_to_dem=N}if(u&&u.labelPlaneMatrixInv&&(y.u_label_plane_matrix_inv=u.labelPlaneMatrixInv),o.setTerrainUniformValues(p,y),this.painter.transform.projection.name==="globe"){const N=this.globeUniformValues(this.painter.transform,t.tileID.canonical,u&&u.useDenormalizedUpVectorScale);o.setGlobeUniformValues(p,N)}}globeUniformValues(t,o,u){const p=t.projection;return{u_tile_tl_up:p.upVector(o,0,0),u_tile_tr_up:p.upVector(o,a.al,0),u_tile_br_up:p.upVector(o,a.al,a.al),u_tile_bl_up:p.upVector(o,0,a.al),u_tile_up_scale:u?a.dM(1):p.upVectorScale(o,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const o=this.painter,u=this.painter.context;t.length!==0&&(u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,(function(p,g,y,b,T){if(p.transform.projection.name==="globe")(function(C,I,B,L,N){const H=C.context,j=H.gl;let q,W;const ne=C.transform,ie=a.dE(C,H,ne),ee=(Be,Le)=>{if(W===Le)return;const $e=[Ju[Le],"PROJECTION_GLOBE_VIEW"];ie&&$e.push("CUSTOM_ANTIALIASING");const ot=C.isTileAffectedByFog(Be);q=C.getOrCreateProgram("globeRaster",{defines:$e,overrideFog:ot}),W=Le},xe=C.colorModeForRenderPass(),me=new ti(j.LEQUAL,ti.ReadWrite,C.depthRangeFor3D);qa.update(N);const ye=a.dF(ne),de=[a.aF(ne.center.lng),a.aJ(ne.center.lat)],se=C.globeSharedBuffers,Te=[ne.width*a.o.devicePixelRatio,ne.height*a.o.devicePixelRatio],Ae=Float32Array.from(ne.globeMatrix),Re={useDenormalizedUpVectorScale:!0};{const Be=C.transform,Le=Vl(Be.zoom,I.exaggeration(),I.sourceCache._source.tileSize);W=-1;const $e=j.TRIANGLES;for(const ot of L){const Fe=B.getTile(ot),Se=yi.disabled,Ke=I.prevTerrainTileForTile[ot.key],Ve=I.terrainTileForTile[ot.key];Ul(Ke,Ve)&&qa.newMorphing(ot.key,Ke,Ve,N,250),eh(C,Fe.emissiveTexture),H.activeTexture.set(j.TEXTURE0),Fe.texture&&Fe.texture.bind(j.LINEAR,j.CLAMP_TO_EDGE);const it=qa.getMorphValuesForProxy(ot.key),Et=it?1:0;it&&Object.assign(Re,{morphing:{srcDemTile:it.from,dstDemTile:it.to,phase:a.dD(it.phase)}});const Bt=a.dG(ot.canonical),Ct=a.dH(Bt.getCenter().lat),At=a.dI(ot.canonical,Bt,Ct,Be.worldSize/Be._pixelsPerMercatorPixel),Qt=a.bk(a.dJ(ot.canonical)),Wt=C.emissiveMode==="mrt-fallback"?1:0,Ft=Qu(Be.expandedFarZProjMatrix,Ae,ye,Qt,a.aj(Be.zoom),de,Be.frustumCorners.TL,Be.frustumCorners.TR,Be.frustumCorners.BR,Be.frustumCorners.BL,Be.globeCenterInViewSpace,Be.globeRadius,Te,Le,Be._farZ,Wt,At);if(ee(ot,Et),q&&(I.setupElevationDraw(Fe,q,Re),C.uploadCommonUniforms(H,q,ot.toUnwrapped()),se)){const[Yt,oi,fi]=se.getGridBuffers(Ct,Le!==0);q.draw(C,$e,me,Se,xe,di.backCCW,Ft,"globe_raster",Yt,oi,fi)}}}if(se&&(C.renderDefaultNorthPole||C.renderDefaultSouthPole)){const Be=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];ie&&Be.push("CUSTOM_ANTIALIASING"),q=C.getOrCreateProgram("globeRaster",{defines:Be});for(const Le of L){const{x:$e,y:ot,z:Fe}=Le.canonical,Se=ot===0,Ke=ot===(1<<Fe)-1,[Ve,it,Et,Bt]=se.getPoleBuffers(Fe,!1);if(Bt&&(Se||Ke)){const Ct=B.getTile(Le);eh(C,Ct.emissiveTexture),H.activeTexture.set(j.TEXTURE0),Ct.texture&&Ct.texture.bind(j.LINEAR,j.CLAMP_TO_EDGE);let At=a.dK(Fe,$e,ne);const Qt=a.bk(a.dJ(Le.canonical)),Wt=C.emissiveMode==="mrt-fallback"?1:0,Ft=(Yt,oi)=>Yt.draw(C,j.TRIANGLES,me,yi.disabled,xe,di.disabled,Qu(ne.expandedFarZProjMatrix,At,At,Qt,0,de,ne.frustumCorners.TL,ne.frustumCorners.TR,ne.frustumCorners.BR,ne.frustumCorners.BL,ne.globeCenterInViewSpace,ne.globeRadius,Te,0,ne._farZ,Wt),"globe_pole_raster",oi,Et,Bt);I.setupElevationDraw(Ct,q,Re),C.uploadCommonUniforms(H,q,Le.toUnwrapped()),Se&&C.renderDefaultNorthPole&&Ft(q,Ve),Ke&&C.renderDefaultSouthPole&&(At=a.cS(a.bC(),At,[1,-1,1]),Ft(q,it))}}}})(p,g,y,b,T);else{const C=p.context,I=C.gl;let B,L;const N=p.shadowRenderer,H=Va(p,p.longestCutoffRange),j=xe=>{if(L===xe)return;const me=[];me.push(Ju[xe]),H.shouldRenderCutoff&&me.push("RENDER_CUTOFF"),N&&(me.push("RENDER_SHADOWS","DEPTH_TEXTURE"),N.useNormalOffset&&me.push("NORMAL_OFFSET")),B=p.getOrCreateProgram("terrainRaster",{defines:me}),L=xe},q=p.colorModeForRenderPass(),W=new ti(I.LEQUAL,ti.ReadWrite,p.depthRangeFor3D);qa.update(T);const ne=p.transform,ie=Vl(ne.zoom,g.exaggeration(),g.sourceCache._source.tileSize);let ee=[0,0,0];if(N){const xe=p.style.directionalLight,me=p.style.ambientLight;xe&&me&&(ee=Jo(p.style,xe,me))}{L=-1;const xe=I.TRIANGLES,[me,ye]=[g.gridIndexBuffer,g.gridSegments];for(const de of b){const se=y.getTile(de),Te=yi.disabled,Ae=g.prevTerrainTileForTile[de.key],Re=g.terrainTileForTile[de.key];Ul(Ae,Re)&&qa.newMorphing(de.key,Ae,Re,T,250),eh(p,se.emissiveTexture),C.activeTexture.set(I.TEXTURE0),se.texture&&se.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const Be=qa.getMorphValuesForProxy(de.key),Le=Be?1:0;let $e;Be&&($e={morphing:{srcDemTile:Be.from,dstDemTile:Be.to,phase:a.dD(Be.phase)}});const ot=p.emissiveMode==="mrt-fallback"?1:0,Fe=Wn(de.projMatrix,mc(de.canonical,ne.renderWorldCopies)?ie/10:ie,ee,ot);if(j(Le),!B)continue;g.setupElevationDraw(se,B,$e);const Se=de.toUnwrapped();N&&N.setupShadows(Se,B),p.uploadCommonUniforms(C,B,Se,null,H),B.draw(p,xe,W,Te,q,di.backCCW,Fe,"terrain_raster",g.gridBuffer,me,ye)}}}})(o,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const o=this.painter,u=this.painter.context,p=this.proxySourceCache,g=this.proxiedCoords[p.id],y=this._drapedRenderBatches.shift(),b=o.style.order,T=[];this._updateFBOs(o.emissiveMode==="mrt-fallback");let C=0;for(const I of g){const B=p.getTileByID(I.proxyTileKey),L=p.proxyCachedFBO[I.key]?p.proxyCachedFBO[I.key][t]:void 0,N=L!==void 0?p.renderCache[L]:this.pool[C++],H=L!==void 0;if(B.texture=N.tex,B.emissiveTexture=N.emissiveTex,H&&!N.dirty){T.push(B.tileID);continue}u.bindFramebuffer.set(N.fb.framebuffer);const j=u.gl;let q;j.drawBuffers(o.emissiveMode==="mrt-fallback"?[j.COLOR_ATTACHMENT0,j.COLOR_ATTACHMENT1]:[j.COLOR_ATTACHMENT0]),this.renderedToTile=!1,N.dirty&&(u.clear({color:a.ao.transparent,stencil:0}),N.dirty=!1);for(let W=y.start;W<=y.end;++W){const ne=o.style._mergedLayers[b[W]];if(ne.isHidden(o.transform.zoom))continue;const ie=o.style.getLayerSourceCache(ne),ee=ie?this.proxyToSource[I.key][ie.id]:[I];if(!ee)continue;const xe=ee;u.viewport.set([0,0,N.fb.width,N.fb.height]),q!==(ie?ie.id:null)&&(this._setupStencil(N,ee,ne,ie),q=ie?ie.id:null),o.renderLayer(o,ie,ne,xe)}if(j.drawBuffers([j.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const W of this._pendingGroundEffectLayers){const ne=o.style._mergedLayers[b[W]];if(ne.isHidden(o.transform.zoom))continue;const ie=o.style.getLayerSourceCache(ne),ee=ie?this.proxyToSource[I.key][ie.id]:[I];if(!ee)continue;const xe=ee;u.viewport.set([0,0,N.fb.width,N.fb.height]),q!==(ie?ie.id:null)&&(this._setupStencil(N,ee,ne,ie),q=ie?ie.id:null),o.renderLayer(o,ie,ne,xe)}this.renderedToTile?(N.dirty=!0,T.push(B.tileID)):H||--C,C===5&&(C=0,this.renderToBackBuffer(T))}return this.renderToBackBuffer(T),this.renderingToTexture=!1,u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),y.end+1}postRender(){}isLayerOrderingCorrect(t){const o=t.order.length;let u=-1,p=o;for(let g=0;g<o;++g)this._style.isLayerDraped(t._mergedLayers[t.order[g]])?u=Math.max(u,g):p=Math.min(p,g);return p>u}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{t=Math.min(t,o.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,o,u){if(!this._visibleDemTiles)return null;const p=this._visibleDemTiles.filter(g=>g.dem).map(g=>{const y=g.tileID,b=1<<y.overscaledZ,{x:T,y:C}=y.canonical,I=T/b,B=(T+1)/b,L=C/b,N=(C+1)/b;return{minx:I,miny:L,maxx:B,maxy:N,t:g.dem.tree.raycastRoot(I,L,B,N,t,o,u),tile:g}});p.sort((g,y)=>(g.t!==null?g.t:Number.MAX_VALUE)-(y.t!==null?y.t:Number.MAX_VALUE));for(const g of p){if(g.t==null)return null;const y=g.tile.dem.tree.raycast(g.minx,g.miny,g.maxx,g.maxy,t,o,u);if(y!=null)return y}return null}_createFBO(){const t=this.painter.context,o=t.gl,u=this.drapeBufferSize;t.activeTexture.set(o.TEXTURE0);const p=new a.T(t,{width:u[0],height:u[1],data:null},o.RGBA8);p.bind(o.LINEAR,o.CLAMP_TO_EDGE);const g=t.createFramebuffer(u[0],u[1],1,null);let y;return g.colorAttachment0.set(p.texture),this._emissiveTexture&&(y=new a.T(t,{width:u[0],height:u[1],data:null},o.R8),y.bind(o.LINEAR,o.CLAMP_TO_EDGE),g.createColorAttachment(t,1),g.colorAttachment1.set(y.texture)),g.depthAttachment=new Om(t,g.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,u[0],u[1]),this._stencilRef=0,g.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):g.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:g,tex:p,emissiveTex:y,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const o of this.pool)this._updateFBO(o,t);for(const o of this.proxySourceCache.renderCache)this._updateFBO(o,t);this._emissiveTexture=t}}_updateFBO(t,o){const u=t.fb,p=this.painter.context,g=p.gl,y=this.drapeBufferSize;if(o){const b=new a.T(p,{width:y[0],height:y[1],data:null},g.R8);b.bind(g.LINEAR,g.CLAMP_TO_EDGE),t.emissiveTex=b,u.createColorAttachment(p,1),u.colorAttachment1.set(b.texture)}else t.emissiveTex=void 0,u.removeColorAttachment(p,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const o=this._style._mergedLayers[t],u=o.isHidden(this.painter.transform.zoom);return o.type==="hillshade"||o.type==="custom"?!u&&o.shouldRedrape():!u&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const u of this._style.getSources())if(u instanceof rs){t=!0;break}if(!t)return;const o={};for(let u=0;u<this._style.order.length;++u){const p=this._style._mergedLayers[this._style.order[u]],g=this._style.getLayerSourceCache(p);if(!g||o[g.id]||p.isHidden(this.painter.transform.zoom)||p.type!=="line")continue;const y=p.widthExpression(),b=p.emissiveStrengthExpression();if(y instanceof a.ad||b instanceof a.ad){o[g.id]=!0;for(const T of this.proxyCoords){const C=this.proxyToSource[T.key][g.id];if(C)for(const I of C)this._clearRenderCacheForTile(g.id,I)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const u in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[u]._source instanceof Gr){t=!0;break}if(!t)return;const o={};for(let u=0;u<this._style.order.length;++u){const p=this._style._mergedLayers[this._style.order[u]],g=this._style.getLayerSourceCache(p);if(!g||o[g.id]||p.isHidden(this.painter.transform.zoom)||p.type!=="raster")continue;const y=p.paint.get("raster-fade-duration");for(const b of this.proxyCoords){const T=this.proxyToSource[b.key][g.id];if(T)for(const C of T){const I=od(g.getTile(C),g.findLoadedParent(C,0),g,this.painter.transform,y);(I.opacity!==1||I.mix!==0)&&this._clearRenderCacheForTile(g.id,C)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,o=t.length;if(o===0)return;const u=[];this._pendingGroundEffectLayers=[];let p,g=0,y=this._style._mergedLayers[t[g]];for(;!this._style.isLayerDraped(y)&&y.isHidden(this.painter.transform.zoom)&&++g<o;)y=this._style._mergedLayers[t[g]];for(;g<o;++g){const b=this._style._mergedLayers[t[g]];b.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(b)?p===void 0&&(p=g):(b.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(g),p!==void 0&&(u.push({start:p,end:g-1}),p=void 0)))}if(p!==void 0&&u.push({start:p,end:g-1}),u.length!==0){const b=u[u.length-1];this._pendingGroundEffectLayers.every(T=>T>b.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=u}_setupRenderCache(t){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const y=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let b=0;b<y.length;++b){const T=Object.values(y[b]);o.renderCachePool.push(...T)}}return}this._clearRasterLayersFromRenderCache();const u=this.proxyCoords,p=this._tilesDirty;for(let y=u.length-1;y>=0;y--){const b=u[y];if(o.getTileByID(b.key),o.proxyCachedFBO[b.key]!==void 0){const T=t[b.key],C=this.proxyToSource[b.key];let I=0;for(const B in C){const L=C[B],N=T[B];if(!N||N.length!==L.length||L.some((H,j)=>H!==N[j]||p[B]&&p[B].hasOwnProperty(H.key))){I=-1;break}++I}for(const B in o.proxyCachedFBO[b.key])o.renderCache[o.proxyCachedFBO[b.key][B]].dirty=I<0||I!==Object.values(T).length}}const g=[...this._drapedRenderBatches];g.sort((y,b)=>b.end-b.start-(y.end-y.start));for(const y of g)for(const b of u){if(o.proxyCachedFBO[b.key])continue;let T=o.renderCachePool.pop();T===void 0&&o.renderCache.length<50&&(T=o.renderCache.length,o.renderCache.push(this._createFBO())),T!==void 0&&(o.proxyCachedFBO[b.key]={},o.proxyCachedFBO[b.key][y.start]=T,o.renderCache[T].dirty=!0)}this._tilesDirty={}}_setupStencil(t,o,u,p){if(!p||!this._sourceTilesOverlap[p.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const g=this.painter.context,y=g.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let b;if(u.isTileClipped())b=o.length,this._overlapStencilMode.test={func:y.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o[o.length-1].overscaledZ))return void(this._overlapStencilType=!1);b=1,this._overlapStencilMode.test={func:y.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+b>255&&(g.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=b,this._overlapStencilMode.ref=this._stencilRef,u.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):yi.disabled}_renderTileClippingMasks(t,o){const u=this.painter,p=this.painter.context,g=p.gl;u._tileClippingMaskIDs={},p.setColorMode(bi.disabled),p.setDepthMode(ti.disabled);const y=u.getOrCreateProgram("clippingMask");for(const b of t){const T=u._tileClippingMaskIDs[b.key]=--o;y.draw(u,g.TRIANGLES,ti.disabled,new yi({func:g.ALWAYS,mask:0},T,255,g.KEEP,g.KEEP,g.REPLACE),bi.disabled,di.disabled,th(b.projMatrix),"$clipping",u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}}pointCoordinate(t){const o=this.painter.transform;if(t.x<0||t.x>o.width||t.y<0||t.y>o.height)return null;const u=[t.x,t.y,1,1];a.aC(u,u,o.pixelMatrixInverse),a.cK(u,u,1/u[3]),u[0]/=o.worldSize,u[1]/=o.worldSize;const p=o._camera.position,g=a.cf(1,o.center.lat),y=[p[0],p[1],p[2]/g,0],b=a.da([],u.slice(0,3),y);a.aw(b,b);const T=this.raycast(y,b,this._exaggeration);return T!==null&&T?(a.bH(y,y,b,T),y[3]=y[2],y[2]*=g,y):null}_setupProxiedCoordsForOrtho(t,o,u){if(t.getSource()instanceof a.aU)return this._setupProxiedCoordsForImageSource(t,o,u);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const p=this.proxiedCoords[t.id]=[],g=this.proxyCoords;for(let T=0;T<g.length;T++){const C=g[T],I=this._findTileCoveringTileID(C,t);if(I){const B=this._createProxiedId(C,I,u[C.key]&&u[C.key][t.id]);p.push(B),this.proxyToSource[C.key][t.id]=[B]}}let y=!1;const b=new Set;for(let T=0;T<o.length;T++){const C=t.getTile(o[T]);if(!C||!C.hasData())continue;const I=this._findTileCoveringTileID(C.tileID,this.proxySourceCache);if(I&&I.tileID.canonical.z!==C.tileID.canonical.z){const B=this.proxyToSource[I.tileID.key][t.id],L=this._createProxiedId(I.tileID,C,u[I.tileID.key]&&u[I.tileID.key][t.id]);B?B.splice(B.length-1,0,L):this.proxyToSource[I.tileID.key][t.id]=[L];const N=this.proxyToSource[I.tileID.key][t.id];b.has(N)||b.add(N),p.push(L),y=!0}}if(this._sourceTilesOverlap[t.id]=y,y&&this._debugParams.sortTilesHiZFirst)for(const T of b)T.sort((C,I)=>I.overscaledZ-C.overscaledZ)}_setupProxiedCoordsForImageSource(t,o,u){if(!t.getSource().loaded())return;const p=this.proxiedCoords[t.id]=[],g=this.proxyCoords,y=t.getSource(),b=y.tileID;if(!b)return;const T=new a.P(b.x,b.y)._div(1<<b.z),C=y.coordinates.map(a.ae.fromLngLat).reduce((B,L)=>(B.min.x=Math.min(B.min.x,L.x-T.x),B.min.y=Math.min(B.min.y,L.y-T.y),B.max.x=Math.max(B.max.x,L.x-T.x),B.max.y=Math.max(B.max.y,L.y-T.y),B),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),I=(B,L)=>{const N=B.wrap+B.canonical.x/(1<<B.canonical.z),H=B.canonical.y/(1<<B.canonical.z),j=a.al/(1<<B.canonical.z),q=L.wrap+L.canonical.x/(1<<L.canonical.z),W=L.canonical.y/(1<<L.canonical.z);return N+j<q+C.min.x||N>q+C.max.x||H+j<W+C.min.y||H>W+C.max.y};for(let B=0;B<g.length;B++){const L=g[B];for(let N=0;N<o.length;N++){const H=t.getTile(o[N]);if(!H||!H.hasData()||I(L,H.tileID))continue;const j=this._createProxiedId(L,H,u[L.key]&&u[L.key][t.id]),q=this.proxyToSource[L.key][t.id];q?q.push(j):this.proxyToSource[L.key][t.id]=[j],p.push(j)}}}_createProxiedId(t,o,u){let p=this.orthoMatrix;if(u){const g=u.find(y=>y.key===o.tileID.key);if(g)return g}if(o.tileID.key!==t.key){const g=t.canonical.z-o.tileID.canonical.z;let y,b,T;p=a.bC();const C=o.tileID.wrap-t.wrap<<t.overscaledZ;g>0?(y=a.al>>g,b=y*((o.tileID.canonical.x<<g)-t.canonical.x+C),T=y*((o.tileID.canonical.y<<g)-t.canonical.y)):(y=a.al<<-g,b=a.al*(o.tileID.canonical.x-(t.canonical.x+C<<-g)),T=a.al*(o.tileID.canonical.y-(t.canonical.y<<-g))),a.ce(p,0,y,0,y,0,1),a.br(p,p,[b,T,0])}return new sd(o.tileID,t.key,p)}_findTileCoveringTileID(t,o){let u=o.getTile(t);if(u&&u.hasData())return u;const p=this._findCoveringTileCache[o.id],g=p[t.key];if(u=g?o.getTileByID(g):null,u&&u.hasData()||g===null)return u;let y=u?u.tileID:t,b=y.overscaledZ;const T=o.getSource().minzoom,C=[];if(!g){const B=o.getSource().maxzoom;if(t.canonical.z>=B){const L=t.canonical.z-B;o.getSource().reparseOverscaled?(b=Math.max(t.canonical.z+2,o.transform.tileZoom),y=new a.aQ(b,t.wrap,B,t.canonical.x>>L,t.canonical.y>>L)):L!==0&&(b=B,y=new a.aQ(b,t.wrap,B,t.canonical.x>>L,t.canonical.y>>L))}y.key!==t.key&&(C.push(y.key),u=o.getTile(y))}const I=B=>
3203{C.forEach(L=>{p[L]=B}),C.length=0};for(b-=1;b>=T&&(!u||!u.hasData());b--){u&&I(u.tileID.key);const B=y.calculateScaledKey(b);if(u=o.getTileByID(B),u&&u.hasData())break;const L=p[B];if(L===null)break;L===void 0?C.push(B):u=o.getTileByID(L)}return I(u?u.tileID.key:null),u&&u.hasData()?u:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,o){let u=this._tilesDirty[t];u||(u=this._tilesDirty[t]={}),u[o.key]=!0}}function Qc(c,t,o){const u=(function(b,T,C){const I=a.bJ(T,b),B=a.bJ(C,[.2126,.7152,.0722]),L=(H,j,q)=>(1-q)*H+q*j,N=L(1-.3*Math.min(B,1),1,Math.min(I+1,1));return L(.92,1,Math.asin(a.aA(T[2],-1,1))/Math.PI+.5)*N})(c,[0,0,1],t),p=[0,0,0];a.c5(p,o.slice(0,3),u);const g=[0,0,0];a.c5(g,t.slice(0,3),c[2]);const y=[0,0,0];return a.d8(y,p,g),a.db(y)}const nh=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],bp=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class ld{static cacheKey(t,o,u,p){const g=[o];p&&g.push(p.cacheKey);for(const y of u)t.usedDefines.has(y)&&g.push(y);return g.join("/")}constructor(t,o,u,p,g,y){const b=t.gl;this.program=b.createProgram(),this.configuration=p,this.name=o,this.fixedDefines=[...y];const T=`#version 300 es
3204${(p?p.defines():[]).concat(y.map(j=>`#define ${j}`)).join(`
3205`)}`,C=[T,Lm];for(const j of u.fragmentIncludes)C.push(Ol[j]);C.push(u.fragmentSource);const I=C.join(`
3206`),B=[T,cf];for(const j of u.vertexIncludes)B.push(Ol[j]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&u.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&B.push("uniform int u_instanceID;"),B.push(u.vertexSource);let L=B.join(`
3207`);this.forceManualRenderingForInstanceIDShaders&&(L=L.replaceAll("gl_InstanceID","u_instanceID"));const N=b.createShader(b.FRAGMENT_SHADER);if(b.isContextLost())return void(this.failedToCreate=!0);b.shaderSource(N,I),b.compileShader(N),b.attachShader(this.program,N);const H=b.createShader(b.VERTEX_SHADER);b.isContextLost()?this.failedToCreate=!0:(b.shaderSource(H,L),b.compileShader(H),b.attachShader(this.program,H),this.attributes={},b.linkProgram(this.program),b.deleteShader(H),b.deleteShader(N),this.fixedUniforms=g(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=p?p.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(j=>({u_instanceID:new a.ch(j)}))(t)),(y.includes("TERRAIN")||o.includes("symbol")||o.includes("circle"))&&(this.terrainUniforms=(j=>({u_dem:new a.ch(j),u_dem_prev:new a.ch(j),u_dem_tl:new a.ck(j),u_dem_scale:new a.cj(j),u_dem_tl_prev:new a.ck(j),u_dem_scale_prev:new a.cj(j),u_dem_size:new a.cj(j),u_dem_lerp:new a.cj(j),u_exaggeration:new a.cj(j),u_depth:new a.ch(j),u_depth_size_inv:new a.ck(j),u_depth_range_unpack:new a.ck(j),u_occluder_half_size:new a.cj(j),u_occlusion_depth_offset:new a.cj(j),u_meter_to_dem:new a.cj(j),u_label_plane_matrix_inv:new a.cl(j)}))(t)),y.includes("GLOBE")&&(this.globeUniforms=(j=>({u_tile_tl_up:new a.ci(j),u_tile_tr_up:new a.ci(j),u_tile_br_up:new a.ci(j),u_tile_bl_up:new a.ci(j),u_tile_up_scale:new a.cj(j)}))(t)),y.includes("FOG")&&(this.fogUniforms=(j=>({u_fog_matrix:new a.cl(j),u_fog_range:new a.ck(j),u_fog_color:new a.d3(j),u_fog_horizon_blend:new a.cj(j),u_fog_vertical_limit:new a.ck(j),u_fog_temporal_offset:new a.cj(j),u_frustum_tl:new a.ci(j),u_frustum_tr:new a.ci(j),u_frustum_br:new a.ci(j),u_frustum_bl:new a.ci(j),u_globe_pos:new a.ci(j),u_globe_radius:new a.cj(j),u_globe_transition:new a.cj(j),u_is_globe:new a.ch(j),u_viewport:new a.ck(j)}))(t)),y.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(j=>({u_cutoff_params:new a.d3(j)}))(t)),y.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(j=>({u_lighting_ambient_color:new a.ci(j),u_lighting_directional_dir:new a.ci(j),u_lighting_directional_color:new a.ci(j),u_ground_radiance:new a.ci(j)}))(t)),y.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(j=>({u_light_matrix_0:new a.cl(j),u_light_matrix_1:new a.cl(j),u_fade_range:new a.ck(j),u_shadow_normal_offset:new a.ci(j),u_shadow_intensity:new a.cj(j),u_shadow_texel_size:new a.cj(j),u_shadow_map_resolution:new a.cj(j),u_shadow_direction:new a.ci(j),u_shadow_bias:new a.ci(j),u_shadowmap_0:new a.ch(j),u_shadowmap_1:new a.ch(j)}))(t)))}getAttributeLocation(t,o){let u=this.attributes[o];return u===void 0&&(u=this.attributes[o]=t.getAttribLocation(this.program,o)),u}setTerrainUniformValues(t,o){if(!this.terrainUniforms)return;const u=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p]&&u[p].set(this.program,p,o[p])}}setGlobeUniformValues(t,o){if(!this.globeUniforms)return;const u=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p]&&u[p].set(this.program,p,o[p])}}setFogUniformValues(t,o){if(!this.fogUniforms)return;const u=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p].set(this.program,p,o[p])}}setCutoffUniformValues(t,o){if(!this.cutoffUniforms)return;const u=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p].set(this.program,p,o[p])}}setLightsUniformValues(t,o){if(!this.lightsUniforms)return;const u=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p].set(this.program,p,o[p])}}setShadowUniformValues(t,o){if(this.failedToCreate||!this.shadowUniforms)return;const u=this.shadowUniforms;t.program.set(this.program);for(const p in o)u[p].set(this.program,p,o[p])}_drawDebugWireframe(t,o,u,p,g,y,b,T,C,I){const B=t.options.wireframe;if(B.terrain===!1&&B.layers2D===!1&&B.layers3D===!1)return;const L=t.context;if(!(!(!B.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!B.layers2D||t._terrain&&t._terrain.renderingToTexture||!nh.includes(this.name))||!(!B.layers3D||!bp.includes(this.name))))return;const N=L.gl,H=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,g,L);if(!H)return;
vendor: 9,727 bytes, line 3207
3207const j=[...this.fixedDefines,"DEBUG_WIREFRAME"],q=t.getOrCreateProgram(this.name,{config:this.configuration,defines:j});L.program.set(q.program);const W=(ee,xe,me)=>{if(xe[ee]&&me[ee])for(const ye in xe[ee])me[ee][ye]&&me[ee][ye].set(me.program,ye,xe[ee][ye].current)};C&&C.setUniforms(q.program,L,q.binderUniforms,b,{zoom:T}),W("fixedUniforms",this,q),W("terrainUniforms",this,q),W("globeUniforms",this,q),W("fogUniforms",this,q),W("lightsUniforms",this,q),W("shadowUniforms",this,q),H.bind(),L.setColorMode(new bi([N.ONE,N.ONE_MINUS_SRC_ALPHA,N.ZERO,N.ONE],a.ao.transparent,[!0,!0,!0,!1])),L.setDepthMode(new ti(o.func===N.LESS?N.LEQUAL:o.func,ti.ReadOnly,o.range)),L.setStencilMode(yi.disabled);const ne=3*y.primitiveLength*2,ie=3*y.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const ee=I||1;for(let xe=0;xe<ee;++xe)q.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",xe),N.drawElements(N.LINES,ne,N.UNSIGNED_SHORT,ie)}else I&&I>1?N.drawElementsInstanced(N.LINES,ne,N.UNSIGNED_SHORT,ie,I):N.drawElements(N.LINES,ne,N.UNSIGNED_SHORT,ie);g.bind(),L.program.set(this.program),L.setDepthMode(o),L.setStencilMode(u),L.setColorMode(p)}checkUniforms(t,o,u){if(this.fixedDefines.includes(o)){for(const p of Object.keys(u))if(!u[p].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${p} not set but required by ${o} being defined`)}}draw(t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q){const W=t.context,ne=W.gl;if(this.failedToCreate)return;W.program.set(this.program),W.setDepthMode(u),W.setStencilMode(p),W.setColorMode(g),W.setCullFace(y);for(const[de,se]of this.fixedUniformsEntries)se.set(this.program,de,b[de]);H&&H.setUniforms(this.program,W,this.binderUniforms,L,{zoom:N});const ie={[ne.POINTS]:1,[ne.LINES]:2,[ne.TRIANGLES]:3,[ne.LINE_STRIP]:1}[o];this.checkUniforms(T,"RENDER_SHADOWS",this.shadowUniforms);const ee=j||[],xe=H?H.getPaintVertexBuffers():[],me=o===ne.TRIANGLES&&I,ye=q&&q>0?1:void 0;for(const de of B.get()){const se=de.vaos||(de.vaos={});if((se[T]||(se[T]=new Xu)).bind(W,this,C,xe,I,de.vertexOffset,ee,ye),this.forceManualRenderingForInstanceIDShaders){const Te=q||1;for(let Ae=0;Ae<Te;++Ae)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Ae),I?ne.drawElements(o,de.primitiveLength*ie,ne.UNSIGNED_SHORT,de.primitiveOffset*ie*2):ne.drawArrays(o,de.vertexOffset,de.vertexLength)}else q&&q>1?ne.drawElementsInstanced(o,de.primitiveLength*ie,ne.UNSIGNED_SHORT,de.primitiveOffset*ie*2,q):I?ne.drawElements(o,de.primitiveLength*ie,ne.UNSIGNED_SHORT,de.primitiveOffset*ie*2):ne.drawArrays(o,de.vertexOffset,de.vertexLength);me&&this._drawDebugWireframe(t,u,p,g,I,de,L,N,H,q)}}}function cd(c,t,o=0){const u=Math.pow(2,t.tileID.overscaledZ),p=t.tileSize*Math.pow(2,c.transform.tileZoom)/u,g=p*(t.tileID.canonical.x+t.tileID.wrap*u),y=p*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.ay(t,1,c.transform.tileZoom),u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y],u_pattern_transition:o}}const ud={terrain:0,flat:1},Bm=a.bC(),ll=(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W)=>{const ne=t.style.light,ie=ne.properties.get("position"),ee=[ie.x,ie.y,ie.z],xe=a.dO();ne.properties.get("anchor")==="viewport"&&(a.dP(xe,-t.transform.angle),a.dQ(ee,ee,xe));const me=ne.properties.get("color").toPremultipliedRenderColor(null),ye=t.transform,de={u_matrix:c,u_lightpos:ee,u_lightintensity:ne.properties.get("intensity"),u_lightcolor:[me.r,me.g,me.b],u_vertical_gradient:+o,u_opacity:u,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Bm,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:ud[C],u_base_type:ud[I],u_ao:p,u_edge_radius:g,u_width_scale:y,u_flood_light_color:H,u_vertical_scale:j,u_flood_light_intensity:q,u_ground_shadow_factor:W};return ye.projection.name==="globe"&&(de.u_tile_id=[b.canonical.x,b.canonical.y,1<<b.canonical.z],de.u_zoom_transition=B,de.u_inv_rot_matrix=N,de.u_merc_center=L,de.u_up_dir=ye.projection.upVector(new a.cD(0,0,0),L[0]*a.al,L[1]*a.al),de.u_height_lift=T),de},Gl=(c,t,o,u,p,g)=>({u_matrix:c,u_edge_radius:t,u_width_scale:o,u_vertical_scale:u,u_height_type:ud[p],u_base_type:ud[g]}),wp=(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W)=>{const ne=ll(c,t,o,u,p,g,y,b,C,I,B,L,N,H,j,q,1,[0,0,0]),ie={u_height_factor:-Math.pow(2,b.overscaledZ)/T.tileSize/8};return Object.assign(ne,cd(t,T,W),ie)},gc=(c,t,o)=>({u_matrix:c,u_emissive_strength:t,u_ground_shadow_factor:o}),_c=(c,t,o,u,p,g=0)=>Object.assign(gc(c,t,p),cd(o,u,g)),rh=(c,t,o,u)=>({u_matrix:c,u_world:o,u_emissive_strength:t,u_ground_shadow_factor:u}),hd=(c,t,o,u,p,g,y=0)=>Object.assign(_c(c,t,o,u,g,y),{u_world:p}),Jc=(c,t)=>({u_matrix:c,u_depth_bias:t}),Ps=(c,t)=>({u_matrix:c,u_ground_shadow_factor:t}),yc=(c,t,o,u,p)=>({u_matrix:c,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:o,u_height_scale:u,u_reset_depth:p}),cl=(c,t,o,u,p,g,y,b,T)=>({u_matrix:c,u_normal_matrix:t,u_opacity:o,u_faux_facade_ao_intensity:u,u_camera_pos:p,u_tile_to_meter:g,u_facade_emissive_chance:y,u_flood_light_color:b,u_flood_light_intensity:T}),Tp=c=>({u_matrix:c}),pa=c=>({u_matrix:c}),dd=(c,t,o,u,p,g,y,b)=>{const T=a.al/g.tileSize;return{u_matrix:c,u_inv_rot_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(b),u_extrude_scale:[o.pixelsToGLUnits[0]/T,o.pixelsToGLUnits[1]/T],u_zoom_transition:u,u_tile_id:y,u_merc_center:p}},oh=(c,t,o,u)=>({u_matrix:c,u_inv_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(u),u_viewport_size:[o.width,o.height]}),ul=(c,t,o=1)=>({u_matrix:c,u_color:t,u_overlay:0,u_overlay_scale:o}),Hl=a.bC(),eu=(c,t,o,u,p,g,y)=>{const b=c.transform,T=b.projection.name==="globe",C=T?a.dR(b.zoom,t.canonical)*b._pixelsPerMercatorPixel:a.ay(o,1,g),I={u_matrix:t.projMatrix,u_extrude_scale:C,u_intensity:y,u_inv_rot_matrix:Hl,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(T){I.u_inv_rot_matrix=u,I.u_merc_center=p,I.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],I.u_zoom_transition=a.aj(b.zoom);const B=p[0]*a.al,L=p[1]*a.al;I.u_up_dir=b.projection.upVector(new a.cD(0,0,0),B,L)}return I};function ah(c,[t,o,u,p],[g,y]){if(g===y)return[0,0,0,0];const b=255*(c-1)/(c*(y-g));return[t*b,o*b,u*b,p*b]}function mf(c,t,[o,u]){return o===u?0:.5/c+(t-o)*(c-1)/(c*(u-o))}const tu=(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W,ne,ie,ee)=>({u_matrix:c,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:u,u_grid_matrix:p,u_tl_parent:g,u_scale_parent:C,u_fade_t:I.mix,u_opacity:I.opacity*B.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:B.paint.get("raster-brightness-min"),u_brightness_high:B.paint.get("raster-brightness-max"),u_saturation_factor:a.dT(B.paint.get("raster-saturation")),u_contrast_factor:a.dS(B.paint.get("raster-contrast")),u_spin_weights:ql(B.paint.get("raster-hue-rotate")),u_perspective_transform:L,u_raster_elevation:N,u_zoom_transition:y,u_merc_center:b,u_cutoff_params:T,u_colorization_mix:ah(a.dU,j,W),u_colorization_offset:mf(a.dU,q,W),u_color_ramp:H,u_texture_offset:[ie/(ne+2*ie),ne/(ne+2*ie)],u_texture_res:[ne+2*ie,ne+2*ie],u_emissive_strength:ee});function ql(c){c*=Math.PI/180;const t=Math.sin(c),o=Math.cos(c);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const iu=.05,km=(c,t,o,u,p,g,y,b,T,C,I,B)=>({u_matrix:c,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:u,u_grid_matrix:p,u_tl_parent:g,u_scale_parent:C,u_fade_t:I.mix,u_opacity:I.opacity,u_image0:0,u_image1:1,u_raster_elevation:B,u_zoom_transition:y,u_merc_center:b,u_cutoff_params:T}),nu=(c,t,o,u,p,g,y,b,T,C)=>({u_particle_texture:c,u_particle_texture_side_len:t,u_tile_offset:o,u_velocity:u,u_color_ramp:g,u_velocity_res:p,u_max_speed:y,u_uv_offset:b,u_data_scale:[255*T[0],255*T[1]],u_data_offset:C,u_particle_pos_scale:1.1,u_particle_pos_offset:[iu,iu]}),gf=(c,t,o,u,p,g,y,b,T,C)=>({u_particle_texture:c,u_particle_texture_side_len:t,u_velocity:o,u_velocity_res:u,u_max_speed:p,u_speed_factor:g,u_reset_rate:y,u_rand_seed:Math.random(),u_uv_offset:b,u_data_scale:[255*T[0],255*T[1]],u_data_offset:C,u_particle_pos_scale:1.1,u_particle_pos_offset:[iu,iu]}),fd=a.bC(),ru=(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W,ne,ie,ee,xe,me,ye)=>{const de=p.transform,se={u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:de.getCameraToCenterDistance(ne),u_rotate_symbol:+o,u_aspect_ratio:de.width/de.height,u_fade_change:p.options.fadeDuration?p.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+C,u_elevation_from_sea:T?1:0,u_pitch_with_map:+u,u_texsize:I,u_texsize_icon:B,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:fd,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:fd,u_up_vector:[0,-1,0],u_color_adj_mat:xe,u_icon_transition:me||0,u_gamma_scale:u?p.transform.getCameraToCenterDistance(ne)*Math.cos(p.terrain?0:p.transform._pitch):1,u_device_pixel_ratio:a.o.devicePixelRatio,u_is_halo:1,u_scale_factor:ye||1,u_ground_shadow_factor:ie,u_inv_matrix:a.bl(a.bC(),y),u_normal_scale:ee,u_lutTexture:10};return ne.name==="globe"&&(se.u_tile_id=[N.canonical.x,N.canonical.y,1<<N.canonical.z],se.u_zoom_transition=H,se.u_inv_rot_matrix=q,se.u_merc_center=j,se.u_camera_forward=de._camera.forward(),se.u_ecef_origin=a.dV(de.globeMatrix,N.toUnwrapped()),se.u_tile_matrix=Float32Array.from(de.globeMatrix),se.u_up_vector=W),se},hl=(c,t,o,u)=>({u_matrix:c,u_emissive_strength:t,u_opacity:o,u_color:u}),jo=(c,t,o,u,p,g,y,b,T)=>Object.assign((function(C,I,B,L,N,H){const{width:j,height:q}=L.imageManager.getPixelSize(I),W=Math.pow(2,H.tileID.overscaledZ
3207),ne=H.tileSize*Math.pow(2,L.transform.tileZoom)/W,ie=ne*(H.tileID.canonical.x+H.tileID.wrap*W),ee=ne*H.tileID.canonical.y;return{u_image:0,u_pattern_tl:B.tl,u_pattern_br:B.br,u_texsize:[j,q],u_pattern_size:B.displaySize,u_pattern_units_to_pixels:N?[L.transform.width,-1*L.transform.height]:[1/a.ay(H,1,L.transform.tileZoom),1/a.ay(H,1,L.transform.tileZoom)],u_pixel_coord_upper:[ie>>16,ee>>16],u_pixel_coord_lower:[65535&ie,65535&ee]}})(0,g,y,u,b,T),{u_matrix:c,u_emissive_strength:t,u_opacity:o}),Io=new Float32Array(a.bA([])),Ls=(c,t,o,u,p,g,y,b,T,C,I,B,L,N=[0,0,0],H,j,q)=>{const W=p.style.light,ne=W.properties.get("position"),ie=[-ne.x,-ne.y,ne.z],ee=a.dO();W.properties.get("anchor")==="viewport"&&(a.dP(ee,-p.transform.angle),a.dQ(ie,ie,ee));const xe=I.alphaMode==="MASK",me=W.properties.get("color").toNonPremultipliedRenderColor(null),ye=L.paint.get("model-ambient-occlusion-intensity"),de=L.paint.get("model-color").constantOr(a.ao.white).toNonPremultipliedRenderColor(null);return de.a=L.paint.get("model-color-mix-intensity").constantOr(0),q&&(de.r=q[0],de.g=q[1],de.b=q[2],de.a=q[3]),j&&(de.r=j.color.r,de.g=j.color.g,de.b=j.color.b,de.a=j.colorMix,B=j.emissionStrength,g*=j.opacity),{u_matrix:c,u_lighting_matrix:t,u_normal_matrix:o,u_node_matrix:u||Io,u_lightpos:ie,u_lightintensity:W.properties.get("intensity"),u_lightcolor:[me.r,me.g,me.b],u_camera_pos:N,u_opacity:g,u_baseTextureIsAlpha:0,u_alphaMask:+xe,u_alphaCutoff:I.alphaCutoff,u_baseColorFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:b.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:T,u_roughnessFactor:C,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:de.toArray01(),u_aoIntensity:ye,u_emissive_strength:B,u_occlusionTextureTransform:H||[0,0,0,0]}},ou=(c,t=Io,o=Io)=>({u_matrix:c,u_instance:t,u_node_matrix:o}),pd={fillExtrusion:c=>({u_matrix:new a.cl(c),u_lightpos:new a.ci(c),u_lightintensity:new a.cj(c),u_lightcolor:new a.ci(c),u_vertical_gradient:new a.cj(c),u_opacity:new a.cj(c),u_edge_radius:new a.cj(c),u_width_scale:new a.cj(c),u_ao:new a.ck(c),u_height_type:new a.ch(c),u_base_type:new a.ch(c),u_tile_id:new a.ci(c),u_zoom_transition:new a.cj(c),u_inv_rot_matrix:new a.cl(c),u_merc_center:new a.ck(c),u_up_dir:new a.ci(c),u_height_lift:new a.cj(c),u_flood_light_color:new a.ci(c),u_vertical_scale:new a.cj(c),u_flood_light_intensity:new a.cj(c),u_ground_shadow_factor:new a.ci(c)}),fillExtrusionDepth:c=>({u_matrix:new a.cl(c),u_edge_radius:new a.cj(c),u_width_scale:new a.cj(c),u_vertical_scale:new a.cj(c),u_height_type:new a.ch(c),u_base_type:new a.ch(c)}),fillExtrusionPattern:c=>({u_matrix:new a.cl(c),u_lightpos:new a.ci(c),u_lightintensity:new a.cj(c),u_lightcolor:new a.ci(c),u_vertical_gradient:new a.cj(c),u_height_factor:new a.cj(c),u_edge_radius:new a.cj(c),u_width_scale:new a.cj(c),u_ao:new a.ck(c),u_height_type:new a.ch(c),u_base_type:new a.ch(c),u_tile_id:new a.ci(c),u_zoom_transition:new a.cj(c),u_inv_rot_matrix:new a.cl(c),u_merc_center:new a.ck(c),u_up_dir:new a.ci(c),u_height_lift:new a.cj(c),u_image:new a.ch(c),u_texsize:new a.ck(c),u_pixel_coord_upper:new a.ck(c),u_pixel_coord_lower:new a.ck(c),u_tile_units_to_pixels:new a.cj(c),u_opacity:new a.cj(c),u_pattern_transition:new a.cj(c)}),fillExtrusionGroundEffect:c=>({u_matrix:new a.cl(c),u_opacity:new a.cj(c),u_ao_pass:new a.cj(c),u_meter_to_tile:new a.cj(c),u_ao:new a.ck(c),u_flood_light_intensity:new a.cj(c),u_flood_light_color:new a.ci(c),u_attenuation:new a.cj(c),u_edge_radius:new a.cj(c),u_fb:new a.ch(c),u_fb_size:new a.cj(c),u_dynamic_offset:new a.cj(c)}),fill:c=>({u_matrix:new a.cl(c),u_emissive_strength:new a.cj(c),u_ground_shadow_factor:new a.ci(c)}),fillPattern:c=>({u_matrix:new a.cl(c),u_emissive_strength:new a.cj(c),u_image:new a.ch(c),u_texsize:new a.ck(c),u_pixel_coord_upper:new a.ck(c),u_pixel_coord_lower:new a.ck(c),u_tile_units_to_pixels:new a.cj(c),u_ground_shadow_factor:new a.ci(c),u_pattern_transition:new a.cj(c)}),fillOutline:c=>({u_matrix:new a.cl(c),u_emissive_strength:new a.cj(c),u_world:new a.ck(c),u_ground_shadow_factor:new a.ci(c)}),fillOutlinePattern:c=>({u_matrix:new a.cl(c),u_emissive_strength:new a.cj(c),u_world:new a.ck(c),u_image:new a.ch(c),u_texsize:new a.ck(c),u_pixel_coord_upper:new a.ck(c),u_pixel_coord_lower:new a.ck(c),u_tile_units_to_pixels:new a.cj(c),u_ground_shadow_factor:new a.ci(c),u_pattern_transition:new a.cj(c)}),building:c=>({u_matrix:new a.cl(c),u_normal_matrix:new a.cl(c),u_opacity:new a.cj(c),u_faux_facade_ao_intensity:new a.cj(c),u_camera_pos:new a.ci(c),u_tile_to_meter:new a.cj(c),u_facade_emissive_chance:new a.cj(c),u_flood_light_color:new a.ci(c),u_flood_light_intensity:new a.cj(c)}),buildingBloom:c=>({u_matrix:new a.cl(c)}),buildingDepth:c=>({u_matrix:new a.cl(c)}),elevatedStructuresDepth:c=>({u_matrix:new a.cl(c),u_depth_bias:new a.cj(c)}),elevatedStructures:c=>({u_matrix:new a.cl(c),u_ground_shadow_factor:new a.ci(c)}),elevatedStructuresDepthReconstruct:c=>({u_matrix:new a.cl(c),u_camera_pos:new a.ci(c),u_depth_bias:new a.cj(c),u_height_scale:new a.cj(c),u_reset_depth:new a.cj(c)}),circle:a.dY,collisionBox:c=>({u_matrix:new a.cl(c),u_inv_rot_matrix:new a.cl(c),u_camera_to_center_distance:new a.cj(c),u_extrude_scale:new a.ck(c),u_zoom_transition:new a.cj(c),u_merc_center:new a.ck(c),u_tile_id:new a.ci(c)}),collisionCircle:c=>({u_matrix:new a.cl(c),u_inv_matrix:new a.cl(c),u_camera_to_center_distance:new a.cj(c),u_viewport_size:new a.ck(c)}),debug:c=>({u_color:new a.dB(c),u_matrix:new a.cl(c),u_overlay:new a.ch(c),u_overlay_scale:new a.cj(c)}),clippingMask:c=>({u_matrix:new a.cl(c)}),heatmap:c=>({u_extrude_scale:new a.cj(c),u_intensity:new a.cj(c),u_matrix:new a.cl(c),u_inv_rot_matrix:new a.cl(c),u_merc_center:new a.ck(c),u_tile_id:new a.ci(c),u_zoom_transition:new a.cj(c),u_up_dir:new a.ci(c)}),heatmapTexture:c=>({u_image:new a.ch(c),u_color_ramp:new a.ch(c),u_opacity:new a.cj(c)}),hillshade:c=>({u_matrix:new a.cl(c),u_image:new a.ch(c),u_latrange:new a.ck(c),u_light:new a.ck(c),u_shadow:new a.dB(c),u_highlight:new a.dB(c),u_emissive_strength:new a.cj(c),u_accent:new a.dB(c)}),hillshadePrepare:c=>({u_matrix:new a.cl(c),u_image:new a.ch(c),u_dimension:new a.ck(c),u_zoom:new a.cj(c)}),line:a.dX,linePattern:a.dW,raster:c=>({u_matrix:new a.cl(c),u_normalize_matrix:new a.cl(c),u_globe_matrix:new a.cl(c),u_merc_matrix:new a.cl(c),u_grid_matrix:new a.dC(c),u_tl_parent:new a.ck(c),u_scale_parent:new a.cj(c),u_fade_t:new a.cj(c),u_opacity:new a.cj(c),u_image0:new a.ch(c),u_image1:new a.ch(c),u_brightness_low:new a.cj(c),u_brightness_high:new a.cj(c),u_saturation_factor:new a.cj(c),u_contrast_factor:new a.cj(c),u_spin_weights:new a.ci(c),u_perspective_transform:new a.ck(c),u_raster_elevation:new a.cj(c),u_zoom_transition:new a.cj(c),u_merc_center:new a.ck(c),u_cutoff_params:new a.d3(c),u_colorization_mix:new a.d3(c),u_colorization_offset:new a.cj(c),u_color_ramp:new a.ch(c),u_texture_offset:new a.ck(c),u_texture_res:new a.ck(c),u_emissive_strength:new a.cj(c)}),rasterParticle:c=>({u_matrix:new a.cl(c),u_normalize_matrix:new a.cl(c),u_globe_matrix:new a.cl(c),u_merc_matrix:new a.cl(c),u_grid_matrix:new a.dC(c),u_tl_parent:new a.ck(c),u_scale_parent:new a.cj(c),u_fade_t:new a.cj(c),u_opacity:new a.cj(c),u_image0:new a.ch(c),u_image1:new a.ch(c),u_raster_elevation:new a.cj(c),u_zoom_transition:new a.cj(c),u_merc_center:new a.ck(c),u_cutoff_params:new a.d3(c)}),rasterParticleTexture:c=>({u_texture:new a.ch(c),u_opacity:new a.cj(c)}),rasterParticleDraw:c=>({u_particle_texture:new a.ch(c),u_particle_texture_side_len:new a.cj(c),u_tile_offset:new a.ck(c),u_velocity:new a.ch(c),u_color_ramp:new a.ch(c),u_velocity_res:new a.ck(c),u_max_speed:new a.cj(c),u_uv_offset:new a.ck(c),u_data_scale:new a.ck(c),u_data_offset:new a.cj(c),u_particle_pos_scale:new a.cj(c),u_particle_pos_offset:new a.ck(c)}),rasterParticleUpdate:c=>({u_particle_texture:new a.ch(c),u_particle_texture_side_len:new a.cj(c),u_velocity:new a.ch(c),u_velocity_res:new a.ck(c),u_max_speed:new a.cj(c),u_speed_factor:new a.cj(c),u_reset_rate:new a.cj(c),u_rand_seed:new a.cj(c),u_uv_offset:new a.ck(c),u_data_scale:new a.ck(c),u_data_offset:new a.cj(c),u_particle_pos_scale:new a.cj(c),u_particle_pos_offset:new a.ck(c)}),symbol:c=>({u_is_size_zoom_constant:new a.ch(c),u_is_size_feature_constant:new a.ch(c),u_size_t:new a.cj(c),u_size:new a.cj(c),u_camera_to_center_distance:new a.cj(c),u_rotate_symbol:new a.ch(c),u_aspect_ratio:new a.cj(c),u_fade_change:new a.cj(c),u_matrix:new a.cl(c),u_label_plane_matrix:new a.cl(c),u_coord_matrix:new a.cl(c),u_is_text:new a.ch(c),u_elevation_from_sea:new a.ch(c),u_pitch_with_map:new a.ch(c),u_texsize:new a.ck(c),u_texsize_icon:new a.ck(c),u_texture:new a.ch(c),u_texture_icon:new a.ch(c),u_gamma_scale:new a.cj(c),u_device_pixel_ratio:new a.cj(c),u_tile_id:new a.ci(c),u_zoom_transition:new a.cj(c),u_inv_rot_matrix:new a.cl(c),u_merc_center:new a.ck(c),u_camera_forward:new a.ci(c),u_tile_matrix:new a.cl(c),u_up_vector:new a.ci(c),u_ecef_origin:new a.ci(c),u_is_halo:new a.ch(c),u_icon_transition:new a.cj(c),u_color_adj_mat:new a.cl(c),u_scale_factor:new a.cj(c),u_ground_shadow_factor:new a.ci(c),u_inv_matrix:new a.cl(c),u_normal_scale:new a.cj(c),u_lutTexture:new a.ch(c)}),background:c=>({u_matrix:new a.cl(c),u_emissive_strength:new a.cj(c),u_opacity:new a.cj(c),u_color:new a.dB(c)}),backgroundPattern:c=>({u_matrix:new a.cl(c),u_emissive_strength:new a.cj(c),u_opacity:new a.cj(c),u_image:new a.ch(c),u_pattern_tl:new a.ck(c),u_pattern_br:new a.ck(c),u_texsize:new a.ck(c),u_pattern_size:new a.ck(c),u_pixel_coord_upper:new a.ck(c),u_pixel_coord_lower:new a.ck(c),u_pattern_units_to_pixels:new a.ck(c)}),terrainRaster:c=>({u_matrix:new a.cl(c),u_image0:new a.ch(c),u_image1:new a.ch(c),u_skirt_height:new a.cj(c),u_ground_shadow_factor:new a.ci(c),u_emissive_texture_available:new a.cj(c)}),skybox:c=>({u_matrix:new a.cl(c),u_sun_direction:new a.ci(c),u_cubemap:new a.ch(c),u_opacity:new a.cj(c),u_temporal_offset:new a.cj(c)}),skyboxGradient:c=>({u_matrix:new a.cl(c),u_color_ramp:new a.ch(c),u_center_direction:new a.ci(c),u_radius:new a.cj(c),u_opacity:new a.cj(c),u_temporal_offset:new a.cj(c)}),skyboxCapture:c=>({u_matrix_3f:new a.dC(c),u_sun_direction:new a.ci(c),u_sun_intensity:new a.cj(c),u_color_tint_r:new a.d3(c),u_color_tint_m:new a.d3(c),u_luminance:new a.cj(c)}),globeRaster:c=>({u_proj_matrix:new a.cl(c),u_globe_matrix:new a.cl(c),u_normalize_matrix:new a.cl(c),u_merc_matrix:new a.cl(c),u_zoom_transition:new a.cj(c),u_merc_center:new a.ck(c),u_image0:new a.ch(c),u_image1:new a.ch(c),u_grid_matrix:new a.dC(c),u_skirt_height:new a.cj(c),u_far_z_cutoff:new a.cj(c),u_frustum_tl:new a.ci(c),u_frustum_tr:new a.ci(c),u_frustum_br:new a.ci(c),u_frustum_bl:new a.ci(c),u_globe_pos:new a.ci(c),u_globe_radius:new a.cj(c),u_viewport:new a.ck(c),u_emissive_texture_available:new a.cj(c)}),globeAtmosphere:c=>({u_frustum_tl:new a.ci(c),u_frustum_tr:new a.ci(c),u_frustum_br:new a.ci(c),u_frustum_bl:new a.ci(c),u_horizon:new a.cj(c),u_transition:new a.cj(c),u_fadeout_range:new a.cj(c),u_atmosphere_fog_color:new a.d3(c),u_high_color:new a.d3(c),u_space_color:new a.d3(c),u_temporal_offset:new a.cj(c),u_horizon_angle:new a.cj(c)}),model:c=>({u_matrix:new a.cl(c),u_lighting_matrix:new a.cl(c),u_normal_matrix:new a.cl(c),u_node_matrix:new a.cl(c),u_lightpos:new a.ci(c),u_lightintensity:new a.cj(c),u_lightcolor:new a.ci(c),u_camera_pos:new a.ci(c),u_opacity:new a.cj(c),u_baseColorFactor:new a.d3(c),u_emissiveFactor:new a.d3(c),u_metallicFactor:new a.cj(c),u_roughnessFactor:new a.cj(c),u_baseTextureIsAlpha:new a.ch(c),u_alph
vendor: 34,213 bytes, line 3207
3207aMask:new a.ch(c),u_alphaCutoff:new a.cj(c),u_baseColorTexture:new a.ch(c),u_metallicRoughnessTexture:new a.ch(c),u_normalTexture:new a.ch(c),u_occlusionTexture:new a.ch(c),u_emissionTexture:new a.ch(c),u_lutTexture:new a.ch(c),u_color_mix:new a.d3(c),u_aoIntensity:new a.cj(c),u_emissive_strength:new a.cj(c),u_occlusionTextureTransform:new a.d3(c)}),modelDepth:c=>({u_matrix:new a.cl(c),u_instance:new a.cl(c),u_node_matrix:new a.cl(c)}),groundShadow:c=>({u_matrix:new a.cl(c),u_ground_shadow_factor:new a.ci(c)}),stars:c=>({u_matrix:new a.cl(c),u_up:new a.ci(c),u_right:new a.ci(c),u_intensity_multiplier:new a.cj(c)}),snowParticle:c=>({u_modelview:new a.cl(c),u_projection:new a.cl(c),u_time:new a.cj(c),u_cam_pos:new a.ci(c),u_velocityConeAperture:new a.cj(c),u_velocity:new a.cj(c),u_horizontalOscillationRadius:new a.cj(c),u_horizontalOscillationRate:new a.cj(c),u_boxSize:new a.cj(c),u_billboardSize:new a.cj(c),u_simpleShapeParameters:new a.ck(c),u_screenSize:new a.ck(c),u_thinningCenterPos:new a.ck(c),u_thinningShape:new a.ci(c),u_thinningAffectedRatio:new a.cj(c),u_thinningParticleOffset:new a.cj(c),u_particleColor:new a.d3(c),u_direction:new a.ci(c)}),rainParticle:c=>({u_modelview:new a.cl(c),u_projection:new a.cl(c),u_time:new a.cj(c),u_cam_pos:new a.ci(c),u_texScreen:new a.ch(c),u_velocityConeAperture:new a.cj(c),u_velocity:new a.cj(c),u_boxSize:new a.cj(c),u_rainDropletSize:new a.ck(c),u_distortionStrength:new a.cj(c),u_rainDirection:new a.ci(c),u_color:new a.d3(c),u_screenSize:new a.ck(c),u_thinningCenterPos:new a.ck(c),u_thinningShape:new a.ci(c),u_thinningAffectedRatio:new a.cj(c),u_thinningParticleOffset:new a.cj(c),u_shapeDirectionalPower:new a.cj(c),u_shapeNormalPower:new a.cj(c),u_mode:new a.cj(c)}),vignette:c=>({u_vignetteShape:new a.ci(c),u_vignetteColor:new a.d3(c)}),occlusion:c=>({u_matrix:new a.cl(c),u_anchorPos:new a.ci(c),u_screenSizePx:new a.ck(c),u_occluderSizePx:new a.ck(c),u_color:new a.d3(c)})};class Go{constructor(t,o,u,p){this.id=Go.uniqueIdxCounter,Go.uniqueIdxCounter++,this.context=t;const g=t.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||p||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Go.uniqueIdxCounter,Go.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Go.uniqueIdxCounter=0;const Ca={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Jr{constructor(t,o,u,p,g,y){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=p,this.instanceCount=y,this.context=t;const b=t.gl;this.buffer=b.createBuffer(),t.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||g||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let u=0;u<this.attributes.length;u++){const p=o.getAttributeLocation(t,this.attributes[u].name);p!==-1&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,o,u){for(let p=0;p<this.attributes.length;p++){const g=this.attributes[p],y=o.getAttributeLocation(t,g.name);y!==-1&&t.vertexAttribPointer(y,g.components,t[Ca[g.type]],!1,this.itemSize,g.offset+this.itemSize*(u||0))}}setVertexAttribDivisor(t,o,u){for(let p=0;p<this.attributes.length;p++){const g=o.getAttributeLocation(t,this.attributes[p].name);g!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(g,u)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class dl{constructor(t,o,u,p,g){this.context=t,this.width=o,this.height=u;const y=this.framebuffer=t.gl.createFramebuffer();p>0&&(this.colorAttachment0=new nd(t,y,0)),p>1&&(this.colorAttachment1=new nd(t,y,1)),g&&(this.depthAttachmentType=g,this.depthAttachment=g==="renderbuffer"?new Ku(t,y):new rd(t,y))}createColorAttachment(t,o){o===0?this.colorAttachment0=new nd(t,this.framebuffer,0):o===1&&(this.colorAttachment1=new nd(t,this.framebuffer,1))}removeColorAttachment(t,o){const u=this.context.gl;let p;o===0?(p=this.colorAttachment0.get(),this.colorAttachment0=void 0):o===1&&(p=this.colorAttachment1.get(),this.colorAttachment1=void 0),p&&u.deleteTexture(p)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const o=this.colorAttachment0.get();o&&t.deleteTexture(o)}if(this.colorAttachment1){const o=this.colorAttachment1.get();o&&t.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&t.deleteTexture(o)}t.deleteFramebuffer(this.framebuffer)}}class ps{constructor(t,o){this.gl=t,this.clearColor=new ol(this),this.clearDepth=new Is(this),this.clearStencil=new Rs(this),this.colorMask=new Jh(this),this.depthMask=new ed(this),this.stencilMask=new Bl(this),this.stencilFunc=new Yc(this),this.stencilOp=new Qr(this),this.stencilTest=new sr(this),this.depthRange=new Bn(this),this.depthTest=new al(this),this.depthFunc=new Ha(this),this.blend=new dc(this),this.blendFunc=new zs(this),this.blendColor=new td(this),this.blendEquation=new df(this),this.cullFace=new kl(this),this.cullFaceSide=new Ds(this),this.frontFace=new ff(this),this.program=new Wu(this),this.activeTexture=new pf(this),this.viewport=new fs(this),this.bindFramebuffer=new sl(this),this.bindRenderbuffer=new fc(this),this.bindTexture=new Fl(this),this.bindVertexBuffer=new vp(this),this.bindElementBuffer=new id(this),this.bindVertexArrayOES=new pc(this),this.pixelStoreUnpack=new Yu(this),this.pixelStoreUnpackPremultiplyAlpha=new Nl(this),this.pixelStoreUnpackFlipY=new Co(this),this.options=o?Object.assign({},o):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=o&&!!o.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=t.getExtension("WEBGL_blend_func_extended")}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o,u){return new Go(this,t,o,u)}createVertexBuffer(t,o,u,p,g){return new Jr(this,t,o,u,p,g)}createRenderbuffer(t,o,u){const p=this.gl,g=p.createRenderbuffer();return this.bindRenderbuffer.set(g),p.renderbufferStorage(p.RENDERBUFFER,t,o,u),this.bindRenderbuffer.set(null),g}createFramebuffer(t,o,u,p){return new dl(this,t,o,u,p)}clear({color:t,depth:o,stencil:u,colorMask:p}){const g=this.gl;let y=0;t&&(y|=g.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(p||[!0,!0,!0,!0])),o!==void 0&&(y|=g.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),u!==void 0&&(y|=g.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),g.clear(y)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){a.by(t.blendFunction,bi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let zt;function lr(c,t,o,u,p,g,y){const b=c.context,T=b.gl,C=c.transform,I=[a.aF(C.center.lng),a.aJ(C.center.lat)],B=o.layout.get("symbol-placement"),L=o.layout.get("text-variable-anchor"),N=o.layout.get("icon-rotation-alignment")==="map",H=o.layout.get("text-rotation-alignment")==="map",j=B!=="point",q=[];let W=0,ne=0;for(let de=0;de<u.length;de++){const se=u[de],Te=t.getTile(se),Ae=Te.getBucket(o);if(!Ae)continue;const Re=Ae.getProjection().createInversionMatrix(C,se.canonical),Be=[],Le=up(se,Ae,C),$e=!y&&N&&j,ot=y&&H&&j,Fe=L&&Ae.hasTextData(),Se=Ae.hasIconTextFit()&&Fe&&Ae.hasIconData(),Ke=$e||ot||y&&Fe||Se,Ve=Ae.projection.name==="globe",it=Ve?a.aj(C.zoom):0;Ve&&(Be.push("PROJECTION_GLOBE_VIEW"),Ke&&Be.push("PROJECTED_POS_ON_VIEWPORT"));const Et=c.getOrCreateProgram("collisionBox",{defines:Be});let Bt=Le;p[0]===0&&p[1]===0||(Bt=c.translatePosMatrix(Le,Te,p,g));const Ct=y?Ae.textCollisionBox:Ae.iconCollisionBox,At=Ae.collisionCircleArray;if(At.length>0){const Wt=a.bC(),Ft=Bt;a.cP(Wt,Ae.placementInvProjMatrix,C.glCoordMatrix),a.cP(Wt,Wt,Ae.placementViewportMatrix),q.push({circleArray:At,circleOffset:ne,transform:Ft,invTransform:Wt,projection:Ae.getProjection()}),W+=At.length/4,ne=W}if(!Ct)continue;c.terrain&&c.terrain.setupElevationDraw(Te,Et);const Qt=Ve?[se.canonical.x,se.canonical.y,1<<se.canonical.z]:[0,0,0];Et.draw(c,T.LINES,ti.disabled,yi.disabled,c.colorModeForRenderPass(),di.disabled,dd(Bt,Re,C,it,I,Te,Qt,Ae.getProjection()),o.id,Ct.layoutVertexBuffer,Ct.indexBuffer,Ct.segments,null,C.zoom,null,[Ct.collisionVertexBuffer,Ct.collisionVertexBufferExt])}if(!y||!q.length)return;const ie=c.getOrCreateProgram("collisionCircle"),ee=new a.dZ;ee.resize(4*W),ee._trim();let xe=0;for(const de of q)for(let se=0;se<de.circleArray.length/4;se++){const Te=4*se,Ae=de.circleArray[Te+0],Re=de.circleArray[Te+1],Be=de.circleArray[Te+2],Le=de.circleArray[Te+3];ee.emplace(xe++,Ae,Re,Be,Le,0),ee.emplace(xe++,Ae,Re,Be,Le,1),ee.emplace(xe++,Ae,Re,Be,Le,2),ee.emplace(xe++,Ae,Re,Be,Le,3)}(!zt||zt.length<2*W)&&(zt=(function(de){const se=2*de,Te=new a.b0;Te.resize(se),Te._trim();for(let Ae=0;Ae<se;Ae++){const Re=6*Ae;Te.uint16[Re+0]=4*Ae+0,Te.uint16[Re+1]=4*Ae+1,Te.uint16[Re+2]=4*Ae+2,Te.uint16[Re+3]=4*Ae+2,Te.uint16[Re+4]=4*Ae+3,Te.uint16[Re+5]=4*Ae+0}return Te})(W));const me=b.createIndexBuffer(zt,!0),ye=b.createVertexBuffer(ee,a.d_.members,!0);for(const de of q){const se=oh(de.transform,de.invTransform,C,de.projection);ie.draw(c,T.TRIANGLES,ti.disabled,yi.disabled,c.colorModeForRenderPass(),di.disabled,se,o.id,ye,me,a.bg.simpleSegment(0,2*de.circleOffset,de.circleArray.length,de.circleArray.length/2),null,C.zoom)}ye.destroy(),me.destroy()}const cr=a.bC();function ms(c){const t=c._camera.getWorldToCamera(c.worldSize,1),o=a.aB([],t,c.globeMatrix);a.bl(o,o);const u=[0,0,0],p=[0,1,0,0];return a.aC(p,p,o),u[0]=p[0],u[1]=p[1],u[2]=p[2],a.aw(u,u),u}function au({width:c,height:t,anchor:o,textOffset:u,textScale:p},g){const{horizontalAlign:y,verticalAlign:b}=a.c1(o),T=-(y-.5)*c,C=-(b-.5)*t,I=a.c2(o,u);return new a.P((T/p+I[0])*g,(C/p+I[1])*g)}function xc(c,t,o,u,p,g,y,b,T,C){const I=c.text.placedSymbolArray,B=c.text.dynamicLayoutVertexArray,L=c.icon.dynamicLayoutVertexArray,N={},H=c.getProjection(),j=el(y,H,p),q=p.elevation,W=H.upVectorScale(y.canonical,p.center.lat,p.worldSize).metersToTile;B.clear();for(let ne=0;ne<I.length;ne++){const ie=I.get(ne),{tileAnchorX:ee,tileAnchorY:xe,numGlyphs:me}=ie,ye=ie.hidden||!ie.crossTileID||c.allowVerticalPlacement&&!ie.placedOrientation?null:u[ie.crossTileID];if(ye){let de=0,se=0,Te=0;const Ae=c.elevationType==="road";if(q||Ae){const Ve=Ae?c.getElevationFeatureForText(ne):null,it=a.bV.getAtTileOffset(y,new a.P(ee,xe),q,Ve),[Et,Bt,Ct]=H.upVector(y.canonical,ee,xe);de=it*Et*W,se=it*Bt*W,Te=it*Ct*W}let[Re,Be,Le,$e]=hs(ie.projectedAnchorX+de,ie.projectedAnchorY+se,ie.projectedAnchorZ+Te,o?j:g);const ot=Kd(p.getCameraToCenterDistance(H),$e);let Fe=a.bM(c.textSizeData,T,ie)*ot/a.bY;o&&(Fe*=c.tilePixelRatio/b);const Se=au(ye,Fe);o?({x:Re,y:Be,z:Le}=H.projectTilePoint(ee+Se.x,xe+Se.y,y.canonical),[Re,Be,Le]=hs(Re+de,Be+se,Le+Te,g)):(t&&Se._rotate(-p.angle),Re+=Se.x,Be+=Se.y,Le=0);const Ke=c.allowVerticalPlacement&&ie.placedOrientation===a.bL.vertical?Math.PI/2:0;for(let Ve=0;Ve<me;Ve++)a.bO(B,Re,Be,Le,Ke);C&&ie.associatedIconIndex>=0&&(N[ie.associatedIconIndex]={x:Re,y:Be,z:Le,angle:Ke})}else Ao(me,B)}if(C){L.clear();const ne=c.icon.placedSymbolArray;for(let ie=0;ie<ne.length;ie++){const ee=ne.get(ie),{numGlyphs:xe}=ee,me=N[ie];if(ee.hidden||!me)Ao(xe,L);else{const{x:ye,y:de,z:se,angle:Te}=me;for(let Ae=0;Ae<xe;Ae++)a.bO(L,ye,de,se,Te)}}c.icon.dynamicLayoutVertexBuffer.updateData(L)}c.text.dynamicLayoutVertexBuffer.updateData(B)}function su(c,t,o,u,p,g,y={}){const b=o.paint.get("icon-translate"),T=o.paint.get("text-translate"),C=o.paint.get("icon-translate-anchor"),I=o.paint.get("text-translate-anchor"),B=o.layout.get("icon-rotation-alignment"),L=o.layout.get("text-rotation-alignment"),N=o.layout.get("icon-pitch-alignment"),H=o.layout.get("text-pitch-alignment"),j=o.layout.get("icon-keep-upright"),q=o.layout.get("text-keep-upright"),W=o.paint.get("icon-color-saturation"),ne=o.paint.get("icon-color-contrast"),ie=o.paint.get("icon-color-brightness-min"),ee=o.paint.get("icon-color-brightness-max"),xe=o.layout.get("symbol-elevation-reference")==="sea",me=o.layout.get("icon-image-use-theme")==="none",ye=c.context,de=ye.gl,se=c.transform,Te=B==="map",Ae=L==="map",Re=N==="map",Be=H==="map",Le=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let $e=!1;const ot=c.depthModeForSublayer(0,ti.ReadOnly),Fe=new ti(c.context.gl.LEQUAL,ti.ReadOnly,c.depthRangeFor3D),Se=[a.aF(se.center.lng),a.aJ(se.center.lat)],Ke=o.layout.get("text-variable-anchor"),Ve=se.projection.name==="globe",it=[],Et=[0,-1,0];for(const Bt of u){const Ct=t.getTile(Bt),At=Ct.getBucket(o);if(!At||At.projection.name==="mercator"&&Ve||At.fullyClipped)continue;const Qt=At.projection.name==="globe",Wt=Qt?a.aj(se.zoom):0,Ft=el(Bt,At.getProjection(),se),Yt=se.calculatePixelsToTileUnitsMatrix(Ct),oi=Ke&&At.hasTextData(),fi=At.hasIconTextFit()&&oi&&At.hasIconData(),Ri=At.getProjection().createInversionMatrix(se,Bt.canonical),Hi=(1<<Ct.tileID.canonical.z)*a.al/c.transform.worldSize,pi=un=>{let Ci=[0,0,0];if(un){const Pi=c.style.directionalLight,Mn=c.style.ambientLight;Pi&&Mn&&(Ci=Jo(c.style,Pi,Mn))}return Ci},zi=un=>{se.depthOcclusionForSymbolsAndCircles&&(o.hasOcclusionOpacityProperties||c.terrain)&&(un.push("DEPTH_D24"),un.push("DEPTH_OCCLUSION"))},wi=un=>{o.lut&&!me&&(o.lut.texture||(o.lut.texture=new a.d$(c.context,o.lut.image,[o.lut.image.height,o.lut.image.height,o.lut.image.height],ye.gl.RGBA8)),ye.activeTexture.set(ye.gl.TEXTURE0+10),o.lut.texture&&o.lut.texture.bind(ye.gl.LINEAR,ye.gl.CLAMP_TO_EDGE),un.push("APPLY_LUT_ON_GPU"))},an=()=>{const un=Te&&o.layout.get("symbol-placement")!=="point",Ci=[];zi(Ci),wi(Ci);const Pi=un||fi,Mn=At.elevationType==="road",Jn=c.shadowRenderer,xn=Mn&&Re&&!!Jn&&Jn.enabled,Cn=pi(xn),Ro=Mn&&Re&&!c.terrain?Fe:ot,co=o.paint.get("icon-image-cross-fade");c.terrainRenderModeElevated()&&Re&&Ci.push("PITCH_WITH_MAP_TERRAIN"),Qt&&(Ci.push("PROJECTION_GLOBE_VIEW"),Pi&&Ci.push("PROJECTED_POS_ON_VIEWPORT")),co>0&&At.hasAnySecondaryIcon&&Ci.push("ICON_TRANSITION"),!At.icon.zOffsetVertexBuffer||Mn&&c.terrain||Ci.push("Z_OFFSET"),W===0&&ne===0&&ie===0&&ee===1||Ci.push("COLOR_ADJUSTMENT"),At.sdfIcons&&Ci.push("RENDER_SDF"),xn&&Ci.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Mn&&Re&&!c.terrain&&At.icon.orientationVertexBuffer&&Ci.push("ELEVATED_ROADS");const Zr=At.icon.programConfigurations.get(o.id),hn=c.getOrCreateProgram("symbol",{config:Zr,defines:Ci}),ga=Ct.imageAtlasTexture?Ct.imageAtlasTexture.size:[0,0],uo=At.iconSizeData,go=a.bK(uo,se.zoom),Pa=Re||!se.isOrthographic,na=Vc(Ft,Ct.tileID.canonical,Re,Te,se,At.getProjection(),Yt),Zn=No(Ft,Ct.tileID.canonical,Re,Te,se,At.getProjection(),Yt),yr=c.translatePosMatrix(Zn,Ct,b,C,!0),Dn=c.translatePosMatrix(Ft,Ct,b,C),Sr=Pi?cr:na,Vr=Te&&!Re&&!un;let Yn=Et;!Ve&&!se.mercatorFromTransition||Te||(Yn=ms(se));const _a=Qt?Yn:Et,wh=o.getColorAdjustmentMatrix(W,ne,ie,ee),Gs=ru(uo.kind,go,Vr,Re,c,Dn,Sr,yr,xe,!1,ga,[0,0],0,Bt,Wt,Se,Ri,_a,At.getProjection(),Cn,Hi,wh,co,null),vu=Ct.imageAtlasTexture?Ct.imageAtlasTexture:null,bu=o.layout.get("icon-size").constantOr(0)!==1||At.iconsNeedLinear,ya=At.sdfIcons||c.options.rotating||c.options.zooming||bu||Pa?de.LINEAR:de.NEAREST,Xa=At.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,Hs=c.terrain&&Re&&un?a.bl(a.bC(),na):cr;if(un&&At.icon){const La=a.bV.getAtTileOffsetFunc(Bt,se.center.lat,se.worldSize,At.getProjection()),Ln=Il(Ft,Ct.tileID.canonical,Re,Te,se,At.getProjection(),Yt),Ql=o.layout.get("icon-size-scale-range"),Ff=a.aA(c.scaleFactor,Ql[0],Ql[1]);pn(At,Ft,c,!1,Ln,Zn,Re,j,La,Bt,Ff)}return{program:hn,buffers:At.icon,uniformValues:Gs,atlasTexture:vu,atlasTextureIcon:null,atlasInterpolation:ya,atlasInterpolationIcon:null,isSDF:At.sdfIcons,hasHalo:Xa,depthMode:Ro,tile:Ct,renderWithShadows:xn,labelPlaneMatrixInv:Hs}},tn=()=>{const un=Ae&&o.layout.get("symbol-placement")!=="point",Ci=[],Pi=un||Ke||fi,Mn=At.elevationType==="road",Jn=c.shadowRenderer,xn=Mn&&Be&&!!Jn&&Jn.enabled,Cn=pi(xn),Ro=Mn&&Be&&!c.terrain?Fe:ot;c.terrainRenderModeElevated()&&Be&&Ci.push("PITCH_WITH_MAP_TERRAIN"),Qt&&(Ci.push("PROJECTION_GLOBE_VIEW"),Pi&&Ci.push("PROJECTED_POS_ON_VIEWPORT")),!At.text.zOffsetVertexBuffer||Mn&&c.terrain||Ci.push("Z_OFFSET"),At.iconsInText&&Ci.push("RENDER_TEXT_AND_SYMBOL"),Ci.push("RENDER_SDF"),xn&&Ci.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Mn&&Be&&!c.terrain&&At.text.orientationVertexBuffer&&Ci.push("ELEVATED_ROADS"),zi(Ci);const co=At.text.programConfigurations.get(o.id),Zr=c.getOrCreateProgram("symbol",{config:co,defines:Ci});let hn,ga=[0,0],uo=null;const go=At.textSizeData;At.iconsInText&&(ga=Ct.imageAtlasTexture?Ct.imageAtlasTexture.size:[0,0],uo=Ct.imageAtlasTexture?Ct.imageAtlasTexture:null,hn=Be||!se.isOrthographic||c.options.rotating||c.options.zooming||go.kind==="composite"||go.kind==="camera"?de.LINEAR:de.NEAREST);const Pa=Ct.glyphAtlasTexture?Ct.glyphAtlasTexture.size:[0,0],na=o.layout.get("text-size-scale-range"),Zn=a.aA(c.scaleFactor,na[0],na[1]),yr=a.bK(go,se.zoom,Zn),Dn=Vc(Ft,Ct.tileID.canonical,Be,Ae,se,At.getProjection(),Yt),Sr=No(Ft,Ct.tileID.canonical,Be,Ae,se,At.getProjection(),Yt),Vr=c.translatePosMatrix(Sr,Ct,T,I,!0),Yn=c.translatePosMatrix(Ft,Ct,T,I),_a=Pi?cr:Dn,wh=Ae&&!Be&&!un;let Gs=Et;!Ve&&!se.mercatorFromTransition||Ae||(Gs=ms(se));const vu=ru(go.kind,yr,wh,Be,c,Yn,_a,Vr,xe,!0,Pa,ga,0,Bt,Wt,Se,Ri,Qt?Gs:Et,At.getProjection(),Cn,Hi,null,null,Zn),bu=Ct.glyphAtlasTexture?Ct.glyphAtlasTexture:null,ya=de.LINEAR,Xa=o.paint.get("text-halo-width").constantOr(1)!==0,Hs=c.terrain&&Be&&un?a.bl(a.bC(),Dn):cr;if(un&&At.text){const La=a.bV.getAtTileOffsetFunc(Bt,se.center.lat,se.worldSize,At.getProjection()),Ln=Il(Ft,Ct.tileID.canonical,Be,Ae,se,At.getProjection(),Yt);pn(At,Ft,c,!0,Ln,Sr,Be,q,La,Bt,Zn)}return{program:Zr,buffers:At.text,uniformValues:vu,atlasTexture:bu,atlasTextureIcon:uo,atlasInterpolation:ya,atlasInterpolationIcon:hn,isSDF:!0,hasHalo:Xa,depthMode:Ro,tile:Ct,renderWithShadows:xn,labelPlaneMatrixInv:Hs}},gn=At.icon.segments.get().length,Yi=At.text.segments.get().length,Di=gn&&!y.onlyText?an():null,rn=Yi&&!y.onlyIcons?tn():null,Fn=o.paint.get("icon-opacity").constantOr(1),_n=o.paint.get("text-opacity").constantOr(1);if(Le&&At.canOverlap){$e=!0;const un=Fn&&!y.onlyText?At.icon.segments.get():[],Ci=_n&&!y.onlyIcons?At.text.segments.get():[];for(const Pi of un)it.push({segments:new a.bg([Pi]),sortKey:Pi.sortKey,state:Di});for(const Pi of Ci)it.push({segments:new a.bg([Pi]),sortKey:Pi.sortKey,state:rn})}else y.onlyText||it.push({segments:Fn?At.icon.segments:new a.bg([]),sortKey:0,state:Di}),y.onlyIcons||it.push({segments:_n?At.text.segments:new a.bg([]),sortKey:0,state:rn})}$e&&it.sort((Bt,Ct)=>Bt.sortKey-Ct.sortKey);for(const Bt of it){const Ct=Bt.state;if(Ct)if(c.terrain?c.terrain.setupElevationDraw(Ct.tile,Ct.program,{useDepthForOcclusion:se.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Ct.labelPlaneMatrixInv}):c.setupDepthForOcclusion(se.depthOcclusionForSymbolsAndCircles,Ct.program),ye.activeTexture.set(de.TEXTURE0),Ct.atlasTexture&&Ct.atlasTexture.bind(Ct.atlasInterpolation,de.CLAMP_TO_EDGE,!0),Ct.atlasTextureIcon&&(ye.activeTexture.set(de.TEXTURE1),Ct.atlasTextureIcon&&Ct.atlasTextureIcon.bind(Ct.atlasInterpolationIcon,de.CLAMP_TO_EDGE,!0)),Ct.renderWithShadows&&c.shadowRenderer.setupShadows(Ct.tile.tileID.toUnwrapped(),Ct.program,"vector-tile"),c.uploadCommonLightUniforms(c.context,Ct.program),Ct.hasHalo){const At=Ct.uniformValues;At.u_is_halo=1,vc(Ct.buffers,Bt.segments,o,c,Ct.program,Ct.depthMode,p,g,At,2),At.u_is_halo=0}else{if(Ct.isSDF){const At=Ct.uniformValues;Ct.hasHalo&&(At.u_is_halo=1,vc(Ct.buffers,Bt.segments,o,c,Ct.program,Ct.depthMode,p,g,At,1)),At.u_is_halo=0}vc(Ct.buffers,Bt.segments,o,c,Ct.program,Ct.depthMode,p,g,Ct.uniformValues,1)}}}function vc(c,t,o,u,p,g,y,b,T,C){const I=[c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer,c.iconTransitioningVertexBuffer,c.globeExtVertexBuffer,c.zOffsetVertexBuffer,c.orientationVertexBuffer];p.draw(u,u.context.gl.TRIANGLES,g,y,b,di.disabled,T,o.id,c.layoutVertexBuffer,c.indexBuffer,t,o.paint,u.transform.zoom,c.programConfigurations.get(o.id),I,C)}function bc(c,t){const o=1<<c.canonical.z,u=(t.x*o-c.canonical.x-c.wrap*o)*a.al,p=(t.y*o-c.canonical.y)*a.al,g=a.e8(t.z,t.y);return a.d5(u,p,g)}function Sp(c,t,o,u,p){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const g=c.context.gl,y=new ti(c.context.gl.LEQUAL,ti.ReadWrite,c.depthRangeFor3D),b=new ti(c.context.gl.GREATER,ti.ReadWrite,c.depthRangeFor3D),T=(function(N){let H=.01;return N.isOrthographic&&(H=a.ak(1e-4,H,a.d0(N.pitch>=Aa?1:N.pitch/Aa))),2*H})(c.transform),C=c.transform.getFreeCameraOptions().position,I="elevatedStructuresDepthReconstruct",B=c.getOrCreateProgram(I,{defines:["DEPTH_RECONSTRUCTION"]}),L=c.getOrCreateProgram(I);for(const N of u){const H=t.getTile(N),j=H.getBucket(o);if(!j)continue;const q=j.elevatedStructures;if(!q)continue;const W=j.elevationBufferData.heightRange,ne=bc(N.toUnwrapped(),C),ie=c.translatePosMatrix(N.projMatrix,H,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));let ee,xe,me,ye;if(p==="initialize"){if(!W||W.min>=1||q.depthSegments.segments[0].primitiveLength===0)continue;ee=yc(ie,ne,T,1,0),xe=y,me=q.depthSegments,ye=B}else if(p==="reset"){if(!W||W.min>=0||q.maskSegments.segments[0].primitiveLength===0)continue;ee=yc(ie,ne,0,0,1),xe=b,me=q.maskSegments,ye=B}else if(p==="geometry"){if(q.depthSegments.segments[0].primitiveLength===0)continue;ee=yc(ie,ne,T,1,0),xe=y,me=q.depthSegments,ye=L}ye.draw(c,g.TRIANGLES,xe,yi.disabled,bi.disabled,di.disabled,ee,o.id,q.vertexBuffer,q.indexBuffer,me,o.paint,c.transform.zoom)}}function wr(c,t,o,u){const{painter:p,sourceCache:g,layer:y,coords:b,colorMode:T,elevationType:C,terrainEnabled:I,pass:B}=c,L=p.context.gl,N=y.paint.get("fill-pattern"),H=y.paint.get("fill-pattern-cross-fade"),j=N.constantOr(null);let q=C;C!=="road"||t&&!I||(q="none");const W=q==="road",ne=c.painter.shadowRenderer,ie=W&&!!ne&&ne.enabled,ee=new ti(p.context.gl.LEQUAL,ti.ReadOnly,p.depthRangeFor3D);let xe=[0,0,0];if(ie){const se=p.style.directionalLight,Te=p.style.ambientLight;se&&Te&&(xe=Jo(p.style,se,Te))}const me=N&&N.constantOr(1),ye=p.terrain&&p.terrain.renderingToTexture,de=(se,Te)=>{let Ae,Re,Be,Le,$e;Te?(Ae=me&&!y.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Be=L.LINES):(Ae=me?"fillPattern":"fill",Be=L.TRIANGLES);for(const ot of b){const Fe=g.getTile(ot);if(me&&!Fe.patternsLoaded())continue;const Se=Fe.getBucket(y);if(!Se)continue;const Ke=t?Se.elevationBufferData:Se.bufferData;if(Ke.isEmpty())continue;p.prepareDrawTile();const Ve=Ke.programConfigurations.get(y.id),it=p.isTileAffectedByFog(ot),Et=[],Bt=[];W&&(Et.push("ELEVATED_ROADS"),Bt.push(Ke.elevatedLayoutVertexBuffer)),ie&&Et.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ye&&o&&Et.push("USE_MRT1"),me&&(p.context.activeTexture.set(L.TEXTURE0),Fe.imageAtlasTexture&&Fe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ve.updatePaintBuffers());let Ct=!1;if(j&&Fe.imageAtlas){const Yt=Fe.imageAtlas,oi=a.e3.from(j),fi=oi.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Ri=oi.getSecondary(),Hi=Yt.patternPositions.get(fi),pi=Ri?Yt.patternPositions.get(Ri.scaleSelf(a.o.devicePixelRatio).toString()):null;Ct=!!Hi&&!!pi,Hi&&Ve.setConstantPatternPositions(Hi,pi)}H>0&&(Ct||Ve.getPatternTransitionVertexBuffer("fill-pattern"))&&Et.push("FILL_PATTERN_TRANSITION");const At=p.getOrCreateProgram(Ae,{config:Ve,overrideFog:it,defines:Et}),Qt=p.translatePosMatrix(ot.projMatrix,Fe,y.paint.get("fill-translate"),y.paint.get("fill-translate-anchor"));ie&&ne.setupShadows(Fe.tileID.toUnwrapped(),At,"vector-tile");const Wt=y.paint.get("fill-emissive-strength");if(Te){Le=Ke.lineIndexBuffer,$e=Ke.lineSegments;const Yt=p.terrain&&p.terrain.renderingToTexture?p.terrain.drapeBufferSize:[L.drawingBufferWidth,L.drawingBufferHeight];Re=Ae==="fillOutlinePattern"&&me?hd(Qt,Wt,p,Fe,Yt,xe,H):rh(Qt,Wt,Yt,xe)}else Le=Ke.indexBuffer,$e=Ke.triangleSegments,Re=me?_c(Qt,Wt,p,Fe,xe,H):gc(Qt,Wt,xe);p.uploadCommonUniforms(p.context,At,ot.toUnwrapped());let Ft=se;(C==="road"&&!I||C==="offset")&&(Ft=ee),At.draw(p,Be,Ft,u||p.stencilModeForClipping(ot),T,di.disabled,Re,y.id,Ke.layoutVertexBuffer,Le,$e,y.paint,p.transform.zoom,Ve,Bt)}};p.renderPass===B&&de(p.depthModeForSublayer(1,p.renderPass==="opaque"?ti.ReadWrite:ti.ReadOnly),!1),q==="none"&&p.renderPass==="translucent"&&y.paint.get("fill-antialias")&&de(p.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ti.ReadOnly),!0)}function wc(c,t,o,u,p,g,y,b){o.resetLayerRenderingStats(c);const T=c.context,C=T.gl,I=c.transform,B=o.paint.get("fill-extrusion-pattern"),L=o.paint.get("fill-extrusion-pattern-cross-fade"),N=B.constantOr(null),H=B.constantOr(1),j=o.paint.get("fill-extrusion-opacity"),q=c.style.enable3dLights(),W=o.paint.get(q&&!H?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),ne=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),W],ie=o.layout.get("fill-extrusion-edge-radius"),ee=ie>0&&!o.paint.get("fill-extrusion-rounded-roof"),xe=ee?0:ie,me=I.projection.name==="globe"?a.eb():0,ye=I.projection.name==="globe",de=ye?a.aj(I.zoom):0,se=[a.aF(I.center.lng),a.aJ(I.center.lat)],Te=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ae=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Te?null:o.lut).toArray01().slice(0,3),Re=o.paint.get("fill-extrusion-flood-light-intensity"),Be=o.paint.get("fill-extrusion-vertical-scale"),Le=o.paint.get("fill-extrusion-line-width").constantOr(1)!==0,$e=o.paint.get("fill-extrusion-height-alignment"),ot=o.paint.get("fill-extrusion-base-alignment"),Fe=Va(c,o.paint.get("fill-extrusion-cutoff-fade-range")),Se=[];let Ke;ye&&Se.push("PROJECTION_GLOBE_VIEW"),ne[0]>0&&Se.push("FAUX_AO"),ee&&Se.push("ZERO_ROOF_RADIUS"),b&&Se.push("HAS_CENTROID"),Re>0&&Se.push("FLOOD_LIGHT"),Fe.shouldRenderCutoff&&Se.push("RENDER_CUTOFF"),Le&&Se.push("RENDER_WALL_MODE");const Ve=c.renderPass==="shadow",it=c.shadowRenderer,Et=Ve&&!!it,Bt=Ve?di.disabled:di.backCCW;c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!0);let Ct=[0,0,0];if(it){const Wt=c.style.directionalLight,Ft=c.style.ambientLight;Wt&&Ft&&(Ct=Jo(c.style,Wt,Ft)),Ve||(Se.push("RENDER_SHADOWS","DEPTH_TEXTURE"),it.useNormalOffset&&Se.push("NORMAL_OFFSET")),Ke=Se.concat(["SHADOWS_SINGLE_CASCADE"])}const At=Et?"fillExtrusionDepth":H?"fillExtrusionPattern":"fillExtrusion",Qt=o.getLayerRenderingStats();for(const Wt of u){const Ft=t.getTile(Wt),Yt=Ft.getBucket(o);if(!Yt||Yt.projection.name!==I.projection.name)continue;let oi=!1;it&&(oi=it.getMaxCascadeForTile(Wt.toUnwrapped())===0);const fi=c.isTileAffectedByFog(Wt),Ri=Yt.programConfigurations.get(o.id);let Hi=!1;if(N&&Ft.imageAtlas){const Yi=Ft.imageAtlas,Di=a.e3.from(N),rn=Di.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Fn=Di.getSecondary(),_n=Yi.patternPositions.get(rn),un=Fn?Yi.patternPositions.get(Fn.scaleSelf(a.o.devicePixelRatio).toString()):null;Hi=!!_n&&!!un,_n&&Ri.setConstantPatternPositions(_n,un)}L>0&&(Hi||Ri.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Se.push("FILL_EXTRUSION_PATTERN_TRANSITION");const pi=c.getOrCreateProgram(At,{config:Ri,defines:oi?Ke:Se,overrideFog:fi});if(c.terrain&&c.terrain.setupElevationDraw(Ft,pi,{useMeterToDem:!0}),!Yt.centroidVertexBuffer){const Yi=pi.getAttributeLocation(C,"a_centroid_pos");Yi!==-1&&C.vertexAttrib2f(Yi,0,0)}!Ve&&it&&it.setupShadows(Ft.tileID.toUnwrapped(),pi,"vector-tile"),H&&(c.context.activeTexture.set(C.TEXTURE0),Ft.imageAtlasTexture&&Ft.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Ri.updatePaintBuffers());const zi=o.paint.get("fill-extrusion-vertical-gradient"),wi=1/Yt.tileToMeter;let an;if(Ve&&it){if(md(Ft.tileID,Yt.maxHeight,c))continue;const Yi=it.calculateShadowPassMatrixFromTile(Ft.tileID.toUnwrapped());an=Gl(Yi,xe,wi,Be,$e,ot)}else{const Yi=c.translatePosMatrix(Wt.expandedProjMatrix,Ft,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Di=I.projection.createInversionMatrix(I,Wt.canonical);an=H?wp(Yi,c,zi,j,ne,xe,wi,Wt,Ft,me,$e,ot,de,se,Di,Ae,Be,L):ll(Yi,c,zi,j,ne,xe,wi,Wt,me,$e,ot,de,se,Di,Ae,Be,Re,Ct)}c.uploadCommonUniforms(T,pi,Wt.toUnwrapped(),null,Fe);let tn=Yt.segments;if(I.projection.name==="mercator"&&!Ve&&(tn=Yt.getVisibleSegments(Ft.tileID,c.terrain,c.transform.getFrustum(0)),!tn.get().length))continue;if(Qt)if(Ve)for(const Yi of tn.get())Qt.numRenderedVerticesInShadowPass+=Yi.primitiveLength;else for(const Yi of tn.get())Qt.numRenderedVerticesInTransparentPass+=Yi.primitiveLength;const gn=[];(c.terrain||b)&&gn.push(Yt.centroidVertexBuffer),ye&&gn.push(Yt.layoutVertexExtBuffer),Le&&gn.push(Yt.wallVertexBuffer),pi.draw(c,T.gl.TRIANGLES,p,g,y,Bt,an,o.id,Yt.layoutVertexBuffer,Yt.indexBuffer,tn,o.paint,c.transform.zoom,Ri,gn)}c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!1)}class lu{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Os(c,t,o,u,p,g,y,b,T,C,I,B,L,N,H,j,q,W,ne,ie){const ee=t.context,xe=ee.gl,me=t.transform,ye=t.transform.zoom,de=[],se=c.translate,Te=c.translateAnchor,Ae=c.edgeRadius,Re=Va(t,c.cutoffFadeRange);I==="clear"?(de.push("CLEAR_SUBPASS"),ie&&(de.push("CLEAR_FROM_TEXTURE"),ee.activeTexture.set(xe.TEXTURE0),ie.bind(xe.LINEAR,xe.CLAMP_TO_EDGE))):I==="sdf"?de.push("SDF_SUBPASS"):I==="emissive"&&(de.push("USE_MRT1"),ee.activeTexture.set(xe.TEXTURE0),ie.bind(xe.LINEAR,xe.CLAMP_TO_EDGE)),W&&de.push("HAS_CENTROID"),Re.shouldRenderCutoff&&de.push("RENDER_CUTOFF");const Be=(Le,$e,ot,Fe,Se)=>{let Ke=de;$e.groundRadiusBuffer!=null&&(Ke=de.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Ve=$e.programConfigurations.get(u.id),it=t.isTileAffectedByFog(Le),Et=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ve,defines:Ke,overrideFog:it}),Bt=((At,Qt,Wt,Ft,Yt,oi,fi,Ri,Hi,pi,zi)=>({u_matrix:Qt,u_opacity:Wt,u_ao_pass:Ft?1:0,u_meter_to_tile:Yt,u_ao:oi,u_flood_light_intensity:fi,u_flood_light_color:Ri,u_attenuation:Hi,u_edge_radius:pi,u_fb:0,u_fb_size:zi,u_dynamic_offset:1}))(0,Fe,B,C,Se,[L,N*Se],H,j,q,ye>=17?0:Ae*Se,ie?ie.size[0]:0),Ct=[];W&&Ct.push($e.hiddenByLandmarkVertexBuffer),$e.groundRadiusBuffer!=null&&
3207Ct.push($e.groundRadiusBuffer),t.uploadCommonUniforms(ee,Et,Le.toUnwrapped(),null,Re),Et.draw(t,ee.gl.TRIANGLES,g,y,b,T,Bt,u.id,$e.vertexBuffer,$e.indexBuffer,ot,u.paint,ye,Ve,Ct)};for(const Le of p){const $e=o.getTile(Le),ot=$e.getBucket(u);if(!ot||ot.projection.name!==me.projection.name||!ot.groundEffect||ot.groundEffect&&!ot.groundEffect.hasData())continue;const Fe=ot.groundEffect,Se=1/ot.tileToMeter;{const Ke=t.translatePosMatrix(Le.projMatrix,$e,se,Te),Ve=Fe.getDefaultSegment();Be(Le,Fe,Ve,Ke,Se)}if(ne)for(let Ke=0;Ke<4;Ke++){const Ve=a.e9[Ke](Le),it=o.getTile(Ve);if(!it)continue;const Et=it.getBucket(u);if(!Et||Et.projection.name!==me.projection.name||!Et.groundEffect||Et.groundEffect&&!Et.groundEffect.hasData())continue;const Bt=Et.groundEffect;let Ct,At;Ke===0?(Ct=[-a.al,0,0],At=1):Ke===1?(Ct=[a.al,0,0],At=0):Ke===2?(Ct=[0,-a.al,0],At=3):(Ct=[0,a.al,0],At=2);const Qt=Bt.regionSegments[At];if(!Qt)continue;const Wt=new Float32Array(16);a.br(Wt,Le.projMatrix,Ct),Be(Le,Bt,Qt,t.translatePosMatrix(Wt,$e,se,Te),Se)}}}function Ep(c,t,o,u,p,g,y){u.centroidVertexArray.length===0&&u.createCentroidsBuffer();const b=g?g.findDEMTileFor(o):null;if(!(b&&b.dem||y))return;g&&b&&b.dem&&u.selfDEMTileTimestamp!==b.dem._timestamp&&(u.borderDoneWithNeighborZ=[-1,-1,-1,-1],u.selfDEMTileTimestamp=b.dem._timestamp);const T=(q,W)=>{(q.flags|W.flags)&a.ec?(q.flags|=a.ec,W.flags|=a.ec):(q.flags&=~a.ec,W.flags&=~a.ec)},C=q=>new a.P(Math.ceil((q+a.ed)*a.ee),0),I=q=>{const W=t.getSource().minzoom,ne=ee=>{const xe=t.getTileByID(ee);if(xe&&xe.hasData())return xe.getBucket(p)},ie=[0,-1,1];for(const ee of ie){if(q.overscaledZ+ee<W)continue;const xe=ne(q.calculateScaledKey(q.overscaledZ+ee));if(xe)return xe}},B=[0,0,0],L=(q,W)=>(B[0]=Math.min(q.min.y,W.min.y),B[1]=Math.max(q.max.y,W.max.y),B[2]=a.al-W.min.x>q.max.x?W.min.x-a.al:q.max.x,B),N=(q,W)=>(B[0]=Math.min(q.min.x,W.min.x),B[1]=Math.max(q.max.x,W.max.x),B[2]=a.al-W.min.y>q.max.y?W.min.y-a.al:q.max.y,B),H=[(q,W)=>L(q,W),(q,W)=>L(W,q),(q,W)=>N(q,W),(q,W)=>N(W,q)],j=(q,W,ne,ie,ee,xe,me)=>{if(!g)return 0;const ye=[[xe?ne:q,xe?q:ne,0],[xe?ne:W,xe?W:ne,0]],de=me<0?a.al+me:me,se=[xe?de:(q+W)/2,xe?(q+W)/2:de,0];return ne===0&&me<0||ne!==0&&me>0?g.getForTilePoints(ee,[se],!0,ie):ye.push(se),g.getForTilePoints(o,ye,!0,b),Math.max(ye[0][2],ye[1][2],se[2])/g.exaggeration()};for(let q=0;q<4;q++){const W=u.borderFeatureIndices[q];if(W.length===0)continue;const ne=a.e9[q](o),ie=I(ne);if(!(ie&&ie instanceof a.ea))continue;const ee=g?g.findDEMTileFor(ne):null;if(!(ee&&ee.dem||y)||(g&&ee&&ee.dem&&u.borderDEMTileTimestamp[q]!==ee.dem._timestamp&&(u.borderDoneWithNeighborZ[q]=-1,u.borderDEMTileTimestamp[q]=ee.dem._timestamp),u.borderDoneWithNeighborZ[q]===ie.canonical.z))continue;ie.centroidVertexArray.length===0&&ie.createCentroidsBuffer();const xe=(q<2?1:5)-q,me=ie.borderDoneWithNeighborZ[xe]!==u.canonical.z,ye=ie.borderFeatureIndices[xe];let de=0;if(u.canonical.z!==ie.canonical.z){for(const se of W)u.showCentroid(u.featuresOnBorder[se]);if(me)for(const se of ye)ie.showCentroid(ie.featuresOnBorder[se]);u.borderDoneWithNeighborZ[q]=ie.canonical.z,ie.borderDoneWithNeighborZ[xe]=u.canonical.z}for(const se of W){const Te=u.featuresOnBorder[se],Ae=u.centroidData[Te.centroidDataIndex],Re=Te.borders[q];let Be;for(;de<ye.length;){Be=ie.featuresOnBorder[ye[de]];const Le=Be.borders[xe];if(Le[1]>Re[0]+3||Le[0]>Re[0]-3)break;ie.showCentroid(Be),de++}if(Be&&de<ye.length){const Le=de;let $e=0;for(;!(Be.borders[xe][0]>Re[1]-3)&&($e++,++de!==ye.length);)Be=ie.featuresOnBorder[ye[de]];Be=ie.featuresOnBorder[ye[Le]];let ot=!1;if($e>=1){const Ke=Be.borders[xe];Math.abs(Re[0]-Ke[0])<3&&Math.abs(Re[1]-Ke[1])<3&&($e=1,ot=!0,de=Le+1)}else if($e===0){u.showCentroid(Te);continue}const Fe=ie.centroidData[Be.centroidDataIndex];y&&ot&&T(Ae,Fe);const Se=Te.intersectsCount()>1||Be.intersectsCount()>1;if($e>1)de=Le,Ae.centroidXY=Fe.centroidXY=new a.P(0,0);else if(ee&&ee.dem&&!Se){const Ke=H[q](Ae,Fe),Ve=q%2?a.al-1:0,it=j(Ke[0],Math.min(a.al-1,Ke[1]),Ve,ee,ne,q<2,Ke[2]);Ae.centroidXY=Fe.centroidXY=C(it)}else Se?Ae.centroidXY=Fe.centroidXY=new a.P(0,0):(Ae.centroidXY=u.encodeBorderCentroid(Te),Fe.centroidXY=ie.encodeBorderCentroid(Be));u.writeCentroidToBuffer(Ae),ie.writeCentroidToBuffer(Fe)}else u.showCentroid(Te)}u.borderDoneWithNeighborZ[q]=ie.canonical.z,ie.borderDoneWithNeighborZ[xe]=u.canonical.z}(u.needsCentroidUpdate||!u.centroidVertexBuffer&&u.centroidVertexArray.length!==0)&&u.uploadCentroid(c)}const Fm=[1,0,0],_f=[0,1,0],yf=[0,0,1];function md(c,t,o){const u=o.transform,p=o.shadowRenderer;if(!p)return!0;const g=c.toUnwrapped(),y=u.tileSize*p._cascades[o.currentShadowCascade].scale;let b=t;if(u.elevation){const j=u.elevation.getMinMaxForTile(c);j&&(b+=j.max)}const T=[...p.shadowDirection];T[2]=-T[2];const C=p.computeSimplifiedTileShadowVolume(g,b,y,T);if(!C)return!1;const I=[Fm,_f,yf,T,[T[0],0,T[2]],[0,T[1],T[2]]],B=u.projection.name==="globe",L=u.scaleZoom(y),N=a.cB.fromInvProjectionMatrix(u.invProjMatrix,u.worldSize,L,!B),H=p.getCurrentCascadeFrustum();return N.intersectsPrecise(C.vertices,C.planes,I)===0||H.intersectsPrecise(C.vertices,C.planes,I)===0}function lo(c){const{painter:t,source:o,layer:u,coords:p}=c;let g=c.defines;const y=t.context,b=t.renderPass==="shadow",T=t.renderPass==="light-beam",C=t.shadowRenderer,I=a.ef(t.transform.center.lat,t.transform.zoom),B=Va(t,u.paint.get("building-cutoff-fade-range"));B.shouldRenderCutoff&&(g=g.concat("RENDER_CUTOFF")),c.floodLightIntensity>0&&(g=g.concat("FLOOD_LIGHT"));for(const L of p){const N=o.getTile(L),H=N.getBucket(u);
vendor: 16,872 bytes, line 3207
3207if(!H)continue;C&&C.getMaxCascadeForTile(L.toUnwrapped())===0&&(g=g.concat("SHADOWS_SINGLE_CASCADE"));const j=H.programConfigurations.get(u.id);let q,W,ne,ie=t.translatePosMatrix(L.expandedProjMatrix,N,[0,0],"map");if(ie=a.cS(a.bC(),ie,[1,1,c.verticalScale]),b&&C){if(md(N.tileID,H.maxHeight*I,t))continue;let xe=C.calculateShadowPassMatrixFromTile(N.tileID.toUnwrapped());xe=a.cS(a.bC(),xe,[1,1,c.verticalScale]),ne=pa(xe),q=W=t.getOrCreateProgram("buildingDepth",{config:j,defines:g,overrideFog:!1})}else if(T)q=W=t.getOrCreateProgram("buildingBloom",{config:j,defines:g,overrideFog:!1}),ne=Tp(ie);else{const xe=t.transform.calculatePosMatrix(L.toUnwrapped(),t.transform.worldSize);a.cS(xe,xe,[1,1,c.verticalScale]);const me=a.bC();a.cS(me,xe,[1,-1,1/I]),a.bl(me,me),a.eg(me,me);const ye=t.transform.getFreeCameraOptions().position,de=1<<L.canonical.z;if(ne=cl(ie,me,c.opacity,c.facadeAOIntensity,[((ye.x-L.wrap)*de-L.canonical.x)*a.al,(ye.y*de-L.canonical.y)*a.al,ye.z*de*a.al],H.tileToMeter,c.facadeEmissiveChance,c.floodLightColor,c.floodLightIntensity),W=t.getOrCreateProgram("building",{config:j,defines:g,overrideFog:!1}),c.depthOnly===!0)q=W;else{const se=g.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);q=t.getOrCreateProgram("building",{config:j,defines:se,overrideFog:!1})}C&&(C.setupShadowsFromMatrix(xe,W,!0),q!==W&&C.setupShadowsFromMatrix(xe,q,!0))}const ee=(xe,me)=>{if(T){const ye=xe.entranceBloom;me.draw(t,y.gl.TRIANGLES,c.depthMode,yi.disabled,c.blendMode,di.disabled,ne,u.id,ye.layoutVertexBuffer,ye.indexBuffer,ye.segmentsBucket,u.paint,t.transform.zoom,j,[ye.layoutAttenuationBuffer,ye.layoutColorBuffer])}else{const ye=xe.segmentsBucket;let de=[xe.layoutNormalBuffer,xe.layoutCentroidBuffer,xe.layoutColorBuffer,xe.layoutFloodLightDataBuffer];xe.layoutFacadePaintBuffer&&(de=de.concat([xe.layoutFacadeDataBuffer,xe.layoutFacadeVerticalRangeBuffer,xe.layoutFacadePaintBuffer])),me.draw(t,y.gl.TRIANGLES,c.depthMode,yi.disabled,c.blendMode,b?di.disabled:di.backCW,ne,u.id,xe.layoutVertexBuffer,xe.indexBuffer,ye,u.paint,t.transform.zoom,j,de)}};t.uploadCommonUniforms(y,W,L.toUnwrapped(),null,B),H.buildingWithoutFacade&&ee(H.buildingWithoutFacade,W),H.buildingWithFacade&&(q!==W&&t.uploadCommonUniforms(y,q,L.toUnwrapped(),null,B),ee(H.buildingWithFacade,q))}}function Pr(c,t,o,u,p,g,y,b,T,C,I,B,L){const N=c.context.gl,H=c.depthModeForSublayer(1,ti.ReadOnly,N.LEQUAL,!0),j=.1*(1-(q=I))+3*q;var q;const W=c._showOverdrawInspector,ne=B,ie=new lu;W||Os(ie,c,t,o,u,H,new yi({func:N.ALWAYS,mask:255},255,255,N.KEEP,N.KEEP,N.REPLACE),new bi([N.ONE,N.ONE,N.ONE,N.ONE],a.ao.transparent,[!1,!1,!1,!0],N.MIN),di.disabled,p,"sdf",g,y,b,T,C,j,ne,!1);{const ee=W?yi.disabled:new yi({func:N.EQUAL,mask:255},255,255,N.KEEP,N.DECR,N.DECR),xe=W?c.colorModeForRenderPass():new bi([N.ONE_MINUS_DST_ALPHA,N.DST_ALPHA,N.ONE,N.ONE],a.ao.transparent,[!0,!0,!0,!0]);Os(ie,c,t,o,u,H,ee,xe,di.disabled,p,"color",g,y,b,T,C,j,ne,!1)}}function sh(c){return[c[0]*a.eh,c[1]*a.eh,c[2]*a.eh,0]}function Tc(c,t,o,u,p,g,y,b,T){const C=u.getSource(),I=o.globeSharedBuffers;if(!I)return;let B,L,N;if(t&&(B=u.getTile(t)),C instanceof a.aU?(L=C.texture,N=a.dK(0,0,o.transform)):B&&t&&(L=B.texture,N=a.dK(t.canonical.z,t.canonical.x,o.transform)),!L||!N)return;c||(N=a.cS(a.bC(),N,[1,-1,1]));const H=o.context,j=H.gl,q=p.paint.get("raster-resampling")==="nearest"?j.NEAREST:j.LINEAR,W=o.colorModeForDrapableLayerRenderPass(g),ne=y.defines;ne.push("GLOBE_POLES");const ie=new ti(j.LEQUAL,ti.ReadWrite,o.depthRangeFor3D),ee=Float32Array.from(o.transform.expandedFarZProjMatrix),xe=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),H.activeTexture.set(j.TEXTURE0),L.bind(q,j.CLAMP_TO_EDGE),H.activeTexture.set(j.TEXTURE1),L.bind(q,j.CLAMP_TO_EDGE),"useMipmap"in L&&H.extTextureFilterAnisotropic&&o.transform.pitch>20&&j.texParameterf(j.TEXTURE_2D,H.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,H.extTextureFilterAnisotropicMax);const[me,ye,de,se]=t?I.getPoleBuffers(t.canonical.z,!1):I.getPoleBuffers(0,!0),Te=p.paint.get("raster-elevation");let Ae;c?(Ae=me,o.renderDefaultNorthPole=Te!==0):(Ae=ye,o.renderDefaultSouthPole=Te!==0);const Re=sh(y.mix),Be=(($e,ot,Fe,Se,Ke,Ve,it,Et,Bt,Ct,At,Qt,Wt)=>tu($e,ot,Fe,new Float32Array(16),new Float32Array(9),[0,0],Se,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ve,[0,0],Et,2,Ct,At,Qt,1,0,Wt))(ee,xe,N,a.aj(o.transform.zoom),0,p,0,Te,0,Re,y.offset,y.range,g),Le=o.getOrCreateProgram("raster",{defines:ne});o.uploadCommonUniforms(H,Le,null),Le.draw(o,j.TRIANGLES,ie,T,W,b,Be,p.id,Ae,de,se)}function gd(c){if(c.isOrthographic)return[0,0,0,0];const t=c._nearZ,o=c.projection.farthestPixelDistance(c),u=o-t,p=.2*c.height,g=t+p;return[t,o,(g-p-t)/u,(g-t)/u]}function xf(c,t,o,u){if(c)return t instanceof Fo&&c instanceof Ou?t.getTextureDescriptor(c,o,!0):{texture:c.texture,mix:sh(u.mix),offset:u.offset,buffer:0,tileSize:1}}var Bs=a.ei([{name:"a_index",type:"Int16",components:1}]);class _d{constructor(t,o,u,p){const g={width:u[0],height:u[1],data:null},y=t.gl;this.targetColorTexture=new a.T(t,g,y.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new a.T(t,g,y.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(o,p),this.lastInvalidatedAt=0}updateParticleTexture(t,o){if(this.particleTextureDimension===o.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const u=this.context.gl,p=o.width*o.height;this.particleTexture0=new a.T(this.context,o,u.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new a.T(this.context,o,u.RGBA8,{premultiply:!1,useMipmap:!1});const g=new a.ej;g.reserve(p);for(let y=0;y<p;y++)g.emplaceBack(y);this.particleIndexBuffer=this.context.createVertexBuffer(g,Bs.members,!0),this.particleSegment=a.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=o.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=a.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function yd(c,t,o){if(!c)return null;const u=t.getTextureDescriptor(c,o,!0);if(!u)return null;let{texture:p,mix:g,offset:y,tileSize:b,buffer:T,format:C}=u;if(!p||!C)return null;let I=!1;return C==="uint32"&&(I=!0,g[3]=0,g=ah(a.ek,g,[0,o.paint.get("raster-particle-max-speed")]),y=mf(a.ek,y,[0,o.paint.get("raster-particle-max-speed")])),{texture:p,textureOffset:[T/(b+2*T),b/(b+2*T)],tileSize:b,scalarData:I,scale:g,offset:y,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[C]]}}function vf(c){const t=c._nearZ,o=c.projection.farthestPixelDistance(c),u=o-t,p=.2*c.height,g=t+p;return[t,o,(g-p-t)/u,(g-t)/u]}const bf=new a.ao(1,0,0,1),wf=new a.ao(0,1,0,1),Tf=new a.ao(0,0,1,1),Nm=new a.ao(1,0,1,1),Um=new a.ao(0,1,1,1);function Ap(c,t,o,u,p,g){for(let y=0;y<o.length;y++)if(p){const C=new a.ao(u.r*.8,u.g*.8,u.b*.8,1);fl(c,t,o[y],u,-1,-1,g),fl(c,t,o[y],u,-1,1,g),fl(c,t,o[y],u,1,1,g),fl(c,t,o[y],u,1,-1,g),fl(c,t,o[y],C,0,0,g)}else fl(c,t,o[y],u,0,0,g)}function fl(c,t,o,u,p,g,y){const b=c.context,T=c.transform,C=b.gl,I=T.projection.name==="globe",B=I?["PROJECTION_GLOBE_VIEW"]:[];let L=a.bz(o.projMatrix);if(I&&a.aj(T.zoom)>0){const Re=a.bj(o.canonical,T),Be=a.el(Re);L=a.aB(new Float32Array(16),T.globeMatrix,Be),a.aB(L,T.projMatrix,L)}const N=a.bC();N[12]+=2*p/(a.o.devicePixelRatio*T.width),N[13]+=2*g/(a.o.devicePixelRatio*T.height),a.aB(L,N,L);const H=c.getOrCreateProgram("debug",{defines:B}),j=t.getTileByID(o.key);c.terrain&&c.terrain.setupElevationDraw(j,H);const q=ti.disabled,W=yi.disabled,ne=c.colorModeForRenderPass(),ie="$debug";b.activeTexture.set(C.TEXTURE0),c.emptyTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),I?j._makeGlobeTileDebugBuffers(c.context,T):j._makeDebugTileBoundsBuffers(c.context,T.projection);const ee=j._tileDebugBuffer||c.debugBuffer,xe=j._tileDebugIndexBuffer||c.debugIndexBuffer,me=j._tileDebugSegments||c.debugSegments;if(H.draw(c,C.LINE_STRIP,q,W,ne,di.disabled,ul(L,u.toPremultipliedRenderColor(null)),ie,ee,xe,me,null,null,null,[j._globeTileDebugBorderBuffer]),y){const Re=j.latestRawTileData,Be=Math.floor((Re&&Re.byteLength||0)/1024);let Le=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(Le+=` => ${o.overscaledZ}`),Le+=` ${j.state}`,Le+=` ${Be}kb`,(function($e,ot){$e.initDebugOverlayCanvas();const Fe=$e.debugOverlayCanvas,Se=$e.context.gl,Ke=$e.debugOverlayCanvas.getContext("2d");Ke.clearRect(0,0,Fe.width,Fe.height),Ke.shadowColor="white",Ke.shadowBlur=2,Ke.lineWidth=1.5,Ke.strokeStyle="white",Ke.textBaseline="top",Ke.font="bold 36px Open Sans, sans-serif",Ke.fillText(ot,5,5),Ke.strokeText(ot,5,5),$e.debugOverlayTexture.update(Fe),$e.debugOverlayTexture.bind(Se.LINEAR,Se.CLAMP_TO_EDGE)})(c,Le)}const ye=t.getTile(o).tileSize,de=512/Math.min(ye,512)*(o.overscaledZ/T.zoom)*.5,se=j._tileDebugTextBuffer||c.debugBuffer,Te=j._tileDebugTextIndexBuffer||c.quadTriangleIndexBuffer,Ae=j._tileDebugTextSegments||c.debugSegments;H.draw(c,C.TRIANGLES,q,W,bi.alphaBlended,di.disabled,ul(L,a.ao.transparent.toPremultipliedRenderColor(null),de),ie,se,Te,Ae,null,null,null,[j._globeTileDebugTextBuffer])}function Mp(c,t,o,u){xd(c,0,t+o/2,c.transform.width,o,u)}function Cp(c,t,o,u){xd(c,t-o/2,0,o,c.transform.height,u)}function xd(c,t,o,u,p,g){const y=c.context,b=y.gl;b.enable(b.SCISSOR_TEST),b.scissor(t*a.o.devicePixelRatio,o*a.o.devicePixelRatio,u*a.o.devicePixelRatio,p*a.o.devicePixelRatio),y.clear({color:g}),b.disable(b.SCISSOR_TEST)}const Ip=a.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Vm}=Ip;function pl(c,t,o,u){c.emplaceBack(t,o,u)}class ia{constructor(t){this.vertexArray=new a.em,this.indices=new a.b0,pl(this.vertexArray,-1,-1,1),pl(this.vertexArray,1,-1,1),pl(this.vertexArray,-1,1,1),pl(this.vertexArray,1,1,1),pl(this.vertexArray,-1,-1,-1),pl(this.vertexArray,1,-1,-1),pl(this.vertexArray,-1,1,-1),pl(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Vm),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=a.bg.simpleSegment(0,0,36,12)}}function Zl(c,t,o,u,p,g){const y=c.context.gl,b=t.paint.get("sky-atmosphere-color"),T=t.paint.get("sky-atmosphere-halo-color"),C=t.paint.get("sky-atmosphere-sun-intensity"),I=((B,L,N,H,j)=>({u_matrix_3f:B,u_sun_direction:L,u_sun_intensity:N,u_color_tint_r:[H.r,H.g,H.b,H.a],u_color_tint_m:[j.r,j.g,j.b,j.a],u_luminance:5e-5}))(a.eo(a.dO(),u),p,C,b.toPremultipliedRenderColor(null),T.toPremultipliedRenderColor(null));y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_CUBE_MAP_POSITIVE_X+g,t.skyboxTexture,0),o.draw(c,y.TRIANGLES,ti.disabled,yi.disabled,bi.unblended,di.frontCW,I,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Ho=a.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class $l{constructor(t){const o=new a.ep;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const u=new a.b0;u.emplaceBack(0,1,2),u.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(o,Ho.members),this.indexBuffer=t.createIndexBuffer(u),this.segments=a.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Rp=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class zp{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Sf{constructor(t){this.colorModeAlphaBlendedWriteRGB=new bi([1,uc,1,uc],a.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new bi([1,0,1,0],a.ao.transparent,[!1,!1,!1,!0]),this.params=new zp,this.updateNeeded=!0}update(t){const o=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new $l(o);const u=this.params.sizeRange,p=this.params.intensityRange,g=(function(I){const B=a.eq(30),L=[];for(let N=0;N<I;++N){const H=2*Math.PI*B(),j=Math.acos(1-2*B())-.5*Math.PI;L.push(a.d5(Math.cos(j)*Math.cos(H),Math.cos(j)*Math.sin(H),Math.sin(j)))}return L})(this.params.starsCount),y=a.eq(300),b=new a.er,T=new a.b0;let C=0;for(let I=0;I<g.length;++I){const B=a.c5([],g[I],200),L=Math.max(0,1+.01*u*(1*y()-.5)),N=Math.max(0,1+.01*p*(1*y()-.5));b.emplaceBack(B[0],B[1],B[2],-1,-1,L,N),b.emplaceBack(B[0],B[1],B[2],1,-1,L,N),b.emplaceBack(B[0],B[1],B[2],1,1,L,N),b.emplaceBack(B[0],B[1],B[2],-1,1,L,N),T.emplaceBack(C+0,C+1,C+2),T.emplaceBack(C+0,C+2,C+3),C+=4}this.starsVx=o.createVertexBuffer(b,Rp.members),this.starsIdx=o.createIndexBuffer(T),this.starsSegments=a.bg.simpleSegment(0,0,b.length,T.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,o){const u=t.context,p=u.gl,g=t.transform,y=new ti(p.LEQUAL,ti.ReadOnly,[0,1]),b=a.aj(g.zoom),T=t.style.getLut(o.scope),C=o.properties.get("color-use-theme")==="none",I=o.properties.get("color").toNonPremultipliedRenderColor(C?null:T),B=o.properties.get("high-color-use-theme")==="none",L=o.properties.get("high-color").toNonPremultipliedRenderColor(B?null:T),N=o.properties.get("space-color-use-theme")==="none",H=o.properties.get("space-color").toNonPremultipliedRenderColor(N?null:T),j=5e-4,q=a.es(o.properties.get("horizon-blend"),0,1,j,.25),W=a.dE(t,u,g)&&q===j?g.worldSize/(2*Math.PI*1.025)-1:g.globeRadius,ne=t.frameCounter/1e3%1,ie=a.ag(g.globeCenterInViewSpace),ee=Math.sqrt(Math.pow(ie,2)-Math.pow(W,2)),xe=Math.acos(ee/ie),me=ye=>{const de=g.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ye&&de.push("ALPHA_PASS");const se=t.getOrCreateProgram("globeAtmosphere",{defines:de}),Te=((Re,Be,Le,$e,ot,Fe,Se,Ke,Ve,it,Et,Bt)=>({u_frustum_tl:Re,u_frustum_tr:Be,u_frustum_br:Le,u_frustum_bl:$e,u_horizon:ot,u_transition:Fe,u_fadeout_range:Se,u_atmosphere_fog_color:Ke.toArray01(),u_high_color:Ve.toArray01(),u_space_color:it.toArray01(),u_temporal_offset:Et,u_horizon_angle:Bt}))(g.frustumCorners.TL,g.frustumCorners.TR,g.frustumCorners.BR,g.frustumCorners.BL,g.frustumCorners.horizon,b,q,I,L,H,ne,xe);t.uploadCommonUniforms(u,se);const Ae=this.atmosphereBuffer;Ae&&se.draw(t,p.TRIANGLES,y,yi.disabled,ye?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,di.backCW,Te,ye?"atmosphere_glow_alpha":"atmosphere_glow",Ae.vertexBuffer,Ae.indexBuffer,Ae.segments)};me(!1),me(!0)}drawStars(t,o){const u=a.aA(o.properties.get("star-intensity"),0,1);if(u===0)return;const p=t.context,g=p.gl,y=t.transform,b=t.getOrCreateProgram("stars"),T=a.c7([]);a.c9(T,T,-y._pitch),a.c8(T,T,-y.angle),a.c9(T,T,a.an(y._center.lat)),a.et(T,T,-a.an(y._center.lng));const C=a.cc(new Float32Array(16),T),I=a.aB([],y.starsProjMatrix,C),B=a.eo([],C),L=a.eu([],B),N=[0,1,0];a.dQ(N,N,L),a.c5(N,N,this.params.sizeMultiplier);const H=[1,0,0];a.dQ(H,H,L),a.c5(H,H,this.params.sizeMultiplier);const j=(q=N,W=H,ne=u,{u_matrix:Float32Array.from(I),u_up:q,u_right:W,u_intensity_multiplier:ne});var q,W,ne;t.uploadCommonUniforms(p,b),this.starsVx&&this.starsIdx&&b.draw(t,g.TRIANGLES,ti.disabled,yi.disabled,this.colorModeAlphaBlendedWriteRGB,di.disabled,j,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Sc{constructor(){this.visibleTiles=[]}updateBorders(t,o){const u=[],p=[],g=t._getRenderableCoordinates(!1,!0);for(const T of g){const C=t.getTile(T);if(!C.hasData())continue;const I=C.getBucket(o);I&&(I.isEmpty()||(u.push(T.key),p.push({bucket:I,tileID:T.canonical})))}let y=u.length!==this.visibleTiles.length;if(!y){u.sort();for(let T=0;T<u.length;T++)if(u[T]!==this.visibleTiles[T]){y=!0;break}}if(!y)return;const b=new Set;this.visibleTiles=u,p.sort((T,C)=>T.tileID.z-C.tileID.z||T.tileID.x-C.tileID.x||T.tileID.y-C.tileID.y);for(const T of p){const C=new Array,I=new Array,B=T.bucket;for(const L of B.featuresOnBorder)b.has(L.featureId)?I.push(L.footprintIndex):(b.add(L.featureId),C.push(L.footprintIndex));B.updateFootprintHiddenFlags(C,a.ev,!1),B.updateFootprintHiddenFlags(I,a.ev,!0)}}}function Ef(c,t){const o=[...c],u=t.cameraWorldSizeForFog/t.worldSize,p=a.bA
3207([]);return a.cS(p,p,[u,u,1]),a.aB(o,p,o),a.aB(o,t.worldToFogMatrix,o),o}function Ia(c,t,o,u,p){const g=o.material,y=u.context,{baseColorTexture:b,metallicRoughnessTexture:T}=g.pbrMetallicRoughness,{normalTexture:C,occlusionTexture:I,emissionTexture:B}=g;function L(H,j,q){if(H&&(c.push(j),y.activeTexture.set(y.gl.TEXTURE0+q),H.gfxTexture)){const{minFilter:W,magFilter:ne,wrapS:ie,wrapT:ee}=H.sampler;H.gfxTexture.bindExtraParam(W,ne,ie,ee)}}L(b,"HAS_TEXTURE_u_baseColorTexture",5),L(T,"HAS_TEXTURE_u_metallicRoughnessTexture",6),L(C,"HAS_TEXTURE_u_normalTexture",7),L(I,"HAS_TEXTURE_u_occlusionTexture",8),L(B,"HAS_TEXTURE_u_emissionTexture",9),p&&(p.texture||(p.texture=new a.d$(u.context,p.image,[p.image.height,p.image.height,p.image.height],y.gl.RGBA8)),y.activeTexture.set(y.gl.TEXTURE0+10),p.texture&&p.texture.bind(y.gl.LINEAR,y.gl.CLAMP_TO_EDGE),c.push("APPLY_LUT_ON_GPU")),o.texcoordBuffer&&(c.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(o.texcoordBuffer)),o.colorBuffer&&(c.push(o.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(o.colorBuffer)),o.normalBuffer&&(c.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(o.normalBuffer)),o.pbrBuffer&&(c.push("HAS_ATTRIBUTE_a_pbr"),c.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(o.pbrBuffer)),g.alphaMode!=="OPAQUE"&&g.alphaMode!=="MASK"||c.push("UNPREMULT_TEXTURE_IN_SHADER"),g.defined||c.push("DIFFUSE_SHADED");const N=u.shadowRenderer;N&&(c.push("RENDER_SHADOWS","DEPTH_TEXTURE"),N.useNormalOffset&&c.push("NORMAL_OFFSET"))}function mn(c,t,o,u,p,g){const y=c.modelOpacity,b=t.context,T=new ti(t.context.gl.LEQUAL,c.isLightMesh?ti.ReadOnly:ti.ReadWrite,t.depthRangeFor3D),C=t.transform,I=c.mesh,B=I.material,L=B.pbrMetallicRoughness,N=t.style.fog;let H;H=t.transform.projection.zAxisUnit==="pixels"?[...c.nodeModelMatrix]:a.aB([],u.zScaleMatrix,c.nodeModelMatrix),a.aB(H,u.negCameraPosMatrix,H);const j=a.bl([],H);a.eg(j,j);const q=o.paint.get("model-color-use-theme").constantOr("default")==="none",W=o.paint.get("model-emissive-strength").constantOr(0),ne=Ls(new Float32Array(c.worldViewProjection),new Float32Array(H),new Float32Array(j),null,t,y,L.baseColorFactor,B.emissiveFactor,L.metallicFactor,L.roughnessFactor,B,W,o,void 0,void 0,c.materialOverride,c.modelColor),ie={defines:[]},ee=[],xe=t.shadowRenderer;xe&&(xe.useNormalOffset=!1),Ia(ie.defines,ee,I,t,q?null:o.lut);let me=null;if(N){const se=Ef(c.nodeModelMatrix,t.transform);if(me=new Float32Array(se),C.projection.name!=="globe"){const Te=I.aabb.min,Ae=I.aabb.max,[Re,Be]=N.getOpacityForBounds(se,Te[0],Te[1],Ae[0],Ae[1]);ie.overrideFog=Re>=Zt||Be>=Zt}}const ye=Va(t,o.paint.get("model-cutoff-fade-range"));ye.shouldRenderCutoff&&ie.defines.push("RENDER_CUTOFF");const de=t.getOrCreateProgram("model",ie);t.uploadCommonUniforms(b,de,null,me,ye),t.renderPass!=="shadow"&&xe&&xe.setupShadowsFromMatrix(c.nodeModelMatrix,de),de.draw(t,b.gl.TRIANGLES,T,p,g,I.material.doubleSided?di.disabled:di.backCCW,ne,o.id,I.vertexBuffer,I.indexBuffer,I.segments,o.paint,t.transform.zoom,void 0,ee)}function lh(c,t){return c.style._importedAsBasemap?"basemap":t.scope}function cu(c,t,o,u,p,g,y,b,T,C){const I=c.transform,B=!!t.isGeometryBloom&&t.isGeometryBloom;if(B&&c.renderPass==="shadow")return;const L=I.projection.name==="globe"?a.eD(o,I):[...o];a.aB(L,L,t.globalMatrix);const N=a.aB([],u,L);if(t.meshes)for(const H of t.meshes){const j=b.get(H.material.name);if(j&&j.opacity<=0)continue;if(H.material.alphaMode!=="BLEND"){y.push({mesh:H,depth:0,modelIndex:p,worldViewProjection:N,nodeModelMatrix:L,isLightMesh:B,materialOverride:j,modelOpacity:T,modelColor:C});continue}const q=a.af([],H.centroid,N);!I.isOrthographic&&q[2]<=0||g.push({mesh:H,depth:q[2],modelIndex:p,worldViewProjection:N,nodeModelMatrix:L,isLightMesh:B,materialOverride:j,modelOpacity:T,modelColor:C})}if(t.children)for(const H of t.children)cu(c,H,o,u,p,g,y,b,T,C)}function ch(c,t,o,u){const p=o.shadowRenderer;if(!p)return;const g=p.getShadowPassDepthMode(),y=p.getShadowPassColorMode(),b=p.calculateShadowPassMatrixFromMatrix(t),T=ou(b);o.getOrCreateProgram("modelDepth",{defines:o._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(o,o.context.gl.TRIANGLES,g,yi.disabled,y,di.disabled,T,u.id,c.vertexBuffer,c.indexBuffer,c.segments,u.paint,o.transform.zoom,void 0,void 0)}function Dp(c,t,o,u,p,g){for(const y of p){const b=Object.assign({},u);b.part=y;const T={type:"Unknown",id:t,properties:b},C={orientation:c.paint.get("model-rotation").evaluate(T,o)};g.set(y,C)}}function Pp(c,t,o,u,p,g){for(const y of p){const b=Object.assign({},u);b.part=y;const T={type:"Unknown",id:t,properties:b},C={color:c.paint.get("model-color").evaluate(T,o),colorMix:c.paint.get("model-color-mix-intensity").evaluate(T,o),opacity:c.paint.get("model-opacity").evaluate(T,o),emissionStrength:c.paint.get("model-emissive-strength").evaluate(T,o)};g.set(y,C)}}function Af(c,t,o,u,p){let g=!1;for(const b of u)b.modelOpacity!==1&&(mn(b,c,t,p[b.modelIndex],yi.disabled,bi.disabled),g=!0);for(const b of u)mn(b,c,t,p[b.modelIndex],b.modelOpacity!==1?c.stencilModeFor3D():yi.disabled,c.colorModeForRenderPass());g&&c.resetStencilClippingMasks();const y=bi.additive;for(const b of o)mn(b,c,t,p[b.modelIndex],yi.disabled,b.isLightMesh?y:c.colorModeForRenderPass())}function Ec(c,t,o){const u=t.updateZoomBasedPaintProperties(),p=(function(g,y,b){let T,C,I,B=g.terrain?g.terrain.exaggeration():0;if(g.terrain&&B>0){const L=g.terrain,N=L.findDEMTileFor(b);N&&N.dem?T=a.eF.create(L,b,N):B=0}if(B===0&&(y.terrainElevationMin=0,y.terrainElevationMax=0),B===y.validForExaggeration&&(B===0||T&&T._demTile&&T._demTile.tileID===y.validForDEMTile.id&&T._dem._timestamp===y.validForDEMTile.timestamp))return!1;for(const L in y.instancesPerModel){const N=y.instancesPerModel[L];for(let H=0;H<N.instancedDataArray.length;++H){const j=(T?B*T.getElevationAt(0|N.instancedDataArray.float32[16*H],0|N.instancedDataArray.float32[16*H+1],!0,!0):0)+N.instancesEvaluatedElevation[H];N.instancedDataArray.float32[16*H+6]=j,C=C?Math.min(y.terrainElevationMin,j):j,I=I?Math.max(y.terrainElevationMax,j):j}}return y.terrainElevationMin=C||0,y.terrainElevationMax=I||0,y.validForExaggeration=B,y.validForDEMTile=T&&T._demTile?{id:T._demTile.tileID,timestamp:T._dem._timestamp}:{id:void 0,timestamp:0},!0})(c,t,o);(u||p)&&(t.uploaded=!1,t.upload(c.context))}const qo={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new a.d9([0,0,0],[a.al,a.al,0])};function It(c,t){const o=1<<c.canonical.z,u=t.getFreeCameraOptions().position,p=t.elevation,g=c.canonical.x/o,y=(c.canonical.x+1)/o,b=c.canonical.y/o,T=(c.canonical.y+1)/o;let C=t._centerAltitude;if(p){const N=p.getMinMaxForTile(c);N&&N.max>C&&(C=N.max)}
3207const I=a.aA(u.x,g,y)-u.x,B=a.aA(u.y,b,T)-u.y,L=a.cf(C,t.center.lat)-u.z;return t._zoomFromMercatorZ(Math.sqrt(I*I+B*B+L*L))}function Ut(c,t,o,u,p,g,y){const b=c.context,T=c.renderPass==="shadow",C=c.shadowRenderer,I=T&&C?C.getShadowPassDepthMode():new ti(b.gl.LEQUAL,ti.ReadWrite,c.depthRangeFor3D),B=c.isTileAffectedByFog(g),L=c.transform.projection.name==="globe";if(o.meshes)for(const N of o.meshes){const H=L?[]:["MODEL_POSITION_ON_GPU"],j=[];let q,W,ne;const ie=!L&&u.instancedDataArray.length>20;ie&&H.push("INSTANCED_ARRAYS");const ee=Va(c,t.paint.get("model-cutoff-fade-range"));if(ee.shouldRenderCutoff&&H.push("RENDER_CUTOFF"),T&&C)q=c.getOrCreateProgram("modelDepth",{defines:H}),W=ou(y.shadowTileMatrix,y.shadowTileMatrix,Float32Array.from(o.globalMatrix)),ne=C.getShadowPassColorMode();else{Ia(H,j,N,c,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),q=c.getOrCreateProgram("model",{defines:H,overrideFog:B});const me=N.material,ye=me.pbrMetallicRoughness,de=t.paint.get("model-opacity").constantOr(1),se=t.paint.get("model-emissive-strength").constantOr(0);W=Ls(g.expandedProjMatrix,Float32Array.from(o.globalMatrix),new Float32Array(16),null,c,de,ye.baseColorFactor,me.emissiveFactor,ye.metallicFactor,ye.roughnessFactor,me,se,t,p),C&&(y.shadowUniformsInitialized?q.setShadowUniformValues(b,C.getShadowUniformValues()):(C.setupShadows(g.toUnwrapped(),q,"model-tile"),y.shadowUniformsInitialized=!0)),ne=ee.shouldRenderCutoff||de<1||me.alphaMode!=="OPAQUE"?bi.alphaBlended:bi.unblended}c.uploadCommonUniforms(b,q,g.toUnwrapped(),null,ee);const xe=N.material.doubleSided?di.disabled:di.backCCW;if(ie)j.push(u.instancedDataBuffer),q.draw(c,b.gl.TRIANGLES,I,yi.disabled,ne,xe,W,t.id,N.vertexBuffer,N.indexBuffer,N.segments,t.paint,c.transform.zoom,void 0,j,u.instancedDataArray.length);else{const me=T?"u_instance":"u_normal_matrix";for(let ye=0;ye<u.instancedDataArray.length;++ye)W[me]=new Float32Array(u.instancedDataArray.arrayBuffer,64*ye,16),q.draw(c,b.gl.TRIANGLES,I,yi.disabled,ne,xe,W,t.id,N.vertexBuffer,N.indexBuffer,N.segments,t.paint,c.transform.zoom,void 0,j)}}if(o.children)for(const N of o.children)Ut(c,t,N,u,p,g,y)}const uu=[1,-1,1];function qn(c,t,o,u){if(!o.modelManager)return!0;const p=o.modelManager;if(!o.shadowRenderer)return!0;const g=o.shadowRenderer,y=t.aabb;let b=!0,T=c.maxHeight;if(T===0){let I=0;for(const B in c.instancesPerModel){const L=p.getModel(B,u);L?I=Math.max(I,Math.max(Math.max(L.aabb.max[0],L.aabb.max[1]),L.aabb.max[2])):b=!1}T=c.maxScale*I*1.41+c.maxVerticalOffset,b&&(c.maxHeight=T)}y.max[2]=T,y.min[2]+=c.terrainElevationMin,y.max[2]+=c.terrainElevationMax,a.af(y.min,y.min,t.tileMatrix),a.af(y.max,y.max,t.tileMatrix);const C=y.intersects(g.getCurrentCascadeFrustum());return o.currentShadowCascade===0&&(c.isInsideFirstShadowMapFrustum=C===2),C===0}function Oe(c,t){const o=c.uniformValues.u_cutoff_params[0],u=c.uniformValues.u_cutoff_params[1],p=c.uniformValues.u_cutoff_params[2],g=c.uniformValues.u_cutoff_params[3];return u===o||g===p?1:a.aA(((t-o)/(u-o)-p)/(g-p),0,1)}function Lp(c,t,o,u){if(t.pitch<20)return 1;const p=t.getWorldToCameraMatrix();a.aB(p,p,c);const g=a.bU(o.min[0],o.min[1],o.min[2],1);let y=a.aC(a.eG(),g,p),b=y,T=y;g[1]=o.max[1],y=a.aC(a.eG(),g,p),b=y[1]<b[1]?y:b,T=y[1]>T[1]?y:T,g[0]=o.max[0],y=a.aC(a.eG(),g,p),b=y[1]<b[1]?y:b,T=y[1]>T[1]?y:T,g[1]=o.min[1],y=a.aC(a.eG(),g,p),b=y[1]<b[1]?y:b,T=y[1]>T[1]?y:T;const C=a.aA(u[0],0,1),I=100*t.pixelsPerMeter*a.aA(u[1],0,1),B=a.aA(u[2],0,1),L=a.eH(a.eG(),b,T,C),N=Math.tan(.5*t.fovX),H=-L[2]*N;if(I===0)return L[1]<-Math.abs(H)?B:1;const j=(-Math.abs(H)-L[1])/I,q=(ne,ie,ee)=>(1-ee)*ne+ee*ie,W=a.aA(q(1,B,j),B,1);return q(1,W,a.aA((t.pitch-20)/20,0,1))}class Mf{}class vd{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,o,u){{const B=this._storage.get(o.id);if(B)return B.lastUsedFrameIdx=t,B.buf}const p=u.gl,g=p.getBufferParameter(p.ELEMENT_ARRAY_BUFFER,p.BUFFER_SIZE),y=new ArrayBuffer(g),b=new Int16Array(y);p.getBufferSubData(p.ELEMENT_ARRAY_BUFFER,0,new Int16Array(y));const T=new a.eJ;for(let B=0;B<g/2;B+=3){const L=b[B],N=b[B+1],H=b[B+2];T.emplaceBack(L,N),T.emplaceBack(N,H),T.emplaceBack(H,L)}const C=u.bindVertexArrayOES.current,I=new Mf;return I.buf=new Go(u,T),I.lastUsedFrameIdx=t,this._storage.set(o.id,I),u.bindVertexArrayOES.set(C),I.buf}update(t){for(const[o,u]of this._storage)t-u.lastUsedFrameIdx>30&&(u.buf.destroy(),this._storage.delete(o))}
vendor: 1,205 bytes, line 3207
3207destroy(){for(const[t,o]of this._storage)o.buf.destroy(),this._storage.delete(t)}}class Cf{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Op=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class bd{constructor(t){this.revealStart=11,this.revealRange=2}}const hu=a.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class jm{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,o){const u=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const y=new a.eK,b=new a.b0;y.emplaceBack(-1,-1),y.emplaceBack(1,-1),y.emplaceBack(1,1),y.emplaceBack(-1,1),b.emplaceBack(0,1,2),b.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(y,hu.members),this.vignetteIdx=t.context.createIndexBuffer(b)}const p=a.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,u);const y={u_vignetteShape:(g={vignetteShape:[o.start,o.range,Math.pow(10,o.fadePower)],vignetteColor:[o.color.r,o.color.g,o.color.b,o.color.a*o.strength]}).vignetteShape,u_vignetteColor:g.vignetteColor};
3207u.draw(t,t.context.gl.TRIANGLES,ti.disabled,yi.disabled,bi.alphaBlended,di.disabled,y,"vignette",this.vignetteVx,this.vignetteIdx,p)}var g}}class jg{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,o){const u=t.getFreeCameraOptions().position,p=u.toAltitude(),g=u.toLngLat(),y=a.an(g.lng),b=a.an(g.lat),T=t.pixelsPerMeter/o,C=y*a.eM,I=a.eM*Math.log(Math.tan(Math.PI/4+b/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const B=-this._offsetYPrev+I,L=-this._elevationPrev+p;this._accumulatedOffsetX+=(-this._offsetXPrev+C)*T,this._accumulatedOffsetY+=B*T,this._accumulatedElevation+=L*T,this._offsetXPrev=C,this._offsetYPrev=I,this._elevationPrev=p}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Bp(c,t){return[-(c[0]-Math.floor(c[0]/t)*t),-(c[1]-Math.floor(c[1]/t)*t),-(c[2]-Math.floor(c[2]/t)*t)]}function uh(c){const t=a.eq(1323123451230),o=[];for(let u=0;u<c;++u){const p=2*t()-1,g=2*t()-1,y=2*t()-1;o.push(a.d5(p,g,y))}return o}function Ra(c,t,o,u,p){const g=a.aA((p-o)/(u-o),0,1);return(1-g)*c+g*t}class wd{constructor(t){this._movement=new jg,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new jm,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,o){const u=t.transform;this._movement.update(u,this._ppmScaleFactor);const p=u.starsProjMatrix,g=a.c7([]);a.c9(g,g,a.an(90)-u._pitch),a.c8(g,g,-u.angle);const y=a.cc(new Float32Array(16),g),b=a.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),T=a.eg([],b),C=a.aB([],T,y),I=Date.now()/1e3;return this._accumulatedTimeFromStart+=(I-this._prevTime)*o,this._prevTime=I,{projectionMatrix:p,modelviewMatrix:C}}}class Td extends wd{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new bd("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const o=t.context;if(!this.particlesVx){const u=uh(this.particlesCount),p=new a.eN,g=new a.b0;let y=0;const b=a.eq(1323123451230);for(let T=0;T<u.length;++T){const C=u[T],I=[2*b()-1,b(),b(),b()];p.emplaceBack(C[0],C[1],C[2],-1,-1,...I),p.emplaceBack(C[0],C[1],C[2],1,-1,...I),p.emplaceBack(C[0],C[1],C[2],1,1,...I),p.emplaceBack(C[0],C[1],C[2],-1,1,...I),g.emplaceBack(y+0,y+1,y+2),g.emplaceBack(y+0,y+2,y+3),y+=4}this.particlesVx=o.createVertexBuffer(p,Op.members),this.particlesIdx=o.createIndexBuffer(g)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const o=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},u=t.transform.zoom;if(o.revealStart>u)return;const p=Ra(0,1,o.revealStart,o.revealStart+o.revealRange,u);if(!this.particlesVx||!this.particlesIdx)return;const g=structuredClone(this._params);let y=[-g.direction.x,g.direction.y,-100];a.aw(y,y);const b=structuredClone(this._vignetteParams);b.strength*=p,g.overrideStyleParameters||(g.intensity=t.style.rain.state.density,g.timeFactor=t.style.rain.state.intensity,g.color=structuredClone(t.style.rain.state.color),y=structuredClone(t.style.rain.state.direction),g.screenThinning.intensity=t.style.rain.state.centerThinning,g.dropletSizeX=t.style.rain.state.dropletSize[0],g.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],g.distortionStrength=100*t.style.rain.state.distortionStrength,b.strength=1,b.color=structuredClone(t.style.rain.state.vignetteColor));const T=this.updateOnRender(t,g.timeFactor),C=t.context,I=C.gl,B=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new a.T(C,{width:t.width,height:t.height,data:null},I.RGBA8)),g.distortionStrength>0&&(C.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.copyTexSubImage2D(I.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const L=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(C,L),C.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const N=[g.color.r,g.color.g,g.color.b,g.color.a],H=(j,q)=>{const W=Bp(this._movement.getPosition(),j),ne=g.dropletSizeX,ie=g.dropletSizeX*g.dropletSizeYScale,ee=t.width/2,xe=t.height/2,me=Ra(0,g.screenThinning.start,0,1,g.screenThinning.intensity),ye=Ra(.
vendor: 1,451 bytes, line 3207
3207001,g.screenThinning.range,0,1,g.screenThinning.intensity),de=Ra(0,g.screenThinning.particleOffset,0,1,g.screenThinning.intensity),se=(Te={modelview:T.modelviewMatrix,projection:T.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:W,velocityConeAperture:g.velocityConeAperture,velocity:g.velocity,boxSize:j,rainDropletSize:[ne,ie],distortionStrength:g.distortionStrength,rainDirection:y,color:N,screenSize:[B.width,B.height],thinningCenterPos:[ee,xe],thinningShape:[me,ye,Math.pow(10,g.screenThinning.fadePower)],thinningAffectedRatio:g.screenThinning.affectedRatio,thinningParticleOffset:de,shapeDirectionalPower:g.shapeDirPower,shapeNormalPower:g.shapeNormalPower,mode:q?0:1},{u_modelview:Float32Array.from(Te.modelview),u_projection:Float32Array.from(Te.projection),u_time:Te.time,u_cam_pos:Te.camPos,u_texScreen:0,u_velocityConeAperture:Te.velocityConeAperture,u_velocity:Te.velocity,u_boxSize:Te.boxSize,u_rainDropletSize:Te.rainDropletSize,u_distortionStrength:Te.distortionStrength,u_rainDirection:Te.rainDirection,u_color:Te.color,u_screenSize:Te.screenSize,u_thinningCenterPos:Te.thinningCenterPos,u_thinningShape:Te.thinningShape,u_thinningAffectedRatio:Te.thinningAffectedRatio,u_thinningParticleOffset:Te.thinningParticleOffset,u_shapeDirectionalPower:Te.shapeDirectionalPower,u_shapeNormalPower:Te.shapeNormalPower,u_mode:Te.mode});var Te;const Ae=Math.round(g.intensity*this.particlesCount),Re=a.bg.simpleSegment(0,0,4*Ae,2*Ae);
3207L.draw(t,I.TRIANGLES,ti.disabled,yi.disabled,bi.alphaBlended,di.disabled,se,"rain_particles",this.particlesVx,this.particlesIdx,Re)};g.distortionStrength>0&&H(g.boxSize,!0),H(g.boxSize,!1),this._vignette.draw(t,b)}}const Sd=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class hh extends wd{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new bd("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const o=t.context;if(!this.particlesVx){const u=uh(this.particlesCount),p=new a.eO,g=new a.b0;let y=0;const b=a.eq(1323123451230);for(let T=0;T<u.length;++T){const C=u[T],I=b(),B=b(),L=b(),N=[T/u.length,I,B,L],H=[b(),b()];p.emplaceBack(C[0],C[1],C[2],-1,-1,...N,...H),p.emplaceBack(C[0],C[1],C[2],1,-1,...N,...H),p.emplaceBack(C[0],C[1],C[2],1,1,...N,...H),p.emplaceBack(C[0],C[1],C[2],-1,1,...N,...H),g.emplaceBack(y+0,y+1,y+2),g.emplaceBack(y+0,y+2,y+3),y+=4}this.particlesVx=o.createVertexBuffer(p,Sd.members),this.particlesIdx=o.createIndexBuffer(g)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const o=structuredClone(this._params);let u=[-o.direction.x,o.direction.y,-100];a.aw(u,u);const p=structuredClone(this._vignetteParams),g=o.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},y=t.transform.zoom;if(g.revealStart>y)return;const b=Ra(0,1,g.revealStart,g.revealStart+g.revealRange,y);p.strength*=b,o.overrideStyleParameters||(o.intensity=t.style.snow.state.density,o.timeFactor=t.style.snow.state.intensity,o.color=structuredClone(t.style.snow.state.color),u=structuredClone(t.style.snow.state.direction),o.screenThinning.intensity=t.style.snow.state.centerThinning,o.billboardSize=2.79*t.style.snow.state.flakeSize,p.strength=1,p.color=structuredClone(t.style.snow.state.vignetteColor));const T=this.updateOnRender(t,o.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const C=t.context,I=C.gl,B=t.transform,L=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(C,L),((N,H,j)=>{const q=Bp(this._movement.getPosition(),N),W=B.width/2,ne=B.height/2,ie=Ra(0,j.screenThinning.start,0,1,j.screenThinning.intensity),ee=Ra(.001,j.screenThinning.range,0,1,j.screenThinning.intensity),xe=Ra(0,j.screenThinning.particleOffset,0,1,j.screenThinning.intensity),me=(ye={modelview:T.modelviewMatrix,projection:T.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:q,velocityConeAperture:j.velocityConeAperture,velocity:j.velocity,horizontalOscillationRadius:j.horizontalOscillationRadius,horizontalOscillationRate:j.horizontalOscillationRate,boxSize:N,billboardSize:1*j.billboardSize,simpleShapeParameters:[j.shapeFadeStart,j.shapeFadePower],screenSize:[B.width,B.height],thinningCenterPos:[W,ne],thinningShape:[ie,ee,Math.pow(10,j.screenThinning.fadePower)],thinningAffectedRatio:j.screenThinning.affectedRatio,thinningParticleOffset:xe,color:[j.color.r,j.color.g,j.color.b,j.color.a],direction:u},{u_modelview:Float32Array.from(ye.modelview),u_projection:Float32Array.from(ye.projection),u_time:ye.time,u_cam_pos:ye.camPos,u_velocityConeAperture:ye.velocityConeAperture,u_velocity:ye.velocity,u_horizontalOscillationRadius:ye.horizontalOscillationRadius,u_horizontalOscillationRate:ye.horizontalOscillationRate,u_boxSize:ye.boxSize,u_billboardSize:ye.billboardSize,u_simpleShapeParameters:ye.simpleShapeParameters,u_screenSize:ye.screenSize,u_thinningCenterPos:ye.thinningCenterPos,u_thinningShape:ye.thinningShape,u_thinningAffectedRatio:ye.thinningAffectedRatio,u_thinningParticleOffset:ye.thinningParticleOffset,u_particleColor:ye.color,u_direction:ye.direction});var ye;const de=Math.round(j.intensity*this.particlesCount),se=a.bg.simpleSegment(0,0,4*de,2*de);this.particlesVx&&this.particlesIdx&&L.draw(t,I.TRIANGLES,ti.disabled,yi.disabled,bi.alph
3207aBlended,di.disabled,me,"snow_particles",this.particlesVx,this.particlesIdx,se)})(o.boxSize,0,o),this._vignette.draw(t,p)}}const ks={symbol:function(c,t,o,u,p){if(c.renderPass!=="translucent")return;const g=yi.disabled,y=c.colorModeForRenderPass(),b=o.layout.get("text-variable-anchor"),T=o.layout.get("text-size-scale-range"),C=a.aA(c.scaleFactor,T[0],T[1]);b&&(function(L,N,H,j,q,W,ne,ie){const ee=N.transform,xe=q==="map",me=W==="map";for(const ye of L){const de=j.getTile(ye),se=de.getBucket(H);if(!se||!se.text||!se.text.segments.get().length)continue;const Te=a.bK(se.textSizeData,ee.zoom,ie),Ae=el(ye,se.getProjection(),ee),Re=ee.calculatePixelsToTileUnitsMatrix(de),Be=Vc(Ae,de.tileID.canonical,me,xe,ee,se.getProjection(),Re),Le=se.hasIconTextFit()&&se.hasIconData();Te&&xc(se,xe,me,ne,ee,Be,ye,Math.pow(2,ee.zoom-de.tileID.overscaledZ),Te,Le)}})(u,c,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),p,C);const I=o.paint.get("icon-opacity").constantOr(1)!==0,B=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(I||B)?su(c,t,o,u,g,y):(I&&su(c,t,o,u,g,y,{onlyIcons:!0}),B&&su(c,t,o,u,g,y,{onlyText:!0})),t.map.showCollisionBoxes&&(lr(c,t,o,u,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),lr(c,t,o,u,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(c,t,o,u){if(c.renderPass!=="translucent")return;const p=o.paint.get("circle-opacity"),g=o.paint.get("circle-stroke-width"),y=o.paint.get("circle-stroke-opacity"),b=o.layout.get("circle-sort-key").constantOr(1)!==void 0,T=o.paint.get("circle-emissive-strength");if(p.constantOr(1)===0&&(g.constantOr(1)===0||y.constantOr(1)===0))return;const C=c.context,I=C.gl,B=c.transform,L=!(!c.terrain||!c.terrain.enabled),N=o.layout.get("circle-elevation-reference"),H=c.depthModeForSublayer(0,ti.ReadOnly),j=new ti(c.context.gl.LEQUAL,ti.ReadOnly,c.depthRangeFor3D),q=N==="none"||L?H:j,W=yi.disabled,ne=c.colorModeForDrapableLayerRenderPass(T),ie=B.projection.name==="globe",ee=[a.aF(B.center.lng),a.aJ(B.center.lat)],xe=[];for(let ye=0;ye<u.length;ye++){const de=u[ye],se=t.getTile(de),Te=se.getBucket(o);if(!Te||Te.projection.name!==B.projection.name)continue;const Ae=Te.programConfigurations.get(o.id),Re=Te.layoutVertexBuffer,Be=Te.globeExtVertexBuffer,Le=Te.indexBuffer,$e=a.e0(o),ot=[Be],Fe=c.isTileAffectedByFog(de);ie&&$e.push("PROJECTION_GLOBE_VIEW"),$e.push("DEPTH_D24"),c.terrain&&B.depthOcclusionForSymbolsAndCircles&&$e.push("DEPTH_OCCLUSION"),Te.hasElevation&&!c.terrain&&($e.push("ELEVATED_ROADS"),ot.push(Te.elevatedLayoutVertexBuffer));const Se=c.getOrCreateProgram("circle",{config:Ae,defines:$e,overrideFog:Fe}),Ke=B.projection.createInversionMatrix(B,de.canonical),Ve={programConfiguration:Ae,program:Se,layoutVertexBuffer:Re,dynamicBuffers:ot,indexBuffer:Le,uniformValues:a.e1(c,de,se,Ke,ee,o),tile:se};if(b){const it=Te.segments.get();for(const Et of it)xe.push({segments:new a.bg([Et]),sortKey:Et.sortKey,state:Ve})}else xe.push({segments:Te.segments,sortKey:0,state:Ve})}b&&xe.sort((ye,de)=>ye.sortKey-de.sortKey);const me={useDepthForOcclusion:B.depthOcclusionForSymbolsAndCircles};for(const ye of xe){const{programConfiguration:de,program:se,layoutVertexBuffer:Te,dynamicBuffers:Ae,indexBuffer:Re,uniformValues:Be,tile:Le}=ye.state,$e=ye.segments;c.terrain&&c.terrain.setupElevationDraw(Le,se,me),c.uploadCommonUniforms(C,se,Le.tileID.toUnwrapped()),se.draw(c,I.TRIANGLES,q,W,ne,di.disabled,Be,o.id,Te,Re,$e,o.paint,B.zoom,de,Ae)}},heatmap:function(c,t,o,u){if(o.paint.get("heatmap-opacity")!==0)if(c.renderPass==="offscreen"){const p=c.context,g=p.gl,y=yi.disabled,b=new bi([g.ONE,g.ONE,g.ONE,g.ONE],a.ao.transparent,[!0,!0,!0,!0]);(function(N,H,j,q){const W=N.gl,ne=H.width*q,ie=H.height*q;N.activeTexture.set(W.TEXTURE1),N.viewport.set([0,0,ne,ie]);let ee=j.heatmapFbo;if(!ee||ee&&(ee.width!==ne||ee.height!==ie)){ee&&ee.destroy();const xe=W.createTexture();W.bindTexture(W.TEXTURE_2D,xe),W.texParameteri(W.TEXTURE_2D,W.TEXTURE_WRAP_S,W.CLAMP_TO_EDGE),W.texParameteri(W.TEXTURE_2D,W.TEXTURE_WRAP_T,W.CLAMP_TO_EDGE),W.texParameteri(W.TEXTURE_2D,W.TEXTURE_MIN_FILTER,W.LINEAR),W.texParameteri(W.TEXTURE_2D,W.TEXTURE_MAG_FILTER,W.LINEAR),ee=j.heatmapFbo=N.createFramebuffer(ne,ie,1,null),(function(me,ye,de,se,Te,Ae){const Re=me.gl;Re.texImage2D(Re.TEXTURE_2D,0,me.extRenderToTextureHalfFloat?Re.RGBA16F:Re.RGBA,Te,Ae,0,Re.RGBA,me.extRenderToTextureHalfFloat?Re.HALF_FLOAT:Re.UNSIGNED_BYTE,null),se.colorAttachment0.set(de)}
vendor: 6,408 bytes, line 3207
3207)(N,0,xe,ee,ne,ie)}else W.bindTexture(W.TEXTURE_2D,ee.colorAttachment0.get()),N.bindFramebuffer.set(ee.framebuffer)})(p,c,o,c.transform.projection.name==="globe"?.5:.25),p.clear({color:a.ao.transparent});const T=c.transform,C=T.projection.name==="globe",I=C?["PROJECTION_GLOBE_VIEW"]:[],B=C?di.frontCCW:di.disabled,L=[a.aF(T.center.lng),a.aJ(T.center.lat)];for(let N=0;N<u.length;N++){const H=u[N];if(t.hasRenderableParent(H))continue;const j=t.getTile(H),q=j.getBucket(o);if(!q||q.projection.name!==T.projection.name)continue;const W=c.isTileAffectedByFog(H),ne=q.programConfigurations.get(o.id),ie=c.getOrCreateProgram("heatmap",{config:ne,defines:I,overrideFog:W}),{zoom:ee}=c.transform;c.terrain&&c.terrain.setupElevationDraw(j,ie),c.uploadCommonUniforms(p,ie,H.toUnwrapped());const xe=T.projection.createInversionMatrix(T,H.canonical);ie.draw(c,g.TRIANGLES,ti.disabled,y,b,B,eu(c,H,j,xe,L,ee,o.paint.get("heatmap-intensity")),o.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,o.paint,c.transform.zoom,ne,C?[q.globeExtVertexBuffer]:null)}p.viewport.set([0,0,c.width,c.height])}else c.renderPass==="translucent"&&(c.context.setColorMode(c.colorModeForRenderPass()),(function(p,g){const y=p.context,b=y.gl,T=g.heatmapFbo;if(!T)return;y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,T.colorAttachment0.get()),y.activeTexture.set(b.TEXTURE1);let C=g.colorRampTexture;C||(C=g.colorRampTexture=new a.T(y,g.colorRamp,b.RGBA8)),C.bind(b.LINEAR,b.CLAMP_TO_EDGE),p.getOrCreateProgram("heatmapTexture").draw(p,b.TRIANGLES,ti.disabled,yi.disabled,p.colorModeForRenderPass(),di.disabled,((I,B)=>({u_image:0,u_color_ramp:1,u_opacity:B.paint.get("heatmap-opacity")}))(0,g),g.id,p.viewportBuffer,p.quadTriangleIndexBuffer,p.viewportSegments,g.paint,p.transform.zoom)})(c,o))},line:function(c,t,o,u){if(c.renderPass!=="translucent")return;const p=o.paint.get("line-opacity"),g=o.paint.get("line-width");if(p.constantOr(1)===0||g.constantOr(1)===0)return;const y=o.paint.get("line-emissive-strength").isConstant(),b=o.paint.get("line-emissive-strength").constantOr(0),T=o.paint.get("line-occlusion-opacity"),C=o.layout.get("line-elevation-reference"),I=o.layout.get("line-width-unit")==="meters",B=C==="sea",L=!(!c.terrain||!c.terrain.enabled),N=c.context,H=N.gl;if(o.hasElevatedBuckets&&c.transform.projection.name==="globe")return;const j=o.layout.get("line-cross-slope"),q=j!==void 0,W=j<1,ne=c.colorModeForDrapableLayerRenderPass(y?b:null),ie=c.terrain&&c.terrain.renderingToTexture,ee=ie?1:a.o.devicePixelRatio,xe=o.paint.get("line-dasharray"),me=xe.constantOr(1),ye=o.layout.get("line-cap"),de=xe.constantOr(null),se=ye.constantOr(null),Te=o.paint.get("line-pattern"),Ae=Te.constantOr(1),Re=o.paint.get("line-pattern-cross-fade"),Be=Te.constantOr(null),Le=o.paint.get("line-opacity").constantOr(1);let $e=!Ae&&Le!==1||c.depthOcclusion&&T>0&&T<1;const ot=o.paint.get("line-gradient"),Fe=Ae?"linePattern":"line",Se=a.e2(o);let Ke;if(ie&&c.terrain&&c.terrain.clipOrMaskOverlapStencilType()&&($e=!1),T!==0&&c.depthOcclusion){const Bt=o.paint._values["line-opacity"];Bt&&Bt.value&&Bt.value.kind==="constant"?Ke=Bt.value:a.w(`Occlusion opacity for layer ${o.id} is supported only when line-opacity isn't data-driven.`)}g.value.kind!=="constant"&&g.value.isLineProgressConstant===!1&&Se.push("VARIABLE_LINE_WIDTH"),ie&&(c.emissiveMode!=="dual-source-blending"||y?c.emissiveMode==="mrt-fallback"&&Se.push("USE_MRT1"):Se.push("DUAL_SOURCE_BLENDING"));const Ve=(Bt,Ct,At,Qt,Wt,Ft)=>{for(const Yt of Bt){const oi=t.getTile(Yt);if(Ae&&!oi.patternsLoaded())continue;const fi=oi.getBucket(o);if(!fi||fi.elevationType!=="none"&&!Wt||fi.elevationType==="none"&&Wt)continue;c.prepareDrawTile();const Ri=[...Ct],Hi=c.shadowRenderer,pi=fi.elevationType==="road"&&!!Hi&&Hi.enabled;let zi=[0,0,0];if(pi){const Pi=c.style.directionalLight,Mn=c.style.ambientLight;Pi&&Mn&&(zi=Jo(c.style,Pi,Mn)),Ri.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const wi=fi.programConfigurations.get(o.id);let an=!1;if(Be&&oi.imageAtlas){const Pi=a.e3.from(Be),Mn=Pi.getPrimary().scaleSelf(ee).toString(),Jn=oi.imageAtlas.patternPositions.get(Mn),xn=Pi.getSecondary(),Cn=xn?oi.imageAtlas.patternPositions.get(xn.scaleSelf(ee).toString()):null;an=!!Jn&&!!Cn,Jn&&wi.setConstantPatternPositions(Jn,Cn)}Re>0&&(an||wi.getPatternTransitionVertexBuffer("line-pattern"))&&Ri.push("LINE_PATTERN_TRANSITION");const tn=c.isTileAffectedByFog(Yt),gn=c.getOrCreateProgram(Fe,{config:wi,defines:Ri,overrideFog:tn});if(!Ae&&de&&se&&oi.lineAtlas){const Pi=oi.lineAtlas.getDash(de,se);Pi&&wi.setConstantPatternPositions(Pi)}pi&&Hi.setupShadows(oi.tileID.toUnwrapped(),gn,"vector-tile");let[Yi,Di]=o.paint.get("line-trim-offset");(se==="round"||se==="square")&&Yi!==Di&&(Yi===0&&(Yi-=1),Di===1&&(Di+=1));const rn=ie?Yt.projMatrix:null,Fn=I?1/fi.tileToMeter/a.ay(oi,1,c.transform.zoom):1,_n=I?1/fi.tileToMeter/a.ay(oi,1,Math.floor(c.transform.zoom)):1,un=Ae?a.e4(c,oi,o,rn,ee,Fn,_n,[Yi,Di],zi,Re):a.e5(c,oi,o,rn,fi.lineClipsArray.length,ee,Fn,_n,[Yi,Di],zi);if(ot){const Pi=fi.gradients[o.id];let Mn=Pi.texture;if(o.gradientVersion!==Pi.version){let Jn=256;if(o.stepInterpolant){const xn=t.getSource().maxzoom,Cn=Yt.canonical.z===xn?Math.ceil(1<<c.transform.maxZoom-Yt.canonical.z):1;Jn=a.aA(a.e6(fi.maxLineLength/a.al*1024*Cn),256,N.maxTextureSize)}Pi.gradient=a.e7({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:Jn,image:Pi.gradient||void 0,clips:fi.lineClipsArray}),Pi.texture?Pi.texture.update(Pi.gradient):Pi.texture=new a.T(N,Pi.gradient,H.RGBA8),Pi.version=o.gradientVersion,Mn=Pi.texture}N.activeTexture.set(H.TEXTURE1),Mn.bind(o.stepInterpolant?H.NEAREST:H.LINEAR,H.CLAMP_TO_EDGE)}me&&(N.activeTexture.set(H.TEXTURE0),oi.lineAtlasTexture&&oi.lineAtlasTexture.bind(H.LINEAR,H.REPEAT),wi.updatePaintBuffers()),Ae&&(N.activeTexture.set(H.TEXTURE0),oi.imageAtlasTexture&&oi.imageAtlasTexture.bind(H.LINEAR,H.CLAMP_TO_EDGE),wi.updatePaintBuffers()),Wt&&!B&&c.terrain.setupElevationDraw(oi,gn),c.uploadCommonUniforms(N,gn,Yt.toUnwrapped());const Ci=Pi=>{Ke!=null&&(Ke.value=Le*T),gn.draw(c,H.TRIANGLES,At,Pi,ne,di.disabled,un,o.id,fi.layoutVertexBuffer,fi.indexBuffer,fi.segments,o.paint,c.transform.zoom,wi,[fi.layoutVertexBuffer2,fi.patternVertexBuffer,fi.zOffsetVertexBuffer]),Ke!=null&&(Ke.value=Le)};if($e&&!Wt){const Pi=c.stencilModeForClipping(Yt).ref;Pi===0&&ie&&N.clear({stencil:0});const Mn={func:H.EQUAL,mask:255};
3207un.u_alpha_discard_threshold=.8,Ci(new yi(Mn,Pi,255,H.KEEP,H.KEEP,H.INVERT)),un.u_alpha_discard_threshold=0,Ci(new yi(Mn,Pi,255,H.KEEP,H.KEEP,H.KEEP))}else un.u_alpha_discard_threshold=$e&&Wt&&Ft?.8:0,Ci(Wt?Qt:c.stencilModeForClipping(Yt))}};let it=c.depthModeForSublayer(0,ti.ReadOnly);const Et=new ti(c.depthOcclusion?H.GREATER:H.LEQUAL,ti.ReadOnly,c.depthRangeFor3D);if(o.hasNonElevatedBuckets){const Bt=!ie&&c.terrain;T!==0&&Bt?a.w(`Occlusion opacity for layer ${o.id} is supported on terrain only if the layer has line-z-offset enabled.`):Bt?a.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o.id}.`):Ve(u,Se,it,yi.disabled,!1,!0)}if(o.hasElevatedBuckets){C==="hd-road-markup"?L||(it=Et,Se.push("ELEVATED_ROADS")):(Se.push("ELEVATED"),it=Et,q&&Se.push(W?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),B&&Se.push("ELEVATION_REFERENCE_SEA"));const Bt=$e?c.stencilModeFor3D():yi.disabled;c.forceTerrainMode=!0,Ve(u,Se,it,Bt,!0,!0),$e&&Ve(u,Se,it,Bt,!0,!1),c.forceTerrainMode=!1}$e&&(c.resetStencilClippingMasks(),ie&&N.clear({stencil:0})),T===0||c.depthOcclusion||ie||c.layersWithOcclusionOpacity.push(c.currentLayer)},fill:function(c,t,o,u){const p=o.paint.get("fill-color"),g=o.paint.get("fill-opacity");if(g.constantOr(1)===0)return;const y=o.paint.get("fill-emissive-strength"),b=c.colorModeForDrapableLayerRenderPass(y),T=o.paint.get("fill-pattern"),C=c.opaquePassEnabledForLayer()&&!T.constantOr(1)&&p.constantOr(a.ao.transparent).a===1&&g.constantOr(0)===1?"opaque":"translucent";let I="none";o.layout.get("fill-elevation-reference")!=="none"?I="road":o.paint.get("fill-z-offset").constantOr(1)!==0&&(I="offset");const B=!(!c.terrain||!c.terrain.enabled),L={painter:c,sourceCache:t,layer:o,coords:u,colorMode:b,elevationType:I,terrainEnabled:B,pass:C};if(c.renderPass==="shadow")return void(c.shadowRenderer&&I==="road"&&!B&&(function(H){const{painter:j,sourceCache:q,layer:W,coords:ne}=H,ie=j.context.gl,ee=H.painter.shadowRenderer;for(const xe of ne){const me=q.getTile(xe),ye=me.getBucket(W);if(!ye)continue;const de=ye.elevatedStructures;if(!de||!de.shadowCasterSegments||de.shadowCasterSegments.segments[0].primitiveLength===0)continue;j.prepareDrawTile();const se=ye.bufferData.programConfigurations.get(W.id),Te=j.isTileAffectedByFog(xe),Ae=j.getOrCreateProgram("elevatedStructuresDepth",{config:se,overrideFog:Te}),Re=ee.calculateShadowPassMatrixFromTile(me.tileID.toUnwrapped());j.uploadCommonUniforms(j.context,Ae,xe.toUnwrapped());const Be=Jc(Re,0);Ae.draw(j,ie.TRIANGLES,ee.getShadowPassDepthMode(),yi.disabled,ee.getShadowPassColorMode(),di.disabled,Be,W.id,de.vertexBuffer,de.indexBuffer,de.shadowCasterSegments,W.paint,j.transform.zoom,se)}})(L));const N=c.emissiveMode==="mrt-fallback";if(I!=="offset"){if(wr(L,!1,N),I==="road"){const H=!B&&c.renderPass==="translucent";H&&Sp(c,t,o,u,"geometry"),wr(L,!0,N,yi.disabled),H&&(function(j){const{painter:q,sourceCache:W,layer:ne,coords:ie,colorMode:ee}=j,xe=q.context.gl,me=j.painter.shadowRenderer,ye=!!me&&me.enabled,de=new ti(q.context.gl.LEQUAL,ti.ReadOnly,q.depthRangeFor3D);let se=[0,0,0];if(ye){const Ae=q.style.directionalLight,Re=q.style.ambientLight;Ae&&Re&&(se=Jo(q.style,Ae,Re))}const Te=Ae=>{for(const Re of ie){const Be=W.getTile(Re),Le=Be.getBucket(ne);if(!Le)continue;const $e=Le.elevatedStructures;if(!$e)continue;let ot,Fe;if(Ae?(ot=$e.renderableBridgeSegments,Fe=$e.bridgeProgramConfigurations.get(ne.id)):(ot=$e.renderableTunnelSegments,Fe=$e.tunnelProgramConfigurations.get(ne.id)),!ot||ot.segments[0].primitiveLength===0)continue;Fe.updatePaintBuffers(),q.prepareDrawTile();const Se=q.isTileAffectedByFog(Re),Ke=[];ye&&Ke.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Ve=q.getOrCreateProgram("elevatedStructures",{config:Fe,overrideFog:Se,defines:Ke}),it=q.translatePosMatrix(Re.projMatrix,Be,ne.paint.get("fill-translate"),ne.paint.get("fill-translate-anchor"));ye&&me.setupShadows(Be.tileID.toUnwrapped(),Ve,"vector-tile");const Et=Ps(it,se);q.uploadCommonUniforms(q.context,Ve,Re.toUnwrapped()),Ve.draw(q,xe.TRIANGLES,de,yi.disabled,ee,di.backCCW,Et,ne.id,$e.vertexBuffer,$e.indexBuffer,ot,
3207ne.paint,q.transform.zoom,Fe,[$e.vertexBufferNormal])}};Te(!0),Te(!1)})(L)}}else wr(L,!1,N,c.stencilModeFor3D())},"fill-extrusion":function(c,t,o,u){const p=o.paint.get("fill-extrusion-opacity"),g=c.context,y=g.gl,b=c.terrain,T=b&&b.renderingToTexture;if(p===0)return;const C=c.emissiveMode==="mrt-fallback",I=c.conflationActive&&c.style.isLayerClipped(o,t.getSource()),B=c.style.order.indexOf(o.fqid);if(I&&(function(L,N,H,j,q){for(const W of j){const ne=N.getTile(W).getBucket(H);ne&&(ne.updateReplacement(W,L.replacementSource,q),ne.uploadCentroid(L.context))}})(c,t,o,u,B),b||I)for(const L of u){const N=t.getTile(L).getBucket(o);N&&Ep(c.context,t,L,N,o,b,I)}if(c.renderPass==="shadow"&&c.shadowRenderer){const L=c.shadowRenderer;if(b&&p<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.ad)return;const N=L.getShadowPassDepthMode(),H=L.getShadowPassColorMode();wc(c,t,o,u,N,yi.disabled,H,I)}else if(c.renderPass==="translucent"){const L=!o.paint.get("fill-extrusion-pattern").constantOr(1),N=o.paint.get("fill-extrusion-color").constantOr(a.ao.white);if(!T&&N.a!==0){const H=new ti(c.context.gl.LEQUAL,ti.ReadWrite,c.depthRangeFor3D);p===1&&L?wc(c,t,o,u,H,yi.disabled,bi.unblended,I):(wc(c,t,o,u,H,yi.disabled,bi.disabled,I),wc(c,t,o,u,H,c.stencilModeFor3D(),c.colorModeForRenderPass(),I),c.resetStencilClippingMasks())}if(c.style.enable3dLights()&&L&&(!b&&c.transform.projection.name!=="globe"||T)){const H=o.paint.get("fill-extrusion-opacity"),j=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),q=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),W=o.paint.get("fill-extrusion-flood-light-intensity"),ne=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ie=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ne?null:o.lut).toArray01().slice(0,3),ee=j>0&&q>0,xe=W>0,me=(se,Te,Ae)=>(1-Ae)*se+Ae*Te,ye=new lu;ye.translate=o.paint.get("fill-extrusion-translate"),ye.translateAnchor=o.paint.get("fill-extrusion-translate-anchor"),ye.edgeRadius=o.layout.get("fill-extrusion-edge-radius"),ye.cutoffFadeRange=o.paint.get("fill-extrusion-cutoff-fade-range");const de=se=>{const Te=c.depthModeForSublayer(1,ti.ReadOnly,y.LEQUAL,!0),Ae=o.paint.get(se?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Re=me(.1,3,Ae),Be=c._showOverdrawInspector;if(!Be){const Le=new yi({func:y.ALWAYS,mask:255},255,255,y.KEEP,y.KEEP,y.REPLACE),$e=new bi([y.ONE,y.ONE,y.ONE,y.ONE],a.ao.transparent,[!1,!1,!1,!0],y.MIN);Os(ye,c,t,o,u,Te,Le,$e,di.disabled,se,"sdf",H,j,q,W,ie,Re,I,!1)}{const Le=Be?yi.disabled:new yi({func:y.EQUAL,mask:255},255,255,y.KEEP,y.DECR,y.DECR),$e=Be?c.colorModeForRenderPass():new bi([y.ONE_MINUS_DST_ALPHA,y.DST_ALPHA,y.ONE,y.ONE],a.ao.transparent,[!0,!0,!0,!0]);Os(ye,c,t,o,u,Te,Le,$e,di.disabled,se,"color",H,j,q,W,ie,Re,I,!1)}};if(T){const se=()=>{const Ae=b.drapeBufferSize[0],Re=b.drapeBufferSize[1];let Be=b.framebufferCopyTexture;return Be&&(!Be||Be.size[0]===Ae&&Be.size[1]===Re)||(Be&&Be.destroy(),Be=b.framebufferCopyTexture=new a.T(g,new a.q({width:Ae,height:Re}),y.RGBA8)),Be.bind(y.LINEAR,y.CLAMP_TO_EDGE),y.copyTexSubImage2D(y.TEXTURE_2D,0,0,0,0,0,Ae,Re),Be},Te=(Ae,Re,Be)=>{const Le=c.depthModeForSublayer(1,ti.ReadOnly,y.LEQUAL,!1),$e=o.paint.get(Ae?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ot=me(.1,3,$e);{const Fe=new bi([y.ONE,y.ONE,y.ONE,y.ONE],a.ao.transparent,[!1,!1,!1,!0]);Os(ye,c,t,o,u,Le,yi.disabled,Fe,di.disabled,Ae,"clear",H,j,q,W,ie,ot,I,Re)}{const Fe=new yi({func:y.ALWAYS,mask:255},255,255,y.KEEP,y.KEEP,y.REPLACE),Se=new bi([y.ONE,y.ONE,y.ONE,y.ONE],a.ao.transparent,[!1,!1,!1,!0],y.MIN);Os(ye,c,t,o,u,Le,Fe,Se,di.disabled,Ae,"sdf",H,j,q,W,ie,ot,I,Re)}C&&!Ae&&(Be=se());{const Fe=Ae?y.ZERO:y.ONE_MINUS_DST_ALPHA,Se=new yi({func:y.EQUAL,mask:255},255,255,y.KEEP,y.DECR,y.DECR),Ke=new bi([Fe,y.DST_ALPHA,y.ONE_MINUS_DST_ALPHA,y.ZERO],a.ao.transparent,[!0,!0,!0,!0]);Os(ye,c,t,o,u,Le,Se,Ke,di.disabled,Ae,"color",H,j,q,W,ie,ot,I,Re)}if(!C||Ae){const Fe=new bi([y.ONE,y.ONE,y.ONE,Ae?y.ZERO:y.ONE],a.ao.transparent,[!1,!1,!1,!0],Ae?y.FUNC_ADD:y.MAX);Os(ye,c,t,o,u,Le,yi.disabled,Fe,di.disabled,Ae,"clear",H,j,q,W,ie,ot,I,Re,Be)}else{y.drawBuffers([y.NONE,y.COLOR_ATTACHMENT1]);const Fe=new yi({func:y.EQUAL,mask:255},254,255,y.KEEP,y.DECR,y.DECR),Se=new bi([y.ONE,y.ONE,y.ONE,y.ONE],a.ao.transparent,[!0,!1,!1,!1],y.MAX);Os(ye,c,t,o,u,Le,Fe,Se,di.disabled,Ae,"emissive",H,j,q,W,ie,ot,I,Re,Be),y.drawBuffers([y.COLOR_ATTACHMENT0])}};if(ee||xe){let Ae;c.prepareDrawTile(),C&&!ee||(Ae=se()),ee&&Te(!0,!1,Ae),xe&&Te(!1,!0,Ae)}}else ee&&de(!0),xe&&de(!1),(ee||xe)&&c.resetStencilClippingMasks()}}},building:function(c,t,o,u){c.currentLayer<c.firstLightBeamLayer&&(c.firstLightBeamLayer=c.currentLayer);const p=o.paint.get("building-ambient-occlusion-ground-intensity"),g=o.paint.get("building-ambient-occlusion-ground-radius"),y=o.paint.get("building-ambient-occlusion-ground-attenuation"),b=o.paint.get("building-opacity");if(b<=0)return;let T=p>0&&g>0,C=!0;const I=o.paint.get("building-vertical-scale");if(I<=0)return;c.shadowRenderer||(C=!1);const B=c.conflationActive&&c.style.isLayerClipped(o,t.getSource()),L=c.style.order.indexOf(o.fqid);if((function(N,H,j,q,W,ne){for(const ie of ne){const ee=H.getTile(ie).getBucket(j);ee&&(W&&ee.updateReplacement(ie,N.replacementSource,q),ee.uploadUpdatedIndexBuffer(N.context))}})(c,t,o,L,B,u),(function(N,H,j,q){for(const W of q){const ne=H.getTile(W).getBucket(j);ne&&ne.needsEvaluation()&&ne.uploadUpdatedColorBuffer(N.context)}})(c,t,o,u),o.resetLayerRenderingStats(c),c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!0),c.renderPass==="shadow"&&c.shadowRenderer){const N=c.shadowRenderer,H=[],j=N.get
3207ShadowPassDepthMode();lo({painter:c,source:t,layer:o,coords:u,defines:H,blendMode:N.getShadowPassColorMode(),depthMode:j,opacity:b,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(c.renderPass==="translucent"){let N=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];C&&(N=N.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),c.shadowRenderer&&c.shadowRenderer.useNormalOffset&&(N=N.concat("NORMAL_OFFSET"));const H=o.paint.get("building-facade-emissive-chance"),j=o.paint.get("building-ambient-occlusion-intensity"),q=o.paint.get("building-flood-light-intensity"),W=o.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",ne=o.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(W?null:o.lut).toArray01().slice(0,3),ie=o.paint.get("building-flood-light-ground-attenuation"),ee=q>0,xe=new ti(c.context.gl.LEQUAL,ti.ReadWrite,c.depthRangeFor3D);b<1&&lo({painter:c,source:t,layer:o,coords:u,defines:N,blendMode:bi.disabled,depthMode:xe,opacity:b,verticalScale:I,facadeEmissiveChance:H,facadeAOIntensity:j,floodLightIntensity:q,floodLightColor:ne,depthOnly:!0});const me=c.colorModeForRenderPass();lo({painter:c,source:t,layer:o,coords:u,defines:N,blendMode:me,depthMode:xe,opacity:b,verticalScale:I,facadeEmissiveChance:H,facadeAOIntensity:j,floodLightIntensity:q,floodLightColor:ne}),T&&Pr(c,t,o,u,!0,b,p,g,q,ne,y,B),ee&&Pr(c,t,o,u,!1,b,p,g,q,ne,ie,B)}else if(c.renderPass==="light-beam"){const N=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],H=new ti(c.context.gl.LEQUAL,ti.ReadOnly,c.depthRangeFor3D);lo({painter:c,source:t,layer:o,coords:u,defines:N,blendMode:bi.alphaBlended,depthMode:H,opacity:b,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!1),c.resetStencilClippingMasks()},hillshade:function(c,t,o,u){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent"||c.style.disableElevatedTerrain)return;const p=c.context,g=c.terrain&&c.terrain.renderingToTexture,[y,b]=c.renderPass!=="translucent"||g?[{},u]:c.stencilConfigForOverlap(u);for(const T of b){const C=t.getTile(T);if(C.needsHillshadePrepare&&c.renderPass==="offscreen")ds(c,C,o);else if(c.renderPass==="translucent"){const I=c.depthModeForSublayer(0,ti.ReadOnly),B=o.paint.get("hillshade-emissive-strength"),L=c.colorModeForDrapableLayerRenderPass(B),N=g&&c.terrain?c.terrain.stencilModeForRTTOverlap(T):y[T.overscaledZ];Qh(c,T,C,o,I,N,L)}}p.viewport.set([0,0,c.width,c.height]),c.resetStencilClippingMasks()},raster:function(c,t,o,u,p,g){if(c.renderPass!=="translucent"||o.paint.get("raster-opacity")===0)return;const y=c.transform.projection.name==="globe",b=o.paint.get("raster-elevation")!==0,T=b&&y;if(c.renderElevatedRasterBackface&&!T)return;const C=c.context,I=C.gl,B=t.getSource(),L=(function(me,ye,de,se,Te){const Ae=ye.paint.get("raster-color"),Re=me.type==="raster-array",Be=[],Le=ye.paint.get("raster-resampling"),$e=ye.paint.get("raster-color-mix");let ot=ye.paint.get("raster-color-range");const Fe=[$e[0],$e[1],$e[2],0],Se=$e[3];let Ke=Le==="nearest"?se.NEAREST:se.LINEAR;if(Re&&(Be.push("RASTER_ARRAY"),Ae||Be.push("RASTER_COLOR"),Le==="linear"&&Be.push("RASTER_ARRAY_LINEAR"),Ke=se.NEAREST,!ot&&me.rasterLayers)){const Ve=me.rasterLayers.find(({id:it})=>it===ye.sourceLayer);Ve&&Ve.fields&&Ve.fields.range&&(ot=Ve.fields.range)}if(ot=ot||[0,1],Ae){Be.push("RASTER_COLOR"),de.activeTexture.set(se.TEXTURE2),ye.updateColorRamp(ot);let Ve=ye.colorRampTexture;Ve||(Ve=ye.colorRampTexture=new a.T(de,ye.colorRamp,se.RGBA8)),Ve.bind(Ke,se.CLAMP_TO_EDGE)}return Te&&Be.push("USE_MRT1"),{mix:Fe,range:ot,offset:Se,defines:Be,resampling:Ke}})(B,o,C,I,c.terrain&&c.terrain.renderingToTexture&&c.emissiveMode==="mrt-fallback");if(B instanceof a.aU&&!u.length&&!y)return;const N=o.paint.get("raster-emissive-strength"),H=c.colorModeForDrapableLayerRenderPass(N),j=c.terrain&&c.terrain.renderingToTexture,q=!c.options.moving,W=o.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;if(B instanceof a.aU&&!u.length&&(B.onNorthPole||B.onSouthPole)){const me=b?c.stencilModeFor3D():yi.disabled;return void Tc(!!B.onNorthPole,null,c,t,o,N,L,di.disabled,me)}if(!u.length)return;const[ne,ie]=B instanceof a.aU||j?[{},u]:c.stencilConfigForOverlap(u),ee=ie[ie.length-1].overscaledZ;T&&L.defines.push("PROJECTION_GLOBE_VIEW"),b&&L.defines.push("RENDER_CUTOFF");const xe=(me,ye,de)=>
3207{for(const se of me){const Te=se.toUnwrapped(),Ae=t.getTile(se);if(j&&(!Ae||!Ae.hasData()))continue;C.activeTexture.set(I.TEXTURE0);const Re=xf(Ae,B,o,L);if(!Re||!Re.texture)continue;const{texture:Be,mix:Le,offset:$e,tileSize:ot,buffer:Fe}=Re;let Se,Ke;j?(Se=ti.disabled,Ke=se.projMatrix):b?(Se=new ti(I.LEQUAL,ti.ReadWrite,c.depthRangeFor3D),Ke=y?Float32Array.from(c.transform.expandedFarZProjMatrix):c.transform.calculateProjMatrix(Te,q)):(Se=c.depthModeForSublayer(se.overscaledZ-ee,o.paint.get("raster-opacity")===1?ti.ReadWrite:ti.ReadOnly,I.LESS),Ke=c.transform.calculateProjMatrix(Te,q));const Ve=c.terrain&&j?c.terrain.stencilModeForRTTOverlap(se):ne[se.overscaledZ],it=g?0:o.paint.get("raster-fade-duration");Ae.registerFadeDuration(it);const Et=t.findLoadedParent(se,0),Bt=od(Ae,Et,t,c.transform,it);let Ct,At;!Bt.isFading&&Ae.refreshedUponExpiration&&(Ae.refreshedUponExpiration=!1),c.terrain&&c.terrain.prepareDrawTile(),C.activeTexture.set(I.TEXTURE0),Be.bind(W,I.CLAMP_TO_EDGE),C.activeTexture.set(I.TEXTURE1),Et?(Et.texture&&Et.texture.bind(W,I.CLAMP_TO_EDGE),Ct=Math.pow(2,Et.tileID.overscaledZ-Ae.tileID.overscaledZ),At=[Ae.tileID.canonical.x*Ct%1,Ae.tileID.canonical.y*Ct%1]):Be.bind(W,I.CLAMP_TO_EDGE),"useMipmap"in Be&&C.extTextureFilterAnisotropic&&c.transform.pitch>20&&I.texParameterf(I.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax);const Qt=c.transform;let Wt;const Ft=b?gd(Qt):[0,0,0,0];let Yt,oi,fi,Ri,Hi,pi=0;if(T&&B instanceof a.aU&&B.coordinates.length>3)Yt=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0)))),oi=Float32Array.from(Qt.globeMatrix),fi=Float32Array.from(a.dF(Qt)),Ri=[a.aF(Qt.center.lng),a.aJ(Qt.center.lat)],Wt=B.elevatedGlobePerspectiveTransform,Hi=B.elevatedGlobeGridMatrix||new Float32Array(9);else if(T){const tn=a.dG(se.canonical);pi=a.dH(tn.getCenter().lat),Yt=Float32Array.from(a.bk(a.dJ(se.canonical))),oi=Float32Array.from(Qt.globeMatrix),fi=Float32Array.from(a.dF(Qt)),Ri=[a.aF(Qt.center.lng),a.aJ(Qt.center.lat)],Wt=[0,0],Hi=Float32Array.from(a.dI(se.canonical,tn,pi,Qt.worldSize/Qt._pixelsPerMercatorPixel))}else Wt=B instanceof a.aU?B.perspectiveTransform:[0,0],Yt=new Float32Array(16),oi=new Float32Array(9),fi=new Float32Array(16),Ri=[0,0],Hi=new Float32Array(9);const zi=tu(Ke,Yt,oi,fi,Hi,At||[0,0],a.aj(c.transform.zoom),Ri,Ft,Ct||1,Bt,o,Wt,b?o.paint.get("raster-elevation"):0,2,Le,$e,L.range,ot,Fe,N),wi=c.isTileAffectedByFog(se),an=c.getOrCreateProgram("raster",{defines:L.defines,overrideFog:wi});if(c.uploadCommonUniforms(C,an,Te),B instanceof a.aU){const tn=B.elevatedGlobeVertexBuffer,gn=B.elevatedGlobeIndexBuffer;if(j||!y)B.boundsBuffer&&B.boundsSegments&&an.draw(c,I.TRIANGLES,Se,yi.disabled,H,di.disabled,zi,o.id,B.boundsBuffer,c.quadTriangleIndexBuffer,B.boundsSegments);else if(tn&&gn){const Yi=Qt.zoom<=a.c_?B.elevatedGlobeSegments:B.getSegmentsForLongitude(Qt.center.lng);Yi&&an.draw(c,I.TRIANGLES,Se,yi.disabled,H,ye,zi,o.id,tn,gn,Yi)}}else if(T){Se=new ti(I.LEQUAL,ti.ReadOnly,c.depthRangeFor3D);const tn=c.globeSharedBuffers;if(tn){const[gn,Yi,Di]=tn.getGridBuffers(pi,!1);an.draw(c,I.TRIANGLES,Se,de||Ve,c.colorModeForRenderPass(),ye,zi,o.id,gn,Yi,Di)}}else{const{tileBoundsBuffer:tn,tileBoundsIndexBuffer:gn,tileBoundsSegments:Yi}=c.getTileBoundsBuffers(Ae);an.draw(c,I.TRIANGLES,Se,Ve,H,di.disabled,zi,o.id,tn,gn,Yi)}}if(!(B instanceof a.aU)&&T)for(const se of me){const Te=se.canonical.y===(1<<se.canonical.z)-1;se.canonical.y===0&&Tc(!0,se,c,t,o,N,L,ye,de||yi.disabled),Te&&Tc(!1,se,c,t,o,N,L,ye===di.frontCW?di.backCW:di.frontCW,de||yi.disabled)}};T?xe(ie,c.renderElevatedRasterBackface?di.backCW:di.frontCW,c.stencilModeFor3D()):xe(ie,di.disabled,void 0),c.resetStencilClippingMasks()},"raster-particle":function(c,t,o,u,p,g){c.renderPass==="offscreen"&&(function(y,b,T,C){if(!C.length)return;const I=y.context,B=I.gl,L=b.getSource();if(!(L instanceof Fo))return;const N=Math.ceil(Math.sqrt(T.paint.get("raster-particle-count")));let H=T.particlePositionRGBAImage;if(!H||H.width!==N){const ie=(function(ee){const xe=ee*ee,me=new Uint8Array(4*xe),ye=function(se){return se|=0,se=Math.imul(2747636419^se,2654435769),se=Math.imul(se^se>>>16,2654435769),((se=Math.imul(se^se>>>16,2654435769))>>>0)/4294967296},de=.9090909090909091;for(let se=0;se<xe;se++){const Te=de*(ye(2*se+0)+iu),Ae=de*(ye(2*se+1)+iu),Re=255*Te%1,Be=255*Ae%1,Le=Re,$e=Ae-Be/255,ot=Be;me[4*se+0]=255*(Te-Re/255),me[4*se+1]=255*Le,me[4*se+2]=255*$e,me[4*se+3]=255*ot}return me})(N);H=T.particlePositionRGBAImage=new a.q({width:N,height:N},ie)}let j=T.particleFramebuffer;j?j.width!==N&&(j.destroy(),j=T.particleFramebuffer=I.createFramebuffer(N,N,1,null)):j=T.particleFramebuffer=I.createFramebuffer(N,N,1,null);const q=[];for(const ie of C){const ee=b.getTile(ie);if(!(ee instanceof Ou))continue;const xe=yd(ee,L,T);if(!xe)continue;const me=[ee.tileSize,ee.tileSize];let ye=T.tileFramebuffer;ye||(ye=T.tileFramebuffer=I.createFramebuffer(me[0],me[1],1,null));let de=ee.rasterParticleState;de||(de=ee.rasterParticleState=new _d(I,ie,me,H));const se=de.update(T.lastInvalidatedAt);de.particleTextureDimension!==N&&de.updateParticleTexture(ie,H);const Te=de.targetColorTexture;de.targetColorTexture=de.backgroundColorTexture,de.backgroundColorTexture=Te;const Ae=de.particleTexture0;de.particleTexture0=de.particleTexture1,de.particleTexture1=Ae,q.push([ie,xe,de,se])}if(q.length===0)return;const W=a.o.now(),ne=T.previousDrawTimestamp?.001*(W-T.previousDrawTimestamp):.0167;if(T.previousDrawTimestamp=W,T.hasColorMap()){I.activeTexture.set(B.TEXTURE0+2);let ie=T.colorRampTexture;ie||(ie=T.colorRampTexture=new a.T(I,T.colorRamp,B.RGBA8)),ie.bind(B.LINEAR,B.CLAMP_TO_EDGE)}I.bindFramebuffer.set(T.tileFramebuffer.framebuffer),(function(ie,ee,xe){const me=ie.context,ye=me.gl,de=ee.tileFramebuffer;me.activeTexture.set(ye.TEXTURE0);const se={u_texture:0,u_opacity:1.05*(Ae=ee.paint.get("raster-particle-fade-opacity-factor"))/(Ae+.05)},Te=ie.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var Ae;
vendor: 15,923 bytes, line 3207
3207for(const Re of xe){const[,,Be,Le]=Re;de.colorAttachment0.set(Be.targetColorTexture.texture),me.viewport.set([0,0,de.width,de.height]),me.clear({color:a.ao.transparent}),Le&&(Be.backgroundColorTexture.bind(ye.NEAREST,ye.CLAMP_TO_EDGE),Te.draw(ie,ye.TRIANGLES,ti.disabled,yi.disabled,bi.alphaBlended,di.disabled,se,ee.id,ie.viewportBuffer,ie.quadTriangleIndexBuffer,ie.viewportSegments))}})(y,T,q),(function(ie,ee,xe,me){const ye=ie.context,de=ye.gl,se=xe.tileFramebuffer,Te=ie.transform.projection.name==="globe",Ae=xe.paint.get("raster-particle-max-speed");for(const Re of me){const[Be,Le,$e]=Re;ye.activeTexture.set(de.TEXTURE0+0),Le.texture.bind(de.LINEAR,de.CLAMP_TO_EDGE),se.colorAttachment0.set($e.targetColorTexture.texture);const ot=ie.getOrCreateProgram("rasterParticleDraw",{defines:Le.defines,overrideFog:!1});ye.activeTexture.set(de.TEXTURE0+1);const Fe=Le.scalarData?[]:[0,1,2,3].map(Ve=>a.e9[Ve](Be));Fe.push(Be);const Se=Be.canonical.x,Ke=Be.canonical.y;for(const Ve of Fe){const it=ee.getTile(Te?Ve.wrapped():Ve);if(!it)continue;const Et=it.rasterParticleState;if(!Et)continue;const Bt=Ve.canonical.x+(1<<Ve.canonical.z)*(Ve.wrap-Be.wrap),Ct=Ve.canonical.y;Et.particleTexture0.bind(de.NEAREST,de.CLAMP_TO_EDGE);const At=nu(1,Et.particleTexture0.size[0],[Bt-Se,Ct-Ke],0,Le.texture.size,2,Ae,Le.textureOffset,Le.scale,Le.offset);ot.draw(ie,de.POINTS,ti.disabled,yi.disabled,bi.alphaBlended,di.disabled,At,xe.id,Et.particleIndexBuffer,void 0,Et.particleSegment)}}})(y,b,T,q),I.bindFramebuffer.set(T.particleFramebuffer.framebuffer),(function(ie,ee,xe,me){const ye=ie.context,de=ye.gl,se=ee.paint.get("raster-particle-max-speed"),Te=me*ee.paint.get("raster-particle-speed-factor")*.15,Ae=(function(Be){return Math.pow(Be,6)})(.01+1*ee.paint.get("raster-particle-reset-rate-factor")),Re=ee.particleFramebuffer;ye.viewport.set([0,0,Re.width,Re.height]);for(const Be of xe){const[,Le,$e]=Be;ye.activeTexture.set(de.TEXTURE0+0),Le.texture.bind(de.LINEAR,de.CLAMP_TO_EDGE),ye.activeTexture.set(de.TEXTURE0+1);const ot=$e.particleTexture0;ot.bind(de.NEAREST,de.CLAMP_TO_EDGE);const Fe=gf(1,ot.size[0],0,Le.texture.size,se,Te,Ae,Le.textureOffset,Le.scale,Le.offset);Re.colorAttachment0.set($e.particleTexture1.texture),ye.clear({color:a.ao.transparent}),ie.getOrCreateProgram("rasterParticleUpdate",{defines:Le.defines}).draw(ie,de.TRIANGLES,ti.disabled,yi.disabled,bi.unblended,di.disabled,Fe,ee.id,ie.viewportBuffer,ie.quadTriangleIndexBuffer,ie.viewportSegments)}})(y,T,q,ne)})(c,t,o,u),c.renderPass==="translucent"&&((function(y,b,T,C){const I=y.context,B=I.gl,L=b.getSource().tileSize,N=5*(1-a.ah(a.cL,a.cL+1,y.transform.zoom))*L+T.paint.get("raster-particle-elevation"),H=!y.options.moving,j=y.transform.projection.name==="globe";if(!C.length)return;const[q,W]=y.stencilConfigForOverlap(C),ne=[];j&&ne.push("PROJECTION_GLOBE_VIEW");const ie=y.stencilModeFor3D();for(const ee of W){const xe=ee.toUnwrapped(),me=b.getTile(ee);if(!me.rasterParticleState)continue;const ye=me.rasterParticleState,de=100;me.registerFadeDuration(de);const se=b.findLoadedParent(ee,0),Te=od(me,se,b,y.transform,de);let Ae,Re;y.terrain&&y.terrain.prepareDrawTile(),I.activeTexture.set(B.TEXTURE0),ye.targetColorTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),I.activeTexture.set(B.TEXTURE1),se&&se.rasterParticleState?(se.rasterParticleState.targetColorTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),Ae=Math.pow(2,se.tileID.overscaledZ-me.tileID.overscaledZ),Re=[me.tileID.canonical.x*Ae%1,me.tileID.canonical.y*Ae%1]):ye.targetColorTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE);const Be=j?Float32Array.from(y.transform.expandedFarZProjMatrix):y.transform.calculateProjMatrix(xe,H),Le=y.transform,$e=vf(Le),ot=a.dG(ee.canonical),Fe=a.dH(ot.getCenter().lat);let Se,Ke,Ve,it,Et;j?(Se=Float32Array.from(a.bk(a.dJ(ee.canonical))),Ke=Float32Array.from(Le.globeMatrix),Ve=Float32Array.from(a.dF(Le)),it=[a.aF(Le.center.lng),a.aJ(Le.center.lat)],Et=Float32Array.from(a.dI(ee.canonical,ot,Fe,Le.worldSize/Le._pixelsPerMercatorPixel))):(Se=new Float32Array(16),Ke=new Float32Array(9),Ve=new Float32Array(16),it=[0,0],Et=new Float32Array(9));const Bt=km(Be,Se,Ke,Ve,Et,Re||[0,0],a.aj(y.transform.zoom),it,$e,Ae||1,Te,N),Ct=y.isTileAffectedByFog(ee),At=y.getOrCreateProgram("rasterParticle",{defines:ne,overrideFog:Ct});if(y.uploadCommonUniforms(I,At,xe),j){const Qt=new ti(B.LEQUAL,ti.ReadOnly,y.depthRangeFor3D),Wt=0,Ft=y.globeSharedBuffers;if(Ft){const[Yt,oi,fi]=Ft.getGridBuffers(Fe,Wt!==0);At.draw(y,B.TRIANGLES,Qt,ie,bi.alphaBlended,y.renderElevatedRasterBackface?di.frontCCW:di.backCCW,Bt,T.id,Yt,oi,fi)}}else{const Qt=y.depthModeForSublayer(0,ti.ReadOnly),Wt=q[ee.overscaledZ],{tileBoundsBuffer:Ft,tileBoundsIndexBuffer:Yt,tileBoundsSegments:oi}=y.getTileBoundsBuffers(me);At.draw(y,B.TRIANGLES,Qt,Wt,bi.alphaBlended,di.disabled,Bt,T.id,Ft,Yt,oi)}}y.resetStencilClippingMasks()})(c,t,o,u),c.style.map.triggerRepaint())},background:function(c,t,o,u){const p=o.paint.get("background-color"),g=o.paint.get("background-color-use-theme").constantOr("default")==="none",y=o.paint.get("background-opacity"),b=o.paint.get("background-emissive-strength"),T=o.paint.get("background-pitch-alignment")==="viewport";if(y===0)return;const C=c.context,I=C.gl,B=c.transform,L=B.tileSize,N=o.paint.get("background-pattern");let H;if(N!==void 0&&(N===null||(H=c.imageManager.getPattern(a.I.from(N.toString()),o.scope,c.style.getLut(o.scope)),!H)))return;const j=!N&&p.a===1&&y===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==j)return;const q=yi.disabled,W=c.depthModeForSublayer(0,j==="opaque"?ti.ReadWrite:ti.ReadOnly),ne=c.colorModeForDrapableLayerRenderPass(b),ie=N?"backgroundPattern":"background";let ee,xe=u;xe||(ee=c.getBackgroundTiles(),xe=Object.values(ee).map(ye=>ye.tileID)),N&&(C.activeTexture.set(I.TEXTURE0),c.imageManager.bind(c.context,o.scope));const me=[];if(c.terrain&&c.terrain.renderingToTexture&&c.emissiveMode==="mrt-fallback"&&me.push("USE_MRT1"),T){const ye=c.getOrCreateProgram(ie,{overrideFog:!1,overrideRtt:!0,defines:me}),de=new Float32Array(a.bA([])),se=new a.aQ(0,0,0,0,0),Te=N?jo(de,b,y,c,0,o.scope,H,T,{tileID:se,tileSize:L}):hl(de,b,y,p.toPremultipliedRenderColor(g?null:o.lut));return void ye.draw(c,I.TRIANGLES,W,q,ne,di.disabled,Te,o.id,c.viewportBuffer,c.quadTriangleIndexBuffer,c.viewportSegments)}for(const ye of xe){const de=c.isTileAffectedByFog(ye),se=c.getOrCreateProgram(ie,{overrideFog:de,defines:me}),Te=ye.toUnwrapped(),Ae=u?ye.projMatrix:c.transform.calculateProjMatrix(Te);c.prepareDrawTile();const Re=t?t.getTile(ye):ee?ee[ye.key]:new Al(ye,L,B.zoom,c),Be=N?jo(Ae,b,y,c,0,o.scope,H,T,{tileID:ye,tileSize:L}):hl(Ae,b,y,p.toPremultipliedRenderColor(g?null:o.lut));c.uploadCommonUniforms(C,se,Te);const{tileBoundsBuffer:Le,tileBoundsIndexBuffer:$e,tileBoundsSegments:ot}=c.getTileBoundsBuffers(Re);se.draw(c,I.TRIANGLES,W,q,ne,di.disabled,Be,o.id,Le,$e,ot)}},sky:function(c,t,o){const u=c._atmosphere?a.aj(c.transform.zoom):1,p=o.paint.get("sky-opacity")*u;if(p===0)return;const g=c.context,y=o.paint.get("sky-type"),b=new ti(g.gl.LEQUAL,ti.ReadOnly,[0,1]),T=c.frameCounter/1e3%1;y==="atmosphere"?c.renderPass==="offscreen"?o.needsSkyboxCapture(c)&&((function(C,I){const B=C.context,L=B.gl;let N=I.skyboxFbo;if(!N){N=I.skyboxFbo=B.createFramebuffer(32,32,1,null),I.skyboxGeometry=new ia(B),I.skyboxTexture=B.gl.createTexture(),L.bindTexture(L.TEXTURE_CUBE_MAP,I.skyboxTexture),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MAG_FILTER,L.LINEAR);for(let W=0;W<6;++W)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,L.RGBA,32,32,0,L.RGBA,L.UNSIGNED_BYTE,null)}B.bindFramebuffer.set(N.framebuffer),B.viewport.set([0,0,32,32]);const H=I.getCenter(C,!0),j=C.getOrCreateProgram("skyboxCapture"),q=new Float64Array(16);a.bA(q),a.en(q,q,.5*-Math.PI),Zl(C,I,j,q,H,0),a.bA(q),a.en(q,q,.5*Math.PI),Zl(C,I,j,q,H,1),a.bA(q),a.cU(q,q,.5*-Math.PI),Zl(C,I,j,q,H,2),a.bA(q),a.cU(q,q,.5*Math.PI),Zl(C,I,j,q,H,3),a.bA(q),Zl(C,I,j,q,H,4),a.bA(q),a.en(q,q,Math.PI),Zl(C,I,j,q,H,5),B.viewport.set([0,0,C.width,C.height])})(c,o),o.markSkyboxValid(c)):c.renderPass==="sky"&&(function(C,I,B,L,N){const H=C.context,j=H.gl,q=C.transform,W=C.getOrCreateProgram("skybox");H.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_CUBE_MAP,I.skyboxTexture);const ne=((ie,ee,xe,me,ye)=>({u_matrix:ie,u_sun_direction:ee,u_cubemap:0,u_opacity:me,u_temporal_offset:ye}))(q.skyboxMatrix,I.getCenter(C,!1),0,L,N);C.uploadCommonUniforms(H,W),W.draw(C,j.TRIANGLES,B,yi.disabled,C.colorModeForRenderPass(),di.backCW,ne,"skybox",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)})(c,o,b,p,T):y==="gradient"&&c.renderPass==="sky"&&(function(C,I,B,L,N){const H=C.context,j=H.gl,q=C.transform,W=C.getOrCreateProgram("skyboxGradient");I.skyboxGeometry||(I.skyboxGeometry=new ia(H)),H.activeTexture.set(j.TEXTURE0);let ne=I.colorRampTexture;ne||(ne=I.colorRampTexture=new a.T(H,I.colorRamp,j.RGBA8)),ne.bind(j.LINEAR,j.CLAMP_TO_EDGE);const ie=((ee,xe,me,ye,de)=>({u_matrix:ee,u_color_ramp:0,u_center_direction:xe,u_radius:a.an(me),u_opacity:ye,u_temporal_offset:de}))(q.skyboxMatrix,I.getCenter(C,!1),I.paint.get("sky-gradient-radius"),L,N);C.uploadCommonUniforms(H,W),W.draw(C,j.TRIANGLES,B,yi.disabled,C.colorModeForRenderPass(),di.backCW,ie,"skyboxGradient",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)})(c,o,b,p,T)},custom:function(c,t,o,u){const p=c.context,g=o.implementation;if(!c.transform.projection.unsupportedLayers||!c.transform.projection.unsupportedLayers.includes("custom")||c.terrain&&(c.terrain.renderingToTexture||c.renderPass==="offscreen")&&o.isDraped(t)){if(c.renderPass==="offscreen"){const y=g.prerender;if(y){if(c.setCustomLayerDefaults(),p.setColorMode(c.colorModeForRenderPass()),c.transform.projection.name==="globe"){const b=c.transform.pointMerc;y.call(g,p.gl,c.transform.customLayerMatrix(),c.transform.getProjection(),c.transform.globeToMercatorMatrix(),a.aj(c.transform.zoom),[b.x,b.y],c.transform.pixelsPerMeterRatio)}else y.call(g,p.gl,c.transform.customLayerMatrix());p.setDirty(),c.setBaseState()}}else if(c.renderPass==="translucent"){if(c.terrain&&c.terrain.renderingToTexture){const b=g.renderToTile;if(b){const T=u[0].canonical,C={x:T.x+u[0].wrap*(g.wrapTileId?0:1<<T.z),y:T.y,z:T.z};p.setDepthMode(ti.disabled),p.setStencilMode(yi.disabled),p.setColorMode(c.colorModeForRenderPass()),c.setCustomLayerDefaults(),b.call(g,p.gl,C),p.setDirty(),c.setBaseState()}return}c.setCustomLayerDefaults(),p.setColorMode(c.colorModeForRenderPass()),p.setStencilMode(yi.disabled);const y=g.renderingMode==="3d"?new ti(c.context.gl.LEQUAL,ti.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,ti.ReadOnly);if(p.setDepthMode(y),c.transform.projection.name==="globe"){const b=c.transform.pointMerc;g.render(p.gl,c.transform.customLayerMatrix(),c.transform.getProjection(),c.transform.globeToMercatorMatrix(),a.aj(c.transform.zoom),[b.x,b.y],c.transform.pixelsPerMeterRatio)}else g.render(p.gl,c.transform.customLayerMatrix());p.setDirty(),c.setBaseState(),p.bindFramebuffer.set(null)}}else a.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(c,t,o,u){if(c.renderPass==="opaque")return;const p=o.paint.get("model-opacity").constantOr(1),g=o.paint.get("model-elevation-reference"),y=g==="ground",b=g==="ground";if(p===0)return;const T=o.paint.get("model-cast-shadows");if(c.renderPass==="shadow"&&(!T||c.terrain&&p<.65&&o._transitionablePaint._values["model-opacity"].value.expression instanceof a.ad))return;const C=c.shadowRenderer,I=o.paint.get("model-receive-shadows");C&&(C.useNormalOffset=!0,I||(C.enabled=!1));const B=()=>{C&&(C.useNormalOffset=!0,I||(C.enabled=!0))},L=t.getSource();if(c.renderPass==="light-beam"&&L.type!=="batched-model")return;if(L.type==="vector"||L.type==="geojson")return(function(ee,xe,me,ye,de){const se=ee.transform,Te=se.projection.name==="globe",Ae=se.getFreeCameraOptions().position;if(!ee.modelManager)return;const Re=ee.modelManager;me.modelManager=Re;const Be=ee.shadowRenderer;if(!me._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Le=me._unevaluatedLayout._values["model-id"],$e=Object.assign({},me.layout.get("model-id").parameters),ot=ee.style.order.indexOf(me.fqid),Fe=me.paint.get("model-opacity").constantOr(1);for(const Se of ye){const Ke=xe.getTile(Se).getBucket(me);if(!Ke||Ke.projection.name!==se.projection.name)continue;const Ve=Ke.getModelUris();if(Ve&&!Ke.modelsRequested&&(Re.addModelsFromBucket(Ve,de),Ke.modelsRequested=!0),Te)$e.zoom=Se.overscaledZ;else{const Ft=It(Se,se);$e.zoom=Ft}const it=Le.possiblyEvaluate($e);if(Ec(ee,Ke,Se),qo.shadowUniformsInitialized=!1,qo.useSingleShadowCascade=!!Be&&Be.getMaxCascadeForTile(Se.toUnwrapped())===0,ee.renderPass==="shadow"&&Be){if(ee.currentShadowCascade===1&&Ke.isInsideFirstShadowMapFrustum)continue;const Ft=se.calculatePosMatrix(Se.toUnwrapped(),se.worldSize);if(qo.tileMatrix.set(Ft),qo.shadowTileMatrix=Float32Array.from(Be.calculateShadowPassMatrixFromMatrix(Ft)),qo.aabb.min=[0,0,0],qo.aabb.max[0]=qo.aabb.max[1]=a.al,qo.aabb.max[2]=0,qn(Ke,qo,ee,me.scope))continue}const Et=1<<Se.canonical.z,Bt=[((Ae.x-Se.wrap)*Et-Se.canonical.x)*a.al,(Ae.y*Et-Se.canonical.y)*a.al,Ae.z*Et*a.al];ee.conflationActive&&Object.keys(Ke.instancesPerModel).length>0&&ee.style.isLayerClipped(me,xe.getSource())&&Ke.updateReplacement(Se,ee.replacementSource,ot,me.scope)&&(Ke.uploaded=!1,Ke.upload(ee.context));let Ct=0;const At=new Array,Qt=new Array,Wt=new Array;for(let Ft in Ke.instancesPerModel){const Yt=Ke.instancesPerModel[Ft];Yt.features.length>0&&!Te&&(Ft=it.evaluate(Yt.features[0].feature,{}));const oi=Re.getModel(Ft,de);if(oi||Re.hasURLBeenRequested(Ft)||Ke.modelUris.includes(Ft)||(Ke.modelUris.push(Ft),Ke.modelsRequested=!1),oi&&oi.uploaded)if(Te){const fi=a.c5([],[Ae.x,Ae.y,Ae.z],ee.transform.worldSize);a.ew(fi,fi);for(let Ri=0;Ri<Yt.instancedDataArray.length;++Ri){const Hi=[0,0,0],pi=[1,1,1],zi=a.ex(),wi=Yt.tileCoordinatesForInstance(Ri),an=Yt.transformForInstance(Ri);a.ey(pi,an),a.ez(zi,an),a.eA(Hi,zi);const tn=Yt.translationForInstance(Ri),gn=new a.aT(0,0);a.eB(Ke.canonical,gn,wi.x,wi.y);const Yi=a.bC();a.eC(Yi,oi,ee.transform,gn,Hi,pi,tn,!0,!1,!1);const Di=Yt.colorForInstance(Ri),rn=a.bA([]),Fn=a.ef(gn.lat,ee.transform.zoom),_n=a.bq([],[1,1,1/Fn]);a.br(rn,rn,fi),Wt.push({zScaleMatrix:_n,negCameraPosMatrix:rn});for(const un of oi.nodes)cu(ee,un,Yi,ee.transform.expandedFarZProjMatrix,Ct,At,Qt,oi.materialOverrides,Fe,Di);++Ct}}else for(const fi of oi.nodes)Ut(ee,me,fi,Yt,Bt,Se,qo)}if(Te)if(ee.renderPass==="shadow"){for(const Ft of Qt)ch(Ft.mesh,Ft.nodeModelMatrix,ee,me);for(const Ft of At)ch(Ft.mesh,Ft.nodeModelMatrix,ee,me)}else Af(ee,me,At,Qt,Wt)}})(c,t,o,u,lh(c,o)),void B();if(!L.loaded())return;if(L.type==="batched-model")return(function(ee,xe,me,ye){me.resetLayerRenderingStats(ee);const de=ee.context,se=ee.transform,Te=ee.style.fog,Ae=ee.shadowRenderer;if(se.projection.name!=="mercator")return void a.w(`Drawing 3D landmark models for ${se.projection.name} projection is not yet implemented`);const Re=ee.transform.getFreeCameraOptions().position,Be=a.c5([],[Re.x,Re.y,Re.z],ee.transform.worldSize),Le=a.ew([],Be),$e=a.bA([]),ot=a.ef(se.center.lat,se.zoom),Fe=a.bq([],[1,1,1/ot]);a.br($e,$e,Le);const Se=me.paint.get("model-opacity").constantOr(1),Ke=new ti(de.gl.LEQUAL,ti.ReadWrite,ee.depthRangeFor3D),Ve=new ti(de.gl.LEQUAL,ti.ReadOnly,ee.depthRangeFor3D),it=new a.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Et=ee.renderPass==="shadow",Bt=Et&&Ae?Ae.getCurrentCascadeFrustum():se.getFrustum(se.scaleZoom(se.worldSize)),Ct=me.paint.get("model-front-cutoff"),At=Ct[2]<1,Qt=Va(ee,me.paint.get("model-cutoff-fade-range")),Wt
3207=me.getLayerRenderingStats();(function(Ft,Yt,oi,fi){const Ri=Ft.terrain?Ft.terrain.exaggeration():0,Hi=Ft.transform.zoom;for(const pi of fi){const zi=Yt.getTile(pi).getBucket(oi);zi&&(zi.setFilter(oi.filter),Ft.conflationActive&&zi.updateReplacement(pi,Ft.replacementSource),zi.evaluateTransform(Ft,oi),Ft.terrain&&Ri>0&&zi.elevationUpdate(Ft.terrain,Ri,pi,oi.source),zi.needsReEvaluation(Ft,Hi,oi)&&zi.evaluate(oi))}})(ee,xe,me,ye),(function(){let Ft,Yt,oi;At?(Ft=ye.length-1,Yt=-1,oi=-1):(Ft=0,Yt=ye.length,oi=1);const fi=new Float64Array(16),Ri=a.cA(),Hi=new a.P(0,0);for(let pi=Ft;pi!==Yt;pi+=oi){const zi=ye[pi],wi=xe.getTile(zi).getBucket(me);if(!wi||!wi.uploaded)continue;let an=!1;Ae&&(an=Ae.getMaxCascadeForTile(zi.toUnwrapped())===0);const tn=se.calculatePosMatrix(zi.toUnwrapped(),se.worldSize),gn=wi.modelTraits;!Et&&At&&(a.bl(fi,tn),a.af(Ri,Be,fi),Hi.x=Ri[0],Hi.y=Ri[1]);const Yi=[];wi.setFilter(me.filter);for(const Di of wi.getNodesInfo()){if(Di.hiddenByReplacement||!Di.node.meshes)continue;const rn=Di.node;let Fn=0;ee.terrain&&rn.elevation&&(Fn=rn.elevation*ee.terrain.exaggeration());const _n=(()=>{const hn=Di.aabb;return it.min=[...hn.min],it.max=[...hn.max],it.min[2]+=Fn,it.max[2]+=Fn,a.af(it.min,it.min,tn),a.af(it.max,it.max,tn),it})(),un=Di.evaluatedScale;if(un[0]<=1&&un[1]<=1&&un[2]<=1&&_n.intersects(Bt)===0)continue;if(!Et&&At){const hn=.16666666666666666;Di.cameraCollisionOpacity=Be[0]>_n.min[0]&&Be[0]<_n.max[0]&&Be[1]>_n.min[1]&&Be[1]<_n.max[1]&&Be[2]*ot<_n.max[2]&&rn.footprint&&a.c0(Hi,rn.footprint)?Math.max(Di.cameraCollisionOpacity-hn,0):Math.min(1,Di.cameraCollisionOpacity+hn)}const Ci=[...tn],Pi=1/a.d7(zi.canonical),Mn=rn.anchor?rn.anchor[0]:0,Jn=rn.anchor?rn.anchor[1]:0;a.br(Ci,Ci,[Mn*(un[0]-1)+Di.evaluatedTranslation[0]*Pi,Jn*(un[1]-1)+Di.evaluatedTranslation[1]*Pi,Fn+Di.evaluatedTranslation[2]]),a.cq(un,a.eE)||a.cS(Ci,Ci,un);const xn=a.aB([],Ci,rn.globalMatrix),Cn=a.aB([],se.expandedFarZProjMatrix,xn),Ro=a.aB([],se.expandedFarZProjMatrix,Ci),co=a.aC([],[Mn,Jn,Fn,1],Cn)[2];rn.hidden=!1;let Zr=Se;Et||(At&&(Zr*=Di.cameraCollisionOpacity,Zr*=Lp(Ci,se,Di.aabb,Ct)),Zr*=Oe(Qt,co)),Zr!==0?Yi.push({nodeInfo:Di,depth:co,opacity:Zr,wvpForNode:Cn,wvpForTile:Ro,nodeModelMatrix:xn,tileModelMatrix:Ci}):rn.hidden=!0}Et||Yi.sort((Di,rn)=>!At||Di.opacity===1&&rn.opacity===1?Di.depth<rn.depth?-1:1:Di.opacity===1?-1:rn.opacity===1?1:Di.depth>rn.depth?-1:1);for(const Di of Yi){const rn=Di.nodeInfo,Fn=rn.node;let _n=a.aB([],Fe,Di.tileModelMatrix);a.aB(_n,$e,_n);const un=a.bl([],_n);a.eg(un,un),a.cS(un,un,uu),_n=a.aB(_n,_n,Fn.globalMatrix);const Ci=ee.renderPass==="light-beam",Pi=me.paint.get("model-color-use-theme").constantOr("default")==="none",Mn=gn&a.eI.HasMapboxMeshFeatures,Jn=Mn?0:rn.evaluatedRMEA[0][2];for(let xn=0;xn<Fn.meshes.length;++xn){const Cn=Fn.meshes[xn],Ro=xn===Fn.lightMeshIndex;let co=Di.wvpForNode;if(Ro){if(!Ci&&!ee.terrain&&ee.shadowRenderer){ee.currentLayer<ee.firstLightBeamLayer&&(ee.firstLightBeamLayer=ee.currentLayer);continue}co=Di.wvpForTile}else if(Ci)continue;const Zr={defines:[]},hn=[];if(!Et&&Ae&&(Ae.useNormalOffset=!!Cn.normalBuffer),Ia(Zr.defines,hn,Cn,ee,Pi?null:me.lut),Mn||Zr.defines.push("DIFFUSE_SHADED"),an&&Zr.defines.push("SHADOWS_SINGLE_CASCADE"),Wt&&(Et?Wt.numRenderedVerticesInShadowPass+=Cn.vertexArray.length:Wt.numRenderedVerticesInTransparentPass+=Cn.vertexArray.length),Et){ch(Cn,Di.nodeModelMatrix,ee,me);continue}let ga=null;if(Te){const yr=Ef(Di.nodeModelMatrix,ee.transform);if(ga=new Float32Array(yr),se.projection.name!=="globe"){const Dn=Cn.aabb.min,Sr=Cn.aabb.max,[Vr,Yn]=Te.getOpacityForBounds(yr,Dn[0],Dn[1],Sr[0],Sr[1]);Zr.overrideFog=Vr>=Zt||Yn>=Zt}}const uo=Cn.material;let go;uo.occlusionTexture&&uo.occlusionTexture.offsetScale&&(go=uo.occlusionTexture.offsetScale,Zr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Pa=ee.getOrCreateProgram("model",Zr);!Et&&Ae&&Ae.setupShadowsFromMatrix(Di.tileModelMatrix,Pa,Ae.useNormalOffset),ee.uploadCommonUniforms(de,Pa,null,ga);const na=uo.pbrMetallicRoughness;na.metallicFactor=.9,na.roughnessFactor=.5;const Zn=Ls(new Float32Array(co),new Float32Array(_n),new Float32Array(un),new Float32Array(Fn.globalMatrix),ee,Di.opacity,na.baseColorFactor,uo.emissiveFactor,na.metallicFactor,na.roughnessFactor,uo,Jn,me,[0,0,0],go);!Ro&&(rn.hasTranslucentParts||Di.opacity<1)&&Pa.draw(ee,de.gl.TRIANGLES,Ke,yi.disabled,bi.disabled,di.backCCW,Zn,me.id,Cn.vertexBuffer,Cn.indexBuffer,Cn.segments,me.paint,ee.transform.zoom,void 0,hn),Pa.draw(ee,de.gl.TRIANGLES,Ro?Ve:Ke,yi.disabled,Ro||Di.opacity<1||rn.hasTranslucentParts?bi.alphaBlended:bi.unblended,di.backCCW,Zn,me.id,Cn.vertexBuffer,Cn.indexBuffer,Cn.segments,me.paint,ee.transform.zoom,void 0,hn)}}}})()})(c,t,o,u),void B();if(L.type!=="model")return;const N=L.getModels(),H=[],j=c.transform.getFreeCameraOptions().position,q=a.c5([],[j.x,j.y,j.z],c.transform.worldSize);a.ew(q,q);const W=[],ne=[];let ie=0;for(const ee of N){const xe=t.getFeatureState("",ee.id),me={type:"Unknown",id:ee.id,properties:ee.featureProperties},ye=o.paint.get("model-rotation").evaluate(me,xe),de=o.paint.get("model-scale").evaluate(me,xe),se=o.paint.get("model-translation").evaluate(me,xe),Te=o.paint.get("model-opacity").evaluate(me,xe);Dp(o,ee.id,xe,ee.featureProperties,ee.nodeOverrideNames,ee.nodeOverrides),Pp(o,ee.id,xe,ee.featureProperties,ee.materialOverrideNames,ee.materialOverrides),ee.nodeOverrides.size>0&&ee.computeBoundsAndApplyParent(),ee.computeModelMatrix(c,ye,de,se,b,y,!1);const Ae=a.bA([]),Re=a.ef(ee.position.lat,c.transform.zoom),Be=a.bq([],[1,1,1/Re]);a.br(Ae,Ae,q),H.push({zScaleMatrix:Be,negCameraPosMatrix:Ae});for(const Le of ee.nodes)cu(c,Le,ee.matrix,c.transform.expandedFarZProjMatrix,ie,W,ne,ee.materialOverrides,Te);ie++}if(W.sort((ee,xe)=>xe.depth-ee.depth),c.renderPass!=="shadow")Af(c,o,W,ne,H),B();else{for(const ee of ne)ch(ee.mesh,ee.nodeModelMatrix,c,o);for(const ee of W)ch(ee.mesh,ee.nodeModelMatrix,c,o);B()}}},If={line:function(c,t,o){if(c.hasElevatedBuckets=!1,c.hasNonElevatedBuckets=!1,c._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||c._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const u=t.getVisibleCoordinates();for(const p of u){const g=t.getTile(p).getBucket(c);if(g&&(g.elevationType!=="none"?c.hasElevatedBuckets=!0:c.hasNonElevatedBuckets=!0,c.hasElevatedBuckets&&c.hasNonElevatedBuckets))break}}}else c.hasNonElevatedBuckets=!0},model:function(c,t,o){const u=t.getSource();if(!u.loaded())return;if(u.type==="vector"||u.type==="geojson")return void(o.modelManager&&o.modelManager.upload(o,lh(o,c)));if(u.type==="batched-model"||u.type!=="model")return;const p=u.getModels();for(const g of p)g.upload(o.context)},raster:function(c,t,o){const u=t.getSource();if(!(u instanceof Fo&&u.loaded()))return;const p=c.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!p)return;const g=c.paint.get("raster-array-band")||u.getInitialBand(p);if(g==null)return;const y=t.getIds().map(b=>t.getTileByID(b));for(const b of y)b.updateNeeded(c.id,g)&&u.prepareTile(b,p,c.id,g)},"raster-particle":function(c,t,o){const u=t.getSource();if(!(u instanceof Fo&&u.loaded()))return;const p=c.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!p)return;const g=c.paint.get("raster-particle-array-band")||u.getInitialBand(p);if(g==null)return;const y=t.getIds().map(b=>t.getTileByID(b));for(const b of y)b.updateNeeded(c.id,g)&&u.prepareTile(b,p,c.id,g)}},Ed={fill:Sp},kp={fill:function(c,t,o,u){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const p=c.context.gl,g=new ti(p.LEQUAL,ti.ReadOnly,c.depthRangeFor3D),y=new yi({func:p.ALWAYS,mask:255},255,255,p.KEEP,p.KEEP,p.REPLACE),b=c.transform.getFreeCameraOptions().position,T=c.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const C of u){const I=t.getTile(C),B=I.getBucket(o);if(!B)continue;const L=B.elevatedStructures;if(!L||L.depthSegments.segments[0].primitiveLength===0)continue;const N=bc(C.toUnwrapped(),b),H=c.translatePosMatrix(C.projMatrix,I,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),j=yc(H,N,0,1,0);T.draw(c,p.TRIANGLES,g,y,bi.disabled,di.disabled,j,o.id,L.vertexBuffer,L.indexBuffer,L.depthSegments,o.paint,c.transform.zoom)}}};class Rf{constructor(t,o,u,p,g){this.context=new ps(t,o),this.transform=u,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=a.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const y=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const T of y)this._debugParams.enabledLayers[T]=!0;for(const T of y);this.occlusionParams=new Cf,this.setup(),this.numSublayers=Nr.maxUnderzooming+Nr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Wh(this),this._wireframeDebugCache=new vd,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const b=new a.q({width:1,height:1},Uint8Array.of(0,0,0,0));
vendor: 5,201 bytes, line 3207
3207this.emptyDepthTexture=new a.T(this.context,b,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=p,this.worldview=g,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(t,o){const u=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(u||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new ih(this,t));const p=this._terrain;this.transform.elevation=u?p:null,p.update(t,this.transform,o),this.transform.elevation&&!p.enabled&&(this.transform.elevation=null)}_updateFog(t){const o=t.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[u,p]=o.getFovAdjustedRange(this.transform._fov);if(u>p)return void(this.transform.fogCullDistSq=null);const g=u+.78*(p-u);this.transform.fogCullDistSq=g*g}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new ih(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,o){if(this.width=t*a.o.devicePixelRatio,this.height=o*a.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style.order)this.style._mergedLayers[u].resize()}setup(){const t=this.context,o=new a.bd;o.emplaceBack(0,0),o.emplaceBack(a.al,0),o.emplaceBack(0,a.al),o.emplaceBack(a.al,a.al),this.tileExtentBuffer=t.createVertexBuffer(o,a.bf.members),this.tileExtentSegments=a.bg.simpleSegment(0,0,4,2);const u=new a.bd;u.emplaceBack(0,0),u.emplaceBack(a.al,0),u.emplaceBack(0,a.al),u.emplaceBack(a.al,a.al),this.debugBuffer=t.createVertexBuffer(u,a.bf.members),this.debugSegments=a.bg.simpleSegment(0,0,4,5);const p=new a.bd;p.emplaceBack(-1,-1),p.emplaceBack(1,-1),p.emplaceBack(-1,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,a.bf.members),this.viewportSegments=a.bg.simpleSegment(0,0,4,2);const g=new a.b1;g.emplaceBack(0,0,0,0),g.emplaceBack(a.al,0,a.al,0),g.emplaceBack(0,a.al,0,a.al),g.emplaceBack(a.al,a.al,a.al,a.al),this.mercatorBoundsBuffer=t.createVertexBuffer(g,a.bi.members),this.mercatorBoundsSegments=a.bg.simpleSegment(0,0,4,2);const y=new a.b0;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const b=new a.be;for(const C of[0,1,3,2,0])b.emplaceBack(C);this.debugIndexBuffer=t.createIndexBuffer(b),this.emptyTexture=new a.T(t,new a.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=a.bC();const T=this.context.gl;this.stencilClearMode=new yi({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,ti.disabled,this.stencilClearMode,bi.disabled,di.disabled,th(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,o,u){if(!o||this.currentStencilSource===o.id||!t.isTileClipped()||!u||u.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let b=!1;for(const T of u)if(this._tileClippingMaskIDs[T.key]===void 0){b=!0;break}if(!b)return}this.currentStencilSource=o.id;const p=this.context,g=p.gl;this.nextStencilID+u.length>256&&this.clearStencil(),p.setColorMode(bi.disabled),p.setDepthMode(ti.disabled);const y=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const b of u){const T=o.getTile(b),C=this._tileClippingMaskIDs[b.key]=this.nextStencilID++,{tileBoundsBuffer:I,tileBoundsIndexBuffer:B,tileBoundsSegments:L}=this.getTileBoundsBuffers(T);y.draw(this,g.TRIANGLES,ti.disabled,new yi({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),bi.disabled,di.disabled,th(b.projMatrix),"$clipping",I,B,L)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new yi({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const o=this.context.gl;return new yi({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,u=t.sort((y,b)=>
3207b.overscaledZ-y.overscaledZ),p=u[u.length-1].overscaledZ,g=u[0].overscaledZ-p+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const y={};for(let b=0;b<g;b++)y[b+p]=new yi({func:o.GEQUAL,mask:255},b+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=g,[y,u]}return[{[p]:yi.disabled},u]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new bi([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new a.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?bi.unblended:bi.alphaBlended}colorModeForDrapableLayerRenderPass(t){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?t!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new bi([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new a.ao(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new bi([o.ONE,o.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,o.ONE_MINUS_SRC_ALPHA],a.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,o,u,p=!1){if(this.depthOcclusion)return new ti(this.context.gl.GREATER,ti.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!p)return ti.disabled;const g=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ti(u||this.context.gl.LEQUAL,o,[g,g])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,o=Math.ceil(this.width),u=Math.ceil(this.height),p=this.context.bindFramebuffer.get(),g=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===o&&this.depthFBO.height===u||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),o!==0&&u!==0&&(this.depthFBO=new dl(this.context,o,u,0,"texture"),this.depthTexture=new a.T(this.context,{width:o,height:u,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(p),t.bindTexture(t.TEXTURE_2D,g),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,o,u,0,0,o,u,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,o)=>t+o/this._fpsHistory.length,0))}render(t,o){const u=a.o.now();this._dt=u-this._timeStamp,this._timeStamp=u,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=o;const p=this.style._mergedLayers,g=!(!this.terrain||!this.terrain.enabled),y=()=>this.style._getOrder(g).filter(Fe=>{const Se=p[Fe];return!(Se.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Se.type]});let b=y(),T=!1,C=!1,I=null,B=0,L=!1;for(const Fe of b){const Se=p[Fe];Se.visibility!=="none"&&(Se.type==="circle"?T=!0:Se.type==="building"?(I=Se,++B):Se.type==="symbol"&&(Se.hasOcclusionOpacityProperties?C=!0:T=!0))}this.updateEmissiveMode();let N=b.map(Fe=>p[Fe]);const H=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.o.now()),this.imageManager.beginFrame();for(const Fe in H){const Se=H[Fe];Se.used&&(Se.prepare(this.context),Se.getSource().usedInConflation&&++B)}let j=!1;for(const Fe of N)Fe.isHidden(this.transform.zoom)||(Fe.type==="clip"&&(j=!0),this.prepareLayer(Fe));const q={},W={},ne={},ie={},ee={};for(const Fe in H){const Se=H[Fe];q[Fe]=Se.getVisibleCoordinates(),W[Fe]=q[Fe].slice().reverse(),ne[Fe]=Se.getVisibleCoordinates(!0).reverse(),ie[Fe]=Se.getShadowCasterCoordinates(),ee[Fe]=Se.sortCoordinatesByDistance(q[Fe])}const xe=Fe=>{const Se=this.style.getLayerSourceCache(Fe);return Se&&Se.used?Se.getSource():null};if(B||j||this._clippingActiveLastFrame){const Fe=[],Se=[];let Ke=0;for(const Ve of N)this.isSourceForClippingOrConflation(Ve,xe(Ve))&&(Fe.push(Ve),Se.push(Ke)),Ke++;if(Fe&&(j||Fe.length>1)||this._clippingActiveLastFrame){j=!1;const Ve=[];for(let it=0;
vendor: 110,356 bytes, lines 3207-3212
3207it<Fe.length;it++){const Et=Fe[it],Bt=Se[it],Ct=this.style.getLayerSourceCache(Et);if(!Ct||!Ct.used||!Ct.getSource().usedInConflation&&Et.type!=="clip"&&Et.type!=="building")continue;let At=a.eQ,Qt=a.b_.None;const Wt=[];let Ft=!0;if(Et.type==="building")At=a.eS;else if(Et.type==="clip")if(At=Bt,Et.isHidden(this.transform.zoom))Ft=!1;else{if(!Et.layout){Ft=!1;continue}for(const Yt of Et.layout.get("clip-layer-types"))Qt|=Yt==="model"?a.b_.Model:Yt==="symbol"?a.b_.Symbol:a.b_.FillExtrusion;for(const Yt of Et.layout.get("clip-layer-scope"))Wt.push(Yt);j=!0}Ft&&Ve.push({layer:Et.fqid,cache:Ct,order:At,clipMask:Qt,clipScope:Wt})}this.replacementSource.setSources(Ve),L=!0}}this._clippingActiveLastFrame=j,L||this.replacementSource.clear(),this.conflationActive=L,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Fe=0;Fe<N.length;Fe++){const Se=N[Fe];if(Se.visibility==="none")continue;const Ke=Se.cutoffRange();if(this.longestCutoffRange=Math.max(Ke,this.longestCutoffRange),Ke>0){const Ve=xe(Se);Ve&&(this.minCutoffZoom=Math.max(Ve.minzoom,this.minCutoffZoom)),Se.minzoom&&(this.minCutoffZoom=Math.max(Se.minzoom,this.minCutoffZoom))}Se.is3D(g)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Fe),this._lastOcclusionLayer=Fe)}const me=this.style&&this.style.fog;me?(this._fogVisible=me.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=me.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(ne),this.opaquePassCutoff=0,b=y(),N=b.map(Fe=>p[Fe]));const ye=this._shadowRenderer;if(ye){ye.updateShadowParameters(this.transform,this.style.directionalLight);for(const Fe in H)for(const Se of q[Fe]){let Ke={min:0,max:0};this.terrain&&(Ke=this.terrain.getMinMaxForTile(Se)||Ke),ye.addShadowReceiver(Se.toUnwrapped(),Ke.min,Ke.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Sf(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const de=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),se=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(de&&!this._snow&&(this._snow=new hh(this)),!de&&this._snow&&(this._snow.destroy(),delete this._snow),se&&!this._rain&&(this._rain=new Td(this)),!se&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),I){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Sc);const Fe=this.style.getLayerSourceCache(I);this.buildingTileBorderManager.updateBorders(Fe,I)}if(!Qa.has(this.context.gl))return;this.renderPass="offscreen";for(const Fe of N){const Se=t.getLayerSourceCache(Fe);if(!Fe.hasOffscreenPass()||Fe.isHidden(this.transform.zoom))continue;const Ke=Se?W[Se.id]:void 0;(Fe.type==="custom"||Fe.type==="raster"||Fe.type==="raster-particle"||Fe.isSky()||Ke&&Ke.length)&&this.renderLayer(this,Se,Fe,Ke)}this.depthRangeFor3D=[0,1-(N.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,ie)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const Te=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Ae=(()=>{if(o.showOverdrawInspector)return a.ao.black;const Fe=this.style.fog;if(Fe&&this.transform.projection.supportsFog){const Se=this.style.getLut(Fe.scope);if(!Te){const Ke=Fe.properties.get("color-use-theme")==="none",Ve=Fe.properties.get("color").toNonPremultipliedRenderColor(Ke?null:Se).toArray01();return new a.ao(...Ve)}if(Te){const Ke=Fe.properties.get("space-color-use-theme")==="none",Ve=Fe.properties.get("space-color").toNonPremultipliedRenderColor(Ke?null:Se).toArray01();return new a.ao(...Ve)}}return a.ao.transparent})();if(this.context.clear({color:Ae,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Te&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=b.length-1;this.currentLayer>=0;this.currentLayer--){const Fe=N[this.currentLayer],Se=t.getLayerSourceCache(Fe);if(Fe.isSky())continue;const Ke=Se?(Fe.is3D(g)?ee:W)[Se.id]:void 0;this._renderTileClippingMasks(Fe,Se,Ke),this.renderLayer(this,Se,Fe,Ke)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Te&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<b.length;this.currentLayer++){const Fe=N[this.currentLayer],Se=t.getLayerSourceCache(Fe);Fe.isSky()&&this.renderLayer(this,Se,Fe,Se?W[Se.id]:void 0)}function Re(Fe,Se){let Ke;return Se&&(Ke=(Fe.type==="symbol"?ne:Fe.is3D(g)?ee:W)[Se.id]),Ke}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<b.length;){const Fe=N[this.currentLayer];if(Fe.type==="raster"||Fe.type==="raster-particle"){const Se=t.getLayerSourceCache(Fe);this.renderLayer(this,Se,Fe,Re(Fe,Se))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const Be=ye?ye.getGroundShadowLayerIndex():-1;let Le=!1,$e=-1;for(let Fe=0;Fe<b.length;++Fe){const Se=N[Fe];Se.isHidden(this.transform.zoom)||Se.is3D(g)&&($e=Fe)}C&&$e===-1&&(T=!0);let ot=!1;for(;this.currentLayer<b.length;){const Fe=N[this.currentLayer],Se=t.getLayerSourceCache(Fe);if(Fe.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(Fe)){if(Fe.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!ot&&Fe.is3D(g)&&!g){const Ke=this.currentLayer,Ve=it=>{for(this.currentLayer=0;this.currentLayer<N.length;this.currentLayer++){const Et=N[this.currentLayer];if(Ed[Et.type]){const Bt=this.style.getLayerSourceCache(Et);Ed[Et.type](this,Bt,Et,Re(Et,Bt),it)}}};Ve("initialize"),Ve("reset"),this.currentLayer=Ke,ot=!0}if(T&&!Le&&this.terrain&&!this.transform.isOrthographic&&(Le=!0,this.blitDepth()),C&&$e!==-1&&this.currentLayer===$e+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(Fe,Se,Se?q[Se.id]:void 0),this.renderLayer(this,Se,Fe,Re(Fe,Se)),!this.terrain&&ye&&this.currentLayer===Be){{this.clearStencil(),this.resetStencilClippingMasks();const Ke=this.currentLayer;for(this.currentLayer=0;this.currentLayer<N.length;this.currentLayer++){const Ve=N[this.currentLayer];if(kp[Ve.type]){const it=this.style.getLayerSourceCache(Ve);kp[Ve.type](this,it,Ve,Re(Ve,it))}}this.currentLayer=Ke}if(ye.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Ke=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Ke;this.currentLayer++){const Ve=N[this.currentLayer];if(!Ve.hasLightBeamPass())continue;const it=t.getLayerSourceCache(Ve);this.renderLayer(this,it,Ve,it?W[it.id]:void 0)}this.currentLayer=Ke,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Ke=this.currentLayer;this.depthOcclusion=!0;for(const Ve of this.layersWithOcclusionOpacity){this.currentLayer=Ve;const it=N[this.currentLayer],Et=t.getLayerSourceCache(it),Bt=Et?W[Et.id]:void 0;this.terrain||this._renderTileClippingMasks(it,Et,Et?q[Et.id]:void 0),this.renderLayer(this,Et,it,Bt)}this.depthOcclusion=!1,this.currentLayer=Ke,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Fe=null;N.forEach(Se=>{const Ke=t.getLayerSourceCache(Se);Ke&&!Se.isHidden(this.transform.zoom)&&Ke.getVisibleCoordinates().length&&(!Fe||Fe.getSource().maxzoom<Ke.getSource().maxzoom)&&(Fe=Ke)}),Fe&&this.options.showTileBoundaries&&Ap(this,Fe,Fe.getVisibleCoordinates(),a.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Ap(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new a.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(function(Fe){const Se=Fe.transform.padding;Mp(Fe,Fe.transform.height-(Se.top||0),3,bf),Mp(Fe,Se.bottom||0,3,wf),Cp(Fe,Se.left||0,3,Tf),Cp(Fe,Fe.transform.width-(Se.right||0),3,Nm);const Ke=Fe.transform.centerPoint;(function(Ve,it,Et,Bt){xd(Ve,it-1,Et-10,2,20,Bt),xd(Ve,it-10,Et-1,20,2,Bt)})(Fe,Ke.x,Fe.transform.height-Ke.y,Um)})(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),L||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:o}=this.transform.projection,u=!o||!o.includes(t.type);if(If[t.type]&&(u||this.terrain&&t.type==="custom")){const p=this.style.getLayerSourceCache(t);If[t.type](t,p,this)}this.gpuTimingEnd()}renderLayer(t,o,u,p){u.isHidden(this.transform.zoom)||(u.type==="background"||u.type==="sky"||u.type==="custom"||u.type==="model"||u.type==="raster"||u.type==="raster-particle"||p&&p.length)&&(this.id=u.id,this.gpuTimingStart(u),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(u.type)&&(!t.terrain||u.type!=="custom")||u.type==="clip"||ks[u.type](t,o,u,p,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,u=this.context.gl;let p=this.gpuTimers[t.id];p||(p=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:u.createQuery()}),p.calls++,u.beginQuery(o.TIME_ELAPSED_EXT,p.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,o=this.context.gl,u=o.createQuery();this.deferredRenderGpuTimeQueries.push(u),o.beginQuery(t.TIME_ELAPSED_EXT,u)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const o={};for(const u in t){const p=t[u],g=this.context.extTimerQuery,y=g.getQueryParameter(p.query,this.context.gl.QUERY_RESULT)/1e6;g.deleteQueryEXT(p.query),o[u]=y}return o}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.gl;let u=0;for(const p of t)u+=o.getQueryParameter(p,o.QUERY_RESULT)/1e6,o.deleteQuery(p);return u}translatePosMatrix(t,o,u,p,g){if(!u[0]&&!u[1])return t;const y=g?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(y){const C=Math.sin(y),I=Math.cos(y);u=[u[0]*I-u[1]*C,u[0]*C+u[1]*I]}const b=[g?u[0]:a.ay(o,u[0],this.transform.zoom),g?u[1]:a.ay(o,u[1],this.transform.zoom),0],T=new Float32Array(16);return a.br(T,t,b),T}saveTileTexture(t){if(t.context!==this.context)return;const o=t.size[0],u=this._tileTextures[o];u?u.push(t):this._tileTextures[o]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,o,u){const p=u===void 0?this.terrain&&this.terrain.renderingToTexture:u,g=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(g.push("LIGHTING_3D_MODE"),g.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):p||g.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||g.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(g.push("TERRAIN"),this.linearFloatFilteringSupported()&&g.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&g.push("GLOBE"),!this._fogVisible||p||o!==void 0&&!o||g.push("FOG"),p&&g.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&g.push("OVERDRAW_INSPECTOR"),g}getOrCreateProgram(t,o){this.cache=this.cache||{};const u=o&&o.defines||[],p=o&&o.config,g=this.currentGlobalDefines(t,o&&o.overrideFog,o&&o.overrideRtt).concat(u),y=ld.cacheKey(uf[t],t,g,p);return this.cache[y]||(this.cache[y]=new ld(this.context,t,uf[t],p,pd[t],g)),this.cache[y]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,o){if(this.style.enable3dLights()){const u=this.style.directionalLight,p=this.style.ambientLight;if(u&&p){const g=((y,b,T)=>{const C=y.properties.get("direction"),I=y.properties.get("color-use-theme")==="none",B=y.properties.get("color").toNonPremultipliedRenderColor(I?null:T.getLut(y.scope)).toArray01(),L=y.properties.get("intensity"),N=b.properties.get("color-use-theme")==="none",H=b.properties.get("color").toNonPremultipliedRenderColor(N?null:T.getLut(b.scope)).toArray01(),j=b.properties.get("intensity"),q=[C.x,C.y,C.z],W=a.dN(H,j),ne=a.dN(B,L);return{u_lighting_ambient_color:W,u_lighting_directional_dir:q,u_lighting_directional_color:ne,u_ground_radiance:Qc(q,ne,W)}})(u,p,this.style);o.setLightsUniformValues(t,g)}}}uploadCommonUniforms(t,o,u,p,g){if(this.uploadCommonLightUniforms(t,o),this.terrain&&this.terrain.renderingToTexture)return;const y=this.style.fog;if(y){const b=y.getOpacity(this.transform.pitch),T=((C,I,B,L,N,H,j,q,W,ne,ie,ee)=>{const xe=C.transform,me=I.properties.get("color-use-theme")==="none",ye=I.properties.get("color").toNonPremultipliedRenderColor(me?null:C.style.getLut(I.scope)).toArray01();ye[3]=L;const de=C.frameCounter/1e3%1,[se,Te]=I.properties.get("vertical-range");return{u_fog_matrix:B?xe.calculateFogTileMatrix(B):ee||C.identityMat,u_fog_range:I.getFovAdjustedRange(xe._fov),u_fog_color:ye,u_fog_horizon_blend:I.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(se,Te),Te],u_fog_temporal_offset:de,u_frustum_tl:N,u_frustum_tr:H,u_frustum_br:j,u_frustum_bl:q,u_globe_pos:W,u_globe_radius:ne,u_viewport:ie,u_globe_transition:a.aj(xe.zoom),u_is_globe:+(xe.projection.name==="globe")}})(this,y,u,b,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.o.devicePixelRatio,this.transform.height*a.o.devicePixelRatio],p);o.setFogUniformValues(t,T)}g&&o.setCutoffUniformValues(t,g.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,o=this._backgroundTiles={},u=this.transform.coveringTiles({tileSize:512});for(const p of u)o[p.key]=t[p.key]||new Al(p,512,this.transform.tileZoom,this,void 0,this.worldview);return o}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,o){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!o||o.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[t.key];return o||(this._cachedTileFogOpacities[t.key]=o=this.style.fog.getOpacityForTile(t)),o[0]>=Zt||o[1]>=Zt}setupDepthForOcclusion(t,o,u){const p=this.context,g=p.gl,y=!!u;var b;u||(u={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),p.activeTexture.set(g.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE),u.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],u.u_depth_range_unpack=[2/((b=this.depthRangeFor3D)[1]-b[0]),-1-2*b[0]/(b[1]-b[0])],u.u_occluder_half_size=.5*this.occlusionParams.occluderSize,u.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE),p.activeTexture.set(g.TEXTURE0),y||o.setTerrainUniformValues(p,u)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function zf(c,t){let o=!1,u=null;const p=()=>{u=null,o&&(c(),u=setTimeout(p,t),o=!1)};return()=>(o=!0,u||p(),u)}class Zo{constructor(t){this._hashName=t&&encodeURIComponent(t),a.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=zf(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const o=Fp(t);if(this._hashName){const u=this._hashName;let p=!1;const g=location.hash.slice(1).split("&").map(y=>{const b=y.split("=")[0];return b===u?(p=!0,`${b}=${o}`):y}).filter(y=>y);return p||g.push(`${u}=${o}`),`#${g.join("&")}`}return`#${o}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let o;return t.split("&").map(u=>u.split("=")).forEach(u=>{u[0]===this._hashName&&(o=u)}),(o&&o[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(Number(u)))){const u=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(o[3]||0):t.getBearing();return t.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Fp(c,t){const o=c.getCenter(),u=Math.round(100*c.getZoom())/100,p=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,p),y=Math.round(o.lng*g)/g,b=Math.round(o.lat*g)/g,T=c.getBearing(),C=c.getPitch();let I=t?`/${y}/${b}/${u}`:`${u}/${b}/${y}`;return(T||C)&&(I+="/"+Math.round(10*T)/10),C&&(I+=`/${Math.round(C)}`),I}const za={linearity:.3,easing:a.eT(0,0,.3,1)},Gm=Object.assign({deceleration:2500,maxSpeed:1400},za),Pn=Object.assign({deceleration:20,maxSpeed:1400},za),Gi=Object.assign({deceleration:1e3,maxSpeed:360},za),Ad=Object.assign({deceleration:1e3,maxSpeed:90},za);class Xl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=a.o.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:g}of this._inertiaBuffer)o.zoom+=g.zoomDelta||0,o.bearing+=g.bearingDelta||0,o.pitch+=g.pitchDelta||0,g.panDelta&&o.pan._add(g.panDelta),g.around&&(o.around=g.around),g.pinchAround&&(o.pinchAround=g.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(o.pan.mag()){const g=ml(o.pan.mag(),u,Object.assign({},Gm,t||{}));p.offset=o.pan.mult(g.amount/o.pan.mag()),p.center=this._map.transform.center,Fs(p,g)}if(o.zoom){const g=ml(o.zoom,u,Pn);p.zoom=this._map.transform.zoom+g.amount,Fs(p,g)}if(o.bearing){const g=ml(o.bearing,u,Gi);p.bearing=this._map.transform.bearing+a.aA(g.amount,-179,179),Fs(p,g)}if(o.pitch){const g=ml(o.pitch,u,Ad);p.pitch=this._map.transform.pitch+g.amount,Fs(p,g)}if(p.zoom||p.bearing){const g=o.pinchAround===void 0?o.around:o.pinchAround;p.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),p.noMoveStart=!0,p}}function Fs(c,t){(!c.duration||c.duration<t.duration)&&(c.duration=t.duration,c.easing=t.easing)}function ml(c,t,o){const{maxSpeed:u,linearity:p,deceleration:g}=o,y=a.aA(c*p/(t/1e3),-u,u),b=Math.abs(y)/(g*p);return{easing:o.easing,duration:1e3*b,amount:y*(b/2)}}class eo extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,u,p={}){const g=wt(o.getCanvasContainer(),u),y=o.unproject(g);super(t,Object.assign({point:g,lngLat:y,originalEvent:u},p)),this._defaultPrevented=!1,this.target=o}}class dh extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,u){const p=t==="touchend"?u.changedTouches:u.touches,g=Ii(o.getCanvasContainer(),p),y=g.map(T=>o.unproject(T)),b=g.reduce((T,C,I,B)=>T.add(C.div(B.length)),new a.P(0,0));super(t,{points:g,point:b,lngLats:y,lngLat:o.unproject(b),originalEvent:u}),this._defaultPrevented=!1}}class Md extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o){super("wheel",{originalEvent:o}),this._defaultPrevented=!1}}class Hr{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new Md(this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new eo(t.type,this._map,t))}mouseup(t){this._map.fire(new eo(t.type,this._map,t))}preclick(t){const o=new MouseEvent("preclick",t);this._map.fire(new eo(o.type,this._map,o))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(t),this._map.fire(new eo(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new eo(t.type,this._map,t))}mouseover(t){this._map.fire(new eo(t.type,this._map,t))}mouseout(t){this._map.fire(new eo(t.type,this._map,t))}touchstart(t){return this._firePreventable(new dh(t.type,this._map,t))}touchmove(t){this._map.fire(new dh(t.type,this._map,t))}touchend(t){this._map.fire(new dh(t.type,this._map,t))}touchcancel(t){this._map.fire(new dh(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new eo(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new eo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new eo(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Za{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(nt(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const u=o,p=this._startPos,g=this._lastPos;if(!p||!g||g.equals(u)||!this._box&&u.dist(p)<this._clickTolerance)return;this._lastPos=u,this._box||(this._box=Ne("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const y=Math.min(p.x,u.x),b=Math.max(p.x,u.x),T=Math.min(p.y,u.y),C=Math.max(p.y,u.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${y}px,${T}px)`,this._box.style.width=b-y+"px",this._box.style.height=C-T+"px")})}mouseupWindow(t,o){if(!this._active)return;const u=this._startPos,p=o;if(u&&t.button===0){if(this.reset(),rt(),u.x!==p.x||u.y!==p.y)return this._map.fire(new a.z("boxzoomend",{originalEvent:t})),{cameraAnimation:g=>g.fitScreenCoordinates(u,p,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),vt(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new a.z(t,{originalEvent:o}))}}function Ns(c,t){const o={};for(let u=0;u<c.length;u++)o[c[u].identifier]=t[u];return o}class du{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,o,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),u.length===this.numTouches&&(this.centroid=(function(p){const g=new a.P(0,0);for(const y of p)g._add(y);return g.div(p.length)})(o),this.touches=Ns(u,o)))}touchmove(t,o,u){if(this.aborted||!this.centroid)return;const p=Ns(u,o);for(const g in this.touches){const y=p[g];(!y||y.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(t,o,u){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class fu{constructor(t){this.singleTap=new du(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,o,u){this.singleTap.touchstart(t,o,u)}touchmove(t,o,u){this.singleTap.touchmove(t,o,u)}touchend(t,o,u){const p=this.singleTap.touchend(t,o,u);if(p){const g=t.timeStamp-this.lastTime<500,y=!this.lastTap||this.lastTap.dist(p)<30;if(g&&y||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class pu{constructor(){this._zoomIn=new fu({numTouches:1,numTaps:2}),this._zoomOut=new fu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,u){this._zoomIn.touchstart(t,o,u),this._zoomOut.touchstart(t,o,u)}touchmove(t,o,u){this._zoomIn.touchmove(t,o,u),this._zoomOut.touchmove(t,o,u)}touchend(t,o,u){const p=this._zoomIn.touchend(t,o,u),g=this._zoomOut.touchend(t,o,u);return p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:y.getZoom()+1,around:y.unproject(p)},{originalEvent:t})}):g?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:y.getZoom()-1,around:y.unproject(g)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Df=0,Us=2,Pf={[Df]:1,[Us]:2},$a={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Ac{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,o){return!1}_move(t,o){return{}}mousedown(t,o){if(this._lastPoint)return;const u=ji(t);this._correctButton(t,u)&&(this._lastPoint=o,this._eventButton=u)}mousemoveWindow(t,o){const u=this._lastPoint;if(u){if(t.preventDefault(),this._eventButton!=null&&(function(p,g){const y=Pf[g];return p.buttons===void 0||(p.buttons&y)!==y})(t,this._eventButton))this.reset();else if(this._moved||!(o.dist(u)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(u,o)}}mouseupWindow(t){this._lastPoint&&ji(t)===this._eventButton&&(this._moved&&rt(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fh extends Ac{mousedown(t,o){super.mousedown(t,o),this._lastPoint&&(this._active=!0)}_correctButton(t,o){return o===0&&!t.ctrlKey}_move(t,o){return{around:o,panDelta:o.sub(t)}}}class Cd extends Ac{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?$a[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const u=.8*(o.x-t.x);if(u)return this._active=!0,{bearingDelta:u}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Id extends Ac{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?$a[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const u=-.5*(o.y-t.y);if(u)return this._active=!0,{pitchDelta:u}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Lr{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),a.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}touchstart(t,o,u){return this._calculateTransform(t,o,u)}touchmove(t,o,u){if(this._active&&!(u.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(u.length===1&&!a.eU())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,o,u)}}touchend(t,o,u){this._calculateTransform(t,o,u),this._active&&u.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,u){u.length>0&&(this._active=!0);const p=Ns(u,o),g=new a.P(0,0),y=new a.P(0,0);let b=0;for(const C in p){const I=p[C],B=this._touches[C];B&&(g._add(I),y._add(I.sub(B)),b++,p[C]=I)}if(this._touches=p,b<this._minTouches||!y.mag())return;const T=y.div(b);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(b),panDelta:T}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ne("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class mu{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,o,u){return{}}touchstart(t,o,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,u){const p=this._firstTwoTouches;if(!p)return;t.preventDefault();const[g,y]=p,b=Mc(u,o,g),T=Mc(u,o,y);if(!b||!T)return;const C=this._aroundCenter?null:b.add(T).div(2);return this._move([b,T],C,t)}touchend(t,o,u){if(!this._firstTwoTouches)return;const[p,g]=this._firstTwoTouches,y=Mc(u,o,p),b=Mc(u,o,g);y&&b||(this._active&&rt(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Mc(c,t,o){for(let u=0;u<c.length;u++)if(c[u].identifier===o)return t[u]}function ph(c,t){return Math.log2(c/t)}class Cc extends mu{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){const u=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ph(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ph(this._distance,u),pinchAround:o}}}function mh(c,t){return 180*c.angleWith(t)/Math.PI}class gh extends mu{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o){const u=this._vector;if(this._vector=t[0].sub(t[1]),u&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:mh(this._vector,u),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const o=25/(Math.PI*this._minDiameter)*360,u=this._startVector;if(!u)return!1;const p=mh(t,u);return Math.abs(p)<o}}function gu(c){return Math.abs(c.y)>Math.abs(c.x)}class Ic extends mu{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,gu(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,u){const p=this._lastPoints;if(!p)return;const g=t[0].sub(p[0]),y=t[1].sub(p[1]);return this._map._cooperativeGestures&&!a.eU()&&u.touches.length<3||(this._valid=this.gestureBeginsVertically(g,y,u.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(g.y+y.y)/2*-.5})}gestureBeginsVertically(t,o,u){if(this._valid!==void 0)return this._valid;const p=t.mag()>=2,g=o.mag()>=2;if(!p&&!g)return;if(!p||!g)return this._firstMove==null&&(this._firstMove=u),u-this._firstMove<100&&void 0;const y=t.y>0==o.y>0;return gu(t)&&gu(o)&&y}}const Rd={panStep:100,bearingStep:15,pitchStep:10};class _h{constructor(){const t=Rd;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,u=0,p=0,g=0,y=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?u=-1:(t.preventDefault(),g=-1);break;case 39:t.shiftKey?u=1:(t.preventDefault(),g=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),y=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),y=1);break;default:return}return this._rotationDisabled&&(u=0,p=0),{cameraAnimation:b=>{const T=b.getZoom();b.easeTo({duration:300,easeId:"keyboardHandler",easing:Vs,zoom:o?Math.round(T)+o*(t.shiftKey?2:1):T,bearing:b.getBearing()+u*this._bearingStep,pitch:b.getPitch()+p*this._pitchStep,offset:[-g*this._panStep,-y*this._panStep],center:b.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Vs(c){return c*(2-c)}const _u=4.000244140625,Np=1/450;class zd{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Np,a.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||a.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const u=a.o.now(),p=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%_u===0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=o,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){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 o=wt(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>_u?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&I!==0&&(I=1/I);const B=o(),L=Math.pow(2,B),N=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):L;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(N*I))),this._type==="wheel"&&(this._startZoom=B,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:o(),p=this._startZoom,g=this._easing;let y,b=!1;if(this._type==="wheel"&&p&&g){const C=Math.min((a.o.now()-this._lastWheelEventTime)/200,1),I=g(C);y=a.ak(p,u,I),C<1?this._frameId||(this._frameId=!0):b=!0}else y=u,b=!0;this._active=!0,b&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let T=y-o();return T*this._lastDelta<0&&(T=0),{noInertia:!0,needsRenderFrame:!b,zoomDelta:T,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=a.eV;if(this._prevEase){const u=this._prevEase,p=(a.o.now()-u.start)/u.duration,g=u.easing(p+.01)-u.easing(p),y=.27/Math.sqrt(g*g+1e-4)*.01,b=Math.sqrt(.0729-y*y);o=a.eT(y,b,.25,1)}return this._prevEase={start:a.o.now(),duration:t,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ne("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class gl{constructor(t,o){this._clickZoom=t,this._tapZoom=o}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 Lf{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,o){return t.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:u.getZoom()+(t.shiftKey?-1:1),around:u.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Up{constructor(){this._tap=new fu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,o,u){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?u.length>0&&(this._swipePoint=o[0],this._swipeTouch=u[0].identifier):this._tap.touchstart(t,o,u))}touchmove(t,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const p=o[0],g=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(t,o,u)}touchend(t,o,u){this._tapTime?this._swipePoint&&u.length===0&&this.reset():this._tap.touchend(t,o,u)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dd{constructor(t,o,u){this._el=t,this._mousePan=o,this._touchPan=u}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class yh{constructor(t,o,u){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ir{constructor(t,o,u,p){this._el=t,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Pd=c=>c.zoom||c.drag||c.pitch||c.rotate;class Hm extends a.z{}class Vp{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,o){const u=a.av([],o,t);this.radius=a.ag(u[2]<0?a.eX([],u,this.constants):[u[0],u[1],0])}projectRay(t){a.eX(t,t,this.constants),a.aw(t,t),a.eY(t,t,this.constants);const o=a.c5([],t,this.radius);if(o[2]>0){const u=a.c5([],[0,0,1],a.bJ(o,[0,0,1])),p=a.c5([],a.aw([],[o[0],o[1],0]),this.radius),g=a.d8([],o,a.c5([],a.av([],a.d8([],p,u),o),2));o[0]=g[0],o[1]=g[1]}return o}}function Wl(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class Yl{constructor(t,o){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Xl(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Vp,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),a.aY(["handleEvent","handleWindowEvent"],this);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,g,y]of this._listeners){const b=p===document?this.handleWindowEvent:this.handleEvent;p.addEventListener(g,b,y)}}destroy(){for(const[t,o,u]of this._listeners){const p=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(o,p,u)}}_addDefaultHandlers(t){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new Hr(o,t));const p=o.boxZoom=new Za(o,t);this._add("boxZoom",p);const g=new pu,y=new Lf;o.doubleClickZoom=new gl(y,g),this._add("tapZoom",g),this._add("clickZoom",y);const b=new Up;this._add("tapDragZoom",b);const T=o.touchPitch=new Ic(o);this._add("touchPitch",T);const C=new Cd(t),I=new Id(t);o.dragRotate=new yh(t,C,I),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]);const B=new fh(t),L=new Lr(o,t);o.dragPan=new Dd(u,B,L),this._add("mousePan",B),this._add("touchPan",L,["touchZoom","touchRotate"]);const N=new gh,H=new Cc;o.touchZoomRotate=new Ir(u,H,N,b),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),this._add("blockableMapEvent",new mo(o));const j=o.scrollZoom=new zd(o,this);this._add("scrollZoom",j,["mousePan"]);const q=o.keyboard=new _h;this._add("keyboard",q);for(const W of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[W]&&o[W].enable(t[W])}_add(t,o,u){this._handlers.push({handlerName:t,handler:o,allowed:u}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Pd(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,o,u){for(const p in t)if(p!==u&&(!o||o.indexOf(p)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const o=[];for(const u of t)this._el.contains(u.target)&&o.push(u);return o}handleEvent(t,o){this._updatingCamera=!0;const u=t.type==="renderFrame",p=u?void 0:t,g={needsRenderFrame:!1},y={},b={},T=t.touches?this._getMapTouches(t.touches):void 0,C=T?Ii(this._el,T):u?void 0:wt(this._el,t);for(const{handlerName:L,handler:N,allowed:H}of this._handlers){if(!N.isEnabled())continue;let j;this._blockedByActive(b,H,L)?N.reset():N[o||t.type]&&(j=N[o||t.type](t,C,T),this.mergeHandlerResult(g,y,j,L,p),j&&j.needsRenderFrame&&this._triggerRenderFrame()),(j||N.isActive())&&(b[L]=N)}const I={};for(const L in this._previousActiveHandlers)b[L]||(I[L]=p);this._previousActiveHandlers=b,(Object.keys(I).length||Wl(g))&&(this._changes.push([g,y,I]),this._triggerRenderFrame()),(Object.keys(b).length||Wl(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:B}=g;B&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],B(this._map))}mergeHandlerResult(t,o,u,p,g){if(!u)return;Object.assign(t,u);const y={handlerName:p,originalEvent:u.originalEvent||g};u.zoomDelta!==void 0&&(o.zoom=y),u.panDelta!==void 0&&(o.drag=y),u.pitchDelta!==void 0&&(o.pitch=y),u.bearingDelta!==void 0&&(o.rotate=y)}_applyChanges(){const t={},o={},u={};for(const[p,g,y]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new a.P(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(t.around=p.around),p.aroundCoord!==void 0&&(t.aroundCoord=p.aroundCoord),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),Object.assign(o,g),Object.assign(u,y);this._updateMapTransform(t,o,u),this._changes=[]}_updateMapTransform(t,o,u){const p=this._map,g=p.transform,y=ne=>[ne.x,ne.y,ne.z];if((()=>{const ne=this._eventsInProgress.drag;return ne&&!this._handlersById[ne.handlerName].isActive()})()&&!Wl(t)){const ne=g.zoom;g.cameraElevationReference="sea",this._originalZoom!=null&&g._orthographicProjectionAtLowPitch&&g.projection.name!=="globe"&&g.pitch===0?(g.cameraElevationReference="ground",g.zoom=this._originalZoom):(g.recenterOnTerrain(),g.cameraElevationReference="ground"),ne!==g.zoom&&this._map._update(!0)}if(g._isCameraConstrained&&p._stop(!0),!Wl(t))return void this._fireEvents(o,u,!0);let{panDelta:b,zoomDelta:T,bearingDelta:C,pitchDelta:I,around:B,aroundCoord:L,pinchAround:N}=t;g._isCameraConstrained&&(T>0&&(T=0),g._isCameraConstrained=!1),N!==void 0&&(B=N),(T||(ne=>o[ne]&&!this._eventsInProgress[ne])("drag"))&&B&&(this._dragOrigin=y(g.pointCoordinate3D(B)),this._originalZoom=g.zoom,this._trackingEllipsoid.setup(g._camera.position,this._dragOrigin)),g.cameraElevationReference="sea",p._stop(!0),B=B||p.transform.centerPoint,C&&(g.bearing+=C),I&&(g.pitch+=I),g._updateCameraState();const H=[0,0,0];if(b)if(g.projection.name==="mercator"){const ne=this._trackingEllipsoid.projectRay(g.screenPointToMercatorRay(B).dir),ie=this._trackingEllipsoid.projectRay(g.screenPointToMercatorRay(B.sub(b)).dir);H[0]=ie[0]-ne[0],H[1]=ie[1]-ne[1]}else{const ne=g.pointCoordinate(B);if(g.projection.name==="globe"){b=b.rotate(-g.angle);const ie=g._pixelsPerMercatorPixel/g.worldSize;H[0]=-b.x*a.eW(a.a$(ne.y))*ie,H[1]=-b.y*a.eW(g.center.lat)*ie}else{const ie=g.pointCoordinate(B.sub(b));ne&&ie&&(H[0]=ie.x-ne.x,H[1]=ie.y-ne.y)}}const j=g.zoom,q=[0,0,0];if(T){const ne=y(L||g.pointCoordinate3D(B)),ie={dir:a.aw([],a.av([],ne,g._camera.position))};if(ie.dir[2]<0){const ee=g.zoomDeltaToMovement(ne,T);a.c5(q,ie.dir,ee)}}const W=a.d8(H,H,q);g._translateCameraConstrained(W),T&&Math.abs(g.zoom-j)>1e-4&&g.recenterOnTerrain(),g.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,u,!0)}_fireEvents(t,o,u){const p=Pd(this._eventsInProgress),g=Pd(t),y={};for(const I in t){const{originalEvent:B}=t[I];this._eventsInProgress[I]||(y[`${I}start`]=B),this._eventsInProgress[I]=t[I]}!p&&g&&this._fireEvent("movestart",g.originalEvent);for(const I in y)this._fireEvent(I,y[I]);g&&this._fireEvent("move",g.originalEvent);for(const I in t){const{originalEvent:B}=t[I];this._fireEvent(I,B)}const b={};let T;for(const I in this._eventsInProgress){const{handlerName:B,originalEvent:L}=this._eventsInProgress[I];this._handlersById[B].isActive()||(delete this._eventsInProgress[I],T=o[B]||L,b[`${I}end`]=T)}for(const I in b)this._fireEvent(I,b[I]);const C=Pd(this._eventsInProgress);if(u&&(p||g)&&!C){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),B=L=>L!==0&&-this._bearingSnap<L&&L<this._bearingSnap;I?(B(I.bearing||this._map.getBearing())&&(I.bearing=0),this._map.easeTo(I,{originalEvent:T})):(this._map.fire(new a.z("moveend",{originalEvent:T})),B(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new a.z(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new Hm("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Of="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class jp extends a.E{constructor(t,o){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,a.aY(["_renderFrameCallback"],this)}getCenter(){return new a.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,u){return t=a.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},o),u)}panTo(t,o,u){return this.easeTo(Object.assign({center:t},o),u)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,u){return this.easeTo(Object.assign({zoom:t},o),u)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,u){return this.easeTo(Object.assign({bearing:t},o),u)}resetNorth(t,o){return this.rotateTo(0,Object.assign({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}cameraForBounds(t,o){t=a.aI.convert(t);const u=o&&o.bearing||0,p=o&&o.pitch||0,g=t.getNorthWest(),y=t.getSouthEast();return this._cameraForBounds(this.transform,g,y,u,p,o)}_extendPadding(t){const o={top:0,right:0,bottom:0,left:0};return t==null?Object.assign({},o,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:Object.assign({},o,t)}_extendCameraOptions(t){return(t=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,o){const u=o.max[0]-o.min[0],p=o.max[1]-o.min[1];return u/p>t.aspect?u/(2*Math.tan(.5*t.fovX)*t.aspect):p/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,o,u,p,g,y){const b=t.clone(),T=this._extendCameraOptions(y);b.bearing=p,b.pitch=g;const C=a.aT.convert(o),I=a.aT.convert(u),B=.5*(C.lat+I.lat),L=.5*(C.lng+I.lng),N=a.eZ(B,L),H=a.aw([],N),j=a.aw([],a.bI([],H,[0,1,0])),q=a.bI([],j,H),W=[j[0],j[1],j[2],0,q[0],q[1],q[2],0,H[0],H[1],H[2],0,0,0,0,1],ne=[N,a.eZ(C.lat,C.lng),a.eZ(I.lat,C.lng),a.eZ(I.lat,I.lng),a.eZ(C.lat,I.lng),a.eZ(B,C.lng),a.eZ(B,I.lng),a.eZ(C.lat,L),a.eZ(I.lat,L)];let ie=a.d9.fromPoints(ne.map(Ve=>[a.bJ(j,Ve),a.bJ(q,Ve),a.bJ(H,Ve)]));const ee=a.af([],ie.center,W);a.e_(ee)===0&&a.e$(ee,0,0,1),a.aw(ee,ee),a.c5(ee,ee,a.aD),b.center=a.f0(ee);const xe=b.getWorldToCameraMatrix(),me=a.bl(new Float64Array(16),xe);ie=a.d9.applyTransform(ie,a.aB([],xe,W));const ye=this._extendAABB(ie,b,T,p);if(!ye)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");ie=ye,a.af(ee,ee,xe);const de=.5*(ie.max[2]-ie.min[2]),se=this._minimumAABBFrustumDistance(b,ie),Te=a.c5([],[0,0,1],de),Ae=a.d8(Te,ee,Te),Re=se+(b.pitch===0?0:a.bG(ee,Ae)),Be=b.globeCenterInViewSpace,Le=a.av([],ee,[Be[0],Be[1],Be[2]]);a.aw(Le,Le),a.c5(Le,Le,Re);const $e=a.d8([],ee,Le);a.af($e,$e,me);const ot=a.eM/a.aD,Fe=a.ag($e),Se=a.cf(Math.max(Fe*ot-a.eM,Number.EPSILON),0),Ke=Math.min(b.zoomFromMercatorZAdjusted(Se),T.maxZoom);return Ke>.5*(a.c_+a.cL)?(b.setProjection({name:"mercator"}),b.zoom=Ke,this._cameraForBounds(b,o,u,p,g,y)):{center:b.center,zoom:Ke,bearing:p,pitch:g}}_extendAABB(t,o,u,p){const g=.5*((u.padding.left||0)+(u.padding.right||0)),y=.5*((u.padding.top||0)+(u.padding.bottom||0)),b=y,T=g,C=g,I=y,B=o.width-(T+C),L=o.height-(b+I),N=a.av([],t.max,t.min),H=Math.min(B/N[0],L/N[1]),j=Math.min(o.scaleZoom(o.scale*H),u.maxZoom);if(isNaN(j))return null;const q=o.scale/o.zoomScale(j),W=new a.d9([t.min[0]-T*q,t.min[1]-I*q,t.min[2]],[t.max[0]+C*q,t.max[1]+b*q,t.max[2]]),ne=(typeof u.offset.x=="number"&&typeof u.offset.y=="number"?new a.P(u.offset.x,u.offset.y):a.P.convert(u.offset)).rotate(-a.an(p));return W.center[0]-=ne.x*q,W.center[1]+=ne.y*q,W}queryTerrainElevation(t,o){const u=this.transform.elevation;return u?(o=Object.assign({},{exaggerated:!0},o),u.getAtPoint(a.ae.fromLngLat(t),null,o.exaggerated)):null}_cameraForBounds(t,o,u,p,g,y){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,o,u,p,g,y);const b=t.clone(),T=this._extendCameraOptions(y);b.bearing=p,b.pitch=g;const C=a.aT.convert(o),I=a.aT.convert(u),B=new a.aT(C.lng,I.lat),L=new a.aT(I.lng,C.lat),N=b.project(C),H=b.project(I),j=this.queryTerrainElevation(C),q=this.queryTerrainElevation(I),W=this.queryTerrainElevation(B),ne=this.queryTerrainElevation(L),ie=[[N.x,N.y,Math.min(j||0,q||0,W||0,ne||0)],[H.x,H.y,Math.max(j||0,q||0,W||0,ne||0)]];let ee=a.d9.fromPoints(ie);const xe=b.getWorldToCameraMatrix(),me=a.bl(new Float64Array(16),xe);ee=a.d9.applyTransform(ee,xe);const ye=this._extendAABB(ee,b,T,p);if(!ye)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");ee=ye;const de=.5*a.av([],ee.max,ee.min)[2],se=this._minimumAABBFrustumDistance(b,ee),Te=[0,0,1,0];a.aC(Te,Te,xe),a.f1(Te,Te);const Ae=a.c5([],Te,se+de),Re=a.d8([],ee.center,Ae);a.af(ee.center,ee.center,me),a.af(Re,Re,me);const Be=b.unproject(new a.P(ee.center[0],ee.center[1])),Le=a.f2(b.projection,Be),$e=Math.pow(2,Le),ot=Math.min(b._zoomFromMercatorZ(Re[2]*b.pixelsPerMeter*$e/b.worldSize),T.maxZoom);return b.mercatorFromTransition&&ot<.5*(a.c_+a.cL)?(b.setProjection({name:"globe"}),b.zoom=ot,this._cameraForBounds(b,o,u,p,g,y)):{center:Be,zoom:ot,bearing:p,pitch:g}}fitBounds(t,o,u){const p=this.cameraForBounds(t,o);return this._fitInternal(p,o,u)}fitScreenCoordinates(t,o,u,p,g){const y=a.P.convert(t),b=a.P.convert(o),T=new a.P(Math.min(y.x,b.x),Math.min(y.y,b.y)),C=new a.P(Math.max(y.x,b.x),Math.max(y.y,b.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(y,b))return this;const I=this.transform.pointLocation3D(T),B=this.transform.pointLocation3D(C),L=this.transform.pointLocation3D(new a.P(T.x,C.y)),N=this.transform.pointLocation3D(new a.P(C.x,T.y)),H=[Math.min(I.lng,B.lng,L.lng,N.lng),Math.min(I.lat,B.lat,L.lat,N.lat)],j=[Math.max(I.lng,B.lng,L.lng,N.lng),Math.max(I.lat,B.lat,L.lat,N.lat)],q=p&&p.pitch?p.pitch:this.getPitch(),W=this._cameraForBounds(this.transform,H,j,u,q,p);return this._fitInternal(W,p,g)}_fitInternal(t,o,u){return t?(o=Object.assign(t,o)).linear?this.easeTo(o,u):this.flyTo(o,u):this}jumpTo(t,o){this.stop();const u=t.preloadOnly?this.transform.clone():this.transform;let p=!1,g=!1,y=!1;"zoom"in t&&u.zoom!==+t.zoom&&(p=!0,u.zoom=+t.zoom),t.center!==void 0&&(u.center=a.aT.convert(t.center)),"bearing"in t&&u.bearing!==+t.bearing&&(g=!0,u.bearing=+t.bearing),"pitch"in t&&u.pitch!==+t.pitch&&(y=!0,u.pitch=+t.pitch);const b=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!u.isPaddingEqual(b))if(t.retainPadding===!1){const T=u.clone();T.padding=b,u.setLocationAtPoint(u.center,T.centerPoint)}else u.padding=b;return t.preloadOnly?(this._preloadTiles(u),this):(this.fire(new a.z("movestart",o)).fire(new a.z("move",o)),p&&this.fire(new a.z("zoomstart",o)).fire(new a.z("zoom",o)).fire(new a.z("zoomend",o)),g&&this.fire(new a.z("rotatestart",o)).fire(new a.z("rotate",o)).fire(new a.z("rotateend",o)),y&&this.fire(new a.z("pitchstart",o)).fire(new a.z("pitch",o)).fire(new a.z("pitchend",o)),this.fire(new a.z("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(Of),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,o){const u=this.transform;if(!u.projection.supportsFreeCamera)return a.w(Of),this;this.stop();const p=u.zoom,g=u.pitch,y=u.bearing;u.setFreeCameraOptions(t);const b=p!==u.zoom,T=g!==u.pitch,C=y!==u.bearing;return this.fire(new a.z("movestart",o)).fire(new a.z("move",o)),b&&this.fire(new a.z("zoomstart",o)).fire(new a.z("zoom",o)).fire(new a.z("zoomend",o)),C&&this.fire(new a.z("rotatestart",o)).fire(new a.z("rotate",o)).fire(new a.z("rotateend",o)),T&&this.fire(new a.z("pitchstart",o)).fire(new a.z("pitch",o)).fire(new a.z("pitchend",o)),this.fire(new a.z("moveend",o)),this}easeTo(t,o){this._stop(!1,t.easeId),((t=Object.assign({offset:[0,0],duration:500,easing:a.eV},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const u=this.transform,p=this.getZoom(),g=this.getBearing(),y=this.getPitch(),b=this.getPadding(),T="zoom"in t?+t.zoom:p,C="bearing"in t?this._normalizeBearing(t.bearing,g):g,I="pitch"in t?+t.pitch:y,B=this._extendPadding(t.padding),L=a.P.convert(t.offset);let N,H,j;if(u.projection.name==="globe"){const Te=a.ae.fromLngLat(u.center),Ae=L.rotate(-u.angle);Te.x+=Ae.x/u.worldSize,Te.y+=Ae.y/u.worldSize;const Re=Te.toLngLat(),Be=a.aT.convert(t.center||Re);this._normalizeCenter(Be),N=u.centerPoint.add(Ae),H=new a.P(Te.x,Te.y).mult(u.worldSize),j=new a.P(a.aF(Be.lng),a.aJ(Be.lat)).mult(u.worldSize).sub(H)}else{N=u.centerPoint.add(L);const Te=u.pointLocation(N),Ae=a.aT.convert(t.center||Te);this._normalizeCenter(Ae),H=u.project(Te),j=u.project(Ae).sub(H)}const q=u.zoomScale(T-p);let W,ne;t.around&&(W=a.aT.convert(t.around),ne=u.locationPoint(W));const ie=this._zooming||T!==p,ee=this._rotating||g!==C,xe=this._pitching||I!==y,me=!u.isPaddingEqual(B),ye=t.retainPadding===!1?u.clone():u,de=Te=>Ae=>{if(ie&&(Te.zoom=a.ak(p,T,Ae)),ee&&(Te.bearing=a.ak(g,C,Ae)),xe&&(Te.pitch=a.ak(y,I,Ae)),me&&(ye.interpolatePadding(b,B,Ae),N=ye.centerPoint.add(L)),W)Te.setLocationAtPoint(W,ne);else{const Re=Te.zoomScale(Te.zoom-p),Be=T>p?Math.min(2,q):Math.max(.5,q),Le=Math.pow(Be,1-Ae),$e=Te.unproject(H.add(j.mult(Ae*Le)).mult(Re));Te.setLocationAtPoint(Te.renderWorldCopies?$e.wrap():$e,N)}return t.preloadOnly||this._fireMoveEvents(o),Te};if(t.preloadOnly){const Te=this._emulate(de,t.duration,u);return this._preloadTiles(Te),this}const se={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=ie,this._rotating=ee,this._pitching=xe,this._padding=me,this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,se),this._ease(de(u),Te=>{u.cameraElevationReference==="sea"&&u.recenterOnTerrain(),this._afterEase(o,Te)},t),this}_prepareEase(t,o,u={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||u.moving||this.fire(new a.z("movestart",t)),this._zooming&&!u.zooming&&this.fire(new a.z("zoomstart",t)),this._rotating&&!u.rotating&&this.fire(new a.z("rotatestart",t)),this._pitching&&!u.pitching&&this.fire(new a.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.z("move",t)),this._zooming&&this.fire(new a.z("zoom",t)),this._rotating&&this.fire(new a.z("rotate",t)),this._pitching&&this.fire(new a.z("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const u=this._zooming,p=this._rotating,g=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new a.z("zoomend",t)),p&&this.fire(new a.z("rotateend",t)),g&&this.fire(new a.z("pitchend",t)),this.fire(new a.z("moveend",t))}flyTo(t,o){if(this._prefersReducedMotion(t)){const Ve=a.aH(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ve,o)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:a.eV},t);const u=this.transform,p=this.getZoom(),g=this.getBearing(),y=this.getPitch(),b=this.getPadding(),T="zoom"in t?a.aA(+t.zoom,u.minZoom,u.maxZoom):p,C="bearing"in t?this._normalizeBearing(t.bearing,g):g,I="pitch"in t?+t.pitch:y,B=this._extendPadding(t.padding),L=u.zoomScale(T-p),N=a.P.convert(t.offset);let H=u.centerPoint.add(N);const j=u.pointLocation(H),q=a.aT.convert(t.center||j);this._normalizeCenter(q);const W=u.project(j),ne=u.project(q).sub(W);let ie=t.curve;const ee=Math.max(u.width,u.height),xe=ee/L,me=ne.mag();if("minZoom"in t){const Ve=a.aA(Math.min(t.minZoom,p,T),u.minZoom,u.maxZoom),it=ee/u.zoomScale(Ve-p);ie=Math.sqrt(it/me*2)}const ye=ie*ie;function de(Ve){const it=(xe*xe-ee*ee+(Ve?-1:1)*ye*ye*me*me)/(2*(Ve?xe:ee)*ye*me);return Math.log(Math.sqrt(it*it+1)-it)}function se(Ve){return(Math.exp(Ve)-Math.exp(-Ve))/2}function Te(Ve){return(Math.exp(Ve)+Math.exp(-Ve))/2}const Ae=de(0);let Re=function(Ve){return Te(Ae)/Te(Ae+ie*Ve)},Be=function(Ve){return ee*((Te(Ae)*(se(it=Ae+ie*Ve)/Te(it))-se(Ae))/ye)/me;var it},Le=(de(1)-Ae)/ie;if(Math.abs(me)<1e-6||!isFinite(Le)){if(Math.abs(ee-xe)<1e-6)return this.easeTo(t,o);const Ve=xe<ee?-1:1;Le=Math.abs(Math.log(xe/ee))/ie,Be=function(){return 0},Re=function(it){return Math.exp(Ve*ie*it)}}t.duration="duration"in t?+t.duration:1e3*Le/("screenSpeed"in t?+t.screenSpeed/ie:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const $e=g!==C,ot=I!==y,Fe=!u.isPaddingEqual(B),Se=t.retainPadding===!1?u.clone():u,Ke=Ve=>it=>{const Et=it*Le,Bt=1/Re(Et);Ve.zoom=it===1?T:p+Ve.scaleZoom(Bt),$e&&(Ve.bearing=a.ak(g,C,it)),ot&&(Ve.pitch=a.ak(y,I,it)),Fe&&(Se.interpolatePadding(b,B,it),H=Se.centerPoint.add(N));const Ct=it===1?q:Ve.unproject(W.add(ne.mult(Be(Et))).mult(Bt));return Ve.setLocationAtPoint(Ve.renderWorldCopies?Ct.wrap():Ct,H),Ve._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(o),Ve};if(t.preloadOnly){const Ve=this._emulate(Ke,t.duration,u);return this._preloadTiles(Ve),this}return this._zooming=!0,this._rotating=$e,this._pitching=ot,this._padding=Fe,this._prepareEase(o,!1),this._ease(Ke(u),()=>this._afterEase(o),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const u=this._onEaseEnd;this._onEaseEnd=void 0,u.call(this,o)}if(!t){const u=this.handlers;u&&u.stop(!1)}return this}_ease(t,o,u){u.animate===!1||u.duration===0?(t(1),o()):(this._easeStart=a.o.now(),this._easeOptions=u,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.o.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,o){t=a.bT(t,-180,180);const u=Math.abs(t-o);return Math.abs(t-360-o)<u&&(t-=360),Math.abs(t+360-o)<u&&(t+=360),t}_normalizeCenter(t){const o=this.transform;if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const u=t.lng-o.center.lng;t.lng+=u>180?-360:u<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&a.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,o,u){const p=Math.ceil(15*o/1e3),g=[],y=t(u.clone());for(let b=0;b<=p;b++){const T=y(b/p);g.push(T.clone())}return g}_preloadTiles(t,o){}}class xh{constructor(t={}){this.options=t,a.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const o=this.options&&this.options.compact,u=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Ne("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Ne("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",u);const p=Ne("span","mapboxgl-ctrl-icon",this._compactButton);return p.setAttribute("aria-hidden","true"),p.setAttribute("title",u),this._innerContainer=Ne("div","mapboxgl-ctrl-attrib-inner",this._container),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.e.ACCESS_TOKEN}];if(t){const u=o.reduce((p,g,y)=>(g.value&&(p+=`${g.key}=${g.value}${y<o.length-1?"&":""}`),p),"?");t.href=`${a.e.FEEDBACK_URL}/${u}#${Fp(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||(t.dataType!=="source"||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility")&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const o=this._map.style._mergedSourceCaches;for(const p in o){const g=o[p];if(g.used){const y=g.getSource();y.attribution&&t.indexOf(y.attribution)<0&&t.push(y.attribution)}}t.sort((p,g)=>p.length-g.length),t=t.filter((p,g)=>{for(let y=g+1;y<t.length;y++)if(t[y].indexOf(p)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const u=t.map(p=>(function(g){const y=new DOMParser().parseFromString(g,"text/html");return Array.from(y.body.querySelectorAll("*")).reverse().forEach(b=>{const T=b.textContent||"";if(b.tagName!=="A")return void b.replaceWith(...b.childNodes);const C=b.getAttribute("href");if(!C||!/^(https?:|mailto:)/i.test(C))return void b.replaceWith(y.createTextNode(T));const I=y.createElement("a");I.href=C,I.textContent=T,I.rel="noopener nofollow";const B=b.getAttribute("class");B&&(I.className=B),b.replaceWith(I)}),y.body.innerHTML})(p)).join(" | ");u!==this._attribHTML&&(this._attribHTML=u,t.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class js{constructor(){a.aY(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Ne("div","mapboxgl-ctrl");const o=Ne("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const o in t){const u=t[o].getSource();if(u.hasOwnProperty("mapbox_logo")&&!u.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const o=t[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class Gp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;for(const p of u)if(p.id===t)return void(p.cancelled=!0)}run(t=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class kn{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const o=a.dD((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,o,u){this._start=this.getValue(o),this._end=t,this._startTime=o,this._endTime=o+u}}const Hp={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Bf extends a.z{constructor(t,o,u,p){const{point:g,lngLat:y,originalEvent:b,target:T}=t;super(t.type,{point:g,lngLat:y,originalEvent:b,target:T}),this.preventDefault=()=>{t.preventDefault()},this.id=o,this.interaction=u,this.feature=p}}class qp{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,o){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const u=o.filter;let p=o.type;u&&this.filters.set(t,a.b6(u)),p==="mouseover"&&(p="mouseenter"),p==="mouseout"&&(p="mouseleave");const g=this.interactionsByType.get(p)||new Map;p==="mouseenter"||p==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,o)):g.size===0&&this.map.on(p,this.handleType),g.size===0&&this.interactionsByType.set(p,g),g.set(t,o),this.typeById.set(t,p)}get(t){const o=this.typeById.get(t);if(!o)return;const u=this.interactionsByType.get(o);return u?u.get(t):void 0}remove(t){const o=this.typeById.get(t);if(!o)return;this.typeById.delete(t),this.filters.delete(t);const u=this.interactionsByType.get(o);u&&(u.delete(t),o==="mouseenter"||o==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):u.size===0&&this.map.off(o,this.handleType))}queryTargets(t,o){const u=[];for(const[p,g]of o)g.target&&u.push({targetId:p,target:g.target,filter:this.filters.get(p)});return this.map.style.queryRenderedTargets(t,u,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const o=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());o.length&&(t.type="mouseenter",this.handleType(t,o));const u=new Map;for(const[p,{feature:g}]of this.prevHoveredFeatures)this.hoveredFeatures.has(p)||u.set(g.id,g);u.size&&(t.type="mouseleave",this.handleType(t,Array.from(u.values())))}handleOut(t){const o=Array.from(this.hoveredFeatures.values()).map(({feature:u})=>u);o.length&&(t.type="mouseleave",this.handleType(t,o)),this.hoveredFeatures.clear()}handleType(t,o){const u=t.type==="mouseenter";if(u&&!this.interactionsByType.has(t.type))return void a.w("mouseenter interaction required for mouseleave to work.");const p=Array.from(this.interactionsByType.get(t.type)).reverse(),g=!!o;o=o||this.queryTargets(t.point,p);let y=!1;const b=new Set;for(const T of o){for(const[C,I]of p){if(!I.target)continue;const B=T.variants?T.variants[C]:null;if(B){for(const L of B){if(Lu(L,T,b,C))continue;const N=new a.dx(T,L),H=Ea(L,T,C);g&&N.id!==void 0&&(N.state=this.map.getFeatureState(N));const j=u?this.prevHoveredFeatures.get(H):null,q=new Bf(t,C,I,N),W=j?j.stop:I.handler(q);if(u&&this.hoveredFeatures.set(H,{feature:T,stop:W}),W!==!1){y=!0;break}}if(y)break}}if(y)break}if(!y)for(const[T,C]of p){const{handler:I,target:B}=C;if(!B&&I(new Bf(t,T,C,null))!==!1)break}}}function kf(c,t){if(Array.isArray(c)&&Array.isArray(t)){const o=new Set(c),u=new Set(t);return o.size===u.size&&c.every(p=>u.has(p))}return a.by(c,t)}const vh={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},_l={showCompass:!0,showZoom:!0,visualizePitch:!1};class qr{constructor(t,o,u=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new Cd({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,u&&(this.mousePitch=new Id({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(t,o){this.mouseRotate.mousedown(t,o),this.mousePitch&&this.mousePitch.mousedown(t,o),nt()}move(t,o){const u=this.map,p=this.mouseRotate.mousemoveWindow(t,o),g=p&&p.bearingDelta;if(g&&u.setBearing(u.getBearing()+g),this.mousePitch){const y=this.mousePitch.mousemoveWindow(t,o),b=y&&y.pitchDelta;b&&u.setPitch(u.getPitch()+b)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){vt(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Object.assign({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),wt(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,wt(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Ii(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Ii(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function yu(c,t,o){if(c=new a.aT(c.lng,c.lat),t){const u=new a.aT(c.lng-360,c.lat),p=new a.aT(c.lng+360,c.lat),g=360*Math.ceil(Math.abs(c.lng-o.center.lng)/360),y=o.locationPoint3D(c).distSqr(t),b=t.x<0||t.y<0||t.x>o.width||t.y>o.height;o.locationPoint3D(u).distSqr(t)<y&&(b||Math.abs(u.lng-o.center.lng)<g)?c=u:o.locationPoint3D(p).distSqr(t)<y&&(b||Math.abs(p.lng-o.center.lng)<g)&&(c=p)}for(;Math.abs(c.lng-o.center.lng)>180;){const u=o.locationPoint3D(c);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;c.lng>o.center.lng?c.lng-=360:c.lng+=360}return c}const gs={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%)"},ur={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Rr extends a.E{constructor(t,o){super(),(t instanceof HTMLElement||o)&&(t=Object.assign({element:t},o)),a.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:u="center",color:p="#3FB1CE",scale:g=1,draggable:y=!1,clickTolerance:b=0,rotation:T=ur.rotation,rotationAlignment:C=ur.rotationAlignment,pitchAlignment:I=ur.pitchAlignment,occludedOpacity:B=ur.occludedOpacity,altitude:L=ur.altitude}=t||{};this._anchor=u,this._color=p,this._scale=g,this._draggable=y,this._clickTolerance=b,this._rotation=T,this._rotationAlignment=C,this._pitchAlignment=I,this._occludedOpacity=B,this._altitude=L,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=a.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=a.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",j=>{j.preventDefault()}),this._element.addEventListener("mousedown",j=>{j.preventDefault()});const N=this._element.classList;for(const j in gs)N.remove(`mapboxgl-marker-anchor-${j}`);N.add(`mapboxgl-marker-anchor-${this._anchor}`);const H=t&&t.className?t.className.trim().split(/\s+/):[];N.add(...H),this._popup=null}_createDefaultMarker(){const t=Ne("div"),o=Je("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const u=Je("radialGradient",{id:"shadowGradient"},Je("defs",{},o));Je("stop",{offset:"10%","stop-opacity":.4},u),Je("stop",{offset:"100%","stop-opacity":.05},u),Je("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o)}return Je("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),Je("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),Je("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.aT.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||ur.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const p=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const o=t.code,u=t.charCode||t.keyCode;o!=="Space"&&o!=="Enter"&&u!==32&&u!==13||this.togglePopup()}_onMapClick(t){const o=t.originalEvent.target,u=this._element;this._popup&&(o===u||u.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,o=this._pos;if(!t||!o)return!1;const u=t.unproject(o,this._altitude),p=t.getFreeCameraOptions();if(!p.position)return!1;const g=p.position.toLngLat();return g.distanceTo(u)<.9*g.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const o=this._pos;if(!o||o.x<0||o.x>t.transform.width||o.y<0||o.y>t.transform.height)return void this._clearFadeTimer();const u=t.unproject(o,this._altitude);let p;t._showingGlobe()&&a.f5(t.transform,this._lngLat)?p=0:(p=1-t._queryFogOpacity(u),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(p*=this._occludedOpacity)),this._element.style.opacity=`${p}`,this._element.style.pointerEvents=p>0?"auto":"none",this._popup&&this._popup._setOpacity(p),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=`
3208            translate(${t.x}px,${t.y}px)
3209            ${gs[this._anchor]}
3210            ${this._calculateXYTransform()} ${this._calculateZTransform()}
3211            translate(${o.x}px,${o.y}px)
3212        `}_calculateXYTransform(){const t=this._pos,o=this._map,u=this.getPitchAlignment();if(!o||!t||u!=="map")return"";if(!o._showingGlobe()){const T=o.getPitch();return T?`rotateX(${T}deg)`:""}const p=a.cX(a.f6(o.transform,this._lngLat)),g=t.sub(a.f7(o.transform)),y=Math.abs(g.x)+Math.abs(g.y);if(y===0)return"";const b=p/y;return`rotateX(${-g.y*b}deg) rotateY(${g.x*b}deg)`}_calculateZTransform(){const t=this._pos,o=this._map;if(!o||!t)return"";let u=0;const p=this.getRotationAlignment();if(p==="map")if(o._showingGlobe()){const g=o.project(new a.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),y=o.project(new a.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(g);u=a.cX(Math.atan2(y.y,y.x))-90}else u=-o.getBearing();else if(p==="horizon"){const g=a.ah(4,6,o.getZoom()),y=a.f7(o.transform);y.y+=g*o.transform.height;const b=t.sub(y),T=a.cX(Math.atan2(b.y,b.x));u=(T>90?T-270:T+90)*(1-g)}return u+=this._rotation,u?`rotateZ(${u}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const o=this._map;o&&(o.transform.renderWorldCopies&&(this._lngLat=yu(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=a.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const o=this._map;if(!o)return;const u=this._pointerdownPos,p=this._positionDelta;if(u&&p){if(!this._isDragging){const g=this._clickTolerance||o._clickTolerance;if(t.point.dist(u)<g)return;this._isDragging=!0}this._pos=t.point.sub(p),this._lngLat=o.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.z("dragstart"))),this.fire(new a.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new a.z("dragend")),this._state="inactive"}_addDragHandler(t){const o=this._map,u=this._pos;o&&u&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(u),this._pointerdownPos=t.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const o=this._map;return o&&(t?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||ur.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||ur.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||ur.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||ur.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Da={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},bh={maxWidth:100,unit:"metric"},Tr={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},ma={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},Kl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function xu(c=new a.P(0,0),t="bottom"){if(typeof c=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(c,2)));switch(t){case"top":return new a.P(0,c);case"top-left":return new a.P(o,o);case"top-right":return new a.P(-o,o);case"bottom":return new a.P(0,-c);case"bottom-left":return new a.P(o,-o);case"bottom-right":return new a.P(-o,-o);case"left":return new a.P(c,0);case"right":return new a.P(-c,0)}return new a.P(0,0)}return c instanceof a.P||Array.isArray(c)?a.P.convert(c):a.P.convert(c[t]||[0,0])}return{version:ue,supported:ft.supported,setRTLTextPlugin:a.fb,getRTLTextPluginStatus:a.fa,Map:class extends jp{constructor(c){Ee.mark(re.create);const t=c;if((c=Object.assign({},vh,c)).minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(c.antialias&&a.f3(window)&&(c.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Xh(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies,null,null),c),this._repaint=!!c.repaint,this._interactive=c.interactive,this._minTileCacheSize=c.minTileCacheSize,this._maxTileCacheSize=c.maxTileCacheSize,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=c.crossSourceCollisions,this._collectResourceTiming=c.collectResourceTiming,this._language=this._parseLanguage(c.language),this._worldview=c.worldview,this._renderTaskQueue=new Gp,this._domRenderTaskQueue=new Gp,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.b2(),this._locale=Object.assign({},Hp,c.locale),this._clickTolerance=c.clickTolerance,this._cooperativeGestures=c.cooperativeGestures,this._performanceMetricsCollection=c.performanceMetricsCollection,this._tessellationStep=c.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=c.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new kn(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=c.scaleFactor,this._requestManager=new gi(c.transformRequest,c.accessToken,c.testMode),this._silenceAuthErrors=!!c.testMode,this._contextCreateOptions=c.contextCreateOptions?Object.assign({},c.contextCreateOptions):{},typeof c.container=="string"){const o=document.getElementById(c.container);if(!o)throw new Error(`Container '${c.container.toString()}' not found.`);this._container=o}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(this._container.childNodes.length>0&&a.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),c.maxBounds&&this.setMaxBounds(c.maxBounds),this._spriteFormat=c.spriteFormat,a.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Yl(this,c),this._localFontFamily=c.localFontFamily,this._localIdeographFontFamily=c.localIdeographFontFamily,(c.style||!c.testMode)&&this.setStyle(c.style||a.e.DEFAULT_STYLE,{config:c.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),c.projection&&this.setProjection(c.projection),c.hash&&(this._hash=new Zo(typeof c.hash=="string"&&c.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch});const o=c.bounds;o&&(this.resize(),this.fitBounds(o,Object.assign({},c.fitBoundsOptions,{duration:0})))}this.resize(),c.attributionControl&&this.addControl(new xh({customAttribution:c.customAttribution})),this._logoControl=new js,this.addControl(this._logoControl,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new a.z(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new a.z(`${o.dataType}dataloading`,o))}),this._interactions=new qp(this)}_getMapId(){return this._mapId}addControl(c,t){if(t===void 0&&(t=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new a.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=c.onAdd(this);this._controls.push(c);const u=this._controlPositions[t];return t.indexOf("bottom")!==-1?u.insertBefore(o,u.firstChild):u.appendChild(o),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new a.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(c);return t>-1&&this._controls.splice(t,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(c){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new a.z("movestart",c)).fire(new a.z("move",c)),this.fire(new a.z("resize",c)),t&&this.fire(new a.z("moveend",c)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(c){return this.transform.setMaxBounds(a.aI.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()<c?this.setZoom(c):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(c){if((c=c??22)>=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c?this.setZoom(c):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()<c?this.setPitch(c):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(c){if((c=c??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c?this.setPitch(c):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(c){return this._scaleFactor=c,this.painter.scaleFactor=c,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(c){return c==="auto"?navigator.language:Array.isArray(c)?c.length===0?void 0:c.map(t=>t==="auto"?navigator.language:t):c}setLanguage(c){const t=this._parseLanguage(c);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(c){return this.style&&c!==this._worldview?(this._worldview=c,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(c){return this._lazyInitEmptyStyle(),c?typeof c=="string"&&(c={name:c}):c=null,this._useExplicitProjection=!!c,this._prioritizeAndUpdateProjection(c,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const c=this.transform,t=c.projection.name;let o;t==="globe"&&c.zoom>=a.cL?(c.setMercatorFromTransition(),o=!0):t==="mercator"&&c.zoom<a.cL&&(c.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(c,t){return this._updateProjection(c||t||{name:"mercator"})}_updateProjection(c){let t;const o=this.transform.mercatorFromTransition;t=c.name==="globe"&&this.transform.zoom>=a.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(c),this.style.applyProjectionUpdate();const u=this.transform.getProjection().name==="mercator"&&o!==this.transform.mercatorFromTransition;return(t||u)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(c,t){return this.transform.locationPoint3D(a.aT.convert(c),t)}unproject(c,t){return this.transform.pointLocation3D(a.P.convert(c),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(c,t,o){const u=p=>{let g=[];if(Array.isArray(t)){const y=t.filter(b=>this.getLayer(b));g=y.length?this.queryRenderedFeatures(p,{layers:y}):[]}else g=this.queryRenderedFeatures(p,{target:t});return g};if(c==="mouseenter"||c==="mouseover"){let p=!1;return{listener:o,targets:t,delegates:{mousemove:y=>{const b=u(y.point);b.length?p||(p=!0,o.call(this,new eo(c,this,y.originalEvent,{features:b}))):p=!1},mouseout:()=>{p=!1}}}}if(c==="mouseleave"||c==="mouseout"){let p=!1;return{listener:o,targets:t,delegates:{mousemove:b=>{u(b.point).length?p=!0:p&&(p=!1,o.call(this,new eo(c,this,b.originalEvent)))},mouseout:b=>{p&&(p=!1,o.call(this,new eo(c,this,b.originalEvent)))}}}}{const p=g=>{const y=u(g.point);y.length&&(g.features=y,o.call(this,g),delete g.features)};return{listener:o,targets:t,delegates:{[c]:p}}}}on(c,t,o){if(typeof t=="function"||o===void 0)return super.on(c,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const u=this._createDelegatedListener(c,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(u);for(const p in u.delegates)this.on(p,u.delegates[p]);return this}once(c,t,o){if(typeof t=="function"||o===void 0)return super.once(c,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const u=this._createDelegatedListener(c,t,o);for(const p in u.delegates)this.once(p,u.delegates[p]);return this}off(c,t,o){if(typeof t=="function"||o===void 0)return super.off(c,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const u=this._delegatedListeners?this._delegatedListeners[c]:void 0;return u&&(p=>{for(let g=0;g<p.length;g++){const y=p[g];if(y.listener===o&&kf(y.targets,t)){for(const b in y.delegates)this.off(b,y.delegates[b]);return p.splice(g,1),this}}})(u),this}queryRenderedFeatures(c,t){if(!this.style)return[];if(c===void 0||c instanceof a.P||Array.isArray(c)||t!==void 0||(t=c,c=void 0),c=c||[[0,0],[this.transform.width,this.transform.height]],!t){const g=this.style.queryRenderedFeatures(c,void 0,this.transform),y=this.style.queryRenderedFeatureset(c,void 0,this.transform);return g.concat(y)}let o=!0;if(t.target&&(o=this._isTargetValid(t.target),o&&!t.layers))return this.style.queryRenderedFeatureset(c,t,this.transform);let u=!0;if(t.layers&&Array.isArray(t.layers)){for(const g of t.layers)if(!this._isValidId(g)){u=!1;break}if(u&&!t.target)return this.style.queryRenderedFeatures(c,t,this.transform)}let p=[];return u&&(p=p.concat(this.style.queryRenderedFeatures(c,t,this.transform))),o&&(p=p.concat(this.style.queryRenderedFeatureset(c,t,this.transform))),p}querySourceFeatures(c,t){return!c||typeof c=="string"&&!this._isValidId(c)?[]:this.style.querySourceFeatures(c,t)}queryRasterValue(c,t,o){return this._isValidId(c)?this.style.queryRasterValue(c,t,o):Promise.resolve(null)}isPointOnSurface(c){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&a.w(`${t} projection does not support isPointOnSurface, this API may behave unex
3212pectedly.`),this.transform.isPointOnSurface(a.P.convert(c))}addInteraction(c,t){return this._interactions.add(c,t),this}removeInteraction(c){return this._interactions.remove(c),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(c){return this._cooperativeGestures=c,this}setStyle(c,t){return t=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&c&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(c,(o,u)=>{if(o){const p=typeof o=="string"?o:o instanceof Error?o.message:o.error;a.w(`Unable to perform style diff: ${p}. Rebuilding the style from scratch.`),this._updateStyle(c,t)}else u&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(c,t))}_getUIString(c){const t=this._locale[c];if(t==null)throw new Error(`Missing UI string '${c}'`);return t}_updateStyle(c,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),c){const o=Object.assign({},t);t&&t.config&&(o.initialConfig=t.config,delete o.config),this.style=new ea(this,o).load(c),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new ea(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(a.w("There is no style added to the map."),!1)}_isValidId(c){return c==null?(this.fire(new a.y(new Error("IDs can't be empty."))),!1):!a.dr(c)||(this.fire(new a.y(new Error(`IDs can't contain special symbols: "${c}".`))),!1)}_isTargetValid(c){return"featuresetId"in c?this._isValidId("importId"in c?c.importId:c.featuresetId):"layerId"in c&&this._isValidId(c.layerId)}_areTargetsValid(c){if(Array.isArray(c)){for(const t of c)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(c)}addSource(c,t){return this._isValidId(c)?(this._lazyInitEmptyStyle(),this.style.addSource(c,t),this._update(!0)):this}isSourceLoaded(c){return!!this._isValidId(c)&&!!this.style&&this.style._isSourceCacheLoaded(c)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(c,t,o){this._lazyInitEmptyStyle(),this.style.addSourceType(c,t,o)}removeSource(c){return this._isValidId(c)?(this.style.removeSource(c),this._updateTerrain(),this._update(!0)):this}getSource(c){return this._isValidId(c)?this.style.getOwnSource(c):null}addImage(c,t,{pixelRatio:o=1,sdf:u=!1,stretchX:p,stretchY:g,content:y}={}){this._lazyInitEmptyStyle();const b=a.I.from(c);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:T,height:C,data:I}=a.o.getImageData(t);this.style.addImage(b,{data:new a.q({width:T,height:C},I),pixelRatio:o,stretchX:p,stretchY:g,content:y,sdf:u,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new a.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:T,height:C}=t,I=t;this.style.addImage(b,{data:new a.q({width:T,height:C},new Uint8Array(I.data)),pixelRatio:o,stretchX:p,stretchY:g,content:y,sdf:u,usvg:!1,version:0,userImage:I}),I.onAdd&&I.onAdd(this,c)}}updateImage(c,t){this._lazyInitEmptyStyle();const o=a.I.from(c),u=this.style.getImage(o);if(!u)return void this.fire(new a.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?a.o.getImageData(t):t,{width:g,height:y,data:b}=p;if(g===void 0||y===void 0)return void this.fire(new a.y(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(g!==(u.usvg?u.icon.usvg_tree.width:u.data.width)||y!==(u.usvg?u.icon.usvg_tree.height:u.data.height))return void this.fire(new a.y(new Error(`The width and height of the updated image (${g}, ${y})
3213                must be that same as the previous version of the image
3214                (${u.data.width}, ${u.data.height})`)));const T=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let C=!1;u.usvg?(u.data=new a.q({width:g,height:y},new Uint8Array(b)),u.usvg=!1,u.icon=void 0,C=!0):u.data.replace(b,T),this.style.updateImage(o,u,C)}hasImage(c){return c?!!this.style&&!!this.style.getImage(a.I.from(c)):(this.fire(new a.y(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(a.I.from(c))}loadImage(c,t){a.n(this._requestManager.transformRequest(c,a.R.Image),(o,u)=>{t(o,u instanceof HTMLImageElement?a.o.getImageData(u):u)})}listImages(){return this.style.listImages().map(c=>c.name)}addModel(c,t){this._lazyInitEmptyStyle(),this.style.addModel(c,t)}hasModel(c){return c?this.style.hasModel(c):(this.fire(new a.y(new Error("Missing required model id"))),!1)}removeModel(c){this.style.removeModel(c)}listModels(){return this.style.listModels()}addLayer(c,t){return this._isValidId(c.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(c,t),this._update(!0)):this}getSlot(c){const t=this.getLayer(c);return t&&t.slot||null}setSlot(c,t){return this.style.setSlot(c,t),this.style.mergeLayers(),this._update(!0)}
vendor: 5,648 bytes, line 3214
3214addImport(c,t){return this.style.addImport(c,t).catch(o=>this.fire(new a.y(new Error("Failed to add import",o)))),this}updateImport(c,t){return typeof t!="string"&&t.id!==c?(this.removeImport(c),this.addImport(t)):(this.style.updateImport(c,t),this._update(!0))}removeImport(c){return this.style.removeImport(c),this}moveImport(c,t){return this.style.moveImport(c,t),this._update(!0)}moveLayer(c,t){return this._isValidId(c)?(this.style.moveLayer(c,t),this._update(!0)):this}removeLayer(c){return this._isValidId(c)?(this.style.removeLayer(c),this._update(!0)):this}getLayer(c){if(!this._isValidId(c))return null;const t=this.style.getOwnLayer(c);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(c,t,o){return this._isValidId(c)?(this.style.setLayerZoomRange(c,t,o),this._update(!0)):this}setFilter(c,t,o={}){return this._isValidId(c)?(this.style.setFilter(c,t,o),this._update(!0)):this}getFilter(c){return this._isValidId(c)?this.style.getFilter(c):null}setPaintProperty(c,t,o,u={}){return this._isValidId(c)?(this.style.setPaintProperty(c,t,o,u),this._update(!0)):this}getPaintProperty(c,t){return this._isValidId(c)?this.style.getPaintProperty(c,t):null}setLayoutProperty(c,t,o,u={}){return this._isValidId(c)?(this.style.setLayoutProperty(c,t,o,u),this._update(!0)):this}getLayoutProperty(c,t){return this._isValidId(c)?this.style.getLayoutProperty(c,t):null}setLayerProperty(c,t,o,u={}){return this._isValidId(c)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(c,t,o,u),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(c){return this.style.setGlyphsUrl(c),this._update(!0)}getSchema(c){return this.style.getSchema(c)}setSchema(c,t){return this.style.setSchema(c,t),this._update(!0)}getConfig(c){return this.style.getConfig(c)}setConfig(c,t){return this.style.setConfig(c,t),this._update(!0)}getConfigProperty(c,t){return this.style.getConfigProperty(c,t)}setConfigProperty(c,t,o){return this.style.setConfigProperty(c,t,o),this._update(!0)}getFeaturesetDescriptors(c){return this.style.getFeaturesetDescriptors(c)}setLights(c){if(this._lazyInitEmptyStyle(),c&&c.length===1&&c[0].type==="flat"){const t=c[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(c),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const c=this.style.getLights()||[];return c.length===0&&c.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),c}setLight(c,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:c}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(c){return this._lazyInitEmptyStyle(),!c&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(c),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(c){return this._lazyInitEmptyStyle(),this.style.setFog(c),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(c){return this._lazyInitEmptyStyle(),this.style.setSnow(c),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(c){return this._lazyInitEmptyStyle(),this.style.setRain(c),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(c){return this._lazyInitEmptyStyle(),this.style.setColorTheme(c),this._update(!0)}setImportColorTheme(c,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(c,t),this._update(!0)}setCamera(c){return this.style.setCamera(c),this._triggerCameraUpdate(c)}_triggerCameraUpdate(c){return this._update(this.transform.setOrthographicProjectionAtLowPitch(c["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(c){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.aT.convert(c),this.transform):0}setFeatureState(c,t){return c.source&&!this._isValidId(c.source)?this:(this.style.setFeatureState(c,t),this._update())}removeFeatureState(c,t){return c.source&&!this._isValidId(c.source)?this:(this.style.removeFeatureState(c,t),this._update())}getFeatureState(c){return c.source&&!this._isValidId(c.source)?null:this.style.getFeatureState(c)}_selectIndoorFloor(c){this.style.indoorManager.selectFloor(c)}_setIndoorActiveFloorsVisibility(c){this.style.indoorManager.setActiveFloorsVisibility(c)}getIndoorTileOptions(c,t){return this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(c,t):null}_updateContainerDimensions(){if(!this._container)return;const c=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let o,u,p,g=this._container;for(;g&&(!u||!p);){const y=window.getComputedStyle(g).transform;y&&y!=="none"&&(o=y.match(/matrix.*\((.+)\)/)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(u=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(p=o[3])),g=g.parentElement}this._containerWidth=u?Math.abs(c/u):c,this._containerHeight=p?Math.abs(t/p):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described 
3214in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const c=this._container;c.classList.add("mapboxgl-map"),(this._missingCSSCanary=Ne("div","mapboxgl-canary",c)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Ne("div","mapboxgl-canvas-container",c);this._canvas=Ne("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=Ne("div","mapboxgl-control-container",c),u=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(p=>{u[p]=Ne("div",`mapboxgl-ctrl-${p}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,t){const o=a.o.devicePixelRatio||1;this._canvas.width=o*Math.ceil(c),this._canvas.height=o*Math.ceil(t),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${t}px`}_addMarker(c){this._markers.push(c)}_removeMarker(c){const t=this._markers.indexOf(c);t!==-1&&this._markers.splice(t,1)}_addPopup(c){this._popups.push(c)}_removePopup(c){const t=this._popups.indexOf(c);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const c=Object.assign({},ft.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",c);t?(Oo(t,!0),this.painter=new Rf(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",o=>{if(o.dataType==="source"){const u=this.transform.elevation?this.transform.elevation._source():null;u&&o.sourceCacheId===u.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),a.k.testSupport(t)):this.fire(new a.y(new Error("Failed to initialize WebGL")))}_contextLost(c){c.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.z("webglcontextlost",{originalEvent:c}))}_contextRestored(c){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new a.z("webglcontextrestored",{originalEvent:c}))}_onMapScroll(c){if(c.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(c){return this.style?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_requestDomTask(c){!this.loaded()||this.loaded()&&!this.isMoving()?c():this._domRenderTaskQueue.add(c)}_render(c){let t;this.fire(new a.z("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,u=a.o.now(),p=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=p.createQuery(),p.beginQuery(o.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(c),this._domRenderTaskQueue.run(c),this._removed)return;this._updateProjectionTransition();const g=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,C=this.transform.pitch,I=a.o.now(),B=new a.ac(T,{now:I,fadeDuration:g,pitch:C,transition:this.style.transition,worldview:this._worldview});this.style.update(B)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedU
vendor: 11,702 bytes, line 3214
3214pdate=!0,this._sourcesDirty=!0);let y=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),y=this._updateAverageElevation(u),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):y=this._updateAverageElevation(u),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,g,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:g,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Ee.mark(re.load),this.fire(new a.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const T=a.o.now()-u;p.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const C=p.getQueryParameter(t,p.QUERY_RESULT)/1e6;p.deleteQuery(t),this.fire(new a.z("gpu-timing-frame",{cpuTime:T,gpuTime:C}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const C=this.painter.queryGpuTimers(T);this.fire(new a.z("gpu-timing-layer",{layerTimes:C}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const C=this.painter.queryGpuTimeDeferredRender(T);this.fire(new a.z("gpu-timing-deferred-render",{gpuTime:C}))},50)}const b=this._sourcesDirty||this._styleDirty||this._placementDirty||y;if(b||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(y=this._updateAverageElevation(u,!0)),y)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new a.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const C=this._calculateSpeedIndex();this.fire(new a.z("speedindexcompleted",{speedIndex:C})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||b||(this._fullyLoaded=!0,Ee.mark(re.fullLoad),this._performanceMetricsCollection&&Nn(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(c){for(const t of this._markers)c&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!c||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(c,t=!1){const o=p=>(this.transform.averageElevation=p,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const u=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(u||(t||c-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(c)){const p=this.transform.averageElevation;let g=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(g)?g=0:this._averageElevationLastSampledAt=c;const y=Math.abs(p-g);if(y>1){if(this._isInitialLoad||u)return this._averageElevation.jumpTo(g),o(g);this._averageElevation.easeTo(g,c,300)}else if(y>1e-4)return this._averageElevation.jumpTo(g),o(g)}return!!this._averageElevation.isEasing(c)&&o(this._averageElevation.getValue(c))}_authenticate(){Ka(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,c=>{if(c&&(c.message===Vt||c.status===401)){const t=this.painter.context.gl;Oo(t,!1),this._logoControl instanceof js&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),ui(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ai(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&xi(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Xn(this._requestManager._customAccessToken)}_updateTerrain(){const c=this._isDragging();this.painter.updateTerrain(this.style,c)}_calculateSpeedIndex(){const c=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const o=this.painter.context.gl,u=o.createFramebuffer();function p(g){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,g,0);const y=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,y),y}return o.bindFramebuffer(o.FRAMEBUFFER,u),this._canvasPixelComparison(p(c),t.canvasCopies.map(p),t.timeStamps)}_canvasPixelComparison(c,t,o){let u=o[1]-o[0];const p=c.length/4;for(let g=0;g<t.length;g++){const y=t[g];let b=0;for(let T=0;T<y.length;T+=4)y[T]===c[T]&&y[T+1]===c[T+1]&&y[T+2]===c[T+2]&&y[T+3]===c[T+3]&&(b+=1);u+=(o[g+2]-o[g+1])*(1-b/p)}return u}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const c=this.painter.context.gl.getExtension("WEBGL_lose_context");c&&c.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),Qa.delete(this.painter.context.gl),bo.remove(),Ht.remove(),this._removed=!0,this.fire(new a.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(c){this._renderNextFrame=this._renderNextFrame||c,this.style&&!this._frame&&(this._frame=a.o.frame(t=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(t)}))}_preloadTiles(c){const t=this.style?this.style.getSourceCaches():[];return a.bw(t,(o,u)=>o._preloadTiles(c,u),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(c){this._trackResize&&this.resize({originalEvent:c})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(c){this._showParseStatus!==c&&(this._showParseStatus=c,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(c){this._showTerrainWireframe!==c&&(this._showTerrainWireframe=c,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(c){this._showLayers2DWireframe!==c&&(this._showLayers2DWireframe=c,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(c){this._showLayers3DWireframe!==c&&(this._showLayers3DWireframe=c,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(c){this._speedIndexTiming!==c&&(this._speedIndexTiming=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,this.style&&c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(c){this._showTileAABBs!==c&&(this._showTileAABBs=c,c&&this._update())}_setCacheLimits(c,t){a.f4(c,t)}get version(){return ue}},NavigationControl:class{constructor(c={}){this.options=Object.assign({},_l,c),this._container=Ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Ne("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),Ne("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:t}):o.resetNorth({},{originalEvent:t}))}),this._compassIcon=Ne("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const c=this._map;if(!c)return;const t=c.getZoom(),o=t===c.getMaxZoom(),u=t===c.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const c=this._map;if(!c)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(c.transform.pitch*(Math.PI/180)
3214),.5)}) rotateX(${c.transform.pitch}deg) rotateZ(${c.transform.angle*(180/Math.PI)}deg)`:`rotate(${c.transform.angle*(180/Math.PI)}deg)`;c._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(c){return this._map=c,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),c.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&c.on("pitch",this._rotateCompassArrow),c.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new qr(c,this._compass,this.options.visualizePitch)),this._container}onRemove(){const c=this._map;c&&(this._container.remove(),this.options.showZoom&&c.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&c.off("pitch",this._rotateCompassArrow),c.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(c,t){const o=Ne("button",c,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(c,t){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${t}`);c.setAttribute("aria-label",o),c.firstElementChild&&c.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends a.E{constructor(c={}){super();const t=navigator.geolocation;this.options=Object.assign({geolocation:t},Da,c),a.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=zf(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(c){return this._map=c,this._container=Ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(c){const t=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,c(o)};this._supportsGeolocation!==void 0?c(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>t(o.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(c){const t=this._map.getMaxBounds(),o=c.coords;return!!t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(c){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(c))return this._setErrorState(),this.fire(new a.z("outofmaxbounds",c)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=c,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(c),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(c),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("geolocate",Object.assign({coords:c.coords,timestamp:c.timestamp},c.toJSON?{toJSON:c.toJSON.bind(c)}:{}))),this._finish()}}_updateCamera(c){const t=new a.aT(c.coords.longitude,c.coords.latitude),o=c.coords.accuracy,u=this._map.getBearing(),p=Object.assign({bearing:u},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(o),p,{geolocateSource:!0})}_updateMarker(c){if(c){const t=new a.aT(c.coords.longitude,c.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=c.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const c=this._map.transform,t=a.cf(1,c._center.lat)*c.worldSize,o=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(c){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(c.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(c.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("error",{code:c.code,message:c.message,PERMISSION_DENIED:c.PERMISSION_DENIED,POSITION_UNAVAILABLE:c.POSITION_UNAVAILABLE,TIMEOUT:c.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const c=this.options.positionOptions.timeout;c&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},c))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(c){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Ne("button","mapboxgl-ctrl-geolocate",this._container),Ne("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",c===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3214se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Ne("div","mapboxgl-user-location"),this._dotElement.appendChild(Ne("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Ne("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Rr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Ne("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Rr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.z("trackuserlocationend")))})}}_onDeviceOrientation(c){this._userLocationDotMarker&&(c.webkitCompassHeading?this._heading=c.webkitCompassHeading:c.absolute===!0&&(this._heading=-1*c.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.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 a.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let c;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(c={maximumAge:6e5,timeout:0},this._noTimeout=!0):(c=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,c),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(c){return this.options.followUserLocation=c??Da.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.z("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_E
3214RROR"||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new a.z("trackuserlocationend")))),this}_addDeviceOrientationListener(){const c=()=>{const t="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(t,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&c()}).catch(console.error):c()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:xh,ScaleControl:class{constructor(c={}){this.options=Object.assign({},bh,c),a.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const c=this.options.maxWidth||100,t=this._map,o=t._containerHeight/2,u=t._containerWidth/2-c/2,p=t.unproject([u,o]),g=t.unproject([u+c,o]),y=p.distanceTo(g);if(this.options.unit==="imperial"){const b=3.2808*y;b>5280?this._setScale(c,b/5280,"mile"):this._setScale(c,b,"foot")}else this.options.unit==="nautical"?this._setScale(c,y/1852,"nautical-mile"):y>=1e3?this._setScale(c,y/1e3,"kilometer"):this._setScale(c,y,"meter")}_setScale(c,t,o){this._map._requestDomTask(()=>{const u=(function(g){const y=Math.pow(10,`${Math.floor(g)}`.length-1);let b=g/y;return b=b>=10?10:b>=5?5:b>=3?3:b>=2?2:b>=1?1:(function(T){const C=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*C)/C})(b),y*b})(t),p=u/t;this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(u):`${u}&nbsp;${Tr[o]}`,this._container.style.width=c*p+"px"})}onAdd(c){return this._map=c,this._language=c.getLanguage(),this._container=Ne("div","mapboxgl-ctrl mapboxgl-ctrl-scale",c.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(c){this._language=c,this._update()}setUnit(c){this.options.unit=c,this._update()}},FullscreenControl:class{constructor(c={}){this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:a.w("Full screen control 'container' must be a DOM element.")),a.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=Ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const c=this._fullscreenButton=Ne("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Ne("span","mapboxgl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",c)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:of,Popup:class extends a.E{constructor(c){super(),this.options=Object.assign(Object.create(ma),c),this._altitude=this.options.altitude,a.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(c&&c.className?c.className.trim().split(/\s+/):[])}addTo(c){return this._map&&this.remove(),this._map=c,this.options.closeOnClick&&c.on("preclick",this._onClose),this.options.closeOnMove&&c.on("move",this._onClose),c.on("remove",this.remove),this._update(),c._addPopup(this),this._focusFirstElement(),this._trackPointer?(c.on("mousemove",this._onMouseEvent),c.on("mouseup",this._onMouseEvent),c._canvasContainer.classList.add("mapboxgl-track-pointer")):c.on("move",this._update),this.fire(new a.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const c=this._map;
vendor: 7,130 bytes, line 3214
3214return c&&(c.off("move",this._update),c.off("move",this._onClose),c.off("preclick",this._onClose),c.off("click",this._onClose),c.off("remove",this.remove),c.off("mousemove",this._onMouseEvent),c.off("mouseup",this._onMouseEvent),c.off("drag",this._onMouseEvent),c._canvasContainer&&c._canvasContainer.classList.remove("mapboxgl-track-pointer"),c._removePopup(this),this._map=void 0),this.fire(new a.z("close")),this}getLngLat(){return this._lngLat}setLngLat(c){this._lngLat=a.aT.convert(c),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(c){return this._altitude=c,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const c=this._map;return c&&(c.off("move",this._update),c.on("mousemove",this._onMouseEvent),c.on("drag",this._onMouseEvent),c._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){const t=document.createDocumentFragment(),o=document.createElement("body");let u;for(o.innerHTML=c;u=o.firstChild,u;)t.appendChild(u);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=Ne("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(c),this.options.closeButton){const o=this._closeButton=Ne("button","mapboxgl-popup-close-button",t);o.type="button",o.setAttribute("aria-label","Close popup"),o.innerHTML='<span aria-hidden="true">&#215;</span>',o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(c){return this._classList.add(c),this._updateClassList(),this}removeClassName(c){return this._classList.delete(c),this._updateClassList(),this}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){let t;return this._classList.delete(c)?t=!1:(this._classList.add(c),t=!0),this._updateClassList(),t}_onMouseEvent(c){this._update(c.point)}_getAnchor(c){if(this.options.anchor)return this.options.anchor;const t=this._map,o=this._container,u=this._pos;if(!t||!o||!u)return"bottom";const p=o.offsetWidth,g=o.offsetHeight,y=u.x<p/2,b=u.x>t.transform.width-p/2;if(u.y+c<g)return y?"top-left":b?"top-right":"top";if(u.y>t.transform.height-g){if(y)return"bottom-left";if(b)return"bottom-right"}return y?"left":b?"right":"bottom"}_updateClassList(){const c=this._container;if(!c)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),c.className=t.join(" ")}_update(c){const t=this._map,o=this._content;if(!t||!this._lngLat&&!this._trackPointer||!o)return;let u=this._container;if(u||(u=this._container=Ne("div","mapboxgl-popup",t.getContainer()),this._tip=Ne("div","mapboxgl-popup-tip",u),u.appendChild(o)),this.options.maxWidth&&u.style.maxWidth!==this.options.maxWidth&&(u.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=yu(this._lngLat,this._pos,t.transform)),!this._trackPointer||c){const p=this._pos=this._trackPointer&&c instanceof a.P?c:t.project(this._lngLat,this._altitude),g=xu(this.options.offset),y=this._anchor=this._getAnchor(g.y),b=xu(this.options.offset,y),T=p.add(b).round();t._requestDomTask(()=>{this._container&&y&&(this._container.style.transform=`${gs[y]} translate(${T.x}px,${T.y}px)`)})}if(!this._marker&&t._showingGlobe()){const p=a.f5(t.transform,this._lngLat)?0:1;this._setOpacity(p)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const c=this._container.querySelector(Kl);c&&c.focus()}_onClose(){this.remove()}_setOpacity(c){this._container&&(this._container.style.opacity=`${c}`),this._content&&(this._content.style.pointerEvents=c?"auto":"none")}},Marker:Rr,Style:ea,LngLat:a.aT,LngLatBounds:a.aI,Point:a.P,MercatorCoordinate:a.ae,FreeCameraOptions:Im,Evented:a.E,config:a.e,prewarm:a.f9,clearPrewarmedResources:a.f8,get accessToken(){return a.e.ACCESS_TOKEN},set accessToken(c){a.e.ACCESS_TOKEN=c},get baseApiUrl(){return a.e.API_URL},set baseApiUrl(c){a.e.API_URL=c},get workerCount(){return a.fi.workerCount},set workerCount(c){a.fi.workerCount=c},get maxParallelImageRequests(){return a.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(c){a.e.MAX_PARALLEL_IMAGE_REQUESTS=c},clearStorage(c){a.fh(c)},get workerUrl(){return a.fg.workerUrl},set workerUrl(c){a.fg.workerUrl=c},get workerClass(){return a.fg.workerClass},set workerClass(c){a.fg.workerClass=c},get workerParams(){return a.fg.workerParams},set workerParams(c){a.fg.workerParams=c},get dracoUrl(){return a.ff()},set dracoUrl(c){a.fe(c)},get meshoptUrl(){return a.fd()},set meshoptUrl(c){a.fc(c)},setNow:a.o.setNow,restoreNow:a.o.restoreNow}});var fe=X;return fe}))})(Cx)),Cx.exports}var Z3=q3();const Bh=Bx(Z3);Bh.accessToken="pk.eyJ1Ijoic2VjcmV0bmFtaWJpYSIsImEiOiJjbGpxM2EyYm4wMmc2M2luZ2N0NWdoOHphIn0.nZvxT5FGIKMXIjmK6ZxFkg";const W_={drive:"#8B2323",flight:"#2E5B4E",transfer:"#C4956A"},$3={type:"FeatureCollection",features:[{type:"Feature",properties:{name:"Windhoek",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[17.0842,-22.5649]}},{type:"Feature",properties:{name:"Swakopmund",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[14.5053,-22.6784]}},{type:"Feature",properties:{name:"Walvis Bay",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[14.5053,-22.9576]}},{type:"Feature",properties:{name:"Lüderitz",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[15.1591,-26.6481]}},{type:"Feature",properties:{name:"Oshakati",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[15.6881,-17.7872]}},{type:"Feature",properties:{name:"Rundu",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[19.7686,-17.9264]}},{type:"Feature",properties:{name:"Katima Mulilo",type:"city",country:"Namibia"},geometry:{type:"Point",coordinates:[24.2747,-17.5]}},{type:"Feature",properties:{name:"Otjiwarongo",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[16.6478,-20.4639]}},{type:"Feature",properties:{name:"Okahandja",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[16.9167,-21.9833]}},{type:"Feature",properties:{name:"Tsumeb",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[17.7167,-19.2333]}},{type:"Feature",properties:{name:"Outjo",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[16.15,-20.1167]}},{type:"Feature",properties:{name:"Keetmanshoop",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[18.1333,-26.5833]}},{type:"Feature",properties:{name:"Mariental",type:"town",country:"Namibia"}
3214,geometry:{type:"Point",coordinates:[17.9667,-24.6333]}},{type:"Feature",properties:{name:"Rehoboth",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[17.0833,-23.3167]}},{type:"Feature",properties:{name:"Gobabis",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[18.9667,-22.45]}},{type:"Feature",properties:{name:"Grootfontein",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[18.1167,-19.5667]}},{type:"Feature",properties:{name:"Ondangwa",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[15.95,-17.9167]}},{type:"Feature",properties:{name:"Opuwo",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[13.84,-18.06]}},{type:"Feature",properties:{name:"Karibib",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[15.85,-21.9333]}},{type:"Feature",properties:{name:"Usakos",type:"town",country:"Namibia"},geometry:{type:"Point",coordinates:[15.5833,-22]}},{type:"Feature",properties:{name:"Etosha",type:"park",country:"Namibia"},geometry:{type:"Point",coordinates:[16.3167,-18.85]}},{type:"Feature",properties:{name:"Sossusvlei",type:"park",country:"Namibia"},geometry:{type:"Point",coordinates:[15.2833,-24.7333]}},{type:"Feature",properties:{name:"Skeleton Coast",type:"park",country:"Namibia"},geometry:{type:"Point",coordinates:[13,-19.5]}},{type:"Feature",properties:{name:"Fish River Canyon",type:"park",country:"Namibia"},geometry:{type:"Point",coordinates:[17.55,-27.5833]}},{type:"Feature",properties:{name:"Damaraland",type:"region",country:"Namibia"},geometry:{type:"Point",coordinates:[14.5,-20.5]}},{type:"Feature",properties:{name:"Caprivi Strip",type:"region",country:"Namibia"},geometry:{type:"Point",coordinates:[22,-18]}},{type:"Feature",properties:{name:"Cape Town",type:"city",country:"South Africa"},geometry:{type:"Point",coordinates:[18.4241,-33.9249]}},{type:"Feature",properties:{name:"Johannesburg",type:"city",country:"South Africa"},geometry:{type:"Point",coordinates:[28.0473,-26.2041]}},{type:"Feature",properties:{name:"Durban",type:"city",country:"South Africa"},geometry:{type:"Point",coordinates:[31.0218,-29.8587]}},{type:"Feature",properties:{name:"Pretoria",type:"city",country:"South Africa"},geometry:{type:"Point",coordinates:[28.1881,-25.7479]}},{type:"Feature",properties:{name:"Port Elizabeth",type:"city",country:"South Africa"},geometry:{type:"Point",coordinates:[25.8915,-33.9608]}},{type:"Feature",properties:{name:"Bloemfontein",type:"city",country:"South Africa"},geometry:{type:"Point",coordinates:[26.2309,-29.0852]}},{type:"Feature",properties:{name:"Stellenbosch",type:"town",country:"South Africa"},geometry:{type:"Point",coordinates:[18.8602,-33.9321]}},{type:"Feature",properties:{name:"Franschhoek",type:"town",country:"South Africa"},geometry:{type:"Point",coordinates:[19.1167,-33.9]}},{type:"Feature",properties:{name:"Knysna",type:"town",country:"South Africa"},geometry:{type:"Point",coordinates:[23.0486,-34.0356]}},{type:"Feature",properties:{name:"Hermanus",type:"town",country:"South Africa"},geometry:{type:"Point",coordinates:[19.2417,-34.4167]}},{type:"Feature",properties:{name:"Hoedspruit",type:"town",country:"South Africa"},geometry:{type:"Point",coordinates:[30.9667,-24.35]}},{type:"Feature",properties:{name:"Nelspruit",type:"town",country:"South Africa"},geometry:{type:"Point",coordinates:[30.9667,-25.4667]}},{type:"Feature",properties:{name:"Kruger National Park",type:"park",country:"South Africa"},geometry:{type:"Point",coordinates:[31.5,-24]}},{type:"Feature",properties:{name:"Table Mountain",type:"park",country:"South Africa"},geometry:{type:"Point",coordinates:[18.4036,-33.9628]}},{type:"Feature",properties:{name:"Garden Route",type:"region",country:"South Africa"},geometry:{type:"Point",coordinates:[22.5,-34]}},{type:"Feature",properties:{name:"Sabi Sands",type:"park",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4,-24.8]}},{type:"Feature",properties:{name:"Addo Elephant Park",type:"park",country:"South Africa"},geometry:{type:"Point",coordinates:[25.7667,-33.45]}},{type:"Feature",properties:{name:"Gaborone",type:"city",country:"Botswana"},geometry:{type:"Point",coordinates:[25.9231,-24.6282]}},{type:"Feature",properties:{name:"Francistown",type:"city",country:"Botswana"},geometry:{type:"Point",coordinates:[27.5167,-21.1667]}},{type:"Feature",properties:{name:"Maun",type:"city",country:"Botswana"},geometry:{type:"Point",coordinates:[23.4167,-19.9833]}},{type:"Feature",properties:{name:"Kasane",type:"town",country:"Botswana"},geometry:{type:"Point",coordinates:[25.15,-17.8]}},{type:"Feature",properties:{name:"Nata",type:"town",country:"Botswana"},geometry:{type:"Point",coordinates:[26.2167,-20.2167]}},{type:"Feature",properties:{name:"Okavango Delta",type:"park",country:"Botswana"},geometry:{type:"Point",coordinates:[22.5,-19.3]}},{type:"Feature",properties:{name:"Chobe National Park",type:"park",country:"Botswana"},geometry:{type:"Point",coordinates:[25,-18.5]}}
3214,{type:"Feature",properties:{name:"Central Kalahari",type:"park",country:"Botswana"},geometry:{type:"Point",coordinates:[23.5,-22]}},{type:"Feature",properties:{name:"Makgadikgadi Pans",type:"park",country:"Botswana"},geometry:{type:"Point",coordinates:[25.5,-20.5]}},{type:"Feature",properties:{name:"Moremi Game Reserve",type:"park",country:"Botswana"},geometry:{type:"Point",coordinates:[23,-19.2]}},{type:"Feature",properties:{name:"Lusaka",type:"city",country:"Zambia"},geometry:{type:"Point",coordinates:[28.2871,-15.3875]}},{type:"Feature",properties:{name:"Livingstone",type:"city",country:"Zambia"},geometry:{type:"Point",coordinates:[25.86,-17.8419]}},{type:"Feature",properties:{name:"Ndola",type:"city",country:"Zambia"},geometry:{type:"Point",coordinates:[28.6366,-12.9587]}},{type:"Feature",properties:{name:"Kitwe",type:"city",country:"Zambia"},geometry:{type:"Point",coordinates:[28.213,-12.8024]}},{type:"Feature",properties:{name:"Victoria Falls (Zambia)",type:"park",country:"Zambia"},geometry:{type:"Point",coordinates:[25.8567,-17.9244]}},{type:"Feature",properties:{name:"South Luangwa",type:"park",country:"Zambia"},geometry:{type:"Point",coordinates:[31.8,-13]}},{type:"Feature",properties:{name:"Lower Zambezi",type:"park",country:"Zambia"},geometry:{type:"Point",coordinates:[29.5,-15.5]}},{type:"Feature",properties:{name:"Kafue National Park",type:"park",country:"Zambia"},geometry:{type:"Point",coordinates:[26,-15]}},{type:"Feature",properties:{name:"Harare",type:"city",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[31.0492,-17.8292]}},{type:"Feature",properties:{name:"Bulawayo",type:"city",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[28.5833,-20.15]}},{type:"Feature",properties:{name:"Victoria Falls (Zimbabwe)",type:"city",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[25.8333,-17.9333]}},{type:"Feature",properties:{name:"Hwange National Park",type:"park",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.5,-18.5]}},{type:"Feature",properties:{name:"Mana Pools",type:"park",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[29.4,-15.8]}},{type:"Feature",properties:{name:"Matobo Hills",type:"park",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[28.5,-20.5]}},{type:"Feature",properties:{name:"Lake Kariba",type:"park",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[28,-16.8]}},{type:"Feature",properties:{name:"Nairobi",type:"city",country:"Kenya"},geometry:{type:"Point",coordinates:[36.8219,-1.2921]}},{type:"Feature",properties:{name:"Mombasa",type:"city",country:"Kenya"},geometry:{type:"Point",coordinates:[39.6682,-4.0435]}},{type:"Feature",properties:{name:"Kisumu",type:"city",country:"Kenya"},geometry:{type:"Point",coordinates:[34.7617,-.1022]}},{type:"Feature",properties:{name:"Nakuru",type:"city",country:"Kenya"},geometry:{type:"Point",coordinates:[36.0667,-.2833]}},{type:"Feature",properties:{name:"Malindi",type:"town",country:"Kenya"},geometry:{type:"Point",coordinates:[40.1167,-3.2167]}},{type:"Feature",properties:{name:"Lamu",type:"town",country:"Kenya"},geometry:{type:"Point",coordinates:[40.9,-2.2667]}},{type:"Feature",properties:{name:"Masai Mara",type:"park",country:"Kenya"},geometry:{type:"Point",coordinates:[35,-1.5]}},{type:"Feature",properties:{name:"Amboseli",type:"park",country:"Kenya"},geometry:{type:"Point",coordinates:[37.25,-2.65]}},{type:"Feature",properties:{name:"Tsavo",type:"park",country:"Kenya"},geometry:{type:"Point",coordinates:[38.5,-3]}},{type:"Feature",properties:{name:"Lake Nakuru",type:"park",country:"Kenya"},geometry:{type:"Point",coordinates:[36.0833,-.3667]}},{type:"Feature",properties:{name:"Samburu",type:"park",country:"Kenya"},geometry:{type:"Point",coordinates:[37.5,.6]}},{type:"Feature",properties:{name:"Laikipia",type:"region",country:"Kenya"},geometry:{type:"Point",coordinates:[36.8,.3]}},{type:"Feature",properties:{name:"Dar es Salaam",type:"city",country:"Tanzania"},geometry:{type:"Point",coordinates:[39.2083,-6.7924]}},{type:"Feature",properties:{name:"Arusha",type:"city",country:"Tanzania"},geometry:{type:"Point",coordinates:[36.6833,-3.3667]}}
3214,{type:"Feature",properties:{name:"Zanzibar City",type:"city",country:"Tanzania"},geometry:{type:"Point",coordinates:[39.188,-6.1659]}},{type:"Feature",properties:{name:"Mwanza",type:"city",country:"Tanzania"},geometry:{type:"Point",coordinates:[32.9,-2.5167]}},{type:"Feature",properties:{name:"Dodoma",type:"city",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.75,-6.1833]}},{type:"Feature",properties:{name:"Serengeti",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.8333,-2.3333]}},{type:"Feature",properties:{name:"Ngorongoro Crater",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.5833,-3.1833]}},{type:"Feature",properties:{name:"Mount Kilimanjaro",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[37.3556,-3.0674]}},{type:"Feature",properties:{name:"Tarangire",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[36,-4]}},{type:"Feature",properties:{name:"Lake Manyara",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.8333,-3.5333]}},{type:"Feature",properties:{name:"Selous Game Reserve",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[37.5,-9]}},{type:"Feature",properties:{name:"Ruaha",type:"park",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.5,-7.5]}},{type:"Feature",properties:{name:"Zanzibar",type:"region",country:"Tanzania"},geometry:{type:"Point",coordinates:[39.5,-6]}},{type:"Feature",properties:{name:"Little Kulala",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[15.4833,-24.75]}},{type:"Feature",properties:{name:"Kulala Desert Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[15.5167,-24.7333]}},{type:"Feature",properties:{name:"Hoanib Skeleton Coast",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[13.3667,-19.35]}},{type:"Feature",properties:{name:"Serra Cafema",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[12.2,-17.25]}}
3214,{type:"Feature",properties:{name:"Damaraland Camp",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[14.1667,-20.4167]}},{type:"Feature",properties:{name:"Desert Rhino Camp",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[14.0833,-20.25]}},{type:"Feature",properties:{name:"Doro Nawas",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[14.2,-20.5333]}},{type:"Feature",properties:{name:"Sossusvlei Desert Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[15.8667,-24.8333]}},{type:"Feature",properties:{name:"Ongava Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[15.9167,-18.9167]}},{type:"Feature",properties:{name:"Little Ongava",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[15.9,-18.9333]}},{type:"Feature",properties:{name:"Okonjima",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[16.7167,-20.75]}},{type:"Feature",properties:{name:"Etosha Safari Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[16.0333,-19.05]}},{type:"Feature",properties:{name:"Mushara Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[17.1,-18.8167]}},{type:"Feature",properties:{name:"Onguma",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[17.0833,-18.7333]}},{type:"Feature",properties:{name:"Mokuti Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[17.0667,-18.8167]}},{type:"Feature",properties:{name:"Shipwreck Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[12.65,-19.0833]}},{type:"Feature",properties:{name:"Wolwedans",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[16,-24.9167]}},{type:"Feature",properties:{name:"Zannier Sonop",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[16.05,-24.9333]}},{type:"Feature",properties:{name:"Fish River Lodge",type:"lodge",country:"Namibia"},geometry:{type:"Point",coordinates:[17.6,-27.45]}},{type:"Feature",properties:{name:"Singita Lebombo",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.95,-24.0167]}},{type:"Feature",properties:{name:"Singita Sweni",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.9333,-24.0333]}},{type:"Feature",properties:{name:"Singita Ebony",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4667,-24.8167]}},{type:"Feature",properties:{name:"Singita Boulders",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.45,-24.8333]}},{type:"Feature",properties:{name:"Singita Castleton",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4833,-24.8]}},{type:"Feature",properties:{name:"Londolozi",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.5,-24.7833]}},{type:"Feature",properties:{name:"Kirkman's Kamp",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4833,-24.85]}},{type:"Feature",properties:{name:"Ngala Safari Lodge",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4,-24.4]}},{type:"Feature",properties:{name:"Phinda",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[32.35,-27.8333]}},{type:"Feature",properties:{name:"Lion Sands",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.5333,-24.9167]}},{type:"Feature",properties:{name:"Mala Mala",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.5167,-24.7667]}},{type:"Feature",properties:{name:"Ulusaba",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.3667,-24.7833]}},{type:"Feature",properties:{name:"Chitwa Chitwa",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4333,-24.8667]}},{type:"Feature",properties:{name:"Savanna Lodge",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.4167,-24.8833]}},{type:"Feature",properties:{name:"Royal Malewane",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.1667,-24.3833]}},{type:"Feature",properties:{name:"Tanda Tula",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.2333,-24.35]}},{type:"Feature",properties:{name:"Motswari",type:"lodge",country:"South Africa"},geometry:{type:"Point",coordinates:[31.2,-24.3667]}},{type:"Feature",properties:{name:"Mombo Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[22.7833,-19.2167]}},{type:"Feature",properties:{name:"Little Mombo",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[22.7667,-19.2333]}},{type:"Feature",properties:{name:"Vumbura Plains",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[22.8167,-18.9667]}},{type:"Feature",properties:{name:"Chitabe",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.3833,-19.4667]}},{type:"Feature",properties:{name:"Jao Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[22.55,-19.0833]}},{type:"Feature",properties:{name:"Kings Pool",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.5333,-18.45]}}
3214,{type:"Feature",properties:{name:"DumaTau",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.6167,-18.4333]}},{type:"Feature",properties:{name:"Savuti Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[24.0667,-18.5667]}},{type:"Feature",properties:{name:"Jackalberry",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.7,-18.4833]}},{type:"Feature",properties:{name:"Singita Sabora",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23,-19.15]}},{type:"Feature",properties:{name:"Sandibe",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.15,-19.5333]}},{type:"Feature",properties:{name:"Nxabega",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[22.9833,-19.45]}},{type:"Feature",properties:{name:"Xaranna",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.0167,-19.4833]}},{type:"Feature",properties:{name:"Chobe Game Lodge",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[25.1333,-17.8167]}},{type:"Feature",properties:{name:"Zarafa",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.5667,-18.4667]}},{type:"Feature",properties:{name:"Selinda Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[23.5,-18.5]}},{type:"Feature",properties:{name:"Abu Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[22.4667,-19.2167]}},{type:"Feature",properties:{name:"Jack's Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[25.2333,-20.3833]}},{type:"Feature",properties:{name:"San Camp",type:"lodge",country:"Botswana"},geometry:{type:"Point",coordinates:[25.25,-20.4]}},{type:"Feature",properties:{name:"Toka Leya",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[25.8333,-17.8833]}},{type:"Feature",properties:{name:"Shumba Camp",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[26.0833,-14.9667]}},{type:"Feature",properties:{name:"Busanga Bush Camp",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[25.85,-14.4167]}},{type:"Feature",properties:{name:"Nkwali Camp",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[31.7833,-13.1]}},{type:"Feature",properties:{name:"Tena Tena",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[31.8167,-13.0667]}},{type:"Feature",properties:{name:"Nsefu Camp",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[31.85,-13.05]}},{type:"Feature",properties:{name:"Chinzombo",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[31.7667,-13.1167]}},{type:"Feature",properties:{name:"Mchenja",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[31.8333,-13.0833]}},{type:"Feature",properties:{name:"Royal Chundu",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[25.7,-17.85]}},{type:"Feature",properties:{name:"Tongabezi",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[25.7333,-17.8667]}},{type:"Feature",properties:{name:"Chiawa Camp",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[29.3833,-15.65]}},{type:"Feature",properties:{name:"Old Mondoro",type:"lodge",country:"Zambia"},geometry:{type:"Point",coordinates:[29.4167,-15.6333]}},{type:"Feature",properties:{name:"Linkwasha",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.9167,-18.6833]}},{type:"Feature",properties:{name:"Little Makalolo",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.8833,-18.7]}},{type:"Feature",properties:{name:"Davison's Camp",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.85,-18.7167]}},{type:"Feature",properties:{name:"Ruckomechi",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[29.1667,-15.7833]}},{type:"Feature",properties:{name:"Singita Pamushana",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[31.95,-21.05]}},{type:"Feature",properties:{name:"Victoria Falls Hotel",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[25.85,-17.9333]}},{type:"Feature",properties:{name:"The Hide",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.75,-18.65]}},{type:"Feature",properties:{name:"Somalisa",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.8,-18.6667]}},{type:"Feature",properties:{name:"Camp Hwange",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[26.7667,-18.6333]}},{type:"Feature",properties:{name:"Changa Safari Camp",type:"lodge",country:"Zimbabwe"},geometry:{type:"Point",coordinates:[28.7833,-16.8333]}},{type:"Feature",properties:{name:"Singita Mara River",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[34.8667,-1.3833]}},{type:"Feature",properties:{name:"Bateleur Camp",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[35.05,-1.4167]}},{type:"Feature",properties:{name:"Kichwa Tembo",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[35.0333,-1.35]}},{type:"Feature",properties:{name:"Angama Mara",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[35.0167,-1.2833]}},{type:"Feature",properties:{name:"Governors Camp",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[35,-1.45]}}
3214,{type:"Feature",properties:{name:"Little Governors",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[35.0167,-1.4333]}},{type:"Feature",properties:{name:"Cottar's 1920s",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[35.25,-1.5167]}},{type:"Feature",properties:{name:"Saruni Samburu",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.5333,.6167]}},{type:"Feature",properties:{name:"Sasaab",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.4833,.5833]}},{type:"Feature",properties:{name:"Elephant Bedroom",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.5167,.6]}},{type:"Feature",properties:{name:"Segera Retreat",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.0167,.2333]}},{type:"Feature",properties:{name:"Ol Pejeta",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[36.9167,.0167]}},{type:"Feature",properties:{name:"Lewa Safari Camp",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.4167,.2]}},{type:"Feature",properties:{name:"Sirikoi",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.4333,.1833]}},{type:"Feature",properties:{name:"Tortilis Camp",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.2667,-2.6333]}},{type:"Feature",properties:{name:"Ol Tukai",type:"lodge",country:"Kenya"},geometry:{type:"Point",coordinates:[37.25,-2.65]}},{type:"Feature",properties:{name:"Singita Grumeti",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.7,-2.15]}},{type:"Feature",properties:{name:"Singita Sasakwa",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.7167,-2.1333]}},{type:"Feature",properties:{name:"Singita Faru Faru",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.7333,-2.1667]}},{type:"Feature",properties:{name:"Singita Mara River (TZ)",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.85,-1.55]}},{type:"Feature",properties:{name:"Ngorongoro Crater Lodge",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.5833,-3.2]}},{type:"Feature",properties:{name:"Klein's Camp",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.2667,-1.8833]}},{type:"Feature",properties:{name:"Grumeti Serengeti",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.6833,-2.1833]}},{type:"Feature",properties:{name:"Mnemba Island",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[39.3833,-5.8167]}},{type:"Feature",properties:{name:"Namiri Plains",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.35,-2.5333]}},{type:"Feature",properties:{name:"Sayari Camp",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.8333,-1.6]}},{type:"Feature",properties:{name:"Highlands Ngorongoro",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.55,-3.1667]}},{type:"Feature",properties:{name:"Olakira Camp",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.9,-1.7]}},{type:"Feature",properties:{name:"Four Seasons Serengeti",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.8167,-2.35]}},{type:"Feature",properties:{name:"Serengeti Migration Camp",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.8,-1.65]}},{type:"Feature",properties:{name:"Lemala Kuria Hills",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[34.8667,-1.5833]}},{type:"Feature",properties:{name:"Tarangire Treetops",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[36.0333,-3.95]}},{type:"Feature",properties:{name:"Chem Chem",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.9833,-3.8833]}},{type:"Feature",properties:{name:"Lake Manyara Tree Lodge",type:"lodge",country:"Tanzania"},geometry:{type:"Point",coordinates:[35.85,-3.55]}},{type:"Feature",properties:{name:"NAMIBIA",type:"country"},geometry:{type:"Point",coordinates:[17,-22]}},{type:"Feature",properties:{name:"SOUTH AFRICA",type:"country"},geometry:{type:"Point",coordinates:[25,-29]}},{type:"Feature",properties:{name:"BOTSWANA",type:"country"},geometry:{type:"Point",coordinates:[24,-22.5]}}
3214,{type:"Feature",properties:{name:"ZAMBIA",type:"country"},geometry:{type:"Point",coordinates:[28,-14]}},{type:"Feature",properties:{name:"ZIMBABWE",type:"country"},geometry:{type:"Point",coordinates:[29.5,-19]}},{type:"Feature",properties:{name:"KENYA",type:"country"},geometry:{type:"Point",coordinates:[38,-1]}},{type:"Feature",properties:{name:"TANZANIA",type:"country"},geometry:{type:"Point",coordinates:[35,-6]}},{type:"Feature",properties:{name:"ANGOLA",type:"country"},geometry:{type:"Point",coordinates:[17.5,-12.5]}},{type:"Feature",properties:{name:"MOZAMBIQUE",type:"country"},geometry:{type:"Point",coordinates:[35,-18]}},{type:"Feature",properties:{name:"MALAWI",type:"country"},geometry:{type:"Point",coordinates:[34,-13.5]}},{type:"Feature",properties:{name:"DRC",type:"country"},geometry:{type:"Point",coordinates:[23,-4]}},{type:"Feature",properties:{name:"UGANDA",type:"country"},geometry:{type:"Point",coordinates:[32.5,1]}},{type:"Feature",properties:{name:"RWANDA",type:"country"},geometry:{type:"Point",coordinates:[29.8,-2]}},{type:"Feature",properties:{name:"ETHIOPIA",type:"country"},geometry:{type:"Point",coordinates:[40,9]}},{type:"Feature",properties:{name:"SOMALIA",type:"country"},geometry:{type:"Point",coordinates:[46,5]}}]},X3={version:8,name:"Secret Namibia Safari",sources:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v8"},"mapbox-terrain":{type:"vector",url:"mapbox://mapbox.mapbox-terrain-v2"},"africa-places":{type:"geojson",data:$3}},glyphs:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"#F5F0E8"}},{id:"land",type:"fill",source:"mapbox-streets","source-layer":"landuse",paint:{"fill-color":["match",["get","class"],"park","#D8E4D0","national_park","#D0DCC8","nature_reserve","#D4E0CC","cemetery","#E8E4D8","hospital","#F5F0E8","school","#F5F0E8","airport","#E8E4DC","#F5F0E8"],"fill-opacity":.7}},{id:"national-parks",type:"fill",source:"mapbox-streets","source-layer":"landuse",filter:["in",["get","class"],["literal",["national_park","nature_reserve","park"]]],paint:{"fill-color":"#D0DCC8","fill-opacity":.5}},{id:"hillshade",type:"fill",source:"mapbox-terrain","source-layer":"hillshade",paint:{"fill-color":["match",["get","level"],94,"#F5F0E8",90,"#EBE6DE",89,"#E5E0D8",78,"#DDD8D0",67,"#D5D0C8",56,"#CCC7BF","#F5F0E8"],"fill-opacity":.35}},{id:"water",type:"fill",source:"mapbox-streets","source-layer":"water",paint:{"fill-color":"#B8C8D4","fill-opacity":.9}},{id:"waterways",type:"line",source:"mapbox-streets","source-layer":"waterway",paint:{"line-color":"#A8B8C4","line-width":["interpolate",["linear"],["zoom"],5,.5,10,1.5,14,3]}},{id:"admin-country",type:"line",source:"mapbox-streets","source-layer":"admin",filter:["==",["get","admin_level"],0],paint:{"line-color":"#908070","line-width":1.5,"line-dasharray":[3,2]}},{id:"admin-state",type:"line",source:"mapbox-streets","source-layer":"admin",filter:["==",["get","admin_level"],1],paint:{"line-color":"#B0A090","line-width":.8,"line-dasharray":[2,2]}},{id:"roads-tertiary",type:"line",source:"mapbox-streets","source-layer":"road",filter:["in",["get","class"],["literal",["tert
3214iary","tertiary_link"]]],minzoom:7,paint:{"line-color":"#D8D0C8","line-width":["interpolate",["linear"],["zoom"],7,.3,10,.8,14,2]}},{id:"roads-secondary",type:"line",source:"mapbox-streets","source-layer":"road",filter:["in",["get","class"],["literal",["secondary","secondary_link"]]],minzoom:6,paint:{"line-color":"#D0C8C0","line-width":["interpolate",["linear"],["zoom"],6,.4,10,1.2,14,2.5]}},{id:"roads-primary",type:"line",source:"mapbox-streets","source-layer":"road",filter:["in",["get","class"],["literal",["primary","primary_link"]]],minzoom:5,paint:{"line-color":"#C8C0B8","line-width":["interpolate",["linear"],["zoom"],5,.5,10,1.5,14,3]}},{id:"roads-major",type:"line",source:"mapbox-streets","source-layer":"road",filter:["in",["get","class"],["literal",["motorway","trunk","motorway_link","trunk_link"]]],paint:{"line-color":"#B8B0A8","line-width":["interpolate",["linear"],["zoom"],4,.6,8,1.5,12,3,16,5]}},{id:"road-labels",type:"symbol",source:"mapbox-streets","source-layer":"road",filter:["in",["get","class"],["literal",["motorway","trunk","primary","secondary"]]],minzoom:8,layout:{"symbol-placement":"line","text-field":["get","name"],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],8,9,12,11],"text-max-angle":30},paint:{"text-color":"#7B6B5B","text-halo-color":"#F5F0E8","text-halo-width":1.5}},{id:"place-labels-country",type:"symbol",source:"mapbox-streets","source-layer":"place_label",filter:["==",["get","class"],"country"],layout:{"text-field":["get","name_en"],"text-font":["DIN Pro Medium","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],3,14,7,22],"text-transform":"uppercase","text-letter-spacing":.15},paint:{"text-color":"#6B5B4B","text-halo-color":"#F5F0E8","text-halo-width":2}},{id:"place-labels-state",type:"symbol",source:"mapbox-streets","source-layer":"place_label",filter:["==",["get","class"],"state"],minzoom:5,layout:{"text-field":["get","name"],"text-font":["DIN Pro Medium","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase","text-letter-spacing":.1},paint:{"text-color":"#7B6B5B","text-halo-color":"#F5F0E8","text-halo-width":1.5,"text-opacity":.8}},{id:"place-labels-city",type:"symbol",source:"mapbox-streets","source-layer":"place_label",filter:["==",["get","class"],"city"],minzoom:3,layout:{"text-field":["get","name"],"text-font":["DIN Pro Medium","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],3,9,5,11,8,14,12,18],"text-allow-overlap":!1,"text-ignore-placement":!1},paint:{"text-color":"#5B4B3B","text-halo-color":"#F5F0E8","text-halo-width":2}},{id:"place-labels-town",type:"symbol",source:"mapbox-streets","source-layer":"place_label",filter:["==",["get","class"],"town"],minzoom:4,layout:{"text-field":["get","name"],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],4,8,6,10,10,12,14,14],"text-allow-overlap":!1},paint:{"text-color":"#6B5B4B","text-halo-color":"#F5F0E8","text-halo-width":1.5}},{id:"place-labels-village",type:"symbol",source:"mapbox-streets","source-layer":"place_label",filter:["in",["get","class"],["literal",["village","hamlet"]]],minzoom:5,layout:{"text-field":["get","name"],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],5,8,8,10,12,11],"text-allow-overlap":!1},paint:{"text-color":"#7B6B5B","text-halo-color":"#F5F0E8","text-halo-width":1}},{id:"place-labels-suburb",type:"symbol",source:"mapbox-streets","source-layer":"place_label",filter:["in",["get","class"],["literal",["suburb","neighbourhood"]]],minzoom:10,layout:{"text-field":["get","name"],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-size":10},paint:{"text-color":"#8B7B6B","text-halo-color":"#F5F0E8","text-halo-width":1}},{id:"natural-labels",type:"symbol",source:"mapbox-streets","source-layer":"natural_label",minzoom:4,layout:{"text-field":["get","name"],"text-font":["DIN Pro Italic","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],4,9,8,11,12,13],"text-letter-spacing":.05,"text-allow-overlap":!1},paint:{"text-color":"#6B7B6B","text-halo-color":"#F5F0E8","text-halo-width":1.5}},{id:"poi-labels-parks",type:"symbol",source:"mapbox-streets","source-layer":"poi_label",filter:["in",["get","class"],["literal",["park","nature_reserve"]]],minzoom:4,layout:{"text-field":["get","name"],"text-font":["DIN Pro Italic","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],4,9,6,10,10,12,14,14],"text-transform":"none","text-allow-overlap":!1},paint:{"text-color":"#4A6B4A","text-halo-color":"#F5F0E8","text-halo-width":1.5}},{id:"poi-labels-lodging",type:"symbol",source:"mapbox-streets","source-layer":"poi_label",filter:["in",["get","class"],["literal",["lodging","campground"]]],minzoom:6,layout:{"text-field":["get","name"],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],6,8,10,10,12,11],"text-allow-overlap":!1}
3214,paint:{"text-color":"#8B5A2B","text-halo-color":"#F5F0E8","text-halo-width":1}},{id:"poi-labels-airport",type:"symbol",source:"mapbox-streets","source-layer":"poi_label",filter:["==",["get","class"],"airport"],minzoom:4,layout:{"text-field":["get","name"],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],4,8,8,10,10,11],"text-allow-overlap":!1},paint:{"text-color":"#5B5B6B","text-halo-color":"#F5F0E8","text-halo-width":1}},{id:"poi-labels-landmark",type:"symbol",source:"mapbox-streets","source-layer":"poi_label",filter:["in",["get","class"],["literal",["landmark","attraction","museum","monument"]]],minzoom:8,layout:{"text-field":["get","name"],"text-font":["DIN Pro Italic","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],8,9,12,11]},paint:{"text-color":"#6B5B4B","text-halo-color":"#F5F0E8","text-halo-width":1}},{id:"water-labels",type:"symbol",source:"mapbox-streets","source-layer":"natural_label",filter:["in",["get","class"],["literal",["water","bay","ocean","sea"]]],minzoom:5,layout:{"text-field":["get","name"],"text-font":["DIN Pro Italic","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],5,10,10,13],"text-letter-spacing":.1},paint:{"text-color":"#5B7B8B","text-halo-color":"#F5F0E8","text-halo-width":1}},{id:"africa-cities",type:"symbol",source:"africa-places",filter:["==",["get","type"],"city"],minzoom:3,layout:{"text-field":["get","name"],"text-font":["DIN Pro Bold","Arial Unicode MS Bold"],"text-size":["interpolate",["linear"],["zoom"],4,11,8,14,12,18],"text-anchor":"center","text-allow-overlap":!1,"text-padding":5},paint:{"text-color":"#4A3A2A","text-halo-color":"#F5F0E8","text-halo-width":2}},{id:"africa-towns",type:"symbol",source:"africa-places",filter:["==",["get","type"],"town"],minzoom:4,layout:{"text-field":["get","name"],"text-font":["DIN Pro Medium","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],5,9,8,11,12,14],"text-anchor":"center","text-allow-overlap":!1,"text-padding":3},paint:{"text-color":"#5B4B3B","text-halo-color":"#F5F0E8","text-halo-width":1.5}},{id:"africa-parks",type:"symbol",source:"africa-places",filter:["in",["get","type"],["literal",["park","region"]]],layout:{"text-field":["get","name"],"text-font":["DIN Pro Italic","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],3,8,5,10,8,13,12,16],"text-anchor":"center","text-allow-overlap":!1,"text-padding":5,"text-letter-spacing":.05},paint:{"text-color":"#3A5A3A","text-halo-color":"#F5F0E8","text-halo-width":2}},{id:"africa-lodges",type:"symbol",source:"africa-places",filter:["==",["get","type"],"lodge"],minzoom:6,layout:{"text-field":["get","name"],"text-font":["DIN Pro Medium","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],6,8,8,10,10,12,14,14],"text-anchor":"center","text-allow-overlap":!1,"text-padding":3,"text-offset":[0,.5]},paint:{"text-color":"#8B4513","text-halo-color":"#F5F0E8","text-halo-width":1.5}},{id:"africa-countries",type:"symbol",source:"africa-places",filter:["==",["get","type"],"country"],layout:{"text-field":["get","name"],"text-font":["DIN Pro Medium","Arial Unicode MS Regular"],"text-size":["interpolate",["linear"],["zoom"],2,10,4,14,6,18,8,22],"text-anchor":"center","text-allow-overlap":!1,"text-padding":10,"text-letter-spacing":.2,"text-transform":"uppercase"},paint:{"text-color":"#8B7355","text-halo-color":"#F5F0E8","text-halo-width":2,"text-opacity":["interpolate",["linear"],["zoom"],2,.8,6,.6,8,.4]}}]},cT={drive:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"/><circle cx="7" cy="17" r="2"/><path d="M9 17h6"/><circle cx="17" cy="17" r="2"/></svg>',flight:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.
32141-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"/></svg>',transfer:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 6v6"/><path d="M15 6v6"/><path d="M2 12h19.6"/><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-1.1-.9-2-2-2h-3.8"/><path d="M5 18H2s-.5-1.7-.8-2.8c-.1-.4-.2-.8-.2-1.2 0-1.1.9-2 2-2h3.8"/><path d="M7 18h10"/><circle cx="7" cy="18" r="2"/><circle cx="17" cy="18" r="2"/></svg>'},Ev=new Map,W3="pk.eyJ1Ijoic2VjcmV0bmFtaWJpYSIsImEiOiJjbGpxM2EyYm4wMmc2M2luZ2N0NWdoOHphIn0.nZvxT5FGIKMXIjmK6ZxFkg";async function Y3(E,P){const k=`${E.join(",")}-${P.join(",")}`;if(Ev.has(k))return Ev.get(k);try{const F=`https://api.mapbox.com/directions/v5/mapbox/driving/${E[0]},${E[1]};${P[0]},${P[1]}?geometries=geojson&overview=full&access_token=${W3}`,X=await fetch(F);if(!X.ok)throw new Error(`Directions API error: ${X.status}`);const te=await X.json();if(te.routes&&te.routes.length>0){const fe=te.routes[0].geometry.coordinates;return Ev.set(k,fe),fe}return[E,P]}catch(F){return console.error("Error fetching driving route:",F),[E,P]}}const c1=ze.forwardRef(({destinations:E,routeSegments:P,onMapReady:k,onRoutesLoaded:F,isAnimating:X=!1},te)=>{const fe=ze.useRef(null),a=ze.useRef(null),ue=ze.useRef([]),re=ze.useRef([]),Ee=ze.useRef(null),oe=ze.useRef(null);ze.useRef({currentSegment:0,progress:0,isRunning:!1});const ke=ze.useRef(new Map),[Qe,ft]=ze.useState(0),Ne=ze.useRef([]);return ze.useImperativeHandle(te,()=>({exportMap:async()=>{if(!a.current)return"";if(E.length>0){const vt=new Bh.LngLatBounds;E.forEach(ji=>{vt.extend(ji.coordinates)});
3214const ut=vt.getNorthEast(),rt=vt.getSouthWest(),wt=(ut.lat-rt.lat)*.25,Ii=(ut.lng-rt.lng)*.25;vt.extend([rt.lng-Ii,rt.lat-wt]),vt.extend([ut.lng+Ii,ut.lat+wt]),a.current.fitBounds(vt,{padding:{top:100,bottom:100,left:100,right:100},maxZoom:7,duration:0})}await new Promise(vt=>{const ut=()=>{a.current?.off("idle",ut),vt()};a.current?.on("idle",ut),setTimeout(vt,2e3)});const Je=a.current.getCanvas();if(!fe.current)return Je.toDataURL("image/png");const pt=document.createElement("canvas");pt.width=Je.width,pt.height=Je.height;const dt=pt.getContext("2d");if(!dt)return Je.toDataURL("image/png");dt.drawImage(Je,0,0);const nt=window.devicePixelRatio||1;return ue.current.forEach(vt=>{const ut=vt.getElement(),rt=vt.getLngLat(),wt=a.current.project(rt);dt.beginPath(),dt.arc(wt.x*nt,wt.y*nt,16*nt,0,2*Math.PI),dt.fillStyle="#8B2323",dt.fill(),dt.strokeStyle="#F5F0E8",dt.lineWidth=2*nt,dt.stroke(),dt.fillStyle="#F5F0E8",dt.font=`bold ${14*nt}px "Playfair Display", serif`,dt.textAlign="center",dt.textBaseline="middle",dt.fillText(ut.textContent||"",wt.x*nt,wt.y*nt)}),P.forEach((vt,ut)=>{const rt=vt.from.coordinates,wt=vt.to.coordinates,Ii=[(rt[0]+wt[0])/2,(rt[1]+wt[1])/2],ji=a.current.project(Ii),Bi=16*nt;dt.beginPath(),dt.arc(ji.x*nt,ji.y*nt,Bi,0,2*Math.PI),dt.fillStyle=W_[vt.transportMode],dt.fill(),dt.strokeStyle="#F5F0E8",dt.lineWidth=2*nt,dt.stroke(),dt.fillStyle="#F5F0E8",dt.font=`bold ${12*nt}px sans-serif`,dt.textAlign="center",dt.textBaseline="middle";const ai={drive:"🚗",flight:"✈",transfer:"🚌"};dt.fillText(ai[vt.transportMode]||"",ji.x*nt,ji.y*nt)}),pt.toDataURL("image/png")},fitToDestinations:()=>{if(!a.current||E.length===0)return;const Je=new Bh.LngLatBounds;E.forEach(mt=>{Je.extend(mt.coordinates)}),a.current.fitBounds(Je,{padding:{top:80,bottom:80,left:80,right:80},maxZoom:10,duration:1e3})}})),ze.useEffect(()=>{if(!(a.current||!fe.current))return a.current=new Bh.Map({container:fe.current,style:X3,center:[18,-22],zoom:5,preserveDrawingBuffer:!0}),a.current.addControl(new Bh.NavigationControl,"top-right"),a.current.on("load",()=>{k?.()}),()=>{a.current?.remove(),a.current=null}},[]),ze.useEffect(()=>{if(!a.current)return;ue.current.forEach(pt=>pt.remove()),ue.current=[];const Je={};E.forEach(pt=>{const dt=`${pt.coordinates[0].toFixed(4)},${pt.coordinates[1].toFixed(4)}`;Je[dt]||(Je[dt]=[]),Je[dt].push(pt)});const mt=pt=>{const dt=`${pt.coordinates[0].toFixed(4)},${pt.coordinates[1].toFixed(4)}`,nt=Je[dt];if(nt.length<=1)return[0,0];const vt=nt.findIndex(ji=>ji.label===pt.label),ut=nt.length,rt=20;return[-((ut-1)*rt)/2+vt*rt,0]};if(E.forEach(pt=>{const dt=mt(pt),nt=document.createElement("div");nt.className="destination-marker",nt.innerHTML=pt.label,nt.style.cssText=`
3215          width: 32px;
3216          height: 32px;
3217          border-radius: 50%;
3218          display: flex;
3219          align-items: center;
3220          justify-content: center;
3221          font-family: 'Playfair Display', serif;
3222          font-weight: 600;
3223          font-size: 14px;
3224          box-shadow: 0 2px 8px rgba(0,0,0,0.25);
3225          background: #8B2323;
3226          color: #F5F0E8;
3227          border: 2px solid #F5F0E8;
3228          cursor: pointer;
3229          transition: box-shadow 0.2s ease, border-color 0.2s ease;
3230        `,nt.addEventListener("mouseenter",()=>{nt.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",nt.style.borderColor="#FFFFFF"}),nt.addEventListener("mouseleave",()=>{nt.style.boxShadow="0 2px 8px rgba(0,0,0,0.25)",nt.style.borderColor="#F5F0E8"});const vt=new Bh.Marker({element:nt,offset:dt}).setLngLat(pt.coordinates).setPopup(new Bh.Popup({offset:25,className:"secret-namibia-popup"}).setHTML(`<div style="font-family: 'Source Sans 3', sans-serif; padding: 4px;">
3231                <strong style="font-family: 'Playfair Display', serif; font-size: 14px; color: #8B2323;">${pt.label}. ${pt.name}</strong>
3232              </div>`)).addTo(a.current);ue.current.push(vt)}),E.length>0){const pt=new Bh.LngLatBounds;E.forEach(dt=>pt.extend(dt.coordinates)),a.current.fitBounds(pt,{padding:{top:80,bottom:80,left:80,right:80},maxZoom:10,duration:1e3})}},[E]),ze.useEffect(()=>{if(!a.current)return;
3232if(P.length===0){ke.current=new Map,ft(0);return}let Je=!1;return(async()=>{const pt=new Map;for(let vt=0;vt<P.length;vt++){if(Je)return;const ut=P[vt];try{if(ut.transportMode==="flight"){const rt=K3(ut.from.coordinates,ut.to.coordinates,20);pt.set(vt,rt)}else{const rt=await Y3(ut.from.coordinates,ut.to.coordinates);pt.set(vt,rt)}}catch{pt.set(vt,[ut.from.coordinates,ut.to.coordinates])}}Je||!a.current||(a.current.isStyleLoaded()||await new Promise(vt=>{const ut=setTimeout(()=>vt(),5e3);a.current.once("idle",()=>{clearTimeout(ut),vt()})}),Je||!a.current)||((a.current.getStyle()?.layers||[]).forEach(vt=>{(vt.id.startsWith("route-layer-")||vt.id.startsWith("route-animated-"))&&a.current?.removeLayer(vt.id)}),Object.keys(a.current.getStyle()?.sources||{}).forEach(vt=>{vt.startsWith("route-")&&a.current?.removeSource(vt)}),P.forEach((vt,ut)=>{const rt=`route-${ut}`,wt=`route-layer-${ut}`,Ii=pt.get(ut)||[vt.from.coordinates,vt.to.coordinates];a.current?.addSource(rt,{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:Ii}}}),a.current?.addLayer({id:`${wt}-bg`,type:"line",source:rt,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":W_[vt.transportMode],"line-width":vt.transportMode==="flight"?3:5,"line-opacity":.3}}),a.current?.addLayer({id:wt,type:"line",source:rt,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":W_[vt.transportMode],"line-width":vt.transportMode==="flight"?2:3,"line-dasharray":vt.transportMode==="flight"?[4,4]:[1,0]}})}),re.current.forEach(vt=>vt.remove()),re.current=[],Je)||(ke.current=pt,ft(vt=>vt+1),F?.())})().catch(()=>{}),()=>{Je=!0,re.current.forEach(pt=>pt.remove()),re.current=[]}},[P]),ze.useEffect(()=>{const Je=ke.current;if(oe.current&&(cancelAnimationFrame(oe.current),oe.current=null),Ee.current&&(Ee.current.remove(),Ee.current=null),Ne.current.forEach(ei=>ei.remove()),Ne.current=[],!X||!a.current||P.length===0||Je.size===0||!P.every((ei,Ue)=>Je.has(Ue)))return;const pt=3e3,dt=800,nt=.75,vt=.2,ut=(ei,Ue)=>{if(ei.length===0)return[0,0];if(ei.length===1||Ue<=0)return ei[0];if(Ue>=1)return ei[ei.length-1];const Dt=[];let bt=0;for(let hi=1;hi<ei.length;hi++){const Ai=ei[hi][0]-ei[hi-1][0],Oi=ei[hi][1]-ei[hi-1][1],xi=Math.sqrt(Ai*Ai+Oi*Oi);Dt.push(xi),bt+=xi}if(bt===0)return ei[0];const Ht=Ue*bt;let ui=0;for(let hi=0;hi<Dt.length;hi++){if(ui+Dt[hi]>=Ht){const Oi=(Ht-ui)/Dt[hi],xi=ei[hi][0]+(ei[hi+1][0]-ei[hi][0])*Oi,ln=ei[hi][1]+(ei[hi+1][1]-ei[hi][1])*Oi;return[xi,ln]}ui+=Dt[hi]}return ei[ei.length-1]},rt=ei=>{if(!Ee.current)return;const Ue=P[ei];if(!Ue)return;const bt=Ee.current.getElement().querySelector(".icon-inner");if(bt){bt.style.backgroundColor=W_[Ue.transportMode],bt.innerHTML=cT[Ue.transportMode];const Ht=bt.querySelector("svg");Ht&&(Ht.style.width="20px",Ht.style.height="20px")}},wt=[];E.forEach((ei,Ue)=>{const Dt=document.createElement("div");Dt.className="property-tooltip",Dt.innerHTML=`
3233          <div style="
3234            background: rgba(255, 255, 255, 0.95);
3235            backdrop-filter: blur(4px);
3236            border: 1px solid #E5DED3;
3237            border-radius: 6px;
3238            padding: 4px 10px;
3239            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
3240            white-space: nowrap;
3241            pointer-events: none;
3242            font-family: 'Playfair Display', serif;
3243            font-size: 11px;
3244            font-weight: 600;
3245            color: #8B2323;
3246            letter-spacing: 0.02em;
3247          ">${ei.name}</div>
3248        `,Dt.style.opacity="0",Dt.style.transition="opacity 0.4s ease",Dt.style.pointerEvents="none";const bt=new Bh.Marker({element:Dt,anchor:"bottom",offset:[0,-22]}).setLngLat(ei.coordinates).addTo(a.current);Ne.current.push(bt),wt.push(Dt)});const Ii=(ei,Ue,Dt)=>{E.forEach((bt,Ht)=>{const ui=wt[Ht];if(!ui)return;let hi=0;const Ai=P[ei];if(Ai){const Oi=E.findIndex(xi=>xi.id===Ai.to.id);Ht===Oi&&(Ue>=nt&&(hi=Math.min(1,(Ue-nt)/(1-nt))),Dt&&(hi=1))}if(hi===0&&!Dt){const Oi=P[ei];if(Oi){const xi=E.findIndex(ln=>ln.id===Oi.from.id);Ht===xi&&Ue<=vt&&(hi=Math.max(0,1-Ue/vt))}}ui.style.opacity=String(hi)})},ji=P[0],Bi=document.createElement("div");Bi.className="animated-transport-icon",Bi.innerHTML=`
3249        <div class="icon-inner" style="
3250          width: 36px;
3251          height: 36px;
3252          background-color: ${W_[ji.transportMode]};
3253          border-radius: 50%;
3254          display: flex;
3255          align-items: center;
3256          justify-content: center;
3257          box-shadow: 0 3px 10px rgba(0,0,0,0.4);
3258          border: 2.5px solid #F5F0E8;
3259          transition: background-color 0.3s ease;
3260        ">
3261          ${cT[ji.transportMode]}
3262        </div>
3263      `;const ai=Bi.querySelector("svg");ai&&(ai.style.width="20px",ai.style.height="20px");const Vt=ji.from.coordinates;
3263Ee.current=new Bh.Marker({element:Bi,anchor:"center"}).setLngLat(Vt).addTo(a.current);let gi=0,Si=0,je=null,St=!1,Tt=0;rt(0),Ii(0,0,!1),wt[0]&&(wt[0].style.opacity="1");const _i=ei=>{if(!Ee.current||!a.current)return;je===null&&(je=ei);const Ue=ei-je;if(je=ei,St)if(Ii(gi,1,!0),ei-Tt>=dt)St=!1,gi=(gi+1)%P.length,Si=0,rt(gi);else{oe.current=requestAnimationFrame(_i);return}if(Si+=Ue/pt,Si>=1){Si=1;const bt=Je.get(gi);if(bt&&bt.length>0){const Ht=bt[bt.length-1];Ee.current.setLngLat(Ht)}Ii(gi,1,!1),St=!0,Tt=ei,oe.current=requestAnimationFrame(_i);return}const Dt=Je.get(gi);if(Dt){const bt=ut(Dt,Si);Ee.current.setLngLat(bt)}Ii(gi,Si,!1),oe.current=requestAnimationFrame(_i)};return oe.current=requestAnimationFrame(_i),()=>{oe.current&&(cancelAnimationFrame(oe.current),oe.current=null),Ee.current&&(Ee.current.remove(),Ee.current=null),Ne.current.forEach(ei=>ei.remove()),Ne.current=[]}},[X,Qe,P,E]),Ce.jsx("div",{"data-loc":"client/src/components/MapboxMap.tsx:1663",ref:fe,className:"w-full h-full rounded-lg overflow-hidden",style:{minHeight:"400px"}})});function K3(E,P,k){const F=[];for(let X=0;X<=k;X++){const te=X/k,fe=E[0]+(P[0]-E[0])*te,a=E[1]+(P[1]-E[1])*te,Ee=Math.sqrt(Math.pow(P[0]-E[0],2)+Math.pow(P[1]-E[1],2))*.15*Math.sin(Math.PI*te);F.push([fe,a+Ee*.5])}return F}c1.displayName="MapboxMap";const Q3=["lodge","camp","safari","guest house","guesthouse","hotel","resort","inn","rest camp","wilderness","tented","villa","chalet","cottage","accommodation","hideout","retreat"],J3="5V4qwM3qkNMjgDQzgC2DhG",eD="https://forge.manus.ai",tD=`${eD}/v1/maps/proxy`,qv={na:{name:"Namibia",bounds:{south:-29,west:11.5,north:-17,east:25.5}},za:{name:"South Africa",bounds:{south:-35,west:16,north:-22,east:33}},bw:{name:"Botswana",bounds:{south:-27,west:20,north:-18,east:29.5}},zm:{name:"Zambia",bounds:{south:-18,west:22,north:-8,east:34}},zw:{name:"Zimbabwe",bounds:{south:-22.5,west:25,north:-15.5,east:33}},ke:{name:"Kenya",bounds:{south:-5,west:33.5,north:5,east:42}},tz:{name:"Tanzania",bounds:{south:-12,west:29,north:-1,east:41}}},iD={south:-35,west:11.5,north:5,east:42},nD=(E,P)=>{for(const[k,F]of Object.entries(qv))if(E>=F.bounds.south&&E<=F.bounds.north&&P>=F.bounds.west&&P<=F.bounds.east)return k;return null};function rD({value:E,onChange:P,onClear:k,placeholder:F="Search for a location in Africa...",label:X}){const[te,fe]=ze.useState(E),[a,ue]=ze.useState([]),[re,Ee]=ze.useState(!1),[oe,ke]=ze.useState(!1),[Qe,ft]=ze.useState(!1),Ne=ze.useRef(null),Je=ze.useRef(null),mt=ze.useRef(null),pt=ze.useRef(null),dt=ze.useRef(null),nt=ze.useRef(null),vt=ze.useRef(null);ze.useEffect(()=>{const ai=async()=>{if(window.google?.maps?.places){Vt();return}if(document.querySelector('script[src*="maps/api/js"]')){const Si=setInterval(()=>{window.google?.maps?.places&&(clearInterval(Si),Vt())},100);return}const gi=document.createElement("script");gi.src=`${tD}/maps/api/js?key=${J3}&v=weekly&libraries=places`,gi.async=!0,gi.crossOrigin="anonymous",gi.onload=()=>{Vt()},gi.onerror=()=>{console.error("Failed to load Google Maps")},document.head.appendChild(gi)},Vt=()=>{window.google?.maps?.places&&(pt.current=new window.google.maps.places.AutocompleteService,vt.current=document.createElement("div"),dt.current=new window.google.maps.places.PlacesService(vt.current),nt.current=new window.google.maps.places.AutocompleteSessionToken,ft(!0))};ai()},[]),ze.useEffect(()=>{fe(E)},[E]),ze.useEffect(()=>{const ai=Vt=>{Je.current&&!Je.current.contains(Vt.target)&&ke(!1)};return document.addEventListener("mousedown",ai),()=>document.removeEventListener("mousedown",ai)},[]);const ut=ze.useCallback(async ai=>{if(ai.length<2){ue([]);return}if(!pt.current||!dt.current||!Qe){console.log("Google Places not ready yet");return}Ee(!0);try{const Vt=Object.keys(qv).map(async _i=>new Promise(ei=>{pt.current.getPlacePredictions({input:ai,locationBias:iD,types:["establishment","geocode"],sessionToken:nt.current,componentRestrictions:{country:_i}},(Ue,Dt)=>{Dt===google.maps.places.PlacesServiceStatus.OK&&Ue?ei(Ue):ei([])})})),je=(await Promise.all(Vt)).flat().filter((_i,ei,Ue)=>ei===Ue.findIndex(Dt=>Dt.place_id===_i.place_id)),Tt=(await Promise.all(je.slice(0,8).map(async _i=>new Promise(ei=>{dt.current.getDetails({placeId:_i.place_id,fields:["name","formatted_address","geometry","types","place_id","address_components"],sessionToken:nt.current},(Ue,Dt)=>{if(Dt===google.maps.places.PlacesServiceStatus.OK&&Ue?.geometry?.location){const bt=Ue.geometry.location.lat(),Ht=Ue.geometry.location.lng(),ui=nD(bt,Ht);
3263if(ui){const Ai=Ue.address_components?.find(Oi=>Oi.types.includes("country"))?.long_name||qv[ui]?.name;ei({id:Ue.place_id||_i.place_id,name:Ue.name||_i.structured_formatting.main_text,formattedAddress:Ue.formatted_address||_i.description,coordinates:[Ht,bt],types:Ue.types||[],country:Ai})}else ei(null)}else ei(null)})})))).filter(_i=>_i!==null);nt.current=new window.google.maps.places.AutocompleteSessionToken,ue(Tt)}catch(Vt){console.error("Search error:",Vt),ue([])}finally{Ee(!1)}},[Qe]),rt=ai=>{const Vt=ai.target.value;fe(Vt),ke(!0),mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{ut(Vt)},300)},wt=ai=>{let Vt=ai.name;const gi=ai.formattedAddress.split(","),Si=gi.length>1?gi[gi.length-2]?.trim():"";Si&&!["Namibia","South Africa","Botswana","Zambia","Zimbabwe","Kenya","Tanzania"].includes(Si)&&(Vt=`${ai.name}, ${Si}`),fe(Vt),ke(!1),P(Vt,ai.coordinates)},Ii=()=>{fe(""),ue([]),k(),Ne.current?.focus()},ji=ai=>{const Vt=ai.name.toLowerCase(),gi=Q3.some(je=>Vt.includes(je)),Si=ai.types.some(je=>["lodging","campground","resort","hotel","guest_house"].includes(je));return gi||Si},Bi=ai=>ai&&{Namibia:"🇳🇦","South Africa":"🇿🇦",Botswana:"🇧🇼",Zambia:"🇿🇲",Zimbabwe:"🇿🇼",Kenya:"🇰🇪",Tanzania:"🇹🇿"}[ai]||"";return Ce.jsxs("div",{"data-loc":"client/src/components/DestinationInput.tsx:332",ref:Je,className:"relative",children:[Ce.jsx("label",{"data-loc":"client/src/components/DestinationInput.tsx:333",className:"block text-sm font-medium text-foreground/80 mb-1.5",children:Ce.jsxs("span",{"data-loc":"client/src/components/DestinationInput.tsx:334",className:"inline-flex items-center gap-1.5",children:[Ce.jsx("span",{"data-loc":"client/src/components/DestinationInput.tsx:335",className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-semibold",style:{background:"#8B2323",color:"#F5F0E8",fontFamily:"'Playfair Display', serif"},children:X}),"Destination"]})}),Ce.jsxs("div",{"data-loc":"client/src/components/DestinationInput.tsx:349",className:"relative",children:[Ce.jsx("div",{"data-loc":"client/src/components/DestinationInput.tsx:350",className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:re?Ce.jsx(Bg,{"data-loc":"client/src/components/DestinationInput.tsx:352",className:"w-4 h-4 animate-spin"}):Ce.jsx(f3,{"data-loc":"client/src/components/DestinationInput.tsx:354",className:"w-4 h-4"})}),Ce.jsx("input",{"data-loc":"client/src/components/DestinationInput.tsx:358",ref:Ne,type:"text",value:te,onChange:rt,onFocus:()=>ke(!0),placeholder:F,className:"w-full pl-10 pr-10 py-2.5 safari-input rounded-lg text-sm focus:outline-none"}),te&&Ce.jsx("button",{"data-loc":"client/src/components/DestinationInput.tsx:369",onClick:Ii,className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:Ce.jsx(bS,{"data-loc":"client/src/components/DestinationInput.tsx:373",className:"w-4 h-4"})})]}),oe&&a.length>0&&Ce.jsx("div",{"data-loc":"client/src/components/DestinationInput.tsx:380",className:"absolute z-50 w-full mt-1 bg-card rounded-lg shadow-lg border border-border overflow-hidden max-h-80 overflow-y-auto",children:a.map(ai=>Ce.jsxs("button",{"data-loc":"client/src/components/DestinationInput.tsx:382",onClick:()=>wt(ai),className:"w-full px-4 py-3 text-left hover:bg-secondary/50 transition-colors flex items-start gap-3 border-b border-border/50 last:border-0",children:[ji(ai)?Ce.jsx(Jz,{"data-loc":"client/src/components/DestinationInput.tsx:388",className:"w-4 h-4 mt-0.5 shrink-0",style:{color:"#8B2323"}}):Ce.jsx(u3,{"data-loc":"client/src/components/DestinationInput.tsx:390",className:"w-4 h-4 mt-0.5 shrink-0",style:{color:"#8B2323"}}),Ce.jsxs("div",{"data-loc":"client/src/components/DestinationInput.tsx:392",className:"flex flex-col flex-1",children:[Ce.jsxs("span",{"data-loc":"client/src/components/DestinationInput.tsx:393",className:"text-sm font-medium flex items-center gap-2",children:[ai.name,ai.country&&Ce.jsx("span",{"data-loc":"client/src/components/DestinationInput.tsx:396",className:"text-xs",title:ai.country,children:Bi(ai.country)})]}),Ce.jsx("span",{"data-loc":"client/src/components/DestinationInput.tsx:401",className:"text-xs text-muted-foreground",children:ai.formattedAddress})]})]},ai.id))}),oe&&te.length>=2&&!re&&a.length===0&&Qe&&Ce.jsxs("div",{"data-loc":"client/src/components/DestinationInput.tsx:412",className:"absolute z-50 w-full mt-1 bg-card rounded-lg shadow-lg border border-border p-4 text-center",children:[Ce.jsx("p",{"data-loc":"client/src/components/DestinationInput.tsx:413",className:"text-sm text-muted-foreground",children:"No locations foun
3263d"}),Ce.jsx("p",{"data-loc":"client/src/components/DestinationInput.tsx:414",className:"text-xs text-muted-foreground mt-1",children:"Search in Namibia, South Africa, Botswana, Zambia, Zimbabwe, Kenya, or Tanzania"})]}),!Qe&&te.length>=2&&Ce.jsxs("div",{"data-loc":"client/src/components/DestinationInput.tsx:422",className:"absolute z-50 w-full mt-1 bg-card rounded-lg shadow-lg border border-border p-4 text-center",children:[Ce.jsx(Bg,{"data-loc":"client/src/components/DestinationInput.tsx:423",className:"w-4 h-4 animate-spin mx-auto mb-2"}),Ce.jsx("p",{"data-loc":"client/src/components/DestinationInput.tsx:424",className:"text-sm text-muted-foreground",children:"Loading search..."})]})]})}const oD=({mode:E})=>{const P={drive:yS,flight:xS,transfer:_S},k={drive:"#2B4B7C",flight:"#2E7D4E",transfer:"#C4A35A"},F=P[E];return Ce.jsx(F,{"data-loc":"client/src/components/DestinationList.tsx:25",className:"w-4 h-4",style:{color:k[E]}})};function aD({destinations:E,routeSegments:P,onRemove:k,onTransportModeChange:F}){return E.length===0?Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:36",className:"text-center py-8 text-muted-foreground",children:[Ce.jsx("p",{"data-loc":"client/src/components/DestinationList.tsx:37",className:"text-sm",children:"No destinations added yet."}),Ce.jsx("p",{"data-loc":"client/src/components/DestinationList.tsx:38",className:"text-xs mt-1",children:"Search and add your first destination above."})]}):Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:44",className:"space-y-2",children:[Ce.jsx("h3",{"data-loc":"client/src/components/DestinationList.tsx:45",className:"text-sm font-medium text-foreground/80 mb-3",children:"Route Itinerary"}),Ce.jsx("div",{"data-loc":"client/src/components/DestinationList.tsx:47",className:"space-y-0",children:E.map((X,te)=>Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:49",children:[Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:51",className:"safari-card rounded-lg p-3 flex items-center gap-3",children:[Ce.jsx("div",{"data-loc":"client/src/components/DestinationList.tsx:52",className:"text-muted-foreground cursor-grab",children:Ce.jsx(a3,{"data-loc":"client/src/components/DestinationList.tsx:53",className:"w-4 h-4"})}),Ce.jsx("div",{"data-loc":"client/src/components/DestinationList.tsx:56",className:"w-7 h-7 rounded-full flex items-center justify-center text-sm font-semibold shrink-0",style:{background:"#2B4B7C",color:"white",fontFamily:"'Playfair Display', serif"},children:X.label}),Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:67",className:"flex-1 min-w-0",children:[Ce.jsx("p",{"data-loc":"client/src/components/DestinationList.tsx:68",className:"text-sm font-medium truncate",children:X.name}),Ce.jsxs("p",{"data-loc":"client/src/components/DestinationList.tsx:69",className:"text-xs text-muted-foreground",children:[X.coordinates[1].toFixed(4),", ",X.coordinates[0].toFixed(4)]})]}),Ce.jsx("button",{"data-loc":"client/src/components/DestinationList.tsx:74",onClick:()=>k(X.id),className:"p-1.5 text-muted-foreground hover:text-destructive transition-colors rounded",children:Ce.jsx(p3,{"data-loc":"client/src/components/DestinationList.tsx:78",className:"w-4 h-4"})})]}),te<E.length-1&&P[te]&&Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:84",className:"flex items-center gap-2 py-2 pl-12",children:[Ce.jsx("div",{"data-loc":"client/src/components/DestinationList.tsx:85",className:"h-6 w-px bg-border"}),Ce.jsxs("div",{"data-loc":"client/src/components/DestinationList.tsx:86",className:"flex items-center gap-1.5 text-xs",children:[Ce.jsx(oD,{"data-loc":"client/src/components/DestinationList.tsx:87",mode:P[te].transportMode}),Ce.jsxs("select",{"data-loc":"client/src/components/DestinationList.tsx:88",value:P[te].transportMode,onChange:fe=>F(te,fe.target.value),className:"text-xs bg-transparent border-none focus:outline-none cursor-pointer text-muted-foreground hover:text-foreground",children:[Ce.jsx("option",{"data-loc":"client/src/components/DestinationList.tsx:93",value:"drive",children:"Self Drive"}),Ce.jsx("option",{"data-loc":"client/src/components/DestinationList.tsx:94",value:"flight",children:"Flight"}),Ce.jsx("option",{"data-loc":"client/src/components/DestinationList.tsx:95",value:"transfer",children:"Transfer"})]})]}),Ce.jsx("div",{"data-loc":"client/src/components/DestinationList.tsx:98",className:"h-6 w-px bg-border"})]})]},X.id))})]})}function sD({onExport:E,disabled:P,destinationCount:k}){const[F,X]=ze.useState(!1),[te,fe]=ze.useState(!1),a=async()=>
3263{if(!(P||F)){X(!0),fe(!1);try{const ue=await E();if(ue){const re=document.createElement("a");re.download=`safari-route-map-${Date.now()}.png`,re.href=ue,document.body.appendChild(re),re.click(),document.body.removeChild(re),fe(!0),setTimeout(()=>fe(!1),3e3)}}catch(ue){console.error("Export failed:",ue)}finally{X(!1)}}};return Ce.jsxs("div",{"data-loc":"client/src/components/ExportPanel.tsx:44",className:"safari-card rounded-lg p-4 space-y-4",children:[Ce.jsxs("div",{"data-loc":"client/src/components/ExportPanel.tsx:45",className:"flex items-center gap-2",children:[Ce.jsx(l3,{"data-loc":"client/src/components/ExportPanel.tsx:46",className:"w-5 h-5 text-primary"}),Ce.jsx("h3",{"data-loc":"client/src/components/ExportPanel.tsx:47",className:"font-semibold",style:{fontFamily:"'Playfair Display', serif"},children:"Export Map"})]}),Ce.jsx("p",{"data-loc":"client/src/components/ExportPanel.tsx:52",className:"text-sm text-muted-foreground",children:"Export your safari route as a high-quality PNG image ready for use on the Secret Namibia website."}),Ce.jsxs("div",{"data-loc":"client/src/components/ExportPanel.tsx:56",className:"flex items-center justify-between text-sm",children:[Ce.jsx("span",{"data-loc":"client/src/components/ExportPanel.tsx:57",className:"text-muted-foreground",children:"Destinations:"}),Ce.jsx("span",{"data-loc":"client/src/components/ExportPanel.tsx:58",className:"font-medium",children:k})]}),Ce.jsx(kh,{"data-loc":"client/src/components/ExportPanel.tsx:61",onClick:a,disabled:P||F||k<2,className:"w-full safari-button-primary",style:{background:P||k<2?"#ccc":"#8B1A1A",color:"white"},children:F?Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(Bg,{"data-loc":"client/src/components/ExportPanel.tsx:72",className:"w-4 h-4 mr-2 animate-spin"}),"Exporting..."]}):te?Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(Ax,{"data-loc":"client/src/components/ExportPanel.tsx:77",className:"w-4 h-4 mr-2"}),"Downloaded!"]}):Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(n3,{"data-loc":"client/src/components/ExportPanel.tsx:82",className:"w-4 h-4 mr-2"}),"Export as PNG"]})}),k<2&&Ce.jsx("p",{"data-loc":"client/src/components/ExportPanel.tsx:89",className:"text-xs text-muted-foreground text-center",children:"Add at least 2 destinations to export"})]})}var Av="focusScope.autoFocusOnMount",Mv="focusScope.autoFocusOnUnmount",uT={bubbles:!1,cancelable:!0},lD="FocusScope",zS=ze.forwardRef((E,P)=>{const{loop:k=!1,trapped:F=!1,onMountAutoFocus:X,onUnmountAutoFocus:te,...fe}=E,[a,ue]=ze.useState(null),re=Pg(X),Ee=Pg(te),oe=ze.useRef(null),ke=Du(P,Ne=>ue(Ne)),Qe=ze.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ze.useEffect(()=>{if(F){let Ne=function(dt){if(Qe.paused||!a)return;const nt=dt.target;a.contains(nt)?oe.current=nt:np(oe.current,{select:!0})},Je=function(dt){if(Qe.paused||!a)return;const nt=dt.relatedTarget;nt!==null&&(a.contains(nt)||np(oe.current,{select:!0}))},mt=function(dt){if(document.activeElement===document.body)for(const vt of dt)vt.removedNodes.length>0&&np(a)};document.addEventListener("focusin",Ne),document.addEventListener("focusout",Je);const pt=new MutationObserver(mt);return a&&pt.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",Ne),document.removeEventListener("focusout",Je),pt.disconnect()}}},[F,a,Qe.paused]),ze.useEffect(()=>{if(a){dT.add(Qe);const Ne=document.activeElement;if(!a.contains(Ne)){const mt=new CustomEvent(Av,uT);a.addEventListener(Av,re),a.dispatchEvent(mt),mt.defaultPrevented||(cD(pD(DS(a)),{select:!0}),document.activeElement===Ne&&np(a))}return()=>{a.removeEventListener(Av,re),setTimeout(()=>{const mt=new CustomEvent(Mv,uT);a.addEventListener(Mv,Ee),a.dispatchEvent(mt),mt.defaultPrevented||np(Ne??document.body,{select:!0}),a.removeEventListener(Mv,Ee),dT.remove(Qe)},0)}}},[a,re,Ee,Qe]);const ft=ze.useCallback(Ne=>{if(!k&&!F||Qe.paused)return;const Je=Ne.key==="Tab"&&!Ne.altKey&&!Ne.ctrlKey&&!Ne.metaKey,mt=document.activeElement;if(Je&&mt){const pt=Ne.currentTarget,[dt,nt]=uD(pt);dt&&nt?!Ne.shiftKey&&mt===nt?(Ne.preventDefault(),k&&np(dt,{select:!0})):Ne.shiftKey&&mt===dt&&(Ne.preventDefault(),k&&np(nt,{select:!0})):mt===pt&&Ne.preventDefault()}},[k,F,Qe.paused]);return Ce.jsx(Sl.div,{tabIndex:-1,...fe,ref:ke,onKeyDown:ft})});zS.displayName=lD;function cD(E,{select:P=!1}={}){const k=document.activeElement;for(const F of E)if(np(F,{select:P}),document.activeElement!==k)return}function uD(E){const P=DS(E),k=hT(P,E),F=hT(P.reverse(),E);return[k,F]}function DS(E){const P=[],k=document.createTreeWalker(E,NodeFilter.SHOW_ELEMENT,{acceptNode:F=>{const X=F.tagName==="INPUT"&&F.type==="hidden";
vendor: 10,282 bytes, lines 3263-3303
3263return F.disabled||F.hidden||X?NodeFilter.FILTER_SKIP:F.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;k.nextNode();)P.push(k.currentNode);return P}function hT(E,P){for(const k of E)if(!hD(k,{upTo:P}))return k}function hD(E,{upTo:P}){if(getComputedStyle(E).visibility==="hidden")return!0;for(;E;){if(P!==void 0&&E===P)return!1;if(getComputedStyle(E).display==="none")return!0;E=E.parentElement}return!1}function dD(E){return E instanceof HTMLInputElement&&"select"in E}function np(E,{select:P=!1}={}){if(E&&E.focus){const k=document.activeElement;E.focus({preventScroll:!0}),E!==k&&dD(E)&&P&&E.select()}}var dT=fD();function fD(){let E=[];return{add(P){const k=E[0];P!==k&&k?.pause(),E=fT(E,P),E.unshift(P)},remove(P){E=fT(E,P),E[0]?.resume()}}}function fT(E,P){const k=[...E],F=k.indexOf(P);return F!==-1&&k.splice(F,1),k}function pD(E){return E.filter(P=>P.tagName!=="A")}var Cv=0;function mD(){ze.useEffect(()=>{const E=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",E[0]??pT()),document.body.insertAdjacentElement("beforeend",E[1]??pT()),Cv++,()=>{Cv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(P=>P.remove()),Cv--}},[])}function pT(){const E=document.createElement("span");return E.setAttribute("data-radix-focus-guard",""),E.tabIndex=0,E.style.outline="none",E.style.opacity="0",E.style.position="fixed",E.style.pointerEvents="none",E}var Fh=function(){return Fh=Object.assign||function(P){for(var k,F=1,X=arguments.length;F<X;F++){k=arguments[F];for(var te in k)Object.prototype.hasOwnProperty.call(k,te)&&(P[te]=k[te])}return P},Fh.apply(this,arguments)};function PS(E,P){var k={};for(var F in E)Object.prototype.hasOwnProperty.call(E,F)&&P.indexOf(F)<0&&(k[F]=E[F]);if(E!=null&&typeof Object.getOwnPropertySymbols=="function")for(var X=0,F=Object.getOwnPropertySymbols(E);X<F.length;X++)P.indexOf(F[X])<0&&Object.prototype.propertyIsEnumerable.call(E,F[X])&&(k[F[X]]=E[F[X]]);return k}function gD(E,P,k){if(k||arguments.length===2)for(var F=0,X=P.length,te;F<X;F++)(te||!(F in P))&&(te||(te=Array.prototype.slice.call(P,0,F)),te[F]=P[F]);return E.concat(te||Array.prototype.slice.call(P))}var Ix="right-scroll-bar-position",Rx="width-before-scroll-bar",_D="with-scroll-bars-hidden",yD="--removed-body-scroll-bar-size";function Iv(E,P){return typeof E=="function"?E(P):E&&(E.current=P),E}function xD(E,P){var k=ze.useState(function(){return{value:E,callback:P,facade:{get current(){return k.value},set current(F){var X=k.value;X!==F&&(k.value=F,k.callback(F,X))}}}})[0];return k.callback=P,k.facade}var vD=typeof window<"u"?ze.useLayoutEffect:ze.useEffect,mT=new WeakMap;function bD(E,P){var k=xD(null,function(F){return E.forEach(function(X){return Iv(X,F)})});return vD(function(){var F=mT.get(k);if(F){var X=new Set(F),te=new Set(E),fe=k.current;X.forEach(function(a){te.has(a)||Iv(a,null)}),te.forEach(function(a){X.has(a)||Iv(a,fe)})}mT.set(k,E)},[E]),k}function wD(E){return E}function TD(E,P){P===void 0&&(P=wD);var k=[],F=!1,X={read:function(){if(F)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return k.length?k[k.length-1]:E},useMedium:function(te){var fe=P(te,F);return k.push(fe),function(){k=k.filter(function(a){return a!==fe})}},assignSyncMedium:function(te){for(F=!0;k.length;){var fe=k;k=[],fe.forEach(te)}k={push:function(a){return te(a)},filter:function(){return k}}},assignMedium:function(te){F=!0;var fe=[];if(k.length){var a=k;k=[],a.forEach(te),fe=k}var ue=function(){var Ee=fe;fe=[],Ee.forEach(te)},re=function(){return Promise.resolve().then(ue)};re(),k={push:function(Ee){fe.push(Ee),re()},filter:function(Ee){return fe=fe.filter(Ee),k}}}};return X}function SD(E){E===void 0&&(E={});var P=TD(null);return P.options=Fh({async:!0,ssr:!1},E),P}var LS=function(E){var P=E.sideCar,k=PS(E,["sideCar"]);if(!P)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var F=P.read();if(!F)throw new Error("Sidecar medium not found");return ze.createElement(F,Fh({},k))};LS.isSideCarExport=!0;function ED(E,P){return E.useMedium(P),LS}var OS=SD(),Rv=function(){},qx=ze.forwardRef(function(E,P){var k=ze.useRef(null),F=ze.useState({onScrollCapture:Rv,onWheelCapture:Rv,onTouchMoveCapture:Rv}),X=F[0],te=F[1],fe=E.forwardProps,a=E.children,ue=E.className,re=E.removeScrollBar,Ee=E.enabled,oe=E.shards,ke=E.sideCar,Qe=E.noRelative,ft=E.noIsolation,Ne=E.inert,Je=E.allowPinchZoom,mt=E.as,pt=mt===void 0?"div":mt,dt=E.gapMode,nt=PS(E,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),vt=ke,ut=bD([k,P]),rt=Fh(Fh({},nt),X);return ze.createElement(ze.Fragment,null,Ee&&ze.createElement(vt,{sideCar:OS,removeScrollBar:re,shards:oe,noRelative:Qe,noIsolation:ft,inert:Ne,setCallbacks:te,allowPinchZoom:!!Je,lockRef:k,gapMode:dt}),fe?ze.cloneElement(ze.Children.only(a),Fh(Fh({},rt),{ref:ut})):ze.createElement(pt,Fh({},rt,{className:ue,ref:ut}),a))});qx.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};qx.classNames={fullWidth:Rx,zeroRight:Ix};var AD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function MD(){if(!document)return null;var E=document.createElement("style");E.type="text/css";var P=AD();return P&&E.setAttribute("nonce",P),E}function CD(E,P){E.styleSheet?E.styleSheet.cssText=P:E.appendChild(document.createTextNode(P))}function ID(E){var P=document.head||document.getElementsByTagName("head")[0];P.appendChild(E)}var RD=function(){var E=0,P=null;return{add:function(k){E==0&&(P=MD())&&(CD(P,k),ID(P)),E++},remove:function(){E--,!E&&P&&(P.parentNode&&P.parentNode.removeChild(P),P=null)}}},zD=function(){var E=RD();return function(P,k){ze.useEffect(function(){return E.add(P),function(){E.remove()}},[P&&k])}},BS=function(){var E=zD(),P=function(k){var F=k.styles,X=k.dynamic;return E(F,X),null};return P},DD={left:0,top:0,right:0,gap:0},zv=function(E){return parseInt(E||"",10)||0},PD=function(E){var P=window.getComputedStyle(document.body),k=P[E==="padding"?"paddingLeft":"marginLeft"],F=P[E==="padding"?"paddingTop":"marginTop"],X=P[E==="padding"?"paddingRight":"marginRight"];return[zv(k),zv(F),zv(X)]},LD=function(E){if(E===void 0&&(E="margin"),typeof window>"u")return DD;var P=PD(E),k=document.documentElement.clientWidth,F=window.innerWidth;return{left:P[0],top:P[1],right:P[2],gap:Math.max(0,F-k+P[2]-P[0])}},OD=BS(),Dg="data-scroll-locked",BD=function(E,P,k,F){var X=E.left,te=E.top,fe=E.right,a=E.gap;return k===void 0&&(k="margin"),`
3264  .`.concat(_D,` {
3265   overflow: hidden `).concat(F,`;
3266   padding-right: `).concat(a,"px ").concat(F,`;
3267  }
3268  body[`).concat(Dg,`] {
3269    overflow: hidden `).concat(F,`;
3270    overscroll-behavior: contain;
3271    `).concat([P&&"position: relative ".concat(F,";"),k==="margin"&&`
3272    padding-left: `.concat(X,`px;
3273    padding-top: `).concat(te,`px;
3274    padding-right: `).concat(fe,`px;
3275    margin-left:0;
3276    margin-top:0;
3277    margin-right: `).concat(a,"px ").concat(F,`;
3278    `),k==="padding"&&"padding-right: ".concat(a,"px ").concat(F,";")].filter(Boolean).join(""),`
3279  }
3280  
3281  .`).concat(Ix,` {
3282    right: `).concat(a,"px ").concat(F,`;
3283  }
3284  
3285  .`).concat(Rx,` {
3286    margin-right: `).concat(a,"px ").concat(F,`;
3287  }
3288  
3289  .`).concat(Ix," .").concat(Ix,` {
3290    right: 0 `).concat(F,`;
3291  }
3292  
3293  .`).concat(Rx," .").concat(Rx,` {
3294    margin-right: 0 `).concat(F,`;
3295  }
3296  
3297  body[`).concat(Dg,`] {
3298    `).concat(yD,": ").concat(a,`px;
3299  }
3300`)},gT=function(){var E=parseInt(document.body.getAttribute(Dg)||"0",10);return isFinite(E)?E:0},kD=function(){ze.useEffect(function(){return document.body.setAttribute(Dg,(gT()+1).toString()),function(){var E=gT()-1;E<=0?document.body.removeAttribute(Dg):document.body.setAttribute(Dg,E.toString())}},[])},FD=function(E){var P=E.noRelative,k=E.noImportant,F=E.gapMode,X=F===void 0?"margin":F;kD();var te=ze.useMemo(function(){return LD(X)},[X]);return ze.createElement(OD,{styles:BD(te,!P,X,k?"":"!important")})},Zv=!1;if(typeof window<"u")try{var vx=Object.defineProperty({},"passive",{get:function(){return Zv=!0,!0}});window.addEventListener("test",vx,vx),window.removeEventListener("test",vx,vx)}catch{Zv=!1}var Cg=Zv?{passive:!1}:!1,ND=function(E){return E.tagName==="TEXTAREA"},kS=function(E,P){if(!(E instanceof Element))return!1;var k=window.getComputedStyle(E);return k[P]!=="hidden"&&!(k.overflowY===k.overflowX&&!ND(E)&&k[P]==="visible")},UD=function(E){return kS(E,"overflowY")},VD=function(E){return kS(E,"overflowX")},_T=function(E,P){var k=P.ownerDocument,F=P;do{typeof ShadowRoot<"u"&&F instanceof ShadowRoot&&(F=F.host);var X=FS(E,F);if(X){var te=NS(E,F),fe=te[1],a=te[2];if(fe>a)return!0}F=F.parentNode}while(F&&F!==k.body);return!1},jD=function(E){var P=E.scrollTop,k=E.scrollHeight,F=E.clientHeight;return[P,k,F]},GD=function(E){var P=E.scrollLeft,k=E.scrollWidth,F=E.clientWidth;return[P,k,F]},FS=function(E,P){return E==="v"?UD(P):VD(P)},NS=function(E,P){return E==="v"?jD(P):GD(P)},HD=function(E,P){return E==="h"&&P==="rtl"?-1:1},qD=function(E,P,k,F,X){var te=HD(E,window.getComputedStyle(P).direction),fe=te*F,a=k.target,ue=P.contains(a),re=!1,Ee=fe>0,oe=0,ke=0;do{if(!a)break;var Qe=NS(E,a),ft=Qe[0],Ne=Qe[1],Je=Qe[2],mt=Ne-Je-te*ft;(ft||mt)&&FS(E,a)&&(oe+=mt,ke+=ft);var pt=a.parentNode;a=pt&&pt.nodeType===Node.DOCUMENT_FRAGMENT_NODE?pt.host:pt}while(!ue&&a!==document.body||ue&&(P.contains(a)||P===a));return(Ee&&Math.abs(oe)<1||!Ee&&Math.abs(ke)<1)&&(re=!0),re},bx=function(E){return"changedTouches"in E?[E.changedTouches[0].clientX,E.changedTouches[0].clientY]:[0,0]},yT=function(E){return[E.deltaX,E.deltaY]},xT=function(E){return E&&"current"in E?E.current:E},ZD=function(E,P){return E[0]===P[0]&&E[1]===P[1]},$D=function(E){return`
3301  .block-interactivity-`.concat(E,` {pointer-events: none;}
3302  .allow-interactivity-`).concat(E,` {pointer-events: all;}
3303`)},XD=0,Ig=[];function WD(E){var P=ze.useRef([]),k=ze.useRef([0,0]),F=ze.useRef(),X=ze.useState(XD++)[0],te=ze.useState(BS)[0],fe=ze.useRef(E);ze.useEffect(function(){fe.current=E},[E]),ze.useEffect(function(){if(E.inert){document.body.classList.add("block-interactivity-".concat(X));var Ne=gD([E.lockRef.current],(E.shards||[]).map(xT),!0).filter(
vendor: 1,200 bytes, line 3303
3303Boolean);return Ne.forEach(function(Je){return Je.classList.add("allow-interactivity-".concat(X))}),function(){document.body.classList.remove("block-interactivity-".concat(X)),Ne.forEach(function(Je){return Je.classList.remove("allow-interactivity-".concat(X))})}}},[E.inert,E.lockRef.current,E.shards]);var a=ze.useCallback(function(Ne,Je){if("touches"in Ne&&Ne.touches.length===2||Ne.type==="wheel"&&Ne.ctrlKey)return!fe.current.allowPinchZoom;var mt=bx(Ne),pt=k.current,dt="deltaX"in Ne?Ne.deltaX:pt[0]-mt[0],nt="deltaY"in Ne?Ne.deltaY:pt[1]-mt[1],vt,ut=Ne.target,rt=Math.abs(dt)>Math.abs(nt)?"h":"v";if("touches"in Ne&&rt==="h"&&ut.type==="range")return!1;var wt=_T(rt,ut);if(!wt)return!0;if(wt?vt=rt:(vt=rt==="v"?"h":"v",wt=_T(rt,ut)),!wt)return!1;if(!F.current&&"changedTouches"in Ne&&(dt||nt)&&(F.current=vt),!vt)return!0;var Ii=F.current||vt;return qD(Ii,Je,Ne,Ii==="h"?dt:nt)},[]),ue=ze.useCallback(function(Ne){var Je=Ne;if(!(!Ig.length||Ig[Ig.length-1]!==te)){var mt="deltaY"in Je?yT(Je):bx(Je),pt=P.current.filter(function(vt){return vt.name===Je.type&&(vt.target===Je.target||Je.target===vt.shadowParent)&&ZD(vt.delta,mt)})[0];if(pt&&pt.should){Je.cancelable&&Je.preventDefault();return}
vendor: 9,421 bytes, lines 3303-3307
3303if(!pt){var dt=(fe.current.shards||[]).map(xT).filter(Boolean).filter(function(vt){return vt.contains(Je.target)}),nt=dt.length>0?a(Je,dt[0]):!fe.current.noIsolation;nt&&Je.cancelable&&Je.preventDefault()}}},[]),re=ze.useCallback(function(Ne,Je,mt,pt){var dt={name:Ne,delta:Je,target:mt,should:pt,shadowParent:YD(mt)};P.current.push(dt),setTimeout(function(){P.current=P.current.filter(function(nt){return nt!==dt})},1)},[]),Ee=ze.useCallback(function(Ne){k.current=bx(Ne),F.current=void 0},[]),oe=ze.useCallback(function(Ne){re(Ne.type,yT(Ne),Ne.target,a(Ne,E.lockRef.current))},[]),ke=ze.useCallback(function(Ne){re(Ne.type,bx(Ne),Ne.target,a(Ne,E.lockRef.current))},[]);ze.useEffect(function(){return Ig.push(te),E.setCallbacks({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:ke}),document.addEventListener("wheel",ue,Cg),document.addEventListener("touchmove",ue,Cg),document.addEventListener("touchstart",Ee,Cg),function(){Ig=Ig.filter(function(Ne){return Ne!==te}),document.removeEventListener("wheel",ue,Cg),document.removeEventListener("touchmove",ue,Cg),document.removeEventListener("touchstart",Ee,Cg)}},[]);var Qe=E.removeScrollBar,ft=E.inert;return ze.createElement(ze.Fragment,null,ft?ze.createElement(te,{styles:$D(X)}):null,Qe?ze.createElement(FD,{noRelative:E.noRelative,gapMode:E.gapMode}):null)}function YD(E){for(var P=null;E!==null;)E instanceof ShadowRoot&&(P=E.host,E=E.host),E=E.parentNode;return P}const KD=ED(OS,WD);var US=ze.forwardRef(function(E,P){return ze.createElement(qx,Fh({},E,{ref:P,sideCar:KD}))});US.classNames=qx.classNames;var QD=function(E){if(typeof document>"u")return null;var P=Array.isArray(E)?E[0]:E;return P.ownerDocument.body},Rg=new WeakMap,wx=new WeakMap,Tx={},Dv=0,VS=function(E){return E&&(E.host||VS(E.parentNode))},JD=function(E,P){return P.map(function(k){if(E.contains(k))return k;var F=VS(k);return F&&E.contains(F)?F:(console.error("aria-hidden",k,"in not contained inside",E,". Doing nothing"),null)}).filter(function(k){return!!k})},eP=function(E,P,k,F){var X=JD(P,Array.isArray(E)?E:[E]);Tx[k]||(Tx[k]=new WeakMap);var te=Tx[k],fe=[],a=new Set,ue=new Set(X),re=function(oe){!oe||a.has(oe)||(a.add(oe),re(oe.parentNode))};X.forEach(re);var Ee=function(oe){!oe||ue.has(oe)||Array.prototype.forEach.call(oe.children,function(ke){if(a.has(ke))Ee(ke);else try{var Qe=ke.getAttribute(F),ft=Qe!==null&&Qe!=="false",Ne=(Rg.get(ke)||0)+1,Je=(te.get(ke)||0)+1;Rg.set(ke,Ne),te.set(ke,Je),fe.push(ke),Ne===1&&ft&&wx.set(ke,!0),Je===1&&ke.setAttribute(k,"true"),ft||ke.setAttribute(F,"true")}catch(mt){console.error("aria-hidden: cannot operate on ",ke,mt)}})};return Ee(P),a.clear(),Dv++,function(){fe.forEach(function(oe){var ke=Rg.get(oe)-1,Qe=te.get(oe)-1;Rg.set(oe,ke),te.set(oe,Qe),ke||(wx.has(oe)||oe.removeAttribute(F),wx.delete(oe)),Qe||oe.removeAttribute(k)}),Dv--,Dv||(Rg=new WeakMap,Rg=new WeakMap,wx=new WeakMap,Tx={})}},tP=function(E,P,k){k===void 0&&(k="data-aria-hidden");var F=Array.from(Array.isArray(E)?E:[E]),X=QD(E);return X?(F.push.apply(F,Array.from(X.querySelectorAll("[aria-live], script"))),eP(F,X,k,"aria-hidden")):function(){return null}},Zx="Dialog",[jS]=Wv(Zx),[iP,Pu]=jS(Zx),GS=E=>{const{__scopeDialog:P,children:k,open:F,defaultOpen:X,onOpenChange:te,modal:fe=!0}=E,a=ze.useRef(null),ue=ze.useRef(null),[re,Ee]=VR({prop:F,defaultProp:X??!1,onChange:te,caller:Zx});return Ce.jsx(iP,{scope:P,triggerRef:a,contentRef:ue,contentId:_v(),titleId:_v(),descriptionId:_v(),open:re,onOpenChange:Ee,onOpenToggle:ze.useCallback(()=>Ee(oe=>!oe),[Ee]),modal:fe,children:k})};GS.displayName=Zx;var HS="DialogTrigger",qS=ze.forwardRef((E,P)=>{const{__scopeDialog:k,...F}=E,X=Pu(HS,k),te=Du(P,X.triggerRef);return Ce.jsx(Sl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":X.open,"aria-controls":X.contentId,"data-state":d1(X.open),...F,ref:te,onClick:Tl(E.onClick,X.onOpenToggle)})});qS.displayName=HS;var u1="DialogPortal",[nP,ZS]=jS(u1,{forceMount:void 0}),$S=E=>{const{__scopeDialog:P,forceMount:k,children:F,container:X}=E,te=Pu(u1,P);return Ce.jsx(nP,{scope:P,forceMount:k,children:ze.Children.map(F,fe=>Ce.jsx(J_,{present:k||te.open,children:Ce.jsx(YT,{asChild:!0,container:X,children:fe})}))})};$S.displayName=u1;var Ox="DialogOverlay",XS=ze.forwardRef((E,P)=>{const k=ZS(Ox,E.__scopeDialog),{forceMount:F=k.forceMount,...X}=E,te=Pu(Ox,E.__scopeDialog);return te.modal?Ce.jsx(J_,{present:F||te.open,children:Ce.jsx(oP,{...X,ref:P})}):null});XS.displayName=Ox;var rP=Yv("DialogOverlay.RemoveScroll"),oP=ze.forwardRef((E,P)=>{const{__scopeDialog:k,...F}=E,X=Pu(Ox,k);return Ce.jsx(US,{as:rP,allowPinchZoom:!0,shards:[X.contentRef],children:Ce.jsx(Sl.div,{"data-state":d1(X.open),...F,ref:P,style:{pointerEvents:"auto",...F.style}})})}),Sm="DialogContent",WS=ze.forwardRef((E,P)=>{const k=ZS(Sm,E.__scopeDialog),{forceMount:F=k.forceMount,...X}=E,te=Pu(Sm,E.__scopeDialog);return Ce.jsx(J_,{present:F||te.open,children:te.modal?Ce.jsx(aP,{...X,ref:P}):Ce.jsx(sP,{...X,ref:P})})});WS.displayName=Sm;var aP=ze.forwardRef((E,P)=>{const k=Pu(Sm,E.__scopeDialog),F=ze.useRef(null),X=Du(P,k.contentRef,F);return ze.useEffect(()=>{const te=F.current;if(te)return tP(te)},[]),Ce.jsx(YS,{...E,ref:X,trapFocus:k.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tl(E.onCloseAutoFocus,te=>{te.preventDefault(),k.triggerRef.current?.focus()}),onPointerDownOutside:Tl(E.onPointerDownOutside,te=>{const fe=te.detail.originalEvent,a=fe.button===0&&fe.ctrlKey===!0;(fe.button===2||a)&&te.preventDefault()}),onFocusOutside:Tl(E.onFocusOutside,te=>te.preventDefault())})}),sP=ze.forwardRef((E,P)=>{const k=Pu(Sm,E.__scopeDialog),F=ze.useRef(!1),X=ze.useRef(!1);return Ce.jsx(YS,{...E,ref:P,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:te=>{E.onCloseAutoFocus?.(te),te.defaultPrevented||(F.current||k.triggerRef.current?.focus(),te.preventDefault()),F.current=!1,X.current=!1},onInteractOutside:te=>{E.onInteractOutside?.(te),te.defaultPrevented||(F.current=!0,te.detail.originalEvent.type==="pointerdown"&&(X.current=!0));const fe=te.target;k.triggerRef.current?.contains(fe)&&te.preventDefault(),te.detail.originalEvent.type==="focusin"&&X.current&&te.preventDefault()}})}),YS=ze.forwardRef((E,P)=>{const{__scopeDialog:k,trapFocus:F,onOpenAutoFocus:X,onCloseAutoFocus:te,...fe}=E,a=Pu(Sm,k),ue=ze.useRef(null),re=Du(P,ue);return mD(),Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(zS,{asChild:!0,loop:!0,trapped:F,onMountAutoFocus:X,onUnmountAutoFocus:te,children:Ce.jsx(Kv,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":d1(a.open),...fe,ref:re,onDismiss:()=>a.onOpenChange(!1)})}),Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(cP,{titleId:a.titleId}),Ce.jsx(hP,{contentRef:ue,descriptionId:a.descriptionId})]})]})}),h1="DialogTitle",KS=ze.forwardRef((E,P)=>{const{__scopeDialog:k,...F}=E,X=Pu(h1,k);return Ce.jsx(Sl.h2,{id:X.titleId,...F,ref:P})});KS.displayName=h1;var QS="DialogDescription",lP=ze.forwardRef((E,P)=>{const{__scopeDialog:k,...F}=E,X=Pu(QS,k);return Ce.jsx(Sl.p,{id:X.descriptionId,...F,ref:P})});lP.displayName=QS;var JS="DialogClose",eE=ze.forwardRef((E,P)=>{const{__scopeDialog:k,...F}=E,X=Pu(JS,k);return Ce.jsx(Sl.button,{type:"button",...F,ref:P,onClick:Tl(E.onClick,()=>X.onOpenChange(!1))})});eE.displayName=JS;function d1(E){return E?"open":"closed"}var tE="DialogTitleWarning",[qP,iE]=WC(tE,{contentName:Sm,titleName:h1,docsSlug:"dialog"}),cP=({titleId:E})=>{const P=iE(tE),k=`\`${P.contentName}\` requires a \`${P.titleName}\` for the component to be accessible for screen reader users.
3304
3305If you want to hide the \`${P.titleName}\`, you can wrap it with our VisuallyHidden component.
3306
3307For more information, see https://radix-ui.com/primitives/docs/components/${P.docsSlug}`;return ze.useEffect(()=>{E&&(document.getElementById(E)||console.error(k))},[k,E]),null},uP="DialogDescriptionWarning",hP=({contentRef:E,descriptionId:P})=>{const F=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${iE(uP).contentName}}.`;return ze.useEffect(()=>{const X=E.current?.getAttribute("aria-describedby");P&&X&&(document.getElementById(P)||console.warn(F))},[F,E,P]),null},dP=GS,fP=qS,pP=$S,mP=XS,gP=WS,_P=KS,yP=eE;const nE=ze.createContext({isComposing:()=>!1,setComposing:()=>{},justEndedComposing:()=>!1,markCompositionEnd:()=>{}}),xP=()=>ze.useContext(nE);function vP({...E}){const P=ze.useRef(!1),k=ze.useRef(!1),F=ze.useRef(null),X=ze.useMemo(()=>({isComposing:()=>P.current,setComposing:te=>{P.current=te},justEndedComposing:()=>k.current,markCompositionEnd:()=>{k.current=!0,F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{k.current=!1},150)}}),[]);return Ce.jsx(nE.Provider,{"data-loc":"client/src/components/ui/dialog.tsx:50",value:X,children:Ce.jsx(dP,{"data-loc":"client/src/components/ui/dialog.tsx:51","data-slot":"dialog",...E})})}function bP({...E}){return Ce.jsx(fP,{"data-loc":"client/src/components/ui/dialog.tsx:59","data-slot":"dialog-trigger",...E})}function wP({...E}){return Ce.jsx(pP,{"data-loc":"client/src/components/ui/dialog.tsx:65","data-slot":"dialog-portal",...E})}function rE({className:E,...P}){return Ce.jsx(mP,{"data-loc":"client/src/components/ui/dialog.tsx:79","data-slot":"dialog-overlay",className:sp("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",E),...P})}rE.displayName="DialogOverlay";
3307function TP({className:E,children:P,showCloseButton:k=!0,onEscapeKeyDown:F,...X}){const{isComposing:te}=xP(),fe=ze.useCallback(a=>{if(a.isComposing||te()){a.preventDefault();return}F?.(a)},[te,F]);return Ce.jsxs(wP,{"data-loc":"client/src/components/ui/dialog.tsx:122","data-slot":"dialog-portal",children:[Ce.jsx(rE,{"data-loc":"client/src/components/ui/dialog.tsx:123"}),Ce.jsxs(gP,{"data-loc":"client/src/components/ui/dialog.tsx:124","data-slot":"dialog-content",className:sp("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",E),onEscapeKeyDown:fe,...X,children:[P,k&&Ce.jsxs(yP,{"data-loc":"client/src/components/ui/dialog.tsx:135","data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[Ce.jsx(bS,{"data-loc":"client/src/components/ui/dialog.tsx:139"}),Ce.jsx("span",{"data-loc":"client/src/components/ui/dialog.tsx:140",className:"sr-only",children:"Close"})]})]})]})}function SP({className:E,...P}){return Ce.jsx("div",{"data-loc":"client/src/components/ui/dialog.tsx:150","data-slot":"dialog-header",className:sp("flex flex-col gap-2 text-center sm:text-left",E),...P})}function EP({className:E,...P}){return Ce.jsx(_P,{"data-loc":"client/src/components/ui/dialog.tsx:176","data-slot":"dialog-title",className:sp("text-lg leading-none font-semibold",E),...P})}var Pv={exports:{}},vT;function AP(){return vT||(vT=1,(function(E){var P=(function(){var k=String.fromCharCode,F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",X="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",te={};function fe(ue,re){if(!te[ue]){te[ue]={};for(var Ee=0;Ee<ue.length;Ee++)te[ue][ue.charAt(Ee)]=Ee}return te[ue][re]}var a={compressToBase64:function(ue){if(ue==null)return"";var re=a._compress(ue,6,function(Ee){return F.charAt(Ee)});switch(re.length%4){default:case 0:return re;case 1:return re+"===";case 2:return re+"==";case 3:return re+"="}},decompressFromBase64:function(ue){return ue==null?"":ue==""?null:a._decompress(ue.length,32,function(re){return fe(F,ue.charAt(re))})},compressToUTF16:function(ue){return ue==null?"":a._compress(ue,15,function(re){return k(re+32)})+" "},decompressFromUTF16:function(ue){return ue==null?"":ue==""?null:a._decompress(ue.length,16384,function(re){return ue.charCodeAt(re)-32})},compressToUint8Array:function(ue){for(var re=a.compress(ue),Ee=new Uint8Array(re.length*2),oe=0,ke=re.length;oe<ke;oe++){var Qe=re.charCodeAt(oe);Ee[oe*2]=Qe>>>8,Ee[oe*2+1]=Qe%256}return Ee},decompressFromUint8Array:function(ue){if(ue==null)return a.decompress(ue);for(var re=new Array(ue.length/2),Ee=0,oe=re.length;Ee<oe;Ee++)re[Ee]=ue[Ee*2]*256+ue[Ee*2+1];var ke=[];return re.forEach(function(Qe){ke.push(k(Qe))}),a.decompress(ke.join(""))},compressToEncodedURIComponent:function(ue){return ue==null?"":a._compress(ue,6,function(re){return X.charAt(re)})},decompressFromEncodedURIComponent:function(ue){return ue==null?"":ue==""?null:(ue=ue.replace(/ /g,"+"),a._decompress(ue.length,32,function(re){return fe(X,ue.charAt(re))}))},compress:function(ue){return a._compress(ue,16,function(re){return k(re)})},_compress:function(ue,re,Ee){if(ue==null)return"";var oe,ke,Qe={},ft={},Ne="",Je="",mt="",pt=2,dt=3,nt=2,vt=[],ut=0,rt=0,wt;for(wt=0;wt<ue.length;wt+=1)if(Ne=ue.charAt(wt),Object.prototype.hasOwnProperty.call(Qe,Ne)||(Qe[Ne]=dt++,ft[Ne]=!0),Je=mt+Ne,Object.prototype.hasOwnProperty.call(Qe,Je))mt=Je;else{if(Object.prototype.hasOwnProperty.call(ft,mt)){if(mt.charCodeAt(0)<256){for(oe=0;oe<nt;oe++)ut=ut<<1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++;for(ke=mt.charCodeAt(0),oe=0;oe<8;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1}else{for(ke=1,oe=0;oe<nt;oe++)ut=ut<<1|ke,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=0;for(ke=mt.charCodeAt(0),oe=0;oe<16;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1}pt--,pt==0&&(pt=Math.pow(2,nt),nt++),delete ft[mt]}else for(ke=Qe[mt],oe=0;oe<nt;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1;pt--,pt==0&&(pt=Math.pow(2,nt),nt++),Qe[Je]=dt++,mt=String(Ne)}if(mt!==""){if(Object.prototype.hasOwnProperty.call(ft,mt)){if(mt.charCodeAt(0)<256){for(oe=0;oe<nt;oe++)ut=ut<<1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++;for(ke=mt.charCodeAt(0),oe=0;oe<8;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1}else{for(ke=1,oe=0;oe<nt;oe++)ut=ut<<1|ke,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=0;for(ke=mt.charCodeAt(0),oe=0;oe<16;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1}pt--,pt==0&&(pt=Math.pow(2,nt),nt++),delete ft[mt]}else for(ke=Qe[mt],oe=0;oe<nt;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1;pt--,pt==0&&(pt=Math.pow(2,nt),nt++)}for(ke=2,oe=0;oe<nt;oe++)ut=ut<<1|ke&1,rt==re-1?(rt=0,vt.push(Ee(ut)),ut=0):rt++,ke=ke>>1;for(;;)if(ut=ut<<1,rt==re-1){vt.push(Ee(ut));break}else rt++;return vt.join("")},decompress:function(ue){return ue==null?"":ue==""?null:a._decompress(ue.length,32768,function(re){return ue.charCodeAt(re)})}
3307,_decompress:function(ue,re,Ee){var oe=[],ke=4,Qe=4,ft=3,Ne="",Je=[],mt,pt,dt,nt,vt,ut,rt,wt={val:Ee(0),position:re,index:1};for(mt=0;mt<3;mt+=1)oe[mt]=mt;for(dt=0,vt=Math.pow(2,2),ut=1;ut!=vt;)nt=wt.val&wt.position,wt.position>>=1,wt.position==0&&(wt.position=re,wt.val=Ee(wt.index++)),dt|=(nt>0?1:0)*ut,ut<<=1;switch(dt){case 0:for(dt=0,vt=Math.pow(2,8),ut=1;ut!=vt;)nt=wt.val&wt.position,wt.position>>=1,wt.position==0&&(wt.position=re,wt.val=Ee(wt.index++)),dt|=(nt>0?1:0)*ut,ut<<=1;rt=k(dt);break;case 1:for(dt=0,vt=Math.pow(2,16),ut=1;ut!=vt;)nt=wt.val&wt.position,wt.position>>=1,wt.position==0&&(wt.position=re,wt.val=Ee(wt.index++)),dt|=(nt>0?1:0)*ut,ut<<=1;rt=k(dt);break;case 2:return""}for(oe[3]=rt,pt=rt,Je.push(rt);;){if(wt.index>ue)return"";for(dt=0,vt=Math.pow(2,ft),ut=1;ut!=vt;)nt=wt.val&wt.position,wt.position>>=1,wt.position==0&&(wt.position=re,wt.val=Ee(wt.index++)),dt|=(nt>0?1:0)*ut,ut<<=1;switch(rt=dt){case 0:for(dt=0,vt=Math.pow(2,8),ut=1;ut!=vt;)nt=wt.val&wt.position,wt.position>>=1,wt.position==0&&(wt.position=re,wt.val=Ee(wt.index++)),dt|=(nt>0?1:0)*ut,ut<<=1;oe[Qe++]=k(dt),rt=Qe-1,ke--;break;case 1:for(dt=0,vt=Math.pow(2,16),ut=1;ut!=vt;)nt=wt.val&wt.position,wt.position>>=1,wt.position==0&&(wt.position=re,wt.val=Ee(wt.index++)),dt|=(nt>0?1:0)*ut,ut<<=1;oe[Qe++]=k(dt),rt=Qe-1,ke--;break;case 2:return Je.join("")}if(ke==0&&(ke=Math.pow(2,ft),ft++),oe[rt])Ne=oe[rt];else if(rt===Qe)Ne=pt+pt.charAt(0);else return null;Je.push(Ne),oe[Qe++]=pt+Ne.charAt(0),ke--,pt=Ne,ke==0&&(ke=Math.pow(2,ft),ft++)}}};return a})();E!=null?E.exports=P:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return P})})(Pv)),Pv.exports}var MP=AP();const oE=Bx(MP);function CP(E){const P=new Map,k=E.destinations.map((X,te)=>(P.set(X.id,te),[X.name,Math.round(X.coordinates[0]*1e6)/1e6,Math.round(X.coordinates[1]*1e6)/1e6,X.label])),F=E.routeSegments.map(X=>{const te=P.get(X.from.id)??0,fe=P.get(X.to.id)??0;return[te,fe,X.transportMode]});return{v:2,d:k,s:F}}function IP(E){const P=E.d.map(([F,X,te,fe],a)=>({id:`dest-${a}`,name:F,coordinates:[X,te],label:fe})),k=E.s.map(([F,X,te])=>({from:P[F],to:P[X],transportMode:te}));return{destinations:P,routeSegments:k}}function RP(E,P){const k=CP({destinations:E,routeSegments:P}),F=JSON.stringify(k);return oE.compressToEncodedURIComponent(F)}function zP(E){try{const P=oE.decompressFromEncodedURIComponent(E);if(P){const k=JSON.parse(P);if(k.v===2&&Array.isArray(k.d)&&Array.isArray(k.s))return IP(k);if(k.destinations&&k.routeSegments)return k}}catch{}try{const P=decodeURIComponent(atob(E)),k=JSON.parse(P);if(k.destinations&&k.routeSegments)return k}catch{}return console.error("Failed to decode route data: unrecognized format"),null}async function DP(E){const P=`https://is.gd/create.php?format=json&url=${encodeURIComponent(E)}`,k=await fetch(P);if(!k.ok)throw new Error(`URL shortening failed: ${k.status}`);const F=await k.json();if(F.errorcode)throw new Error(F.errormessage||"URL shortening failed");return F.shorturl}function PP({destinations:E,routeSegments:P,disabled:k}){const[F,X]=ze.useState(!1),[te,fe]=ze.useState(!1),[a,ue]=ze.useState(!1),[re,Ee]=ze.useState("Safari Route"),[oe,ke]=ze.useState(!1),[Qe,ft]=ze.useState(null),[Ne,Je]=ze.useState(!1),[mt,pt]=ze.useState(null),dt=ze.useRef(""),nt=ze.useMemo(()=>{if(E.length<2)return"";const Vt=RP(E,P),gi=window.location.origin,Si=encodeURIComponent(re);return`${gi}/embed?route=${Vt}&title=${Si}`},[E,P,re]),vt=ze.useCallback(async Vt=>{if(!Vt){ft(null);return}if(!(Vt===dt.current&&Qe)){dt.current=Vt,Je(!0),pt(null),ft(null);try{const gi=await DP(Vt);dt.current===Vt&&ft(gi)}catch(gi){dt.current===Vt&&pt(gi.message||"Failed to shorten URL")}finally{dt.current===Vt&&Je(!1)}}},[Qe]);ze.useEffect(()=>{oe&&nt&&vt(nt)},[oe,nt,vt]),ze.useEffect(()=>{oe||(ft(null),dt.current="",pt(null))},[oe]);const ut=ze.useMemo(()=>nt?`<iframe 
3308  src="${nt}" 
3309  width="100%" 
3310  height="500" 
3311  style="border: none; border-radius: 8px;" 
3312  title="${re}"
3313  loading="lazy"
3314></iframe>`:"",[nt,re]),rt=nt.length,wt=rt<2e3?"text-green-600":rt<4e3?"text-amber-600":"text-red-600",Ii=async()=>{const Vt=Qe||nt;try{await navigator.clipboard.writeText(Vt),X(!0),setTimeout(()=>X(!1),2e3)}catch(gi){console.error("Failed to copy:",gi)}},ji=async()=>{try{await navigator.clipboard.writeText(nt),fe(!0),setTimeout(()=>fe(!1),2e3)}catch(Vt){console.error("Failed to copy:",Vt)}},Bi=async()=>{try{await navigator.clipboard.writeText(ut),ue(!0),setTimeout(()=>ue(!1),2e3)}catch(Vt){console.error("Failed to copy:",Vt)}},ai=()=>{window.open(nt,"_blank")};return Ce.jsxs(vP,{"data-loc":"client/src/components/SharePanel.tsx:148",open:oe,onOpenChange:ke,children:[Ce.jsx(bP,{"data-loc":"client/src/components/SharePanel.tsx:149",asChild:!0,children:Ce.jsxs(kh,{"data-loc":"client/src/components/SharePanel.tsx:150",disabled:k||E.length<2,variant:"outline",className:"w-full",style:{borderColor:k||E.length<2?"#ccc":"#8B1A1A",color:k||E.length<2?"#999":"#8B1A1A"},children:[Ce.jsx(eT,{"data-loc":"client/src/components/SharePanel.tsx:159",className:"w-4 h-4 mr-2"}),"Share & Embed"]})}),Ce.jsxs(TP,{"data-loc":"client/src/components/SharePanel.tsx:164",className:"sm:max-w-lg bg-[#FFFBF5]",children:[Ce.jsx(SP,{"data-loc":"client/src/components/SharePanel.tsx:165",children:Ce.jsxs(EP,{"data-loc":"client/src/components/SharePanel.tsx:166",className:"flex items-center gap-2",style:{fontFamily:"'Playfair Display', serif"},children:[Ce.jsx(eT,{"data-loc":"client/src/components/SharePanel.tsx:170",className:"w-5 h-5 text-[#8B1A1A]"}
3314),"Share Your Safari Route"]})}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:175",className:"space-y-5 pt-4",children:[Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:177",className:"space-y-2",children:[Ce.jsx("label",{"data-loc":"client/src/components/SharePanel.tsx:178",className:"text-sm font-medium text-[#2C2C2C]",children:"Route Title"}),Ce.jsx("input",{"data-loc":"client/src/components/SharePanel.tsx:181",type:"text",value:re,onChange:Vt=>Ee(Vt.target.value),className:"w-full px-3 py-2 border border-[#E5DED3] rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#8B1A1A]/20 focus:border-[#8B1A1A]",placeholder:"Enter a title for your route"})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:191",className:"space-y-2",children:[Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:192",className:"flex items-center gap-2",children:[Ce.jsx(c3,{"data-loc":"client/src/components/SharePanel.tsx:193",className:"w-4 h-4 text-[#8B1A1A]"}),Ce.jsx("label",{"data-loc":"client/src/components/SharePanel.tsx:194",className:"text-sm font-medium text-[#2C2C2C]",children:"Short Link"}),Ce.jsx("span",{"data-loc":"client/src/components/SharePanel.tsx:197",className:"text-xs text-[#999] italic",children:"for sharing"}),Ne&&Ce.jsx(Bg,{"data-loc":"client/src/components/SharePanel.tsx:199",className:"w-3 h-3 text-[#8B1A1A] animate-spin"}),Qe&&Ce.jsx("span",{"data-loc":"client/src/components/SharePanel.tsx:202",className:"text-xs text-green-600 font-medium",children:"via is.gd"})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:205",className:"flex gap-2",children:[Ce.jsx("input",{"data-loc":"client/src/components/SharePanel.tsx:206",type:"text",value:Ne?"Generating short link...":Qe||nt,readOnly:!0,className:"flex-1 px-3 py-2 border border-[#E5DED3] rounded-lg bg-[#F5F0E8] text-sm text-[#666] truncate"}),Ce.jsx(kh,{"data-loc":"client/src/components/SharePanel.tsx:212",onClick:Ii,variant:"outline",size:"sm",className:"flex-shrink-0",style:{borderColor:"#8B1A1A",color:"#8B1A1A"},disabled:Ne||!nt,children:F?Ce.jsx(Ax,{"data-loc":"client/src/components/SharePanel.tsx:221",className:"w-4 h-4"}):Ce.jsx(wv,{"data-loc":"client/src/components/SharePanel.tsx:223",className:"w-4 h-4"})}),Ce.jsx(kh,{"data-loc":"client/src/components/SharePanel.tsx:226",onClick:ai,variant:"outline",size:"sm",className:"flex-shrink-0",style:{borderColor:"#8B1A1A",color:"#8B1A1A"},children:Ce.jsx(r3,{"data-loc":"client/src/components/SharePanel.tsx:233",className:"w-4 h-4"})})]}),mt&&Ce.jsx("p",{"data-loc":"client/src/components/SharePanel.tsx:237",className:"text-xs text-amber-600",children:"Could not generate short link. Using full URL instead."})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:244",className:"space-y-2",children:[Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:245",className:"flex items-center gap-2",children:[Ce.jsx(o3,{"data-loc":"client/src/components/SharePanel.tsx:246",className:"w-4 h-4 text-[#8B1A1A]"}),Ce.jsx("label",{"data-loc":"client/src/components/SharePanel.tsx:247",className:"text-sm font-medium text-[#2C2C2C]",children:"Direct Link"}),Ce.jsx("span",{"data-loc":"client/src/components/SharePanel.tsx:250",className:"text-xs text-[#999] italic",children:"for Framer / iframe"}),Ce.jsx("span",{"data-loc":"client/src/components/SharePanel.tsx:251",className:`text-xs font-mono ${wt}`,children:rt>0?`${rt} chars`:""})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:255",className:"flex gap-2",children:[Ce.jsx("input",{"data-loc":"client/src/components/SharePanel.tsx:256",type:"text",value:nt,readOnly:!0,className:"flex-1 px-3 py-2 border border-[#E5DED3] rounded-lg bg-[#F5F0E8] text-sm text-[#666] truncate"}),Ce.jsx(kh,{"data-loc":"client/src/components/SharePanel.tsx:262",onClick:ji,variant:"outline",size:"sm",className:"flex-shrink-0",style:{borderColor:"#8B1A1A",color:"#8B1A1A"},disabled:!nt,children:te?Ce.jsx(Ax,{"data-loc":"client/src/components/SharePanel.tsx:271",className:"w-4 h-4"}):Ce.jsx(wv,{"data-loc":"client/src/components/SharePanel.tsx:273",className:"w-4 h-4"})})]}),Ce.jsx("p",{"data-loc":"client/src/components/SharePanel.tsx:277",className:"text-xs text-[#999]",children:"Use this URL when embedding in Framer, iframes, or other website builders."})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:283",className:"space-y-2",children:[Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:284",className:"flex items-center gap-2",children:[Ce.jsx(i3,{"data-loc":"client/src/components/SharePanel.tsx:285",className:"w-4 h-4 text-[#8B1A1A]"}),Ce.jsx("label",{"data-loc":"client/src/components/SharePanel.tsx:286",className:"text-sm font-medium text-[#2C2C2C]",children:"Embed Code"})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:290",className:"relative",children:[Ce.jsx("textarea",{"data-loc":"client/src/components/SharePanel.tsx:291",value:ut,readOnly:!0,rows:5,className:"w-full px-3 py-2 border border-[#
3314E5DED3] rounded-lg bg-[#F5F0E8] text-xs font-mono text-[#666] resize-none"}),Ce.jsx(kh,{"data-loc":"client/src/components/SharePanel.tsx:297",onClick:Bi,variant:"outline",size:"sm",className:"absolute top-2 right-2",style:{borderColor:"#8B1A1A",color:"#8B1A1A"},disabled:!ut,children:a?Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(Ax,{"data-loc":"client/src/components/SharePanel.tsx:307",className:"w-4 h-4 mr-1"}),"Copied!"]}):Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(wv,{"data-loc":"client/src/components/SharePanel.tsx:312",className:"w-4 h-4 mr-1"}),"Copy"]})})]}),Ce.jsx("p",{"data-loc":"client/src/components/SharePanel.tsx:318",className:"text-xs text-[#666]",children:"Paste this code into your website's HTML to embed the interactive map."})]}),Ce.jsxs("div",{"data-loc":"client/src/components/SharePanel.tsx:324",className:"bg-[#F5F0E8] rounded-lg p-3 space-y-1",children:[Ce.jsxs("p",{"data-loc":"client/src/components/SharePanel.tsx:325",className:"text-xs text-[#666]",children:[Ce.jsx("span",{"data-loc":"client/src/components/SharePanel.tsx:326",className:"font-medium",children:"Destinations:"})," ",E.length]}),Ce.jsxs("p",{"data-loc":"client/src/components/SharePanel.tsx:328",className:"text-xs text-[#666]",children:[Ce.jsx("span",{"data-loc":"client/src/components/SharePanel.tsx:329",className:"font-medium",children:"Route:"})," ",E.map(Vt=>Vt.label).join(" → ")]})]})]})]})]})}const LP=[{value:"drive",label:"Self Drive",icon:yS,color:"#2B4B7C"},{value:"flight",label:"Flight",icon:xS,color:"#2E7D4E"},{value:"transfer",label:"Transfer",icon:_S,color:"#C4A35A"}];function OP({value:E,onChange:P}){return Ce.jsxs("div",{"data-loc":"client/src/components/TransportModeSelector.tsx:18",className:"space-y-2",children:[Ce.jsx("label",{"data-loc":"client/src/components/TransportModeSelector.tsx:19",className:"block text-sm font-medium text-foreground/80",children:"Transport Mode"}),Ce.jsx("div",{"data-loc":"client/src/components/TransportModeSelector.tsx:22",className:"grid grid-cols-3 gap-2",children:LP.map(k=>{const F=k.icon,X=E===k.value;return Ce.jsxs("button",{"data-loc":"client/src/components/TransportModeSelector.tsx:28",onClick:()=>P(k.value),className:`
3315                flex flex-col items-center gap-1.5 p-3 rounded-lg border-2 transition-all duration-200
3316                ${X?"border-current shadow-md":"border-border hover:border-muted-foreground/30"}
3317              `,style:{color:X?k.color:void 0,backgroundColor:X?`${k.color}10`:void 0},children:[Ce.jsx(F,{"data-loc":"client/src/components/TransportModeSelector.tsx:43",className:"w-5 h-5",style:{color:X?k.color:"currentColor"}}),Ce.jsx("span",{"data-loc":"client/src/components/TransportModeSelector.tsx:47",className:`text-xs font-medium ${X?"":"text-muted-foreground"}`,children:k.label})]},k.value)})})]})}const Sx="ABCDEFGHIJKLMNOPQRSTUVWXYZ",BP=(E,P,k=.001)=>Math.abs(E[0]-P[0])<k&&Math.abs(E[1]-P[1])<k;function kP(){const[E,P]=ze.useState([]),[k,F]=ze.useState([]),[X,te]=ze.useState(""),[fe,a]=ze.useState(null),[ue,re]=ze.useState("drive"),[Ee,oe]=ze.useState(!1),[ke,Qe]=ze.useState(!1),ft=ze.useRef(null),Ne=ze.useMemo(()=>{if(E.length<2)return!1;const Bi=E[0],ai=E[E.length-1];return BP(Bi.coordinates,ai.coordinates)},[E]),Je=ke||Ne,mt=(Bi,ai)=>{te(Bi),a(ai)},pt=ze.useCallback(()=>{if(!X||!fe)return;Qe(!1);const Bi={id:`dest-${Date.now()}`,name:X,coordinates:fe,label:Sx[E.length]||`${E.length+1}`},ai=[...E,Bi];if(P(ai),E.length>0){const Vt={from:E[E.length-1],to:Bi,transportMode:ue};F([...k,Vt])}te(""),a(null)},[X,fe,E,k,ue]),dt=ze.useCallback(Bi=>{if(E.findIndex(je=>je.id===Bi)===-1)return;Qe(!1);const gi=E.filter(je=>je.id!==Bi).map((je,St)=>({...je,label:Sx[St]||`${St+1}`}));P(gi);const Si=[];for(let je=0;je<gi.length-1;je++)Si.push({from:gi[je],to:gi[je+1],transportMode:k[je]?.transportMode||ue});F(Si)},[E,k,ue]),nt=ze.useCallback((Bi,ai)=>{const Vt=[...k];Vt[Bi]&&(Vt[Bi]={...Vt[Bi],transportMode:ai},F(Vt))},[k]),vt=ze.useCallback((Bi,ai)=>{Qe(!1);const Vt=[...E],[gi]=Vt.splice(Bi,1);Vt.splice(ai,0,gi);const Si=Vt.map((St,Tt)=>({...St,label:Sx[Tt]||`${Tt+1}`}));P(Si);const je=[];for(let St=0;St<Si.length-1;St++)je.push({from:Si[St],to:Si[St+1],transportMode:ue});F(je)},[E,ue]),ut=ze.useCallback(async()=>ft.current?ft.current.exportMap():"",[]),rt=ze.useCallback(()=>{P([]),F([]),te(""),a(null),Qe(!1)},[]),wt=ze.useCallback(()=>{te(""),a(null)},[]),Ii=ze.useCallback(()=>{Qe(!0)},[]),ji=E.length>=2&&!Ne&&!ke;return Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:170",className:"h-screen flex flex-col overflow-hidden",children:[Ce.jsx("header",{"data-loc":"client/src/pages/Home.tsx:172",className:"bg-card border-b border-border px-6 py-4 flex-shrink-0",children:Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:173",className:"flex items-center justify-between max-w-screen-2xl mx-auto",children:[Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:174",className:"flex items-center gap-3",children:[Ce.jsx("div",{"data-loc":"client/src/pages/Home.tsx:175",className:"w-10 h-10 rounded-full bg-primary flex items-center justify-center",children:Ce.jsx(Mx,{"data-loc":"client/src/pages/Home.tsx:176",className:"w-5 h-5 text-primary-foreground"})}),Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:178",children:[Ce.jsx("h1",{"data-loc":"client/src/pages/Home.tsx:179",className:"text-xl font-semibold text-foreground",style:{fontFamily:"'Playfair Display', serif"},children:"Safari Route Map Generator"}),Ce.jsx("p",{"data-loc":"client/src/pages/Home.tsx:185",className:"text-xs text-muted-foreground",children:"Secret Namibia Itinerary Maps"})]})]}),Ce.jsxs(kh,{"data-loc":"client/src/pages/Home.tsx:191",variant:"outline",size:"sm",onClick:rt,className:"text-muted-foreground hover:text-foreground",children:[Ce.jsx(vS,{"data-loc":"client/src/pages/Home.tsx:197",className:"w-4 h-4 mr-2"}),"Reset"]})]})}),Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:204",className:"flex-1 flex min-h-0",children:[Ce.jsxs("aside",{"data-loc":"client/src/pages/Home.tsx:206",className:"w-96 safari-panel flex flex-col overflow-y-auto flex-shrink-0",children:[Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:207",className:"p-6 space-y-6",children:[Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:209",className:"space-y-4",children:[Ce.jsx("h2",{"data-loc":"client/src/pages/Home.tsx:210",className:"text-lg font-semibold",style:{fontFamily:"'Playfair Display', serif"},children:"Add Destination"}),Ce.jsx(rD,{"data-loc":"client/src/pages/Home.tsx:217",value:X,onChange:mt,onClear:wt,placeholder:"Search for a location in Namibia...",label:Sx[E.length]||`${E.length+1}`}),Ce.jsx(OP,{"data-loc":"client/src/pages/Home.tsx:225",value:ue,onChange:re}),Ce.jsxs(kh,{"data-loc":"client/src/pages/Home.tsx:230",onClick:pt,disabled:!X||!fe,className:"w-full safari-button-primary",style:{background:!X||!fe?"#ccc":"#8B1A1A",color:"white"},children:[Ce.jsx(d3,{"data-loc":"client/src/pages/Home.tsx:239",className:"w-4 h-4 mr-2"}),"Add to Route"]})]}),Ce.jsx("div",{"data-loc":"client/src/pages/Home.tsx:245",className:"border-t border-dashed border-border"}),Ce.jsx(aD,{"data-loc":"client/src/pages/Home.tsx:248",destinations:E,routeSegments:k,onRemove:dt,onReorder:vt,onTransportModeChange:nt}),ji&&Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:258",className:"pt-2",children:[Ce.jsxs(kh,{"data-loc":"client/src/pages/Home.tsx:259",onClick:Ii,className:"w-full",style:{background:"#2E5B4E",color:"white"},children:[Ce.jsx(h3,{"data-loc":"client/src/pages/Home.tsx:267",className:"w-4 h-4 mr-2"}),"Finalize Route & Start Animation"]}),Ce.jsx("p",{"data-loc":"client/src/pages/Home.tsx:270",className:"text-xs text-muted-foreground mt-2 text-center",children:"Or add the starting point as the last destination to complete the loop"})]}),Je&&E.length>=2&&Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:278",className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200",children:[Ce.jsx(t3,{"data-loc":"client/src/pages/Home.tsx:279",className:"w-5 h-5 text-green-600"}),Ce.jsx("span",{"data-loc":"client/src/pages/Home.tsx:280",className:"text-sm text-green-700 font-medium",children:Ne?"Route complete - Loop detected!":"Route finalized - Animation active"})]})]}),Ce.jsxs("div",{"data-loc":"client/src/pages/Home.tsx:288",className:"p-6 border-t border-border bg-card/50 space-y-3",children:[Ce.jsx(sD,{"data-loc":"client/src/pages/Home.tsx:289",onExport:ut,disabled:!Ee,destinationCount:E.length}),Ce.jsx(PP,{"data-loc":"client/src/pages/Home.tsx:295",destinations:E,routeSegments:k,disabled:!Ee})]})]}),Ce.jsx("main",{"data-loc":"client/src/pages/Home.tsx:304",className:"flex-1 p-6 bg-secondary/30 min-h-0",children:Ce.jsx("div",{"data-loc":"client/src/pages/Home.tsx:305",className:"h-full safari-card rounded-xl overflow-hidden shadow-lg",children:Ce.jsx(c1,{"data-loc":"client/src/pages/Home.tsx:306",ref:ft,destinations:E,routeSegments:k,onMapReady:()=>
3317oe(!0),isAnimating:Je})})})]})]})}function FP(){const E=N3(),[P,k]=ze.useState([]),[F,X]=ze.useState([]),[te,fe]=ze.useState(!1),[a,ue]=ze.useState(!1),[re,Ee]=ze.useState(null),[oe,ke]=ze.useState("Safari Route"),[Qe,ft]=ze.useState(!0),Ne=ze.useRef(null);ze.useEffect(()=>{const mt=new URLSearchParams(E),pt=mt.get("route"),dt=mt.get("title");if(dt&&ke(decodeURIComponent(dt)),pt){const nt=zP(pt);nt?(k(nt.destinations),X(nt.routeSegments),ft(!1)):(Ee("Invalid route data"),ft(!1))}else Ee("No route data provided"),ft(!1)},[E]);const Je=a&&P.length>=2;return Qe?Ce.jsx("div",{"data-loc":"client/src/pages/EmbedView.tsx:50",className:"min-h-screen flex items-center justify-center bg-[#F5F0E8]",children:Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:51",className:"text-center p-8",children:[Ce.jsx(Bg,{"data-loc":"client/src/pages/EmbedView.tsx:52",className:"w-12 h-12 text-[#8B1A1A] mx-auto mb-4 animate-spin"}),Ce.jsx("p",{"data-loc":"client/src/pages/EmbedView.tsx:53",className:"text-[#666]",children:"Loading route..."})]})}):re?Ce.jsx("div",{"data-loc":"client/src/pages/EmbedView.tsx:61",className:"min-h-screen flex items-center justify-center bg-[#F5F0E8]",children:Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:62",className:"text-center p-8",children:[Ce.jsx(Mx,{"data-loc":"client/src/pages/EmbedView.tsx:63",className:"w-12 h-12 text-[#8B1A1A] mx-auto mb-4"}),Ce.jsx("h1",{"data-loc":"client/src/pages/EmbedView.tsx:64",className:"text-xl font-semibold text-[#2C2C2C] mb-2",style:{fontFamily:"'Playfair Display', serif"},children:"Route Not Found"}),Ce.jsx("p",{"data-loc":"client/src/pages/EmbedView.tsx:70",className:"text-[#666]",children:re})]})}):Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:77",className:"w-full h-screen flex flex-col bg-[#F5F0E8]",children:[window.self===window.top&&Ce.jsxs("header",{"data-loc":"client/src/pages/EmbedView.tsx:80",className:"bg-white border-b border-[#E5DED3] px-4 py-3 flex items-center gap-3",children:[Ce.jsx("div",{"data-loc":"client/src/pages/EmbedView.tsx:81",className:"w-8 h-8 rounded-full bg-[#8B1A1A] flex items-center justify-center",children:Ce.jsx(Mx,{"data-loc":"client/src/pages/EmbedView.tsx:82",className:"w-4 h-4 text-white"})}),Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:84",children:[Ce.jsx("h1",{"data-loc":"client/src/pages/EmbedView.tsx:85",className:"text-lg font-semibold text-[#2C2C2C]",style:{fontFamily:"'Playfair Display', serif"},children:oe}),Ce.jsx("p",{"data-loc":"client/src/pages/EmbedView.tsx:91",className:"text-xs text-[#666]",children:"Secret Namibia Itinerary"})]})]}),Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:99",className:"flex-1 relative",children:[Ce.jsx(c1,{"data-loc":"client/src/pages/EmbedView.tsx:100",ref:Ne,destinations:P,routeSegments:F,onMapReady:()=>{fe(!0)},onRoutesLoaded:()=>{ue(!0)},isAnimating:Je}),te&&!a&&F.length>0&&Ce.jsx("div",{"data-loc":"client/src/pages/EmbedView.tsx:115",className:"absolute inset-0 bg-[#F5F0E8]/50 flex items-center justify-center pointer-events-none",children:Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:116",className:"bg-white rounded-lg px-4 py-3 shadow-md flex items-center gap-3",children:[Ce.jsx(Bg,{"data-loc":"client/src/pages/EmbedView.tsx:117",className:"w-5 h-5 text-[#8B1A1A] animate-spin"}),Ce.jsx("span",{"data-loc":"client/src/pages/EmbedView.tsx:118",className:"text-sm text-[#666]",children:"Loading routes..."})]})}),Ce.jsx("div",{"data-loc":"client/src/pages/EmbedView.tsx:124",className:"absolute bottom-4 left-4 bg-white/90 backdrop-blur-sm rounded-lg px-3 py-2 shadow-sm",children:Ce.jsxs("div",{"data-loc":"client/src/pages/EmbedView.tsx:125",className:"flex items-center gap-2",children:[Ce.jsx("div",{"data-loc":"client/src/pages/EmbedView.tsx:126",className:"w-5 h-5 rounded-full bg-[#8B1A1A] flex items-center justify-center",children:Ce.jsx(Mx,{"data-loc":"client/src/pages/EmbedView.tsx:127",className:"w-3 h-3 text-white"})}),Ce.jsx("span",{"data-loc":"client/src/pages/EmbedView.tsx:129",className:"text-xs font-medium text-[#2C2C2C]",style:{fontFamily:"'Playfair Display', serif"},children:"Secret Namibia"})]})})]})]})}function NP(){return Ce.jsxs(j3,{"data-loc":"client/src/App.tsx:12",children:[Ce.jsx(xx,{"data-loc":"client/src/App.tsx:13",path:"/",component:kP}),Ce.jsx(xx,{"data-loc":"client/src/App.tsx:14",path:"/embed",component:FP}),Ce.jsx(xx,{"data-loc":"client/src/App.tsx:15",path:"/404",component:sT}),Ce.jsx(xx,{"data-loc":"client/src/App.tsx:16",component:sT})]})}function UP(){return Ce.jsx(G3,{"data-loc":"client/src/App.tsx:23",children:Ce.jsx(xC,{"data-loc":"client/src/App.tsx:24",defaultTheme:"light",children:Ce.jsxs(qz,{"data-loc":"client/src/App.tsx:25",children:[Ce.jsx(XC,{"data-loc":"client/src/App.tsx:26"}),Ce.jsx(NP,{"data-loc":"client/src/App.tsx:27"})]})})})}yC.createRoot(document.getElementById("root")).render(Ce.jsx(UP,{"data-loc":"client/src/main.tsx:5"}));

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.