48ea61cdcc
- Product documentation in docs/products/ - Updated MEMORY.md with product info - quiXzoom Auth Core as AAMOS Identity product
4013 lines
2.6 MiB
Plaintext
4013 lines
2.6 MiB
Plaintext
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Index-BHs-gF4l.js","assets/refresh-cw-CCL0Gd2i.js","assets/clock-CHYQgZWG.js","assets/chevron-right-Dvw0FPw3.js","assets/index-C6sfL5Wv.js","assets/circle-alert-DFiBooaQ.js","assets/video-Di1TW95I.js","assets/Auth-BZtkFe2c.js","assets/mail-C8_RqWpe.js","assets/eye-off-CHF4QKq3.js","assets/eye-IKrhkOAd.js","assets/index-DXB3_sFe.js","assets/smartphone-Ca6TX_3a.js","assets/MissionDetail-Bkj3Z1-2.js","assets/useMissionExamples-k-4yLF0Z.js","assets/useIdentityVerification-Cb6XYb0B.js","assets/circle-check-60AjePHB.js","assets/SecureCamera-0VtB9UCG.js","assets/shield-DIM7u0gp.js","assets/check-CCL32zXH.js","assets/award-7DMfX1ZX.js","assets/triangle-alert-I_PJ38kC.js","assets/gift-C8Ri1JSk.js","assets/ticket-DTjwndeG.js","assets/external-link-DZgJPdR9.js","assets/arrow-left-DyClWdEf.js","assets/image-CUEcTqim.js","assets/timer-DiqX45Mc.js","assets/Profile-Bs_7SKke.js","assets/dropdown-menu-CFWQzY9-.js","assets/circle-CNf9xg3I.js","assets/badge-D3Mn__J4.js","assets/progress-BVXi0hgU.js","assets/trending-up-CVyK6WFK.js","assets/leaf-BV-5O-4e.js","assets/zap-DA9vuiyP.js","assets/select-Dcsz1esX.js","assets/chevron-down-DA--jGG2.js","assets/building-2-BpMHggJ8.js","assets/credit-card-C9X53A_j.js","assets/palette-BI1sulb6.js","assets/save-CMkrLPh2.js","assets/Wallet-DhBioTUc.js","assets/differenceInDays-BjWVl97D.js","assets/sv-KqUX0hpM.js","assets/star-DINAYY6y.js","assets/qr-code-J7tfaoiH.js","assets/heart-Bn8C2h_q.js","assets/graduation-cap-TNnu1wlO.js","assets/scroll-area-DdYSSeiY.js","assets/info-DLVcQf5T.js","assets/file-text-I90VDyBK.js","assets/download-JAaLZNwh.js","assets/send-DWELcW4W.js","assets/calendar-3jVgdv6R.js","assets/Notifications-BvwbWrtB.js","assets/VerifyIdentity-CVO73JZ2.js","assets/OrdererRegistration-BiflvXWp.js","assets/radio-group-BcmHTP2Q.js","assets/landmark-pzfm3gLZ.js","assets/CreateMission-DTYpAitx.js","assets/upload-B_ploHV0.js","assets/repeat-CjEas7lo.js","assets/megaphone-B7uGchyN.js","assets/CreateCampaign-ssmSrgNm.js","assets/waves-CcHX4WbX.js","assets/trash-2-DRcoDJkq.js","assets/radio-DbSuriKm.js","assets/settings-CI2ouCEL.js","assets/search-DezKAVqp.js","assets/OrdererDashboard-CFnxw39_.js","assets/tabs-7ErWJ04g.js","assets/useQuery-CHKCqCt4.js","assets/ROICalculator-ha2oOP1j.js","assets/layers-CksRxMxR.js","assets/activity-BnabgJXD.js","assets/server-D4qLsdvj.js","assets/key-C9i37qxc.js","assets/RealChangeMission-BP6arpm_.js","assets/blocks-CpGLjLKj.js","assets/OrdererMissionDetail-rIgIT4BY.js","assets/OperationsPopout-BydwqHpi.js","assets/AnalyticsPopout-rWRAHbbT.js","assets/AdsPopout-ovL1xFgb.js","assets/Principles-CmpgkpiO.js","assets/network-DPfpWoXe.js","assets/Policy-mB-84Q1T.js","assets/Integritetspolicy-UTJ2l2uy.js","assets/Villkor-DWXP9YER.js","assets/PhotoMarketplace-DHi_u6nN.js","assets/taj-mahal-BrmjbJxw.js","assets/PhotoDetail-CWLPRqgG.js","assets/PhotoContest-ByCNK-WJ.js","assets/IdentityDisclaimer-D9ew3vwe.js","assets/RedeemVoucher-BpkWcNI_.js","assets/ResetPassword-UPJcC126.js"])))=>i.map(i=>d[i]);
|
||
var I$=Object.defineProperty;var gO=n=>{throw TypeError(n)};var M$=(n,t,s)=>t in n?I$(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var Tk=(n,t,s)=>M$(n,typeof t!="symbol"?t+"":t,s),Ek=(n,t,s)=>t.has(n)||gO("Cannot "+s);var Lt=(n,t,s)=>(Ek(n,t,"read from private field"),s?s.call(n):t.get(n)),Gr=(n,t,s)=>t.has(n)?gO("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),cr=(n,t,s,h)=>(Ek(n,t,"write to private field"),h?h.call(n,s):t.set(n,s),s),Es=(n,t,s)=>(Ek(n,t,"access private method"),s);var Aw=(n,t,s,h)=>({set _(g){cr(n,t,g,s)},get _(){return Lt(n,t,h)}});function P$(n,t){for(var s=0;s<t.length;s++){const h=t[s];if(typeof h!="string"&&!Array.isArray(h)){for(const g in h)if(g!=="default"&&!(g in n)){const v=Object.getOwnPropertyDescriptor(h,g);v&&Object.defineProperty(n,g,v.get?v:{enumerable:!0,get:()=>h[g]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const g of document.querySelectorAll('link[rel="modulepreload"]'))h(g);new MutationObserver(g=>{for(const v of g)if(v.type==="childList")for(const E of v.addedNodes)E.tagName==="LINK"&&E.rel==="modulepreload"&&h(E)}).observe(document,{childList:!0,subtree:!0});function s(g){const v={};return g.integrity&&(v.integrity=g.integrity),g.referrerPolicy&&(v.referrerPolicy=g.referrerPolicy),g.crossOrigin==="use-credentials"?v.credentials="include":g.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function h(g){if(g.ep)return;g.ep=!0;const v=s(g);fetch(g.href,v)}})();const D$="modulepreload",R$=function(n){return"/"+n},_O={},Ri=function(t,s,h){let g=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const E=document.querySelector("meta[property=csp-nonce]"),c=(E==null?void 0:E.nonce)||(E==null?void 0:E.getAttribute("nonce"));g=Promise.allSettled(s.map(T=>{if(T=R$(T),T in _O)return;_O[T]=!0;const L=T.endsWith(".css"),B=L?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${B}`))return;const U=document.createElement("link");if(U.rel=L?"stylesheet":D$,L||(U.as="script"),U.crossOrigin="",U.href=T,c&&U.setAttribute("nonce",c),document.head.appendChild(U),L)return new Promise((H,X)=>{U.addEventListener("load",H),U.addEventListener("error",()=>X(new Error(`Unable to preload CSS for ${T}`)))})}))}function v(E){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=E,window.dispatchEvent(c),!c.defaultPrevented)throw E}return g.then(E=>{for(const c of E||[])c.status==="rejected"&&v(c.reason);return t().catch(v)})};var L$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wI(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var GB={exports:{}},CT={},$B={exports:{}},jr={};/**
|
||
* @license React
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Vx=Symbol.for("react.element"),O$=Symbol.for("react.portal"),F$=Symbol.for("react.fragment"),z$=Symbol.for("react.strict_mode"),B$=Symbol.for("react.profiler"),N$=Symbol.for("react.provider"),V$=Symbol.for("react.context"),j$=Symbol.for("react.forward_ref"),U$=Symbol.for("react.suspense"),G$=Symbol.for("react.memo"),$$=Symbol.for("react.lazy"),yO=Symbol.iterator;function H$(n){return n===null||typeof n!="object"?null:(n=yO&&n[yO]||n["@@iterator"],typeof n=="function"?n:null)}var HB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WB=Object.assign,qB={};function V_(n,t,s){this.props=n,this.context=t,this.refs=qB,this.updater=s||HB}V_.prototype.isReactComponent={};V_.prototype.setState=function(n,t){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,t,"setState")};V_.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function ZB(){}ZB.prototype=V_.prototype;function SI(n,t,s){this.props=n,this.context=t,this.refs=qB,this.updater=s||HB}var TI=SI.prototype=new ZB;TI.constructor=SI;WB(TI,V_.prototype);TI.isPureReactComponent=!0;var vO=Array.isArray,XB=Object.prototype.hasOwnProperty,EI={current:null},KB={key:!0,ref:!0,__self:!0,__source:!0};function YB(n,t,s){var h,g={},v=null,E=null;if(t!=null)for(h in t.ref!==void 0&&(E=t.ref),t.key!==void 0&&(v=""+t.key),t)XB.call(t,h)&&!KB.hasOwnProperty(h)&&(g[h]=t[h]);var c=arguments.length-2;if(c===1)g.children=s;else if(1<c){for(var T=Array(c),L=0;L<c;L++)T[L]=arguments[L+2];g.children=T}if(n&&n.defaultProps)for(h in c=n.defaultProps,c)g[h]===void 0&&(g[h]=c[h]);return{$$typeof:Vx,type:n,key:v,ref:E,props:g,_owner:EI.current}}function W$(n,t){return{$$typeof:Vx,type:n.type,key:t,ref:n.ref,props:n.props,_owner:n._owner}}function kI(n){return typeof n=="object"&&n!==null&&n.$$typeof===Vx}function q$(n){var t={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(s){return t[s]})}var xO=/\/+/g;function kk(n,t){return typeof n=="object"&&n!==null&&n.key!=null?q$(""+n.key):t.toString(36)}function cS(n,t,s,h,g){var v=typeof n;(v==="undefined"||v==="boolean")&&(n=null);var E=!1;if(n===null)E=!0;else switch(v){case"string":case"number":E=!0;break;case"object":switch(n.$$typeof){case Vx:case O$:E=!0}}if(E)return E=n,g=g(E),n=h===""?"."+kk(E,0):h,vO(g)?(s="",n!=null&&(s=n.replace(xO,"$&/")+"/"),cS(g,t,s,"",function(L){return L})):g!=null&&(kI(g)&&(g=W$(g,s+(!g.key||E&&E.key===g.key?"":(""+g.key).replace(xO,"$&/")+"/")+n)),t.push(g)),1;if(E=0,h=h===""?".":h+":",vO(n))for(var c=0;c<n.length;c++){v=n[c];var T=h+kk(v,c);E+=cS(v,t,s,T,g)}else if(T=H$(n),typeof T=="function")for(n=T.call(n),c=0;!(v=n.next()).done;)v=v.value,T=h+kk(v,c++),E+=cS(v,t,s,T,g);else if(v==="object")throw t=String(n),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return E}function Cw(n,t,s){if(n==null)return n;var h=[],g=0;return cS(n,h,"","",function(v){return t.call(s,v,g++)}),h}function Z$(n){if(n._status===-1){var t=n._result;t=t(),t.then(function(s){(n._status===0||n._status===-1)&&(n._status=1,n._result=s)},function(s){(n._status===0||n._status===-1)&&(n._status=2,n._result=s)}),n._status===-1&&(n._status=0,n._result=t)}if(n._status===1)return n._result.default;throw n._result}var fa={current:null},uS={transition:null},X$={ReactCurrentDispatcher:fa,ReactCurrentBatchConfig:uS,ReactCurrentOwner:EI};function QB(){throw Error("act(...) is not supported in production builds of React.")}jr.Children={map:Cw,forEach:function(n,t,s){Cw(n,function(){t.apply(this,arguments)},s)},count:function(n){var t=0;return Cw(n,function(){t++}),t},toArray:function(n){return Cw(n,function(t){return t})||[]},only:function(n){if(!kI(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};jr.Component=V_;jr.Fragment=F$;jr.Profiler=B$;jr.PureComponent=SI;jr.StrictMode=z$;jr.Suspense=U$;jr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X$;jr.act=QB;jr.cloneElement=function(n,t,s){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var h=WB({},n.props),g=n.key,v=n.ref,E=n._owner;if(t!=null){if(t.ref!==void 0&&(v=t.ref,E=EI.current),t.key!==void 0&&(g=""+t.key),n.type&&n.type.defaultProps)var c=n.type.defaultProps;for(T in t)XB.call(t,T)&&!KB.hasOwnProperty(T)&&(h[T]=t[T]===void 0&&c!==void 0?c[T]:t[T])}var T=arguments.length-2;if(T===1)h.children=s;else if(1<T){c=Array(T);for(var L=0;L<T;L++)c[L]=arguments[L+2];h.children=c}return{$$typeof:Vx,type:n.type,key:g,ref:v,props:h,_owner:E}};jr.createContext=function(n){return n={$$typeof:V$,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:N$,_context:n},n.Consumer=n};jr.createElement=YB;jr.createFactory=function(n){var t=YB.bind(null,n);return t.type=n,t};jr.createRef=function(){return{current:null}};jr.forwardRef=function(n){return{$$typeof:j$,render:n}};jr.isValidElement=kI;jr.lazy=function(n){return{$$typeof:$$,_payload:{_status:-1,_result:n},_init:Z$}};jr.memo=function(n,t){return{$$typeof:G$,type:n,compare:t===void 0?null:t}};jr.startTransition=function(n){var t=uS.transition;uS.transition={};try{n()}finally{uS.transition=t}};jr.unstable_act=QB;jr.useCallback=function(n,t){return fa.current.useCallback(n,t)};jr.useContext=function(n){return fa.current.useContext(n)};jr.useDebugValue=function(){};jr.useDeferredValue=function(n){return fa.current.useDeferredValue(n)};jr.useEffect=function(n,t){return fa.current.useEffect(n,t)};jr.useId=function(){return fa.current.useId()};jr.useImperativeHandle=function(n,t,s){return fa.current.useImperativeHandle(n,t,s)};jr.useInsertionEffect=function(n,t){return fa.current.useInsertionEffect(n,t)};jr.useLayoutEffect=function(n,t){return fa.current.useLayoutEffect(n,t)};jr.useMemo=function(n,t){return fa.current.useMemo(n,t)};jr.useReducer=function(n,t,s){return fa.current.useReducer(n,t,s)};jr.useRef=function(n){return fa.current.useRef(n)};jr.useState=function(n){return fa.current.useState(n)};jr.useSyncExternalStore=function(n,t,s){return fa.current.useSyncExternalStore(n,t,s)};jr.useTransition=function(){return fa.current.useTransition()};jr.version="18.3.1";$B.exports=jr;var Y=$B.exports;const dn=wI(Y),IT=P$({__proto__:null,default:dn},[Y]);/**
|
||
* @license React
|
||
* react-jsx-runtime.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var K$=Y,Y$=Symbol.for("react.element"),Q$=Symbol.for("react.fragment"),J$=Object.prototype.hasOwnProperty,eH=K$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tH={key:!0,ref:!0,__self:!0,__source:!0};function JB(n,t,s){var h,g={},v=null,E=null;s!==void 0&&(v=""+s),t.key!==void 0&&(v=""+t.key),t.ref!==void 0&&(E=t.ref);for(h in t)J$.call(t,h)&&!tH.hasOwnProperty(h)&&(g[h]=t[h]);if(n&&n.defaultProps)for(h in t=n.defaultProps,t)g[h]===void 0&&(g[h]=t[h]);return{$$typeof:Y$,type:n,key:v,ref:E,props:g,_owner:eH.current}}CT.Fragment=Q$;CT.jsx=JB;CT.jsxs=JB;GB.exports=CT;var ue=GB.exports,e5={exports:{}},ml={},t5={exports:{}},n5={};/**
|
||
* @license React
|
||
* scheduler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/(function(n){function t(vt,pt){var Pt=vt.length;vt.push(pt);e:for(;0<Pt;){var An=Pt-1>>>1,bn=vt[An];if(0<g(bn,pt))vt[An]=pt,vt[Pt]=bn,Pt=An;else break e}}function s(vt){return vt.length===0?null:vt[0]}function h(vt){if(vt.length===0)return null;var pt=vt[0],Pt=vt.pop();if(Pt!==pt){vt[0]=Pt;e:for(var An=0,bn=vt.length,Vn=bn>>>1;An<Vn;){var Mn=2*(An+1)-1,Tn=vt[Mn],Wr=Mn+1,Kn=vt[Wr];if(0>g(Tn,Pt))Wr<bn&&0>g(Kn,Tn)?(vt[An]=Kn,vt[Wr]=Pt,An=Wr):(vt[An]=Tn,vt[Mn]=Pt,An=Mn);else if(Wr<bn&&0>g(Kn,Pt))vt[An]=Kn,vt[Wr]=Pt,An=Wr;else break e}}return pt}function g(vt,pt){var Pt=vt.sortIndex-pt.sortIndex;return Pt!==0?Pt:vt.id-pt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var v=performance;n.unstable_now=function(){return v.now()}}else{var E=Date,c=E.now();n.unstable_now=function(){return E.now()-c}}var T=[],L=[],B=1,U=null,H=3,X=!1,ae=!1,ne=!1,me=typeof setTimeout=="function"?setTimeout:null,oe=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function he(vt){for(var pt=s(L);pt!==null;){if(pt.callback===null)h(L);else if(pt.startTime<=vt)h(L),pt.sortIndex=pt.expirationTime,t(T,pt);else break;pt=s(L)}}function _e(vt){if(ne=!1,he(vt),!ae)if(s(T)!==null)ae=!0,Zt(De);else{var pt=s(L);pt!==null&&zt(_e,pt.startTime-vt)}}function De(vt,pt){ae=!1,ne&&(ne=!1,oe(Xe),Xe=-1),X=!0;var Pt=H;try{for(he(pt),U=s(T);U!==null&&(!(U.expirationTime>pt)||vt&&!Bt());){var An=U.callback;if(typeof An=="function"){U.callback=null,H=U.priorityLevel;var bn=An(U.expirationTime<=pt);pt=n.unstable_now(),typeof bn=="function"?U.callback=bn:U===s(T)&&h(T),he(pt)}else h(T);U=s(T)}if(U!==null)var Vn=!0;else{var Mn=s(L);Mn!==null&&zt(_e,Mn.startTime-pt),Vn=!1}return Vn}finally{U=null,H=Pt,X=!1}}var He=!1,nt=null,Xe=-1,ft=5,At=-1;function Bt(){return!(n.unstable_now()-At<ft)}function Dt(){if(nt!==null){var vt=n.unstable_now();At=vt;var pt=!0;try{pt=nt(!0,vt)}finally{pt?It():(He=!1,nt=null)}}else He=!1}var It;if(typeof re=="function")It=function(){re(Dt)};else if(typeof MessageChannel<"u"){var kt=new MessageChannel,wt=kt.port2;kt.port1.onmessage=Dt,It=function(){wt.postMessage(null)}}else It=function(){me(Dt,0)};function Zt(vt){nt=vt,He||(He=!0,It())}function zt(vt,pt){Xe=me(function(){vt(n.unstable_now())},pt)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(vt){vt.callback=null},n.unstable_continueExecution=function(){ae||X||(ae=!0,Zt(De))},n.unstable_forceFrameRate=function(vt){0>vt||125<vt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ft=0<vt?Math.floor(1e3/vt):5},n.unstable_getCurrentPriorityLevel=function(){return H},n.unstable_getFirstCallbackNode=function(){return s(T)},n.unstable_next=function(vt){switch(H){case 1:case 2:case 3:var pt=3;break;default:pt=H}var Pt=H;H=pt;try{return vt()}finally{H=Pt}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(vt,pt){switch(vt){case 1:case 2:case 3:case 4:case 5:break;default:vt=3}var Pt=H;H=vt;try{return pt()}finally{H=Pt}},n.unstable_scheduleCallback=function(vt,pt,Pt){var An=n.unstable_now();switch(typeof Pt=="object"&&Pt!==null?(Pt=Pt.delay,Pt=typeof Pt=="number"&&0<Pt?An+Pt:An):Pt=An,vt){case 1:var bn=-1;break;case 2:bn=250;break;case 5:bn=1073741823;break;case 4:bn=1e4;break;default:bn=5e3}return bn=Pt+bn,vt={id:B++,callback:pt,priorityLevel:vt,startTime:Pt,expirationTime:bn,sortIndex:-1},Pt>An?(vt.sortIndex=Pt,t(L,vt),s(T)===null&&vt===s(L)&&(ne?(oe(Xe),Xe=-1):ne=!0,zt(_e,Pt-An))):(vt.sortIndex=bn,t(T,vt),ae||X||(ae=!0,Zt(De))),vt},n.unstable_shouldYield=Bt,n.unstable_wrapCallback=function(vt){var pt=H;return function(){var Pt=H;H=pt;try{return vt.apply(this,arguments)}finally{H=Pt}}}})(n5);t5.exports=n5;var nH=t5.exports;/**
|
||
* @license React
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var rH=Y,hl=nH;function Qt(n){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+n,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+n+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r5=new Set,rx={};function Qp(n,t){w_(n,t),w_(n+"Capture",t)}function w_(n,t){for(rx[n]=t,n=0;n<t.length;n++)r5.add(t[n])}var fd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),IA=Object.prototype.hasOwnProperty,iH=/^[: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]*$/,bO={},wO={};function oH(n){return IA.call(wO,n)?!0:IA.call(bO,n)?!1:iH.test(n)?wO[n]=!0:(bO[n]=!0,!1)}function sH(n,t,s,h){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return h?!1:s!==null?!s.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function aH(n,t,s,h){if(t===null||typeof t>"u"||sH(n,t,s,h))return!0;if(h)return!1;if(s!==null)switch(s.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pa(n,t,s,h,g,v,E){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=h,this.attributeNamespace=g,this.mustUseProperty=s,this.propertyName=n,this.type=t,this.sanitizeURL=v,this.removeEmptyString=E}var Is={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Is[n]=new pa(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var t=n[0];Is[t]=new pa(t,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Is[n]=new pa(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Is[n]=new pa(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Is[n]=new pa(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Is[n]=new pa(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Is[n]=new pa(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Is[n]=new pa(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Is[n]=new pa(n,5,!1,n.toLowerCase(),null,!1,!1)});var AI=/[\-:]([a-z])/g;function CI(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var t=n.replace(AI,CI);Is[t]=new pa(t,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var t=n.replace(AI,CI);Is[t]=new pa(t,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var t=n.replace(AI,CI);Is[t]=new pa(t,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Is[n]=new pa(n,1,!1,n.toLowerCase(),null,!1,!1)});Is.xlinkHref=new pa("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Is[n]=new pa(n,1,!1,n.toLowerCase(),null,!0,!0)});function II(n,t,s,h){var g=Is.hasOwnProperty(t)?Is[t]:null;(g!==null?g.type!==0:h||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(aH(t,s,g,h)&&(s=null),h||g===null?oH(t)&&(s===null?n.removeAttribute(t):n.setAttribute(t,""+s)):g.mustUseProperty?n[g.propertyName]=s===null?g.type===3?!1:"":s:(t=g.attributeName,h=g.attributeNamespace,s===null?n.removeAttribute(t):(g=g.type,s=g===3||g===4&&s===!0?"":""+s,h?n.setAttributeNS(h,t,s):n.setAttribute(t,s))))}var bd=rH.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Iw=Symbol.for("react.element"),jg=Symbol.for("react.portal"),Ug=Symbol.for("react.fragment"),MI=Symbol.for("react.strict_mode"),MA=Symbol.for("react.profiler"),i5=Symbol.for("react.provider"),o5=Symbol.for("react.context"),PI=Symbol.for("react.forward_ref"),PA=Symbol.for("react.suspense"),DA=Symbol.for("react.suspense_list"),DI=Symbol.for("react.memo"),wh=Symbol.for("react.lazy"),s5=Symbol.for("react.offscreen"),SO=Symbol.iterator;function x0(n){return n===null||typeof n!="object"?null:(n=SO&&n[SO]||n["@@iterator"],typeof n=="function"?n:null)}var go=Object.assign,Ak;function L0(n){if(Ak===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Ak=t&&t[1]||""}return`
|
||
`+Ak+n}var Ck=!1;function Ik(n,t){if(!n||Ck)return"";Ck=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(L){var h=L}Reflect.construct(n,[],t)}else{try{t.call()}catch(L){h=L}n.call(t.prototype)}else{try{throw Error()}catch(L){h=L}n()}}catch(L){if(L&&h&&typeof L.stack=="string"){for(var g=L.stack.split(`
|
||
`),v=h.stack.split(`
|
||
`),E=g.length-1,c=v.length-1;1<=E&&0<=c&&g[E]!==v[c];)c--;for(;1<=E&&0<=c;E--,c--)if(g[E]!==v[c]){if(E!==1||c!==1)do if(E--,c--,0>c||g[E]!==v[c]){var T=`
|
||
`+g[E].replace(" at new "," at ");return n.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",n.displayName)),T}while(1<=E&&0<=c);break}}}finally{Ck=!1,Error.prepareStackTrace=s}return(n=n?n.displayName||n.name:"")?L0(n):""}function lH(n){switch(n.tag){case 5:return L0(n.type);case 16:return L0("Lazy");case 13:return L0("Suspense");case 19:return L0("SuspenseList");case 0:case 2:case 15:return n=Ik(n.type,!1),n;case 11:return n=Ik(n.type.render,!1),n;case 1:return n=Ik(n.type,!0),n;default:return""}}function RA(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ug:return"Fragment";case jg:return"Portal";case MA:return"Profiler";case MI:return"StrictMode";case PA:return"Suspense";case DA:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case o5:return(n.displayName||"Context")+".Consumer";case i5:return(n._context.displayName||"Context")+".Provider";case PI:var t=n.render;return n=n.displayName,n||(n=t.displayName||t.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case DI:return t=n.displayName||null,t!==null?t:RA(n.type)||"Memo";case wh:t=n._payload,n=n._init;try{return RA(n(t))}catch{}}return null}function cH(n){var t=n.type;switch(n.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=t.render,n=n.displayName||n.name||"",t.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return RA(t);case 8:return t===MI?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qh(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function a5(n){var t=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uH(n){var t=a5(n)?"checked":"value",s=Object.getOwnPropertyDescriptor(n.constructor.prototype,t),h=""+n[t];if(!n.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var g=s.get,v=s.set;return Object.defineProperty(n,t,{configurable:!0,get:function(){return g.call(this)},set:function(E){h=""+E,v.call(this,E)}}),Object.defineProperty(n,t,{enumerable:s.enumerable}),{getValue:function(){return h},setValue:function(E){h=""+E},stopTracking:function(){n._valueTracker=null,delete n[t]}}}}function Mw(n){n._valueTracker||(n._valueTracker=uH(n))}function l5(n){if(!n)return!1;var t=n._valueTracker;if(!t)return!0;var s=t.getValue(),h="";return n&&(h=a5(n)?n.checked?"true":"false":n.value),n=h,n!==s?(t.setValue(n),!0):!1}function RS(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function LA(n,t){var s=t.checked;return go({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??n._wrapperState.initialChecked})}function TO(n,t){var s=t.defaultValue==null?"":t.defaultValue,h=t.checked!=null?t.checked:t.defaultChecked;s=qh(t.value!=null?t.value:s),n._wrapperState={initialChecked:h,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function c5(n,t){t=t.checked,t!=null&&II(n,"checked",t,!1)}function OA(n,t){c5(n,t);var s=qh(t.value),h=t.type;if(s!=null)h==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+s):n.value!==""+s&&(n.value=""+s);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}t.hasOwnProperty("value")?FA(n,t.type,s):t.hasOwnProperty("defaultValue")&&FA(n,t.type,qh(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(n.defaultChecked=!!t.defaultChecked)}function EO(n,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var h=t.type;if(!(h!=="submit"&&h!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+n._wrapperState.initialValue,s||t===n.value||(n.value=t),n.defaultValue=t}s=n.name,s!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,s!==""&&(n.name=s)}function FA(n,t,s){(t!=="number"||RS(n.ownerDocument)!==n)&&(s==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+s&&(n.defaultValue=""+s))}var O0=Array.isArray;function i_(n,t,s,h){if(n=n.options,t){t={};for(var g=0;g<s.length;g++)t["$"+s[g]]=!0;for(s=0;s<n.length;s++)g=t.hasOwnProperty("$"+n[s].value),n[s].selected!==g&&(n[s].selected=g),g&&h&&(n[s].defaultSelected=!0)}else{for(s=""+qh(s),t=null,g=0;g<n.length;g++){if(n[g].value===s){n[g].selected=!0,h&&(n[g].defaultSelected=!0);return}t!==null||n[g].disabled||(t=n[g])}t!==null&&(t.selected=!0)}}function zA(n,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Qt(91));return go({},t,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function kO(n,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(Qt(92));if(O0(s)){if(1<s.length)throw Error(Qt(93));s=s[0]}t=s}t==null&&(t=""),s=t}n._wrapperState={initialValue:qh(s)}}function u5(n,t){var s=qh(t.value),h=qh(t.defaultValue);s!=null&&(s=""+s,s!==n.value&&(n.value=s),t.defaultValue==null&&n.defaultValue!==s&&(n.defaultValue=s)),h!=null&&(n.defaultValue=""+h)}function AO(n){var t=n.textContent;t===n._wrapperState.initialValue&&t!==""&&t!==null&&(n.value=t)}function d5(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function BA(n,t){return n==null||n==="http://www.w3.org/1999/xhtml"?d5(t):n==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Pw,h5=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,h,g){MSApp.execUnsafeLocalFunction(function(){return n(t,s,h,g)})}:n}(function(n,t){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=t;else{for(Pw=Pw||document.createElement("div"),Pw.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Pw.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;t.firstChild;)n.appendChild(t.firstChild)}});function ix(n,t){if(t){var s=n.firstChild;if(s&&s===n.lastChild&&s.nodeType===3){s.nodeValue=t;return}}n.textContent=t}var U0={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},dH=["Webkit","ms","Moz","O"];Object.keys(U0).forEach(function(n){dH.forEach(function(t){t=t+n.charAt(0).toUpperCase()+n.substring(1),U0[t]=U0[n]})});function f5(n,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||U0.hasOwnProperty(n)&&U0[n]?(""+t).trim():t+"px"}function p5(n,t){n=n.style;for(var s in t)if(t.hasOwnProperty(s)){var h=s.indexOf("--")===0,g=f5(s,t[s],h);s==="float"&&(s="cssFloat"),h?n.setProperty(s,g):n[s]=g}}var hH=go({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function NA(n,t){if(t){if(hH[n]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Qt(137,n));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Qt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Qt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Qt(62))}}function VA(n,t){if(n.indexOf("-")===-1)return typeof t.is=="string";switch(n){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 jA=null;function RI(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var UA=null,o_=null,s_=null;function CO(n){if(n=Gx(n)){if(typeof UA!="function")throw Error(Qt(280));var t=n.stateNode;t&&(t=LT(t),UA(n.stateNode,n.type,t))}}function m5(n){o_?s_?s_.push(n):s_=[n]:o_=n}function g5(){if(o_){var n=o_,t=s_;if(s_=o_=null,CO(n),t)for(n=0;n<t.length;n++)CO(t[n])}}function _5(n,t){return n(t)}function y5(){}var Mk=!1;function v5(n,t,s){if(Mk)return n(t,s);Mk=!0;try{return _5(n,t,s)}finally{Mk=!1,(o_!==null||s_!==null)&&(y5(),g5())}}function ox(n,t){var s=n.stateNode;if(s===null)return null;var h=LT(s);if(h===null)return null;s=h[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(s&&typeof s!="function")throw Error(Qt(231,t,typeof s));return s}var GA=!1;if(fd)try{var b0={};Object.defineProperty(b0,"passive",{get:function(){GA=!0}}),window.addEventListener("test",b0,b0),window.removeEventListener("test",b0,b0)}catch{GA=!1}function fH(n,t,s,h,g,v,E,c,T){var L=Array.prototype.slice.call(arguments,3);try{t.apply(s,L)}catch(B){this.onError(B)}}var G0=!1,LS=null,OS=!1,$A=null,pH={onError:function(n){G0=!0,LS=n}};function mH(n,t,s,h,g,v,E,c,T){G0=!1,LS=null,fH.apply(pH,arguments)}function gH(n,t,s,h,g,v,E,c,T){if(mH.apply(this,arguments),G0){if(G0){var L=LS;G0=!1,LS=null}else throw Error(Qt(198));OS||(OS=!0,$A=L)}}function Jp(n){var t=n,s=n;if(n.alternate)for(;t.return;)t=t.return;else{n=t;do t=n,t.flags&4098&&(s=t.return),n=t.return;while(n)}return t.tag===3?s:null}function x5(n){if(n.tag===13){var t=n.memoizedState;if(t===null&&(n=n.alternate,n!==null&&(t=n.memoizedState)),t!==null)return t.dehydrated}return null}function IO(n){if(Jp(n)!==n)throw Error(Qt(188))}function _H(n){var t=n.alternate;if(!t){if(t=Jp(n),t===null)throw Error(Qt(188));return t!==n?null:n}for(var s=n,h=t;;){var g=s.return;if(g===null)break;var v=g.alternate;if(v===null){if(h=g.return,h!==null){s=h;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===s)return IO(g),n;if(v===h)return IO(g),t;v=v.sibling}throw Error(Qt(188))}if(s.return!==h.return)s=g,h=v;else{for(var E=!1,c=g.child;c;){if(c===s){E=!0,s=g,h=v;break}if(c===h){E=!0,h=g,s=v;break}c=c.sibling}if(!E){for(c=v.child;c;){if(c===s){E=!0,s=v,h=g;break}if(c===h){E=!0,h=v,s=g;break}c=c.sibling}if(!E)throw Error(Qt(189))}}if(s.alternate!==h)throw Error(Qt(190))}if(s.tag!==3)throw Error(Qt(188));return s.stateNode.current===s?n:t}function b5(n){return n=_H(n),n!==null?w5(n):null}function w5(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var t=w5(n);if(t!==null)return t;n=n.sibling}return null}var S5=hl.unstable_scheduleCallback,MO=hl.unstable_cancelCallback,yH=hl.unstable_shouldYield,vH=hl.unstable_requestPaint,Oo=hl.unstable_now,xH=hl.unstable_getCurrentPriorityLevel,LI=hl.unstable_ImmediatePriority,T5=hl.unstable_UserBlockingPriority,FS=hl.unstable_NormalPriority,bH=hl.unstable_LowPriority,E5=hl.unstable_IdlePriority,MT=null,gu=null;function wH(n){if(gu&&typeof gu.onCommitFiberRoot=="function")try{gu.onCommitFiberRoot(MT,n,void 0,(n.current.flags&128)===128)}catch{}}var vc=Math.clz32?Math.clz32:EH,SH=Math.log,TH=Math.LN2;function EH(n){return n>>>=0,n===0?32:31-(SH(n)/TH|0)|0}var Dw=64,Rw=4194304;function F0(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function zS(n,t){var s=n.pendingLanes;if(s===0)return 0;var h=0,g=n.suspendedLanes,v=n.pingedLanes,E=s&268435455;if(E!==0){var c=E&~g;c!==0?h=F0(c):(v&=E,v!==0&&(h=F0(v)))}else E=s&~g,E!==0?h=F0(E):v!==0&&(h=F0(v));if(h===0)return 0;if(t!==0&&t!==h&&!(t&g)&&(g=h&-h,v=t&-t,g>=v||g===16&&(v&4194240)!==0))return t;if(h&4&&(h|=s&16),t=n.entangledLanes,t!==0)for(n=n.entanglements,t&=h;0<t;)s=31-vc(t),g=1<<s,h|=n[s],t&=~g;return h}function kH(n,t){switch(n){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function AH(n,t){for(var s=n.suspendedLanes,h=n.pingedLanes,g=n.expirationTimes,v=n.pendingLanes;0<v;){var E=31-vc(v),c=1<<E,T=g[E];T===-1?(!(c&s)||c&h)&&(g[E]=kH(c,t)):T<=t&&(n.expiredLanes|=c),v&=~c}}function HA(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function k5(){var n=Dw;return Dw<<=1,!(Dw&4194240)&&(Dw=64),n}function Pk(n){for(var t=[],s=0;31>s;s++)t.push(n);return t}function jx(n,t,s){n.pendingLanes|=t,t!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,t=31-vc(t),n[t]=s}function CH(n,t){var s=n.pendingLanes&~t;n.pendingLanes=t,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=t,n.mutableReadLanes&=t,n.entangledLanes&=t,t=n.entanglements;var h=n.eventTimes;for(n=n.expirationTimes;0<s;){var g=31-vc(s),v=1<<g;t[g]=0,h[g]=-1,n[g]=-1,s&=~v}}function OI(n,t){var s=n.entangledLanes|=t;for(n=n.entanglements;s;){var h=31-vc(s),g=1<<h;g&t|n[h]&t&&(n[h]|=t),s&=~g}}var xi=0;function A5(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var C5,FI,I5,M5,P5,WA=!1,Lw=[],zh=null,Bh=null,Nh=null,sx=new Map,ax=new Map,Eh=[],IH="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 submit".split(" ");function PO(n,t){switch(n){case"focusin":case"focusout":zh=null;break;case"dragenter":case"dragleave":Bh=null;break;case"mouseover":case"mouseout":Nh=null;break;case"pointerover":case"pointerout":sx.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ax.delete(t.pointerId)}}function w0(n,t,s,h,g,v){return n===null||n.nativeEvent!==v?(n={blockedOn:t,domEventName:s,eventSystemFlags:h,nativeEvent:v,targetContainers:[g]},t!==null&&(t=Gx(t),t!==null&&FI(t)),n):(n.eventSystemFlags|=h,t=n.targetContainers,g!==null&&t.indexOf(g)===-1&&t.push(g),n)}function MH(n,t,s,h,g){switch(t){case"focusin":return zh=w0(zh,n,t,s,h,g),!0;case"dragenter":return Bh=w0(Bh,n,t,s,h,g),!0;case"mouseover":return Nh=w0(Nh,n,t,s,h,g),!0;case"pointerover":var v=g.pointerId;return sx.set(v,w0(sx.get(v)||null,n,t,s,h,g)),!0;case"gotpointercapture":return v=g.pointerId,ax.set(v,w0(ax.get(v)||null,n,t,s,h,g)),!0}return!1}function D5(n){var t=Ip(n.target);if(t!==null){var s=Jp(t);if(s!==null){if(t=s.tag,t===13){if(t=x5(s),t!==null){n.blockedOn=t,P5(n.priority,function(){I5(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){n.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}n.blockedOn=null}function dS(n){if(n.blockedOn!==null)return!1;for(var t=n.targetContainers;0<t.length;){var s=qA(n.domEventName,n.eventSystemFlags,t[0],n.nativeEvent);if(s===null){s=n.nativeEvent;var h=new s.constructor(s.type,s);jA=h,s.target.dispatchEvent(h),jA=null}else return t=Gx(s),t!==null&&FI(t),n.blockedOn=s,!1;t.shift()}return!0}function DO(n,t,s){dS(n)&&s.delete(t)}function PH(){WA=!1,zh!==null&&dS(zh)&&(zh=null),Bh!==null&&dS(Bh)&&(Bh=null),Nh!==null&&dS(Nh)&&(Nh=null),sx.forEach(DO),ax.forEach(DO)}function S0(n,t){n.blockedOn===t&&(n.blockedOn=null,WA||(WA=!0,hl.unstable_scheduleCallback(hl.unstable_NormalPriority,PH)))}function lx(n){function t(g){return S0(g,n)}if(0<Lw.length){S0(Lw[0],n);for(var s=1;s<Lw.length;s++){var h=Lw[s];h.blockedOn===n&&(h.blockedOn=null)}}for(zh!==null&&S0(zh,n),Bh!==null&&S0(Bh,n),Nh!==null&&S0(Nh,n),sx.forEach(t),ax.forEach(t),s=0;s<Eh.length;s++)h=Eh[s],h.blockedOn===n&&(h.blockedOn=null);for(;0<Eh.length&&(s=Eh[0],s.blockedOn===null);)D5(s),s.blockedOn===null&&Eh.shift()}var a_=bd.ReactCurrentBatchConfig,BS=!0;function DH(n,t,s,h){var g=xi,v=a_.transition;a_.transition=null;try{xi=1,zI(n,t,s,h)}finally{xi=g,a_.transition=v}}function RH(n,t,s,h){var g=xi,v=a_.transition;a_.transition=null;try{xi=4,zI(n,t,s,h)}finally{xi=g,a_.transition=v}}function zI(n,t,s,h){if(BS){var g=qA(n,t,s,h);if(g===null)jk(n,t,h,NS,s),PO(n,h);else if(MH(g,n,t,s,h))h.stopPropagation();else if(PO(n,h),t&4&&-1<IH.indexOf(n)){for(;g!==null;){var v=Gx(g);if(v!==null&&C5(v),v=qA(n,t,s,h),v===null&&jk(n,t,h,NS,s),v===g)break;g=v}g!==null&&h.stopPropagation()}else jk(n,t,h,null,s)}}var NS=null;function qA(n,t,s,h){if(NS=null,n=RI(h),n=Ip(n),n!==null)if(t=Jp(n),t===null)n=null;else if(s=t.tag,s===13){if(n=x5(t),n!==null)return n;n=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;n=null}else t!==n&&(n=null);return NS=n,null}function R5(n){switch(n){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(xH()){case LI:return 1;case T5:return 4;case FS:case bH:return 16;case E5:return 536870912;default:return 16}default:return 16}}var Rh=null,BI=null,hS=null;function L5(){if(hS)return hS;var n,t=BI,s=t.length,h,g="value"in Rh?Rh.value:Rh.textContent,v=g.length;for(n=0;n<s&&t[n]===g[n];n++);var E=s-n;for(h=1;h<=E&&t[s-h]===g[v-h];h++);return hS=g.slice(n,1<h?1-h:void 0)}function fS(n){var t=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&t===13&&(n=13)):n=t,n===10&&(n=13),32<=n||n===13?n:0}function Ow(){return!0}function RO(){return!1}function gl(n){function t(s,h,g,v,E){this._reactName=s,this._targetInst=g,this.type=h,this.nativeEvent=v,this.target=E,this.currentTarget=null;for(var c in n)n.hasOwnProperty(c)&&(s=n[c],this[c]=s?s(v):v[c]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ow:RO,this.isPropagationStopped=RO,this}return go(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ow)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ow)},persist:function(){},isPersistent:Ow}),t}var j_={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},NI=gl(j_),Ux=go({},j_,{view:0,detail:0}),LH=gl(Ux),Dk,Rk,T0,PT=go({},Ux,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:VI,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==T0&&(T0&&n.type==="mousemove"?(Dk=n.screenX-T0.screenX,Rk=n.screenY-T0.screenY):Rk=Dk=0,T0=n),Dk)},movementY:function(n){return"movementY"in n?n.movementY:Rk}}),LO=gl(PT),OH=go({},PT,{dataTransfer:0}),FH=gl(OH),zH=go({},Ux,{relatedTarget:0}),Lk=gl(zH),BH=go({},j_,{animationName:0,elapsedTime:0,pseudoElement:0}),NH=gl(BH),VH=go({},j_,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),jH=gl(VH),UH=go({},j_,{data:0}),OO=gl(UH),GH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$H={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"},HH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function WH(n){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(n):(n=HH[n])?!!t[n]:!1}function VI(){return WH}var qH=go({},Ux,{key:function(n){if(n.key){var t=GH[n.key]||n.key;if(t!=="Unidentified")return t}return n.type==="keypress"?(n=fS(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?$H[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:VI,charCode:function(n){return n.type==="keypress"?fS(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?fS(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),ZH=gl(qH),XH=go({},PT,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),FO=gl(XH),KH=go({},Ux,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:VI}),YH=gl(KH),QH=go({},j_,{propertyName:0,elapsedTime:0,pseudoElement:0}),JH=gl(QH),e9=go({},PT,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),t9=gl(e9),n9=[9,13,27,32],jI=fd&&"CompositionEvent"in window,$0=null;fd&&"documentMode"in document&&($0=document.documentMode);var r9=fd&&"TextEvent"in window&&!$0,O5=fd&&(!jI||$0&&8<$0&&11>=$0),zO=" ",BO=!1;function F5(n,t){switch(n){case"keyup":return n9.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function z5(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Gg=!1;function i9(n,t){switch(n){case"compositionend":return z5(t);case"keypress":return t.which!==32?null:(BO=!0,zO);case"textInput":return n=t.data,n===zO&&BO?null:n;default:return null}}function o9(n,t){if(Gg)return n==="compositionend"||!jI&&F5(n,t)?(n=L5(),hS=BI=Rh=null,Gg=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return O5&&t.locale!=="ko"?null:t.data;default:return null}}var s9={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 NO(n){var t=n&&n.nodeName&&n.nodeName.toLowerCase();return t==="input"?!!s9[n.type]:t==="textarea"}function B5(n,t,s,h){m5(h),t=VS(t,"onChange"),0<t.length&&(s=new NI("onChange","change",null,s,h),n.push({event:s,listeners:t}))}var H0=null,cx=null;function a9(n){X5(n,0)}function DT(n){var t=Wg(n);if(l5(t))return n}function l9(n,t){if(n==="change")return t}var N5=!1;if(fd){var Ok;if(fd){var Fk="oninput"in document;if(!Fk){var VO=document.createElement("div");VO.setAttribute("oninput","return;"),Fk=typeof VO.oninput=="function"}Ok=Fk}else Ok=!1;N5=Ok&&(!document.documentMode||9<document.documentMode)}function jO(){H0&&(H0.detachEvent("onpropertychange",V5),cx=H0=null)}function V5(n){if(n.propertyName==="value"&&DT(cx)){var t=[];B5(t,cx,n,RI(n)),v5(a9,t)}}function c9(n,t,s){n==="focusin"?(jO(),H0=t,cx=s,H0.attachEvent("onpropertychange",V5)):n==="focusout"&&jO()}function u9(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return DT(cx)}function d9(n,t){if(n==="click")return DT(t)}function h9(n,t){if(n==="input"||n==="change")return DT(t)}function f9(n,t){return n===t&&(n!==0||1/n===1/t)||n!==n&&t!==t}var bc=typeof Object.is=="function"?Object.is:f9;function ux(n,t){if(bc(n,t))return!0;if(typeof n!="object"||n===null||typeof t!="object"||t===null)return!1;var s=Object.keys(n),h=Object.keys(t);if(s.length!==h.length)return!1;for(h=0;h<s.length;h++){var g=s[h];if(!IA.call(t,g)||!bc(n[g],t[g]))return!1}return!0}function UO(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function GO(n,t){var s=UO(n);n=0;for(var h;s;){if(s.nodeType===3){if(h=n+s.textContent.length,n<=t&&h>=t)return{node:s,offset:t-n};n=h}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=UO(s)}}function j5(n,t){return n&&t?n===t?!0:n&&n.nodeType===3?!1:t&&t.nodeType===3?j5(n,t.parentNode):"contains"in n?n.contains(t):n.compareDocumentPosition?!!(n.compareDocumentPosition(t)&16):!1:!1}function U5(){for(var n=window,t=RS();t instanceof n.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)n=t.contentWindow;else break;t=RS(n.document)}return t}function UI(n){var t=n&&n.nodeName&&n.nodeName.toLowerCase();return t&&(t==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||t==="textarea"||n.contentEditable==="true")}function p9(n){var t=U5(),s=n.focusedElem,h=n.selectionRange;if(t!==s&&s&&s.ownerDocument&&j5(s.ownerDocument.documentElement,s)){if(h!==null&&UI(s)){if(t=h.start,n=h.end,n===void 0&&(n=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(n,s.value.length);else if(n=(t=s.ownerDocument||document)&&t.defaultView||window,n.getSelection){n=n.getSelection();var g=s.textContent.length,v=Math.min(h.start,g);h=h.end===void 0?v:Math.min(h.end,g),!n.extend&&v>h&&(g=h,h=v,v=g),g=GO(s,v);var E=GO(s,h);g&&E&&(n.rangeCount!==1||n.anchorNode!==g.node||n.anchorOffset!==g.offset||n.focusNode!==E.node||n.focusOffset!==E.offset)&&(t=t.createRange(),t.setStart(g.node,g.offset),n.removeAllRanges(),v>h?(n.addRange(t),n.extend(E.node,E.offset)):(t.setEnd(E.node,E.offset),n.addRange(t)))}}for(t=[],n=s;n=n.parentNode;)n.nodeType===1&&t.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)n=t[s],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var m9=fd&&"documentMode"in document&&11>=document.documentMode,$g=null,ZA=null,W0=null,XA=!1;function $O(n,t,s){var h=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;XA||$g==null||$g!==RS(h)||(h=$g,"selectionStart"in h&&UI(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),W0&&ux(W0,h)||(W0=h,h=VS(ZA,"onSelect"),0<h.length&&(t=new NI("onSelect","select",null,t,s),n.push({event:t,listeners:h}),t.target=$g)))}function Fw(n,t){var s={};return s[n.toLowerCase()]=t.toLowerCase(),s["Webkit"+n]="webkit"+t,s["Moz"+n]="moz"+t,s}var Hg={animationend:Fw("Animation","AnimationEnd"),animationiteration:Fw("Animation","AnimationIteration"),animationstart:Fw("Animation","AnimationStart"),transitionend:Fw("Transition","TransitionEnd")},zk={},G5={};fd&&(G5=document.createElement("div").style,"AnimationEvent"in window||(delete Hg.animationend.animation,delete Hg.animationiteration.animation,delete Hg.animationstart.animation),"TransitionEvent"in window||delete Hg.transitionend.transition);function RT(n){if(zk[n])return zk[n];if(!Hg[n])return n;var t=Hg[n],s;for(s in t)if(t.hasOwnProperty(s)&&s in G5)return zk[n]=t[s];return n}var $5=RT("animationend"),H5=RT("animationiteration"),W5=RT("animationstart"),q5=RT("transitionend"),Z5=new Map,HO="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function tf(n,t){Z5.set(n,t),Qp(t,[n])}for(var Bk=0;Bk<HO.length;Bk++){var Nk=HO[Bk],g9=Nk.toLowerCase(),_9=Nk[0].toUpperCase()+Nk.slice(1);tf(g9,"on"+_9)}tf($5,"onAnimationEnd");tf(H5,"onAnimationIteration");tf(W5,"onAnimationStart");tf("dblclick","onDoubleClick");tf("focusin","onFocus");tf("focusout","onBlur");tf(q5,"onTransitionEnd");w_("onMouseEnter",["mouseout","mouseover"]);w_("onMouseLeave",["mouseout","mouseover"]);w_("onPointerEnter",["pointerout","pointerover"]);w_("onPointerLeave",["pointerout","pointerover"]);Qp("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Qp("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Qp("onBeforeInput",["compositionend","keypress","textInput","paste"]);Qp("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Qp("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Qp("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var z0="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(" "),y9=new Set("cancel close invalid load scroll toggle".split(" ").concat(z0));function WO(n,t,s){var h=n.type||"unknown-event";n.currentTarget=s,gH(h,t,void 0,n),n.currentTarget=null}function X5(n,t){t=(t&4)!==0;for(var s=0;s<n.length;s++){var h=n[s],g=h.event;h=h.listeners;e:{var v=void 0;if(t)for(var E=h.length-1;0<=E;E--){var c=h[E],T=c.instance,L=c.currentTarget;if(c=c.listener,T!==v&&g.isPropagationStopped())break e;WO(g,c,L),v=T}else for(E=0;E<h.length;E++){if(c=h[E],T=c.instance,L=c.currentTarget,c=c.listener,T!==v&&g.isPropagationStopped())break e;WO(g,c,L),v=T}}}if(OS)throw n=$A,OS=!1,$A=null,n}function Ki(n,t){var s=t[eC];s===void 0&&(s=t[eC]=new Set);var h=n+"__bubble";s.has(h)||(K5(t,n,2,!1),s.add(h))}function Vk(n,t,s){var h=0;t&&(h|=4),K5(s,n,h,t)}var zw="_reactListening"+Math.random().toString(36).slice(2);function dx(n){if(!n[zw]){n[zw]=!0,r5.forEach(function(s){s!=="selectionchange"&&(y9.has(s)||Vk(s,!1,n),Vk(s,!0,n))});var t=n.nodeType===9?n:n.ownerDocument;t===null||t[zw]||(t[zw]=!0,Vk("selectionchange",!1,t))}}function K5(n,t,s,h){switch(R5(t)){case 1:var g=DH;break;case 4:g=RH;break;default:g=zI}s=g.bind(null,t,s,n),g=void 0,!GA||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(g=!0),h?g!==void 0?n.addEventListener(t,s,{capture:!0,passive:g}):n.addEventListener(t,s,!0):g!==void 0?n.addEventListener(t,s,{passive:g}):n.addEventListener(t,s,!1)}function jk(n,t,s,h,g){var v=h;if(!(t&1)&&!(t&2)&&h!==null)e:for(;;){if(h===null)return;var E=h.tag;if(E===3||E===4){var c=h.stateNode.containerInfo;if(c===g||c.nodeType===8&&c.parentNode===g)break;if(E===4)for(E=h.return;E!==null;){var T=E.tag;if((T===3||T===4)&&(T=E.stateNode.containerInfo,T===g||T.nodeType===8&&T.parentNode===g))return;E=E.return}for(;c!==null;){if(E=Ip(c),E===null)return;if(T=E.tag,T===5||T===6){h=v=E;continue e}c=c.parentNode}}h=h.return}v5(function(){var L=v,B=RI(s),U=[];e:{var H=Z5.get(n);if(H!==void 0){var X=NI,ae=n;switch(n){case"keypress":if(fS(s)===0)break e;case"keydown":case"keyup":X=ZH;break;case"focusin":ae="focus",X=Lk;break;case"focusout":ae="blur",X=Lk;break;case"beforeblur":case"afterblur":X=Lk;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=LO;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=FH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=YH;break;case $5:case H5:case W5:X=NH;break;case q5:X=JH;break;case"scroll":X=LH;break;case"wheel":X=t9;break;case"copy":case"cut":case"paste":X=jH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=FO}var ne=(t&4)!==0,me=!ne&&n==="scroll",oe=ne?H!==null?H+"Capture":null:H;ne=[];for(var re=L,he;re!==null;){he=re;var _e=he.stateNode;if(he.tag===5&&_e!==null&&(he=_e,oe!==null&&(_e=ox(re,oe),_e!=null&&ne.push(hx(re,_e,he)))),me)break;re=re.return}0<ne.length&&(H=new X(H,ae,null,s,B),U.push({event:H,listeners:ne}))}}if(!(t&7)){e:{if(H=n==="mouseover"||n==="pointerover",X=n==="mouseout"||n==="pointerout",H&&s!==jA&&(ae=s.relatedTarget||s.fromElement)&&(Ip(ae)||ae[pd]))break e;if((X||H)&&(H=B.window===B?B:(H=B.ownerDocument)?H.defaultView||H.parentWindow:window,X?(ae=s.relatedTarget||s.toElement,X=L,ae=ae?Ip(ae):null,ae!==null&&(me=Jp(ae),ae!==me||ae.tag!==5&&ae.tag!==6)&&(ae=null)):(X=null,ae=L),X!==ae)){if(ne=LO,_e="onMouseLeave",oe="onMouseEnter",re="mouse",(n==="pointerout"||n==="pointerover")&&(ne=FO,_e="onPointerLeave",oe="onPointerEnter",re="pointer"),me=X==null?H:Wg(X),he=ae==null?H:Wg(ae),H=new ne(_e,re+"leave",X,s,B),H.target=me,H.relatedTarget=he,_e=null,Ip(B)===L&&(ne=new ne(oe,re+"enter",ae,s,B),ne.target=he,ne.relatedTarget=me,_e=ne),me=_e,X&&ae)t:{for(ne=X,oe=ae,re=0,he=ne;he;he=Mg(he))re++;for(he=0,_e=oe;_e;_e=Mg(_e))he++;for(;0<re-he;)ne=Mg(ne),re--;for(;0<he-re;)oe=Mg(oe),he--;for(;re--;){if(ne===oe||oe!==null&&ne===oe.alternate)break t;ne=Mg(ne),oe=Mg(oe)}ne=null}else ne=null;X!==null&&qO(U,H,X,ne,!1),ae!==null&&me!==null&&qO(U,me,ae,ne,!0)}}e:{if(H=L?Wg(L):window,X=H.nodeName&&H.nodeName.toLowerCase(),X==="select"||X==="input"&&H.type==="file")var De=l9;else if(NO(H))if(N5)De=h9;else{De=u9;var He=c9}else(X=H.nodeName)&&X.toLowerCase()==="input"&&(H.type==="checkbox"||H.type==="radio")&&(De=d9);if(De&&(De=De(n,L))){B5(U,De,s,B);break e}He&&He(n,H,L),n==="focusout"&&(He=H._wrapperState)&&He.controlled&&H.type==="number"&&FA(H,"number",H.value)}switch(He=L?Wg(L):window,n){case"focusin":(NO(He)||He.contentEditable==="true")&&($g=He,ZA=L,W0=null);break;case"focusout":W0=ZA=$g=null;break;case"mousedown":XA=!0;break;case"contextmenu":case"mouseup":case"dragend":XA=!1,$O(U,s,B);break;case"selectionchange":if(m9)break;case"keydown":case"keyup":$O(U,s,B)}var nt;if(jI)e:{switch(n){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Gg?F5(n,s)&&(Xe="onCompositionEnd"):n==="keydown"&&s.keyCode===229&&(Xe="onCompositionStart");Xe&&(O5&&s.locale!=="ko"&&(Gg||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Gg&&(nt=L5()):(Rh=B,BI="value"in Rh?Rh.value:Rh.textContent,Gg=!0)),He=VS(L,Xe),0<He.length&&(Xe=new OO(Xe,n,null,s,B),U.push({event:Xe,listeners:He}),nt?Xe.data=nt:(nt=z5(s),nt!==null&&(Xe.data=nt)))),(nt=r9?i9(n,s):o9(n,s))&&(L=VS(L,"onBeforeInput"),0<L.length&&(B=new OO("onBeforeInput","beforeinput",null,s,B),U.push({event:B,listeners:L}),B.data=nt))}X5(U,t)})}function hx(n,t,s){return{instance:n,listener:t,currentTarget:s}}function VS(n,t){for(var s=t+"Capture",h=[];n!==null;){var g=n,v=g.stateNode;g.tag===5&&v!==null&&(g=v,v=ox(n,s),v!=null&&h.unshift(hx(n,v,g)),v=ox(n,t),v!=null&&h.push(hx(n,v,g))),n=n.return}return h}function Mg(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function qO(n,t,s,h,g){for(var v=t._reactName,E=[];s!==null&&s!==h;){var c=s,T=c.alternate,L=c.stateNode;if(T!==null&&T===h)break;c.tag===5&&L!==null&&(c=L,g?(T=ox(s,v),T!=null&&E.unshift(hx(s,T,c))):g||(T=ox(s,v),T!=null&&E.push(hx(s,T,c)))),s=s.return}E.length!==0&&n.push({event:t,listeners:E})}var v9=/\r\n?/g,x9=/\u0000|\uFFFD/g;function ZO(n){return(typeof n=="string"?n:""+n).replace(v9,`
|
||
`).replace(x9,"")}function Bw(n,t,s){if(t=ZO(t),ZO(n)!==t&&s)throw Error(Qt(425))}function jS(){}var KA=null,YA=null;function QA(n,t){return n==="textarea"||n==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var JA=typeof setTimeout=="function"?setTimeout:void 0,b9=typeof clearTimeout=="function"?clearTimeout:void 0,XO=typeof Promise=="function"?Promise:void 0,w9=typeof queueMicrotask=="function"?queueMicrotask:typeof XO<"u"?function(n){return XO.resolve(null).then(n).catch(S9)}:JA;function S9(n){setTimeout(function(){throw n})}function Uk(n,t){var s=t,h=0;do{var g=s.nextSibling;if(n.removeChild(s),g&&g.nodeType===8)if(s=g.data,s==="/$"){if(h===0){n.removeChild(g),lx(t);return}h--}else s!=="$"&&s!=="$?"&&s!=="$!"||h++;s=g}while(s);lx(t)}function Vh(n){for(;n!=null;n=n.nextSibling){var t=n.nodeType;if(t===1||t===3)break;if(t===8){if(t=n.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return n}function KO(n){n=n.previousSibling;for(var t=0;n;){if(n.nodeType===8){var s=n.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return n;t--}else s==="/$"&&t++}n=n.previousSibling}return null}var U_=Math.random().toString(36).slice(2),hu="__reactFiber$"+U_,fx="__reactProps$"+U_,pd="__reactContainer$"+U_,eC="__reactEvents$"+U_,T9="__reactListeners$"+U_,E9="__reactHandles$"+U_;function Ip(n){var t=n[hu];if(t)return t;for(var s=n.parentNode;s;){if(t=s[pd]||s[hu]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(n=KO(n);n!==null;){if(s=n[hu])return s;n=KO(n)}return t}n=s,s=n.parentNode}return null}function Gx(n){return n=n[hu]||n[pd],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Wg(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(Qt(33))}function LT(n){return n[fx]||null}var tC=[],qg=-1;function nf(n){return{current:n}}function Qi(n){0>qg||(n.current=tC[qg],tC[qg]=null,qg--)}function zi(n,t){qg++,tC[qg]=n.current,n.current=t}var Zh={},Ws=nf(Zh),La=nf(!1),Hp=Zh;function S_(n,t){var s=n.type.contextTypes;if(!s)return Zh;var h=n.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===t)return h.__reactInternalMemoizedMaskedChildContext;var g={},v;for(v in s)g[v]=t[v];return h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=t,n.__reactInternalMemoizedMaskedChildContext=g),g}function Oa(n){return n=n.childContextTypes,n!=null}function US(){Qi(La),Qi(Ws)}function YO(n,t,s){if(Ws.current!==Zh)throw Error(Qt(168));zi(Ws,t),zi(La,s)}function Y5(n,t,s){var h=n.stateNode;if(t=t.childContextTypes,typeof h.getChildContext!="function")return s;h=h.getChildContext();for(var g in h)if(!(g in t))throw Error(Qt(108,cH(n)||"Unknown",g));return go({},s,h)}function GS(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Zh,Hp=Ws.current,zi(Ws,n),zi(La,La.current),!0}function QO(n,t,s){var h=n.stateNode;if(!h)throw Error(Qt(169));s?(n=Y5(n,t,Hp),h.__reactInternalMemoizedMergedChildContext=n,Qi(La),Qi(Ws),zi(Ws,n)):Qi(La),zi(La,s)}var sd=null,OT=!1,Gk=!1;function Q5(n){sd===null?sd=[n]:sd.push(n)}function k9(n){OT=!0,Q5(n)}function rf(){if(!Gk&&sd!==null){Gk=!0;var n=0,t=xi;try{var s=sd;for(xi=1;n<s.length;n++){var h=s[n];do h=h(!0);while(h!==null)}sd=null,OT=!1}catch(g){throw sd!==null&&(sd=sd.slice(n+1)),S5(LI,rf),g}finally{xi=t,Gk=!1}}return null}var Zg=[],Xg=0,$S=null,HS=0,Nl=[],Vl=0,Wp=null,ld=1,cd="";function Tp(n,t){Zg[Xg++]=HS,Zg[Xg++]=$S,$S=n,HS=t}function J5(n,t,s){Nl[Vl++]=ld,Nl[Vl++]=cd,Nl[Vl++]=Wp,Wp=n;var h=ld;n=cd;var g=32-vc(h)-1;h&=~(1<<g),s+=1;var v=32-vc(t)+g;if(30<v){var E=g-g%5;v=(h&(1<<E)-1).toString(32),h>>=E,g-=E,ld=1<<32-vc(t)+g|s<<g|h,cd=v+n}else ld=1<<v|s<<g|h,cd=n}function GI(n){n.return!==null&&(Tp(n,1),J5(n,1,0))}function $I(n){for(;n===$S;)$S=Zg[--Xg],Zg[Xg]=null,HS=Zg[--Xg],Zg[Xg]=null;for(;n===Wp;)Wp=Nl[--Vl],Nl[Vl]=null,cd=Nl[--Vl],Nl[Vl]=null,ld=Nl[--Vl],Nl[Vl]=null}var cl=null,ll=null,so=!1,yc=null;function eN(n,t){var s=jl(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=n,t=n.deletions,t===null?(n.deletions=[s],n.flags|=16):t.push(s)}function JO(n,t){switch(n.tag){case 5:var s=n.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(n.stateNode=t,cl=n,ll=Vh(t.firstChild),!0):!1;case 6:return t=n.pendingProps===""||t.nodeType!==3?null:t,t!==null?(n.stateNode=t,cl=n,ll=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=Wp!==null?{id:ld,overflow:cd}:null,n.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=jl(18,null,null,0),s.stateNode=t,s.return=n,n.child=s,cl=n,ll=null,!0):!1;default:return!1}}function nC(n){return(n.mode&1)!==0&&(n.flags&128)===0}function rC(n){if(so){var t=ll;if(t){var s=t;if(!JO(n,t)){if(nC(n))throw Error(Qt(418));t=Vh(s.nextSibling);var h=cl;t&&JO(n,t)?eN(h,s):(n.flags=n.flags&-4097|2,so=!1,cl=n)}}else{if(nC(n))throw Error(Qt(418));n.flags=n.flags&-4097|2,so=!1,cl=n}}}function eF(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;cl=n}function Nw(n){if(n!==cl)return!1;if(!so)return eF(n),so=!0,!1;var t;if((t=n.tag!==3)&&!(t=n.tag!==5)&&(t=n.type,t=t!=="head"&&t!=="body"&&!QA(n.type,n.memoizedProps)),t&&(t=ll)){if(nC(n))throw tN(),Error(Qt(418));for(;t;)eN(n,t),t=Vh(t.nextSibling)}if(eF(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(Qt(317));e:{for(n=n.nextSibling,t=0;n;){if(n.nodeType===8){var s=n.data;if(s==="/$"){if(t===0){ll=Vh(n.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}n=n.nextSibling}ll=null}}else ll=cl?Vh(n.stateNode.nextSibling):null;return!0}function tN(){for(var n=ll;n;)n=Vh(n.nextSibling)}function T_(){ll=cl=null,so=!1}function HI(n){yc===null?yc=[n]:yc.push(n)}var A9=bd.ReactCurrentBatchConfig;function E0(n,t,s){if(n=s.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(Qt(309));var h=s.stateNode}if(!h)throw Error(Qt(147,n));var g=h,v=""+n;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===v?t.ref:(t=function(E){var c=g.refs;E===null?delete c[v]:c[v]=E},t._stringRef=v,t)}if(typeof n!="string")throw Error(Qt(284));if(!s._owner)throw Error(Qt(290,n))}return n}function Vw(n,t){throw n=Object.prototype.toString.call(t),Error(Qt(31,n==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":n))}function tF(n){var t=n._init;return t(n._payload)}function nN(n){function t(oe,re){if(n){var he=oe.deletions;he===null?(oe.deletions=[re],oe.flags|=16):he.push(re)}}function s(oe,re){if(!n)return null;for(;re!==null;)t(oe,re),re=re.sibling;return null}function h(oe,re){for(oe=new Map;re!==null;)re.key!==null?oe.set(re.key,re):oe.set(re.index,re),re=re.sibling;return oe}function g(oe,re){return oe=$h(oe,re),oe.index=0,oe.sibling=null,oe}function v(oe,re,he){return oe.index=he,n?(he=oe.alternate,he!==null?(he=he.index,he<re?(oe.flags|=2,re):he):(oe.flags|=2,re)):(oe.flags|=1048576,re)}function E(oe){return n&&oe.alternate===null&&(oe.flags|=2),oe}function c(oe,re,he,_e){return re===null||re.tag!==6?(re=Kk(he,oe.mode,_e),re.return=oe,re):(re=g(re,he),re.return=oe,re)}function T(oe,re,he,_e){var De=he.type;return De===Ug?B(oe,re,he.props.children,_e,he.key):re!==null&&(re.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===wh&&tF(De)===re.type)?(_e=g(re,he.props),_e.ref=E0(oe,re,he),_e.return=oe,_e):(_e=xS(he.type,he.key,he.props,null,oe.mode,_e),_e.ref=E0(oe,re,he),_e.return=oe,_e)}function L(oe,re,he,_e){return re===null||re.tag!==4||re.stateNode.containerInfo!==he.containerInfo||re.stateNode.implementation!==he.implementation?(re=Yk(he,oe.mode,_e),re.return=oe,re):(re=g(re,he.children||[]),re.return=oe,re)}function B(oe,re,he,_e,De){return re===null||re.tag!==7?(re=Vp(he,oe.mode,_e,De),re.return=oe,re):(re=g(re,he),re.return=oe,re)}function U(oe,re,he){if(typeof re=="string"&&re!==""||typeof re=="number")return re=Kk(""+re,oe.mode,he),re.return=oe,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case Iw:return he=xS(re.type,re.key,re.props,null,oe.mode,he),he.ref=E0(oe,null,re),he.return=oe,he;case jg:return re=Yk(re,oe.mode,he),re.return=oe,re;case wh:var _e=re._init;return U(oe,_e(re._payload),he)}if(O0(re)||x0(re))return re=Vp(re,oe.mode,he,null),re.return=oe,re;Vw(oe,re)}return null}function H(oe,re,he,_e){var De=re!==null?re.key:null;if(typeof he=="string"&&he!==""||typeof he=="number")return De!==null?null:c(oe,re,""+he,_e);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case Iw:return he.key===De?T(oe,re,he,_e):null;case jg:return he.key===De?L(oe,re,he,_e):null;case wh:return De=he._init,H(oe,re,De(he._payload),_e)}if(O0(he)||x0(he))return De!==null?null:B(oe,re,he,_e,null);Vw(oe,he)}return null}function X(oe,re,he,_e,De){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return oe=oe.get(he)||null,c(re,oe,""+_e,De);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case Iw:return oe=oe.get(_e.key===null?he:_e.key)||null,T(re,oe,_e,De);case jg:return oe=oe.get(_e.key===null?he:_e.key)||null,L(re,oe,_e,De);case wh:var He=_e._init;return X(oe,re,he,He(_e._payload),De)}if(O0(_e)||x0(_e))return oe=oe.get(he)||null,B(re,oe,_e,De,null);Vw(re,_e)}return null}function ae(oe,re,he,_e){for(var De=null,He=null,nt=re,Xe=re=0,ft=null;nt!==null&&Xe<he.length;Xe++){nt.index>Xe?(ft=nt,nt=null):ft=nt.sibling;var At=H(oe,nt,he[Xe],_e);if(At===null){nt===null&&(nt=ft);break}n&&nt&&At.alternate===null&&t(oe,nt),re=v(At,re,Xe),He===null?De=At:He.sibling=At,He=At,nt=ft}if(Xe===he.length)return s(oe,nt),so&&Tp(oe,Xe),De;if(nt===null){for(;Xe<he.length;Xe++)nt=U(oe,he[Xe],_e),nt!==null&&(re=v(nt,re,Xe),He===null?De=nt:He.sibling=nt,He=nt);return so&&Tp(oe,Xe),De}for(nt=h(oe,nt);Xe<he.length;Xe++)ft=X(nt,oe,Xe,he[Xe],_e),ft!==null&&(n&&ft.alternate!==null&&nt.delete(ft.key===null?Xe:ft.key),re=v(ft,re,Xe),He===null?De=ft:He.sibling=ft,He=ft);return n&&nt.forEach(function(Bt){return t(oe,Bt)}),so&&Tp(oe,Xe),De}function ne(oe,re,he,_e){var De=x0(he);if(typeof De!="function")throw Error(Qt(150));if(he=De.call(he),he==null)throw Error(Qt(151));for(var He=De=null,nt=re,Xe=re=0,ft=null,At=he.next();nt!==null&&!At.done;Xe++,At=he.next()){nt.index>Xe?(ft=nt,nt=null):ft=nt.sibling;var Bt=H(oe,nt,At.value,_e);if(Bt===null){nt===null&&(nt=ft);break}n&&nt&&Bt.alternate===null&&t(oe,nt),re=v(Bt,re,Xe),He===null?De=Bt:He.sibling=Bt,He=Bt,nt=ft}if(At.done)return s(oe,nt),so&&Tp(oe,Xe),De;if(nt===null){for(;!At.done;Xe++,At=he.next())At=U(oe,At.value,_e),At!==null&&(re=v(At,re,Xe),He===null?De=At:He.sibling=At,He=At);return so&&Tp(oe,Xe),De}for(nt=h(oe,nt);!At.done;Xe++,At=he.next())At=X(nt,oe,Xe,At.value,_e),At!==null&&(n&&At.alternate!==null&&nt.delete(At.key===null?Xe:At.key),re=v(At,re,Xe),He===null?De=At:He.sibling=At,He=At);return n&&nt.forEach(function(Dt){return t(oe,Dt)}),so&&Tp(oe,Xe),De}function me(oe,re,he,_e){if(typeof he=="object"&&he!==null&&he.type===Ug&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case Iw:e:{for(var De=he.key,He=re;He!==null;){if(He.key===De){if(De=he.type,De===Ug){if(He.tag===7){s(oe,He.sibling),re=g(He,he.props.children),re.return=oe,oe=re;break e}}else if(He.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===wh&&tF(De)===He.type){s(oe,He.sibling),re=g(He,he.props),re.ref=E0(oe,He,he),re.return=oe,oe=re;break e}s(oe,He);break}else t(oe,He);He=He.sibling}he.type===Ug?(re=Vp(he.props.children,oe.mode,_e,he.key),re.return=oe,oe=re):(_e=xS(he.type,he.key,he.props,null,oe.mode,_e),_e.ref=E0(oe,re,he),_e.return=oe,oe=_e)}return E(oe);case jg:e:{for(He=he.key;re!==null;){if(re.key===He)if(re.tag===4&&re.stateNode.containerInfo===he.containerInfo&&re.stateNode.implementation===he.implementation){s(oe,re.sibling),re=g(re,he.children||[]),re.return=oe,oe=re;break e}else{s(oe,re);break}else t(oe,re);re=re.sibling}re=Yk(he,oe.mode,_e),re.return=oe,oe=re}return E(oe);case wh:return He=he._init,me(oe,re,He(he._payload),_e)}if(O0(he))return ae(oe,re,he,_e);if(x0(he))return ne(oe,re,he,_e);Vw(oe,he)}return typeof he=="string"&&he!==""||typeof he=="number"?(he=""+he,re!==null&&re.tag===6?(s(oe,re.sibling),re=g(re,he),re.return=oe,oe=re):(s(oe,re),re=Kk(he,oe.mode,_e),re.return=oe,oe=re),E(oe)):s(oe,re)}return me}var E_=nN(!0),rN=nN(!1),WS=nf(null),qS=null,Kg=null,WI=null;function qI(){WI=Kg=qS=null}function ZI(n){var t=WS.current;Qi(WS),n._currentValue=t}function iC(n,t,s){for(;n!==null;){var h=n.alternate;if((n.childLanes&t)!==t?(n.childLanes|=t,h!==null&&(h.childLanes|=t)):h!==null&&(h.childLanes&t)!==t&&(h.childLanes|=t),n===s)break;n=n.return}}function l_(n,t){qS=n,WI=Kg=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&t&&(Ra=!0),n.firstContext=null)}function Gl(n){var t=n._currentValue;if(WI!==n)if(n={context:n,memoizedValue:t,next:null},Kg===null){if(qS===null)throw Error(Qt(308));Kg=n,qS.dependencies={lanes:0,firstContext:n}}else Kg=Kg.next=n;return t}var Mp=null;function XI(n){Mp===null?Mp=[n]:Mp.push(n)}function iN(n,t,s,h){var g=t.interleaved;return g===null?(s.next=s,XI(t)):(s.next=g.next,g.next=s),t.interleaved=s,md(n,h)}function md(n,t){n.lanes|=t;var s=n.alternate;for(s!==null&&(s.lanes|=t),s=n,n=n.return;n!==null;)n.childLanes|=t,s=n.alternate,s!==null&&(s.childLanes|=t),s=n,n=n.return;return s.tag===3?s.stateNode:null}var Sh=!1;function KI(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oN(n,t){n=n.updateQueue,t.updateQueue===n&&(t.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function ud(n,t){return{eventTime:n,lane:t,tag:0,payload:null,callback:null,next:null}}function jh(n,t,s){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,Jr&2){var g=h.pending;return g===null?t.next=t:(t.next=g.next,g.next=t),h.pending=t,md(n,s)}return g=h.interleaved,g===null?(t.next=t,XI(h)):(t.next=g.next,g.next=t),h.interleaved=t,md(n,s)}function pS(n,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var h=t.lanes;h&=n.pendingLanes,s|=h,t.lanes=s,OI(n,s)}}function nF(n,t){var s=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,s===h)){var g=null,v=null;if(s=s.firstBaseUpdate,s!==null){do{var E={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};v===null?g=v=E:v=v.next=E,s=s.next}while(s!==null);v===null?g=v=t:v=v.next=t}else g=v=t;s={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,effects:h.effects},n.updateQueue=s;return}n=s.lastBaseUpdate,n===null?s.firstBaseUpdate=t:n.next=t,s.lastBaseUpdate=t}function ZS(n,t,s,h){var g=n.updateQueue;Sh=!1;var v=g.firstBaseUpdate,E=g.lastBaseUpdate,c=g.shared.pending;if(c!==null){g.shared.pending=null;var T=c,L=T.next;T.next=null,E===null?v=L:E.next=L,E=T;var B=n.alternate;B!==null&&(B=B.updateQueue,c=B.lastBaseUpdate,c!==E&&(c===null?B.firstBaseUpdate=L:c.next=L,B.lastBaseUpdate=T))}if(v!==null){var U=g.baseState;E=0,B=L=T=null,c=v;do{var H=c.lane,X=c.eventTime;if((h&H)===H){B!==null&&(B=B.next={eventTime:X,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var ae=n,ne=c;switch(H=t,X=s,ne.tag){case 1:if(ae=ne.payload,typeof ae=="function"){U=ae.call(X,U,H);break e}U=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=ne.payload,H=typeof ae=="function"?ae.call(X,U,H):ae,H==null)break e;U=go({},U,H);break e;case 2:Sh=!0}}c.callback!==null&&c.lane!==0&&(n.flags|=64,H=g.effects,H===null?g.effects=[c]:H.push(c))}else X={eventTime:X,lane:H,tag:c.tag,payload:c.payload,callback:c.callback,next:null},B===null?(L=B=X,T=U):B=B.next=X,E|=H;if(c=c.next,c===null){if(c=g.shared.pending,c===null)break;H=c,c=H.next,H.next=null,g.lastBaseUpdate=H,g.shared.pending=null}}while(!0);if(B===null&&(T=U),g.baseState=T,g.firstBaseUpdate=L,g.lastBaseUpdate=B,t=g.shared.interleaved,t!==null){g=t;do E|=g.lane,g=g.next;while(g!==t)}else v===null&&(g.shared.lanes=0);Zp|=E,n.lanes=E,n.memoizedState=U}}function rF(n,t,s){if(n=t.effects,t.effects=null,n!==null)for(t=0;t<n.length;t++){var h=n[t],g=h.callback;if(g!==null){if(h.callback=null,h=s,typeof g!="function")throw Error(Qt(191,g));g.call(h)}}}var $x={},_u=nf($x),px=nf($x),mx=nf($x);function Pp(n){if(n===$x)throw Error(Qt(174));return n}function YI(n,t){switch(zi(mx,t),zi(px,n),zi(_u,$x),n=t.nodeType,n){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:BA(null,"");break;default:n=n===8?t.parentNode:t,t=n.namespaceURI||null,n=n.tagName,t=BA(t,n)}Qi(_u),zi(_u,t)}function k_(){Qi(_u),Qi(px),Qi(mx)}function sN(n){Pp(mx.current);var t=Pp(_u.current),s=BA(t,n.type);t!==s&&(zi(px,n),zi(_u,s))}function QI(n){px.current===n&&(Qi(_u),Qi(px))}var fo=nf(0);function XS(n){for(var t=n;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break;for(;t.sibling===null;){if(t.return===null||t.return===n)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var $k=[];function JI(){for(var n=0;n<$k.length;n++)$k[n]._workInProgressVersionPrimary=null;$k.length=0}var mS=bd.ReactCurrentDispatcher,Hk=bd.ReactCurrentBatchConfig,qp=0,mo=null,Qo=null,gs=null,KS=!1,q0=!1,gx=0,C9=0;function Vs(){throw Error(Qt(321))}function eM(n,t){if(t===null)return!1;for(var s=0;s<t.length&&s<n.length;s++)if(!bc(n[s],t[s]))return!1;return!0}function tM(n,t,s,h,g,v){if(qp=v,mo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,mS.current=n===null||n.memoizedState===null?D9:R9,n=s(h,g),q0){v=0;do{if(q0=!1,gx=0,25<=v)throw Error(Qt(301));v+=1,gs=Qo=null,t.updateQueue=null,mS.current=L9,n=s(h,g)}while(q0)}if(mS.current=YS,t=Qo!==null&&Qo.next!==null,qp=0,gs=Qo=mo=null,KS=!1,t)throw Error(Qt(300));return n}function nM(){var n=gx!==0;return gx=0,n}function lu(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gs===null?mo.memoizedState=gs=n:gs=gs.next=n,gs}function $l(){if(Qo===null){var n=mo.alternate;n=n!==null?n.memoizedState:null}else n=Qo.next;var t=gs===null?mo.memoizedState:gs.next;if(t!==null)gs=t,Qo=n;else{if(n===null)throw Error(Qt(310));Qo=n,n={memoizedState:Qo.memoizedState,baseState:Qo.baseState,baseQueue:Qo.baseQueue,queue:Qo.queue,next:null},gs===null?mo.memoizedState=gs=n:gs=gs.next=n}return gs}function _x(n,t){return typeof t=="function"?t(n):t}function Wk(n){var t=$l(),s=t.queue;if(s===null)throw Error(Qt(311));s.lastRenderedReducer=n;var h=Qo,g=h.baseQueue,v=s.pending;if(v!==null){if(g!==null){var E=g.next;g.next=v.next,v.next=E}h.baseQueue=g=v,s.pending=null}if(g!==null){v=g.next,h=h.baseState;var c=E=null,T=null,L=v;do{var B=L.lane;if((qp&B)===B)T!==null&&(T=T.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),h=L.hasEagerState?L.eagerState:n(h,L.action);else{var U={lane:B,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};T===null?(c=T=U,E=h):T=T.next=U,mo.lanes|=B,Zp|=B}L=L.next}while(L!==null&&L!==v);T===null?E=h:T.next=c,bc(h,t.memoizedState)||(Ra=!0),t.memoizedState=h,t.baseState=E,t.baseQueue=T,s.lastRenderedState=h}if(n=s.interleaved,n!==null){g=n;do v=g.lane,mo.lanes|=v,Zp|=v,g=g.next;while(g!==n)}else g===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function qk(n){var t=$l(),s=t.queue;if(s===null)throw Error(Qt(311));s.lastRenderedReducer=n;var h=s.dispatch,g=s.pending,v=t.memoizedState;if(g!==null){s.pending=null;var E=g=g.next;do v=n(v,E.action),E=E.next;while(E!==g);bc(v,t.memoizedState)||(Ra=!0),t.memoizedState=v,t.baseQueue===null&&(t.baseState=v),s.lastRenderedState=v}return[v,h]}function aN(){}function lN(n,t){var s=mo,h=$l(),g=t(),v=!bc(h.memoizedState,g);if(v&&(h.memoizedState=g,Ra=!0),h=h.queue,rM(dN.bind(null,s,h,n),[n]),h.getSnapshot!==t||v||gs!==null&&gs.memoizedState.tag&1){if(s.flags|=2048,yx(9,uN.bind(null,s,h,g,t),void 0,null),_s===null)throw Error(Qt(349));qp&30||cN(s,t,g)}return g}function cN(n,t,s){n.flags|=16384,n={getSnapshot:t,value:s},t=mo.updateQueue,t===null?(t={lastEffect:null,stores:null},mo.updateQueue=t,t.stores=[n]):(s=t.stores,s===null?t.stores=[n]:s.push(n))}function uN(n,t,s,h){t.value=s,t.getSnapshot=h,hN(t)&&fN(n)}function dN(n,t,s){return s(function(){hN(t)&&fN(n)})}function hN(n){var t=n.getSnapshot;n=n.value;try{var s=t();return!bc(n,s)}catch{return!0}}function fN(n){var t=md(n,1);t!==null&&xc(t,n,1,-1)}function iF(n){var t=lu();return typeof n=="function"&&(n=n()),t.memoizedState=t.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_x,lastRenderedState:n},t.queue=n,n=n.dispatch=P9.bind(null,mo,n),[t.memoizedState,n]}function yx(n,t,s,h){return n={tag:n,create:t,destroy:s,deps:h,next:null},t=mo.updateQueue,t===null?(t={lastEffect:null,stores:null},mo.updateQueue=t,t.lastEffect=n.next=n):(s=t.lastEffect,s===null?t.lastEffect=n.next=n:(h=s.next,s.next=n,n.next=h,t.lastEffect=n)),n}function pN(){return $l().memoizedState}function gS(n,t,s,h){var g=lu();mo.flags|=n,g.memoizedState=yx(1|t,s,void 0,h===void 0?null:h)}function FT(n,t,s,h){var g=$l();h=h===void 0?null:h;var v=void 0;if(Qo!==null){var E=Qo.memoizedState;if(v=E.destroy,h!==null&&eM(h,E.deps)){g.memoizedState=yx(t,s,v,h);return}}mo.flags|=n,g.memoizedState=yx(1|t,s,v,h)}function oF(n,t){return gS(8390656,8,n,t)}function rM(n,t){return FT(2048,8,n,t)}function mN(n,t){return FT(4,2,n,t)}function gN(n,t){return FT(4,4,n,t)}function _N(n,t){if(typeof t=="function")return n=n(),t(n),function(){t(null)};if(t!=null)return n=n(),t.current=n,function(){t.current=null}}function yN(n,t,s){return s=s!=null?s.concat([n]):null,FT(4,4,_N.bind(null,t,n),s)}function iM(){}function vN(n,t){var s=$l();t=t===void 0?null:t;var h=s.memoizedState;return h!==null&&t!==null&&eM(t,h[1])?h[0]:(s.memoizedState=[n,t],n)}function xN(n,t){var s=$l();t=t===void 0?null:t;var h=s.memoizedState;return h!==null&&t!==null&&eM(t,h[1])?h[0]:(n=n(),s.memoizedState=[n,t],n)}function bN(n,t,s){return qp&21?(bc(s,t)||(s=k5(),mo.lanes|=s,Zp|=s,n.baseState=!0),t):(n.baseState&&(n.baseState=!1,Ra=!0),n.memoizedState=s)}function I9(n,t){var s=xi;xi=s!==0&&4>s?s:4,n(!0);var h=Hk.transition;Hk.transition={};try{n(!1),t()}finally{xi=s,Hk.transition=h}}function wN(){return $l().memoizedState}function M9(n,t,s){var h=Gh(n);if(s={lane:h,action:s,hasEagerState:!1,eagerState:null,next:null},SN(n))TN(t,s);else if(s=iN(n,t,s,h),s!==null){var g=ha();xc(s,n,h,g),EN(s,t,h)}}function P9(n,t,s){var h=Gh(n),g={lane:h,action:s,hasEagerState:!1,eagerState:null,next:null};if(SN(n))TN(t,g);else{var v=n.alternate;if(n.lanes===0&&(v===null||v.lanes===0)&&(v=t.lastRenderedReducer,v!==null))try{var E=t.lastRenderedState,c=v(E,s);if(g.hasEagerState=!0,g.eagerState=c,bc(c,E)){var T=t.interleaved;T===null?(g.next=g,XI(t)):(g.next=T.next,T.next=g),t.interleaved=g;return}}catch{}finally{}s=iN(n,t,g,h),s!==null&&(g=ha(),xc(s,n,h,g),EN(s,t,h))}}function SN(n){var t=n.alternate;return n===mo||t!==null&&t===mo}function TN(n,t){q0=KS=!0;var s=n.pending;s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t}function EN(n,t,s){if(s&4194240){var h=t.lanes;h&=n.pendingLanes,s|=h,t.lanes=s,OI(n,s)}}var YS={readContext:Gl,useCallback:Vs,useContext:Vs,useEffect:Vs,useImperativeHandle:Vs,useInsertionEffect:Vs,useLayoutEffect:Vs,useMemo:Vs,useReducer:Vs,useRef:Vs,useState:Vs,useDebugValue:Vs,useDeferredValue:Vs,useTransition:Vs,useMutableSource:Vs,useSyncExternalStore:Vs,useId:Vs,unstable_isNewReconciler:!1},D9={readContext:Gl,useCallback:function(n,t){return lu().memoizedState=[n,t===void 0?null:t],n},useContext:Gl,useEffect:oF,useImperativeHandle:function(n,t,s){return s=s!=null?s.concat([n]):null,gS(4194308,4,_N.bind(null,t,n),s)},useLayoutEffect:function(n,t){return gS(4194308,4,n,t)},useInsertionEffect:function(n,t){return gS(4,2,n,t)},useMemo:function(n,t){var s=lu();return t=t===void 0?null:t,n=n(),s.memoizedState=[n,t],n},useReducer:function(n,t,s){var h=lu();return t=s!==void 0?s(t):t,h.memoizedState=h.baseState=t,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:t},h.queue=n,n=n.dispatch=M9.bind(null,mo,n),[h.memoizedState,n]},useRef:function(n){var t=lu();return n={current:n},t.memoizedState=n},useState:iF,useDebugValue:iM,useDeferredValue:function(n){return lu().memoizedState=n},useTransition:function(){var n=iF(!1),t=n[0];return n=I9.bind(null,n[1]),lu().memoizedState=n,[t,n]},useMutableSource:function(){},useSyncExternalStore:function(n,t,s){var h=mo,g=lu();if(so){if(s===void 0)throw Error(Qt(407));s=s()}else{if(s=t(),_s===null)throw Error(Qt(349));qp&30||cN(h,t,s)}g.memoizedState=s;var v={value:s,getSnapshot:t};return g.queue=v,oF(dN.bind(null,h,v,n),[n]),h.flags|=2048,yx(9,uN.bind(null,h,v,s,t),void 0,null),s},useId:function(){var n=lu(),t=_s.identifierPrefix;if(so){var s=cd,h=ld;s=(h&~(1<<32-vc(h)-1)).toString(32)+s,t=":"+t+"R"+s,s=gx++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=C9++,t=":"+t+"r"+s.toString(32)+":";return n.memoizedState=t},unstable_isNewReconciler:!1},R9={readContext:Gl,useCallback:vN,useContext:Gl,useEffect:rM,useImperativeHandle:yN,useInsertionEffect:mN,useLayoutEffect:gN,useMemo:xN,useReducer:Wk,useRef:pN,useState:function(){return Wk(_x)},useDebugValue:iM,useDeferredValue:function(n){var t=$l();return bN(t,Qo.memoizedState,n)},useTransition:function(){var n=Wk(_x)[0],t=$l().memoizedState;return[n,t]},useMutableSource:aN,useSyncExternalStore:lN,useId:wN,unstable_isNewReconciler:!1},L9={readContext:Gl,useCallback:vN,useContext:Gl,useEffect:rM,useImperativeHandle:yN,useInsertionEffect:mN,useLayoutEffect:gN,useMemo:xN,useReducer:qk,useRef:pN,useState:function(){return qk(_x)},useDebugValue:iM,useDeferredValue:function(n){var t=$l();return Qo===null?t.memoizedState=n:bN(t,Qo.memoizedState,n)},useTransition:function(){var n=qk(_x)[0],t=$l().memoizedState;return[n,t]},useMutableSource:aN,useSyncExternalStore:lN,useId:wN,unstable_isNewReconciler:!1};function pc(n,t){if(n&&n.defaultProps){t=go({},t),n=n.defaultProps;for(var s in n)t[s]===void 0&&(t[s]=n[s]);return t}return t}function oC(n,t,s,h){t=n.memoizedState,s=s(h,t),s=s==null?t:go({},t,s),n.memoizedState=s,n.lanes===0&&(n.updateQueue.baseState=s)}var zT={isMounted:function(n){return(n=n._reactInternals)?Jp(n)===n:!1},enqueueSetState:function(n,t,s){n=n._reactInternals;var h=ha(),g=Gh(n),v=ud(h,g);v.payload=t,s!=null&&(v.callback=s),t=jh(n,v,g),t!==null&&(xc(t,n,g,h),pS(t,n,g))},enqueueReplaceState:function(n,t,s){n=n._reactInternals;var h=ha(),g=Gh(n),v=ud(h,g);v.tag=1,v.payload=t,s!=null&&(v.callback=s),t=jh(n,v,g),t!==null&&(xc(t,n,g,h),pS(t,n,g))},enqueueForceUpdate:function(n,t){n=n._reactInternals;var s=ha(),h=Gh(n),g=ud(s,h);g.tag=2,t!=null&&(g.callback=t),t=jh(n,g,h),t!==null&&(xc(t,n,h,s),pS(t,n,h))}};function sF(n,t,s,h,g,v,E){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(h,v,E):t.prototype&&t.prototype.isPureReactComponent?!ux(s,h)||!ux(g,v):!0}function kN(n,t,s){var h=!1,g=Zh,v=t.contextType;return typeof v=="object"&&v!==null?v=Gl(v):(g=Oa(t)?Hp:Ws.current,h=t.contextTypes,v=(h=h!=null)?S_(n,g):Zh),t=new t(s,v),n.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=zT,n.stateNode=t,t._reactInternals=n,h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=g,n.__reactInternalMemoizedMaskedChildContext=v),t}function aF(n,t,s,h){n=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,h),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,h),t.state!==n&&zT.enqueueReplaceState(t,t.state,null)}function sC(n,t,s,h){var g=n.stateNode;g.props=s,g.state=n.memoizedState,g.refs={},KI(n);var v=t.contextType;typeof v=="object"&&v!==null?g.context=Gl(v):(v=Oa(t)?Hp:Ws.current,g.context=S_(n,v)),g.state=n.memoizedState,v=t.getDerivedStateFromProps,typeof v=="function"&&(oC(n,t,v,s),g.state=n.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(t=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),t!==g.state&&zT.enqueueReplaceState(g,g.state,null),ZS(n,s,g,h),g.state=n.memoizedState),typeof g.componentDidMount=="function"&&(n.flags|=4194308)}function A_(n,t){try{var s="",h=t;do s+=lH(h),h=h.return;while(h);var g=s}catch(v){g=`
|
||
Error generating stack: `+v.message+`
|
||
`+v.stack}return{value:n,source:t,stack:g,digest:null}}function Zk(n,t,s){return{value:n,source:null,stack:s??null,digest:t??null}}function aC(n,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var O9=typeof WeakMap=="function"?WeakMap:Map;function AN(n,t,s){s=ud(-1,s),s.tag=3,s.payload={element:null};var h=t.value;return s.callback=function(){JS||(JS=!0,_C=h),aC(n,t)},s}function CN(n,t,s){s=ud(-1,s),s.tag=3;var h=n.type.getDerivedStateFromError;if(typeof h=="function"){var g=t.value;s.payload=function(){return h(g)},s.callback=function(){aC(n,t)}}var v=n.stateNode;return v!==null&&typeof v.componentDidCatch=="function"&&(s.callback=function(){aC(n,t),typeof h!="function"&&(Uh===null?Uh=new Set([this]):Uh.add(this));var E=t.stack;this.componentDidCatch(t.value,{componentStack:E!==null?E:""})}),s}function lF(n,t,s){var h=n.pingCache;if(h===null){h=n.pingCache=new O9;var g=new Set;h.set(t,g)}else g=h.get(t),g===void 0&&(g=new Set,h.set(t,g));g.has(s)||(g.add(s),n=X9.bind(null,n,t,s),t.then(n,n))}function cF(n){do{var t;if((t=n.tag===13)&&(t=n.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return n;n=n.return}while(n!==null);return null}function uF(n,t,s,h,g){return n.mode&1?(n.flags|=65536,n.lanes=g,n):(n===t?n.flags|=65536:(n.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=ud(-1,1),t.tag=2,jh(s,t,1))),s.lanes|=1),n)}var F9=bd.ReactCurrentOwner,Ra=!1;function ua(n,t,s,h){t.child=n===null?rN(t,null,s,h):E_(t,n.child,s,h)}function dF(n,t,s,h,g){s=s.render;var v=t.ref;return l_(t,g),h=tM(n,t,s,h,v,g),s=nM(),n!==null&&!Ra?(t.updateQueue=n.updateQueue,t.flags&=-2053,n.lanes&=~g,gd(n,t,g)):(so&&s&&GI(t),t.flags|=1,ua(n,t,h,g),t.child)}function hF(n,t,s,h,g){if(n===null){var v=s.type;return typeof v=="function"&&!hM(v)&&v.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=v,IN(n,t,v,h,g)):(n=xS(s.type,null,h,t,t.mode,g),n.ref=t.ref,n.return=t,t.child=n)}if(v=n.child,!(n.lanes&g)){var E=v.memoizedProps;if(s=s.compare,s=s!==null?s:ux,s(E,h)&&n.ref===t.ref)return gd(n,t,g)}return t.flags|=1,n=$h(v,h),n.ref=t.ref,n.return=t,t.child=n}function IN(n,t,s,h,g){if(n!==null){var v=n.memoizedProps;if(ux(v,h)&&n.ref===t.ref)if(Ra=!1,t.pendingProps=h=v,(n.lanes&g)!==0)n.flags&131072&&(Ra=!0);else return t.lanes=n.lanes,gd(n,t,g)}return lC(n,t,s,h,g)}function MN(n,t,s){var h=t.pendingProps,g=h.children,v=n!==null?n.memoizedState:null;if(h.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},zi(Qg,il),il|=s;else{if(!(s&1073741824))return n=v!==null?v.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:n,cachePool:null,transitions:null},t.updateQueue=null,zi(Qg,il),il|=n,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=v!==null?v.baseLanes:s,zi(Qg,il),il|=h}else v!==null?(h=v.baseLanes|s,t.memoizedState=null):h=s,zi(Qg,il),il|=h;return ua(n,t,g,s),t.child}function PN(n,t){var s=t.ref;(n===null&&s!==null||n!==null&&n.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function lC(n,t,s,h,g){var v=Oa(s)?Hp:Ws.current;return v=S_(t,v),l_(t,g),s=tM(n,t,s,h,v,g),h=nM(),n!==null&&!Ra?(t.updateQueue=n.updateQueue,t.flags&=-2053,n.lanes&=~g,gd(n,t,g)):(so&&h&&GI(t),t.flags|=1,ua(n,t,s,g),t.child)}function fF(n,t,s,h,g){if(Oa(s)){var v=!0;GS(t)}else v=!1;if(l_(t,g),t.stateNode===null)_S(n,t),kN(t,s,h),sC(t,s,h,g),h=!0;else if(n===null){var E=t.stateNode,c=t.memoizedProps;E.props=c;var T=E.context,L=s.contextType;typeof L=="object"&&L!==null?L=Gl(L):(L=Oa(s)?Hp:Ws.current,L=S_(t,L));var B=s.getDerivedStateFromProps,U=typeof B=="function"||typeof E.getSnapshotBeforeUpdate=="function";U||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(c!==h||T!==L)&&aF(t,E,h,L),Sh=!1;var H=t.memoizedState;E.state=H,ZS(t,h,E,g),T=t.memoizedState,c!==h||H!==T||La.current||Sh?(typeof B=="function"&&(oC(t,s,B,h),T=t.memoizedState),(c=Sh||sF(t,s,c,h,H,T,L))?(U||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(t.flags|=4194308)):(typeof E.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=h,t.memoizedState=T),E.props=h,E.state=T,E.context=L,h=c):(typeof E.componentDidMount=="function"&&(t.flags|=4194308),h=!1)}else{E=t.stateNode,oN(n,t),c=t.memoizedProps,L=t.type===t.elementType?c:pc(t.type,c),E.props=L,U=t.pendingProps,H=E.context,T=s.contextType,typeof T=="object"&&T!==null?T=Gl(T):(T=Oa(s)?Hp:Ws.current,T=S_(t,T));var X=s.getDerivedStateFromProps;(B=typeof X=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(c!==U||H!==T)&&aF(t,E,h,T),Sh=!1,H=t.memoizedState,E.state=H,ZS(t,h,E,g);var ae=t.memoizedState;c!==U||H!==ae||La.current||Sh?(typeof X=="function"&&(oC(t,s,X,h),ae=t.memoizedState),(L=Sh||sF(t,s,L,h,H,ae,T)||!1)?(B||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(h,ae,T),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(h,ae,T)),typeof E.componentDidUpdate=="function"&&(t.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof E.componentDidUpdate!="function"||c===n.memoizedProps&&H===n.memoizedState||(t.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||c===n.memoizedProps&&H===n.memoizedState||(t.flags|=1024),t.memoizedProps=h,t.memoizedState=ae),E.props=h,E.state=ae,E.context=T,h=L):(typeof E.componentDidUpdate!="function"||c===n.memoizedProps&&H===n.memoizedState||(t.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||c===n.memoizedProps&&H===n.memoizedState||(t.flags|=1024),h=!1)}return cC(n,t,s,h,v,g)}function cC(n,t,s,h,g,v){PN(n,t);var E=(t.flags&128)!==0;if(!h&&!E)return g&&QO(t,s,!1),gd(n,t,v);h=t.stateNode,F9.current=t;var c=E&&typeof s.getDerivedStateFromError!="function"?null:h.render();return t.flags|=1,n!==null&&E?(t.child=E_(t,n.child,null,v),t.child=E_(t,null,c,v)):ua(n,t,c,v),t.memoizedState=h.state,g&&QO(t,s,!0),t.child}function DN(n){var t=n.stateNode;t.pendingContext?YO(n,t.pendingContext,t.pendingContext!==t.context):t.context&&YO(n,t.context,!1),YI(n,t.containerInfo)}function pF(n,t,s,h,g){return T_(),HI(g),t.flags|=256,ua(n,t,s,h),t.child}var uC={dehydrated:null,treeContext:null,retryLane:0};function dC(n){return{baseLanes:n,cachePool:null,transitions:null}}function RN(n,t,s){var h=t.pendingProps,g=fo.current,v=!1,E=(t.flags&128)!==0,c;if((c=E)||(c=n!==null&&n.memoizedState===null?!1:(g&2)!==0),c?(v=!0,t.flags&=-129):(n===null||n.memoizedState!==null)&&(g|=1),zi(fo,g&1),n===null)return rC(t),n=t.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(t.mode&1?n.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(E=h.children,n=h.fallback,v?(h=t.mode,v=t.child,E={mode:"hidden",children:E},!(h&1)&&v!==null?(v.childLanes=0,v.pendingProps=E):v=VT(E,h,0,null),n=Vp(n,h,s,null),v.return=t,n.return=t,v.sibling=n,t.child=v,t.child.memoizedState=dC(s),t.memoizedState=uC,n):oM(t,E));if(g=n.memoizedState,g!==null&&(c=g.dehydrated,c!==null))return z9(n,t,E,h,c,g,s);if(v){v=h.fallback,E=t.mode,g=n.child,c=g.sibling;var T={mode:"hidden",children:h.children};return!(E&1)&&t.child!==g?(h=t.child,h.childLanes=0,h.pendingProps=T,t.deletions=null):(h=$h(g,T),h.subtreeFlags=g.subtreeFlags&14680064),c!==null?v=$h(c,v):(v=Vp(v,E,s,null),v.flags|=2),v.return=t,h.return=t,h.sibling=v,t.child=h,h=v,v=t.child,E=n.child.memoizedState,E=E===null?dC(s):{baseLanes:E.baseLanes|s,cachePool:null,transitions:E.transitions},v.memoizedState=E,v.childLanes=n.childLanes&~s,t.memoizedState=uC,h}return v=n.child,n=v.sibling,h=$h(v,{mode:"visible",children:h.children}),!(t.mode&1)&&(h.lanes=s),h.return=t,h.sibling=null,n!==null&&(s=t.deletions,s===null?(t.deletions=[n],t.flags|=16):s.push(n)),t.child=h,t.memoizedState=null,h}function oM(n,t){return t=VT({mode:"visible",children:t},n.mode,0,null),t.return=n,n.child=t}function jw(n,t,s,h){return h!==null&&HI(h),E_(t,n.child,null,s),n=oM(t,t.pendingProps.children),n.flags|=2,t.memoizedState=null,n}function z9(n,t,s,h,g,v,E){if(s)return t.flags&256?(t.flags&=-257,h=Zk(Error(Qt(422))),jw(n,t,E,h)):t.memoizedState!==null?(t.child=n.child,t.flags|=128,null):(v=h.fallback,g=t.mode,h=VT({mode:"visible",children:h.children},g,0,null),v=Vp(v,g,E,null),v.flags|=2,h.return=t,v.return=t,h.sibling=v,t.child=h,t.mode&1&&E_(t,n.child,null,E),t.child.memoizedState=dC(E),t.memoizedState=uC,v);if(!(t.mode&1))return jw(n,t,E,null);if(g.data==="$!"){if(h=g.nextSibling&&g.nextSibling.dataset,h)var c=h.dgst;return h=c,v=Error(Qt(419)),h=Zk(v,h,void 0),jw(n,t,E,h)}if(c=(E&n.childLanes)!==0,Ra||c){if(h=_s,h!==null){switch(E&-E){case 4:g=2;break;case 16:g=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:g=32;break;case 536870912:g=268435456;break;default:g=0}g=g&(h.suspendedLanes|E)?0:g,g!==0&&g!==v.retryLane&&(v.retryLane=g,md(n,g),xc(h,n,g,-1))}return dM(),h=Zk(Error(Qt(421))),jw(n,t,E,h)}return g.data==="$?"?(t.flags|=128,t.child=n.child,t=K9.bind(null,n),g._reactRetry=t,null):(n=v.treeContext,ll=Vh(g.nextSibling),cl=t,so=!0,yc=null,n!==null&&(Nl[Vl++]=ld,Nl[Vl++]=cd,Nl[Vl++]=Wp,ld=n.id,cd=n.overflow,Wp=t),t=oM(t,h.children),t.flags|=4096,t)}function mF(n,t,s){n.lanes|=t;var h=n.alternate;h!==null&&(h.lanes|=t),iC(n.return,t,s)}function Xk(n,t,s,h,g){var v=n.memoizedState;v===null?n.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:h,tail:s,tailMode:g}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=h,v.tail=s,v.tailMode=g)}function LN(n,t,s){var h=t.pendingProps,g=h.revealOrder,v=h.tail;if(ua(n,t,h.children,s),h=fo.current,h&2)h=h&1|2,t.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=t.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&mF(n,s,t);else if(n.tag===19)mF(n,s,t);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}h&=1}if(zi(fo,h),!(t.mode&1))t.memoizedState=null;else switch(g){case"forwards":for(s=t.child,g=null;s!==null;)n=s.alternate,n!==null&&XS(n)===null&&(g=s),s=s.sibling;s=g,s===null?(g=t.child,t.child=null):(g=s.sibling,s.sibling=null),Xk(t,!1,g,s,v);break;case"backwards":for(s=null,g=t.child,t.child=null;g!==null;){if(n=g.alternate,n!==null&&XS(n)===null){t.child=g;break}n=g.sibling,g.sibling=s,s=g,g=n}Xk(t,!0,s,null,v);break;case"together":Xk(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function _S(n,t){!(t.mode&1)&&n!==null&&(n.alternate=null,t.alternate=null,t.flags|=2)}function gd(n,t,s){if(n!==null&&(t.dependencies=n.dependencies),Zp|=t.lanes,!(s&t.childLanes))return null;if(n!==null&&t.child!==n.child)throw Error(Qt(153));if(t.child!==null){for(n=t.child,s=$h(n,n.pendingProps),t.child=s,s.return=t;n.sibling!==null;)n=n.sibling,s=s.sibling=$h(n,n.pendingProps),s.return=t;s.sibling=null}return t.child}function B9(n,t,s){switch(t.tag){case 3:DN(t),T_();break;case 5:sN(t);break;case 1:Oa(t.type)&&GS(t);break;case 4:YI(t,t.stateNode.containerInfo);break;case 10:var h=t.type._context,g=t.memoizedProps.value;zi(WS,h._currentValue),h._currentValue=g;break;case 13:if(h=t.memoizedState,h!==null)return h.dehydrated!==null?(zi(fo,fo.current&1),t.flags|=128,null):s&t.child.childLanes?RN(n,t,s):(zi(fo,fo.current&1),n=gd(n,t,s),n!==null?n.sibling:null);zi(fo,fo.current&1);break;case 19:if(h=(s&t.childLanes)!==0,n.flags&128){if(h)return LN(n,t,s);t.flags|=128}if(g=t.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),zi(fo,fo.current),h)break;return null;case 22:case 23:return t.lanes=0,MN(n,t,s)}return gd(n,t,s)}var ON,hC,FN,zN;ON=function(n,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)n.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}};hC=function(){};FN=function(n,t,s,h){var g=n.memoizedProps;if(g!==h){n=t.stateNode,Pp(_u.current);var v=null;switch(s){case"input":g=LA(n,g),h=LA(n,h),v=[];break;case"select":g=go({},g,{value:void 0}),h=go({},h,{value:void 0}),v=[];break;case"textarea":g=zA(n,g),h=zA(n,h),v=[];break;default:typeof g.onClick!="function"&&typeof h.onClick=="function"&&(n.onclick=jS)}NA(s,h);var E;s=null;for(L in g)if(!h.hasOwnProperty(L)&&g.hasOwnProperty(L)&&g[L]!=null)if(L==="style"){var c=g[L];for(E in c)c.hasOwnProperty(E)&&(s||(s={}),s[E]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(rx.hasOwnProperty(L)?v||(v=[]):(v=v||[]).push(L,null));for(L in h){var T=h[L];if(c=g!=null?g[L]:void 0,h.hasOwnProperty(L)&&T!==c&&(T!=null||c!=null))if(L==="style")if(c){for(E in c)!c.hasOwnProperty(E)||T&&T.hasOwnProperty(E)||(s||(s={}),s[E]="");for(E in T)T.hasOwnProperty(E)&&c[E]!==T[E]&&(s||(s={}),s[E]=T[E])}else s||(v||(v=[]),v.push(L,s)),s=T;else L==="dangerouslySetInnerHTML"?(T=T?T.__html:void 0,c=c?c.__html:void 0,T!=null&&c!==T&&(v=v||[]).push(L,T)):L==="children"?typeof T!="string"&&typeof T!="number"||(v=v||[]).push(L,""+T):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(rx.hasOwnProperty(L)?(T!=null&&L==="onScroll"&&Ki("scroll",n),v||c===T||(v=[])):(v=v||[]).push(L,T))}s&&(v=v||[]).push("style",s);var L=v;(t.updateQueue=L)&&(t.flags|=4)}};zN=function(n,t,s,h){s!==h&&(t.flags|=4)};function k0(n,t){if(!so)switch(n.tailMode){case"hidden":t=n.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?n.tail=null:s.sibling=null;break;case"collapsed":s=n.tail;for(var h=null;s!==null;)s.alternate!==null&&(h=s),s=s.sibling;h===null?t||n.tail===null?n.tail=null:n.tail.sibling=null:h.sibling=null}}function js(n){var t=n.alternate!==null&&n.alternate.child===n.child,s=0,h=0;if(t)for(var g=n.child;g!==null;)s|=g.lanes|g.childLanes,h|=g.subtreeFlags&14680064,h|=g.flags&14680064,g.return=n,g=g.sibling;else for(g=n.child;g!==null;)s|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=n,g=g.sibling;return n.subtreeFlags|=h,n.childLanes=s,t}function N9(n,t,s){var h=t.pendingProps;switch($I(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return js(t),null;case 1:return Oa(t.type)&&US(),js(t),null;case 3:return h=t.stateNode,k_(),Qi(La),Qi(Ws),JI(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(n===null||n.child===null)&&(Nw(t)?t.flags|=4:n===null||n.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,yc!==null&&(xC(yc),yc=null))),hC(n,t),js(t),null;case 5:QI(t);var g=Pp(mx.current);if(s=t.type,n!==null&&t.stateNode!=null)FN(n,t,s,h,g),n.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!h){if(t.stateNode===null)throw Error(Qt(166));return js(t),null}if(n=Pp(_u.current),Nw(t)){h=t.stateNode,s=t.type;var v=t.memoizedProps;switch(h[hu]=t,h[fx]=v,n=(t.mode&1)!==0,s){case"dialog":Ki("cancel",h),Ki("close",h);break;case"iframe":case"object":case"embed":Ki("load",h);break;case"video":case"audio":for(g=0;g<z0.length;g++)Ki(z0[g],h);break;case"source":Ki("error",h);break;case"img":case"image":case"link":Ki("error",h),Ki("load",h);break;case"details":Ki("toggle",h);break;case"input":TO(h,v),Ki("invalid",h);break;case"select":h._wrapperState={wasMultiple:!!v.multiple},Ki("invalid",h);break;case"textarea":kO(h,v),Ki("invalid",h)}NA(s,v),g=null;for(var E in v)if(v.hasOwnProperty(E)){var c=v[E];E==="children"?typeof c=="string"?h.textContent!==c&&(v.suppressHydrationWarning!==!0&&Bw(h.textContent,c,n),g=["children",c]):typeof c=="number"&&h.textContent!==""+c&&(v.suppressHydrationWarning!==!0&&Bw(h.textContent,c,n),g=["children",""+c]):rx.hasOwnProperty(E)&&c!=null&&E==="onScroll"&&Ki("scroll",h)}switch(s){case"input":Mw(h),EO(h,v,!0);break;case"textarea":Mw(h),AO(h);break;case"select":case"option":break;default:typeof v.onClick=="function"&&(h.onclick=jS)}h=g,t.updateQueue=h,h!==null&&(t.flags|=4)}else{E=g.nodeType===9?g:g.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=d5(s)),n==="http://www.w3.org/1999/xhtml"?s==="script"?(n=E.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof h.is=="string"?n=E.createElement(s,{is:h.is}):(n=E.createElement(s),s==="select"&&(E=n,h.multiple?E.multiple=!0:h.size&&(E.size=h.size))):n=E.createElementNS(n,s),n[hu]=t,n[fx]=h,ON(n,t,!1,!1),t.stateNode=n;e:{switch(E=VA(s,h),s){case"dialog":Ki("cancel",n),Ki("close",n),g=h;break;case"iframe":case"object":case"embed":Ki("load",n),g=h;break;case"video":case"audio":for(g=0;g<z0.length;g++)Ki(z0[g],n);g=h;break;case"source":Ki("error",n),g=h;break;case"img":case"image":case"link":Ki("error",n),Ki("load",n),g=h;break;case"details":Ki("toggle",n),g=h;break;case"input":TO(n,h),g=LA(n,h),Ki("invalid",n);break;case"option":g=h;break;case"select":n._wrapperState={wasMultiple:!!h.multiple},g=go({},h,{value:void 0}),Ki("invalid",n);break;case"textarea":kO(n,h),g=zA(n,h),Ki("invalid",n);break;default:g=h}NA(s,g),c=g;for(v in c)if(c.hasOwnProperty(v)){var T=c[v];v==="style"?p5(n,T):v==="dangerouslySetInnerHTML"?(T=T?T.__html:void 0,T!=null&&h5(n,T)):v==="children"?typeof T=="string"?(s!=="textarea"||T!=="")&&ix(n,T):typeof T=="number"&&ix(n,""+T):v!=="suppressContentEditableWarning"&&v!=="suppressHydrationWarning"&&v!=="autoFocus"&&(rx.hasOwnProperty(v)?T!=null&&v==="onScroll"&&Ki("scroll",n):T!=null&&II(n,v,T,E))}switch(s){case"input":Mw(n),EO(n,h,!1);break;case"textarea":Mw(n),AO(n);break;case"option":h.value!=null&&n.setAttribute("value",""+qh(h.value));break;case"select":n.multiple=!!h.multiple,v=h.value,v!=null?i_(n,!!h.multiple,v,!1):h.defaultValue!=null&&i_(n,!!h.multiple,h.defaultValue,!0);break;default:typeof g.onClick=="function"&&(n.onclick=jS)}switch(s){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}}h&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return js(t),null;case 6:if(n&&t.stateNode!=null)zN(n,t,n.memoizedProps,h);else{if(typeof h!="string"&&t.stateNode===null)throw Error(Qt(166));if(s=Pp(mx.current),Pp(_u.current),Nw(t)){if(h=t.stateNode,s=t.memoizedProps,h[hu]=t,(v=h.nodeValue!==s)&&(n=cl,n!==null))switch(n.tag){case 3:Bw(h.nodeValue,s,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Bw(h.nodeValue,s,(n.mode&1)!==0)}v&&(t.flags|=4)}else h=(s.nodeType===9?s:s.ownerDocument).createTextNode(h),h[hu]=t,t.stateNode=h}return js(t),null;case 13:if(Qi(fo),h=t.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(so&&ll!==null&&t.mode&1&&!(t.flags&128))tN(),T_(),t.flags|=98560,v=!1;else if(v=Nw(t),h!==null&&h.dehydrated!==null){if(n===null){if(!v)throw Error(Qt(318));if(v=t.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(Qt(317));v[hu]=t}else T_(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;js(t),v=!1}else yc!==null&&(xC(yc),yc=null),v=!0;if(!v)return t.flags&65536?t:null}return t.flags&128?(t.lanes=s,t):(h=h!==null,h!==(n!==null&&n.memoizedState!==null)&&h&&(t.child.flags|=8192,t.mode&1&&(n===null||fo.current&1?es===0&&(es=3):dM())),t.updateQueue!==null&&(t.flags|=4),js(t),null);case 4:return k_(),hC(n,t),n===null&&dx(t.stateNode.containerInfo),js(t),null;case 10:return ZI(t.type._context),js(t),null;case 17:return Oa(t.type)&&US(),js(t),null;case 19:if(Qi(fo),v=t.memoizedState,v===null)return js(t),null;if(h=(t.flags&128)!==0,E=v.rendering,E===null)if(h)k0(v,!1);else{if(es!==0||n!==null&&n.flags&128)for(n=t.child;n!==null;){if(E=XS(n),E!==null){for(t.flags|=128,k0(v,!1),h=E.updateQueue,h!==null&&(t.updateQueue=h,t.flags|=4),t.subtreeFlags=0,h=s,s=t.child;s!==null;)v=s,n=h,v.flags&=14680066,E=v.alternate,E===null?(v.childLanes=0,v.lanes=n,v.child=null,v.subtreeFlags=0,v.memoizedProps=null,v.memoizedState=null,v.updateQueue=null,v.dependencies=null,v.stateNode=null):(v.childLanes=E.childLanes,v.lanes=E.lanes,v.child=E.child,v.subtreeFlags=0,v.deletions=null,v.memoizedProps=E.memoizedProps,v.memoizedState=E.memoizedState,v.updateQueue=E.updateQueue,v.type=E.type,n=E.dependencies,v.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),s=s.sibling;return zi(fo,fo.current&1|2),t.child}n=n.sibling}v.tail!==null&&Oo()>C_&&(t.flags|=128,h=!0,k0(v,!1),t.lanes=4194304)}else{if(!h)if(n=XS(E),n!==null){if(t.flags|=128,h=!0,s=n.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),k0(v,!0),v.tail===null&&v.tailMode==="hidden"&&!E.alternate&&!so)return js(t),null}else 2*Oo()-v.renderingStartTime>C_&&s!==1073741824&&(t.flags|=128,h=!0,k0(v,!1),t.lanes=4194304);v.isBackwards?(E.sibling=t.child,t.child=E):(s=v.last,s!==null?s.sibling=E:t.child=E,v.last=E)}return v.tail!==null?(t=v.tail,v.rendering=t,v.tail=t.sibling,v.renderingStartTime=Oo(),t.sibling=null,s=fo.current,zi(fo,h?s&1|2:s&1),t):(js(t),null);case 22:case 23:return uM(),h=t.memoizedState!==null,n!==null&&n.memoizedState!==null!==h&&(t.flags|=8192),h&&t.mode&1?il&1073741824&&(js(t),t.subtreeFlags&6&&(t.flags|=8192)):js(t),null;case 24:return null;case 25:return null}throw Error(Qt(156,t.tag))}function V9(n,t){switch($I(t),t.tag){case 1:return Oa(t.type)&&US(),n=t.flags,n&65536?(t.flags=n&-65537|128,t):null;case 3:return k_(),Qi(La),Qi(Ws),JI(),n=t.flags,n&65536&&!(n&128)?(t.flags=n&-65537|128,t):null;case 5:return QI(t),null;case 13:if(Qi(fo),n=t.memoizedState,n!==null&&n.dehydrated!==null){if(t.alternate===null)throw Error(Qt(340));T_()}return n=t.flags,n&65536?(t.flags=n&-65537|128,t):null;case 19:return Qi(fo),null;case 4:return k_(),null;case 10:return ZI(t.type._context),null;case 22:case 23:return uM(),null;case 24:return null;default:return null}}var Uw=!1,$s=!1,j9=typeof WeakSet=="function"?WeakSet:Set,kn=null;function Yg(n,t){var s=n.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(h){bo(n,t,h)}else s.current=null}function fC(n,t,s){try{s()}catch(h){bo(n,t,h)}}var gF=!1;function U9(n,t){if(KA=BS,n=U5(),UI(n)){if("selectionStart"in n)var s={start:n.selectionStart,end:n.selectionEnd};else e:{s=(s=n.ownerDocument)&&s.defaultView||window;var h=s.getSelection&&s.getSelection();if(h&&h.rangeCount!==0){s=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{s.nodeType,v.nodeType}catch{s=null;break e}var E=0,c=-1,T=-1,L=0,B=0,U=n,H=null;t:for(;;){for(var X;U!==s||g!==0&&U.nodeType!==3||(c=E+g),U!==v||h!==0&&U.nodeType!==3||(T=E+h),U.nodeType===3&&(E+=U.nodeValue.length),(X=U.firstChild)!==null;)H=U,U=X;for(;;){if(U===n)break t;if(H===s&&++L===g&&(c=E),H===v&&++B===h&&(T=E),(X=U.nextSibling)!==null)break;U=H,H=U.parentNode}U=X}s=c===-1||T===-1?null:{start:c,end:T}}else s=null}s=s||{start:0,end:0}}else s=null;for(YA={focusedElem:n,selectionRange:s},BS=!1,kn=t;kn!==null;)if(t=kn,n=t.child,(t.subtreeFlags&1028)!==0&&n!==null)n.return=t,kn=n;else for(;kn!==null;){t=kn;try{var ae=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ae!==null){var ne=ae.memoizedProps,me=ae.memoizedState,oe=t.stateNode,re=oe.getSnapshotBeforeUpdate(t.elementType===t.type?ne:pc(t.type,ne),me);oe.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var he=t.stateNode.containerInfo;he.nodeType===1?he.textContent="":he.nodeType===9&&he.documentElement&&he.removeChild(he.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Qt(163))}}catch(_e){bo(t,t.return,_e)}if(n=t.sibling,n!==null){n.return=t.return,kn=n;break}kn=t.return}return ae=gF,gF=!1,ae}function Z0(n,t,s){var h=t.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var g=h=h.next;do{if((g.tag&n)===n){var v=g.destroy;g.destroy=void 0,v!==void 0&&fC(t,s,v)}g=g.next}while(g!==h)}}function BT(n,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&n)===n){var h=s.create;s.destroy=h()}s=s.next}while(s!==t)}}function pC(n){var t=n.ref;if(t!==null){var s=n.stateNode;switch(n.tag){case 5:n=s;break;default:n=s}typeof t=="function"?t(n):t.current=n}}function BN(n){var t=n.alternate;t!==null&&(n.alternate=null,BN(t)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(t=n.stateNode,t!==null&&(delete t[hu],delete t[fx],delete t[eC],delete t[T9],delete t[E9])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function NN(n){return n.tag===5||n.tag===3||n.tag===4}function _F(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||NN(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function mC(n,t,s){var h=n.tag;if(h===5||h===6)n=n.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(n,t):s.insertBefore(n,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(n,s)):(t=s,t.appendChild(n)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=jS));else if(h!==4&&(n=n.child,n!==null))for(mC(n,t,s),n=n.sibling;n!==null;)mC(n,t,s),n=n.sibling}function gC(n,t,s){var h=n.tag;if(h===5||h===6)n=n.stateNode,t?s.insertBefore(n,t):s.appendChild(n);else if(h!==4&&(n=n.child,n!==null))for(gC(n,t,s),n=n.sibling;n!==null;)gC(n,t,s),n=n.sibling}var ks=null,_c=!1;function mh(n,t,s){for(s=s.child;s!==null;)VN(n,t,s),s=s.sibling}function VN(n,t,s){if(gu&&typeof gu.onCommitFiberUnmount=="function")try{gu.onCommitFiberUnmount(MT,s)}catch{}switch(s.tag){case 5:$s||Yg(s,t);case 6:var h=ks,g=_c;ks=null,mh(n,t,s),ks=h,_c=g,ks!==null&&(_c?(n=ks,s=s.stateNode,n.nodeType===8?n.parentNode.removeChild(s):n.removeChild(s)):ks.removeChild(s.stateNode));break;case 18:ks!==null&&(_c?(n=ks,s=s.stateNode,n.nodeType===8?Uk(n.parentNode,s):n.nodeType===1&&Uk(n,s),lx(n)):Uk(ks,s.stateNode));break;case 4:h=ks,g=_c,ks=s.stateNode.containerInfo,_c=!0,mh(n,t,s),ks=h,_c=g;break;case 0:case 11:case 14:case 15:if(!$s&&(h=s.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){g=h=h.next;do{var v=g,E=v.destroy;v=v.tag,E!==void 0&&(v&2||v&4)&&fC(s,t,E),g=g.next}while(g!==h)}mh(n,t,s);break;case 1:if(!$s&&(Yg(s,t),h=s.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=s.memoizedProps,h.state=s.memoizedState,h.componentWillUnmount()}catch(c){bo(s,t,c)}mh(n,t,s);break;case 21:mh(n,t,s);break;case 22:s.mode&1?($s=(h=$s)||s.memoizedState!==null,mh(n,t,s),$s=h):mh(n,t,s);break;default:mh(n,t,s)}}function yF(n){var t=n.updateQueue;if(t!==null){n.updateQueue=null;var s=n.stateNode;s===null&&(s=n.stateNode=new j9),t.forEach(function(h){var g=Y9.bind(null,n,h);s.has(h)||(s.add(h),h.then(g,g))})}}function dc(n,t){var s=t.deletions;if(s!==null)for(var h=0;h<s.length;h++){var g=s[h];try{var v=n,E=t,c=E;e:for(;c!==null;){switch(c.tag){case 5:ks=c.stateNode,_c=!1;break e;case 3:ks=c.stateNode.containerInfo,_c=!0;break e;case 4:ks=c.stateNode.containerInfo,_c=!0;break e}c=c.return}if(ks===null)throw Error(Qt(160));VN(v,E,g),ks=null,_c=!1;var T=g.alternate;T!==null&&(T.return=null),g.return=null}catch(L){bo(g,t,L)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jN(t,n),t=t.sibling}function jN(n,t){var s=n.alternate,h=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(dc(t,n),su(n),h&4){try{Z0(3,n,n.return),BT(3,n)}catch(ne){bo(n,n.return,ne)}try{Z0(5,n,n.return)}catch(ne){bo(n,n.return,ne)}}break;case 1:dc(t,n),su(n),h&512&&s!==null&&Yg(s,s.return);break;case 5:if(dc(t,n),su(n),h&512&&s!==null&&Yg(s,s.return),n.flags&32){var g=n.stateNode;try{ix(g,"")}catch(ne){bo(n,n.return,ne)}}if(h&4&&(g=n.stateNode,g!=null)){var v=n.memoizedProps,E=s!==null?s.memoizedProps:v,c=n.type,T=n.updateQueue;if(n.updateQueue=null,T!==null)try{c==="input"&&v.type==="radio"&&v.name!=null&&c5(g,v),VA(c,E);var L=VA(c,v);for(E=0;E<T.length;E+=2){var B=T[E],U=T[E+1];B==="style"?p5(g,U):B==="dangerouslySetInnerHTML"?h5(g,U):B==="children"?ix(g,U):II(g,B,U,L)}switch(c){case"input":OA(g,v);break;case"textarea":u5(g,v);break;case"select":var H=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!v.multiple;var X=v.value;X!=null?i_(g,!!v.multiple,X,!1):H!==!!v.multiple&&(v.defaultValue!=null?i_(g,!!v.multiple,v.defaultValue,!0):i_(g,!!v.multiple,v.multiple?[]:"",!1))}g[fx]=v}catch(ne){bo(n,n.return,ne)}}break;case 6:if(dc(t,n),su(n),h&4){if(n.stateNode===null)throw Error(Qt(162));g=n.stateNode,v=n.memoizedProps;try{g.nodeValue=v}catch(ne){bo(n,n.return,ne)}}break;case 3:if(dc(t,n),su(n),h&4&&s!==null&&s.memoizedState.isDehydrated)try{lx(t.containerInfo)}catch(ne){bo(n,n.return,ne)}break;case 4:dc(t,n),su(n);break;case 13:dc(t,n),su(n),g=n.child,g.flags&8192&&(v=g.memoizedState!==null,g.stateNode.isHidden=v,!v||g.alternate!==null&&g.alternate.memoizedState!==null||(lM=Oo())),h&4&&yF(n);break;case 22:if(B=s!==null&&s.memoizedState!==null,n.mode&1?($s=(L=$s)||B,dc(t,n),$s=L):dc(t,n),su(n),h&8192){if(L=n.memoizedState!==null,(n.stateNode.isHidden=L)&&!B&&n.mode&1)for(kn=n,B=n.child;B!==null;){for(U=kn=B;kn!==null;){switch(H=kn,X=H.child,H.tag){case 0:case 11:case 14:case 15:Z0(4,H,H.return);break;case 1:Yg(H,H.return);var ae=H.stateNode;if(typeof ae.componentWillUnmount=="function"){h=H,s=H.return;try{t=h,ae.props=t.memoizedProps,ae.state=t.memoizedState,ae.componentWillUnmount()}catch(ne){bo(h,s,ne)}}break;case 5:Yg(H,H.return);break;case 22:if(H.memoizedState!==null){xF(U);continue}}X!==null?(X.return=H,kn=X):xF(U)}B=B.sibling}e:for(B=null,U=n;;){if(U.tag===5){if(B===null){B=U;try{g=U.stateNode,L?(v=g.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none"):(c=U.stateNode,T=U.memoizedProps.style,E=T!=null&&T.hasOwnProperty("display")?T.display:null,c.style.display=f5("display",E))}catch(ne){bo(n,n.return,ne)}}}else if(U.tag===6){if(B===null)try{U.stateNode.nodeValue=L?"":U.memoizedProps}catch(ne){bo(n,n.return,ne)}}else if((U.tag!==22&&U.tag!==23||U.memoizedState===null||U===n)&&U.child!==null){U.child.return=U,U=U.child;continue}if(U===n)break e;for(;U.sibling===null;){if(U.return===null||U.return===n)break e;B===U&&(B=null),U=U.return}B===U&&(B=null),U.sibling.return=U.return,U=U.sibling}}break;case 19:dc(t,n),su(n),h&4&&yF(n);break;case 21:break;default:dc(t,n),su(n)}}function su(n){var t=n.flags;if(t&2){try{e:{for(var s=n.return;s!==null;){if(NN(s)){var h=s;break e}s=s.return}throw Error(Qt(160))}switch(h.tag){case 5:var g=h.stateNode;h.flags&32&&(ix(g,""),h.flags&=-33);var v=_F(n);gC(n,v,g);break;case 3:case 4:var E=h.stateNode.containerInfo,c=_F(n);mC(n,c,E);break;default:throw Error(Qt(161))}}catch(T){bo(n,n.return,T)}n.flags&=-3}t&4096&&(n.flags&=-4097)}function G9(n,t,s){kn=n,UN(n)}function UN(n,t,s){for(var h=(n.mode&1)!==0;kn!==null;){var g=kn,v=g.child;if(g.tag===22&&h){var E=g.memoizedState!==null||Uw;if(!E){var c=g.alternate,T=c!==null&&c.memoizedState!==null||$s;c=Uw;var L=$s;if(Uw=E,($s=T)&&!L)for(kn=g;kn!==null;)E=kn,T=E.child,E.tag===22&&E.memoizedState!==null?bF(g):T!==null?(T.return=E,kn=T):bF(g);for(;v!==null;)kn=v,UN(v),v=v.sibling;kn=g,Uw=c,$s=L}vF(n)}else g.subtreeFlags&8772&&v!==null?(v.return=g,kn=v):vF(n)}}function vF(n){for(;kn!==null;){var t=kn;if(t.flags&8772){var s=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:$s||BT(5,t);break;case 1:var h=t.stateNode;if(t.flags&4&&!$s)if(s===null)h.componentDidMount();else{var g=t.elementType===t.type?s.memoizedProps:pc(t.type,s.memoizedProps);h.componentDidUpdate(g,s.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var v=t.updateQueue;v!==null&&rF(t,v,h);break;case 3:var E=t.updateQueue;if(E!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}rF(t,E,s)}break;case 5:var c=t.stateNode;if(s===null&&t.flags&4){s=c;var T=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":T.autoFocus&&s.focus();break;case"img":T.src&&(s.src=T.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var L=t.alternate;if(L!==null){var B=L.memoizedState;if(B!==null){var U=B.dehydrated;U!==null&&lx(U)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Qt(163))}$s||t.flags&512&&pC(t)}catch(H){bo(t,t.return,H)}}if(t===n){kn=null;break}if(s=t.sibling,s!==null){s.return=t.return,kn=s;break}kn=t.return}}function xF(n){for(;kn!==null;){var t=kn;if(t===n){kn=null;break}var s=t.sibling;if(s!==null){s.return=t.return,kn=s;break}kn=t.return}}function bF(n){for(;kn!==null;){var t=kn;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{BT(4,t)}catch(T){bo(t,s,T)}break;case 1:var h=t.stateNode;if(typeof h.componentDidMount=="function"){var g=t.return;try{h.componentDidMount()}catch(T){bo(t,g,T)}}var v=t.return;try{pC(t)}catch(T){bo(t,v,T)}break;case 5:var E=t.return;try{pC(t)}catch(T){bo(t,E,T)}}}catch(T){bo(t,t.return,T)}if(t===n){kn=null;break}var c=t.sibling;if(c!==null){c.return=t.return,kn=c;break}kn=t.return}}var $9=Math.ceil,QS=bd.ReactCurrentDispatcher,sM=bd.ReactCurrentOwner,Ul=bd.ReactCurrentBatchConfig,Jr=0,_s=null,Go=null,Cs=0,il=0,Qg=nf(0),es=0,vx=null,Zp=0,NT=0,aM=0,X0=null,Da=null,lM=0,C_=1/0,od=null,JS=!1,_C=null,Uh=null,Gw=!1,Lh=null,eT=0,K0=0,yC=null,yS=-1,vS=0;function ha(){return Jr&6?Oo():yS!==-1?yS:yS=Oo()}function Gh(n){return n.mode&1?Jr&2&&Cs!==0?Cs&-Cs:A9.transition!==null?(vS===0&&(vS=k5()),vS):(n=xi,n!==0||(n=window.event,n=n===void 0?16:R5(n.type)),n):1}function xc(n,t,s,h){if(50<K0)throw K0=0,yC=null,Error(Qt(185));jx(n,s,h),(!(Jr&2)||n!==_s)&&(n===_s&&(!(Jr&2)&&(NT|=s),es===4&&kh(n,Cs)),Fa(n,h),s===1&&Jr===0&&!(t.mode&1)&&(C_=Oo()+500,OT&&rf()))}function Fa(n,t){var s=n.callbackNode;AH(n,t);var h=zS(n,n===_s?Cs:0);if(h===0)s!==null&&MO(s),n.callbackNode=null,n.callbackPriority=0;else if(t=h&-h,n.callbackPriority!==t){if(s!=null&&MO(s),t===1)n.tag===0?k9(wF.bind(null,n)):Q5(wF.bind(null,n)),w9(function(){!(Jr&6)&&rf()}),s=null;else{switch(A5(h)){case 1:s=LI;break;case 4:s=T5;break;case 16:s=FS;break;case 536870912:s=E5;break;default:s=FS}s=KN(s,GN.bind(null,n))}n.callbackPriority=t,n.callbackNode=s}}function GN(n,t){if(yS=-1,vS=0,Jr&6)throw Error(Qt(327));var s=n.callbackNode;if(c_()&&n.callbackNode!==s)return null;var h=zS(n,n===_s?Cs:0);if(h===0)return null;if(h&30||h&n.expiredLanes||t)t=tT(n,h);else{t=h;var g=Jr;Jr|=2;var v=HN();(_s!==n||Cs!==t)&&(od=null,C_=Oo()+500,Np(n,t));do try{q9();break}catch(c){$N(n,c)}while(!0);qI(),QS.current=v,Jr=g,Go!==null?t=0:(_s=null,Cs=0,t=es)}if(t!==0){if(t===2&&(g=HA(n),g!==0&&(h=g,t=vC(n,g))),t===1)throw s=vx,Np(n,0),kh(n,h),Fa(n,Oo()),s;if(t===6)kh(n,h);else{if(g=n.current.alternate,!(h&30)&&!H9(g)&&(t=tT(n,h),t===2&&(v=HA(n),v!==0&&(h=v,t=vC(n,v))),t===1))throw s=vx,Np(n,0),kh(n,h),Fa(n,Oo()),s;switch(n.finishedWork=g,n.finishedLanes=h,t){case 0:case 1:throw Error(Qt(345));case 2:Ep(n,Da,od);break;case 3:if(kh(n,h),(h&130023424)===h&&(t=lM+500-Oo(),10<t)){if(zS(n,0)!==0)break;if(g=n.suspendedLanes,(g&h)!==h){ha(),n.pingedLanes|=n.suspendedLanes&g;break}n.timeoutHandle=JA(Ep.bind(null,n,Da,od),t);break}Ep(n,Da,od);break;case 4:if(kh(n,h),(h&4194240)===h)break;for(t=n.eventTimes,g=-1;0<h;){var E=31-vc(h);v=1<<E,E=t[E],E>g&&(g=E),h&=~v}if(h=g,h=Oo()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*$9(h/1960))-h,10<h){n.timeoutHandle=JA(Ep.bind(null,n,Da,od),h);break}Ep(n,Da,od);break;case 5:Ep(n,Da,od);break;default:throw Error(Qt(329))}}}return Fa(n,Oo()),n.callbackNode===s?GN.bind(null,n):null}function vC(n,t){var s=X0;return n.current.memoizedState.isDehydrated&&(Np(n,t).flags|=256),n=tT(n,t),n!==2&&(t=Da,Da=s,t!==null&&xC(t)),n}function xC(n){Da===null?Da=n:Da.push.apply(Da,n)}function H9(n){for(var t=n;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var h=0;h<s.length;h++){var g=s[h],v=g.getSnapshot;g=g.value;try{if(!bc(v(),g))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===n)break;for(;t.sibling===null;){if(t.return===null||t.return===n)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function kh(n,t){for(t&=~aM,t&=~NT,n.suspendedLanes|=t,n.pingedLanes&=~t,n=n.expirationTimes;0<t;){var s=31-vc(t),h=1<<s;n[s]=-1,t&=~h}}function wF(n){if(Jr&6)throw Error(Qt(327));c_();var t=zS(n,0);if(!(t&1))return Fa(n,Oo()),null;var s=tT(n,t);if(n.tag!==0&&s===2){var h=HA(n);h!==0&&(t=h,s=vC(n,h))}if(s===1)throw s=vx,Np(n,0),kh(n,t),Fa(n,Oo()),s;if(s===6)throw Error(Qt(345));return n.finishedWork=n.current.alternate,n.finishedLanes=t,Ep(n,Da,od),Fa(n,Oo()),null}function cM(n,t){var s=Jr;Jr|=1;try{return n(t)}finally{Jr=s,Jr===0&&(C_=Oo()+500,OT&&rf())}}function Xp(n){Lh!==null&&Lh.tag===0&&!(Jr&6)&&c_();var t=Jr;Jr|=1;var s=Ul.transition,h=xi;try{if(Ul.transition=null,xi=1,n)return n()}finally{xi=h,Ul.transition=s,Jr=t,!(Jr&6)&&rf()}}function uM(){il=Qg.current,Qi(Qg)}function Np(n,t){n.finishedWork=null,n.finishedLanes=0;var s=n.timeoutHandle;if(s!==-1&&(n.timeoutHandle=-1,b9(s)),Go!==null)for(s=Go.return;s!==null;){var h=s;switch($I(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&US();break;case 3:k_(),Qi(La),Qi(Ws),JI();break;case 5:QI(h);break;case 4:k_();break;case 13:Qi(fo);break;case 19:Qi(fo);break;case 10:ZI(h.type._context);break;case 22:case 23:uM()}s=s.return}if(_s=n,Go=n=$h(n.current,null),Cs=il=t,es=0,vx=null,aM=NT=Zp=0,Da=X0=null,Mp!==null){for(t=0;t<Mp.length;t++)if(s=Mp[t],h=s.interleaved,h!==null){s.interleaved=null;var g=h.next,v=s.pending;if(v!==null){var E=v.next;v.next=g,h.next=E}s.pending=h}Mp=null}return n}function $N(n,t){do{var s=Go;try{if(qI(),mS.current=YS,KS){for(var h=mo.memoizedState;h!==null;){var g=h.queue;g!==null&&(g.pending=null),h=h.next}KS=!1}if(qp=0,gs=Qo=mo=null,q0=!1,gx=0,sM.current=null,s===null||s.return===null){es=1,vx=t,Go=null;break}e:{var v=n,E=s.return,c=s,T=t;if(t=Cs,c.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){var L=T,B=c,U=B.tag;if(!(B.mode&1)&&(U===0||U===11||U===15)){var H=B.alternate;H?(B.updateQueue=H.updateQueue,B.memoizedState=H.memoizedState,B.lanes=H.lanes):(B.updateQueue=null,B.memoizedState=null)}var X=cF(E);if(X!==null){X.flags&=-257,uF(X,E,c,v,t),X.mode&1&&lF(v,L,t),t=X,T=L;var ae=t.updateQueue;if(ae===null){var ne=new Set;ne.add(T),t.updateQueue=ne}else ae.add(T);break e}else{if(!(t&1)){lF(v,L,t),dM();break e}T=Error(Qt(426))}}else if(so&&c.mode&1){var me=cF(E);if(me!==null){!(me.flags&65536)&&(me.flags|=256),uF(me,E,c,v,t),HI(A_(T,c));break e}}v=T=A_(T,c),es!==4&&(es=2),X0===null?X0=[v]:X0.push(v),v=E;do{switch(v.tag){case 3:v.flags|=65536,t&=-t,v.lanes|=t;var oe=AN(v,T,t);nF(v,oe);break e;case 1:c=T;var re=v.type,he=v.stateNode;if(!(v.flags&128)&&(typeof re.getDerivedStateFromError=="function"||he!==null&&typeof he.componentDidCatch=="function"&&(Uh===null||!Uh.has(he)))){v.flags|=65536,t&=-t,v.lanes|=t;var _e=CN(v,c,t);nF(v,_e);break e}}v=v.return}while(v!==null)}qN(s)}catch(De){t=De,Go===s&&s!==null&&(Go=s=s.return);continue}break}while(!0)}function HN(){var n=QS.current;return QS.current=YS,n===null?YS:n}function dM(){(es===0||es===3||es===2)&&(es=4),_s===null||!(Zp&268435455)&&!(NT&268435455)||kh(_s,Cs)}function tT(n,t){var s=Jr;Jr|=2;var h=HN();(_s!==n||Cs!==t)&&(od=null,Np(n,t));do try{W9();break}catch(g){$N(n,g)}while(!0);if(qI(),Jr=s,QS.current=h,Go!==null)throw Error(Qt(261));return _s=null,Cs=0,es}function W9(){for(;Go!==null;)WN(Go)}function q9(){for(;Go!==null&&!yH();)WN(Go)}function WN(n){var t=XN(n.alternate,n,il);n.memoizedProps=n.pendingProps,t===null?qN(n):Go=t,sM.current=null}function qN(n){var t=n;do{var s=t.alternate;if(n=t.return,t.flags&32768){if(s=V9(s,t),s!==null){s.flags&=32767,Go=s;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{es=6,Go=null;return}}else if(s=N9(s,t,il),s!==null){Go=s;return}if(t=t.sibling,t!==null){Go=t;return}Go=t=n}while(t!==null);es===0&&(es=5)}function Ep(n,t,s){var h=xi,g=Ul.transition;try{Ul.transition=null,xi=1,Z9(n,t,s,h)}finally{Ul.transition=g,xi=h}return null}function Z9(n,t,s,h){do c_();while(Lh!==null);if(Jr&6)throw Error(Qt(327));s=n.finishedWork;var g=n.finishedLanes;if(s===null)return null;if(n.finishedWork=null,n.finishedLanes=0,s===n.current)throw Error(Qt(177));n.callbackNode=null,n.callbackPriority=0;var v=s.lanes|s.childLanes;if(CH(n,v),n===_s&&(Go=_s=null,Cs=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||Gw||(Gw=!0,KN(FS,function(){return c_(),null})),v=(s.flags&15990)!==0,s.subtreeFlags&15990||v){v=Ul.transition,Ul.transition=null;var E=xi;xi=1;var c=Jr;Jr|=4,sM.current=null,U9(n,s),jN(s,n),p9(YA),BS=!!KA,YA=KA=null,n.current=s,G9(s),vH(),Jr=c,xi=E,Ul.transition=v}else n.current=s;if(Gw&&(Gw=!1,Lh=n,eT=g),v=n.pendingLanes,v===0&&(Uh=null),wH(s.stateNode),Fa(n,Oo()),t!==null)for(h=n.onRecoverableError,s=0;s<t.length;s++)g=t[s],h(g.value,{componentStack:g.stack,digest:g.digest});if(JS)throw JS=!1,n=_C,_C=null,n;return eT&1&&n.tag!==0&&c_(),v=n.pendingLanes,v&1?n===yC?K0++:(K0=0,yC=n):K0=0,rf(),null}function c_(){if(Lh!==null){var n=A5(eT),t=Ul.transition,s=xi;try{if(Ul.transition=null,xi=16>n?16:n,Lh===null)var h=!1;else{if(n=Lh,Lh=null,eT=0,Jr&6)throw Error(Qt(331));var g=Jr;for(Jr|=4,kn=n.current;kn!==null;){var v=kn,E=v.child;if(kn.flags&16){var c=v.deletions;if(c!==null){for(var T=0;T<c.length;T++){var L=c[T];for(kn=L;kn!==null;){var B=kn;switch(B.tag){case 0:case 11:case 15:Z0(8,B,v)}var U=B.child;if(U!==null)U.return=B,kn=U;else for(;kn!==null;){B=kn;var H=B.sibling,X=B.return;if(BN(B),B===L){kn=null;break}if(H!==null){H.return=X,kn=H;break}kn=X}}}var ae=v.alternate;if(ae!==null){var ne=ae.child;if(ne!==null){ae.child=null;do{var me=ne.sibling;ne.sibling=null,ne=me}while(ne!==null)}}kn=v}}if(v.subtreeFlags&2064&&E!==null)E.return=v,kn=E;else e:for(;kn!==null;){if(v=kn,v.flags&2048)switch(v.tag){case 0:case 11:case 15:Z0(9,v,v.return)}var oe=v.sibling;if(oe!==null){oe.return=v.return,kn=oe;break e}kn=v.return}}var re=n.current;for(kn=re;kn!==null;){E=kn;var he=E.child;if(E.subtreeFlags&2064&&he!==null)he.return=E,kn=he;else e:for(E=re;kn!==null;){if(c=kn,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:BT(9,c)}}catch(De){bo(c,c.return,De)}if(c===E){kn=null;break e}var _e=c.sibling;if(_e!==null){_e.return=c.return,kn=_e;break e}kn=c.return}}if(Jr=g,rf(),gu&&typeof gu.onPostCommitFiberRoot=="function")try{gu.onPostCommitFiberRoot(MT,n)}catch{}h=!0}return h}finally{xi=s,Ul.transition=t}}return!1}function SF(n,t,s){t=A_(s,t),t=AN(n,t,1),n=jh(n,t,1),t=ha(),n!==null&&(jx(n,1,t),Fa(n,t))}function bo(n,t,s){if(n.tag===3)SF(n,n,s);else for(;t!==null;){if(t.tag===3){SF(t,n,s);break}else if(t.tag===1){var h=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Uh===null||!Uh.has(h))){n=A_(s,n),n=CN(t,n,1),t=jh(t,n,1),n=ha(),t!==null&&(jx(t,1,n),Fa(t,n));break}}t=t.return}}function X9(n,t,s){var h=n.pingCache;h!==null&&h.delete(t),t=ha(),n.pingedLanes|=n.suspendedLanes&s,_s===n&&(Cs&s)===s&&(es===4||es===3&&(Cs&130023424)===Cs&&500>Oo()-lM?Np(n,0):aM|=s),Fa(n,t)}function ZN(n,t){t===0&&(n.mode&1?(t=Rw,Rw<<=1,!(Rw&130023424)&&(Rw=4194304)):t=1);var s=ha();n=md(n,t),n!==null&&(jx(n,t,s),Fa(n,s))}function K9(n){var t=n.memoizedState,s=0;t!==null&&(s=t.retryLane),ZN(n,s)}function Y9(n,t){var s=0;switch(n.tag){case 13:var h=n.stateNode,g=n.memoizedState;g!==null&&(s=g.retryLane);break;case 19:h=n.stateNode;break;default:throw Error(Qt(314))}h!==null&&h.delete(t),ZN(n,s)}var XN;XN=function(n,t,s){if(n!==null)if(n.memoizedProps!==t.pendingProps||La.current)Ra=!0;else{if(!(n.lanes&s)&&!(t.flags&128))return Ra=!1,B9(n,t,s);Ra=!!(n.flags&131072)}else Ra=!1,so&&t.flags&1048576&&J5(t,HS,t.index);switch(t.lanes=0,t.tag){case 2:var h=t.type;_S(n,t),n=t.pendingProps;var g=S_(t,Ws.current);l_(t,s),g=tM(null,t,h,n,g,s);var v=nM();return t.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oa(h)?(v=!0,GS(t)):v=!1,t.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,KI(t),g.updater=zT,t.stateNode=g,g._reactInternals=t,sC(t,h,n,s),t=cC(null,t,h,!0,v,s)):(t.tag=0,so&&v&&GI(t),ua(null,t,g,s),t=t.child),t;case 16:h=t.elementType;e:{switch(_S(n,t),n=t.pendingProps,g=h._init,h=g(h._payload),t.type=h,g=t.tag=J9(h),n=pc(h,n),g){case 0:t=lC(null,t,h,n,s);break e;case 1:t=fF(null,t,h,n,s);break e;case 11:t=dF(null,t,h,n,s);break e;case 14:t=hF(null,t,h,pc(h.type,n),s);break e}throw Error(Qt(306,h,""))}return t;case 0:return h=t.type,g=t.pendingProps,g=t.elementType===h?g:pc(h,g),lC(n,t,h,g,s);case 1:return h=t.type,g=t.pendingProps,g=t.elementType===h?g:pc(h,g),fF(n,t,h,g,s);case 3:e:{if(DN(t),n===null)throw Error(Qt(387));h=t.pendingProps,v=t.memoizedState,g=v.element,oN(n,t),ZS(t,h,null,s);var E=t.memoizedState;if(h=E.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},t.updateQueue.baseState=v,t.memoizedState=v,t.flags&256){g=A_(Error(Qt(423)),t),t=pF(n,t,h,s,g);break e}else if(h!==g){g=A_(Error(Qt(424)),t),t=pF(n,t,h,s,g);break e}else for(ll=Vh(t.stateNode.containerInfo.firstChild),cl=t,so=!0,yc=null,s=rN(t,null,h,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(T_(),h===g){t=gd(n,t,s);break e}ua(n,t,h,s)}t=t.child}return t;case 5:return sN(t),n===null&&rC(t),h=t.type,g=t.pendingProps,v=n!==null?n.memoizedProps:null,E=g.children,QA(h,g)?E=null:v!==null&&QA(h,v)&&(t.flags|=32),PN(n,t),ua(n,t,E,s),t.child;case 6:return n===null&&rC(t),null;case 13:return RN(n,t,s);case 4:return YI(t,t.stateNode.containerInfo),h=t.pendingProps,n===null?t.child=E_(t,null,h,s):ua(n,t,h,s),t.child;case 11:return h=t.type,g=t.pendingProps,g=t.elementType===h?g:pc(h,g),dF(n,t,h,g,s);case 7:return ua(n,t,t.pendingProps,s),t.child;case 8:return ua(n,t,t.pendingProps.children,s),t.child;case 12:return ua(n,t,t.pendingProps.children,s),t.child;case 10:e:{if(h=t.type._context,g=t.pendingProps,v=t.memoizedProps,E=g.value,zi(WS,h._currentValue),h._currentValue=E,v!==null)if(bc(v.value,E)){if(v.children===g.children&&!La.current){t=gd(n,t,s);break e}}else for(v=t.child,v!==null&&(v.return=t);v!==null;){var c=v.dependencies;if(c!==null){E=v.child;for(var T=c.firstContext;T!==null;){if(T.context===h){if(v.tag===1){T=ud(-1,s&-s),T.tag=2;var L=v.updateQueue;if(L!==null){L=L.shared;var B=L.pending;B===null?T.next=T:(T.next=B.next,B.next=T),L.pending=T}}v.lanes|=s,T=v.alternate,T!==null&&(T.lanes|=s),iC(v.return,s,t),c.lanes|=s;break}T=T.next}}else if(v.tag===10)E=v.type===t.type?null:v.child;else if(v.tag===18){if(E=v.return,E===null)throw Error(Qt(341));E.lanes|=s,c=E.alternate,c!==null&&(c.lanes|=s),iC(E,s,t),E=v.sibling}else E=v.child;if(E!==null)E.return=v;else for(E=v;E!==null;){if(E===t){E=null;break}if(v=E.sibling,v!==null){v.return=E.return,E=v;break}E=E.return}v=E}ua(n,t,g.children,s),t=t.child}return t;case 9:return g=t.type,h=t.pendingProps.children,l_(t,s),g=Gl(g),h=h(g),t.flags|=1,ua(n,t,h,s),t.child;case 14:return h=t.type,g=pc(h,t.pendingProps),g=pc(h.type,g),hF(n,t,h,g,s);case 15:return IN(n,t,t.type,t.pendingProps,s);case 17:return h=t.type,g=t.pendingProps,g=t.elementType===h?g:pc(h,g),_S(n,t),t.tag=1,Oa(h)?(n=!0,GS(t)):n=!1,l_(t,s),kN(t,h,g),sC(t,h,g,s),cC(null,t,h,!0,n,s);case 19:return LN(n,t,s);case 22:return MN(n,t,s)}throw Error(Qt(156,t.tag))};function KN(n,t){return S5(n,t)}function Q9(n,t,s,h){this.tag=n,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jl(n,t,s,h){return new Q9(n,t,s,h)}function hM(n){return n=n.prototype,!(!n||!n.isReactComponent)}function J9(n){if(typeof n=="function")return hM(n)?1:0;if(n!=null){if(n=n.$$typeof,n===PI)return 11;if(n===DI)return 14}return 2}function $h(n,t){var s=n.alternate;return s===null?(s=jl(n.tag,t,n.key,n.mode),s.elementType=n.elementType,s.type=n.type,s.stateNode=n.stateNode,s.alternate=n,n.alternate=s):(s.pendingProps=t,s.type=n.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=n.flags&14680064,s.childLanes=n.childLanes,s.lanes=n.lanes,s.child=n.child,s.memoizedProps=n.memoizedProps,s.memoizedState=n.memoizedState,s.updateQueue=n.updateQueue,t=n.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=n.sibling,s.index=n.index,s.ref=n.ref,s}function xS(n,t,s,h,g,v){var E=2;if(h=n,typeof n=="function")hM(n)&&(E=1);else if(typeof n=="string")E=5;else e:switch(n){case Ug:return Vp(s.children,g,v,t);case MI:E=8,g|=8;break;case MA:return n=jl(12,s,t,g|2),n.elementType=MA,n.lanes=v,n;case PA:return n=jl(13,s,t,g),n.elementType=PA,n.lanes=v,n;case DA:return n=jl(19,s,t,g),n.elementType=DA,n.lanes=v,n;case s5:return VT(s,g,v,t);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case i5:E=10;break e;case o5:E=9;break e;case PI:E=11;break e;case DI:E=14;break e;case wh:E=16,h=null;break e}throw Error(Qt(130,n==null?n:typeof n,""))}return t=jl(E,s,t,g),t.elementType=n,t.type=h,t.lanes=v,t}function Vp(n,t,s,h){return n=jl(7,n,h,t),n.lanes=s,n}function VT(n,t,s,h){return n=jl(22,n,h,t),n.elementType=s5,n.lanes=s,n.stateNode={isHidden:!1},n}function Kk(n,t,s){return n=jl(6,n,null,t),n.lanes=s,n}function Yk(n,t,s){return t=jl(4,n.children!==null?n.children:[],n.key,t),t.lanes=s,t.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},t}function e7(n,t,s,h,g){this.tag=t,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pk(0),this.expirationTimes=Pk(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pk(0),this.identifierPrefix=h,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function fM(n,t,s,h,g,v,E,c,T){return n=new e7(n,t,s,c,T),t===1?(t=1,v===!0&&(t|=8)):t=0,v=jl(3,null,null,t),n.current=v,v.stateNode=n,v.memoizedState={element:h,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},KI(v),n}function t7(n,t,s){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:jg,key:h==null?null:""+h,children:n,containerInfo:t,implementation:s}}function YN(n){if(!n)return Zh;n=n._reactInternals;e:{if(Jp(n)!==n||n.tag!==1)throw Error(Qt(170));var t=n;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Oa(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Qt(171))}if(n.tag===1){var s=n.type;if(Oa(s))return Y5(n,s,t)}return t}function QN(n,t,s,h,g,v,E,c,T){return n=fM(s,h,!0,n,g,v,E,c,T),n.context=YN(null),s=n.current,h=ha(),g=Gh(s),v=ud(h,g),v.callback=t??null,jh(s,v,g),n.current.lanes=g,jx(n,g,h),Fa(n,h),n}function jT(n,t,s,h){var g=t.current,v=ha(),E=Gh(g);return s=YN(s),t.context===null?t.context=s:t.pendingContext=s,t=ud(v,E),t.payload={element:n},h=h===void 0?null:h,h!==null&&(t.callback=h),n=jh(g,t,E),n!==null&&(xc(n,g,E,v),pS(n,g,E)),E}function nT(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function TF(n,t){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var s=n.retryLane;n.retryLane=s!==0&&s<t?s:t}}function pM(n,t){TF(n,t),(n=n.alternate)&&TF(n,t)}function n7(){return null}var JN=typeof reportError=="function"?reportError:function(n){console.error(n)};function mM(n){this._internalRoot=n}UT.prototype.render=mM.prototype.render=function(n){var t=this._internalRoot;if(t===null)throw Error(Qt(409));jT(n,t,null,null)};UT.prototype.unmount=mM.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var t=n.containerInfo;Xp(function(){jT(null,n,null,null)}),t[pd]=null}};function UT(n){this._internalRoot=n}UT.prototype.unstable_scheduleHydration=function(n){if(n){var t=M5();n={blockedOn:null,target:n,priority:t};for(var s=0;s<Eh.length&&t!==0&&t<Eh[s].priority;s++);Eh.splice(s,0,n),s===0&&D5(n)}};function gM(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function GT(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function EF(){}function r7(n,t,s,h,g){if(g){if(typeof h=="function"){var v=h;h=function(){var L=nT(E);v.call(L)}}var E=QN(t,h,n,0,null,!1,!1,"",EF);return n._reactRootContainer=E,n[pd]=E.current,dx(n.nodeType===8?n.parentNode:n),Xp(),E}for(;g=n.lastChild;)n.removeChild(g);if(typeof h=="function"){var c=h;h=function(){var L=nT(T);c.call(L)}}var T=fM(n,0,!1,null,null,!1,!1,"",EF);return n._reactRootContainer=T,n[pd]=T.current,dx(n.nodeType===8?n.parentNode:n),Xp(function(){jT(t,T,s,h)}),T}function $T(n,t,s,h,g){var v=s._reactRootContainer;if(v){var E=v;if(typeof g=="function"){var c=g;g=function(){var T=nT(E);c.call(T)}}jT(t,E,n,g)}else E=r7(s,t,n,g,h);return nT(E)}C5=function(n){switch(n.tag){case 3:var t=n.stateNode;if(t.current.memoizedState.isDehydrated){var s=F0(t.pendingLanes);s!==0&&(OI(t,s|1),Fa(t,Oo()),!(Jr&6)&&(C_=Oo()+500,rf()))}break;case 13:Xp(function(){var h=md(n,1);if(h!==null){var g=ha();xc(h,n,1,g)}}),pM(n,1)}};FI=function(n){if(n.tag===13){var t=md(n,134217728);if(t!==null){var s=ha();xc(t,n,134217728,s)}pM(n,134217728)}};I5=function(n){if(n.tag===13){var t=Gh(n),s=md(n,t);if(s!==null){var h=ha();xc(s,n,t,h)}pM(n,t)}};M5=function(){return xi};P5=function(n,t){var s=xi;try{return xi=n,t()}finally{xi=s}};UA=function(n,t,s){switch(t){case"input":if(OA(n,s),t=s.name,s.type==="radio"&&t!=null){for(s=n;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var h=s[t];if(h!==n&&h.form===n.form){var g=LT(h);if(!g)throw Error(Qt(90));l5(h),OA(h,g)}}}break;case"textarea":u5(n,s);break;case"select":t=s.value,t!=null&&i_(n,!!s.multiple,t,!1)}};_5=cM;y5=Xp;var i7={usingClientEntryPoint:!1,Events:[Gx,Wg,LT,m5,g5,cM]},A0={findFiberByHostInstance:Ip,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},o7={bundleType:A0.bundleType,version:A0.version,rendererPackageName:A0.rendererPackageName,rendererConfig:A0.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:bd.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=b5(n),n===null?null:n.stateNode},findFiberByHostInstance:A0.findFiberByHostInstance||n7,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $w=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$w.isDisabled&&$w.supportsFiber)try{MT=$w.inject(o7),gu=$w}catch{}}ml.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i7;ml.createPortal=function(n,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gM(t))throw Error(Qt(200));return t7(n,t,null,s)};ml.createRoot=function(n,t){if(!gM(n))throw Error(Qt(299));var s=!1,h="",g=JN;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(h=t.identifierPrefix),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=fM(n,1,!1,null,null,s,!1,h,g),n[pd]=t.current,dx(n.nodeType===8?n.parentNode:n),new mM(t)};ml.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var t=n._reactInternals;if(t===void 0)throw typeof n.render=="function"?Error(Qt(188)):(n=Object.keys(n).join(","),Error(Qt(268,n)));return n=b5(t),n=n===null?null:n.stateNode,n};ml.flushSync=function(n){return Xp(n)};ml.hydrate=function(n,t,s){if(!GT(t))throw Error(Qt(200));return $T(null,n,t,!0,s)};ml.hydrateRoot=function(n,t,s){if(!gM(n))throw Error(Qt(405));var h=s!=null&&s.hydratedSources||null,g=!1,v="",E=JN;if(s!=null&&(s.unstable_strictMode===!0&&(g=!0),s.identifierPrefix!==void 0&&(v=s.identifierPrefix),s.onRecoverableError!==void 0&&(E=s.onRecoverableError)),t=QN(t,null,n,1,s??null,g,!1,v,E),n[pd]=t.current,dx(n),h)for(n=0;n<h.length;n++)s=h[n],g=s._getVersion,g=g(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,g]:t.mutableSourceEagerHydrationData.push(s,g);return new UT(t)};ml.render=function(n,t,s){if(!GT(t))throw Error(Qt(200));return $T(null,n,t,!1,s)};ml.unmountComponentAtNode=function(n){if(!GT(n))throw Error(Qt(40));return n._reactRootContainer?(Xp(function(){$T(null,null,n,!1,function(){n._reactRootContainer=null,n[pd]=null})}),!0):!1};ml.unstable_batchedUpdates=cM;ml.unstable_renderSubtreeIntoContainer=function(n,t,s,h){if(!GT(s))throw Error(Qt(200));if(n==null||n._reactInternals===void 0)throw Error(Qt(38));return $T(n,t,s,!1,h)};ml.version="18.3.1-next-f1338f8080-20240426";function e4(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e4)}catch(n){console.error(n)}}e4(),e5.exports=ml;var G_=e5.exports;const s7=wI(G_);var t4,kF=G_;t4=kF.createRoot,kF.hydrateRoot;const a7=1,l7=1e6;let Qk=0;function c7(){return Qk=(Qk+1)%Number.MAX_SAFE_INTEGER,Qk.toString()}const Jk=new Map,AF=n=>{if(Jk.has(n))return;const t=setTimeout(()=>{Jk.delete(n),Y0({type:"REMOVE_TOAST",toastId:n})},l7);Jk.set(n,t)},u7=(n,t)=>{switch(t.type){case"ADD_TOAST":return{...n,toasts:[t.toast,...n.toasts].slice(0,a7)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;return s?AF(s):n.toasts.forEach(h=>{AF(h.id)}),{...n,toasts:n.toasts.map(h=>h.id===s||s===void 0?{...h,open:!1}:h)}}case"REMOVE_TOAST":return t.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(s=>s.id!==t.toastId)}}},bS=[];let wS={toasts:[]};function Y0(n){wS=u7(wS,n),bS.forEach(t=>{t(wS)})}function d7({...n}){const t=c7(),s=g=>Y0({type:"UPDATE_TOAST",toast:{...g,id:t}}),h=()=>Y0({type:"DISMISS_TOAST",toastId:t});return Y0({type:"ADD_TOAST",toast:{...n,id:t,open:!0,onOpenChange:g=>{g||h()}}}),{id:t,dismiss:h,update:s}}function h7(){const[n,t]=Y.useState(wS);return Y.useEffect(()=>(bS.push(t),()=>{const s=bS.indexOf(t);s>-1&&bS.splice(s,1)}),[n]),{...n,toast:d7,dismiss:s=>Y0({type:"DISMISS_TOAST",toastId:s})}}function hi(n,t,{checkForDefaultPrevented:s=!0}={}){return function(g){if(n==null||n(g),s===!1||!g.defaultPrevented)return t==null?void 0:t(g)}}function CF(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function f7(...n){return t=>{let s=!1;const h=n.map(g=>{const v=CF(g,t);return!s&&typeof v=="function"&&(s=!0),v});if(s)return()=>{for(let g=0;g<h.length;g++){const v=h[g];typeof v=="function"?v():CF(n[g],null)}}}}function $o(...n){return Y.useCallback(f7(...n),n)}function $_(n,t=[]){let s=[];function h(v,E){const c=Y.createContext(E);c.displayName=v+"Context";const T=s.length;s=[...s,E];const L=U=>{var oe;const{scope:H,children:X,...ae}=U,ne=((oe=H==null?void 0:H[n])==null?void 0:oe[T])||c,me=Y.useMemo(()=>ae,Object.values(ae));return ue.jsx(ne.Provider,{value:me,children:X})};L.displayName=v+"Provider";function B(U,H){var ne;const X=((ne=H==null?void 0:H[n])==null?void 0:ne[T])||c,ae=Y.useContext(X);if(ae)return ae;if(E!==void 0)return E;throw new Error(`\`${U}\` must be used within \`${v}\``)}return[L,B]}const g=()=>{const v=s.map(E=>Y.createContext(E));return function(c){const T=(c==null?void 0:c[n])||v;return Y.useMemo(()=>({[`__scope${n}`]:{...c,[n]:T}}),[c,T])}};return g.scopeName=n,[h,p7(g,...t)]}function p7(...n){const t=n[0];if(n.length===1)return t;const s=()=>{const h=n.map(g=>({useScope:g(),scopeName:g.scopeName}));return function(v){const E=h.reduce((c,{useScope:T,scopeName:L})=>{const U=T(v)[`__scope${L}`];return{...c,...U}},{});return Y.useMemo(()=>({[`__scope${t.scopeName}`]:E}),[E])}};return s.scopeName=t.scopeName,s}function xx(n){const t=Y.forwardRef((s,h)=>{let{children:g,...v}=s,E=null,c=!1;const T=[];IF(g)&&typeof Hw=="function"&&(g=Hw(g._payload)),Y.Children.forEach(g,H=>{var X;if(x7(H)){c=!0;const ae=H;let ne="child"in ae.props?ae.props.child:ae.props.children;IF(ne)&&typeof Hw=="function"&&(ne=Hw(ne._payload)),E=_7(ae,ne),T.push((X=E==null?void 0:E.props)==null?void 0:X.children)}else T.push(H)}),E?E=Y.cloneElement(E,void 0,T):!c&&Y.Children.count(g)===1&&Y.isValidElement(g)&&(E=g);const L=E?v7(E):void 0,B=$o(h,L);if(!E){if(g||g===0)throw new Error(c?T7(n):S7(n));return g}const U=y7(v,E.props??{});return E.type!==Y.Fragment&&(U.ref=h?B:L),Y.cloneElement(E,U)});return t.displayName=`${n}.Slot`,t}var m7=xx("Slot"),n4=Symbol.for("radix.slottable");function g7(n){const t=s=>"child"in s?s.children(s.child):s.children;return t.displayName=`${n}.Slottable`,t.__radixId=n4,t}var _7=(n,t)=>{if("child"in n.props){const s=n.props.child;return Y.isValidElement(s)?Y.cloneElement(s,void 0,n.props.children(s.props.children)):null}return Y.isValidElement(t)?t:null};function y7(n,t){const s={...t};for(const h in t){const g=n[h],v=t[h];/^on[A-Z]/.test(h)?g&&v?s[h]=(...c)=>{const T=v(...c);return g(...c),T}:g&&(s[h]=g):h==="style"?s[h]={...g,...v}:h==="className"&&(s[h]=[g,v].filter(Boolean).join(" "))}return{...n,...s}}function v7(n){var h,g;let t=(h=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:h.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?n.ref:(t=(g=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:g.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}function x7(n){return Y.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===n4}var b7=Symbol.for("react.lazy");function IF(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===b7&&"_payload"in n&&w7(n._payload)}function w7(n){return typeof n=="object"&&n!==null&&"then"in n}var S7=n=>`${n} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,T7=n=>`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Hw=IT[" use ".trim().toString()];function r4(n){const t=n+"CollectionProvider",[s,h]=$_(t),[g,v]=s(t,{collectionRef:{current:null},itemMap:new Map}),E=ne=>{const{scope:me,children:oe}=ne,re=Y.useRef(null),he=Y.useRef(new Map).current;return ue.jsx(g,{scope:me,itemMap:he,collectionRef:re,children:oe})};E.displayName=t;const c=n+"CollectionSlot",T=xx(c),L=Y.forwardRef((ne,me)=>{const{scope:oe,children:re}=ne,he=v(c,oe),_e=$o(me,he.collectionRef);return ue.jsx(T,{ref:_e,children:re})});L.displayName=c;const B=n+"CollectionItemSlot",U="data-radix-collection-item",H=xx(B),X=Y.forwardRef((ne,me)=>{const{scope:oe,children:re,...he}=ne,_e=Y.useRef(null),De=$o(me,_e),He=v(B,oe);return Y.useEffect(()=>(He.itemMap.set(_e,{ref:_e,...he}),()=>void He.itemMap.delete(_e))),ue.jsx(H,{[U]:"",ref:De,children:re})});X.displayName=B;function ae(ne){const me=v(n+"CollectionConsumer",ne);return Y.useCallback(()=>{const re=me.collectionRef.current;if(!re)return[];const he=Array.from(re.querySelectorAll(`[${U}]`));return Array.from(me.itemMap.values()).sort((He,nt)=>he.indexOf(He.ref.current)-he.indexOf(nt.ref.current))},[me.collectionRef,me.itemMap])}return[{Provider:E,Slot:L,ItemSlot:X},ae,h]}var E7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bi=E7.reduce((n,t)=>{const s=xx(`Primitive.${t}`),h=Y.forwardRef((g,v)=>{const{asChild:E,...c}=g,T=E?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ue.jsx(T,{...c,ref:v})});return h.displayName=`Primitive.${t}`,{...n,[t]:h}},{});function i4(n,t){n&&G_.flushSync(()=>n.dispatchEvent(t))}function Su(n){const t=Y.useRef(n);return Y.useEffect(()=>{t.current=n}),Y.useMemo(()=>(...s)=>{var h;return(h=t.current)==null?void 0:h.call(t,...s)},[])}function k7(n,t=globalThis==null?void 0:globalThis.document){const s=Su(n);Y.useEffect(()=>{const h=g=>{g.key==="Escape"&&s(g)};return t.addEventListener("keydown",h,{capture:!0}),()=>t.removeEventListener("keydown",h,{capture:!0})},[s,t])}var A7="DismissableLayer",bC="dismissableLayer.update",C7="dismissableLayer.pointerDownOutside",I7="dismissableLayer.focusOutside",MF,_M=Y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),HT=Y.forwardRef((n,t)=>{const{disableOutsidePointerEvents:s=!1,deferPointerDownOutside:h=!1,onEscapeKeyDown:g,onPointerDownOutside:v,onFocusOutside:E,onInteractOutside:c,onDismiss:T,...L}=n,B=Y.useContext(_M),[U,H]=Y.useState(null),X=(U==null?void 0:U.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,ae]=Y.useState({}),ne=$o(t,ft=>H(ft)),me=Array.from(B.layers),[oe]=[...B.layersWithOutsidePointerEventsDisabled].slice(-1),re=me.indexOf(oe),he=U?me.indexOf(U):-1,_e=B.layersWithOutsidePointerEventsDisabled.size>0,De=he>=re,He=Y.useRef(!1),nt=D7(ft=>{const At=ft.target;if(!(At instanceof Node))return;const Bt=[...B.branches].some(Dt=>Dt.contains(At));!De||Bt||(v==null||v(ft),c==null||c(ft),ft.defaultPrevented||T==null||T())},{ownerDocument:X,deferPointerDownOutside:h,isDeferredPointerDownOutsideRef:He,dismissableSurfaces:B.dismissableSurfaces}),Xe=R7(ft=>{if(h&&He.current)return;const At=ft.target;[...B.branches].some(Dt=>Dt.contains(At))||(E==null||E(ft),c==null||c(ft),ft.defaultPrevented||T==null||T())},X);return k7(ft=>{he===B.layers.size-1&&(g==null||g(ft),!ft.defaultPrevented&&T&&(ft.preventDefault(),T()))},X),Y.useEffect(()=>{if(U)return s&&(B.layersWithOutsidePointerEventsDisabled.size===0&&(MF=X.body.style.pointerEvents,X.body.style.pointerEvents="none"),B.layersWithOutsidePointerEventsDisabled.add(U)),B.layers.add(U),PF(),()=>{s&&(B.layersWithOutsidePointerEventsDisabled.delete(U),B.layersWithOutsidePointerEventsDisabled.size===0&&(X.body.style.pointerEvents=MF))}},[U,X,s,B]),Y.useEffect(()=>()=>{U&&(B.layers.delete(U),B.layersWithOutsidePointerEventsDisabled.delete(U),PF())},[U,B]),Y.useEffect(()=>{const ft=()=>ae({});return document.addEventListener(bC,ft),()=>document.removeEventListener(bC,ft)},[]),ue.jsx(Bi.div,{...L,ref:ne,style:{pointerEvents:_e?De?"auto":"none":void 0,...n.style},onFocusCapture:hi(n.onFocusCapture,Xe.onFocusCapture),onBlurCapture:hi(n.onBlurCapture,Xe.onBlurCapture),onPointerDownCapture:hi(n.onPointerDownCapture,nt.onPointerDownCapture)})});HT.displayName=A7;var M7="DismissableLayerBranch",o4=Y.forwardRef((n,t)=>{const s=Y.useContext(_M),h=Y.useRef(null),g=$o(t,h);return Y.useEffect(()=>{const v=h.current;if(v)return s.branches.add(v),()=>{s.branches.delete(v)}},[s.branches]),ue.jsx(Bi.div,{...n,ref:g})});o4.displayName=M7;function P7(){const n=Y.useContext(_M),[t,s]=Y.useState(null);return Y.useEffect(()=>{if(t)return n.dismissableSurfaces.add(t),()=>{n.dismissableSurfaces.delete(t)}},[t,n.dismissableSurfaces]),s}function D7(n,t){const{ownerDocument:s=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:h=!1,isDeferredPointerDownOutsideRef:g,dismissableSurfaces:v}=t,E=Su(n),c=Y.useRef(!1),T=Y.useRef(!1),L=Y.useRef(new Map),B=Y.useRef(()=>{});return Y.useEffect(()=>{function U(){T.current=!1,g.current=!1,L.current.clear()}function H(){return Array.from(L.current.values()).some(Boolean)}function X(re){if(!T.current)return;const he=re.target;he instanceof Node&&[...v].some(De=>De.contains(he))||L.current.set(re.type,!0),re.type==="click"&&window.setTimeout(()=>{T.current&&B.current()},0)}function ae(re){T.current&&L.current.set(re.type,!1)}const ne=re=>{if(re.target&&!c.current){let he=function(){s.removeEventListener("click",B.current);const De=H();U(),De||s4(C7,E,_e,{discrete:!0})};const _e={originalEvent:re};T.current=!0,g.current=h&&re.button===0,L.current.clear(),!h||re.button!==0?he():(s.removeEventListener("click",B.current),B.current=he,s.addEventListener("click",B.current,{once:!0}))}else s.removeEventListener("click",B.current),U();c.current=!1},me=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const re of me)s.addEventListener(re,X,!0),s.addEventListener(re,ae);const oe=window.setTimeout(()=>{s.addEventListener("pointerdown",ne)},0);return()=>{window.clearTimeout(oe),s.removeEventListener("pointerdown",ne),s.removeEventListener("click",B.current);for(const re of me)s.removeEventListener(re,X,!0),s.removeEventListener(re,ae)}},[s,E,h,g,v]),{onPointerDownCapture:()=>c.current=!0}}function R7(n,t=globalThis==null?void 0:globalThis.document){const s=Su(n),h=Y.useRef(!1);return Y.useEffect(()=>{const g=v=>{v.target&&!h.current&&s4(I7,s,{originalEvent:v},{discrete:!1})};return t.addEventListener("focusin",g),()=>t.removeEventListener("focusin",g)},[t,s]),{onFocusCapture:()=>h.current=!0,onBlurCapture:()=>h.current=!1}}function PF(){const n=new CustomEvent(bC);document.dispatchEvent(n)}function s4(n,t,s,{discrete:h}){const g=s.originalEvent.target,v=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:s});t&&g.addEventListener(n,t,{once:!0}),h?i4(g,v):g.dispatchEvent(v)}var L7=HT,O7=o4,yu=globalThis!=null&&globalThis.document?Y.useLayoutEffect:()=>{},F7="Portal",yM=Y.forwardRef((n,t)=>{var c;const{container:s,...h}=n,[g,v]=Y.useState(!1);yu(()=>v(!0),[]);const E=s||g&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return E?G_.createPortal(ue.jsx(Bi.div,{...h,ref:t}),E):null});yM.displayName=F7;function z7(n,t){return Y.useReducer((s,h)=>t[s][h]??s,n)}var H_=n=>{const{present:t,children:s}=n,h=B7(t),g=typeof s=="function"?s({present:h.isPresent}):Y.Children.only(s),v=N7(h.ref,V7(g));return typeof s=="function"||h.isPresent?Y.cloneElement(g,{ref:v}):null};H_.displayName="Presence";function B7(n){const[t,s]=Y.useState(),h=Y.useRef(null),g=Y.useRef(n),v=Y.useRef("none"),E=n?"mounted":"unmounted",[c,T]=z7(E,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Y.useEffect(()=>{const L=Ww(h.current);v.current=c==="mounted"?L:"none"},[c]),yu(()=>{const L=h.current,B=g.current;if(B!==n){const H=v.current,X=Ww(L);n?T("MOUNT"):X==="none"||(L==null?void 0:L.display)==="none"?T("UNMOUNT"):T(B&&H!==X?"ANIMATION_OUT":"UNMOUNT"),g.current=n}},[n,T]),yu(()=>{if(t){let L;const B=t.ownerDocument.defaultView??window,U=X=>{const ne=Ww(h.current).includes(CSS.escape(X.animationName));if(X.target===t&&ne&&(T("ANIMATION_END"),!g.current)){const me=t.style.animationFillMode;t.style.animationFillMode="forwards",L=B.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=me)})}},H=X=>{X.target===t&&(v.current=Ww(h.current))};return t.addEventListener("animationstart",H),t.addEventListener("animationcancel",U),t.addEventListener("animationend",U),()=>{B.clearTimeout(L),t.removeEventListener("animationstart",H),t.removeEventListener("animationcancel",U),t.removeEventListener("animationend",U)}}else T("ANIMATION_END")},[t,T]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:Y.useCallback(L=>{h.current=L?getComputedStyle(L):null,s(L)},[])}}function DF(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function N7(...n){const t=Y.useRef(n);return t.current=n,Y.useCallback(s=>{const h=t.current;let g=!1;const v=h.map(E=>{const c=DF(E,s);return!g&&typeof c=="function"&&(g=!0),c});if(g)return()=>{for(let E=0;E<v.length;E++){const c=v[E];typeof c=="function"?c():DF(h[E],null)}}},[])}function Ww(n){return(n==null?void 0:n.animationName)||"none"}function V7(n){var h,g;let t=(h=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:h.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?n.ref:(t=(g=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:g.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}var j7=IT[" useInsertionEffect ".trim().toString()]||yu;function WT({prop:n,defaultProp:t,onChange:s=()=>{},caller:h}){const[g,v,E]=U7({defaultProp:t,onChange:s}),c=n!==void 0,T=c?n:g;{const B=Y.useRef(n!==void 0);Y.useEffect(()=>{const U=B.current;U!==c&&console.warn(`${h} is changing from ${U?"controlled":"uncontrolled"} to ${c?"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.`),B.current=c},[c,h])}const L=Y.useCallback(B=>{var U;if(c){const H=G7(B)?B(n):B;H!==n&&((U=E.current)==null||U.call(E,H))}else v(B)},[c,n,v,E]);return[T,L]}function U7({defaultProp:n,onChange:t}){const[s,h]=Y.useState(n),g=Y.useRef(s),v=Y.useRef(t);return j7(()=>{v.current=t},[t]),Y.useEffect(()=>{var E;g.current!==s&&((E=v.current)==null||E.call(v,s),g.current=s)},[s,g]),[s,h,v]}function G7(n){return typeof n=="function"}var $7=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"}),H7="VisuallyHidden",qT=Y.forwardRef((n,t)=>ue.jsx(Bi.span,{...n,ref:t,style:{...$7,...n.style}}));qT.displayName=H7;var W7=qT,vM="ToastProvider",[xM,q7,Z7]=r4("Toast"),[a4]=$_("Toast",[Z7]),[X7,ZT]=a4(vM),l4=n=>{const{__scopeToast:t,label:s="Notification",duration:h=5e3,swipeDirection:g="right",swipeThreshold:v=50,announcerContainer:E,children:c}=n,[T,L]=Y.useState(null),[B,U]=Y.useState(0),H=Y.useRef(!1),X=Y.useRef(!1);return s.trim()||console.error(`Invalid prop \`label\` supplied to \`${vM}\`. Expected non-empty \`string\`.`),ue.jsx(xM.Provider,{scope:t,children:ue.jsx(X7,{scope:t,label:s,duration:h,swipeDirection:g,swipeThreshold:v,toastCount:B,viewport:T,onViewportChange:L,onToastAdd:Y.useCallback(()=>U(ae=>ae+1),[]),onToastRemove:Y.useCallback(()=>U(ae=>ae-1),[]),isFocusedToastEscapeKeyDownRef:H,isClosePausedRef:X,announcerContainer:E,children:c})})};l4.displayName=vM;var c4="ToastViewport",K7=["F8"],wC="toast.viewportPause",SC="toast.viewportResume",u4=Y.forwardRef((n,t)=>{const{__scopeToast:s,hotkey:h=K7,label:g="Notifications ({hotkey})",...v}=n,E=ZT(c4,s),c=q7(s),T=Y.useRef(null),L=Y.useRef(null),B=Y.useRef(null),U=Y.useRef(null),H=$o(t,U,E.onViewportChange),X=h.join("+").replace(/Key/g,"").replace(/Digit/g,""),ae=E.toastCount>0;Y.useEffect(()=>{const me=oe=>{var he;h.length!==0&&h.every(_e=>oe[_e]||oe.code===_e)&&((he=U.current)==null||he.focus())};return document.addEventListener("keydown",me),()=>document.removeEventListener("keydown",me)},[h]),Y.useEffect(()=>{const me=T.current,oe=U.current;if(ae&&me&&oe){const re=()=>{if(!E.isClosePausedRef.current){const He=new CustomEvent(wC);oe.dispatchEvent(He),E.isClosePausedRef.current=!0}},he=()=>{if(E.isClosePausedRef.current){const He=new CustomEvent(SC);oe.dispatchEvent(He),E.isClosePausedRef.current=!1}},_e=He=>{!me.contains(He.relatedTarget)&&he()},De=()=>{me.contains(document.activeElement)||he()};return me.addEventListener("focusin",re),me.addEventListener("focusout",_e),me.addEventListener("pointermove",re),me.addEventListener("pointerleave",De),window.addEventListener("blur",re),window.addEventListener("focus",he),()=>{me.removeEventListener("focusin",re),me.removeEventListener("focusout",_e),me.removeEventListener("pointermove",re),me.removeEventListener("pointerleave",De),window.removeEventListener("blur",re),window.removeEventListener("focus",he)}}},[ae,E.isClosePausedRef]);const ne=Y.useCallback(({tabbingDirection:me})=>{const re=c().map(he=>{const _e=he.ref.current,De=[_e,...cW(_e)];return me==="forwards"?De:De.reverse()});return(me==="forwards"?re.reverse():re).flat()},[c]);return Y.useEffect(()=>{const me=U.current;if(me){const oe=re=>{var De,He,nt;const he=re.altKey||re.ctrlKey||re.metaKey;if(re.key==="Tab"&&!he){const Xe=document.activeElement,ft=re.shiftKey;if(re.target===me&&ft){(De=L.current)==null||De.focus();return}const Dt=ne({tabbingDirection:ft?"backwards":"forwards"}),It=Dt.findIndex(kt=>kt===Xe);eA(Dt.slice(It+1))?re.preventDefault():ft?(He=L.current)==null||He.focus():(nt=B.current)==null||nt.focus()}};return me.addEventListener("keydown",oe),()=>me.removeEventListener("keydown",oe)}},[c,ne]),ue.jsxs(O7,{ref:T,role:"region","aria-label":g.replace("{hotkey}",X),tabIndex:-1,style:{pointerEvents:ae?void 0:"none"},children:[ae&&ue.jsx(TC,{ref:L,onFocusFromOutsideViewport:()=>{const me=ne({tabbingDirection:"forwards"});eA(me)}}),ue.jsx(xM.Slot,{scope:s,children:ue.jsx(Bi.ol,{tabIndex:-1,...v,ref:H})}),ae&&ue.jsx(TC,{ref:B,onFocusFromOutsideViewport:()=>{const me=ne({tabbingDirection:"backwards"});eA(me)}})]})});u4.displayName=c4;var d4="ToastFocusProxy",TC=Y.forwardRef((n,t)=>{const{__scopeToast:s,onFocusFromOutsideViewport:h,...g}=n,v=ZT(d4,s);return ue.jsx(qT,{tabIndex:0,...g,ref:t,style:{position:"fixed"},onFocus:E=>{var L;const c=E.relatedTarget;!((L=v.viewport)!=null&&L.contains(c))&&h()}})});TC.displayName=d4;var Hx="Toast",Y7="toast.swipeStart",Q7="toast.swipeMove",J7="toast.swipeCancel",eW="toast.swipeEnd",h4=Y.forwardRef((n,t)=>{const{forceMount:s,open:h,defaultOpen:g,onOpenChange:v,...E}=n,[c,T]=WT({prop:h,defaultProp:g??!0,onChange:v,caller:Hx});return ue.jsx(H_,{present:s||c,children:ue.jsx(rW,{open:c,...E,ref:t,onClose:()=>T(!1),onPause:Su(n.onPause),onResume:Su(n.onResume),onSwipeStart:hi(n.onSwipeStart,L=>{L.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:hi(n.onSwipeMove,L=>{const{x:B,y:U}=L.detail.delta;L.currentTarget.setAttribute("data-swipe","move"),L.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${B}px`),L.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${U}px`)}),onSwipeCancel:hi(n.onSwipeCancel,L=>{L.currentTarget.setAttribute("data-swipe","cancel"),L.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),L.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),L.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),L.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:hi(n.onSwipeEnd,L=>{const{x:B,y:U}=L.detail.delta;L.currentTarget.setAttribute("data-swipe","end"),L.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),L.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),L.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${B}px`),L.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${U}px`),T(!1)})})})});h4.displayName=Hx;var[tW,nW]=a4(Hx,{onClose(){}}),rW=Y.forwardRef((n,t)=>{const{__scopeToast:s,type:h="foreground",duration:g,open:v,onClose:E,onEscapeKeyDown:c,onPause:T,onResume:L,onSwipeStart:B,onSwipeMove:U,onSwipeCancel:H,onSwipeEnd:X,...ae}=n,ne=ZT(Hx,s),[me,oe]=Y.useState(null),re=$o(t,kt=>oe(kt)),he=Y.useRef(null),_e=Y.useRef(null),De=g||ne.duration,He=Y.useRef(0),nt=Y.useRef(De),Xe=Y.useRef(0),{onToastAdd:ft,onToastRemove:At}=ne,Bt=Su(()=>{var wt;(me==null?void 0:me.contains(document.activeElement))&&((wt=ne.viewport)==null||wt.focus()),E()}),Dt=Y.useCallback(kt=>{!kt||kt===1/0||(window.clearTimeout(Xe.current),He.current=new Date().getTime(),Xe.current=window.setTimeout(Bt,kt))},[Bt]);Y.useEffect(()=>{const kt=ne.viewport;if(kt){const wt=()=>{Dt(nt.current),L==null||L()},Zt=()=>{const zt=new Date().getTime()-He.current;nt.current=nt.current-zt,window.clearTimeout(Xe.current),T==null||T()};return kt.addEventListener(wC,Zt),kt.addEventListener(SC,wt),()=>{kt.removeEventListener(wC,Zt),kt.removeEventListener(SC,wt)}}},[ne.viewport,De,T,L,Dt]),Y.useEffect(()=>{v&&!ne.isClosePausedRef.current&&Dt(De)},[v,De,ne.isClosePausedRef,Dt]),Y.useEffect(()=>(ft(),()=>At()),[ft,At]);const It=Y.useMemo(()=>me?v4(me):null,[me]);return ne.viewport?ue.jsxs(ue.Fragment,{children:[It&&ue.jsx(iW,{__scopeToast:s,role:"status","aria-live":h==="foreground"?"assertive":"polite",children:It}),ue.jsx(tW,{scope:s,onClose:Bt,children:G_.createPortal(ue.jsx(xM.ItemSlot,{scope:s,children:ue.jsx(L7,{asChild:!0,onEscapeKeyDown:hi(c,()=>{ne.isFocusedToastEscapeKeyDownRef.current||Bt(),ne.isFocusedToastEscapeKeyDownRef.current=!1}),children:ue.jsx(Bi.li,{tabIndex:0,"data-state":v?"open":"closed","data-swipe-direction":ne.swipeDirection,...ae,ref:re,style:{userSelect:"none",touchAction:"none",...n.style},onKeyDown:hi(n.onKeyDown,kt=>{kt.key==="Escape"&&(c==null||c(kt.nativeEvent),kt.nativeEvent.defaultPrevented||(ne.isFocusedToastEscapeKeyDownRef.current=!0,Bt()))}),onPointerDown:hi(n.onPointerDown,kt=>{kt.button===0&&(he.current={x:kt.clientX,y:kt.clientY})}),onPointerMove:hi(n.onPointerMove,kt=>{if(!he.current)return;const wt=kt.clientX-he.current.x,Zt=kt.clientY-he.current.y,zt=!!_e.current,vt=["left","right"].includes(ne.swipeDirection),pt=["left","up"].includes(ne.swipeDirection)?Math.min:Math.max,Pt=vt?pt(0,wt):0,An=vt?0:pt(0,Zt),bn=kt.pointerType==="touch"?10:2,Vn={x:Pt,y:An},Mn={originalEvent:kt,delta:Vn};zt?(_e.current=Vn,qw(Q7,U,Mn,{discrete:!1})):RF(Vn,ne.swipeDirection,bn)?(_e.current=Vn,qw(Y7,B,Mn,{discrete:!1}),kt.target.setPointerCapture(kt.pointerId)):(Math.abs(wt)>bn||Math.abs(Zt)>bn)&&(he.current=null)}),onPointerUp:hi(n.onPointerUp,kt=>{const wt=_e.current,Zt=kt.target;if(Zt.hasPointerCapture(kt.pointerId)&&Zt.releasePointerCapture(kt.pointerId),_e.current=null,he.current=null,wt){const zt=kt.currentTarget,vt={originalEvent:kt,delta:wt};RF(wt,ne.swipeDirection,ne.swipeThreshold)?qw(eW,X,vt,{discrete:!0}):qw(J7,H,vt,{discrete:!0}),zt.addEventListener("click",pt=>pt.preventDefault(),{once:!0})}})})})}),ne.viewport)})]}):null}),iW=n=>{const{__scopeToast:t,children:s,...h}=n,g=ZT(Hx,t),[v,E]=Y.useState(!1),[c,T]=Y.useState(!1);return aW(()=>E(!0)),Y.useEffect(()=>{const L=window.setTimeout(()=>T(!0),1e3);return()=>window.clearTimeout(L)},[]),c?null:ue.jsx(yM,{asChild:!0,container:g.announcerContainer||void 0,children:ue.jsx(qT,{...h,children:v&&ue.jsxs(ue.Fragment,{children:[g.label," ",s]})})})},oW="ToastTitle",f4=Y.forwardRef((n,t)=>{const{__scopeToast:s,...h}=n;return ue.jsx(Bi.div,{...h,ref:t})});f4.displayName=oW;var sW="ToastDescription",p4=Y.forwardRef((n,t)=>{const{__scopeToast:s,...h}=n;return ue.jsx(Bi.div,{...h,ref:t})});p4.displayName=sW;var m4="ToastAction",g4=Y.forwardRef((n,t)=>{const{altText:s,...h}=n;return s.trim()?ue.jsx(y4,{altText:s,asChild:!0,children:ue.jsx(bM,{...h,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${m4}\`. Expected non-empty \`string\`.`),null)});g4.displayName=m4;var _4="ToastClose",bM=Y.forwardRef((n,t)=>{const{__scopeToast:s,...h}=n,g=nW(_4,s);return ue.jsx(y4,{asChild:!0,children:ue.jsx(Bi.button,{type:"button",...h,ref:t,onClick:hi(n.onClick,g.onClose)})})});bM.displayName=_4;var y4=Y.forwardRef((n,t)=>{const{__scopeToast:s,altText:h,...g}=n;return ue.jsx(Bi.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":h||void 0,...g,ref:t})});function v4(n){const t=[];return Array.from(n.childNodes).forEach(h=>{if(h.nodeType===h.TEXT_NODE&&h.textContent&&t.push(h.textContent),lW(h)){const g=h.ariaHidden||h.hidden||h.style.display==="none",v=h.dataset.radixToastAnnounceExclude==="";if(!g)if(v){const E=h.dataset.radixToastAnnounceAlt;E&&t.push(E)}else t.push(...v4(h))}}),t}function qw(n,t,s,{discrete:h}){const g=s.originalEvent.currentTarget,v=new CustomEvent(n,{bubbles:!0,cancelable:!0,detail:s});t&&g.addEventListener(n,t,{once:!0}),h?i4(g,v):g.dispatchEvent(v)}var RF=(n,t,s=0)=>{const h=Math.abs(n.x),g=Math.abs(n.y),v=h>g;return t==="left"||t==="right"?v&&h>s:!v&&g>s};function aW(n=()=>{}){const t=Su(n);yu(()=>{let s=0,h=0;return s=window.requestAnimationFrame(()=>h=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(h)}},[t])}function lW(n){return n.nodeType===n.ELEMENT_NODE}function cW(n){const t=[],s=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:h=>{const g=h.tagName==="INPUT"&&h.type==="hidden";return h.disabled||h.hidden||g?NodeFilter.FILTER_SKIP:h.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function eA(n){const t=document.activeElement;return n.some(s=>s===t?!0:(s.focus(),document.activeElement!==t))}var uW=l4,x4=u4,b4=h4,w4=f4,S4=p4,T4=g4,E4=bM;function k4(n){var t,s,h="";if(typeof n=="string"||typeof n=="number")h+=n;else if(typeof n=="object")if(Array.isArray(n)){var g=n.length;for(t=0;t<g;t++)n[t]&&(s=k4(n[t]))&&(h&&(h+=" "),h+=s)}else for(s in n)n[s]&&(h&&(h+=" "),h+=s);return h}function A4(){for(var n,t,s=0,h="",g=arguments.length;s<g;s++)(n=arguments[s])&&(t=k4(n))&&(h&&(h+=" "),h+=t);return h}const LF=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,OF=A4,wM=(n,t)=>s=>{var h;if((t==null?void 0:t.variants)==null)return OF(n,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:g,defaultVariants:v}=t,E=Object.keys(g).map(L=>{const B=s==null?void 0:s[L],U=v==null?void 0:v[L];if(B===null)return null;const H=LF(B)||LF(U);return g[L][H]}),c=s&&Object.entries(s).reduce((L,B)=>{let[U,H]=B;return H===void 0||(L[U]=H),L},{}),T=t==null||(h=t.compoundVariants)===null||h===void 0?void 0:h.reduce((L,B)=>{let{class:U,className:H,...X}=B;return Object.entries(X).every(ae=>{let[ne,me]=ae;return Array.isArray(me)?me.includes({...v,...c}[ne]):{...v,...c}[ne]===me})?[...L,U,H]:L},[]);return OF(n,E,T,s==null?void 0:s.class,s==null?void 0:s.className)};/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const dW=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C4=(...n)=>n.filter((t,s,h)=>!!t&&t.trim()!==""&&h.indexOf(t)===s).join(" ").trim();/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var hW={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"};/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const fW=Y.forwardRef(({color:n="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:h,className:g="",children:v,iconNode:E,...c},T)=>Y.createElement("svg",{ref:T,...hW,width:t,height:t,stroke:n,strokeWidth:h?Number(s)*24/Number(t):s,className:C4("lucide",g),...c},[...E.map(([L,B])=>Y.createElement(L,B)),...Array.isArray(v)?v:[v]]));/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Hr=(n,t)=>{const s=Y.forwardRef(({className:h,...g},v)=>Y.createElement(fW,{ref:v,iconNode:t,className:C4(`lucide-${dW(n)}`,h),...g}));return s.displayName=`${n}`,s};/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const pW=Hr("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const FF=Hr("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const I4=Hr("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zF=Hr("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"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const mW=Hr("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const gW=Hr("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const _W=Hr("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Pg=Hr("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const BF=Hr("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yW=Hr("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const EC=Hr("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const M4=Hr("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vW=Hr("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"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const xW=Hr("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const bW=Hr("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const NF=Hr("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const wW=Hr("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"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const SW=Hr("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const rT=Hr("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const TW=Hr("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const EW=Hr("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const P4=Hr("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const kW=Hr("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const iT=Hr("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"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const kC=Hr("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const AC=Hr("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const AW=Hr("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const CW=Hr("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const D4=Hr("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const IW=Hr("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const VF=Hr("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const MW=Hr("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const PW=Hr("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const DW=Hr("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const jp=Hr("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),SM="-",RW=n=>{const t=OW(n),{conflictingClassGroups:s,conflictingClassGroupModifiers:h}=n;return{getClassGroupId:E=>{const c=E.split(SM);return c[0]===""&&c.length!==1&&c.shift(),R4(c,t)||LW(E)},getConflictingClassGroupIds:(E,c)=>{const T=s[E]||[];return c&&h[E]?[...T,...h[E]]:T}}},R4=(n,t)=>{var E;if(n.length===0)return t.classGroupId;const s=n[0],h=t.nextPart.get(s),g=h?R4(n.slice(1),h):void 0;if(g)return g;if(t.validators.length===0)return;const v=n.join(SM);return(E=t.validators.find(({validator:c})=>c(v)))==null?void 0:E.classGroupId},jF=/^\[(.+)\]$/,LW=n=>{if(jF.test(n)){const t=jF.exec(n)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},OW=n=>{const{theme:t,prefix:s}=n,h={nextPart:new Map,validators:[]};return zW(Object.entries(n.classGroups),s).forEach(([v,E])=>{CC(E,h,v,t)}),h},CC=(n,t,s,h)=>{n.forEach(g=>{if(typeof g=="string"){const v=g===""?t:UF(t,g);v.classGroupId=s;return}if(typeof g=="function"){if(FW(g)){CC(g(h),t,s,h);return}t.validators.push({validator:g,classGroupId:s});return}Object.entries(g).forEach(([v,E])=>{CC(E,UF(t,v),s,h)})})},UF=(n,t)=>{let s=n;return t.split(SM).forEach(h=>{s.nextPart.has(h)||s.nextPart.set(h,{nextPart:new Map,validators:[]}),s=s.nextPart.get(h)}),s},FW=n=>n.isThemeGetter,zW=(n,t)=>t?n.map(([s,h])=>{const g=h.map(v=>typeof v=="string"?t+v:typeof v=="object"?Object.fromEntries(Object.entries(v).map(([E,c])=>[t+E,c])):v);return[s,g]}):n,BW=n=>{if(n<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,h=new Map;const g=(v,E)=>{s.set(v,E),t++,t>n&&(t=0,h=s,s=new Map)};return{get(v){let E=s.get(v);if(E!==void 0)return E;if((E=h.get(v))!==void 0)return g(v,E),E},set(v,E){s.has(v)?s.set(v,E):g(v,E)}}},L4="!",NW=n=>{const{separator:t,experimentalParseClassName:s}=n,h=t.length===1,g=t[0],v=t.length,E=c=>{const T=[];let L=0,B=0,U;for(let me=0;me<c.length;me++){let oe=c[me];if(L===0){if(oe===g&&(h||c.slice(me,me+v)===t)){T.push(c.slice(B,me)),B=me+v;continue}if(oe==="/"){U=me;continue}}oe==="["?L++:oe==="]"&&L--}const H=T.length===0?c:c.substring(B),X=H.startsWith(L4),ae=X?H.substring(1):H,ne=U&&U>B?U-B:void 0;return{modifiers:T,hasImportantModifier:X,baseClassName:ae,maybePostfixModifierPosition:ne}};return s?c=>s({className:c,parseClassName:E}):E},VW=n=>{if(n.length<=1)return n;const t=[];let s=[];return n.forEach(h=>{h[0]==="["?(t.push(...s.sort(),h),s=[]):s.push(h)}),t.push(...s.sort()),t},jW=n=>({cache:BW(n.cacheSize),parseClassName:NW(n),...RW(n)}),UW=/\s+/,GW=(n,t)=>{const{parseClassName:s,getClassGroupId:h,getConflictingClassGroupIds:g}=t,v=[],E=n.trim().split(UW);let c="";for(let T=E.length-1;T>=0;T-=1){const L=E[T],{modifiers:B,hasImportantModifier:U,baseClassName:H,maybePostfixModifierPosition:X}=s(L);let ae=!!X,ne=h(ae?H.substring(0,X):H);if(!ne){if(!ae){c=L+(c.length>0?" "+c:c);continue}if(ne=h(H),!ne){c=L+(c.length>0?" "+c:c);continue}ae=!1}const me=VW(B).join(":"),oe=U?me+L4:me,re=oe+ne;if(v.includes(re))continue;v.push(re);const he=g(ne,ae);for(let _e=0;_e<he.length;++_e){const De=he[_e];v.push(oe+De)}c=L+(c.length>0?" "+c:c)}return c};function $W(){let n=0,t,s,h="";for(;n<arguments.length;)(t=arguments[n++])&&(s=O4(t))&&(h&&(h+=" "),h+=s);return h}const O4=n=>{if(typeof n=="string")return n;let t,s="";for(let h=0;h<n.length;h++)n[h]&&(t=O4(n[h]))&&(s&&(s+=" "),s+=t);return s};function HW(n,...t){let s,h,g,v=E;function E(T){const L=t.reduce((B,U)=>U(B),n());return s=jW(L),h=s.cache.get,g=s.cache.set,v=c,c(T)}function c(T){const L=h(T);if(L)return L;const B=GW(T,s);return g(T,B),B}return function(){return v($W.apply(null,arguments))}}const Xi=n=>{const t=s=>s[n]||[];return t.isThemeGetter=!0,t},F4=/^\[(?:([a-z-]+):)?(.+)\]$/i,WW=/^\d+\/\d+$/,qW=new Set(["px","full","screen"]),ZW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XW=/\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$/,KW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,YW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,QW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nd=n=>u_(n)||qW.has(n)||WW.test(n),gh=n=>W_(n,"length",sq),u_=n=>!!n&&!Number.isNaN(Number(n)),tA=n=>W_(n,"number",u_),C0=n=>!!n&&Number.isInteger(Number(n)),JW=n=>n.endsWith("%")&&u_(n.slice(0,-1)),Ir=n=>F4.test(n),_h=n=>ZW.test(n),eq=new Set(["length","size","percentage"]),tq=n=>W_(n,eq,z4),nq=n=>W_(n,"position",z4),rq=new Set(["image","url"]),iq=n=>W_(n,rq,lq),oq=n=>W_(n,"",aq),I0=()=>!0,W_=(n,t,s)=>{const h=F4.exec(n);return h?h[1]?typeof t=="string"?h[1]===t:t.has(h[1]):s(h[2]):!1},sq=n=>XW.test(n)&&!KW.test(n),z4=()=>!1,aq=n=>YW.test(n),lq=n=>QW.test(n),cq=()=>{const n=Xi("colors"),t=Xi("spacing"),s=Xi("blur"),h=Xi("brightness"),g=Xi("borderColor"),v=Xi("borderRadius"),E=Xi("borderSpacing"),c=Xi("borderWidth"),T=Xi("contrast"),L=Xi("grayscale"),B=Xi("hueRotate"),U=Xi("invert"),H=Xi("gap"),X=Xi("gradientColorStops"),ae=Xi("gradientColorStopPositions"),ne=Xi("inset"),me=Xi("margin"),oe=Xi("opacity"),re=Xi("padding"),he=Xi("saturate"),_e=Xi("scale"),De=Xi("sepia"),He=Xi("skew"),nt=Xi("space"),Xe=Xi("translate"),ft=()=>["auto","contain","none"],At=()=>["auto","hidden","clip","visible","scroll"],Bt=()=>["auto",Ir,t],Dt=()=>[Ir,t],It=()=>["",nd,gh],kt=()=>["auto",u_,Ir],wt=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Zt=()=>["solid","dashed","dotted","double","none"],zt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],vt=()=>["start","end","center","between","around","evenly","stretch"],pt=()=>["","0",Ir],Pt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],An=()=>[u_,Ir];return{cacheSize:500,separator:":",theme:{colors:[I0],spacing:[nd,gh],blur:["none","",_h,Ir],brightness:An(),borderColor:[n],borderRadius:["none","","full",_h,Ir],borderSpacing:Dt(),borderWidth:It(),contrast:An(),grayscale:pt(),hueRotate:An(),invert:pt(),gap:Dt(),gradientColorStops:[n],gradientColorStopPositions:[JW,gh],inset:Bt(),margin:Bt(),opacity:An(),padding:Dt(),saturate:An(),scale:An(),sepia:pt(),skew:An(),space:Dt(),translate:Dt()},classGroups:{aspect:[{aspect:["auto","square","video",Ir]}],container:["container"],columns:[{columns:[_h]}],"break-after":[{"break-after":Pt()}],"break-before":[{"break-before":Pt()}],"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"],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:[...wt(),Ir]}],overflow:[{overflow:At()}],"overflow-x":[{"overflow-x":At()}],"overflow-y":[{"overflow-y":At()}],overscroll:[{overscroll:ft()}],"overscroll-x":[{"overscroll-x":ft()}],"overscroll-y":[{"overscroll-y":ft()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[ne]}],"inset-x":[{"inset-x":[ne]}],"inset-y":[{"inset-y":[ne]}],start:[{start:[ne]}],end:[{end:[ne]}],top:[{top:[ne]}],right:[{right:[ne]}],bottom:[{bottom:[ne]}],left:[{left:[ne]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",C0,Ir]}],basis:[{basis:Bt()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ir]}],grow:[{grow:pt()}],shrink:[{shrink:pt()}],order:[{order:["first","last","none",C0,Ir]}],"grid-cols":[{"grid-cols":[I0]}],"col-start-end":[{col:["auto",{span:["full",C0,Ir]},Ir]}],"col-start":[{"col-start":kt()}],"col-end":[{"col-end":kt()}],"grid-rows":[{"grid-rows":[I0]}],"row-start-end":[{row:["auto",{span:[C0,Ir]},Ir]}],"row-start":[{"row-start":kt()}],"row-end":[{"row-end":kt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ir]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ir]}],gap:[{gap:[H]}],"gap-x":[{"gap-x":[H]}],"gap-y":[{"gap-y":[H]}],"justify-content":[{justify:["normal",...vt()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...vt(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...vt(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[re]}],px:[{px:[re]}],py:[{py:[re]}],ps:[{ps:[re]}],pe:[{pe:[re]}],pt:[{pt:[re]}],pr:[{pr:[re]}],pb:[{pb:[re]}],pl:[{pl:[re]}],m:[{m:[me]}],mx:[{mx:[me]}],my:[{my:[me]}],ms:[{ms:[me]}],me:[{me:[me]}],mt:[{mt:[me]}],mr:[{mr:[me]}],mb:[{mb:[me]}],ml:[{ml:[me]}],"space-x":[{"space-x":[nt]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[nt]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ir,t]}],"min-w":[{"min-w":[Ir,t,"min","max","fit"]}],"max-w":[{"max-w":[Ir,t,"none","full","min","max","fit","prose",{screen:[_h]},_h]}],h:[{h:[Ir,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ir,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ir,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ir,t,"auto","min","max","fit"]}],"font-size":[{text:["base",_h,gh]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tA]}],"font-family":[{font:[I0]}],"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:["tighter","tight","normal","wide","wider","widest",Ir]}],"line-clamp":[{"line-clamp":["none",u_,tA]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",nd,Ir]}],"list-image":[{"list-image":["none",Ir]}],"list-style-type":[{list:["none","disc","decimal",Ir]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[oe]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Zt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",nd,gh]}],"underline-offset":[{"underline-offset":["auto",nd,Ir]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Dt()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ir]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ir]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[oe]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...wt(),nq]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tq]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iq]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[ae]}],"gradient-via-pos":[{via:[ae]}],"gradient-to-pos":[{to:[ae]}],"gradient-from":[{from:[X]}],"gradient-via":[{via:[X]}],"gradient-to":[{to:[X]}],rounded:[{rounded:[v]}],"rounded-s":[{"rounded-s":[v]}],"rounded-e":[{"rounded-e":[v]}],"rounded-t":[{"rounded-t":[v]}],"rounded-r":[{"rounded-r":[v]}],"rounded-b":[{"rounded-b":[v]}],"rounded-l":[{"rounded-l":[v]}],"rounded-ss":[{"rounded-ss":[v]}],"rounded-se":[{"rounded-se":[v]}],"rounded-ee":[{"rounded-ee":[v]}],"rounded-es":[{"rounded-es":[v]}],"rounded-tl":[{"rounded-tl":[v]}],"rounded-tr":[{"rounded-tr":[v]}],"rounded-br":[{"rounded-br":[v]}],"rounded-bl":[{"rounded-bl":[v]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[oe]}],"border-style":[{border:[...Zt(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[oe]}],"divide-style":[{divide:Zt()}],"border-color":[{border:[g]}],"border-color-x":[{"border-x":[g]}],"border-color-y":[{"border-y":[g]}],"border-color-s":[{"border-s":[g]}],"border-color-e":[{"border-e":[g]}],"border-color-t":[{"border-t":[g]}],"border-color-r":[{"border-r":[g]}],"border-color-b":[{"border-b":[g]}],"border-color-l":[{"border-l":[g]}],"divide-color":[{divide:[g]}],"outline-style":[{outline:["",...Zt()]}],"outline-offset":[{"outline-offset":[nd,Ir]}],"outline-w":[{outline:[nd,gh]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:It()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[oe]}],"ring-offset-w":[{"ring-offset":[nd,gh]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",_h,oq]}],"shadow-color":[{shadow:[I0]}],opacity:[{opacity:[oe]}],"mix-blend":[{"mix-blend":[...zt(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":zt()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[h]}],contrast:[{contrast:[T]}],"drop-shadow":[{"drop-shadow":["","none",_h,Ir]}],grayscale:[{grayscale:[L]}],"hue-rotate":[{"hue-rotate":[B]}],invert:[{invert:[U]}],saturate:[{saturate:[he]}],sepia:[{sepia:[De]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[h]}],"backdrop-contrast":[{"backdrop-contrast":[T]}],"backdrop-grayscale":[{"backdrop-grayscale":[L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[B]}],"backdrop-invert":[{"backdrop-invert":[U]}],"backdrop-opacity":[{"backdrop-opacity":[oe]}],"backdrop-saturate":[{"backdrop-saturate":[he]}],"backdrop-sepia":[{"backdrop-sepia":[De]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[E]}],"border-spacing-x":[{"border-spacing-x":[E]}],"border-spacing-y":[{"border-spacing-y":[E]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ir]}],duration:[{duration:An()}],ease:[{ease:["linear","in","out","in-out",Ir]}],delay:[{delay:An()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ir]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_e]}],"scale-x":[{"scale-x":[_e]}],"scale-y":[{"scale-y":[_e]}],rotate:[{rotate:[C0,Ir]}],"translate-x":[{"translate-x":[Xe]}],"translate-y":[{"translate-y":[Xe]}],"skew-x":[{"skew-x":[He]}],"skew-y":[{"skew-y":[He]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ir]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],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",Ir]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Dt()}],"scroll-mx":[{"scroll-mx":Dt()}],"scroll-my":[{"scroll-my":Dt()}],"scroll-ms":[{"scroll-ms":Dt()}],"scroll-me":[{"scroll-me":Dt()}],"scroll-mt":[{"scroll-mt":Dt()}],"scroll-mr":[{"scroll-mr":Dt()}],"scroll-mb":[{"scroll-mb":Dt()}],"scroll-ml":[{"scroll-ml":Dt()}],"scroll-p":[{"scroll-p":Dt()}],"scroll-px":[{"scroll-px":Dt()}],"scroll-py":[{"scroll-py":Dt()}],"scroll-ps":[{"scroll-ps":Dt()}],"scroll-pe":[{"scroll-pe":Dt()}],"scroll-pt":[{"scroll-pt":Dt()}],"scroll-pr":[{"scroll-pr":Dt()}],"scroll-pb":[{"scroll-pb":Dt()}],"scroll-pl":[{"scroll-pl":Dt()}],"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",Ir]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[nd,gh,tA]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},uq=HW(cq);function fi(...n){return uq(A4(n))}const dq=uW,B4=Y.forwardRef(({className:n,...t},s)=>ue.jsx(x4,{ref:s,className:fi("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",n),...t}));B4.displayName=x4.displayName;const hq=wM("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),N4=Y.forwardRef(({className:n,variant:t,...s},h)=>ue.jsx(b4,{ref:h,className:fi(hq({variant:t}),n),...s}));N4.displayName=b4.displayName;const fq=Y.forwardRef(({className:n,...t},s)=>ue.jsx(T4,{ref:s,className:fi("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",n),...t}));fq.displayName=T4.displayName;const V4=Y.forwardRef(({className:n,...t},s)=>ue.jsx(E4,{ref:s,className:fi("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",n),"toast-close":"",...t,children:ue.jsx(jp,{className:"h-4 w-4"})}));V4.displayName=E4.displayName;const j4=Y.forwardRef(({className:n,...t},s)=>ue.jsx(w4,{ref:s,className:fi("text-sm font-semibold",n),...t}));j4.displayName=w4.displayName;const U4=Y.forwardRef(({className:n,...t},s)=>ue.jsx(S4,{ref:s,className:fi("text-sm opacity-90",n),...t}));U4.displayName=S4.displayName;function pq(){const{toasts:n}=h7();return ue.jsxs(dq,{children:[n.map(function({id:t,title:s,description:h,action:g,...v}){return ue.jsxs(N4,{...v,children:[ue.jsxs("div",{className:"grid gap-1",children:[s&&ue.jsx(j4,{children:s}),h&&ue.jsx(U4,{children:h})]}),g,ue.jsx(V4,{})]},t)}),ue.jsx(B4,{})]})}var GF=["light","dark"],mq="(prefers-color-scheme: dark)",gq=Y.createContext(void 0),_q={setTheme:n=>{},themes:[]},yq=()=>{var n;return(n=Y.useContext(gq))!=null?n:_q};Y.memo(({forcedTheme:n,storageKey:t,attribute:s,enableSystem:h,enableColorScheme:g,defaultTheme:v,value:E,attrs:c,nonce:T})=>{let L=v==="system",B=s==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(ae=>`'${ae}'`).join(",")})`};`:`var d=document.documentElement,n='${s}',s='setAttribute';`,U=g?GF.includes(v)&&v?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${v}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",H=(ae,ne=!1,me=!0)=>{let oe=E?E[ae]:ae,re=ne?ae+"|| ''":`'${oe}'`,he="";return g&&me&&!ne&&GF.includes(ae)&&(he+=`d.style.colorScheme = '${ae}';`),s==="class"?ne||oe?he+=`c.add(${re})`:he+="null":oe&&(he+=`d[s](n,${re})`),he},X=n?`!function(){${B}${H(n)}}()`:h?`!function(){try{${B}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${L})){var t='${mq}',m=window.matchMedia(t);if(m.media!==t||m.matches){${H("dark")}}else{${H("light")}}}else if(e){${E?`var x=${JSON.stringify(E)};`:""}${H(E?"x[e]":"e",!0)}}${L?"":"else{"+H(v,!1,!1)+"}"}${U}}catch(e){}}()`:`!function(){try{${B}var e=localStorage.getItem('${t}');if(e){${E?`var x=${JSON.stringify(E)};`:""}${H(E?"x[e]":"e",!0)}}else{${H(v,!1,!1)};}${U}}catch(t){}}();`;return Y.createElement("script",{nonce:T,dangerouslySetInnerHTML:{__html:X}})});var vq=n=>{switch(n){case"success":return wq;case"info":return Tq;case"warning":return Sq;case"error":return Eq;default:return null}},xq=Array(12).fill(0),bq=({visible:n,className:t})=>dn.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":n},dn.createElement("div",{className:"sonner-spinner"},xq.map((s,h)=>dn.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${h}`})))),wq=dn.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dn.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"})),Sq=dn.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},dn.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"})),Tq=dn.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dn.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"})),Eq=dn.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dn.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"})),kq=dn.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"},dn.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),dn.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Aq=()=>{let[n,t]=dn.useState(document.hidden);return dn.useEffect(()=>{let s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),n},IC=1,Cq=class{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{let t=this.subscribers.indexOf(n);this.subscribers.splice(t,1)}),this.publish=n=>{this.subscribers.forEach(t=>t(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var t;let{message:s,...h}=n,g=typeof(n==null?void 0:n.id)=="number"||((t=n.id)==null?void 0:t.length)>0?n.id:IC++,v=this.toasts.find(c=>c.id===g),E=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(g)&&this.dismissedToasts.delete(g),v?this.toasts=this.toasts.map(c=>c.id===g?(this.publish({...c,...n,id:g,title:s}),{...c,...n,id:g,dismissible:E,title:s}):c):this.addToast({title:s,...h,dismissible:E,id:g}),g},this.dismiss=n=>(this.dismissedToasts.add(n),n||this.toasts.forEach(t=>{this.subscribers.forEach(s=>s({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:n,dismiss:!0})),n),this.message=(n,t)=>this.create({...t,message:n}),this.error=(n,t)=>this.create({...t,message:n,type:"error"}),this.success=(n,t)=>this.create({...t,type:"success",message:n}),this.info=(n,t)=>this.create({...t,type:"info",message:n}),this.warning=(n,t)=>this.create({...t,type:"warning",message:n}),this.loading=(n,t)=>this.create({...t,type:"loading",message:n}),this.promise=(n,t)=>{if(!t)return;let s;t.loading!==void 0&&(s=this.create({...t,promise:n,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let h=n instanceof Promise?n:n(),g=s!==void 0,v,E=h.then(async T=>{if(v=["resolve",T],dn.isValidElement(T))g=!1,this.create({id:s,type:"default",message:T});else if(Mq(T)&&!T.ok){g=!1;let L=typeof t.error=="function"?await t.error(`HTTP error! status: ${T.status}`):t.error,B=typeof t.description=="function"?await t.description(`HTTP error! status: ${T.status}`):t.description;this.create({id:s,type:"error",message:L,description:B})}else if(t.success!==void 0){g=!1;let L=typeof t.success=="function"?await t.success(T):t.success,B=typeof t.description=="function"?await t.description(T):t.description;this.create({id:s,type:"success",message:L,description:B})}}).catch(async T=>{if(v=["reject",T],t.error!==void 0){g=!1;let L=typeof t.error=="function"?await t.error(T):t.error,B=typeof t.description=="function"?await t.description(T):t.description;this.create({id:s,type:"error",message:L,description:B})}}).finally(()=>{var T;g&&(this.dismiss(s),s=void 0),(T=t.finally)==null||T.call(t)}),c=()=>new Promise((T,L)=>E.then(()=>v[0]==="reject"?L(v[1]):T(v[1])).catch(L));return typeof s!="string"&&typeof s!="number"?{unwrap:c}:Object.assign(s,{unwrap:c})},this.custom=(n,t)=>{let s=(t==null?void 0:t.id)||IC++;return this.create({jsx:n(s),id:s,...t}),s},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Pa=new Cq,Iq=(n,t)=>{let s=(t==null?void 0:t.id)||IC++;return Pa.addToast({title:n,...t,id:s}),s},Mq=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",Pq=Iq,Dq=()=>Pa.toasts,Rq=()=>Pa.getActiveToasts(),Jo=Object.assign(Pq,{success:Pa.success,info:Pa.info,warning:Pa.warning,error:Pa.error,custom:Pa.custom,message:Pa.message,promise:Pa.promise,dismiss:Pa.dismiss,loading:Pa.loading},{getHistory:Dq,getToasts:Rq});function Lq(n,{insertAt:t}={}){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],h=document.createElement("style");h.type="text/css",t==="top"&&s.firstChild?s.insertBefore(h,s.firstChild):s.appendChild(h),h.styleSheet?h.styleSheet.cssText=n:h.appendChild(document.createTextNode(n))}Lq(`:where(html[dir="ltr"]),:where([data-sonner-toaster][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%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][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%)}:where([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:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([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);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([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 #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([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)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([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;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left: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);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-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([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}:where([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}:where([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, 0px)) translate(var(--swipe-amount-x, 0px));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{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{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{0%{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-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--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-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-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-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, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--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-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-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],[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],[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],[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],[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:nth-child(1){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)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{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 Zw(n){return n.label!==void 0}var Oq=3,Fq="32px",zq="16px",$F=4e3,Bq=356,Nq=14,Vq=20,jq=200;function hc(...n){return n.filter(Boolean).join(" ")}function Uq(n){let[t,s]=n.split("-"),h=[];return t&&h.push(t),s&&h.push(s),h}var Gq=n=>{var t,s,h,g,v,E,c,T,L,B,U;let{invert:H,toast:X,unstyled:ae,interacting:ne,setHeights:me,visibleToasts:oe,heights:re,index:he,toasts:_e,expanded:De,removeToast:He,defaultRichColors:nt,closeButton:Xe,style:ft,cancelButtonStyle:At,actionButtonStyle:Bt,className:Dt="",descriptionClassName:It="",duration:kt,position:wt,gap:Zt,loadingIcon:zt,expandByDefault:vt,classNames:pt,icons:Pt,closeButtonAriaLabel:An="Close toast",pauseWhenPageIsHidden:bn}=n,[Vn,Mn]=dn.useState(null),[Tn,Wr]=dn.useState(null),[Kn,Ho]=dn.useState(!1),[Ni,wo]=dn.useState(!1),[$n,Ar]=dn.useState(!1),[pi,zo]=dn.useState(!1),[Tr,ns]=dn.useState(!1),[ma,So]=dn.useState(0),[Ci,Or]=dn.useState(0),Vi=dn.useRef(X.duration||kt||$F),To=dn.useRef(null),ys=dn.useRef(null),za=he===0,Ec=he+1<=oe,oi=X.type,rs=X.dismissible!==!1,vs=X.className||"",Ct=X.descriptionClassName||"",sn=dn.useMemo(()=>re.findIndex(zn=>zn.toastId===X.id)||0,[re,X.id]),pn=dn.useMemo(()=>{var zn;return(zn=X.closeButton)!=null?zn:Xe},[X.closeButton,Xe]),jn=dn.useMemo(()=>X.duration||kt||$F,[X.duration,kt]),Fn=dn.useRef(0),hr=dn.useRef(0),qr=dn.useRef(0),ti=dn.useRef(null),[qs,Ba]=wt.split("-"),is=dn.useMemo(()=>re.reduce((zn,vr,et)=>et>=sn?zn:zn+vr.height,0),[re,sn]),Ms=Aq(),mi=X.invert||H,ga=oi==="loading";hr.current=dn.useMemo(()=>sn*Zt+is,[sn,is]),dn.useEffect(()=>{Vi.current=jn},[jn]),dn.useEffect(()=>{Ho(!0)},[]),dn.useEffect(()=>{let zn=ys.current;if(zn){let vr=zn.getBoundingClientRect().height;return Or(vr),me(et=>[{toastId:X.id,height:vr,position:X.position},...et]),()=>me(et=>et.filter(ji=>ji.toastId!==X.id))}},[me,X.id]),dn.useLayoutEffect(()=>{if(!Kn)return;let zn=ys.current,vr=zn.style.height;zn.style.height="auto";let et=zn.getBoundingClientRect().height;zn.style.height=vr,Or(et),me(ji=>ji.find(Eo=>Eo.toastId===X.id)?ji.map(Eo=>Eo.toastId===X.id?{...Eo,height:et}:Eo):[{toastId:X.id,height:et,position:X.position},...ji])},[Kn,X.title,X.description,me,X.id]);let Wo=dn.useCallback(()=>{wo(!0),So(hr.current),me(zn=>zn.filter(vr=>vr.toastId!==X.id)),setTimeout(()=>{He(X)},jq)},[X,He,me,hr]);dn.useEffect(()=>{if(X.promise&&oi==="loading"||X.duration===1/0||X.type==="loading")return;let zn;return De||ne||bn&&Ms?(()=>{if(qr.current<Fn.current){let vr=new Date().getTime()-Fn.current;Vi.current=Vi.current-vr}qr.current=new Date().getTime()})():Vi.current!==1/0&&(Fn.current=new Date().getTime(),zn=setTimeout(()=>{var vr;(vr=X.onAutoClose)==null||vr.call(X,X),Wo()},Vi.current)),()=>clearTimeout(zn)},[De,ne,X,oi,bn,Ms,Wo]),dn.useEffect(()=>{X.delete&&Wo()},[Wo,X.delete]);function _a(){var zn,vr,et;return Pt!=null&&Pt.loading?dn.createElement("div",{className:hc(pt==null?void 0:pt.loader,(zn=X==null?void 0:X.classNames)==null?void 0:zn.loader,"sonner-loader"),"data-visible":oi==="loading"},Pt.loading):zt?dn.createElement("div",{className:hc(pt==null?void 0:pt.loader,(vr=X==null?void 0:X.classNames)==null?void 0:vr.loader,"sonner-loader"),"data-visible":oi==="loading"},zt):dn.createElement(bq,{className:hc(pt==null?void 0:pt.loader,(et=X==null?void 0:X.classNames)==null?void 0:et.loader),visible:oi==="loading"})}return dn.createElement("li",{tabIndex:0,ref:ys,className:hc(Dt,vs,pt==null?void 0:pt.toast,(t=X==null?void 0:X.classNames)==null?void 0:t.toast,pt==null?void 0:pt.default,pt==null?void 0:pt[oi],(s=X==null?void 0:X.classNames)==null?void 0:s[oi]),"data-sonner-toast":"","data-rich-colors":(h=X.richColors)!=null?h:nt,"data-styled":!(X.jsx||X.unstyled||ae),"data-mounted":Kn,"data-promise":!!X.promise,"data-swiped":Tr,"data-removed":Ni,"data-visible":Ec,"data-y-position":qs,"data-x-position":Ba,"data-index":he,"data-front":za,"data-swiping":$n,"data-dismissible":rs,"data-type":oi,"data-invert":mi,"data-swipe-out":pi,"data-swipe-direction":Tn,"data-expanded":!!(De||vt&&Kn),style:{"--index":he,"--toasts-before":he,"--z-index":_e.length-he,"--offset":`${Ni?ma:hr.current}px`,"--initial-height":vt?"auto":`${Ci}px`,...ft,...X.style},onDragEnd:()=>{Ar(!1),Mn(null),ti.current=null},onPointerDown:zn=>{ga||!rs||(To.current=new Date,So(hr.current),zn.target.setPointerCapture(zn.pointerId),zn.target.tagName!=="BUTTON"&&(Ar(!0),ti.current={x:zn.clientX,y:zn.clientY}))},onPointerUp:()=>{var zn,vr,et,ji;if(pi||!rs)return;ti.current=null;let Eo=Number(((zn=ys.current)==null?void 0:zn.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ao=Number(((vr=ys.current)==null?void 0:vr.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Bo=new Date().getTime()-((et=To.current)==null?void 0:et.getTime()),Ui=Vn==="x"?Eo:ao,os=Math.abs(Ui)/Bo;if(Math.abs(Ui)>=Vq||os>.11){So(hr.current),(ji=X.onDismiss)==null||ji.call(X,X),Wr(Vn==="x"?Eo>0?"right":"left":ao>0?"down":"up"),Wo(),zo(!0),ns(!1);return}Ar(!1),Mn(null)},onPointerMove:zn=>{var vr,et,ji,Eo;if(!ti.current||!rs||((vr=window.getSelection())==null?void 0:vr.toString().length)>0)return;let ao=zn.clientY-ti.current.y,Bo=zn.clientX-ti.current.x,Ui=(et=n.swipeDirections)!=null?et:Uq(wt);!Vn&&(Math.abs(Bo)>1||Math.abs(ao)>1)&&Mn(Math.abs(Bo)>Math.abs(ao)?"x":"y");let os={x:0,y:0};Vn==="y"?(Ui.includes("top")||Ui.includes("bottom"))&&(Ui.includes("top")&&ao<0||Ui.includes("bottom")&&ao>0)&&(os.y=ao):Vn==="x"&&(Ui.includes("left")||Ui.includes("right"))&&(Ui.includes("left")&&Bo<0||Ui.includes("right")&&Bo>0)&&(os.x=Bo),(Math.abs(os.x)>0||Math.abs(os.y)>0)&&ns(!0),(ji=ys.current)==null||ji.style.setProperty("--swipe-amount-x",`${os.x}px`),(Eo=ys.current)==null||Eo.style.setProperty("--swipe-amount-y",`${os.y}px`)}},pn&&!X.jsx?dn.createElement("button",{"aria-label":An,"data-disabled":ga,"data-close-button":!0,onClick:ga||!rs?()=>{}:()=>{var zn;Wo(),(zn=X.onDismiss)==null||zn.call(X,X)},className:hc(pt==null?void 0:pt.closeButton,(g=X==null?void 0:X.classNames)==null?void 0:g.closeButton)},(v=Pt==null?void 0:Pt.close)!=null?v:kq):null,X.jsx||Y.isValidElement(X.title)?X.jsx?X.jsx:typeof X.title=="function"?X.title():X.title:dn.createElement(dn.Fragment,null,oi||X.icon||X.promise?dn.createElement("div",{"data-icon":"",className:hc(pt==null?void 0:pt.icon,(E=X==null?void 0:X.classNames)==null?void 0:E.icon)},X.promise||X.type==="loading"&&!X.icon?X.icon||_a():null,X.type!=="loading"?X.icon||(Pt==null?void 0:Pt[oi])||vq(oi):null):null,dn.createElement("div",{"data-content":"",className:hc(pt==null?void 0:pt.content,(c=X==null?void 0:X.classNames)==null?void 0:c.content)},dn.createElement("div",{"data-title":"",className:hc(pt==null?void 0:pt.title,(T=X==null?void 0:X.classNames)==null?void 0:T.title)},typeof X.title=="function"?X.title():X.title),X.description?dn.createElement("div",{"data-description":"",className:hc(It,Ct,pt==null?void 0:pt.description,(L=X==null?void 0:X.classNames)==null?void 0:L.description)},typeof X.description=="function"?X.description():X.description):null),Y.isValidElement(X.cancel)?X.cancel:X.cancel&&Zw(X.cancel)?dn.createElement("button",{"data-button":!0,"data-cancel":!0,style:X.cancelButtonStyle||At,onClick:zn=>{var vr,et;Zw(X.cancel)&&rs&&((et=(vr=X.cancel).onClick)==null||et.call(vr,zn),Wo())},className:hc(pt==null?void 0:pt.cancelButton,(B=X==null?void 0:X.classNames)==null?void 0:B.cancelButton)},X.cancel.label):null,Y.isValidElement(X.action)?X.action:X.action&&Zw(X.action)?dn.createElement("button",{"data-button":!0,"data-action":!0,style:X.actionButtonStyle||Bt,onClick:zn=>{var vr,et;Zw(X.action)&&((et=(vr=X.action).onClick)==null||et.call(vr,zn),!zn.defaultPrevented&&Wo())},className:hc(pt==null?void 0:pt.actionButton,(U=X==null?void 0:X.classNames)==null?void 0:U.actionButton)},X.action.label):null))};function HF(){if(typeof window>"u"||typeof document>"u")return"ltr";let n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}function $q(n,t){let s={};return[n,t].forEach((h,g)=>{let v=g===1,E=v?"--mobile-offset":"--offset",c=v?zq:Fq;function T(L){["top","right","bottom","left"].forEach(B=>{s[`${E}-${B}`]=typeof L=="number"?`${L}px`:L})}typeof h=="number"||typeof h=="string"?T(h):typeof h=="object"?["top","right","bottom","left"].forEach(L=>{h[L]===void 0?s[`${E}-${L}`]=c:s[`${E}-${L}`]=typeof h[L]=="number"?`${h[L]}px`:h[L]}):T(c)}),s}var Hq=Y.forwardRef(function(n,t){let{invert:s,position:h="bottom-right",hotkey:g=["altKey","KeyT"],expand:v,closeButton:E,className:c,offset:T,mobileOffset:L,theme:B="light",richColors:U,duration:H,style:X,visibleToasts:ae=Oq,toastOptions:ne,dir:me=HF(),gap:oe=Nq,loadingIcon:re,icons:he,containerAriaLabel:_e="Notifications",pauseWhenPageIsHidden:De}=n,[He,nt]=dn.useState([]),Xe=dn.useMemo(()=>Array.from(new Set([h].concat(He.filter(bn=>bn.position).map(bn=>bn.position)))),[He,h]),[ft,At]=dn.useState([]),[Bt,Dt]=dn.useState(!1),[It,kt]=dn.useState(!1),[wt,Zt]=dn.useState(B!=="system"?B:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),zt=dn.useRef(null),vt=g.join("+").replace(/Key/g,"").replace(/Digit/g,""),pt=dn.useRef(null),Pt=dn.useRef(!1),An=dn.useCallback(bn=>{nt(Vn=>{var Mn;return(Mn=Vn.find(Tn=>Tn.id===bn.id))!=null&&Mn.delete||Pa.dismiss(bn.id),Vn.filter(({id:Tn})=>Tn!==bn.id)})},[]);return dn.useEffect(()=>Pa.subscribe(bn=>{if(bn.dismiss){nt(Vn=>Vn.map(Mn=>Mn.id===bn.id?{...Mn,delete:!0}:Mn));return}setTimeout(()=>{s7.flushSync(()=>{nt(Vn=>{let Mn=Vn.findIndex(Tn=>Tn.id===bn.id);return Mn!==-1?[...Vn.slice(0,Mn),{...Vn[Mn],...bn},...Vn.slice(Mn+1)]:[bn,...Vn]})})})}),[]),dn.useEffect(()=>{if(B!=="system"){Zt(B);return}if(B==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Zt("dark"):Zt("light")),typeof window>"u")return;let bn=window.matchMedia("(prefers-color-scheme: dark)");try{bn.addEventListener("change",({matches:Vn})=>{Zt(Vn?"dark":"light")})}catch{bn.addListener(({matches:Mn})=>{try{Zt(Mn?"dark":"light")}catch(Tn){console.error(Tn)}})}},[B]),dn.useEffect(()=>{He.length<=1&&Dt(!1)},[He]),dn.useEffect(()=>{let bn=Vn=>{var Mn,Tn;g.every(Wr=>Vn[Wr]||Vn.code===Wr)&&(Dt(!0),(Mn=zt.current)==null||Mn.focus()),Vn.code==="Escape"&&(document.activeElement===zt.current||(Tn=zt.current)!=null&&Tn.contains(document.activeElement))&&Dt(!1)};return document.addEventListener("keydown",bn),()=>document.removeEventListener("keydown",bn)},[g]),dn.useEffect(()=>{if(zt.current)return()=>{pt.current&&(pt.current.focus({preventScroll:!0}),pt.current=null,Pt.current=!1)}},[zt.current]),dn.createElement("section",{ref:t,"aria-label":`${_e} ${vt}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Xe.map((bn,Vn)=>{var Mn;let[Tn,Wr]=bn.split("-");return He.length?dn.createElement("ol",{key:bn,dir:me==="auto"?HF():me,tabIndex:-1,ref:zt,className:c,"data-sonner-toaster":!0,"data-theme":wt,"data-y-position":Tn,"data-lifted":Bt&&He.length>1&&!v,"data-x-position":Wr,style:{"--front-toast-height":`${((Mn=ft[0])==null?void 0:Mn.height)||0}px`,"--width":`${Bq}px`,"--gap":`${oe}px`,...X,...$q(T,L)},onBlur:Kn=>{Pt.current&&!Kn.currentTarget.contains(Kn.relatedTarget)&&(Pt.current=!1,pt.current&&(pt.current.focus({preventScroll:!0}),pt.current=null))},onFocus:Kn=>{Kn.target instanceof HTMLElement&&Kn.target.dataset.dismissible==="false"||Pt.current||(Pt.current=!0,pt.current=Kn.relatedTarget)},onMouseEnter:()=>Dt(!0),onMouseMove:()=>Dt(!0),onMouseLeave:()=>{It||Dt(!1)},onDragEnd:()=>Dt(!1),onPointerDown:Kn=>{Kn.target instanceof HTMLElement&&Kn.target.dataset.dismissible==="false"||kt(!0)},onPointerUp:()=>kt(!1)},He.filter(Kn=>!Kn.position&&Vn===0||Kn.position===bn).map((Kn,Ho)=>{var Ni,wo;return dn.createElement(Gq,{key:Kn.id,icons:he,index:Ho,toast:Kn,defaultRichColors:U,duration:(Ni=ne==null?void 0:ne.duration)!=null?Ni:H,className:ne==null?void 0:ne.className,descriptionClassName:ne==null?void 0:ne.descriptionClassName,invert:s,visibleToasts:ae,closeButton:(wo=ne==null?void 0:ne.closeButton)!=null?wo:E,interacting:It,position:bn,style:ne==null?void 0:ne.style,unstyled:ne==null?void 0:ne.unstyled,classNames:ne==null?void 0:ne.classNames,cancelButtonStyle:ne==null?void 0:ne.cancelButtonStyle,actionButtonStyle:ne==null?void 0:ne.actionButtonStyle,removeToast:An,toasts:He.filter($n=>$n.position==Kn.position),heights:ft.filter($n=>$n.position==Kn.position),setHeights:At,expandByDefault:v,gap:oe,loadingIcon:re,expanded:Bt,pauseWhenPageIsHidden:De,swipeDirections:n.swipeDirections})})):null}))});const Wq=({...n})=>{const{theme:t="system"}=yq();return ue.jsx(Hq,{theme:t,className:"toaster group",position:"top-center",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...n})};var qq=IT[" useId ".trim().toString()]||(()=>{}),Zq=0;function SS(n){const[t,s]=Y.useState(qq());return yu(()=>{s(h=>h??String(Zq++))},[n]),n||(t?`radix-${t}`:"")}const Xq=["top","right","bottom","left"],Xh=Math.min,al=Math.max,oT=Math.round,Xw=Math.floor,vu=n=>({x:n,y:n}),Kq={left:"right",right:"left",bottom:"top",top:"bottom"};function MC(n,t,s){return al(n,Xh(t,s))}function _d(n,t){return typeof n=="function"?n(t):n}function yd(n){return n.split("-")[0]}function q_(n){return n.split("-")[1]}function TM(n){return n==="x"?"y":"x"}function EM(n){return n==="y"?"height":"width"}function pu(n){const t=n[0];return t==="t"||t==="b"?"y":"x"}function kM(n){return TM(pu(n))}function Yq(n,t,s){s===void 0&&(s=!1);const h=q_(n),g=kM(n),v=EM(g);let E=g==="x"?h===(s?"end":"start")?"right":"left":h==="start"?"bottom":"top";return t.reference[v]>t.floating[v]&&(E=sT(E)),[E,sT(E)]}function Qq(n){const t=sT(n);return[PC(n),t,PC(t)]}function PC(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const WF=["left","right"],qF=["right","left"],Jq=["top","bottom"],eZ=["bottom","top"];function tZ(n,t,s){switch(n){case"top":case"bottom":return s?t?qF:WF:t?WF:qF;case"left":case"right":return t?Jq:eZ;default:return[]}}function nZ(n,t,s,h){const g=q_(n);let v=tZ(yd(n),s==="start",h);return g&&(v=v.map(E=>E+"-"+g),t&&(v=v.concat(v.map(PC)))),v}function sT(n){const t=yd(n);return Kq[t]+n.slice(t.length)}function rZ(n){return{top:0,right:0,bottom:0,left:0,...n}}function G4(n){return typeof n!="number"?rZ(n):{top:n,right:n,bottom:n,left:n}}function aT(n){const{x:t,y:s,width:h,height:g}=n;return{width:h,height:g,top:s,left:t,right:t+h,bottom:s+g,x:t,y:s}}function ZF(n,t,s){let{reference:h,floating:g}=n;const v=pu(t),E=kM(t),c=EM(E),T=yd(t),L=v==="y",B=h.x+h.width/2-g.width/2,U=h.y+h.height/2-g.height/2,H=h[c]/2-g[c]/2;let X;switch(T){case"top":X={x:B,y:h.y-g.height};break;case"bottom":X={x:B,y:h.y+h.height};break;case"right":X={x:h.x+h.width,y:U};break;case"left":X={x:h.x-g.width,y:U};break;default:X={x:h.x,y:h.y}}switch(q_(t)){case"start":X[E]-=H*(s&&L?-1:1);break;case"end":X[E]+=H*(s&&L?-1:1);break}return X}async function iZ(n,t){var s;t===void 0&&(t={});const{x:h,y:g,platform:v,rects:E,elements:c,strategy:T}=n,{boundary:L="clippingAncestors",rootBoundary:B="viewport",elementContext:U="floating",altBoundary:H=!1,padding:X=0}=_d(t,n),ae=G4(X),me=c[H?U==="floating"?"reference":"floating":U],oe=aT(await v.getClippingRect({element:(s=await(v.isElement==null?void 0:v.isElement(me)))==null||s?me:me.contextElement||await(v.getDocumentElement==null?void 0:v.getDocumentElement(c.floating)),boundary:L,rootBoundary:B,strategy:T})),re=U==="floating"?{x:h,y:g,width:E.floating.width,height:E.floating.height}:E.reference,he=await(v.getOffsetParent==null?void 0:v.getOffsetParent(c.floating)),_e=await(v.isElement==null?void 0:v.isElement(he))?await(v.getScale==null?void 0:v.getScale(he))||{x:1,y:1}:{x:1,y:1},De=aT(v.convertOffsetParentRelativeRectToViewportRelativeRect?await v.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:re,offsetParent:he,strategy:T}):re);return{top:(oe.top-De.top+ae.top)/_e.y,bottom:(De.bottom-oe.bottom+ae.bottom)/_e.y,left:(oe.left-De.left+ae.left)/_e.x,right:(De.right-oe.right+ae.right)/_e.x}}const oZ=50,sZ=async(n,t,s)=>{const{placement:h="bottom",strategy:g="absolute",middleware:v=[],platform:E}=s,c=E.detectOverflow?E:{...E,detectOverflow:iZ},T=await(E.isRTL==null?void 0:E.isRTL(t));let L=await E.getElementRects({reference:n,floating:t,strategy:g}),{x:B,y:U}=ZF(L,h,T),H=h,X=0;const ae={};for(let ne=0;ne<v.length;ne++){const me=v[ne];if(!me)continue;const{name:oe,fn:re}=me,{x:he,y:_e,data:De,reset:He}=await re({x:B,y:U,initialPlacement:h,placement:H,strategy:g,middlewareData:ae,rects:L,platform:c,elements:{reference:n,floating:t}});B=he??B,U=_e??U,ae[oe]={...ae[oe],...De},He&&X<oZ&&(X++,typeof He=="object"&&(He.placement&&(H=He.placement),He.rects&&(L=He.rects===!0?await E.getElementRects({reference:n,floating:t,strategy:g}):He.rects),{x:B,y:U}=ZF(L,H,T)),ne=-1)}return{x:B,y:U,placement:H,strategy:g,middlewareData:ae}},aZ=n=>({name:"arrow",options:n,async fn(t){const{x:s,y:h,placement:g,rects:v,platform:E,elements:c,middlewareData:T}=t,{element:L,padding:B=0}=_d(n,t)||{};if(L==null)return{};const U=G4(B),H={x:s,y:h},X=kM(g),ae=EM(X),ne=await E.getDimensions(L),me=X==="y",oe=me?"top":"left",re=me?"bottom":"right",he=me?"clientHeight":"clientWidth",_e=v.reference[ae]+v.reference[X]-H[X]-v.floating[ae],De=H[X]-v.reference[X],He=await(E.getOffsetParent==null?void 0:E.getOffsetParent(L));let nt=He?He[he]:0;(!nt||!await(E.isElement==null?void 0:E.isElement(He)))&&(nt=c.floating[he]||v.floating[ae]);const Xe=_e/2-De/2,ft=nt/2-ne[ae]/2-1,At=Xh(U[oe],ft),Bt=Xh(U[re],ft),Dt=At,It=nt-ne[ae]-Bt,kt=nt/2-ne[ae]/2+Xe,wt=MC(Dt,kt,It),Zt=!T.arrow&&q_(g)!=null&&kt!==wt&&v.reference[ae]/2-(kt<Dt?At:Bt)-ne[ae]/2<0,zt=Zt?kt<Dt?kt-Dt:kt-It:0;return{[X]:H[X]+zt,data:{[X]:wt,centerOffset:kt-wt-zt,...Zt&&{alignmentOffset:zt}},reset:Zt}}}),lZ=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var s,h;const{placement:g,middlewareData:v,rects:E,initialPlacement:c,platform:T,elements:L}=t,{mainAxis:B=!0,crossAxis:U=!0,fallbackPlacements:H,fallbackStrategy:X="bestFit",fallbackAxisSideDirection:ae="none",flipAlignment:ne=!0,...me}=_d(n,t);if((s=v.arrow)!=null&&s.alignmentOffset)return{};const oe=yd(g),re=pu(c),he=yd(c)===c,_e=await(T.isRTL==null?void 0:T.isRTL(L.floating)),De=H||(he||!ne?[sT(c)]:Qq(c)),He=ae!=="none";!H&&He&&De.push(...nZ(c,ne,ae,_e));const nt=[c,...De],Xe=await T.detectOverflow(t,me),ft=[];let At=((h=v.flip)==null?void 0:h.overflows)||[];if(B&&ft.push(Xe[oe]),U){const kt=Yq(g,E,_e);ft.push(Xe[kt[0]],Xe[kt[1]])}if(At=[...At,{placement:g,overflows:ft}],!ft.every(kt=>kt<=0)){var Bt,Dt;const kt=(((Bt=v.flip)==null?void 0:Bt.index)||0)+1,wt=nt[kt];if(wt&&(!(U==="alignment"?re!==pu(wt):!1)||At.every(vt=>pu(vt.placement)===re?vt.overflows[0]>0:!0)))return{data:{index:kt,overflows:At},reset:{placement:wt}};let Zt=(Dt=At.filter(zt=>zt.overflows[0]<=0).sort((zt,vt)=>zt.overflows[1]-vt.overflows[1])[0])==null?void 0:Dt.placement;if(!Zt)switch(X){case"bestFit":{var It;const zt=(It=At.filter(vt=>{if(He){const pt=pu(vt.placement);return pt===re||pt==="y"}return!0}).map(vt=>[vt.placement,vt.overflows.filter(pt=>pt>0).reduce((pt,Pt)=>pt+Pt,0)]).sort((vt,pt)=>vt[1]-pt[1])[0])==null?void 0:It[0];zt&&(Zt=zt);break}case"initialPlacement":Zt=c;break}if(g!==Zt)return{reset:{placement:Zt}}}return{}}}};function XF(n,t){return{top:n.top-t.height,right:n.right-t.width,bottom:n.bottom-t.height,left:n.left-t.width}}function KF(n){return Xq.some(t=>n[t]>=0)}const cZ=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(t){const{rects:s,platform:h}=t,{strategy:g="referenceHidden",...v}=_d(n,t);switch(g){case"referenceHidden":{const E=await h.detectOverflow(t,{...v,elementContext:"reference"}),c=XF(E,s.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:KF(c)}}}case"escaped":{const E=await h.detectOverflow(t,{...v,altBoundary:!0}),c=XF(E,s.floating);return{data:{escapedOffsets:c,escaped:KF(c)}}}default:return{}}}}},$4=new Set(["left","top"]);async function uZ(n,t){const{placement:s,platform:h,elements:g}=n,v=await(h.isRTL==null?void 0:h.isRTL(g.floating)),E=yd(s),c=q_(s),T=pu(s)==="y",L=$4.has(E)?-1:1,B=v&&T?-1:1,U=_d(t,n);let{mainAxis:H,crossAxis:X,alignmentAxis:ae}=typeof U=="number"?{mainAxis:U,crossAxis:0,alignmentAxis:null}:{mainAxis:U.mainAxis||0,crossAxis:U.crossAxis||0,alignmentAxis:U.alignmentAxis};return c&&typeof ae=="number"&&(X=c==="end"?ae*-1:ae),T?{x:X*B,y:H*L}:{x:H*L,y:X*B}}const dZ=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var s,h;const{x:g,y:v,placement:E,middlewareData:c}=t,T=await uZ(t,n);return E===((s=c.offset)==null?void 0:s.placement)&&(h=c.arrow)!=null&&h.alignmentOffset?{}:{x:g+T.x,y:v+T.y,data:{...T,placement:E}}}}},hZ=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:s,y:h,placement:g,platform:v}=t,{mainAxis:E=!0,crossAxis:c=!1,limiter:T={fn:oe=>{let{x:re,y:he}=oe;return{x:re,y:he}}},...L}=_d(n,t),B={x:s,y:h},U=await v.detectOverflow(t,L),H=pu(yd(g)),X=TM(H);let ae=B[X],ne=B[H];if(E){const oe=X==="y"?"top":"left",re=X==="y"?"bottom":"right",he=ae+U[oe],_e=ae-U[re];ae=MC(he,ae,_e)}if(c){const oe=H==="y"?"top":"left",re=H==="y"?"bottom":"right",he=ne+U[oe],_e=ne-U[re];ne=MC(he,ne,_e)}const me=T.fn({...t,[X]:ae,[H]:ne});return{...me,data:{x:me.x-s,y:me.y-h,enabled:{[X]:E,[H]:c}}}}}},fZ=function(n){return n===void 0&&(n={}),{options:n,fn(t){const{x:s,y:h,placement:g,rects:v,middlewareData:E}=t,{offset:c=0,mainAxis:T=!0,crossAxis:L=!0}=_d(n,t),B={x:s,y:h},U=pu(g),H=TM(U);let X=B[H],ae=B[U];const ne=_d(c,t),me=typeof ne=="number"?{mainAxis:ne,crossAxis:0}:{mainAxis:0,crossAxis:0,...ne};if(T){const he=H==="y"?"height":"width",_e=v.reference[H]-v.floating[he]+me.mainAxis,De=v.reference[H]+v.reference[he]-me.mainAxis;X<_e?X=_e:X>De&&(X=De)}if(L){var oe,re;const he=H==="y"?"width":"height",_e=$4.has(yd(g)),De=v.reference[U]-v.floating[he]+(_e&&((oe=E.offset)==null?void 0:oe[U])||0)+(_e?0:me.crossAxis),He=v.reference[U]+v.reference[he]+(_e?0:((re=E.offset)==null?void 0:re[U])||0)-(_e?me.crossAxis:0);ae<De?ae=De:ae>He&&(ae=He)}return{[H]:X,[U]:ae}}}},pZ=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){var s,h;const{placement:g,rects:v,platform:E,elements:c}=t,{apply:T=()=>{},...L}=_d(n,t),B=await E.detectOverflow(t,L),U=yd(g),H=q_(g),X=pu(g)==="y",{width:ae,height:ne}=v.floating;let me,oe;U==="top"||U==="bottom"?(me=U,oe=H===(await(E.isRTL==null?void 0:E.isRTL(c.floating))?"start":"end")?"left":"right"):(oe=U,me=H==="end"?"top":"bottom");const re=ne-B.top-B.bottom,he=ae-B.left-B.right,_e=Xh(ne-B[me],re),De=Xh(ae-B[oe],he),He=!t.middlewareData.shift;let nt=_e,Xe=De;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(Xe=he),(h=t.middlewareData.shift)!=null&&h.enabled.y&&(nt=re),He&&!H){const At=al(B.left,0),Bt=al(B.right,0),Dt=al(B.top,0),It=al(B.bottom,0);X?Xe=ae-2*(At!==0||Bt!==0?At+Bt:al(B.left,B.right)):nt=ne-2*(Dt!==0||It!==0?Dt+It:al(B.top,B.bottom))}await T({...t,availableWidth:Xe,availableHeight:nt});const ft=await E.getDimensions(c.floating);return ae!==ft.width||ne!==ft.height?{reset:{rects:!0}}:{}}}};function XT(){return typeof window<"u"}function Z_(n){return H4(n)?(n.nodeName||"").toLowerCase():"#document"}function ul(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function Tu(n){var t;return(t=(H4(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function H4(n){return XT()?n instanceof Node||n instanceof ul(n).Node:!1}function wc(n){return XT()?n instanceof Element||n instanceof ul(n).Element:!1}function wd(n){return XT()?n instanceof HTMLElement||n instanceof ul(n).HTMLElement:!1}function YF(n){return!XT()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ul(n).ShadowRoot}function Wx(n){const{overflow:t,overflowX:s,overflowY:h,display:g}=Sc(n);return/auto|scroll|overlay|hidden|clip/.test(t+h+s)&&g!=="inline"&&g!=="contents"}function mZ(n){return/^(table|td|th)$/.test(Z_(n))}function KT(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const gZ=/transform|translate|scale|rotate|perspective|filter/,_Z=/paint|layout|strict|content/,bp=n=>!!n&&n!=="none";let nA;function AM(n){const t=wc(n)?Sc(n):n;return bp(t.transform)||bp(t.translate)||bp(t.scale)||bp(t.rotate)||bp(t.perspective)||!CM()&&(bp(t.backdropFilter)||bp(t.filter))||gZ.test(t.willChange||"")||_Z.test(t.contain||"")}function yZ(n){let t=Kh(n);for(;wd(t)&&!I_(t);){if(AM(t))return t;if(KT(t))return null;t=Kh(t)}return null}function CM(){return nA==null&&(nA=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),nA}function I_(n){return/^(html|body|#document)$/.test(Z_(n))}function Sc(n){return ul(n).getComputedStyle(n)}function YT(n){return wc(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Kh(n){if(Z_(n)==="html")return n;const t=n.assignedSlot||n.parentNode||YF(n)&&n.host||Tu(n);return YF(t)?t.host:t}function W4(n){const t=Kh(n);return I_(t)?n.ownerDocument?n.ownerDocument.body:n.body:wd(t)&&Wx(t)?t:W4(t)}function bx(n,t,s){var h;t===void 0&&(t=[]),s===void 0&&(s=!0);const g=W4(n),v=g===((h=n.ownerDocument)==null?void 0:h.body),E=ul(g);if(v){const c=DC(E);return t.concat(E,E.visualViewport||[],Wx(g)?g:[],c&&s?bx(c):[])}else return t.concat(g,bx(g,[],s))}function DC(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function q4(n){const t=Sc(n);let s=parseFloat(t.width)||0,h=parseFloat(t.height)||0;const g=wd(n),v=g?n.offsetWidth:s,E=g?n.offsetHeight:h,c=oT(s)!==v||oT(h)!==E;return c&&(s=v,h=E),{width:s,height:h,$:c}}function IM(n){return wc(n)?n:n.contextElement}function d_(n){const t=IM(n);if(!wd(t))return vu(1);const s=t.getBoundingClientRect(),{width:h,height:g,$:v}=q4(t);let E=(v?oT(s.width):s.width)/h,c=(v?oT(s.height):s.height)/g;return(!E||!Number.isFinite(E))&&(E=1),(!c||!Number.isFinite(c))&&(c=1),{x:E,y:c}}const vZ=vu(0);function Z4(n){const t=ul(n);return!CM()||!t.visualViewport?vZ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xZ(n,t,s){return t===void 0&&(t=!1),!s||t&&s!==ul(n)?!1:t}function Kp(n,t,s,h){t===void 0&&(t=!1),s===void 0&&(s=!1);const g=n.getBoundingClientRect(),v=IM(n);let E=vu(1);t&&(h?wc(h)&&(E=d_(h)):E=d_(n));const c=xZ(v,s,h)?Z4(v):vu(0);let T=(g.left+c.x)/E.x,L=(g.top+c.y)/E.y,B=g.width/E.x,U=g.height/E.y;if(v){const H=ul(v),X=h&&wc(h)?ul(h):h;let ae=H,ne=DC(ae);for(;ne&&h&&X!==ae;){const me=d_(ne),oe=ne.getBoundingClientRect(),re=Sc(ne),he=oe.left+(ne.clientLeft+parseFloat(re.paddingLeft))*me.x,_e=oe.top+(ne.clientTop+parseFloat(re.paddingTop))*me.y;T*=me.x,L*=me.y,B*=me.x,U*=me.y,T+=he,L+=_e,ae=ul(ne),ne=DC(ae)}}return aT({width:B,height:U,x:T,y:L})}function QT(n,t){const s=YT(n).scrollLeft;return t?t.left+s:Kp(Tu(n)).left+s}function X4(n,t){const s=n.getBoundingClientRect(),h=s.left+t.scrollLeft-QT(n,s),g=s.top+t.scrollTop;return{x:h,y:g}}function bZ(n){let{elements:t,rect:s,offsetParent:h,strategy:g}=n;const v=g==="fixed",E=Tu(h),c=t?KT(t.floating):!1;if(h===E||c&&v)return s;let T={scrollLeft:0,scrollTop:0},L=vu(1);const B=vu(0),U=wd(h);if((U||!U&&!v)&&((Z_(h)!=="body"||Wx(E))&&(T=YT(h)),U)){const X=Kp(h);L=d_(h),B.x=X.x+h.clientLeft,B.y=X.y+h.clientTop}const H=E&&!U&&!v?X4(E,T):vu(0);return{width:s.width*L.x,height:s.height*L.y,x:s.x*L.x-T.scrollLeft*L.x+B.x+H.x,y:s.y*L.y-T.scrollTop*L.y+B.y+H.y}}function wZ(n){return Array.from(n.getClientRects())}function SZ(n){const t=Tu(n),s=YT(n),h=n.ownerDocument.body,g=al(t.scrollWidth,t.clientWidth,h.scrollWidth,h.clientWidth),v=al(t.scrollHeight,t.clientHeight,h.scrollHeight,h.clientHeight);let E=-s.scrollLeft+QT(n);const c=-s.scrollTop;return Sc(h).direction==="rtl"&&(E+=al(t.clientWidth,h.clientWidth)-g),{width:g,height:v,x:E,y:c}}const QF=25;function TZ(n,t){const s=ul(n),h=Tu(n),g=s.visualViewport;let v=h.clientWidth,E=h.clientHeight,c=0,T=0;if(g){v=g.width,E=g.height;const B=CM();(!B||B&&t==="fixed")&&(c=g.offsetLeft,T=g.offsetTop)}const L=QT(h);if(L<=0){const B=h.ownerDocument,U=B.body,H=getComputedStyle(U),X=B.compatMode==="CSS1Compat"&&parseFloat(H.marginLeft)+parseFloat(H.marginRight)||0,ae=Math.abs(h.clientWidth-U.clientWidth-X);ae<=QF&&(v-=ae)}else L<=QF&&(v+=L);return{width:v,height:E,x:c,y:T}}function EZ(n,t){const s=Kp(n,!0,t==="fixed"),h=s.top+n.clientTop,g=s.left+n.clientLeft,v=wd(n)?d_(n):vu(1),E=n.clientWidth*v.x,c=n.clientHeight*v.y,T=g*v.x,L=h*v.y;return{width:E,height:c,x:T,y:L}}function JF(n,t,s){let h;if(t==="viewport")h=TZ(n,s);else if(t==="document")h=SZ(Tu(n));else if(wc(t))h=EZ(t,s);else{const g=Z4(n);h={x:t.x-g.x,y:t.y-g.y,width:t.width,height:t.height}}return aT(h)}function K4(n,t){const s=Kh(n);return s===t||!wc(s)||I_(s)?!1:Sc(s).position==="fixed"||K4(s,t)}function kZ(n,t){const s=t.get(n);if(s)return s;let h=bx(n,[],!1).filter(c=>wc(c)&&Z_(c)!=="body"),g=null;const v=Sc(n).position==="fixed";let E=v?Kh(n):n;for(;wc(E)&&!I_(E);){const c=Sc(E),T=AM(E);!T&&c.position==="fixed"&&(g=null),(v?!T&&!g:!T&&c.position==="static"&&!!g&&(g.position==="absolute"||g.position==="fixed")||Wx(E)&&!T&&K4(n,E))?h=h.filter(B=>B!==E):g=c,E=Kh(E)}return t.set(n,h),h}function AZ(n){let{element:t,boundary:s,rootBoundary:h,strategy:g}=n;const E=[...s==="clippingAncestors"?KT(t)?[]:kZ(t,this._c):[].concat(s),h],c=JF(t,E[0],g);let T=c.top,L=c.right,B=c.bottom,U=c.left;for(let H=1;H<E.length;H++){const X=JF(t,E[H],g);T=al(X.top,T),L=Xh(X.right,L),B=Xh(X.bottom,B),U=al(X.left,U)}return{width:L-U,height:B-T,x:U,y:T}}function CZ(n){const{width:t,height:s}=q4(n);return{width:t,height:s}}function IZ(n,t,s){const h=wd(t),g=Tu(t),v=s==="fixed",E=Kp(n,!0,v,t);let c={scrollLeft:0,scrollTop:0};const T=vu(0);function L(){T.x=QT(g)}if(h||!h&&!v)if((Z_(t)!=="body"||Wx(g))&&(c=YT(t)),h){const X=Kp(t,!0,v,t);T.x=X.x+t.clientLeft,T.y=X.y+t.clientTop}else g&&L();v&&!h&&g&&L();const B=g&&!h&&!v?X4(g,c):vu(0),U=E.left+c.scrollLeft-T.x-B.x,H=E.top+c.scrollTop-T.y-B.y;return{x:U,y:H,width:E.width,height:E.height}}function rA(n){return Sc(n).position==="static"}function ez(n,t){if(!wd(n)||Sc(n).position==="fixed")return null;if(t)return t(n);let s=n.offsetParent;return Tu(n)===s&&(s=s.ownerDocument.body),s}function Y4(n,t){const s=ul(n);if(KT(n))return s;if(!wd(n)){let g=Kh(n);for(;g&&!I_(g);){if(wc(g)&&!rA(g))return g;g=Kh(g)}return s}let h=ez(n,t);for(;h&&mZ(h)&&rA(h);)h=ez(h,t);return h&&I_(h)&&rA(h)&&!AM(h)?s:h||yZ(n)||s}const MZ=async function(n){const t=this.getOffsetParent||Y4,s=this.getDimensions,h=await s(n.floating);return{reference:IZ(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:h.width,height:h.height}}};function PZ(n){return Sc(n).direction==="rtl"}const DZ={convertOffsetParentRelativeRectToViewportRelativeRect:bZ,getDocumentElement:Tu,getClippingRect:AZ,getOffsetParent:Y4,getElementRects:MZ,getClientRects:wZ,getDimensions:CZ,getScale:d_,isElement:wc,isRTL:PZ};function Q4(n,t){return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height}function RZ(n,t){let s=null,h;const g=Tu(n);function v(){var c;clearTimeout(h),(c=s)==null||c.disconnect(),s=null}function E(c,T){c===void 0&&(c=!1),T===void 0&&(T=1),v();const L=n.getBoundingClientRect(),{left:B,top:U,width:H,height:X}=L;if(c||t(),!H||!X)return;const ae=Xw(U),ne=Xw(g.clientWidth-(B+H)),me=Xw(g.clientHeight-(U+X)),oe=Xw(B),he={rootMargin:-ae+"px "+-ne+"px "+-me+"px "+-oe+"px",threshold:al(0,Xh(1,T))||1};let _e=!0;function De(He){const nt=He[0].intersectionRatio;if(nt!==T){if(!_e)return E();nt?E(!1,nt):h=setTimeout(()=>{E(!1,1e-7)},1e3)}nt===1&&!Q4(L,n.getBoundingClientRect())&&E(),_e=!1}try{s=new IntersectionObserver(De,{...he,root:g.ownerDocument})}catch{s=new IntersectionObserver(De,he)}s.observe(n)}return E(!0),v}function LZ(n,t,s,h){h===void 0&&(h={});const{ancestorScroll:g=!0,ancestorResize:v=!0,elementResize:E=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:T=!1}=h,L=IM(n),B=g||v?[...L?bx(L):[],...t?bx(t):[]]:[];B.forEach(oe=>{g&&oe.addEventListener("scroll",s,{passive:!0}),v&&oe.addEventListener("resize",s)});const U=L&&c?RZ(L,s):null;let H=-1,X=null;E&&(X=new ResizeObserver(oe=>{let[re]=oe;re&&re.target===L&&X&&t&&(X.unobserve(t),cancelAnimationFrame(H),H=requestAnimationFrame(()=>{var he;(he=X)==null||he.observe(t)})),s()}),L&&!T&&X.observe(L),t&&X.observe(t));let ae,ne=T?Kp(n):null;T&&me();function me(){const oe=Kp(n);ne&&!Q4(ne,oe)&&s(),ne=oe,ae=requestAnimationFrame(me)}return s(),()=>{var oe;B.forEach(re=>{g&&re.removeEventListener("scroll",s),v&&re.removeEventListener("resize",s)}),U==null||U(),(oe=X)==null||oe.disconnect(),X=null,T&&cancelAnimationFrame(ae)}}const OZ=dZ,FZ=hZ,zZ=lZ,BZ=pZ,NZ=cZ,tz=aZ,VZ=fZ,jZ=(n,t,s)=>{const h=new Map,g={platform:DZ,...s},v={...g.platform,_c:h};return sZ(n,t,{...g,platform:v})};var UZ=typeof document<"u",GZ=function(){},TS=UZ?Y.useLayoutEffect:GZ;function lT(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let s,h,g;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(s=n.length,s!==t.length)return!1;for(h=s;h--!==0;)if(!lT(n[h],t[h]))return!1;return!0}if(g=Object.keys(n),s=g.length,s!==Object.keys(t).length)return!1;for(h=s;h--!==0;)if(!{}.hasOwnProperty.call(t,g[h]))return!1;for(h=s;h--!==0;){const v=g[h];if(!(v==="_owner"&&n.$$typeof)&&!lT(n[v],t[v]))return!1}return!0}return n!==n&&t!==t}function J4(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function nz(n,t){const s=J4(n);return Math.round(t*s)/s}function iA(n){const t=Y.useRef(n);return TS(()=>{t.current=n}),t}function $Z(n){n===void 0&&(n={});const{placement:t="bottom",strategy:s="absolute",middleware:h=[],platform:g,elements:{reference:v,floating:E}={},transform:c=!0,whileElementsMounted:T,open:L}=n,[B,U]=Y.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[H,X]=Y.useState(h);lT(H,h)||X(h);const[ae,ne]=Y.useState(null),[me,oe]=Y.useState(null),re=Y.useCallback(vt=>{vt!==He.current&&(He.current=vt,ne(vt))},[]),he=Y.useCallback(vt=>{vt!==nt.current&&(nt.current=vt,oe(vt))},[]),_e=v||ae,De=E||me,He=Y.useRef(null),nt=Y.useRef(null),Xe=Y.useRef(B),ft=T!=null,At=iA(T),Bt=iA(g),Dt=iA(L),It=Y.useCallback(()=>{if(!He.current||!nt.current)return;const vt={placement:t,strategy:s,middleware:H};Bt.current&&(vt.platform=Bt.current),jZ(He.current,nt.current,vt).then(pt=>{const Pt={...pt,isPositioned:Dt.current!==!1};kt.current&&!lT(Xe.current,Pt)&&(Xe.current=Pt,G_.flushSync(()=>{U(Pt)}))})},[H,t,s,Bt,Dt]);TS(()=>{L===!1&&Xe.current.isPositioned&&(Xe.current.isPositioned=!1,U(vt=>({...vt,isPositioned:!1})))},[L]);const kt=Y.useRef(!1);TS(()=>(kt.current=!0,()=>{kt.current=!1}),[]),TS(()=>{if(_e&&(He.current=_e),De&&(nt.current=De),_e&&De){if(At.current)return At.current(_e,De,It);It()}},[_e,De,It,At,ft]);const wt=Y.useMemo(()=>({reference:He,floating:nt,setReference:re,setFloating:he}),[re,he]),Zt=Y.useMemo(()=>({reference:_e,floating:De}),[_e,De]),zt=Y.useMemo(()=>{const vt={position:s,left:0,top:0};if(!Zt.floating)return vt;const pt=nz(Zt.floating,B.x),Pt=nz(Zt.floating,B.y);return c?{...vt,transform:"translate("+pt+"px, "+Pt+"px)",...J4(Zt.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:pt,top:Pt}},[s,c,Zt.floating,B.x,B.y]);return Y.useMemo(()=>({...B,update:It,refs:wt,elements:Zt,floatingStyles:zt}),[B,It,wt,Zt,zt])}const HZ=n=>{function t(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:n,fn(s){const{element:h,padding:g}=typeof n=="function"?n(s):n;return h&&t(h)?h.current!=null?tz({element:h.current,padding:g}).fn(s):{}:h?tz({element:h,padding:g}).fn(s):{}}}},WZ=(n,t)=>{const s=OZ(n);return{name:s.name,fn:s.fn,options:[n,t]}},qZ=(n,t)=>{const s=FZ(n);return{name:s.name,fn:s.fn,options:[n,t]}},ZZ=(n,t)=>({fn:VZ(n).fn,options:[n,t]}),XZ=(n,t)=>{const s=zZ(n);return{name:s.name,fn:s.fn,options:[n,t]}},KZ=(n,t)=>{const s=BZ(n);return{name:s.name,fn:s.fn,options:[n,t]}},YZ=(n,t)=>{const s=NZ(n);return{name:s.name,fn:s.fn,options:[n,t]}},QZ=(n,t)=>{const s=HZ(n);return{name:s.name,fn:s.fn,options:[n,t]}};var JZ="Arrow",eV=Y.forwardRef((n,t)=>{const{children:s,width:h=10,height:g=5,...v}=n;return ue.jsx(Bi.svg,{...v,ref:t,width:h,height:g,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?s:ue.jsx("polygon",{points:"0,0 30,0 15,10"})})});eV.displayName=JZ;var eX=eV;function tV(n){const[t,s]=Y.useState(void 0);return yu(()=>{if(n){s({width:n.offsetWidth,height:n.offsetHeight});const h=new ResizeObserver(g=>{if(!Array.isArray(g)||!g.length)return;const v=g[0];let E,c;if("borderBoxSize"in v){const T=v.borderBoxSize,L=Array.isArray(T)?T[0]:T;E=L.inlineSize,c=L.blockSize}else E=n.offsetWidth,c=n.offsetHeight;s({width:E,height:c})});return h.observe(n,{box:"border-box"}),()=>h.unobserve(n)}else s(void 0)},[n]),t}var MM="Popper",[nV,rV]=$_(MM),[tX,iV]=nV(MM),oV=n=>{const{__scopePopper:t,children:s}=n,[h,g]=Y.useState(null),[v,E]=Y.useState(void 0);return ue.jsx(tX,{scope:t,anchor:h,onAnchorChange:g,placementState:v,setPlacementState:E,children:s})};oV.displayName=MM;var sV="PopperAnchor",aV=Y.forwardRef((n,t)=>{const{__scopePopper:s,virtualRef:h,...g}=n,v=iV(sV,s),E=Y.useRef(null),c=v.onAnchorChange,T=Y.useCallback(ae=>{E.current=ae,ae&&c(ae)},[c]),L=$o(t,T),B=Y.useRef(null);Y.useEffect(()=>{if(!h)return;const ae=B.current;B.current=h.current,ae!==B.current&&c(B.current)});const U=v.placementState&&DM(v.placementState),H=U==null?void 0:U[0],X=U==null?void 0:U[1];return h?null:ue.jsx(Bi.div,{"data-radix-popper-side":H,"data-radix-popper-align":X,...g,ref:L})});aV.displayName=sV;var PM="PopperContent",[nX,rX]=nV(PM),lV=Y.forwardRef((n,t)=>{var Ho,Ni,wo,$n,Ar,pi;const{__scopePopper:s,side:h="bottom",sideOffset:g=0,align:v="center",alignOffset:E=0,arrowPadding:c=0,avoidCollisions:T=!0,collisionBoundary:L=[],collisionPadding:B=0,sticky:U="partial",hideWhenDetached:H=!1,updatePositionStrategy:X="optimized",onPlaced:ae,...ne}=n,me=iV(PM,s),[oe,re]=Y.useState(null),he=$o(t,zo=>re(zo)),[_e,De]=Y.useState(null),He=tV(_e),nt=(He==null?void 0:He.width)??0,Xe=(He==null?void 0:He.height)??0,ft=h+(v!=="center"?"-"+v:""),At=typeof B=="number"?B:{top:0,right:0,bottom:0,left:0,...B},Bt=Array.isArray(L)?L:[L],Dt=Bt.length>0,It={padding:At,boundary:Bt.filter(oX),altBoundary:Dt},{refs:kt,floatingStyles:wt,placement:Zt,isPositioned:zt,middlewareData:vt}=$Z({strategy:"fixed",placement:ft,whileElementsMounted:(...zo)=>LZ(...zo,{animationFrame:X==="always"}),elements:{reference:me.anchor},middleware:[WZ({mainAxis:g+Xe,alignmentAxis:E}),T&&qZ({mainAxis:!0,crossAxis:!1,limiter:U==="partial"?ZZ():void 0,...It}),T&&XZ({...It}),KZ({...It,apply:({elements:zo,rects:Tr,availableWidth:ns,availableHeight:ma})=>{const{width:So,height:Ci}=Tr.reference,Or=zo.floating.style;Or.setProperty("--radix-popper-available-width",`${ns}px`),Or.setProperty("--radix-popper-available-height",`${ma}px`),Or.setProperty("--radix-popper-anchor-width",`${So}px`),Or.setProperty("--radix-popper-anchor-height",`${Ci}px`)}}),_e&&QZ({element:_e,padding:c}),sX({arrowWidth:nt,arrowHeight:Xe}),H&&YZ({strategy:"referenceHidden",...It,boundary:Dt?It.boundary:void 0})]}),pt=me.setPlacementState;yu(()=>(pt(Zt),()=>{pt(void 0)}),[Zt,pt]);const[Pt,An]=DM(Zt),bn=Su(ae);yu(()=>{zt&&(bn==null||bn())},[zt,bn]);const Vn=(Ho=vt.arrow)==null?void 0:Ho.x,Mn=(Ni=vt.arrow)==null?void 0:Ni.y,Tn=((wo=vt.arrow)==null?void 0:wo.centerOffset)!==0,[Wr,Kn]=Y.useState();return yu(()=>{oe&&Kn(window.getComputedStyle(oe).zIndex)},[oe]),ue.jsx("div",{ref:kt.setFloating,"data-radix-popper-content-wrapper":"",style:{...wt,transform:zt?wt.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Wr,"--radix-popper-transform-origin":[($n=vt.transformOrigin)==null?void 0:$n.x,(Ar=vt.transformOrigin)==null?void 0:Ar.y].join(" "),...((pi=vt.hide)==null?void 0:pi.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:ue.jsx(nX,{scope:s,placedSide:Pt,placedAlign:An,onArrowChange:De,arrowX:Vn,arrowY:Mn,shouldHideArrow:Tn,children:ue.jsx(Bi.div,{"data-side":Pt,"data-align":An,...ne,ref:he,style:{...ne.style,animation:zt?void 0:"none"}})})})});lV.displayName=PM;var cV="PopperArrow",iX={top:"bottom",right:"left",bottom:"top",left:"right"},uV=Y.forwardRef(function(t,s){const{__scopePopper:h,...g}=t,v=rX(cV,h),E=iX[v.placedSide];return ue.jsx("span",{ref:v.onArrowChange,style:{position:"absolute",left:v.arrowX,top:v.arrowY,[E]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[v.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[v.placedSide],visibility:v.shouldHideArrow?"hidden":void 0},children:ue.jsx(eX,{...g,ref:s,style:{...g.style,display:"block"}})})});uV.displayName=cV;function oX(n){return n!==null}var sX=n=>({name:"transformOrigin",options:n,fn(t){var me,oe,re;const{placement:s,rects:h,middlewareData:g}=t,E=((me=g.arrow)==null?void 0:me.centerOffset)!==0,c=E?0:n.arrowWidth,T=E?0:n.arrowHeight,[L,B]=DM(s),U={start:"0%",center:"50%",end:"100%"}[B],H=(((oe=g.arrow)==null?void 0:oe.x)??0)+c/2,X=(((re=g.arrow)==null?void 0:re.y)??0)+T/2;let ae="",ne="";return L==="bottom"?(ae=E?U:`${H}px`,ne=`${-T}px`):L==="top"?(ae=E?U:`${H}px`,ne=`${h.floating.height+T}px`):L==="right"?(ae=`${-T}px`,ne=E?U:`${X}px`):L==="left"&&(ae=`${h.floating.width+T}px`,ne=E?U:`${X}px`),{data:{x:ae,y:ne}}}});function DM(n){const[t,s="center"]=n.split("-");return[t,s]}var aX=oV,lX=aV,cX=lV,uX=uV,[JT]=$_("Tooltip",[rV]),e2=rV(),dV="TooltipProvider",dX=700,RC="tooltip.open",[hX,RM]=JT(dV),hV=n=>{const{__scopeTooltip:t,delayDuration:s=dX,skipDelayDuration:h=300,disableHoverableContent:g=!1,children:v}=n,E=Y.useRef(!0),c=Y.useRef(!1),T=Y.useRef(0);return Y.useEffect(()=>{const L=T.current;return()=>window.clearTimeout(L)},[]),ue.jsx(hX,{scope:t,isOpenDelayedRef:E,delayDuration:s,onOpen:Y.useCallback(()=>{h<=0||(window.clearTimeout(T.current),E.current=!1)},[h]),onClose:Y.useCallback(()=>{h<=0||(window.clearTimeout(T.current),T.current=window.setTimeout(()=>E.current=!0,h))},[h]),isPointerInTransitRef:c,onPointerInTransitChange:Y.useCallback(L=>{c.current=L},[]),disableHoverableContent:g,children:v})};hV.displayName=dV;var wx="Tooltip",[fX,t2]=JT(wx),fV=n=>{const{__scopeTooltip:t,children:s,open:h,defaultOpen:g,onOpenChange:v,disableHoverableContent:E,delayDuration:c}=n,T=RM(wx,n.__scopeTooltip),L=e2(t),[B,U]=Y.useState(null),H=SS(),X=Y.useRef(0),ae=E??T.disableHoverableContent,ne=c??T.delayDuration,me=Y.useRef(!1),[oe,re]=WT({prop:h,defaultProp:g??!1,onChange:nt=>{nt?(T.onOpen(),document.dispatchEvent(new CustomEvent(RC))):T.onClose(),v==null||v(nt)},caller:wx}),he=Y.useMemo(()=>oe?me.current?"delayed-open":"instant-open":"closed",[oe]),_e=Y.useCallback(()=>{window.clearTimeout(X.current),X.current=0,me.current=!1,re(!0)},[re]),De=Y.useCallback(()=>{window.clearTimeout(X.current),X.current=0,re(!1)},[re]),He=Y.useCallback(()=>{window.clearTimeout(X.current),X.current=window.setTimeout(()=>{me.current=!0,re(!0),X.current=0},ne)},[ne,re]);return Y.useEffect(()=>()=>{X.current&&(window.clearTimeout(X.current),X.current=0)},[]),ue.jsx(aX,{...L,children:ue.jsx(fX,{scope:t,contentId:H,open:oe,stateAttribute:he,trigger:B,onTriggerChange:U,onTriggerEnter:Y.useCallback(()=>{T.isOpenDelayedRef.current?He():_e()},[T.isOpenDelayedRef,He,_e]),onTriggerLeave:Y.useCallback(()=>{ae?De():(window.clearTimeout(X.current),X.current=0)},[De,ae]),onOpen:_e,onClose:De,disableHoverableContent:ae,children:s})})};fV.displayName=wx;var LC="TooltipTrigger",pV=Y.forwardRef((n,t)=>{const{__scopeTooltip:s,...h}=n,g=t2(LC,s),v=RM(LC,s),E=e2(s),c=Y.useRef(null),T=$o(t,c,g.onTriggerChange),L=Y.useRef(!1),B=Y.useRef(!1),U=Y.useCallback(()=>L.current=!1,[]);return Y.useEffect(()=>()=>document.removeEventListener("pointerup",U),[U]),ue.jsx(lX,{asChild:!0,...E,children:ue.jsx(Bi.button,{"aria-describedby":g.open?g.contentId:void 0,"data-state":g.stateAttribute,...h,ref:T,onPointerMove:hi(n.onPointerMove,H=>{H.pointerType!=="touch"&&!B.current&&!v.isPointerInTransitRef.current&&(g.onTriggerEnter(),B.current=!0)}),onPointerLeave:hi(n.onPointerLeave,()=>{g.onTriggerLeave(),B.current=!1}),onPointerDown:hi(n.onPointerDown,()=>{g.open&&g.onClose(),L.current=!0,document.addEventListener("pointerup",U,{once:!0})}),onFocus:hi(n.onFocus,()=>{L.current||g.onOpen()}),onBlur:hi(n.onBlur,g.onClose),onClick:hi(n.onClick,g.onClose)})})});pV.displayName=LC;var pX="TooltipPortal",[$le,mX]=JT(pX,{forceMount:void 0}),M_="TooltipContent",mV=Y.forwardRef((n,t)=>{const s=mX(M_,n.__scopeTooltip),{forceMount:h=s.forceMount,side:g="top",...v}=n,E=t2(M_,n.__scopeTooltip);return ue.jsx(H_,{present:h||E.open,children:E.disableHoverableContent?ue.jsx(gV,{side:g,...v,ref:t}):ue.jsx(gX,{side:g,...v,ref:t})})}),gX=Y.forwardRef((n,t)=>{const s=t2(M_,n.__scopeTooltip),h=RM(M_,n.__scopeTooltip),g=Y.useRef(null),v=$o(t,g),[E,c]=Y.useState(null),{trigger:T,onClose:L}=s,B=g.current,{onPointerInTransitChange:U}=h,H=Y.useCallback(()=>{c(null),U(!1)},[U]),X=Y.useCallback((ae,ne)=>{const me=ae.currentTarget,oe={x:ae.clientX,y:ae.clientY},re=bX(oe,me.getBoundingClientRect()),he=wX(oe,re),_e=SX(ne.getBoundingClientRect()),De=EX([...he,..._e]);c(De),U(!0)},[U]);return Y.useEffect(()=>()=>H(),[H]),Y.useEffect(()=>{if(T&&B){const ae=me=>X(me,B),ne=me=>X(me,T);return T.addEventListener("pointerleave",ae),B.addEventListener("pointerleave",ne),()=>{T.removeEventListener("pointerleave",ae),B.removeEventListener("pointerleave",ne)}}},[T,B,X,H]),Y.useEffect(()=>{if(E){const ae=ne=>{const me=ne.target,oe={x:ne.clientX,y:ne.clientY},re=(T==null?void 0:T.contains(me))||(B==null?void 0:B.contains(me)),he=!TX(oe,E);re?H():he&&(H(),L())};return document.addEventListener("pointermove",ae),()=>document.removeEventListener("pointermove",ae)}},[T,B,E,L,H]),ue.jsx(gV,{...n,ref:v})}),[_X,yX]=JT(wx,{isInside:!1}),vX=g7("TooltipContent"),gV=Y.forwardRef((n,t)=>{const{__scopeTooltip:s,children:h,"aria-label":g,onEscapeKeyDown:v,onPointerDownOutside:E,...c}=n,T=t2(M_,s),L=e2(s),{onClose:B}=T;return Y.useEffect(()=>(document.addEventListener(RC,B),()=>document.removeEventListener(RC,B)),[B]),Y.useEffect(()=>{if(T.trigger){const U=H=>{H.target instanceof Node&&H.target.contains(T.trigger)&&B()};return window.addEventListener("scroll",U,{capture:!0}),()=>window.removeEventListener("scroll",U,{capture:!0})}},[T.trigger,B]),ue.jsx(HT,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:v,onPointerDownOutside:E,onFocusOutside:U=>U.preventDefault(),onDismiss:B,children:ue.jsxs(cX,{"data-state":T.stateAttribute,...L,...c,ref:t,style:{...c.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:[ue.jsx(vX,{children:h}),ue.jsx(_X,{scope:s,isInside:!0,children:ue.jsx(W7,{id:T.contentId,role:"tooltip",children:g||h})})]})})});mV.displayName=M_;var _V="TooltipArrow",xX=Y.forwardRef((n,t)=>{const{__scopeTooltip:s,...h}=n,g=e2(s);return yX(_V,s).isInside?null:ue.jsx(uX,{...g,...h,ref:t})});xX.displayName=_V;function bX(n,t){const s=Math.abs(t.top-n.y),h=Math.abs(t.bottom-n.y),g=Math.abs(t.right-n.x),v=Math.abs(t.left-n.x);switch(Math.min(s,h,g,v)){case v:return"left";case g:return"right";case s:return"top";case h:return"bottom";default:throw new Error("unreachable")}}function wX(n,t,s=5){const h=[];switch(t){case"top":h.push({x:n.x-s,y:n.y+s},{x:n.x+s,y:n.y+s});break;case"bottom":h.push({x:n.x-s,y:n.y-s},{x:n.x+s,y:n.y-s});break;case"left":h.push({x:n.x+s,y:n.y-s},{x:n.x+s,y:n.y+s});break;case"right":h.push({x:n.x-s,y:n.y-s},{x:n.x-s,y:n.y+s});break}return h}function SX(n){const{top:t,right:s,bottom:h,left:g}=n;return[{x:g,y:t},{x:s,y:t},{x:s,y:h},{x:g,y:h}]}function TX(n,t){const{x:s,y:h}=n;let g=!1;for(let v=0,E=t.length-1;v<t.length;E=v++){const c=t[v],T=t[E],L=c.x,B=c.y,U=T.x,H=T.y;B>h!=H>h&&s<(U-L)*(h-B)/(H-B)+L&&(g=!g)}return g}function EX(n){const t=n.slice();return t.sort((s,h)=>s.x<h.x?-1:s.x>h.x?1:s.y<h.y?-1:s.y>h.y?1:0),kX(t)}function kX(n){if(n.length<=1)return n.slice();const t=[];for(let h=0;h<n.length;h++){const g=n[h];for(;t.length>=2;){const v=t[t.length-1],E=t[t.length-2];if((v.x-E.x)*(g.y-E.y)>=(v.y-E.y)*(g.x-E.x))t.pop();else break}t.push(g)}t.pop();const s=[];for(let h=n.length-1;h>=0;h--){const g=n[h];for(;s.length>=2;){const v=s[s.length-1],E=s[s.length-2];if((v.x-E.x)*(g.y-E.y)>=(v.y-E.y)*(g.x-E.x))s.pop();else break}s.push(g)}return s.pop(),t.length===1&&s.length===1&&t[0].x===s[0].x&&t[0].y===s[0].y?t:t.concat(s)}var AX=hV,CX=fV,IX=pV,yV=mV;const MX=AX,Hle=CX,Wle=IX,PX=Y.forwardRef(({className:n,sideOffset:t=4,...s},h)=>ue.jsx(yV,{ref:h,sideOffset:t,className:fi("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...s}));PX.displayName=yV.displayName;var n2=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Rp,Ah,f_,LB,DX=(LB=class extends n2{constructor(){super();Gr(this,Rp);Gr(this,Ah);Gr(this,f_);cr(this,f_,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){Lt(this,Ah)||this.setEventListener(Lt(this,f_))}onUnsubscribe(){var t;this.hasListeners()||((t=Lt(this,Ah))==null||t.call(this),cr(this,Ah,void 0))}setEventListener(t){var s;cr(this,f_,t),(s=Lt(this,Ah))==null||s.call(this),cr(this,Ah,t(h=>{typeof h=="boolean"?this.setFocused(h):this.onFocus()}))}setFocused(t){Lt(this,Rp)!==t&&(cr(this,Rp,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof Lt(this,Rp)=="boolean"?Lt(this,Rp):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Rp=new WeakMap,Ah=new WeakMap,f_=new WeakMap,LB),vV=new DX,RX={setTimeout:(n,t)=>setTimeout(n,t),clearTimeout:n=>clearTimeout(n),setInterval:(n,t)=>setInterval(n,t),clearInterval:n=>clearInterval(n)},Ch,bI,OB,LX=(OB=class{constructor(){Gr(this,Ch,RX);Gr(this,bI,!1)}setTimeoutProvider(n){cr(this,Ch,n)}setTimeout(n,t){return Lt(this,Ch).setTimeout(n,t)}clearTimeout(n){Lt(this,Ch).clearTimeout(n)}setInterval(n,t){return Lt(this,Ch).setInterval(n,t)}clearInterval(n){Lt(this,Ch).clearInterval(n)}},Ch=new WeakMap,bI=new WeakMap,OB),OC=new LX;function OX(n){setTimeout(n,0)}var FX=typeof window>"u"||"Deno"in globalThis;function mc(){}function zX(n,t){return typeof n=="function"?n(t):n}function BX(n){return typeof n=="number"&&n>=0&&n!==1/0}function NX(n,t){return Math.max(n+(t||0)-Date.now(),0)}function FC(n,t){return typeof n=="function"?n(t):n}function VX(n,t){return typeof n=="function"?n(t):n}function rz(n,t){const{type:s="all",exact:h,fetchStatus:g,predicate:v,queryKey:E,stale:c}=n;if(E){if(h){if(t.queryHash!==LM(E,t.options))return!1}else if(!Tx(t.queryKey,E))return!1}if(s!=="all"){const T=t.isActive();if(s==="active"&&!T||s==="inactive"&&T)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||g&&g!==t.state.fetchStatus||v&&!v(t))}function iz(n,t){const{exact:s,status:h,predicate:g,mutationKey:v}=n;if(v){if(!t.options.mutationKey)return!1;if(s){if(Sx(t.options.mutationKey)!==Sx(v))return!1}else if(!Tx(t.options.mutationKey,v))return!1}return!(h&&t.state.status!==h||g&&!g(t))}function LM(n,t){return((t==null?void 0:t.queryKeyHashFn)||Sx)(n)}function Sx(n){return JSON.stringify(n,(t,s)=>zC(s)?Object.keys(s).sort().reduce((h,g)=>(h[g]=s[g],h),{}):s)}function Tx(n,t){return n===t?!0:typeof n!=typeof t?!1:n&&t&&typeof n=="object"&&typeof t=="object"?Object.keys(t).every(s=>Tx(n[s],t[s])):!1}var jX=Object.prototype.hasOwnProperty;function xV(n,t,s=0){if(n===t)return n;if(s>500)return t;const h=oz(n)&&oz(t);if(!h&&!(zC(n)&&zC(t)))return t;const v=(h?n:Object.keys(n)).length,E=h?t:Object.keys(t),c=E.length,T=h?new Array(c):{};let L=0;for(let B=0;B<c;B++){const U=h?B:E[B],H=n[U],X=t[U];if(H===X){T[U]=H,(h?B<v:jX.call(n,U))&&L++;continue}if(H===null||X===null||typeof H!="object"||typeof X!="object"){T[U]=X;continue}const ae=xV(H,X,s+1);T[U]=ae,ae===H&&L++}return v===c&&L===v?n:T}function qle(n,t){if(!t||Object.keys(n).length!==Object.keys(t).length)return!1;for(const s in n)if(n[s]!==t[s])return!1;return!0}function oz(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function zC(n){if(!sz(n))return!1;const t=n.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!sz(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function sz(n){return Object.prototype.toString.call(n)==="[object Object]"}function UX(n){return new Promise(t=>{OC.setTimeout(t,n)})}function GX(n,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(n,t):s.structuralSharing!==!1?xV(n,t):t}function $X(n,t,s=0){const h=[...n,t];return s&&h.length>s?h.slice(1):h}function HX(n,t,s=0){const h=[t,...n];return s&&h.length>s?h.slice(0,-1):h}var OM=Symbol();function bV(n,t){return!n.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!n.queryFn||n.queryFn===OM?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Zle(n,t){return typeof n=="function"?n(...t):!!n}function WX(n,t,s){let h=!1,g;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(g??(g=t()),h||(h=!0,g.aborted?s():g.addEventListener("abort",s,{once:!0})),g)}),n}var wV=(()=>{let n=()=>FX;return{isServer(){return n()},setIsServer(t){n=t}}})();function qX(){let n,t;const s=new Promise((g,v)=>{n=g,t=v});s.status="pending",s.catch(()=>{});function h(g){Object.assign(s,g),delete s.resolve,delete s.reject}return s.resolve=g=>{h({status:"fulfilled",value:g}),n(g)},s.reject=g=>{h({status:"rejected",reason:g}),t(g)},s}var ZX=OX;function XX(){let n=[],t=0,s=c=>{c()},h=c=>{c()},g=ZX;const v=c=>{t?n.push(c):g(()=>{s(c)})},E=()=>{const c=n;n=[],c.length&&g(()=>{h(()=>{c.forEach(T=>{s(T)})})})};return{batch:c=>{let T;t++;try{T=c()}finally{t--,t||E()}return T},batchCalls:c=>(...T)=>{v(()=>{c(...T)})},schedule:v,setNotifyFunction:c=>{s=c},setBatchNotifyFunction:c=>{h=c},setScheduler:c=>{g=c}}}var da=XX(),p_,Ih,m_,FB,KX=(FB=class extends n2{constructor(){super();Gr(this,p_,!0);Gr(this,Ih);Gr(this,m_);cr(this,m_,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),h=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",h,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",h)}}})}onSubscribe(){Lt(this,Ih)||this.setEventListener(Lt(this,m_))}onUnsubscribe(){var t;this.hasListeners()||((t=Lt(this,Ih))==null||t.call(this),cr(this,Ih,void 0))}setEventListener(t){var s;cr(this,m_,t),(s=Lt(this,Ih))==null||s.call(this),cr(this,Ih,t(this.setOnline.bind(this)))}setOnline(t){Lt(this,p_)!==t&&(cr(this,p_,t),this.listeners.forEach(h=>{h(t)}))}isOnline(){return Lt(this,p_)}},p_=new WeakMap,Ih=new WeakMap,m_=new WeakMap,FB),cT=new KX;function YX(n){return Math.min(1e3*2**n,3e4)}function SV(n){return(n??"online")==="online"?cT.isOnline():!0}var BC=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function TV(n){let t=!1,s=0,h;const g=qX(),v=()=>g.status!=="pending",E=ne=>{var me;if(!v()){const oe=new BC(ne);H(oe),(me=n.onCancel)==null||me.call(n,oe)}},c=()=>{t=!0},T=()=>{t=!1},L=()=>vV.isFocused()&&(n.networkMode==="always"||cT.isOnline())&&n.canRun(),B=()=>SV(n.networkMode)&&n.canRun(),U=ne=>{v()||(h==null||h(),g.resolve(ne))},H=ne=>{v()||(h==null||h(),g.reject(ne))},X=()=>new Promise(ne=>{var me;h=oe=>{(v()||L())&&ne(oe)},(me=n.onPause)==null||me.call(n)}).then(()=>{var ne;h=void 0,v()||(ne=n.onContinue)==null||ne.call(n)}),ae=()=>{if(v())return;let ne;const me=s===0?n.initialPromise:void 0;try{ne=me??n.fn()}catch(oe){ne=Promise.reject(oe)}Promise.resolve(ne).then(U).catch(oe=>{var He;if(v())return;const re=n.retry??(wV.isServer()?0:3),he=n.retryDelay??YX,_e=typeof he=="function"?he(s,oe):he,De=re===!0||typeof re=="number"&&s<re||typeof re=="function"&&re(s,oe);if(t||!De){H(oe);return}s++,(He=n.onFail)==null||He.call(n,s,oe),UX(_e).then(()=>L()?void 0:X()).then(()=>{t?H(oe):ae()})})};return{promise:g,status:()=>g.status,cancel:E,continue:()=>(h==null||h(),g),cancelRetry:c,continueRetry:T,canStart:B,start:()=>(B()?ae():X().then(ae),g)}}var Lp,zB,EV=(zB=class{constructor(){Gr(this,Lp)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),BX(this.gcTime)&&cr(this,Lp,OC.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(wV.isServer()?1/0:5*60*1e3))}clearGcTimeout(){Lt(this,Lp)!==void 0&&(OC.clearTimeout(Lt(this,Lp)),cr(this,Lp,void 0))}},Lp=new WeakMap,zB);function QX(n){return{onFetch:(t,s)=>{var B,U,H,X,ae;const h=t.options,g=(H=(U=(B=t.fetchOptions)==null?void 0:B.meta)==null?void 0:U.fetchMore)==null?void 0:H.direction,v=((X=t.state.data)==null?void 0:X.pages)||[],E=((ae=t.state.data)==null?void 0:ae.pageParams)||[];let c={pages:[],pageParams:[]},T=0;const L=async()=>{let ne=!1;const me=he=>{WX(he,()=>t.signal,()=>ne=!0)},oe=bV(t.options,t.fetchOptions),re=async(he,_e,De)=>{if(ne)return Promise.reject(t.signal.reason);if(_e==null&&he.pages.length)return Promise.resolve(he);const nt=(()=>{const Bt={client:t.client,queryKey:t.queryKey,pageParam:_e,direction:De?"backward":"forward",meta:t.options.meta};return me(Bt),Bt})(),Xe=await oe(nt),{maxPages:ft}=t.options,At=De?HX:$X;return{pages:At(he.pages,Xe,ft),pageParams:At(he.pageParams,_e,ft)}};if(g&&v.length){const he=g==="backward",_e=he?JX:az,De={pages:v,pageParams:E},He=_e(h,De);c=await re(De,He,he)}else{const he=n??v.length;do{const _e=T===0?E[0]??h.initialPageParam:az(h,c);if(T>0&&_e==null)break;c=await re(c,_e),T++}while(T<he)}return c};t.options.persister?t.fetchFn=()=>{var ne,me;return(me=(ne=t.options).persister)==null?void 0:me.call(ne,L,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=L}}}function az(n,{pages:t,pageParams:s}){const h=t.length-1;return t.length>0?n.getNextPageParam(t[h],t,s[h],s):void 0}function JX(n,{pages:t,pageParams:s}){var h;return t.length>0?(h=n.getPreviousPageParam)==null?void 0:h.call(n,t[0],t,s[0],s):void 0}var g_,Op,__,Bl,Fp,ms,zx,zp,sl,kV,id,BB,eK=(BB=class extends EV{constructor(t){super();Gr(this,sl);Gr(this,g_);Gr(this,Op);Gr(this,__);Gr(this,Bl);Gr(this,Fp);Gr(this,ms);Gr(this,zx);Gr(this,zp);cr(this,zp,!1),cr(this,zx,t.defaultOptions),this.setOptions(t.options),this.observers=[],cr(this,Fp,t.client),cr(this,Bl,Lt(this,Fp).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,cr(this,Op,cz(this.options)),this.state=t.state??Lt(this,Op),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return Lt(this,g_)}get promise(){var t;return(t=Lt(this,ms))==null?void 0:t.promise}setOptions(t){if(this.options={...Lt(this,zx),...t},t!=null&&t._type&&cr(this,g_,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=cz(this.options);s.data!==void 0&&(this.setState(lz(s.data,s.dataUpdatedAt)),cr(this,Op,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Lt(this,Bl).remove(this)}setData(t,s){const h=GX(this.state.data,t,this.options);return Es(this,sl,id).call(this,{data:h,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),h}setState(t){Es(this,sl,id).call(this,{type:"setState",state:t})}cancel(t){var h,g;const s=(h=Lt(this,ms))==null?void 0:h.promise;return(g=Lt(this,ms))==null||g.cancel(t),s?s.then(mc).catch(mc):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return Lt(this,Op)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>VX(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===OM||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>FC(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!NX(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(h=>h.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=Lt(this,ms))==null||s.continue()}onOnline(){var s;const t=this.observers.find(h=>h.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=Lt(this,ms))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Lt(this,Bl).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(Lt(this,ms)&&(Lt(this,zp)||Es(this,sl,kV).call(this)?Lt(this,ms).cancel({revert:!0}):Lt(this,ms).cancelRetry()),this.scheduleGc()),Lt(this,Bl).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Es(this,sl,id).call(this,{type:"invalidate"})}async fetch(t,s){var L,B,U,H,X,ae,ne,me,oe,re,he;if(this.state.fetchStatus!=="idle"&&((L=Lt(this,ms))==null?void 0:L.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(Lt(this,ms))return Lt(this,ms).continueRetry(),Lt(this,ms).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _e=this.observers.find(De=>De.options.queryFn);_e&&this.setOptions(_e.options)}const h=new AbortController,g=_e=>{Object.defineProperty(_e,"signal",{enumerable:!0,get:()=>(cr(this,zp,!0),h.signal)})},v=()=>{const _e=bV(this.options,s),He=(()=>{const nt={client:Lt(this,Fp),queryKey:this.queryKey,meta:this.meta};return g(nt),nt})();return cr(this,zp,!1),this.options.persister?this.options.persister(_e,He,this):_e(He)},c=(()=>{const _e={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:Lt(this,Fp),state:this.state,fetchFn:v};return g(_e),_e})(),T=Lt(this,g_)==="infinite"?QX(this.options.pages):this.options.behavior;T==null||T.onFetch(c,this),cr(this,__,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((B=c.fetchOptions)==null?void 0:B.meta))&&Es(this,sl,id).call(this,{type:"fetch",meta:(U=c.fetchOptions)==null?void 0:U.meta}),cr(this,ms,TV({initialPromise:s==null?void 0:s.initialPromise,fn:c.fetchFn,onCancel:_e=>{_e instanceof BC&&_e.revert&&this.setState({...Lt(this,__),fetchStatus:"idle"}),h.abort()},onFail:(_e,De)=>{Es(this,sl,id).call(this,{type:"failed",failureCount:_e,error:De})},onPause:()=>{Es(this,sl,id).call(this,{type:"pause"})},onContinue:()=>{Es(this,sl,id).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0}));try{const _e=await Lt(this,ms).start();if(_e===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_e),(X=(H=Lt(this,Bl).config).onSuccess)==null||X.call(H,_e,this),(ne=(ae=Lt(this,Bl).config).onSettled)==null||ne.call(ae,_e,this.state.error,this),_e}catch(_e){if(_e instanceof BC){if(_e.silent)return Lt(this,ms).promise;if(_e.revert){if(this.state.data===void 0)throw _e;return this.state.data}}throw Es(this,sl,id).call(this,{type:"error",error:_e}),(oe=(me=Lt(this,Bl).config).onError)==null||oe.call(me,_e,this),(he=(re=Lt(this,Bl).config).onSettled)==null||he.call(re,this.state.data,_e,this),_e}finally{this.scheduleGc()}}},g_=new WeakMap,Op=new WeakMap,__=new WeakMap,Bl=new WeakMap,Fp=new WeakMap,ms=new WeakMap,zx=new WeakMap,zp=new WeakMap,sl=new WeakSet,kV=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},id=function(t){const s=h=>{switch(t.type){case"failed":return{...h,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...h,fetchStatus:"paused"};case"continue":return{...h,fetchStatus:"fetching"};case"fetch":return{...h,...tK(h.data,this.options),fetchMeta:t.meta??null};case"success":const g={...h,...lz(t.data,t.dataUpdatedAt),dataUpdateCount:h.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return cr(this,__,t.manual?g:void 0),g;case"error":const v=t.error;return{...h,error:v,errorUpdateCount:h.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:h.fetchFailureCount+1,fetchFailureReason:v,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...h,isInvalidated:!0};case"setState":return{...h,...t.state}}};this.state=s(this.state),da.batch(()=>{this.observers.forEach(h=>{h.onQueryUpdate()}),Lt(this,Bl).notify({query:this,type:"updated",action:t})})},BB);function tK(n,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:SV(t.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function lz(n,t){return{data:n,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function cz(n){const t=typeof n.initialData=="function"?n.initialData():n.initialData,s=t!==void 0,h=s?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?h??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Bx,cu,Us,Bp,uu,vh,NB,nK=(NB=class extends EV{constructor(t){super();Gr(this,uu);Gr(this,Bx);Gr(this,cu);Gr(this,Us);Gr(this,Bp);cr(this,Bx,t.client),this.mutationId=t.mutationId,cr(this,Us,t.mutationCache),cr(this,cu,[]),this.state=t.state||rK(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Lt(this,cu).includes(t)||(Lt(this,cu).push(t),this.clearGcTimeout(),Lt(this,Us).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){cr(this,cu,Lt(this,cu).filter(s=>s!==t)),this.scheduleGc(),Lt(this,Us).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Lt(this,cu).length||(this.state.status==="pending"?this.scheduleGc():Lt(this,Us).remove(this))}continue(){var t;return((t=Lt(this,Bp))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var E,c,T,L,B,U,H,X,ae,ne,me,oe,re,he,_e,De,He,nt;const s=()=>{Es(this,uu,vh).call(this,{type:"continue"})},h={client:Lt(this,Bx),meta:this.options.meta,mutationKey:this.options.mutationKey};cr(this,Bp,TV({fn:()=>this.options.mutationFn?this.options.mutationFn(t,h):Promise.reject(new Error("No mutationFn found")),onFail:(Xe,ft)=>{Es(this,uu,vh).call(this,{type:"failed",failureCount:Xe,error:ft})},onPause:()=>{Es(this,uu,vh).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Lt(this,Us).canRun(this)}));const g=this.state.status==="pending",v=!Lt(this,Bp).canStart();try{if(g)s();else{Es(this,uu,vh).call(this,{type:"pending",variables:t,isPaused:v}),Lt(this,Us).config.onMutate&&await Lt(this,Us).config.onMutate(t,this,h);const ft=await((c=(E=this.options).onMutate)==null?void 0:c.call(E,t,h));ft!==this.state.context&&Es(this,uu,vh).call(this,{type:"pending",context:ft,variables:t,isPaused:v})}const Xe=await Lt(this,Bp).start();return await((L=(T=Lt(this,Us).config).onSuccess)==null?void 0:L.call(T,Xe,t,this.state.context,this,h)),await((U=(B=this.options).onSuccess)==null?void 0:U.call(B,Xe,t,this.state.context,h)),await((X=(H=Lt(this,Us).config).onSettled)==null?void 0:X.call(H,Xe,null,this.state.variables,this.state.context,this,h)),await((ne=(ae=this.options).onSettled)==null?void 0:ne.call(ae,Xe,null,t,this.state.context,h)),Es(this,uu,vh).call(this,{type:"success",data:Xe}),Xe}catch(Xe){try{await((oe=(me=Lt(this,Us).config).onError)==null?void 0:oe.call(me,Xe,t,this.state.context,this,h))}catch(ft){Promise.reject(ft)}try{await((he=(re=this.options).onError)==null?void 0:he.call(re,Xe,t,this.state.context,h))}catch(ft){Promise.reject(ft)}try{await((De=(_e=Lt(this,Us).config).onSettled)==null?void 0:De.call(_e,void 0,Xe,this.state.variables,this.state.context,this,h))}catch(ft){Promise.reject(ft)}try{await((nt=(He=this.options).onSettled)==null?void 0:nt.call(He,void 0,Xe,t,this.state.context,h))}catch(ft){Promise.reject(ft)}throw Es(this,uu,vh).call(this,{type:"error",error:Xe}),Xe}finally{Lt(this,Us).runNext(this)}}},Bx=new WeakMap,cu=new WeakMap,Us=new WeakMap,Bp=new WeakMap,uu=new WeakSet,vh=function(t){const s=h=>{switch(t.type){case"failed":return{...h,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...h,isPaused:!0};case"continue":return{...h,isPaused:!1};case"pending":return{...h,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...h,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...h,data:void 0,error:t.error,failureCount:h.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),da.batch(()=>{Lt(this,cu).forEach(h=>{h.onMutationUpdate(t)}),Lt(this,Us).notify({mutation:this,type:"updated",action:t})})},NB);function rK(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ad,gc,Nx,VB,iK=(VB=class extends n2{constructor(t={}){super();Gr(this,ad);Gr(this,gc);Gr(this,Nx);this.config=t,cr(this,ad,new Set),cr(this,gc,new Map),cr(this,Nx,0)}build(t,s,h){const g=new nK({client:t,mutationCache:this,mutationId:++Aw(this,Nx)._,options:t.defaultMutationOptions(s),state:h});return this.add(g),g}add(t){Lt(this,ad).add(t);const s=Kw(t);if(typeof s=="string"){const h=Lt(this,gc).get(s);h?h.push(t):Lt(this,gc).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Lt(this,ad).delete(t)){const s=Kw(t);if(typeof s=="string"){const h=Lt(this,gc).get(s);if(h)if(h.length>1){const g=h.indexOf(t);g!==-1&&h.splice(g,1)}else h[0]===t&&Lt(this,gc).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=Kw(t);if(typeof s=="string"){const h=Lt(this,gc).get(s),g=h==null?void 0:h.find(v=>v.state.status==="pending");return!g||g===t}else return!0}runNext(t){var h;const s=Kw(t);if(typeof s=="string"){const g=(h=Lt(this,gc).get(s))==null?void 0:h.find(v=>v!==t&&v.state.isPaused);return(g==null?void 0:g.continue())??Promise.resolve()}else return Promise.resolve()}clear(){da.batch(()=>{Lt(this,ad).forEach(t=>{this.notify({type:"removed",mutation:t})}),Lt(this,ad).clear(),Lt(this,gc).clear()})}getAll(){return Array.from(Lt(this,ad))}find(t){const s={exact:!0,...t};return this.getAll().find(h=>iz(s,h))}findAll(t={}){return this.getAll().filter(s=>iz(t,s))}notify(t){da.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return da.batch(()=>Promise.all(t.map(s=>s.continue().catch(mc))))}},ad=new WeakMap,gc=new WeakMap,Nx=new WeakMap,VB);function Kw(n){var t;return(t=n.options.scope)==null?void 0:t.id}var du,jB,oK=(jB=class extends n2{constructor(t={}){super();Gr(this,du);this.config=t,cr(this,du,new Map)}build(t,s,h){const g=s.queryKey,v=s.queryHash??LM(g,s);let E=this.get(v);return E||(E=new eK({client:t,queryKey:g,queryHash:v,options:t.defaultQueryOptions(s),state:h,defaultOptions:t.getQueryDefaults(g)}),this.add(E)),E}add(t){Lt(this,du).has(t.queryHash)||(Lt(this,du).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=Lt(this,du).get(t.queryHash);s&&(t.destroy(),s===t&&Lt(this,du).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){da.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Lt(this,du).get(t)}getAll(){return[...Lt(this,du).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(h=>rz(s,h))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(h=>rz(t,h)):s}notify(t){da.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){da.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){da.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},du=new WeakMap,jB),vo,Mh,Ph,y_,v_,Dh,x_,b_,UB,sK=(UB=class{constructor(n={}){Gr(this,vo);Gr(this,Mh);Gr(this,Ph);Gr(this,y_);Gr(this,v_);Gr(this,Dh);Gr(this,x_);Gr(this,b_);cr(this,vo,n.queryCache||new oK),cr(this,Mh,n.mutationCache||new iK),cr(this,Ph,n.defaultOptions||{}),cr(this,y_,new Map),cr(this,v_,new Map),cr(this,Dh,0)}mount(){Aw(this,Dh)._++,Lt(this,Dh)===1&&(cr(this,x_,vV.subscribe(async n=>{n&&(await this.resumePausedMutations(),Lt(this,vo).onFocus())})),cr(this,b_,cT.subscribe(async n=>{n&&(await this.resumePausedMutations(),Lt(this,vo).onOnline())})))}unmount(){var n,t;Aw(this,Dh)._--,Lt(this,Dh)===0&&((n=Lt(this,x_))==null||n.call(this),cr(this,x_,void 0),(t=Lt(this,b_))==null||t.call(this),cr(this,b_,void 0))}isFetching(n){return Lt(this,vo).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return Lt(this,Mh).findAll({...n,status:"pending"}).length}getQueryData(n){var s;const t=this.defaultQueryOptions({queryKey:n});return(s=Lt(this,vo).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(n){const t=this.defaultQueryOptions(n),s=Lt(this,vo).build(this,t),h=s.state.data;return h===void 0?this.fetchQuery(n):(n.revalidateIfStale&&s.isStaleByTime(FC(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(h))}getQueriesData(n){return Lt(this,vo).findAll(n).map(({queryKey:t,state:s})=>{const h=s.data;return[t,h]})}setQueryData(n,t,s){const h=this.defaultQueryOptions({queryKey:n}),g=Lt(this,vo).get(h.queryHash),v=g==null?void 0:g.state.data,E=zX(t,v);if(E!==void 0)return Lt(this,vo).build(this,h).setData(E,{...s,manual:!0})}setQueriesData(n,t,s){return da.batch(()=>Lt(this,vo).findAll(n).map(({queryKey:h})=>[h,this.setQueryData(h,t,s)]))}getQueryState(n){var s;const t=this.defaultQueryOptions({queryKey:n});return(s=Lt(this,vo).get(t.queryHash))==null?void 0:s.state}removeQueries(n){const t=Lt(this,vo);da.batch(()=>{t.findAll(n).forEach(s=>{t.remove(s)})})}resetQueries(n,t){const s=Lt(this,vo);return da.batch(()=>(s.findAll(n).forEach(h=>{h.reset()}),this.refetchQueries({type:"active",...n},t)))}cancelQueries(n,t={}){const s={revert:!0,...t},h=da.batch(()=>Lt(this,vo).findAll(n).map(g=>g.cancel(s)));return Promise.all(h).then(mc).catch(mc)}invalidateQueries(n,t={}){return da.batch(()=>(Lt(this,vo).findAll(n).forEach(s=>{s.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},t)))}refetchQueries(n,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},h=da.batch(()=>Lt(this,vo).findAll(n).filter(g=>!g.isDisabled()&&!g.isStatic()).map(g=>{let v=g.fetch(void 0,s);return s.throwOnError||(v=v.catch(mc)),g.state.fetchStatus==="paused"?Promise.resolve():v}));return Promise.all(h).then(mc)}fetchQuery(n){const t=this.defaultQueryOptions(n);t.retry===void 0&&(t.retry=!1);const s=Lt(this,vo).build(this,t);return s.isStaleByTime(FC(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(mc).catch(mc)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(mc).catch(mc)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return cT.isOnline()?Lt(this,Mh).resumePausedMutations():Promise.resolve()}getQueryCache(){return Lt(this,vo)}getMutationCache(){return Lt(this,Mh)}getDefaultOptions(){return Lt(this,Ph)}setDefaultOptions(n){cr(this,Ph,n)}setQueryDefaults(n,t){Lt(this,y_).set(Sx(n),{queryKey:n,defaultOptions:t})}getQueryDefaults(n){const t=[...Lt(this,y_).values()],s={};return t.forEach(h=>{Tx(n,h.queryKey)&&Object.assign(s,h.defaultOptions)}),s}setMutationDefaults(n,t){Lt(this,v_).set(Sx(n),{mutationKey:n,defaultOptions:t})}getMutationDefaults(n){const t=[...Lt(this,v_).values()],s={};return t.forEach(h=>{Tx(n,h.mutationKey)&&Object.assign(s,h.defaultOptions)}),s}defaultQueryOptions(n){if(n._defaulted)return n;const t={...Lt(this,Ph).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return t.queryHash||(t.queryHash=LM(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===OM&&(t.enabled=!1),t}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...Lt(this,Ph).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){Lt(this,vo).clear(),Lt(this,Mh).clear()}},vo=new WeakMap,Mh=new WeakMap,Ph=new WeakMap,y_=new WeakMap,v_=new WeakMap,Dh=new WeakMap,x_=new WeakMap,b_=new WeakMap,UB),AV=Y.createContext(void 0),Xle=n=>{const t=Y.useContext(AV);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},aK=({client:n,children:t})=>(Y.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),ue.jsx(AV.Provider,{value:n,children:t}));/**
|
||
* @remix-run/router v1.23.3
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/function Ex(){return Ex=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var h in s)({}).hasOwnProperty.call(s,h)&&(n[h]=s[h])}return n},Ex.apply(null,arguments)}var Oh;(function(n){n.Pop="POP",n.Push="PUSH",n.Replace="REPLACE"})(Oh||(Oh={}));const uz="popstate";function lK(n){n===void 0&&(n={});function t(h,g){let{pathname:v,search:E,hash:c}=h.location;return NC("",{pathname:v,search:E,hash:c},g.state&&g.state.usr||null,g.state&&g.state.key||"default")}function s(h,g){return typeof g=="string"?g:uT(g)}return uK(t,s,null,n)}function Fo(n,t){if(n===!1||n===null||typeof n>"u")throw new Error(t)}function FM(n,t){if(!n){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function cK(){return Math.random().toString(36).substr(2,8)}function dz(n,t){return{usr:n.state,key:n.key,idx:t}}function NC(n,t,s,h){return s===void 0&&(s=null),Ex({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof t=="string"?X_(t):t,{state:s,key:t&&t.key||h||cK()})}function uT(n){let{pathname:t="/",search:s="",hash:h=""}=n;return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),h&&h!=="#"&&(t+=h.charAt(0)==="#"?h:"#"+h),t}function X_(n){let t={};if(n){let s=n.indexOf("#");s>=0&&(t.hash=n.substr(s),n=n.substr(0,s));let h=n.indexOf("?");h>=0&&(t.search=n.substr(h),n=n.substr(0,h)),n&&(t.pathname=n)}return t}function uK(n,t,s,h){h===void 0&&(h={});let{window:g=document.defaultView,v5Compat:v=!1}=h,E=g.history,c=Oh.Pop,T=null,L=B();L==null&&(L=0,E.replaceState(Ex({},E.state,{idx:L}),""));function B(){return(E.state||{idx:null}).idx}function U(){c=Oh.Pop;let me=B(),oe=me==null?null:me-L;L=me,T&&T({action:c,location:ne.location,delta:oe})}function H(me,oe){c=Oh.Push;let re=NC(ne.location,me,oe);L=B()+1;let he=dz(re,L),_e=ne.createHref(re);try{E.pushState(he,"",_e)}catch(De){if(De instanceof DOMException&&De.name==="DataCloneError")throw De;g.location.assign(_e)}v&&T&&T({action:c,location:ne.location,delta:1})}function X(me,oe){c=Oh.Replace;let re=NC(ne.location,me,oe);L=B();let he=dz(re,L),_e=ne.createHref(re);E.replaceState(he,"",_e),v&&T&&T({action:c,location:ne.location,delta:0})}function ae(me){let oe=g.location.origin!=="null"?g.location.origin:g.location.href,re=typeof me=="string"?me:uT(me);return re=re.replace(/ $/,"%20"),Fo(oe,"No window.location.(origin|href) available to create URL for href: "+re),new URL(re,oe)}let ne={get action(){return c},get location(){return n(g,E)},listen(me){if(T)throw new Error("A history only accepts one active listener");return g.addEventListener(uz,U),T=me,()=>{g.removeEventListener(uz,U),T=null}},createHref(me){return t(g,me)},createURL:ae,encodeLocation(me){let oe=ae(me);return{pathname:oe.pathname,search:oe.search,hash:oe.hash}},push:H,replace:X,go(me){return E.go(me)}};return ne}var hz;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(hz||(hz={}));function dK(n,t,s){return s===void 0&&(s="/"),hK(n,t,s)}function hK(n,t,s,h){let g=typeof t=="string"?X_(t):t,v=zM(g.pathname||"/",s);if(v==null)return null;let E=CV(n);fK(E);let c=null,T=EK(v);for(let L=0;c==null&&L<E.length;++L)c=wK(E[L],T);return c}function CV(n,t,s,h){t===void 0&&(t=[]),s===void 0&&(s=[]),h===void 0&&(h="");let g=(v,E,c)=>{let T={relativePath:c===void 0?v.path||"":c,caseSensitive:v.caseSensitive===!0,childrenIndex:E,route:v};T.relativePath.startsWith("/")&&(Fo(T.relativePath.startsWith(h),'Absolute route path "'+T.relativePath+'" nested under path '+('"'+h+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),T.relativePath=T.relativePath.slice(h.length));let L=Hh([h,T.relativePath]),B=s.concat(T);v.children&&v.children.length>0&&(Fo(v.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+L+'".')),CV(v.children,t,B,L)),!(v.path==null&&!v.index)&&t.push({path:L,score:xK(L,v.index),routesMeta:B})};return n.forEach((v,E)=>{var c;if(v.path===""||!((c=v.path)!=null&&c.includes("?")))g(v,E);else for(let T of IV(v.path))g(v,E,T)}),t}function IV(n){let t=n.split("/");if(t.length===0)return[];let[s,...h]=t,g=s.endsWith("?"),v=s.replace(/\?$/,"");if(h.length===0)return g?[v,""]:[v];let E=IV(h.join("/")),c=[];return c.push(...E.map(T=>T===""?v:[v,T].join("/"))),g&&c.push(...E),c.map(T=>n.startsWith("/")&&T===""?"/":T)}function fK(n){n.sort((t,s)=>t.score!==s.score?s.score-t.score:bK(t.routesMeta.map(h=>h.childrenIndex),s.routesMeta.map(h=>h.childrenIndex)))}const pK=/^:[\w-]+$/,mK=3,gK=2,_K=1,yK=10,vK=-2,fz=n=>n==="*";function xK(n,t){let s=n.split("/"),h=s.length;return s.some(fz)&&(h+=vK),t&&(h+=gK),s.filter(g=>!fz(g)).reduce((g,v)=>g+(pK.test(v)?mK:v===""?_K:yK),h)}function bK(n,t){return n.length===t.length&&n.slice(0,-1).every((h,g)=>h===t[g])?n[n.length-1]-t[t.length-1]:0}function wK(n,t,s){let{routesMeta:h}=n,g={},v="/",E=[];for(let c=0;c<h.length;++c){let T=h[c],L=c===h.length-1,B=v==="/"?t:t.slice(v.length)||"/",U=SK({path:T.relativePath,caseSensitive:T.caseSensitive,end:L},B),H=T.route;if(!U)return null;Object.assign(g,U.params),E.push({params:g,pathname:Hh([v,U.pathname]),pathnameBase:MK(Hh([v,U.pathnameBase])),route:H}),U.pathnameBase!=="/"&&(v=Hh([v,U.pathnameBase]))}return E}function SK(n,t){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[s,h]=TK(n.path,n.caseSensitive,n.end),g=t.match(s);if(!g)return null;let v=g[0],E=v.replace(/(.)\/+$/,"$1"),c=g.slice(1);return{params:h.reduce((L,B,U)=>{let{paramName:H,isOptional:X}=B;if(H==="*"){let ne=c[U]||"";E=v.slice(0,v.length-ne.length).replace(/(.)\/+$/,"$1")}const ae=c[U];return X&&!ae?L[H]=void 0:L[H]=(ae||"").replace(/%2F/g,"/"),L},{}),pathname:v,pathnameBase:E,pattern:n}}function TK(n,t,s){t===void 0&&(t=!1),s===void 0&&(s=!0),FM(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let h=[],g="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(E,c,T)=>(h.push({paramName:c,isOptional:T!=null}),T?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(h.push({paramName:"*"}),g+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?g+="\\/*$":n!==""&&n!=="/"&&(g+="(?:(?=\\/|$))"),[new RegExp(g,t?void 0:"i"),h]}function EK(n){try{return n.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return FM(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),n}}function zM(n,t){if(t==="/")return n;if(!n.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,h=n.charAt(s);return h&&h!=="/"?null:n.slice(s)||"/"}const kK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,AK=n=>kK.test(n);function CK(n,t){t===void 0&&(t="/");let{pathname:s,search:h="",hash:g=""}=typeof n=="string"?X_(n):n,v;if(s)if(AK(s))v=s;else{if(s.includes("//")){let E=s;s=MV(s),FM(!1,"Pathnames cannot have embedded double slashes - normalizing "+(E+" -> "+s))}s.startsWith("/")?v=pz(s.substring(1),"/"):v=pz(s,t)}else v=t;return{pathname:v,search:PK(h),hash:DK(g)}}function pz(n,t){let s=t.replace(/\/+$/,"").split("/");return n.split("/").forEach(g=>{g===".."?s.length>1&&s.pop():g!=="."&&s.push(g)}),s.length>1?s.join("/"):"/"}function oA(n,t,s,h){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(h)+"]. Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function IK(n){return n.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function BM(n,t){let s=IK(n);return t?s.map((h,g)=>g===s.length-1?h.pathname:h.pathnameBase):s.map(h=>h.pathnameBase)}function NM(n,t,s,h){h===void 0&&(h=!1);let g;typeof n=="string"?g=X_(n):(g=Ex({},n),Fo(!g.pathname||!g.pathname.includes("?"),oA("?","pathname","search",g)),Fo(!g.pathname||!g.pathname.includes("#"),oA("#","pathname","hash",g)),Fo(!g.search||!g.search.includes("#"),oA("#","search","hash",g)));let v=n===""||g.pathname==="",E=v?"/":g.pathname,c;if(E==null)c=s;else{let U=t.length-1;if(!h&&E.startsWith("..")){let H=E.split("/");for(;H[0]==="..";)H.shift(),U-=1;g.pathname=H.join("/")}c=U>=0?t[U]:"/"}let T=CK(g,c),L=E&&E!=="/"&&E.endsWith("/"),B=(v||E===".")&&s.endsWith("/");return!T.pathname.endsWith("/")&&(L||B)&&(T.pathname+="/"),T}const MV=n=>n.replace(/\/\/+/g,"/"),Hh=n=>MV(n.join("/")),MK=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),PK=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,DK=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function RK(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const PV=["post","put","patch","delete"];new Set(PV);const LK=["get",...PV];new Set(LK);/**
|
||
* React Router v6.30.4
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/function kx(){return kx=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var h in s)({}).hasOwnProperty.call(s,h)&&(n[h]=s[h])}return n},kx.apply(null,arguments)}const VM=Y.createContext(null),OK=Y.createContext(null),of=Y.createContext(null),r2=Y.createContext(null),Sd=Y.createContext({outlet:null,matches:[],isDataRoute:!1}),DV=Y.createContext(null);function FK(n,t){let{relative:s}=t===void 0?{}:t;K_()||Fo(!1);let{basename:h,navigator:g}=Y.useContext(of),{hash:v,pathname:E,search:c}=LV(n,{relative:s}),T=E;return h!=="/"&&(T=E==="/"?h:Hh([h,E])),g.createHref({pathname:T,search:c,hash:v})}function K_(){return Y.useContext(r2)!=null}function em(){return K_()||Fo(!1),Y.useContext(r2).location}function RV(n){Y.useContext(of).static||Y.useLayoutEffect(n)}function Y_(){let{isDataRoute:n}=Y.useContext(Sd);return n?XK():zK()}function zK(){K_()||Fo(!1);let n=Y.useContext(VM),{basename:t,future:s,navigator:h}=Y.useContext(of),{matches:g}=Y.useContext(Sd),{pathname:v}=em(),E=JSON.stringify(BM(g,s.v7_relativeSplatPath)),c=Y.useRef(!1);return RV(()=>{c.current=!0}),Y.useCallback(function(L,B){if(B===void 0&&(B={}),!c.current)return;if(typeof L=="number"){h.go(L);return}let U=NM(L,JSON.parse(E),v,B.relative==="path");n==null&&t!=="/"&&(U.pathname=U.pathname==="/"?t:Hh([t,U.pathname])),(B.replace?h.replace:h.push)(U,B.state,B)},[t,h,E,v,n])}function Kle(){let{matches:n}=Y.useContext(Sd),t=n[n.length-1];return t?t.params:{}}function LV(n,t){let{relative:s}=t===void 0?{}:t,{future:h}=Y.useContext(of),{matches:g}=Y.useContext(Sd),{pathname:v}=em(),E=JSON.stringify(BM(g,h.v7_relativeSplatPath));return Y.useMemo(()=>NM(n,JSON.parse(E),v,s==="path"),[n,E,v,s])}function BK(n,t){return NK(n,t)}function NK(n,t,s,h){K_()||Fo(!1);let{navigator:g}=Y.useContext(of),{matches:v}=Y.useContext(Sd),E=v[v.length-1],c=E?E.params:{};E&&E.pathname;let T=E?E.pathnameBase:"/";E&&E.route;let L=em(),B;if(t){var U;let me=typeof t=="string"?X_(t):t;T==="/"||(U=me.pathname)!=null&&U.startsWith(T)||Fo(!1),B=me}else B=L;let H=B.pathname||"/",X=H;if(T!=="/"){let me=T.replace(/^\//,"").split("/");X="/"+H.replace(/^\//,"").split("/").slice(me.length).join("/")}let ae=dK(n,{pathname:X}),ne=$K(ae&&ae.map(me=>Object.assign({},me,{params:Object.assign({},c,me.params),pathname:Hh([T,g.encodeLocation?g.encodeLocation(me.pathname).pathname:me.pathname]),pathnameBase:me.pathnameBase==="/"?T:Hh([T,g.encodeLocation?g.encodeLocation(me.pathnameBase).pathname:me.pathnameBase])})),v,s,h);return t&&ne?Y.createElement(r2.Provider,{value:{location:kx({pathname:"/",search:"",hash:"",state:null,key:"default"},B),navigationType:Oh.Pop}},ne):ne}function VK(){let n=ZK(),t=RK(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),s=n instanceof Error?n.stack:null,g={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return Y.createElement(Y.Fragment,null,Y.createElement("h2",null,"Unexpected Application Error!"),Y.createElement("h3",{style:{fontStyle:"italic"}},t),s?Y.createElement("pre",{style:g},s):null,null)}const jK=Y.createElement(VK,null);class UK extends Y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){console.error("React Router caught the following error during render",t,s)}render(){return this.state.error!==void 0?Y.createElement(Sd.Provider,{value:this.props.routeContext},Y.createElement(DV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function GK(n){let{routeContext:t,match:s,children:h}=n,g=Y.useContext(VM);return g&&g.static&&g.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(g.staticContext._deepestRenderedBoundaryId=s.route.id),Y.createElement(Sd.Provider,{value:t},h)}function $K(n,t,s,h){var g;if(t===void 0&&(t=[]),s===void 0&&(s=null),h===void 0&&(h=null),n==null){var v;if(!s)return null;if(s.errors)n=s.matches;else if((v=h)!=null&&v.v7_partialHydration&&t.length===0&&!s.initialized&&s.matches.length>0)n=s.matches;else return null}let E=n,c=(g=s)==null?void 0:g.errors;if(c!=null){let B=E.findIndex(U=>U.route.id&&(c==null?void 0:c[U.route.id])!==void 0);B>=0||Fo(!1),E=E.slice(0,Math.min(E.length,B+1))}let T=!1,L=-1;if(s&&h&&h.v7_partialHydration)for(let B=0;B<E.length;B++){let U=E[B];if((U.route.HydrateFallback||U.route.hydrateFallbackElement)&&(L=B),U.route.id){let{loaderData:H,errors:X}=s,ae=U.route.loader&&H[U.route.id]===void 0&&(!X||X[U.route.id]===void 0);if(U.route.lazy||ae){T=!0,L>=0?E=E.slice(0,L+1):E=[E[0]];break}}}return E.reduceRight((B,U,H)=>{let X,ae=!1,ne=null,me=null;s&&(X=c&&U.route.id?c[U.route.id]:void 0,ne=U.route.errorElement||jK,T&&(L<0&&H===0?(KK("route-fallback"),ae=!0,me=null):L===H&&(ae=!0,me=U.route.hydrateFallbackElement||null)));let oe=t.concat(E.slice(0,H+1)),re=()=>{let he;return X?he=ne:ae?he=me:U.route.Component?he=Y.createElement(U.route.Component,null):U.route.element?he=U.route.element:he=B,Y.createElement(GK,{match:U,routeContext:{outlet:B,matches:oe,isDataRoute:s!=null},children:he})};return s&&(U.route.ErrorBoundary||U.route.errorElement||H===0)?Y.createElement(UK,{location:s.location,revalidation:s.revalidation,component:ne,error:X,children:re(),routeContext:{outlet:null,matches:oe,isDataRoute:!0}}):re()},null)}var OV=function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n}(OV||{}),FV=function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n}(FV||{});function HK(n){let t=Y.useContext(VM);return t||Fo(!1),t}function WK(n){let t=Y.useContext(OK);return t||Fo(!1),t}function qK(n){let t=Y.useContext(Sd);return t||Fo(!1),t}function zV(n){let t=qK(),s=t.matches[t.matches.length-1];return s.route.id||Fo(!1),s.route.id}function ZK(){var n;let t=Y.useContext(DV),s=WK(),h=zV();return t!==void 0?t:(n=s.errors)==null?void 0:n[h]}function XK(){let{router:n}=HK(OV.UseNavigateStable),t=zV(FV.UseNavigateStable),s=Y.useRef(!1);return RV(()=>{s.current=!0}),Y.useCallback(function(g,v){v===void 0&&(v={}),s.current&&(typeof g=="number"?n.navigate(g):n.navigate(g,kx({fromRouteId:t},v)))},[n,t])}const mz={};function KK(n,t,s){mz[n]||(mz[n]=!0)}function YK(n,t){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function Yle(n){let{to:t,replace:s,state:h,relative:g}=n;K_()||Fo(!1);let{future:v,static:E}=Y.useContext(of),{matches:c}=Y.useContext(Sd),{pathname:T}=em(),L=Y_(),B=NM(t,BM(c,v.v7_relativeSplatPath),T,g==="path"),U=JSON.stringify(B);return Y.useEffect(()=>L(JSON.parse(U),{replace:s,state:h,relative:g}),[L,U,g,s,h]),null}function vi(n){Fo(!1)}function QK(n){let{basename:t="/",children:s=null,location:h,navigationType:g=Oh.Pop,navigator:v,static:E=!1,future:c}=n;K_()&&Fo(!1);let T=t.replace(/^\/*/,"/"),L=Y.useMemo(()=>({basename:T,navigator:v,static:E,future:kx({v7_relativeSplatPath:!1},c)}),[T,c,v,E]);typeof h=="string"&&(h=X_(h));let{pathname:B="/",search:U="",hash:H="",state:X=null,key:ae="default"}=h,ne=Y.useMemo(()=>{let me=zM(B,T);return me==null?null:{location:{pathname:me,search:U,hash:H,state:X,key:ae},navigationType:g}},[T,B,U,H,X,ae,g]);return ne==null?null:Y.createElement(of.Provider,{value:L},Y.createElement(r2.Provider,{children:s,value:ne}))}function JK(n){let{children:t,location:s}=n;return BK(VC(t),s)}new Promise(()=>{});function VC(n,t){t===void 0&&(t=[]);let s=[];return Y.Children.forEach(n,(h,g)=>{if(!Y.isValidElement(h))return;let v=[...t,g];if(h.type===Y.Fragment){s.push.apply(s,VC(h.props.children,v));return}h.type!==vi&&Fo(!1),!h.props.index||!h.props.children||Fo(!1);let E={id:h.props.id||v.join("-"),caseSensitive:h.props.caseSensitive,element:h.props.element,Component:h.props.Component,index:h.props.index,path:h.props.path,loader:h.props.loader,action:h.props.action,errorElement:h.props.errorElement,ErrorBoundary:h.props.ErrorBoundary,hasErrorBoundary:h.props.ErrorBoundary!=null||h.props.errorElement!=null,shouldRevalidate:h.props.shouldRevalidate,handle:h.props.handle,lazy:h.props.lazy};h.props.children&&(E.children=VC(h.props.children,v)),s.push(E)}),s}/**
|
||
* React Router DOM v6.30.4
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/function jC(){return jC=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var h in s)({}).hasOwnProperty.call(s,h)&&(n[h]=s[h])}return n},jC.apply(null,arguments)}function eY(n,t){if(n==null)return{};var s={};for(var h in n)if({}.hasOwnProperty.call(n,h)){if(t.indexOf(h)!==-1)continue;s[h]=n[h]}return s}function tY(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function nY(n,t){return n.button===0&&(!t||t==="_self")&&!tY(n)}function UC(n){return n===void 0&&(n=""),new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((t,s)=>{let h=n[s];return t.concat(Array.isArray(h)?h.map(g=>[s,g]):[[s,h]])},[]))}function rY(n,t){let s=UC(n);return t&&t.forEach((h,g)=>{s.has(g)||t.getAll(g).forEach(v=>{s.append(g,v)})}),s}const iY=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],oY="6";try{window.__reactRouterVersion=oY}catch{}const sY="startTransition",gz=IT[sY];function aY(n){let{basename:t,children:s,future:h,window:g}=n,v=Y.useRef();v.current==null&&(v.current=lK({window:g,v5Compat:!0}));let E=v.current,[c,T]=Y.useState({action:E.action,location:E.location}),{v7_startTransition:L}=h||{},B=Y.useCallback(U=>{L&&gz?gz(()=>T(U)):T(U)},[T,L]);return Y.useLayoutEffect(()=>E.listen(B),[E,B]),Y.useEffect(()=>YK(h),[h]),Y.createElement(QK,{basename:t,children:s,location:c.location,navigationType:c.action,navigator:E,future:h})}const lY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cY=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qle=Y.forwardRef(function(t,s){let{onClick:h,relative:g,reloadDocument:v,replace:E,state:c,target:T,to:L,preventScrollReset:B,viewTransition:U}=t,H=eY(t,iY),{basename:X}=Y.useContext(of),ae,ne=!1;if(typeof L=="string"&&cY.test(L)&&(ae=L,lY))try{let he=new URL(window.location.href),_e=L.startsWith("//")?new URL(he.protocol+L):new URL(L),De=zM(_e.pathname,X);_e.origin===he.origin&&De!=null?L=De+_e.search+_e.hash:ne=!0}catch{}let me=FK(L,{relative:g}),oe=uY(L,{replace:E,state:c,target:T,preventScrollReset:B,relative:g,viewTransition:U});function re(he){h&&h(he),he.defaultPrevented||oe(he)}return Y.createElement("a",jC({},H,{href:ae||me,onClick:ne||v?h:re,ref:s,target:T}))});var _z;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(_z||(_z={}));var yz;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(yz||(yz={}));function uY(n,t){let{target:s,replace:h,state:g,preventScrollReset:v,relative:E,viewTransition:c}=t===void 0?{}:t,T=Y_(),L=em(),B=LV(n,{relative:E});return Y.useCallback(U=>{if(nY(U,s)){U.preventDefault();let H=h!==void 0?h:uT(L)===uT(B);T(n,{replace:H,state:g,preventScrollReset:v,relative:E,viewTransition:c})}},[L,T,B,h,g,s,n,v,E,c])}function dY(n){let t=Y.useRef(UC(n)),s=Y.useRef(!1),h=em(),g=Y.useMemo(()=>rY(h.search,s.current?null:t.current),[h.search]),v=Y_(),E=Y.useCallback((c,T)=>{const L=UC(typeof c=="function"?c(g):c);s.current=!0,v("?"+L,T)},[v,g]);return[g,E]}class hY{constructor(t){Tk(this,"config");Tk(this,"listeners",new Set);this.config={token_key:"qz_auth_token",refresh_token_key:"qz_refresh_token",auto_refresh:!0,...t}}async request(t,s={}){const h=`${this.config.api_base_url}${t}`,g=this.getToken(),v={"Content-Type":"application/json",...s.headers||{}};g&&(v.Authorization=`Bearer ${g}`);const E=await fetch(h,{...s,headers:v});if(!E.ok){const c=await E.json().catch(()=>({}));throw new fY(c.message||`HTTP ${E.status}`,E.status,c.code)}return E.json()}getToken(){return localStorage.getItem(this.config.token_key)}setToken(t){localStorage.setItem(this.config.token_key,t)}getRefreshToken(){return localStorage.getItem(this.config.refresh_token_key)}setRefreshToken(t){localStorage.setItem(this.config.refresh_token_key,t)}clearTokens(){localStorage.removeItem(this.config.token_key),localStorage.removeItem(this.config.refresh_token_key)}isTokenValid(){const t=this.getToken();if(!t)return!1;try{return(JSON.parse(atob(t.split(".")[1])).exp??0)>Math.floor(Date.now()/1e3)}catch{return!1}}async register(t){const s=await this.request("/auth/register",{method:"POST",body:JSON.stringify(t)});return s.token&&(this.setToken(s.token),s.refresh_token&&this.setRefreshToken(s.refresh_token)),s}async login(t){const s=await this.request("/auth/login",{method:"POST",body:JSON.stringify(t)});return s.token&&(this.setToken(s.token),s.refresh_token&&this.setRefreshToken(s.refresh_token)),s}async oauthLogin(t){const s=await this.request("/auth/oauth",{method:"POST",body:JSON.stringify(t)});return s.token&&this.setToken(s.token),s}async logout(){if(this.getToken())try{await this.request("/auth/logout",{method:"POST"})}catch{}this.clearTokens(),this.emit({type:"logout"})}async getCurrentUser(){if(!this.isTokenValid())return null;try{return(await this.request("/auth/me")).user}catch{return this.clearTokens(),null}}async refreshToken(){const t=this.getRefreshToken();if(!t)return null;try{const s=await this.request("/auth/refresh",{method:"POST",body:JSON.stringify({refresh_token:t})});if(s.token)return this.setToken(s.token),this.emit({type:"token_refresh",token:s.token}),s.token}catch{this.clearTokens()}return null}async getKYZStatus(){return this.request("/kyz/status")}async submitKYZ(t){return this.request("/kyz/submit",{method:"POST",body:JSON.stringify(t)})}async uploadDocument(t,s){const h=new FormData;return h.append("file",s),h.append("type",t),this.request("/kyz/documents",{method:"POST",body:h,headers:{}})}async registerCompany(t){return this.request("/company/register",{method:"POST",body:JSON.stringify(t)})}async getCompanyInfo(){try{return await this.request("/company")}catch{return null}}async verifyCompany(t){return this.request("/company/verify",{method:"POST",body:JSON.stringify({org_number:t})})}async getPayoutSettings(){try{return await this.request("/payouts/settings")}catch{return null}}async updatePayoutSettings(t){return this.request("/payouts/settings",{method:"PUT",body:JSON.stringify(t)})}async calculatePayout(t){return this.request("/payouts/calculate",{method:"POST",body:JSON.stringify(t)})}async requestPayout(t){return this.request("/payouts/request",{method:"POST",body:JSON.stringify(t)})}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t){this.listeners.forEach(s=>s(t))}}class fY extends Error{constructor(t,s,h){super(t),this.status=s,this.code=h,this.name="AuthAPIError"}}var ii;(function(n){n.assertEqual=g=>{};function t(g){}n.assertIs=t;function s(g){throw new Error}n.assertNever=s,n.arrayToEnum=g=>{const v={};for(const E of g)v[E]=E;return v},n.getValidEnumValues=g=>{const v=n.objectKeys(g).filter(c=>typeof g[g[c]]!="number"),E={};for(const c of v)E[c]=g[c];return n.objectValues(E)},n.objectValues=g=>n.objectKeys(g).map(function(v){return g[v]}),n.objectKeys=typeof Object.keys=="function"?g=>Object.keys(g):g=>{const v=[];for(const E in g)Object.prototype.hasOwnProperty.call(g,E)&&v.push(E);return v},n.find=(g,v)=>{for(const E of g)if(v(E))return E},n.isInteger=typeof Number.isInteger=="function"?g=>Number.isInteger(g):g=>typeof g=="number"&&Number.isFinite(g)&&Math.floor(g)===g;function h(g,v=" | "){return g.map(E=>typeof E=="string"?`'${E}'`:E).join(v)}n.joinValues=h,n.jsonStringifyReplacer=(g,v)=>typeof v=="bigint"?v.toString():v})(ii||(ii={}));var vz;(function(n){n.mergeShapes=(t,s)=>({...t,...s})})(vz||(vz={}));const In=ii.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Th=n=>{switch(typeof n){case"undefined":return In.undefined;case"string":return In.string;case"number":return Number.isNaN(n)?In.nan:In.number;case"boolean":return In.boolean;case"function":return In.function;case"bigint":return In.bigint;case"symbol":return In.symbol;case"object":return Array.isArray(n)?In.array:n===null?In.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?In.promise:typeof Map<"u"&&n instanceof Map?In.map:typeof Set<"u"&&n instanceof Set?In.set:typeof Date<"u"&&n instanceof Date?In.date:In.object;default:return In.unknown}},on=ii.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class vd extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=h=>{this.issues=[...this.issues,h]},this.addIssues=(h=[])=>{this.issues=[...this.issues,...h]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(v){return v.message},h={_errors:[]},g=v=>{for(const E of v.issues)if(E.code==="invalid_union")E.unionErrors.map(g);else if(E.code==="invalid_return_type")g(E.returnTypeError);else if(E.code==="invalid_arguments")g(E.argumentsError);else if(E.path.length===0)h._errors.push(s(E));else{let c=h,T=0;for(;T<E.path.length;){const L=E.path[T];T===E.path.length-1?(c[L]=c[L]||{_errors:[]},c[L]._errors.push(s(E))):c[L]=c[L]||{_errors:[]},c=c[L],T++}}};return g(this),h}static assert(t){if(!(t instanceof vd))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ii.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s={},h=[];for(const g of this.issues)if(g.path.length>0){const v=g.path[0];s[v]=s[v]||[],s[v].push(t(g))}else h.push(t(g));return{formErrors:h,fieldErrors:s}}get formErrors(){return this.flatten()}}vd.create=n=>new vd(n);const GC=(n,t)=>{let s;switch(n.code){case on.invalid_type:n.received===In.undefined?s="Required":s=`Expected ${n.expected}, received ${n.received}`;break;case on.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(n.expected,ii.jsonStringifyReplacer)}`;break;case on.unrecognized_keys:s=`Unrecognized key(s) in object: ${ii.joinValues(n.keys,", ")}`;break;case on.invalid_union:s="Invalid input";break;case on.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${ii.joinValues(n.options)}`;break;case on.invalid_enum_value:s=`Invalid enum value. Expected ${ii.joinValues(n.options)}, received '${n.received}'`;break;case on.invalid_arguments:s="Invalid function arguments";break;case on.invalid_return_type:s="Invalid function return type";break;case on.invalid_date:s="Invalid date";break;case on.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(s=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?s=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?s=`Invalid input: must end with "${n.validation.endsWith}"`:ii.assertNever(n.validation):n.validation!=="regex"?s=`Invalid ${n.validation}`:s="Invalid";break;case on.too_small:n.type==="array"?s=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?s=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?s=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?s=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?s=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:s="Invalid input";break;case on.too_big:n.type==="array"?s=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?s=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?s=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?s=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?s=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:s="Invalid input";break;case on.custom:s="Invalid input";break;case on.invalid_intersection_types:s="Intersection results could not be merged";break;case on.not_multiple_of:s=`Number must be a multiple of ${n.multipleOf}`;break;case on.not_finite:s="Number must be finite";break;default:s=t.defaultError,ii.assertNever(n)}return{message:s}};let pY=GC;function mY(){return pY}const gY=n=>{const{data:t,path:s,errorMaps:h,issueData:g}=n,v=[...s,...g.path||[]],E={...g,path:v};if(g.message!==void 0)return{...g,path:v,message:g.message};let c="";const T=h.filter(L=>!!L).slice().reverse();for(const L of T)c=L(E,{data:t,defaultError:c}).message;return{...g,path:v,message:c}};function _n(n,t){const s=mY(),h=gY({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,s,s===GC?void 0:GC].filter(g=>!!g)});n.common.issues.push(h)}class fl{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const h=[];for(const g of s){if(g.status==="aborted")return _r;g.status==="dirty"&&t.dirty(),h.push(g.value)}return{status:t.value,value:h}}static async mergeObjectAsync(t,s){const h=[];for(const g of s){const v=await g.key,E=await g.value;h.push({key:v,value:E})}return fl.mergeObjectSync(t,h)}static mergeObjectSync(t,s){const h={};for(const g of s){const{key:v,value:E}=g;if(v.status==="aborted"||E.status==="aborted")return _r;v.status==="dirty"&&t.dirty(),E.status==="dirty"&&t.dirty(),v.value!=="__proto__"&&(typeof E.value<"u"||g.alwaysSet)&&(h[v.value]=E.value)}return{status:t.value,value:h}}}const _r=Object.freeze({status:"aborted"}),B0=n=>({status:"dirty",value:n}),Hl=n=>({status:"valid",value:n}),xz=n=>n.status==="aborted",bz=n=>n.status==="dirty",P_=n=>n.status==="valid",dT=n=>typeof Promise<"u"&&n instanceof Promise;var Ln;(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ln||(Ln={}));class Yh{constructor(t,s,h,g){this._cachedPath=[],this.parent=t,this.data=s,this._path=h,this._key=g}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const wz=(n,t)=>{if(P_(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new vd(n.common.issues);return this._error=s,this._error}}};function Br(n){if(!n)return{};const{errorMap:t,invalid_type_error:s,required_error:h,description:g}=n;if(t&&(s||h))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:g}:{errorMap:(E,c)=>{const{message:T}=n;return E.code==="invalid_enum_value"?{message:T??c.defaultError}:typeof c.data>"u"?{message:T??h??c.defaultError}:E.code!=="invalid_type"?{message:c.defaultError}:{message:T??s??c.defaultError}},description:g}}class ei{get description(){return this._def.description}_getType(t){return Th(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:Th(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new fl,ctx:{common:t.parent.common,data:t.data,parsedType:Th(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const s=this._parse(t);if(dT(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const h=this.safeParse(t,s);if(h.success)return h.data;throw h.error}safeParse(t,s){const h={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Th(t)},g=this._parseSync({data:t,path:h.path,parent:h});return wz(h,g)}"~validate"(t){var h,g;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Th(t)};if(!this["~standard"].async)try{const v=this._parseSync({data:t,path:[],parent:s});return P_(v)?{value:v.value}:{issues:s.common.issues}}catch(v){(g=(h=v==null?void 0:v.message)==null?void 0:h.toLowerCase())!=null&&g.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(v=>P_(v)?{value:v.value}:{issues:s.common.issues})}async parseAsync(t,s){const h=await this.safeParseAsync(t,s);if(h.success)return h.data;throw h.error}async safeParseAsync(t,s){const h={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Th(t)},g=this._parse({data:t,path:h.path,parent:h}),v=await(dT(g)?g:Promise.resolve(g));return wz(h,v)}refine(t,s){const h=g=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(g):s;return this._refinement((g,v)=>{const E=t(g),c=()=>v.addIssue({code:on.custom,...h(g)});return typeof Promise<"u"&&E instanceof Promise?E.then(T=>T?!0:(c(),!1)):E?!0:(c(),!1)})}refinement(t,s){return this._refinement((h,g)=>t(h)?!0:(g.addIssue(typeof s=="function"?s(h,g):s),!1))}_refinement(t){return new R_({schema:this,typeName:yr.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return Wh.create(this,this._def)}nullable(){return L_.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xu.create(this)}promise(){return mT.create(this,this._def)}or(t){return fT.create([this,t],this._def)}and(t){return pT.create(this,t,this._def)}transform(t){return new R_({...Br(this._def),schema:this,typeName:yr.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new HC({...Br(this._def),innerType:this,defaultValue:s,typeName:yr.ZodDefault})}brand(){return new NY({typeName:yr.ZodBranded,type:this,...Br(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new WC({...Br(this._def),innerType:this,catchValue:s,typeName:yr.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return jM.create(this,t)}readonly(){return qC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _Y=/^c[^\s-]{8,}$/i,yY=/^[0-9a-z]+$/,vY=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xY=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,bY=/^[a-z0-9_-]{21}$/i,wY=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,SY=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TY=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,EY="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sA;const kY=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,AY=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,CY=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,IY=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,MY=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PY=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,BV="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",DY=new RegExp(`^${BV}$`);function NV(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);const s=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${s}`}function RY(n){return new RegExp(`^${NV(n)}$`)}function LY(n){let t=`${BV}T${NV(n)}`;const s=[];return s.push(n.local?"Z?":"Z"),n.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function OY(n,t){return!!((t==="v4"||!t)&&kY.test(n)||(t==="v6"||!t)&&CY.test(n))}function FY(n,t){if(!wY.test(n))return!1;try{const[s]=n.split(".");if(!s)return!1;const h=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),g=JSON.parse(atob(h));return!(typeof g!="object"||g===null||"typ"in g&&(g==null?void 0:g.typ)!=="JWT"||!g.alg||t&&g.alg!==t)}catch{return!1}}function zY(n,t){return!!((t==="v4"||!t)&&AY.test(n)||(t==="v6"||!t)&&IY.test(n))}class Fh extends ei{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==In.string){const v=this._getOrReturnCtx(t);return _n(v,{code:on.invalid_type,expected:In.string,received:v.parsedType}),_r}const h=new fl;let g;for(const v of this._def.checks)if(v.kind==="min")t.data.length<v.value&&(g=this._getOrReturnCtx(t,g),_n(g,{code:on.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),h.dirty());else if(v.kind==="max")t.data.length>v.value&&(g=this._getOrReturnCtx(t,g),_n(g,{code:on.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),h.dirty());else if(v.kind==="length"){const E=t.data.length>v.value,c=t.data.length<v.value;(E||c)&&(g=this._getOrReturnCtx(t,g),E?_n(g,{code:on.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}):c&&_n(g,{code:on.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}),h.dirty())}else if(v.kind==="email")TY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"email",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="emoji")sA||(sA=new RegExp(EY,"u")),sA.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"emoji",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="uuid")xY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"uuid",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="nanoid")bY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"nanoid",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="cuid")_Y.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"cuid",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="cuid2")yY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"cuid2",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="ulid")vY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"ulid",code:on.invalid_string,message:v.message}),h.dirty());else if(v.kind==="url")try{new URL(t.data)}catch{g=this._getOrReturnCtx(t,g),_n(g,{validation:"url",code:on.invalid_string,message:v.message}),h.dirty()}else v.kind==="regex"?(v.regex.lastIndex=0,v.regex.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"regex",code:on.invalid_string,message:v.message}),h.dirty())):v.kind==="trim"?t.data=t.data.trim():v.kind==="includes"?t.data.includes(v.value,v.position)||(g=this._getOrReturnCtx(t,g),_n(g,{code:on.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),h.dirty()):v.kind==="toLowerCase"?t.data=t.data.toLowerCase():v.kind==="toUpperCase"?t.data=t.data.toUpperCase():v.kind==="startsWith"?t.data.startsWith(v.value)||(g=this._getOrReturnCtx(t,g),_n(g,{code:on.invalid_string,validation:{startsWith:v.value},message:v.message}),h.dirty()):v.kind==="endsWith"?t.data.endsWith(v.value)||(g=this._getOrReturnCtx(t,g),_n(g,{code:on.invalid_string,validation:{endsWith:v.value},message:v.message}),h.dirty()):v.kind==="datetime"?LY(v).test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{code:on.invalid_string,validation:"datetime",message:v.message}),h.dirty()):v.kind==="date"?DY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{code:on.invalid_string,validation:"date",message:v.message}),h.dirty()):v.kind==="time"?RY(v).test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{code:on.invalid_string,validation:"time",message:v.message}),h.dirty()):v.kind==="duration"?SY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"duration",code:on.invalid_string,message:v.message}),h.dirty()):v.kind==="ip"?OY(t.data,v.version)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"ip",code:on.invalid_string,message:v.message}),h.dirty()):v.kind==="jwt"?FY(t.data,v.alg)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"jwt",code:on.invalid_string,message:v.message}),h.dirty()):v.kind==="cidr"?zY(t.data,v.version)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"cidr",code:on.invalid_string,message:v.message}),h.dirty()):v.kind==="base64"?MY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"base64",code:on.invalid_string,message:v.message}),h.dirty()):v.kind==="base64url"?PY.test(t.data)||(g=this._getOrReturnCtx(t,g),_n(g,{validation:"base64url",code:on.invalid_string,message:v.message}),h.dirty()):ii.assertNever(v);return{status:h.value,value:t.data}}_regex(t,s,h){return this.refinement(g=>t.test(g),{validation:s,code:on.invalid_string,...Ln.errToObj(h)})}_addCheck(t){return new Fh({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ln.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ln.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ln.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ln.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ln.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ln.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ln.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ln.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ln.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ln.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ln.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ln.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ln.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Ln.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ln.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ln.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...Ln.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s==null?void 0:s.position,...Ln.errToObj(s==null?void 0:s.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...Ln.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...Ln.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...Ln.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...Ln.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...Ln.errToObj(s)})}nonempty(t){return this.min(1,Ln.errToObj(t))}trim(){return new Fh({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fh({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fh({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}Fh.create=n=>new Fh({checks:[],typeName:yr.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...Br(n)});function BY(n,t){const s=(n.toString().split(".")[1]||"").length,h=(t.toString().split(".")[1]||"").length,g=s>h?s:h,v=Number.parseInt(n.toFixed(g).replace(".","")),E=Number.parseInt(t.toFixed(g).replace(".",""));return v%E/10**g}class Ax extends ei{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==In.number){const v=this._getOrReturnCtx(t);return _n(v,{code:on.invalid_type,expected:In.number,received:v.parsedType}),_r}let h;const g=new fl;for(const v of this._def.checks)v.kind==="int"?ii.isInteger(t.data)||(h=this._getOrReturnCtx(t,h),_n(h,{code:on.invalid_type,expected:"integer",received:"float",message:v.message}),g.dirty()):v.kind==="min"?(v.inclusive?t.data<v.value:t.data<=v.value)&&(h=this._getOrReturnCtx(t,h),_n(h,{code:on.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),g.dirty()):v.kind==="max"?(v.inclusive?t.data>v.value:t.data>=v.value)&&(h=this._getOrReturnCtx(t,h),_n(h,{code:on.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),g.dirty()):v.kind==="multipleOf"?BY(t.data,v.value)!==0&&(h=this._getOrReturnCtx(t,h),_n(h,{code:on.not_multiple_of,multipleOf:v.value,message:v.message}),g.dirty()):v.kind==="finite"?Number.isFinite(t.data)||(h=this._getOrReturnCtx(t,h),_n(h,{code:on.not_finite,message:v.message}),g.dirty()):ii.assertNever(v);return{status:g.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,Ln.toString(s))}gt(t,s){return this.setLimit("min",t,!1,Ln.toString(s))}lte(t,s){return this.setLimit("max",t,!0,Ln.toString(s))}lt(t,s){return this.setLimit("max",t,!1,Ln.toString(s))}setLimit(t,s,h,g){return new Ax({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:h,message:Ln.toString(g)}]})}_addCheck(t){return new Ax({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ln.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ln.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ln.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ln.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ln.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:Ln.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:Ln.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ln.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ln.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ii.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const h of this._def.checks){if(h.kind==="finite"||h.kind==="int"||h.kind==="multipleOf")return!0;h.kind==="min"?(s===null||h.value>s)&&(s=h.value):h.kind==="max"&&(t===null||h.value<t)&&(t=h.value)}return Number.isFinite(s)&&Number.isFinite(t)}}Ax.create=n=>new Ax({checks:[],typeName:yr.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...Br(n)});class Cx extends ei{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==In.bigint)return this._getInvalidInput(t);let h;const g=new fl;for(const v of this._def.checks)v.kind==="min"?(v.inclusive?t.data<v.value:t.data<=v.value)&&(h=this._getOrReturnCtx(t,h),_n(h,{code:on.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),g.dirty()):v.kind==="max"?(v.inclusive?t.data>v.value:t.data>=v.value)&&(h=this._getOrReturnCtx(t,h),_n(h,{code:on.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),g.dirty()):v.kind==="multipleOf"?t.data%v.value!==BigInt(0)&&(h=this._getOrReturnCtx(t,h),_n(h,{code:on.not_multiple_of,multipleOf:v.value,message:v.message}),g.dirty()):ii.assertNever(v);return{status:g.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return _n(s,{code:on.invalid_type,expected:In.bigint,received:s.parsedType}),_r}gte(t,s){return this.setLimit("min",t,!0,Ln.toString(s))}gt(t,s){return this.setLimit("min",t,!1,Ln.toString(s))}lte(t,s){return this.setLimit("max",t,!0,Ln.toString(s))}lt(t,s){return this.setLimit("max",t,!1,Ln.toString(s))}setLimit(t,s,h,g){return new Cx({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:h,message:Ln.toString(g)}]})}_addCheck(t){return new Cx({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ln.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ln.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ln.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ln.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:Ln.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}Cx.create=n=>new Cx({checks:[],typeName:yr.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...Br(n)});class Sz extends ei{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==In.boolean){const h=this._getOrReturnCtx(t);return _n(h,{code:on.invalid_type,expected:In.boolean,received:h.parsedType}),_r}return Hl(t.data)}}Sz.create=n=>new Sz({typeName:yr.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...Br(n)});class hT extends ei{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==In.date){const v=this._getOrReturnCtx(t);return _n(v,{code:on.invalid_type,expected:In.date,received:v.parsedType}),_r}if(Number.isNaN(t.data.getTime())){const v=this._getOrReturnCtx(t);return _n(v,{code:on.invalid_date}),_r}const h=new fl;let g;for(const v of this._def.checks)v.kind==="min"?t.data.getTime()<v.value&&(g=this._getOrReturnCtx(t,g),_n(g,{code:on.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),h.dirty()):v.kind==="max"?t.data.getTime()>v.value&&(g=this._getOrReturnCtx(t,g),_n(g,{code:on.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),h.dirty()):ii.assertNever(v);return{status:h.value,value:new Date(t.data.getTime())}}_addCheck(t){return new hT({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:Ln.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:Ln.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}}hT.create=n=>new hT({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:yr.ZodDate,...Br(n)});class Tz extends ei{_parse(t){if(this._getType(t)!==In.symbol){const h=this._getOrReturnCtx(t);return _n(h,{code:on.invalid_type,expected:In.symbol,received:h.parsedType}),_r}return Hl(t.data)}}Tz.create=n=>new Tz({typeName:yr.ZodSymbol,...Br(n)});class Ez extends ei{_parse(t){if(this._getType(t)!==In.undefined){const h=this._getOrReturnCtx(t);return _n(h,{code:on.invalid_type,expected:In.undefined,received:h.parsedType}),_r}return Hl(t.data)}}Ez.create=n=>new Ez({typeName:yr.ZodUndefined,...Br(n)});class kz extends ei{_parse(t){if(this._getType(t)!==In.null){const h=this._getOrReturnCtx(t);return _n(h,{code:on.invalid_type,expected:In.null,received:h.parsedType}),_r}return Hl(t.data)}}kz.create=n=>new kz({typeName:yr.ZodNull,...Br(n)});class Az extends ei{constructor(){super(...arguments),this._any=!0}_parse(t){return Hl(t.data)}}Az.create=n=>new Az({typeName:yr.ZodAny,...Br(n)});class Cz extends ei{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Hl(t.data)}}Cz.create=n=>new Cz({typeName:yr.ZodUnknown,...Br(n)});class Qh extends ei{_parse(t){const s=this._getOrReturnCtx(t);return _n(s,{code:on.invalid_type,expected:In.never,received:s.parsedType}),_r}}Qh.create=n=>new Qh({typeName:yr.ZodNever,...Br(n)});class Iz extends ei{_parse(t){if(this._getType(t)!==In.undefined){const h=this._getOrReturnCtx(t);return _n(h,{code:on.invalid_type,expected:In.void,received:h.parsedType}),_r}return Hl(t.data)}}Iz.create=n=>new Iz({typeName:yr.ZodVoid,...Br(n)});class xu extends ei{_parse(t){const{ctx:s,status:h}=this._processInputParams(t),g=this._def;if(s.parsedType!==In.array)return _n(s,{code:on.invalid_type,expected:In.array,received:s.parsedType}),_r;if(g.exactLength!==null){const E=s.data.length>g.exactLength.value,c=s.data.length<g.exactLength.value;(E||c)&&(_n(s,{code:E?on.too_big:on.too_small,minimum:c?g.exactLength.value:void 0,maximum:E?g.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:g.exactLength.message}),h.dirty())}if(g.minLength!==null&&s.data.length<g.minLength.value&&(_n(s,{code:on.too_small,minimum:g.minLength.value,type:"array",inclusive:!0,exact:!1,message:g.minLength.message}),h.dirty()),g.maxLength!==null&&s.data.length>g.maxLength.value&&(_n(s,{code:on.too_big,maximum:g.maxLength.value,type:"array",inclusive:!0,exact:!1,message:g.maxLength.message}),h.dirty()),s.common.async)return Promise.all([...s.data].map((E,c)=>g.type._parseAsync(new Yh(s,E,s.path,c)))).then(E=>fl.mergeArray(h,E));const v=[...s.data].map((E,c)=>g.type._parseSync(new Yh(s,E,s.path,c)));return fl.mergeArray(h,v)}get element(){return this._def.type}min(t,s){return new xu({...this._def,minLength:{value:t,message:Ln.toString(s)}})}max(t,s){return new xu({...this._def,maxLength:{value:t,message:Ln.toString(s)}})}length(t,s){return new xu({...this._def,exactLength:{value:t,message:Ln.toString(s)}})}nonempty(t){return this.min(1,t)}}xu.create=(n,t)=>new xu({type:n,minLength:null,maxLength:null,exactLength:null,typeName:yr.ZodArray,...Br(t)});function Ng(n){if(n instanceof Uo){const t={};for(const s in n.shape){const h=n.shape[s];t[s]=Wh.create(Ng(h))}return new Uo({...n._def,shape:()=>t})}else return n instanceof xu?new xu({...n._def,type:Ng(n.element)}):n instanceof Wh?Wh.create(Ng(n.unwrap())):n instanceof L_?L_.create(Ng(n.unwrap())):n instanceof Yp?Yp.create(n.items.map(t=>Ng(t))):n}class Uo extends ei{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),s=ii.objectKeys(t);return this._cached={shape:t,keys:s},this._cached}_parse(t){if(this._getType(t)!==In.object){const L=this._getOrReturnCtx(t);return _n(L,{code:on.invalid_type,expected:In.object,received:L.parsedType}),_r}const{status:h,ctx:g}=this._processInputParams(t),{shape:v,keys:E}=this._getCached(),c=[];if(!(this._def.catchall instanceof Qh&&this._def.unknownKeys==="strip"))for(const L in g.data)E.includes(L)||c.push(L);const T=[];for(const L of E){const B=v[L],U=g.data[L];T.push({key:{status:"valid",value:L},value:B._parse(new Yh(g,U,g.path,L)),alwaysSet:L in g.data})}if(this._def.catchall instanceof Qh){const L=this._def.unknownKeys;if(L==="passthrough")for(const B of c)T.push({key:{status:"valid",value:B},value:{status:"valid",value:g.data[B]}});else if(L==="strict")c.length>0&&(_n(g,{code:on.unrecognized_keys,keys:c}),h.dirty());else if(L!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const L=this._def.catchall;for(const B of c){const U=g.data[B];T.push({key:{status:"valid",value:B},value:L._parse(new Yh(g,U,g.path,B)),alwaysSet:B in g.data})}}return g.common.async?Promise.resolve().then(async()=>{const L=[];for(const B of T){const U=await B.key,H=await B.value;L.push({key:U,value:H,alwaysSet:B.alwaysSet})}return L}).then(L=>fl.mergeObjectSync(h,L)):fl.mergeObjectSync(h,T)}get shape(){return this._def.shape()}strict(t){return Ln.errToObj,new Uo({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,h)=>{var v,E;const g=((E=(v=this._def).errorMap)==null?void 0:E.call(v,s,h).message)??h.defaultError;return s.code==="unrecognized_keys"?{message:Ln.errToObj(t).message??g}:{message:g}}}:{}})}strip(){return new Uo({...this._def,unknownKeys:"strip"})}passthrough(){return new Uo({...this._def,unknownKeys:"passthrough"})}extend(t){return new Uo({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Uo({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:yr.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new Uo({...this._def,catchall:t})}pick(t){const s={};for(const h of ii.objectKeys(t))t[h]&&this.shape[h]&&(s[h]=this.shape[h]);return new Uo({...this._def,shape:()=>s})}omit(t){const s={};for(const h of ii.objectKeys(this.shape))t[h]||(s[h]=this.shape[h]);return new Uo({...this._def,shape:()=>s})}deepPartial(){return Ng(this)}partial(t){const s={};for(const h of ii.objectKeys(this.shape)){const g=this.shape[h];t&&!t[h]?s[h]=g:s[h]=g.optional()}return new Uo({...this._def,shape:()=>s})}required(t){const s={};for(const h of ii.objectKeys(this.shape))if(t&&!t[h])s[h]=this.shape[h];else{let v=this.shape[h];for(;v instanceof Wh;)v=v._def.innerType;s[h]=v}return new Uo({...this._def,shape:()=>s})}keyof(){return VV(ii.objectKeys(this.shape))}}Uo.create=(n,t)=>new Uo({shape:()=>n,unknownKeys:"strip",catchall:Qh.create(),typeName:yr.ZodObject,...Br(t)});Uo.strictCreate=(n,t)=>new Uo({shape:()=>n,unknownKeys:"strict",catchall:Qh.create(),typeName:yr.ZodObject,...Br(t)});Uo.lazycreate=(n,t)=>new Uo({shape:n,unknownKeys:"strip",catchall:Qh.create(),typeName:yr.ZodObject,...Br(t)});class fT extends ei{_parse(t){const{ctx:s}=this._processInputParams(t),h=this._def.options;function g(v){for(const c of v)if(c.result.status==="valid")return c.result;for(const c of v)if(c.result.status==="dirty")return s.common.issues.push(...c.ctx.common.issues),c.result;const E=v.map(c=>new vd(c.ctx.common.issues));return _n(s,{code:on.invalid_union,unionErrors:E}),_r}if(s.common.async)return Promise.all(h.map(async v=>{const E={...s,common:{...s.common,issues:[]},parent:null};return{result:await v._parseAsync({data:s.data,path:s.path,parent:E}),ctx:E}})).then(g);{let v;const E=[];for(const T of h){const L={...s,common:{...s.common,issues:[]},parent:null},B=T._parseSync({data:s.data,path:s.path,parent:L});if(B.status==="valid")return B;B.status==="dirty"&&!v&&(v={result:B,ctx:L}),L.common.issues.length&&E.push(L.common.issues)}if(v)return s.common.issues.push(...v.ctx.common.issues),v.result;const c=E.map(T=>new vd(T));return _n(s,{code:on.invalid_union,unionErrors:c}),_r}}get options(){return this._def.options}}fT.create=(n,t)=>new fT({options:n,typeName:yr.ZodUnion,...Br(t)});function $C(n,t){const s=Th(n),h=Th(t);if(n===t)return{valid:!0,data:n};if(s===In.object&&h===In.object){const g=ii.objectKeys(t),v=ii.objectKeys(n).filter(c=>g.indexOf(c)!==-1),E={...n,...t};for(const c of v){const T=$C(n[c],t[c]);if(!T.valid)return{valid:!1};E[c]=T.data}return{valid:!0,data:E}}else if(s===In.array&&h===In.array){if(n.length!==t.length)return{valid:!1};const g=[];for(let v=0;v<n.length;v++){const E=n[v],c=t[v],T=$C(E,c);if(!T.valid)return{valid:!1};g.push(T.data)}return{valid:!0,data:g}}else return s===In.date&&h===In.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}class pT extends ei{_parse(t){const{status:s,ctx:h}=this._processInputParams(t),g=(v,E)=>{if(xz(v)||xz(E))return _r;const c=$C(v.value,E.value);return c.valid?((bz(v)||bz(E))&&s.dirty(),{status:s.value,value:c.data}):(_n(h,{code:on.invalid_intersection_types}),_r)};return h.common.async?Promise.all([this._def.left._parseAsync({data:h.data,path:h.path,parent:h}),this._def.right._parseAsync({data:h.data,path:h.path,parent:h})]).then(([v,E])=>g(v,E)):g(this._def.left._parseSync({data:h.data,path:h.path,parent:h}),this._def.right._parseSync({data:h.data,path:h.path,parent:h}))}}pT.create=(n,t,s)=>new pT({left:n,right:t,typeName:yr.ZodIntersection,...Br(s)});class Yp extends ei{_parse(t){const{status:s,ctx:h}=this._processInputParams(t);if(h.parsedType!==In.array)return _n(h,{code:on.invalid_type,expected:In.array,received:h.parsedType}),_r;if(h.data.length<this._def.items.length)return _n(h,{code:on.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_r;!this._def.rest&&h.data.length>this._def.items.length&&(_n(h,{code:on.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const v=[...h.data].map((E,c)=>{const T=this._def.items[c]||this._def.rest;return T?T._parse(new Yh(h,E,h.path,c)):null}).filter(E=>!!E);return h.common.async?Promise.all(v).then(E=>fl.mergeArray(s,E)):fl.mergeArray(s,v)}get items(){return this._def.items}rest(t){return new Yp({...this._def,rest:t})}}Yp.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yp({items:n,typeName:yr.ZodTuple,rest:null,...Br(t)})};class Mz extends ei{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:h}=this._processInputParams(t);if(h.parsedType!==In.map)return _n(h,{code:on.invalid_type,expected:In.map,received:h.parsedType}),_r;const g=this._def.keyType,v=this._def.valueType,E=[...h.data.entries()].map(([c,T],L)=>({key:g._parse(new Yh(h,c,h.path,[L,"key"])),value:v._parse(new Yh(h,T,h.path,[L,"value"]))}));if(h.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const T of E){const L=await T.key,B=await T.value;if(L.status==="aborted"||B.status==="aborted")return _r;(L.status==="dirty"||B.status==="dirty")&&s.dirty(),c.set(L.value,B.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const T of E){const L=T.key,B=T.value;if(L.status==="aborted"||B.status==="aborted")return _r;(L.status==="dirty"||B.status==="dirty")&&s.dirty(),c.set(L.value,B.value)}return{status:s.value,value:c}}}}Mz.create=(n,t,s)=>new Mz({valueType:t,keyType:n,typeName:yr.ZodMap,...Br(s)});class Ix extends ei{_parse(t){const{status:s,ctx:h}=this._processInputParams(t);if(h.parsedType!==In.set)return _n(h,{code:on.invalid_type,expected:In.set,received:h.parsedType}),_r;const g=this._def;g.minSize!==null&&h.data.size<g.minSize.value&&(_n(h,{code:on.too_small,minimum:g.minSize.value,type:"set",inclusive:!0,exact:!1,message:g.minSize.message}),s.dirty()),g.maxSize!==null&&h.data.size>g.maxSize.value&&(_n(h,{code:on.too_big,maximum:g.maxSize.value,type:"set",inclusive:!0,exact:!1,message:g.maxSize.message}),s.dirty());const v=this._def.valueType;function E(T){const L=new Set;for(const B of T){if(B.status==="aborted")return _r;B.status==="dirty"&&s.dirty(),L.add(B.value)}return{status:s.value,value:L}}const c=[...h.data.values()].map((T,L)=>v._parse(new Yh(h,T,h.path,L)));return h.common.async?Promise.all(c).then(T=>E(T)):E(c)}min(t,s){return new Ix({...this._def,minSize:{value:t,message:Ln.toString(s)}})}max(t,s){return new Ix({...this._def,maxSize:{value:t,message:Ln.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}Ix.create=(n,t)=>new Ix({valueType:n,minSize:null,maxSize:null,typeName:yr.ZodSet,...Br(t)});class Pz extends ei{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Pz.create=(n,t)=>new Pz({getter:n,typeName:yr.ZodLazy,...Br(t)});class Dz extends ei{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return _n(s,{received:s.data,code:on.invalid_literal,expected:this._def.value}),_r}return{status:"valid",value:t.data}}get value(){return this._def.value}}Dz.create=(n,t)=>new Dz({value:n,typeName:yr.ZodLiteral,...Br(t)});function VV(n,t){return new D_({values:n,typeName:yr.ZodEnum,...Br(t)})}class D_ extends ei{_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),h=this._def.values;return _n(s,{expected:ii.joinValues(h),received:s.parsedType,code:on.invalid_type}),_r}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const s=this._getOrReturnCtx(t),h=this._def.values;return _n(s,{received:s.data,code:on.invalid_enum_value,options:h}),_r}return Hl(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return D_.create(t,{...this._def,...s})}exclude(t,s=this._def){return D_.create(this.options.filter(h=>!t.includes(h)),{...this._def,...s})}}D_.create=VV;class Rz extends ei{_parse(t){const s=ii.getValidEnumValues(this._def.values),h=this._getOrReturnCtx(t);if(h.parsedType!==In.string&&h.parsedType!==In.number){const g=ii.objectValues(s);return _n(h,{expected:ii.joinValues(g),received:h.parsedType,code:on.invalid_type}),_r}if(this._cache||(this._cache=new Set(ii.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const g=ii.objectValues(s);return _n(h,{received:h.data,code:on.invalid_enum_value,options:g}),_r}return Hl(t.data)}get enum(){return this._def.values}}Rz.create=(n,t)=>new Rz({values:n,typeName:yr.ZodNativeEnum,...Br(t)});class mT extends ei{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==In.promise&&s.common.async===!1)return _n(s,{code:on.invalid_type,expected:In.promise,received:s.parsedType}),_r;const h=s.parsedType===In.promise?s.data:Promise.resolve(s.data);return Hl(h.then(g=>this._def.type.parseAsync(g,{path:s.path,errorMap:s.common.contextualErrorMap})))}}mT.create=(n,t)=>new mT({type:n,typeName:yr.ZodPromise,...Br(t)});class R_ extends ei{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===yr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:h}=this._processInputParams(t),g=this._def.effect||null,v={addIssue:E=>{_n(h,E),E.fatal?s.abort():s.dirty()},get path(){return h.path}};if(v.addIssue=v.addIssue.bind(v),g.type==="preprocess"){const E=g.transform(h.data,v);if(h.common.async)return Promise.resolve(E).then(async c=>{if(s.value==="aborted")return _r;const T=await this._def.schema._parseAsync({data:c,path:h.path,parent:h});return T.status==="aborted"?_r:T.status==="dirty"||s.value==="dirty"?B0(T.value):T});{if(s.value==="aborted")return _r;const c=this._def.schema._parseSync({data:E,path:h.path,parent:h});return c.status==="aborted"?_r:c.status==="dirty"||s.value==="dirty"?B0(c.value):c}}if(g.type==="refinement"){const E=c=>{const T=g.refinement(c,v);if(h.common.async)return Promise.resolve(T);if(T instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(h.common.async===!1){const c=this._def.schema._parseSync({data:h.data,path:h.path,parent:h});return c.status==="aborted"?_r:(c.status==="dirty"&&s.dirty(),E(c.value),{status:s.value,value:c.value})}else return this._def.schema._parseAsync({data:h.data,path:h.path,parent:h}).then(c=>c.status==="aborted"?_r:(c.status==="dirty"&&s.dirty(),E(c.value).then(()=>({status:s.value,value:c.value}))))}if(g.type==="transform")if(h.common.async===!1){const E=this._def.schema._parseSync({data:h.data,path:h.path,parent:h});if(!P_(E))return _r;const c=g.transform(E.value,v);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:c}}else return this._def.schema._parseAsync({data:h.data,path:h.path,parent:h}).then(E=>P_(E)?Promise.resolve(g.transform(E.value,v)).then(c=>({status:s.value,value:c})):_r);ii.assertNever(g)}}R_.create=(n,t,s)=>new R_({schema:n,typeName:yr.ZodEffects,effect:t,...Br(s)});R_.createWithPreprocess=(n,t,s)=>new R_({schema:t,effect:{type:"preprocess",transform:n},typeName:yr.ZodEffects,...Br(s)});class Wh extends ei{_parse(t){return this._getType(t)===In.undefined?Hl(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wh.create=(n,t)=>new Wh({innerType:n,typeName:yr.ZodOptional,...Br(t)});class L_ extends ei{_parse(t){return this._getType(t)===In.null?Hl(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}L_.create=(n,t)=>new L_({innerType:n,typeName:yr.ZodNullable,...Br(t)});class HC extends ei{_parse(t){const{ctx:s}=this._processInputParams(t);let h=s.data;return s.parsedType===In.undefined&&(h=this._def.defaultValue()),this._def.innerType._parse({data:h,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}HC.create=(n,t)=>new HC({innerType:n,typeName:yr.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Br(t)});class WC extends ei{_parse(t){const{ctx:s}=this._processInputParams(t),h={...s,common:{...s.common,issues:[]}},g=this._def.innerType._parse({data:h.data,path:h.path,parent:{...h}});return dT(g)?g.then(v=>({status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new vd(h.common.issues)},input:h.data})})):{status:"valid",value:g.status==="valid"?g.value:this._def.catchValue({get error(){return new vd(h.common.issues)},input:h.data})}}removeCatch(){return this._def.innerType}}WC.create=(n,t)=>new WC({innerType:n,typeName:yr.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Br(t)});class Lz extends ei{_parse(t){if(this._getType(t)!==In.nan){const h=this._getOrReturnCtx(t);return _n(h,{code:on.invalid_type,expected:In.nan,received:h.parsedType}),_r}return{status:"valid",value:t.data}}}Lz.create=n=>new Lz({typeName:yr.ZodNaN,...Br(n)});class NY extends ei{_parse(t){const{ctx:s}=this._processInputParams(t),h=s.data;return this._def.type._parse({data:h,path:s.path,parent:s})}unwrap(){return this._def.type}}class jM extends ei{_parse(t){const{status:s,ctx:h}=this._processInputParams(t);if(h.common.async)return(async()=>{const v=await this._def.in._parseAsync({data:h.data,path:h.path,parent:h});return v.status==="aborted"?_r:v.status==="dirty"?(s.dirty(),B0(v.value)):this._def.out._parseAsync({data:v.value,path:h.path,parent:h})})();{const g=this._def.in._parseSync({data:h.data,path:h.path,parent:h});return g.status==="aborted"?_r:g.status==="dirty"?(s.dirty(),{status:"dirty",value:g.value}):this._def.out._parseSync({data:g.value,path:h.path,parent:h})}}static create(t,s){return new jM({in:t,out:s,typeName:yr.ZodPipeline})}}class qC extends ei{_parse(t){const s=this._def.innerType._parse(t),h=g=>(P_(g)&&(g.value=Object.freeze(g.value)),g);return dT(s)?s.then(g=>h(g)):h(s)}unwrap(){return this._def.innerType}}qC.create=(n,t)=>new qC({innerType:n,typeName:yr.ZodReadonly,...Br(t)});var yr;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(yr||(yr={}));const Yi=Fh.create;Qh.create;xu.create;const O_=Uo.create;fT.create;pT.create;Yp.create;const jV=D_.create;mT.create;Wh.create;L_.create;const VY=Yi().email("Ogiltig e-postadress"),jY=Yi().min(8,"Lösenordet måste vara minst 8 tecken").regex(/[A-Z]/,"Lösenordet måste innehålla minst en stor bokstav").regex(/[a-z]/,"Lösenordet måste innehålla minst en liten bokstav").regex(/[0-9]/,"Lösenordet måste innehålla minst en siffra"),UY=Yi().min(8,"Telefonnumret är för kort").regex(/^\+?[0-9\s\-()]+$/,"Ogiltigt telefonnummer");O_({email:VY,password:jY,phone:UY,display_name:Yi().min(2,"Namnet måste vara minst 2 tecken").optional(),role:jV(["zoomer","orderer"]).default("zoomer")});const GY=Yi().regex(/^(\d{6,8}-?\d{4}|\d{10,12})$/,"Ogiltigt personnummer"),$Y=O_({street:Yi().min(3,"Gatuadress krävs"),postal_code:Yi().min(3,"Postnummer krävs"),city:Yi().min(2,"Stad krävs"),country:Yi().min(2,"Land krävs"),care_of:Yi().optional()});O_({full_name:Yi().min(2,"Fullständigt namn krävs"),date_of_birth:Yi().regex(/^\d{4}-\d{2}-\d{2}$/,"Ogiltigt datumformat (YYYY-MM-DD)"),nationality:Yi().min(2,"Nationalitet krävs"),personal_number:GY.optional(),residential_address:$Y});O_({se:Yi().regex(/^\d{6}-?\d{4}$/,"Ogiltigt svenskt org.nr (XXXXXX-XXXX)"),no:Yi().regex(/^\d{9}$/,"Ogiltigt norskt org.nr (9 siffror)"),dk:Yi().regex(/^\d{8}$/,"Ogiltigt danskt CVR (8 siffror)"),fi:Yi().regex(/^\d{7}-?\d$/,"Ogiltigt finskt FO-nummer"),de:Yi().regex(/^\d{2}\s?\d{3}\s?\d{3}\s?\d{3}$/,"Ogiltigt tyskt Handelsregisternummer")});O_({type:jV(["sole_proprietorship","registered_company"]),org_number:Yi().optional(),company_name:Yi().min(2,"Företagsnamn krävs").optional(),vat_number:Yi().optional(),address:O_({street:Yi().min(3),postal_code:Yi().min(3),city:Yi().min(2),country:Yi().min(2)}).optional()});var HY={};function UV(n,t){return{api_base_url:n,token_key:"qz_auth_token",refresh_token_key:"qz_refresh_token",auto_refresh:!0,...t}}UV(HY.VITE_QZ_API_BASE||"https://api.quixzoom.com");const wp=new hY(UV("https://api.quixzoom.com/api/qz")),GV=Y.createContext(void 0),WY=({children:n})=>{const[t,s]=Y.useState(null),[h,g]=Y.useState(!0);Y.useEffect(()=>{let L=!1;async function B(){try{if(wp.isTokenValid()){const U=await wp.getCurrentUser();L||s(U)}}catch{}finally{L||g(!1)}}return B(),()=>{L=!0}},[]);const v=t&&wp.getToken()?{user:t,access_token:wp.getToken()}:null,E=async(L,B)=>{try{const U=await wp.login({email:L,password:B});return U.error||!U.user?{error:new Error(U.error??"Login failed")}:(s(U.user),{error:null})}catch(U){return{error:U instanceof Error?U:new Error("Login failed")}}},c=async(L,B,U)=>{try{const H=await wp.register({email:L,password:B,phone:"",display_name:U});return H.error||!H.user?{error:new Error(H.error??"Sign-up failed")}:(s(H.user),{error:null})}catch(H){return{error:H instanceof Error?H:new Error("Sign-up failed")}}},T=async()=>{await wp.logout(),s(null)};return ue.jsx(GV.Provider,{value:{user:t,session:v,isLoading:h,signIn:E,signUp:c,signOut:T},children:n})},tm=()=>{const n=Y.useContext(GV);if(n===void 0)throw new Error("useAuth must be used within an AuthProvider");return n},$V="qz_last_position",qY=5*60*1e3;function ZY(){try{const n=localStorage.getItem($V);if(!n)return null;const{latitude:t,longitude:s,ts:h}=JSON.parse(n);return Date.now()-h>qY?null:{latitude:t,longitude:s}}catch{return null}}function XY(n,t){try{localStorage.setItem($V,JSON.stringify({latitude:n,longitude:t,ts:Date.now()}))}catch{}}const UM=()=>{const n=ZY(),[t,s]=Y.useState({latitude:(n==null?void 0:n.latitude)??null,longitude:(n==null?void 0:n.longitude)??null,error:null,loading:n===null}),h=Y.useCallback(()=>new Promise(g=>{if(!navigator.geolocation){s(v=>({...v,error:"Geolocation stöds inte i din webbläsare",loading:!1})),g(null);return}navigator.geolocation.getCurrentPosition(v=>{const E={latitude:v.coords.latitude,longitude:v.coords.longitude};s({...E,error:null,loading:!1}),g(E)},v=>{s(E=>({...E,error:v.message,loading:!1})),g(null)},{enableHighAccuracy:!0,timeout:1e4,maximumAge:6e4})}),[]);return Y.useEffect(()=>{if(!navigator.geolocation){s(E=>({...E,error:"Geolocation stöds inte i din webbläsare",loading:!1}));return}const g=E=>{const{latitude:c,longitude:T}=E.coords;XY(c,T),s({latitude:c,longitude:T,error:null,loading:!1})},v=E=>{s(c=>({...c,error:E.message,loading:!1}))};navigator.geolocation.getCurrentPosition(g,v,{enableHighAccuracy:!0,timeout:5e3,maximumAge:6e4})},[]),{...t,requestPosition:h}},KY=(n,t,s,h)=>{const v=n*Math.PI/180,E=s*Math.PI/180,c=(s-n)*Math.PI/180,T=(h-t)*Math.PI/180,L=Math.sin(c/2)*Math.sin(c/2)+Math.cos(v)*Math.cos(E)*Math.sin(T/2)*Math.sin(T/2);return 6371e3*(2*Math.atan2(Math.sqrt(L),Math.sqrt(1-L)))},ES=n=>n<1e3?`${Math.round(n)} m`:`${(n/1e3).toFixed(1)} km`,HV=Y.createContext(void 0),Oz="app-theme";function YY(n,t){if(!n)return t>=5&&t<7?Math.round(20+(t-5)/2*20):t>=7&&t<18?55:t>=18&&t<21?Math.round(55-(t-18)/3*35):t>=21&&t<23?Math.round(20-(t-21)/2*15):5;const{uvIndex:s,isDaytime:h,cloudCover:g,sunrise:v,sunset:E}=n,c=parseInt(v.split(":")[0]),T=parseInt(E.split(":")[0]);if(!h){if(t>=c-2&&t<c){const oe=(t-(c-2))/2;return Math.round(5+oe*25)}if(t>=T&&t<T+2){const oe=(t-T)/2;return Math.round(30-oe*25)}return 5}const L=45,B=Math.min(s/6,1)*15,U=g/100*12,H=(c+T)/2,X=T-c,ae=Math.abs(t-H),ne=Math.max(0,8-ae/(X/2)*8),me=L+B+ne-U;return Math.round(Math.max(10,Math.min(60,me)))}function QY(n){const t=Math.floor(n/10),h=[{background:"220 25% 6%",foreground:"210 20% 95%",card:"220 20% 10%",cardForeground:"210 20% 95%",popover:"220 20% 8%",secondary:"215 20% 18%",secondaryForeground:"210 20% 90%",muted:"215 15% 15%",mutedForeground:"215 15% 60%",border:"215 20% 20%",input:"215 20% 15%",primary:"185 70% 50%",primaryForeground:"220 25% 6%"},{background:"220 22% 10%",foreground:"210 20% 93%",card:"220 20% 14%",cardForeground:"210 20% 93%",popover:"220 20% 12%",secondary:"215 18% 22%",secondaryForeground:"210 20% 88%",muted:"215 15% 20%",mutedForeground:"215 15% 58%",border:"215 18% 25%",input:"215 18% 20%",primary:"185 70% 48%",primaryForeground:"220 25% 6%"},{background:"220 18% 15%",foreground:"210 18% 90%",card:"220 18% 19%",cardForeground:"210 18% 90%",popover:"220 18% 17%",secondary:"215 16% 28%",secondaryForeground:"210 18% 85%",muted:"215 14% 26%",mutedForeground:"215 14% 55%",border:"215 16% 32%",input:"215 16% 26%",primary:"185 68% 46%",primaryForeground:"0 0% 100%"},{background:"215 15% 92%",foreground:"220 20% 15%",card:"0 0% 100%",cardForeground:"220 20% 15%",popover:"0 0% 100%",secondary:"215 14% 85%",secondaryForeground:"220 18% 25%",muted:"215 12% 88%",mutedForeground:"215 12% 45%",border:"215 14% 82%",input:"215 14% 90%",primary:"185 65% 42%",primaryForeground:"0 0% 100%"},{background:"210 18% 95%",foreground:"220 22% 12%",card:"0 0% 100%",cardForeground:"220 22% 12%",popover:"0 0% 100%",secondary:"215 15% 88%",secondaryForeground:"220 20% 20%",muted:"215 14% 91%",mutedForeground:"215 12% 42%",border:"215 16% 85%",input:"215 16% 92%",primary:"185 68% 40%",primaryForeground:"0 0% 100%"},{background:"210 20% 97%",foreground:"220 25% 10%",card:"0 0% 100%",cardForeground:"220 25% 10%",popover:"0 0% 100%",secondary:"215 15% 90%",secondaryForeground:"220 22% 18%",muted:"215 15% 93%",mutedForeground:"215 12% 40%",border:"215 18% 87%",input:"215 18% 94%",primary:"185 70% 38%",primaryForeground:"0 0% 100%"},{background:"210 20% 98%",foreground:"220 25% 10%",card:"0 0% 100%",cardForeground:"220 25% 10%",popover:"0 0% 100%",secondary:"215 15% 92%",secondaryForeground:"220 25% 15%",muted:"215 15% 94%",mutedForeground:"215 15% 38%",border:"215 20% 88%",input:"215 20% 94%",primary:"185 70% 40%",primaryForeground:"0 0% 100%"}][Math.min(t,6)];return{"--background":h.background,"--foreground":h.foreground,"--card":h.card,"--card-foreground":h.cardForeground,"--popover":h.popover,"--popover-foreground":h.cardForeground,"--primary":h.primary,"--primary-foreground":h.primaryForeground,"--secondary":h.secondary,"--secondary-foreground":h.secondaryForeground,"--muted":h.muted,"--muted-foreground":h.mutedForeground,"--accent":h.primary,"--accent-foreground":h.primaryForeground,"--border":h.border,"--input":h.input,"--ring":h.primary}}async function JY(n,t){var s,h,g,v,E,c,T,L,B;try{const U=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${n}&longitude=${t}¤t=uv_index,is_day,cloud_cover&daily=sunrise,sunset&timezone=auto&forecast_days=1`);if(!U.ok)return null;const H=await U.json();return{uvIndex:((s=H.current)==null?void 0:s.uv_index)??0,isDaytime:((h=H.current)==null?void 0:h.is_day)===1,cloudCover:((g=H.current)==null?void 0:g.cloud_cover)??0,sunrise:((c=(E=(v=H.daily)==null?void 0:v.sunrise)==null?void 0:E[0])==null?void 0:c.split("T")[1])??"06:00",sunset:((B=(L=(T=H.daily)==null?void 0:T.sunset)==null?void 0:L[0])==null?void 0:B.split("T")[1])??"20:00"}}catch(U){return console.error("Failed to fetch sunlight data:",U),null}}function eQ({children:n}){const[t,s]=Y.useState(()=>typeof window<"u"&&localStorage.getItem(Oz)||"light"),[h,g]=Y.useState("light"),[v,E]=Y.useState(0),[c,T]=Y.useState(null),{latitude:L,longitude:B}=UM();Y.useEffect(()=>{if(t!=="auto"||!L||!B)return;const X=async()=>{const ne=await JY(L,B);T(ne)};X();const ae=setInterval(X,10*60*1e3);return()=>clearInterval(ae)},[t,L,B]);const U=Y.useCallback(()=>{const X=new Date().getHours();if(t==="auto"){const ae=YY(c,X);E(ae),g(ae>=30?"light":"dark")}else E(t==="light"?60:0),g(t)},[t,c]);Y.useEffect(()=>{if(U(),t==="auto"){const X=setInterval(U,6e4);return()=>clearInterval(X)}},[t,U]),Y.useEffect(()=>{const X=document.documentElement;if(t==="auto"){const ae=QY(v);Object.entries(ae).forEach(([ne,me])=>{X.style.setProperty(ne,me)}),X.classList.remove("light","dark"),X.classList.add(h)}else["--background","--foreground","--card","--card-foreground","--popover","--popover-foreground","--primary","--primary-foreground","--secondary","--secondary-foreground","--muted","--muted-foreground","--accent","--accent-foreground","--border","--input","--ring"].forEach(ne=>X.style.removeProperty(ne)),X.classList.remove("light","dark"),X.classList.add(t)},[t,v,h]);const H=X=>{s(X),localStorage.setItem(Oz,X)};return ue.jsx(HV.Provider,{value:{theme:t,resolvedTheme:h,lightLevel:v,setTheme:H},children:n})}function tQ(){const n=Y.useContext(HV);if(!n)throw new Error("useTheme must be used within a ThemeProvider");return n}function Yw({className:n,...t}){return ue.jsx("div",{className:fi("animate-pulse rounded-md bg-muted",n),...t})}class nQ extends Y.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,s){console.error("[ErrorBoundary] Caught:",t,s.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ue.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-6 gap-4",children:[ue.jsx("p",{className:"text-muted-foreground text-sm",children:"Något gick fel. Försök ladda om sidan."}),ue.jsx("button",{className:"px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm",onClick:()=>window.location.reload(),children:"Ladda om"})]}):this.props.children}}const rQ=(n,t,s,h)=>{var v,E,c,T;const g=[s,{code:t,...h||{}}];if((E=(v=n==null?void 0:n.services)==null?void 0:v.logger)!=null&&E.forward)return n.services.logger.forward(g,"warn","react-i18next::",!0);Up(g[0])&&(g[0]=`react-i18next:: ${g[0]}`),(T=(c=n==null?void 0:n.services)==null?void 0:c.logger)!=null&&T.warn?n.services.logger.warn(...g):console!=null&&console.warn&&console.warn(...g)},Fz={},ZC=(n,t,s,h)=>{Up(s)&&Fz[s]||(Up(s)&&(Fz[s]=new Date),rQ(n,t,s,h))},WV=(n,t)=>()=>{if(n.isInitialized)t();else{const s=()=>{setTimeout(()=>{n.off("initialized",s)},0),t()};n.on("initialized",s)}},XC=(n,t,s)=>{n.loadNamespaces(t,WV(n,s))},zz=(n,t,s,h)=>{if(Up(s)&&(s=[s]),n.options.preload&&n.options.preload.indexOf(t)>-1)return XC(n,s,h);s.forEach(g=>{n.options.ns.indexOf(g)<0&&n.options.ns.push(g)}),n.loadLanguages(t,WV(n,h))},iQ=(n,t,s={})=>!t.languages||!t.languages.length?(ZC(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(n,{lng:s.lng,precheck:(h,g)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&h.services.backendConnector.backend&&h.isLanguageChangingTo&&!g(h.isLanguageChangingTo,n))return!1}}),Up=n=>typeof n=="string",oQ=n=>typeof n=="object"&&n!==null,sQ=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,aQ={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},lQ=n=>aQ[n],cQ=n=>n.replace(sQ,lQ);let KC={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:cQ};const uQ=(n={})=>{KC={...KC,...n}},dQ=()=>KC;let qV;const hQ=n=>{qV=n},fQ=()=>qV,pQ={type:"3rdParty",init(n){uQ(n.options.react),hQ(n)}},mQ=Y.createContext();class gQ{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const _Q=(n,t)=>{const s=Y.useRef();return Y.useEffect(()=>{s.current=n},[n,t]),s.current},ZV=(n,t,s,h)=>n.getFixedT(t,s,h),yQ=(n,t,s,h)=>Y.useCallback(ZV(n,t,s,h),[n,t,s,h]),nm=(n,t={})=>{var _e,De,He,nt;const{i18n:s}=t,{i18n:h,defaultNS:g}=Y.useContext(mQ)||{},v=s||h||fQ();if(v&&!v.reportNamespaces&&(v.reportNamespaces=new gQ),!v){ZC(v,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const Xe=(At,Bt)=>Up(Bt)?Bt:oQ(Bt)&&Up(Bt.defaultValue)?Bt.defaultValue:Array.isArray(At)?At[At.length-1]:At,ft=[Xe,{},!1];return ft.t=Xe,ft.i18n={},ft.ready=!1,ft}(_e=v.options.react)!=null&&_e.wait&&ZC(v,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const E={...dQ(),...v.options.react,...t},{useSuspense:c,keyPrefix:T}=E;let L=g||((De=v.options)==null?void 0:De.defaultNS);L=Up(L)?[L]:L||["translation"],(nt=(He=v.reportNamespaces).addUsedNamespaces)==null||nt.call(He,L);const B=(v.isInitialized||v.initializedStoreOnce)&&L.every(Xe=>iQ(Xe,v,E)),U=yQ(v,t.lng||null,E.nsMode==="fallback"?L:L[0],T),H=()=>U,X=()=>ZV(v,t.lng||null,E.nsMode==="fallback"?L:L[0],T),[ae,ne]=Y.useState(H);let me=L.join();t.lng&&(me=`${t.lng}${me}`);const oe=_Q(me),re=Y.useRef(!0);Y.useEffect(()=>{const{bindI18n:Xe,bindI18nStore:ft}=E;re.current=!0,!B&&!c&&(t.lng?zz(v,t.lng,L,()=>{re.current&&ne(X)}):XC(v,L,()=>{re.current&&ne(X)})),B&&oe&&oe!==me&&re.current&&ne(X);const At=()=>{re.current&&ne(X)};return Xe&&(v==null||v.on(Xe,At)),ft&&(v==null||v.store.on(ft,At)),()=>{re.current=!1,v&&Xe&&(Xe==null||Xe.split(" ").forEach(Bt=>v.off(Bt,At))),ft&&v&&ft.split(" ").forEach(Bt=>v.store.off(Bt,At))}},[v,me]),Y.useEffect(()=>{re.current&&B&&ne(H)},[v,T,B]);const he=[ae,v,B];if(he.t=ae,he.i18n=v,he.ready=B,B||!B&&!c)return he;throw new Promise(Xe=>{t.lng?zz(v,t.lng,L,()=>Xe()):XC(v,L,()=>Xe())})};var XV={exports:{}};(function(n,t){(function(s,h){n.exports=h()})(L$,function(){let s,h,g;function v(c,T){if(!s)s=T;else if(!h)h=T;else{const L={};s(void 0,L),g=T(L);const B="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 = {}; ("+s+")(undefined, sharedChunk); ("+h+")(undefined, sharedChunk); self.onerror = null;";typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(g.workerUrl=window.URL.createObjectURL(new Blob([B],{type:"text/javascript"})))}}v(["require","exports"],function(c,T){var L=1e-6,B=typeof Float32Array<"u"?Float32Array:Array;function U(o,e){var i=e[0],l=e[1],d=e[2],p=e[3],m=i*p-d*l;return m?(o[0]=p*(m=1/m),o[1]=-l*m,o[2]=-d*m,o[3]=i*m,o):null}function H(){var o=new B(9);return B!=Float32Array&&(o[1]=0,o[2]=0,o[3]=0,o[5]=0,o[6]=0,o[7]=0),o[0]=1,o[4]=1,o[8]=1,o}function X(o,e){var i=e[0],l=e[1],d=e[2],p=e[3],m=e[4],y=e[5],b=e[6],S=e[7],C=e[8];return o[0]=m*C-y*S,o[1]=d*S-l*C,o[2]=l*y-d*m,o[3]=y*b-p*C,o[4]=i*C-d*b,o[5]=d*p-i*y,o[6]=p*S-m*b,o[7]=l*b-i*S,o[8]=i*m-l*p,o}function ae(o,e,i){var l=e[0],d=e[1],p=e[2],m=e[3],y=e[4],b=e[5],S=e[6],C=e[7],I=e[8],M=i[0],R=i[1],O=i[2],N=i[3],V=i[4],G=i[5],K=i[6],q=i[7],ee=i[8];return o[0]=M*l+R*m+O*S,o[1]=M*d+R*y+O*C,o[2]=M*p+R*b+O*I,o[3]=N*l+V*m+G*S,o[4]=N*d+V*y+G*C,o[5]=N*p+V*b+G*I,o[6]=K*l+q*m+ee*S,o[7]=K*d+q*y+ee*C,o[8]=K*p+q*b+ee*I,o}function ne(){var o=new B(16);return B!=Float32Array&&(o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[11]=0,o[12]=0,o[13]=0,o[14]=0),o[0]=1,o[5]=1,o[10]=1,o[15]=1,o}function me(o){var e=new B(16);return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],e}function oe(o){return o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}function re(o,e){var i=e[0],l=e[1],d=e[2],p=e[3],m=e[4],y=e[5],b=e[6],S=e[7],C=e[8],I=e[9],M=e[10],R=e[11],O=e[12],N=e[13],V=e[14],G=e[15],K=i*y-l*m,q=i*b-d*m,ee=i*S-p*m,te=l*b-d*y,le=l*S-p*y,xe=d*S-p*b,de=C*N-I*O,ve=C*V-M*O,Se=C*G-R*O,we=I*V-M*N,Fe=I*G-R*N,Ve=M*G-R*V,qe=K*Ve-q*Fe+ee*we+te*Se-le*ve+xe*de;return qe?(o[0]=(y*Ve-b*Fe+S*we)*(qe=1/qe),o[1]=(d*Fe-l*Ve-p*we)*qe,o[2]=(N*xe-V*le+G*te)*qe,o[3]=(M*le-I*xe-R*te)*qe,o[4]=(b*Se-m*Ve-S*ve)*qe,o[5]=(i*Ve-d*Se+p*ve)*qe,o[6]=(V*ee-O*xe-G*q)*qe,o[7]=(C*xe-M*ee+R*q)*qe,o[8]=(m*Fe-y*Se+S*de)*qe,o[9]=(l*Se-i*Fe-p*de)*qe,o[10]=(O*le-N*ee+G*K)*qe,o[11]=(I*ee-C*le-R*K)*qe,o[12]=(y*ve-m*we-b*de)*qe,o[13]=(i*we-l*ve+d*de)*qe,o[14]=(N*q-O*te-V*K)*qe,o[15]=(C*te-I*q+M*K)*qe,o):null}function he(o,e,i){var l=e[0],d=e[1],p=e[2],m=e[3],y=e[4],b=e[5],S=e[6],C=e[7],I=e[8],M=e[9],R=e[10],O=e[11],N=e[12],V=e[13],G=e[14],K=e[15],q=i[0],ee=i[1],te=i[2],le=i[3];return o[0]=q*l+ee*y+te*I+le*N,o[1]=q*d+ee*b+te*M+le*V,o[2]=q*p+ee*S+te*R+le*G,o[3]=q*m+ee*C+te*O+le*K,o[4]=(q=i[4])*l+(ee=i[5])*y+(te=i[6])*I+(le=i[7])*N,o[5]=q*d+ee*b+te*M+le*V,o[6]=q*p+ee*S+te*R+le*G,o[7]=q*m+ee*C+te*O+le*K,o[8]=(q=i[8])*l+(ee=i[9])*y+(te=i[10])*I+(le=i[11])*N,o[9]=q*d+ee*b+te*M+le*V,o[10]=q*p+ee*S+te*R+le*G,o[11]=q*m+ee*C+te*O+le*K,o[12]=(q=i[12])*l+(ee=i[13])*y+(te=i[14])*I+(le=i[15])*N,o[13]=q*d+ee*b+te*M+le*V,o[14]=q*p+ee*S+te*R+le*G,o[15]=q*m+ee*C+te*O+le*K,o}function _e(o,e,i){var l,d,p,m,y,b,S,C,I,M,R,O,N=i[0],V=i[1],G=i[2];return e===o?(o[12]=e[0]*N+e[4]*V+e[8]*G+e[12],o[13]=e[1]*N+e[5]*V+e[9]*G+e[13],o[14]=e[2]*N+e[6]*V+e[10]*G+e[14],o[15]=e[3]*N+e[7]*V+e[11]*G+e[15]):(d=e[1],p=e[2],m=e[3],y=e[4],b=e[5],S=e[6],C=e[7],I=e[8],M=e[9],R=e[10],O=e[11],o[0]=l=e[0],o[1]=d,o[2]=p,o[3]=m,o[4]=y,o[5]=b,o[6]=S,o[7]=C,o[8]=I,o[9]=M,o[10]=R,o[11]=O,o[12]=l*N+y*V+I*G+e[12],o[13]=d*N+b*V+M*G+e[13],o[14]=p*N+S*V+R*G+e[14],o[15]=m*N+C*V+O*G+e[15]),o}function De(o,e,i){var l=i[0],d=i[1],p=i[2];return o[0]=e[0]*l,o[1]=e[1]*l,o[2]=e[2]*l,o[3]=e[3]*l,o[4]=e[4]*d,o[5]=e[5]*d,o[6]=e[6]*d,o[7]=e[7]*d,o[8]=e[8]*p,o[9]=e[9]*p,o[10]=e[10]*p,o[11]=e[11]*p,o[12]=e[12],o[13]=e[13],o[14]=e[14],o[15]=e[15],o}function He(o,e,i){var l=Math.sin(i),d=Math.cos(i),p=e[4],m=e[5],y=e[6],b=e[7],S=e[8],C=e[9],I=e[10],M=e[11];return e!==o&&(o[0]=e[0],o[1]=e[1],o[2]=e[2],o[3]=e[3],o[12]=e[12],o[13]=e[13],o[14]=e[14],o[15]=e[15]),o[4]=p*d+S*l,o[5]=m*d+C*l,o[6]=y*d+I*l,o[7]=b*d+M*l,o[8]=S*d-p*l,o[9]=C*d-m*l,o[10]=I*d-y*l,o[11]=M*d-b*l,o}function nt(o,e,i){var l=Math.sin(i),d=Math.cos(i),p=e[0],m=e[1],y=e[2],b=e[3],S=e[8],C=e[9],I=e[10],M=e[11];return e!==o&&(o[4]=e[4],o[5]=e[5],o[6]=e[6],o[7]=e[7],o[12]=e[12],o[13]=e[13],o[14]=e[14],o[15]=e[15]),o[0]=p*d-S*l,o[1]=m*d-C*l,o[2]=y*d-I*l,o[3]=b*d-M*l,o[8]=p*l+S*d,o[9]=m*l+C*d,o[10]=y*l+I*d,o[11]=b*l+M*d,o}function Xe(o,e,i){var l=Math.sin(i),d=Math.cos(i),p=e[0],m=e[1],y=e[2],b=e[3],S=e[4],C=e[5],I=e[6],M=e[7];return e!==o&&(o[8]=e[8],o[9]=e[9],o[10]=e[10],o[11]=e[11],o[12]=e[12],o[13]=e[13],o[14]=e[14],o[15]=e[15]),o[0]=p*d+S*l,o[1]=m*d+C*l,o[2]=y*d+I*l,o[3]=b*d+M*l,o[4]=S*d-p*l,o[5]=C*d-m*l,o[6]=I*d-y*l,o[7]=M*d-b*l,o}function ft(o,e){return o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=e[0],o[13]=e[1],o[14]=e[2],o[15]=1,o}function At(o,e){return o[0]=e[0],o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=e[1],o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=e[2],o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}function Bt(o,e,i){var l,d,p,m=i[0],y=i[1],b=i[2],S=Math.sqrt(m*m+y*y+b*b);return S<L?null:(m*=S=1/S,y*=S,b*=S,l=Math.sin(e),d=Math.cos(e),o[0]=m*m*(p=1-d)+d,o[1]=y*m*p+b*l,o[2]=b*m*p-y*l,o[3]=0,o[4]=m*y*p-b*l,o[5]=y*y*p+d,o[6]=b*y*p+m*l,o[7]=0,o[8]=m*b*p+y*l,o[9]=y*b*p-m*l,o[10]=b*b*p+d,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o)}function Dt(o,e){var i=e[0],l=e[1],d=e[2],p=e[4],m=e[5],y=e[6],b=e[8],S=e[9],C=e[10];return o[0]=Math.sqrt(i*i+l*l+d*d),o[1]=Math.sqrt(p*p+m*m+y*y),o[2]=Math.sqrt(b*b+S*S+C*C),o}function It(o,e){var i=e[0],l=e[1],d=e[2],p=e[3],m=i+i,y=l+l,b=d+d,S=i*m,C=l*m,I=l*y,M=d*m,R=d*y,O=d*b,N=p*m,V=p*y,G=p*b;return o[0]=1-I-O,o[1]=C+G,o[2]=M-V,o[3]=0,o[4]=C-G,o[5]=1-S-O,o[6]=R+N,o[7]=0,o[8]=M+V,o[9]=R-N,o[10]=1-S-I,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}var kt=he;function wt(){var o=new B(3);return B!=Float32Array&&(o[0]=0,o[1]=0,o[2]=0),o}function Zt(o){var e=new B(3);return e[0]=o[0],e[1]=o[1],e[2]=o[2],e}function zt(o){var e=o[0],i=o[1],l=o[2];return Math.sqrt(e*e+i*i+l*l)}function vt(o,e,i){var l=new B(3);return l[0]=o,l[1]=e,l[2]=i,l}function pt(o,e,i,l){return o[0]=e,o[1]=i,o[2]=l,o}function Pt(o,e,i){return o[0]=e[0]+i[0],o[1]=e[1]+i[1],o[2]=e[2]+i[2],o}function An(o,e,i){return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],o}function bn(o,e,i){return o[0]=e[0]*i[0],o[1]=e[1]*i[1],o[2]=e[2]*i[2],o}function Vn(o,e,i){return o[0]=Math.min(e[0],i[0]),o[1]=Math.min(e[1],i[1]),o[2]=Math.min(e[2],i[2]),o}function Mn(o,e,i){return o[0]=Math.max(e[0],i[0]),o[1]=Math.max(e[1],i[1]),o[2]=Math.max(e[2],i[2]),o}function Tn(o,e,i){return o[0]=e[0]*i,o[1]=e[1]*i,o[2]=e[2]*i,o}function Wr(o,e,i,l){return o[0]=e[0]+i[0]*l,o[1]=e[1]+i[1]*l,o[2]=e[2]+i[2]*l,o}function Kn(o,e){var i=e[0]-o[0],l=e[1]-o[1],d=e[2]-o[2];return Math.sqrt(i*i+l*l+d*d)}function Ho(o,e){var i=e[0]-o[0],l=e[1]-o[1],d=e[2]-o[2];return i*i+l*l+d*d}function Ni(o){var e=o[0],i=o[1],l=o[2];return e*e+i*i+l*l}function wo(o,e){return o[0]=-e[0],o[1]=-e[1],o[2]=-e[2],o}function $n(o,e){var i=e[0],l=e[1],d=e[2],p=i*i+l*l+d*d;return p>0&&(p=1/Math.sqrt(p)),o[0]=e[0]*p,o[1]=e[1]*p,o[2]=e[2]*p,o}function Ar(o,e){return o[0]*e[0]+o[1]*e[1]+o[2]*e[2]}function pi(o,e,i){var l=e[0],d=e[1],p=e[2],m=i[0],y=i[1],b=i[2];return o[0]=d*b-p*y,o[1]=p*m-l*b,o[2]=l*y-d*m,o}function zo(o,e,i,l){var d=e[0],p=e[1],m=e[2];return o[0]=d+l*(i[0]-d),o[1]=p+l*(i[1]-p),o[2]=m+l*(i[2]-m),o}function Tr(o,e,i){var l=e[0],d=e[1],p=e[2],m=i[3]*l+i[7]*d+i[11]*p+i[15];return o[0]=(i[0]*l+i[4]*d+i[8]*p+i[12])/(m=m||1),o[1]=(i[1]*l+i[5]*d+i[9]*p+i[13])/m,o[2]=(i[2]*l+i[6]*d+i[10]*p+i[14])/m,o}function ns(o,e,i){var l=e[0],d=e[1],p=e[2];return o[0]=l*i[0]+d*i[3]+p*i[6],o[1]=l*i[1]+d*i[4]+p*i[7],o[2]=l*i[2]+d*i[5]+p*i[8],o}function ma(o,e,i){var l=i[0],d=i[1],p=i[2],m=i[3],y=e[0],b=e[1],S=e[2],C=d*S-p*b,I=p*y-l*S,M=l*b-d*y;return o[0]=y+m*(C+=C)+d*(M+=M)-p*(I+=I),o[1]=b+m*I+p*C-l*M,o[2]=S+m*M+l*I-d*C,o}function So(o){return o[0]=0,o[1]=0,o[2]=0,o}function Ci(o,e){return o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]}var Or=An,Vi=bn,To=zt;function ys(){var o=new B(4);return B!=Float32Array&&(o[0]=0,o[1]=0,o[2]=0,o[3]=0),o}function za(o,e,i){return o[0]=e[0]*i,o[1]=e[1]*i,o[2]=e[2]*i,o[3]=e[3]*i,o}function Ec(o,e){var i=e[0],l=e[1],d=e[2],p=e[3],m=i*i+l*l+d*d+p*p;return m>0&&(m=1/Math.sqrt(m)),o[0]=i*m,o[1]=l*m,o[2]=d*m,o[3]=p*m,o}function oi(o,e,i){var l=e[0],d=e[1],p=e[2],m=e[3];return o[0]=i[0]*l+i[4]*d+i[8]*p+i[12]*m,o[1]=i[1]*l+i[5]*d+i[9]*p+i[13]*m,o[2]=i[2]*l+i[6]*d+i[10]*p+i[14]*m,o[3]=i[3]*l+i[7]*d+i[11]*p+i[15]*m,o}function rs(){var o=new B(4);return B!=Float32Array&&(o[0]=0,o[1]=0,o[2]=0),o[3]=1,o}function vs(o){return o[0]=0,o[1]=0,o[2]=0,o[3]=1,o}function Ct(o,e,i){i*=.5;var l=e[0],d=e[1],p=e[2],m=e[3],y=Math.sin(i),b=Math.cos(i);return o[0]=l*b+m*y,o[1]=d*b+p*y,o[2]=p*b-d*y,o[3]=m*b-l*y,o}function sn(o,e,i){i*=.5;var l=e[0],d=e[1],p=e[2],m=e[3],y=Math.sin(i),b=Math.cos(i);return o[0]=l*b-p*y,o[1]=d*b+m*y,o[2]=p*b+l*y,o[3]=m*b-d*y,o}wt(),ys();var pn,jn,Fn,hr=Ec,qr=(pn=wt(),jn=vt(1,0,0),Fn=vt(0,1,0),function(o,e,i){var l=Ar(e,i);return l<-.999999?(pi(pn,jn,e),To(pn)<1e-6&&pi(pn,Fn,e),$n(pn,pn),function(d,p,m){m*=.5;var y=Math.sin(m);d[0]=y*p[0],d[1]=y*p[1],d[2]=y*p[2],d[3]=Math.cos(m)}(o,pn,Math.PI),o):l>.999999?(o[0]=0,o[1]=0,o[2]=0,o[3]=1,o):(pi(pn,e,i),o[0]=pn[0],o[1]=pn[1],o[2]=pn[2],o[3]=1+l,hr(o,o))});function ti(){var o=new B(2);return B!=Float32Array&&(o[0]=0,o[1]=0),o}function qs(o,e){var i=new B(2);return i[0]=o,i[1]=e,i}function Ba(o,e,i){return o[0]=e,o[1]=i,o}function is(o,e,i){return o[0]=e[0]+i[0],o[1]=e[1]+i[1],o}function Ms(o,e,i){return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o}function mi(o,e,i){return o[0]=e[0]*i,o[1]=e[1]*i,o}function ga(o){var e=o[0],i=o[1];return Math.sqrt(e*e+i*i)}function Wo(o,e){var i=e[0],l=e[1],d=i*i+l*l;return d>0&&(d=1/Math.sqrt(d)),o[0]=e[0]*d,o[1]=e[1]*d,o}function _a(o,e){return o[0]*e[0]+o[1]*e[1]}rs(),rs(),H();var zn=Ms;function vr(o,e,i,l){const d=3*o,p=3*(i-o)-d,m=1-d-p,y=3*e,b=3*(l-e)-y,S=1-y-b;return function(C,I=1e-6){if(C<=0)return 0;if(C>=1)return 1;let M=C;for(let N=0;N<8;N++){const V=((m*M+p)*M+d)*M-C;if(Math.abs(V)<I)return((S*M+b)*M+y)*M;const G=(3*m*M+2*p)*M+d;if(Math.abs(G)<1e-6)break;M-=V/G}let R=0,O=1;M=C;for(let N=0;N<20;N++){const V=((m*M+p)*M+d)*M;if(Math.abs(V-C)<I)break;C>V?R=M:O=M,M=.5*(R+O)}return((S*M+b)*M+y)*M}}function et(o,e){this.x=o,this.y=e}function ji(o,e){if(Array.isArray(o)){if(!Array.isArray(e)||o.length!==e.length)return!1;for(let i=0;i<o.length;i++)if(!ji(o[i],e[i]))return!1;return!0}if(typeof o=="object"&&o!==null&&e!==null){if(typeof e!="object")return!1;const i=o,l=e;if(Object.keys(i).length!==Object.keys(l).length)return!1;for(const d in i)if(!ji(i[d],l[d]))return!1;return!0}return o===e}function Eo(o,e,i=0,l=o.length-1,d=Bo){for(;l>i;){if(l-i>600){const b=l-i+1,S=e-i+1,C=Math.log(b),I=.5*Math.exp(2*C/3),M=.5*Math.sqrt(C*I*(b-I)/b)*(S-b/2<0?-1:1);Eo(o,e,Math.max(i,Math.floor(e-S*I/b+M)),Math.min(l,Math.floor(e+(b-S)*I/b+M)),d)}const p=o[e];let m=i,y=l;for(ao(o,i,e),d(o[l],p)>0&&ao(o,i,l);m<y;){for(ao(o,m,y),m++,y--;d(o[m],p)<0;)m++;for(;d(o[y],p)>0;)y--}d(o[i],p)===0?ao(o,i,y):(y++,ao(o,y,l)),y<=e&&(i=y+1),e<=y&&(l=y-1)}}function ao(o,e,i){const l=o[e];o[e]=o[i],o[i]=l}function Bo(o,e){return o<e?-1:o>e?1:0}function Ui(o){let e=0;for(let i,l,d=0,p=o.length,m=p-1;d<p;m=d++)i=o[d],l=o[m],e+=(l.x-i.x)*(i.y+l.y);return e}function os(o,e){return e.area-o.area}function Bn(o,e){const i=o.length;if(i<=1)return[o];const l=[];let d,p;for(let m=0;m<i;m++){const y=Ui(o[m]);y!==0&&(o[m].area=Math.abs(y),p===void 0&&(p=y<0),p===y<0?(d&&l.push(d),d=[o[m]]):d.push(o[m]))}if(d&&l.push(d),e>1)for(let m=0;m<l.length;m++)l[m].length<=e||(Eo(l[m],e,1,l[m].length-1,os),l[m]=l[m].slice(0,e));return l}function Ur(o,e){o[0]=Math.min(o[0],e[0]),o[1]=Math.min(o[1],e[1]),o[2]=Math.max(o[2],e[0]),o[3]=Math.max(o[3],e[1])}function ni(o,e){return!(o[0]<=e[0]||o[2]>=e[2]||o[1]<=e[1]||o[3]>=e[3])}function _o(o,e,i){const l=o[0]-e[0],d=o[1]-e[1],p=o[0]-i[0],m=o[1]-i[1];return l*m-p*d===0&&l*p<=0&&d*m<=0}function ya(o,e,i){return e[1]>o[1]!=i[1]>o[1]&&o[0]<(i[0]-e[0])*(o[1]-e[1])/(i[1]-e[1])+e[0]}function ss(o,e,i=!1){let l=!1;for(let d=0,p=e.length;d<p;d++){const m=e[d];for(let y=0,b=m.length,S=b-1;y<b;S=y++){const C=m[S],I=m[y];if(_o(o,C,I))return i;ya(o,C,I)&&(l=!l)}}return l}function Zs(o,e,i,l){const d=l[0]-i[0],p=l[1]-i[1],m=(o[0]-i[0])*p-d*(o[1]-i[1]),y=(e[0]-i[0])*p-d*(e[1]-i[1]);return m>0&&y<0||m<0&&y>0}function Wl(o,e,i,l){return(d=[l[0]-i[0],l[1]-i[1]])[0]*(p=[e[0]-o[0],e[1]-o[1]])[1]-d[1]*p[0]!==0&&!(!Zs(o,e,i,l)||!Zs(i,l,o,e));var d,p}function ql(o){const e=new et(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new et(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const l of o[0])e.x>l.x&&(e.x=l.x),e.y>l.y&&(e.y=l.y),i.x<l.x&&(i.x=l.x),i.y<l.y&&(i.y=l.y);return{min:e,max:i}}ti(),et.prototype={clone(){return new et(this.x,this.y)},add(o){return this.clone()._add(o)},sub(o){return this.clone()._sub(o)},multByPoint(o){return this.clone()._multByPoint(o)},divByPoint(o){return this.clone()._divByPoint(o)},mult(o){return this.clone()._mult(o)},div(o){return this.clone()._div(o)},rotate(o){return this.clone()._rotate(o)},rotateAround(o,e){return this.clone()._rotateAround(o,e)},matMult(o){return this.clone()._matMult(o)},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(o){return this.x===o.x&&this.y===o.y},dist(o){return Math.sqrt(this.distSqr(o))},distSqr(o){const e=o.x-this.x,i=o.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(o){return Math.atan2(this.y-o.y,this.x-o.x)},angleWith(o){return this.angleWithSep(o.x,o.y)},angleWithSep(o,e){return Math.atan2(this.x*e-this.y*o,this.x*o+this.y*e)},_matMult(o){const e=o[2]*this.x+o[3]*this.y;return this.x=o[0]*this.x+o[1]*this.y,this.y=e,this},_add(o){return this.x+=o.x,this.y+=o.y,this},_sub(o){return this.x-=o.x,this.y-=o.y,this},_mult(o){return this.x*=o,this.y*=o,this},_div(o){return this.x/=o,this.y/=o,this},_multByPoint(o){return this.x*=o.x,this.y*=o.y,this},_divByPoint(o){return this.x/=o.x,this.y/=o.y,this},_unit(){return this._div(this.mag()),this},_perp(){const o=this.y;return this.y=this.x,this.x=-o,this},_rotate(o){const e=Math.cos(o),i=Math.sin(o),l=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=l,this},_rotateAround(o,e){const i=Math.cos(o),l=Math.sin(o),d=e.y+l*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-l*(this.y-e.y),this.y=d,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:et},et.convert=function(o){if(o instanceof et)return o;if(Array.isArray(o))return new et(+o[0],+o[1]);if(o.x!==void 0&&o.y!==void 0)return new et(+o.x,+o.y);throw new Error("Expected [x, y] or {x, y} point format")};const af=Math.PI/180,Re=180/Math.PI,Z=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ie=/\b(iPad|iPhone|iPod)\b/,pe=/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/;function Te(o){return o*af}function ke(o){return o*Re}const Me=[[0,0],[1,0],[1,1],[0,1]];function Ue(o){if(o<=0)return 0;if(o>=1)return 1;const e=o*o,i=e*o;return 4*(o<.5?i:3*(o-e)+i-.75)}const ge=vr(.25,.1,.25,1);function Ie(o,e,i){return Math.min(i,Math.max(e,o))}function st(o,e,i){return(i=Ie((i-o)/(e-o),0,1))*i*(3-2*i)}function dt(o,e,i){const l=i-e,d=((o-e)%l+l)%l+e;return d===e?i:d}function Tt(o,e,i){if(!o.length)return i(null,[]);let l=o.length;const d=new Array(o.length);let p=null;o.forEach((m,y)=>{e(m,(b,S)=>{b&&(p=b),d[y]=S,--l===0&&i(p,d)})})}function jt(o,e){const i={};for(let l=0;l<e.length;l++){const d=e[l];d in o&&(i[d]=o[d])}return i}let Xt=1;function Un(){return Xt++}function hn(o){return o<=1?1:Math.pow(2,Math.ceil(Math.log2(o)))}function mn(o,e){o.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Nn(o,e,i){const l={};for(const d in o)l[d]=e.call(this,o[d],d,o);return l}function xr(o,e,i){const l={};for(const d in o)e.call(this,o[d],d,o)&&(l[d]=o[d]);return l}function Dr(o){return Array.isArray(o)?o.map(Dr):typeof o=="object"&&o?Nn(o,Dr):o}function Ii(o,e){for(let i=0;i<o.length;i++)if(e.includes(o[i]))return!0;return!1}const Gi={};function Cn(o){Gi[o]||(typeof console<"u"&&console.warn(o),Gi[o]=!0)}function ci(o,e,i){return(i.y-o.y)*(e.x-o.x)>(e.y-o.y)*(i.x-o.x)}function Na([o,e,i]){const l=Te(e+90),d=Te(i);return{x:o*Math.cos(l)*Math.sin(d),y:o*Math.sin(l)*Math.sin(d),z:o*Math.cos(d),azimuthal:e,polar:i}}function xs(o){return(typeof self<"u"||o!==void 0)&&typeof WorkerGlobalScope<"u"&&(o!==void 0?o:self)instanceof WorkerGlobalScope}function Zr(o){const e={};if(o.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,l,d,p)=>{const m=d||p;return e[l]=!m||m.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Xr,Li,gi,Yr,qo,eo,ko,Va=null;function ja(o,e){return[o[4*e],o[4*e+1],o[4*e+2],o[4*e+3]]}function Cr(o,e,i,l){for(;e<i;){const d=e+i>>1;o[d]<l?e=d+1:i=d}return e}function ui(o,e,i,l){for(;e<i;){const d=e+i>>1;o[d]<=l?e=d+1:i=d}return e}function kc(o){return o>0?1/(1.001-o):1+o}function Eu(o){return o>0?1-1/(1.001-o):-o}function Ps(o,e,i){return(o-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}function lf(){return Li==null&&(Li=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Li}const Zo={requestIdleCallback:o=>{if(typeof requestIdleCallback<"u")return requestIdleCallback(o);setTimeout(()=>o({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>qo!==void 0?qo:performance.now(),setNow(o){qo=o},restoreNow(){qo=void 0},frame(o){const e=requestAnimationFrame(o);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(o,e=0){const{width:i,height:l}=o;eo||(eo=document.createElement("canvas"));const d=eo.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return(i>eo.width||l>eo.height)&&(eo.width=i,eo.height=l),d.clearRect(-e,-e,i+2*e,l+2*e),d.drawImage(o,0,0,i,l),d.getImageData(-e,-e,i+2*e,l+2*e)},resolveURL:o=>(gi||(gi=document.createElement("a")),gi.href=o,gi.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Yr==null&&(Yr=window.matchMedia("(prefers-reduced-motion: reduce)")),Yr.matches)},hasCanvasFingerprintNoise(){if(ko!==void 0)return ko;if(!lf())return ko=!1,!1;const o=new OffscreenCanvas(85,1),e=o.getContext("2d",{willReadFrequently:!0});let i=0;for(let d=0;d<o.width;++d)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(d,0,1,1);const l=e.getImageData(0,0,o.width,o.height);i=0;for(let d=0;d<l.data.length;++d)if(d%4!=3&&i++!==l.data[d])return ko=!0,!0;return ko=!1,!1}},Nr={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i,API_FONTS_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i,get EVENTS_URL(){if(!Nr.API_URL)return null;try{const o=new URL(Nr.API_URL);return o.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":o.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:"/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(Object.create(null),{pmtiles:"/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function Jx(){return new URL(Nr.DRACO_URL,Nr.API_URL).href}function eb(){if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(function(){if(Xr===void 0){if(typeof WebAssembly!="object")return!1;const o=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]);Xr=WebAssembly.validate(o)}return Xr}()?Nr.MESHOPT_SIMD_URL:Nr.MESHOPT_URL,Nr.API_URL).href}function tb(){return new URL(Nr.BUILDING_GEN_URL,Nr.API_URL).href}function ty(o){return Nr.API_URL_REGEX.test(o)}function nb(o){return Nr.API_SPRITE_REGEX.test(o)}function cf(o,e){const i=o.indexOf("?");if(i<0)return`${o}?${new URLSearchParams(e).toString()}`;const l=new URLSearchParams(o.slice(i));for(const d in e)l.set(d,e[d]);return`${o.slice(0,i)}?${l.toString()}`}function ny(o,e={persistentParams:[]}){const i=o.indexOf("?");if(i<0)return o;const l=new URLSearchParams,d=new URLSearchParams(o.slice(i));for(const m of e.persistentParams){const y=d.get(m);y&&l.set(m,y)}const p=l.toString();return`${o.slice(0,i)}${p.length>0?`?${p}`:""}`}const rb="mapbox-tiles";let ib=500,Ds=50;const Td=["language","worldview","jobid"];let va;function ry(){try{return caches}catch{}}function uf(){const o=ry();o&&va==null&&(va=o.open(rb))}let im=1/0;const iy={supported:!1,testSupport:function(o){!om&&Zl&&(oy?ob(o):Ua=o)}};let Ua,Zl,om=!1,oy=!1;const _l=typeof self<"u"?self:{};function ob(o){const e=o.createTexture();o.bindTexture(o.TEXTURE_2D,e);try{if(o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,Zl),o.isContextLost())return;iy.supported=!0}catch{}o.deleteTexture(e),om=!0}_l.document&&(Zl=_l.document.createElement("img"),Zl.onload=function(){Ua&&ob(Ua),Ua=null,oy=!0},Zl.onerror=function(){om=!0,Ua=null},Zl.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ac={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(Ac);class sm extends Error{constructor(e,i,l){i===401&&ty(l)&&(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=l}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function sb(o){return typeof o=="object"&&o!==null&&"status"in o&&o.status===404}const sy=xs()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Cc=/^\w+:/,f2=/[\r\n]+/,ku=function(o,e){return(i=o.url).startsWith("file:")||sy().startsWith("file:")&&!Cc.test(i)?function(l,d){const p=new XMLHttpRequest;p.open(l.method||"GET",l.url,!0),l.type==="arrayBuffer"&&(p.responseType="arraybuffer");for(const m in l.headers)p.setRequestHeader(m,l.headers[m]);return l.type==="json"&&(p.responseType="text",p.setRequestHeader("Accept","application/json")),p.withCredentials=l.credentials==="include",p.onerror=()=>{d(new Error(p.statusText))},p.onload=()=>{if((p.status>=200&&p.status<300||p.status===0)&&p.response!==null){let m=p.response;if(l.type==="json")try{m=JSON.parse(p.response)}catch(b){return d(b)}const y=new Headers;p.getAllResponseHeaders().trim().split(f2).forEach(b=>{const S=b.split(": "),C=S.shift(),I=S.join(": ");y.append(C,I)}),d(null,m,y)}else d(new sm(p.statusText,p.status,l.url))},p.send(l.body),{cancel:()=>p.abort()}}(o,e):function(l,d){const p=new AbortController,m=new Request(l.url,{method:l.method||"GET",body:l.body,credentials:l.credentials,headers:l.headers,referrer:sy(),referrerPolicy:l.referrerPolicy,signal:p.signal});let y=!1,b=!1;const S=(C=m.url).indexOf("sku=")>0&&ty(C);var C;l.type==="json"&&m.headers.set("Accept","application/json");const I=(R,O,N)=>{if(b)return;if(R&&R.message!=="SecurityError"&&Cn(R.toString()),O&&N)return M(O);const V=Date.now();fetch(m).then(G=>{if(G.ok){const K=S?G.clone():null;return M(G,K,V)}return d(new sm(G.statusText,G.status,l.url))}).catch(G=>{G.name!=="AbortError"&&d(new Error(`${G.message} ${l.url}`))})},M=(R,O,N)=>{(l.type==="arrayBuffer"?R.arrayBuffer():l.type==="json"?R.json():R.text()).then(V=>{b||(O&&N&&function(G,K,q){if(uf(),va==null)return;const ee=Zr(K.headers.get("cache-control")||"");if(ee["no-store"])return;const te={status:K.status,statusText:K.statusText,headers:new Headers};K.headers.forEach((Se,we)=>te.headers.set(we,Se)),ee["max-age"]&&te.headers.set("Expires",new Date(q+1e3*ee["max-age"]).toUTCString());const le=te.headers.get("expires");if(!le||new Date(le).getTime()-q<42e4)return;let xe=ny(G.url,{persistentParams:Td});if(K.status===206){const Se=G.headers.get("Range");if(!Se)return;te.status=200,xe=cf(xe,{range:Se})}const de=new Response((ve=K.status)!==200&&ve!==404&&[101,103,204,205,304].includes(ve)?null:K.body,te);var ve;uf(),va!=null&&va.then(Se=>Se.put(xe,de)).catch(Se=>Cn(Se.message))}(m,O,N),y=!0,d(null,V,R.headers))}).catch(V=>{b||d(new Error(V.message))})};return S?function(R,O){if(uf(),va==null)return O(null);va.then(N=>{let V=ny(R.url,{persistentParams:Td});const G=R.headers.get("Range");G&&(V=cf(V,{range:G})),N.match(V).then(K=>{const q=function(ee){if(!ee)return!1;const te=new Date(ee.headers.get("expires")||0),le=Zr(ee.headers.get("cache-control")||"");return Number(te)>Date.now()&&!le["no-cache"]}(K);N.delete(V).catch(O),q&&N.put(V,K.clone()).catch(O),O(null,K,q)}).catch(O)}).catch(O)}(m,I):I(null,null),{cancel:()=>{b=!0,y||p.abort()}}}(o,e);var i},Ic=function(o,e){return ku(Object.assign(o,{type:"json"}),e)},Mc=function(o,e){return ku(Object.assign(o,{type:"arrayBuffer"}),e)};function ab(o){const e=document.createElement("a");return e.href=o,e.protocol===location.protocol&&e.host===location.host}let df,hf;df=[],hf=0;const am=function(o,e){if(iy.supported&&(o.headers||(o.headers={}),o.headers.accept="image/webp,*/*"),hf>=Nr.MAX_PARALLEL_IMAGE_REQUESTS){const p={requestParameters:o,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return df.push(p),p}hf++;let i=!1;const l=()=>{if(!i)for(i=!0,hf--;df.length&&hf<Nr.MAX_PARALLEL_IMAGE_REQUESTS;){const p=df.shift(),{requestParameters:m,callback:y,cancelled:b}=p;b||(p.cancel=am(m,y).cancel)}},d=Mc(o,(p,m,y)=>{l(),p?e(p):m&&function(b,S){const C=new Blob([new Uint8Array(b)],{type:"image/png"});createImageBitmap(C).then(I=>{S(null,I)}).catch(I=>{S(new Error(`Could not load image because of ${I.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(m,(b,S)=>e(b,S,y))});return{cancel:()=>{d.cancel(),l()}}};function lm(o,e=0){const d=o.length,p=d-(3&d);let m,y=0|e,b=0;for(;b<p;)m=255&o.charCodeAt(b)|(255&o.charCodeAt(b+1))<<8|(255&o.charCodeAt(b+2))<<16|(255&o.charCodeAt(b+3))<<24,b+=4,m=Math.imul(m,3432918353),m=m<<15|m>>>17,m=Math.imul(m,461845907),y^=m,y=y<<13|y>>>19,y=Math.imul(y,5)+3864292196|0;m=0;const S=3&d;return S>0&&(S>=3&&(m^=(255&o.charCodeAt(b+2))<<16),S>=2&&(m^=(255&o.charCodeAt(b+1))<<8),m^=255&o.charCodeAt(b),m=Math.imul(m,3432918353),m=m<<15|m>>>17,m=Math.imul(m,461845907),y^=m),y^=d,y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>16,y>>>0}class Xl{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class cm extends Xl{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function lb(o,e,i){i[o]&&i[o].includes(e)||(i[o]=i[o]||[],i[o].push(e))}function ff(o,e,i){if(i&&i[o]){const l=i[o].indexOf(e);l!==-1&&i[o].splice(l,1)}}class Au{on(e,i){return this._listeners=this._listeners||{},lb(e,i,this._listeners),this}off(e,i){return ff(e,i,this._listeners),ff(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},lb(e,i,this._oneTimeListeners),this):new Promise(l=>{this.once(e,l)})}fire(e,i){const l=typeof e=="string"?new Xl(e,i):e,d=l.type;if(this.listens(d)){l.target=this;const p=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const b of p)b.call(this,l);const m=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const b of m)ff(d,b,this._oneTimeListeners),b.call(this,l);const y=this._eventedParent;if(y){const b=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(l,b),y.fire(l)}}else l instanceof cm&&console.error(l.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 Ut{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new Ut(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){const[i,l]=e.split("");return new Ut({name:i,iconsetId:l})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return Ut.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Vt,pf={},cb=function(){if(Vt)return pf;Vt=1;var o={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(p){return(p=Math.round(p))<0?0:p>255?255:p}function i(p){return e(p[p.length-1]==="%"?parseFloat(p)/100*255:parseInt(p))}function l(p){return(m=p[p.length-1]==="%"?parseFloat(p)/100:parseFloat(p))<0?0:m>1?1:m;var m}function d(p,m,y){return y<0?y+=1:y>1&&(y-=1),6*y<1?p+(m-p)*y*6:2*y<1?m:3*y<2?p+(m-p)*(2/3-y)*6:p}try{pf.parseCSSColor=function(p){var m,y=p.replace(/ /g,"").toLowerCase();if(y in o)return o[y].slice();if(y[0]==="#")return y.length===4?(m=parseInt(y.substr(1),16))>=0&&m<=4095?[(3840&m)>>4|(3840&m)>>8,240&m|(240&m)>>4,15&m|(15&m)<<4,1]:null:y.length===7&&(m=parseInt(y.substr(1),16))>=0&&m<=16777215?[(16711680&m)>>16,(65280&m)>>8,255&m,1]:null;var b=y.indexOf("("),S=y.indexOf(")");if(b!==-1&&S+1===y.length){var C=y.substr(0,b),I=y.substr(b+1,S-(b+1)).split(","),M=1;switch(C){case"rgba":if(I.length!==4)return null;M=l(I.pop());case"rgb":return I.length!==3?null:[i(I[0]),i(I[1]),i(I[2]),M];case"hsla":if(I.length!==4)return null;M=l(I.pop());case"hsl":if(I.length!==3)return null;var R=(parseFloat(I[0])%360+360)%360/360,O=l(I[1]),N=l(I[2]),V=N<=.5?N*(O+1):N+O-N*O,G=2*N-V;return[e(255*d(G,V,R+1/3)),e(255*d(G,V,R)),e(255*d(G,V,R-1/3)),M];default:return null}}return null}}catch{}return pf}();function Jt(o,e,i){return o*(1-i)+e*i}const ay=new Map;class qn{constructor(e,i,l,d=1){this.r=e,this.g=i,this.b=l,this.a=d}static parse(e){if(!e)return;if(e instanceof qn)return e;if(typeof e!="string")return;const i=ay.get(e);if(i)return i;const l=cb.parseCSSColor(e);if(!l)return;const d=new qn(l[0]/255,l[1]/255,l[2]/255,l[3]);return ay.set(e,d),d}toString(){const{r:e,g:i,b:l,a:d}=this;return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*l)},${d})`}toNonPremultipliedRenderColor(e){const{r:i,g:l,b:d,a:p}=this;return new p2(e,i,l,d,p)}toPremultipliedRenderColor(e){const{r:i,g:l,b:d,a:p}=this;return new gf(e,i*p,l*p,d*p,p)}clone(){return new qn(this.r,this.g,this.b,this.a)}}class mf{constructor(e,i,l,d,p,m=!1){if(this.premultiplied=!1,this.premultiplied=m,e){const y=e.image.height,b=y*y;this.premultiplied?(i=p===0?0:i/p*(y-1),l=p===0?0:l/p*(y-1),d=p===0?0:d/p*(y-1)):(i*=y-1,l*=y-1,d*=y-1),i=Math.max(0,Math.min(y-1,i)),l=Math.max(0,Math.min(y-1,l)),d=Math.max(0,Math.min(y-1,d));const S=Math.floor(i),C=Math.floor(l),I=Math.floor(d),M=Math.ceil(i),R=Math.ceil(l),O=Math.ceil(d),N=i-S,V=l-C,G=d-I,K=e.image.data,q=4*(S+C*b+I*y),ee=4*(S+C*b+O*y),te=4*(S+R*b+I*y),le=4*(S+R*b+O*y),xe=4*(M+C*b+I*y),de=4*(M+C*b+O*y),ve=4*(M+R*b+I*y),Se=4*(M+R*b+O*y);this.r=Jt(Jt(Jt(K[q],K[ee],G),Jt(K[te],K[le],G),V),Jt(Jt(K[xe],K[de],G),Jt(K[ve],K[Se],G),V),N)/255*(this.premultiplied?p:1),this.g=Jt(Jt(Jt(K[q+1],K[ee+1],G),Jt(K[te+1],K[le+1],G),V),Jt(Jt(K[xe+1],K[de+1],G),Jt(K[ve+1],K[Se+1],G),V),N)/255*(this.premultiplied?p:1),this.b=Jt(Jt(Jt(K[q+2],K[ee+2],G),Jt(K[te+2],K[le+2],G),V),Jt(Jt(K[xe+2],K[de+2],G),Jt(K[ve+2],K[Se+2],G),V),N)/255*(this.premultiplied?p:1),this.a=p}else this.r=i,this.g=l,this.b=d,this.a=p}toArray(){const{r:e,g:i,b:l,a:d}=this;return[255*e,255*i,255*l,d]}toHslaArray(){let{r:e,g:i,b:l,a:d}=this;if(this.premultiplied){if(d===0)return[0,0,0,0];const O=1/d;e*=O,i*=O,l*=O}const p=Math.min(Math.max(e,0),1),m=Math.min(Math.max(i,0),1),y=Math.min(Math.max(l,0),1),b=Math.min(p,m,y),S=Math.max(p,m,y),C=S-b,I=.5*(b+S);if(C===0)return[0,0,100*I,d];const M=I>.5?C/(2-S-b):C/(S+b);let R;switch(S){case p:R=60*((m-y)/C+(m<y?6:0));break;case m:R=60*((y-p)/C+2);break;default:R=60*((p-m)/C+4)}return[R,100*M,100*I,d]}toArray01(){const{r:e,g:i,b:l,a:d}=this;return[e,i,l,d]}toArray01Scaled(e){const{r:i,g:l,b:d}=this;return[i*e,l*e,d*e]}toArray01Linear(){const{r:e,g:i,b:l,a:d}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(l,2.2),d]}}class p2 extends mf{constructor(e,i,l,d,p){super(e,i,l,d,p,!1)}}class gf extends mf{constructor(e,i,l,d,p){super(e,i,l,d,p,!0)}}function um(o,e,i){return o.map((l,d)=>Jt(l,e[d],i))}qn.black=new qn(0,0,0,1),qn.white=new qn(1,1,1,1),qn.transparent=new qn(0,0,0,0),qn.red=new qn(1,0,0,1),qn.blue=new qn(0,0,1,1);var Ed=Object.freeze({__proto__:null,array:um,color:function(o,e,i){return new qn(Jt(o.r,e.r,i),Jt(o.g,e.g,i),Jt(o.b,e.b,i),Jt(o.a,e.a,i))},number:Jt});class lo extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class dm{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[l,d]of i)this.bindings[l]=d}concat(e){return new dm(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 kd={kind:"null"},Gt={kind:"number"},tr={kind:"string"},rr={kind:"boolean"},as={kind:"color"},Cu={kind:"object"},ir={kind:"value"},Iu={kind:"collator"},yl={kind:"formatted"},Ad={kind:"resolvedImage"};function $i(o,e){return{kind:"array",itemType:o,N:e}}function bi(o){if(o.kind==="array"){const e=bi(o.itemType);return typeof o.N=="number"?`array<${e}, ${o.N}>`:o.itemType.kind==="value"?"array":`array<${e}>`}return o.kind}const Pc=[kd,Gt,tr,rr,as,yl,Cu,$i(ir),Ad];function Mu(o,e){if(e.kind==="error")return null;if(o.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Mu(o.itemType,e.itemType))&&(typeof o.N!="number"||o.N===e.N))return null}else{if(o.kind===e.kind)return null;if(o.kind==="value"){for(const i of Pc)if(!Mu(i,e))return null}}return`Expected ${bi(o)} but found ${bi(e)} instead.`}function rn(o,e){return e.some(i=>i.kind===o.kind)}function Dc(o,e){return e.some(i=>i==="null"?o===null:i==="array"?Array.isArray(o):i==="object"?o&&!Array.isArray(o)&&typeof o=="object":i===typeof o)}function vl(o,e){return o.kind==="array"&&e.kind==="array"?o.N===e.N&&vl(o.itemType,e.itemType):o.kind===e.kind}class tn{constructor(e,i,l){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=l,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 _f{constructor(e,i,l,d,p){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=l,this.fontStack=d,this.textColor=p}}class Ao{constructor(e){this.sections=e}static fromString(e){return new Ao([new _f(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 Ao?e:Ao.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 d=i.image.getPrimary().id.toString();e.push(["image",d]);continue}e.push(i.text);const l={};i.fontStack&&(l["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(l["font-scale"]=i.scale),i.textColor&&(l["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(l)}return e}}class xa{constructor(e,i={}){this.id=Ut.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,l,d,p;try{({id:i,params:l,sx:d,sy:p}=JSON.parse(e)||{})}catch{return null}return i?new xa(i,{params:l,sx:d,sy:p}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class ls{constructor(e,i,l,d,p=!1){this.primaryId=Ut.from(e),this.primaryOptions=i,l&&(this.secondaryId=Ut.from(l)),this.secondaryOptions=d,this.available=p}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new xa(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new xa(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?ls.build({name:e}):e}static build(e,i,l,d){return!e||typeof e=="object"&&!("name"in e)?null:new ls(e,l,i,d)}}function ub(o,e,i,l){return typeof o=="number"&&o>=0&&o<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?l===void 0||typeof l=="number"&&l>=0&&l<=1?null:`Invalid rgba value [${[o,e,i,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof l=="number"?[o,e,i,l]:[o,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Cd(o){if(o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"||o instanceof qn||o instanceof tn||o instanceof Ao||o instanceof ls)return!0;if(Array.isArray(o)){for(const e of o)if(!Cd(e))return!1;return!0}if(typeof o=="object"){for(const e in o)if(!Cd(o[e]))return!1;return!0}return!1}function to(o){if(o===null)return kd;if(typeof o=="string")return tr;if(typeof o=="boolean")return rr;if(typeof o=="number")return Gt;if(o instanceof qn)return as;if(o instanceof tn)return Iu;if(o instanceof Ao)return yl;if(o instanceof ls)return Ad;if(Array.isArray(o)){const e=o.length;let i;for(const l of o){const d=to(l);if(i){if(i===d)continue;i=ir;break}i=d}return $i(i||ir,e)}return Cu}function Xs(o){return o===null?"":typeof o=="string"||typeof o=="number"||typeof o=="boolean"?String(o):o instanceof Ao||o instanceof ls||o instanceof qn?o.toString():JSON.stringify(o)}class xl{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(!Cd(e[1]))return i.error("invalid value");const l=e[1];let d=to(l);const p=i.expectedType;return d.kind!=="array"||d.N!==0||!p||p.kind!=="array"||typeof p.N=="number"&&p.N!==0||(d=p),new xl(d,l)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof qn?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Ao?this.value.serialize():this.value}}class wi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ly={string:tr,number:Gt,boolean:rr,object:Cu};class Ga{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 l,d=1;const p=e[0];if(p==="array"){let y,b;if(e.length>2){const S=e[1];if(typeof S!="string"||!(S in ly)||S==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);y=ly[S],d++}else y=ir;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);b=e[2],d++}l=$i(y,b)}else l=ly[p];const m=[];for(;d<e.length;d++){const y=i.parse(e[d],d,ir);if(!y)return null;m.push(y)}return new Ga(l,m)}evaluate(e){for(let i=0;i<this.args.length;i++){const l=this.args[i].evaluate(e);if(!Mu(this.type,to(l)))return l;if(i===this.args.length-1)throw new wi(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${bi(to(l))} but was expected to be of type ${bi(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 l=e.itemType;if(l.kind==="string"||l.kind==="number"||l.kind==="boolean"){i.push(l.kind);const d=e.N;(typeof d=="number"||this.args.length>1)&&i.push(d)}}return i.concat(this.args.map(l=>l.serialize()))}}class yf{constructor(e){this.type=yl,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const l=e[1];if(!Array.isArray(l)&&typeof l=="object")return i.error("First argument must be an image or text section.");const d=[];let p=!1;for(let m=1;m<=e.length-1;++m){const y=e[m];if(p&&typeof y=="object"&&!Array.isArray(y)){p=!1;let b=null;if(y["font-scale"]&&(b=i.parseObjectValue(y["font-scale"],m,"font-scale",Gt),!b))return null;let S=null;if(y["text-font"]&&(S=i.parseObjectValue(y["text-font"],m,"text-font",$i(tr)),!S))return null;let C=null;if(y["text-color"]&&(C=i.parseObjectValue(y["text-color"],m,"text-color",as),!C))return null;const I=d.at(-1);I.scale=b,I.font=S,I.textColor=C}else{const b=i.parse(e[m],m,ir);if(!b)return null;const S=b.type.kind;if(S!=="string"&&S!=="value"&&S!=="null"&&S!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");p=!0,d.push({content:b,scale:null,font:null,textColor:null})}}return new yf(d)}evaluate(e){return new Ao(this.sections.map(i=>{const l=i.content.evaluate(e);return vl(to(l),Ad)?new _f("",l,null,null,null):new _f(Xs(l),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 l={};i.scale&&(l["font-scale"]=i.scale.serialize()),i.font&&(l["text-font"]=i.font.serialize()),i.textColor&&(l["text-color"]=i.textColor.serialize()),e.push(l)}return e}}class hm{constructor(e,i,l,d){this._imageWarnHistory={},this.type=Ad,this.namePrimary=e,this.nameSecondary=i,l&&(this.paramsPrimary=l.params,this.iconsetIdPrimary=l.iconset?l.iconset.id:void 0),d&&(this.paramsSecondary=d.params,this.iconsetIdSecondary=d.iconset?d.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let l=1;const d=[];function p(){if(l<e.length){const y=i.parse(e[l],l++,tr);return y?(d.push({image:y,options:{}}),!0):(i.error(d.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function m(){if(l<e.length){const b=e[l];if((y=b)===null||typeof y!="object"||Array.isArray(y))return!0;const S=b.params,C=b.iconset,I=i.concat(l);if(!S&&!C)return l++,!0;if(S){if(typeof S!="object"||S.constructor!==Object)return I.error('Image options "params" should be an object'),!1;const M={},R=I.concat(void 0,"params");for(const O in S){if(!O)return R.error("Image parameter name should be non-empty"),!1;const N=R.concat(void 0,O).parse(S[O],void 0,as,void 0,{typeAnnotation:"coerce"});if(!N)return!1;M[O]=N}d.at(-1).options.params=M}if(C){if(typeof C!="object"||C.constructor!==Object)return I.error('Image options "iconset" should be an object'),!1;if(!C.id)return I.error('Image options "iconset" should have an "id" property'),!1;d.at(-1).options.iconset=C}return l++,!0}var y;return!0}for(let y=0;y<2;y++)if(!p()||!m())return;return new hm(d[0].image,d[1]?d[1].image:void 0,d[0].options,d[1]?d[1].options:void 0)}evaluateParams(e,i){const l={};if(i){for(const d in i)if(i[d])try{l[d]=i[d].evaluate(e)}catch{continue}if(Object.keys(l).length!==0)return{params:l}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},l=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,d=ls.build(i,l,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(d&&e.availableImages){const p=d.getPrimary().id;if(d.available=e.availableImages.some(m=>Ut.isEqual(m,p)),d.available){const m=d.getSecondary()?d.getSecondary().id:null;m&&(d.available=e.availableImages.some(y=>Ut.isEqual(y,m)))}}return d}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 l={};if(i&&(l.iconset={id:i}),e){l.params={};for(const d in e)e[d]&&(l.params[d]=e[d].serialize())}return Object.keys(l).length>0?l: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 Id(o){return Rc(o)?"string":fm(o)?"number":uy(o)?"boolean":Array.isArray(o)?"array":o===null?"null":cy(o)?"object":typeof o}function cy(o){return o!=null&&!Array.isArray(o)&&typeof o!="function"&&!(o instanceof String||o instanceof Number||o instanceof Boolean)&&typeof o=="object"}function Rc(o){return typeof o=="string"||o instanceof String}function fm(o){return typeof o=="number"||o instanceof Number}function uy(o){return typeof o=="boolean"||o instanceof Boolean}const pm={"to-boolean":rr,"to-color":as,"to-number":Gt,"to-string":tr};class bl{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 l=e[0],d=[];let p=kd;if(l==="to-array"){if(!Array.isArray(e[1]))return null;const m=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);p=$i(i.expectedType.itemType,m)}else{if(!(m>0&&Cd(e[1][0])))return null;p=$i(to(e[1][0]),m)}for(let y=0;y<m;y++){const b=e[1][y];let S;if(Array.isArray(b))S=i.parse(b,void 0,p.itemType);else{const C=Id(b);if(C!==p.itemType.kind)return i.error(`Expected ${p.itemType.kind} but found ${C}.`);S=i.registry.literal.parse(["literal",b===void 0?null:b],i)}if(!S)return null;d.push(S)}}else{if((l==="to-boolean"||l==="to-string")&&e.length!==2)return i.error("Expected one argument.");p=pm[l];for(let m=1;m<e.length;m++){const y=i.parse(e[m],m,ir);if(!y)return null;d.push(y)}}return new bl(p,d)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,l;for(const d of this.args){if(i=d.evaluate(e),l=null,i instanceof qn)return i;if(typeof i=="string"){const p=e.parseColor(i);if(p)return p}else if(Array.isArray(i)&&(l=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ub(i[0],i[1],i[2],i[3]),!l))return new qn(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new wi(l||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const l of this.args){if(i=l.evaluate(e),i===null)return 0;const d=Number(i);if(!isNaN(d))return d}throw new wi(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Ao.fromString(Xs(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?ls.build(Xs(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):Xs(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 yf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new hm(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const dy=["Unknown","Point","LineString","Polygon"];class $a{constructor(e,i,l){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=l}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?dy[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:l,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(l*i-e[0])+this.featureDistanceData.bearing[1]*(d*i-e[1])}return 0}parseColor(e){return qn.parse(e)}getConfig(e){return this.options?this.options.get(e):null}}class bs{constructor(e,i,l,d,p){this.name=e,this.type=i,this._evaluate=l,this.args=d,this._overloadIndex=p}evaluate(e){if(!this._evaluate){const i=bs.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 l=e[0],d=bs.definitions[l];if(!d)return i.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0);const p=Array.isArray(d)?d[0]:d.type,m=Array.isArray(d)?[[d[1],d[2]]]:d.overloads,y=[];let b=null,S=-1;for(const[C,I]of m){if(Array.isArray(C)&&C.length!==e.length-1)continue;y.push(C),S++,b===null?b=new Wa(i.registry,i.path,null,i.scope,[],i._scope,i.options,i.iconImageUseTheme):b.errors.length=0;const M=[];let R=!1;for(let O=1;O<e.length;O++){const N=e[O],V=Array.isArray(C)?C[O-1]:C.type,G=b.parse(N,1+M.length,V);if(!G){R=!0;break}M.push(G)}if(!R)if(Array.isArray(C)&&C.length!==M.length)b.error(`Expected ${C.length} arguments, but found ${M.length} instead.`);else{for(let O=0;O<M.length;O++){const N=Array.isArray(C)?C[O]:C.type;b.checkSubtype(N,M[O].type,O+1)}if(b.errors.length===0)return new bs(l,p,I,M,S)}}if(y.length===1)i.errors.push(...b.errors);else{const C=(y.length?y:m.map(([M])=>M)).map(m2).join(" | "),I=[];for(let M=1;M<e.length;M++){const R=i.parse(e[M],1+I.length);if(!R)return null;I.push(bi(R.type))}i.error(`Expected arguments of type ${C}, but found (${I.join(", ")}) instead.`)}return null}static register(e,i){bs.definitions=i;for(const l in i)e[l]=bs}}function m2(o){return Array.isArray(o)?`(${o.map(bi).join(", ")})`:`(${bi(o.type)}...)`}class mm{constructor(e,i,l){this.type=Iu,this.locale=l,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument."),null;const l=e[1];if(typeof l!="object"||Array.isArray(l))return i.error("Collator options argument must be an object."),null;const d=l["case-sensitive"]===void 0?i.parse(!1,1,rr):i.parseObjectValue(l["case-sensitive"],1,"case-sensitive",rr);if(!d)return null;const p=l["diacritic-sensitive"]===void 0?i.parse(!1,1,rr):i.parseObjectValue(l["diacritic-sensitive"],1,"diacritic-sensitive",rr);if(!p)return null;let m=null;return l.locale&&(m=i.parseObjectValue(l.locale,1,"locale",tr),!m)?null:new mm(d,p,m)}evaluate(e){return new tn(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 wl(o){return(180+o)/360}function ba(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function cs(o){return 360*o-180}function Si(o){return 360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90}const Ha=8192;function db(o,e){const i=wl(o[0]),l=ba(o[1]),d=Math.pow(2,e.z);return[Math.round(i*d*Ha),Math.round(l*d*Ha)]}function g2(o,e){for(let i=0;i<e.length;i++)if(ss(o,e[i]))return!0;return!1}function Md(o,e,i){for(const l of i)for(let d=0,p=l.length,m=p-1;d<p;m=d++)if(Wl(o,e,l[m],l[d]))return!0;return!1}function hb(o,e){for(let i=0;i<o.length;++i)if(!ss(o[i],e))return!1;for(let i=0;i<o.length-1;++i)if(Md(o[i],o[i+1],e))return!1;return!0}function _2(o,e){for(let i=0;i<e.length;i++)if(hb(o,e[i]))return!0;return!1}function hy(o,e,i){const l=[];for(let d=0;d<o.length;d++){const p=[];for(let m=0;m<o[d].length;m++){const y=db(o[d][m],i);Ur(e,y),p.push(y)}l.push(p)}return l}function fy(o,e,i){const l=[];for(let d=0;d<o.length;d++){const p=hy(o[d],e,i);l.push(p)}return l}function py(o,e,i,l){if(o[0]<i[0]||o[0]>i[2]){const d=.5*l;let p=o[0]-i[0]>d?-l:i[0]-o[0]>d?l:0;p===0&&(p=o[0]-i[2]>d?-l:i[2]-o[0]>d?l:0),o[0]+=p}Ur(e,o)}function gm(o,e,i,l){const d=Math.pow(2,l.z)*Ha,p=[l.x*Ha,l.y*Ha],m=[];if(!o)return m;for(const y of o)for(const b of y){const S=[b.x+p[0],b.y+p[1]];py(S,e,i,d),m.push(S)}return m}function my(o,e,i,l){const d=Math.pow(2,l.z)*Ha,p=[l.x*Ha,l.y*Ha],m=[];if(!o)return m;for(const b of o){const S=[];for(const C of b){const I=[C.x+p[0],C.y+p[1]];Ur(e,I),S.push(I)}m.push(S)}if(e[2]-e[0]<=d/2){(y=e)[0]=y[1]=1/0,y[2]=y[3]=-1/0;for(const b of m)for(const S of b)py(S,e,i,d)}var y;return m}class wa{constructor(e,i){this.type=rr,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(Cd(e[1])){const l=e[1];if(l.type==="FeatureCollection")for(let d=0;d<l.features.length;++d){const p=l.features[d].geometry.type;if(p==="Polygon"||p==="MultiPolygon")return new wa(l,l.features[d].geometry)}else if(l.type==="Feature"){const d=l.geometry.type;if(d==="Polygon"||d==="MultiPolygon")return new wa(l,l.geometry)}else if(l.type==="Polygon"||l.type==="MultiPolygon")return new wa(l,l)}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,l){const d=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],m=i.canonicalID();if(!m)return!1;if(l.type==="Polygon"){const y=hy(l.coordinates,p,m),b=gm(i.geometry(),d,p,m);if(!ni(d,p))return!1;for(const S of b)if(!ss(S,y))return!1}if(l.type==="MultiPolygon"){const y=fy(l.coordinates,p,m),b=gm(i.geometry(),d,p,m);if(!ni(d,p))return!1;for(const S of b)if(!g2(S,y))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,l){const d=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],m=i.canonicalID();if(!m)return!1;if(l.type==="Polygon"){const y=hy(l.coordinates,p,m),b=my(i.geometry(),d,p,m);if(!ni(d,p))return!1;for(const S of b)if(!hb(S,y))return!1}if(l.type==="MultiPolygon"){const y=fy(l.coordinates,p,m),b=my(i.geometry(),d,p,m);if(!ni(d,p))return!1;for(const S of b)if(!_2(S,y))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Pu={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},fb=1/298.257223563,Du=fb*(2-fb),vf=Math.PI/180;class xf{static fromTile(e,i,l){const d=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),p=Math.atan(.5*(Math.exp(d)-Math.exp(-d)))/vf;return new xf(p,l)}static get units(){return Pu}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Pu[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Pu).join(", ")}`);const l=6378.137*vf*(i?Pu[i]:1),d=Math.cos(e*vf),p=1/(1-Du*(1-d*d)),m=Math.sqrt(p);this.kx=l*m*d,this.ky=l*m*p*(1-Du)}distance(e,i){const l=Sa(e[0]-i[0])*this.kx,d=(e[1]-i[1])*this.ky;return Math.sqrt(l*l+d*d)}bearing(e,i){const l=Sa(i[0]-e[0])*this.kx;return Math.atan2(l,(i[1]-e[1])*this.ky)/vf}destination(e,i,l){const d=l*vf;return this.offset(e,Math.sin(d)*i,Math.cos(d)*i)}offset(e,i,l){return[e[0]+i/this.kx,e[1]+l/this.ky]}lineDistance(e){let i=0;for(let l=0;l<e.length-1;l++)i+=this.distance(e[l],e[l+1]);return i}area(e){let i=0;for(let l=0;l<e.length;l++){const d=e[l];for(let p=0,m=d.length,y=m-1;p<m;y=p++)i+=Sa(d[p][0]-d[y][0])*(d[p][1]+d[y][1])*(l?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let l=0;if(i<=0)return e[0];for(let d=0;d<e.length-1;d++){const p=e[d],m=e[d+1],y=this.distance(p,m);if(l+=y,l>i)return gy(p,m,(i-(l-y))/y)}return e[e.length-1]}pointToSegmentDistance(e,i,l){let[d,p]=i,m=Sa(l[0]-d)*this.kx,y=(l[1]-p)*this.ky;if(m!==0||y!==0){const b=(Sa(e[0]-d)*this.kx*m+(e[1]-p)*this.ky*y)/(m*m+y*y);b>1?(d=l[0],p=l[1]):b>0&&(d+=m/this.kx*b,p+=y/this.ky*b)}return m=Sa(e[0]-d)*this.kx,y=(e[1]-p)*this.ky,Math.sqrt(m*m+y*y)}pointOnLine(e,i){let l=1/0,d=e[0][0],p=e[0][1],m=0,y=0;for(let b=0;b<e.length-1;b++){let S=e[b][0],C=e[b][1],I=Sa(e[b+1][0]-S)*this.kx,M=(e[b+1][1]-C)*this.ky,R=0;I===0&&M===0||(R=(Sa(i[0]-S)*this.kx*I+(i[1]-C)*this.ky*M)/(I*I+M*M),R>1?(S=e[b+1][0],C=e[b+1][1]):R>0&&(S+=I/this.kx*R,C+=M/this.ky*R)),I=Sa(i[0]-S)*this.kx,M=(i[1]-C)*this.ky;const O=I*I+M*M;O<l&&(l=O,d=S,p=C,m=b,y=R)}return{point:[d,p],index:m,t:Math.max(0,Math.min(1,y))}}lineSlice(e,i,l){let d=this.pointOnLine(l,e),p=this.pointOnLine(l,i);if(d.index>p.index||d.index===p.index&&d.t>p.t){const S=d;d=p,p=S}const m=[d.point],y=d.index+1,b=p.index;!_m(l[y],m[0])&&y<=b&&m.push(l[y]);for(let S=y+1;S<=b;S++)m.push(l[S]);return _m(l[b],p.point)||m.push(p.point),m}lineSliceAlong(e,i,l){let d=0;const p=[];for(let m=0;m<l.length-1;m++){const y=l[m],b=l[m+1],S=this.distance(y,b);if(d+=S,d>e&&p.length===0&&p.push(gy(y,b,(e-(d-S))/S)),d>=i)return p.push(gy(y,b,(i-(d-S))/S)),p;d>e&&p.push(b)}return p}bufferPoint(e,i){const l=i/this.ky,d=i/this.kx;return[e[0]-d,e[1]-l,e[0]+d,e[1]+l]}bufferBBox(e,i){const l=i/this.ky,d=i/this.kx;return[e[0]-d,e[1]-l,e[2]+d,e[3]+l]}insideBBox(e,i){return Sa(e[0]-i[0])>=0&&Sa(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function _m(o,e){return o[0]===e[0]&&o[1]===e[1]}function gy(o,e,i){const l=Sa(e[0]-o[0]);return[o[0]+l*i,o[1]+(e[1]-o[1])*i]}function Sa(o){for(;o<-180;)o+=360;for(;o>180;)o-=360;return o}class bf{constructor(e=[],i=(l,d)=>l<d?-1:l>d?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}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:l}=this,d=i[e];for(;e>0;){const p=e-1>>1,m=i[p];if(l(d,m)>=0)break;i[e]=m,e=p}i[e]=d}_down(e){const{data:i,compare:l}=this,d=this.length>>1,p=i[e];for(;e<d;){let m=1+(e<<1);const y=m+1;if(y<this.length&&l(i[y],i[m])<0&&(m=y),l(i[m],p)>=0)break;i[e]=i[m],e=m}i[e]=p}}var St=8192;function _y(o,e){return e.dist-o.dist}function yy(o){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==o.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==o[i])return!1;return!0}function wf(o){return o[1]-o[0]+1}function Sl(o,e){const i=o[1]>=o[0]&&o[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function ym(o,e){if(o[0]>o[1])return[null,null];const i=wf(o);if(e){if(i===2)return[o,null];const l=Math.floor(i/2);return[[o[0],o[0]+l],[o[0]+l,o[1]]]}{if(i===1)return[o,null];const l=Math.floor(i/2)-1;return[[o[0],o[0]+l],[o[0]+l+1,o[1]]]}}function Lc(o,e){const i=[1/0,1/0,-1/0,-1/0];if(!Sl(e,o.length))return i;for(let l=e[0];l<=e[1];++l)Ur(i,o[l]);return i}function Pd(o){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<o.length;++i)for(let l=0;l<o[i].length;++l)Ur(e,o[i][l]);return e}function Ru(o,e,i){if(yy(o)||yy(e))return NaN;let l=0,d=0;return o[2]<e[0]&&(l=e[0]-o[2]),o[0]>e[2]&&(l=o[0]-e[2]),o[1]>e[3]&&(d=o[1]-e[3]),o[3]<e[1]&&(d=e[1]-o[3]),i.distance([0,0],[l,d])}function Sf(o,e,i=8192){const l=Math.pow(2,e.z),d=(o.y/i+e.y)/l;return[cs((o.x/i+e.x)/l),Si(d)]}function pb(o,e){const i=[];for(let l=0;l<o.length;++l)i.push(Sf(o[l],e));return i}function vy(o,e,i){const l=i.pointOnLine(e,o).point;return i.distance(o,l)}function xy(o,e,i,l,d){const p=i.slice(l[0],l[1]+1);let m=1/0;for(let y=e[0];y<=e[1];++y)if((m=Math.min(m,vy(o[y],p,d)))===0)return 0;return m}function by(o,e,i,l,d){const p=Math.min(d.pointToSegmentDistance(o,i,l),d.pointToSegmentDistance(e,i,l)),m=Math.min(d.pointToSegmentDistance(i,o,e),d.pointToSegmentDistance(l,o,e));return Math.min(p,m)}function y2(o,e,i,l,d){if(!Sl(e,o.length)||!Sl(l,i.length))return NaN;let p=1/0;for(let m=e[0];m<e[1];++m)for(let y=l[0];y<l[1];++y){if(Wl(o[m],o[m+1],i[y],i[y+1]))return 0;p=Math.min(p,by(o[m],o[m+1],i[y],i[y+1],d))}return p}function vm(o,e,i,l,d){if(!Sl(e,o.length)||!Sl(l,i.length))return NaN;let p=1/0;for(let m=e[0];m<=e[1];++m)for(let y=l[0];y<=l[1];++y)if((p=Math.min(p,d.distance(o[m],i[y])))===0)return p;return p}function Tf(o,e,i){if(ss(o,e,!0))return 0;let l=1/0;for(const d of e){const p=d.length;if(p<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(d[0]!==d[p-1]&&(l=Math.min(l,i.pointToSegmentDistance(o,d[p-1],d[0])))===0||(l=Math.min(l,vy(o,d,i)))===0)return l}return l}function xm(o,e,i,l){if(!Sl(e,o.length))return NaN;for(let p=e[0];p<=e[1];++p)if(ss(o[p],i,!0))return 0;let d=1/0;for(let p=e[0];p<e[1];++p)for(const m of i)for(let y=0,b=m.length,S=b-1;y<b;S=y++){if(Wl(o[p],o[p+1],m[S],m[y]))return 0;d=Math.min(d,by(o[p],o[p+1],m[S],m[y],l))}return d}function wy(o,e){for(const i of o)for(let l=0;l<=i.length-1;++l)if(ss(i[l],e,!0))return!0;return!1}function mb(o,e,i,l=1/0){const d=Pd(o),p=Pd(e);if(l!==1/0&&Ru(d,p,i)>=l)return l;if(ni(d,p)){if(wy(o,e))return 0}else if(wy(e,o))return 0;let m=l;for(const y of o)for(let b=0,S=y.length,C=S-1;b<S;C=b++)for(const I of e)for(let M=0,R=I.length,O=R-1;M<R;O=M++){if(Wl(y[C],y[b],I[O],I[M]))return 0;m=Math.min(m,by(y[C],y[b],I[O],I[M],i))}return m}function Ef(o,e,i,l,d,p,m){if(p===null||m===null)return;const y=Ru(Lc(l,p),Lc(d,m),i);y<e&&o.push({dist:y,range1:p,range2:m})}function gb(o,e,i,l,d=1/0){let p=Math.min(l.distance(o[0],i[0][0]),d);if(p===0)return p;const m=new bf([{dist:0,range1:[0,o.length-1],range2:[0,0]}],_y),y=e?50:100,b=Pd(i);for(;m.length;){const S=m.pop();if(S.dist>=p)continue;const C=S.range1;if(wf(C)<=y){if(!Sl(C,o.length))return NaN;if(e){const I=xm(o,C,i,l);if((p=Math.min(p,I))===0)return p}else for(let I=C[0];I<=C[1];++I){const M=Tf(o[I],i,l);if((p=Math.min(p,M))===0)return p}}else{const I=ym(C,e);if(I[0]!==null){const M=Ru(Lc(o,I[0]),b,l);M<p&&m.push({dist:M,range1:I[0],range2:[0,0]})}if(I[1]!==null){const M=Ru(Lc(o,I[1]),b,l);M<p&&m.push({dist:M,range1:I[1],range2:[0,0]})}}}return p}function _b(o,e,i,l,d,p=1/0){let m=Math.min(p,d.distance(o[0],i[0]));if(m===0)return m;const y=new bf([{dist:0,range1:[0,o.length-1],range2:[0,i.length-1]}],_y),b=e?50:100,S=l?50:100;for(;y.length;){const C=y.pop();if(C.dist>=m)continue;const I=C.range1,M=C.range2;if(wf(I)<=b&&wf(M)<=S){if(!Sl(I,o.length)||!Sl(M,i.length))return NaN;if(e&&l?m=Math.min(m,y2(o,I,i,M,d)):e||l?e&&!l?m=Math.min(m,xy(i,M,o,I,d)):!e&&l&&(m=Math.min(m,xy(o,I,i,M,d))):m=Math.min(m,vm(o,I,i,M,d)),m===0)return m}else{const R=ym(I,e),O=ym(M,l);Ef(y,m,d,o,i,R[0],O[0]),Ef(y,m,d,o,i,R[0],O[1]),Ef(y,m,d,o,i,R[1],O[0]),Ef(y,m,d,o,i,R[1],O[1])}}return m}function Sy(o,e,i,l,d=1/0){let p=d;const m=Lc(o,[0,o.length-1]);for(const y of i)if(!(p!==1/0&&Ru(m,Lc(y,[0,y.length-1]),l)>=p)&&(p=Math.min(p,_b(o,e,y,!0,l,p)),p===0))return p;return p}function bm(o,e,i,l,d=1/0){let p=d;const m=Lc(o,[0,o.length-1]);for(const y of i){if(p!==1/0&&Ru(m,Pd(y),l)>=p)continue;const b=gb(o,e,y,l,p);if(isNaN(b))return b;if((p=Math.min(p,b))===0)return p}return p}function Oc(o){return o==="Point"||o==="MultiPoint"||o==="LineString"||o==="MultiLineString"||o==="Polygon"||o==="MultiPolygon"}class Fc{constructor(e,i){this.type=Gt,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(Cd(e[1])){const l=e[1];if(l.type==="FeatureCollection"){for(let d=0;d<l.features.length;++d)if(Oc(l.features[d].geometry.type))return new Fc(l,l.features[d].geometry)}else if(l.type==="Feature"){if(Oc(l.geometry.type))return new Fc(l,l.geometry)}else if(Oc(l.type))return new Fc(l,l)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),l=e.canonicalID();if(i!=null&&l!=null){if(e.geometryType()==="Point")return function(d,p,m){const y=[];for(const S of d)for(const C of S)y.push(Sf(C,p));const b=new xf(y[0][1],"meters");return m.type==="Point"||m.type==="MultiPoint"||m.type==="LineString"?_b(y,!1,m.type==="Point"?[m.coordinates]:m.coordinates,m.type==="LineString",b):m.type==="MultiLineString"?Sy(y,!1,m.coordinates,b):m.type==="Polygon"||m.type==="MultiPolygon"?bm(y,!1,m.type==="Polygon"?[m.coordinates]:m.coordinates,b):null}(i,l,this.geometries);if(e.geometryType()==="LineString")return function(d,p,m){const y=[];for(const S of d){const C=[];for(const I of S)C.push(Sf(I,p));y.push(C)}const b=new xf(y[0][0][1],"meters");if(m.type==="Point"||m.type==="MultiPoint"||m.type==="LineString")return Sy(m.type==="Point"?[m.coordinates]:m.coordinates,m.type==="LineString",y,b);if(m.type==="MultiLineString"){let S=1/0;for(let C=0;C<m.coordinates.length;C++){const I=Sy(m.coordinates[C],!0,y,b,S);if(isNaN(I))return I;if((S=Math.min(S,I))===0)return S}return S}if(m.type==="Polygon"||m.type==="MultiPolygon"){let S=1/0;for(let C=0;C<y.length;C++){const I=bm(y[C],!0,m.type==="Polygon"?[m.coordinates]:m.coordinates,b,S);if(isNaN(I))return I;if((S=Math.min(S,I))===0)return S}return S}return null}(i,l,this.geometries);if(e.geometryType()==="Polygon")return function(d,p,m){const y=[];for(const S of Bn(d,0)){const C=[];for(let I=0;I<S.length;++I)C.push(pb(S[I],p));y.push(C)}const b=new xf(y[0][0][0][1],"meters");if(m.type==="Point"||m.type==="MultiPoint"||m.type==="LineString")return bm(m.type==="Point"?[m.coordinates]:m.coordinates,m.type==="LineString",y,b);if(m.type==="MultiLineString"){let S=1/0;for(let C=0;C<m.coordinates.length;C++){const I=bm(m.coordinates[C],!0,y,b,S);if(isNaN(I))return I;if((S=Math.min(S,I))===0)return S}return S}return m.type==="Polygon"||m.type==="MultiPolygon"?function(S,C,I){let M=1/0;for(const R of S)for(const O of C){const N=mb(R,O,I,M);if(isNaN(N))return N;if((M=Math.min(M,N))===0)return M}return M}(m.type==="Polygon"?[m.coordinates]:m.coordinates,y,b):null}(i,l,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requires valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function wn(o){if(o instanceof bs&&(o.name==="get"&&o.args.length===1||o.name==="feature-state"||o.name==="has"&&o.args.length===1||o.name==="properties"||o.name==="geometry-type"||o.name==="id"||o.name.startsWith("filter-"))||o instanceof wa||o instanceof Fc)return!1;if(o instanceof Lu)return o.featureConstant;let e=!0;return o.eachChild(i=>{e&&!wn(i)&&(e=!1)}),e}function Dd(o){if(o instanceof bs&&o.name==="feature-state")return!1;let e=!0;return o.eachChild(i=>{e&&!Dd(i)&&(e=!1)}),e}function Tl(o,e){if(o instanceof bs&&e.includes(o.name))return!1;let i=!0;return o.eachChild(l=>{i&&!Tl(l,e)&&(i=!1)}),i}function yb(o,e,i){return[o,e,i].filter(Boolean).join("")}function Ty(o,e){switch(o){case"string":return Xs(e);case"number":return+e;case"boolean":return!!e;case"color":return qn.parse(e);case"formatted":return Ao.fromString(Xs(e));case"resolvedImage":return ls.build(Xs(e))}return e}function vb(o,e,i,l){return l!==void 0&&(o=l*Math.round(o/l)),e!==void 0&&o<e&&(o=e),i!==void 0&&o>i&&(o=i),o}class Lu{constructor(e,i,l,d=!1){this.type=e,this.key=i,this.scope=l,this.featureConstant=d}static parse(e,i){let l=i.expectedType;if(l==null&&(l=ir),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const d=i.parse(e[1],1);if(!(d instanceof xl))return i.error("Key name of 'config' expression must be a string literal.");let p,m=!0;const y=Xs(d.value);if(e.length>=3){const b=i.parse(e[2],2);if(!(b instanceof xl))return i.error("Scope of 'config' expression must be a string literal.");p=Xs(b.value)}if(i.options){const b=yb(y,p,i._scope),S=i.options.get(b);S&&(m=wn(S.value||S.default))}return new Lu(l,y,p,m)}evaluate(e){const i=yb(this.key,this.scope,e.scope),l=e.getConfig(i);if(!l)return null;const{type:d,value:p,values:m,minValue:y,maxValue:b,stepValue:S}=l,C=l.default.evaluate(e);let I=C;if(p){const M=e.scope;e.scope=(M||"").split("").slice(1).join(""),I=p.evaluate(e),e.scope=M}return d&&(I=Ty(d,I)),I===void 0||y===void 0&&b===void 0&&S===void 0||(typeof I=="number"?I=vb(I,y,b,S):Array.isArray(I)&&(I=I.map(M=>typeof M=="number"?vb(M,y,b,S):M))),p!==void 0&&I!==void 0&&m&&!m.includes(I)&&(I=C,d&&(I=Ty(d,I))),(d&&d!==this.type||I!==void 0&&!vl(to(I),this.type))&&(I=Ty(this.type.kind,I)),I}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class kf{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 l=e[1];return i.scope.has(l)?new kf(l,i.scope.get(l)):i.error(`Unknown variable "${l}". Make sure "${l}" 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 Wa{constructor(e,i=[],l,d=new dm,p=[],m,y,b){this.registry=e,this.path=i,this.scope=d,this.errors=p,this.expectedType=l,this._scope=m,this.options=y,this.iconImageUseTheme=b}get key(){if(this._key===void 0){const e=this.path;let i="";for(let l=0;l<e.length;l++){const d=e[l];i+=typeof d=="string"?`['${d}']`:`[${d}]`}this._key=i}return this._key}parse(e,i,l,d,p={}){return i||l?this.concat(i,null,l,d)._parse(e,p):this._parse(e,p)}parseObjectValue(e,i,l,d,p,m={}){return this.concat(i,l,d,p)._parse(e,m)}_parse(e,i){function l(d,p,m){return m==="assert"?new Ga(p,[d]):m==="coerce"?new bl(p,[d]):d}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 d=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(d){let p=d.parse(e,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||y.kind!=="value"&&y.kind!=="string"){if(this.checkSubtype(m,y))return null}else p=l(p,m,i.typeAnnotation||"coerce");else p=l(p,m,i.typeAnnotation||"assert")}if(!(p instanceof xl)&&p.type.kind!=="resolvedImage"&&wm(p)){const m=new $a(this._scope,this.options,this.iconImageUseTheme);try{p=new xl(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return bl.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,l,d){let p=typeof e=="number"?this.path.concat(e):this.path;p=typeof i=="string"?p.concat(i):p;const m=d?this.scope.concat(d):this.scope;return new Wa(this.registry,p,l||null,m,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const l=`${this.key}${i.map(d=>`[${d}]`).join("")}`;this.errors.push(new lo(l,e))}checkSubtype(e,i,l){const d=Mu(e,i);return d&&this.error(d,...typeof l=="number"?[l]:[]),d}}function wm(o){if(o instanceof kf)return wm(o.boundExpression);if(o instanceof bs&&o.name==="error"||o instanceof mm||o instanceof wa||o instanceof Fc||o instanceof Lu)return!1;const e=o instanceof bl||o instanceof Ga;let i=!0;return o.eachChild(l=>{i=e?i&&wm(l):i&&l instanceof xl}),!!i&&wn(o)&&Tl(o,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"])}function Sm(o,e){const i=o.length-1;let l,d,p=0,m=i,y=0;for(;p<=m;)if(y=Math.floor((p+m)/2),l=o[y],d=o[y+1],l<=e){if(y===i||e<d)return y;p=y+1}else{if(!(l>e))throw new wi("Input is not a number.");m=y-1}return 0}class Af{constructor(e,i,l){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[d,p]of l)this.labels.push(d),this.outputs.push(p)}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 l=i.parse(e[1],1,Gt);if(!l)return null;const d=[];let p=null;i.expectedType&&i.expectedType.kind!=="value"&&(p=i.expectedType);for(let m=1;m<e.length;m+=2){const y=m===1?-1/0:e[m],b=e[m+1],S=m,C=m+1;if(typeof y!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',S);if(d.length&&d.at(-1)[0]>=y)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',S);const I=i.parse(b,C,p);if(!I)return null;p=p||I.type,d.push([y,I])}return new Af(p,l,d)}evaluate(e){const i=this.labels,l=this.outputs;if(i.length===1)return l[0].evaluate(e);const d=this.input.evaluate(e);if(d<=i[0])return l[0].evaluate(e);const p=i.length;return d>=i[p-1]?l[p-1].evaluate(e):l[Sm(i,d)].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 xb=.95047,Cf=1.08883,bb=4/29,Ou=6/29,wb=3*Ou*Ou,Sb=Ou*Ou*Ou,v2=Math.PI/180,x2=180/Math.PI;function Ey(o){return o>Sb?Math.pow(o,1/3):o/wb+bb}function ky(o){return o>Ou?o*o*o:wb*(o-bb)}function Ay(o){return 255*(o<=.0031308?12.92*o:1.055*Math.pow(o,1/2.4)-.055)}function Rs(o){return(o/=255)<=.04045?o/12.92:Math.pow((o+.055)/1.055,2.4)}function Cy(o){const e=Rs(o.r),i=Rs(o.g),l=Rs(o.b),d=Ey((.4124564*e+.3575761*i+.1804375*l)/xb),p=Ey((.2126729*e+.7151522*i+.072175*l)/1);return{l:116*p-16,a:500*(d-p),b:200*(p-Ey((.0193339*e+.119192*i+.9503041*l)/Cf)),alpha:o.a}}function Rd(o){let e=(o.l+16)/116,i=isNaN(o.a)?e:e+o.a/500,l=isNaN(o.b)?e:e-o.b/200;return e=1*ky(e),i=xb*ky(i),l=Cf*ky(l),new qn(Ay(3.2404542*i-1.5371385*e-.4985314*l),Ay(-.969266*i+1.8760108*e+.041556*l),Ay(.0556434*i-.2040259*e+1.0572252*l),o.alpha)}function If(o,e,i){const l=e-o;return o+i*(l>180||l<-180?l-360*Math.round(l/360):l)}const Mf={forward:Cy,reverse:Rd,interpolate:function(o,e,i){return{l:Jt(o.l,e.l,i),a:Jt(o.a,e.a,i),b:Jt(o.b,e.b,i),alpha:Jt(o.alpha,e.alpha,i)}}},Pf={forward:function(o){const{l:e,a:i,b:l}=Cy(o),d=Math.atan2(l,i)*x2;return{h:d<0?d+360:d,c:Math.sqrt(i*i+l*l),l:e,alpha:o.a}},reverse:function(o){const e=o.h*v2,i=o.c;return Rd({l:o.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:o.alpha})},interpolate:function(o,e,i){return{h:If(o.h,e.h,i),c:Jt(o.c,e.c,i),l:Jt(o.l,e.l,i),alpha:Jt(o.alpha,e.alpha,i)}}};var Iy=Object.freeze({__proto__:null,hcl:Pf,lab:Mf});class Ks{constructor(e,i,l,d,p){this.type=e,this.operator=i,this.interpolation=l,this.input=d,this.labels=[],this.outputs=[];for(const[m,y]of p)this.labels.push(m),this.outputs.push(y)}static interpolationFactor(e,i,l,d){let p=0;if(e.name==="exponential")p=My(i,e.base,l,d);else if(e.name==="linear")p=My(i,1,l,d);else if(e.name==="cubic-bezier"){const m=e.controlPoints;p=vr(m[0],m[1],m[2],m[3])(My(i,1,l,d))}return p}static parse(e,i){let[l,d,p,...m]=e;if(!Array.isArray(d)||d.length===0)return i.error("Expected an interpolation type expression.",1);if(d[0]==="linear")d={name:"linear"};else if(d[0]==="exponential"){const S=d[1];if(typeof S!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);d={name:"exponential",base:S}}else{if(d[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(d[0])}`,1,0);{const S=d.slice(1);if(S.length!==4||S.some(C=>typeof C!="number"||C<0||C>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);d={name:"cubic-bezier",controlPoints:S}}}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(p=i.parse(p,2,Gt),!p)return null;const y=[];let b=null;l==="interpolate-hcl"||l==="interpolate-lab"?b=as:i.expectedType&&i.expectedType.kind!=="value"&&(b=i.expectedType);for(let S=0;S<m.length;S+=2){const C=m[S],I=m[S+1],M=S+3,R=S+4;if(typeof C!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',M);if(y.length&&y.at(-1)[0]>=C)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',M);const O=i.parse(I,R,b);if(!O)return null;b=b||O.type,y.push([C,O])}return b.kind==="number"||b.kind==="color"||b.kind==="array"&&b.itemType.kind==="number"&&typeof b.N=="number"?new Ks(b,l,d,p,y):i.error(`Type ${bi(b)} is not interpolatable.`)}evaluate(e){const i=this.labels,l=this.outputs;if(i.length===1)return l[0].evaluate(e);const d=this.input.evaluate(e);if(d<=i[0])return l[0].evaluate(e);const p=i.length;if(d>=i[p-1])return l[p-1].evaluate(e);const m=Sm(i,d),y=Ks.interpolationFactor(this.interpolation,d,i[m],i[m+1]),b=l[m].evaluate(e),S=l[m+1].evaluate(e);return this.operator==="interpolate"?Ed[this.type.kind.toLowerCase()](b,S,y):this.operator==="interpolate-hcl"?Pf.reverse(Pf.interpolate(Pf.forward(b),Pf.forward(S),y)):Mf.reverse(Mf.interpolate(Mf.forward(b),Mf.forward(S),y))}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 l=0;l<this.labels.length;l++)i.push(this.labels[l],this.outputs[l].serialize());return i}}function My(o,e,i,l){const d=l-i,p=o-i;return d===0?0:e===1?p/d:(Math.pow(e,p)-1)/(Math.pow(e,d)-1)}class Df{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."),null;let l=null;const d=i.expectedType;d&&d.kind!=="value"&&(l=d);const p=[];for(const y of e.slice(1)){const b=i.parse(y,1+p.length,l,void 0,{typeAnnotation:"omit"});if(!b)return null;l=l||b.type,p.push(b)}const m=d&&p.some(y=>Mu(d,y.type));return new Df(m?ir:l,p)}evaluate(e){let i,l=null,d=0;for(const p of this.args){if(d++,l=p.evaluate(e),l&&l instanceof ls&&!l.available&&(i||(i=l),l=null,d===this.args.length))return i;if(l!==null)break}return l}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}}const Tb=/[^a-zA-Z0-9_]/;class Rf{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 l=[];for(let p=1;p<e.length-1;p+=2){const m=e[p];if(typeof m!="string")return i.error(`Expected string, but found ${typeof m} instead.`,p);if(Tb.test(m))return i.error("Variable names must contain only alphanumeric characters or '_'.",p);const y=i.parse(e[p+1],p+1);if(!y)return null;l.push([m,y])}const d=i.parse(e.at(-1),e.length-1,i.expectedType,l);return d?new Rf(l,d):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,l]of this.bindings)e.push(i,l.serialize());return e.push(this.result.serialize()),e}}class Py{constructor(e,i,l){this.type=e,this.index=i,this.input=l}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const l=i.parse(e[1],1,Gt),d=i.parse(e[2],2,$i(i.expectedType||ir));return l&&d?new Py(d.type.itemType,l,d):null}evaluate(e){const i=this.index.evaluate(e),l=this.input.evaluate(e);if(i<0)throw new wi("Array index out of bounds: negative index");if(i>=l.length)throw new wi("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new wi("Array index must be an integer. Use at-interpolated for fractional indices");return l[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Zn{constructor(e,i,l){this.type=e,this.index=i,this.input=l}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const l=i.parse(e[1],1,Gt),d=i.parse(e[2],2,$i(i.expectedType||ir));return l&&d?new Zn(d.type.itemType,l,d):null}evaluate(e){const i=this.index.evaluate(e),l=this.input.evaluate(e);if(i<0)throw new wi(`Array index out of bounds: ${i} < 0.`);if(i>l.length-1)throw new wi(`Array index out of bounds: ${i} > ${l.length-1}.`);if(i===Math.floor(i))return l[i];const d=Math.floor(i),p=Math.ceil(i),m=l[d],y=l[p];if(typeof m!="number"||typeof y!="number")throw new wi(`Cannot interpolate between non-number values at index ${i}.`);return Jt(m,y,i-d)}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Ld{constructor(e,i){this.type=rr,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.`),null;const l=i.parse(e[1],1,ir),d=i.parse(e[2],2,ir);return l&&d?rn(l.type,[rr,tr,Gt,kd,ir])?new Ld(l,d):(i.error(`Expected first argument to be of type boolean, string, number or null, but found ${bi(l.type)} instead`),null):null}evaluate(e){const i=this.needle.evaluate(e),l=this.haystack.evaluate(e);if(l==null)return!1;if(!Dc(i,["boolean","string","number","null"]))throw new wi(`Expected first argument to be of type boolean, string, number or null, but found ${bi(to(i))} instead.`);if(!Dc(l,["string","array"]))throw new wi(`Expected second argument to be of type array or string, but found ${bi(to(l))} instead.`);return l.includes(i)}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Od{constructor(e,i,l){this.type=Gt,this.needle=e,this.haystack=i,this.fromIndex=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.`),null;const l=i.parse(e[1],1,ir),d=i.parse(e[2],2,ir);if(!l||!d)return null;if(!rn(l.type,[rr,tr,Gt,kd,ir]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${bi(l.type)} instead`),null;if(e.length===4){const p=i.parse(e[3],3,Gt);return p?new Od(l,d,p):null}return new Od(l,d)}evaluate(e){const i=this.needle.evaluate(e),l=this.haystack.evaluate(e);if(!Dc(i,["boolean","string","number","null"]))throw new wi(`Expected first argument to be of type boolean, string, number or null, but found ${bi(to(i))} instead.`);if(!Dc(l,["string","array"]))throw new wi(`Expected second argument to be of type array or string, but found ${bi(to(l))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(e);return l.indexOf(i,d)}return l.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 Lf{constructor(e,i,l,d,p,m){this.inputType=e,this.type=i,this.input=l,this.cases=d,this.outputs=p,this.otherwise=m}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 l,d;i.expectedType&&i.expectedType.kind!=="value"&&(d=i.expectedType);const p={},m=[];for(let S=2;S<e.length-1;S+=2){let C=e[S];const I=e[S+1];Array.isArray(C)||(C=[C]);const M=i.concat(S);if(C.length===0)return M.error("Expected at least one branch label.");for(const O of C){if(typeof O!="number"&&typeof O!="string")return M.error("Branch labels must be numbers or strings.");if(typeof O=="number"&&Math.abs(O)>Number.MAX_SAFE_INTEGER)return M.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof O=="number"&&Math.floor(O)!==O)return M.error("Numeric branch labels must be integer values.");if(l){if(M.checkSubtype(l,to(O)))return null}else l=to(O);if(p[String(O)]!==void 0)return M.error("Branch labels must be unique.");p[String(O)]=m.length}const R=i.parse(I,S,d);if(!R)return null;d=d||R.type,m.push(R)}const y=i.parse(e[1],1,ir);if(!y)return null;const b=i.parse(e.at(-1),e.length-1,d);return b?y.type.kind!=="value"&&i.concat(1).checkSubtype(l,y.type)?null:new Lf(l,d,y,p,m,b):null}evaluate(e){const i=this.input.evaluate(e);return(vl(to(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(),l=[],d={};for(const m of i){const y=d[this.cases[m]];y===void 0?(d[this.cases[m]]=l.length,l.push([this.cases[m],[m]])):l[y][1].push(m)}const p=m=>this.inputType.kind==="number"?Number(m):m;for(const[m,y]of l)e.push(y.length===1?p(y[0]):y.map(p)),e.push(this.outputs[m].serialize());return e.push(this.otherwise.serialize()),e}}class Tm{constructor(e,i,l){this.type=e,this.branches=i,this.otherwise=l}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return i.error("Expected an odd number of arguments."),null;let l;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);const d=[];for(let m=1;m<e.length-1;m+=2){const y=i.parse(e[m],m,rr);if(!y)return null;const b=i.parse(e[m+1],m+1,l);if(!b)return null;d.push([y,b]),l=l||b.type}const p=i.parse(e.at(-1),e.length-1,l);return p?new Tm(l,d,p):null}evaluate(e){for(const[i,l]of this.branches)if(i.evaluate(e))return l.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,l]of this.branches)e(i),e(l);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 Fd{constructor(e,i,l,d){this.type=e,this.input=i,this.beginIndex=l,this.endIndex=d}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.`),null;const l=i.parse(e[1],1,ir),d=i.parse(e[2],2,Gt);if(!l||!d)return null;if(!rn(l.type,[$i(ir),tr,ir]))return i.error(`Expected first argument to be of type array or string, but found ${bi(l.type)} instead`),null;if(e.length===4){const p=i.parse(e[3],3,Gt);return p?new Fd(l.type,l,d,p):null}return new Fd(l.type,l,d)}evaluate(e){const i=this.input.evaluate(e),l=this.beginIndex.evaluate(e);if(!Dc(i,["string","array"]))throw new wi(`Expected first argument to be of type array or string, but found ${bi(to(i))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(e);return i.slice(l,d)}return i.slice(l)}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 Ta{constructor(e,i){this.type=$i(tr),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 l=i.parse(e[1],1,tr),d=i.parse(e[2],2,tr);return l&&d?new Ta(l,d):void 0}evaluate(e){const i=this.str.evaluate(e),l=this.delimiter.evaluate(e);return i.split(l)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Kl(o,e){return o==="=="||o==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Dy(o,e,i,l){return l.compare(e,i)===0}function zc(o,e,i){const l=o!=="=="&&o!=="!=";return class KV{constructor(p,m,y){this.type=rr,this.lhs=p,this.rhs=m,this.collator=y,this.hasUntypedArgument=p.type.kind==="value"||m.type.kind==="value"}static parse(p,m){if(p.length!==3&&p.length!==4)return m.error("Expected two or three arguments.");const y=p[0];let b=m.parse(p[1],1,ir);if(!b)return null;if(!Kl(y,b.type))return m.concat(1).error(`"${y}" comparisons are not supported for type '${bi(b.type)}'.`);let S=m.parse(p[2],2,ir);if(!S)return null;if(!Kl(y,S.type))return m.concat(2).error(`"${y}" comparisons are not supported for type '${bi(S.type)}'.`);if(b.type.kind!==S.type.kind&&b.type.kind!=="value"&&S.type.kind!=="value")return m.error(`Cannot compare types '${bi(b.type)}' and '${bi(S.type)}'.`);l&&(b.type.kind==="value"&&S.type.kind!=="value"?b=new Ga(S.type,[b]):b.type.kind!=="value"&&S.type.kind==="value"&&(S=new Ga(b.type,[S])));let C=null;if(p.length===4){if(b.type.kind!=="string"&&S.type.kind!=="string"&&b.type.kind!=="value"&&S.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(C=m.parse(p[3],3,Iu),!C)return null}return new KV(b,S,C)}evaluate(p){const m=this.lhs.evaluate(p),y=this.rhs.evaluate(p);if(l&&this.hasUntypedArgument){const b=to(m),S=to(y);if(b.kind!==S.kind||b.kind!=="string"&&b.kind!=="number")throw new wi(`Expected arguments for "${o}" to be (string, string) or (number, number), but found (${b.kind}, ${S.kind}) instead.`)}if(this.collator&&!l&&this.hasUntypedArgument){const b=to(m),S=to(y);if(b.kind!=="string"||S.kind!=="string")return e(p,m,y)}return this.collator?i(p,m,y,this.collator.evaluate(p)):e(p,m,y)}eachChild(p){p(this.lhs),p(this.rhs),this.collator&&p(this.collator)}outputDefined(){return!0}serialize(){const p=[o];return this.eachChild(m=>{p.push(m.serialize())}),p}}}const Ry=zc("==",function(o,e,i){return e===i},Dy),Em=zc("!=",function(o,e,i){return e!==i},function(o,e,i,l){return!Dy(0,e,i,l)}),b2=zc("<",function(o,e,i){return e<i},function(o,e,i,l){return l.compare(e,i)<0}),km=zc(">",function(o,e,i){return e>i},function(o,e,i,l){return l.compare(e,i)>0}),w2=zc("<=",function(o,e,i){return e<=i},function(o,e,i,l){return l.compare(e,i)<=0}),Am=zc(">=",function(o,e,i){return e>=i},function(o,e,i,l){return l.compare(e,i)>=0});class Ly{constructor(e,i,l,d,p,m){this.type=tr,this.number=e,this.locale=i,this.currency=l,this.unit=d,this.minFractionDigits=p,this.maxFractionDigits=m}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const l=i.parse(e[1],1,Gt);if(!l)return null;const d=e[2];if(typeof d!="object"||Array.isArray(d))return i.error("NumberFormat options argument must be an object.");let p=null;if(d.locale&&(p=i.parseObjectValue(d.locale,2,"locale",tr),!p))return null;let m=null;if(d.currency&&(m=i.parseObjectValue(d.currency,2,"currency",tr),!m))return null;let y=null;if(d.unit&&(y=i.parseObjectValue(d.unit,2,"unit",tr),!y))return null;let b=null;if(d["min-fraction-digits"]&&(b=i.parseObjectValue(d["min-fraction-digits"],2,"min-fraction-digits",Gt),!b))return null;let S=null;return d["max-fraction-digits"]&&(S=i.parseObjectValue(d["max-fraction-digits"],2,"max-fraction-digits",Gt),!S)?null:new Ly(l,p,m,y,b,S)}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 Of{constructor(e){this.type=Gt,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const l=i.parse(e[1],1);return l?l.type.kind!=="array"&&l.type.kind!=="string"&&l.type.kind!=="value"?(i.error(`Expected argument of type string or array, but found ${bi(l.type)} instead.`),null):new Of(l):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new wi(`Expected value to be of type string or array, but found ${bi(to(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Cm(o){return function(){o=1831565813+(o|=0)|0;let e=Math.imul(o^o>>>15,1|o);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const El={"==":Ry,"!=":Em,">":km,"<":b2,">=":Am,"<=":w2,array:Ga,at:Py,"at-interpolated":Zn,boolean:Ga,case:Tm,coalesce:Df,collator:mm,format:yf,image:hm,in:Ld,"index-of":Od,interpolate:Ks,"interpolate-hcl":Ks,"interpolate-lab":Ks,length:Of,let:Rf,literal:xl,match:Lf,number:Ga,"number-format":Ly,object:Ga,slice:Fd,step:Af,string:Ga,"to-boolean":bl,"to-color":bl,"to-number":bl,"to-string":bl,var:kf,within:wa,distance:Fc,config:Lu,split:Ta};function Im(o,[e,i,l,d]){e=e.evaluate(o),i=i.evaluate(o),l=l.evaluate(o);const p=d?d.evaluate(o):1,m=ub(e,i,l,p);if(m)throw new wi(m);return new qn(e/255,i/255,l/255,p)}function Mm(o,[e,i,l,d]){e=e.evaluate(o),i=i.evaluate(o),l=l.evaluate(o);const p=d?d.evaluate(o):1,m=function(S,C,I,M){return typeof S=="number"&&S>=0&&S<=360?typeof C=="number"&&C>=0&&C<=100&&typeof I=="number"&&I>=0&&I<=100?M===void 0||typeof M=="number"&&M>=0&&M<=1?null:`Invalid hsla value [${[S,C,I,M].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof M=="number"?[S,C,I,M]:[S,C,I]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof M=="number"?[S,C,I,M]:[S,C,I]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,l,p);if(m)throw new wi(m);const y=`hsla(${e}, ${i}%, ${l}%, ${p})`,b=qn.parse(y);if(!b)throw new wi(`Failed to parse HSLA color: ${y}`);return b}function Oy(o,e){return o in e}function Ff(o,e){const i=e[o];return i===void 0?null:i}function Ea(o){return{type:o}}function zf(o){if(o instanceof Lu)return new Set([o.key]);let e=new Set;return o.eachChild(i=>{e=new Set([...e,...zf(i)])}),e}function Pm(o){if(o instanceof bs&&o.name==="is-active-floor")return!0;let e=!1;return o.eachChild(i=>{!e&&Pm(i)&&(e=!0)}),e}function Eb(o){return{result:"success",value:o}}function Yl(o){return{result:"error",value:o}}function Fy(o,e){return!!o&&!!o.parameters&&o.parameters.includes(e)}function Ys(o){return o["property-type"]==="data-driven"}function kb(o){return Fy(o.expression,"measure-light")}function zy(o){return Fy(o.expression,"zoom")}function By(o){return!!o.expression&&o.expression.interpolated}function Ny(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function S2(o){return o}function Ab(o,e){const i=e.type==="color",l=o.stops&&typeof o.stops[0][0]=="object",d=l||!(l||o.property!==void 0),p=o.type||(By(e)?"exponential":"interval");if(i&&((o=Object.assign({},o)).stops&&(o.stops=o.stops.map(S=>[S[0],qn.parse(S[1])])),o.default=qn.parse(o.default?o.default:e.default)),o.colorSpace&&o.colorSpace!=="rgb"&&!Iy[o.colorSpace])throw new Error(`Unknown color space: ${o.colorSpace}`);let m,y,b;if(p==="exponential")m=Dm;else if(p==="interval")m=Vy;else if(p==="categorical"){m=Cb,y=Object.create(null);for(const S of o.stops)y[S[0]]=S[1];b=typeof o.stops[0][0]}else{if(p!=="identity")throw new Error(`Unknown function type "${p}"`);m=Bf}if(l){const S={},C=[];for(let R=0;R<o.stops.length;R++){const O=o.stops[R],N=O[0].zoom;S[N]===void 0&&(S[N]={zoom:N,type:o.type,property:o.property,default:o.default,stops:[]},C.push(N)),S[N].stops.push([O[0].value,O[1]])}const I=[];for(const R of C)I.push([S[R].zoom,Ab(S[R],e)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:Ks.interpolationFactor.bind(void 0,M),zoomStops:I.map(R=>R[0]),evaluate:({zoom:R},O)=>Dm({stops:I,base:o.base},e,R).evaluate(R,O)}}if(d){const S=p==="exponential"?{name:"exponential",base:o.base!==void 0?o.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Ks.interpolationFactor.bind(void 0,S),zoomStops:o.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(o,e,C,y,b)}}return{kind:"source",evaluate(S,C){const I=C&&C.properties?C.properties[o.property]:void 0;return I===void 0?Bc(o.default,e.default):m(o,e,I,y,b)}}}function Bc(o,e,i){return o!==void 0?o:e!==void 0?e:i!==void 0?i:void 0}function Cb(o,e,i,l,d){return Bc(typeof i===d?l[i]:void 0,o.default,e.default)}function Vy(o,e,i){if(!fm(i))return Bc(o.default,e.default);const l=o.stops.length;if(l===1||i<=o.stops[0][0])return o.stops[0][1];if(i>=o.stops[l-1][0])return o.stops[l-1][1];const d=Sm(o.stops.map(p=>p[0]),i);return o.stops[d][1]}function Dm(o,e,i){const l=o.base!==void 0?o.base:1;if(!fm(i))return Bc(o.default,e.default);const d=o.stops.length;if(d===1||i<=o.stops[0][0])return o.stops[0][1];if(i>=o.stops[d-1][0])return o.stops[d-1][1];const p=Sm(o.stops.map(C=>C[0]),i),m=function(C,I,M,R){const O=R-M,N=C-M;return O===0?0:I===1?N/O:(Math.pow(I,N)-1)/(Math.pow(I,O)-1)}(i,l,o.stops[p][0],o.stops[p+1][0]),y=o.stops[p][1],b=o.stops[p+1][1];let S=Ed[e.type]||S2;if(o.colorSpace&&o.colorSpace!=="rgb"){const C=Iy[o.colorSpace];S=(I,M)=>C.reverse(C.interpolate(C.forward(I),C.forward(M),m))}return typeof y.evaluate=="function"?{evaluate(...C){const I=y.evaluate.apply(void 0,C),M=b.evaluate.apply(void 0,C);if(I!==void 0&&M!==void 0)return S(I,M,m)}}:S(y,b,m)}function Bf(o,e,i){return e.type==="color"?i=qn.parse(i):e.type==="formatted"?i=Ao.fromString(i.toString()):e.type==="resolvedImage"?i=ls.build(i.toString()):Id(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Bc(i,o.default,e.default)}bs.register(El,{error:[{kind:"error"},[tr],(o,[e])=>{throw new wi(e.evaluate(o))}],typeof:[tr,[ir],(o,[e])=>bi(to(e.evaluate(o)))],"to-rgba":[$i(Gt,4),[as],(o,[e])=>e.evaluate(o).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[$i(Gt,4),[as],(o,[e])=>e.evaluate(o).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[as,[Gt,Gt,Gt],Im],rgba:[as,[Gt,Gt,Gt,Gt],Im],hsl:[as,[Gt,Gt,Gt],Mm],hsla:[as,[Gt,Gt,Gt,Gt],Mm],has:{type:rr,overloads:[[[tr],(o,[e])=>Oy(e.evaluate(o),o.properties())],[[tr,Cu],(o,[e,i])=>Oy(e.evaluate(o),i.evaluate(o))]]},get:{type:ir,overloads:[[[tr],(o,[e])=>Ff(e.evaluate(o),o.properties())],[[tr,Cu],(o,[e,i])=>Ff(e.evaluate(o),i.evaluate(o))]]},"feature-state":[ir,[tr],(o,[e])=>Ff(e.evaluate(o),o.featureState||{})],properties:[Cu,[],o=>o.properties()],"geometry-type":[tr,[],o=>o.geometryType()],worldview:[tr,[],o=>o.globals.worldview||""],"is-active-floor":[rr,Ea(tr),(o,e)=>{if(!(o.globals&&o.globals.activeFloors&&o.globals.activeFloors.size>0))return!1;if(e.length===0)return!0;const i=o.globals.activeFloors;return e.some(l=>{const d=l.evaluate(o);return i.has(d)})}],id:[ir,[],o=>o.id()],zoom:[Gt,[],o=>o.globals.zoom],pitch:[Gt,[],o=>o.globals.pitch||0],"distance-from-center":[Gt,[],o=>o.distanceFromCenter()],"measure-light":[Gt,[tr],(o,[e])=>o.measureLight(e.evaluate(o))],"heatmap-density":[Gt,[],o=>o.globals.heatmapDensity||0],"line-progress":[Gt,[],o=>o.globals.lineProgress||0],"raster-value":[Gt,[],o=>o.globals.rasterValue||0],"raster-particle-speed":[Gt,[],o=>o.globals.rasterParticleSpeed||0],"sky-radial-progress":[Gt,[],o=>o.globals.skyRadialProgress||0],accumulated:[ir,[],o=>o.globals.accumulated===void 0?null:o.globals.accumulated],"+":[Gt,Ea(Gt),(o,e)=>{let i=0;for(const l of e)i+=l.evaluate(o);return i}],"*":[Gt,Ea(Gt),(o,e)=>{let i=1;for(const l of e)i*=l.evaluate(o);return i}],"-":{type:Gt,overloads:[[[Gt,Gt],(o,[e,i])=>e.evaluate(o)-i.evaluate(o)],[[Gt],(o,[e])=>-e.evaluate(o)]]},"/":[Gt,[Gt,Gt],(o,[e,i])=>e.evaluate(o)/i.evaluate(o)],"%":[Gt,[Gt,Gt],(o,[e,i])=>e.evaluate(o)%i.evaluate(o)],ln2:[Gt,[],()=>Math.LN2],pi:[Gt,[],()=>Math.PI],e:[Gt,[],()=>Math.E],"^":[Gt,[Gt,Gt],(o,[e,i])=>Math.pow(e.evaluate(o),i.evaluate(o))],sqrt:[Gt,[Gt],(o,[e])=>Math.sqrt(e.evaluate(o))],log10:[Gt,[Gt],(o,[e])=>Math.log(e.evaluate(o))/Math.LN10],ln:[Gt,[Gt],(o,[e])=>Math.log(e.evaluate(o))],log2:[Gt,[Gt],(o,[e])=>Math.log2(e.evaluate(o))],sin:[Gt,[Gt],(o,[e])=>Math.sin(e.evaluate(o))],cos:[Gt,[Gt],(o,[e])=>Math.cos(e.evaluate(o))],tan:[Gt,[Gt],(o,[e])=>Math.tan(e.evaluate(o))],asin:[Gt,[Gt],(o,[e])=>Math.asin(e.evaluate(o))],acos:[Gt,[Gt],(o,[e])=>Math.acos(e.evaluate(o))],atan:[Gt,[Gt],(o,[e])=>Math.atan(e.evaluate(o))],min:[Gt,Ea(Gt),(o,e)=>Math.min(...e.map(i=>i.evaluate(o)))],max:[Gt,Ea(Gt),(o,e)=>Math.max(...e.map(i=>i.evaluate(o)))],abs:[Gt,[Gt],(o,[e])=>Math.abs(e.evaluate(o))],round:[Gt,[Gt],(o,[e])=>{const i=e.evaluate(o);return i<0?-Math.round(-i):Math.round(i)}],floor:[Gt,[Gt],(o,[e])=>Math.floor(e.evaluate(o))],ceil:[Gt,[Gt],(o,[e])=>Math.ceil(e.evaluate(o))],"filter-==":[rr,[tr,ir],(o,[e,i])=>o.properties()[e.value]===i.value],"filter-id-==":[rr,[ir],(o,[e])=>o.id()===e.value],"filter-type-==":[rr,[tr],(o,[e])=>o.geometryType()===e.value],"filter-<":[rr,[tr,ir],(o,[e,i])=>{const l=o.properties()[e.value],d=i.value;return typeof l==typeof d&&l<d}],"filter-id-<":[rr,[ir],(o,[e])=>{const i=o.id(),l=e.value;return typeof i==typeof l&&i<l}],"filter->":[rr,[tr,ir],(o,[e,i])=>{const l=o.properties()[e.value],d=i.value;return typeof l==typeof d&&l>d}],"filter-id->":[rr,[ir],(o,[e])=>{const i=o.id(),l=e.value;return typeof i==typeof l&&i>l}],"filter-<=":[rr,[tr,ir],(o,[e,i])=>{const l=o.properties()[e.value],d=i.value;return typeof l==typeof d&&l<=d}],"filter-id-<=":[rr,[ir],(o,[e])=>{const i=o.id(),l=e.value;return typeof i==typeof l&&i<=l}],"filter->=":[rr,[tr,ir],(o,[e,i])=>{const l=o.properties()[e.value],d=i.value;return typeof l==typeof d&&l>=d}],"filter-id->=":[rr,[ir],(o,[e])=>{const i=o.id(),l=e.value;return typeof i==typeof l&&i>=l}],"filter-has":[rr,[ir],(o,[e])=>e.value in o.properties()],"filter-has-id":[rr,[],o=>o.id()!==null&&o.id()!==void 0],"filter-type-in":[rr,[$i(tr)],(o,[e])=>e.value.includes(o.geometryType())],"filter-id-in":[rr,[$i(ir)],(o,[e])=>e.value.includes(o.id())],"filter-in-small":[rr,[tr,$i(ir)],(o,[e,i])=>i.value.includes(o.properties()[e.value])],"filter-in-large":[rr,[tr,$i(ir)],(o,[e,i])=>function(l,d,p,m){for(;p<=m;){const y=p+m>>1;if(d[y]===l)return!0;d[y]>l?m=y-1:p=y+1}return!1}(o.properties()[e.value],i.value,0,i.value.length-1)],all:{type:rr,overloads:[[[rr,rr],(o,[e,i])=>e.evaluate(o)&&i.evaluate(o)],[Ea(rr),(o,e)=>{for(const i of e)if(!i.evaluate(o))return!1;return!0}]]},any:{type:rr,overloads:[[[rr,rr],(o,[e,i])=>e.evaluate(o)||i.evaluate(o)],[Ea(rr),(o,e)=>{for(const i of e)if(i.evaluate(o))return!0;return!1}]]},"!":[rr,[rr],(o,[e])=>!e.evaluate(o)],"is-supported-script":[rr,[tr],(o,[e])=>{const i=o.globals&&o.globals.isSupportedScript;return!i||i(e.evaluate(o))}],upcase:[tr,[tr],(o,[e])=>e.evaluate(o).toUpperCase()],downcase:[tr,[tr],(o,[e])=>e.evaluate(o).toLowerCase()],concat:[tr,Ea(ir),(o,e)=>e.map(i=>Xs(i.evaluate(o))).join("")],"resolved-locale":[tr,[Iu],(o,[e])=>e.evaluate(o).resolvedLocale()],random:[Gt,[Gt,Gt,ir],(o,e)=>{const[i,l,d]=e.map(m=>m.evaluate(o));if(i>l||i===l)return i;let p;if(typeof d=="string")p=function(m){let y=0;if(m.length===0)return y;for(let b=0;b<m.length;b++)y=(y<<5)-y+m.charCodeAt(b),y&=y;return y}(d);else{if(typeof d!="number")throw new wi(`Invalid seed input: ${d}`);p=d}return i+Cm(p)()*(l-i)}]});class Rm{constructor(e,i,l,d,p){this.expression=e,this._warningHistory={},this._scope=l,this._options=d,this._iconImageUseTheme=p,this._evaluator=new $a(l,d,p),this._defaultValue=i?function(m){return m.type==="color"&&(Ny(m.default)||Array.isArray(m.default))?new qn(0,0,0,0):m.type==="color"?qn.parse(m.default)||null:m.default===void 0?null:m.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=zf(e),this.isIndoorDependent=Pm(e)}evaluateWithoutErrorHandling(e,i,l,d,p,m,y,b){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=l,this._evaluator.canonical=d||null,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=m,this._evaluator.featureTileCoord=y||null,this._evaluator.featureDistanceData=b||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,l,d,p,m,y,b,S){this._evaluator||(this._evaluator=new $a(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=l||null,this._evaluator.canonical=d||null,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=m||null,this._evaluator.featureTileCoord=y||null,this._evaluator.featureDistanceData=b||null,this._evaluator.iconImageUseTheme=S||null;try{const C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new wi(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){const I=C;return this._warningHistory[I.message]||(this._warningHistory[I.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${I.message}`)),this._defaultValue}}}function Nf(o){return Array.isArray(o)&&o.length>0&&typeof o[0]=="string"&&o[0]in El}function Ql(o,e,i,l,d){const p=new Wa(El,[],e?function(y){const b={color:as,string:tr,number:Gt,enum:tr,boolean:rr,formatted:yl,resolvedImage:Ad};return y.type==="array"?$i(b[y.value]||ir,y.length):b[y.type]}(e):void 0,void 0,void 0,i,l,d),m=p.parse(o,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return m?Eb(new Rm(m,e,i,l,d)):Yl(p.errors)}class zd{constructor(e,i,l,d){this.kind=e,this._styleExpression=i,this.isLightConstant=l,this.isLineProgressConstant=d,this.isStateDependent=e!=="constant"&&!Dd(i.expression),this.configDependencies=zf(i.expression),this.isIndoorDependent=Pm(i.expression)}evaluateWithoutErrorHandling(e,i,l,d,p,m){return this._styleExpression.evaluateWithoutErrorHandling(e,i,l,d,p,m)}evaluate(e,i,l,d,p,m,y){return this._styleExpression.evaluate(e,i,l,d,p,m,void 0,void 0,y)}}class Bd{constructor(e,i,l,d,p,m){this.kind=e,this.zoomStops=l,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Dd(i.expression),this.isIndoorDependent=Pm(i.expression),this.isLightConstant=p,this.isLineProgressConstant=m,this.configDependencies=zf(i.expression),this.interpolationType=d}evaluateWithoutErrorHandling(e,i,l,d,p,m){return this._styleExpression.evaluateWithoutErrorHandling(e,i,l,d,p,m)}evaluate(e,i,l,d,p,m){return this._styleExpression.evaluate(e,i,l,d,p,m)}interpolationFactor(e,i,l){return this.interpolationType?Ks.interpolationFactor(this.interpolationType,e,i,l):0}}function jy(o,e,i,l,d){if((o=Ql(o,e,i,l,d)).result==="error")return o;const p=o.value.expression,m=wn(p);if(!m&&!Ys(e))return Yl([new lo("","data expressions not supported")]);const y=Tl(p,["zoom","pitch","distance-from-center"]);if(!y&&!zy(e))return Yl([new lo("","zoom expressions not supported")]);const b=Tl(p,["measure-light"]);if(!b&&!kb(e))return Yl([new lo("","measure-light expression not supported")]);const S=Tl(p,["line-progress"]);if(!S&&!function(M){return Fy(M.expression,"line-progress")}(e))return Yl([new lo("","line-progress expression not supported")]);const C=e.expression&&e.expression.relaxZoomRestriction,I=Om(p);return I||y||C?I instanceof lo?Yl([I]):I instanceof Ks&&!By(e)?Yl([new lo("",'"interpolate" expressions cannot be used with this property')]):Eb(I?new Bd(m&&S?"camera":"composite",o.value,I.labels,I instanceof Ks?I.interpolation:void 0,b,S):new zd(m&&S?"constant":"source",o.value,b,S)):Yl([new lo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Lm{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,Ab(this._parameters,this._specification))}static deserialize(e){return new Lm(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Om(o){let e=null;if(o instanceof Rf)e=Om(o.result);else if(o instanceof Df){for(const i of o.args)if(e=Om(i),e)break}else(o instanceof Af||o instanceof Ks)&&o.input instanceof bs&&o.input.name==="zoom"&&(e=o);return e instanceof lo||o.eachChild(i=>{const l=Om(i);l instanceof lo?e=l:e&&l&&e!==l&&(e=new lo("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}class Vf{constructor(e,i,l){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,e instanceof ArrayBuffer){const d=new Int32Array(e);this.width=d[0],this.height=d[1],this.xCellCount=d[2],this.yCellCount=d[3],this.boxUid=d[4],this.circleUid=d[5];const p=this.xCellCount*this.yCellCount,m=[];for(let C=0;C<p;C++){const I=d[6+C],M=d[6+C+1];m.push(I===M?null:d.subarray(I,M))}const y=d[6+p],b=[];for(let C=0;C<p;C++){const I=d[y+C],M=d[y+C+1];b.push(I===M?null:d.subarray(I,M))}let S=d[y+p];this.boxCells=m,this.circleCells=b,this.boxKeys=d.subarray(S,S+this.boxUid),S+=this.boxUid,this.circleKeys=d.subarray(S,S+this.circleUid),S+=this.circleUid,this.bboxes=d.subarray(S,S+4*this.boxUid),S+=4*this.boxUid,this.circles=d.subarray(S,S+3*this.circleUid)}else{this.width=e,this.height=i,this.xCellCount=Math.ceil(e/l),this.yCellCount=Math.ceil(i/l);const d=this.xCellCount*this.yCellCount,p=[],m=[];for(let y=0;y<d;y++)p.push([]),m.push([]);this.boxCells=p,this.circleCells=m,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}clear(){for(const e of this.boxCells)e&&(e.length=0);for(const e of this.circleCells)e&&(e.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(e,i,l,d,p){const m=this.boxUid++,y=this._xCell(i),b=this._yCell(l),S=this._xCell(d),C=this._yCell(p);for(let I=y;I<=S;I++)for(let M=b;M<=C;M++)this.boxCells[this.xCellCount*M+I].push(m);this.boxKeys.push(e),this.bboxes.push(i,l,d,p)}insertCircle(e,i,l,d){const p=this.circleUid++,m=this._xCell(i-d),y=this._yCell(l-d),b=this._xCell(i+d),S=this._yCell(l+d);for(let C=m;C<=b;C++)for(let I=y;I<=S;I++)this.circleCells[this.xCellCount*I+C].push(p);this.circleKeys.push(e),this.circles.push(i,l,d)}query(e,i,l,d,p){const m=[];if(l<0||e>this.width||d<0||i>this.height)return m;const y=this._nextGen(),{boxCells:b,circleCells:S,boxKeys:C,circleKeys:I,bboxes:M,circles:R,boxSeen:O,circleSeen:N,xCellCount:V}=this,G=this._xCell(e),K=this._yCell(i),q=this._xCell(l),ee=this._yCell(d);for(let te=G;te<=q;te++)for(let le=K;le<=ee;le++){const xe=V*le+te,de=b[xe];if(de)for(let Se=0;Se<de.length;Se++){const we=de[Se];if(O[we]===y)continue;O[we]=y;const Fe=4*we,Ve=M[Fe],qe=M[Fe+1],Ke=M[Fe+2],je=M[Fe+3];e<=Ke&&i<=je&&l>=Ve&&d>=qe&&(!p||p(C[we]))&&m.push({key:C[we],x1:Ve,y1:qe,x2:Ke,y2:je})}const ve=S[xe];if(ve)for(let Se=0;Se<ve.length;Se++){const we=ve[Se];if(N[we]===y)continue;N[we]=y;const Fe=3*we,Ve=R[Fe],qe=R[Fe+1],Ke=R[Fe+2];!this._circleAndRectCollide(Ve,qe,Ke,e,i,l,d)||p&&!p(I[we])||m.push({key:I[we],x1:Ve-Ke,y1:qe-Ke,x2:Ve+Ke,y2:qe+Ke})}}return m}queryKeys(e,i,l,d,p){const m=[];if(l<0||e>this.width||d<0||i>this.height)return m;const y=this._nextGen(),{boxCells:b,boxKeys:S,bboxes:C,boxSeen:I,xCellCount:M,xScale:R,yScale:O}=this,N=this._xCell(e),V=this._yCell(i),G=this._xCell(l),K=this._yCell(d);for(let q=N;q<=G;q++)for(let ee=V;ee<=K;ee++){if(p&&!p(q/R,ee/O,(q+1)/R,(ee+1)/O))continue;const te=b[M*ee+q];if(te)for(let le=0;le<te.length;le++){const xe=te[le];if(I[xe]===y)continue;I[xe]=y;const de=4*xe,ve=C[de],Se=C[de+1],we=C[de+2],Fe=C[de+3];(p?p(ve,Se,we,Fe):e<=we&&i<=Fe&&l>=ve&&d>=Se)&&m.push(S[xe])}}return m}hitTest(e,i,l,d,p){if(l<0||e>this.width||d<0||i>this.height)return!1;const m=this._nextGen(),{boxCells:y,circleCells:b,boxKeys:S,circleKeys:C,bboxes:I,circles:M,boxSeen:R,circleSeen:O,xCellCount:N}=this,V=this._xCell(e),G=this._yCell(i),K=this._xCell(l),q=this._yCell(d);for(let ee=V;ee<=K;ee++)for(let te=G;te<=q;te++){const le=N*te+ee,xe=y[le];if(xe)for(let ve=0;ve<xe.length;ve++){const Se=xe[ve];if(R[Se]===m)continue;R[Se]=m;const we=4*Se;if(e<=I[we+2]&&i<=I[we+3]&&l>=I[we]&&d>=I[we+1]&&(!p||p(S[Se])))return!0}const de=b[le];if(de)for(let ve=0;ve<de.length;ve++){const Se=de[ve];if(O[Se]===m)continue;O[Se]=m;const we=3*Se;if(this._circleAndRectCollide(M[we],M[we+1],M[we+2],e,i,l,d)&&(!p||p(C[Se])))return!0}}return!1}hitTestCircle(e,i,l,d){const p=e-l,m=i-l,y=e+l,b=i+l;if(y<0||p>this.width||b<0||m>this.height)return!1;const S=this._nextGen(),{boxCells:C,circleCells:I,boxKeys:M,circleKeys:R,bboxes:O,circles:N,boxSeen:V,circleSeen:G,xCellCount:K}=this,q=this._xCell(p),ee=this._yCell(m),te=this._xCell(y),le=this._yCell(b);for(let xe=q;xe<=te;xe++)for(let de=ee;de<=le;de++){const ve=K*de+xe,Se=C[ve];if(Se)for(let Fe=0;Fe<Se.length;Fe++){const Ve=Se[Fe];if(V[Ve]===S)continue;V[Ve]=S;const qe=4*Ve;if(this._circleAndRectCollide(e,i,l,O[qe],O[qe+1],O[qe+2],O[qe+3])&&(!d||d(M[Ve])))return!0}const we=I[ve];if(we)for(let Fe=0;Fe<we.length;Fe++){const Ve=we[Fe];if(G[Ve]===S)continue;G[Ve]=S;const qe=3*Ve;if(this._circlesCollide(N[qe],N[qe+1],N[qe+2],e,i,l)&&(!d||d(R[Ve])))return!0}}return!1}static serialize(e,i){const l=e.toArrayBuffer();return i&&i.add(l),{buffer:l}}static deserialize(e){return new Vf(e.buffer)}toArrayBuffer(){const e=this.xCellCount*this.yCellCount;let i=0,l=0;for(let y=0;y<e;y++)i+=this.boxCells[y].length,l+=this.circleCells[y].length;const d=new Int32Array(6+(e+1)+i+(e+1)+l+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);d[0]=this.width,d[1]=this.height,d[2]=this.xCellCount,d[3]=this.yCellCount,d[4]=this.boxUid,d[5]=this.circleUid;let p=6+(e+1);for(let y=0;y<e;y++){d[6+y]=p;const b=this.boxCells[y];d.set(b,p),p+=b.length}d[6+e]=p;const m=p;p+=e+1;for(let y=0;y<e;y++){d[m+y]=p;const b=this.circleCells[y];d.set(b,p),p+=b.length}return d[m+e]=p,d.set(this.boxKeys,p),p+=this.boxUid,d.set(this.circleKeys,p),p+=this.circleUid,d.set(this.bboxes,p),p+=4*this.boxUid,d.set(this.circles,p),d.buffer}_xCell(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_yCell(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,this.generation===0&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}_circlesCollide(e,i,l,d,p,m){const y=d-e,b=p-i,S=l+m;return S*S>y*y+b*b}_circleAndRectCollide(e,i,l,d,p,m,y){const b=(m-d)/2,S=Math.abs(e-(d+b));if(S>b+l)return!1;const C=(y-p)/2,I=Math.abs(i-(p+C));if(I>C+l)return!1;if(S<=b||I<=C)return!0;const M=S-b,R=I-C;return M*M+R*R<=l*l}}const jf={};function Mt(o,e,i={}){Object.defineProperty(o,"_classRegistryKey",{value:e,writable:!1}),jf[e]={klass:o,omit:i.omit||[]}}Mt(Object,"Object"),Mt(Vf,"Grid"),delete et.prototype.constructor,Mt(qn,"Color"),Mt(Error,"Error"),Mt(Ao,"Formatted"),Mt(_f,"FormattedSection"),Mt(sm,"AJAXError"),Mt(ls,"ResolvedImage"),Mt(Lm,"StylePropertyFunction"),Mt(Rm,"StyleExpression",{omit:["_evaluator"]}),Mt(Ut,"ImageId"),Mt(xa,"ImageVariant"),Mt(Bd,"ZoomDependentExpression"),Mt(zd,"ZoomConstantExpression"),Mt(bs,"CompoundExpression",{omit:["_evaluate"]});for(const o in El)jf[El[o]._classRegistryKey]||Mt(El[o],`Expression${o}`);function Nd(o){return o&&(o instanceof ArrayBuffer||o.constructor&&o.constructor.name==="ArrayBuffer")}function Jl(o,e){if(o===null)return null;const i=typeof o;if(i!=="object")return i==="bigint"?{$name:"BigInt",value:o.toString()}:o;if(Array.isArray(o)){const m=o.length,y=[];y.length=m;for(let b=0;b<m;b++)y[b]=Jl(o[b],e);return y}if(ArrayBuffer.isView(o))return e&&e.add(o.buffer),o;if(Nd(o)||o instanceof ImageBitmap)return e&&e.add(o),o;if(o instanceof ImageData)return e&&e.add(o.data.buffer),o;if(o instanceof Map){const m={$name:"Map",entries:[]};for(const[y,b]of o.entries())m.entries.push(Jl(y),Jl(b,e));return m}if(o instanceof Set){const m={$name:"Set"};let y=0;for(const b of o.values())m[++y]=Jl(b);return m}if(o instanceof Date||o instanceof RegExp||o instanceof Boolean||o instanceof Number||o instanceof String)return o;const l=o.constructor||Object,d=l._classRegistryKey;if(!d)throw new Error(`Can't serialize object of unregistered class "${l.name}".`);const p=l.serialize?l.serialize(o,e):{};if(!l.serialize){const m=jf[d].omit,y=o;for(const b in y)Object.hasOwn(y,b)&&(m.includes(b)||(p[b]=Jl(y[b],e)));o instanceof Error&&(p.message=o.message)}if(p.$name)throw new Error("$name property is reserved for worker serialization logic.");return d!=="Object"&&(p.$name=d),p}function Nc(o){if(o===null||typeof o!="object")return o;if(Array.isArray(o)){for(let d=0;d<o.length;d++)o[d]=Nc(o[d]);return o}if(ArrayBuffer.isView(o)||Nd(o)||o instanceof ImageBitmap||o instanceof ImageData||o instanceof Date||o instanceof RegExp||o instanceof Boolean||o instanceof Number||o instanceof String)return o;const e=o.$name||"Object";if(e==="Map"){const d=o.entries||[],p=new Map;for(let m=0;m<d.length;m+=2)p.set(Nc(d[m]),Nc(d[m+1]));return p}if(e==="Set"){const d=new Set;for(const p in o)p!=="$name"&&d.add(Nc(o[p]));return d}if(e==="BigInt")return BigInt(o.value);const{klass:i}=jf[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(o);const l=Object.create(i.prototype);for(const d in o)d!=="$name"&&(l[d]=Nc(o[d]));return l}const Uy=o=>o>=1536&&o<=1791,Xn=o=>o>=1872&&o<=1919,Gy=o=>o>=2208&&o<=2303,$y=o=>o>=11904&&o<=12031,Ib=o=>o>=12032&&o<=12255,Mb=o=>o>=12272&&o<=12287,Fu=o=>o>=12288&&o<=12351,Vd=o=>o>=12352&&o<=12447,zu=o=>o>=12448&&o<=12543,Fm=o=>o>=12544&&o<=12591,Pb=o=>o>=12704&&o<=12735,zm=o=>o>=12736&&o<=12783,Hy=o=>o>=12784&&o<=12799,jd=o=>o>=12800&&o<=13055,Uf=o=>o>=13056&&o<=13311,Wy=o=>o>=13312&&o<=19903,qy=o=>o>=19968&&o<=40959,Db=o=>o>=40960&&o<=42127,Zy=o=>o>=42128&&o<=42191,Bm=o=>o>=44032&&o<=55215,Gf=o=>o>=63744&&o<=64255,Ud=o=>o>=64336&&o<=65023,Rb=o=>o>=65040&&o<=65055,Gd=o=>o>=65072&&o<=65103,Lb=o=>o>=65104&&o<=65135,Xy=o=>o>=65136&&o<=65279,Ky=o=>o>=65280&&o<=65519;function Yy(o){for(const e of o)if(Nm(e.charCodeAt(0)))return!0;return!1}function T2(o){for(const e of o)if(!E2(e.charCodeAt(0)))return!1;return!0}function E2(o){return!(Uy(o)||Xn(o)||Gy(o)||Ud(o)||Xy(o))}function k2(o){return!(o<11904||!(Pb(o)||Fm(o)||Gd(o)||Gf(o)||Uf(o)||$y(o)||zm(o)||Fu(o)||Wy(o)||qy(o)||jd(o)||Ky(o)||Vd(o)||Mb(o)||Ib(o)||Hy(o)||zu(o)||Rb(o)||Zy(o)||Db(o)))}function Nm(o){return!(o!==746&&o!==747&&(o<4352||!(Pb(o)||Fm(o)||Gd(o)&&!(o>=65097&&o<=65103)||Gf(o)||Uf(o)||$y(o)||zm(o)||!(!Fu(o)||o>=12296&&o<=12305||o>=12308&&o<=12319||o===12336)||Wy(o)||qy(o)||jd(o)||(e=>e>=12592&&e<=12687)(o)||(e=>e>=43360&&e<=43391)(o)||(e=>e>=55216&&e<=55295)(o)||(e=>e>=4352&&e<=4607)(o)||Bm(o)||Vd(o)||Mb(o)||(e=>e>=12688&&e<=12703)(o)||Ib(o)||Hy(o)||zu(o)&&o!==12540||!(!Ky(o)||o===65288||o===65289||o===65293||o>=65306&&o<=65310||o===65339||o===65341||o===65343||o>=65371&&o<=65503||o===65507||o>=65512&&o<=65519)||!(!Lb(o)||o>=65112&&o<=65118||o>=65123&&o<=65126)||(e=>e>=5120&&e<=5759)(o)||(e=>e>=6320&&e<=6399)(o)||Rb(o)||(e=>e>=19904&&e<=19967)(o)||Db(o)||Zy(o))))}function $d(o){return o===12312||o===12313||o===12316||o===12540||o===12448}function Ob(o){return!(Nm(o)||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)||Fu(e)||zu(e)||(i=>i>=57344&&i<=63743)(e)||Gd(e)||Lb(e)||Ky(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(o))}function kl(o){return Uy(o)||Xn(o)||Gy(o)||Ud(o)||Xy(o)}function Qy(o){return o>=1424&&o<=2303||Ud(o)||Xy(o)}function A2(o,e){return!(!e&&Qy(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||(i=>i>=6016&&i<=6143)(o))}function C2(o){for(const e of o)if(Qy(e.charCodeAt(0)))return!0;return!1}const ws={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let $f=null,us=ws.unavailable,Vc=null;const Fb=function(o){o&&(us=ws.error),$f&&$f(o)};function Jy(){ev.fire(new Xl("pluginStateChange",{pluginStatus:us,pluginURL:Vc}))}const ev=new Au,tv=function(){return us},zb=function(){if(us!==ws.deferred||!Vc)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");us=ws.loading,Jy(),Vc&&Mc({url:Vc},o=>{o?Fb(o):(us=ws.loaded,Jy())})},qa={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>us===ws.loaded||qa.applyArabicShaping!=null,isLoading:()=>us===ws.loading,setState(o){us=o.pluginStatus,Vc=o.pluginURL},isParsing:()=>us===ws.parsing,isParsed:()=>us===ws.parsed,getPluginURL:()=>Vc},I2=function(){qa.isLoading()||qa.isLoaded()||tv()!=="deferred"||zb()};class Yn{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,l){for(const d of i)if(!A2(d.charCodeAt(0),l))return!1;return!0}(e,qa.isLoaded())}}class Vm{constructor(e,i,l,d,p){this.property=e,this.value=i,this.expression=function(m,y,b,S,C){if(Ny(m))return new Lm(m,y);if(Nf(m)||Array.isArray(m)&&m.length>0){const I=jy(m,y,b,S,C);if(I.result==="error")throw new Error(I.value.map(M=>`${M.key}: ${M.message}`).join(", "));return I.value}{let I=m;return typeof m=="string"&&y.type==="color"&&(I=qn.parse(m)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>I}}}(i===void 0?e.specification.default:i,e.specification,l,d,p)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,l,d){return this.property.possiblyEvaluate(this,e,i,l,d)}}class nv{constructor(e,i,l,d){this.property=e,this.value=new Vm(e,void 0,i,l,d)}transitioned(e,i){return new Bb(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new Bb(this.property,this.value,null,{},0)}}class rv{constructor(e,i,l,d){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=l,this._iconImageUseTheme=d,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Dr(this._values[e].value.value)}setValue(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new nv(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Vm(this._values[e].property,i===null?void 0:Dr(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 l=this._properties.properties;if(e)for(const d in e){const p=e[d];if(d.endsWith("-transition")){const m=d.slice(0,-11);l[m]&&this.setTransition(m,p)}else Object.hasOwn(l,d)&&this.setValue(d,p)}}getTransition(e){return Dr(this._values[e].transition)}setTransition(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new nv(this._values[e].property)),this._values[e].transition=Dr(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const l=this.getValue(i);l!==void 0&&(e[i]=l);const d=this.getTransition(i);d!==void 0&&(e[`${i}-transition`]=d)}return e}transitioned(e,i){const l=new jc(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].transitioned(e,i._values[d]);return l}untransitioned(){const e=new jc(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Bb{constructor(e,i,l,d,p){const m=d.delay||0,y=d.duration||0;p=p||0,this.property=e,this.value=i,this.begin=p+m,this.end=this.begin+y,e.specification.transition&&(d.delay||d.duration)&&(this.prior=l)}possiblyEvaluate(e,i,l){const d=e.now||0,p=this.value.possiblyEvaluate(e,i,l),m=this.prior;if(m){if(d>this.end)return this.prior=null,p;if(this.value.isDataDriven())return this.prior=null,p;if(d<this.begin)return m.possiblyEvaluate(e,i,l);{const y=(d-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(e,i,l),p,Ue(y))}}return p}}class jc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,l){const d=new Gc(this._properties);for(const p of Object.keys(this._values))d._values[p]=this._values[p].possiblyEvaluate(e,i,l);return d}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Hd{constructor(e,i,l,d){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=l,this._iconImageUseTheme=d,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Dr(this._values[e].value)}setValue(e,i){this._values[e]=new Vm(this._values[e].property,i===null?void 0:Dr(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 l=this.getValue(i);l!==void 0&&(e[i]=l)}return e}possiblyEvaluate(e,i,l,d){const p=new Gc(this._properties);for(const m of Object.keys(this._values))p._values[m]=this._values[m].possiblyEvaluate(e,i,l,d);return p}isIndoorDependent(){return this._isIndoorDependent}}class Uc{constructor(e,i,l,d){this.property=e,this.value=i,this.parameters=l,this.iconImageUseTheme=d}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,l,d,p){return this.property.evaluate(this.value,this.parameters,e,i,l,d,this.iconImageUseTheme,p)}}class Gc{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class _t{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,l){const d=Ed[this.specification.type];return d?d(e,i,l):e}}class xt{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,l,d,p){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Uc(this,{kind:"constant",value:e.expression.evaluate(i,null,{},l,d,void 0,p)},i):new Uc(this,e.expression,i,p)}interpolate(e,i,l){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Uc(this,{kind:"constant",value:void 0},e.parameters);const d=Ed[this.specification.type];return d?new Uc(this,{kind:"constant",value:d(e.value.value,i.value.value,l)},e.parameters):e}evaluate(e,i,l,d,p,m,y,b){return e.kind==="constant"?e.value:e.evaluate(i,l,d,p,m,b,y)}}class Bu{constructor(e){this.specification=e}possiblyEvaluate(e,i,l,d){return!!e.expression.evaluate(i,null,{},l,d)}interpolate(){return!1}}class fr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Yn(0,{});for(const l in e){const d=e[l],p=d.specification;p&&p.overridable&&this.overridableProperties.push(l);const m=this.defaultPropertyValues[l]=new Vm(d,void 0),y=this.defaultTransitionablePropertyValues[l]=new nv(d);this.defaultTransitioningPropertyValues[l]=y.untransitioned(),this.defaultPossiblyEvaluatedValues[l]=m.possiblyEvaluate(i)}}}Mt(xt,"DataDrivenProperty"),Mt(_t,"DataConstantProperty"),Mt(Bu,"ColorRampProperty");var Le=JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"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},"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"},"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":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"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,"minimum":0,"maximum":512},"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","default":[0,0,0],"length":3,"value":"number"}},"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","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"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":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"id":{"type":"string"},"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"}},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"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","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"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","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"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_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1},"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"colorTheme":{"data":{"type":"string","expression":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"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":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"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":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","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"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"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":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}');function Nb(o){return o instanceof Number||o instanceof String||o instanceof Boolean?o.valueOf():o}function jm(o){if(Array.isArray(o))return o.map(jm);if(o instanceof Object&&!(o instanceof Number||o instanceof String||o instanceof Boolean)){const e={},i=o;for(const l in i)e[l]=jm(i[l]);return e}return Nb(o)}function Um(o){if(o===!0||o===!1)return!0;if(!Array.isArray(o)||o.length===0)return!1;switch(o[0]){case"has":return o.length>=2&&o[1]!=="$id"&&o[1]!=="$type";case"in":return o.length>=3&&(typeof o[1]!="string"||Array.isArray(o[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return o.length!==3||Array.isArray(o[1])||Array.isArray(o[2]);case"any":case"all":for(const e of o.slice(1))if(!Um(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Gm(o,e="",i=null,l="fill"){if(o==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Um(o)||(o=$m(o));const d=o;let p=!0;try{p=function(C){if(!Wd(C))return C;let I=jm(C);return Vb(I),I=$r(I),I}(d)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
|
||
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
|
||
and paste the contents of this message in the report.
|
||
Thank you!
|
||
Filter Expression:
|
||
${JSON.stringify(d,null,2)}
|
||
`)}let m=null,y=null;if(l!=="background"&&l!=="sky"&&l!=="slot"){y=Le[`filter_${l}`];const C=Ql(p,y,e,i);if(C.result==="error")throw new Error(C.value.map(I=>`${I.key}: ${I.message}`).join(", "));m=(I,M,R)=>C.value.evaluate(I,M,{},R)}let b=null,S=null;if(p!==d){const C=Ql(d,y,e,i);if(C.result==="error")throw new Error(C.value.map(I=>`${I.key}: ${I.message}`).join(", "));b=(I,M,R,O,N)=>C.value.evaluate(I,M,{},R,void 0,void 0,O,N),S=!wn(C.value.expression)}return{filter:m,dynamicFilter:b||void 0,needGeometry:jb(p),needFeature:!!S}}function $r(o){if(!Array.isArray(o))return o;const e=function(i){if(M2.has(i[0])){for(let l=1;l<i.length;l++)if(Wd(i[l]))return!0}return i}(o);return e===!0?e:e.map(i=>$r(i))}function Vb(o){let e=!1;const i=[];if(o[0]==="case"){for(let l=1;l<o.length-1;l+=2)e=e||Wd(o[l]),i.push(o[l+1]);i.push(o.at(-1))}else if(o[0]==="match"){e=e||Wd(o[1]);for(let l=2;l<o.length-1;l+=2)i.push(o[l+1]);i.push(o.at(-1))}else if(o[0]==="step"){e=e||Wd(o[1]);for(let l=1;l<o.length-1;l+=2)i.push(o[l+1])}e&&(o.length=0,o.push("any",...i));for(let l=1;l<o.length;l++)Vb(o[l])}function Wd(o){if(!Array.isArray(o))return!1;if((e=o[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<o.length;i++)if(Wd(o[i]))return!0;return!1}const M2=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function P2(o,e){return o<e?-1:o>e?1:0}function jb(o){if(!Array.isArray(o))return!1;if(o[0]==="within"||o[0]==="distance")return!0;for(let e=1;e<o.length;e++)if(jb(o[e]))return!0;return!1}function $m(o){if(!o)return!0;const e=o[0];return o.length<=1?e!=="any":e==="=="?iv(o[1],o[2],"=="):e==="!="?Hm(iv(o[1],o[2],"==")):e==="<"||e===">"||e==="<="||e===">="?iv(o[1],o[2],e):e==="any"?(i=o.slice(1),["any"].concat(i.map($m))):e==="all"?["all"].concat(o.slice(1).map($m)):e==="none"?["all"].concat(o.slice(1).map($m).map(Hm)):e==="in"?Ub(o[1],o.slice(2)):e==="!in"?Hm(Ub(o[1],o.slice(2))):e==="has"?Gb(o[1]):e!=="!has"||Hm(Gb(o[1]));var i}function iv(o,e,i){switch(o){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,o,e]}}function Ub(o,e){if(e.length===0)return!1;switch(o){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",o,["literal",e.sort(P2)]]:["filter-in-small",o,["literal",e]]}}function Gb(o){switch(o){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",o]}}function Hm(o){return["!",o]}const Hf="";function ov(o,e){return e?`${o}${Hf}${e}`:o}function $b(o){const e=o.indexOf(Hf);return e>=0?o.slice(e+1):""}let Hb;const Wb=()=>Hb||(Hb=new fr({"icon-size":new xt(Le.layout_symbol["icon-size"]),"icon-image":new xt(Le.layout_symbol["icon-image"]),"icon-rotate":new xt(Le.layout_symbol["icon-rotate"]),"icon-offset":new xt(Le.layout_symbol["icon-offset"]),"text-size":new xt(Le.layout_symbol["text-size"]),"text-rotate":new xt(Le.layout_symbol["text-rotate"]),"text-offset":new xt(Le.layout_symbol["text-offset"])}));let qb;const Zb=()=>qb||(qb=new fr({"icon-opacity":new xt(Le.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new xt(Le.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new xt(Le.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new xt(Le.paint_symbol["text-emissive-strength"]),"icon-color":new xt(Le.paint_symbol["icon-color"]),"icon-halo-color":new xt(Le.paint_symbol["icon-halo-color"]),"icon-halo-width":new xt(Le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new xt(Le.paint_symbol["icon-halo-blur"]),"icon-translate":new xt(Le.paint_symbol["icon-translate"]),"text-opacity":new xt(Le.paint_symbol["text-opacity"]),"text-occlusion-opacity":new xt(Le.paint_symbol["text-occlusion-opacity"]),"text-color":new xt(Le.paint_symbol["text-color"],{runtimeType:as,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new xt(Le.paint_symbol["text-halo-color"]),"text-halo-width":new xt(Le.paint_symbol["text-halo-width"]),"text-halo-blur":new xt(Le.paint_symbol["text-halo-blur"]),"text-translate":new xt(Le.paint_symbol["text-translate"]),"symbol-z-offset":new xt(Le.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}));class D2{constructor(e,i,l,d,p,m){this._conditionSpec=e,this._propertiesSpec=l;const y=Ql(e,Le.appearance.condition);if(y.result==="success"&&(this.condition=y.value),this.name=i,l){this.layoutProperties=new Gc(Wb()),this.unevaluatedLayout=new Hd(Wb(),d,p,m),this.paintProperties=new Gc(Zb()),this.unevaluatedPaint=new Hd(Zb(),d,p,"");for(const b in l)b in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(b,l[b]):b in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(b,l[b])}}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}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,i,l){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,l)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,i,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const i=this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},l=this.unevaluatedPaint?this.unevaluatedPaint.serialize():{},d=Object.assign({},i,l);return Object.keys(d).length>0&&(e.properties=d),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),i=this.hasLayoutProperty("icon-size"),l=this.hasLayoutProperty("icon-offset"),d=this.hasLayoutProperty("icon-rotate");return e||i||l||d}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),i=this.hasLayoutProperty("text-offset"),l=this.hasLayoutProperty("text-rotate");return e||i||l}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&this.unevaluatedLayout._values[e].value!==void 0}hasPaintProperty(e){return this.unevaluatedPaint&&this.unevaluatedPaint._values[e].value!==void 0}}const Xb="-transition",R2=new Set(["fill","line","background","hillshade","raster"]);class ds extends Au{constructor(e,i,l,d,p,m){if(super(),this.id=e.id,this.fqid=ov(this.id,l),this.type=e.type,this.scope=l,this.lut=d,this.options=p,this.iconImageUseTheme=m,this.appearances=new Array,this.appearancesVersion=0,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 y=Ql(this.filter,Le[`filter_${e.type}`]);y.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...y.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||y.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new Hd(i.layout,this.scope,p,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 rv(i.paint,this.scope,p);for(const y in e.paint)this.setPaintProperty(y,e.paint[y]);for(const y in e.layout)this.setLayoutProperty(y,e.layout[y]);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 Gc(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&R2.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 l=this._unevaluatedLayout;l._properties.properties[e]&&(l.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...l.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||l.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new D2(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Xb)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const l=this._transitionablePaint,d=l._properties.properties;if(e.endsWith(Xb)){const I=e.slice(0,-11);return d[I]&&l.setTransition(I,i||void 0),!1}if(!d[e])return!1;const p=l._values[e],m=p.value.isDataDriven(),y=p.value;l.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...l.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||l.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const b=l._values[e].value,S=b.isDataDriven(),C=e.endsWith("pattern")||e==="line-dasharray";return S||m||C||this._handleOverridablePaintPropertyUpdate(e,y,b)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,l){return null}_handleOverridablePaintPropertyUpdate(e,i,l){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())),xr(e,(i,l)=>!(i===void 0||l==="layout"&&!Object.keys(i).length||l==="paint"&&!Object.keys(i).length))}is3D(e){return!1}hasElevation(){return!1}mayUse(e){return!1}prepare(){return Promise.resolve()}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 Uc&&Ys(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Dd(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Gm(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}dynamicFilterNeedsGeometry(){return this._featureFilter.needGeometry}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,l){return{}}queryRadius(e){}queryIntersectsFeature(e,i,l,d,p,m,y,b,S,C){}}function Wm(o,e,i){if(!o._unevaluatedLayout)return!1;const l=o._unevaluatedLayout.getValue(e);return l!==void 0&&(typeof l!="string"||i(l))}function Nu(o,e,i=2){const l=e&&e.length,d=l?e[0]*i:o.length;let p=Kb(o,0,d,i,!0);const m=[];if(!p||p.next===p.prev)return m;let y,b,S;if(l&&(p=function(C,I,M,R){const O=[];for(let N=0,V=I.length;N<V;N++){const G=Kb(C,I[N]*R,N<V-1?I[N+1]*R:C.length,R,!1);G===G.next&&(G.steiner=!0),O.push(N2(G))}O.sort(B2);for(let N=0;N<O.length;N++)M=sv(O[N],M);return M}(o,e,p,i)),o.length>80*i){y=o[0],b=o[1];let C=y,I=b;for(let M=i;M<d;M+=i){const R=o[M],O=o[M+1];R<y&&(y=R),O<b&&(b=O),R>C&&(C=R),O>I&&(I=O)}S=Math.max(C-y,I-b),S=S!==0?32767/S:0}return Wf(p,m,i,y,b,S,0),m}function Kb(o,e,i,l,d){let p;if(d===function(m,y,b,S){let C=0;for(let I=y,M=b-S;I<b;I+=S)C+=(m[M]-m[I])*(m[I+1]+m[M+1]),M=I;return C}(o,e,i,l)>0)for(let m=e;m<i;m+=l)p=lv(m/l|0,o[m],o[m+1],p);else for(let m=i-l;m>=e;m-=l)p=lv(m/l|0,o[m],o[m+1],p);return p&&Za(p,p.next)&&(Zd(p),p=p.next),p}function Vu(o,e){if(!o)return o;e||(e=o);let i,l=o;do if(i=!1,l.steiner||!Za(l,l.next)&&Oi(l.prev,l,l.next)!==0)l=l.next;else{if(Zd(l),l=e=l.prev,l===l.next)break;i=!0}while(i||l!==e);return e}function Wf(o,e,i,l,d,p,m){if(!o)return;!m&&p&&function(b,S,C,I){let M=b;do M.z===0&&(M.z=Zm(M.x,M.y,S,C,I)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==b);M.prevZ.nextZ=null,M.prevZ=null,function(R){let O,N=1;do{let V,G=R;R=null;let K=null;for(O=0;G;){O++;let q=G,ee=0;for(let le=0;le<N&&(ee++,q=q.nextZ,q);le++);let te=N;for(;ee>0||te>0&&q;)ee!==0&&(te===0||!q||G.z<=q.z)?(V=G,G=G.nextZ,ee--):(V=q,q=q.nextZ,te--),K?K.nextZ=V:R=V,V.prevZ=K,K=V;G=q}K.nextZ=null,N*=2}while(O>1)}(M)}(o,l,d,p);let y=o;for(;o.prev!==o.next;){const b=o.prev,S=o.next;if(p?O2(o,l,d,p):L2(o))e.push(b.i,o.i,S.i),Zd(o),o=S.next,y=S.next;else if((o=S)===y){m?m===1?Wf(o=F2(Vu(o),e),e,i,l,d,p,2):m===2&&z2(o,e,i,l,d,p):Wf(Vu(o),e,i,l,d,p,1);break}}}function L2(o){const e=o.prev,i=o,l=o.next;if(Oi(e,i,l)>=0)return!1;const d=e.x,p=i.x,m=l.x,y=e.y,b=i.y,S=l.y,C=Math.min(d,p,m),I=Math.min(y,b,S),M=Math.max(d,p,m),R=Math.max(y,b,S);let O=l.next;for(;O!==e;){if(O.x>=C&&O.x<=M&&O.y>=I&&O.y<=R&&qf(d,y,p,b,m,S,O.x,O.y)&&Oi(O.prev,O,O.next)>=0)return!1;O=O.next}return!0}function O2(o,e,i,l){const d=o.prev,p=o,m=o.next;if(Oi(d,p,m)>=0)return!1;const y=d.x,b=p.x,S=m.x,C=d.y,I=p.y,M=m.y,R=Math.min(y,b,S),O=Math.min(C,I,M),N=Math.max(y,b,S),V=Math.max(C,I,M),G=Zm(R,O,e,i,l),K=Zm(N,V,e,i,l);let q=o.prevZ,ee=o.nextZ;for(;q&&q.z>=G&&ee&&ee.z<=K;){if(q.x>=R&&q.x<=N&&q.y>=O&&q.y<=V&&q!==d&&q!==m&&qf(y,C,b,I,S,M,q.x,q.y)&&Oi(q.prev,q,q.next)>=0||(q=q.prevZ,ee.x>=R&&ee.x<=N&&ee.y>=O&&ee.y<=V&&ee!==d&&ee!==m&&qf(y,C,b,I,S,M,ee.x,ee.y)&&Oi(ee.prev,ee,ee.next)>=0))return!1;ee=ee.nextZ}for(;q&&q.z>=G;){if(q.x>=R&&q.x<=N&&q.y>=O&&q.y<=V&&q!==d&&q!==m&&qf(y,C,b,I,S,M,q.x,q.y)&&Oi(q.prev,q,q.next)>=0)return!1;q=q.prevZ}for(;ee&&ee.z<=K;){if(ee.x>=R&&ee.x<=N&&ee.y>=O&&ee.y<=V&&ee!==d&&ee!==m&&qf(y,C,b,I,S,M,ee.x,ee.y)&&Oi(ee.prev,ee,ee.next)>=0)return!1;ee=ee.nextZ}return!0}function F2(o,e){let i=o;do{const l=i.prev,d=i.next.next;!Za(l,d)&&av(l,i,i.next,d)&&Zf(l,d)&&Zf(d,l)&&(e.push(l.i,i.i,d.i),Zd(i),Zd(i.next),i=o=d),i=i.next}while(i!==o);return Vu(i)}function z2(o,e,i,l,d,p){let m=o;do{let y=m.next.next;for(;y!==m.prev;){if(m.i!==y.i&&Qb(m,y)){let b=Jb(m,y);return m=Vu(m,m.next),b=Vu(b,b.next),Wf(m,e,i,l,d,p,0),void Wf(b,e,i,l,d,p,0)}y=y.next}m=m.next}while(m!==o)}function B2(o,e){let i=o.x-e.x;return i===0&&(i=o.y-e.y,i===0)&&(i=(o.next.y-o.y)/(o.next.x-o.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function sv(o,e){const i=function(d,p){let m=p;const y=d.x,b=d.y;let S,C=-1/0;if(Za(d,m))return m;do{if(Za(d,m.next))return m.next;if(b<=m.y&&b>=m.next.y&&m.next.y!==m.y){const N=m.x+(b-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(N<=y&&N>C&&(C=N,S=m.x<m.next.x?m:m.next,N===y))return S}m=m.next}while(m!==p);if(!S)return null;const I=S,M=S.x,R=S.y;let O=1/0;m=S;do{if(y>=m.x&&m.x>=M&&y!==m.x&&Yb(b<R?y:C,b,M,R,b<R?C:y,b,m.x,m.y)){const N=Math.abs(b-m.y)/(y-m.x);Zf(m,d)&&(N<O||N===O&&(m.x>S.x||m.x===S.x&&qm(S,m)))&&(S=m,O=N)}m=m.next}while(m!==I);return S}(o,e);if(!i)return e;const l=Jb(i,o);return Vu(l,l.next),Vu(i,i.next)}function qm(o,e){return Oi(o.prev,o,e.prev)<0&&Oi(e.next,o,o.next)<0}function Zm(o,e,i,l,d){return(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-i)*d|0)|o<<8))|o<<4))|o<<2))|o<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-l)*d|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function N2(o){let e=o,i=o;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==o);return i}function Yb(o,e,i,l,d,p,m,y){return(d-m)*(e-y)>=(o-m)*(p-y)&&(o-m)*(l-y)>=(i-m)*(e-y)&&(i-m)*(p-y)>=(d-m)*(l-y)}function qf(o,e,i,l,d,p,m,y){return!(o===m&&e===y)&&Yb(o,e,i,l,d,p,m,y)}function Qb(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!function(i,l){let d=i;do{if(d.i!==i.i&&d.next.i!==i.i&&d.i!==l.i&&d.next.i!==l.i&&av(d,d.next,i,l))return!0;d=d.next}while(d!==i);return!1}(o,e)&&(Zf(o,e)&&Zf(e,o)&&function(i,l){let d=i,p=!1;const m=(i.x+l.x)/2,y=(i.y+l.y)/2;do d.y>y!=d.next.y>y&&d.next.y!==d.y&&m<(d.next.x-d.x)*(y-d.y)/(d.next.y-d.y)+d.x&&(p=!p),d=d.next;while(d!==i);return p}(o,e)&&(Oi(o.prev,o,e.prev)||Oi(o,e.prev,e))||Za(o,e)&&Oi(o.prev,o,o.next)>0&&Oi(e.prev,e,e.next)>0)}function Oi(o,e,i){return(e.y-o.y)*(i.x-e.x)-(e.x-o.x)*(i.y-e.y)}function Za(o,e){return o.x===e.x&&o.y===e.y}function av(o,e,i,l){const d=qd(Oi(o,e,i)),p=qd(Oi(o,e,l)),m=qd(Oi(i,l,o)),y=qd(Oi(i,l,e));return d!==p&&m!==y||!(d!==0||!Xm(o,i,e))||!(p!==0||!Xm(o,l,e))||!(m!==0||!Xm(i,o,l))||!(y!==0||!Xm(i,e,l))}function Xm(o,e,i){return e.x<=Math.max(o.x,i.x)&&e.x>=Math.min(o.x,i.x)&&e.y<=Math.max(o.y,i.y)&&e.y>=Math.min(o.y,i.y)}function qd(o){return o>0?1:o<0?-1:0}function Zf(o,e){return Oi(o.prev,o,o.next)<0?Oi(o,e,o.next)>=0&&Oi(o,o.prev,e)>=0:Oi(o,e,o.prev)<0||Oi(o,o.next,e)<0}function Jb(o,e){const i=cv(o.i,o.x,o.y),l=cv(e.i,e.x,e.y),d=o.next,p=e.prev;return o.next=e,e.prev=o,i.next=d,d.prev=i,l.next=i,i.prev=l,p.next=l,l.prev=p,l}function lv(o,e,i,l){const d=cv(o,e,i);return l?(d.next=l.next,d.prev=l,l.next.prev=d,l.next=d):(d.prev=d,d.next=d),d}function Zd(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function cv(o,e,i){return{i:o,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function e1(o,e,i=1){if(!o)return null;const l=typeof o=="string"?ls.from(o).getPrimary():o.getPrimary(),d=typeof o=="string"?null:o.getSecondary();for(const p of[l,d]){if(!p)continue;const m=p.id.toString();e.has(m)||e.set(m,[]),p.scaleSelf(i),e.get(m).push(p)}return{primary:l.toString(),secondary:d?d.toString():null}}function uv(o,e,i,l){const d=l.patternDependencies;let p=!1;for(const m of e){const y=m.paint.get(`${o}-pattern`);y.isConstant()||(p=!0),e1(y.constantOr(null),d,i)&&(p=!0)}return p}function Km(o,e,i,l,d,p){const m=p.patternDependencies;for(const y of e){const b=y.paint.get(`${o}-pattern`).value;if(b.kind!=="constant"){const S=e1(b.evaluate({zoom:l},i,{},void 0,p.availableImages),m,d);if(!S)continue;const{primary:C,secondary:I}=S;C&&(i.patterns[y.id]=[C,I].filter(Boolean))}}return i}const Xo=St/Math.PI/2,ju=64,dv=[ju,32,16],ka=-Xo,Aa=Xo;function Xd(o,e,i,l=Xo){return i=Te(i),[o*Math.sin(i)*l,-e*l,o*Math.cos(i)*l]}function Uu(o,e,i){return Xd(Math.cos(Te(o)),Math.sin(Te(o)),e,i)}const Kd=63710088e-1,hv=2*Math.PI*Kd;class Qn{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 Qn(dt(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,l=this.lat*i,d=e.lat*i,p=Math.sin(l)*Math.sin(d)+Math.cos(l)*Math.cos(d)*Math.cos((e.lng-this.lng)*i);return Kd*Math.acos(Math.min(p,1))}toBounds(e=0){const i=360*e/40075017,l=i/Math.cos(Math.PI/180*this.lat);return new ec({lng:this.lng-l,lat:this.lat-i},{lng:this.lng+l,lat:this.lat+i})}toEcef(e){return Uu(this.lat,this.lng,Xo+e*Xo/Kd)}static convert(e){if(e instanceof Qn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Qn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Qn(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 ec{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 Qn?new Qn(e.lng,e.lat):Qn.convert(e),this}setSouthWest(e){return this._sw=e instanceof Qn?new Qn(e.lng,e.lat):Qn.convert(e),this}extend(e){const i=this._sw,l=this._ne;let d,p;if(e instanceof Qn)d=e,p=e;else{if(!(e instanceof ec))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ec.convert(e)):this.extend(Qn.convert(e)):typeof e=="object"&&e!==null&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(Qn.convert(e)):this;if(d=e._sw,p=e._ne,!d||!p)return this}return i||l?(i.lng=Math.min(d.lng,i.lng),i.lat=Math.min(d.lat,i.lat),l.lng=Math.max(p.lng,l.lng),l.lat=Math.max(p.lat,l.lat)):(this._sw=new Qn(d.lng,d.lat),this._ne=new Qn(p.lng,p.lat)),this}getCenter(){return new Qn((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 Qn(this.getWest(),this.getNorth())}getSouthEast(){return new Qn(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:l}=Qn.convert(e);let d=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=l&&l<=this._ne.lat&&d}static convert(e){if(e)return e instanceof ec?e:new ec(e)}}function fv(o){return hv*Math.cos(o*Math.PI/180)}function Ko(o,e){return o/fv(e)}function Ym(o,e){return o*fv(Si(e))}const Ss=85.051129;function pv(o){return Math.cos(Te(Ie(o,-85.051129,Ss)))}function Gu(o,e){const i=Ie(e,0,25.5),l=Math.pow(2,i);return pv(o)*hv/(512*l)}function tc(o){return 1/Math.cos(o*Math.PI/180)}function Qs(o,e=0){const i=Math.exp(Math.PI*(1-(o.y+e/St)/(1<<o.z)*2));return 80150034*i/(i*i+1)/St/(1<<o.z)}class No{constructor(e,i,l=0){this.x=+e,this.y=+i,this.z=+l}static fromLngLat(e,i=0){const l=Qn.convert(e);return new No(wl(l.lng),ba(l.lat),Ko(i,l.lat))}toLngLat(){return new Qn(cs(this.x),Si(this.y))}toAltitude(){return Ym(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/hv*tc(Si(this.y))}}function $c(o,e,i,l,d,p,m,y,b){const S=(e+l)/2,C=(i+d)/2,I=new et(S,C);y(I),function(M,R,O,N,V,G){const K=O-V,q=N-G;return Math.abs((N-R)*K-(O-M)*q)/Math.hypot(K,q)}(I.x,I.y,p.x,p.y,m.x,m.y)>=b?($c(o,e,i,S,C,p,I,y,b),$c(o,S,C,l,d,I,m,y,b)):o.push(m)}function t1(o,e,i){let l=o[0],d=l.x,p=l.y;e(l);const m=[l];for(let y=1;y<o.length;y++){const b=o[y],{x:S,y:C}=b;e(b),$c(m,d,p,S,C,l,b,e,i),d=S,p=C,l=b}return m}function Yd(o,e,i,l){if(l(e,i)){const d=e.add(i)._mult(.5);Yd(o,e,d,l),Yd(o,d,i,l)}else o.push(i)}function n1(o,e){let i=o[0];const l=[i];for(let d=1;d<o.length;d++){const p=o[d];Yd(l,i,p,e),i=p}return l}const Qd=Math.pow(2,14)-1,mv=-Qd-1;function V2(o,e){const i=Math.round(o.x*e),l=Math.round(o.y*e);return o.x=Ie(i,mv,Qd),o.y=Ie(l,mv,Qd),(i<o.x||i>o.x+1||l<o.y||l>o.y+1)&&Cn("Geometry exceeds allowed extent, reduce your vector tile buffer size"),o}function Js(o,e,i){const l=o.loadGeometry(),d=o.extent,p=St/d;if(e&&i&&i.projection.isReprojectedInTileSpace){const m=1<<e.z,{scale:y,x:b,y:S,projection:C}=i,I=M=>{const R=cs((e.x+M.x/d)/m),O=Si((e.y+M.y/d)/m),N=C.project(R,O);M.x=(N.x*y-b)*d,M.y=(N.y*y-S)*d};for(let M=0;M<l.length;M++)if(o.type!==1)l[M]=t1(l[M],I,1);else{const R=[];for(const O of l[M])O.x<0||O.x>=d||O.y<0||O.y>=d||(I(O),R.push(O));l[M]=R}}for(const m of l)for(const y of m)V2(y,p);return l}function Ls(o,e){return{type:o.type,id:o.id,properties:o.properties,geometry:e?Js(o):[]}}const gv={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class $u{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 r1=new ArrayBuffer(0);class Rr{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=r1),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}resizeExact(e){this.reserveExact(e),this.length=e}reserve(e){e>this.capacity&&this._allocate(Math.max(e,Math.floor(5*this.capacity),128))}reserveExact(e){(e>this.capacity||!this.arrayBuffer)&&this._allocate(e)}_allocate(e){this._reallocCount++,this.capacity=e,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 Sn(o,e=1){let i=0,l=0;return{members:o.map(d=>{const p=gv[d.type].BYTES_PER_ELEMENT,m=i=Xf(i,Math.max(e,p)),y=d.components||1;return l=Math.max(l,p),i+=p*y,{name:d.name,type:d.type,components:y,offset:m}}),size:Xf(i,Math.max(l,e)),alignment:e}}function Xf(o,e){return Math.ceil(o/e)*e}class ea extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const l=this.length;return this.resize(l+1),this.emplace(l,e,i)}emplace(e,i,l){const d=2*e;return this.int16[d+0]=i,this.int16[d+1]=l,e}}ea.prototype.bytesPerElement=4,Mt(ea,"StructArrayLayout2i4");class Hc extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,l)}emplace(e,i,l,d){const p=3*e;return this.int16[p+0]=i,this.int16[p+1]=l,this.int16[p+2]=d,e}}Hc.prototype.bytesPerElement=6,Mt(Hc,"StructArrayLayout3i6");class Wc extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,l,d)}emplace(e,i,l,d,p){const m=4*e;return this.int16[m+0]=i,this.int16[m+1]=l,this.uint16[m+2]=d,this.uint16[m+3]=p,e}}Wc.prototype.bytesPerElement=8,Mt(Wc,"StructArrayLayout2i2ui8");class Xa extends Rr{_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}}Xa.prototype.bytesPerElement=4,Mt(Xa,"StructArrayLayout1f4");class Kf extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,l)}emplace(e,i,l,d){const p=4*e,m=2*e;return this.int16[p+0]=i,this.int16[p+1]=l,this.float32[m+1]=d,e}}Kf.prototype.bytesPerElement=8,Mt(Kf,"StructArrayLayout2i1f8");class Qm extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,l)}emplace(e,i,l,d){const p=4*e;return this.int16[p+0]=i,this.int16[p+1]=l,this.int16[p+2]=d,e}}Qm.prototype.bytesPerElement=8,Mt(Qm,"StructArrayLayout3i8");class Yf extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,l,d)}emplace(e,i,l,d,p){const m=4*e;return this.int16[m+0]=i,this.int16[m+1]=l,this.int16[m+2]=d,this.int16[m+3]=p,e}}Yf.prototype.bytesPerElement=8,Mt(Yf,"StructArrayLayout4i8");class _v extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,l,d,p)}emplace(e,i,l,d,p,m){const y=5*e;return this.int16[y+0]=i,this.int16[y+1]=l,this.int16[y+2]=d,this.int16[y+3]=p,this.int16[y+4]=m,e}}_v.prototype.bytesPerElement=10,Mt(_v,"StructArrayLayout5i10");class yv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,l,d,p,m,y)}emplace(e,i,l,d,p,m,y,b){const S=6*e,C=12*e,I=3*e;return this.int16[S+0]=i,this.int16[S+1]=l,this.uint8[C+4]=d,this.uint8[C+5]=p,this.uint8[C+6]=m,this.uint8[C+7]=y,this.float32[I+2]=b,e}}yv.prototype.bytesPerElement=12,Mt(yv,"StructArrayLayout2i4ub1f12");class Ca extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,l)}emplace(e,i,l,d){const p=3*e;return this.float32[p+0]=i,this.float32[p+1]=l,this.float32[p+2]=d,e}}Ca.prototype.bytesPerElement=12,Mt(Ca,"StructArrayLayout3f12");class qc extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,l,d,p)}emplace(e,i,l,d,p,m){const y=6*e,b=3*e;return this.uint16[y+0]=i,this.uint16[y+1]=l,this.uint16[y+2]=d,this.uint16[y+3]=p,this.float32[b+2]=m,e}}qc.prototype.bytesPerElement=12,Mt(qc,"StructArrayLayout4ui1f12");class Jd extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,l,d)}emplace(e,i,l,d,p){const m=4*e;return this.uint16[m+0]=i,this.uint16[m+1]=l,this.uint16[m+2]=d,this.uint16[m+3]=p,e}}Jd.prototype.bytesPerElement=8,Mt(Jd,"StructArrayLayout4ui8");class Jm extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,l,d,p,m)}emplace(e,i,l,d,p,m,y){const b=6*e;return this.int16[b+0]=i,this.int16[b+1]=l,this.int16[b+2]=d,this.int16[b+3]=p,this.int16[b+4]=m,this.int16[b+5]=y,e}}Jm.prototype.bytesPerElement=12,Mt(Jm,"StructArrayLayout6i12");class vv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y,b,S,C,I,M){const R=this.length;return this.resize(R+1),this.emplace(R,e,i,l,d,p,m,y,b,S,C,I,M)}emplace(e,i,l,d,p,m,y,b,S,C,I,M,R){const O=12*e;return this.int16[O+0]=i,this.int16[O+1]=l,this.int16[O+2]=d,this.int16[O+3]=p,this.uint16[O+4]=m,this.uint16[O+5]=y,this.uint16[O+6]=b,this.uint16[O+7]=S,this.int16[O+8]=C,this.int16[O+9]=I,this.int16[O+10]=M,this.int16[O+11]=R,e}}vv.prototype.bytesPerElement=24,Mt(vv,"StructArrayLayout4i4ui4i24");class xv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,l,d,p,m)}emplace(e,i,l,d,p,m,y){const b=10*e,S=5*e;return this.int16[b+0]=i,this.int16[b+1]=l,this.int16[b+2]=d,this.float32[S+2]=p,this.float32[S+3]=m,this.float32[S+4]=y,e}}xv.prototype.bytesPerElement=20,Mt(xv,"StructArrayLayout3i3f20");class nc extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,l,d)}emplace(e,i,l,d,p){const m=4*e;return this.float32[m+0]=i,this.float32[m+1]=l,this.float32[m+2]=d,this.float32[m+3]=p,e}}nc.prototype.bytesPerElement=16,Mt(nc,"StructArrayLayout4f16");class eg extends Rr{_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}}eg.prototype.bytesPerElement=4,Mt(eg,"StructArrayLayout1ul4");class ta extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const l=this.length;return this.resize(l+1),this.emplace(l,e,i)}emplace(e,i,l){const d=2*e;return this.uint16[d+0]=i,this.uint16[d+1]=l,e}}ta.prototype.bytesPerElement=4,Mt(ta,"StructArrayLayout2ui4");class eh extends Rr{_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,l,d,p,m,y,b,S,C,I,M,R){const O=this.length;return this.resize(O+1),this.emplace(O,e,i,l,d,p,m,y,b,S,C,I,M,R)}emplace(e,i,l,d,p,m,y,b,S,C,I,M,R,O){const N=20*e,V=10*e;return this.int16[N+0]=i,this.int16[N+1]=l,this.int16[N+2]=d,this.int16[N+3]=p,this.int16[N+4]=m,this.float32[V+3]=y,this.float32[V+4]=b,this.float32[V+5]=S,this.float32[V+6]=C,this.int16[N+14]=I,this.uint32[V+8]=M,this.uint16[N+18]=R,this.uint16[N+19]=O,e}}eh.prototype.bytesPerElement=40,Mt(eh,"StructArrayLayout5i4f1i1ul2ui40");class tg extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,l,d,p,m,y)}emplace(e,i,l,d,p,m,y,b){const S=8*e;return this.int16[S+0]=i,this.int16[S+1]=l,this.int16[S+2]=d,this.int16[S+4]=p,this.int16[S+5]=m,this.int16[S+6]=y,this.int16[S+7]=b,e}}tg.prototype.bytesPerElement=16,Mt(tg,"StructArrayLayout3i2i2i16");class bv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,l,d,p)}emplace(e,i,l,d,p,m){const y=4*e,b=8*e;return this.float32[y+0]=i,this.float32[y+1]=l,this.float32[y+2]=d,this.int16[b+6]=p,this.int16[b+7]=m,e}}bv.prototype.bytesPerElement=16,Mt(bv,"StructArrayLayout2f1f2i16");class Al extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,l,d,p,m)}emplace(e,i,l,d,p,m,y){const b=20*e,S=5*e;return this.uint8[b+0]=i,this.uint8[b+1]=l,this.float32[S+1]=d,this.float32[S+2]=p,this.float32[S+3]=m,this.float32[S+4]=y,e}}Al.prototype.bytesPerElement=20,Mt(Al,"StructArrayLayout2ub4f20");class _i extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,l)}emplace(e,i,l,d){const p=3*e;return this.uint16[p+0]=i,this.uint16[p+1]=l,this.uint16[p+2]=d,e}}_i.prototype.bytesPerElement=6,Mt(_i,"StructArrayLayout3ui6");class Zc extends Rr{_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,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te){const le=this.length;return this.resize(le+1),this.emplace(le,e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te)}emplace(e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te,le){const xe=30*e,de=15*e,ve=60*e;return this.int16[xe+0]=i,this.int16[xe+1]=l,this.int16[xe+2]=d,this.float32[de+2]=p,this.float32[de+3]=m,this.uint16[xe+8]=y,this.uint16[xe+9]=b,this.uint32[de+5]=S,this.uint32[de+6]=C,this.uint32[de+7]=I,this.uint16[xe+16]=M,this.uint16[xe+17]=R,this.uint16[xe+18]=O,this.float32[de+10]=N,this.float32[de+11]=V,this.uint8[ve+48]=G,this.uint8[ve+49]=K,this.uint8[ve+50]=q,this.uint32[de+13]=ee,this.int16[xe+28]=te,this.uint8[ve+58]=le,e}}Zc.prototype.bytesPerElement=60,Mt(Zc,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class wv extends Rr{_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,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te,le,xe,de,ve,Se,we,Fe,Ve,qe,Ke,je,at){const Ge=this.length;return this.resize(Ge+1),this.emplace(Ge,e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te,le,xe,de,ve,Se,we,Fe,Ve,qe,Ke,je,at)}emplace(e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te,le,xe,de,ve,Se,we,Fe,Ve,qe,Ke,je,at,Ge){const $e=20*e,Ye=40*e,rt=80*e;return this.float32[$e+0]=i,this.float32[$e+1]=l,this.int16[Ye+4]=d,this.int16[Ye+5]=p,this.int16[Ye+6]=m,this.int16[Ye+7]=y,this.int16[Ye+8]=b,this.int16[Ye+9]=S,this.int16[Ye+10]=C,this.int16[Ye+11]=I,this.int16[Ye+12]=M,this.uint16[Ye+13]=R,this.uint16[Ye+14]=O,this.uint16[Ye+15]=N,this.uint16[Ye+16]=V,this.uint16[Ye+17]=G,this.uint16[Ye+18]=K,this.uint16[Ye+19]=q,this.uint16[Ye+20]=ee,this.uint16[Ye+21]=te,this.uint16[Ye+22]=le,this.uint16[Ye+23]=xe,this.uint16[Ye+24]=de,this.uint16[Ye+25]=ve,this.uint16[Ye+26]=Se,this.uint16[Ye+27]=we,this.uint32[$e+14]=Fe,this.float32[$e+15]=Ve,this.float32[$e+16]=qe,this.float32[$e+17]=Ke,this.float32[$e+18]=je,this.uint8[rt+76]=at,this.uint16[Ye+39]=Ge,e}}wv.prototype.bytesPerElement=80,Mt(wv,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Sv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,l,d,p,m)}emplace(e,i,l,d,p,m,y){const b=6*e;return this.float32[b+0]=i,this.float32[b+1]=l,this.float32[b+2]=d,this.float32[b+3]=p,this.float32[b+4]=m,this.float32[b+5]=y,e}}Sv.prototype.bytesPerElement=24,Mt(Sv,"StructArrayLayout6f24");class Hu extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,l,d,p)}emplace(e,i,l,d,p,m){const y=5*e;return this.float32[y+0]=i,this.float32[y+1]=l,this.float32[y+2]=d,this.float32[y+3]=p,this.float32[y+4]=m,e}}Hu.prototype.bytesPerElement=20,Mt(Hu,"StructArrayLayout5f20");class Tv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,l,d,p,m,y)}emplace(e,i,l,d,p,m,y,b){const S=7*e;return this.float32[S+0]=i,this.float32[S+1]=l,this.float32[S+2]=d,this.float32[S+3]=p,this.float32[S+4]=m,this.float32[S+5]=y,this.float32[S+6]=b,e}}Tv.prototype.bytesPerElement=28,Mt(Tv,"StructArrayLayout7f28");class Ev extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y,b,S,C,I){const M=this.length;return this.resize(M+1),this.emplace(M,e,i,l,d,p,m,y,b,S,C,I)}emplace(e,i,l,d,p,m,y,b,S,C,I,M){const R=11*e;return this.float32[R+0]=i,this.float32[R+1]=l,this.float32[R+2]=d,this.float32[R+3]=p,this.float32[R+4]=m,this.float32[R+5]=y,this.float32[R+6]=b,this.float32[R+7]=S,this.float32[R+8]=C,this.float32[R+9]=I,this.float32[R+10]=M,e}}Ev.prototype.bytesPerElement=44,Mt(Ev,"StructArrayLayout11f44");class kv extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y,b,S){const C=this.length;return this.resize(C+1),this.emplace(C,e,i,l,d,p,m,y,b,S)}emplace(e,i,l,d,p,m,y,b,S,C){const I=9*e;return this.float32[I+0]=i,this.float32[I+1]=l,this.float32[I+2]=d,this.float32[I+3]=p,this.float32[I+4]=m,this.float32[I+5]=y,this.float32[I+6]=b,this.float32[I+7]=S,this.float32[I+8]=C,e}}kv.prototype.bytesPerElement=36,Mt(kv,"StructArrayLayout9f36");class Wu extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const l=this.length;return this.resize(l+1),this.emplace(l,e,i)}emplace(e,i,l){const d=2*e;return this.float32[d+0]=i,this.float32[d+1]=l,e}}Wu.prototype.bytesPerElement=8,Mt(Wu,"StructArrayLayout2f8");class Av extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,l,d)}emplace(e,i,l,d,p){const m=6*e;return this.uint32[3*e+0]=i,this.uint16[m+2]=l,this.uint16[m+3]=d,this.uint16[m+4]=p,e}}Av.prototype.bytesPerElement=12,Mt(Av,"StructArrayLayout1ul3ui12");class Cl extends Rr{_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}}Cl.prototype.bytesPerElement=2,Mt(Cl,"StructArrayLayout1ui2");class th extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V){const G=this.length;return this.resize(G+1),this.emplace(G,e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V)}emplace(e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G){const K=16*e;return this.float32[K+0]=i,this.float32[K+1]=l,this.float32[K+2]=d,this.float32[K+3]=p,this.float32[K+4]=m,this.float32[K+5]=y,this.float32[K+6]=b,this.float32[K+7]=S,this.float32[K+8]=C,this.float32[K+9]=I,this.float32[K+10]=M,this.float32[K+11]=R,this.float32[K+12]=O,this.float32[K+13]=N,this.float32[K+14]=V,this.float32[K+15]=G,e}}th.prototype.bytesPerElement=64,Mt(th,"StructArrayLayout16f64");class ng extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,l,d,p,m,y){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,l,d,p,m,y)}emplace(e,i,l,d,p,m,y,b){const S=10*e,C=5*e;return this.uint16[S+0]=i,this.uint16[S+1]=l,this.uint16[S+2]=d,this.uint16[S+3]=p,this.float32[C+2]=m,this.float32[C+3]=y,this.float32[C+4]=b,e}}ng.prototype.bytesPerElement=20,Mt(ng,"StructArrayLayout4ui3f20");class Qf extends Rr{_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}}Qf.prototype.bytesPerElement=2,Mt(Qf,"StructArrayLayout1i2");class rg extends Rr{_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}}rg.prototype.bytesPerElement=1,Mt(rg,"StructArrayLayout1ub1");class i1 extends $u{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]}}i1.prototype.size=40;class ig extends eh{get(e){return new i1(this,e)}}Mt(ig,"CollisionBoxArray");class Jf extends $u{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}}Jf.prototype.size=60;class o1 extends Zc{get(e){return new Jf(this,e)}}Mt(o1,"PlacedSymbolArray");class s1 extends $u{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]}}s1.prototype.size=80;class a1 extends wv{get(e){return new s1(this,e)}}Mt(a1,"SymbolInstanceArray");class l1 extends Xa{getoffsetX(e){return this.float32[1*e+0]}}Mt(l1,"GlyphOffsetArray");class c1 extends ea{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Mt(c1,"SymbolLineVertexArray");class ep extends $u{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]}}ep.prototype.size=12;class tp extends Av{get(e){return new ep(this,e)}}Mt(tp,"FeatureIndexArray");class Os extends ta{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Mt(Os,"FillExtrusionCentroidArray");class np extends $u{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]}}np.prototype.size=6;class u1 extends Hc{get(e){return new np(this,e)}}Mt(u1,"FillExtrusionWallArray");const j2=Sn([{name:"a_pos",components:2,type:"Int16"}],4),U2=Sn([{name:"a_road_z_offset",components:1,type:"Float32"}],4),G2=Sn([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Cv=Sn([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class pr{constructor(e=[]){this.segments=e}_prepareSegment(e,i,l,d,p){let m=this.segments.at(-1);return e>pr.MAX_VERTEX_ARRAY_LENGTH&&Cn(`Max vertices per segment is ${pr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!m||m.vertexLength+e>pr.MAX_VERTEX_ARRAY_LENGTH||m.sortKey!==d||p!==void 0&&m&&m.batchIndex!==void 0&&m.batchIndex!==p)&&(m={vertexOffset:i,primitiveOffset:l,vertexLength:0,primitiveLength:0},d!==void 0&&(m.sortKey=d),p!==void 0&&(m.batchIndex=p),this.segments.push(m)),m}prepareSegment(e,i,l,d,p){return this._prepareSegment(e,i.length,l.length,d,p)}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,l,d){return new pr([{vertexOffset:e,primitiveOffset:i,vertexLength:l,primitiveLength:d,vaos:{},sortKey:0}])}}function Xc(o,e){return 256*(o=Ie(Math.floor(o),0,255))+Ie(Math.floor(e),0,255)}pr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Mt(pr,"SegmentVector");const $2=Sn([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),H2=Sn([{name:"a_pattern_b",components:4,type:"Uint16"}]),W2=Sn([{name:"a_dash",components:4,type:"Uint16"}]);class rp{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,l,d){this.ids.push(Iv(e)),this.positions.push(i,l,d)}eachPosition(e,i){const l=Iv(e);let d=0,p=this.ids.length-1;for(;d<p;){const m=d+p>>1;this.ids[m]>=l?p=m:d=m+1}for(;this.ids[d]===l;)i(this.positions[3*d],this.positions[3*d+1],this.positions[3*d+2]),d++}static serialize(e,i){const l=new Float64Array(e.ids),d=new Uint32Array(e.positions);return ip(l,d,0,l.length-1),i&&(i.add(l.buffer),i.add(d.buffer)),{ids:l,positions:d}}static deserialize(e){const i=new rp;let l;i.ids=e.ids,i.positions=e.positions;for(const d of i.ids)d!==l&&i.uniqueIds.push(d),l=d;return i.indexed=!0,i}}function Iv(o){const e=+o;return Number.isSafeInteger(e)?e:lm(String(o))}function ip(o,e,i,l){for(;i<l;){const d=o[i+l>>1];let p=i-1,m=l+1;for(;;){do p++;while(o[p]<d);do m--;while(o[m]>d);if(p>=m)break;og(o,p,m),og(e,3*p,3*m),og(e,3*p+1,3*m+1),og(e,3*p+2,3*m+2)}m-i<l-m?(ip(o,e,i,m),i=m+1):(ip(o,e,m+1,l),l=m)}}function og(o,e,i){const l=o[e];o[e]=o[i],o[i]=l}Mt(rp,"FeaturePositionMap");class Ka{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,l){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class op extends Ka{constructor(e){super(e),this.current=0}set(e,i,l){this.fetchUniformLocation(e,i)&&this.current!==l&&(this.current=l,this.gl.uniform1i(this.location,l))}}class Ti extends Ka{constructor(e){super(e),this.current=0}set(e,i,l){this.fetchUniformLocation(e,i)&&this.current!==l&&(this.current=l,this.gl.uniform1f(this.location,l))}}class Fs extends Ka{constructor(e){super(e),this.current=[0,0]}set(e,i,l){this.fetchUniformLocation(e,i)&&(l[0]===this.current[0]&&l[1]===this.current[1]||(this.current=l,this.gl.uniform2f(this.location,l[0],l[1])))}}class Kc extends Ka{constructor(e){super(e),this.current=[0,0,0]}set(e,i,l){this.fetchUniformLocation(e,i)&&(l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]||(this.current=l,this.gl.uniform3f(this.location,l[0],l[1],l[2])))}}class d1 extends Ka{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,l){this.fetchUniformLocation(e,i)&&(l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]&&l[3]===this.current[3]||(this.current=l,this.gl.uniform4ui(this.location,l[0],l[1],l[2],l[3])))}}class Mv extends Ka{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,l){this.fetchUniformLocation(e,i)&&(l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]&&l[3]===this.current[3]||(this.current=l,this.gl.uniform4f(this.location,l[0],l[1],l[2],l[3])))}}class Pv extends Ka{constructor(e){super(e),this.current=qn.transparent.toPremultipliedRenderColor(null)}set(e,i,l){this.fetchUniformLocation(e,i)&&(l.r===this.current.r&&l.g===this.current.g&&l.b===this.current.b&&l.a===this.current.a||(this.current=l,this.gl.uniform4f(this.location,l.r,l.g,l.b,l.a)))}}class sp extends Ka{constructor(e){super(e),this.current=new Float32Array(16)}set(e,i,l){if(!this.fetchUniformLocation(e,i))return;const d=this.current;if(l[12]!==d[12]||l[0]!==d[0])return d.set(l),void this.gl.uniformMatrix4fv(this.location,!1,d);for(let p=1;p<16;p++)if(l[p]!==d[p]){d.set(l),this.gl.uniformMatrix4fv(this.location,!1,d);break}}}class ap extends Ka{constructor(e){super(e),this.current=new Float32Array(4)}set(e,i,l){if(!this.fetchUniformLocation(e,i))return;const d=this.current;for(let p=0;p<4;p++)if(l[p]!==d[p]){d.set(l),this.gl.uniformMatrix2fv(this.location,!1,d);break}}}function Dv(o){return[Xc(255*o.r,255*o.g),Xc(255*o.b,255*o.a)]}function sg(o,e,i,l,d,p,m,y){return!!o&&(o.kind==="composite"||o.kind==="source"?o.evaluate(new Yn(0,{brightness:p,worldview:y}),e,i,d,l,m)==="none":o.value==="none")}class ag{constructor(e,i,l,d){this.value=e,this.uniformNames=i.map(p=>`u_${p}`),this.type=l,this.context=d}setUniform(e,i,l,d,p){const m=d.constantOr(this.value);i.set(e,p,m instanceof qn?m.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):m)}getBinding(e,i){return this.type==="color"?new Pv(e):new Ti(e)}}class lp{constructor(e,i){this.uniformNames=i.map(l=>`u_${l}`),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,l,d,p){let m=null;p!=="u_pattern"&&p!=="u_dash"||(m=this.pattern),p==="u_pattern_b"&&(m=this.patternTransition),p==="u_pixel_ratio"&&(m=this.pixelRatio),m&&i.set(e,p,m)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new d1(e):new Ti(e)}}class Il{constructor(e,i,l,d){this.expression=e,this.type=l,this.maxValue=0,this.paintVertexAttributes=i.map(p=>({name:`a_${p}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,i,l,d,p,m,y,b){const S=this.paintVertexArray.length,C=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Yn(0,{brightness:m,worldview:b}),i,{},p,d,y):this.expression.kind==="constant"&&this.expression.value,I=sg(this.lutExpression,i,{},d,p,m,y,b);this.paintVertexArray.resize(e),this._setPaintValue(S,e,C,I?null:this.context.lut)}updatePaintArray(e,i,l,d,p,m,y,b){const S=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:y,worldview:b},l,d,void 0,p):this.expression.kind==="constant"&&this.expression.value,C=sg(this.lutExpression,l,d,p,void 0,y,void 0,b);this._setPaintValue(e,i,S,C?null:this.context.lut)}_setPaintValue(e,i,l,d){if(this.type==="color"){const p=Dv(l.toPremultipliedRenderColor(d));for(let m=e;m<i;m++)this.paintVertexArray.emplace(m,p[0],p[1])}else{for(let p=e;p<i;p++)this.paintVertexArray.emplace(p,l);this.maxValue=Math.max(this.maxValue,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.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 Ml{constructor(e,i,l,d,p,m){this.expression=e,this.uniformNames=i.map(y=>`u_${y}_t`),this.type=l,this.useIntegerZoom=d,this.context=p,this.maxValue=0,this.paintVertexAttributes=i.map(y=>({name:`a_${y}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(e,i,l,d,p,m,y,b){const S=this.expression.evaluate(new Yn(this.context.zoom,{brightness:m,worldview:b}),i,{},p,d,y),C=this.expression.evaluate(new Yn(this.context.zoom+1,{brightness:m,worldview:b}),i,{},p,d,y),I=sg(this.lutExpression,i,{},d,p,m,y,b),M=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(M,e,S,C,I?null:this.context.lut)}updatePaintArray(e,i,l,d,p,m,y,b){const S=this.expression.evaluate({zoom:this.context.zoom,brightness:y,worldview:b},l,d,void 0,p),C=this.expression.evaluate({zoom:this.context.zoom+1,brightness:y,worldview:b},l,d,void 0,p),I=sg(this.lutExpression,l,d,p,void 0,y,void 0,b);this._setPaintValue(e,i,S,C,I?null:this.context.lut)}_setPaintValue(e,i,l,d,p){if(this.type==="color"){const m=Dv(l.toPremultipliedRenderColor(p)),y=Dv(d.toPremultipliedRenderColor(p));for(let b=e;b<i;b++)this.paintVertexArray.emplace(b,m[0],m[1],y[0],y[1])}else{for(let m=e;m<i;m++)this.paintVertexArray.emplace(m,l,d);this.maxValue=Math.max(this.maxValue,Math.abs(l),Math.abs(d))}}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,l,d,p){const m=this.useIntegerZoom?Math.floor(l.zoom):l.zoom,y=Ie(this.expression.interpolationFactor(m,this.context.zoom,this.context.zoom+1),0,1);i.set(e,p,y)}getBinding(e,i){return new Ti(e)}}class Pl{constructor(e,i,l,d,p){this.expression=e,this.layerId=p,this.paintVertexAttributes=(l==="array"?W2:$2).members;for(let m=0;m<i.length;++m);this.paintVertexArray=new d,this.paintTransitionVertexArray=new Jd}populatePaintArray(e,i,l,d){const p=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(p,e,i.patterns&&i.patterns[this.layerId],l)}updatePaintArray(e,i,l,d,p,m,y){this._setPaintValues(e,i,l.patterns&&l.patterns[this.layerId],m)}_setPaintValues(e,i,l,d){if(!d||!l)return;const p=d[l[0]],m=d[l[1]];if(p){if(p){const{tl:y,br:b,pixelRatio:S}=p;for(let C=e;C<i;C++)this.paintVertexArray.emplace(C,y[0],y[1],b[0],b[1],S)}if(m){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:y,br:b}=m;for(let S=e;S<i;S++)this.paintTransitionVertexArray.emplace(S,y[0],y[1],b[0],b[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,H2.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class qu{constructor(e,i,l=()=>!0){this.binders={},this._buffers=[],this.context=i;const d=[],p=e;for(const m in e.paint._values){const y=p.paint.get(m);if(m.endsWith("-use-theme")||!l(m)||!(y instanceof Uc&&Ys(y.property.specification)))continue;const b=Z2(m,e.type),S=y.value,C=y.property.specification.type,I=!!y.property.useIntegerZoom,M=m==="line-dasharray"||m.endsWith("pattern"),R=p.paint.get(`${m}-use-theme`),O=m==="line-dasharray"&&p.layout.get("line-cap").value.kind!=="constant"||R&&R.value.kind!=="constant";if(S.kind!=="constant"||O)if(S.kind==="source"||O||M){const N=h1(m,C,"source");this.binders[m]=M?new Pl(S,b,C,N,e.id):new Il(S,b,C,N),d.push(`/a_${m}`)}else{const N=h1(m,C,"composite");this.binders[m]=new Ml(S,b,C,I,i,N),d.push(`/z_${m}`)}else this.binders[m]=M?new lp(S.value,b):new ag(S.value,b,C,i),d.push(`/u_${m}`);R&&(this.binders[m].lutExpression=R.value)}this.cacheKey=d.sort().join("")}updateExpressions(e){const i=e;for(const l in this.binders){const d=this.binders[l];if(d instanceof Il||d instanceof Ml||d instanceof Pl){const p=i.paint.get(l);d.expression=p.value}}}getMaxValue(e){const i=this.binders[e];return i instanceof Il||i instanceof Ml?i.maxValue:0}populatePaintArrays(e,i,l,d,p,m,y,b){for(const S in this.binders){const C=this.binders[S];C.context=this.context,(C instanceof Il||C instanceof Ml||C instanceof Pl)&&C.populatePaintArray(e,i,l,d,p,m,y,b)}}setConstantPatternPositions(e,i){for(const l in this.binders){const d=this.binders[l];d instanceof lp&&d.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof Pl?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,l,d,p,m,y,b,S,C){let I=!1;const M=Object.keys(e),R=M.length!==0&&!b,O=R?M:i.uniqueIds;this.context.lut=p.lut;for(const N in this.binders){const V=this.binders[N];if(V.context=this.context,(V instanceof Il||V instanceof Ml||V instanceof Pl)&&V.expression&&V.expression.kind&&V.expression.kind!=="constant"&&(V.expression.isStateDependent===!0||V.expression.isLightConstant===!1)){const G=p.paint.get(N);V.expression=G.value;for(const K of O){const q=e[K.toString()];i.eachPosition(K,(ee,te,le)=>{const xe=d.feature(ee);V.updatePaintArray(te,le,xe,q,m,y,S,C)})}if(!R)for(const K of l.uniqueIds){const q=e[K.toString()];l.eachPosition(K,(ee,te,le)=>{const xe=d.feature(ee);V.updatePaintArray(te,le,xe,q,m,y,S,C)})}I=!0}}return I}defines(){const e=[];for(const i in this.binders){const l=this.binders[i];(l instanceof ag||l instanceof lp)&&e.push(...l.uniformNames.map(d=>`#define HAS_UNIFORM_${d}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const l in this.binders){const d=this.binders[l];if(d instanceof ag||d instanceof lp||d instanceof Ml)for(const p of d.uniformNames)i.push({name:p,property:l,binding:d.getBinding(e,p)})}return i}setUniforms(e,i,l,d,p){for(const{name:m,property:y,binding:b}of l)this.binders[y].setUniform(e,b,p,d.get(y),m)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Il||i instanceof Ml||i instanceof Pl)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof Pl&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const l=this.binders[i];(l instanceof Il||l instanceof Ml||l instanceof Pl)&&l.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Il||i instanceof Ml||i instanceof Pl)&&i.destroy()}}}class Ya{constructor(e,i,l=()=>!0){this.programConfigurations={};for(const d of e)this.programConfigurations[d.id]=new qu(d,i,l);this.needsUpload=!1,this._featureMap=new rp,this._featureMapWithoutIds=new rp,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,l,d,p,m,y,b,S){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(e,i,d,p,m,y,b,S);i.id!==void 0?this._featureMap.add(i.id,l,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,l,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,l,d,p,m,y,b){for(const S of l)this.needsUpload=this.programConfigurations[S.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,S,d,p,m,y||0,b)||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()}updateExpressions(e){const i=new Set;for(const l of e){const d=this.programConfigurations[l.id];d&&(d.updateExpressions(l),i.add(l.id))}for(const l in this.programConfigurations)i.has(l)||delete this.programConfigurations[l]}}const q2={"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 Z2(o,e){return q2[o]||[o.replace(`${e}-`,"").replace(/-/g,"_")]}const X2={"line-pattern":{source:qc,composite:qc},"fill-pattern":{source:qc,composite:qc},"fill-extrusion-pattern":{source:qc,composite:qc},"line-dasharray":{source:Jd,composite:Jd}},K2={color:{source:Wu,composite:nc},number:{source:Xa,composite:Wu}};function h1(o,e,i){const l=X2[o];return l&&l[i]||K2[e][i]}Mt(ag,"ConstantBinder"),Mt(lp,"PatternConstantBinder"),Mt(Il,"SourceExpressionBinder",{omit:["expression"]}),Mt(Pl,"PatternCompositeBinder",{omit:["expression"]}),Mt(Ml,"CompositeExpressionBinder",{omit:["expression"]}),Mt(qu,"ProgramConfiguration",{omit:["_buffers"]}),Mt(Ya,"ProgramConfigurationSet");class nh{constructor(e,i,l){this.layoutVertexArray=new ea,this.indexArray=new _i,this.lineIndexArray=new ta,this.triangleSegments=new pr,this.lineSegments=new pr,this.programConfigurations=new Ya(e,{zoom:i,lut:l}),this.uploaded=!1}update(e,i,l,d,p,m,y,b){this.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y,b)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,j2.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,l,d,p,m,y){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,l,d,p,m,void 0,y)}}Mt(nh,"FillBufferData");class lg{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 nh(e.layers,e.zoom,e.lut),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.sourceLayerIndex=e.sourceLayerIndex,this.sourceLayerName=e.sourceLayerName||"",this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){this.hasPattern=uv("fill",this.layers,this.pixelRatio,i);const p=this.layers[0].layout.get("fill-sort-key"),m=[];for(const{feature:y,id:b,index:S,sourceLayerIndex:C}of e){const I=this.layers[0]._featureFilter.needGeometry,M=Ls(y,I);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),M,l))continue;const R=p?p.evaluate(M,{},l,i.availableImages):void 0,O={id:b,properties:y.properties,type:y.type,sourceLayerIndex:C,index:S,geometry:I?M.geometry:Js(y,l,d),patterns:{},sortKey:R};m.push(O)}p&&m.sort((y,b)=>y.sortKey-b.sortKey);for(const y of m){const{geometry:b,index:S,sourceLayerIndex:C}=y;if(this.hasPattern){const I=Km("fill",this.layers,y,this.zoom,this.pixelRatio,i);this.patternFeatures.push(I)}else this.addFeature(y,b,S,l,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[S].feature,b,S,C,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(e,i,l,d,p,m,y){this.bufferData.update(e,i,l,d,p,m,y,this.worldview),this.hdExt&&this.hdExt.update(e,i,l,d,p,m,y,this.worldview)}updateExpressions(e){this.bufferData.programConfigurations.updateExpressions(e),this.hdExt&&this.hdExt.updateExpressions(e)}addFeatures(e,i,l,d,p,m){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,i,l,d,m,e.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.hdExt!=null&&this.hdExt.needsUpload()}upload(e){this.bufferData.upload(e),this.hdExt&&this.hdExt.upload(e)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}addFeature(e,i,l,d,p,m=[],y,b){const S=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,C=this.bufferData.indexArray.length,I=Bn(i,500);this.hdExt!=null&&this.hdExt.handleFeature(e,I,l,d,b,this)||this.addGeometry(I,this.bufferData),this.bufferData.populatePaintArrays(e,l,p,m,d,y,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(e,l,p,m,d,y,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,C,this.bufferData.indexArray.length,S)}addGeometry(e,i,l,d){let p=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,y=null;l&&(y=l.elevationSampler.constantElevation(l.elevation,l.bias),y!=null&&(p=y,m=y));const b=l?i:null,S=(C,I,M)=>{if(l!=null)if(I.push(C),y!=null)b.elevatedLayoutVertexArray.emplaceBack(y),M.push(y);else{const R=l.elevationSampler.pointElevation(C,l.elevation,l.bias);b.elevatedLayoutVertexArray.emplaceBack(R),M.push(R),p=Math.min(p,R),m=Math.max(m,R)}};for(const C of e){let I=0;for(const te of C)I+=te.length;const M=i.triangleSegments.prepareSegment(I,i.layoutVertexArray,i.indexArray),R=M.vertexLength,O=[],N=[],V=[],G=[],K=[],q=i.layoutVertexArray.length;for(const te of C){if(te.length===0)continue;te!==C[0]&&N.push(O.length/2);const le=i.lineSegments.prepareSegment(te.length,i.layoutVertexArray,i.lineIndexArray),xe=le.vertexLength;l&&K.push(i.layoutVertexArray.length-q),S(te[0],V,G),i.layoutVertexArray.emplaceBack(te[0].x,te[0].y),i.lineIndexArray.emplaceBack(xe+te.length-1,xe),O.push(te[0].x),O.push(te[0].y);for(let de=1;de<te.length;de++)S(te[de],V,G),i.layoutVertexArray.emplaceBack(te[de].x,te[de].y),i.lineIndexArray.emplaceBack(xe+de-1,xe+de),O.push(te[de].x),O.push(te[de].y);le.vertexLength+=te.length,le.primitiveLength+=te.length}const ee=Nu(O,N);for(let te=0;te<ee.length;te+=3)i.indexArray.emplaceBack(R+ee[te],R+ee[te+1],R+ee[te+2]);if(ee.length>0&&l&&d){const te=l.elevation.isTunnel(),le=l.elevation.safeArea,xe=d.addVertices(V,G);d.addTriangles(ee,xe,te);const de=K.length;if(de>0){for(let ve=0;ve<de-1;ve++)d.addRenderableRing(l.index,K[ve]+xe,K[ve+1]-K[ve],te,le,l.featureInfo);d.addRenderableRing(l.index,K[de-1]+xe,V.length-K[de-1],te,le,l.featureInfo)}}M.vertexLength+=I,M.primitiveLength+=ee.length/3}return[p,m]}}Mt(lg,"FillBucket",{omit:["layers","patternFeatures"]});const Y2=Sn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),cg=Sn([{name:"a_z_offset_width",components:4,type:"Float32"}],4),Q2=Sn([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),f1=Sn([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:J2}=Y2,eE=Sn([{name:"a_packed",components:3,type:"Float32"}]),{members:p1}=eE,m1=Sn([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:g1}=m1;class Yc{constructor(e,i,l,d,p){for(this.properties=Object.create(null),this.extent=l,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=d,this._values=p;e.pos<i;){const m=e.readVarint();if(m===8)this.id=e.readVarint();else if(m===18){const y=e.readVarint()+e.pos;for(;e.pos<y;){const b=d[e.readVarint()],S=p[e.readVarint()];this.properties[b]=S}}else m===24?this.type=e.readVarint():(m===34&&(this._geometry=e.pos),e.skip(m))}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,l=[];let d,p=1,m=0,y=0,b=0;for(;e.pos<i;){if(m<=0){const S=e.readVarint();if(p=7&S,m=S>>3,m===0)continue}if(m--,p===1)y+=e.readSVarint(),b+=e.readSVarint(),d&&l.push(d),d=[new et(y,b)];else if(p===2)y+=e.readSVarint(),b+=e.readSVarint(),d&&d.push(new et(y,b));else{if(p!==7)throw new Error(`unknown command ${p}`);d&&d.push(d[0].clone())}}return d&&l.push(d),l}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let l=1,d=0,p=0,m=0,y=1/0,b=-1/0,S=1/0,C=-1/0;for(;e.pos<i;){if(d<=0){const I=e.readVarint();if(l=7&I,d=I>>3,d===0)continue}if(d--,l===1||l===2)p+=e.readSVarint(),m+=e.readSVarint(),p<y&&(y=p),p>b&&(b=p),m<S&&(S=m),m>C&&(C=m);else if(l!==7)throw new Error(`unknown command ${l}`)}return[y,S,b,C]}toGeoJSON(e,i,l){const d=this.extent*Math.pow(2,l),p=this.extent*e,m=this.extent*i,y=this.loadGeometry();function b(M){return[360*(M.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((1-2*(M.y+m)/d)*Math.PI))-90]}function S(M){return M.map(b)}let C;if(this.type===1){const M=[];for(const O of y)M.push(O[0]);const R=S(M);C=M.length===1?{type:"Point",coordinates:R[0]}:{type:"MultiPoint",coordinates:R}}else if(this.type===2){const M=y.map(S);C=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(O){const N=O.length;if(N<=1)return[O];const V=[];let G,K;for(let q=0;q<N;q++){const ee=tE(O[q]);ee!==0&&(K===void 0&&(K=ee<0),K===ee<0?(G&&V.push(G),G=[O[q]]):G&&G.push(O[q]))}return G&&V.push(G),V}(y),R=[];for(const O of M)R.push(O.map(S));C=R.length===1?{type:"Polygon",coordinates:R[0]}:{type:"MultiPolygon",coordinates:R}}}const I={type:"Feature",geometry:C,properties:this.properties};return this.id!=null&&(I.id=this.id),I}}function tE(o){let e=0;for(let i,l,d=0,p=o.length,m=p-1;d<p;m=d++)i=o[d],l=o[m],e+=(l.x-i.x)*(i.y+l.y);return e}Yc.types=["Unknown","Point","LineString","Polygon"];class _1{constructor(e,i){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],i===void 0&&(i=e.length);e.pos<i;){const l=e.readVarint();l===10?this.name=e.readString():l===18?(this._features.push(e.pos),e.skip(l)):l===26?this._keys.push(e.readString()):l===34?this._values.push(nE(e)):l===40?this.extent=e.readVarint():l===120?this.version=e.readVarint():e.skip(l)}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 Yc(this._pbf,i,this.extent,this._keys,this._values)}}function nE(o){let e=null;const i=o.readVarint()+o.pos;for(;o.pos<i;){const l=o.readVarint();e=l===10?o.readString():l===21?o.readFloat():l===25?o.readDouble():l===32?o.readVarint(!0):l===40?o.readVarint():l===48?o.readSVarint():l===56?o.readBoolean():(o.skip(l),null)}if(e==null)throw new Error("unknown feature value");return e}class Rv{constructor(e,i=e.length){const l=Object.create(null);for(;e.pos<i;){const d=e.readVarint();if(d===26){const p=new _1(e,e.readVarint()+e.pos);p.length&&(l[p.name]=p)}else e.skip(d)}this.layers=l}}function Lv(o,e){for(let i=0;i<o.length;i++)if(Qc(e,o[i]))return!0;for(let i=0;i<e.length;i++)if(Qc(o,e[i]))return!0;return!!ug(o,e)}function rE(o,e,i){return!!Qc(o,e)||!!cp(e,o,i)}function Ov(o,e){if(o.length===1)return y1(e,o[0]);for(let i=0;i<e.length;i++){const l=e[i];for(let d=0;d<l.length;d++)if(Qc(o,l[d]))return!0}for(let i=0;i<o.length;i++)if(y1(e,o[i]))return!0;for(let i=0;i<e.length;i++)if(ug(o,e[i]))return!0;return!1}function iE(o,e,i){if(o.length>1){if(ug(o,e))return!0;for(let l=0;l<e.length;l++)if(cp(e[l],o,i))return!0}for(let l=0;l<o.length;l++)if(cp(o[l],e,i))return!0;return!1}function ug(o,e){if(o.length===0||e.length===0)return!1;for(let i=0;i<o.length-1;i++){const l=o[i],d=o[i+1];for(let p=0;p<e.length-1;p++)if(Fv(l,d,e[p],e[p+1]))return!0}return!1}function Fv(o,e,i,l){return ci(o,i,l)!==ci(e,i,l)&&ci(o,e,i)!==ci(o,e,l)}function zv(o,e,i){return(o.x-i.x)*(e.y-i.y)-(o.y-i.y)*(e.x-i.x)}function Dl(o,e,i,l){const d=zv(o,e,l),p=zv(o,e,i);if(Math.sign(d)===Math.sign(p))return;const m=zv(i,l,o),y=m+p-d;return Math.sign(m)!==Math.sign(y)?[m/(m-y),p/(p-d)]:void 0}function cp(o,e,i){const l=i*i;if(e.length===1)return o.distSqr(e[0])<l;for(let d=1;d<e.length;d++)if(Zu(o,e[d-1],e[d])<l)return!0;return!1}function Zu(o,e,i){const l=e.distSqr(i);if(l===0)return o.distSqr(e);const d=((o.x-e.x)*(i.x-e.x)+(o.y-e.y)*(i.y-e.y))/l;return o.distSqr(d<0?e:d>1?i:i.sub(e)._mult(d)._add(e))}function y1(o,e){let i,l,d,p=!1;for(let m=0;m<o.length;m++){i=o[m];for(let y=0,b=i.length-1;y<i.length;b=y++)l=i[y],d=i[b],l.y>e.y!=d.y>e.y&&e.x<(d.x-l.x)*(e.y-l.y)/(d.y-l.y)+l.x&&(p=!p)}return p}function Qc(o,e){let i=!1;for(let l=0,d=o.length-1;l<o.length;d=l++){const p=o[l],m=o[d];p.y>e.y!=m.y>e.y&&e.x<(m.x-p.x)*(e.y-p.y)/(m.y-p.y)+p.x&&(i=!i)}return i}function v1(o,e,i,l,d){for(const m of o)if(e<=m.x&&i<=m.y&&l>=m.x&&d>=m.y)return!0;const p=[new et(e,i),new et(e,d),new et(l,d),new et(l,i)];if(o.length>2){for(const m of p)if(Qc(o,m))return!0}for(let m=0;m<o.length-1;m++)if(rh(o[m],o[m+1],p))return!0;return!1}function rh(o,e,i){const l=i[0],d=i[2];if(o.x<l.x&&e.x<l.x||o.x>d.x&&e.x>d.x||o.y<l.y&&e.y<l.y||o.y>d.y&&e.y>d.y)return!1;const p=ci(o,e,i[0]);return p!==ci(o,e,i[1])||p!==ci(o,e,i[2])||p!==ci(o,e,i[3])}function ih(o,e,i,l,d,p){let m=e.y-o.y,y=o.x-e.x;if(p=p||0){const b=m*m+y*y;if(b===0)return!0;const S=Math.sqrt(b);m/=S,y/=S}return!((i.x-o.x)*m+(i.y-o.y)*y-p<0||(l.x-o.x)*m+(l.y-o.y)*y-p<0||(d.x-o.x)*m+(d.y-o.y)*y-p<0)}function dg(o,e,i,l,d,p,m){return!(ih(o,e,l,d,p,m)||ih(e,i,l,d,p,m)||ih(i,o,l,d,p,m)||ih(l,d,o,e,i,m)||ih(d,p,o,e,i,m)||ih(p,l,o,e,i,m))}class rc extends et{constructor(e,i,l){super(e,i),this.z=l}}class Bv extends rc{constructor(e,i,l,d){super(e,i,l),this.w=d}}function oE(o,e,i,l){const d=i==="x"?"y":"x",p=(l-o[i])/(e[i]-o[i]);o[d]=Math.round(o[d]+(e[d]-o[d])*p),o[i]=l,Object.hasOwn(o,"z")&&(o.z=Jt(o.z,e.z,p)),Object.hasOwn(o,"w")&&(o.w=Jt(o.w,e.w,p))}function u(o,e,i,l){const d=i,p=l;for(const m of["x","y"]){let y=o,b=e;y[m]>=b[m]&&(y=e,b=o),y[m]<d&&b[m]>d&&oE(y,b,m,d),y[m]<p&&b[m]>p&&oE(b,y,m,p)}}function r(o,e,i,l,d,p){const m=[];for(let y=0;y<o.length;y++){const b=o[y];let S;const C=m.length;let I=0;for(let M=0;M<b.length-1;M++){let R=b[M],O=b[M+1],N=0;const V=I;let G,K;p&&(N=Math.hypot(O.x-R.x,O.y-R.y),I+=N,G=R,K=O),R.x<e&&O.x<e||(R.x<e?R=new et(e,R.y+(e-R.x)/(O.x-R.x)*(O.y-R.y))._round():O.x<e&&(O=new et(e,R.y+(e-R.x)/(O.x-R.x)*(O.y-R.y))._round()),R.y<i&&O.y<i||(R.y<i?R=new et(R.x+(i-R.y)/(O.y-R.y)*(O.x-R.x),i)._round():O.y<i&&(O=new et(R.x+(i-R.y)/(O.y-R.y)*(O.x-R.x),i)._round()),R.x>=l&&O.x>=l||(R.x>=l?R=new et(l,R.y+(l-R.x)/(O.x-R.x)*(O.y-R.y))._round():O.x>=l&&(O=new et(l,R.y+(l-R.x)/(O.x-R.x)*(O.y-R.y))._round()),R.y>=d&&O.y>=d||(R.y>=d?R=new et(R.x+(d-R.y)/(O.y-R.y)*(O.x-R.x),d)._round():O.y>=d&&(O=new et(R.x+(d-R.y)/(O.y-R.y)*(O.x-R.x),d)._round()),S&&R.equals(S.at(-1))||(S=[R],m.push(S),p&&p.push({progress:{min:V+f(G,K,R)*N,max:1},parentIndex:y,prevPoint:G,nextPoint:K})),S.push(O),p&&(p.at(-1).progress.max=V+f(G,K,O)*N,p.at(-1).nextPoint=K)))))}if(p&&I>0)for(let M=C;M<m.length;M++)p[M].progress.min/=I,p[M].progress.max/=I}return m}function a(o,e,i,l,d){if(o.length<2)return void l.push(o);const p=[];for(;e.valid();){const[S,C]=e.get();for(let I=0;I<o.length-1;I++){const M=o[I],R=o[I+1],O=Dl(M,R,S,C);if(O){const[N]=O,V=new et(Jt(M.x,R.x,N),Jt(M.y,R.y,N));p.push({t:I+N,distance:0,point:V})}}e.next()}if(p.length===0)return void l.push(o);p.sort((S,C)=>S.t-C.t);let m=0,y=0,b=[];for(l.push(b);m!==o.length;){if(y===p.length){for(;m!==o.length;)b.length!==0&&b.at(-1).equals(o[m])||b.push(o[m]),m++;break}p[y].t<=m?(b.length!==0&&b.at(-1).equals(p[y].point)||b.push(p[y].point),Math.trunc(p[y].t),y++):(b.length!==0&&b.at(-1).equals(o[m])||b.push(o[m]),m++)}}function f(o,e,i){return o.x!==e.x?(i.x-o.x)/(e.x-o.x):o.y!==e.y?(i.y-o.y)/(e.y-o.y):0}function _(o,{width:e,height:i},l,d){if(d){if(d instanceof Uint8ClampedArray)d=new Uint8Array(d.buffer);else if(d.length!==e*i*l)throw new RangeError("mismatched image size")}else d=new Uint8Array(e*i*l);return o.width=e,o.height=i,o.data=d,o}function x(o,e,i){const{width:l,height:d}=e;l===o.width&&d===o.height||(w(o,e,{x:0,y:0},{x:0,y:0},{width:Math.min(o.width,l),height:Math.min(o.height,d)},i,null),o.width=l,o.height=d,o.data=e.data)}function w(o,e,i,l,d,p,m,y){if(d.width===0||d.height===0)return e;if(d.width>o.width||d.height>o.height||i.x>o.width-d.width||i.y>o.height-d.height)throw new RangeError("out of range source coordinates for image copy");if(d.width>e.width||d.height>e.height||l.x>e.width-d.width||l.y>e.height-d.height)throw new RangeError("out of range destination coordinates for image copy");const b=o.data,S=e.data,C=p===4&&y;for(let I=0;I<d.height;I++){const M=((i.y+I)*o.width+i.x)*p,R=((l.y+I)*e.width+l.x)*p;if(C)for(let O=0;O<d.width;O++){const N=M+O*p+3,V=R+O*p;S[V+0]=255,S[V+1]=255,S[V+2]=255,S[V+3]=b[N]}else if(m)for(let O=0;O<d.width;O++){const N=M+O*p,V=R+O*p,G=new qn(b[N+0]/255,b[N+1]/255,b[N+2]/255,b[N+3]).toNonPremultipliedRenderColor(m).toArray();S[V+0]=G[0],S[V+1]=G[1],S[V+2]=G[2],S[V+3]=G[3]}else for(let O=0;O<d.width*p;O++)S[R+O]=b[M+O]}return e}class k{constructor(e,i){_(this,e,1,i)}resize(e){x(this,new k(e),1)}clone(){return new k({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,l,d,p){w(e,i,l,d,p,1,null)}}class A{constructor(e,i){_(this,e,4,i)}resize(e){x(this,new A(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new A({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,l,d,p,m,y){w(e,i,l,d,p,4,m,y)}}class P{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}Mt(k,"AlphaImage"),Mt(A,"RGBAImage");class D{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new k({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const l=this.getKey(e,i);return this.positions[l]}trim(){const e=this.width,i=this.height=hn(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,l){const d=[];let p=e.length%2==1?-e.at(-1)*l:0,m=e[0]*l,y=!0;d.push({left:p,right:m,isDash:y,zeroLength:e[0]===0});let b=e[0];for(let S=1;S<e.length;S++){y=!y;const C=e[S];p=b*l,b+=C,m=b*l,d.push({left:p,right:m,isDash:y,zeroLength:C===0})}return d}addRoundDash(e,i,l){const d=i/2;for(let p=-l;p<=l;p++){const m=this.width*(this.nextRow+l+p);let y=0,b=e[y];for(let S=0;S<this.width;S++){S/b.right>1&&(b=e[++y]);const C=Math.abs(S-b.left),I=Math.abs(S-b.right),M=Math.min(C,I);let R;const O=p/l*(d+1);if(b.isDash){const N=d-Math.abs(O);R=Math.sqrt(M*M+N*N)}else R=d-Math.sqrt(M*M+O*O);this.image.data[m+S]=Math.max(0,Math.min(255,R+128))}}}addRegularDash(e,i){for(let b=e.length-1;b>=0;--b){const S=e[b],C=e[b+1];S.zeroLength?e.splice(b,1):C&&C.isDash===S.isDash&&(C.left=S.left,e.splice(b,1))}const l=e[0],d=e.at(-1);l.isDash===d.isDash&&(l.left=d.left-this.width,d.right=l.right+this.width);const p=this.width*this.nextRow;let m=0,y=e[m];for(let b=0;b<this.width;b++){b/y.right>1&&(y=e[++m]);const S=Math.abs(b-y.left),C=Math.abs(b-y.right),I=Math.min(S,C);this.image.data[p+b]=Math.max(0,Math.min(255,(y.isDash?I:-I)+i+128))}}addDash(e,i){const l=this.getKey(e,i);if(this.positions[l])return this.positions[l];const d=i==="round",p=d?7:0,m=2*p+1;if(this.nextRow+m>this.height)return Cn("LineAtlas out of space"),null;e.length===0&&e.push(1);let y=0;for(let I=0;I<e.length;I++)e[I]<0&&(Cn("Negative value is found in line dasharray, replacing values with 0"),e[I]=0),y+=e[I];if(y!==0){const I=this.width/y,M=this.getDashRanges(e,this.width,I);d?this.addRoundDash(M,I,p):this.addRegularDash(M,i==="square"?.5*I:0)}const b=this.nextRow+p;this.nextRow+=m;const S=Math.floor(y),C={tl:[b,p],br:[S,Math.round(65535*(y-S))]};return this.positions[l]=C,C}}Mt(D,"LineAtlas");const z="3d_elevation_id",F="level",j=Yc.types,$=Math.cos(Math.PI/180*37.5),W=Math.cos(Math.PI/180*5);class J{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,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 yv,this.layoutVertexArray2=new Ca,this.patternVertexArray=new Ca,this.indexArray=new _i,this.programConfigurations=new Ya(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new pr,this.sourceLayerName=e.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new nc,this.elevationIdColVertexArray=new Ca,this.elevationGroundScaleVertexArray=new Xa,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,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){this.showElevationIdDebug=i.showElevationIdDebug,this.hasPattern=uv("line",this.layers,this.pixelRatio,i);const p=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Qs(l);const m=this.layers[0].layout.get("line-elevation-reference");if(m==="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=m!=="sea"&&m!=="ground"&&R?"none":"offset",this.elevationType==="offset"&&m==="none"&&Cn(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference=m==="sea"}const y=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&y!==void 0;const b=[];for(const{feature:M,id:R,index:O,sourceLayerIndex:N}of e){const V=this.layers[0]._featureFilter.needGeometry,G=Ls(M,V);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),G,l))continue;const K=p?p.evaluate(G,{},l):void 0,q={id:R,properties:M.properties,type:M.type,sourceLayerIndex:N,index:O,geometry:V?G.geometry:Js(M,l,d),patterns:{},sortKey:K};b.push(q)}p&&b.sort((M,R)=>M.sortKey-R.sortKey);const{lineAtlas:S,featureIndex:C}=i,I=this.addConstantDashes(S);for(const M of b){const{geometry:R,index:O,sourceLayerIndex:N}=M;if(I&&this.addFeatureDashes(M,S),this.hasPattern){const V=Km("line",this.layers,M,this.zoom,this.pixelRatio,i);this.patternFeatures.push(V)}else this.addFeature(M,R,O,l,S.positions,i.availableImages,i.brightness,i.elevationFeatures);C.insert(e[O].feature,R,O,N,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}addConstantDashes(e){let i=!1;for(const l of this.layers){const d=l.paint.get("line-dasharray").value,p=l.layout.get("line-cap").value;if(d.kind!=="constant"||p.kind!=="constant")i=!0;else{const m=p.value,y=d.value;if(!y)continue;e.addDash(y,m)}}return i}addFeatureDashes(e,i){const l=this.zoom;for(const d of this.layers){const p=d.paint.get("line-dasharray").value,m=d.layout.get("line-cap").value;if(p.kind==="constant"&&m.kind==="constant")continue;let y,b;if(p.kind==="constant"){if(y=p.value,!y)continue}else y=p.evaluate({zoom:l},e);b=m.kind==="constant"?m.value:m.evaluate({zoom:l},e),i.addDash(y,b),e.patterns[d.id]=[i.getKey(y,b)]}}update(e,i,l,d,p,m,y,b,S){this.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y,S)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,i,l,d,p,m){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,i,l,d,m,e.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}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,p1)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,g1)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,cg.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,Q2.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,f1.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,J2),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,i){let l,d;if(i&&i>0?(l=`mapbox_clip_start_${i}`,d=`mapbox_clip_end_${i}`):(l="mapbox_clip_start",d="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,l)&&Object.hasOwn(e.properties,d))return{start:+e.properties[l],end:+e.properties[d]}}addFeature(e,i,l,d,p,m,y,b){const S=this.layers[0].layout,C=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,I=this.indexArray.length,M=S.get("line-join").evaluate(e,{}),R=S.get("line-cap").evaluate(e,{}),O=S.get("line-miter-limit"),N=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const V=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=S.get("line-z-offset").value;const G=this.layers[0].paint,K=G.get("line-width").value;K.kind!=="constant"&&K.isLineProgressConstant===!1&&(this.variableWidthValue=K);const q=G.get("line-emissive-strength").value;if(q.kind!=="constant"&&q.isLineProgressConstant===!1&&(this.variableEmissiveStrengthValue=q),this.isSeaLevelReference){const ee=S.get("line-elevation-ground-scale").value;ee.kind==="constant"&&ee.value===0||(this.elevationGroundScaleValue=ee)}if(this.hdExt==null||!this.hdExt.handleFeature(e,i,d,b,M,R,O,N,this))for(let ee=0;ee<i.length;ee++)this.addLine(i[ee],e,d,M,R,O,N,void 0,V&&ee>0?ee:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,l,p,m,d,y,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,I,this.indexArray.length,C)}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}addLine(e,i,l,d,p,m,y,b,S){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=S?this.lineFeatureClips(i,S):this.lineClips;const C=d==="none";this.patternJoinNone=this.hasPattern&&C,this.currentLineJoinType=d,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const I=b&&b.progress.min>0,M=b&&b.progress.max<1;if(this.lineClips){let ve={min:this.lineClips.start,max:this.lineClips.end},Se=1;if(b){const Ve=this.lineClips.end-this.lineClips.start;ve=function(qe,Ke,je){return{min:Ps(qe.min,Ke,je),max:Ps(qe.max,Ke,je)}}(b.progress,{min:0,max:1},ve),Ve>0&&(Se=(ve.max-ve.min)/Ve)}const we=+i.properties.mapbox_clip_feature_len,Fe=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(we)||Number.isNaN(Fe)){for(let qe=0;qe<e.length-1;qe++)this.totalDistance+=e[qe].dist(e[qe+1]);const Ve=this.totalDistance/(ve.max-ve.min);this.totalFeatureLength=Number.isFinite(Ve)?Ve:0,this.lineClips.start=ve.min,this.lineClips.end=ve.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=we,this.distance=Fe*Se,this.lineClips.start=ve.min,this.lineClips.end=ve.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const R=j[i.type]==="Polygon";let O=e.length;for(;O>=2&&e[O-1].equals(e[O-2]);)O--;let N=0;for(;N<O-1&&e[N].equals(e[N+1]);)N++;if(O<(R?3:2))return;d==="bevel"&&(m=1.05);const V=this.segments.prepareSegment(10*O,this.layoutVertexArray,this.indexArray);let G,K,q,ee,te,le,xe,de;b&&b.prevDir&&(le=b.prevDir.perp()),b&&b.nextDir&&(xe=b.nextDir.perp()),this.e1=this.e2=-1,R&&(G=e[O-2],te=e[N].sub(G)._unit()._perp());for(let ve=N;ve<O;ve++){if(q=ve===O-1?R?e[N+1]:void 0:e[ve+1],q&&e[ve].equals(q))continue;te&&(ee=te),G&&(K=G),G=e[ve],de=this.evaluateLineProgressFeatures(K?K.dist(G):0),te=q?q.sub(G)._unit()._perp():ee,ee=ee||te;const Se=K&&q;let we=Se?d:R||C?"butt":p;const Fe=ee.x*te.x+ee.y*te.y;if(C){const Ye=function(rt){if(rt.patternJoinNone){const lt=rt.segmentPoints.length/2,yt=rt.lineSoFar-rt.segmentStart;for(let tt=0;tt<lt;++tt){const mt=rt.segmentPoints[2*tt+1],bt=Math.round(rt.segmentPoints[2*tt])+.5+.25*mt;rt.patternVertexArray.emplaceBack(bt,yt,rt.segmentStart),rt.patternVertexArray.emplaceBack(bt,yt,rt.segmentStart)}rt.segmentPoints.length=0}rt.e1=rt.e2=-1};if(Se&&Fe<W){this.updateDistance(K,G),this.addCurrentVertex(G,ee,1,1,V,de),Ye(this),this.addCurrentVertex(G,te,-1,-1,V,de);continue}if(K){if(!q){this.updateDistance(K,G),this.addCurrentVertex(G,ee,1,1,V,de),Ye(this);continue}we="miter"}}let Ve=ee.add(te);Ve.x===0&&Ve.y===0||Ve._unit();const qe=Ve.x*te.x+Ve.y*te.y,Ke=qe!==0?1/qe:1/0,je=2*Math.sqrt(2-2*qe),at=qe<$&&K&&q,Ge=ee.x*te.y-ee.y*te.x>0,$e=this.overscaling<=16?122880/(512*this.overscaling):0;if(Se&&we==="round"){if(Ke<y)we="miter";else if(Ke<=2){const Ye=Q(G,-10,8202);we=this.elevationType==="offset"&&(Ye||this.hasCrossSlope)?"miter":"fakeround"}}if(we==="miter"&&Ke>m&&(we="bevel"),we==="bevel"&&(Ke>2&&(we="flipbevel"),Ke<m&&(we="miter")),K&&!(we==="miter"&&at)&&this.updateDistance(K,G),we==="miter")if(at){const Ye=G.dist(K);if(Ye>2*$e){const lt=G.sub(G.sub(K)._mult($e/Ye)._round());this.updateDistance(K,lt),this.addCurrentVertex(lt,ee,0,0,V,de),K=lt}this.updateDistance(K,G),Ve._mult(Ke),this.addCurrentVertex(G,Ve,0,0,V,de);const rt=G.dist(q);if(rt>2*$e){const lt=G.add(q.sub(G)._mult($e/rt)._round());this.updateDistance(G,lt),this.addCurrentVertex(lt,te,0,0,V,de),G=lt}}else Ve._mult(Ke),this.addCurrentVertex(G,Ve,0,0,V,de);else if(we==="flipbevel"){if(Ke>100)Ve=te.mult(-1);else{const Ye=Ke*ee.add(te).mag()/ee.sub(te).mag();Ve._perp()._mult(Ye*(Ge?-1:1))}this.addCurrentVertex(G,Ve,0,0,V,de),this.addCurrentVertex(G,Ve.mult(-1),0,0,V,de)}else if(we==="bevel"||we==="fakeround"){const Ye=G.dist(K);let rt=1;if(this.elevationType==="offset"&&we==="bevel"&&this.currentLineJoinType!=="round"&&!this.patternJoinNone&&de!=null&&K&&q){const Ft=4*$e;Ye<Ft&&(rt=Math.max(0,Ye/Ft))}de!=null&&K&&this.addCurrentVertex(G,xe||ee,-rt,-rt,V,de);const lt=Ye<=2*$e&&we!=="bevel",yt=Ve.mult(Ge?1:-1);yt._mult(Ke);const tt=te.mult(Ge?-1:1),mt=ee.mult(Ge?-1:1),bt=this.evaluateLineProgressFeatures(this.distance);if(de==null&&(this.addHalfVertex(G,yt.x,yt.y,!1,!Ge,0,V,bt),lt||this.addHalfVertex(G,yt.x+2*mt.x,yt.y+2*mt.y,!1,Ge,0,V,bt)),we==="fakeround"){const Ft=Math.round(180*je/Math.PI/20);this.addHalfVertex(G,mt.x,mt.y,!1,Ge,0,V,bt);for(let Rt=0;Rt<Ft;Rt++){let Wt=Rt/Ft;if(Wt!==.5){const en=Wt-.5;Wt+=Wt*en*(Wt-1)*((1.0904+Fe*(Fe*(3.55645-1.43519*Fe)-3.2452))*en*en+(.848013+Fe*(.215638*Fe-1.06021)))}const ln=tt.sub(mt)._mult(Wt)._add(mt)._unit();this.addHalfVertex(G,ln.x,ln.y,!1,Ge,0,V,bt)}this.addHalfVertex(G,tt.x,tt.y,!1,Ge,0,V,bt)}lt||de!=null||this.addHalfVertex(G,yt.x+2*tt.x,yt.y+2*tt.y,!1,Ge,0,V,bt),de!=null&&q&&this.addCurrentVertex(G,le||te,rt,rt,V,de)}else if(we==="butt")this.addCurrentVertex(G,Ve,0,0,V,de);else if(we==="square"){if(!K){const Ye=I?0:-1;this.addCurrentVertex(G,Ve,Ye,Ye,V,de)}if(this.addCurrentVertex(G,Ve,0,0,V,de),K){const Ye=M?0:1;this.addCurrentVertex(G,Ve,Ye,Ye,V,de)}}else if(we==="round"){if(K){const Ye=!Se&&xe?xe:ee;this.addCurrentVertex(G,Ye,0,0,V,de),!Se&&M||this.addCurrentVertex(G,Ye,1,1,V,de,!0)}if(q){const Ye=!Se&&le?le:te;!Se&&I||this.addCurrentVertex(G,Ye,-1,-1,V,de,!0),this.addCurrentVertex(G,Ye,0,0,V,de)}}}}addVerticesTo(e,i,l,d,p,m,y,b,S,C){const I=(i.w-e.w)/this.tessellationStep|0;let M=0;const R=this.scaledDistance;if(I>1){this.lineSoFar=e.w;const N=(i.x-e.x)/I,V=(i.y-e.y)/I,G=(i.z-e.z)/I,K=(i.w-e.w)/I,q=i.x-e.x,ee=i.y-e.y,te=Math.sqrt(q*q+ee*ee);if(te===0)return;const le=-ee/te,xe=q/te,de=le,ve=xe,Se=-le,we=-xe;for(let Fe=1;Fe<I;++Fe){e.x+=N,e.y+=V,e.z+=G,this.lineSoFar+=K,M+=K;const Ve=this.evaluateLineProgressFeatures(this.prevDistance+M);this.scaledDistance=(this.prevDistance+M)/this.totalDistance,this.addHalfVertex(e,de,ve,C,!1,0,S,Ve),this.addHalfVertex(e,Se,we,C,!0,0,S,Ve)}}this.lineSoFar=i.w,this.scaledDistance=R;const O=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,l,d,C,!1,y,S,O),this.addHalfVertex(i,p,m,C,!0,-b,S,O)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.variableEmissiveStrengthValue&&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):Cn(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,i*=.5);let l=0;this.variableEmissiveStrengthValue&&this.variableEmissiveStrengthValue.kind!=="constant"&&(l=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const d=this.evaluateElevationGroundScale();return this.elevationType!=="offset"?{zOffset:0,variableWidth:i,elevationGroundScale:d,variableEmissiveStrength:l}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i,elevationGroundScale:d,variableEmissiveStrength:l}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i,elevationGroundScale:d,variableEmissiveStrength:l}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?this.elevationGroundScaleValue.kind==="constant"?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,i,l,d,p,m,y=!1){const b=i.x+i.y*l,S=i.y-i.x*l,C=i.y*d-i.x,I=-i.y-i.x*d;if(m!=null){const M=this.elevationType==="offset",R=this.elevationType==="offset"?2:10,O=-R,N=St+R,V=m.zOffset,G=new Bv(e.x,e.y,V,this.lineSoFar),K=!!M&&Q(e,O,N),q=this.lineSoFar,ee=this.distance;if(this.currentVertex)if(K){const te=this.currentVertexIsOutside,le=this.currentVertex,xe=new Bv(e.x,e.y,V,this.lineSoFar);if(u(le,xe,O,N),!Q(xe,O,N)){if(te){this.e1=this.e2=-1,this.distance-=le.dist(G),this.lineSoFar=le.w;const de=this.evaluateLineProgressFeatures(le.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(le,b,S,y,!1,l,p,de),this.addHalfVertex(le,C,I,y,!0,-d,p,de),this.prevDistance=this.distance}this.distance=this.prevDistance+le.dist(xe),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(le,xe,b,S,C,I,l,d,p,y),this.distance=ee,this.scaledDistance=this.distance/this.totalDistance}}else{const te=this.currentVertex;if(this.currentVertexIsOutside){u(te,G,O,N),this.e1=this.e2=-1,this.distance-=te.dist(G),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=te.w;const le=this.evaluateLineProgressFeatures(te.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(te,b,S,y,!1,l,p,le),this.addHalfVertex(te,C,I,y,!0,-d,p,le),this.prevDistance=this.distance,this.distance=ee,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(te,G,b,S,C,I,l,d,p,y)}else K||(this.addHalfVertex(e,b,S,y,!1,l,p,m),this.addHalfVertex(e,C,I,y,!0,-d,p,m));this.currentVertex=G,this.currentVertexIsOutside=K,this.lineSoFar=q}else this.addHalfVertex(e,b,S,y,!1,l,p,m),this.addHalfVertex(e,C,I,y,!0,-d,p,m)}addHalfVertex({x:e,y:i},l,d,p,m,y,b,S){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),m||this.segmentPoints.push(this.lineSoFar-this.segmentStart,y)),this.layoutVertexArray.emplaceBack((e<<1)+(p?1:0),(i<<1)+(m?1:0),Math.round(63*l)+128,Math.round(63*d)+128,1+(y===0?0:y<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const I=Jt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,I)}const C=b.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,C),b.primitiveLength++),m?this.e2=C:this.e1=C,S!=null&&(this.zOffsetVertexArray.emplaceBack(S.zOffset,S.variableWidth,S.variableWidth,S.variableEmissiveStrength),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const I=S?S.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(I)}}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 Q(o,e,i){return o.x<e||o.x>i||o.y<e||o.y>i}Mt(J,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const ce=Sn([{name:"a_pos",components:2,type:"Int16"}],4),fe=Sn([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),se=Sn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ae{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 ea,this.indexArray=new _i,this.segments=new pr,this.programConfigurations=new Ya(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){const p=this.layers[0],m=[];let y=null;p.type==="circle"&&(y=p.layout.get("circle-sort-key"));for(const{feature:S,id:C,index:I,sourceLayerIndex:M}of e){const R=this.layers[0]._featureFilter.needGeometry,O=Ls(S,R);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),O,l))continue;const N=y?y.evaluate(O,{},l):void 0,V={id:C,properties:S.properties,type:S.type,sourceLayerIndex:M,index:I,geometry:R?O.geometry:Js(S,l,d),patterns:{},sortKey:N};m.push(V)}y&&m.sort((S,C)=>S.sortKey-C.sortKey);let b=null;d.projection.name==="globe"&&(this.globeExtVertexArray=new Jm,b=d.projection);for(const S of m){const{geometry:C,index:I,sourceLayerIndex:M}=S,R=e[I].feature;this.addFeature(S,C,I,i.availableImages,l,b,i.brightness,i.elevationFeatures),i.featureIndex.insert(R,C,I,M,this.index)}this.hdExt&&this.hdExt.finalize()}update(e,i,l,d,p,m,y){this.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ce.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,se.members)),this.hdExt&&this.hdExt.upload(e)),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.hdExt&&this.hdExt.destroy())}addFeature(e,i,l,d,p,m,y,b){this.hdExt&&this.hdExt.beginFeature(e,b);for(const S of i)for(const C of S){const I=C.x,M=C.y;if(I<0||I>=St||M<0||M>=St)continue;if(m){const N=m.projectTilePoint(I,M,p),V=m.upVector(p,I,M);this.addGlobeExtVertex(N,V),this.addGlobeExtVertex(N,V),this.addGlobeExtVertex(N,V),this.addGlobeExtVertex(N,V)}const R=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),O=R.vertexLength;this.addCircleVertex(I,M,-1,-1),this.addCircleVertex(I,M,1,-1),this.addCircleVertex(I,M,1,1),this.addCircleVertex(I,M,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(I,M),this.indexArray.emplaceBack(O,O+1,O+2),this.indexArray.emplaceBack(O,O+2,O+3),R.vertexLength+=4,R.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,l,{},d,p,y,void 0,this.worldview)}addCircleVertex(e,i,l,d){this.layoutVertexArray.emplaceBack(2*e+(l+1)/2,2*i+(d+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}Mt(Ae,"CircleBucket",{omit:["layers"]});const Ee=Sn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Pe=Sn([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),ye=Sn([{name:"a_projected_pos",components:4,type:"Float32"}],4);Sn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const be=Sn([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Ce=Sn([{name:"a_feature_index",components:1,type:"Float32"}],4),ze=Sn([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Oe=Sn([{name:"a_texb",components:2,type:"Uint16"}]),Ze=Sn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),We=Sn([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Sn([{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 ut=Sn([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ne=Sn([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Sn([{name:"triangle",components:3,type:"Uint16"}]),Sn([{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"}]),Sn([{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"}]),Sn([{type:"Float32",name:"offsetX"}]),Sn([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const Je=class Vg{static getBlockIndices(e){let i=Vg._blockIndicesTemplate;if(!i){i=Vg._blockIndicesTemplate=new Uint32Array(e);for(let l=0;l<e;l++)i[l]=l}return i}constructor(e,i,l,d){this.batchIndex=i,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=l,this.totalBytes=4*this.propsDwords,this.headerData=d,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,e&&this._initBuffers(e)}_initBuffers(e){const i=e.gl;if(this.totalBytes>e.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${e.maxUniformBlockSize}`);if(this.headerBuffer=i.createBuffer(),!this.headerBuffer)throw new Error("Failed to create header UBO buffer");if(i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferData(i.UNIFORM_BUFFER,Vg.HEADER_BYTES,i.DYNAMIC_DRAW),this.propertiesBuffer=i.createBuffer(),!this.propertiesBuffer)throw new Error("Failed to create properties UBO buffer");if(i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferData(i.UNIFORM_BUFFER,this.totalBytes,i.DYNAMIC_DRAW),this.blockIndicesBuffer=i.createBuffer(),!this.blockIndicesBuffer)throw new Error("Failed to create block-indices UBO buffer");i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferData(i.UNIFORM_BUFFER,this.totalBytes,i.DYNAMIC_DRAW),i.bindBuffer(i.UNIFORM_BUFFER,null)}writeDataDrivenBlock(e,i){const l=this.headerData,d=4*l[2];if(d===0)return;const p=i*d;if(p+d>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${i} exceeds propertiesData capacity`);const m=l[0],y=l[1];for(let S=0;S<9;S++)m&1<<S&&this._copyFromFlat(p+l[3+S],S,e,Vg.EVAL_FLAT_OFFSETS[S],y);(this._propsDirtyMin===-1||p<this._propsDirtyMin)&&(this._propsDirtyMin=p);const b=p+d;b>this._propsDirtyMax&&(this._propsDirtyMax=b)}rightSizeForTransfer(){const e=this._propsDirtyMax===-1?0:this._propsDirtyMax;e<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,e))}_copyFromFlat(e,i,l,d,p){const m=i===8,y=!!(p&1<<i),b=i<2||m&&y?4:m||y?2:1;for(let S=0;S<b;S++)this.propertiesData[e+S]=l[d+S]}upload(e){this.context||(this.context=e);const i=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e);let l=!1;if(this._headerDirty&&(i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,l=!0),this._propsDirtyMin!==-1){const d=this._propsDirtyMin,p=this._propsDirtyMax;i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,4*d,this.propertiesData,d,p-d),this._propsDirtyMin=-1,this._propsDirtyMax=-1,l=!0}this._blockIndicesDirty&&(i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,Vg.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,l=!0),l&&i.bindBuffer(i.UNIFORM_BUFFER,null)}bind(e,i){const l=e.gl,d=(m,y,b)=>{if(!y)return;const S=l.getUniformBlockIndex(i,m);S!==l.INVALID_INDEX&&(l.uniformBlockBinding(i,S,b),l.bindBufferBase(l.UNIFORM_BUFFER,b,y))},p=3*this.batchIndex;d("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,p),d("SymbolPaintPropertiesUniform",this.propertiesBuffer,p+1),d("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,p+2)}destroy(){if(this.context){const e=this.context.gl;this.headerBuffer&&(e.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(e.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(e.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};Je.HEADER_DWORDS=12,Je.HEADER_BYTES=48,Je.EVAL_FLAT_OFFSETS=[0,4,8,10,12,14,16,18,20],Je.EVAL_FLAT_TOTAL=24,Je._blockIndicesTemplate=null;let Be=Je;function it(o,e,i,l,d,p,m,y){return!!o&&(o.kind==="constant"?o.value==="none":o.evaluate({zoom:0,brightness:p,worldview:y},e,i,d,l,m)==="none")}function Qe(o){if(!(o instanceof Uc))return!1;const e=o.value;return(e.kind==="source"||e.kind==="composite")&&e.isStateDependent}Mt(Be,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});const ot=["icon","text"].map(o=>[`${o}-color`,`${o}-halo-color`,`${o}-opacity`,`${o}-halo-width`,`${o}-halo-blur`,`${o}-emissive-strength`,`${o}-occlusion-opacity`,"symbol-z-offset",`${o}-translate`]),Et=new Float32Array(Be.EVAL_FLAT_TOTAL),ht=[0,0];class gt{constructor(e,i,l,d,p="",m,y){this.layer=e,this.zoom=i,this.lut=l,this.isText=d,this.worldview=p,this.maxUniformBufferBindings=m||24,this.uboSizeDwords=y||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=null,this.sharedZoomRanges=new Float32Array(18),this.header=new Uint32Array(Be.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=this.header[0]===0;const b=4*this.header[2];this.maxFeaturesPerBatch=b===0?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/b)}updateHeader(){const e=this.layer.paint;let i=0,l=0,d=0,p=0,m=!0;const y=ot[+this.isText];for(let S=0;S<9;S++){const C=y[S],I=S<2,M=S===8,R=e.get(C),O=!(!R||typeof R.isConstant!="function"||R.isConstant()),N=this._appearancesHavePaintProperties(C),V=!(!R||!R.value||R.value.kind!=="composite");if(!O&&!N){const ee=this.layer._transitionablePaint._values[C];(ee&&ee.value&&ee.value.expression&&ee.value.expression.kind)==="camera"&&(d|=1<<S);continue}i|=1<<S,V&&(l|=1<<S);const G=R&&R.value;G&&G.isLightConstant===!1&&(m=!1);const K=I||M&&V,q=K?4:M||V?2:1;K&&p%4!=0?p=p+3&-4:M&&p%4==3&&p++,this.header[3+S]=p,p+=q,V&&R&&this._computeZoomRange(R,Math.floor(this.zoom),2*S)}const b=p===0?0:p+3&-4;this.header[0]=i,this.header[1]=l,this.header[2]=b/4,this.isLightConstant=m,this.cameraMask=d}evaluateAllProperties(e,i,l,d,p,m,y){const b={brightness:p,worldview:this.worldview},S={feature:e,featureState:i,canonical:l,availableImages:d,params:new Yn(this.zoom,b),paramsNext:new Yn(this.zoom+1,b),formattedSection:m,activeAppearance:y},C=this.header,I=ot[+this.isText];for(let M=0;M<9;M++){const R=I[M],O=M===8,N=!!(C[1]&1<<M),V=Be.EVAL_FLAT_OFFSETS[M];M<2?this._evaluateColorValue(R,N,S,V):O?this._evaluateTranslateValue(R,N,S,V):this._evaluateFloatValue(R,N,S,V)}return Et}_resolveProp(e,i){const l=e;return i&&i.hasPaintProperty(l)?i.paintProperties.get(l):this.layer.paint.get(e)}_evalAt(e,i,l){return e.property.evaluate(e.value,i,l.feature,l.featureState,l.canonical,l.availableImages,e.iconImageUseTheme,l.formattedSection)}_evaluateColorValue(e,i,l,d){const p=this._resolveProp(e,l.activeAppearance);if(!p)return Et[d]=0,Et[d+1]=0,Et[d+2]=0,void(Et[d+3]=1);const m=this._resolveProp(`${e}-use-theme`,l.activeAppearance),y=it(m&&typeof m!="string"?m.value:void 0,l.feature,l.featureState,l.availableImages,l.canonical,l.params.brightness,l.formattedSection,this.worldview)?null:this.lut,b=(p.isConstant()?p.constantOr(qn.transparent):this._evalAt(p,l.params,l)||qn.transparent).toNonPremultipliedRenderColor(y);if(Et[d]=Xc(255*b.r,255*b.g),Et[d+1]=Xc(255*b.b,255*b.a),i){const S=(this._evalAt(p,l.paramsNext,l)||qn.transparent).toNonPremultipliedRenderColor(y);Et[d+2]=Xc(255*S.r,255*S.g),Et[d+3]=Xc(255*S.b,255*S.a)}else Et[d+2]=0,Et[d+3]=0}_computeZoomRange(e,i,l){let d=0,p=1;const m=e&&e.value,y=m&&m.kind==="composite"?m.zoomStops:null;if(y&&y.length>0)if(m.interpolationType==null){d=p=1;for(const b of y)if(b>i&&b<i+1){d=p=b-i;break}}else y[0]>i&&y[0]<i+1&&(d=y[0]-i);this.sharedZoomRanges[l]=d,this.sharedZoomRanges[l+1]=p}_evaluateFloatValue(e,i,l,d){const p=e.endsWith("opacity")?1:0,m=this._resolveProp(e,l.activeAppearance),y=m?m.isConstant()?m.constantOr(p):this._evalAt(m,l.params,l):p;if(Et[d]=y??p,i){const b=this._evalAt(m,l.paramsNext,l);Et[d+1]=b??p}else Et[d+1]=0}_evaluateTranslateValue(e,i,l,d){const p=this._resolveProp(e,l.activeAppearance),m=p?typeof p.isConstant!="function"?p:p.isConstant()?p.constantOr(ht):this._evalAt(p,l.params,l):void 0;if(Et[d]=m?m[0]:0,Et[d+1]=m?m[1]:0,i){const y=this._evalAt(p,l.paramsNext,l);Et[d+2]=y?y[0]:0,Et[d+3]=y?y[1]:0}else Et[d+2]=0,Et[d+3]=0}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(i=>i.hasPaintProperty(e))}hasStateDependentPaint(e){const i=e.paint,l=ot[+this.isText];for(const d of l)if(Qe(i.get(d)))return!0;for(const d of e.getAppearances()||[])for(const p of l){const m=p;if(d.hasPaintProperty(m)&&Qe(d.paintProperties.get(m)))return!0}return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return this.maxFeaturesPerBatch===0?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(e,i){const l=this.isAllConstant?0:e;let d=Math.floor(l/this.maxFeaturesPerBatch),p=l%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(d)&&(d=0,p=0);const m=this.ubos[d];return!!m&&(m.writeDataDrivenBlock(i,p),!0)}_batchExceedsDeviceLimit(e){return 3*e+2>=this.maxUniformBufferBindings}_reevaluateAt(e,i,l,d,p,m){if(!i)return;const y=this.allFeatureVtIndices[e],b=i.feature(y);if(!b)return;const S=this.allFeatureIds[e],C=S!=null&&p[S]||{},I={type:b.type,id:S,properties:b.properties||{},geometry:[]},M=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(y):void 0,R=this.evaluateAllProperties(I,C,l,d,m,void 0,M);this._writeFeatureBlock(e,R)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let e=0;e<this.allFeatureVtIndices.length;e++){const i=this.allFeatureIds[e];if(i!=null){let p=this.featureVertexRangesFromId.get(i);p||this.featureVertexRangesFromId.set(i,p=[]),p.push(e)}const l=this.allFeatureVtIndices[e];let d=this.featureVertexRangesFromVtIndex.get(l);d||this.featureVertexRangesFromVtIndex.set(l,d=[]),d.push(e)}}}populateUBO(e,i,l,d,p,m){const y=e.id,b=this.header,S=this.evaluateAllProperties(e,{},l,d,p,m);let C,I;this.isAllConstant?(C=0,I=this.featureCount===0,I&&(this.featureCount=1)):(C=this.featureCount++,I=!0);let M=Math.floor(C/this.maxFeaturesPerBatch),R=C%this.maxFeaturesPerBatch;return I&&(this._batchExceedsDeviceLimit(M)?(Cn(`Too many symbol features: batch ${M} requires binding points up to ${3*M+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),M=0,R=0):(this.ubos[M]||(this.ubos[M]=new Be(null,M,this.uboSizeDwords,b)),this.ubos[M].writeDataDrivenBlock(S,R))),this.allFeatureVtIndices.push(i),this.allFeatureIds.push(y),R}updateFeatures(e,i,l,d,p,m,y){this.layer=i,this.cachedConstantUniforms=null,this._ensureRangeMaps();for(const b of e){const S=this.featureVertexRangesFromId.get(b);if(S)for(const C of S)this._reevaluateAt(C,l,d,p,m,y)}}updateDynamicExpressions(e,i,l,d,p,m){if(this.layer=e,this.cachedConstantUniforms=null,this.header[0]!==0)for(let y=0;y<this.allFeatureVtIndices.length;y++)this._reevaluateAt(y,i,l,d,p,m)}updateFeaturePaintForAppearance(e,i,l,d,p,m,y){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,y||null),this.header[0]===0))return!1;this._ensureRangeMaps();const b=this.featureVertexRangesFromVtIndex.get(e);if(!b)return!1;const S=this.evaluateAllProperties(i,l,d,p,m,void 0,y);let C=!1;for(const I of b)C=this._writeFeatureBlock(I,S)||C;return C}getConstantUniformValues(e,i){const l=this.header,d=!!this.cameraMask,p=!!l[1];if(this.cachedConstantUniforms&&this.cachedConstantBrightness===i&&(!d&&!p||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const m=this.layer.paint,y=d?new Yn(e,{brightness:i,worldview:this.worldview}):null,b={type:1,id:void 0,properties:{},geometry:[]},S=ot[+this.isText],C=O=>{const N=S[O],V=m.get(N);if(!V)return[0,0,0,1];const G=m.get(`${N}-use-theme`),K=it(G&&typeof G!="string"?G.value:void 0,b,{},[],void 0,i,void 0,this.worldview)?null:this.lut;return(this.cameraMask&1<<O&&y?V.property.evaluate(V.value,y,b,{},void 0,[])||qn.transparent:V.constantOr(qn.transparent)).toNonPremultipliedRenderColor(K).toArray01()},I=(O,N)=>{const V=m.get(S[O]);if(!V)return N;if(this.cameraMask&1<<O&&y){const G=V.property.evaluate(V.value,y,b,{},void 0,[]);return G??N}return V.constantOr(N)},M=new Float32Array(9);if(p){const O=e-Math.floor(e);for(let N=0;N<9;N++){if(!(l[1]&1<<N))continue;const V=this.sharedZoomRanges[2*N],G=this.sharedZoomRanges[2*N+1];M[N]=V===G?O>=V?1:0:Math.max(0,Math.min(1,(O-V)/(G-V)))}}const R={fill_np_color:C(0),halo_np_color:C(1),opacity:I(2,1),halo_width:I(3,0),halo_blur:I(4,0),emissive_strength:I(5,0),occlusion_opacity:I(6,1),z_offset:I(7,0),zoomFactors:M};return this.cachedConstantUniforms=R,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=i,R}finalize(){for(const e of this.ubos)e.rightSizeForTransfer()}upload(e){for(const i of this.ubos)i.upload(e)}bind(e,i,l=0){this.ubos[l]&&this.ubos[l].bind(e,i)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}Mt(gt,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});const ct=24;function Ht(o,e,i){return o.sections.forEach(l=>{l.text=function(d,p,m){const y=p.layout.get("text-transform").evaluate(m,{});return y==="uppercase"?d=d.toLocaleUpperCase():y==="lowercase"&&(d=d.toLocaleLowerCase()),qa.applyArabicShaping&&(d=qa.applyArabicShaping(d)),d}(l.text,e,i)}),o}const Ot={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Nt(o){return o==="︶"||o==="﹈"||o==="︸"||o==="﹄"||o==="﹂"||o==="︾"||o==="︼"||o==="︺"||o==="︘"||o==="﹀"||o==="︐"||o==="︓"||o==="︔"||o==="`"||o===" ̄"||o==="︑"||o==="︒"}function $t(o){return o==="︵"||o==="﹇"||o==="︷"||o==="﹃"||o==="﹁"||o==="︽"||o==="︻"||o==="︹"||o==="︗"||o==="︿"}const an=4294967296,nn=1/an,xn=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class En{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,i,l=this.length){let d;for(;d=this.nextField(l);)e(d,i,this);return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*an;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*an;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf,l=i[this.pos++];if(l<128)return l;let d,p=127&l;return d=i[this.pos++],p|=(127&d)<<7,d<128?p:(d=i[this.pos++],p|=(127&d)<<14,d<128?p:(d=i[this.pos++],p|=(127&d)<<21,d<128?p:(d=i[this.pos],p|=(15&d)<<28,function(m,y,b){const S=b.buf;let C,I;if(I=S[b.pos++],C=(112&I)>>4,I<128||(I=S[b.pos++],C|=(127&I)<<3,I<128)||(I=S[b.pos++],C|=(127&I)<<10,I<128)||(I=S[b.pos++],C|=(127&I)<<17,I<128)||(I=S[b.pos++],C|=(127&I)<<24,I<128)||(I=S[b.pos++],C|=(1&I)<<31,I<128))return qt(m,C,y);throw new Error("Expected varint not more than 10 bytes")}(p,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&xn?xn.decode(this.buf.subarray(i,e)):function(l,d,p){let m="",y=d;for(;y<p;){const b=l[y];let S,C,I,M=null,R=b>239?4:b>223?3:b>191?2:1;if(y+R>p)break;R===1?b<128&&(M=b):R===2?(S=l[y+1],(192&S)==128&&(M=(31&b)<<6|63&S,M<=127&&(M=null))):R===3?(S=l[y+1],C=l[y+2],(192&S)==128&&(192&C)==128&&(M=(15&b)<<12|(63&S)<<6|63&C,(M<=2047||M>=55296&&M<=57343)&&(M=null))):R===4&&(S=l[y+1],C=l[y+2],I=l[y+3],(192&S)==128&&(192&C)==128&&(192&I)==128&&(M=(15&b)<<18|(63&S)<<12|(63&C)<<6|63&I,(M<=65535||M>=1114112)&&(M=null))),M===null?(M=65533,R=1):M>65535&&(M-=65536,m+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),m+=String.fromCharCode(M),y+=R}return m}(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const l=this.readPackedEnd();for(;this.pos<l;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const i=this.readVarint();return this.type=7&i,this._valueStart=this.pos,i>>>3}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}}function qt(o,e,i){return i?4294967296*e+(o>>>0):4294967296*(e>>>0)+(o>>>0)}function fn(o,e,i){const l=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(l),i.buf.copyWithin(o+l,o,i.pos)}function un(o,e){for(let i=0;i<o.length;i++)e.writeVarint(o[i])}function Dn(o,e){for(let i=0;i<o.length;i++)e.writeSVarint(o[i])}function Jn(o,e){for(let i=0;i<o.length;i++)e.writeFloat(o[i])}function Mr(o,e){for(let i=0;i<o.length;i++)e.writeDouble(o[i])}function Hn(o,e){for(let i=0;i<o.length;i++)e.writeBoolean(o[i])}function Wn(o,e){for(let i=0;i<o.length;i++)e.writeFixed32(o[i])}function Fr(o,e){for(let i=0;i<o.length;i++)e.writeSFixed32(o[i])}function or(o,e){for(let i=0;i<o.length;i++)e.writeFixed64(o[i])}function ri(o,e){for(let i=0;i<o.length;i++)e.writeSFixed64(o[i])}function Pn(o,e,i){let l;for(;l=o.nextField(e);)l===3?i.glyphs.push(Rn(o,o.readVarint()+o.pos)):l===4?i.ascender=o.readSVarint():l===5&&(i.descender=o.readSVarint())}function Rn(o,e){let i,l,d=0,p=0,m=0,y=0,b=0,S=0;for(;l=o.nextField(e);)l===1?d=o.readVarint():l===2?i=o.readBytes():l===3?p=o.readVarint():l===4?m=o.readVarint():l===5?y=o.readSVarint():l===6?b=o.readSVarint():l===7&&(S=o.readVarint());return{id:d,bitmap:new k({width:p+6,height:m+6},i),metrics:{width:p,height:m,left:y,top:b,advance:S}}}const Kt={horizontal:1,vertical:2,horizontalOnly:3};class lr{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const l=new lr;return l.scale=e||1,l.fontStack=i,l}static forImage(e){const i=new lr;return i.image=e,i}}class nr{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,l,d=1){const p=new nr;for(let m=0;m<e.sections.length;m++){const y=e.sections[m];y.image?p.addImageSection(y,l,d):p.addTextSection(y,i)}return p}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,l){let d="";for(let p=0;p<i.length;p++){const m=i.charCodeAt(p+1)||null,y=i.charCodeAt(p-1)||null;d+=!l&&(m&&Ob(m)&&!Ot[i[p+1]]||y&&Ob(y)&&!Ot[i[p-1]])||!Ot[i[p]]?i[p]:Ot[i[p]]}return d}(this.text,e)}trim(){let e=0;for(let l=0;l<this.text.length&&Lr[this.text.charCodeAt(l)];l++)e++;let i=this.text.length;for(let l=this.text.length-1;l>=0&&l>=e&&Lr[this.text.charCodeAt(l)];l--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const l=new nr;return l.text=this.text.substring(e,i),l.sectionIndex=this.sectionIndex.slice(e,i),l.sections=this.sections,l}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(lr.forText(e.scale,e.fontStack||i));const l=this.sections.length-1;for(let d=0;d<e.text.length;++d)this.sectionIndex.push(l)}addImageSection(e,i,l=1){const d=e.image?e.image.getPrimary():null;if(!d)return void Cn("Can't add FormattedSection with an empty image.");d.scaleSelf(i*l);const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCodePoint(p),this.sections.push(lr.forImage(d)),this.sectionIndex.push(this.sections.length-1)):Cn("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function si(o,e,i,l,d,p,m,y,b,S,C,I,M,R,O,N=1,V=1){const G=nr.fromFeature(o,d,N,V);I===Kt.vertical&&G.verticalizePunctuation(M);let K=[];const q=function(de,ve,Se,we,Fe,Ve,qe=1){if(!de)return[];const Ke=[],je=function($e,Ye,rt,lt,yt,tt,mt=1){let bt=0;for(let Ft=0;Ft<$e.length();Ft++){const Rt=$e.getSection(Ft);bt+=yo($e.getCodePoint(Ft),Rt,lt,yt,Ye,tt,mt)}return bt/Math.max(1,Math.ceil(bt/rt))}(de,ve,Se,we,Fe,Ve,qe),at=de.text.includes("");let Ge=0;for(let $e=0;$e<de.length();$e++){const Ye=de.getSection($e),rt=de.getCodePoint($e);if(Lr[rt]||(Ge+=yo(rt,Ye,we,Fe,ve,Ve,qe)),$e<de.length()-1){const lt=k2(rt);(co[rt]||lt||Ye.image)&&Ke.push(zr($e+1,Ge,je,Ke,sr(rt,de.getCodePoint($e+1),lt&&at),!1))}}return Ei(zr(de.length(),Ge,je,Ke,0,!0))}(G,S,p,e,l,R,V),{processBidirectionalText:ee,processStyledBidirectionalText:te}=qa;if(ee&&G.sections.length===1){const de=ee(G.toString(),q);for(const ve of de){const Se=new nr;Se.text=ve,Se.sections=G.sections;for(let we=0;we<ve.length;we++)Se.sectionIndex.push(0);K.push(Se)}}else if(te){const de=te(G.text,G.sectionIndex,q);for(const ve of de){const Se=new nr;Se.text=ve[0],Se.sectionIndex=ve[1],Se.sections=G.sections,K.push(Se)}}else K=function(de,ve){const Se=[],we=de.text;let Fe=0;for(const Ve of ve)Se.push(de.substring(Fe,Ve)),Fe=Ve;return Fe<we.length&&Se.push(de.substring(Fe,we.length)),Se}(G,q);const le=[],xe={positionedLines:le,text:G.toString(),top:C[1],bottom:C[1],left:C[0],right:C[0],writingMode:I,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(de,ve,Se,we,Fe,Ve,qe,Ke,je,at,Ge,$e,Ye=1){let rt=0,lt=0,yt=0;const tt=Ke==="right"?1:Ke==="left"?0:.5;let mt=!1;for(const ln of Fe){const en=ln.getSections();for(const gn of en){if(gn.image)continue;const cn=ve[gn.fontStack];if(cn&&(mt=cn.ascender!==void 0&&cn.descender!==void 0,!mt))break}if(!mt)break}let bt=0;for(const ln of Fe){ln.trim();const en=ln.getMaxScale(),gn=(en-1)*ct,cn={positionedGlyphs:[],lineOffset:0};de.positionedLines[bt]=cn;const Gn=cn.positionedGlyphs;let Yt=0;if(!ln.length()){lt+=Ve,++bt;continue}let gr=0,ar=0;for(let wr=0;wr<ln.length();wr++){const li=ln.getSection(wr),Po=ln.getSectionIndex(wr),Sr=ln.getCodePoint(wr);let kr=li.scale,Mi=null,uo=null,ki=null,yn=ct,Vo=0,jo=je;jo===Kt.vertical&&$d(Sr)&&(jo=Kt.horizontal);const Do=!(jo===Kt.horizontal||!Ge&&!Nm(Sr)||Ge&&(Lr[Sr]||kl(Sr)));if(li.image){const qi=we.get(li.image.toString());if(!qi)continue;ki=li.image,de.iconsInText=de.iconsInText||!0,uo=qi.paddedRect;const Zi=qi.displaySize,Ro=Zi[0]*Ye,Pi=Zi[1]*Ye;kr=kr*ct/$e,Mi={width:Ro,height:Pi,left:0,top:-3,advance:Do?Pi:Ro,localGlyph:!1},Vo=mt?-Mi.height*kr:en*ct-17-Pi*kr,yn=Mi.advance;const Pr=(Do?Ro:Pi)*kr-ct*en;Pr>0&&Pr>Yt&&(Yt=Pr)}else{const qi=Se[li.fontStack];if(!qi)continue;qi[Sr]&&(uo=qi[Sr]);const Zi=ve[li.fontStack];if(!Zi)continue;const Ro=Zi.glyphs[Sr];if(!Ro)continue;if(Mi=Ro.metrics,yn=Sr!==8203?ct:0,mt){const Pi=Zi.ascender!==void 0?Math.abs(Zi.ascender):0,Pr=Zi.descender!==void 0?Math.abs(Zi.descender):0,ho=(Pi+Pr)*kr;gr<ho&&(gr=ho,ar=(Pi-Pr)/2*kr),Vo=-Pi*kr}else Vo=(en-kr)*ct-17}Do?(de.verticalizable=!0,Gn.push({glyph:Sr,image:ki,x:rt,y:lt+Vo,vertical:Do,scale:kr,localGlyph:Mi.localGlyph,fontStack:li.fontStack,sectionIndex:Po,metrics:Mi,rect:uo}),rt+=yn*kr+at):(Gn.push({glyph:Sr,image:ki,x:rt,y:lt+Vo,vertical:Do,scale:kr,localGlyph:Mi.localGlyph,fontStack:li.fontStack,sectionIndex:Po,metrics:Mi,rect:uo}),rt+=Mi.advance*kr+at)}Gn.length!==0&&(yt=Math.max(rt-at,yt),mt?Vr(Gn,tt,Yt,ar,Ve*en/2):Vr(Gn,tt,Yt,0,Ve/2)),rt=0;const Er=Ve*en+Yt;cn.lineOffset=Math.max(Yt,gn),lt+=Er,++bt}const Ft=lt,{horizontalAlign:Rt,verticalAlign:Wt}=di(qe);(function(ln,en,gn,cn,Gn,Yt){const gr=(en-gn)*Gn,ar=-Yt*cn;for(const Er of ln)for(const wr of Er.positionedGlyphs)wr.x+=gr,wr.y+=ar})(de.positionedLines,tt,Rt,Wt,yt,Ft),de.top+=-Wt*Ft,de.bottom=de.top+Ft,de.left+=-Rt*yt,de.right=de.left+yt,de.hasBaseline=mt}(xe,e,i,l,K,m,y,b,I,S,M,O,V),!function(de){for(const ve of de)if(ve.positionedGlyphs.length!==0)return!1;return!0}(le))return xe}const Lr={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},co={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 yo(o,e,i,l,d,p,m=1){if(e.image){const y=l.get(e.image.toString());return y?y.displaySize[0]*m*e.scale*ct/p+d:0}{const y=i[e.fontStack],b=y&&y.glyphs[o];return b?b.metrics.advance*e.scale+d:0}}function Co(o,e,i,l){const d=Math.pow(o-e,2);return l?o<e?d/2:2*d:d+Math.abs(i)*i}function sr(o,e,i){let l=0;return o===10&&(l-=1e4),i&&(l+=150),o!==40&&o!==65288||(l+=50),e!==41&&e!==65289||(l+=50),l}function zr(o,e,i,l,d,p){let m=null,y=Co(e,i,d,p);for(const b of l){const S=Co(e-b.x,i,d,p)+b.badness;S<=y&&(m=b,y=S)}return{index:o,x:e,priorBreak:m,badness:y}}function Ei(o){return o?Ei(o.priorBreak).concat(o.index):[]}function di(o){let e=.5,i=.5;switch(o){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(o){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 Vr(o,e,i,l,d){if(!(e||i||l||d))return;const p=o.length-1,m=o[p],y=(m.x+m.metrics.advance*m.scale)*e;for(let b=0;b<=p;b++)o[b].x-=y,o[b].y+=i+l+d}function Hi(o){return o.imagePrimary!==void 0&&o.top!==void 0&&o.bottom!==void 0&&o.left!==void 0&&o.right!==void 0}function mr(o,e,i,l){const{horizontalAlign:d,verticalAlign:p}=di(l),m=i[0]-o.displaySize[0]*d,y=i[1]-o.displaySize[1]*p;return{imagePrimary:o,imageSecondary:e,top:y,bottom:y+o.displaySize[1],left:m,right:m+o.displaySize[0]}}function br(o,e,i,l,d,p){const m=o.imagePrimary;let y;if(m.content){const V=m.content,G=m.pixelRatio||1;y=[V[0]/G,V[1]/G,m.displaySize[0]-V[2]/G,m.displaySize[1]-V[3]/G]}const b=e.left*p,S=e.right*p;let C,I,M,R;i==="width"||i==="both"?(R=d[0]+b-l[3],I=d[0]+S+l[1]):(R=d[0]+(b+S-m.displaySize[0])/2,I=R+m.displaySize[0]);const O=e.top*p,N=e.bottom*p;return i==="height"||i==="both"?(C=d[1]+O-l[0],M=d[1]+N+l[2]):(C=d[1]+(O+N-m.displaySize[1])/2,M=C+m.displaySize[1]),{imagePrimary:m,imageSecondary:void 0,top:C,right:I,bottom:M,left:R,collisionPadding:y}}function On(o){return!o.imagePrimary.stretchX}function ai(o){return!o.imagePrimary.stretchY}function Io(o){return{width:o.right-o.left,height:o.bottom-o.top}}const ur=128;function no(o,e,i,l){const{expression:d}=e;if(d.kind==="constant")return{kind:"constant",layoutSize:d.evaluate(new Yn(o+1,{worldview:i}),void 0,void 0,void 0,l)};if(d.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:m}=d;let y=0;for(;y<p.length&&p[y]<=o;)y++;y=Math.max(0,y-1);let b=y;for(;b<p.length&&p[b]<o+1;)b++;b=Math.min(p.length-1,b);const S=p[y],C=p[b];return d.kind==="composite"?{kind:"composite",minZoom:S,maxZoom:C,interpolationType:m}:{kind:"camera",minZoom:S,maxZoom:C,minSize:d.evaluate(new Yn(S,{worldview:i}),void 0,void 0,void 0,l),maxSize:d.evaluate(new Yn(C,{worldview:i}),void 0,void 0,void 0,l),interpolationType:m}}}function na(o,{uSize:e,uSizeT:i},{lowerSize:l,upperSize:d}){return o.kind==="source"?l/ur:o.kind==="composite"?Jt(l/ur,d/ur,i):e}function Mo(o,e,i=1){let l=0,d=0;if(o.kind==="constant")d=o.layoutSize*i;else if(o.kind!=="source"){const{interpolationType:p,minZoom:m,maxZoom:y}=o,b=p?Ie(Ks.interpolationFactor(p,e,m,y),0,1):0;o.kind==="camera"?d=Jt(o.minSize,o.maxSize,b)*i:l=b*i}return{uSizeT:l,uSize:d}}class hs extends et{constructor(e,i,l,d,p){super(e,i),this.angle=d,this.z=l,p!==void 0&&(this.segment=p)}clone(){return new hs(this.x,this.y,this.z,this.angle,this.segment)}}function ra(o,e,i,l,d){if(e.segment===void 0)return!0;let p=e,m=e.segment+1,y=0;for(;y>-i/2;){if(m--,m<0)return!1;y-=o[m].dist(p),p=o[m]}y+=o[m].dist(o[m+1]),m++;const b=[];let S=0;for(;y<i/2;){const C=o[m],I=o[m+1];if(!I)return!1;let M=o[m-1].angleTo(C)-C.angleTo(I);for(M=Math.abs((M+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:y,angleDelta:M}),S+=M;y-b[0].distance>l;)S-=b.shift().angleDelta;if(S>d)return!1;m++,y+=C.dist(I)}return!0}function zs(o){let e=0;for(let i=0;i<o.length-1;i++)e+=o[i].dist(o[i+1]);return e}function ia(o,e,i){return o?.6*e*i:0}function Ts(o,e){return Math.max(o?o.right-o.left:0,e?e.right-e.left:0)}function Qa(o,e,i,l,d,p){const m=ia(i,d,p),y=Ts(i,l)*p;let b=0;const S=zs(o)/2;for(let C=0;C<o.length-1;C++){const I=o[C],M=o[C+1],R=I.dist(M);if(b+R>S){const O=(S-b)/R,N=Jt(I.x,M.x,O),V=Jt(I.y,M.y,O),G=new hs(N,V,0,M.angleTo(I),C);return!m||ra(o,G,y,m,e)?G:void 0}b+=R}}function ic(o,e,i,l,d,p,m,y,b){const S=ia(l,p,m),C=Ts(l,d),I=C*m,M=o[0].x===0||o[0].x===b||o[0].y===0||o[0].y===b;return e-I<e/4&&(e=I+e/4),oh(o,M?e/2*y%e:(C/2+2*p)*m*y%e,e,S,i,I,M,!1,b)}function oh(o,e,i,l,d,p,m,y,b){const S=p/2,C=zs(o);let I=0,M=e-i,R=[];for(let O=0;O<o.length-1;O++){const N=o[O],V=o[O+1],G=N.dist(V),K=V.angleTo(N);for(;M+i<I+G;){M+=i;const q=(M-I)/G,ee=Jt(N.x,V.x,q),te=Jt(N.y,V.y,q);if(ee>=0&&ee<b&&te>=0&&te<b&&M-S>=0&&M+S<=C){const le=new hs(ee,te,0,K,O);l&&!ra(o,le,p,l,d)||R.push(le)}}I+=G}return y||R.length||m||(R=oh(o,I/2,i,l,d,p,m,!0,b)),R}function hg(o){let e=0,i=0;for(const m of o)e+=m.w*m.h,i=Math.max(i,m.w);o.sort((m,y)=>y.h-m.h);const l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let d=0,p=0;for(const m of o)for(let y=l.length-1;y>=0;y--){const b=l[y];if(!(m.w>b.w||m.h>b.h)){if(m.x=b.x,m.y=b.y,p=Math.max(p,m.y+m.h),d=Math.max(d,m.x+m.w),m.w===b.w&&m.h===b.h){const S=l.pop();S&&y<l.length&&(l[y]=S)}else m.h===b.h?(b.x+=m.w,b.w-=m.w):m.w===b.w?(b.y+=m.h,b.h-=m.h):(l.push({x:b.x+m.w,y:b.y,w:b.w-m.w,h:m.h}),b.y+=m.h,b.h-=m.h);break}}return{w:d,h:p,fill:e/(d*p)||0}}function up(o,e){return o.id<e.id?-1:o.id>e.id?1:o.version<e.version?-1:o.version>e.version?1:o.sx<e.sx?-1:o.sx>e.sx?1:o.sy<e.sy?-1:o.sy>e.sy?1:0}function Nv(o){let e=0;for(let i=0;i<o.length;i++)e=(e<<5)-e+o.charCodeAt(i),e&=e;return e}function oc(o,e){return(o<<5)-o+e}function MP(o,e,i,l){for(const[d]of o.entries()){const p=l&&l.get(d)||xa.parse(d),m=p.id.toString(),y=e.get(m)||0;i.push({id:d,version:y,sx:p.sx,sy:p.sy})}}Mt(hs,"Anchor");class sE{constructor(e,i,l,d,p){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=i.size>0,MP(e,l,this.iconDescriptors,p),MP(i,l,this.patternDescriptors,p),this.iconDescriptors.sort(up),this.patternDescriptors.sort(up);let m=0;const y=d?d.data:"";y&&(m=oc(m,Nv(y))),m=oc(m,1);for(const b of this.iconDescriptors)m=oc(m,Nv(b.id)),m=oc(m,b.version),m=oc(m,b.sx),m=oc(m,b.sy);m=oc(m,1);for(const b of this.patternDescriptors)m=oc(m,Nv(b.id)),m=oc(m,b.version),m=oc(m,b.sx),m=oc(m,b.sy);this.hash=m}subsetOf(e){return this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,up)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,up)}isSubsetArray(e,i,l){let d=0,p=0;if(e.length>i.length)return!1;for(;d<e.length&&p<i.length;){const m=l(e[d],i[p]);if(m===0)d++,p++;else{if(m<0)return!1;p++}}return d===e.length}}function aE(o){switch(o){case WebGL2RenderingContext.RGBA8:case WebGL2RenderingContext.RGBA16F: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 lE(o){switch(o){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;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}}Mt(sE,"AtlasContentDescriptor");class Jc{constructor(e,i,l,d){this.context=e,this.format=l,this.useMipmap=d&&d.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:d&&d.premultiply})}update(e,i){const l=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,d=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:p}=this,{gl:m}=p,{x:y,y:b}=i&&i.position?i.position:{x:0,y:0},S=y+l,C=b+d;this.size&&(this.size[0]!==S||this.size[1]!==C)&&(!i||i.recreateWhenResize===void 0||i.recreateWhenResize)&&(m.bindTexture(m.TEXTURE_2D,null),m.deleteTexture(this.texture),this.texture=m.createTexture(),this.size=null),m.bindTexture(m.TEXTURE_2D,this.texture),p.pixelStoreUnpackFlipY.set(!1),p.pixelStoreUnpack.set(1),p.pixelStoreUnpackPremultiplyAlpha.set(this.format===m.RGBA8&&(!i||i.premultiply!==!1));const I=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&S>0&&C>0){const M=this.useMipmap?Math.floor(Math.log2(Math.max(S,C)))+1:1;m.texStorage2D(m.TEXTURE_2D,M,this.format,S,C),this.size=[S,C]}this.size&&(I?m.texSubImage2D(m.TEXTURE_2D,0,y,b,aE(this.format),lE(this.format),e):"data"in e&&e.data&&m.texSubImage2D(m.TEXTURE_2D,0,y,b,l,d,aE(this.format),lE(this.format),e.data)),this.useMipmap&&m.generateMipmap(m.TEXTURE_2D)}bind(e,i,l=!1){const{context:d}=this,{gl:p}=d;p.bindTexture(p.TEXTURE_2D,this.texture),e!==this.minFilter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,e),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,this.useMipmap&&!l?e===p.NEAREST?p.NEAREST_MIPMAP_NEAREST:p.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,i),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,l,d,p){const{context:m}=this,{gl:y}=m;y.bindTexture(y.TEXTURE_2D,this.texture),i!==this.magFilter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,this.useMipmap?e===y.NEAREST?y.NEAREST_MIPMAP_NEAREST:y.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),l!==this.wrapS&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,l),this.wrapS=l),d!==this.wrapT&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,d),this.wrapT=d),p!==this.compareMode&&(p?(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_COMPARE_MODE,y.COMPARE_REF_TO_TEXTURE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_COMPARE_FUNC,p)):y.texParameteri(y.TEXTURE_2D,y.TEXTURE_COMPARE_MODE,y.NONE),this.compareMode=p)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Vv{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:l}=this,{gl:d}=l;d.bindTexture(d.TEXTURE_2D,this.texture),e!==this.minFilter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,e),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,i),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,i),this.wrapS=i)}}class jv{static getImagePositionScale(e,i,l){if(i&&e){const{sx:d,sy:p}=e;return{x:d,y:p}}return{x:l,y:l}}constructor(e,i,l,d){this.paddedRect=e;const{pixelRatio:p,version:m,stretchX:y,stretchY:b,content:S,sdf:C,usvg:I}=i;this.pixelRatio=p,this.stretchX=y,this.stretchY=b,this.content=S,this.version=m,this.padding=l,this.sdf=C,this.usvg=I,this.scale=jv.getImagePositionScale(d,I,p)}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 cE(o,e,i){const l=xa.parse(o),d=function(p,m,y=[1,1]){return{x:0,y:0,w:(p.data?p.data.width:p.width*y[0])+2*m,h:(p.data?p.data.height:p.height*y[1])+2*m}}(e,i,[l.sx,l.sy]);return{bin:d,imagePosition:new jv(d,e,i,l),imageVariant:l}}function uE(o,e){const i=[];for(const[d,p]of o.entries()){const m=xa.parse(d);m&&(i.push({key:d,value:p,variant:m}),e&&e.set(d,m))}i.sort((d,p)=>{const m=d.variant.id.toString().localeCompare(p.variant.id.toString());return m!==0?m:d.variant.sx!==p.variant.sx?d.variant.sx-p.variant.sx:d.variant.sy!==p.variant.sy?d.variant.sy-p.variant.sy:0});const l=new Map;for(const d of i)l.set(d.key,d.value);return l}class PP{constructor(e){this.sourceAtlasHash=e}}class DP{constructor(e,i,l,d){const p=new Map,m=new Map;this.haveRenderCallbacks=[];const y=[],b=d!==void 0,S=b?new Map:void 0,C=b?uE(e,S):e,I=b?uE(i,S):i;this.addImages(C,p,1,y),this.addImages(I,m,2,y);const{w:M,h:R}=hg(y),O=new A({width:M||1,height:R||1});for(const[N,V]of C.entries()){const G=p.get(N).paddedRect;A.copy(V.data,O,{x:0,y:0},{x:G.x+1,y:G.y+1},V.data,null,V.sdf)}for(const[N,V]of I.entries()){const G=m.get(N),K=G.paddedRect;let q=G.padding;const ee=K.x+q,te=K.y+q,le=V.data.width,xe=V.data.height;q=q>1?q-1:q,A.copy(V.data,O,{x:0,y:0},{x:ee,y:te},V.data,l),A.copy(V.data,O,{x:0,y:xe-q},{x:ee,y:te-q},{width:le,height:q},l),A.copy(V.data,O,{x:0,y:0},{x:ee,y:te+xe},{width:le,height:q},l),A.copy(V.data,O,{x:le-q,y:0},{x:ee-q,y:te},{width:q,height:xe},l),A.copy(V.data,O,{x:0,y:0},{x:ee+le,y:te},{width:q,height:xe},l),A.copy(V.data,O,{x:le-q,y:xe-q},{x:ee-q,y:te-q},{width:q,height:q},l),A.copy(V.data,O,{x:0,y:xe-q},{x:ee+le,y:te-q},{width:q,height:q},l),A.copy(V.data,O,{x:0,y:0},{x:ee+le,y:te+xe},{width:q,height:q},l),A.copy(V.data,O,{x:le-q,y:0},{x:ee-q,y:te+xe},{width:q,height:q},l)}this.lut=l,this.image=O,this.iconPositions=p,this.patternPositions=m,b&&(this.contentDescriptor=new sE(C,I,d,l,S))}addImages(e,i,l,d){for(const[p,m]of e.entries()){const{bin:y,imagePosition:b,imageVariant:S}=cE(p,m,l);i.set(p,b),d.push(y),m.hasRenderCallback&&this.haveRenderCallbacks.push(S.id)}}patchUpdatedImages(e,i,l,d){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(p=>e.hasImage(p,l)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,l);for(const p of e.getUpdatedImages(l)){for(const m of this.iconPositions.keys()){const y=xa.parse(m);if(Ut.isEqual(y.id,p)){const b=e.getImage(p,l);this.patchUpdatedImage(this.iconPositions.get(m),b,i,null)}}for(const m of this.patternPositions.keys()){const y=xa.parse(m);if(Ut.isEqual(y.id,p)){const b=e.getImage(p,l);this.patchUpdatedImage(this.patternPositions.get(m),b,i,d||this.lut)}}}}patchUpdatedImage(e,i,l,d=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[p,m]=e.tl,y=e.sdf;if(this.lut||y){const b={width:i.data.width,height:i.data.height},S=new A(b);A.copy(i.data,S,{x:0,y:0},{x:0,y:0},b,d,y),l.update(S,{position:{x:p,y:m},recreateWhenResize:!1})}else l.update(i.data,{position:{x:p,y:m},recreateWhenResize:!1})}}Mt(jv,"ImagePosition"),Mt(DP,"ImageAtlas",{omit:["lut"]}),Mt(PP,"ImageAtlasReference");class Uv{constructor(e){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=e&&e.fontstackCompositing||"client"}loadGlyphRange(e,i,l,d,p){if(this.fontstackCompositing==="server")return void Uv.loadGlyphRange(e,i,l,d,p);const m=e.split(",").map(y=>y.trim()).filter(y=>y.length>0);m.length!==0?m.length!==1?this._loadMultipleFonts(m,i,l,d,p):this._loadFont(m[0],i,l,d,p):p(new Error("Empty fontstack"))}_loadMultipleFonts(e,i,l,d,p){const m=e.map(()=>null),y={completed:0,firstError:null,callbackCalled:!1},b=(S,C,I)=>{if(!y.callbackCalled&&(C&&!y.firstError&&(y.firstError=C),I&&(m[S]=I),y.completed++,y.completed===e.length)){y.callbackCalled=!0;const M=m.filter(O=>O!==null);if(M.length===0)return void p(y.firstError||new Error("All fonts failed to load"));const R=this._composeGlyphs(M);p(null,R)}};for(let S=0;S<e.length;S++)this._loadFont(e[S],i,l,d,(C,I)=>{b(S,C,I)})}_loadFont(e,i,l,d,p){const m=`${e}:${i}`;if(this.cachedRanges.has(m)){const b=this.cachedRanges.get(m);return void Zo.frame(()=>p(null,b))}const y=this.pendingRequests.get(m);y?y.push(p):(this.pendingRequests.set(m,[p]),Uv.loadGlyphRange(e,i,l,d,(b,S)=>{b||this.cachedRanges.set(m,S||null);const C=this.pendingRequests.get(m);if(this.pendingRequests.delete(m),C)for(const I of C)I(b,S)}))}_composeGlyphs(e){const i={};let l,d;for(const p of e)if(l===void 0&&p.ascender!==void 0&&(l=p.ascender),d===void 0&&p.descender!==void 0&&(d=p.descender),p.glyphs)for(const m in p.glyphs)i[m]===void 0&&(i[m]=p.glyphs[m]);return{glyphs:i,ascender:l,descender:d}}}Uv.loadGlyphRange=function(o,e,i,l,d){const p=256*e,m=p+255,y=l.transformRequest(l.normalizeGlyphsURL(i).replace("{fontstack}",o).replace("{range}",`${p}-${m}`),Ac.Glyphs);Mc(y,(b,S)=>{if(b)d(b);else if(S){const C={},I=function(M){return function(R){const O={glyphs:[]};let N;for(;N=R.nextField();)N===1&&Pn(R,R.readVarint()+R.pos,O);return O}(new En(M))}(S);for(const M of I.glyphs)C[M.id]=M;d(null,{glyphs:C,ascender:I.ascender,descender:I.descender})}})};const Gv=1e20,dE=new Float64Array(256);for(let o=0;o<256;o++){const e=.5-Math.pow(o/255,.45454545454545453);dE[o]=e*Math.abs(e)}function RP(o,e,i,l,d,p,m,y,b){for(let S=e;S<e+l;S++)LP(o,i*p+S,p,d,m,y,b);for(let S=i;S<i+d;S++)LP(o,S*p+e,1,l,m,y,b)}function LP(o,e,i,l,d,p,m){p[0]=0,m[0]=-Gv,m[1]=Gv,d[0]=o[e];for(let y=1,b=0,S=0;y<l;y++){d[y]=o[e+y*i];const C=y*y;do{const I=p[b];S=(d[y]-d[I]+C-I*I)/(y-I)/2}while(S<=m[b]&&--b>-1);b++,p[b]=y,m[b]=S,m[b+1]=Gv}for(let y=0,b=0;y<l;y++){for(;m[b+1]<y;)b++;const S=p[b],C=y-S;o[e+y*i]=d[S]+C*C}}dE[255]=-Gv;const O6=/bold/i,F6=/medium/i,z6=/light/i,hE={none:0,ideographs:1,all:2};class x1{constructor(e,i,l,d){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=l,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new Uv({fontstackCompositing:d})}setURL(e){this.url=e}prefetchRange(e,i){const l=this.url||Nr.GLYPHS_URL;if(!l)return;let d=this.entries[e];d||(d=this.entries[e]={glyphs:{},requests:{},ranges:{}}),d.ranges[i]||d.requests[i]||(d.requests[i]=[],this.glyphLoader.loadGlyphRange(e,i,l,this.requestManager,(p,m)=>{if(m){d.ascender=m.ascender,d.descender=m.descender;for(const y in m.glyphs)this._doesCharSupportLocalGlyph(+y)||(d.glyphs[+y]=m.glyphs[+y]);d.ranges[i]=!0}for(const y of d.requests[i]||[])y(p,m);delete d.requests[i]}))}getGlyphs(e,i){const l=[],d=this.url||Nr.GLYPHS_URL;for(const p in e)for(const m of e[p])l.push({stack:p,id:m});Tt(l,({stack:p,id:m},y)=>{let b=this.entries[p];b||(b=this.entries[p]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let S=b.glyphs[m];if(S!==void 0)return void y(null,{stack:p,id:m,glyph:S});if(S=this._tinySDF(b,p,m),S)return b.glyphs[m]=S,void y(null,{stack:p,id:m,glyph:S});const C=Math.floor(m/256);if(256*C>65535)return Cn("glyphs > 65535 not supported"),void y(null,{stack:p,id:m,glyph:S});if(b.ranges[C])return void y(null,{stack:p,id:m,glyph:S});let I=b.requests[C];I||(I=b.requests[C]=[],this.glyphLoader.loadGlyphRange(p,C,d,this.requestManager,(M,R)=>{if(R){b.ascender=R.ascender,b.descender=R.descender;for(const O in R.glyphs)this._doesCharSupportLocalGlyph(+O)||(b.glyphs[+O]=R.glyphs[+O]);b.ranges[C]=!0}for(const O of I)O(M,R);delete b.requests[C]})),I.push((M,R)=>{M?y(M):R&&y(null,{stack:p,id:m,glyph:R.glyphs[m]||null})})},(p,m)=>{if(p)i(p);else if(m){const y={};for(const{stack:b,id:S,glyph:C}of m)y[b]===void 0&&(y[b]={}),y[b].glyphs===void 0&&(y[b].glyphs={}),y[b].glyphs[S]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics},y[b].ascender=this.entries[b].ascender,y[b].descender=this.entries[b].descender;i(null,y)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==hE.none&&(this.localGlyphMode===hE.all?!!this.localFontFamily:!!this.localFontFamily&&(qy(e)||Bm(e)||Vd(e)||zu(e)||Fu(e)||Wy(e)||(i=e)>=131072&&i<=173791||(l=>l>=66736&&l<=66815)(e)));var i}_tinySDF(e,i,l){const d=this.localFontFamily;if(!d||!this._doesCharSupportLocalGlyph(l))return;let p=e.tinySDF;if(!p){let V="400";O6.test(i)?V="900":F6.test(i)?V="500":z6.test(i)&&(V="200"),p=e.tinySDF=new x1.TinySDF({fontFamily:d,fontWeight:V,fontSize:48,buffer:6,radius:16}),p.fontWeight=V}const m=p.fontWeight;if(this.localGlyphs[m][l])return this.localGlyphs[m][l];const y=String.fromCodePoint(l),{data:b,width:S,height:C,glyphWidth:I,glyphHeight:M,glyphLeft:R,glyphTop:O,glyphAdvance:N}=p.draw(y);return this.localGlyphs[m][l]={id:l,bitmap:new k({width:S,height:C},b),metrics:{width:I/2,height:M/2,left:R/2,top:O/2-27,advance:N/2,localGlyph:!0}}}}function OP(o,e){return o+e[1]-e[0]}function fE(o,e,i,l,d=1){const p=[],m=o.imagePrimary,y=m.pixelRatio,b=m.paddedRect.w-2,S=m.paddedRect.h-2,C=(o.right-o.left)*d,I=(o.bottom-o.top)*d,M=m.stretchX||[[0,b]],R=m.stretchY||[[0,S]],O=M.reduce(OP,0),N=R.reduce(OP,0),V=b-O,G=S-N;let K=0,q=O,ee=0,te=N,le=0,xe=V,de=0,ve=G;if(m.content&&l){const we=m.content;K=b1(M,0,we[0]),ee=b1(R,0,we[1]),q=b1(M,we[0],we[2]),te=b1(R,we[1],we[3]),le=we[0]-K,de=we[1]-ee,xe=we[2]-we[0]-q,ve=we[3]-we[1]-te}const Se=(we,Fe,Ve,qe)=>{const Ke=w1(we.stretch-K,q,C,o.left*d),je=S1(we.fixed-le,xe,we.stretch,O),at=w1(Fe.stretch-ee,te,I,o.top*d),Ge=S1(Fe.fixed-de,ve,Fe.stretch,N),$e=w1(Ve.stretch-K,q,C,o.left*d),Ye=S1(Ve.fixed-le,xe,Ve.stretch,O),rt=w1(qe.stretch-ee,te,I,o.top*d),lt=S1(qe.fixed-de,ve,qe.stretch,N),yt=new et(Ke,at),tt=new et($e,at),mt=new et($e,rt),bt=new et(Ke,rt),Ft=new et(je/y,Ge/y),Rt=new et(Ye/y,lt/y),Wt=e*Math.PI/180;if(Wt){const Yt=Math.sin(Wt),gr=Math.cos(Wt),ar=[gr,-Yt,Yt,gr];yt._matMult(ar),tt._matMult(ar),bt._matMult(ar),mt._matMult(ar)}const ln=we.stretch+we.fixed,en=Ve.stretch+Ve.fixed,gn=Fe.stretch+Fe.fixed,cn=qe.stretch+qe.fixed,Gn=o.imageSecondary;return{tl:yt,tr:tt,bl:bt,br:mt,texPrimary:{x:m.paddedRect.x+1+ln,y:m.paddedRect.y+1+gn,w:en-ln,h:cn-gn},texSecondary:Gn?{x:Gn.paddedRect.x+1+ln,y:Gn.paddedRect.y+1+gn,w:en-ln,h:cn-gn}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ft,pixelOffsetBR:Rt,minFontScaleX:xe/y/C,minFontScaleY:ve/y/I,isSDF:i}};if(m.stretchX||m.stretchY){const we=FP(M,V,O),Fe=FP(R,G,N);for(let Ve=0;Ve<we.length-1;Ve++){const qe=we[Ve],Ke=we[Ve+1];for(let je=0;je<Fe.length-1;je++)p.push(Se(qe,Fe[je],Ke,Fe[je+1]))}}else p.push(Se({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:b+1},{fixed:0,stretch:S+1}));return p}function B6(o,e){const i=o.stretchY||[[0,o.paddedRect.h-2]];return o.stretchX||o.stretchY?zP(o.stretchX||[[0,o.paddedRect.w-2]])*zP(i):1}function b1(o,e,i){let l=0;for(const d of o)l+=Math.max(e,Math.min(i,d[1]))-Math.max(e,Math.min(i,d[0]));return l}function FP(o,e,i){const l=[{fixed:-1,stretch:0}];for(const[d,p]of o){const m=l.at(-1);l.push({fixed:d-m.stretch,stretch:m.stretch}),l.push({fixed:d-m.stretch,stretch:m.stretch+(p-d)})}return l.push({fixed:e+1,stretch:i}),l}function zP(o){return 2*o.length+1}function w1(o,e,i,l){return o/e*i+l}function S1(o,e,i,l){return o-e*i/l}function N6(o,e,i,l){const d=e+o.positionedLines[l].lineOffset;return l===0?i+d/2:i+(d+(e+o.positionedLines[l-1].lineOffset))/2}function BP(o,e,i,l,d,p,m,y,b,S=1){const C=[];if(e.positionedLines.length===0)return C;const I=(b!==void 0?b:l.layout.get("text-rotate").evaluate(p,{}))*Math.PI/180,M=function(G){const K=G[0],q=G[1],ee=K*q;return ee>0?[K,-q]:ee<0?[-K,q]:K===0?[q,K]:[q,-K]}(i);let R=Math.abs(e.top-e.bottom);for(const G of e.positionedLines)R-=G.lineOffset;const O=e.positionedLines.length,N=R/O;let V=e.top-i[1];for(let G=0;G<O;++G){const K=e.positionedLines[G];V=N6(e,N,V,G);for(const q of K.positionedGlyphs){if(!q.rect)continue;const ee=q.rect||{};let te=4,le=!0,xe=1,de=0;if(q.image){const mt=m.get(q.image.toString());if(!mt)continue;if(mt.sdf){Cn("SDF images are not supported in formatted text and will be ignored.");continue}le=!1,xe=mt.pixelRatio,te=1/xe,mt.usvg||(xe/=S)}const ve=(d||y)&&q.vertical,Se=q.metrics.advance*q.scale/2,we=q.metrics,Fe=q.rect;if(Fe===null)continue;y&&e.verticalizable&&(de=q.image?Se-q.metrics.width*q.scale/2:0);const Ve=d?[q.x+Se,q.y]:[0,0];let qe=[0,0],Ke=[0,0],je=!1;d||(ve?(Ke=[q.x+Se+M[0],q.y+M[1]-de],je=!0):qe=[q.x+Se+i[0],q.y+i[1]-de]);const at=Fe.w*q.scale/(xe*(q.localGlyph?2:1)),Ge=Fe.h*q.scale/(xe*(q.localGlyph?2:1));let $e,Ye,rt,lt;if(ve){const mt=q.y-V,bt=new et(-Se,Se-mt),Ft=-Math.PI/2,Rt=new et(...Ke);$e=new et(-Se+qe[0],qe[1]),$e._rotateAround(Ft,bt)._add(Rt),$e.x+=-mt+Se,$e.y-=(we.left-te)*q.scale;const Wt=q.image?we.advance*q.scale:ct*q.scale,ln=String.fromCodePoint(q.glyph);Nt(ln)?$e.x+=(1-te)*q.scale:$t(ln)?$e.x+=Wt-we.height*q.scale+(-te-1)*q.scale:$e.x+=q.image||we.width+2*te===Fe.w&&we.height+2*te===Fe.h?(Wt-Ge)/2:(Wt-(we.height+2*te)*q.scale)/2,Ye=new et($e.x,$e.y-at),rt=new et($e.x+Ge,$e.y),lt=new et($e.x+Ge,$e.y-at)}else{const mt=(we.left-te)*q.scale-Se+qe[0],bt=(-we.top-te)*q.scale+qe[1],Ft=mt+at,Rt=bt+Ge;$e=new et(mt,bt),Ye=new et(Ft,bt),rt=new et(mt,Rt),lt=new et(Ft,Rt)}if(I){let mt;mt=d?new et(0,0):je?new et(M[0],M[1]):new et(i[0],i[1]),$e._rotateAround(I,mt),Ye._rotateAround(I,mt),rt._rotateAround(I,mt),lt._rotateAround(I,mt)}const yt=new et(0,0),tt=new et(0,0);C.push({tl:$e,tr:Ye,bl:rt,br:lt,texPrimary:ee,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:Ve,sectionIndex:q.sectionIndex,isSDF:le,pixelOffsetTL:yt,pixelOffsetBR:tt,minFontScaleX:0,minFontScaleY:0})}}return C}function V6(o,e=1,i=!1){let l=1/0,d=1/0,p=-1/0,m=-1/0;const y=o[0];for(let R=0;R<y.length;R++){const O=y[R];(!R||O.x<l)&&(l=O.x),(!R||O.y<d)&&(d=O.y),(!R||O.x>p)&&(p=O.x),(!R||O.y>m)&&(m=O.y)}const b=Math.min(p-l,m-d);let S=b/2;const C=new bf([],j6);if(b===0)return new et(l,d);for(let R=l;R<p;R+=b)for(let O=d;O<m;O+=b)C.push(new fg(R+S,O+S,S,o));let I=function(R){let O=0,N=0,V=0;const G=R[0];for(let K=0,q=G.length,ee=q-1;K<q;ee=K++){const te=G[K],le=G[ee],xe=te.x*le.y-le.x*te.y;N+=(te.x+le.x)*xe,V+=(te.y+le.y)*xe,O+=3*xe}return new fg(N/O,V/O,0,R)}(o),M=C.length;for(;C.length;){const R=C.pop();(R.d>I.d||!I.d)&&(I=R,i&&console.log("found best %d after %d probes",Math.round(1e4*R.d)/1e4,M)),R.max-I.d<=e||(S=R.h/2,C.push(new fg(R.p.x-S,R.p.y-S,S,o)),C.push(new fg(R.p.x+S,R.p.y-S,S,o)),C.push(new fg(R.p.x-S,R.p.y+S,S,o)),C.push(new fg(R.p.x+S,R.p.y+S,S,o)),M+=4)}return i&&(console.log(`num probes: ${M}`),console.log(`best distance: ${I.d}`)),I.p}function j6(o,e){return e.max-o.max}x1.TinySDF=class{constructor({fontSize:o=24,buffer:e=3,radius:i=8,cutoff:l=.25,fontFamily:d="sans-serif",fontWeight:p="normal",fontStyle:m="normal",lang:y=null}={}){this.buffer=e,this.radius=i,this.cutoff=l,this.lang=y;const b=this.size=o+4*e,S=this._createCanvas(b),C=this.ctx=S.getContext("2d",{willReadFrequently:!0});C.font=`${m} ${p} ${o}px ${d}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(b*b),this.gridInner=new Float64Array(b*b),this.f=new Float64Array(b),this.z=new Float64Array(b+1),this.v=new Uint16Array(b)}_createCanvas(o){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(o,o);const e=document.createElement("canvas");return e.width=e.height=o,e}draw(o){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:l,actualBoundingBoxLeft:d,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(i),y=Math.floor(-d),b=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p)-y)),S=Math.max(0,Math.min(this.size-this.buffer,m+Math.ceil(l))),C=b+2*this.buffer,I=S+2*this.buffer,M=Math.max(C*I,0),R=new Uint8ClampedArray(M),O={data:R,width:C,height:I,glyphWidth:b,glyphHeight:S,glyphTop:m,glyphLeft:y,glyphAdvance:e};if(b===0||S===0)return O;const{ctx:N,buffer:V,gridInner:G,gridOuter:K}=this;this.lang&&(N.lang=this.lang),N.clearRect(V,V,b,S),N.fillText(o,V-y,V+m);const q=N.getImageData(V,V,b,S);K.fill(Gv,0,M),G.fill(0,0,M);let ee=3;for(let de=0;de<S;de++){let ve=(de+V)*C+V;for(let Se=0;Se<b;Se++,ee+=4,ve++){const we=q.data[ee];if(we===0)continue;const Fe=dE[we];K[ve]=Math.max(0,Fe),G[ve]=Math.max(0,-Fe)}}RP(K,0,0,C,I,C,this.f,this.v,this.z);const te=Math.min(V,1);RP(G,V-te,V-te,b+2*te,S+2*te,C,this.f,this.v,this.z);const le=255/this.radius,xe=255*(1-this.cutoff);for(let de=0;de<M;de++){const ve=Math.sqrt(K[de])-Math.sqrt(G[de]);R[de]=Math.round(xe-le*ve)}return O}};class fg{constructor(e,i,l,d){this.p=new et(e,i),this.h=l,this.d=function(p,m){let y=!1,b=1/0;for(let S=0;S<m.length;S++){const C=m[S];for(let I=0,M=C.length,R=M-1;I<M;R=I++){const O=C[I],N=C[R];O.y>p.y!=N.y>p.y&&p.x<(N.x-O.x)*(p.y-O.y)/(N.y-O.y)+O.x&&(y=!y),b=Math.min(b,Zu(p,O,N))}}return(y?1:-1)*Math.sqrt(b)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}}const U6=Object.keys,pE=Number.POSITIVE_INFINITY,G6=Math.sqrt(2);function sh(o,e,i,l,d,p){const m=Hi(o)&&o.collisionPadding?o.collisionPadding:[0,0,0,0],y={top:o.top-m[1],bottom:o.bottom+m[3],left:o.left-m[0],right:o.right+m[2],scaled:!1};return l!==void 0&&function(b,S){b.top*=S,b.bottom*=S,b.left*=S,b.right*=S,b.scaled=!0}(y,l),p&&(y.left+=p[0],y.right+=p[0],y.top+=p[1],y.bottom+=p[1]),i&&function(b,S,C){if(!S)return;const I=Te(S),M=new et(C?C[0]:0,C?C[1]:0),R=new et(b.left,b.top),O=new et(b.right,b.top),N=new et(b.left,b.bottom),V=new et(b.right,b.bottom);R._rotateAround(I,M),O._rotateAround(I,M),N._rotateAround(I,M),V._rotateAround(I,M),b.left=Math.min(R.x,O.x,N.x,V.x),b.right=Math.max(R.x,O.x,N.x,V.x),b.top=Math.min(R.y,O.y,N.y,V.y),b.bottom=Math.max(R.y,O.y,N.y,V.y)}(y,i,d),e?{top:Math.min(e.top,y.top),bottom:Math.max(e.bottom,y.bottom),left:Math.min(e.left,y.left),right:Math.max(e.right,y.right),scaled:e.scaled||y.scaled}:y}function NP(o,[e,i]){let l=0,d=0;if(i===pE){e<0&&(e=0);const p=e/G6;switch(o){case"top-right":case"top-left":d=p-7;break;case"bottom-right":case"bottom-left":d=7-p;break;case"bottom":d=7-e;break;case"top":d=e-7}switch(o){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=e;break;case"right":l=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),o){case"top-right":case"top-left":case"top":d=i-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-i}switch(o){case"top-right":case"bottom-right":case"right":l=-e;break;case"top-left":case"bottom-left":case"left":l=e}}return[l,d]}function $6(o,e,i,l,d,p,m,y,b,S,C,I,M,R,O){const N=o.layers[0],V=N.appearances;if(V.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const G={iconBBox:null,iconVerticalBBox:null},K={textBBox:null,textVerticalBBox:null},{baseIconRotate:q,baseTextRotate:ee,iconScaleFactor:te}=function(xe,de,ve){const Se=xe.get("icon-rotate").evaluate(de,{},ve),we=xe.get("text-rotate").evaluate(de,{},ve),[Fe,Ve]=xe.get("icon-size-scale-range");return{baseIconRotate:Se,baseTextRotate:we,iconScaleFactor:Ie(1,Fe,Ve)}}(l,d,p);e&&(G.iconBBox=sh(e,G.iconBBox,q),i)&&(G.iconVerticalBBox=sh(i,G.iconVerticalBBox,q+90));const le=E1(I.horizontal);le&&(K.textBBox=sh(le,K.textBBox,ee,1,R)),I.vertical&&(K.textVerticalBBox=sh(I.vertical,K.textVerticalBBox,ee+90,1,R));for(const xe of V)xe.hasIconLayoutProperties()&&H6(G,o,N,xe,d,p,y,q,m,b,e,S,te,C,O),xe.hasTextLayoutProperties()&&W6(K,N,xe,d,p,R,ee,M,le,I.vertical);return{iconBBox:G.iconBBox,iconVerticalBBox:G.iconVerticalBBox,textBBox:K.textBBox,textVerticalBBox:K.textVerticalBBox}}function H6(o,e,i,l,d,p,m,y,b,S,C,I,M,R,O){const{appearanceIconOffset:N,appearanceIconRotate:V,appearanceIconSize:G}=VP(l,i,d,p,m,y,b,S.iconScaleFactor);let K=null,q=null,ee=null;l.hasLayoutProperty("icon-image")?ee=function(le,xe,de,ve,Se,we,Fe,Ve){let qe=null;const Ke=xe.getAppearanceValueAndResolveTokens(de,"icon-image",ve,Se,Ve);if(Ke){const je=le.getResolvedImageFromTokens(Ke),at=de.hasLayoutProperty("icon-size")?de.getUnevaluatedLayoutProperty("icon-size"):xe._unevaluatedLayout._values["icon-size"],Ge=$v(je,no(le.zoom,at,le.worldview,Ve),at,Se,le.zoom,ve,le.pixelRatio,Fe,le.worldview,Ve);qe=we.get(Ge.iconPrimary.toString())}return qe}(e,i,l,d,p,I,M,O):C&&(ee=C.imagePrimary),ee&&(K=mr(ee,null,N,R),e.allowVerticalPlacement&&(q=mr(ee,null,N,R)));const te=b>0?G/b:1;K&&(o.iconBBox=sh(K,o.iconBBox,V,te!==1?te:void 0)),q&&(o.iconVerticalBBox=sh(q,o.iconVerticalBBox,V+90,te!==1?te:void 0))}function VP(o,e,i,l,d,p,m,y){const b=o.hasLayoutProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(o,"icon-offset",i,l,[]):null,S=b&&Array.isArray(b)?b:d,C=o.hasLayoutProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(o,"icon-rotate",i,l,[]):null,I=typeof C=="number"?C:p,M=o.hasLayoutProperty("icon-size")?e.getAppearanceValueAndResolveTokens(o,"icon-size",i,l,[]):null;return{appearanceIconOffset:S,appearanceIconRotate:I,appearanceIconSize:typeof M=="number"?M*y:m}}function W6(o,e,i,l,d,p,m,y,b,S){const{appearanceTextOffset:C,appearanceTextRotate:I,appearanceTextSize:M}=jP(i,e,l,d,p,m,y),R=M/y,O=[(C[0]-p[0])*R,(C[1]-p[1])*R],N=O[0]!==0||O[1]!==0;b&&(o.textBBox=sh(b,o.textBBox,I,R,C,N?O:void 0)),S&&(o.textVerticalBBox=sh(S,o.textVerticalBBox,I+90,R,C,N?O:void 0))}function jP(o,e,i,l,d,p,m){const y=o.hasLayoutProperty("text-offset")?e.getAppearanceValueAndResolveTokens(o,"text-offset",i,l,[]):null,b=y&&Array.isArray(y)?[y[0]*ct,y[1]*ct]:d,S=o.hasLayoutProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(o,"text-rotate",i,l,[]):null,C=typeof S=="number"?S:p,I=o.hasLayoutProperty("text-size")?e.getAppearanceValueAndResolveTokens(o,"text-size",i,l,[]):null;return{appearanceTextOffset:b,appearanceTextRotate:C,appearanceTextSize:typeof I=="number"?I:m}}function T1(o,e,i,l,d,p,m,y,b){if(!e||!e.usvg)return;const S=Io(l),C=Io(d),I=p!=="both"&&p!=="width"||!On(l)?1:C.width/S.width,M=p!=="both"&&p!=="height"||!ai(l)?1:C.height/S.height;i.scaleSelf(I,M);const R=i.toString();m.set(R,i),y.set(R,e);const{imagePosition:O}=cE(R,e,1);b.set(R,O)}function UP(o,e,i,l,d,p,m,y,b,S){if(!o)return;const C=function(I,M,R,O,N,V,G){if(I.kind==="camera")return I.maxSize;if(I.kind==="composite"){const K=M.possiblyEvaluate(new Yn(I.maxZoom,{worldview:V}),R,G).evaluate(N,{},R,G),q=M.possiblyEvaluate(new Yn(I.minZoom,{worldview:V}),R,G).evaluate(N,{},R,G);return Math.max(K,q)}return M.possiblyEvaluate(new Yn(O,{worldview:V}),R,G).evaluate(N,{},R,G)}(e,i,l,d,p,b,S);return o.scaleSelf(C*y*m)}function $v(o,e,i,l,d,p,m,y,b,S){return{iconPrimary:UP(o.getPrimary(),e,i,l,d,p,m,y,b,S),iconSecondary:UP(o.getSecondary(),e,i,l,d,p,m,y,b,S)}}function q6(o,e,i){if(!e)return;const l=i.get(o.toString()),d=i.get(e.toString());l&&d&&(l.paddedRect.w===d.paddedRect.w&&l.paddedRect.h===d.paddedRect.h||Cn(`Mismatch in icon variant sizes: ${o.toString()} and ${e.toString()}`),l.usvg!==d.usvg&&Cn(`Mismatch in icon variant image types: ${o.id} and ${e.id}`))}function GP(o,e,i,l){if(!o)return;const d=e.get(i.toString());if(d&&(o.imagePrimary=d),l){const p=e.get(l.toString());o.imageSecondary=p}}function Z6(o,e){for(const i in o.horizontal)$P(o.horizontal[i],e);$P(o.vertical,e)}function $P(o,e){if(o){for(const i of o.positionedLines)for(const l of i.positionedGlyphs)if(l.image!==null){const d=l.image.toString();l.rect=e.get(d).paddedRect}}}function mE(o){switch(o){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function X6(o,e,i,l,d,p,m,y,b){const S=E1(p.horizontal)||p.vertical,C=i.get("icon-text-fit-padding").evaluate(l,{},d);let I,M=e;return e&&b!=="none"&&(o.allowVerticalPlacement&&p.vertical&&(I=br(e,p.vertical,b,C,y,m)),S&&(M=br(e,S,b,C,y,m))),{defaultShapedIcon:M,verticallyShapedIcon:I}}function HP(o,e){return o*e/24}function K6(o,e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K,q,ee,te,le,xe,de,ve,Se,we){let Fe=m.textMaxSize.evaluate(e,{},M);Fe===void 0?Fe=y*m.textScaleFactor:Fe*=m.textScaleFactor;const Ve=o.layers[0].layout,qe=HP(y,m.textScaleFactor),Ke=E1(i.horizontal)||i.vertical,je=o.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),at=o.getAppearanceFeatureData(e.index);(V!=="none"||je)&&at&&(at.textShaping=Ke,at.iconTextFitPadding=Ve.get("icon-text-fit-padding").evaluate(e,{},M),at.fontScale=qe,at.textScaleFactor=m.textScaleFactor);const Ge=R.name==="globe",$e=o.tilePixelRatio*Fe/24,Ye=(bt=o.overscaling,o.zoom>18&&bt>2&&(bt>>=1),Math.max(St/(512*bt),1)*Ve.get("symbol-spacing")),rt=Ve.get("text-padding")*o.tilePixelRatio,lt=Ve.get("icon-padding")*o.tilePixelRatio,yt=Te(Ve.get("text-max-angle")),tt=Ve.get("icon-rotation-alignment")==="map"&&q!=="point",mt=Ye/2;var bt;o.hasAnyIconTextFit===!1&&V!=="none"&&(o.hasAnyIconTextFit=!0);const Ft=e.properties?+e.properties[z]:null,Rt=o.hdExt?o.hdExt.elevationFeatureIdToIndex:void 0,Wt=Ft&&Rt?Rt.get(Ft):65535,ln=(en,gn,cn)=>{if(gn.x<0||gn.x>=St||gn.y<0||gn.y>=St||ve&&ve.length>0&&e.properties&&we&&we(ve,e.properties,gn,M,Se))return;let Gn=null;if(Ge){const{x:Yt,y:gr,z:ar}=R.projectTilePoint(gn.x,gn.y,cn);Gn={anchor:new hs(Yt,gr,ar,0,void 0),up:R.upVector(cn,gn.x,gn.y)}}(function(Yt,gr,ar,Er,wr,li,Po,Sr,kr,Mi,uo,ki,yn,Vo,jo,Do,qi,Zi,Ro,Pi,Pr,ho,vp,io,aa,ph,_0,bw,ed,td,ww,Eg){const vn=Yt.addToLineVertexArray(gr,Er);let Di,Kr,Ai,la,ca,Ia,Ma,Sw=0,Tw=0,kg=0,y0=0,Ag=-1,Fi=-1;const yi={};let oo=lm("");const ps=ar?ar.anchor:gr,Yo=bw!=="none";let ou=0,cc=0;if(kr._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Ns=kr.layout.get("text-offset").evaluate(Pr,{},aa);ou=Ns[0]*ct,cc=Ns[1]*ct}else ou=kr.layout.get("text-radial-offset").evaluate(Pr,{},aa)*ct,cc=pE;if(Yt.allowVerticalPlacement&&wr.vertical){const Ns=wr.vertical;if(jo)Ia=yE(Ns),Sr&&(Ma=yE(Sr));else{const nl=kr.layout.get("text-rotate").evaluate(Pr,{},aa)+90;Ai=k1(Mi,ps,gr,uo,ki,yn,Ns,Vo,nl,Do,Eg),Sr&&(la=k1(Mi,ps,gr,uo,ki,yn,Sr,Zi,nl,null,ww))}}if(li){const Ns=kr.layout.get("icon-rotate").evaluate(Pr,{},aa),nl=fE(li,Ns,vp,Yo,ho.iconScaleFactor),rl=Sr?fE(Sr,Ns,vp,Yo,ho.iconScaleFactor):void 0;Kr=k1(Mi,ps,gr,uo,ki,yn,li,Zi,Ns,null,td);const uc=function(xp,b$,aO,w$,S$,lO,cO,T$,Ule,Sk){const uO=xp.layers[0],dO=uO.appearances;let Ig=b$.length;if(aO&&(Ig=Math.max(Ig,aO.length)),dO.length===0)return Ig;const[E$,k$]=w$.get("icon-size-scale-range"),A$=Ie(1,E$,k$);for(const kw of dO)if(kw.hasLayoutProperty("icon-image")){const hO=uO.getAppearanceValueAndResolveTokens(kw,"icon-image",lO,cO,Sk);if(hO){const fO=xp.getResolvedImageFromTokens(hO);if(fO){const pO=kw.hasLayoutProperty("icon-size")?kw.getUnevaluatedLayoutProperty("icon-size"):S$._values["icon-size"],C$=$v(fO,no(xp.zoom,pO,xp.worldview,Sk),pO,cO,xp.zoom,lO,xp.pixelRatio,A$,xp.worldview,Sk),mO=T$.get(C$.iconPrimary.toString());mO&&(Ig=Math.max(Ig,B6(mO)))}}}return Ig}(Yt,nl,rl,kr.layout,kr._unevaluatedLayout,Pr,aa,Yt.iconAtlasPositions,0,io);Sw=4*uc;const v0=kr.layout.get("icon-size").evaluate(Pr,{},aa,io),v$=ho.compositeIconSizes?ho.compositeIconSizes[0].evaluate(Pr,{},aa,io):0,x$=ho.compositeIconSizes?ho.compositeIconSizes[1].evaluate(Pr,{},aa,io):0,sO=_E(Yt.layerIds[0],Yt.iconSizeData,v0,li.imagePrimary.usvg?1:ho.iconScaleFactor,v$,x$);Yt.addSymbols(Yt.icon,nl,sO,Pi,Ro,Pr,void 0,ar,gr,vn.lineStartIndex,vn.lineLength,-1,io,aa,ph,_0,Yt.symbolInstances.length,uc),Ag=Yt.icon.placedSymbolArray.length-1,rl&&(Tw=4*uc,Yt.addSymbols(Yt.icon,rl,sO,Pi,Ro,Pr,Kt.vertical,ar,gr,vn.lineStartIndex,vn.lineLength,-1,io,aa,ph,_0,Yt.symbolInstances.length,uc),Fi=Yt.icon.placedSymbolArray.length-1)}for(const Ns in wr.horizontal){const nl=Ns,rl=wr.horizontal[nl];Di||(oo=lm(rl.text),jo?ca=yE(rl):Di=k1(Mi,ps,gr,uo,ki,yn,rl,Vo,kr.layout.get("text-rotate").evaluate(Pr,{},aa),Do,Eg));const uc=rl.positionedLines.length===1;if(kg+=WP(Yt,ar,gr,rl,Po,kr,jo,Pr,Do,vn,wr.vertical?Kt.horizontal:Kt.horizontalOnly,uc?U6(wr.horizontal):[nl],yi,Ag,ho,io,aa,Yt.symbolInstances.length,ph),uc)break}wr.vertical&&(y0+=WP(Yt,ar,gr,wr.vertical,Po,kr,jo,Pr,Do,vn,Kt.vertical,["vertical"],yi,Fi,ho,io,aa,Yt.symbolInstances.length,ph));let tl=-1;const Cg=(Ns,nl)=>Ns?Math.max(Ns,nl):nl;tl=Cg(ca,tl),tl=Cg(Ia,tl),tl=Cg(Ma,tl);const Ew=tl>-1?1:0;Yt.glyphOffsetArray.length>=65535&&Cn("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Pr.sortKey!==void 0&&Yt.addToSortKeyRanges(Yt.symbolInstances.length,Pr.sortKey),Yt.symbolInstances.emplaceBack(gr.x,gr.y,ps.x,ps.y,ps.z,yi.right>=0?yi.right:-1,yi.center>=0?yi.center:-1,yi.left>=0?yi.left:-1,yi.vertical>=0?yi.vertical:-1,Ag,Fi,oo,Di!==void 0?Di:Yt.collisionBoxArray.length,Di!==void 0?Di+1:Yt.collisionBoxArray.length,Ai!==void 0?Ai:Yt.collisionBoxArray.length,Ai!==void 0?Ai+1:Yt.collisionBoxArray.length,Kr!==void 0?Kr:Yt.collisionBoxArray.length,Kr!==void 0?Kr+1:Yt.collisionBoxArray.length,la||Yt.collisionBoxArray.length,la?la+1:Yt.collisionBoxArray.length,uo,kg,y0,Sw,Tw,Ew,0,ou,cc,tl,0,Yo?1:0,ed)})(o,gn,Gn,en,i,l,p,d,o.layers[0],o.collisionBoxArray,e.index,e.sourceLayerIndex,o.index,rt,K,S,0,lt,tt,G,e,m,C,I,M,O,N,V,Wt,ee,te,le)};if(q==="line")for(const en of r(e.geometry,0,0,St,St)){const gn=ic(en,Ye,yt,i.vertical||Ke,l,24,$e,o.overscaling,St);for(const cn of gn)Ke&&Y6(o,Ke.text,mt,cn)||ln(en,cn,M)}else if(q==="line-center"){for(const en of e.geometry)if(en.length>1){const gn=Qa(en,yt,i.vertical||Ke,l,24,$e);gn&&ln(en,gn,M)}}else if(e.type==="Polygon")for(const en of Bn(e.geometry,0)){const gn=V6(en,16);ln(en[0],new hs(gn.x,gn.y,0,0,void 0),M)}else if(e.type==="LineString")for(const en of e.geometry)ln(en,new hs(en[0].x,en[0].y,0,0,void 0),M);else if(e.type==="Point")for(const en of e.geometry)for(const gn of en)ln([gn],new hs(gn.x,gn.y,0,0,void 0),M)}const gE=255,dp=gE*ur;function WP(o,e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K){const q=BP(0,l,b,p,m,y,d,o.allowVerticalPlacement,void 0,O.textScaleFactor),ee=p.layout.get("text-size").evaluate(y,{},V),te=O.compositeTextSizes?O.compositeTextSizes[0].evaluate(y,{},V):0,le=O.compositeTextSizes?O.compositeTextSizes[1].evaluate(y,{},V):0,xe=_E(o.layerIds[0],o.textSizeData,ee,O.textScaleFactor,te,le);o.addSymbols(o.text,q,xe,b,m,y,C,e,i,S.lineStartIndex,S.lineLength,R,N,V,K,!1,G,q.length);for(const de of I)M[de]=o.text.placedSymbolArray.length-1;return 4*q.length}function _E(o,e,i,l,d,p){const m=e;let y=null;return m.kind==="source"?(y=[ur*i*l],y[0]>dp&&Cn(`${o}: Value for "text-size" or "icon-size" is >= ${gE}. Reduce your "text-size" or "icon-size".`)):m.kind==="composite"&&(y=[ur*d*l,ur*p*l],(y[0]>dp||y[1]>dp)&&Cn(`${o}: Value for "text-size" or "icon-size" is >= ${gE}. Reduce your "text-size" or "icon-size".`)),y}function E1(o){for(const e in o)return o[e];return null}function k1(o,e,i,l,d,p,m,y,b,S,C){let I,M,R,O;if(I=C?C.top:m.top,M=C?C.bottom:m.bottom,R=C?C.left:m.left,O=C?C.right:m.right,Hi(m)&&m.collisionPadding){const N=m.collisionPadding;R-=N[0],I-=N[1],O+=N[2],M+=N[3]}if(b){const N=new et(R,I),V=new et(O,I),G=new et(R,M),K=new et(O,M),q=Te(b);let ee=new et(0,0);S&&(ee=new et(S[0],S[1])),N._rotateAround(q,ee),V._rotateAround(q,ee),G._rotateAround(q,ee),K._rotateAround(q,ee),R=Math.min(N.x,V.x,G.x,K.x),O=Math.max(N.x,V.x,G.x,K.x),I=Math.min(N.y,V.y,G.y,K.y),M=Math.max(N.y,V.y,G.y,K.y)}return o.emplaceBack(e.x,e.y,e.z,i.x,i.y,R,I,O,M,y,l,d,p),o.length-1}function yE(o){Hi(o)&&o.collisionPadding&&(o.top-=o.collisionPadding[1],o.bottom+=o.collisionPadding[3]);const e=o.bottom-o.top;return e>0?Math.max(10,e):null}function Y6(o,e,i,l){const d=o.compareText;if(e in d){const p=d[e];for(let m=p.length-1;m>=0;m--)if(l.dist(p[m])<i)return!0}else d[e]=[];return d[e].push(l),!1}const Q6=Sn([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:A1}=Q6,qP=Sn([{name:"a_pos_3",components:3,type:"Int16"}]);var Hv=Sn([{name:"a_pos",type:"Int16",components:2}]);class J6{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,l){const d=_a(i,this.dir);if(Math.abs(d)<1e-6)return!1;const p=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/d;return l[0]=this.pos[0]+this.dir[0]*p,l[1]=this.pos[1]+this.dir[1]*p,!0}}class vE{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,l){const d=Ar(i,this.dir);if(Math.abs(d)<1e-6)return!1;const p=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/d;return l[0]=this.pos[0]+this.dir[0]*p,l[1]=this.pos[1]+this.dir[1]*p,l[2]=this.pos[2]+this.dir[2]*p,!0}closestPointOnSphere(e,i,l){if(function(R,O){var N=R[0],V=R[1],G=R[2],K=O[0],q=O[1],ee=O[2];return Math.abs(N-K)<=L*Math.max(1,Math.abs(N),Math.abs(K))&&Math.abs(V-q)<=L*Math.max(1,Math.abs(V),Math.abs(q))&&Math.abs(G-ee)<=L*Math.max(1,Math.abs(G),Math.abs(ee))}(this.pos,e)||i===0)return l[0]=l[1]=l[2]=0,!1;const[d,p,m]=this.dir,y=this.pos[0]-e[0],b=this.pos[1]-e[1],S=this.pos[2]-e[2],C=d*d+p*p+m*m,I=2*(y*d+b*p+S*m),M=I*I-4*C*(y*y+b*b+S*S-i*i);if(M<0){const R=Math.max(-I/2,0),O=y+d*R,N=b+p*R,V=S+m*R,G=Math.hypot(O,N,V);return l[0]=O*i/G,l[1]=N*i/G,l[2]=V*i/G,!1}{const R=(-I-Math.sqrt(M))/(2*C);if(R<0){const O=Math.hypot(y,b,S);return l[0]=y*i/O,l[1]=b*i/O,l[2]=S*i/O,!1}return l[0]=y+d*R,l[1]=b+p*R,l[2]=S+m*R,!0}}}class xE{constructor(e,i,l,d,p){this.TL=e,this.TR=i,this.BR=l,this.BL=d,this.horizon=p}static fromInvProjectionMatrix(e,i,l){const d=[-1,1,1],p=[1,1,1],m=[1,-1,1],y=[-1,-1,1],b=Tr(d,d,e),S=Tr(p,p,e),C=Tr(m,m,e),I=Tr(y,y,e);return new xE(b,S,C,I,i/l)}}function bE(o,e,i,l){const d=e[0],p=e[1],m=e[2],y=i[0],b=i[1],S=i[2];let C=1/0,I=-1/0;for(let M=0;M<o.length;M++){const R=o[M],O=(R[0]-d)*y+(R[1]-p)*b+(R[2]-m)*S;O<C&&(C=O),O>I&&(I=O)}return l[0]=C,l[1]=I,l}function ZP(o,e){let i=!0;for(let l=0;l<o.planes.length;l++){const d=o.planes[l];let p=0;for(let m=0;m<e.length;m++)p+=+(Ar(d,e[m])+d[3]>=0);if(p===0)return 0;p!==e.length&&(i=!1)}return i?2:1}const e8=[0,0];function XP(o,e){for(const i of o.projections){const l=bE(e,o.points[0],i.axis,e8);if(i.projection[1]<l[0]||i.projection[0]>l[1])return 0}return 1}function KP(o,e){const i=e[0],l=e[1],d=e[2],p=e[3];for(let m=0;m<o.length;m++){const y=o[m];if(i*y[0]+l*y[1]+d*y[2]+p>=0)return!0}return!1}class wE{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=Qr.fromPoints(this.points),this.projections=[],this.frustumEdges=[Or([],this.points[2],this.points[3]),Or([],this.points[0],this.points[3]),Or([],this.points[4],this.points[0]),Or([],this.points[5],this.points[1]),Or([],this.points[6],this.points[2]),Or([],this.points[7],this.points[3])];for(const l of this.frustumEdges){const d=[0,-l[2],l[1]],p=[l[2],0,-l[0]];this.projections.push({axis:d,projection:bE(this.points,this.points[0],d,[0,0])}),this.projections.push({axis:p,projection:bE(this.points,this.points[0],p,[0,0])})}}static fromInvProjectionMatrix(e,i,l,d){const p=Math.pow(2,l),m=[[-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(S=>{const C=oi([],S,e),I=1/C[3]/i*p;return(M=C)[0]=(R=C)[0]*(O=[I,I,d?1/C[3]:I,I])[0],M[1]=R[1]*O[1],M[2]=R[2]*O[2],M[3]=R[3]*O[3],M;var M,R,O}),y=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(S=>{const C=$n([],pi([],Or([],m[S[0]],m[S[1]]),Or([],m[S[2]],m[S[1]]))),I=-Ar(C,m[S[1]]);return C.concat(I)}),b=[];for(let S=0;S<m.length;S++)b.push([m[S][0],m[S][1],m[S][2]]);return new wE(b,y)}intersectsPrecise(e,i,l){for(let b=0;b<i.length;b++)if(!KP(e,i[b]))return 0;for(let b=0;b<this.planes.length;b++)if(!KP(e,this.planes[b]))return 0;const d=this.points,p=d[0][0],m=d[0][1],y=d[0][2];for(const b of l)for(const S of this.frustumEdges){const C=b[1]*S[2]-b[2]*S[1],I=b[2]*S[0]-b[0]*S[2],M=b[0]*S[1]-b[1]*S[0];if(C===0&&I===0&&M===0)continue;let R=1/0,O=-1/0;for(let G=0;G<d.length;G++){const K=d[G],q=(K[0]-p)*C+(K[1]-m)*I+(K[2]-y)*M;q<R&&(R=q),q>O&&(O=q)}let N=1/0,V=-1/0;for(let G=0;G<e.length;G++){const K=e[G],q=(K[0]-p)*C+(K[1]-m)*I+(K[2]-y)*M;q<N&&(N=q),q>V&&(V=q)}if(R>V||N>O)return 0}return 1}containsPoint(e){for(const i of this.planes){const l=i[3];if(Ar([i[0],i[1],i[2]],e)+l<0)return!1}return!0}}class Qr{static fromPoints(e){const i=[1/0,1/0,1/0],l=[-1/0,-1/0,-1/0];for(const d of e)Vn(i,i,d),Mn(l,l,d);return new Qr(i,l)}static fromTileIdAndHeight(e,i,l){const d=1<<e.canonical.z,p=e.canonical.x,m=e.canonical.y;return new Qr([p/d,m/d,i],[(p+1)/d,(m+1)/d,l])}static applyTransform(e,i){const l=e.getCorners();for(let d=0;d<l.length;++d)Tr(l[d],l[d],i);return Qr.fromPoints(l)}static applyTransformFast(e,i){const l=[i[12],i[13],i[14]],d=[...l];for(let p=0;p<3;p++)for(let m=0;m<3;m++){const y=i[4*m+p],b=y*e.min[m],S=y*e.max[m];l[p]+=Math.min(b,S),d[p]+=Math.max(b,S)}return new Qr(l,d)}static projectAabbCorners(e,i){const l=e.getCorners();for(let d=0;d<l.length;++d)Tr(l[d],l[d],i);return l}constructor(e,i){this.min=e,this.max=i,this.center=Tn([],Pt([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],l=Zt(this.min),d=Zt(this.max);for(let p=0;p<i.length;p++)l[p]=i[p]?this.min[p]:this.center[p],d[p]=i[p]?this.center[p]:this.max[p];return d[2]=this.max[2],new Qr(l,d)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}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)?ZP(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?ZP(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)?XP(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?XP(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])]}}function C1(o){return o*Xo/Kd}Mt(Qr,"Aabb");const t8=[new Qr([ka,ka,ka],[Aa,Aa,Aa]),new Qr([ka,ka,ka],[0,0,Aa]),new Qr([0,ka,ka],[Aa,0,Aa]),new Qr([ka,0,ka],[0,Aa,Aa]),new Qr([0,0,ka],[Aa,Aa,Aa])];function YP(o,e,i,l=!0){const d=Tn([],o._camera.position,o.worldSize),p=[e,i,1,1];oi(p,p,o.pixelMatrixInverse),za(p,p,1/p[3]);const m=$n([],Or([],p,d)),y=o.globeMatrix,b=[y[12],y[13],y[14]],S=Or([],b,d),C=zt(S),I=$n([],S),M=o.worldSize/(2*Math.PI),R=Ar(I,m),O=Math.asin(M/C);if(O<Math.acos(R)){if(!l)return null;const Se=[],we=[];Tn(Se,m,C/R),$n(we,Or(we,Se,S)),$n(m,Pt(m,S,Tn(m,we,Math.tan(O)*C)))}const N=[];new vE(d,m).closestPointOnSphere(b,M,N);const V=$n([],ja(y,0)),G=$n([],ja(y,1)),K=$n([],ja(y,2)),q=Ar(V,N),ee=Ar(G,N),te=Ar(K,N),le=ke(Math.asin(-ee/M));let xe=ke(Math.atan2(q,te));xe=o.center.lng+function(Se,we){const Fe=(we-Se+180)%360-180;return Fe<-180?Fe+360:Fe}(o.center.lng,xe);const de=wl(xe),ve=Ie(ba(le),0,1);return new No(de,ve)}class n8{constructor(e,i,l){this.a=Or([],e,l),this.b=Or([],i,l),this.center=l;const d=$n([],this.a),p=$n([],this.b);this.angle=Math.acos(Ar(d,p))}}function SE(o,e){if(o.angle===0)return null;let i;return i=o.a[e]===0?1/o.angle*.5*Math.PI:1/o.angle*Math.atan(o.b[e]/o.a[e]/Math.sin(o.angle)-1/Math.tan(o.angle)),i<0||i>1?null:function(l,d,p,m){const y=Math.sin(p);return l*(Math.sin((1-m)*p)/y)+d*(Math.sin(m*p)/y)}(o.a[e],o.b[e],o.angle,Ie(i,0,1))+o.center[e]}function eu(o){if(o.z<=1)return t8[o.z+2*o.y+o.x];const e=TE(I1(o));return Qr.fromPoints(e)}function Xu(o,e,i){return Tn(o,o,1-i),Wr(o,o,e,i)}function QP(o,e){const i=Ku(e.zoom);if(i===0)return eu(o);const l=I1(o),d=TE(l),p=wl(l.getWest())*e.worldSize,m=wl(l.getEast())*e.worldSize,y=ba(l.getNorth())*e.worldSize,b=ba(l.getSouth())*e.worldSize,S=[p,y,0],C=[m,y,0],I=[p,b,0],M=[m,b,0],R=re([],e.globeMatrix);return Tr(S,S,R),Tr(C,C,R),Tr(I,I,R),Tr(M,M,R),d[0]=Xu(d[0],I,i),d[1]=Xu(d[1],M,i),d[2]=Xu(d[2],C,i),d[3]=Xu(d[3],S,i),Qr.fromPoints(d)}function JP(o,e,i){for(const l of o)Tr(l,l,e),Tn(l,l,i)}function eD(o,e,i,l){const d=e/o.worldSize,p=o.globeMatrix;if(i.z<=1){const ve=eu(i).getCorners();return JP(ve,p,d),Qr.fromPoints(ve)}const m=I1(i,l),y=TE(m,Xo+C1(o._tileCoverLift));JP(y,p,d);const b=Number.MAX_VALUE,S=[-b,-b,-b],C=[b,b,b];if(m.contains(o.center)){for(const we of y)Vn(C,C,we),Mn(S,S,we);S[2]=0;const ve=o.point,Se=[ve.x*d,ve.y*d,0];return Vn(C,C,Se),Mn(S,S,Se),new Qr(C,S)}if(o._tileCoverLift>0){for(const ve of y)Vn(C,C,ve),Mn(S,S,ve);return new Qr(C,S)}const I=[p[12]*d,p[13]*d,p[14]*d],M=m.getCenter(),R=Ie(o.center.lat,-85.051129,Ss),O=Ie(M.lat,-85.051129,Ss),N=wl(o.center.lng),V=ba(R);let G=N-wl(M.lng);const K=V-ba(O);G>.5?G-=1:G<-.5&&(G+=1);let q=0;Math.abs(G)>Math.abs(K)?q=G>=0?1:3:(q=K>=0?0:2,Wr(I,I,[p[4]*d,p[5]*d,p[6]*d],-Math.sin(Te(K>=0?m.getSouth():m.getNorth()))*Xo));const ee=y[q],te=y[(q+1)%4],le=new n8(ee,te,I),xe=[SE(le,0)||ee[0],SE(le,1)||ee[1],SE(le,2)||ee[2]],de=Ku(o.zoom);if(de>0){const ve=function({x:we,y:Fe,z:Ve},qe,Ke,je,at){const Ge=1/(1<<Ve);let $e=we*Ge,Ye=$e+Ge,rt=Fe*Ge,lt=rt+Ge,yt=0;const tt=($e+Ye)/2-je;return tt>.5?yt=-1:tt<-.5&&(yt=1),$e=(($e+yt)*qe-(je*=qe))*Ke+je,Ye=((Ye+yt)*qe-je)*Ke+je,rt=(rt*qe-(at*=qe))*Ke+at,lt=(lt*qe-at)*Ke+at,[[$e,lt,0],[Ye,lt,0],[Ye,rt,0],[$e,rt,0]]}(i,e,o._pixelsPerMercatorPixel,N,V);for(let we=0;we<y.length;we++)Xu(y[we],ve[we],de);const Se=Pt([],ve[q],ve[(q+1)%4]);Tn(Se,Se,.5),Xu(xe,Se,de)}for(const ve of y)Vn(C,C,ve),Mn(S,S,ve);return C[2]=Math.min(ee[2],te[2]),Vn(C,C,xe),Mn(S,S,xe),new Qr(C,S)}function I1({x:o,y:e,z:i},l=!1){const d=1/(1<<i),p=new Qn(cs(o*d),e===(1<<i)-1&&l?-90:Si((e+1)*d)),m=new Qn(cs((o+1)*d),e===0&&l?90:Si(e*d));return new ec(p,m)}function TE(o,e=Xo){const i=Te(o.getNorth()),l=Te(o.getSouth()),d=Math.cos(i),p=Math.cos(l),m=Math.sin(i),y=Math.sin(l),b=o.getWest(),S=o.getEast();return[Xd(p,y,b,e),Xd(p,y,S,e),Xd(d,m,S,e),Xd(d,m,b,e)]}function Wv(o,e,i,l){const d=1<<i.z,p=(o/St+i.x)/d;return Uu(Si((e/St+i.y)/d),cs(p),l)}function M1({min:o,max:e}){return 16383/Math.max(e[0]-o[0],e[1]-o[1],e[2]-o[2])}const P1=new Float64Array(16);function qv(o){const e=M1(o),i=At(P1,[e,e,e]);return _e(i,i,wo([],o.min))}function EE(o){const e=1/M1(o);return ft(P1,o.min),De(P1,P1,[e,e,e])}function kE(o){const e=St/(2*Math.PI);return o/(2*Math.PI)/e}function tD(o,e){return St/(512*Math.pow(2,o))*M1(eu(e))}function nD(o,e,i,l,d){const p=kE(i),m=[o,e,-i/(2*Math.PI)],y=oe(new Float64Array(16));return _e(y,y,m),De(y,y,[p,p,p]),He(y,y,Te(-d)),nt(y,y,Te(-l)),y}function Ku(o){return st(5,6,o)}function rD(o,e){const i=Uu(e.lat,e.lng),l=function(O){const N=Uu(O._center.lat,O._center.lng);let V=pi([],vt(0,1,0),N);const G=Bt([],-O.angle,N);V=Tr(V,V,G),Bt(G,-O._pitch,V);const K=$n([],N);return Tn(K,K,C1(O.cameraToCenterDistance/O.pixelsPerMeter)),Tr(K,K,G),Pt([],N,K)}(o);return m=(d=An([],l,i))[0],y=d[1],b=d[2],S=(p=i)[0],C=p[1],I=p[2],R=(M=Math.sqrt((m*m+y*y+b*b)*(S*S+C*C+I*I)))&&Ar(d,p)/M,Math.acos(Math.min(Math.max(R,-1),1));var d,p,m,y,b,S,C,I,M,R}function AE(o,e){return rD(o,e)>Math.PI/2*1.01}const iD=Te(85),r8=Math.cos(iD),i8=Math.sin(iD);function oD(o,e){const i=o.fovAboveCenter,l=o.elevation?o.elevation.getMinElevationBelowMSL()*e:0,d=Math.min(l,o.isOrthographic?-10*e:0),p=(o._camera.position[2]*o.worldSize-d)/Math.cos(o._pitch),m=Math.sin(i)*p/Math.sin(Math.max(Math.PI/2-o._pitch-i,.01));let y=Math.sin(o._pitch)*m+p;const b=p*(1/o._horizonShift);if(!o.elevation||o.elevation.exaggeration()===0){let S=Math.max(o.zoom-17,0);o.isOrthographic&&(S/=10),y*=1+S}return Math.min(1.01*y,b)}class hp{constructor(e,i,l){this.z=e,this.x=i,this.y=l,this.key=pg(0,e,e,i,l)}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 l=function(p,m,y){const b=2**y,S=2*Math.PI*6378137,C=S*(p/b-.5),I=S*(.5-(m+1)/b);return`${C},${I},${C+S/b},${I+S/b}`}(this.x,this.y,this.z),d=function(p,m,y){let b,S="";for(let C=p;C>0;C--)b=1<<C-1,S+=(m&b?1:0)+(y&b?2:0);return S}(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}",d).replace("{bbox-epsg-3857}",l)}toString(){return`${this.z}/${this.x}/${this.y}`}}class sD{constructor(e,i){this.wrap=e,this.canonical=i,this.key=pg(e,i.z,i.z,i.x,i.y)}}class fs{constructor(e,i,l,d,p){this.overscaledZ=e,this.wrap=i,this.canonical=new hp(l,+d,+p),this.key=i===0&&e===l?this.canonical.key:pg(i,e,l,d,p)}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 fs(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new fs(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 pg(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const l=this.canonical.z-e;return pg(this.wrap*+i,e,e,this.canonical.x>>l,this.canonical.y>>l)}}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 fs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,l=2*this.canonical.x,d=2*this.canonical.y;return[new fs(i,this.wrap,i,l,d),new fs(i,this.wrap,i,l+1,d),new fs(i,this.wrap,i,l,d+1),new fs(i,this.wrap,i,l+1,d+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 fs(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new fs(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 sD(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function pg(o,e,i,l,d){const p=1<<Math.min(i,22);let m=p*(d%p)+l%p;return o&&i<22&&(m+=p*p*((o<0?-2*o-1:2*o)%(1<<2*(22-i)))),16*(32*m+i)+(e-i)}const o8=[o=>{let e=o.canonical.x-1,i=o.wrap;return e<0&&(e=(1<<o.canonical.z)-1,i--),new fs(o.overscaledZ,i,o.canonical.z,e,o.canonical.y)},o=>{let e=o.canonical.x+1,i=o.wrap;return e===1<<o.canonical.z&&(e=0,i++),new fs(o.overscaledZ,i,o.canonical.z,e,o.canonical.y)},o=>new fs(o.overscaledZ,o.wrap,o.canonical.z,o.canonical.x,(o.canonical.y===0?1<<o.canonical.z:o.canonical.y)-1),o=>new fs(o.overscaledZ,o.wrap,o.canonical.z,o.canonical.x,o.canonical.y===(1<<o.canonical.z)-1?0:o.canonical.y+1)];function fp(o,e){if(!e.isReprojectedInTileSpace)return{scale:1<<o.z,x:o.x,y:o.y,x2:o.x+1,y2:o.y+1,projection:e};const i=Math.pow(2,-o.z),l=o.x*i,d=(o.x+1)*i,p=o.y*i,m=(o.y+1)*i,y=cs(l),b=cs(d),S=Si(p),C=Si(m),I=e.project(y,S),M=e.project(b,S),R=e.project(b,C),O=e.project(y,C);let N=Math.min(I.x,M.x,R.x,O.x),V=Math.min(I.y,M.y,R.y,O.y),G=Math.max(I.x,M.x,R.x,O.x),K=Math.max(I.y,M.y,R.y,O.y);const q=i/16;function ee(le,xe,de,ve,Se,we){const Fe=(de+Se)/2,Ve=(ve+we)/2,qe=e.project(cs(Fe),Si(Ve)),Ke=Math.max(0,N-qe.x,V-qe.y,qe.x-G,qe.y-K);N=Math.min(N,qe.x),G=Math.max(G,qe.x),V=Math.min(V,qe.y),K=Math.max(K,qe.y),Ke>q&&(ee(le,qe,de,ve,Fe,Ve),ee(qe,xe,Fe,Ve,Se,we))}ee(I,M,l,p,d,p),ee(M,R,d,p,d,m),ee(R,O,d,m,l,m),ee(O,I,l,m,l,p),N-=q,V-=q,G+=q,K+=q;const te=1/Math.max(G-N,K-V);return{scale:te,x:N*te,y:V*te,x2:G*te,y2:K*te,projection:e}}function aD(o,{x:e,y:i},l=0){return new et(((e-l)*o.scale-o.x)*St,(i*o.scale-o.y)*St)}Mt(hp,"CanonicalTileID"),Mt(fs,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const s8=oe(new Float32Array(16));class ah{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 Qn(0,0)}projectTilePoint(e,i,l){return{x:e,y:i,z:0}}locationPoint(e,i,l,d=!0){return e._coordinatePoint(e.locationCoordinate(i,l),d)}pixelsPerMeter(e,i){return Ko(1,e)*i}pixelSpaceConversion(e,i,l){return 1}farthestPixelDistance(e){return oD(e,e.pixelsPerMeter)}pointCoordinate(e,i,l,d){const p=e.horizonLineFromTop(!1),m=new et(i,Math.max(p,l));return e.rayIntersectionCoordinate(e.pointRayIntersection(m,d))}pointCoordinate3D(e,i,l){const d=new et(i,l);if(e.elevation)return e.elevation.pointCoordinate(d);{const p=this.pointCoordinate(e,d.x,d.y,0);return[p.x,p.y,p.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const l=e.horizonLineFromTop();return i.y<l}createInversionMatrix(e,i){return s8}createTileMatrix(e,i,l){let d,p,m;const y=l.canonical,b=oe(new Float64Array(16));if(this.isReprojectedInTileSpace){const S=fp(y,this);d=1,p=S.x+l.wrap*S.scale,m=S.y,De(b,b,[d/S.scale,d/S.scale,e.pixelsPerMeter/i])}else d=i/e.zoomScale(y.z),p=(y.x+Math.pow(2,y.z)*l.wrap)*d,m=y.y*d;return _e(b,b,[p,m,0]),De(b,b,[d/St,d/St,1]),b}upVector(e,i,l){return[0,0,1]}upVectorScale(e,i,l){return{metersToTile:1}}}class a8 extends ah{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,l]=this.parallels=e.parallels||[29.5,45.5],d=Math.sin(Te(i));this.n=(d+Math.sin(Te(l)))/2,this.c=1+d*(2*this.n-d),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:l,c:d,r0:p}=this,m=Te(e-this.center[0]),y=Te(i),b=Math.sqrt(d-2*l*Math.sin(y))/l;return{x:b*Math.sin(m*l),y:b*Math.cos(m*l)-p,z:0}}unproject(e,i){const{n:l,c:d,r0:p}=this,m=p+i;let y=Math.atan2(e,Math.abs(m))*Math.sign(m);m*l<0&&(y-=Math.PI*Math.sign(e)*Math.sign(m));const b=Te(this.center[0])*l;y=dt(y,-Math.PI-b,Math.PI-b);const S=Ie(ke(y/l)+this.center[0],-180,180),C=Math.asin(Ie((d-(e*e+m*m)*l*l)/(2*l),-1,1)),I=Ie(ke(C),-85.051129,Ss);return new Qn(S,I)}}const Zv=1.340264,Xv=-.081106,Kv=893e-6,Yv=.003796,D1=Math.sqrt(3)/2;class l8 extends ah{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const l=Math.asin(D1*Math.sin(i)),d=l*l,p=d*d*d;return{x:.5*(e*Math.cos(l)/(D1*(Zv+3*Xv*d+p*(7*Kv+9*Yv*d)))/Math.PI+.5),y:1-.5*(l*(Zv+Xv*d+p*(Kv+Yv*d))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let l=i=(2*(1-i)-1)*Math.PI,d=l*l,p=d*d*d;for(let C,I,M,R=0;R<12&&(I=l*(Zv+Xv*d+p*(Kv+Yv*d))-i,M=Zv+3*Xv*d+p*(7*Kv+9*Yv*d),C=I/M,l=Ie(l-C,-Math.PI/3,Math.PI/3),d=l*l,p=d*d*d,!(Math.abs(C)<1e-12));++R);const m=D1*e*(Zv+3*Xv*d+p*(7*Kv+9*Yv*d))/Math.cos(l),y=Math.asin(Math.sin(l)/D1),b=Ie(180*m/Math.PI,-180,180),S=Ie(180*y/Math.PI,-85.051129,Ss);return new Qn(b,S)}}class c8 extends ah{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 l=360*(e-.5),d=Ie(360*(.5-i),-85.051129,Ss);return new Qn(l,d)}}const mg=Math.PI/2;function R1(o){return Math.tan((mg+o)/2)}class u8 extends ah{constructor(e){super(e),this.center=e.center||[0,30];const[i,l]=this.parallels=e.parallels||[30,30];let d=Te(i),p=Te(l);this.southernCenter=d+p<0,this.southernCenter&&(d=-d,p=-p);const m=Math.cos(d),y=R1(d);this.n=d===p?Math.sin(d):Math.log(m/Math.cos(p))/Math.log(R1(p)/y),this.f=m*Math.pow(R1(d),this.n)/this.n}project(e,i){i=Te(i),this.southernCenter&&(i=-i),e=Te(e-this.center[0]);const l=1e-6,{n:d,f:p}=this;p>0?i<-mg+l&&(i=-mg+l):i>mg-l&&(i=mg-l);const m=p/Math.pow(R1(i),d);let y=m*Math.sin(d*e),b=p-m*Math.cos(d*e);return y=.5*(y/Math.PI+.5),b=.5*(b/Math.PI+.5),{x:y,y:this.southernCenter?b:1-b,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:l,f:d}=this,p=d-i,m=Math.sign(p),y=Math.sign(l)*Math.sqrt(e*e+p*p);let b=Math.atan2(e,Math.abs(p))*m;p*l<0&&(b-=Math.PI*Math.sign(e)*m);const S=Ie(ke(b/l)+this.center[0],-180,180),C=Ie(ke(2*Math.atan(Math.pow(d/y,1/l))-mg),-85.051129,Ss);return new Qn(S,this.southernCenter?-C:C)}}class lD extends ah{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:wl(e),y:ba(i),z:0}}unproject(e,i){const l=cs(e),d=Si(i);return new Qn(l,d)}}const cD=Te(Ss);class d8 extends ah{project(e,i){const l=(i=Te(i))*i,d=l*l;return{x:.5*((e=Te(e))*(.8707-.131979*l+d*(d*(.003971*l-.001529*d)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+l*(.015085+d*(.028874*l-.044475-.005916*d)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let l=i=(2*(1-i)-1)*Math.PI,d=25,p=0,m=l*l;do{m=l*l;const S=m*m;p=(l*(1.007226+m*(.015085+S*(.028874*m-.044475-.005916*S)))-i)/(1.007226+m*(.045255+S*(.259866*m-.311325-.005916*11*S))),l=Ie(l-p,-cD,cD)}while(Math.abs(p)>1e-6&&--d>0);m=l*l;const y=Ie(ke(e/(.8707+m*(m*(m*m*m*(.003971-.001529*m)-.013791)-.131979))),-180,180),b=ke(l);return new Qn(y,b)}}const uD=Te(Ss);class h8 extends ah{project(e,i){i=Te(i),e=Te(e);const l=Math.cos(i),d=2/Math.PI,p=Math.acos(l*Math.cos(e/2)),m=Math.sin(p)/p,y=.5*(e*d+2*l*Math.sin(e/2)/m)||0,b=.5*(i+Math.sin(i)/m)||0;return{x:.5*(y/Math.PI+.5),y:1-.5*(b/Math.PI+1),z:0}}unproject(e,i){let l=e=(2*e-.5)*Math.PI,d=i=(2*(1-i)-1)*Math.PI,p=25;const m=1e-6;let y=0,b=0;do{const S=Math.cos(d),C=Math.sin(d),I=2*C*S,M=C*C,R=S*S,O=Math.cos(l/2),N=Math.sin(l/2),V=2*O*N,G=N*N,K=1-R*O*O,q=K?1/K:0,ee=K?Math.acos(S*O)*Math.sqrt(1/K):0,te=.5*(2*ee*S*N+2*l/Math.PI)-e,le=.5*(ee*C+d)-i,xe=.5*q*(R*G+ee*S*O*M)+1/Math.PI,de=q*(V*I/4-ee*C*N),ve=.125*q*(I*N-ee*C*R*V),Se=.5*q*(M*O+ee*G*S)+.5,we=de*ve-Se*xe;y=(le*de-te*Se)/we,b=(te*ve-le*xe)/we,l=Ie(l-y,-Math.PI,Math.PI),d=Ie(d-b,-uD,uD)}while((Math.abs(y)>m||Math.abs(b)>m)&&--p>0);return new Qn(ke(l),ke(d))}}class dD extends ah{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Te(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:l,cosPhi:d}=this;return{x:Te(e)*d*l+.5,y:-Math.sin(Te(i))/d*l+.5,z:0}}unproject(e,i){const{scale:l,cosPhi:d}=this,p=-(i-.5)/l,m=Ie(ke((e-.5)/l)/d,-180,180),y=Math.asin(Ie(p*d,-1,1)),b=Ie(ke(y),-85.051129,Ss);return new Qn(m,b)}}class f8 extends lD{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,l){const d=Wv(e,i,l);return Tr(d,d,qv(eu(l))),{x:d[0],y:d[1],z:d[2]}}locationPoint(e,i,l){const d=Uu(i.lat,i.lng),p=$n([],d),m=l?e._centerAltitude+l:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Wr(d,d,p,Ko(1,0)*St*m);const y=oe(new Float64Array(16));return he(y,e.pixelMatrix,e.globeMatrix),Tr(d,d,y),new et(d[0],d[1])}pixelsPerMeter(e,i){return Ko(1,0)*i}pixelSpaceConversion(e,i,l){const d=Ko(1,e)*i,p=Jt(Ko(1,45)*i,d,l);return this.pixelsPerMeter(e,i)/p}createTileMatrix(e,i,l){const d=EE(eu(l.canonical));return he(new Float64Array(16),e.globeMatrix,d)}createInversionMatrix(e,i){const{center:l}=e,d=qv(eu(i));return nt(d,d,Te(l.lng)),He(d,d,Te(l.lat)),De(d,d,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(d)}pointCoordinate(e,i,l,d){return YP(e,i,l,!0)||new No(0,0)}pointCoordinate3D(e,i,l){const d=this.pointCoordinate(e,i,l,0);return[d.x,d.y,d.z]}isPointAboveHorizon(e,i){return!YP(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(d,p){const m=d.cameraToCenterDistance,y=d._centerAltitude*p,b=d._camera,S=d._camera.forward(),C=Pt([],Tn([],S,-m),[0,0,y]),I=d.worldSize/(2*Math.PI),M=[0,0,-I],R=d.width/d.height,O=Math.tan(d.fovAboveCenter),N=Tn([],b.up(),O),V=Tn([],b.right(),O*R),G=$n([],Pt([],Pt([],S,N),V)),K=[];let q;if(new vE(C,G).closestPointOnSphere(M,I,K)){const ee=Pt([],K,M),te=Or([],ee,C);q=Math.cos(d.fovAboveCenter)*zt(te)}else{const ee=Or([],C,M),te=Or([],M,C);$n(te,te);const le=zt(ee)-I;q=Math.sqrt(le*(le+2*I));const xe=Math.acos(q/(I+le))-Math.acos(Ar(S,te));q*=Math.cos(xe)}return 1.01*q}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),l=Ku(e.zoom);if(l>0){const d=oD(e,Ko(1,e.center.lat)*e.worldSize),p=e.worldSize/(2*Math.PI),m=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Jt(i,d+p*(1-Math.cos(m)),Math.pow(l,10))}return i}upVector(e,i,l){return Wv(i,l,e,1)}upVectorScale(e){return{metersToTile:C1(M1(eu(e)))}}}function hD(o){const e=o.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(o.name){case"mercator":return new lD(o);case"equirectangular":return new c8(o);case"naturalEarth":return new d8(o);case"equalEarth":return new l8(o);case"winkelTripel":return new h8(o);case"albers":return i?new dD(o):new a8(o);case"lambertConformalConic":return i?new dD(o):new u8(o);case"globe":return new f8(o)}throw new Error(`Invalid projection name: ${o.name}`)}const Qv=Number.MAX_SAFE_INTEGER,p8=Qv-1;function fD(o,e,i,l){return o.order<e||o.order===Qv||!(o.clipMask&i)||function(d,p){if(p.length===0)return!1;let m=d;for(;m!=="";){if(p.includes(m))return!1;m=$b(m)}return!0}(l,o.clipScope)}function L1(o,e){return o.x-e.x||o.y-e.y}function pD(o,e){return L1(o.min,e.min)===0&&L1(o.max,e.max)===0}function CE(o,e){return!(o.min.x>e.max.x||o.max.x<e.min.x||o.min.y>e.max.y||o.max.y<e.min.y)}function O1(o,e){if(o.length!==e.length)return!1;for(let i=0;i<o.length;i++)if(o[i].sourceId!==e[i].sourceId||!pD(o[i],e[i])||o[i].order!==e[i].order||o[i].clipMask!==e[i].clipMask||!ji(o[i].clipScope,e[i].clipScope))return!1;return!0}function mD(o,e,i){const l=1/St,d=1/(1<<i.canonical.z),p=(e.x*l+i.canonical.x)*d+i.wrap,m=(e.y*l+i.canonical.y)*d;return{min:new et((o.x*l+i.canonical.x)*d+i.wrap,(o.y*l+i.canonical.y)*d),max:new et(p,m)}}function m8(o,e,i){const l=1<<i.canonical.z,d=((e.x-i.wrap)*l-i.canonical.x)*St,p=(e.y*l-i.canonical.y)*St;return{min:new et(((o.x-i.wrap)*l-i.canonical.x)*St,(o.y*l-i.canonical.y)*St),max:new et(d,p)}}function IE(o,e,i,l,d,p,m){const y=o.indices,b=o.vertices,S=[];for(let C=l;C<l+d;C+=3){const I=e[i[C+0]+p],M=e[i[C+1]+p],R=e[i[C+2]+p],O=Math.min(I.x,M.x,R.x),N=Math.max(I.x,M.x,R.x),V=Math.min(I.y,M.y,R.y),G=Math.max(I.y,M.y,R.y);S.length=0,o.grid.query(new et(O,V),new et(N,G),S);for(let K=0;K<S.length;K++){const q=S[K];if(dg(b[y[3*q+0]],b[y[3*q+1]],b[y[3*q+2]],I,M,R,m))return!0}}return!1}function gD(o,e,i,l){if(!o||!i)return!1;let d=o.vertices;if(!e.canonical.equals(l.canonical)||e.wrap!==l.wrap){if(i.vertices.length<o.vertices.length)return gD(i,l,o,e);const p=e.canonical,m=l.canonical,y=Math.pow(2,m.z-p.z);d=o.vertices.map(b=>new et((b.x+p.x*St)*y-m.x*St,(b.y+p.y*St)*y-m.y*St))}return IE(i,d,o.indices,0,o.indices.length,0,0)}function _D(o,e,i,l){const d=Math.pow(2,l.z-i.z);return new et((o+i.x*St)*d-l.x*St,(e+i.y*St)*d-l.y*St)}function yD(o,e){const i=[];e.grid.queryPoint(o,i);const l=e.indices,d=e.vertices;for(let p=0;p<i.length;p++){const m=i[p];if(Qc([d[l[3*m+0]],d[l[3*m+1]],d[l[3*m+2]]],o))return!0}return!1}class g8{constructor(e,i){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=i,this.appearances=e;const l=e.map(d=>function(p){if(!p.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const m=p.condition.expression;return{featureDependent:!wn(m),stateDependent:!Dd(m),zoomDependent:!Tl(m,["zoom"]),pitchDependent:!Tl(m,["pitch"]),brightnessDependent:!Tl(m,["brightness","measure-light"]),worldviewDependent:!Tl(m,["worldview"])}}(d));this.anyFeatureDependent=l.some(d=>d.featureDependent),this.anyStateDependent=l.some(d=>d.stateDependent)}update(e,i){const l=this.lastParams,d=!l||l.zoom!==e.zoom||l.pitch!==(e.pitch||0)||l.brightness!==(e.brightness||0)||l.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const p=i&&this.anyStateDependent;if(!d&&!p&&this.lastAllFeaturesIndex!==-2)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!p){const m=this.evaluateAllFeatures(e);return m===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=m,{kind:"all-features",appearanceIndex:m})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let i=0;i<this.appearances.length;i++){const l=this.appearances[i];if(l.condition&&l.condition.evaluate(e,void 0,void 0,void 0))return i}return-1}}const _8=Yc.types,y8=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Jv(o,e,i,l,d,p,m,y,b,S,C,I,M){const R=y?Math.min(dp,Math.round(y[0])):0,O=y?Math.min(dp,Math.round(y[1])):0;o.emplaceBack(e,i,Math.round(32*l),Math.round(32*d),p,m,(R<<1)+(b?1:0),0+(O<<1),16*S,16*C,256*I,256*M)}function e0(o,e,i){o.emplaceBack(e,i)}function t0(o,e,i,l,d,p,m){o.emplaceBack(e,i,l,d,p,m)}function gg(o,e,i,l,d){o.emplaceBack(e,i,l,d),o.emplaceBack(e,i,l,d),o.emplaceBack(e,i,l,d),o.emplaceBack(e,i,l,d)}function v8(o){for(const e of o.sections)if(C2(e.text))return!0;return!1}const _g=12;class ME{constructor(e){this.layoutVertexArray=new vv,this.indexArray=new _i,this.programConfigurations=e,this.segments=new pr,this.dynamicLayoutVertexArray=new nc,this.opacityVertexArray=new eg,this.placedSymbolArray=new o1,this.iconTransitioningVertexArray=new ta,this.globeExtVertexArray=new xv,this.zOffsetVertexArray=new Xa,this.orientationVertexArray=new Sv,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new Xa,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getBatchGrouping(e){const i=e.get().length===this.segments.get().length;if(i&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const l=new Map;for(const m of e.get()){const y=m.batchIndex!==void 0?m.batchIndex:0;l.has(y)||l.set(y,[]),l.get(y).push(m)}const d=Array.from(l.keys()).sort((m,y)=>m-y),p=new Map;for(const m of d){const y=l.get(m);p.set(m,new pr(y))}return i&&(this.cachedBatchIndices=d,this.cachedBatchSegments=p),{batchIndices:d,batchSegments:p}}snapshotSymbolVertexData(e,i){const l=e*_g;return this.layoutVertexArray.uint16.slice(l,l+i*_g)}restoreSymbolVertexData(e,i){this.layoutVertexArray.uint16.set(i,e*_g)}updateSymbolVertexData(e,i,l,d,p,m,y,b,S,C,I,M,R){const O=this.layoutVertexArray.uint16,N=e*_g;O[N]=i,O[N+1]=l,O[N+2]=d,O[N+3]=p,O[N+4]=m,O[N+5]=y,O[N+6]=b,O[N+7]=S,O[N+8]=C,O[N+9]=I,O[N+10]=M,O[N+11]=R}upload(e,i,l,d,p,m){this.isEmpty()||(l&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ee.members,!!m),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,ye.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,y8,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Oe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Pe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||p)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,be.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,ze.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,Ce.members,!1))),(l||d)&&(this.programConfigurations.upload(e),this.uboBinder&&this.uboBinder.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(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}Mt(ME,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class PE{constructor(e,i,l){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new l,this.segments=new pr,this.collisionVertexArray=new Al,this.collisionVertexArrayExt=new nc}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ze.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,We.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Mt(PE,"CollisionBuffers");class Rl{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(m=>m.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=oe([]),this.placementViewportMatrix=oe([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.disableSymbolUBO=e.disableSymbolUBO,this.textSizeData=no(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=no(this.zoom,i["icon-size"],this.worldview,e.availableImages);const l=this.layers[0].layout,d=l.get("symbol-sort-key"),p=l.get("symbol-z-order");this.lut=e.lut,this.canOverlap=l.get("text-allow-overlap")||l.get("icon-allow-overlap")||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=p!=="viewport-y"&&d.constantOr(1)!==void 0,this.sortFeaturesByY=(p==="viewport-y"||p==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=l.get("text-writing-mode").map(m=>Kt[m]),this.stateDependentLayerIds=this.layers.filter(m=>m.isStateDependent()).map(m=>m.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(e){const i=this.layers[0].getAppearances();if(!i||i.length===0)return!1;const l=Array.isArray(e)?e:[e];return i.some(d=>l.some(p=>d.hasLayoutProperty(p)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new ME(new Ya(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new ME(new Ya(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new gt(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new gt(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new l1,this.lineVertexArray=new c1,this.symbolInstances=new a1}calculateGlyphDependencies(e,i,l,d,p){for(const m of e){const y=m.codePointAt(0);if(y===void 0)break;if(i[y]=!0,d&&p&&y<=65535){const b=Ot[m];b&&(i[b.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,l,d,p,m,y){if(!e.hasLayoutProperty("icon-size"))return y*m;let b=1;const S=e.getUnevaluatedLayoutProperty("icon-size"),C=no(this.zoom,S,this.worldview,p),I=Mo(C,i);if(C.kind!=="constant"&&C.kind!=="camera"||(b=I.uSize),C.kind==="composite"){const{minZoom:M,maxZoom:R}=C,O=S.possiblyEvaluate(new Yn(M,{worldview:this.worldview}),d),N=S.possiblyEvaluate(new Yn(R,{worldview:this.worldview}),d),V=O.evaluate(l,{},d,p);b=V+(N.evaluate(l,{},d,p)-V)*I.uSizeT}return C.kind==="source"&&(b=S.possiblyEvaluate(new Yn(this.zoom,{worldview:this.worldview}),d).evaluate(l,{},d,p)),b*m}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!O1(this.activeReplacements,l)&&(this.activeReplacements=l,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?ls.build(e):e}populate(e,i,l,d){const p=this.layers[0],m=p.layout,y=this.projection.name==="globe",b=m.get("text-font"),S=m.get("text-field"),C=m.get("icon-image"),[I,M]=m.get("icon-size-scale-range"),R=Ie(i.scaleFactor||1,I,M),[O,N]=m.get("text-size-scale-range"),V=Ie(i.scaleFactor||1,O,N),G=(S.value.kind!=="constant"||S.value.value instanceof Ao&&!S.value.value.isEmpty()||S.value.value.toString().length>0)&&(b.value.kind!=="constant"||b.value.value.length>0),K=C.value.kind!=="constant"||!!C.value.value||Object.keys(C.parameters).length>0,q=this.hasAnyAppearanceLayoutProperty("icon-image"),ee=m.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!G&&!K&&!q)return;const te=i.iconDependencies,le=i.glyphDependencies,xe=i.availableImages,de=new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),ve=Se=>{const we=Se.id.toString();te.has(we)?te.get(we).push(Se):te.set(we,[Se])};for(const Se of e){const{feature:we,id:Fe,index:Ve,sourceLayerIndex:qe}=Se,Ke=p._featureFilter.needGeometry,je=Ls(we,Ke);if(!p._featureFilter.filter(de,je,l))continue;if(Ke||(je.geometry=Js(we,l,d)),y&&we.type!==1&&l.z<=5){const tt=je.geometry,mt=.98078528056,bt=(Ft,Rt)=>Ar(Wv(Ft.x,Ft.y,l,1),Wv(Rt.x,Rt.y,l,1))<mt;for(let Ft=0;Ft<tt.length;Ft++)tt[Ft]=n1(tt[Ft],bt)}let at,Ge;if(G){const tt=p.getValueAndResolveTokens("text-field",je,l,xe),mt=Ao.factory(tt);v8(mt)&&(this.hasRTLText=!0),(!this.hasRTLText||tv()==="unavailable"||this.hasRTLText&&qa.isParsed())&&(at=Ht(mt,p,je))}if(K){const tt=p.getValueAndResolveTokens("icon-image",je,l,xe);Ge=this.getResolvedImageFromTokens(tt)}const $e=this.layers[0];let Ye=!1;if(!Ge&&q){const tt=$e.getAppearances();for(const mt of tt)if(mt.getLayoutProperty("icon-image")){const bt=$e.getAppearanceValueAndResolveTokens(mt,"icon-image",je,l,xe);if(bt){Ge=this.getResolvedImageFromTokens(bt),Ye=!0;break}}}if(!at&&!Ge)continue;const rt=this.sortFeaturesByKey?ee.evaluate(je,{},l):void 0,lt={id:Fe,text:at,icon:Ge,index:Ve,sourceLayerIndex:qe,geometry:je.geometry,properties:we.properties,type:_8[we.type],sortKey:rt};if(this.features.push(lt),this.featureAppearanceData.set(Ve,{id:Fe,properties:we.properties,usesAppearanceIconAsPlaceholder:Ye}),Ge){const tt=$e._unevaluatedLayout._values,{iconPrimary:mt,iconSecondary:bt}=$v(Ge,this.iconSizeData,tt["icon-size"],l,this.zoom,lt,this.pixelRatio,R,this.worldview,xe);ve(mt),bt&&(this.hasAnySecondaryIcon=!0,ve(bt))}const yt=$e.getAppearances();if(yt.length!==0&&yt.forEach(tt=>{if(!tt.getLayoutProperty("icon-image"))return;const mt=this.getCombinedIconPrimary(tt,$e,je,l,xe,lt,R);mt&&ve(mt)}),at){const tt=b.evaluate(je,{},l).join(","),mt=m.get("text-rotation-alignment")==="map"&&m.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(Kt.vertical);for(const bt of at.sections)if(bt.image){const Ft=bt.image.getPrimary().scaleSelf(this.pixelRatio*V),Rt=Ft.id.toString(),Wt=te.get(Rt)||[];Wt.push(Ft),te.set(Rt,Wt)}else{const Ft=Yy(at.toString()),Rt=bt.fontStack||tt,Wt=le[Rt]=le[Rt]||{};this.calculateGlyphDependencies(bt.text,Wt,mt,this.allowVerticalPlacement,Ft)}}}m.get("symbol-placement")==="line"&&(this.features=function(Se){const we={},Fe={},Ve=[];let qe=0;function Ke($e){Ve.push(Se[$e]),qe++}function je($e,Ye,rt){const lt=Fe[$e];return delete Fe[$e],Fe[Ye]=lt,Ve[lt].geometry[0].pop(),Ve[lt].geometry[0]=Ve[lt].geometry[0].concat(rt[0]),lt}function at($e,Ye,rt){const lt=we[Ye];return delete we[Ye],we[$e]=lt,Ve[lt].geometry[0].shift(),Ve[lt].geometry[0]=rt[0].concat(Ve[lt].geometry[0]),lt}function Ge($e,Ye,rt){const lt=rt?Ye[0].at(-1):Ye[0][0];return`${$e}:${lt.x}:${lt.y}`}for(let $e=0;$e<Se.length;$e++){const Ye=Se[$e],rt=Ye.geometry,lt=Ye.text?Ye.text.toString():null;if(!lt){Ke($e);continue}const yt=Ge(lt,rt),tt=Ge(lt,rt,!0);if(yt in Fe&&tt in we&&Fe[yt]!==we[tt]){const mt=at(yt,tt,rt),bt=je(yt,tt,Ve[mt].geometry);delete we[yt],delete Fe[tt],Fe[Ge(lt,Ve[bt].geometry,!0)]=bt,Ve[mt].geometry=null}else yt in Fe?je(yt,tt,rt):tt in we?at(yt,tt,rt):(Ke($e),we[yt]=qe-1,Fe[tt]=qe-1)}return Ve.filter($e=>$e.geometry)}(this.features)),m.get("symbol-elevation-reference")==="hd-road-markup"?(this.elevationType="road",this.hdExt&&i.elevationFeatures&&i.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(i.elevationFeatures)):m.get("symbol-z-elevate")&&(this.elevationType="offset"),this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((Se,we)=>Se.sortKey-we.sortKey)}getCombinedIconPrimary(e,i,l,d,p,m,y){let b,S;if(e.hasLayoutProperty("icon-image")){const C=i.getAppearanceValueAndResolveTokens(e,"icon-image",l,d,p);b=this.getResolvedImageFromTokens(C)}else{const C=i.getValueAndResolveTokens("icon-image",l,d,p);b=this.getResolvedImageFromTokens(C)}if(b){const C=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):i._unevaluatedLayout._values["icon-size"];S=$v(b,no(this.zoom,C,this.worldview,p),C,d,this.zoom,m,this.pixelRatio,y,this.worldview,p).iconPrimary}return S}updateSymbolInstanceIconVertices(e,i,l,d,p,m){const{canonical:y,availableImages:b,globalProperties:S,layer:C,iconScaleFactor:I,featureState:M,layoutIconOffset:R,layoutIconSize:O,layoutIconRotate:N}=m;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(i.activeAppearanceIndex===l)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const V=l>=0?C.appearances[l]:null;if(V){const G=this.getCombinedIconPrimary(V,C,d,y,b,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:i.properties,type:"Point",id:i.id},I);if(!G)return{vertexOffsetDelta:0,hasChanges:!1};const K=G.toString(),q=this.iconAtlasPositions&&this.iconAtlasPositions.get(K);if(q){const{appearanceIconOffset:ee,appearanceIconRotate:te}=VP(V,C,d,y,R,N,O,I);let le=mr(q,void 0,ee,C.layout.get("icon-anchor").evaluate(d,M,y));const xe=q.sdf,de=C.layout.get("icon-text-fit").constantOr("none");de!=="none"&&i.textShaping&&i.iconTextFitPadding&&i.fontScale&&(le=br(le,i.textShaping,de,i.iconTextFitPadding,ee,i.fontScale));const ve=this.calculateEffectiveAppearanceIconSize(V,S.zoom,d,y,b,I,O),Se=0,we=1+(Math.min(dp,Math.round(ve*ur))<<1),Fe=fE(le,te,xe,de!=="none",I);i.isUsingAppearanceIconVertexData||(i.isUsingAppearanceIconVertexData=!0,i.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(p,e.numIconVertices));const Ve=Math.floor(e.numIconVertices/4),qe=Math.min(Fe.length,Ve);let Ke=p;for(let at=0;at<qe;++at){const Ge=Fe[at],$e=i.layoutBasedIconVertexData[0]||e.tileAnchorX,Ye=i.layoutBasedIconVertexData[1]||e.tileAnchorY,rt=16*Ge.pixelOffsetTL.x,lt=16*Ge.pixelOffsetTL.y,yt=16*Ge.pixelOffsetBR.x,tt=16*Ge.pixelOffsetBR.y,mt=16*Ge.minFontScaleX,bt=16*Ge.minFontScaleY;this.icon.updateSymbolVertexData(Ke,$e,Ye,Math.round(32*Ge.tl.x),Math.round(32*Ge.tl.y),Ge.texPrimary.x,Ge.texPrimary.y,Se,we,rt,lt,mt,bt),this.icon.updateSymbolVertexData(Ke+1,$e,Ye,Math.round(32*Ge.tr.x),Math.round(32*Ge.tr.y),Ge.texPrimary.x+Ge.texPrimary.w,Ge.texPrimary.y,Se,we,yt,lt,mt,bt),this.icon.updateSymbolVertexData(Ke+2,$e,Ye,Math.round(32*Ge.bl.x),Math.round(32*Ge.bl.y),Ge.texPrimary.x,Ge.texPrimary.y+Ge.texPrimary.h,Se,we,rt,tt,mt,bt),this.icon.updateSymbolVertexData(Ke+3,$e,Ye,Math.round(32*Ge.br.x),Math.round(32*Ge.br.y),Ge.texPrimary.x+Ge.texPrimary.w,Ge.texPrimary.y+Ge.texPrimary.h,Se,we,yt,tt,mt,bt),Ke+=4}const je=e.numIconVertices-4*qe;for(let at=0;at<je;++at)this.icon.updateSymbolVertexData(Ke+at,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(i.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(p,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(p+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(p+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(p+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0};if(i.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(p,i.layoutBasedIconVertexData),i.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:i.layoutBasedIconVertexData.length/_g,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,i,l,d,p,m){const{canonical:y,layer:b,textScaleFactor:S,imageMap:C,featureState:I,layoutTextOffset:M,layoutTextSize:R,layoutTextRotate:O,layoutMinZoomSize:N,layoutMaxZoomSize:V,layoutTextSizeMinZoom:G,layoutTextSizeMaxZoom:K,availableImages:q}=m,ee=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!ee)return{vertexOffsetDelta:ee?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearanceIndex===l)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const te=l>=0?b.appearances[l]:null;if(te&&i.textShaping){const{appearanceTextOffset:le,appearanceTextRotate:xe,appearanceTextSize:de}=jP(te,b,d,y,M,O,R);i.fontScale=HP(de,i.textScaleFactor);const ve=te.getUnevaluatedLayoutProperty("text-size");let Se=this.textSizeData,we=G,Fe=K;te.hasLayoutProperty("text-size")&&(Se=no(this.zoom,ve,this.worldview,q),we=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Fe=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const Ve=i.textShaping.bottom-M[1],qe=i.textShaping.left-M[0],Ke=i.textShaping.right-M[0];i.textShaping.top=le[1]+(i.textShaping.top-M[1]),i.textShaping.bottom=le[1]+Ve,i.textShaping.left=le[0]+qe,i.textShaping.right=le[0]+Ke;const je=BP(0,i.textShaping,le,b,!1,d,C,this.allowVerticalPlacement,xe),at=de&&Se.kind==="composite"?ve.possiblyEvaluate(new Yn(we,{}),y).evaluate(d,I,y):N,Ge=de&&Se.kind==="composite"?ve.possiblyEvaluate(new Yn(Fe,{}),y).evaluate(d,I,y):V,$e=_E(te.name,Se,de,S,at,Ge),Ye=Array.isArray($e)?$e[1]:de,rt=0,lt=1+(Math.min(dp,Math.round(Ye*ur))<<1);i.isUsingAppearanceTextVertexData||(i.isUsingAppearanceTextVertexData=!0,i.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(p,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let yt=0;yt<je.length&&yt<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++yt){const tt=je[yt],mt=tt.glyphOffset[1],bt=e.tileAnchorX,Ft=e.tileAnchorY,Rt=p+4*yt;this.text.updateSymbolVertexData(Rt,bt,Ft,Math.round(32*tt.tl.x),Math.round(32*(mt+tt.tl.y)),tt.texPrimary.x,tt.texPrimary.y,rt,lt,tt.pixelOffsetTL.x,tt.pixelOffsetTL.y,tt.minFontScaleX,tt.minFontScaleY),this.text.updateSymbolVertexData(Rt+1,bt,Ft,Math.round(32*tt.tr.x),Math.round(32*(mt+tt.tr.y)),tt.texPrimary.x+tt.texPrimary.w,tt.texPrimary.y,rt,lt,tt.pixelOffsetBR.x,tt.pixelOffsetTL.y,tt.minFontScaleX,tt.minFontScaleY),this.text.updateSymbolVertexData(Rt+2,bt,Ft,Math.round(32*tt.bl.x),Math.round(32*(mt+tt.bl.y)),tt.texPrimary.x,tt.texPrimary.y+tt.texPrimary.h,rt,lt,tt.pixelOffsetTL.x,tt.pixelOffsetBR.y,tt.minFontScaleX,tt.minFontScaleY),this.text.updateSymbolVertexData(Rt+3,bt,Ft,Math.round(32*tt.br.x),Math.round(32*(mt+tt.br.y)),tt.texPrimary.x+tt.texPrimary.w,tt.texPrimary.y+tt.texPrimary.h,rt,lt,tt.pixelOffsetBR.x,tt.pixelOffsetBR.y,tt.minFontScaleX,tt.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return i.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(p,i.layoutBasedTextVertexData),i.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:i.layoutBasedTextVertexData.length/_g,hasChanges:!0}):{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(e){this.text&&this.text.programConfigurations.updateExpressions(e),this.icon&&this.icon.programConfigurations.updateExpressions(e)}update(e,i,l,d,p,m,y,b){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y,this.worldview),b){if(m)for(const S of[this.text.uboBinder,this.icon.uboBinder])S&&!S.isLightConstant&&S.updateDynamicExpressions(p[0],i,b,l,e,y);else if(Object.keys(e).length>0){const S=p[0],C=[this.text.uboBinder,this.icon.uboBinder].filter(I=>I&&I.hasStateDependentPaint(S));if(C.length>0){const I=new Set(Object.keys(e).map(M=>{const R=Number(M);return!isNaN(R)&&Number.isSafeInteger(R)&&String(R)===M?R:M}));for(const M of C)M.updateFeatures(I,S,i,b,l,e,y)}}}}updateZOffset(){const e=(p,m,y)=>{l+=m,l>p.length&&p.resize(l);for(let b=-m;b<0;b++)p.emplace(b+l,y)},i=(p,m,y)=>{d+=m,d>p.length&&p.resize(d);for(let b=-m;b<0;b++)p.emplace(b+d,y)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let l=0,d=0;for(let p=0;p<this.symbolInstances.length;p++){const m=this.symbolInstances.get(p),{numHorizontalGlyphVertices:y,numVerticalGlyphVertices:b,numIconVertices:S}=m,C=m.zOffset,I=S>0;if((y>0||b>0)&&(e(this.text.zOffsetVertexArray,y,C),e(this.text.zOffsetVertexArray,b,C)),I){const{placedIconSymbolIndex:M,verticalPlacedIconSymbolIndex:R}=m;M>=0&&i(this.icon.zOffsetVertexArray,S,C),R>=0&&i(this.icon.zOffsetVertexArray,m.numVerticalIconVertices,C)}}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,l,d,p){!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(m=>m.appearances&&m.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,l,d,p,m=!1){const y={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!l||!this.featureAppearanceData)return y;const b=i||{},S=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,C=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!S&&!C)return y;const I=this.layers[0],M=I.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===I.appearancesVersion||(this.featureAppearances=new g8(I.appearances,I.appearancesVersion));const R=this.featureAppearances.update(d,m);if(R.kind==="no-changes")return y;let O=1,N=0,V=!1,G=!1;if(S){const[xe,de]=M.get("icon-size-scale-range");O=Ie(1,xe,de)}let K=1,q=0,ee=!1;if(C){const[xe,de]=M.get("text-size-scale-range");K=Ie(1,xe,de)}const te=new Map;if(p&&l)for(const xe of l){const de=p.getImage(xe,I.scope);if(de){const ve=new xa(xe.toString());te.set(ve.toString(),de)}}const le=[this.text.uboBinder,this.icon.uboBinder];for(let xe=0;xe<this.symbolInstances.length;xe++){const de=this.symbolInstances.get(xe),ve=this.getAppearanceFeatureData(de.featureIndex);if(!ve)continue;const Se=ve.id,we=Se!==void 0?b[String(Se)]:void 0,Fe={type:"Point",id:ve.id,properties:ve.properties,geometry:[]};let Ve;if(R.kind==="all-features")Ve=R.appearanceIndex;else{const Ke=I.appearances?I.appearances.findIndex(je=>je.isActive({globals:d,feature:Fe,canonical:e,featureState:we})):-1;Ve=Ke>=0?Ke:-1}const qe=ve.activeAppearanceIndex!==Ve;if(C){const Ke=M.get("text-size"),je=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,at=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,Ge={canonical:e,layer:I,featureState:we,availableImages:l,textScaleFactor:K,imageMap:te,layoutTextOffset:M.get("text-offset").evaluate(Fe,we,e).map(Ye=>Ye*ct),layoutTextSize:Ke.evaluate(Fe,we,e),layoutTextRotate:M.get("text-rotate").evaluate(Fe,we,e),layoutMinZoomSize:Ke.evaluate(Fe,{zoom:je},e),layoutMaxZoomSize:Ke.evaluate(Fe,{zoom:at},e),layoutTextSizeMinZoom:je,layoutTextSizeMaxZoom:at},$e=this.updateSymbolInstanceTextVertices(de,ve,Ve,Fe,q,Ge);q+=$e.vertexOffsetDelta,ee=ee||$e.hasChanges}if(S){const Ke={canonical:e,layer:I,featureState:we,availableImages:l,globalProperties:d,iconScaleFactor:O,layoutIconOffset:M.get("icon-offset").evaluate(Fe,we,e),layoutIconSize:M.get("icon-size").evaluate(Fe,we,e,l),layoutIconRotate:M.get("icon-rotate").evaluate(Fe,we,e)},je=this.updateSymbolInstanceIconVertices(de,ve,Ve,Fe,N,Ke);N+=je.vertexOffsetDelta,V=V||je.hasChanges}if(qe){const Ke=de.featureIndex,je=d?d.brightness:null,at=we||{},Ge=Ve>=0?I.appearances[Ve]:null;for(const $e of le)$e&&($e.layer=I,G=$e.updateFeaturePaintForAppearance(Ke,Fe,at,e,l,je,Ge)||G)}ve.activeAppearanceIndex=Ve}return V&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),ee&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:V||ee,hasUboChanges:G}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=hD(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const l=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:d,y:p}of i)this.lineVertexArray.emplaceBack(d,p);return{lineStartIndex:l,lineLength:this.lineVertexArray.length-l}}addSymbols(e,i,l,d,p,m,y,b,S,C,I,M,R,O,N,V,G,K){const q=e.indexArray,ee=e.layoutVertexArray,te=e.globeExtVertexArray,le=K,xe=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,de=e.segments.prepareSegment(4*le,ee,q,this.canOverlap?m.sortKey:void 0,xe),ve=this.glyphOffsetArray.length,Se=de.vertexLength,we=this.allowVerticalPlacement&&y===Kt.vertical?Math.PI/2:0,Fe=m.text&&m.text.sections;let Ve=ee.length,qe=-1;for(let at=0;at<i.length;at++){const{tl:Ge,tr:$e,bl:Ye,br:rt,texPrimary:lt,texSecondary:yt,pixelOffsetTL:tt,pixelOffsetBR:mt,minFontScaleX:bt,minFontScaleY:Ft,glyphOffset:Rt,isSDF:Wt,sectionIndex:ln}=i[at],en=de.vertexLength,gn=Rt[1];if(Jv(ee,S.x,S.y,Ge.x,gn+Ge.y,lt.x,lt.y,l,Wt,tt.x,tt.y,bt,Ft),Jv(ee,S.x,S.y,$e.x,gn+$e.y,lt.x+lt.w,lt.y,l,Wt,mt.x,tt.y,bt,Ft),Jv(ee,S.x,S.y,Ye.x,gn+Ye.y,lt.x,lt.y+lt.h,l,Wt,tt.x,mt.y,bt,Ft),Jv(ee,S.x,S.y,rt.x,gn+rt.y,lt.x+lt.w,lt.y+lt.h,l,Wt,mt.x,mt.y,bt,Ft),b){const{x:cn,y:Gn,z:Yt}=b.anchor,[gr,ar,Er]=b.up;t0(te,cn,Gn,Yt,gr,ar,Er),t0(te,cn,Gn,Yt,gr,ar,Er),t0(te,cn,Gn,Yt,gr,ar,Er),t0(te,cn,Gn,Yt,gr,ar,Er),gg(e.dynamicLayoutVertexArray,cn,Gn,Yt,we)}else gg(e.dynamicLayoutVertexArray,S.x,S.y,S.z,we);if(V){const cn=yt||lt;e0(e.iconTransitioningVertexArray,cn.x,cn.y),e0(e.iconTransitioningVertexArray,cn.x+cn.w,cn.y),e0(e.iconTransitioningVertexArray,cn.x,cn.y+cn.h),e0(e.iconTransitioningVertexArray,cn.x+cn.w,cn.y+cn.h)}if(q.emplaceBack(en,en+1,en+2),q.emplaceBack(en+1,en+2,en+3),de.vertexLength+=4,de.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Rt[0]),(at===i.length-1||ln!==i[at+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(ee.length,m,m.index,{},R,O,N,Fe&&Fe[ln],this.worldview),e.uboBinder)){const cn=e.uboBinder.populateUBO(m,m.index,O,R,N,Fe&&Fe[ln]);qe=cn;const Gn=ee.length-Ve;for(let Yt=0;Yt<Gn;Yt++)e.featureIdArray.emplaceBack(cn);Ve=ee.length}}const Ke=K-i.length;if(Ke!==0&&(this._addNullVertices(Ke,ee,l,b,te,e,V,de,q),e.uboBinder&&qe>=0)){const at=4*Ke;for(let Ge=0;Ge<at;Ge++)e.featureIdArray.emplaceBack(qe)}const je=b?b.anchor:S;e.placedSymbolArray.emplaceBack(je.x,je.y,je.z,S.x,S.y,ve,this.glyphOffsetArray.length-ve,Se,C,I,S.segment,l?l[0]:0,l?l[1]:0,d[0],d[1],y,0,0,0,M,0),e.symbolInstanceIndices.push(G)}_addNullVertices(e,i,l,d,p,m,y,b,S){for(let C=0;C<e;C++){for(let M=0;M<4;M++)Jv(i,0,0,0,0,0,0,l,!1,0,0,0,0),d&&t0(p,0,0,0,0,0,0),gg(m.dynamicLayoutVertexArray,0,0,0,0),y&&e0(m.iconTransitioningVertexArray,0,0);const I=b.vertexLength;S.emplaceBack(I,I+1,I+2),S.emplaceBack(I+1,I+2,I+3),b.vertexLength+=4,b.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,l,d,p,m,y){e.emplaceBack(i,l,d,p,m,Math.round(y.x),Math.round(y.y))}_addCollisionDebugVertices(e,i,l,d,p,m,y){const b=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),S=b.vertexLength,C=y.tileAnchorX,I=y.tileAnchorY;for(let R=0;R<4;R++)l.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(l.collisionVertexArrayExt,i,e.padding,y.zOffset),this._commitLayoutVertex(l.layoutVertexArray,d,p,m,C,I,new et(e.x1,e.y1)),this._commitLayoutVertex(l.layoutVertexArray,d,p,m,C,I,new et(e.x2,e.y1)),this._commitLayoutVertex(l.layoutVertexArray,d,p,m,C,I,new et(e.x2,e.y2)),this._commitLayoutVertex(l.layoutVertexArray,d,p,m,C,I,new et(e.x1,e.y2)),b.vertexLength+=4;const M=l.indexArray;M.emplaceBack(S,S+1),M.emplaceBack(S+1,S+2),M.emplaceBack(S+2,S+3),M.emplaceBack(S+3,S),b.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,l,d,p,m){for(let y=d;y<p;y++){const b=l.get(y),S=this.getSymbolInstanceTextSize(e,m,i,y);this._addCollisionDebugVertices(b,S,this.textCollisionBox,b.projectedAnchorX,b.projectedAnchorY,b.projectedAnchorZ,m)}}_addIconDebugCollisionBoxes(e,i,l,d,p,m){for(let y=d;y<p;y++){const b=l.get(y),S=this.getSymbolInstanceIconSize(e,i,m.placedIconSymbolIndex);this._addCollisionDebugVertices(b,S,this.iconCollisionBox,b.projectedAnchorX,b.projectedAnchorY,b.projectedAnchorZ,m)}}generateCollisionDebugBuffers(e,i,l){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new PE(tg,ut.members,ta),this.iconCollisionBox=new PE(tg,ut.members,ta);const d=Mo(this.iconSizeData,e),p=Mo(this.textSizeData,e,l);for(let m=0;m<this.symbolInstances.length;m++){const y=this.symbolInstances.get(m);this._addTextDebugCollisionBoxes(p,e,i,y.textBoxStartIndex,y.textBoxEndIndex,y),this._addTextDebugCollisionBoxes(p,e,i,y.verticalTextBoxStartIndex,y.verticalTextBoxEndIndex,y),this._addIconDebugCollisionBoxes(d,e,i,y.iconBoxStartIndex,y.iconBoxEndIndex,y),this._addIconDebugCollisionBoxes(d,e,i,y.verticalIconBoxStartIndex,y.verticalIconBoxEndIndex,y)}}getSymbolInstanceTextSize(e,i,l,d){const p=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:d),m=na(this.textSizeData,e,p)/ct;return this.tilePixelRatio*m}getSymbolInstanceIconSize(e,i,l){const d=this.icon.placedSymbolArray.get(l),p=na(this.iconSizeData,e,d);return this.tilePixelRatio*p}_commitDebugCollisionVertexUpdate(e,i,l,d){e.emplaceBack(i,-l,-l,d),e.emplaceBack(i,l,-l,d),e.emplaceBack(i,l,l,d),e.emplaceBack(i,-l,l,d)}_updateTextDebugCollisionBoxes(e,i,l,d,p,m,y){for(let b=d;b<p;b++){const S=l.get(b),C=this.getSymbolInstanceTextSize(e,m,i,b);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,C,S.padding,m.zOffset)}}_updateIconDebugCollisionBoxes(e,i,l,d,p,m,y){for(let b=d;b<p;b++){const S=l.get(b),C=this.getSymbolInstanceIconSize(e,i,m.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,C,S.padding,m.zOffset)}}updateCollisionDebugBuffers(e,i,l,d){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const p=Mo(this.iconSizeData,e,d),m=Mo(this.textSizeData,e,l);for(let y=0;y<this.symbolInstances.length;y++){const b=this.symbolInstances.get(y);this._updateTextDebugCollisionBoxes(m,e,i,b.textBoxStartIndex,b.textBoxEndIndex,b,l),this._updateTextDebugCollisionBoxes(m,e,i,b.verticalTextBoxStartIndex,b.verticalTextBoxEndIndex,b,l),this._updateIconDebugCollisionBoxes(p,e,i,b.iconBoxStartIndex,b.iconBoxEndIndex,b,d),this._updateIconDebugCollisionBoxes(p,e,i,b.verticalIconBoxStartIndex,b.verticalIconBoxEndIndex,b,d)}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,l,d,p,m,y,b,S){const C={};if(i<l){const{x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee,featureIndex:te}=e.get(i);C.textBox={x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee},C.textFeatureIndex=te}if(d<p){const{x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee,featureIndex:te}=e.get(d);C.verticalTextBox={x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee},C.verticalTextFeatureIndex=te}if(m<y){const{x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee,featureIndex:te}=e.get(m);C.iconBox={x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee},C.iconFeatureIndex=te}if(b<S){const{x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee,featureIndex:te}=e.get(b);C.verticalIconBox={x1:I,y1:M,x2:R,y2:O,padding:N,projectedAnchorX:V,projectedAnchorY:G,projectedAnchorZ:K,tileAnchorX:q,tileAnchorY:ee},C.verticalIconFeatureIndex=te}return C}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const l=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,l.textBoxStartIndex,l.textBoxEndIndex,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l.iconBoxStartIndex,l.iconBoxEndIndex,l.verticalIconBoxStartIndex,l.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 l=e.placedSymbolArray.get(i),d=l.vertexStartIndex+4*l.numGlyphs;for(let p=l.vertexStartIndex;p<d;p+=4)e.indexArray.emplaceBack(p,p+1,p+2),e.indexArray.emplaceBack(p+1,p+2,p+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),l=Math.cos(e),d=[],p=[],m=[];for(let y=0;y<this.symbolInstances.length;++y){m.push(y);const b=this.symbolInstances.get(y);d.push(0|Math.round(i*b.tileAnchorX+l*b.tileAnchorY)),p.push(b.featureIndex)}return m.sort((y,b)=>d[y]-d[b]||p[b]-p[y]),m}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 l=this.sortKeyRanges.at(-1);l&&l.sortKey===i?l.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesWithinSegments();else{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 l=this.symbolInstances.get(i);this.featureSortOrder.push(l.featureIndex);const{rightJustifiedTextSymbolIndex:d,centerJustifiedTextSymbolIndex:p,leftJustifiedTextSymbolIndex:m,verticalPlacedTextSymbolIndex:y,placedIconSymbolIndex:b,verticalPlacedIconSymbolIndex:S}=l;d>=0&&this.addIndicesForPlacedSymbol(this.text,d),p>=0&&p!==d&&this.addIndicesForPlacedSymbol(this.text,p),m>=0&&m!==p&&m!==d&&this.addIndicesForPlacedSymbol(this.text,m),y>=0&&this.addIndicesForPlacedSymbol(this.text,y),b>=0&&this.addIndicesForPlacedSymbol(this.icon,b),S>=0&&this.addIndicesForPlacedSymbol(this.icon,S)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(e,i){const l=(this.text.uboBinder&&this.text.uboBinder.maxFeaturesPerBatch>0?this.text.uboBinder:this.icon.uboBinder&&this.icon.uboBinder.maxFeaturesPerBatch>0?this.icon.uboBinder:null).maxFeaturesPerBatch;if(this.symbolsByBatch)for(const d of this.symbolsByBatch.values())for(const p of d){const m=this.symbolInstances.get(p.index);p.rotatedY=0|Math.round(e*m.tileAnchorX+i*m.tileAnchorY)}else{this.symbolsByBatch=new Map;for(let d=0;d<this.symbolInstances.length;d++){const p=this.symbolInstances.get(d),m=Math.floor(d/l),y=0|Math.round(e*p.tileAnchorX+i*p.tileAnchorY);this.symbolsByBatch.has(m)||this.symbolsByBatch.set(m,[]),this.symbolsByBatch.get(m).push({index:d,rotatedY:y,featureIndex:p.featureIndex})}}for(const d of this.symbolsByBatch.values())d.sort((p,m)=>p.rotatedY-m.rotatedY||m.featureIndex-p.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(e,i){for(const l of e){const d=l.batchIndex;if(d===void 0)continue;const p=i.get(d);if(!p){l.primitiveOffset=this.text.indexArray.length,l.primitiveLength=0;continue}l.primitiveOffset=this.text.indexArray.length;const m=this.text.indexArray.length;for(const{index:y}of p){const b=this.symbolInstances.get(y),{rightJustifiedTextSymbolIndex:S,centerJustifiedTextSymbolIndex:C,leftJustifiedTextSymbolIndex:I,verticalPlacedTextSymbolIndex:M}=b;S>=0&&this.addIndicesForPlacedSymbol(this.text,S),C>=0&&C!==S&&this.addIndicesForPlacedSymbol(this.text,C),I>=0&&I!==C&&I!==S&&this.addIndicesForPlacedSymbol(this.text,I),M>=0&&this.addIndicesForPlacedSymbol(this.text,M)}l.primitiveLength=this.text.indexArray.length-m}}rebuildIconSegmentIndices(e,i){for(const l of e){const d=l.batchIndex;if(d===void 0)continue;const p=i.get(d);if(!p){l.primitiveOffset=this.icon.indexArray.length,l.primitiveLength=0;continue}l.primitiveOffset=this.icon.indexArray.length;const m=this.icon.indexArray.length;for(const{index:y}of p){const b=this.symbolInstances.get(y),{placedIconSymbolIndex:S,verticalPlacedIconSymbolIndex:C}=b;S>=0&&this.addIndicesForPlacedSymbol(this.icon,S),C>=0&&this.addIndicesForPlacedSymbol(this.icon,C)}l.primitiveLength=this.icon.indexArray.length-m}}sortFeaturesWithinSegments(){this.featureSortOrder=[];const e=Math.sin(this.sortedAngle),i=Math.cos(this.sortedAngle),l=this.getOrCreateSortedSymbolsByBatch(e,i),d=Array.from(l.keys()).sort((p,m)=>p-m);for(const p of d){const m=l.get(p);for(const{index:y}of m){const b=this.symbolInstances.get(y);this.featureSortOrder.push(b.featureIndex)}}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),l),this.rebuildIconSegmentIndices(this.icon.segments.get(),l),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}Mt(Rl,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Rl.addDynamicAttributes=gg;class vD extends nh{constructor(e,i,l){super(e,i,l),this.elevatedLayoutVertexArray=new Xa}upload(e){const i=this.uploaded;super.upload(e),!i&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,U2.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}Mt(vD,"ElevatedFillBufferData");class Yu{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=St&&i>=St}static evaluate(e){if(e.length===0)return new Yu;let i=[];for(const b of e)i.push(...b.portals);if(i.length===0)return new Yu;for(const b of i){const S=b.va,C=b.vb;(Yu.isOnBorder(S.x,C.x)||Yu.isOnBorder(S.y,C.y))&&(b.type="border")}const l=i.filter(b=>b.type!=="unevaluated"),d=i.filter(b=>b.type==="unevaluated");if(d.length===0)return new Yu;d.sort((b,S)=>b.hash===S.hash?b.isTunnel===S.isTunnel?0:b.isTunnel?-1:1:b.hash<S.hash?1:-1),i=l.concat(d);let p=l.length,m=p,y=p;do if(m++,m===i.length||i[p].hash!==i[m].hash){if(m-p===2){y<p&&(i[y]=i[p],i[p]=null);const b=i[y],S=i[m-1];b.type=b.isTunnel!==S.isTunnel?"tunnel":"polygon",b.connection={a:b.connection.a,b:S.connection.a},y++}p=m}while(p!==i.length);return i.splice(y),i.sort((b,S)=>b.hash<S.hash?1:-1),{portals:i}}}Mt(Yu,"ElevationPortalGraph");class x8{constructor(e,i,l){this.outPositions=e,this.outNormals=i,this.outIndices=l,this.vertexLookup=new Map}addVertex(e,i,l){let d=e[2];l!=null&&(d*=l);const p=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,m=this.vertexLookup.get(p);if(m!=null)return m;const y=this.outPositions.length;this.vertexLookup.set(p,y);const b=Math.trunc(16384*i[0]),S=Math.trunc(16384*i[1]),C=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],d),this.outNormals.emplaceBack(b,S,C),y}addTriangle(e,i,l){this.outIndices.emplaceBack(e,i,l)}addTriangles(e,i,l,d=0){if(e.length===0)return;const p=wt(),m=wt();for(let y=0;y<e.length;y+=3){const b=i[e[y+0]],S=i[e[y+1]],C=i[e[y+2]],I=l[e[y+1]]+d,M=l[e[y+2]]+d;pt(p,b.x,b.y,l[e[y+0]]+d);const R=this.addVertex(p,m);pt(p,S.x,S.y,I);const O=this.addVertex(p,m);pt(p,C.x,C.y,M);const N=this.addVertex(p,m);this.outIndices.emplaceBack(R,O,N)}}addQuad(e,i,l,d,p,m){const y=this.addVertex(e,p,m),b=this.addVertex(i,p,m),S=this.addVertex(l,p,m),C=this.addVertex(d,p,m);this.addTriangle(y,b,S),this.addTriangle(S,C,y)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class oa{constructor(e,i,l,d){this.unevaluatedPortals=new Yu,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Kf,this.vertexNormals=new Qm,this.indexArray=new _i,this.tileToMeters=Qs(e),this.bridgeProgramConfigurations=new Ya(i,{zoom:l,lut:d},p=>p!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Ya(i,{zoom:l,lut:d},p=>p!=="fill-bridge-guard-rail-color")}addVertices(e,i){const l=this.unevalVertices.length;for(let d=0;d<e.length;d++)this.unevalVertices.push(e[d]),this.unevalHeights.push(i[d]);return l}addTriangles(e,i,l){const d=l?this.unevalTunnelTriangles:this.unevalTriangles;for(const p of e)d.push(p+i)}addRenderableRing(e,i,l,d,p,m){const y=[new et(p.min.x,p.min.y),new et(p.max.x,p.min.y),new et(p.max.x,p.max.y),new et(p.min.x,p.max.y)];for(let b=0;b<l-1;b++){const S=i+b,C=S+1,I=this.unevalVertices[S],M=this.unevalVertices[C];if(!(I.x>=p.min.x&&I.x<=p.max.x&&I.y>=p.min.y&&I.y<=p.max.y||M.x>=p.min.x&&M.x<=p.max.x&&M.y>=p.min.y&&M.y<=p.max.y||rh(I,M,y))||this.isOnBorder(I.x,M.x)||this.isOnBorder(I.y,M.y))continue;const R=oa.computeEdgeHash(this.unevalVertices[S],this.unevalVertices[C]);let O,N=this.vertexHashLookup.get(oa.computePosHash(I));N!=null?O=N.next:(N=this.vertexHashLookup.get(oa.computePosHash(M)),O=N!=null?N.prev:R),this.unevalEdges.push({polygonIdx:e,a:S,b:C,hash:R,portalHash:O,isTunnel:d,type:"unevaluated",featureInfo:m})}}addPortalCandidates(e,i,l,d,p){if(i.length!==0){this.vertexHashLookup.clear();for(const m of i){if(m.length===0)continue;const y=m[0];let b=oa.computeEdgeHash(y[y.length-2],y.at(-1));for(let S=0;S<y.length-1;S++){const C=y[S+0],I=y[S+1],M=qs(I.x-C.x,I.y-C.y),R=ga(M);if(R===0)continue;let O="unevaluated";const N=d.pointElevation(C),V=d.pointElevation(I);Math.abs(N)<.01&&Math.abs(V)<.01?O="entrance":(this.isOnBorder(C.x,I.x)||this.isOnBorder(C.y,I.y))&&(O="border");const G=oa.computeEdgeHash(C,I);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:C,vb:I,vab:M,length:R,hash:G,isTunnel:l,type:O});const K=oa.computePosHash(C);this.vertexHashLookup.set(K,{prev:b,next:G}),b=G}}}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),l=M=>{M.primitiveLength=this.indexArray.length-M.primitiveOffset},d=new x8(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const p=i(),m=i(),y=i(),b=(M,R)=>{M.sort((N,V)=>N.type===R&&V.type!==R?-1:N.type!==R&&V.type===R?1:0);const O=M.findIndex(N=>N.type!==R);return O>=0?O:M.length};let S=0;this.unevalEdges.length>0&&(S=b(this.unevalEdges,"none"),this.constructBridgeStructures(d,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:S},this.tileToMeters)),l(y);const C=i(),I=i();if(this.unevalEdges.length>0){const M=this.unevalEdges.splice(S),R=b(M,"tunnel")+S;this.unevalEdges.push(...M),this.constructTunnelStructures(d,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:S},{min:S,max:R})}l(C),d.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),l(I),d.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),l(m),d.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights,4),l(p),this.maskSegments=pr.simpleSegment(0,I.primitiveOffset,0,I.primitiveLength),this.depthSegments=pr.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength),this.renderableBridgeSegments=pr.simpleSegment(0,y.primitiveOffset,0,y.primitiveLength),this.renderableTunnelSegments=pr.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength),this.shadowCasterSegments=pr.simpleSegment(0,p.primitiveOffset,0,p.primitiveLength)}update(e,i,l,d,p,m,y,b){this.bridgeProgramConfigurations.updatePaintArrays(e,i,p,l,d,m,y,b),this.tunnelProgramConfigurations.updatePaintArrays(e,i,p,l,d,m,y,b)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,G2.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,Cv.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,l,d,p){const m=(y,b)=>{for(let S=0;S<b.length-1;S++){const C=b[S].featureIndex,I=b[S+1].vertexStart,M=e.feature(C);y.populatePaintArrays(I,M,C,{},l,i,d,void 0,p)}};m(this.bridgeProgramConfigurations,this.bridgeFeatureSections),m(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,l,d,p){const m=new Map;for(let y=d;y<p;y++){const b=l[y],S=b.a,C=b.b,I=oa.computePosHash(e[S]),M=oa.computePosHash(e[C]);let R=m.get(I);R||(R={},m.set(I,R));let O=m.get(M);O||(O={},m.set(M,O)),i[S]<=0&&i[C]<=0||(R.to=C,O.from=S)}return m}isTerminalVertex(e,i){const l=oa.computePosHash(this.unevalVertices[e]),d=i.get(l);return!d||!d.from||!d.to}constructBridgeStructures(e,i,l,d,p,m){e.clearVertexLookup();const y=this.computeVertexConnections(i,l,d,p.min,p.max),b=1/m,S=.5*b,C=(Ke,je)=>pt(Ke,i[je].x,i[je].y,l[je]*b),I=wt(),M=wt(),R=wt(),O=wt(),N=wt(),V=(Ke,je)=>{const at=y.get(oa.computePosHash(i[je])),Ge=at.from,$e=at.to;if(!Ge||!$e)return;C(I,Ge),C(M,je),C(R,$e),So(O),Ci(I,M)||(Or(N,M,I),$n(O,N)),Ci(R,M)||(Or(N,R,M),Pt(O,O,$n(N,N)));const Ye=To(O);return Ye>0?Tn(Ke,O,1/Ye):void 0};let G=Number.POSITIVE_INFINITY;this.sortSubarray(d,p.min,p.max,(Ke,je)=>Ke.featureInfo.featureIndex-je.featureInfo.featureIndex);const K=wt(),q=wt(),ee=wt(),te=wt(),le=wt(),xe=wt(),de=wt(),ve=wt(),Se=wt(),we=[wt(),wt(),wt(),wt()],Fe=[wt(),wt(),wt(),wt()],Ve=[{coord:new et(0,0),height:0},{coord:new et(0,0),height:0}],qe=(Ke,je)=>Ke>je;for(let Ke=p.min;Ke<p.max;Ke++){const je=d[Ke];if(!je.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Ve,i,l,je,qe))continue;const[at,Ge]=Ve;if(pt(K,at.coord.x,at.coord.y,b*at.height),pt(q,Ge.coord.x,Ge.coord.y,b*Ge.height),Ci(K,q))continue;Or(ee,q,K),$n(ee,ee);const $e=V(ve,je.a)||ee,Ye=V(Se,je.b)||ee;pt(te,$e[1],-$e[0],0),$n(te,te),pt(le,Ye[1],-Ye[0],0),$n(le,le),pi(ve,te,$e),$n(xe,ve),pi(ve,le,Ye),$n(de,ve),Pt(we[0],K,Tn(ve,Or(ve,te,xe),S)),Pt(we[1],K,Tn(ve,Pt(ve,te,xe),S)),Pt(we[2],K,Tn(ve,xe,S)),we[3]=K,Pt(Fe[0],q,Tn(ve,Or(ve,le,de),S)),Pt(Fe[1],q,Tn(ve,Pt(ve,le,de),S)),Pt(Fe[2],q,Tn(ve,de,S)),Fe[3]=q,G=this.addFeatureSection(je.featureInfo.featureIndex,G,this.bridgeFeatureSections,e);const rt=e.addVertex(we[0],te,m),lt=e.addVertex(we[1],te,m),yt=e.addVertex(Fe[0],le,m),tt=e.addVertex(Fe[1],le,m);e.addTriangle(rt,lt,yt),e.addTriangle(lt,tt,yt);const mt=e.addVertex(we[1],xe,m),bt=e.addVertex(we[2],xe,m),Ft=e.addVertex(Fe[1],de,m),Rt=e.addVertex(Fe[2],de,m);e.addTriangle(mt,bt,Ft),e.addTriangle(bt,Rt,Ft),wo(te,te),wo(le,le);const Wt=e.addVertex(we[2],te,m),ln=e.addVertex(we[3],te,m),en=e.addVertex(Fe[2],le,m),gn=e.addVertex(Fe[3],le,m);e.addTriangle(Wt,ln,en),e.addTriangle(ln,gn,en);const cn=this.isTerminalVertex(je.a,y),Gn=this.isTerminalVertex(je.b,y);at.height<.01&&cn&&e.addQuad(we[3],we[2],we[1],we[0],wo($e,$e),m),Ge.height<.01&&Gn&&e.addQuad(Fe[0],Fe[1],Fe[2],Fe[3],Ye,m)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,l,d,p,m){e.clearVertexLookup();let y=Number.POSITIVE_INFINITY;const b=(G,K)=>G.featureInfo.featureIndex-K.featureInfo.featureIndex;this.sortSubarray(d,p.min,p.max,b),this.sortSubarray(d,m.min,m.max,b);const S=G=>$n(G,G),C=[{coord:new et(0,0),height:0},{coord:new et(0,0),height:0}],I=(G,K)=>G<K,M=wt(),R=wt(),O=wt(),N=wt(),V=wt();for(let G=p.min;G<p.max;G++){if(!this.prepareEdgePoints(C,i,l,d[G],I))continue;const[K,q]=C,ee=S(pt(V,-(q.coord.y-K.coord.y),q.coord.x-K.coord.x,0));y=this.addFeatureSection(d[G].featureInfo.featureIndex,y,this.tunnelFeatureSections,e),e.addQuad(pt(M,K.coord.x,K.coord.y,K.height),pt(R,q.coord.x,q.coord.y,q.height),pt(O,q.coord.x,q.coord.y,d[G].isTunnel?q.height+4:0),pt(N,K.coord.x,K.coord.y,d[G].isTunnel?K.height+4:0),ee)}for(let G=m.min;G<m.max;G++){const K=d[G];K.isTunnel&&([K.a,K.b]=[K.b,K.a]);const q=i[K.a],ee=i[K.b],te=S(pt(V,-(ee.y-q.y),ee.x-q.x,0));y=this.addFeatureSection(K.featureInfo.featureIndex,y,this.tunnelFeatureSections,e),e.addQuad(pt(M,ee.x,ee.y,0),pt(R,q.x,q.y,0),pt(O,q.x,q.y,l[K.a]+4),pt(N,ee.x,ee.y,l[K.b]+4),te),e.addQuad(pt(M,q.x,q.y,0),pt(R,ee.x,ee.y,0),pt(O,ee.x,ee.y,l[K.b]+4),pt(N,q.x,q.y,l[K.a]+4),te)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,l,d){e.coord.x=i,e.coord.y=l,e.height=d}prepareEdgePoints(e,i,l,d,p){let m=i[d.a].x,y=i[d.a].y,b=i[d.b].x,S=i[d.b].y,C=l[d.a],I=l[d.b];const M=p(C,0),R=p(I,0);if(M&&R)return this.setElevatedPoint(e[0],m,y,C),this.setElevatedPoint(e[1],b,S,I),!0;if(!M&&!R)return!1;if(M){if(!R){const O=I/(I-C);b=Jt(b,m,O),S=Jt(S,y,O),I=Jt(I,C,O)}}else{const O=C/(C-I);m=Jt(m,b,O),y=Jt(y,S,O),C=Jt(C,I,O)}return this.setElevatedPoint(e[0],m,y,C),this.setElevatedPoint(e[1],b,S,I),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((y,b)=>y.hash===b.hash?b.polygonIdx-y.polygonIdx:b.hash>y.hash?1:-1);let l=0,d=0,p=0,m=i[l].polygonIdx;do d++,(d===i.length||i[l].hash!==i[d].hash)&&((d-l===1||i[d-1].polygonIdx!==m)&&(p<l&&(i[p]=i[l],i[l]=null),i[p].type="none",p++),l=d,l!==i.length&&(m=i[l].polygonIdx));while(l!==i.length);if(i.splice(p),i.length!==0&&e.length!==0){i.sort((S,C)=>S.portalHash<C.portalHash?1:-1);let y=0,b=0;for(;y!==i.length&&b!==e.length;){const S=i[y],C=e[b];S.portalHash>C.hash?y++:C.hash>S.portalHash?b++:(S.type=C.type,y++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=St&&i>=St}addFeatureSection(e,i,l,d){return e!==i&&(i=e,l.push({featureIndex:e,vertexStart:d.getVertexCount()}),d.clearVertexLookup()),i}sortSubarray(e,i,l,d){const p=e.slice(i,l);p.sort(d),e.splice(i,p.length,...p)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(oa.computePosHash(e))<<32n|BigInt(oa.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}class b8{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,l){return this.get(e,!0,i,l)}optional(e,i,l){return this.get(e,!1,i,l)}success(){return this._valid}get(e,i,l,d){const p=Object.hasOwn(this.feature.properties,e)?+this.feature.properties[e]:void 0;return this._valid&&p!==void 0&&!Number.isNaN(p)?l(d?d(p):p):i&&(this._valid=!1),this}}class xD{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,l){return this.featureFunc(e,i,l)}parseVertex(e,i,l){return this.vertexFunc(e,i,l)}}const w8=new xD((o,e,i)=>o.reset(e).require(z,l=>{i.id=l}).optional("fixed_height_relative",l=>{i.constantHeight=l},Qu.decodeRelativeHeight).geometry(l=>{i.bounds=l},ql).success(),(o,e,i)=>o.reset(e).require(z,l=>{i.id=l}).require("elevation_idx",l=>{i.idx=l}).require("extent",l=>{i.extent=l}).require("height_relative",l=>{i.height=l},Qu.decodeRelativeHeight).geometry(l=>{i.position=l},Qu.getPoint).success()),S8=new xD((o,e,i)=>o.reset(e).require(z,l=>{i.id=l}).optional("fixed_height",l=>{i.constantHeight=l},Qu.decodeMetricHeight).geometry(l=>{i.bounds=l},ql).success(),(o,e,i)=>o.reset(e).require(z,l=>{i.id=l}).require("elevation_idx",l=>{i.idx=l}).require("extent",l=>{i.extent=l}).require("height",l=>{i.height=l},Qu.decodeMetricHeight).geometry(l=>{i.position=l},Qu.getPoint).success());class Qu{static getPoint(e){return qs(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"?S8:void 0:w8}static parse(e){const i=[],l=[],d=e.length,p=new b8;for(let m=0;m<d;m++){const y=e.feature(m),b=y.properties.version,S=Qu.getVersionSchema(b);if(S===void 0){Cn(`Unknown elevation feature version number ${b||"(unknown)"}`);continue}const C=y.properties.type;if(!C)continue;const I=Yc.types[y.type];if(I==="Point"&&C==="curve_point"){const M={};S.parseVertex(p,y,M)&&i.push(M)}else if(I==="Polygon"&&C==="curve_meta"){const M={};S.parseFeature(p,y,M)&&l.push(M)}}return{vertices:i,features:l}}}class bD{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,l=i[1],d=-i[0],p=(e.extent+1)*this.metersToTile;return[new et(Math.trunc(e.position[0]+l*p),Math.trunc(e.position[1]+d*p)),new et(Math.trunc(e.position[0]-l*p),Math.trunc(e.position[1]-d*p))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class DE{constructor(e,i,l,d,p,m){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[ti(),ti(),ti(),ti(),ti(),ti(),ti()],this.id=e,this.heightRange={min:l,max:l},this.safeArea=i,this.constantHeight=l,this.constantHeight==null&&(this.constantHeight!=null||d.length!==0)){this.vertices=d,this.edges=p,this.edges=this.edges.filter(y=>{return y.a<this.vertices.length&&y.b<this.vertices.length&&!((b=this.vertices[y.a].position)[0]===(S=this.vertices[y.b].position)[0]&&b[1]===S[1]);var b,S}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const y of this.vertices)this.vertexProps.push({dir:qs(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,y.height),this.heightRange.max=Math.max(this.heightRange.max,y.height);for(const y of this.edges){const b=this.vertices[y.a].position,S=this.vertices[y.b].position,C=Ms(ti(),S,b),I=ga(C),M=mi(ti(),C,1/I);this.edgeProps.push({vec:C,dir:M,len:I});const R=this.vertexProps[y.a].dir,O=this.vertexProps[y.b].dir;is(R,R,M),is(O,O,M)}for(const y of this.vertexProps)y.dir[0]===0&&y.dir[1]===0||Wo(y.dir,y.dir);this.tessellate(m)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[l,d]=i;return Jt(this.vertices[this.edges[l].a].height,this.vertices[this.edges[l].b].height,d)}computeSlopeNormal(e,i){const l=this.getClosestEdge(e);if(!l)return vt(0,0,1);const d=l[0],p=this.edges[d],m=this.edgeProps[d].vec,y=vt(m[0],m[1],(this.vertices[p.b].height-this.vertices[p.a].height)*i),b=vt(y[1],-y[0],0);pi(b,b,y);const S=zt(b);return S>0?Tn(b,b,1/S):pt(b,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,l=Number.POSITIVE_INFINITY,d=0;const[p,m,y,b,S,C,I]=this._tmpVec2;Ba(I,e.x,e.y);const M=new J6(I,null);for(let R=0;R<this.edges.length;R++){const O=this.edges[R],N=this.edgeProps[R].dir;M.dir=N;const V=this.vertices[O.a].position,G=this.vertices[O.b].position,K=M.intersectsPlane(V,this.vertexProps[O.a].dir,p),q=M.intersectsPlane(G,this.vertexProps[O.b].dir,m);if(!K||!q)continue;Ms(y,m,p),Ms(b,I,p);const ee=_a(y,y),te=ee>0?_a(b,y)/ee:0,le=Ie(te,0,1),xe=Math.abs((te-le)*this.edgeProps[R].len);Ms(S,I,V),Ba(C,N[1],-N[0]);const de=xe+Math.abs(_a(S,C));de<l&&(i=R,l=de,d=le)}return[i,d]}tessellate(e){const i=wt(),l=wt(),d=wt(),p=wt();for(let m=this.edges.length-1;m>=0;--m){const y=this.edges[m].a,b=this.edges[m].b,{position:S,height:C,extent:I}=this.vertices[y],{position:M,height:R,extent:O}=this.vertices[b],N=this.vertexProps[y].dir,V=this.vertexProps[b].dir;if(pt(i,S[0]/e,S[1]/e,C),pt(l,M[0]/e,M[1]/e,R),pt(d,N[1],-N[0],0),Tn(d,d,I),pt(p,V[1],-V[0],0),Tn(p,p,O),this.distSqLines(vt(i[0]+.5*d[0],i[1]+.5*d[1],i[2]+.5*d[2]),vt(l[0]-.5*p[0],l[1]-.5*p[1],l[2]-.5*p[2]),vt(i[0]-.5*d[0],i[1]-.5*d[1],i[2]-.5*d[2]),vt(l[0]+.5*p[0],l[1]+.5*p[1],l[2]+.5*p[2]))<=.0025000000000000005)continue;const G=this.vertices.length,K=is(ti(),S,M);this.vertices.push({position:mi(K,K,.5),height:.5*(C+R),extent:.5*(I+O)});const q=is(ti(),N,V);this.vertexProps.push({dir:Wo(q,q)}),this.edges.splice(m,1),this.edgeProps.splice(m,1),this.edges.push({a:y,b:G}),this.edges.push({a:G,b});const ee=Ms(ti(),this.vertices[G].position,S),te=ga(ee),le={vec:ee,dir:mi(ti(),ee,1/te),len:te};this.edgeProps.push(le),this.edgeProps.push(le)}}distSqLines(e,i,l,d){const p=An(wt(),i,e),m=An(wt(),d,l),y=An(wt(),e,l),b=Ar(p,p),S=Ar(p,m),C=Ar(p,y),I=Ar(m,m),M=Ar(m,y),R=b*I-S*S;if(R===0)return Ho(zo(p,l,d,Ar(y,m)/Ar(m,m)),e);const O=(b*M-S*C)/R;return Ho(zo(p,e,i,(S*M-C*I)/R),zo(m,l,d,O))}}class wD{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)*St,this.yOffset=(e.y*this.zScale-i.y)*St)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,l){const d=this.constantElevation(i,l);return d??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),l))}computeBiasedHeight(e,i){return i<=0?e:e+i*st(0,i,e>=0?e:Math.abs(.5*e))}}function T8(o){if(o===0)return[0,0,0];const e=Cm(o);return[e(),e(),e()]}function F1(o,e){if(!e)return;const i=+o.properties[z];return Number.isNaN(i)?void 0:e.find(l=>l.id===i)}function E8(o,e){return o>e?1:o<e?-1:0}Mt(DE,"ElevationFeature");class RE{constructor(e=E8,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,l,d,p,m;e.parent;)(l=(i=e.parent).parent)&&l.parent?((d=l.parent).left===l?d.left=e:d.right=e,e.parent=d):(e.parent=null,this._root=e),p=e.left,m=e.right,e===i.left?(l&&(l.left===i?(i.right?(l.left=i.right,l.left.parent=l):l.left=null,i.right=l,l.parent=i):(p?(l.right=p,p.parent=l):l.right=null,e.left=l,l.parent=e)),m?(i.left=m,m.parent=i):i.left=null,e.right=i,i.parent=e):(l&&(l.right===i?(i.left?(l.right=i.left,l.right.parent=l):l.right=null,i.left=l,l.parent=i):(m?(l.left=m,m.parent=l):l.left=null,e.right=l,l.parent=e)),p?(i.right=p,p.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 l=this._root,d=null,p=this._compare;if(this._noDuplicates)for(;l;){if(d=l,p(l.key,e)===0)return;l=p(l.key,e)<0?l.right:l.left}else for(;l;)d=l,l=p(l.key,e)<0?l.right:l.left;return l={key:e,data:i,left:null,right:null,parent:d},d?p(d.key,l.key)<0?d.right=l:d.left=l:this._root=l,this.splay(l),this._size++,l}find(e){for(var i=this._root,l=this._compare;i;){var d=l(i.key,e);if(d<0)i=i.right;else{if(!(d>0))return i;i=i.left}}return null}contains(e){for(var i=this._root,l=this._compare;i;){var d=l(e,i.key);if(d===0)return!0;i=d<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 l=this.minNode(i.right);l.parent!==i&&(this.replace(l,l.right),l.right=i.right,l.right.parent=l),this.replace(i,l),l.left=i.left,l.left.parent=l}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 l=i.left,d=i.right,p=null;l&&(l.parent=null,p=this.maxNode(l),this.splay(p),this._root=p),d&&(l?p.right=d:this._root=d,d.parent=p),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,l=[],d=!1,p=0;!d;)i?(l.push(i),i=i.left):l.length>0?(e(i=l.pop(),p++),i=i.right):d=!0;return this}range(e,i,l,d){const p=[],m=this._compare;let y,b=this._root;for(;p.length!==0||b;)if(b)p.push(b),b=b.left;else{if(b=p.pop(),y=m(b.key,i),y>0)break;if(m(b.key,e)>=0&&l.call(d,b))return this;b=b.right}return this}keys(){for(var e=this._root,i=[],l=[],d=!1;!d;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),l.push(e.key),e=e.right):d=!0;return l}values(){for(var e=this._root,i=[],l=[],d=!1;!d;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),l.push(e.data),e=e.right):d=!0;return l}at(e){for(var i=this._root,l=[],d=!1,p=0;!d;)if(i)l.push(i),i=i.left;else if(l.length>0){if(i=l.pop(),p===e)return i;p++,i=i.right}else d=!0;return null}load(e=[],i=[],l=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const d=e.length;return l&&OE(e,i,0,d-1,this._compare),this._root=LE(null,e,i,0,d),this._size=d,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,l,d,p){return new RE(l,p).load(e,i,d)}}function LE(o,e,i,l,d){const p=d-l;if(p>0){const m=l+Math.floor(p/2),y={key:e[m],data:i[m],parent:o};return y.left=LE(y,e,i,l,m),y.right=LE(y,e,i,m+1,d),y}return null}function OE(o,e,i,l,d){if(i>=l)return;const p=o[i+l>>1];let m=i-1,y=l+1;for(;;){do m++;while(d(o[m],p)<0);do y--;while(d(o[y],p)>0);if(m>=y)break;let b=o[m];o[m]=o[y],o[y]=b,b=e[m],e[m]=e[y],e[y]=b}OE(o,e,i,y,d),OE(o,e,y+1,l,d)}const SD=11102230246251565e-32,Bs=134217729,k8=(3+8*SD)*SD;function FE(o,e,i,l,d){let p,m,y,b,S=e[0],C=l[0],I=0,M=0;C>S==C>-S?(p=S,S=e[++I]):(p=C,C=l[++M]);let R=0;if(I<o&&M<i)for(C>S==C>-S?(m=S+p,y=p-(m-S),S=e[++I]):(m=C+p,y=p-(m-C),C=l[++M]),p=m,y!==0&&(d[R++]=y);I<o&&M<i;)C>S==C>-S?(m=p+S,b=m-p,y=p-(m-b)+(S-b),S=e[++I]):(m=p+C,b=m-p,y=p-(m-b)+(C-b),C=l[++M]),p=m,y!==0&&(d[R++]=y);for(;I<o;)m=p+S,b=m-p,y=p-(m-b)+(S-b),S=e[++I],p=m,y!==0&&(d[R++]=y);for(;M<i;)m=p+C,b=m-p,y=p-(m-b)+(C-b),C=l[++M],p=m,y!==0&&(d[R++]=y);return p===0&&R!==0||(d[R++]=p),R}function n0(o){return new Float64Array(o)}const yg=n0(4),TD=n0(8),ED=n0(12),kD=n0(16),sa=n0(4);function r0(o,e,i){e===null?(o.inOut=!1,o.otherInOut=!0):(o.isSubject===e.isSubject?(o.inOut=!e.inOut,o.otherInOut=e.otherInOut):(o.inOut=!e.otherInOut,o.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(o.prevInResult=!AD(e,i)||e.isVertical()?e.prevInResult:e)),o.resultTransition=AD(o,i)?function(l,d){let p,m=!l.inOut,y=!l.otherInOut;switch(d){case 0:p=m&&y;break;case 1:p=m||y;break;case 3:p=m!==y;break;case 2:p=l.isSubject?m&&!y:y&&!m}return p?1:-1}(o,i):0}function AD(o,e){switch(o.type){case 0:switch(e){case 0:return!o.otherInOut;case 1:return o.otherInOut;case 2:return o.isSubject&&o.otherInOut||!o.isSubject&&!o.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 vg{constructor(e,i,l,d,p){this.left=i,this.point=e,this.otherEvent=l,this.isSubject=d??!1,this.type=p||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,l=this.otherEvent.point;return this.left?(i[0]-e[0])*(l[1]-e[1])-(l[0]-e[0])*(i[1]-e[1])>0:(l[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(l[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 vg(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 tu(o,e){return o[0]===e[0]&&o[1]===e[1]}function zE(o,e,i){const l=function(d,p,m,y,b,S){const C=(p-S)*(m-b),I=(d-b)*(y-S),M=C-I;if(C===0||I===0||C>0!=I>0)return M;const R=Math.abs(C+I);return Math.abs(M)>=33306690738754716e-32*R?M:-function(O,N,V,G,K,q,ee){let te,le,xe,de,ve,Se,we,Fe,Ve,qe,Ke,je,at,Ge,$e,Ye,rt,lt;const yt=O-K,tt=V-K,mt=N-q,bt=G-q;Ge=yt*bt,Se=Bs*yt,we=Se-(Se-yt),Fe=yt-we,Se=Bs*bt,Ve=Se-(Se-bt),qe=bt-Ve,$e=Fe*qe-(Ge-we*Ve-Fe*Ve-we*qe),Ye=mt*tt,Se=Bs*mt,we=Se-(Se-mt),Fe=mt-we,Se=Bs*tt,Ve=Se-(Se-tt),qe=tt-Ve,rt=Fe*qe-(Ye-we*Ve-Fe*Ve-we*qe),Ke=$e-rt,ve=$e-Ke,yg[0]=$e-(Ke+ve)+(ve-rt),je=Ge+Ke,ve=je-Ge,at=Ge-(je-ve)+(Ke-ve),Ke=at-Ye,ve=at-Ke,yg[1]=at-(Ke+ve)+(ve-Ye),lt=je+Ke,ve=lt-je,yg[2]=je-(lt-ve)+(Ke-ve),yg[3]=lt;let Ft=function(gn,cn){let Gn=cn[0];for(let Yt=1;Yt<4;Yt++)Gn+=cn[Yt];return Gn}(0,yg),Rt=22204460492503146e-32*ee;if(Ft>=Rt||-Ft>=Rt||(ve=O-yt,te=O-(yt+ve)+(ve-K),ve=V-tt,xe=V-(tt+ve)+(ve-K),ve=N-mt,le=N-(mt+ve)+(ve-q),ve=G-bt,de=G-(bt+ve)+(ve-q),te===0&&le===0&&xe===0&&de===0)||(Rt=11093356479670487e-47*ee+k8*Math.abs(Ft),Ft+=yt*de+bt*te-(mt*xe+tt*le),Ft>=Rt||-Ft>=Rt))return Ft;Ge=te*bt,Se=Bs*te,we=Se-(Se-te),Fe=te-we,Se=Bs*bt,Ve=Se-(Se-bt),qe=bt-Ve,$e=Fe*qe-(Ge-we*Ve-Fe*Ve-we*qe),Ye=le*tt,Se=Bs*le,we=Se-(Se-le),Fe=le-we,Se=Bs*tt,Ve=Se-(Se-tt),qe=tt-Ve,rt=Fe*qe-(Ye-we*Ve-Fe*Ve-we*qe),Ke=$e-rt,ve=$e-Ke,sa[0]=$e-(Ke+ve)+(ve-rt),je=Ge+Ke,ve=je-Ge,at=Ge-(je-ve)+(Ke-ve),Ke=at-Ye,ve=at-Ke,sa[1]=at-(Ke+ve)+(ve-Ye),lt=je+Ke,ve=lt-je,sa[2]=je-(lt-ve)+(Ke-ve),sa[3]=lt;const Wt=FE(4,yg,4,sa,TD);Ge=yt*de,Se=Bs*yt,we=Se-(Se-yt),Fe=yt-we,Se=Bs*de,Ve=Se-(Se-de),qe=de-Ve,$e=Fe*qe-(Ge-we*Ve-Fe*Ve-we*qe),Ye=mt*xe,Se=Bs*mt,we=Se-(Se-mt),Fe=mt-we,Se=Bs*xe,Ve=Se-(Se-xe),qe=xe-Ve,rt=Fe*qe-(Ye-we*Ve-Fe*Ve-we*qe),Ke=$e-rt,ve=$e-Ke,sa[0]=$e-(Ke+ve)+(ve-rt),je=Ge+Ke,ve=je-Ge,at=Ge-(je-ve)+(Ke-ve),Ke=at-Ye,ve=at-Ke,sa[1]=at-(Ke+ve)+(ve-Ye),lt=je+Ke,ve=lt-je,sa[2]=je-(lt-ve)+(Ke-ve),sa[3]=lt;const ln=FE(Wt,TD,4,sa,ED);Ge=te*de,Se=Bs*te,we=Se-(Se-te),Fe=te-we,Se=Bs*de,Ve=Se-(Se-de),qe=de-Ve,$e=Fe*qe-(Ge-we*Ve-Fe*Ve-we*qe),Ye=le*xe,Se=Bs*le,we=Se-(Se-le),Fe=le-we,Se=Bs*xe,Ve=Se-(Se-xe),qe=xe-Ve,rt=Fe*qe-(Ye-we*Ve-Fe*Ve-we*qe),Ke=$e-rt,ve=$e-Ke,sa[0]=$e-(Ke+ve)+(ve-rt),je=Ge+Ke,ve=je-Ge,at=Ge-(je-ve)+(Ke-ve),Ke=at-Ye,ve=at-Ke,sa[1]=at-(Ke+ve)+(ve-Ye),lt=je+Ke,ve=lt-je,sa[2]=je-(lt-ve)+(Ke-ve),sa[3]=lt;const en=FE(ln,ED,4,sa,kD);return kD[en-1]}(d,p,m,y,b,S,R)}(o[0],o[1],e[0],e[1],i[0],i[1]);return l>0?-1:l<0?1:0}function lh(o,e){const i=o.point,l=e.point;return i[0]>l[0]?1:i[0]<l[0]?-1:i[1]!==l[1]?i[1]>l[1]?1:-1:function(d,p,m){return d.left!==p.left?d.left?1:-1:zE(m,d.otherEvent.point,p.otherEvent.point)!==0?d.isBelow(p.otherEvent.point)?-1:1:!d.isSubject&&p.isSubject?1:-1}(o,e,i)}function ch(o,e,i){const l=new vg(e,!1,o,o.isSubject),d=new vg(e,!0,o.otherEvent,o.isSubject);return tu(o.point,o.otherEvent.point)&&console.warn("what is that, a collapsed segment?",o),l.contourId=d.contourId=o.contourId,lh(d,o.otherEvent)>0&&(o.otherEvent.left=!0,d.left=!1),o.otherEvent.otherEvent=d,o.otherEvent=l,i.push(d),i.push(l),i}function z1(o,e){return o[0]*e[1]-o[1]*e[0]}function BE(o,e){return o[0]*e[0]+o[1]*e[1]}function NE(o,e,i){const l=function(b,S,C,I){const M=[S[0]-b[0],S[1]-b[1]],R=[I[0]-C[0],I[1]-C[1]];function O(xe,de,ve){return[xe[0]+de*ve[0],xe[1]+de*ve[1]]}const N=[C[0]-b[0],C[1]-b[1]];let V=z1(M,R),G=V*V;const K=BE(M,M);if(G>0){const xe=z1(N,R)/V;if(xe<0||xe>1)return null;const de=z1(N,M)/V;return de<0||de>1?null:xe===0||xe===1?[O(b,xe,M)]:de===0||de===1?[O(C,de,R)]:[O(b,xe,M)]}if(V=z1(N,M),G=V*V,G>0)return null;const q=BE(M,N)/K,ee=q+BE(M,R)/K,te=Math.min(q,ee),le=Math.max(q,ee);return te<=1&&le>=0?te===1?[O(b,te>0?te:0,M)]:le===0?[O(b,le<1?le:1,M)]:[O(b,te>0?te:0,M),O(b,le<1?le:1,M)]:null}(o.point,o.otherEvent.point,e.point,e.otherEvent.point),d=l?l.length:0;if(d===0||d===1&&(tu(o.point,e.point)||tu(o.otherEvent.point,e.otherEvent.point))||d===2&&o.isSubject===e.isSubject)return 0;if(d===1)return!tu(o.point,l[0])&&!tu(o.otherEvent.point,l[0])&&ch(o,l[0],i),!tu(e.point,l[0])&&!tu(e.otherEvent.point,l[0])&&ch(e,l[0],i),1;const p=[];let m=!1,y=!1;return tu(o.point,e.point)?m=!0:lh(o,e)===1?p.push(e,o):p.push(o,e),tu(o.otherEvent.point,e.otherEvent.point)?y=!0:lh(o.otherEvent,e.otherEvent)===1?p.push(e.otherEvent,o.otherEvent):p.push(o.otherEvent,e.otherEvent),m&&y||m?(e.type=1,o.type=e.inOut===o.inOut?2:3,m&&!y&&ch(p[1].otherEvent,p[0].point,i),2):y?(ch(p[0],p[1].point,i),3):p[0]!==p[3].otherEvent?(ch(p[0],p[1].point,i),ch(p[1],p[2].point,i),3):(ch(p[0],p[1].point,i),ch(p[3].otherEvent,p[2].point,i),3)}function A8(o,e){if(o===e)return 0;if(zE(o.point,o.otherEvent.point,e.point)!==0||zE(o.point,o.otherEvent.point,e.otherEvent.point)!==0)return tu(o.point,e.point)?o.isBelow(e.otherEvent.point)?-1:1:o.point[0]===e.point[0]?o.point[1]<e.point[1]?-1:1:lh(o,e)===1?e.isAbove(o.point)?-1:1:o.isBelow(e.point)?-1:1;if(o.isSubject!==e.isSubject)return o.isSubject?-1:1;{let i=o.point,l=e.point;if(i[0]===l[0]&&i[1]===l[1])return i=o.otherEvent.point,l=e.otherEvent.point,i[0]===l[0]&&i[1]===l[1]?0:(o.contourId??0)>(e.contourId??0)?1:-1}return lh(o,e)===1?1:-1}class C8{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function I8(o,e,i,l){let d,p=o+1,m=e[o].point;const y=e.length;for(p<y&&(d=e[p].point);p<y&&d[0]===m[0]&&d[1]===m[1];){if(!i[p])return p;p++,p<y&&(d=e[p].point)}for(p=o-1;i[p]&&p>l;)p--;return p}function M8(o,e,i){const l=new C8;if(o.prevInResult!=null){const d=o.prevInResult,p=d.outputContourId;if(d.resultTransition>0){const m=e[p];if(m.holeOf!=null){const y=m.holeOf;e[y].holeIds.push(i),l.holeOf=y,l.depth=e[p].depth}else e[p].holeIds.push(i),l.holeOf=p,l.depth=e[p].depth+1}else l.holeOf=null,l.depth=e[p].depth}else l.holeOf=null,l.depth=0;return l}const CD=Math.max,ID=Math.min;let B1=0;function MD(o,e,i,l,d,p){let m,y,b,S,C,I;for(m=0,y=o.length-1;m<y;m++){if(b=o[m],S=o[m+1],C=new vg(b,!1,void 0,e),I=new vg(S,!1,C,e),C.otherEvent=I,b[0]===S[0]&&b[1]===S[1])continue;C.contourId=I.contourId=i,p||(C.isExteriorRing=!1,I.isExteriorRing=!1),lh(C,I)>0?I.left=!0:C.left=!0;const M=b[0],R=b[1];d[0]=ID(d[0],M),d[1]=ID(d[1],R),d[2]=CD(d[2],M),d[3]=CD(d[3],R),l.push(C),l.push(I)}}const N1=[];function PD(o,e,i){let l=o,d=e;typeof o[0][0][0]=="number"&&(l=[o]),typeof e[0][0][0]=="number"&&(d=[e]);let p=function(M,R,O){let N=null;return M.length*R.length===0&&(O===0?N=N1:O===2?N=M:(O===1||O===3)&&(N=M.length===0?R:M)),N}(l,d,i);if(p)return p===N1?null:p;const m=[1/0,1/0,-1/0,-1/0],y=[1/0,1/0,-1/0,-1/0],b=function(M,R,O,N,V){const G=new bf(void 0,lh);let K,q,ee,te,le,xe;for(ee=0,te=M.length;ee<te;ee++)for(K=M[ee],le=0,xe=K.length;le<xe;le++)q=le===0,q&&B1++,MD(K[le],!0,B1,G,O,q);for(ee=0,te=R.length;ee<te;ee++)for(K=R[ee],le=0,xe=K.length;le<xe;le++)q=le===0,V===2&&(q=!1),q&&B1++,MD(K[le],!1,B1,G,N,q);return G}(l,d,m,y,i);if(p=function(M,R,O,N,V){let G=null;return(O[0]>N[2]||N[0]>O[2]||O[1]>N[3]||N[1]>O[3])&&(V===0?G=N1:V===2?G=M:(V===1||V===3)&&(G=M.concat(R))),G}(l,d,m,y,i),p)return p===N1?null:p;const S=function(M,R,O,N,V,G){const K=new RE(A8),q=[],ee=Math.min(N[2],V[2]);let te,le,xe;for(;M.length!==0;){let de=M.pop();if(q.push(de),G===0&&de.point[0]>ee||G===2&&de.point[0]>N[2])break;if(de.left){le=te=K.insert(de),xe=K.minNode(),te=te!==xe?K.prev(te):null,le=K.next(le);const ve=te?te.key:null;let Se;if(r0(de,ve,G),le&&NE(de,le.key,M)===2&&(r0(de,ve,G),r0(le.key,de,G)),te&&NE(te.key,de,M)===2){let we=te;we=we!==xe?K.prev(we):null,Se=we?we.key:null,r0(ve,Se,G),r0(de,ve,G)}}else de=de.otherEvent,le=te=K.find(de),te&&le&&(te=te!==xe?K.prev(te):null,le=K.next(le),K.remove(de),le&&te&&NE(te.key,le.key,M))}return q}(b,0,0,m,y,i),C=function(M){let R,O;const N=function(K){let q,ee,te,le,xe;const de=[];for(ee=0,te=K.length;ee<te;ee++)q=K[ee],(q.left&&q.inResult||!q.left&&q.otherEvent.inResult)&&de.push(q);let ve=!1;for(;!ve;)for(ve=!0,ee=0,te=de.length;ee<te;ee++)ee+1<te&&lh(de[ee],de[ee+1])===1&&(le=de[ee],de[ee]=de[ee+1],de[ee+1]=le,ve=!1);for(ee=0,te=de.length;ee<te;ee++)q=de[ee],q.otherPos=ee;for(ee=0,te=de.length;ee<te;ee++)q=de[ee],q.left||(xe=q.otherPos,q.otherPos=q.otherEvent.otherPos,q.otherEvent.otherPos=xe);return de}(M),V={},G=[];for(R=0,O=N.length;R<O;R++){if(V[R])continue;const K=G.length,q=M8(N[R],G,K),ee=xe=>{V[xe]=!0,xe<N.length&&N[xe]&&(N[xe].outputContourId=K)};let te=R,le=R;for(q.points.push(N[R].point);ee(te),te=N[te].otherPos,ee(te),q.points.push(N[te].point),te=I8(te,N,V,le),!(te==le||te>=N.length)&&N[te];);G.push(q)}return G}(S),I=[];for(let M=0;M<C.length;M++){let R=C[M];if(R.isExterior()){let O=[R.points];for(let N=0;N<R.holeIds.length;N++)O.push(C[R.holeIds[N]].points);I.push(O)}}return I}function P8(o,e){const i=PD(VE(o),VE([e]),0);return i==null?[]:RD(i)}function D8(o,e,i=0){let d=VE(o,65536);const p=[];for(;e.valid();e.next()){const[m,y]=e.get();let b=m.x*65536,S=m.y*65536,C=y.x*65536,I=y.y*65536;const M=C-b,R=I-S,O=Math.hypot(M,R);if(O===0)continue;b-=M*i,S-=R*i,C+=M*i,I+=R*i;const N=Math.trunc(R/O*3),V=-Math.trunc(M/O*3);p.push([[[b,S],[C,I],[C+N,I+V],[b+N,S+V],[b,S]]])}return p.length>0&&(d=PD(d,p,2)),RD(d,1/65536,.001)}function VE(o,e=1){return[o.map(i=>i.map(l=>[l.x*e,l.y*e]))]}function DD(o,e){const i=Math.floor(o)+.5;return Math.abs(o-i)<=e?Math.round(i):Math.round(o)}class R8{constructor(e){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=e}canonicalize(e,i){const l=this.tolerance,d=Math.floor(e/l),p=Math.floor(i/l);for(let b=-1;b<=1;b++){const S=this.buckets.get(d+b);if(S)for(let C=-1;C<=1;C++){const I=S.get(p+C);if(I){for(const M of I)if(Math.abs(this.xs[M]-e)<=l&&Math.abs(this.ys[M]-i)<=l){const R=this.ixs[M],O=this.iys[M];return this.xs[M]===e&&this.ys[M]===i||this.store(e,i,R,O,d,p),[R,O]}}}}const m=DD(e,l),y=DD(i,l);return this.store(e,i,m,y,d,p),[m,y]}store(e,i,l,d,p,m){const y=this.xs.length;this.xs.push(e),this.ys.push(i),this.ixs.push(l),this.iys.push(d);let b=this.buckets.get(p);b||(b=new Map,this.buckets.set(p,b));let S=b.get(m);S||(S=[],b.set(m,S)),S.push(y)}}function RD(o,e=1,i){const l=i!=null?new R8(i):null;return o.map(d=>d.map((p,m)=>{const y=p.map(b=>{const S=b[0]*e,C=b[1]*e;if(l){const[I,M]=l.canonicalize(S,C);return new et(I,M)}return new et(Math.round(S),Math.round(C))});return m>0&&y.reverse(),y}))}class jE{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new pr}empty(){return this.frcCoverage.size===0}}function LD(o,e,i){if(o.frcCoverage.size===0||o.featureTriSegments.length===0)return;const l=i.get(),d=e.uint16,p=[];o.featureTriSegments.sort((I,M)=>I.segIdx!==M.segIdx?I.segIdx-M.segIdx:I.frc===null&&M.frc===null?0:I.frc===null?-1:M.frc===null?1:M.frc-I.frc);const m=new Map;let y=0,b=o.featureTriSegments[0].frc,S={vertexOffset:l[y].vertexOffset,primitiveOffset:0,vertexLength:l[y].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0};const C=()=>{S.primitiveLength>0&&(m.has(b)||m.set(b,[]),m.get(b).push(Object.assign({},S)))};for(const I of o.featureTriSegments){I.segIdx!==y&&(C(),y=I.segIdx,b=I.frc,S={vertexOffset:l[y].vertexOffset,primitiveOffset:p.length/3,vertexLength:l[y].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),I.frc!==b&&(C(),b=I.frc,S=Object.assign({},S,{primitiveOffset:p.length/3,primitiveLength:0}));for(let M=I.start;M<I.end;M++)p.push(d[M]);S.primitiveLength+=(I.end-I.start)/3}C();for(let I=0;I<p.length;I++)d[I]=p[I];for(const[I,M]of m)I!==null?o.frcPerLevel.set(I,new pr(M)):o.frcNonRoadSegments=new pr(M);o.featureTriSegments=[]}Mt(jE,"FrcSegmentData");const L8={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function V1(o){const e=o.class;if(typeof e!="string")return null;const i=L8[e];return i!==void 0?i:null}function UE(o,e,i){for(const l of o)if(l.startsWith("(")){const d=l.indexOf(")");if(d===-1)continue;if(l.slice(1,d)===e&&l.slice(d+1)===i)return!0}else if(l===i)return!0;return!1}class OD{constructor(e,i,l){this.elevationMode=i,i&&(this.elevationBufferData=new vD(e.layers,e.zoom,e.lut)),l&&(this.frcData=new jE)}isEmpty(){const e=!this.elevationBufferData||this.elevationBufferData.isEmpty(),i=!this.frcData||this.frcData.empty();return e&&i}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(e){if(!this.frcData)return null;const i=V1(e||{});return i!==null&&this.frcData.frcCoverage.add(i),i}recordFeatureRange(e,i,l,d){if(!this.frcData||l<=i)return;const p=e.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*i,end:3*l,segIdx:p.length>0?p.length-1:0,frc:d})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&LD(this.frcData,e.bufferData.indexArray,e.bufferData.triangleSegments)}handleFeature(e,i,l,d,p,m){const y=new Array;if(!this.elevationMode)return!1;const b=F1(e,p);if(!b)return!1;{const C=this.clipPolygonsToTile(i,1);C.length>0&&y.push({polygons:C,elevationFeature:b,elevationTileID:d})}const S={guardRailEnabled:m.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},d),featureIndex:l};for(const C of y)if(C.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new oa(C.elevationTileID,m.layers,m.zoom,m.lut));const M=C.elevationFeature.isTunnel();let R=0;Object.hasOwn(e.properties,F)&&(R=+e.properties[F]),this.elevatedStructures.addPortalCandidates(C.elevationFeature.id,C.polygons,M,C.elevationFeature,R)}C.elevationFeature.constantHeight==null&&(C.polygons=this.prepareElevatedPolygons(C.polygons,C.elevationFeature,C.elevationTileID));const I=new wD(d,C.elevationTileID);this.addElevatedGeometry(m,C.polygons,I,C.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,l,S)}return!0}populatePaintArrays(e,i,l,d,p,m,y){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(e,i,l,d,p,m,y)}update(e,i,l,d,p,m,y,b){this.elevationBufferData&&this.elevationBufferData.update(e,i,l,d,p,m,y,b),this.elevatedStructures&&this.elevatedStructures.update(e,i,l,d,p,m,y,b)}updateExpressions(e){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(e),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e))}upload(e){this.elevationBufferData&&this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,l,d,p,m){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,l,d,p,m))}addElevatedGeometry(e,i,l,d,p,m,y){const b={elevation:d,elevationSampler:l,bias:p,index:m,featureInfo:y},[S,C]=e.addGeometry(i,this.elevationBufferData,b,this.elevatedStructures);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:S,max:C}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,S),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,C))}prepareElevatedPolygons(e,i,l){const d=1/Qs(l),p=[];for(const m of e){const y=D8(m,new bD(i,d),.1);p.push(...y)}return p}clipPolygonsToTile(e,i){const l=-i,d=-i,p=St+i,m=St+i;let y=0;const b=[],S=[];for(;y<e.length;y++){const M=e[y],R=ql(M);(R.min.x>=l&&R.max.x<=p&&R.min.y>=d&&R.max.y<=m?b:S).push(M)}if(b.length===e.length)return e;const C=[new et(l,d),new et(p,d),new et(p,m),new et(l,m),new et(l,d)],I=b;for(const M of S)I.push(...P8(M,C));return I}}function O8(o,e){return o.nextPoint.sub(e.at(-2)).unit()}function F8(o,e){return e[1].sub(o.prevPoint).unit()}Mt(OD,"FillHDExtension"),Mt(oa,"ElevatedStructures");class FD{constructor(e,i){this.elevationEnabled=e,i&&(this.frcData=new jE)}isEmpty(){const e=!this.elevationEnabled||this.heightRange===void 0,i=!this.frcData||this.frcData.empty();return e&&i}trackFeatureFrc(e){if(!this.frcData)return null;const i=V1(e||{});return i!==null&&this.frcData.frcCoverage.add(i),i}recordFeatureRange(e,i,l,d){if(!this.frcData||l<=i)return;const p=e.segments.get();this.frcData.featureTriSegments.push({start:3*i,end:3*l,segIdx:p.length>0?p.length-1:0,frc:d})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&LD(this.frcData,e.indexArray,e.segments)}handleFeature(e,i,l,d,p,m,y,b,S){if(!this.elevationEnabled)return!1;const C=F1(e,d);if(C){const N=r(i,-1,-1,8193,8193),V=this.prepareElevatedLines(N,C,l);for(const G of V){const K=S.layoutVertexArray.length;S.addLine(G,e,l,p,m,y,b);const q=new wD(l,l),ee=S.showElevationIdDebug?T8(C.id):null;for(let te=K;te<S.layoutVertexArray.length;te++){const le=new et(S.layoutVertexArray.int16[6*te]>>1,S.layoutVertexArray.int16[6*te+1]>>1),xe=q.pointElevation(le,C,.05);this.updateHeightRange(xe),S.zOffsetVertexArray.emplaceBack(xe,0,0,0),ee?S.elevationIdColVertexArray.emplaceBack(ee[0],ee[1],ee[2]):S.showElevationIdDebug&&S.elevationIdColVertexArray.emplaceBack(0,0,0)}}return!0}const I=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics,M=S.layoutVertexArray.length,R=[],O=r(i,-1,-1,8193,8193,R);for(let N=0;N<O.length;N++){const V=O[N],G=R[N],K={progress:{min:G.progress.min,max:G.progress.max},nextDir:O8(G,V),prevDir:F8(G,V)};S.addLine(V,e,l,p,m,y,b,K,I&&G.parentIndex>0?G.parentIndex:null)}return S.fillNonElevatedRoadSegment(M),!0}prepareElevatedLines(e,i,l){if(i.constantHeight!=null)return e;const d=[],p=1/Qs(l);for(const m of e)a(m,new bD(i,p),0,d);return d}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}}}Mt(FD,"LineHDExtension");class zD{constructor(){this.elevatedLayoutVertexArray=new Xa,this.hasElevation=!1}beginFeature(e,i){this.currentFeatureElevation=F1(e,i)}writeVertexQuad(e,i){const l=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new et(e,i)):0;this.hasElevation=this.hasElevation||l!==0;for(let d=0;d<4;d++)this.elevatedLayoutVertexArray.emplaceBack(l)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(e){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,fe.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}}Mt(zD,"CircleHDExtension");const j1=(o,e,i,l)=>{for(let d=0;d<e;d++)o.emplaceBack(i[0],i[1],i[2],l[0],l[1],l[2])};class BD{constructor(){this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1}addElevationFeatures(e){for(const i of e)this.elevationFeatureIdToIndex.set(i.id,this.elevationFeatures.length),this.elevationFeatures.push(i)}updateRoadElevation(e,i){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,e.hasAnyZOffset=!1;let l=!1;const d=Qs(i),p=1/d;let m=!1,y=!1;for(let b=0;b<e.symbolInstances.length;b++){const S=e.symbolInstances.get(b),C=vt(1,0,0),I=vt(0,1,0),{numHorizontalGlyphVertices:M,numVerticalGlyphVertices:R,numIconVertices:O,numVerticalIconVertices:N}=S,V=M>0||R>0,G=O>0,K=this.elevationFeatures[S.elevationFeatureIndex];if(K){const q=new et(S.tileAnchorX,S.tileAnchorY),ee=.075+K.pointElevation(q);S.zOffset!==ee&&(l=!0,S.zOffset=ee),ee!==0&&(e.hasAnyZOffset=!0);const te=K.computeSlopeNormal(q,p),le=qr(rs(),vt(0,0,1),te);ma(C,C,le),ma(I,I,le),C[2]*=d,I[2]*=d,C[0]===1&&C[1]===0&&C[2]===0&&I[0]===0&&I[1]===1&&I[2]===0||(m=m||V,y=y||G)}if(V&&(j1(e.text.orientationVertexArray,M,C,I),j1(e.text.orientationVertexArray,R,C,I)),G){const{placedIconSymbolIndex:q,verticalPlacedIconSymbolIndex:ee}=S;q>=0&&j1(e.icon.orientationVertexArray,O,C,I),ee>=0&&j1(e.icon.orientationVertexArray,N,C,I)}}m||(e.text.orientationVertexArray=void 0),y||(e.icon.orientationVertexArray=void 0),l&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}getElevationFeatureForPlacedSymbol(e,i,l){const d=e.symbolInstances.get(i.symbolInstanceIndices[l]).elevationFeatureIndex;if(d<this.elevationFeatures.length)return this.elevationFeatures[d]}}Mt(BD,"SymbolHDExtension");let sc=null,U1=null,GE=null,G1=null;const ND=5120,VD=5121,jD=5122,UD=5123,GD=5125,$D=5126,$1={[ND]:Int8Array,[VD]:Uint8Array,[jD]:Int16Array,[UD]:Uint16Array,[GD]:Uint32Array,[$D]:Float32Array},z8={[ND]:"DT_INT8",[VD]:"DT_UINT8",[jD]:"DT_INT16",[UD]:"DT_UINT16",[GD]:"DT_UINT32",[$D]:"DT_FLOAT32"},i0={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function HD(o,e,i){const l=i.json.bufferViews.length,d=i.buffers.length;e.bufferView=l,i.json.bufferViews[l]={buffer:d,byteLength:o.byteLength},i.buffers[d]=o}const $E="KHR_draco_mesh_compression";function B8(o,e){const i=o.extensions&&o.extensions[$E];if(!i)return;const l=new sc.Decoder,d=XD(e,i.bufferView),p=new sc.Mesh;if(!l.DecodeArrayToMesh(d,d.byteLength,p))throw new Error("Failed to decode Draco mesh");const m=e.json.accessors[o.indices],y=$1[m.componentType],b=m.count*y.BYTES_PER_ELEMENT,S=sc._malloc(b);y===Uint16Array?l.GetTrianglesUInt16Array(p,b,S):l.GetTrianglesUInt32Array(p,b,S),HD(sc.memory.buffer.slice(S,S+b),m,e),sc._free(S);for(const C of Object.keys(i.attributes)){const I=l.GetAttributeByUniqueId(p,i.attributes[C]),M=e.json.accessors[o.attributes[C]],R=z8[M.componentType],O=M.count*i0[M.type]*$1[M.componentType].BYTES_PER_ELEMENT,N=sc._malloc(O);l.GetAttributeDataArrayForAllPoints(p,I,sc[R],O,N),HD(sc.memory.buffer.slice(N,N+O),M,e),sc._free(N)}l.destroy(),p.destroy(),delete o.extensions[$E]}const H1="EXT_meshopt_compression";function N8(o,e){if(!o.extensions||!o.extensions[H1])return;const i=o.extensions[H1],l=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),d=new Uint8Array(i.count*i.byteStride);GE.decodeGltfBuffer(d,i.count,i.byteStride,l,i.mode,i.filter),o.buffer=e.buffers.length,o.byteOffset=0,e.buffers[o.buffer]=d.buffer,delete o.extensions[H1]}const WD=1179937895,qD=new TextDecoder("utf8");function ZD(o,e){return new URL(o,e).href}async function V8(o,e,i,l,d){const p=await fetch(ZD(o.uri,l),{signal:d}),m=await p.arrayBuffer();e.buffers[i]=m}function XD(o,e){const i=o.json.bufferViews[e];return new Uint8Array(o.buffers[i.buffer],i.byteOffset||0,i.byteLength)}async function j8(o,e,i,l,d){if(o.uri){const p=ZD(o.uri,l),m=await fetch(p,{signal:d}),y=await m.blob(),b=await createImageBitmap(y);e.images[i]=b}else if(o.bufferView!==void 0){const p=XD(e,o.bufferView),m=new Blob([p],{type:o.mimeType}),y=await createImageBitmap(m);e.images[i]=y}}async function KD(o,e=0,i,l){const d={json:null,images:[],buffers:[]};if(new Uint32Array(o,e,1)[0]===WD){const R=new Uint32Array(o,e);let O=2;const N=(R[O++]>>2)-3,V=R[O++]>>2;if(O++,d.json=JSON.parse(qD.decode(R.subarray(O,O+V))),O+=V,O<N){const G=R[O++];O++;const K=e+(O<<2);d.buffers[0]=o.slice(K,K+G)}}else d.json=JSON.parse(qD.decode(new Uint8Array(o,e)));const{buffers:p,images:m,meshes:y,extensionsUsed:b,bufferViews:S}=d.json;if(p){const R=[];for(let O=0;O<p.length;O++){const N=p[O];N.uri?R.push(V8(N,d,O,i,l)):d.buffers[O]||(d.buffers[O]=null)}await Promise.all(R)}if(l&&l.aborted)throw new DOMException("Aborted","AbortError");const C=[],I=b&&b.includes($E),M=b&&b.includes(H1);if(I&&C.push(function(){if(!sc)return U1!=null||(U1=function(R){let O,N=null;function V(){O=new Uint8Array(N.buffer)}function G(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(R,{a:{a:G,d:function(K,q,ee){return O.copyWithin(K,q,q+ee)},c:function(K){const q=O.length,ee=Math.max(K>>>0,Math.ceil(1.2*q)),te=Math.ceil((ee-q)/65536);try{return N.grow(te),V(),!0}catch{return!1}},b:G}}).then(K=>{const{Rb:q,Qb:ee,P:te,T:le,X:xe,Ja:de,La:ve,Qa:Se,Va:we,Wa:Fe,eb:Ve,jb:qe,f:Ke,e:je,yb:at,zb:Ge,Ab:$e,Bb:Ye,Db:rt,Gb:lt}=K.instance.exports;N=je;const yt=(()=>{let tt=0,mt=0,bt=0,Ft=0;return Rt=>{bt&&(q(Ft),q(tt),mt+=bt,bt=tt=0),tt||(mt+=128,tt=ee(mt));const Wt=Rt.length+7&-8;let ln=tt;Wt>=mt&&(bt=Wt,ln=Ft=ee(Wt));for(let en=0;en<Rt.length;en++)O[ln+en]=Rt[en];return ln}})();return V(),Ke(),{memory:je,_free:q,_malloc:ee,Mesh:class{constructor(){this.ptr=te()}destroy(){le(this.ptr)}},Decoder:class{constructor(){this.ptr=de()}destroy(){qe(this.ptr)}DecodeArrayToMesh(tt,mt,bt){const Ft=yt(tt),Rt=ve(this.ptr,Ft,mt,bt.ptr);return!!xe(Rt)}GetAttributeByUniqueId(tt,mt){return{ptr:Se(this.ptr,tt.ptr,mt)}}GetTrianglesUInt16Array(tt,mt,bt){we(this.ptr,tt.ptr,mt,bt)}GetTrianglesUInt32Array(tt,mt,bt){Fe(this.ptr,tt.ptr,mt,bt)}GetAttributeDataArrayForAllPoints(tt,mt,bt,Ft,Rt){Ve(this.ptr,tt.ptr,mt.ptr,bt,Ft,Rt)}},DT_INT8:at(),DT_UINT8:Ge(),DT_INT16:$e(),DT_UINT16:Ye(),DT_UINT32:rt(),DT_FLOAT32:lt()}})}(fetch(Jx())).then(R=>{sc=R,U1=null})),U1}()),M&&C.push(function(){var R;if(!GE)return G1!=null||(G1=(R=fetch(eb()),WebAssembly.instantiateStreaming(R,{}).then(O=>{const{sbrk:N,memory:V,meshopt_decodeVertexBuffer:G,meshopt_decodeIndexBuffer:K,meshopt_decodeIndexSequence:q,meshopt_decodeFilterOct:ee,meshopt_decodeFilterQuat:te,meshopt_decodeFilterExp:le}=O.instance.exports,xe={ATTRIBUTES:G,TRIANGLES:K,INDICES:q},de={OCTAHEDRAL:ee,QUATERNION:te,EXPONENTIAL:le};return O.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(ve,Se,we,Fe,Ve,qe){const Ke=Se+3&-4,je=N(Ke*we),at=N(Fe.length),Ge=new Uint8Array(V.buffer);Ge.set(Fe,at);const $e=xe[Ve](je,Se,we,at,Fe.length);if($e===0&&de[qe]&&de[qe](je,Ke,we),ve.set(Ge.subarray(je,je+Se*we)),N(je-N(0)),$e!==0)throw new Error(`Malformed buffer data: ${$e}`)}}})).then(O=>{GE=O,G1=null})),G1}()),m)for(let R=0;R<m.length;R++)C.push(j8(m[R],d,R,i,l));if(C.length&&await Promise.all(C),l&&l.aborted)throw new DOMException("Aborted","AbortError");if(I&&y)for(const{primitives:R}of y)for(const O of R)B8(O,d);if(M&&y&&S)for(const R of S)N8(R,d);return d}async function YD(o,e){const i=await async function(l,d){if(d&&d.aborted)throw new DOMException("Aborted","AbortError");return new Promise((p,m)=>{const y=ku(l,(b,S)=>{b?m(b):p(S)});d&&d.addEventListener("abort",()=>{y.cancel(),m(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:o,type:"arrayBuffer"},e);return KD(i,0,o,e)}class W1{constructor(e,i,l,d){if(this.triangleCount=i.length/3,this.min=new et(0,0),this.max=new et(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[p,m]=[e[0].clone(),e[0].clone()];for(let I=1;I<e.length;++I){const M=e[I];p.x=Math.min(p.x,M.x),p.y=Math.min(p.y,M.y),m.x=Math.max(m.x,M.x),m.y=Math.max(m.y,M.y)}if(d){const I=Math.ceil(Math.max(m.x-p.x,m.y-p.y)/d);l=Math.max(l,I)}if(l===0)return;this.min=p,this.max=m;const y=this.max.sub(this.min);y.x=Math.max(y.x,1),y.y=Math.max(y.y,1);const b=Math.max(y.x,y.y)/l;this.cellsX=Math.max(1,Math.ceil(y.x/b)),this.cellsY=Math.max(1,Math.ceil(y.y/b)),this.xScale=1/b,this.yScale=1/b;const S=[];for(let I=0;I<this.triangleCount;I++){const M=e[i[3*I+0]].sub(this.min),R=e[i[3*I+1]].sub(this.min),O=e[i[3*I+2]].sub(this.min),N=nu(Math.floor(Math.min(M.x,R.x,O.x)),this.xScale,this.cellsX),V=nu(Math.floor(Math.max(M.x,R.x,O.x)),this.xScale,this.cellsX),G=nu(Math.floor(Math.min(M.y,R.y,O.y)),this.yScale,this.cellsY),K=nu(Math.floor(Math.max(M.y,R.y,O.y)),this.yScale,this.cellsY),q=new et(0,0),ee=new et(0,0),te=new et(0,0),le=new et(0,0);for(let xe=G;xe<=K;++xe){q.y=ee.y=xe*b,te.y=le.y=(xe+1)*b;for(let de=N;de<=V;++de)q.x=te.x=de*b,ee.x=le.x=(de+1)*b,(dg(M,R,O,q,ee,le)||dg(M,R,O,q,le,te))&&S.push({cellIdx:xe*this.cellsX+de,triIdx:I})}}if(S.length===0)return;S.sort((I,M)=>I.cellIdx-M.cellIdx||I.triIdx-M.triIdx);let C=0;for(;C<S.length;){const I=S[C].cellIdx,M={start:this.payload.length,len:0};for(;C<S.length&&S[C].cellIdx===I;)++M.len,this.payload.push(S[C++].triIdx);this.cells[I]=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 l=nu(e.x-this.min.x,this.xScale,this.cellsX),d=nu(e.y-this.min.y,this.yScale,this.cellsY),p=this.cells[d*this.cellsX+l];if(p){this._lazyInitLookup();for(let m=0;m<p.len;m++){const y=this.payload[p.start+m],b=Math.floor(y/8),S=1<<y%8;if(!(this.lookup[b]&S)&&(this.lookup[b]|=S,i.push(y),i.length===this.triangleCount))return}}}query(e,i,l){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 d=nu(e.x-this.min.x,this.xScale,this.cellsX),p=nu(i.x-this.min.x,this.xScale,this.cellsX),m=nu(e.y-this.min.y,this.yScale,this.cellsY),y=nu(i.y-this.min.y,this.yScale,this.cellsY);for(let b=m;b<=y;b++)for(let S=d;S<=p;S++){const C=this.cells[b*this.cellsX+S];if(C)for(let I=0;I<C.len;I++){const M=this.payload[C.start+I],R=Math.floor(M/8),O=1<<M%8;if(!(this.lookup[R]&O)&&(this.lookup[R]|=O,l.push(M),l.length===this.triangleCount))return}}}}function nu(o,e,i){return Math.max(0,Math.min(i-1,Math.floor(o*e)))}Mt(W1,"TriangleGridIndex");const U8=Sn([{name:"a_pos_3f",components:3,type:"Float32"}]),G8=Sn([{name:"a_color_3f",components:3,type:"Float32"}]),$8=Sn([{name:"a_color_4f",components:4,type:"Float32"}]),H8=Sn([{name:"a_uv_2f",components:2,type:"Float32"}]),W8=Sn([{name:"a_normal_3f",components:3,type:"Float32"}]),q8=Sn([{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"}]),Z8=Sn([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function QD(o,e){const i=q1(o.projection,o.zoom,o.width,o.height),l=function(p,m,y,b,S){const C=new Qn(y.lng-180*uh,y.lat),I=new Qn(y.lng+180*uh,y.lat),M=p.project(C.lng,C.lat),R=p.project(I.lng,I.lat),O=-Math.atan2(R.y-M.y,R.x-M.x),N=No.fromLngLat(y);N.y=Ie(N.y,-1+uh,1-uh);const V=N.toLngLat(),G=p.project(V.lng,V.lat),K=No.fromLngLat(V);K.x+=uh;const q=K.toLngLat(),ee=p.project(q.lng,q.lat),te=eR(ee.x-G.x,ee.y-G.y,O),le=No.fromLngLat(V);le.y+=uh;const xe=le.toLngLat(),de=p.project(xe.lng,xe.lat),ve=eR(de.x-G.x,de.y-G.y,O),Se=Math.abs(te.x)/Math.abs(ve.y),we=oe([]);Xe(we,we,-O*(1-(S?0:b)));const Fe=oe([]);return De(Fe,Fe,[1,1-(1-Se)*b,1]),Fe[4]=-ve.x/ve.y*b,Xe(Fe,Fe,O),he(Fe,we,Fe),Fe}(o.projection,0,o.center,i,e),d=JD(o);return De(l,l,[d,d,1]),l}function JD(o){const e=o.projection,i=q1(o.projection,o.zoom,o.width,o.height),l=HE(e,o.center),d=HE(e,Qn.convert(e.center));return Math.pow(2,l*i+(1-i)*d)}function q1(o,e,i,l,d=1/0){const p=o.range;if(!p)return 0;const m=Math.min(d,Math.max(i,l)),y=Math.log2(m/1024);return st(p[0]+y,p[1]+y,e)}const uh=1/4e4;function HE(o,e){const i=Ie(e.lat,-85.051129,Ss),l=new Qn(e.lng-180*uh,i),d=new Qn(e.lng+180*uh,i),p=o.project(l.lng,i),m=o.project(d.lng,i),y=No.fromLngLat(l),b=No.fromLngLat(d),S=m.x-p.x,C=m.y-p.y,I=b.x-y.x,M=b.y-y.y,R=Math.sqrt((I*I+M*M)/(S*S+C*C));return Math.log2(R)}function eR(o,e,i){const l=Math.cos(i),d=Math.sin(i);return{x:o*l-e*d,y:o*d+e*l}}const X8=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function tR(o,e,i){oe(o),Xe(o,o,Te(e[2])),He(o,o,Te(e[0])),nt(o,o,Te(e[1])),De(o,o,i),he(o,o,X8)}function Z1(o,e,i,l,d,p,m,y){const b=[i[0]-e[0],i[1]-e[1],0],S=[l[0]-e[0],l[1]-e[1],0];if(zt(b)<1e-12||zt(S)<1e-12)return vs(o);const C=pi([],b,S);$n(C,C),An(S,l,e),b[2]=(p-d)*y,S[2]=(m-d)*y;const I=b;return pi(I,b,S),$n(I,I),qr(o,C,I)}function X1(o,e,i=!1){const l=Ku(e.zoom),d=function(p,m,y){const b=m.worldSize,S=[p[12],p[13],p[14]],C=Si(S[1]/b),I=cs(S[0]/b),M=oe([]),R=Ko(1,C)*b,O=Ko(1,0)*b*Gu(C,m.zoom),N=1/kE(b);let V=O*N;if(y){const ee=q1(m.projection,m.zoom,m.width,m.height,1024);V=N*m.projection.pixelSpaceConversion(m.center.lat,b,ee)}const G=Uu(C,I);Pt(G,G,Tn([],$n([],G),R*V*S[2]));const K=function(ee){const te=[ee[0],ee[1],ee[2]];let le=[0,1,0];const xe=pi([],le,te);return pi(le,te,xe),Ni(le)===0&&(le=[0,1,0],pi(xe,te,le)),$n(xe,xe),$n(le,le),$n(te,te),[xe[0],xe[1],xe[2],0,le[0],le[1],le[2],0,te[0],te[1],te[2],0,ee[0],ee[1],ee[2],1]}(G);De(M,M,[V,V,V*R]),_e(M,M,[-S[0],-S[1],-S[2]]);const q=he([],m.globeMatrix,K);return he(q,q,M),he(q,q,p),q}(o,e,i);if(l>0){const p=function(m,y){const b=y.worldSize,S=Ko(1,0)*b*Gu(y.center.lat,y.zoom)/kE(b),C=Ko(1,y.center.lat)*b,I=oe([]);nt(I,I,Te(y.center.lng)),He(I,I,Te(y.center.lat)),_e(I,I,[0,0,Xo]),De(I,I,[S,S,S*C]);const M=y.point;return _e(I,I,[-M.x,-M.y,0]),he(I,I,m),he(I,y.globeMatrix,I)}(o,e);return function(m,y,b){const S=(O,N,V)=>{const G=zt(O),K=zt(N),q=Xu(O,N,V);return Tn(q,q,1/zt(q)*Jt(G,K,V))},C=S([m[0],m[1],m[2]],[y[0],y[1],y[2]],b),I=S([m[4],m[5],m[6]],[y[4],y[5],y[6]],b),M=S([m[8],m[9],m[10]],[y[8],y[9],y[10]],b),R=Xu([m[12],m[13],m[14]],[y[12],y[13],y[14]],b);return[C[0],C[1],C[2],0,I[0],I[1],I[2],0,M[0],M[1],M[2],0,R[0],R[1],R[2],1]}(d,p,l)}return d}function WE(o,e,i,l){const d=Qr.projectAabbCorners(l,i);let p=Number.MAX_VALUE;for(let y=0;y<d.length;++y){const b=d[y];b[0]=(.5*b[0]+.5)*e.width,b[1]=(.5-.5*b[1])*e.height,b[2]<p&&(p=b[2])}const m=function(y){const b=[];let S=0;for(let R=1;R<y.length;R++)(y[R][0]<y[S][0]||y[R][0]===y[S][0]&&y[R][1]<y[S][1])&&(S=R);let C,I=S;const M=new Uint8Array(y.length);do{if(M[I])break;b.push(new et(y[I][0],y[I][1])),M[I]=1,C=(I+1)%y.length;for(let R=0;R<y.length;R++){if(y[R][0]===y[C][0]&&y[R][1]===y[C][1]||y[R][0]===y[I][0]&&y[R][1]===y[I][1])continue;const O=[y[R][0]-y[I][0],y[R][1]-y[I][1]],N=[y[C][0]-y[I][0],y[C][1]-y[I][1]],V=O[0]*N[1]-O[1]*N[0];(V>0||V===0&&O[0]*N[0]+O[1]*N[1]>=0&&O[0]*O[0]+O[1]*O[1]>N[0]*N[0]+N[1]*N[1])&&(C=R)}I=C}while(I!==S);return b.length>0&&b.push(b[0]),b}(d);if(Lv(o,m))return p}const pp=64,xg={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function K1(o,e,i,l,d,p,m,y,b,S=!1){const C=i.zoom,I=i.project(l),M=Gu(l.lat,C),R=1/M;oe(o),_e(o,o,[I.x+m[0]*R,I.y+m[1]*R,m[2]]);let O=1,N=1;const V=i.worldSize;if(S){if(i.projection.name==="mercator"){let ee=0;i.elevation&&(ee=i.elevation.getAtPointOrZero(new No(I.x/V,I.y/V),0));const te=oi([],[I.x,I.y,ee,1],i.projMatrix)[3]/i.cameraToCenterDistance;O=te,N=te*Gu(i.center.lat,C)}else if(i.projection.name==="globe"){const ee=X1(o,i),te=[0,0,0,1];oi(te,te,he([],i.projMatrix,ee));const le=te[3]/i.cameraToCenterDistance,xe=Ku(C),de=i.projection.pixelsPerMeter(l.lat,V)*Gu(l.lat,C),ve=i.projection.pixelsPerMeter(i.center.lat,V)*Gu(i.center.lat,C);O=le/Jt(de,pv(i.center.lat),xe),N=le*M/de,O*=ve,N*=ve}}else O=R;De(o,o,[O,O,N]);const G=[...o],K=e.orientation,q=[];if(tR(q,[K[0]+(d?d[0]:0),K[1]+(d?d[1]:0),K[2]+(d?d[2]:0)],p),he(o,G,q),y&&i.elevation){let ee=0;const te=[];if(b&&i.elevation){ee=function(xe,de,ve,Se,we){const Fe=de.elevation;if(!Fe)return 0;const Ve=Qr.projectAabbCorners(ve,Se),qe=Ko(1,we.lat)*de.worldSize,Ke=function(bt,Ft){const Rt=[0,0,1],Wt=[{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 ln of Wt){const en=bt[ln.corners[0]],gn=bt[ln.corners[1]],cn=bt[ln.corners[2]],Gn=[gn[0]-en[0],gn[1]-en[1],Ft*(gn[2]-en[2])],Yt=pi(Gn,Gn,[cn[0]-en[0],cn[1]-en[1],Ft*(cn[2]-en[2])]);$n(Yt,Yt),ln.dotProductWithUp=Ar(Yt,Rt)}return Wt.sort((ln,en)=>ln.dotProductWithUp-en.dotProductWithUp),Wt[0].corners}(Ve,qe),je=Ve[Ke[0]],at=Ve[Ke[1]],Ge=Ve[Ke[2]],$e=Ve[Ke[3]],Ye=Fe.getAtPointOrZero(new No(je[0]/de.worldSize,je[1]/de.worldSize),0),rt=Fe.getAtPointOrZero(new No(at[0]/de.worldSize,at[1]/de.worldSize),0),lt=Fe.getAtPointOrZero(new No(Ge[0]/de.worldSize,Ge[1]/de.worldSize),0),yt=Fe.getAtPointOrZero(new No($e[0]/de.worldSize,$e[1]/de.worldSize),0),tt=(Ye+yt)/2,mt=(rt+lt)/2;return tt>mt?rt<lt?Z1(xe,at,$e,je,rt,yt,Ye,qe):Z1(xe,Ge,je,$e,lt,Ye,yt,qe):Ye<yt?Z1(xe,je,at,Ge,Ye,rt,lt,qe):Z1(xe,$e,Ge,at,yt,lt,rt,qe),Math.max(tt,mt)}(te,i,e.aabb,o,l);const le=he([],It([],te),q);he(o,G,le)}else ee=i.elevation.getAtPointOrZero(new No(I.x/V,I.y/V),0);ee!==0&&(o[14]+=ee)}}class nR{constructor(e,i,l,d,p){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=l!=null?new Qn(l[0],l[1]):new Qn(0,0),this.orientation=d??[0,0,0],this.nodes=p,this.uploaded=!1,this.aabb=new Qr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){he(e.globalMatrix,i,e.localMatrix);const l=this.nodeOverrides.get(e.name);if(l!==void 0){if(l.orientation){const m=[];p=l.orientation,oe(d=m),nt(d,d,Te(p[1])),Xe(d,d,Te(p[2])),He(d,d,Te(p[0])),he(e.globalMatrix,e.globalMatrix,m)}l.minZoom&&(e.minZoom=l.minZoom),l.maxZoom&&(e.maxZoom=l.maxZoom)}var d,p;if(e.meshes)for(const m of e.meshes){const y=Qr.applyTransformFast(m.aabb,e.globalMatrix);this.aabb.encapsulate(y)}if(e.children)for(const m of e.children)this._applyTransformations(m,e.globalMatrix)}computeBoundsAndApplyParent(){const e=oe([]);this.aabb=new Qr([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,l,d,p,m,y=!1){K1(this.matrix,this,e.transform,this.position,i,l,d,p,m,y)}upload(e){if(!this.uploaded){for(const i of this.nodes)qE(i,e);for(const i of this.nodes)Y1(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)ZE(e)}}function o0(o,e,i=!1){o.uploaded||(o.gfxTexture=new Jc(e,o.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:o.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),o.uploaded=!0,o.image=null)}function rR(o,e,i){o.indexBuffer=e.createIndexBuffer(o.indexArray,!1,!0),o.vertexBuffer=e.createVertexBuffer(o.vertexArray,U8.members,!1,!0),o.normalArray&&(o.normalBuffer=e.createVertexBuffer(o.normalArray,W8.members,!1,!0)),o.texcoordArray&&(o.texcoordBuffer=e.createVertexBuffer(o.texcoordArray,H8.members,!1,!0)),o.colorArray&&(o.colorBuffer=e.createVertexBuffer(o.colorArray,(o.colorArray.bytesPerElement===12?G8:$8).members,!1,!0)),o.featureArray&&(o.pbrBuffer=e.createVertexBuffer(o.featureArray,Z8.members,!0)),o.segments=pr.simpleSegment(0,0,o.vertexArray.length,o.indexArray.length);const l=o.material;l.pbrMetallicRoughness.baseColorTexture&&o0(l.pbrMetallicRoughness.baseColorTexture,e),l.pbrMetallicRoughness.metallicRoughnessTexture&&o0(l.pbrMetallicRoughness.metallicRoughnessTexture,e),l.normalTexture&&o0(l.normalTexture,e),l.occlusionTexture&&o0(l.occlusionTexture,e,i),l.emissionTexture&&o0(l.emissionTexture,e)}function qE(o,e,i){if(o.meshes)for(const l of o.meshes)rR(l,e,i);if(o.lodMeshes)for(const l of o.lodMeshes)rR(l,e,i);if(o.children)for(const l of o.children)qE(l,e,i)}function iR(o){o.indexArray.destroy(),o.vertexArray.destroy(),o.colorArray&&o.colorArray.destroy(),o.normalArray&&o.normalArray.destroy(),o.texcoordArray&&o.texcoordArray.destroy(),o.featureArray&&o.featureArray.destroy()}function Y1(o){if(o.meshes)for(const e of o.meshes)iR(e);if(o.lodMeshes)for(const e of o.lodMeshes)iR(e);if(o.children)for(const e of o.children)Y1(e)}function oR(o){var e;o.vertexBuffer&&(o.vertexBuffer.destroy(),o.indexBuffer.destroy(),o.normalBuffer&&o.normalBuffer.destroy(),o.texcoordBuffer&&o.texcoordBuffer.destroy(),o.colorBuffer&&o.colorBuffer.destroy(),o.pbrBuffer&&o.pbrBuffer.destroy(),o.segments.destroy(),o.material&&((e=o.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()))}function ZE(o){if(o.meshes)for(const e of o.meshes)oR(e);if(o.lodMeshes)for(const e of o.lodMeshes)oR(e);if(o.footprintDebugMesh&&(o.footprintDebugMesh.vertexBuffer.destroy(),o.footprintDebugMesh.indexBuffer.destroy(),o.footprintDebugMesh.segments.destroy()),o.children)for(const e of o.children)ZE(e)}function XE(o,e,i,l){return o[0]<=l[0]&&e[0]>=i[0]&&o[1]<=l[1]&&e[1]>=i[1]&&o[2]<=l[2]&&e[2]>=i[2]}function K8(o,e,i,l,d,p,m,y,b,S,C){const I=.5*(S[0]+C[0]),M=.5*(S[1]+C[1]),R=.5*(S[2]+C[2]),O=.5*(C[0]-S[0]),N=.5*(C[1]-S[1]),V=.5*(C[2]-S[2]),G=o-I,K=e-M,q=i-R,ee=l-I,te=d-M,le=p-R,xe=m-I,de=y-M,ve=b-R,Se=ee-G,we=te-K,Fe=le-q,Ve=xe-ee,qe=de-te,Ke=ve-le,je=G-xe,at=K-de,Ge=q-ve;let $e,Ye,rt,lt,yt,tt;if($e=q*we-K*Fe,Ye=le*we-te*Fe,rt=ve*we-de*Fe,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(Fe)*N+Math.abs(we)*V,lt>tt||yt<-tt||($e=q*qe-K*Ke,Ye=le*qe-te*Ke,rt=ve*qe-de*Ke,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(Ke)*N+Math.abs(qe)*V,lt>tt||yt<-tt)||($e=q*at-K*Ge,Ye=le*at-te*Ge,rt=ve*at-de*Ge,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(Ge)*N+Math.abs(at)*V,lt>tt||yt<-tt)||($e=G*Fe-q*Se,Ye=ee*Fe-le*Se,rt=xe*Fe-ve*Se,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(Fe)*O+Math.abs(Se)*V,lt>tt||yt<-tt)||($e=G*Ke-q*Ve,Ye=ee*Ke-le*Ve,rt=xe*Ke-ve*Ve,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(Ke)*O+Math.abs(Ve)*V,lt>tt||yt<-tt)||($e=G*Ge-q*je,Ye=ee*Ge-le*je,rt=xe*Ge-ve*je,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(Ge)*O+Math.abs(je)*V,lt>tt||yt<-tt)||($e=K*Se-G*we,Ye=te*Se-ee*we,rt=de*Se-xe*we,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(we)*O+Math.abs(Se)*N,lt>tt||yt<-tt)||($e=K*Ve-G*qe,Ye=te*Ve-ee*qe,rt=de*Ve-xe*qe,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(qe)*O+Math.abs(Ve)*N,lt>tt||yt<-tt)||($e=K*je-G*at,Ye=te*je-ee*at,rt=de*je-xe*at,lt=Math.min($e,Ye,rt),yt=Math.max($e,Ye,rt),tt=Math.abs(at)*O+Math.abs(je)*N,lt>tt||yt<-tt)||(lt=Math.min(G,ee,xe),yt=Math.max(G,ee,xe),lt>O||yt<-O)||(lt=Math.min(K,te,de),yt=Math.max(K,te,de),lt>N||yt<-N)||(lt=Math.min(q,le,ve),yt=Math.max(q,le,ve),lt>V||yt<-V))return!1;const mt=we*Ke-Fe*qe,bt=Fe*Ve-Se*Ke,Ft=Se*qe-we*Ve,Rt=-(mt*G+bt*K+Ft*q);return tt=O*Math.abs(mt)+N*Math.abs(bt)+V*Math.abs(Ft),!(Math.abs(Rt)>tt)}const Y8=[];class sR{serializeFromGltf(e,i,l,d){if(e.length<7)return;let p=0;if(e[p++]!==109||e[p++]!==98||e[p++]!==120||e[p++]!==98||e[p++]!==118||e[p++]!==104||e[p++]!==43)return;const m=new DataView(e.buffer,e.byteOffset),y=m.getUint16(p,!0);if(p+=2,y===0)return;this._nodes=[];let b=0;for(let C=0;C<y;C++){const I=[i[3*b],i[3*b+1],i[3*b+2]],M=[l[3*b],l[3*b+1],l[3*b+2]];b++;const R=m.getUint16(p,!0);p+=2;let O=0,N=0;R===65535&&(O=m.getUint16(p,!0),p+=2,N=m.getUint32(p,!0),p+=4),this._nodes.push({aabbMin:I,aabbMax:M,backChild:R,indexCount:O,indexOffset:N})}const S=m.getUint32(p,!0);this._indices=d.slice(0,S)}setVertices(e){this._vertices=e}findHighestPoint(e,i){if(!this._nodes||this._nodes.length===0||!XE(this._nodes[0].aabbMin,this._nodes[0].aabbMax,e,i))return null;const l=Y8;l.length=0,l.push(0);let d=-1/0;for(;l.length>0;){const p=l.pop(),m=this._nodes[p];if(m.aabbMax[2]<=d)continue;if(m.backChild===65535){for(let R=0;R<m.indexCount;R+=3){const O=3*this._indices[m.indexOffset+R],N=3*this._indices[m.indexOffset+R+1],V=3*this._indices[m.indexOffset+R+2];K8(this._vertices[O],this._vertices[O+1],this._vertices[O+2],this._vertices[N],this._vertices[N+1],this._vertices[N+2],this._vertices[V],this._vertices[V+1],this._vertices[V+2],e,i)&&(d=Math.max(d,this._vertices[O+2],this._vertices[N+2],this._vertices[V+2]))}continue}const y=p+1,b=m.backChild,S=this._nodes[y],C=this._nodes[b],I=XE(S.aabbMin,S.aabbMax,e,i),M=XE(C.aabbMin,C.aabbMax,e,i);I&&M?S.aabbMax[2]<C.aabbMax[2]?(l.push(y),l.push(b)):(l.push(b),l.push(y)):I?l.push(y):M&&l.push(b)}return d>=0?d:null}}function mp(o,e){const i=o.json.bufferViews[e.bufferView],l=$1[e.componentType];return new l(o.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==i0[e.type]*l.BYTES_PER_ELEMENT?i.byteStride/l.BYTES_PER_ELEMENT:i0[e.type]))}function KE(o,e,i,l){const d=$1[e.componentType],p=function(I){switch(I){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(d),m=o.json.bufferViews[e.bufferView],y=m.byteStride?m.byteStride/d.BYTES_PER_ELEMENT:i0[e.type],b=i.float32,S=b.length/i.capacity,C=e.count*y;for(let I=0,M=0;I<C;I+=y,M+=S)for(let R=0;R<S;R++)b[M+R]=l[I+R]*p}function Q8(o,e,i){const l=o.indices,d=o.attributes,p={};p.indexArray=new _i;const m=e.json.accessors[l],y=mp(e,m);p.indexArray.resizeExact(m.count/3),p.indexArray.uint16.set(y),p.vertexArray=new Ca;const b=e.json.accessors[d.POSITION],S=mp(e,b);p.vertexArray.resizeExact(b.count),p.vertexArray.float32.set(S),p.aabb=new Qr(b.min,b.max);const[C,I,M]=b.min,[R,O,N]=b.max;if(p.centroid=[.5*(C+R),.5*(I+O),.5*(M+N)],d.COLOR_0!==void 0){const G=e.json.accessors[d.COLOR_0],K=i0[G.type],q=mp(e,G);p.colorArray=K===3?new Ca:new nc,p.colorArray.resizeExact(G.count),KE(e,G,p.colorArray,q)}if(d.NORMAL!==void 0){p.normalArray=new Ca;const G=e.json.accessors[d.NORMAL];p.normalArray.resizeExact(G.count);const K=mp(e,G);KE(e,G,p.normalArray,K)}if(d.TEXCOORD_0!==void 0&&i.length>0){p.texcoordArray=new Wu;const G=e.json.accessors[d.TEXCOORD_0];p.texcoordArray.resizeExact(G.count);const K=mp(e,G);KE(e,G,p.texcoordArray,K)}if(d._FEATURE_ID_RGBA4444!==void 0){const G=e.json.accessors[d._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(p.featureData=mp(e,G))}d._FEATURE_RGBA4444!==void 0&&(p.featureData=new Uint32Array(mp(e,e.json.accessors[d._FEATURE_RGBA4444]).buffer));const V=o.material;return p.material=function(G,K){const{emissiveFactor:q=[0,0,0],alphaMode:ee="OPAQUE",alphaCutoff:te=.5,normalTexture:le,occlusionTexture:xe,emissiveTexture:de,doubleSided:ve,name:Se}=G,{baseColorFactor:we=[1,1,1,1],metallicFactor:Fe=1,roughnessFactor:Ve=1,baseColorTexture:qe,metallicRoughnessTexture:Ke}=G.pbrMetallicRoughness||{},je=xe?K[xe.index]:void 0;if(xe&&xe.extensions&&xe.extensions.KHR_texture_transform&&je){const at=xe.extensions.KHR_texture_transform;je.offsetScale=[at.offset[0],at.offset[1],at.scale[0],at.scale[1]]}return{name:Se,pbrMetallicRoughness:{baseColorFactor:new qn(...we),metallicFactor:Fe,roughnessFactor:Ve,baseColorTexture:qe?K[qe.index]:void 0,metallicRoughnessTexture:Ke?K[Ke.index]:void 0},doubleSided:ve,emissiveFactor:new qn(...q),alphaMode:ee,alphaCutoff:te,normalTexture:le?K[le.index]:void 0,occlusionTexture:je,emissionTexture:de?K[de.index]:void 0,defined:G.defined===void 0}}(V!==void 0?e.json.materials[V]:{defined:!1},i),p}function YE(o,e,i){const{matrix:l,rotation:d,translation:p,scale:m,mesh:y,extras:b,children:S,name:C}=o,I={};if(I.name=C,I.localMatrix=l||function(M,R,O,N){var V=R[0],G=R[1],K=R[2],q=R[3],ee=V+V,te=G+G,le=K+K,xe=V*ee,de=V*te,ve=V*le,Se=G*te,we=G*le,Fe=K*le,Ve=q*ee,qe=q*te,Ke=q*le,je=N[0],at=N[1],Ge=N[2];return M[0]=(1-(Se+Fe))*je,M[1]=(de+Ke)*je,M[2]=(ve-qe)*je,M[3]=0,M[4]=(de-Ke)*at,M[5]=(1-(xe+Fe))*at,M[6]=(we+Ve)*at,M[7]=0,M[8]=(ve+qe)*Ge,M[9]=(we-Ve)*Ge,M[10]=(1-(xe+Se))*Ge,M[11]=0,M[12]=O[0],M[13]=O[1],M[14]=O[2],M[15]=1,M}([],d||[0,0,0,1],p||[0,0,0],m||[1,1,1]),I.globalMatrix=me(I.localMatrix),y!==void 0){I.meshes=i[y];const M=I.anchor=[0,0];for(const R of I.meshes){const{min:O,max:N}=R.aabb;M[0]+=O[0]+N[0],M[1]+=O[1]+N[1]}M[0]=Math.floor(M[0]/I.meshes.length/2),M[1]=Math.floor(M[1]/I.meshes.length/2)}if(b&&(b.id&&(I.id=b.id),b.lights&&(I.lights=function(M){if(!M.length)return[];const R=function(K){const q=atob(K),ee=new Uint8Array(q.length);for(let te=0;te<q.length;te++)ee[te]=q.codePointAt(te);return ee}(M),O=[],N=R.length/24,V=new Uint16Array(R.buffer),G=new Float32Array(R.buffer);for(let K=0;K<N;K++){const q=V[2*K*6]/30,ee=V[2*K*6+1]/30,te=V[2*K*6+10]/100,le=G[6*K+1],xe=G[6*K+2],de=G[6*K+3],ve=G[6*K+4],Se=de-le,we=ve-xe,Fe=Math.hypot(Se,we);O.push({pos:[le+.5*Se,xe+.5*we,ee],normal:[we/Fe,-Se/Fe,0],width:Fe,height:q,depth:te,points:[le,xe,de,ve]})}return O}(b.lights)),b.MAPBOX_geometry_bloom&&(I.isGeometryBloom=b.MAPBOX_geometry_bloom),b.MAPBOX_zoom_min&&(I.minZoom=b.MAPBOX_zoom_min),b.MAPBOX_zoom_max&&(I.maxZoom=b.MAPBOX_zoom_max)),S){const M=[];for(const R of S)M.push(YE(e.json.nodes[R],e,i));I.children=M}if(o.extensions&&o.extensions.mbx_bvh&&(I.meshBVH=function(M,R,O){const N=R.binaryAccessor,V=R.positionMinAccessor,G=R.positionMaxAccessor,K=R.indexAccessor;if(!(Number.isInteger(N)&&Number.isInteger(V)&&Number.isInteger(G)&&Number.isInteger(K)))return null;const q=M.json.accessors;if(N>=q.length||V>=q.length||G>=q.length||K>=q.length)return null;const ee=q[N],te=q[V],le=q[G],xe=q[K];if(ee.bufferView===void 0||te.bufferView===void 0||le.bufferView===void 0||xe.bufferView===void 0)return null;const de=M.json.bufferViews;if(ee.bufferView>=de.length||te.bufferView>=de.length||le.bufferView>=de.length||xe.bufferView>=de.length)return null;const ve=de[ee.bufferView],Se=de[te.bufferView],we=de[le.bufferView],Fe=de[xe.bufferView];if(ve.buffer>=M.buffers.length||Se.buffer>=M.buffers.length||we.buffer>=M.buffers.length||Fe.buffer>=M.buffers.length)return null;const Ve=(yt,tt,mt)=>yt>=0&&yt<=mt&&tt<=mt-yt,qe=ee.byteOffset||0,Ke=te.byteOffset||0,je=le.byteOffset||0,at=xe.byteOffset||0;if(!(Ve(qe,0,ve.byteLength)&&Ve(Ke,3*te.count*4,Se.byteLength)&&Ve(je,3*le.count*4,we.byteLength)&&Ve(at,4*xe.count,Fe.byteLength)))return null;const Ge=new Uint8Array(M.buffers[ve.buffer],(ve.byteOffset||0)+qe,ve.byteLength-qe),$e=new Float32Array(M.buffers[Se.buffer],(Se.byteOffset||0)+Ke,3*te.count),Ye=new Float32Array(M.buffers[we.buffer],(we.byteOffset||0)+je,3*le.count),rt=new Uint32Array(M.buffers[Fe.buffer],(Fe.byteOffset||0)+at,xe.count),lt=new sR;if(lt.serializeFromGltf(Ge,$e,Ye,rt),O!==void 0&&M.json.meshes&&M.json.meshes[O]){const yt=M.json.meshes[O].primitives[0];if(yt&&yt.attributes.POSITION!==void 0&&yt.attributes.POSITION<q.length){const tt=q[yt.attributes.POSITION];if(tt.bufferView!==void 0&&tt.bufferView<de.length){const mt=de[tt.bufferView];if(mt.buffer<M.buffers.length){const bt=tt.byteOffset||0,Ft=mt.byteStride?mt.byteStride/4:3;if(Ve(bt,tt.count*Ft*4,mt.byteLength)){const Rt=(mt.byteOffset||0)+bt;if(Ft===3)lt.setVertices(new Float32Array(M.buffers[mt.buffer],Rt,3*tt.count));else{const Wt=new Float32Array(M.buffers[mt.buffer],Rt,tt.count*Ft),ln=new Float32Array(3*tt.count);for(let en=0;en<tt.count;en++)ln[3*en]=Wt[en*Ft],ln[3*en+1]=Wt[en*Ft+1],ln[3*en+2]=Wt[en*Ft+2];lt.setVertices(ln)}}}}}}return lt}(e,o.extensions.mbx_bvh,y)),!I.meshBVH&&I.children){for(const M of I.children)if(M.meshBVH){I.meshBVH=M.meshBVH;break}}return I}function J8(o){if(o.vertices.length===0||o.indices.length===0)return null;const e=new W1(o.vertices,o.indices,8,256),[i,l]=[e.min.clone(),e.max.clone()];return{vertices:o.vertices,indices:o.indices,grid:e,min:i,max:l}}function eG(o){if(!o.extras||!o.extras.ground)return null;const e=o.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 l=[];for(const m of i){if(!Array.isArray(m)||m.length!==2)continue;const y=m[0],b=m[1];typeof y=="number"&&typeof b=="number"&&l.push(new et(y,b))}if(l.length<3)return null;l.length>1&&l.at(-1).equals(l[0])&&l.pop();let d=0;for(let m=0;m<l.length;m++){const y=l[m],b=l[(m+1)%l.length],S=l[(m+2)%l.length];d+=(y.x-b.x)*(S.y-b.y)-(S.x-b.x)*(y.y-b.y)}d>0&&l.reverse();const p=Nu(l.flatMap(m=>[m.x,m.y]),[]);return p.length===0?null:{vertices:l,indices:p}}function tG(o,e){const i=[],l=[];let d=0;const p=[];for(const m of o){d=i.length;const y=m.vertexArray.float32,b=m.indexArray.uint16;for(let S=0;S<m.vertexArray.length;S++)p[0]=y[3*S+0],p[1]=y[3*S+1],p[2]=y[3*S+2],Tr(p,p,e),i.push(new et(p[0],p[1]));for(let S=0;S<3*m.indexArray.length;S++)l.push(b[S]+d)}if(l.length%3!=0)return null;for(let m=0;m<l.length;m+=3){const y=i[l[m+0]],b=i[l[m+1]],S=i[l[m+2]];(y.x-b.x)*(S.y-b.y)-(S.x-b.x)*(y.y-b.y)>0&&([l[m+1],l[m+2]]=[l[m+2],l[m+1]])}return{vertices:i,indices:l}}function aR(o,e){for(let i=0;i<o.length;i++)if(o[i].name===e)return i;return-1}function QE(o){const e=function(C,I){const M=[],R=WebGL2RenderingContext;if(C.json.textures)for(const O of C.json.textures){const N={magFilter:R.LINEAR,minFilter:R.NEAREST,wrapS:R.REPEAT,wrapT:R.REPEAT};O.sampler!==void 0&&Object.assign(N,C.json.samplers[O.sampler]),M.push({image:I[O.source],sampler:N,uploaded:!1})}return M}(o,o.images),i=function(C,I){const M=[];for(const R of C.json.meshes){const O=[];for(const N of R.primitives)O.push(Q8(N,C,I));M.push(O)}return M}(o,e),{scenes:l,scene:d,nodes:p}=o.json;let m=l?aR(l,"Default Scene"):-1;m<0&&(m=d||0);const y=l?l[m].nodes:[...p.keys()],b=[];for(const C of y)b.push(YE(p[C],o,i));(function(C,I,M){const R={},O=new Set;for(let N=0;N<C.length;N++){const V=M[I[N]];if(!V.extras)continue;const G=V.extras["mapbox:footprint:version"],K=V.extras["mapbox:footprint:id"];(G||K)&&O.add(N),G==="1.0.0"&&K&&(R[K]=N)}for(let N=0;N<C.length;N++){if(O.has(N))continue;const V=C[N],G=M[I[N]];if(!G.extras)continue;let K=null;V.id in R&&(K=tG(C[R[V.id]].meshes,V.localMatrix)),K||(K=eG(G)),K&&(V.footprint=J8(K))}if(O.size>0){const N=Array.from(O.values()).sort((V,G)=>V-G);for(let V=N.length-1;V>=0;V--)C.splice(N[V],1)}})(b,y,o.json.nodes);const S=l?aR(l,"LOD"):-1;if(S>=0){const C=l[S].nodes,I=new Map;for(const M of C){const R=YE(p[M],o,i);R.id&&I.set(R.id,R)}for(const M of b)if(M.id){const R=I.get(M.id);R&&R.meshes&&(M.lodMeshes=R.meshes,R.meshBVH&&(M.meshBVH=R.meshBVH))}}return b}function nG(o){o.heightmap=new Float32Array(4096),o.heightmap.fill(-1);const e=o.vertexArray.float32,i=o.aabb.min[0]-1,l=o.aabb.min[1]-1,d=pp/(o.aabb.max[0]-i+2),p=pp/(o.aabb.max[1]-l+2);for(let m=0;m<e.length;m+=3){const y=e[m+2],b=(e[m+0]-i)*d|0,S=(e[m+1]-l)*p|0;y>o.heightmap[S*pp+b]&&(o.heightmap[S*pp+b]=y)}}function lR(o,e,i,l,d){i.reserve(i.length+4*o.length),l.reserve(l.length+10*o.length),d.reserve(d.length+10*o.length);let p=l.length;for(const m of o){const y=Math.min(10,Math.max(4,1.3*m.height))*e,b=[-m.normal[1],m.normal[0],0],S=Math.min(.29,.1*m.width/m.depth),C=m.width-2*m.depth*e*(S+.01),I=Wr([],m.pos,b,C/2),M=Wr([],m.pos,b,-C/2),R=[I[0],I[1],I[2]+m.height],O=[M[0],M[1],M[2]+m.height],N=Wr([],m.normal,b,S);Tn(N,N,y);const V=Wr([],m.normal,b,-S);Tn(V,V,y),Pt(N,I,N),Pt(V,M,V),I[2]+=.1,M[2]+=.1,l.emplaceBack(N[0],N[1],N[2]),l.emplaceBack(V[0],V[1],V[2]),l.emplaceBack(I[0],I[1],I[2]),l.emplaceBack(M[0],M[1],M[2]),l.emplaceBack(R[0],R[1],R[2]),l.emplaceBack(O[0],O[1],O[2]),l.emplaceBack(I[0],I[1],I[2]),l.emplaceBack(M[0],M[1],M[2]),l.emplaceBack(N[0],N[1],N[2]),l.emplaceBack(V[0],V[1],V[2]);const G=C/y/2;d.emplaceBack(-G-S,-1,G,.8),d.emplaceBack(G+S,-1,G,.8),d.emplaceBack(-G,0,G,1.3),d.emplaceBack(G,0,G,1.3),d.emplaceBack(G+S,-.8,G,.7),d.emplaceBack(G+S,-.8,G,.7),d.emplaceBack(0,0,G,1.3),d.emplaceBack(0,0,G,1.3),d.emplaceBack(G+S,-1.2,G,.8),d.emplaceBack(G+S,-1.2,G,.8),i.emplaceBack(6+p,4+p,8+p),i.emplaceBack(7+p,9+p,5+p),i.emplaceBack(0+p,1+p,2+p),i.emplaceBack(1+p,3+p,2+p),p+=10}}function rG(o,e){const i={};i.indexArray=new _i,i.vertexArray=new Ca,i.colorArray=new nc,i.indexArray.reserveExact(4*o.length),i.vertexArray.reserveExact(10*o.length),i.colorArray.reserveExact(10*o.length),lR(o,e,i.indexArray,i.vertexArray,i.colorArray);const l={defined:!0};l.emissiveFactor=qn.black;const d={};return d.baseColorFactor=qn.white,l.pbrMetallicRoughness=d,i.material=l,i.aabb=new Qr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}Mt(sR,"ModelBVH");const cR=Sn([{name:"a_pos_3f",components:3,type:"Float32"}]),iG=Sn([{name:"a_normal_3",components:3,type:"Int16"}]),oG=Sn([{name:"a_centroid_3",components:3,type:"Int16"}]),uR=Sn([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),sG=Sn([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),aG=Sn([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),lG=Sn([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),cG=Sn([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),uG=Sn([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),dG=Sn([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),hG=Sn([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),fG=Sn([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),pG=Sn([{name:"a_centroid_pos",components:2,type:"Uint16"}]),mG=Sn([{name:"a_join_normal_inside",components:3,type:"Int16"}]),gG=Sn([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),_G=Sn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:yG}=dG;function Q1(o,e,i,l){const d=[],p=l===0?(m,y,b,S,C,I)=>{m.push(new et(I,b+(I-y)/(S-y)*(C-b)))}:(m,y,b,S,C,I)=>{m.push(new et(y+(I-b)/(C-b)*(S-y),I))};for(const m of o){const y=[];for(const b of m){if(b.length<=2)continue;const S=[];for(let M=0;M<b.length-1;M++){const R=b[M].x,O=b[M].y,N=b[M+1].x,V=b[M+1].y,G=l===0?R:O,K=l===0?N:V;G<e?K>e&&p(S,R,O,N,V,e):G>i?K<i&&p(S,R,O,N,V,i):S.push(b[M]),K<e&&G>=e&&p(S,R,O,N,V,e),K>i&&G<=i&&p(S,R,O,N,V,i)}let C=b.at(-1);const I=l===0?C.x:C.y;I>=e&&I<=i&&S.push(C),S.length&&(C=S.at(-1),S[0].x===C.x&&S[0].y===C.y||S.push(S[0]),y.push(S))}y.length&&d.push(y)}return d}const J1={None:0,Model:1,Symbol:2,FillExtrusion:4},JE=[new et(0,0),new et(St,0),new et(St,St),new et(0,St)];function dR(o,e){const i=[];let l=[];if(!e||o.length<2)return[o];if(o.length===2)return rh(o[0],o[1],JE)?[o]:[];for(let d=0;d<o.length+2;d++){const p=d===0?o.at(-1):o[(d-1)%o.length],m=o[d%o.length],y=o[(d+1)%o.length],b=rh(p,m,JE),S=rh(m,y,JE),C=b||S;C&&l.push(m),C&&S||l.length>0&&(l.length>1&&i.push(l),l=[])}return l.length>1&&i.push(l),i}const ek=Yc.types,vG=["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"],xG=["fill-extrusion-flood-light-ground-radius"],bG=Math.pow(2,13),wG=Math.pow(2,15)-1,ew=new et(0,1),Ju=2147483648,tw=1073741824;function s0(o,e,i,l,d,p,m,y){o.emplaceBack((e<<1)+m,(i<<1)+p,(Math.floor(l*bG)<<1)+d,Math.round(y))}function a0(o,e,i){o.emplaceBack(e.x*St,e.y*St,i?1:0)}function nw(o,e,i,l,d,p){o.emplaceBack(e.x,e.y,(i.x<<1)+l,(i.y<<1)+d,p)}function l0(o,e,i){o.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class hR{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class rw{constructor(){this.data=[]}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}static serialize(e,i){const l=e.data.length,d=new Uint32Array(4*l),p=[];p.length=l;for(let m=0;m<l;m++){const y=e.data[m],b=4*m;d[b]=y.vertexOffset,d[b+1]=y.vertexCount,d[b+2]=y.indexOffset,d[b+3]=y.indexCount,p[m]=y.ringIndices}return i&&i.add(d.buffer),{scalars:d,rings:p}}static deserialize(e){const{scalars:i,rings:l}=e,d=i.length/4,p=new rw,m=[];m.length=d,p.data=m;for(let y=0;y<d;y++){const b=4*y,S=new hR;S.vertexOffset=i[b],S.vertexCount=i[b+1],S.indexOffset=i[b+2],S.indexCount=i[b+3],S.ringIndices=l[y],p.data[y]=S}return p}}class iw{constructor(){this.centroidXY=new et(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 et(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new et(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new et(0,0)}span(){return new et(this.max.x-this.min.x,this.max.y-this.min.y)}}class ow{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}find(e){return this.data.find(e)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(e,i){const l=e.data.length,d=new Float64Array(15*l);for(let p=0;p<l;p++){const m=e.data[p],y=15*p;d[y]=m.centroidXY.x,d[y+1]=m.centroidXY.y,d[y+2]=m.min.x,d[y+3]=m.min.y,d[y+4]=m.max.x,d[y+5]=m.max.y,d[y+6]=m.groupCentroidPos.x,d[y+7]=m.groupCentroidPos.y,d[y+8]=m.vertexArrayOffset,d[y+9]=m.vertexCount,d[y+10]=m.groundVertexArrayOffset,d[y+11]=m.groundVertexCount,d[y+12]=m.footprintSegLen,d[y+13]=m.height,d[y+14]=m.buildingId}return i&&i.add(d.buffer),{buffer:d}}static deserialize(e){const i=e.buffer,l=i.length/15,d=new ow;d.buffer=i;const p=[];p.length=l,d.data=p;let m=0;for(let y=0;y<l;y++){const b=15*y,S=new iw;S.centroidXY=new et(i[b],i[b+1]),S.min=new et(i[b+2],i[b+3]),S.max=new et(i[b+4],i[b+5]),S.groupCentroidPos=new et(i[b+6],i[b+7]),S.vertexArrayOffset=i[b+8],S.vertexCount=i[b+9],S.groundVertexArrayOffset=i[b+10],S.groundVertexCount=i[b+11],S.footprintSegLen=i[b+12],S.height=i[b+13],S.buildingId=i[b+14],S.footprintSegIdx=m,m+=S.footprintSegLen,d.data[y]=S}return d}}class tk{constructor(){this.acc=new et(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,l){this.accCount++,this.acc._add(i);let d=!!this.borders;i.x<e.min.x?(e.min.x=i.x,d=!0):i.x>e.max.x&&(e.max.x=i.x,d=!0),i.y<e.min.y?(e.min.y=i.y,d=!0):i.y>e.max.y&&(e.max.y=i.y,d=!0),((i.x===0||i.x===St)&&i.x===l.x)!=((i.y===0||i.y===St)&&i.y===l.y)&&this.processBorderOverlap(i,l),d&&this.checkBorderIntersection(i,l)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Jt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>St!=e.x>St&&this.addBorderIntersection(1,Jt(i.y,e.y,(St-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Jt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>St!=e.y>St&&this.addBorderIntersection(3,Jt(i.x,e.x,(St-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 l=this.borders[e];i<l[0]&&(l[0]=i),i>l[1]&&(l[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const l=e.x===0?0:1;this.addBorderIntersection(l,i.y),this.addBorderIntersection(l,e.y)}else{const l=e.y===0?2:3;this.addBorderIntersection(l,i.x),this.addBorderIntersection(l,e.x)}}centroid(){return this.accCount===0?new et(0,0):new et(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 fR(o,e){const i=o.add(e)._unit(),l=Ie(o.x*i.x+o.y*i.y,-1,1);var d,p,m;return m=Math.acos(l),Math.min(4,Math.max(-4,Math.tan(m)))/4*wG*((d=o).x*(p=e).y-d.y*p.x<0?-1:1)}const SG=[o=>o.x<0,o=>o.x>St,o=>o.y<0,o=>o.y>St];function TG(o,e,i,l){const d=[4];if(l===0)return d;i._mult(l);const p=o.sub(i),m=e.sub(i),y=[o,e,p,m];for(let b=0;b<4;b++)for(const S of y)if(SG[b](S)){d.push(b);break}return d}class nk{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new _v,this.indexArray=new _i,this.programConfigurations=new Ya(e.layers,{zoom:e.zoom,lut:e.lut},i=>xG.includes(i)),this._segments=new pr,this.hiddenByLandmarkVertexArray=new rg,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new pr}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,l,d=!1){const p=e.length;if(p>2){let m=Math.max(0,this._segments.get().length-1);const y=this._segments._prepareSegment(4*p,this.vertexArray.length,2*this._segmentToGroundQuads[m].length);let b;m!==this._segments.get().length-1&&(m++,this._segmentToGroundQuads[m]=[],this._segmentToRegionTriCounts[m]=[0,0,0,0,0]);{const S=e[0],C=e[1];b=fR(S.sub(e[p-1])._perp()._unit(),C.sub(S)._perp()._unit())}for(let S=0;S<p;S++){const C=S===p-1?0:S+1,I=e[S],M=e[C],R=e[C===p-1?0:C+1],O=M.sub(I)._perp()._unit(),N=fR(O,R.sub(M)._perp()._unit()),V=b,G=N;if(rk(I,M,i)||d&&gR(I,i)&&gR(M,i)){b=N;continue}const K=y.vertexLength;nw(this.vertexArray,I,M,1,1,V),nw(this.vertexArray,I,M,1,0,V),nw(this.vertexArray,I,M,0,1,G),nw(this.vertexArray,I,M,0,0,G),y.vertexLength+=4;const q=TG(I,M,O,l);for(const ee of q)this._segmentToGroundQuads[m].push({id:K,region:ee}),this._segmentToRegionTriCounts[m][ee]+=2,y.primitiveLength+=2;b=N}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let l=0;l<i;l++)this._segmentToGroundQuads[l].sort((d,p)=>d.region-p.region);for(let l=0;l<i;l++){const d=this._segmentToGroundQuads[l],p=e[l],m=this._segmentToRegionTriCounts[l];m.reduce((b,S)=>b+S,0);let y=0;for(let b=0;b<=4;b++){const S=m[b];if(S!==0){let C=this.regionSegments[b];C||(C=this.regionSegments[b]=new pr);const I={vertexOffset:p.vertexOffset,primitiveOffset:p.primitiveOffset+y,vertexLength:p.vertexLength,primitiveLength:S};C.get().push(I)}y+=S}for(let b=0;b<d.length;b++){const S=d[b].id;this.indexArray.emplaceBack(S,S+1,S+3),this.indexArray.emplaceBack(S,S+3,S+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,l,d,p,m,y){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,l,d,p,m,void 0,y)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,hG.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,fG.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,l,d,p,m,y,b){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,l,d,p,m,y,b)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ju||e.flags&tw))}updateHiddenByLandmarkRange(e,i,l){if(!this.hasData())return;const d=i+e;if(i!==0){for(let p=e;p<d;++p)this.hiddenByLandmarkVertexArray.emplace(p,l?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,gG.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 sw{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=new ow,this.footprintIndices=new _i,this.footprintVertices=new ea,this.footprintSegments=new rw,this.layoutVertexArray=new Yf,this.centroidVertexArray=new Os,this.wallVertexArray=new u1,this.indexArray=new _i,this.programConfigurations=new Ya(e.layers,{zoom:e.zoom,lut:e.lut},i=>vG.includes(i)),this.segments=new pr,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new nk(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){this.features=[],this.hasPattern=uv("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=Qs(l),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:p,id:m,index:y,sourceLayerIndex:b}of e){const S=this.layers[0]._featureFilter.needGeometry,C=Ls(p,S);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),C,l))continue;const I={id:m,sourceLayerIndex:b,index:y,geometry:S?C.geometry:Js(p,l,d),properties:p.properties,type:p.type,patterns:{}},M=this.layoutVertexArray.length,R=ek[I.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:p.id,feature:Km("fill-extrusion",this.layers,I,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const O of I.geometry)for(const N of dR(O,R))this.addFeature(p.id,I,[N],y,l,{},i.availableImages,d,i.brightness);else this.addFeature(p.id,I,I.geometry,y,l,{},i.availableImages,d,i.brightness);i.featureIndex.insert(p,I.geometry,y,b,this.index,M)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,l,d,p,m){for(const{featureId:y,feature:b}of this.features){const S=ek[b.type]==="Polygon",{geometry:C}=b;if(this.wallMode)for(const I of C)for(const M of dR(I,S))this.addFeature(y,b,[M],b.index,i,l,d,p,m);else this.addFeature(y,b,C,b.index,i,l,d,p,m)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,l,d,p,m,y){this.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y,this.worldview),this.groundEffect.update(e,i,p,l,d,m,y,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}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,yG),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,mG.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,_G.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,pG.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,l,d,p,m,y,b,S){const C=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,I=[new et(0,0),new et(St,St)],M=b.projection,R=M.name==="globe",O=this.wallMode||ek[i.type]==="Polygon",N=new tk;N.centroidDataIndex=this.centroidData.length;const V=new iw;V.buildingId=e,i.properties&&Object.hasOwn(i.properties,"building_id")&&(V.buildingId=Number(i.properties.building_id)),N.buildingId=V.buildingId;const G=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},p)<=0,K=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},p);let q;if(V.height=K,V.vertexArrayOffset=this.layoutVertexArray.length,V.groundVertexArrayOffset=this.groundEffect.vertexArray.length,R&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Jm),this.wallMode){if(R)return void Cn("Non zero fill-extrusion-line-width is not yet supported on globe.");if(l.length!==1)return;q=function(Se){const we=Se[0].x===Se.at(-1).x&&Se[0].y===Se.at(-1).y;(function(mt){let bt=0;const Ft=mt.length;for(let Rt=0;Rt<Ft;Rt++)bt+=(mt[(Rt+1)%Ft].x-mt[Rt].x)*(mt[(Rt+1)%Ft].y+mt[Rt].y);return bt>=0})(Se)||(Se=Se.reverse());const Ve={geometry:[],joinNormals:[],indices:[]},qe=[],Ke=[],je=[];let at=Se.length;for(;at>=2&&Se[at-1].equals(Se[at-2]);)at--;if(at<(we?3:2))return Ve;let Ge,$e,Ye,rt,lt,yt=0;for(;yt<at-1&&Se[yt].equals(Se[yt+1]);)yt++;we&&(Ge=Se[at-2],lt=Se[yt].sub(Ge)._unit()._perp());for(let mt=yt;mt<at;mt++){if(Ye=mt===at-1?we?Se[yt+1]:void 0:Se[mt+1],Ye&&Se[mt].equals(Ye))continue;lt&&(rt=lt),Ge&&($e=Ge),Ge=Se[mt],lt=Ye?Ye.sub(Ge)._unit()._perp():rt,rt=rt||lt;let bt=rt.add(lt);bt.x===0&&bt.y===0||bt._unit();const Ft=bt.x*lt.x+bt.y*lt.y,Rt=Ft!==0?1/Ft:1/0,Wt=rt.x*lt.y-rt.y*lt.x>0;let ln="miter";const en=2;ln==="miter"&&Rt>en&&(ln="bevel"),ln==="bevel"&&(Rt>100&&(ln="flipbevel"),Rt<en&&(ln="miter"));const gn=(cn,Gn,Yt,gr)=>{const ar=new et(cn.x,cn.y),Er=new et(cn.x,cn.y);ar.x+=Gn.x*gr,ar.y+=Gn.y*gr,Er.x-=Gn.x*Math.max(Yt,1),Er.y-=Gn.y*Math.max(Yt,1),je.push(Gn),qe.push(ar),Ke.push(Er)};if(ln==="miter")bt._mult(Rt),gn(Ge,bt,0,0);else if(ln==="flipbevel")bt=lt.mult(-1),gn(Ge,bt,0,0),gn(Ge,bt.mult(-1),0,0);else{const cn=-Math.sqrt(Rt*Rt-1),Gn=Wt?cn:0,Yt=Wt?0:cn;$e&&gn(Ge,rt,Gn,Yt),Ye&&gn(Ge,lt,Gn,Yt)}}Ve.geometry=[...qe,...Ke.reverse(),qe[0]],Ve.joinNormals=[...je,...je.reverse(),je.at(-1)];const tt=Ve.geometry.length-1;for(let mt=0;mt<tt/2;mt++)if(mt+1<tt/2){let bt=mt,Ft=mt+1,Rt=tt-1-mt,Wt=tt-2-mt;bt=bt===0?tt-1:bt-1,Ft=Ft===0?tt-1:Ft-1,Rt=Rt===0?tt-1:Rt-1,Wt=Wt===0?tt-1:Wt-1,Ve.indices.push(Rt),Ve.indices.push(Ft),Ve.indices.push(bt),Ve.indices.push(Rt),Ve.indices.push(Wt),Ve.indices.push(Ft)}return Ve}(l[0]),l=[q.geometry]}const ee=(Se,we)=>Se<(we.length-1)/2||Se===we.length-1,te=this.wallMode?[l]:Bn(l,500);for(let Se=te.length-1;Se>=0;Se--){const we=te[Se];(we.length===0||kG(we[0]))&&te.splice(Se,1)}let le;if(R)le=xR(te,I,p);else{le=[];for(const Se of te)le.push({polygon:Se,bounds:I})}const xe=O?this.edgeRadius:0,de=xe>0&&this.zoom<17,ve=(Se,we)=>{if(Se.length===0)return!1;const Fe=Se.at(-1);return we.x===Fe.x&&we.y===Fe.y};for(const{polygon:Se,bounds:we}of le){let Fe=0,Ve=0;for(const at of Se)O&&!at[0].equals(at.at(-1))&&at.push(at[0]),Ve+=O?at.length-1:at.length;const qe=this.segments.prepareSegment((O?5:4)*Ve,this.layoutVertexArray,this.indexArray);V.footprintSegIdx<0&&(V.footprintSegIdx=this.footprintSegments.length),V.polygonSegIdx<0&&(V.polygonSegIdx=this.polygonSegments.length);const Ke={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},je=new hR;if(je.vertexOffset=this.footprintVertices.length,je.indexOffset=3*this.footprintIndices.length,je.ringIndices=[],O){const at=[],Ge=[];Fe=qe.vertexLength;for(let Ye=0;Ye<Se.length;Ye++){const rt=Se[Ye];rt.length&&Ye!==0&&Ge.push(at.length/2);const lt=[];let yt,tt;yt=rt[1].sub(rt[0])._perp()._unit(),je.ringIndices.push(rt.length-1);for(let mt=1;mt<rt.length;mt++){const bt=rt[mt],Ft=rt[mt===rt.length-1?1:mt+1],Rt=bt.clone();if(xe){tt=Ft.sub(bt)._perp()._unit();const Wt=yt.add(tt)._unit(),ln=xe*Math.min(4,1/(yt.x*Wt.x+yt.y*Wt.y));Rt.x+=ln*Wt.x,Rt.y+=ln*Wt.y,Rt.x=Math.round(Rt.x),Rt.y=Math.round(Rt.y),yt=tt}if(!G||xe!==0&&!de||ve(lt,Rt)||lt.push(Rt),s0(this.layoutVertexArray,Rt.x,Rt.y,0,0,1,1,0),this.wallMode){const Wt=ee(mt,rt);a0(this.wallVertexArray,q.joinNormals[mt],!Wt)}qe.vertexLength++,this.footprintVertices.emplaceBack(bt.x,bt.y),at.push(bt.x,bt.y),R&&l0(this.layoutVertexExtArray,M.projectTilePoint(Rt.x,Rt.y,p),M.upVector(p,Rt.x,Rt.y))}G&&(xe===0||de)&&(lt.length!==0&&ve(lt,lt[0])&<.pop(),this.groundEffect.addData(lt,we,C))}const $e=this.wallMode?q.indices:Nu(at,Ge);for(let Ye=0;Ye<$e.length;Ye+=3)this.footprintIndices.emplaceBack(je.vertexOffset+$e[Ye+0],je.vertexOffset+$e[Ye+1],je.vertexOffset+$e[Ye+2]),this.indexArray.emplaceBack(Fe+$e[Ye],Fe+$e[Ye+2],Fe+$e[Ye+1]),qe.primitiveLength++;je.indexCount+=$e.length,je.vertexCount+=this.footprintVertices.length-je.vertexOffset}for(let at=0;at<Se.length;at++){const Ge=Se[at];N.startRing(V,Ge[0]);let $e=Ge.length>4&&_R(Ge[Ge.length-2],Ge[0],Ge[1]),Ye=xe?EG(Ge[Ge.length-2],Ge[0],Ge[1],xe):0;const rt=[];let lt,yt,tt;yt=Ge[1].sub(Ge[0])._perp()._unit();let mt=!0;for(let bt=1,Ft=0;bt<Ge.length;bt++){let Rt=Ge[bt-1],Wt=Ge[bt];const ln=Ge[bt===Ge.length-1?1:bt+1];if(N.appendEdge(V,Wt,Rt),rk(Wt,Rt,we)){xe&&(yt=ln.sub(Wt)._perp()._unit(),mt=!mt);continue}const en=Wt.sub(Rt)._perp(),gn=en.x/(Math.abs(en.x)+Math.abs(en.y)),cn=en.y>0?1:0,Gn=Rt.dist(Wt);if(Ft+Gn>32768&&(Ft=0),xe){tt=ln.sub(Wt)._perp()._unit();let Er=mR(Rt,Wt,ln,pR(yt,tt),xe);isNaN(Er)&&(Er=0);const wr=Wt.sub(Rt)._unit();Rt=Rt.add(wr.mult(Ye))._round(),Wt=Wt.add(wr.mult(-Er))._round(),Ye=Er,yt=tt,G&&this.zoom>=17&&(ve(rt,Rt)||rt.push(Rt),ve(rt,Wt)||rt.push(Wt))}const Yt=qe.vertexLength,gr=Ge.length>4&&_R(Rt,Wt,ln);let ar=yR(Ft,$e,mt);if(s0(this.layoutVertexArray,Rt.x,Rt.y,gn,cn,0,0,ar),s0(this.layoutVertexArray,Rt.x,Rt.y,gn,cn,0,1,ar),this.wallMode){const Er=ee(bt-1,Ge),wr=q.joinNormals[bt-1];a0(this.wallVertexArray,wr,Er),a0(this.wallVertexArray,wr,Er)}if(Ft+=Gn,ar=yR(Ft,gr,!mt),$e=gr,s0(this.layoutVertexArray,Wt.x,Wt.y,gn,cn,0,0,ar),s0(this.layoutVertexArray,Wt.x,Wt.y,gn,cn,0,1,ar),this.wallMode){const Er=ee(bt,Ge),wr=q.joinNormals[bt];a0(this.wallVertexArray,wr,Er),a0(this.wallVertexArray,wr,Er)}if(qe.vertexLength+=4,this.indexArray.emplaceBack(Yt+0,Yt+1,Yt+2),this.indexArray.emplaceBack(Yt+1,Yt+3,Yt+2),qe.primitiveLength+=2,xe){const Er=Fe+(bt===1?Ge.length-2:bt-2),wr=bt===1?Fe:Er+1;if(this.indexArray.emplaceBack(Yt+1,Er,Yt+3),this.indexArray.emplaceBack(Er,wr,Yt+3),qe.primitiveLength+=2,lt===void 0&&(lt=Yt),!rk(ln,Ge[bt],we)){const li=bt===Ge.length-1?lt:qe.vertexLength;this.indexArray.emplaceBack(Yt+2,Yt+3,li),this.indexArray.emplaceBack(Yt+3,li+1,li),this.indexArray.emplaceBack(Yt+3,wr,li+1),qe.primitiveLength+=3}mt=!mt}if(R){const Er=this.layoutVertexExtArray,wr=M.projectTilePoint(Rt.x,Rt.y,p),li=M.projectTilePoint(Wt.x,Wt.y,p),Po=M.upVector(p,Rt.x,Rt.y),Sr=M.upVector(p,Wt.x,Wt.y);l0(Er,wr,Po),l0(Er,wr,Po),l0(Er,li,Sr),l0(Er,li,Sr)}}O&&(Fe+=Ge.length-1),G&&xe&&this.zoom>=17&&(rt.length!==0&&ve(rt,rt[0])&&rt.pop(),this.groundEffect.addData(rt,we,C,xe>0))}this.footprintSegments.push(je),Ke.triangleCount=this.indexArray.length-Ke.triangleArrayOffset,this.polygonSegments.push(Ke),++V.footprintSegLen,++V.polygonSegLen}if(V.vertexCount=this.layoutVertexArray.length-V.vertexArrayOffset,V.groundVertexCount=this.groundEffect.vertexArray.length-V.groundVertexArrayOffset,V.vertexCount!==0){if(V.centroidXY=N.borders?ew:this.encodeCentroid(N,V),i.properties&&Object.hasOwn(i.properties,"building_id")){const Se=V.buildingId;let we=this.buildingGroups.get(Se);we||(we={accX:0,accY:0,accCount:0,mergedMin:new et(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new et(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(Se,we)),we.accX+=N.acc.x,we.accY+=N.acc.y,we.accCount+=N.accCount,we.mergedMin.x=Math.min(we.mergedMin.x,V.min.x),we.mergedMin.y=Math.min(we.mergedMin.y,V.min.y),we.mergedMax.x=Math.max(we.mergedMax.x,V.max.x),we.mergedMax.y=Math.max(we.mergedMax.y,V.max.y),we.partIndices.push(this.centroidData.length)}if(this.centroidData.push(V),N.borders){this.featuresOnBorder.push(N);const Se=this.featuresOnBorder.length-1;for(let we=0;we<N.borders.length;we++)N.borders[we][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[we].push(Se)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,d,m,y,p,S,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,d,m,y,p,S,this.worldview),this.maxHeight=Math.max(this.maxHeight,K)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(e.partIndices.length===0)continue;const i=new tk;i.acc=new et(e.accX,e.accY),i.accCount=e.accCount;const l=new iw;l.min=e.mergedMin,l.max=e.mergedMax;const d=this.encodeCentroid(i,l),p=i.centroid();for(const m of e.partIndices){const y=this.centroidData.get(m);y.centroidXY.x===ew.x&&y.centroidXY.y===ew.y||(y.centroidXY=d),y.min=e.mergedMin,y.max=e.mergedMax,y.groupCentroidPos=p}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,l)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[l].borders[e][0])}splitToSubtiles(){const e=[];for(let y=0;y<this.centroidData.length;y++){const b=this.centroidData.get(y),S=+(b.min.y+b.max.y>St),C=2*S+(+(b.min.x+b.max.x>St)^S);for(let I=0;I<b.polygonSegLen;I++){const M=b.polygonSegIdx+I;e.push({centroidIdx:y,subtile:C,polygonSegmentIdx:M,triangleSegmentIdx:this.polygonSegments[M].triangleSegIdx})}}const i=new _i;e.sort((y,b)=>y.triangleSegmentIdx===b.triangleSegmentIdx?y.subtile-b.subtile:y.triangleSegmentIdx-b.triangleSegmentIdx);let l=0,d=0,p=0;for(const y of e){if(y.triangleSegmentIdx!==l)break;p++}const m=e.length;for(;d!==e.length;){l=e[d].triangleSegmentIdx;let y=0,b=d,S=d;for(let C=b;C<p&&e[C].subtile===y;C++)S++;for(;b!==p;){const C=e[b];y=C.subtile;const I=this.centroidData.get(C.centroidIdx).min.clone(),M=this.centroidData.get(C.centroidIdx).max.clone(),R={vertexOffset:this.segments.segments[l].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[l].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let O=b;O<S;O++){const N=e[O],V=this.polygonSegments[N.polygonSegmentIdx],G=this.centroidData.get(N.centroidIdx).min,K=this.centroidData.get(N.centroidIdx).max,q=this.indexArray.uint16;for(let ee=V.triangleArrayOffset;ee<V.triangleArrayOffset+V.triangleCount;ee++)i.emplaceBack(q[3*ee],q[3*ee+1],q[3*ee+2]);R.primitiveLength+=V.triangleCount,I.x=Math.min(I.x,G.x),I.y=Math.min(I.y,G.y),M.x=Math.max(M.x,K.x),M.y=Math.max(M.y,K.y)}R.primitiveLength>0&&this.triangleSubSegments.push({segment:R,min:I,max:M}),b=S;for(let O=b;O<p&&e[O].subtile===e[b].subtile;O++)S++}d=p;for(let C=d;C<m&&e[C].triangleSegmentIdx===e[d].triangleSegmentIdx;C++)p++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,l){const d=new pr;if(this.wallMode){for(const N of this.triangleSubSegments)d.segments.push(N.segment);return d}let p=0,m=0;const y=1<<e.canonical.z;if(i){const N=i.getMinMaxForTile(e);N&&(p=N.min,m=N.max)}m+=this.maxHeight;const b=e.toUnwrapped();let S;const C=[b.canonical.x/y+b.wrap,b.canonical.y/y],I=[(b.canonical.x+1)/y+b.wrap,(b.canonical.y+1)/y],M=(N,V,G)=>[Jt(N[0],V[0],G[0]),Jt(N[1],V[1],G[1])],R=[],O=[];for(const N of this.triangleSubSegments){R[0]=N.min.x/St,R[1]=N.min.y/St,O[0]=N.max.x/St,O[1]=N.max.y/St;const V=M(C,I,R),G=M(C,I,O);if(new Qr([V[0],V[1],p],[G[0],G[1],m]).intersectsPrecise(l)===0){S&&(d.segments.push(S),S=void 0);continue}const K=N.segment;S&&S.vertexOffset!==K.vertexOffset&&(d.segments.push(S),S=void 0),S?(S.vertexLength+=K.vertexLength,S.primitiveLength+=K.primitiveLength):S={vertexOffset:K.vertexOffset,primitiveLength:K.primitiveLength,vertexLength:K.vertexLength,primitiveOffset:K.primitiveOffset,sortKey:void 0,vaos:{}}}return S&&d.segments.push(S),d}encodeCentroid(e,i){const l=e.centroid(),d=i.span(),p=Math.min(7,Math.round(d.x*this.tileToMeter/10)),m=Math.min(6,Math.round(d.y*this.tileToMeter/10));return new et(Ie(l.x,1,8191)<<3|p,Ie(l.y,1,8191)<<3|m)}encodeBorderCentroid(e){if(!e.borders)return new et(0,0);const i=e.borders,l=Number.MAX_VALUE;if(i[0][0]!==l||i[1][0]!==l){const d=i[0][0]!==l?0:1;return new et(6|(i[0][0]!==l?0:65528),(i[d][0]+i[d][1])/2<<3|6)}{const d=i[2][0]!==l?2:3;return new et((i[d][0]+i[d][1])/2<<3|6,6|(i[2][0]!==l?0:65528))}}showCentroid(e){const i=this.centroidData.get(e.centroidDataIndex);if(i.flags&=Ju,i.groupCentroidPos.x!==0||i.groupCentroidPos.y!==0){const l=i.span(),d=Math.min(7,Math.round(l.x*this.tileToMeter/10)),p=Math.min(6,Math.round(l.y*this.tileToMeter/10));i.centroidXY=new et(Ie(i.groupCentroidPos.x,1,8191)<<3|d,Ie(i.groupCentroidPos.y,1,8191)<<3|p)}else i.centroidXY=new et(0,0);this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,l=e.vertexCount+e.vertexArrayOffset,d=-1073741824&e.flags?ew:e.centroidXY,p=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==d.y||p!==d.x){for(let m=i;m<l;++m)this.centroidVertexArray.emplace(m,d.x,d.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,l){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const d=i.getReplacementRegionsForTile(e.toUnwrapped());if(O1(this.activeReplacements,d))return;if(this.activeReplacements=d,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const m of this.centroidData)m.flags&=1073741823;const p=[];for(const m of this.activeReplacements){if(m.order<l)continue;const y=Math.max(1,Math.pow(2,m.footprintTileId.canonical.z-e.canonical.z));if(m.footprint.buildingIds)for(const b of this.centroidData)b.flags&Ju||b.flags&tw||m.min.x>b.max.x||b.min.x>m.max.x||m.min.y>b.max.y||b.min.y>m.max.y||m.footprint.buildingIds.has(b.buildingId)&&(b.flags|=m.clipMask!==J1.None?-1073741824:Ju);else for(const b of this.centroidData)if(!(b.flags&Ju||b.flags&tw||m.min.x>b.max.x||b.min.x>m.max.x||m.min.y>b.max.y||b.min.y>m.max.y))for(let S=0;S<b.footprintSegLen;S++){const C=this.footprintSegments.get(b.footprintSegIdx+S);if(p.length=0,AG(this.footprintVertices,C.vertexOffset,C.vertexCount,m.footprintTileId.canonical,e.canonical,p),IE(m.footprint,p,this.footprintIndices.uint16,C.indexOffset,C.indexCount,-C.vertexOffset,-y)){b.flags|=m.clipMask!==J1.None?-1073741824:Ju;break}}}for(const m of this.centroidData)this.writeCentroidToBuffer(m);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,l){let d=!1;for(let p=0;p<l.footprintSegLen;p++){const m=this.footprintSegments.get(l.footprintSegIdx+p);let y=0;for(const b of m.ringIndices){for(let S=y,C=b+y-1;S<b+y;C=S++){const I=this.footprintVertices.int16[2*(S+m.vertexOffset)+0],M=this.footprintVertices.int16[2*(S+m.vertexOffset)+1],R=this.footprintVertices.int16[2*(C+m.vertexOffset)+1];M>i!=R>i&&e<(this.footprintVertices.int16[2*(C+m.vertexOffset)+0]-I)*(i-M)/(R-M)+I&&(d=!d)}y=b}}return d}getHeightAtTileCoord(e,i){let l=Number.NEGATIVE_INFINITY,d=!0;const p=4*(e+St)*St+(i+St);if(Object.hasOwn(this.partLookup,p)){const b=this.partLookup[p];return b?{height:b.height,hidden:!!(b.flags&Ju)}:void 0}const m=this.centroidData.buffer,y=this.centroidData.length;for(let b=0;b<y;b++){const S=15*b;if(e>m[S+4]||m[S+2]>e||i>m[S+5]||m[S+3]>i)continue;const C=m[S+13];if(C<=l)continue;const I=this.centroidData.get(b);this.footprintContainsPoint(e,i,I)&&(l=C,this.partLookup[p]=I,d=!!(I.flags&Ju))}if(l!==Number.NEGATIVE_INFINITY)return{height:l,hidden:d};this.partLookup[p]=void 0}}function pR(o,e){const i=o.add(e)._unit();return o.x*i.x+o.y*i.y}function EG(o,e,i,l){const d=e.sub(o)._perp()._unit(),p=i.sub(e)._perp()._unit();return mR(o,e,i,pR(d,p),l)}function mR(o,e,i,l,d){const p=Math.sqrt(1-l*l);return Math.min(o.dist(e)/3,e.dist(i)/3,d*p/l)}function rk(o,e,i){return o.x<i[0].x&&e.x<i[0].x||o.x>i[1].x&&e.x>i[1].x||o.y<i[0].y&&e.y<i[0].y||o.y>i[1].y&&e.y>i[1].y}function gR(o,e){return o.x<e[0].x||o.x>e[1].x||o.y<e[0].y||o.y>e[1].y}function kG(o){return o.every(e=>e.x<=0)||o.every(e=>e.x>=St)||o.every(e=>e.y<=0)||o.every(e=>e.y>=St)}function _R(o,e,i){if(o.x<0||o.x>=St||e.x<0||e.x>=St||i.x<0||i.x>=St)return!1;const l=i.sub(e),d=l.perp(),p=o.sub(e);return(l.x*p.x+l.y*p.y)/Math.sqrt((l.x*l.x+l.y*l.y)*(p.x*p.x+p.y*p.y))>-.866&&d.x*p.x+d.y*p.y<0}function yR(o,e,i){const l=e?2|o:-3&o;return i?1|l:-2&l}function vR(){const o=Math.PI/32,e=Math.tan(o),i=Kd;return i*Math.sqrt(1+2*e*e)-i}function xR(o,e,i){const l=1<<i.z,d=cs(i.x/l),p=cs((i.x+1)/l),m=Si(i.y/l),y=Si((i.y+1)/l);return function(b,S,C,I,M=0,R){const O=[];if(!b.length||!C||!I)return O;const N=(le,xe)=>{for(const de of le)O.push({polygon:de,bounds:xe})},V=Math.ceil(Math.log2(C)),G=Math.ceil(Math.log2(I)),K=V-G,q=[];for(let le=0;le<Math.abs(K);le++)q.push(K>0?0:1);for(let le=0;le<Math.min(V,G);le++)q.push(0),q.push(1);let ee=b;if(ee=Q1(ee,S[0].y-M,S[1].y+M,1),ee=Q1(ee,S[0].x-M,S[1].x+M,0),!ee.length)return O;const te=[];for(q.length?te.push({polygons:ee,bounds:S,depth:0}):N(ee,S);te.length;){const le=te.pop(),xe=le.depth,de=q[xe],ve=le.bounds[0],Se=le.bounds[1],we=de===0?ve.x:ve.y,Fe=de===0?Se.x:Se.y,Ve=R?R(de,we,Fe):.5*(we+Fe),qe=Q1(le.polygons,we-M,Ve+M,de),Ke=Q1(le.polygons,Ve-M,Fe+M,de);if(qe.length){const je=[ve,new et(de===0?Ve:Se.x,de===1?Ve:Se.y)];q.length>xe+1?te.push({polygons:qe,bounds:je,depth:xe+1}):N(qe,je)}if(Ke.length){const je=[new et(de===0?Ve:ve.x,de===1?Ve:ve.y),Se];q.length>xe+1?te.push({polygons:Ke,bounds:je,depth:xe+1}):N(Ke,je)}}return O}(o,e,Math.ceil((p-d)/11.25),Math.ceil((m-y)/11.25),1,(b,S,C)=>{if(b===0)return .5*(S+C);{const I=Si((i.y+S/St)/l);return(ba(.5*(Si((i.y+C/St)/l)+I))*l-i.y)*St}})}function AG(o,e,i,l,d,p){const m=Math.pow(2,l.z-d.z);for(let y=0;y<i;y++){let b=o.int16[2*(y+e)+0],S=o.int16[2*(y+e)+1];b=(b+d.x*St)*m-l.x*St,S=(S+d.y*St)*m-l.y*St,p.push(new et(b,S))}}Mt(sw,"FillExtrusionBucket",{omit:["layers","features"]}),Mt(iw,"PartData"),Mt(ow,"PartDataArray"),Mt(rw,"FootprintSegmentArray"),Mt(tk,"BorderCentroidData"),Mt(nk,"GroundEffect");const ik=4096;class CG{constructor(e){this.module=e,this.memoryStack=this.module.malloc(ik),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>ik?-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>ik?-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,l){this.module.setFauxFacadeOptions(e?1:0,i?1:0,l)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const y of e){const b=this.createIntArray(y.ringIndices),S=this.createFloatArray(y.coordinates);if(b===-1||S===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(y.id,y.sourceId,y.minHeight,y.height,y.roofType,S,b,y.ringIndices.length-1)}for(const y of i){let b;b=y.entrances?JSON.parse(y.entrances):[];const S=this.createFloatArray(b),C=this.createFloatArray(y.coordinates);if(S===-1||C===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(y.sourceId,y.crossPerc,y.distanceToRoad,S,b.length,C,y.coordinates.length)}if(!this.module.generateMesh()){const y=this.module.getLastError();return this.readStringBuffer(y)}const l=this.module.getMeshCount(),d=new Array(l);for(let y=0;y<l;y++){const b=this.module.getPositionsPtr(y),S=this.module.getPositionsLength(y),C=new Float32Array(this.module.heapF32.buffer,b,S),I=this.module.getNormalsPtr(y),M=this.module.getNormalsLength(y),R=new Float32Array(this.module.heapF32.buffer,I,M),O=this.module.getAOPtr(y),N=this.module.getAOLength(y),V=new Float32Array(this.module.heapF32.buffer,O,N),G=this.module.getUVPtr(y),K=this.module.getUVLength(y),q=new Float32Array(this.module.heapF32.buffer,G,K),ee=this.module.getFauxFacadePtr(y),te=this.module.getFauxFacadeLength(y),le=new Uint8Array(this.module.heapU8.buffer,ee,te),xe=this.module.getIndicesPtr(y),de=this.module.getIndicesLength(y),ve=new Int16Array(this.module.heap16.buffer,xe,de),Se=this.module.getBuildingPart(y);d[y]={positions:C,normals:R,ao:V,uv:q,isFauxFacade:le,indices:ve,buildingPart:Se}}const p=this.module.getRingCount(),m=[];for(let y=0;y<p;y++){const b=this.module.getRingPtr(y),S=this.module.getRingLength(y),C=new Float32Array(this.module.heapF32.buffer,b,S);m.push(C)}return{meshes:d,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:m}}}const bR=Yc.types,aw=32767;function IG(o,e){const i=St+e;for(const l of o)for(const d of l)if(d.x<-e||d.x>i||d.y<-e||d.y>i)return!1;return!0}function MG(o){switch(o){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: ${o}`)}}let wR,SR,bg=null,TR=null,Ja=null;class ok{constructor(){this.layoutVertexArray=new Ca,this.layoutAttenuationArray=new nc,this.layoutColorArray=new ta,this.indexArray=new _i,this.indexArrayForConflation=new _i,this.segmentsBucket=new pr}}class sk{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new pr,this.entranceBloom=new ok;const i=66560;this.layoutVertexArray=new Ca,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new Hc,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new Hc,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new ta,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new Qf,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new rg,this.layoutAOArray.reserve(i),this.indexArray=new _i,this.indexArray.reserve(66560),this.indexArrayForConflation=new _i,this.segmentsBucket=new pr,this.entranceBloom=new ok,e&&(this.layoutFacadePaintArray=new ta,this.layoutFacadeDataArray=new Jd,this.layoutFacadeVerticalRangeArray=new ta)}reserve(e,i,l){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),l&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class ER{constructor(e){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Wu,this.footprintsIndices=new Cl,this.footprintsMin=new et(1/0,1/0),this.footprintsMax=new et(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new sk(!1),this.buildingWithFacade=new sk(!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 Ya(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 nk(e),this.groundEffect.groundRadiusArray=new Xa,this.hasAppearances=null}updateFootprints(e,i){const l=new W1([],[],1),d={vertices:[],indices:new Uint32Array(0),grid:l,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:d,id:e})}updateAppearances(e,i,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){if(!Ja)return;const p=Qs(l);this.tileToMeter=p,this.brightness=i.brightness,Ja.setStyle({normalScale:[1,-1,p],tileToMeters:p}),Ja.setAOOptions(!1,.3),Ja.setMetricOptions(!1,16),Ja.setStructuralOptions(!0),Ja.setFacadeClassifierOptions(3);const m=new Map,y=new Map;let b=0;for(const{feature:V}of e){if(bR[V.type]!=="LineString"){m.set(V.id,V.properties.source_id);continue}const G=this.layers[0]._featureFilter.needGeometry;if(G&&!this.layers[0]._featureFilter.filter(new Yn(this.zoom),V,l))continue;const K=Ls(V,G);if(!G&&!this.layers[0]._featureFilter.filter(new Yn(this.zoom),K,l))continue;const q=G?K.geometry:Js(V,l,d),ee=[];for(const de of q)for(const ve of de)ee.push(ve.x),ee.push(ve.y);const te={coordinates:ee,crossPerc:V.properties.cross_perc,distanceToRoad:V.properties.distance_to_road,entrances:V.properties.entrances,sourceId:0},le=V.properties.source_id;let xe=y.get(le);xe||(xe=[],y.set(le,xe)),xe.push(te),++b}this.maxHeight=0;const S=new Array,C=new Set,I=V=>{V!=null&&C.add(V)},M=(V,G)=>{V!=null&&S.push({buildingId:V,footprintIndex:G})},R=64*(e.length-b),O=R/2;this.buildingWithFacade.reserve(R,O,!0),this.buildingWithoutFacade.reserve(2*R,2*O,!1),this.footprintsIndices.reserve(16*(e.length-b)),this.footprintsVertices.reserve(8*(e.length-b));for(const{feature:V,id:G,index:K,sourceLayerIndex:q}of e){if(bR[V.type]==="LineString")continue;const ee=this.layers[0]._featureFilter.needGeometry;if(ee&&!this.layers[0]._featureFilter.filter(new Yn(this.zoom),V,l))continue;let te=null;if(V.properties&&Object.hasOwn(V.properties,"building_id")&&(te=Number(V.properties.building_id),C.has(te)))continue;const le=Ls(V,ee);if(!ee&&!this.layers[0]._featureFilter.filter(new Yn(this.zoom),le,l))continue;const xe=ee?le.geometry:Js(V,l,d),de=Bn(xe,500);let ve=!1;for(const vn of de)if(vn.length!==1){ve=!0;break}if(ve){I(te);continue}if(!IG(xe,163)){I(te);continue}const Se=this.layers[0],we=MG(Se.layout.get("building-roof-shape").evaluate(V,{},l)),Fe=Se.layout.get("building-base").evaluate(V,{},l),Ve=Se.layout.get("building-height").evaluate(V,{},l),qe=Se.layout.get("building-flood-light-ground-radius").evaluate(V,{},l),Ke=Se.paint.get("building-ambient-occlusion-intensity"),je=qe/this.tileToMeter;V.properties["building-part"]="roof";const at=Se.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),Ge=Se.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);V.properties["building-part"]="wall";const $e=Se.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),Ye=Se.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);V.properties["building-part"]="window";const rt=Se.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),lt=Se.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);V.properties["building-part"]="door";const yt=Se.paint.get("building-color").evaluate(V,{},this.canonical).toPremultipliedRenderColor(this.lut),tt=Se.paint.get("building-emissive-strength").evaluate(V,{},this.canonical);let mt=Se.layout.get("building-flood-light-wall-radius").evaluate(V,{},l);mt=Ie(mt,0,2048);const bt=mt/2048*aw,Ft=m.get(G),Rt=y.get(Ft)||[],Wt=Rt.length!==0&&Se.layout.get("building-facade").evaluate(V,{},l);Ja.setFacadeOptions(4,!0),Ja.setFauxFacadeOptions(Wt,!1,1);let ln=0,en=0,gn=0,cn=0,Gn=0,Yt=0,gr=0,ar=0,Er=0,wr=0,li=0;if(Wt){let vn=Math.round(Se.layout.get("building-facade-floors").evaluate(V,{},l));if(Fe===0){vn=Math.max(1,vn-(Rt.length>0?1:0));let Kr=4;if(Ve>100){const Ai=[10,13,15];Kr=Ai[V.id?V.id%Ai.length:0]}else Ve<=10&&(Kr=3);Ja.setFacadeOptions(Kr,!0),Gn=(Ve<15?1.3:1.61803)*Kr/p}else Gn=Fe/p;Yt=Ve/p,Gn=Math.min(Gn,Yt),gn=Se.layout.get("building-facade-unit-width").evaluate(V,{},l)/p,cn=(Yt-Gn)/vn,Ja.setFauxFacadeOptions(!0,!0,gn);const Di=Se.layout.get("building-facade-window").evaluate(V,{},l);ln=Di[0],en=Di[1],gr=Math.floor(65535*Math.min(1,Gn/St)),ar=Math.floor(65535*Math.min(1,Yt/St)),Er=Math.floor(255*ln)<<8|Math.floor(255*en),wr=Math.floor(65535*Math.min(1,gn/St)),li=Math.floor(65535*Math.min(1,cn/St))}const Po=Array(de.length),Sr={x:1/0,y:1/0},kr={x:-1/0,y:-1/0},Mi={x:0,y:0};let uo=0;for(let vn=0;vn<de.length;vn++){const Di=de[vn];if(Di.length>0){const Kr=[],Ai=Array(Di.length+1);Ai[0]=0;for(let la=0;la<Di.length;la++){const ca=Di[la];for(let Ia=0;Ia<ca.length;Ia++){const Ma=ca[ca.length-Ia-1];Sr.x=Math.min(Sr.x,Ma.x),Sr.y=Math.min(Sr.y,Ma.y),kr.x=Math.max(kr.x,Ma.x),kr.y=Math.max(kr.y,Ma.y),Mi.x+=Ma.x,Mi.y+=Ma.y,uo++,Kr.push(Ma.x),Kr.push(Ma.y)}Ai[la+1]=Kr.length}Po[vn]={id:V.id?V.id:0,height:Ve,minHeight:Fe,sourceId:0,roofType:we,coordinates:Kr,ringIndices:Ai}}}Mi.x/=uo||1,Mi.y/=uo||1;const ki=Ja.generateMesh(Po,Rt);if(typeof ki=="string"){Cn(`Unable to generate building ${V.id}: ${ki}`),I(te);continue}if(ki.meshes.length===0||ki.modifiedPolygonRings.length===0){I(te);continue}const yn=Wt?this.buildingWithFacade:this.buildingWithoutFacade;let Vo=0;for(const vn of ki.meshes)Vo+=vn.positions.length/3;const jo=yn.segmentsBucket.prepareSegment(Vo,yn.layoutVertexArray,yn.indexArray),Do=[];let qi=null,Zi=0,Ro=-1;const Pi=yn.layoutVertexArray.length,Pr=Pi+Vo;yn.layoutVertexArray.resize(Pr),yn.layoutCentroidArray.resize(Pr),yn.layoutNormalArray.resize(Pr),yn.layoutAOArray.resize(Pr),yn.layoutColorArray.resize(Pr),yn.layoutFloodLightDataArray.resize(Pr),Wt&&(yn.layoutFacadePaintArray.resize(Pr),yn.layoutFacadeDataArray.resize(Pr),yn.layoutFacadeVerticalRangeArray.resize(Pr));const ho=yn.indexArray.length;let vp=0,io=Pi;for(const vn of ki.meshes){let Di,Kr;if(vn.buildingPart===1)Di=at,Kr=Ge;else if(vn.buildingPart===0)Di=$e,Kr=Ye;else if(vn.buildingPart===2)Di=rt,Kr=lt;else{if(vn.buildingPart!==3)continue;Di=yt,Kr=tt}if(Kr=Ie(Kr,0,1),vn.buildingPart===3){const Fi=new Array;for(let Yo=0;Yo<vn.positions.length;Yo+=12){const ou=vn.positions[Yo+0],cc=vn.positions[Yo+1],tl=vn.positions[Yo+3],Cg=vn.positions[Yo+4],Ew=vn.positions[Yo+2],Ns=vn.positions[Yo+8]-Ew,nl=1,rl=tl-ou,uc=Cg-cc,v0=Math.hypot(rl,uc);Fi.push({pos:[ou+.5*rl,cc+.5*uc,Ew],normal:[uc/v0,-rl/v0,0],width:v0,height:Ns,depth:nl,points:[ou,cc,tl,Cg]})}const yi=yn.entranceBloom.segmentsBucket.prepareSegment(10*Fi.length,yn.entranceBloom.layoutVertexArray,yn.entranceBloom.indexArray),oo=yn.entranceBloom.layoutVertexArray.length;Zi=yn.entranceBloom.indexArray.length,lR(Fi,.5/this.tileToMeter,yn.entranceBloom.indexArray,yn.entranceBloom.layoutVertexArray,yn.entranceBloom.layoutAttenuationArray);const ps=yn.entranceBloom.layoutVertexArray.length-oo;Ro=yn.entranceBloom.indexArray.length-Zi;for(let Yo=0;Yo<ps;Yo++)yn.entranceBloom.layoutColorArray.emplaceBack(255*yt.r<<8|255*yt.g,255*yt.b<<8|51*tt);yi.vertexLength+=ps,yi.primitiveLength+=Ro,qi={part:vn.buildingPart,vertexOffset:oo,vertexLength:ps}}yn.layoutVertexArray.float32.set(vn.positions,3*io);const Ai=vn.positions.length/3;for(let Fi=0;Fi<Ai;++Fi){const yi=3*Fi;vp=Math.max(vp,vn.positions[yi+2]);const oo=vn.normals[yi+1]*aw,ps=vn.normals[yi+2]*aw,Yo=3*(io+Fi);yn.layoutNormalArray.int16[Yo]=vn.normals[yi]*aw,yn.layoutNormalArray.int16[Yo+1]=oo,yn.layoutNormalArray.int16[Yo+2]=ps;const ou=vn.ao[Fi];yn.layoutAOArray.uint8[io+Fi]=255*ou;const cc=1+(ou-1)*Ke,tl=255*Di.b*cc<<8|255*Kr;yn.layoutColorArray.uint16[2*(io+Fi)]=255*Di.r*cc<<8|255*Di.g*cc,yn.layoutColorArray.uint16[2*(io+Fi)+1]=tl}const la=Math.min(8191,Math.max(0,Math.floor(Mi.x))),ca=Math.min(8191,Math.max(0,Math.floor(Mi.y))),Ia=Math.floor(Ve),Ma=20,Sw=4*la+Math.min(3,Math.round((kr.x-Sr.x)*this.tileToMeter/Ma)),Tw=4*ca+Math.min(3,Math.round((kr.y-Sr.y)*this.tileToMeter/Ma));for(let Fi=0;Fi<Ai;++Fi){const yi=3*(io+Fi);yn.layoutCentroidArray.int16[yi]=Sw,yn.layoutCentroidArray.int16[yi+1]=Tw,yn.layoutCentroidArray.int16[yi+2]=Ia}if(yn.layoutFloodLightDataArray.int16.fill(vn.buildingPart===0?bt:0,io,io+Ai),Wt){const Fi=255*rt.r<<8|255*rt.g,yi=255*rt.b<<8|255*lt;for(let oo=0;oo<Ai;++oo){const ps=2*(io+oo);yn.layoutFacadePaintArray.uint16[ps]=Fi,yn.layoutFacadePaintArray.uint16[ps+1]=yi}for(let oo=0;oo<Ai;++oo)if(vn.isFauxFacade[oo]){const ps=Math.min(65535,Math.floor(vn.uv[2*oo]*ki.outerRingLength));yn.layoutFacadeDataArray.emplace(io+oo,1|ps,Er,wr,li),yn.layoutFacadeVerticalRangeArray.emplace(io+oo,gr,ar)}else yn.layoutFacadeDataArray.emplace(io+oo,0,0,0,0),yn.layoutFacadeVerticalRangeArray.emplace(io+oo,0,0)}const kg=jo.vertexLength,y0=vn.indices.length/3,Ag=yn.indexArray.length;yn.indexArray.resize(Ag+y0);for(let Fi=0;Fi<y0;++Fi){const yi=3*Fi,oo=3*Ag+yi;yn.indexArray.uint16[oo]=kg+vn.indices[yi],yn.indexArray.uint16[oo+1]=kg+vn.indices[yi+1],yn.indexArray.uint16[oo+2]=kg+vn.indices[yi+2]}vn.buildingPart!==1&&vn.buildingPart!==0&&vn.buildingPart!==2&&vn.buildingPart!==3||Do.push({part:vn.buildingPart,vertexOffset:io,vertexLength:vn.positions.length/3}),io+=Ai,jo.vertexLength+=Ai,jo.primitiveLength+=vn.indices.length/3}this.maxHeight=Math.max(this.maxHeight,vp);const aa=yn.indexArray.length-ho,ph=this.footprintsIndices.length,_0=this.footprintsVertices.length,bw=[],ed=new et(1/0,1/0),td=new et(-1/0,-1/0),ww=this.groundEffect.vertexArray.length;for(const vn of ki.modifiedPolygonRings){const Di=[],Kr=new et(1/0,1/0),Ai=new et(-1/0,-1/0);for(let la=0;la<vn.length;la+=2){const ca=vn.length-la-2;Kr.x=Math.min(Kr.x,vn[ca]),Kr.y=Math.min(Kr.y,vn[ca+1]),Ai.x=Math.max(Ai.x,vn[ca]),Ai.y=Math.max(Ai.y,vn[ca+1]);const Ia=new et(vn[ca],vn[ca+1]);Di.push(Ia),bw.push(Ia.x,Ia.y),this.footprintsVertices.emplaceBack(Ia.x,Ia.y)}ed.x=Math.min(ed.x,Kr.x),ed.y=Math.min(ed.y,Kr.y),td.x=Math.max(td.x,Ai.x),td.y=Math.max(td.y,Ai.y),this.groundEffect.addData(Di,[Kr,Ai],je)}const Eg=this.groundEffect.vertexArray.length-ww;this.groundEffect.groundRadiusArray.reserveForAdditional(Eg);for(let vn=0;vn<Eg;vn++)this.groundEffect.groundRadiusArray.emplaceBack(qe);(Sr.x<0||kr.x>St||Sr.y<0||kr.y>St)&&this.featuresOnBorder.push({featureId:V.id,footprintIndex:this.footprints.length});{const vn=Nu(bw,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+vn.length),this.footprintsIndices.uint16.set(vn,ph),this.buildingIds.add(te??V.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ed.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ed.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,td.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,td.y);const Di={footprintVertexOffset:_0,footprintVertexLength:this.footprintsVertices.length-_0,footprintIndexOffset:ph,footprintIndexLength:this.footprintsIndices.length-ph,min:ed,max:td,hiddenFlags:0,indicesOffset:ho,indicesLength:aa,bloomIndicesOffset:Zi,bloomIndicesLength:Ro,groundEffectVertexOffset:ww,groundEffectVertexLength:Eg,hasFauxFacade:Wt,height:vp,promoteId:G,feature:le,parts:Do,buildingBloom:qi},Kr=this.footprints.length;V.id!==void 0&&this.featureFootprintLookup.set(V.id,Kr),M(te,Kr),this.footprints.push(Di)}this.programConfigurations.populatePaintArrays(yn.layoutVertexArray.length,V,K,{},i.availableImages,l,i.brightness),this.groundEffect.addPaintPropertiesData(V,K,{},i.availableImages,l,i.brightness),i.featureIndex.insert(V,xe,K,q,this.index,Pi)}S.forEach(({buildingId:V,footprintIndex:G})=>{C.has(V)&&(this.footprints[G].hiddenFlags|=4)});const N=new Set;this.buildingIds.forEach((V,G,K)=>{C.has(V)||N.add(V)}),this.buildingIds=N,this.groundEffect.prepareBorderSegments()}update(e,i,l,d,p,m,y){this.programConfigurations.updatePaintArrays(e,i,p,l,d,m,y),this.groundEffect.update(e,i,p,l,d,m,y),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}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=l=>{l.layoutVertexBuffer=e.createVertexBuffer(l.layoutVertexArray,cR.members),l.layoutNormalBuffer=e.createVertexBuffer(l.layoutNormalArray,iG.members),l.layoutCentroidBuffer=e.createVertexBuffer(l.layoutCentroidArray,oG.members),l.layoutFloodLightDataBuffer=e.createVertexBuffer(l.layoutFloodLightDataArray,uG.members),l.layoutFacadeDataArray&&l.layoutFacadeDataArray.length&&(l.layoutFacadeDataBuffer=e.createVertexBuffer(l.layoutFacadeDataArray,aG.members)),l.layoutFacadeVerticalRangeArray&&l.layoutFacadeVerticalRangeArray.length&&(l.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(l.layoutFacadeVerticalRangeArray,lG.members)),l.entranceBloom.layoutVertexArray.length&&(l.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(l.entranceBloom.layoutVertexArray,cR.members),l.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(l.entranceBloom.layoutAttenuationArray,cG.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,l=!0){let d=!1;const p=l?i:0,m=0|(l?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const y of e){const b=this.footprints[y],S=b.hiddenFlags&m|p;b.hiddenFlags!==S&&(b.hiddenFlags=S,d=!0,this.groundEffect.updateHiddenByLandmarkRange(b.groundEffectVertexOffset,b.groundEffectVertexLength,b.hiddenFlags!==0))}return d&&(this.indexArrayForConflationUploaded=!1),d}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=d=>{d.indexArray.length!==0&&(d.indexArrayForConflation.resize(d.indexArray.length),d.indexArrayForConflation.uint16.set(d.indexArray.uint16),d.entranceBloom.indexArrayForConflation.resize(d.entranceBloom.indexArray.length),d.entranceBloom.indexArrayForConflation.uint16.set(d.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const d of this.footprints){const p=d.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,m=d.indicesOffset+d.indicesLength;if(d.hiddenFlags!==0){for(let b=d.indicesOffset;b<m;b++)p.indexArrayForConflation.uint16[3*b+0]=0,p.indexArrayForConflation.uint16[3*b+1]=0,p.indexArrayForConflation.uint16[3*b+2]=0;const y=d.bloomIndicesOffset+d.bloomIndicesLength;for(let b=d.bloomIndicesOffset;b<y;b++)p.entranceBloom.indexArrayForConflation.uint16[3*b+0]=0,p.entranceBloom.indexArrayForConflation.uint16[3*b+1]=0,p.entranceBloom.indexArrayForConflation.uint16[3*b+2]=0}}const l=d=>{d.indexArray.length!==0&&(d.indexBuffer?d.indexBuffer.updateData(d.indexArrayForConflation):d.indexBuffer=e.createIndexBuffer(d.indexArrayForConflation,!0),d.entranceBloom.indexBuffer?d.entranceBloom.indexBuffer.updateData(d.entranceBloom.indexArrayForConflation):d.entranceBloom.indexBuffer=e.createIndexBuffer(d.entranceBloom.indexArrayForConflation,!0))};l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=l=>{l.layoutColorBuffer?l.layoutColorBuffer.updateData(l.layoutColorArray):l.layoutColorBuffer=e.createVertexBuffer(l.layoutColorArray,uR.members,!0),l.layoutFacadePaintArray&&(l.layoutFacadePaintBuffer?l.layoutFacadePaintBuffer.updateData(l.layoutFacadePaintArray):l.layoutFacadePaintBuffer=e.createVertexBuffer(l.layoutFacadePaintArray,sG.members,!0)),l.entranceBloom.layoutColorBuffer?l.entranceBloom.layoutColorBuffer.updateData(l.entranceBloom.layoutColorArray):l.entranceBloom.layoutColorBuffer=e.createVertexBuffer(l.entranceBloom.layoutColorArray,uR.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const l=e.paint.get("building-ambient-occlusion-intensity");for(const d of this.footprints){if(4&d.hiddenFlags)continue;const p=i[d.promoteId],m=d.feature;m.properties["building-part"]="roof";const y=e.paint.get("building-color").evaluate(m,p,this.canonical).toPremultipliedRenderColor(this.lut),b=e.paint.get("building-emissive-strength").evaluate(m,p,this.canonical);m.properties["building-part"]="wall";const S=e.paint.get("building-color").evaluate(m,p,this.canonical).toPremultipliedRenderColor(this.lut),C=e.paint.get("building-emissive-strength").evaluate(m,p,this.canonical);m.properties["building-part"]="window";const I=e.paint.get("building-color").evaluate(m,p,this.canonical).toPremultipliedRenderColor(this.lut),M=e.paint.get("building-emissive-strength").evaluate(m,p,this.canonical);m.properties["building-part"]="door";const R=e.paint.get("building-color").evaluate(m,p,this.canonical).toPremultipliedRenderColor(this.lut),O=e.paint.get("building-emissive-strength").evaluate(m,p,this.canonical),N=d.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const G of d.parts){let K,q=y;G.part===1?(q=y,K=b):G.part===0?(q=S,K=C):G.part===2?(q=I,K=M):G.part===3&&(q=R,K=O),K=Ie(K,0,1);for(let ee=0;ee<G.vertexLength;ee++){const te=G.vertexOffset+ee,le=1+(N.layoutAOArray.uint8[te]/255-1)*l;N.layoutColorArray.emplace(te,q.r*le*255<<8|q.g*le*255,q.b*le*255<<8|255*K),d.hasFauxFacade&&N.layoutFacadePaintArray.emplace(te,255*I.r<<8|255*I.g,255*I.b<<8|255*M)}}const V=d.buildingBloom;if(V)for(let G=0;G<V.vertexLength;G++)N.entranceBloom.layoutColorArray.emplace(V.vertexOffset+G,255*R.r<<8|255*R.g,255*R.b<<8|51*O)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,l){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const d=i.getReplacementRegionsForTile(e.toUnwrapped());if(O1(this.activeReplacements,d))return;this.activeReplacements=d;for(const m of this.footprints)m.hiddenFlags&=-2;const p=[];for(const m of this.activeReplacements){if(m.order<l)continue;const y=Math.max(1,Math.pow(2,m.footprintTileId.canonical.z-e.canonical.z));for(const b of this.footprints)b.min.x>m.max.x||b.max.x<m.min.x||b.min.y>m.max.y||b.max.y<m.min.y||(p.length=0,DG(this.footprintsVertices,b.footprintVertexOffset,b.footprintVertexLength,m.footprintTileId.canonical,e.canonical,p),IE(m.footprint,p,this.footprintsIndices.uint16,b.footprintIndexOffset,b.footprintIndexLength,0,-y)&&(b.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const m of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(m.groundEffectVertexOffset,m.groundEffectVertexLength,m.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 l=Number.NEGATIVE_INFINITY,d=!0;const p=4*(e+St)*St+(i+St);if(Object.hasOwn(this.footprintLookup,p)){const y=this.footprintLookup[p];return y?{height:y.height,hidden:y.hiddenFlags!==0}:void 0}const m=new et(e,i);for(const y of this.footprints)e>y.max.x||y.min.x>e||i>y.max.y||y.min.y>i||y.height<=l||PG(m,this.footprintsVertices.float32.subarray(2*y.footprintVertexOffset,2*(y.footprintVertexOffset+y.footprintVertexLength)),this.footprintsIndices.uint16.subarray(y.footprintIndexOffset,y.footprintIndexOffset+y.footprintIndexLength))&&(l=y.height,this.footprintLookup[p]=y,d=y.hiddenFlags!==0);if(l!==Number.NEGATIVE_INFINITY)return{height:l,hidden:d};this.footprintLookup[p]=void 0}}function PG(o,e,i){for(let l=0;l<i.length;l+=3){const d=i[l],p=i[l+1],m=i[l+2],y=e[2*d+0],b=e[2*d+1],S=e[2*p+0],C=e[2*p+1],I=e[2*m+0],M=e[2*m+1],R=(y-I)*(o.y-M)-(b-M)*(o.x-I),O=(S-y)*(o.y-b)-(C-b)*(o.x-y);if(R<0!=O<0&&R!==0&&O!==0)continue;const N=(I-S)*(o.y-C)-(M-C)*(o.x-S);if(N===0||N<0==R+O<=0)return!0}return!1}function DG(o,e,i,l,d,p){const m=Math.pow(2,l.z-d.z);for(let y=0;y<i;y++){let b=o.float32[2*(y+e)+0],S=o.float32[2*(y+e)+1];b=(b+d.x*St)*m-l.x*St,S=(S+d.y*St)*m-l.y*St,p.push(new et(b,S))}}Mt(ER,"BuildingBucket",{omit:["layers"]}),Mt(sk,"BuildingGeometry"),Mt(ok,"BuildingBloomGeometry");class kR{constructor(e=0,i=[]){this.frcMask=e,this.rings=i}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}}async function lw(){}function wg(o,e,i){const l=e.paint.get(o).value;return l.kind==="constant"?l.value:i.programConfigurations.get(e.id).getMaxValue(o)}function cw(o){return Math.sqrt(o[0]*o[0]+o[1]*o[1])}function AR(o,e,i,l,d){if(!e[0]&&!e[1])return o;const p=et.convert(e)._mult(d);i==="viewport"&&p._rotate(-l);const m=[];for(let y=0;y<o.length;y++)m.push(o[y].sub(p));return m}function CR(o,e,i,l){const d=et.convert(o)._mult(l);return e==="viewport"&&d._rotate(-i),d}Mt(kR,"FrcCoveragePolygon");const RG=ne(),IR=o=>{const e=[];return o.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),o.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function MR(o,e,i,l,d,p,m,y,b){if(p&&o.queryGeometry.isAboveHorizon)return!1;p&&(b*=o.pixelToTileUnitsFactor);const S=o.tileID.canonical,C=i.projection.upVectorScale(S,i.center.lat,i.worldSize).metersToTile;for(const I of e)for(const M of I){const R=M.add(y),O=d&&i.elevation?i.elevation.exaggeration()*d.getElevationAt(R.x,R.y,!0):0,N=i.projection.projectTilePoint(R.x,R.y,S);if(O>0){const q=i.projection.upVector(S,R.x,R.y);N.x+=q[0]*C*O,N.y+=q[1]*C*O,N.z+=q[2]*C*O}const V=p?R:LG(N.x,N.y,N.z,l),G=p?o.tilespaceRays.map(q=>FG(q,O)):o.queryGeometry.screenGeometry,K=oi([],[N.x,N.y,N.z,1],l);if(!m&&p?b*=K[3]/i.cameraToCenterDistance:m&&!p&&(b*=i.cameraToCenterDistance/K[3]),p){const q=Si((M.y/St+S.y)/(1<<S.z));b/=i.projection.pixelsPerMeter(q,1)/Ko(1,q)}if(rE(G,V,b))return!0}return!1}function LG(o,e,i,l){const d=oi([],[o,e,i,1],l);return new et(d[0]/d[3],d[1]/d[3])}const PR=vt(0,0,0),OG=vt(0,0,1);function FG(o,e){const i=wt();return PR[2]=e,o.intersectsPlane(PR,OG,i),new et(i[0],i[1])}class DR extends Ae{}let RR,LR,OR,FR,zR,BR,NR,VR,jR,UR,GR,$R,HR,WR;function c0(o){const e={},i=o.resolution||256,l=o.clips?o.clips.length:1,d=o.image||new A({width:i,height:l}),p=o.lut||null,m=(y,b,S)=>{e[o.evaluationKey]=S;const C=o.expression.evaluate(e),I=C?C.toNonPremultipliedRenderColor(p):null;I&&(d.data[y+b+0]=Math.floor(255*I.r),d.data[y+b+1]=Math.floor(255*I.g),d.data[y+b+2]=Math.floor(255*I.b),d.data[y+b+3]=Math.floor(255*I.a))};if(o.clips)for(let y=0,b=0;y<l;++y,b+=4*i)for(let S=0,C=0;S<i;S++,C+=4){const I=S/(i-1),{start:M,end:R}=o.clips[y];m(b,C,Jt(M,R,I))}else for(let y=0,b=0;y<i;y++,b+=4)m(0,b,y/(i-1));return d}Mt(DR,"HeatmapBucket",{omit:["layers"]});class qR{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 l of this.footprints)i.push({footprint:l,id:e})}updateAppearances(e,i,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){const p=[];for(const{feature:m,id:y,index:b,sourceLayerIndex:S}of e){const C=this.layers[0]._featureFilter.needGeometry,I=Ls(m,C);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),I,l))continue;const M={id:y,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?I.geometry:Js(m,l,d),patterns:{}};p.push(M)}for(const m of p){const{geometry:y,index:b,sourceLayerIndex:S}=m;this.addFeature(m,y,b,l,{},i.availableImages,i.brightness),i.featureIndex.insert(e[b].feature,y,b,S,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,l,d,p,m,y){}destroy(){}addFeature(e,i,l,d,p,m=[],y){for(const b of Bn(i,2)){const S=[],C=[],I=[],M=new et(1/0,1/0),R=new et(-1/0,-1/0);for(const V of b)if(V.length!==0){V!==b[0]&&I.push(C.length/2);for(let G=0;G<V.length;G++)C.push(V[G].x),C.push(V[G].y),S.push(V[G]),M.x=Math.min(M.x,V[G].x),M.y=Math.min(M.y,V[G].y),R.x=Math.max(R.x,V[G].x),R.y=Math.max(R.y,V[G].y)}const O=Nu(C,I),N=new W1(S,O,8,256);this.footprints.push({vertices:S,indices:O,grid:N,min:M,max:R})}}}function u0(o,e){return o.x*e.x+o.y*e.y}function ZR(o,e){if(o.length===1){let i=0;const l=e[i++];let d;for(;!d||l.equals(d);)if(d=e[i++],!d)return 1/0;for(;i<e.length;i++){const p=e[i],m=o[0],y=d.sub(l),b=p.sub(l),S=m.sub(l),C=u0(y,y),I=u0(y,b),M=u0(b,b),R=u0(S,y),O=u0(S,b),N=C*M-I*I,V=(M*R-I*O)/N,G=(C*O-I*R)/N,K=l.z*(1-V-G)+d.z*V+p.z*G;if(isFinite(K))return K}return 1/0}{let i=1/0;for(const l of e)i=Math.min(i,l.z);return i}}function XR(o,e,i){let l=1/0;Ov(i,e)&&(l=ZR(i,e[0]));for(let d=0;d<e.length;d++){const p=e[d],m=o[d];for(let y=0;y<p.length-1;y++){const b=p[y],S=[b,p[y+1],m[y+1],m[y],b];Lv(i,S)&&(l=Math.min(l,ZR(i,S)))}}return l!==1/0&&l}function KR(o,e,i,l,d,p,m,y,b,S,C){return o.projection.name==="globe"?function(I,M,R,O,N,V,G,K,q,ee,te){const le=[],xe=[],de=I.projection.upVectorScale(te,I.center.lat,I.worldSize).metersToTile,ve=[0,0,0,1],Se=[0,0,0,1],we=(Ve,qe,Ke,je)=>{Ve[0]=qe,Ve[1]=Ke,Ve[2]=je,Ve[3]=1},Fe=vR();R>0&&(R+=Fe),O+=Fe;for(const Ve of M){const qe=[],Ke=[];for(const je of Ve){const at=je.x+N.x,Ge=je.y+N.y,$e=I.projection.projectTilePoint(at,Ge,te),Ye=I.projection.upVector(te,je.x,je.y);let rt=R,lt=O;if(G){const yt=YR(at,Ge,R,O,G,K,q,ee);rt+=yt.base,lt+=yt.top}R!==0?we(ve,$e.x+Ye[0]*de*rt,$e.y+Ye[1]*de*rt,$e.z+Ye[2]*de*rt):we(ve,$e.x,$e.y,$e.z),we(Se,$e.x+Ye[0]*de*lt,$e.y+Ye[1]*de*lt,$e.z+Ye[2]*de*lt),Tr(ve,ve,V),Tr(Se,Se,V),qe.push(new rc(ve[0],ve[1],ve[2])),Ke.push(new rc(Se[0],Se[1],Se[2]))}le.push(qe),xe.push(Ke)}return[le,xe]}(o,e,i,l,d,p,m,y,b,S,C):m?function(I,M,R,O,N,V,G,K,q){const ee=[],te=[],le=[0,0,0,1];for(const xe of I){const de=[],ve=[];for(const Se of xe){const we=Se.x+O.x,Fe=Se.y+O.y,Ve=YR(we,Fe,M,R,V,G,K,q);le[0]=we,le[1]=Fe,le[2]=Ve.base,le[3]=1,oi(le,le,N),le[3]=Math.max(le[3],1e-5);const qe=new rc(le[0]/le[3],le[1]/le[3],le[2]/le[3]);le[0]=we,le[1]=Fe,le[2]=Ve.top,le[3]=1,oi(le,le,N),le[3]=Math.max(le[3],1e-5);const Ke=new rc(le[0]/le[3],le[1]/le[3],le[2]/le[3]);de.push(qe),ve.push(Ke)}ee.push(de),te.push(ve)}return[ee,te]}(e,i,l,d,p,m,y,b,S):function(I,M,R,O,N){const V=[],G=[],K=N[8]*M,q=N[9]*M,ee=N[10]*M,te=N[11]*M,le=N[8]*R,xe=N[9]*R,de=N[10]*R,ve=N[11]*R;for(const Se of I){const we=[],Fe=[];for(const Ve of Se){const qe=Ve.x+O.x,Ke=Ve.y+O.y,je=N[0]*qe+N[4]*Ke+N[12],at=N[1]*qe+N[5]*Ke+N[13],Ge=N[2]*qe+N[6]*Ke+N[14],$e=N[3]*qe+N[7]*Ke+N[15],Ye=je+K,rt=at+q,lt=Ge+ee,yt=Math.max($e+te,1e-5),tt=je+le,mt=at+xe,bt=Ge+de,Ft=Math.max($e+ve,1e-5);we.push(new rc(Ye/yt,rt/yt,lt/yt)),Fe.push(new rc(tt/Ft,mt/Ft,bt/Ft))}V.push(we),G.push(Fe)}return[V,G]}(e,i,l,d,p)}function YR(o,e,i,l,d,p,m,y){const b=m*d.getElevationAt(o,e,!0,!0),S=p[0]!==0,C=S?p[1]===0?m*(p[0]/7-450):m*function(I,M,R){const O=Math.floor(M[0]/8),N=Math.floor(M[1]/8),V=10*(M[0]-8*O),G=10*(M[1]-8*N),K=I.getElevationAt(O,N,!0,!0),q=I.getMeterToDEM(R),ee=Math.floor(.5*(V*q-1)),te=Math.floor(.5*(G*q-1)),le=I.tileCoordToPixel(O,N),xe=2*ee+1,de=2*te+1,ve=function(Ke,je,at,Ge,$e){return[Ke.getElevationAtPixel(je,at,!0),Ke.getElevationAtPixel(je+$e,at,!0),Ke.getElevationAtPixel(je,at+$e,!0),Ke.getElevationAtPixel(je+Ge,at+$e,!0)]}(I,le.x-ee,le.y-te,xe,de),Se=Math.abs(ve[0]-ve[1]),we=Math.abs(ve[2]-ve[3]),Fe=Math.abs(ve[0]-ve[2])+Math.abs(ve[1]-ve[3]),Ve=Math.min(.25,.5*q*(Se+we)/xe),qe=Math.min(.25,.5*q*Fe/de);return K+Math.max(Ve*V,qe*G)}(d,p,y):b;return{base:b+(i===0?-1:i),top:S?Math.max(C+l,b+i+2):b+l}}function QR(o,e,i){return e*(St/(o.tileSize*Math.pow(2,i-o.tileID.overscaledZ)))}function JR(o,e){return 1/QR(o,1,e.tileZoom)}function eL(o,e,i,l){return o.translatePosMatrix(l||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}Mt(qR,"ClipBucket",{omit:["layers"]});const tL=o=>{const e=[];nL(o)&&e.push("RENDER_LINE_DASH"),o.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT"),o.paint.get("line-blend-mode")==="multiply"&&e.push("LINE_BLEND_MULTIPLY"),o.paint.get("line-blend-mode")==="additive"&&e.push("LINE_BLEND_ADDITIVE");const i=o.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),o.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const l=o.layout.get("line-join").constantOr("miter")==="none",d=!!o.paint.get("line-pattern").constantOr(1);return l&&d&&e.push("LINE_JOIN_NONE"),e};function nL(o){const e=o.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let ak;const rL=()=>ak||(ak={layout:HR||(HR=new fr({"line-cap":new xt(Le.layout_line["line-cap"]),"line-join":new xt(Le.layout_line["line-join"]),"line-miter-limit":new _t(Le.layout_line["line-miter-limit"]),"line-round-limit":new _t(Le.layout_line["line-round-limit"]),"line-sort-key":new xt(Le.layout_line["line-sort-key"]),"line-z-offset":new xt(Le.layout_line["line-z-offset"]),"line-elevation-reference":new _t(Le.layout_line["line-elevation-reference"]),"line-cross-slope":new _t(Le.layout_line["line-cross-slope"]),visibility:new _t(Le.layout_line.visibility),"line-width-unit":new _t(Le.layout_line["line-width-unit"]),"line-elevation-ground-scale":new xt(Le.layout_line["line-elevation-ground-scale"])})),paint:WR||(WR=new fr({"line-opacity":new xt(Le.paint_line["line-opacity"]),"line-color":new xt(Le.paint_line["line-color"]),"line-translate":new _t(Le.paint_line["line-translate"]),"line-translate-anchor":new _t(Le.paint_line["line-translate-anchor"]),"line-width":new xt(Le.paint_line["line-width"]),"line-gap-width":new xt(Le.paint_line["line-gap-width"]),"line-offset":new xt(Le.paint_line["line-offset"]),"line-blur":new xt(Le.paint_line["line-blur"]),"line-dasharray":new xt(Le.paint_line["line-dasharray"]),"line-pattern":new xt(Le.paint_line["line-pattern"]),"line-pattern-cross-fade":new _t(Le.paint_line["line-pattern-cross-fade"]),"line-gradient":new Bu(Le.paint_line["line-gradient"]),"line-trim-offset":new _t(Le.paint_line["line-trim-offset"]),"line-trim-fade-range":new _t(Le.paint_line["line-trim-fade-range"]),"line-trim-color":new _t(Le.paint_line["line-trim-color"]),"line-emissive-strength":new xt(Le.paint_line["line-emissive-strength"]),"line-border-width":new xt(Le.paint_line["line-border-width"]),"line-border-color":new xt(Le.paint_line["line-border-color"]),"line-occlusion-opacity":new _t(Le.paint_line["line-occlusion-opacity"]),"line-blend-mode":new _t(Le.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new _t(Le.paint_line["line-blend-additive-clamp"]),"line-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},ak);class zG extends xt{possiblyEvaluate(e,i){return i=new Yn(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,l,d){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,l,d)}}let d0,iL,oL,lk;function sL(o,e){return e>0?e+2*o:o}function aL(o,e){return e.replace(/{([^{}]+)}/g,(i,l)=>l in o?String(o[l]):"")}class lL{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:kd,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}}Mt(lL,"FormatSectionOverride",{omit:["defaultValue"]});const ck=()=>lk||(lk={layout:iL||(iL=new fr({"symbol-placement":new _t(Le.layout_symbol["symbol-placement"]),"symbol-spacing":new _t(Le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new _t(Le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new xt(Le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new _t(Le.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new _t(Le.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new _t(Le.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new _t(Le.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new _t(Le.layout_symbol["icon-ignore-placement"]),"icon-optional":new _t(Le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new _t(Le.layout_symbol["icon-rotation-alignment"]),"icon-size":new xt(Le.layout_symbol["icon-size"]),"icon-size-scale-range":new _t(Le.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new xt(Le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new xt(Le.layout_symbol["icon-text-fit-padding"]),"icon-image":new xt(Le.layout_symbol["icon-image"]),"icon-image-use-theme":new _t({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new xt(Le.layout_symbol["icon-rotate"]),"icon-padding":new _t(Le.layout_symbol["icon-padding"]),"icon-keep-upright":new _t(Le.layout_symbol["icon-keep-upright"]),"icon-offset":new xt(Le.layout_symbol["icon-offset"]),"icon-anchor":new xt(Le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new _t(Le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new _t(Le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new _t(Le.layout_symbol["text-rotation-alignment"]),"text-field":new xt(Le.layout_symbol["text-field"]),"text-font":new xt(Le.layout_symbol["text-font"]),"text-size":new xt(Le.layout_symbol["text-size"]),"text-size-scale-range":new _t(Le.layout_symbol["text-size-scale-range"]),"text-max-width":new xt(Le.layout_symbol["text-max-width"]),"text-line-height":new xt(Le.layout_symbol["text-line-height"]),"text-letter-spacing":new xt(Le.layout_symbol["text-letter-spacing"]),"text-justify":new xt(Le.layout_symbol["text-justify"]),"text-radial-offset":new xt(Le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new _t(Le.layout_symbol["text-variable-anchor"]),"text-anchor":new xt(Le.layout_symbol["text-anchor"]),"text-max-angle":new _t(Le.layout_symbol["text-max-angle"]),"text-writing-mode":new _t(Le.layout_symbol["text-writing-mode"]),"text-rotate":new xt(Le.layout_symbol["text-rotate"]),"text-padding":new _t(Le.layout_symbol["text-padding"]),"text-keep-upright":new _t(Le.layout_symbol["text-keep-upright"]),"text-transform":new xt(Le.layout_symbol["text-transform"]),"text-offset":new xt(Le.layout_symbol["text-offset"]),"text-allow-overlap":new _t(Le.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new _t(Le.layout_symbol["text-ignore-placement"]),"text-optional":new _t(Le.layout_symbol["text-optional"]),visibility:new _t(Le.layout_symbol.visibility)})),paint:oL||(oL=new fr({"icon-opacity":new xt(Le.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new xt(Le.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new xt(Le.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new xt(Le.paint_symbol["text-emissive-strength"]),"icon-color":new xt(Le.paint_symbol["icon-color"]),"icon-halo-color":new xt(Le.paint_symbol["icon-halo-color"]),"icon-halo-width":new xt(Le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new xt(Le.paint_symbol["icon-halo-blur"]),"icon-translate":new _t(Le.paint_symbol["icon-translate"]),"icon-translate-anchor":new _t(Le.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new _t(Le.paint_symbol["icon-image-cross-fade"]),"text-opacity":new xt(Le.paint_symbol["text-opacity"]),"text-occlusion-opacity":new xt(Le.paint_symbol["text-occlusion-opacity"]),"text-color":new xt(Le.paint_symbol["text-color"],{runtimeType:as,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new xt(Le.paint_symbol["text-halo-color"]),"text-halo-width":new xt(Le.paint_symbol["text-halo-width"]),"text-halo-blur":new xt(Le.paint_symbol["text-halo-blur"]),"text-translate":new _t(Le.paint_symbol["text-translate"]),"text-translate-anchor":new _t(Le.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new _t(Le.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new _t(Le.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new _t(Le.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new _t(Le.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new xt(Le.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},lk);class uw extends ds{constructor(e,i,l,d){super(e,ck(),i,l,d,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=oe([]),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(d=>{d.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 l=this.layout.get("text-writing-mode");if(l){const d=[];for(const p of l)d.includes(p)||d.push(p);this.layout._values["text-writing-mode"]=d}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,l,d){return this._saturation===e&&this._contrast===i&&this._brightnessMin===l&&this._brightnessMax===d||(this._colorAdjustmentMatrix=function(p,m,y,b){p=Eu(p),m=kc(m);const S=ne(),C=p/3,I=1-2*C,M=[I,C,C,0,C,I,C,0,C,C,I,0,0,0,0,1],R=.5-.5*m,O=b-y;return he(S,[O,0,0,0,0,O,0,0,0,0,O,0,y,y,y,1],[m,0,0,0,0,m,0,0,0,0,m,0,R,R,R,1]),he(S,S,M),S}(e,i,l,d),this._saturation=e,this._contrast=i,this._brightnessMin=l,this._brightnessMax=d),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,l,d){const p=this.layout.get(e).evaluate(i,{},l,d),m=this._unevaluatedLayout._values[e];return m.isDataDriven()||Nf(m.value)||!p?p:aL(i.properties,p)}getAppearanceValueAndResolveTokens(e,i,l,d,p){const m=e.getLayoutProperty(i);if(!m)return;const y=m.evaluate(l,{},d,p),b=e.getUnevaluatedLayoutProperties()._values[i];return b.isDataDriven()||Nf(b.value)||!y||typeof y!="string"?y:aL(l.properties,y)}createBucket(e){return new Rl(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of ck().paint.overridableProperties){if(!uw.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),l=new lL(i),d=new Rm(l,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let p=null;p=i.value.kind==="constant"||i.value.kind==="source"?new zd("source",d):new Bd("composite",d,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Uc(i.property,p,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,l){return!(!this.layout||i.isDataDriven()||l.isDataDriven())&&uw.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const l=e.get("text-field"),d=ck().paint.properties[i];let p=!1;const m=y=>{for(const b of y)if(d.overrides&&d.overrides.hasOverride(b))return void(p=!0)};if(l.value.kind==="constant"&&l.value.value instanceof Ao)m(l.value.value.sections);else if(l.value.kind==="source"){const y=S=>{p||(S instanceof xl&&to(S.value)===yl?m(S.value.sections):S instanceof yf?m(S.sections):S.eachChild(y))},b=l.value;b._styleExpression&&y(b._styleExpression.expression)}return p}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,l){return{config:new qu(this,{zoom:i,lut:l}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}mayUse(e){return e==="HD"&&Wm(this,"symbol-elevation-reference",i=>i==="hd-road-markup")}prepare(){return this.mayUse("HD")?lw():Promise.resolve()}}let cL,uL,dL,hL;var dw=Sn([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function hw(o,e,i,l,d,p,m,y){const b=[o,e,1,i,l,1,d,p,1],S=[m,y,1],C=X([],b),[I,M,R]=ns(S,S,C);return ae(b,b,[I,0,0,0,M,0,0,0,R])}function fL(o,e,i,l,d,p,m,y){const b=function(S,C,I,M,R,O,N,V){const G=hw(0,0,1,0,1,1,0,1),K=hw(S,C,I,M,R,O,N,V);return ae(K,K,X([],G))}(o,e,i,l,d,p,m,y);return[b[2]/b[8]/St,b[5]/b[8]/St]}function fw(o){return[o[0],Math.min(Math.max(o[1],-85.051129),Ss)]}class pL extends Au{constructor(e,i,l,d){super(),this.id=e,this.dispatcher=l,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(d),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Xl("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=am(this.map._requestManager.transformRequest(this.url,Ac.Image),(l,d)=>{this._imageRequest=null,this._loaded=!0,l?this.fire(new cm(l)):d&&(this.image=d,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 Vv(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 Xl("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 Vv||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],l=e[0][1];for(const p of e)p[1]>l&&(l=p[1]),p[1]<i&&(i=p[1]);const d=(l+i)/2;if(d>Ss?this.onNorthPole=!0:d<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const p=e.map(No.fromLngLat);this.tileID=function(m){let y=1/0,b=1/0,S=-1/0,C=-1/0;for(const N of m)y=Math.min(y,N.x),b=Math.min(b,N.y),S=Math.max(S,N.x),C=Math.max(C,N.y);const I=Math.max(S-y,C-b),M=Math.max(0,Math.floor(-Math.log2(I))),R=Math.pow(2,M);let O=Math.floor((y+S)/2*R);return O>1&&(O-=1),new hp(M,O,Math.floor((b+C)/2*R))}(p),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Xl("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Vv||(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 G=this.tiles[V];G.state!=="loaded"&&(G.state="loaded",G.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=fp(new hp(0,0,0),this.map.transform.projection),l=[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 G=V[1].x-V[0].x,K=V[1].y-V[0].y,q=V[2].x-V[1].x,ee=V[2].y-V[1].y,te=V[3].x-V[2].x,le=V[3].y-V[2].y,xe=V[0].x-V[3].x,de=V[0].y-V[3].y,ve=G*ee-q*K,Se=q*le-te*ee,we=te*de-xe*le,Fe=xe*K-G*de;return ve>0&&Se>0&&we>0&&Fe>0||ve<0&&Se<0&&we<0&&Fe<0}(l))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const d=fp(this.tileID,this.map.transform.projection),[p,m,y,b]=this.coordinates.map(V=>{const G=d.projection.project(V[0],V[1]);return aD(d,G)._round()});this.perspectiveTransform=fL(p.x,p.y,m.x,m.y,y.x,y.y,b.x,b.y);const S=this._boundsArray=new Wc;S.emplaceBack(p.x,p.y,0,0),S.emplaceBack(m.x,m.y,St,0),S.emplaceBack(b.x,b.y,0,St),S.emplaceBack(y.x,y.y,St,St),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(S,dw.members),this.boundsSegments=pr.simpleSegment(0,0,4,2);const C=[],I=function(V){return[fw(V[0]),fw(V[1]),fw(V[2]),fw(V[3])]}(this.coordinates),[M,R,O,N]=function(V){let G=V[0][0],K=G,q=V[0][1],ee=q;for(let te=1;te<V.length;te++)V[te][0]<G?G=V[te][0]:V[te][0]>K&&(K=V[te][0]),V[te][1]<q?q=V[te][1]:V[te][1]>ee&&(ee=V[te][1]);return[G,q,K-G,ee-q]}(I);{const V=new Wc,[G,K,q,ee]=function(je){let at=je[0].x,Ge=at,$e=je[0].y,Ye=$e;for(let rt=1;rt<je.length;rt++)je[rt].x<at?at=je[rt].x:je[rt].x>Ge&&(Ge=je[rt].x),je[rt].y<$e?$e=je[rt].y:je[rt].y>Ye&&(Ye=je[rt].y);return[at,$e,Ge-at,Ye-$e]}(l),te=je=>[(je.x-G)/q,(je.y-K)/ee],[le,xe,de,ve]=l.map(te),Se=function(je,at,Ge,$e,Ye,rt,lt,yt){const tt=hw(0,0,1,0,1,1,0,1);return ae(tt,tt,X([],hw(je,at,Ge,$e,Ye,rt,lt,yt)))}(le[0],le[1],xe[0],xe[1],de[0],de[1],ve[0],ve[1]);this.elevatedGlobePerspectiveTransform=fL(le[0],le[1],xe[0],xe[1],de[0],de[1],ve[0],ve[1]);const we=(je,at)=>{C.push(je.lng);const Ge=Math.round((je.lng-M)/O*St),$e=Math.round((je.lat-R)/N*St),Ye=te(at),rt=ns([],[Ye[0],Ye[1],1],Se),lt=Math.round(rt[0]/rt[2]*St),yt=Math.round(rt[1]/rt[2]*St);V.emplaceBack(Ge,$e,lt,yt)},Fe=l[3].x-l[0].x,Ve=l[3].y-l[0].y,qe=l[2].x-l[1].x,Ke=l[2].y-l[1].y;for(let je=0;je<65;je++){const at=je/64,Ge=[l[0].x+at*Fe,l[0].y+at*Ve],$e=[l[1].x+at*qe,l[1].y+at*Ke],Ye=$e[0]-Ge[0],rt=$e[1]-Ge[1];for(let lt=0;lt<65;lt++){const yt=lt/64,tt={x:Ge[0]+Ye*yt,y:Ge[1]+rt*yt};we(i.projection.unproject(tt.x,tt.y),tt)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(V,dw.members)}{this.maxLongitudeTriangleSize=0;let V=[],G=new _i;const K=(q,ee,te)=>{G.emplaceBack(q,ee,te);const le=C[q],xe=C[ee],de=C[te],ve=Math.min(Math.min(le,xe),de),Se=Math.max(Math.max(le,xe),de)-ve;Se>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Se),V.push(ve+Se/2)};for(let q=0;q<64;q++)for(let ee=0;ee<64;ee++){const te=65*q+ee,le=te+1,xe=te+65,de=xe+1;K(te,xe,le),K(le,xe,de)}[V,G]=function(q,ee){const te=Array.from({length:q.length},(de,ve)=>ve);te.sort((de,ve)=>q[de]-q[ve]);const le=[],xe=new _i;for(let de=0;de<te.length;de++){const ve=te[de];le.push(q[ve]);const Se=3*ve,we=Se+1;xe.emplaceBack(ee.uint16[Se],ee.uint16[we],ee.uint16[we+1])}return[le,xe]}(V,G),this.elevatedGlobeTrianglesCenterLongitudes=V,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(G)}this.elevatedGlobeSegments=pr.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,O/St,0,N/St,0,0,R,M,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,l=i.gl;!this._dirty||this.texture instanceof Vv||(this.texture?this.texture.update(this.image):(this.texture=new Jc(i,this.image,l.RGBA8),this.texture.bind(l.LINEAR,l.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 l=this.elevatedGlobeTrianglesCenterLongitudes;let d=(p=e+180)+360*Math.round((l[0]-p)/360);var p;const m=new pr,y=(I,M)=>{m.segments.push({vertexOffset:0,primitiveOffset:I,vertexLength:i.segments[0].vertexLength,primitiveLength:M,sortKey:void 0,vaos:{}})},b=.51*this.maxLongitudeTriangleSize;if(Math.abs(l[0]-d)<=b){const I=ui(l,0,l.length,d+b);return I===l.length||y(I,Cr(l,I+1,l.length,d+360-b)-I),m}d<l[0]&&(d+=360);const S=Cr(l,0,l.length,d-b);if(S===l.length)return y(0,l.length),m;y(0,S-0);const C=ui(l,S+1,l.length,d+b);return C!==l.length&&y(C,l.length-C),m}}const uk=1024,BG=(Math.pow(uk,2)-1)/268170240;class mL extends ds{constructor(e,i,l,d){super(e,{layout:dL||(dL=new fr({visibility:new _t(Le.layout_raster.visibility)})),paint:hL||(hL=new fr({"raster-opacity":new _t(Le.paint_raster["raster-opacity"]),"raster-color":new Bu(Le.paint_raster["raster-color"]),"raster-color-mix":new _t(Le.paint_raster["raster-color-mix"]),"raster-color-range":new _t(Le.paint_raster["raster-color-range"]),"raster-hue-rotate":new _t(Le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new _t(Le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new _t(Le.paint_raster["raster-brightness-max"]),"raster-saturation":new _t(Le.paint_raster["raster-saturation"]),"raster-contrast":new _t(Le.paint_raster["raster-contrast"]),"raster-resampling":new _t(Le.paint_raster["raster-resampling"]),"raster-fade-duration":new _t(Le.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new _t(Le.paint_raster["raster-emissive-strength"]),"raster-array-band":new _t(Le.paint_raster["raster-array-band"]),"raster-elevation":new _t(Le.paint_raster["raster-elevation"]),"raster-elevation-reference":new _t(Le.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},i,l,d),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 pL&&(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)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[l,d]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(l)&&isNaN(d)||l===this._curRampRange[0]&&d===this._curRampRange[1]||(this.colorRamp=c0({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:l,end:d}],resolution:uk}),this.colorRampTexture=null,this._curRampRange=[l,d])}is3D(e){return this.paint.get("raster-elevation")>0}}let gL,_L,yL,vL,xL,bL,wL;class SL extends ds{constructor(e,i,l,d){super(e,{layout:gL||(gL=new fr({visibility:new _t(Le["layout_raster-particle"].visibility)})),paint:_L||(_L=new fr({"raster-particle-array-band":new _t(Le["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new _t(Le["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Bu(Le["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new _t(Le["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new _t(Le["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new _t(Le["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new _t(Le["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new _t(Le["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},i,l,d),this._updateColorRamp(),this.lastInvalidatedAt=Zo.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=c0({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Zo.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class NG extends ds{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 dk(o,e,i){const l=[0,0,1],d=vs([]);return sn(d,d,i?-Te(o)+Math.PI:Te(o)),Ct(d,d,-Te(e)),ma(l,l,d),$n(l,l)}class TL{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 EL{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new th,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,l=this.instancedDataArray.float32;let d=Math.floor(l[i+2]);const p=1.05*(l[i+2]-d);return d/=100,[l[i]%1*1.05,l[i+1]%1*1.05,p,d]}tileCoordinatesForInstance(e){const i=16*e,l=this.instancedDataArray.float32;let d=l[i+0];return d=d>St?d-St:d,new et(Math.trunc(d),Math.trunc(l[i+1]))}translationForInstance(e){const i=16*e,l=this.instancedDataArray.float32;return[l[i+4],l[i+5],l[i+6]]}rotationScaleForInstance(e){const i=16*e,l=this.instancedDataArray.float32;return[l[i+7],l[i+8],l[i+9],l[i+10],l[i+11],l[i+12],l[i+13],l[i+14],l[i+15]]}transformForInstance(e){const i=16*e,l=this.instancedDataArray.float32;return[l[i+7],l[i+8],l[i+9],l[i+4],l[i+10],l[i+11],l[i+12],l[i+5],l[i+13],l[i+14],l[i+15],l[i+6],0,0,0,1]}}class hk{constructor(e){this.requiresStandardRuntime=!0,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,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,l,d){this.tileToMeter=Qs(l);const p=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const m=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?i.elevationFeatures:void 0;for(const{feature:y,id:b,index:S,sourceLayerIndex:C}of e){const I=b??(y.properties&&Object.hasOwn(y.properties,"id")?y.properties.id:void 0),M=Ls(y,p);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),M,l))continue;const R={id:I,sourceLayerIndex:C,index:S,geometry:p?M.geometry:Js(y,l,d),properties:y.properties,type:y.type,patterns:{}},O=this.addFeature(R,R.geometry,M,m,l);O&&i.featureIndex.insert(y,R.geometry,S,C,this.index,this.instancesPerModel[O].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let l=0;for(const d of this.modelUris){const p=e.getModel(d,i);if(!p)continue;const m=this.instancesPerModel[d];if(m){const y=.5*Kn(p.aabb.max,p.aabb.min)*m.maxScale+m.maxXYTranslationDistance,b=Math.min(St,Math.max(y/this.tileToMeter,256));l=Math.max(b,l)}}return l}update(e,i,l,d){for(const p in this.instancesPerModel){const m=this.instancesPerModel[p];for(const y in e)Object.hasOwn(m.idToFeaturesIndex,y)&&(this.evaluate(m.features[m.idToFeaturesIndex[y]],e[y],m,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const l=this.instancesPerModel[i];for(const d of l.features){const p=this.layers[0],m=d.feature,y=this.canonical,b=p.paint.get("model-rotation").evaluate(m,{},y),S=p.paint.get("model-scale").evaluate(m,{},y),C=p.paint.get("model-translation").evaluate(m,{},y);Ci(d.rotation,b)&&Ci(d.scale,S)&&Ci(d.translation,C)||(this.evaluate(d,d.featureStates,l,!0),e=!0)}}return e}updateReplacement(e,i,l,d){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const p=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(O1(this.activeReplacements,p))return!1;this.activeReplacements=p;let m=!1;for(const y in this.instancesPerModel){const b=this.instancesPerModel[y],S=b.instancedDataArray;for(const C of b.features){const I=C.instancedDataOffset,M=C.instancedDataCount;for(let R=0;R<M;R++){const O=16*(R+I);let N=S.float32[O+0];const V=N>St;N=V?N-St:N;const G=Math.floor(N),K=Math.floor(S.float32[O+1]);let q=!1;for(const ee of this.activeReplacements)if(!fD(ee,l,J1.Model,d)&&!(ee.min.x>G||G>ee.max.x||ee.min.y>K||K>ee.max.y)&&(q=yD(_D(G,K,e.canonical,ee.footprintTileId.canonical),ee.footprint),q))break;S.float32[O]=q?N+St:N,m=m||q!==V}}}return m}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 l=this.instancesPerModel[i];l.instancedDataArray.length<0||l.instancedDataArray.length===0||(l.instancedDataBuffer?l.instancedDataBuffer.updateData(l.instancedDataArray):l.instancedDataBuffer=e.createVertexBuffer(l.instancedDataArray,q8.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const l in this.instancesPerModel){const d=this.instancesPerModel[l];d.instancedDataArray.length!==0&&d.instancedDataBuffer&&d.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const l of this.modelUris)i.removeModel(l,"",!0)}addFeature(e,i,l,d,p){const m=this.layers[0],y=m.layout.get("model-id"),b=m.layout.get("model-allow-density-reduction"),S=y.evaluate(l,{},this.canonical);if(!S)return Cn(`modelId is not evaluated for layer ${m.id} and it is not going to get rendered.`),S;!S.includes("://")&&!this.styleDefinedModelURLs[S]||this.modelUris.includes(S)||this.modelUris.push(S),this.instancesPerModel[S]||(this.instancesPerModel[S]=new EL);const C=this.instancesPerModel[S],I=C.instancedDataArray,M=new TL(l,I.length);let R;d&&(R=F1(e,d));for(const O of i)for(const N of O){if(N.x<0||N.x>=St||N.y<0||N.y>=St)continue;if(this.lookupDim!==0&&b){const G=(this.lookupDim-1)/St,K=this.lookupDim*(N.y*G|0)+N.x*G|0;if(this.lookup){if(this.lookup[K]!==0)continue;this.lookup[K]=1}}this.instanceCount++;const V=I.length;if(I.resize(V+1),d){C.instancesRoadElevation||(C.instancesRoadElevation=[]);const G=R?R.pointElevation(new et(N.x,N.y)):0;C.instancesRoadElevation.push(G)}C.instancesEvaluatedElevation.push(0),I.float32[16*V]=N.x,I.float32[16*V+1]=N.y}return M.instancedDataCount=C.instancedDataArray.length-M.instancedDataOffset,M.instancedDataCount>0&&(e.id&&(C.idToFeaturesIndex[e.id]=C.features.length),C.features.push(M),this.evaluate(M,{},C,!1)),S}getModelUris(){return this.modelUris}evaluate(e,i,l,d){const p=this.layers[0],m=e.feature,y=this.canonical,b=e.rotation=p.paint.get("model-rotation").evaluate(m,i,y),S=e.scale=p.paint.get("model-scale").evaluate(m,i,y),C=e.translation=p.paint.get("model-translation").evaluate(m,i,y),{r:I,g:M,b:R}=p.paint.get("model-color").evaluate(m,i,y),O=p.paint.get("model-color-mix-intensity").evaluate(m,i,y),N=[];this.maxVerticalOffset<C[2]&&(this.maxVerticalOffset=C[2]);const V=C[0]*C[0]+C[1]*C[1],G=V>0?Math.sqrt(V):0;l.maxScale=Math.max(Math.max(l.maxScale,S[0]),Math.max(S[1],S[2])),l.maxXYTranslationDistance=Math.max(l.maxXYTranslationDistance,G),this.maxScale=Math.max(Math.max(this.maxScale,S[0]),Math.max(S[1],S[2])),tR(N,b,S);const K=Math.round(100*O)+R/1.05;for(let q=0;q<e.instancedDataCount;++q){const ee=e.instancedDataOffset+q,te=16*ee,le=l.instancedDataArray.float32;let xe=0;d&&(xe=le[te+6]-l.instancesEvaluatedElevation[ee]);const de=0|le[te+1];le[te]=(0|le[te])+I/1.05,le[te+1]=de+M/1.05,le[te+2]=K,le[te+3]=1/(y.z>10?this.tileToMeter:Qs(y,de)),le[te+4]=C[0],le[te+5]=C[1],le[te+6]=C[2]+(l.instancesRoadElevation?l.instancesRoadElevation[ee]:0)+xe,le[te+7]=N[0],le[te+8]=N[1],le[te+9]=N[2],le[te+10]=N[4],le[te+11]=N[5],le[te+12]=N[6],le[te+13]=N[8],le[te+14]=N[9],le[te+15]=N[10],l.instancesEvaluatedElevation[ee]=C[2]}}}Mt(hk,"ModelBucket",{omit:["layers"]}),Mt(EL,"PerModelAttributes"),Mt(TL,"ModelFeature");class Sg{constructor(e,i,l){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=l}static create(e,i,l){const d=l||e.findDEMTileFor(i);if(!d||!d.dem)return;const p=d.dem,m=d.tileID,y=1<<i.canonical.z-m.canonical.z;return new Sg(d,p.dim/St/y,[(i.canonical.x/y-m.canonical.x)*p.dim,(i.canonical.y/y-m.canonical.y)*p.dim])}tileCoordToPixel(e,i){const l=i*this._scale+this._offset[1];return new et(Math.floor(e*this._scale+this._offset[0]),Math.floor(l))}getElevationAt(e,i,l,d){const p=e*this._scale+this._offset[0],m=i*this._scale+this._offset[1],y=Math.floor(p),b=Math.floor(m),S=this._dem;return d=!!d,l?Jt(Jt(S.get(y,b,d),S.get(y,b+1,d),m-b),Jt(S.get(y+1,b,d),S.get(y+1,b+1,d),m-b),p-y):S.get(y,b,d)}getElevationAtPixel(e,i,l){return this._dem.get(e,i,!!l)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Ko(1,e)*this._dem.stride}}const fk=new Float32Array(262144),gp=new Uint8Array(262144),pw=[0,0,0],mw=[0,0,0];function kL(o){let e=0;if(o.meshes)for(const i of o.meshes)e=Math.max(e,i.aabb.max[2]);if(o.children)for(const i of o.children)e=Math.max(e,kL(i));return e}function AL(o,e,i){if(o.meshes)for(const l of o.meshes){if(l.aabb.min[0]===1/0)continue;const d=Qr.applyTransform(l.aabb,o.globalMatrix);i.insert(e,d.min[0],d.min[1],d.max[0],d.max[1])}if(o.children)for(const l of o.children)AL(l,e,i)}const gw=["","wall","door","roof","window","lamp","logo"];class CL{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.targetLod=-1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:kL(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Qr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new Qr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const l of this.node.meshes)this.node.lightMeshIndex!==e&&(l.transformedAabb=Qr.applyTransformFast(l.aabb,this.node.globalMatrix),i.encapsulate(l.transformedAabb)),e++;this.aabb=i}return this.aabb}}class _w{constructor(e,i,l,d,p,m,y,b){this.requiresStandardRuntime=!0,this.id=l,this.layers=e,this.layerIds=this.layers.map(S=>S.fqid),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.modelTraits|=xg.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,d&&(this.modelTraits|=xg.HasMapboxMeshFeatures),p&&(this.modelTraits|=xg.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=m,this.worldview=b,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const S of i)this.nodesInfo.push(new CL(S)),AL(S,y.featureIndexArray.length,y.grid),y.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,y.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const l of this.getNodesInfo()){const d=l.node;d.footprint&&i.push({footprint:d.footprint,id:e})}}updateAppearances(e,i,l,d){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const l=i?this.stateDependentLayers:this.layers;if(!ji(e,this.states))for(const d of l)this.evaluate(d,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 l of i){const d=l.node;this.uploaded?this.updatePbrBuffer(d):qE(d,e,!0)}for(const l of i)Y1(l.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const l of e.meshes)l.pbrBuffer&&(l.pbrBuffer.updateData(l.featureArray),i=!0);if(e.lodMeshes)for(const l of e.lodMeshes)l.pbrBuffer&&(l.pbrBuffer.updateData(l.featureArray),i=!0);return i}needsReEvaluation(e,i,l){const d=e.transform.projectionOptions,p=e.style.getBrightness(),m=this.brightness!==p;if(!this.uploaded||this.dirty||d.name!==this.projection.name||h0(l.paint.get("model-color").value,m)||h0(l.paint.get("model-color-mix-intensity").value,m)||h0(l.paint.get("model-roughness").value,m)||h0(l.paint.get("model-emissive-strength").value,m)||h0(l.paint.get("model-height-based-emissive-strength-multiplier").value,m)){this.projection=d,this.brightness=p;const y=this.getNodesInfo();for(const b of y)b.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const l=this.getNodesInfo(),d=this.id.canonical;for(const p of l){const m=p.feature;p.evaluatedTranslation=i.paint.get("model-translation").evaluate(m,{},d),p.evaluatedScale=i.paint.get("model-scale").evaluate(m,{},d)}}evaluate(e,i){const l=this.getNodesInfo();for(const d of l){if(!d.node.meshes)continue;const p=d.feature,m=i&&i[p.id];if(ji(m,d.state))continue;d.state=structuredClone(m);const y=d.node.meshes&&d.node.meshes[0].featureData,b=d.evaluatedColor[2],S=d.evaluatedRMEA[2],C=this.id.canonical;if(d.hasTranslucentParts=!1,y){for(let I=0;I<gw.length;I++){const M=gw[I];M.length&&(p.properties.part=M);const R=e.paint.get("model-color").evaluate(p,m,C).toPremultipliedRenderColor(null),O=e.paint.get("model-color-mix-intensity").evaluate(p,m,C);d.evaluatedColor[I]=[R.r,R.g,R.b,O],d.evaluatedRMEA[I][0]=e.paint.get("model-roughness").evaluate(p,m,C),d.evaluatedRMEA[I][2]=e.paint.get("model-emissive-strength").evaluate(p,m,C),d.evaluatedRMEA[I][3]=R.a,d.emissionHeightBasedParams[I]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(p,m,C),!d.hasTranslucentParts&&R.a<1&&(d.hasTranslucentParts=!0)}delete p.properties.part,jG(d,b!==d.evaluatedColor[2]||S!==d.evaluatedRMEA[2],this.modelTraits)}else d.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(p,m,C);d.evaluatedTranslation=e.paint.get("model-translation").evaluate(p,m,C),d.evaluatedScale=e.paint.get("model-scale").evaluate(p,m,C),this.updatePbrBuffer(d.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,l,d){const p=e.findDEMTileFor(l);if(p&&(p.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(p.dem&&p.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=p.tileID.overscaledZ;const m=Sg.create(e,l,p);if(!m)return;this.modelTraits&xg.HasMapboxMeshFeatures&&this.updateDEM(e,m,l,d);for(const y of this.getNodesInfo()){const b=y.node;if(!b.footprint||!b.footprint.vertices||!b.footprint.vertices.length)continue;const S=b.footprint.vertices;let C=m.getElevationAt(S[0].x,S[0].y,!0,!0);for(let I=1;I<S.length;I++)C=Math.min(C,m.getElevationAt(S[I].x,S[I].y,!0,!0));b.elevation=C}}this.terrainTile=p.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,l,d){let p=i._dem._modifiedForSources[d];if(p===void 0&&(i._dem._modifiedForSources[d]=[],p=i._dem._modifiedForSources[d]),p.includes(l.canonical))return;const m=i._dem.dim;p.push(l.canonical);let y=!1;for(const b of this.getNodesInfo()){const S=b.node;if(!S.footprint||!S.footprint.grid)continue;const C=S.footprint.grid,I=i.tileCoordToPixel(C.min.x,C.min.y),M=i.tileCoordToPixel(C.max.x,C.max.y),R=Math.min(Math.min(m-M.y,I.x),Math.min(I.y,m-M.x));if(R<0)continue;const O=Ie(R,2,5);let N=Math.max(0,I.x-O),V=Math.max(0,I.y-O),G=Math.min(M.x+O,m-1),K=Math.min(M.y+O,m-1);for(let le=V;le<=K;++le)for(let xe=N;xe<=G;++xe)gp[le*m+xe]=255;let q=0,ee=0;for(let le=0;le<C.cellsY;++le)for(let xe=0;xe<C.cellsX;++xe){if(!C.cells[le*C.cellsX+xe])continue;const de=i.tileCoordToPixel(C.min.x+xe/C.xScale,C.min.y+le/C.yScale),ve=i.tileCoordToPixel(C.min.x+(xe+1)/C.xScale,C.min.y+(le+1)/C.yScale);for(let Se=de.y;Se<=Math.min(ve.y+1,m-1);++Se)for(let we=de.x;we<=Math.min(ve.x+1,m-1);++we)gp[Se*m+we]===255&&(gp[Se*m+we]=0,q+=i.getElevationAtPixel(we,Se),ee++)}const te=q/ee;N=Math.max(1,I.x-O),V=Math.max(1,I.y-O),G=Math.min(M.x+O,m-2),K=Math.min(M.y+O,m-2),y=!0;for(let le=V;le<=K;++le)for(let xe=N;xe<=G;++xe)gp[le*m+xe]===0&&(fk[le*m+xe]=i._dem.set(xe,le,te));for(let le=1;le<O;++le){N=Math.max(1,I.x-le),V=Math.max(1,I.y-le),G=Math.min(M.x+le,m-2),K=Math.min(M.y+le,m-2);for(let xe=V;xe<=K;++xe)for(let de=N;de<=G;++de){const ve=xe*m+de;if(gp[ve]===255){let Se=0,we=0,Fe=-1,Ve=-1;for(let qe=-1;qe<=1;++qe)for(let Ke=-1;Ke<=1;++Ke){const je=(xe+qe)*m+de+Ke;if(gp[je]>=le)continue;const at=fk[je],Ge=Math.abs(at);Ge>we&&(Se=at,we=Ge,Fe=Ke,Ve=qe)}if(we>.1){const qe=1-(le+.5*Math.abs(Fe*Ve))/O;let Ke=i._dem.get(de,xe)+Se*qe;const je=i._dem.get(de+Fe,xe+Ve),at=i._dem.get(de-Fe,xe-Ve,!0);(Ke-je)*(Ke-at)>0&&(Ke=(je+at)/2),fk[ve]=i._dem.set(de,xe,Ke),gp[ve]=le}}}}}y&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Zo.now())}setFilter(e){this.filter=e?Gm(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Yn(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Y1(i.node),ZE(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped());for(const d of this.getNodesInfo()){const p=d.node.footprint;d.hiddenByReplacement=!!p&&!l.some(m=>m.footprint===p)}}getHeightAtTileCoord(e,i){const l=[0,0,0],d=oe([]);for(const p of this.getNodesInfo()){const m=p.node.meshes[0],y=m.transformedAabb;if(e<y.min[0]||i<y.min[1]||e>y.max[0]||i>y.max[1])continue;if(p.node.hidden===!0)return{height:1/0,maxHeight:p.feature.properties.height,hidden:!1,verticalScale:p.evaluatedScale[2]};if(re(d,p.node.globalMatrix),l[0]=e,l[1]=i,l[2]=0,Tr(l,l,d),p.node.meshBVH){const I=l[0],M=l[1];pw[0]=I-1,pw[1]=M-1,pw[2]=-1e3,mw[0]=I+1,mw[1]=M+1,mw[2]=1e3;const R=p.node.meshBVH.findHighestPoint(pw,mw);if(R!==null)return{height:R,maxHeight:p.feature.properties.height,hidden:p.hiddenByReplacement,verticalScale:p.evaluatedScale[2]};continue}const b=(l[0]-m.aabb.min[0])/(m.aabb.max[0]-m.aabb.min[0])*pp|0,S=Math.min(63,(l[1]-m.aabb.min[1])/(m.aabb.max[1]-m.aabb.min[1])*pp|0)*pp+Math.min(63,b),C=m.heightmap[S];if(C<0&&p.node.footprint){const I=[];if(p.node.footprint.grid.query(new et(e,i),new et(e,i),I),I.length>0)return{height:void 0,maxHeight:p.feature.properties.height,hidden:p.hiddenByReplacement,verticalScale:p.evaluatedScale[2]};continue}return p.hiddenByReplacement?void 0:{height:C,maxHeight:p.feature.properties.height,hidden:!1,verticalScale:p.evaluatedScale[2]}}}}function h0(o,e){return o instanceof zd&&!o.isLightConstant&&e}function VG(o){const e=Ie(o,0,2);return Math.min(Math.round(.5*e*255),255)}const IL=new Float64Array(10*gw.length);function ML(o,e,i,l,d){if(!o.featureData)return;const p=o.featureArray=new ng;p.reserveExact(o.featureData.length),function(S,C,I){const M=I-C;for(let R=0;R<gw.length;R++){const O=S.evaluatedRMEA[R],N=S.evaluatedColor[R],V=S.emissionHeightBasedParams[R],G=Ie(V[0],0,1),K=Ie(V[1],0,1);let q=65535,ee=0,te=1,le=1;if(G!==K&&M!==0){const ve=Ie(V[2],0,1),Se=Ie(V[3],0,1),we=M*(K-G);ee=1/we,te=-(C+M*G)/we,le=Math.pow(10,Ie(V[4],-1,1)),q=255*ve<<8|255*Se}const xe=IL,de=10*R;xe[de]=255*N[0],xe[de+1]=255*N[1],xe[de+2]=255*N[2],xe[de+3]=N[3],xe[de+4]=Math.floor(255*O[3]),xe[de+5]=VG(O[2])<<8|15*O[0]<<4|15*O[1],xe[de+6]=q,xe[de+7]=ee,xe[de+8]=te,xe[de+9]=le}}(e,o.aabb.min[2],o.aabb.max[2]);const m=IL,y=e.node;let b=d&&!!y.lights;for(const S of o.featureData){const C=S>>i&65535,I=S>>l&15,M=I<8?I:0,R=10*M;let O=(61440&C|(61440&C)>>4)>>8,N=(3840&C|(3840&C)>>4)>>4,V=240&C|(240&C)>>4;const G=(15&C|(15&C)<<4)/255,K=m[R+3];K>0&&(O=Jt(O,m[R],K),N=Jt(N,m[R+1],K),V=Jt(V,m[R+2],K)),O*=G,N*=G,V*=G;const q=O<<8|N,ee=V<<8|m[R+4],te=m[R+5],le=m[R+6],xe=m[R+7],de=m[R+8],ve=m[R+9];if(p.emplaceBack(q,ee,te,le,xe,de,ve),b&&M===2){b=!1;const Se=10*y.lights.length,we=new ng;we.reserveExact(Se);for(let Fe=0;Fe<Se;Fe++)we.emplaceBack(q,ee,te,le,xe,de,ve);y.meshes[y.lightMeshIndex].featureArray=we}}}function jG(o,e,i){const l=o.node,d=i&xg.HasMeshoptCompression,p=d?0:16,m=d?16:0;for(let y=0;y<l.meshes.length;y++)l.lights&&l.lightMeshIndex===y||ML(l.meshes[y],o,p,m,e);if(l.lodMeshes)for(const y of l.lodMeshes)ML(y,o,p,m,!1)}Mt(_w,"Tiled3dModelBucket",{omit:["layers"]}),Mt(CL,"Tiled3dModelFeature");const UG=["id","tile","layer","source","sourceLayer","state"];class _p{constructor(e,i,l,d,p){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=l,this._y=d,this.properties=e?e.properties:{},this.id=p}clone(){const e=new _p(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 UG)this[i]!==void 0&&(e[i]=this[i]);return e}}class yp extends Au{constructor(e,i,l,d){super(),this.id=e,this.type="model",this.models=[],this._options=i,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(e,i){return YD(this.map._requestManager.transformRequest(e,Ac.Model).url,i)}async loadModel(e,i,l){try{const d=await this.loadGLTFFromURI(i.uri,l);if(l.aborted)return;const p=this._modelsInfo.get(e);if(!p)return;const m=QE(d),y=p.modelSpec,b=new nR(e,y.uri,y.position,y.orientation,m);yp.applyModelSpecification(b,y),b.computeBoundsAndApplyParent(),this.models.push(b),p.model=b}catch(d){if(d instanceof Error&&d.name==="AbortError")return;const p=d instanceof Error?d.message:"Unknown error";this.fire(new cm(new Error(`Could not load model ${e} from ${i.uri}: ${p}`)))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,i=[];for(const l in this._options.models){const d=this._options.models[l],p=this._modelsInfo.get(l);if(p&&p.model){p.modelSpec=d;const m=p.model;m.position=d.position!=null?new Qn(d.position[0],d.position[1]):new Qn(0,0),m.orientation=d.orientation!=null?d.orientation:[0,0,0],yp.applyModelSpecification(m,d),m.computeBoundsAndApplyParent(),this.models.push(m)}else p?p.modelSpec=d:(this._modelsInfo.set(l,{modelSpec:d,model:null}),i.push(this.loadModel(l,d,e)))}i.length!==0?(await Promise.allSettled(i),e.aborted||this.fire(new Xl("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new Xl("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,i){i.nodeOverrides&&yp.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&yp.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(l=>typeof l=="string")){e.nodeOverrideNames=[];for(const l of i)e.nodeOverrideNames.push(l)}else Object.entries(i).forEach(([l,d])=>{const p={orientation:[0,0,0],minZoom:void 0,maxZoom:void 0};if(Object.hasOwn(d,"orientation")){const m=d.orientation;m&&(p.orientation=m)}Object.hasOwn(d,"minzoom")&&(p.minZoom=d.minzoom),Object.hasOwn(d,"maxzoom")&&(p.maxZoom=d.maxzoom),e.nodeOverrides.set(l,p)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(l=>typeof l=="string")){e.materialOverrideNames=[];for(const l of i)e.materialOverrideNames.push(l)}else Object.entries(i).forEach(([l,d])=>{const p=d["model-color"],m={color:p!==void 0?new qn(p[0],p[1],p[2]):new qn(1,1,1),colorMix:0,emissionStrength:0,opacity:1},y=d["model-color-mix-intensity"];y!==void 0&&(m.colorMix=y);const b=d["model-emissive-strength"];b!==void 0&&(m.emissionStrength=b);const S=d["model-opacity"];S!==void 0&&(m.opacity=S),e.materialOverrides.set(l,m)})}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(){this.cancelModelRequests();const e=ov(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(e){this.cancelModelRequests()}setModels(e){this.models=[];const i=new Map;for(const l in e){const d=e[l],p=this._modelsInfo.get(l);p&&p.modelSpec.uri===d.uri&&i.set(l,p)}if(this._modelsInfo.size!==i.size){this.cancelModelRequests();for(const[l,d]of i)d.model||i.delete(l)}this._modelsInfo=i,this._options.models=e,this.load()}}function pk(o,e,i,l){const d=1<<o.z;e.lat=Si((l/St+o.y)/d),e.lng=cs((i/St+o.x)/d)}function GG(o,e,i,l){const d=o.getNodesInfo()[e];if(!d||d.hiddenByReplacement||!d.node.meshes)return;let p=Number.MAX_VALUE;const m=d.node,y=i.tile,b=l.calculatePosMatrix(y.tileID.toUnwrapped(),l.worldSize),S=d.evaluatedScale;let C=0;l.elevation&&m.elevation&&(C=m.elevation*l.elevation.exaggeration()),_e(b,b,[(m.anchor?m.anchor[0]:0)*(S[0]-1),(m.anchor?m.anchor[1]:0)*(S[1]-1),C]),De(b,b,S);const I=i.queryGeometry,M=I.isPointQuery()?I.screenBounds:I.screenGeometry,R=function(N){const V=he([],b,N.globalMatrix);he(V,l.expandedFarZProjMatrix,V);for(let G=0;G<N.meshes.length;++G){const K=N.meshes[G];if(G===N.lightMeshIndex)continue;const q=WE(M,l,V,K.aabb);q!=null&&(p=Math.min(q,p))}if(N.children)for(const G of N.children)R(G)};if(R(m),p===Number.MAX_VALUE)return;const O=new Qn(0,0);return pk(y.tileID.canonical,O,d.node.anchor[0],d.node.anchor[1]),{intersectionZ:p,position:O,feature:d.feature}}const $G={circle:class extends ds{constructor(o,e,i,l){super(o,{layout:wR||(wR=new fr({"circle-sort-key":new xt(Le.layout_circle["circle-sort-key"]),"circle-elevation-reference":new _t(Le.layout_circle["circle-elevation-reference"]),visibility:new _t(Le.layout_circle.visibility)})),paint:SR||(SR=new fr({"circle-radius":new xt(Le.paint_circle["circle-radius"]),"circle-color":new xt(Le.paint_circle["circle-color"]),"circle-blur":new xt(Le.paint_circle["circle-blur"]),"circle-opacity":new xt(Le.paint_circle["circle-opacity"]),"circle-translate":new _t(Le.paint_circle["circle-translate"]),"circle-translate-anchor":new _t(Le.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new _t(Le.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new _t(Le.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new xt(Le.paint_circle["circle-stroke-width"]),"circle-stroke-color":new xt(Le.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new xt(Le.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new _t(Le.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l)}createBucket(o){return new Ae(o)}queryRadius(o){const e=o;return wg("circle-radius",this,e)+wg("circle-stroke-width",this,e)+cw(this.paint.get("circle-translate"))}queryIntersectsFeature(o,e,i,l,d,p,m,y){const b=CR(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,o.pixelToTileUnitsFactor),S=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return MR(o,l,p,m,y,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",b,S)}getProgramIds(){return["circle"]}getDefaultProgramParams(o,e,i){const l=IR(this);return{config:new qu(this,{zoom:e,lut:i}),defines:l,overrideFog:!1}}is3D(o){return!o&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}mayUse(o){return o==="HD"&&Wm(this,"circle-elevation-reference",e=>e==="hd-road-markup")}prepare(){return this.mayUse("HD")?lw():Promise.resolve()}},heatmap:class extends ds{createBucket(o){return new DR(o)}constructor(o,e,i,l){super(o,{layout:RR||(RR=new fr({visibility:new _t(Le.layout_heatmap.visibility)})),paint:LR||(LR=new fr({"heatmap-radius":new xt(Le.paint_heatmap["heatmap-radius"]),"heatmap-weight":new xt(Le.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new _t(Le.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Bu(Le.paint_heatmap["heatmap-color"]),"heatmap-opacity":new _t(Le.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(o){o==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=c0({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(o){return wg("heatmap-radius",this,o)}queryIntersectsFeature(o,e,i,l,d,p,m,y){const b=this.paint.get("heatmap-radius").evaluate(e,i);return MR(o,l,p,m,y,!0,!0,new et(0,0),b)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(o,e,i){return o==="heatmap"?{config:new qu(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends ds{constructor(o,e,i,l){super(o,{layout:OR||(OR=new fr({visibility:new _t(Le.layout_hillshade.visibility)})),paint:FR||(FR=new fr({"hillshade-illumination-direction":new _t(Le.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new _t(Le.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new _t(Le.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new _t(Le.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new _t(Le.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new _t(Le.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new _t(Le.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l)}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(o,e,i){return{overrideFog:!1}}},fill:class extends ds{constructor(o,e,i,l){super(o,{layout:zR||(zR=new fr({"fill-sort-key":new xt(Le.layout_fill["fill-sort-key"]),visibility:new _t(Le.layout_fill.visibility),"fill-elevation-reference":new _t(Le.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new xt(Le.layout_fill["fill-construct-bridge-guard-rail"])})),paint:BR||(BR=new fr({"fill-antialias":new _t(Le.paint_fill["fill-antialias"]),"fill-opacity":new xt(Le.paint_fill["fill-opacity"]),"fill-color":new xt(Le.paint_fill["fill-color"]),"fill-outline-color":new xt(Le.paint_fill["fill-outline-color"]),"fill-translate":new _t(Le.paint_fill["fill-translate"]),"fill-translate-anchor":new _t(Le.paint_fill["fill-translate-anchor"]),"fill-pattern":new xt(Le.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new _t(Le.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new _t(Le.paint_fill["fill-emissive-strength"]),"fill-z-offset":new xt(Le.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new xt(Le.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new xt(Le.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l)}getProgramIds(){const o=this.paint.get("fill-pattern"),e=o&&o.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(o,e,i){return{config:new qu(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(o,e){super.recalculate(o,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(o){return new lg(o)}queryRadius(){return cw(this.paint.get("fill-translate"))}queryIntersectsFeature(o,e,i,l,d,p){return!o.queryGeometry.isAboveHorizon&&Ov(AR(o.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,o.pixelToTileUnitsFactor),l)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(o){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return o!=null?e&&!o:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}mayUse(o){return o==="HD"&&Wm(this,"fill-elevation-reference",e=>e!=="none")}prepare(){return this.mayUse("HD")?lw():Promise.resolve()}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends ds{constructor(o,e,i,l){super(o,{layout:jR||(jR=new fr({visibility:new _t(Le["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new _t(Le["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new _t(Le["layout_fill-extrusion"]["source-max-zoom"])})),paint:UR||(UR=new fr({"fill-extrusion-opacity":new _t(Le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new xt(Le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new _t(Le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new _t(Le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new xt(Le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new _t(Le["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new xt(Le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new xt(Le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new _t(Le["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new _t(Le["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new _t(Le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new _t(Le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new _t(Le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new _t(Le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new _t(Le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new _t(Le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new _t(Le["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new _t(Le["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new xt(Le["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new xt(Le["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new _t(Le["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new _t(Le["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new _t(Le["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new _t(Le["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new _t(Le["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new xt(Le["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new xt(Le["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new _t(Le["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(o){return new sw(o)}queryRadius(){return cw(this.paint.get("fill-extrusion-translate"))}is3D(o){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(o,e,i,l,d,p,m,y,b){const S=CR(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,o.pixelToTileUnitsFactor),C=this.paint.get("fill-extrusion-height").evaluate(e,i),I=this.paint.get("fill-extrusion-base").evaluate(e,i),M=[0,0],R=y&&p.elevation,O=p.elevation?p.elevation.exaggeration():1,N=o.tile.getBucket(this);if(N instanceof sw){const ee=N.centroidData.find(te=>b>=te.vertexArrayOffset&&b<te.vertexArrayOffset+te.vertexCount);if(ee&&ee.flags&tw)return!1;if(R){const te=N.centroidVertexArray,le=b+1;le<te.length&&(M[0]=te.geta_centroid_pos0(le),M[1]=te.geta_centroid_pos1(le))}}if(M[0]===0&&M[1]===1)return!1;p.projection.name==="globe"&&(l=xR([l],[new et(0,0),new et(St,St)],o.tileID.canonical).map(ee=>ee.polygon).flat());const V=R?y:null,[G,K]=KR(p,l,I,C,S,m,V,M,O,p.center.lat,o.tileID.canonical),q=o.queryGeometry;return XR(G,K,q.isPointQuery()?q.screenBounds:q.screenGeometry)}},building:class extends ds{constructor(o,e,i,l){super(o,{layout:GR||(GR=new fr({visibility:new _t(Le.layout_building.visibility),"building-facade":new xt(Le.layout_building["building-facade"]),"building-facade-floors":new xt(Le.layout_building["building-facade-floors"]),"building-facade-unit-width":new xt(Le.layout_building["building-facade-unit-width"]),"building-facade-window":new xt(Le.layout_building["building-facade-window"]),"building-roof-shape":new xt(Le.layout_building["building-roof-shape"]),"building-height":new xt(Le.layout_building["building-height"]),"building-base":new xt(Le.layout_building["building-base"]),"building-flood-light-wall-radius":new xt(Le.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new xt(Le.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new xt(Le.layout_building["building-flip-roof-orientation"])})),paint:$R||($R=new fr({"building-opacity":new _t(Le.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new _t(Le.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new _t(Le.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new _t(Le.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new _t(Le.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new _t(Le.paint_building["building-vertical-scale"]),"building-cast-shadows":new _t(Le.paint_building["building-cast-shadows"]),"building-color":new xt(Le.paint_building["building-color"]),"building-emissive-strength":new xt(Le.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new _t(Le.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new _t(Le.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new _t(Le.paint_building["building-front-cutoff"]),"building-flood-light-color":new _t(Le.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new _t(Le.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new _t(Le.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(o){return o==="HD"}prepare(){return async function(){return function(){if(!xs(self)||Ja!=null||TR!=null)return null;if(bg!=null)return bg;const o=fetch(tb());return bg=function(e){let i,l,d,p,m;function y(){i=new Uint8Array(m.buffer),l=new Int16Array(m.buffer),d=new Int32Array(m.buffer),p=new Float32Array(m.buffer)}function b(){throw new Error("Unexpected BuildingGen error.")}const S=()=>{},C={a:{a:b,f:function(I){const M=i.length,R=Math.max(I>>>0,Math.ceil(1.2*M)),O=Math.ceil((R-M)/65536);try{return m.grow(O),y(),!0}catch{return!1}},g:b,b:S,c:S,d:S,e:S}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,C):e.then(I=>I.arrayBuffer()).then(I=>WebAssembly.instantiate(I,C))).then(I=>{const M=I.instance.exports;return(0,M.g)(),m=M.f,y(),new CG({setStyle:M.h,setAOOptions:M.i,setMetricOptions:M.j,setStructuralOptions:M.k,setFacadeOptions:M.l,setFauxFacadeOptions:M.m,setFacadeClassifierOptions:M.n,addFeature:M.o,addFacade:M.p,generateMesh:M.q,getLastError:M.r,getOuterRingLength:M.s,getMeshCount:M.t,getPositionsPtr:M.u,getPositionsLength:M.v,getNormalsPtr:M.w,getNormalsLength:M.x,getAOPtr:M.y,getAOLength:M.z,getUVPtr:M.A,getUVLength:M.B,getFauxFacadePtr:M.C,getFauxFacadeLength:M.D,getIndicesPtr:M.E,getIndicesLength:M.F,getBuildingPart:M.G,getRingCount:M.H,getRingPtr:M.I,getRingLength:M.J,malloc:M.K,free:M.L,heapU8:i,heap16:l,heap32:d,heapF32:p})})}(o).then(e=>{bg=null,Ja=e}).catch(e=>{Cn("Could not load building-gen"),bg=null,TR=e}),bg}()}()}createBucket(o){return new ER(o)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(o){return!0}queryRadius(o){return 0}queryIntersectsFeature(o,e,i,l,d,p,m,y,b,S){let C=this.layout.get("building-height").evaluate(e,i);const I=this.layout.get("building-base").evaluate(e,i),M=o.tile.getBucket(this).getFootprint(e);if(M){if(M.hiddenFlags!==0)return!1;C=M.height}const[R,O]=KR(p,l,I,C,new et(0,0),m,null,[0,0],1,p.center.lat,o.tileID.canonical),N=o.queryGeometry;return XR(R,O,N.isPointQuery()?N.screenBounds:N.screenGeometry)}},line:class extends ds{constructor(o,e,i,l){const d=rL();super(o,d,e,i,l),d.layout&&(this.layout=new Gc(d.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Af,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}else o==="line-gradient-use-theme"&&(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(o,e){super.recalculate(o,e),this.paint._values["line-floorwidth"]=(()=>{if(d0)return d0;const i=rL();return d0=new zG(i.paint.properties["line-width"].specification),d0.useIntegerZoom=!0,d0})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new J(o)}getProgramIds(){const o=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return this.paint.get("line-blend-mode")!=="default"&&o.push("lineBlendComposite"),o}getDefaultProgramParams(o,e,i){if(o==="lineBlendComposite")return{};const l=tL(this);return{config:new qu(this,{zoom:e,lut:i}),defines:l,overrideFog:!1}}queryRadius(o){const e=o,i=sL(wg("line-width",this,e),wg("line-gap-width",this,e)),l=wg("line-offset",this,e);return i/2+Math.abs(l)+cw(this.paint.get("line-translate"))}queryIntersectsFeature(o,e,i,l,d,p){if(o.queryGeometry.isAboveHorizon)return!1;const m=AR(o.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,o.pixelToTileUnitsFactor),y=o.pixelToTileUnitsFactor/2*sL(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),b=this.paint.get("line-offset").evaluate(e,i);return b&&(l=function(S,C){const I=[],M=new et(0,0);for(let R=0;R<S.length;R++){const O=S[R],N=[];for(let V=0;V<O.length;V++){const G=O[V],K=O[V+1],q=V===0?M:G.sub(O[V-1])._unit()._perp(),ee=V===O.length-1?M:K.sub(G)._unit()._perp(),te=q._add(ee)._unit();te._mult(1/(te.x*ee.x+te.y*ee.y)),N.push(te._mult(C)._add(G))}I.push(N)}return I}(l,b*o.pixelToTileUnitsFactor)),function(S,C,I){for(let M=0;M<C.length;M++){const R=C[M];if(S.length>=3){for(let O=0;O<R.length;O++)if(Qc(S,R[O]))return!0}if(iE(S,R,I))return!0}return!1}(m,l,y)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(o){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"}mayUse(o){return o==="HD"&&Wm(this,"line-elevation-reference",e=>e==="hd-road-markup")}prepare(){return this.mayUse("HD")?lw():Promise.resolve()}hasOffscreenPass(){return this.paint.get("line-blend-mode")!=="default"&&this.paint.get("line-opacity").constantOr(1)!==0&&this.paint.get("line-width").constantOr(1)!==0&&this.visibility!=="none"}resize(){this._destroyLineBlendFbo()}onRemove(o){this._destroyLineBlendFbo(o.painter&&o.painter.context&&o.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(o){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),o&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(o),this.lineBlendDensityReadback=null}},symbol:uw,background:class extends ds{constructor(o,e,i,l){super(o,{layout:cL||(cL=new fr({visibility:new _t(Le.layout_background.visibility)})),paint:uL||(uL=new fr({"background-pitch-alignment":new _t(Le.paint_background["background-pitch-alignment"]),"background-color":new _t(Le.paint_background["background-color"]),"background-pattern":new _t(Le.paint_background["background-pattern"]),"background-opacity":new _t(Le.paint_background["background-opacity"]),"background-emissive-strength":new _t(Le.paint_background["background-emissive-strength"]),"background-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(o,e,i){return{overrideFog:!1}}is3D(o){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:mL,"raster-particle":SL,sky:class extends ds{constructor(o,e,i,l){super(o,{layout:yL||(yL=new fr({visibility:new _t(Le.layout_sky.visibility)})),paint:vL||(vL=new fr({"sky-type":new _t(Le.paint_sky["sky-type"]),"sky-atmosphere-sun":new _t(Le.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new _t(Le.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new _t(Le.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new _t(Le.paint_sky["sky-gradient-radius"]),"sky-gradient":new Bu(Le.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new _t(Le.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new _t(Le.paint_sky["sky-atmosphere-color"]),"sky-opacity":new _t(Le.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(o){o==="sky-gradient"?this._updateColorRamp():o!=="sky-atmosphere-sun"&&o!=="sky-atmosphere-halo-color"&&o!=="sky-atmosphere-color"&&o!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=c0({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(o){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=o.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(o,e){if(this.paint.get("sky-type")==="atmosphere"){const l=this.paint.get("sky-atmosphere-sun"),d=!l,p=o.style.light,m=p.properties.get("position");return d&&p.properties.get("anchor")==="viewport"&&Cn("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),d?dk(m.azimuthal,90-m.polar,e):dk(l[0],90-l[1],e)}const i=this.paint.get("sky-gradient-center");return dk(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(o){this._skyboxInvalidated=!1,this._lightPosition=o.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const o=this.paint.get("sky-type");return o==="atmosphere"?["skyboxCapture","skybox"]:o==="gradient"?["skyboxGradient"]:null}},slot:class extends ds{constructor(o,e,i,l){super(o,{paint:xL||(xL=new fr({}))},e,null)}},model:class extends ds{constructor(o,e,i,l){super(o,{layout:bL||(bL=new fr({visibility:new _t(Le.layout_model.visibility),"model-id":new xt(Le.layout_model["model-id"]),"model-allow-density-reduction":new _t(Le.layout_model["model-allow-density-reduction"])})),paint:wL||(wL=new fr({"model-opacity":new xt(Le.paint_model["model-opacity"]),"model-rotation":new xt(Le.paint_model["model-rotation"]),"model-scale":new xt(Le.paint_model["model-scale"]),"model-translation":new xt(Le.paint_model["model-translation"]),"model-color":new xt(Le.paint_model["model-color"]),"model-color-mix-intensity":new xt(Le.paint_model["model-color-mix-intensity"]),"model-type":new _t(Le.paint_model["model-type"]),"model-cast-shadows":new _t(Le.paint_model["model-cast-shadows"]),"model-receive-shadows":new _t(Le.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new _t(Le.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new xt(Le.paint_model["model-emissive-strength"]),"model-roughness":new xt(Le.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new xt(Le.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new _t(Le.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new _t(Le.paint_model["model-front-cutoff"]),"model-elevation-reference":new _t(Le.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new _t(Le.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new xt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,l),this.layer=o,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(o){return o==="Standard"}prepare(){return async function(){return Promise.resolve()}()}createBucket(o){return new hk(o)}getProgramIds(){return["model"]}is3D(o){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(o){return o instanceof _w?8191:0}queryRenderedFeatures(o,e,i){const l=e.getSource();if(!(l&&l instanceof yp))return{};const d=l,p={};p[this.id]=[];const m=p[this.id];let y=0;for(const b of d.models){const S=e.getFeatureState(this.sourceLayer,b.id),C={type:"Unknown",id:b.id,properties:b.featureProperties},I=this.paint.get("model-rotation").evaluate(C,S),M=this.paint.get("model-scale").evaluate(C,S),R=this.paint.get("model-translation").evaluate(C,S),O=this.paint.get("model-elevation-reference");let N=[];K1(N,b,i,b.position,I,M,R,O==="ground",O==="ground",!1),i.projection.name==="globe"&&(N=X1(N,i));const V=he([],i.projMatrix,N),G=WE(o.isPointQuery()?o.screenBounds:o.screenGeometry,i,V,b.aabb);if(G!=null){const K=new _p(void 0,0,0,0,b.id);K.layer=this.layer,K.properties=structuredClone(b.featureProperties),K.properties.layer=this.id,K.properties.uri=b.uri,K.properties.orientation=b.orientation,K.sourceLayer=this.sourceLayer,K.geometry={type:"Point",coordinates:[b.position.lng,b.position.lat]},K.state=S,K.source=this.source,m.push({featureIndex:y,feature:K,intersectionZ:G})}++y}return p}queryIntersectsFeature(o,e,i,l,d,p,m,y,b,S){if(!this.modelManager)return!1;const C=this.modelManager,I=o.tile.getBucket(this);if(!(I&&I instanceof hk))return!1;for(const M in I.instancesPerModel){const R=I.instancesPerModel[M],O=e.id!==void 0?e.id:e.properties&&Object.hasOwn(e.properties,"id")?e.properties.id:void 0;if(Object.hasOwn(R.idToFeaturesIndex,O)){const N=R.features[R.idToFeaturesIndex[O]],V=C.getModel(M,S||this.scope);if(!V)return!1;let G=[];const K=new Qn(0,0),q=I.canonical;let ee=Number.MAX_VALUE;for(let te=0;te<N.instancedDataCount;++te){const le=16*(N.instancedDataOffset+te),xe=R.instancedDataArray.float32,de=[xe[le+4],xe[le+5],xe[le+6]];pk(q,K,Math.floor(xe[le]),Math.floor(xe[le+1])),K1(G,V,p,K,N.rotation,N.scale,de,!1,!1,!1),p.projection.name==="globe"&&(G=X1(G,p));const ve=he([],p.projMatrix,G),Se=o.queryGeometry,we=WE(Se.isPointQuery()?Se.screenBounds:Se.screenGeometry,p,ve,V.aabb);we!=null&&(ee=Math.min(we,ee))}return ee!==Number.MAX_VALUE&&ee}}return!1}_handleOverridablePaintPropertyUpdate(o,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||o!=="model-color"&&o!=="model-color-mix-intensity"&&o!=="model-rotation"&&o!=="model-scale"&&o!=="model-translation"&&o!=="model-emissive-strength")}_isPropertyZoomDependent(o){const e=this._transitionablePaint._values[o];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Bd}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends ds{constructor(o,e,i,l){super(o,{layout:NR||(NR=new fr({"clip-layer-types":new _t(Le.layout_clip["clip-layer-types"]),"clip-layer-scope":new _t(Le.layout_clip["clip-layer-scope"]),visibility:new _t(Le.layout_clip.visibility)})),paint:VR||(VR=new fr({}))},e,i,l)}recalculate(o,e){super.recalculate(o,e)}createBucket(o){return new qR(o)}is3D(o){return!0}}};class mk{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)}}Mt(mk,"LRUCache");class HG{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&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}class PL{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const l=e[i];this._stringToNumber[l]=i,this._numberToString[i]=l}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class DL{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Vf(St,St,512),this.featureIndexArray=new tp,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,l,d,p,m=0,y=0){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,d,p,m);const S=this.grid;for(let C=0;C<i.length;C++){const I=i[C],M=[1/0,1/0,-1/0,-1/0];for(let R=0;R<I.length;R++){const O=I[R];M[0]=Math.min(M[0],O.x),M[1]=Math.min(M[1],O.y),M[2]=Math.max(M[2],O.x),M[3]=Math.max(M[3],O.y)}y!==0&&(M[0]-=y,M[1]-=y,M[2]+=y,M[3]+=y),M[0]<St&&M[1]<St&&M[2]>=0&&M[3]>=0&&S.insert(b,M[0],M[1],M[2],M[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Rv(new En(this.rawTileData)).layers,this.sourceLayerCoder=new PL(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:l,transform:d,tileTransform:p,pixelPosMatrix:m,availableImages:y,worldview:b}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const S=i.queryRadius?i.queryRadius:0,C=l.bufferedTilespaceBounds,I=this.grid.queryKeys(C.min.x,C.min.y,C.max.x,C.max.y,(N,V,G,K)=>v1(l.bufferedTilespaceGeometry,N-S,V-S,G+S,K+S));I.sort(WG);let M=null;d.elevation&&I.length>0&&(M=Sg.create(d.elevation,this.tileID));const R={};let O;for(let N=0;N<I.length;N++){const V=I[N];if(V===O)continue;O=V;const G=this.featureIndexArray.get(V);let K=null;this.is3DTile?this.loadMatchingModelFeature(R,G,e,l,d,b):this.loadMatchingFeature(R,G,e,y,b,(q,ee,te,le=0)=>(K||(K=Js(q,this.tileID.canonical,p)),ee.queryIntersectsFeature(l,q,te,K,this.z,d,m,M,le,i.scope)))}return R}loadMatchingFeature(e,i,l,d,p,m){const{featureIndex:y,bucketIndex:b,sourceLayerIndex:S,layoutVertexArrayOffset:C}=i,I=this.bucketLayerIDs[b],M=l.layers,R=Object.keys(M);if(R.length&&!Ii(R,I))return;const O=l.sourceCache,N=this.sourceLayerCoder.decode(S),V=this.vtLayers[N].feature(y),G=this.getId(V,N);for(let K=0;K<I.length;K++){const q=I[K];if(!M[q])continue;const{styleLayer:ee,targets:te}=M[q];let le={};G!==void 0&&(le=O.getFeatureState(ee.sourceLayer,G));const xe=!m||m(V,ee,le,C);if(!xe)continue;const de=new _p(V,this.z,this.x,this.y,G);de.tile=this.tileID.canonical,de.state=le;let ve=this.serializedLayersCache.get(q);ve||(ve=ee.serialize(),ve.id=q,this.serializedLayersCache.set(q,ve)),de.source=ve.source,de.sourceLayer=ve["source-layer"],de.layer=Object.assign({},ve),de.layer.paint=RL(ve.paint,ee.paint,V,le,d),de.layer.layout=RL(ve.layout,ee.layout,V,le,d);let Se=!1;for(const we of te){this.updateFeatureProperties(de,we);const{filter:Fe}=we;if(Fe){if(V.properties=de.properties,Fe.needGeometry){const Ve=Ls(V,!0);if(!Fe.filter(new Yn(this.tileID.overscaledZ,{worldview:p}),Ve,this.tileID.canonical))continue}else if(!Fe.filter(new Yn(this.tileID.overscaledZ,{worldview:p}),V))continue}Se=!0,we.targetId&&this.addFeatureVariant(de,we)}Se&&this.appendToResult(e,q,y,de,xe)}}loadMatchingModelFeature(e,i,l,d,p,m){const{featureIndex:y,bucketIndex:b}=i,S=this.bucketLayerIDs[b],C=l.layers,I=Object.keys(C);if(!I.length||Ii(I,S))for(let M=0;M<S.length;M++){const R=S[M],{styleLayer:O,targets:N}=C[R];if(O.type!=="model")continue;const V=d.tile,G=V.getBucket(O);if(!(G&&G instanceof _w))continue;const K=GG(G,y,d,p);if(!K)continue;const{z:q,x:ee,y:te}=V.tileID.canonical,{feature:le,intersectionZ:xe,position:de}=K;let ve={};le.id!==void 0&&(ve=l.sourceCache.getFeatureState(O.sourceLayer,le.id));const Se=new _p({},q,ee,te,le.id);Se.tile=this.tileID.canonical,Se.state=ve,Se.properties=le.properties,Se.geometry={type:"Point",coordinates:[de.lng,de.lat]};let we=this.serializedLayersCache.get(R);we||(we=O.serialize(),we.id=R,this.serializedLayersCache.set(R,we)),Se.source=we.source,Se.sourceLayer=we["source-layer"],Se.layer=Object.assign({},we);let Fe=!1;for(const Ve of N){this.updateFeatureProperties(Se,Ve);const{filter:qe}=Ve;if(qe){if(le.properties=Se.properties,qe.needGeometry){if(!qe.filter(new Yn(this.tileID.overscaledZ,{worldview:m}),le,this.tileID.canonical))continue}else if(!qe.filter(new Yn(this.tileID.overscaledZ,{worldview:m}),le))continue}Fe=!0,Ve.targetId&&this.addFeatureVariant(Se,Ve)}Fe&&this.appendToResult(e,R,y,Se,xe)}}updateFeatureProperties(e,i,l){if(i.properties){const d={};for(const p in i.properties){const m=i.properties[p].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,l);m!=null&&(d[p]=m)}e.properties=d}}addFeatureVariant(e,i,l){const d={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(d.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(d)}appendToResult(e,i,l,d,p){let m=e[i];m===void 0&&(m=e[i]=[]),m.push({featureIndex:l,feature:d,intersectionZ:p})}lookupSymbolFeatures(e,i,l,d,p,m){const y={};this.loadVTLayers();for(const b of e)this.loadMatchingFeature(y,{bucketIndex:i,sourceLayerIndex:l,featureIndex:b,layoutVertexArrayOffset:0},d,p,m);return y}loadFeature(e){const{featureIndex:i,sourceLayerIndex:l}=e;this.loadVTLayers();const d=this.sourceLayerCoder.decode(l),p=this.vtFeatures[d];if(p[i])return p[i];const m=this.vtLayers[d].feature(i);return p[i]=m,m}hasLayer(e){for(const i of this.bucketLayerIDs)for(const l of i)if(e===l)return!0;return!1}getId(e,i){let l=e.id;if(this.promoteId){const d=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(d!=null)if(Array.isArray(d)){if(!this.promoteIdExpression){const p=Ql(d);if(p.result!=="success"){const m=p.value.map(y=>`${y.key}: ${y.message}`).join(", ");return void Cn(`Failed to create expression for promoteId: ${m}`)}this.promoteIdExpression=p.value}l=this.promoteIdExpression.evaluate({zoom:0},e)}else l=e.properties[d];typeof l=="boolean"&&(l=Number(l))}return l}}function RL(o,e,i,l,d){return Nn(o,(p,m)=>{const y=e instanceof Gc?e.get(m):null;return y&&y.evaluate?y.evaluate(i,l,void 0,d):y})}function WG(o,e){return e-o}function LL(o,e){const i={};if(!e)return i;for(const l of o){const d=l.layerIds.map(p=>e.getLayer(p)).filter(Boolean);if(d.length!==0){l.layers=d,l.stateDependentLayerIds&&(l.stateDependentLayers=l.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0])),l.updateExpressions&&l.updateExpressions(d);for(const p of d)i[p.fqid]=l}}return i}Mt(DL,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Ll=32,ru=33,dh=new Uint16Array(8184);for(let o=0;o<2046;o++){let e=o+2,i=0,l=0,d=0,p=0,m=0,y=0;for(1&e?d=p=m=Ll:i=l=y=Ll;(e>>=1)>1;){const S=i+d>>1,C=l+p>>1;1&e?(d=i,p=l,i=m,l=y):(i=d,l=p,d=m,p=y),m=S,y=C}const b=4*o;dh[b+0]=i,dh[b+1]=l,dh[b+2]=d,dh[b+3]=p}const iu=new Uint16Array(2178),hh=new Uint8Array(1089),yw=new Uint16Array(1089);function OL(o){return o===0?-.03125:o===32?.03125:0}const FL={Other:0,Symbol:1,FillExtrusion:2,HdRoadCoverage:3},zL={type:2,extent:St,loadGeometry:()=>[[new et(0,0),new et(8193,0),new et(8193,8193),new et(0,8193),new et(0,0)]]};class qG{constructor(){this.tasks=new Map,mn(["process"],this),this.invoker=new HG(this.process),this.nextId=0}add(e,i){const l=this.nextId++,d=function({type:p,renderSourceType:m,zoom:y}){y=y||0;const b=m===FL.Symbol;return p==="message"?0:p!=="maybePrepare"||b?p!=="parseTile"||b?p==="parseTile"&&b?300-y:p==="maybePrepare"&&b?400-y:500:200-y:100-y}(i);if(d===0){try{e()}finally{}return null}return this.tasks.set(l,{fn:e,metadata:i,priority:d,id:l}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(l)}}}process(){try{const e=this.pick();if(!e)return;this.tasks.delete(e.id),this.tasks.size>0&&this.invoker.trigger(),e.fn()}finally{}}pick(){let e=null,i=1/0;for(const l of this.tasks.values())l.priority<i&&(i=l.priority,e=l);return e}remove(){this.tasks.clear(),this.invoker.remove()}}function ZG(o,e){const i={};let l;for(;l=o.nextField(e);)l===1?(i.delta_filter=XG(o,o.readVarint()+o.pos),i.filter="delta_filter"):l===2?(o.readVarint(),i.filter="zigzag_filter"):l===3?(o.readVarint(),i.filter="bitshuffle_filter"):l===4&&(o.readVarint(),i.filter="byteshuffle_filter");return i}function XG(o,e){const i={blockSize:0};let l;for(;l=o.nextField(e);)l===1&&(i.blockSize=o.readVarint());return i}function KG(o,e){const i={};let l;for(;l=o.nextField(e);)l===1?(o.readVarint(),i.codec="gzip_data"):l===2?(o.readVarint(),i.codec="jpeg_image"):l===3?(o.readVarint(),i.codec="webp_image"):l===4&&(o.readVarint(),i.codec="png_image");return i}function YG(o,e){const i={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]};let l,d=0,p=0;for(;l=o.nextField(e);)l===1?i.firstByte=o.readFixed64():l===2?i.lastByte=o.readFixed64():l===3?i.filters.push(ZG(o,o.readVarint()+o.pos)):l===4?i.codec=KG(o,o.readVarint()+o.pos):l===5?p=o.readFloat():l===6?d=o.readFloat():l===7?i.bands.push(o.readString()):l===8?i.offset=o.readDouble():l===9&&(i.scale=o.readDouble());return i.offset===0&&(i.offset=p),i.scale===0&&(i.scale=d),i}function QG(o,e){const i={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};let l;for(;l=o.nextField(e);)l===1?i.version=o.readVarint():l===2?i.name=o.readString():l===3?i.units=o.readString():l===4?i.tileSize=o.readVarint():l===5?i.buffer=o.readVarint():l===6?i.pixelFormat=o.readVarint():l===7&&i.dataIndex.push(YG(o,o.readVarint()+o.pos));return i}function JG(o,e,i){let l;for(;l=o.nextField(e);)if(l===1){let d=0;const p=o.readVarint()+o.pos;for(;o.pos<p;)i[d++]=o.readVarint()}return i}function e$(o,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let l=2;l>=1;l--){const d=l===1?1:0,p=l===2?1:0;for(let m=0;m<e[0];m++){const y=e[1]*m;for(let b=d;b<e[1];b++){const S=e[2]*(b+y);for(let C=p;C<e[2];C++){const I=e[3]*(C+S);for(let M=0;M<e[3];M++){const R=I+M;o[R]+=o[R-i]}}}}i*=e[l]}return o}function t$(o){for(let e=0,i=o.length;e<i;e++)o[e]=o[e]>>>1^-(1&o[e]);return o}function n$(o,e){switch(e){case"uint32":return o;case"uint16":for(let i=0;i<o.length;i+=2){const l=o[i],d=o[i+1];o[i]=(240&l)>>4|(61440&l)>>8|(240&d)<<4|61440&d,o[i+1]=15&l|(3840&l)>>4|(15&d)<<8|(3840&d)<<4}return o;case"uint8":for(let i=0;i<o.length;i+=4){const l=o[i],d=o[i+1],p=o[i+2],m=o[i+3];o[i+0]=(192&l)>>6|(192&d)>>4|(192&p)>>2|192&m,o[i+1]=(48&l)>>4|(48&d)>>2|48&p|(48&m)<<2,o[i+2]=(12&l)>>2|12&d|(12&p)<<2|(12&m)<<4,o[i+3]=3&l|(3&d)<<2|(3&p)<<4|(3&m)<<6}return o;default:throw new Error(`Invalid pixel format, "${e}"`)}}var el=Uint8Array,f0=Uint16Array,r$=Int32Array,BL=new el([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]),NL=new el([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]),i$=new el([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VL=function(o,e){for(var i=new f0(31),l=0;l<31;++l)i[l]=e+=1<<o[l-1];var d=new r$(i[30]);for(l=1;l<30;++l)for(var p=i[l];p<i[l+1];++p)d[p]=p-i[l]<<5|l;return{b:i,r:d}},jL=VL(BL,2),UL=jL.b,o$=jL.r;UL[28]=258,o$[258]=28;for(var s$=VL(NL,0).b,GL=new f0(32768),Wi=0;Wi<32768;++Wi){var Tg=(43690&Wi)>>1|(21845&Wi)<<1;GL[Wi]=((65280&(Tg=(61680&(Tg=(52428&Tg)>>2|(13107&Tg)<<2))>>4|(3855&Tg)<<4))>>8|(255&Tg)<<8)>>1}var p0=function(o,e,i){for(var l=o.length,d=0,p=new f0(e);d<l;++d)o[d]&&++p[o[d]-1];var m,y=new f0(e);for(d=1;d<e;++d)y[d]=y[d-1]+p[d-1]<<1;m=new f0(1<<e);var b=15-e;for(d=0;d<l;++d)if(o[d])for(var S=d<<4|o[d],C=e-o[d],I=y[o[d]-1]++<<C,M=I|(1<<C)-1;I<=M;++I)m[GL[I]>>b]=S;return m},m0=new el(288);for(Wi=0;Wi<144;++Wi)m0[Wi]=8;for(Wi=144;Wi<256;++Wi)m0[Wi]=9;for(Wi=256;Wi<280;++Wi)m0[Wi]=7;for(Wi=280;Wi<288;++Wi)m0[Wi]=8;var $L=new el(32);for(Wi=0;Wi<32;++Wi)$L[Wi]=5;var a$=p0(m0,9),l$=p0($L,5),gk=function(o){for(var e=o[0],i=1;i<o.length;++i)o[i]>e&&(e=o[i]);return e},ac=function(o,e,i){var l=e/8|0;return(o[l]|o[l+1]<<8)>>(7&e)&i},_k=function(o,e){var i=e/8|0;return(o[i]|o[i+1]<<8|o[i+2]<<16)>>(7&e)},c$=function(o){return(o+7)/8|0},u$=["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"],lc=function(o,e,i){var l=new Error(e||u$[o]);if(l.code=o,Error.captureStackTrace&&Error.captureStackTrace(l,lc),!i)throw l;return l},d$=new el(0),h$=typeof TextDecoder<"u"&&new TextDecoder;try{h$.decode(d$,{stream:!0})}catch{}const f$={gzip_data:"gzip"};class Ol extends Error{constructor(e){super(e),this.name="MRTError"}}const p$={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},HL={uint32:1,uint16:2,uint8:4},m$={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let yk;class vw{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 Ol(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),l=new DataView(e);if(i[0]!==13)throw new Ol("File is not a valid MRT.");return l.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),l=this.getHeaderLength(e);if(i.length<l)throw new Ol(`Expected header with length >= ${l} but got buffer of length ${i.length}`);const d=function(p){const m={headerLength:0,x:0,y:0,z:0,layers:[]};let y;for(;y=p.nextField(void 0);)y===1?m.headerLength=p.readFixed32():y===2?m.x=p.readVarint():y===3?m.y=p.readVarint():y===4?m.z=p.readVarint():y===5&&m.layers.push(QG(p,p.readVarint()+p.pos));return m}(new yk(i.subarray(0,l)));if(!isNaN(this.x)&&(this.x!==d.x||this.y!==d.y||this.z!==d.z))throw new Ol(`Invalid attempt to parse header ${d.z}/${d.x}/${d.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=d.x,this.y=d.y,this.z=d.z;for(const p of d.layers)this.layers[p.name]=new WL(p,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],l=this.getLayer(e.layerName);for(let d of e.blockIndices){const p=l.dataIndex[d],m=p.firstByte-e.firstByte,y=p.lastByte-e.firstByte;if(l._blocksInProgress.has(d))continue;const b={layerName:l.name,firstByte:m,lastByte:y,pixelFormat:l.pixelFormat,blockIndex:d,blockShape:[p.bands.length].concat(l.bandShape),buffer:l.buffer,codec:p.codec.codec,filters:p.filters.map(S=>S.filter)};l._blocksInProgress.add(d),i.push(b)}return new qL(i,()=>{i.forEach(d=>l._blocksInProgress.delete(d.blockIndex))},(d,p)=>{if(i.forEach(m=>l._blocksInProgress.delete(m.blockIndex)),d)throw d;p.forEach(m=>{this.getLayer(m.layerName).processDecodedData(m)})})}}class WL{constructor({version:e,name:i,units:l,tileSize:d,pixelFormat:p,buffer:m,dataIndex:y},b){if(this.version=e,this.version!==1)throw new Ol(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=l,this.tileSize=d,this.buffer=m,this.pixelFormat=p$[p],this.dataIndex=y,this.bandShape=[d+2*m,d+2*m,HL[this.pixelFormat]],this._decodedBlocks=new mk(b?b.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return HL[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[l,d]of this.dataIndex.entries()){for(const[p,m]of d.bands.entries())if(m===e)return{bandIndex:i+p,blockIndex:l,blockBandIndex:p};i+=d.bands.length}break;case"number":for(const[l,d]of this.dataIndex.entries()){if(e>=i&&e<i+d.bands.length)return{bandIndex:e,blockIndex:l,blockBandIndex:e-i};i+=d.bands.length}break;default:throw new Ol(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,l=-1/0;const d=[],p=new Set;for(const m of e){const{blockIndex:y}=this.getBlockForBand(m);if(y<0)throw new Ol(`Invalid band: ${JSON.stringify(m)}`);const b=this.dataIndex[y];d.includes(y)||d.push(y),p.add(y),i=Math.min(i,b.firstByte),l=Math.max(l,b.lastByte)}if(p.size>this.cacheSize)throw new Ol(`Number of blocks to decode (${p.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:l,blockIndices:d}}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:l}=this.getBlockForBand(e);if(i<0)throw new Ol(`Band not found: ${JSON.stringify(e)}`);const d=this._decodedBlocks.get(i.toString());if(!d)throw new Ol(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const p=this.dataIndex[i],m=this.bandShape.reduce((S,C)=>S*C,1),y=l*m,b=d.subarray(y,y+m);return{data:b,bytes:new Uint8Array(b.buffer).subarray(b.byteOffset,b.byteOffset+b.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:p.offset,scale:p.scale}}}vw.setPbf=function(o){yk=o};class qL{constructor(e,i,l){this.tasks=e,this._onCancel=i,this._onComplete=l,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}function ZL(o,e,i){try{e=function(d){if(!d.variants)return d;if(!Array.isArray(d.variants))throw new Error("variants must be an array");for(const p of d.variants){if(p==null||typeof p!="object"||p.constructor!==Object)throw new Error("variant must be an object");if(!Array.isArray(p.capabilities))throw new Error("capabilities must be an array");if(p.capabilities.length===1&&p.capabilities[0]==="meshopt")return Object.assign(d,p)}return d}(e)}catch(d){return new Error("Failed to process TileJSON variants",{cause:d})}const l=jt(Object.assign({},e,o),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return o.url&&e.tiles&&o.tiles&&(l.tiles=e.tiles),l.tiles=i.canonicalizeTileset(l,o.url),l}vw.performDecoding=function(o,e){const i=new Uint8Array(o);return Promise.all(e.tasks.map(l=>{const{layerName:d,firstByte:p,lastByte:m,pixelFormat:y,blockShape:b,blockIndex:S,filters:C,codec:I}=l,M=i.subarray(p,m+1),R=new Uint32Array(b[0]*b[1]*b[2]);let O;if(I!=="gzip_data")throw new Ol(`Unhandled codec: ${I}`);return O=function(N,V){if(!globalThis.DecompressionStream&&V==="gzip_data")return Promise.resolve((te=function(de){de[0]==31&&de[1]==139&&de[2]==8||lc(6,"invalid gzip data");var ve=de[3],Se=10;4&ve&&(Se+=2+(de[10]|de[11]<<8));for(var we=(ve>>3&1)+(ve>>4&1);we>0;we-=!de[Se++]);return Se+(2&ve)}(G=N),te+8>G.length&&lc(6,"invalid gzip data"),function(de,ve,Se,we){var Fe=de.length;if(!Fe||ve.f&&!ve.l)return Se||new el(0);var Ve=!Se,qe=Ve||ve.i!=2,Ke=ve.i;Ve&&(Se=new el(3*Fe));var je=function(Pi){var Pr=Se.length;if(Pi>Pr){var ho=new el(Math.max(2*Pr,Pi));ho.set(Se),Se=ho}},at=ve.f||0,Ge=ve.p||0,$e=ve.b||0,Ye=ve.l,rt=ve.d,lt=ve.m,yt=ve.n,tt=8*Fe;do{if(!Ye){at=ac(de,Ge,1);var mt=ac(de,Ge+1,3);if(Ge+=3,!mt){var bt=de[(ar=c$(Ge)+4)-4]|de[ar-3]<<8,Ft=ar+bt;if(Ft>Fe){Ke&&lc(0);break}qe&&je($e+bt),Se.set(de.subarray(ar,Ft),$e),ve.b=$e+=bt,ve.p=Ge=8*Ft,ve.f=at;continue}if(mt==1)Ye=a$,rt=l$,lt=9,yt=5;else if(mt==2){var Rt=ac(de,Ge,31)+257,Wt=ac(de,Ge+10,15)+4,ln=Rt+ac(de,Ge+5,31)+1;Ge+=14;for(var en=new el(ln),gn=new el(19),cn=0;cn<Wt;++cn)gn[i$[cn]]=ac(de,Ge+3*cn,7);Ge+=3*Wt;var Gn=gk(gn),Yt=(1<<Gn)-1,gr=p0(gn,Gn);for(cn=0;cn<ln;){var ar,Er=gr[ac(de,Ge,Yt)];if(Ge+=15&Er,(ar=Er>>4)<16)en[cn++]=ar;else{var wr=0,li=0;for(ar==16?(li=3+ac(de,Ge,3),Ge+=2,wr=en[cn-1]):ar==17?(li=3+ac(de,Ge,7),Ge+=3):ar==18&&(li=11+ac(de,Ge,127),Ge+=7);li--;)en[cn++]=wr}}var Po=en.subarray(0,Rt),Sr=en.subarray(Rt);lt=gk(Po),yt=gk(Sr),Ye=p0(Po,lt),rt=p0(Sr,yt)}else lc(1);if(Ge>tt){Ke&&lc(0);break}}qe&&je($e+131072);for(var kr=(1<<lt)-1,Mi=(1<<yt)-1,uo=Ge;;uo=Ge){var ki=(wr=Ye[_k(de,Ge)&kr])>>4;if((Ge+=15&wr)>tt){Ke&&lc(0);break}if(wr||lc(2),ki<256)Se[$e++]=ki;else{if(ki==256){uo=Ge,Ye=null;break}var yn=ki-254;ki>264&&(yn=ac(de,Ge,(1<<(Do=BL[cn=ki-257]))-1)+UL[cn],Ge+=Do);var Vo=rt[_k(de,Ge)&Mi],jo=Vo>>4;if(Vo||lc(3),Ge+=15&Vo,Sr=s$[jo],jo>3){var Do=NL[jo];Sr+=_k(de,Ge)&(1<<Do)-1,Ge+=Do}if(Ge>tt){Ke&&lc(0);break}qe&&je($e+131072);var qi=$e+yn;if($e<Sr){var Zi=0-Sr,Ro=Math.min(Sr,qi);for(Zi+$e<0&&lc(3);$e<Ro;++$e)Se[$e]=we[Zi+$e]}for(;$e<qi;++$e)Se[$e]=Se[$e-Sr]}}ve.l=Ye,ve.p=uo,ve.b=$e,ve.f=at,Ye&&(at=1,ve.m=lt,ve.d=rt,ve.n=yt)}while(!at);return $e!=Se.length&&Ve?function(Pi,Pr,ho){return(ho==null||ho>Pi.length)&&(ho=Pi.length),new el(Pi.subarray(0,ho))}(Se,0,$e):Se.subarray(0,$e)}(G.subarray(te,-8),{i:2},new el(((q=G)[(ee=q.length)-4]|q[ee-3]<<8|q[ee-2]<<16|q[ee-1]<<24)>>>0),K)));var G,K,q,ee,te;const le=f$[V];if(!le)throw new Error(`Unhandled codec: ${V}`);const xe=new globalThis.DecompressionStream(le);return new Response(new Blob([N]).stream().pipeThrough(xe)).arrayBuffer().then(de=>new Uint8Array(de))}(M,I).then(N=>(function(V,G){let K;for(;K=V.nextField();)if(K===2)JG(V,V.readVarint()+V.pos,G);else if(K===3)throw new Error("Not implemented")}(new yk(N),R),new m$[y](R.buffer))),O.then(N=>{for(let V=C.length-1;V>=0;V--)switch(C[V]){case"delta_filter":e$(N,b);break;case"zigzag_filter":t$(N);break;case"bitshuffle_filter":n$(N,y);break;default:throw new Ol(`Unhandled filter "${C[V]}"`)}return{layerName:d,blockIndex:S,data:N}}).catch(N=>{throw N})}))},Mt(qL,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Mt(vw,"MapboxRasterTile"),Mt(WL,"MapboxRasterLayer",{omit:["_blocksInProgress"]});const vk=new Map,XL=new Map;class KL{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const l=this.toIdx(e,i);return{min:this.minimums[l],max:this.maximums[l]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function YL(o,e,i,l){let d=0,p=Number.MAX_VALUE;for(let m=0;m<3;m++)if(Math.abs(l[m])<1e-15){if(i[m]<o[m]||i[m]>e[m])return null}else{const y=1/l[m];let b=(o[m]-i[m])*y,S=(e[m]-i[m])*y;if(b>S){const C=b;b=S,S=C}if(b>d&&(d=b),S<p&&(p=S),d>p)return null}return d}function QL(o,e,i,l,d,p,m,y,b,S,C){const I=l-o,M=d-e,R=p-i,O=m-o,N=y-e,V=b-i,G=C[1]*V-C[2]*N,K=C[2]*O-C[0]*V,q=C[0]*N-C[1]*O,ee=I*G+M*K+R*q;if(Math.abs(ee)<1e-15)return null;const te=1/ee,le=S[0]-o,xe=S[1]-e,de=S[2]-i,ve=(le*G+xe*K+de*q)*te;if(ve<0||ve>1)return null;const Se=xe*R-de*M,we=de*I-le*R,Fe=le*M-xe*I,Ve=(C[0]*Se+C[1]*we+C[2]*Fe)*te;return Ve<0||ve+Ve>1?null:(O*Se+N*we+V*Fe)*te}function JL(o,e,i){return(o-e)/(i-e)}function eO(o,e,i,l,d,p,m,y,b){const S=1<<i,C=p-l,I=m-d,M=(o+1)/S*C+l,R=(e+0)/S*I+d,O=(e+1)/S*I+d;y[0]=(o+0)/S*C+l,y[1]=R,b[0]=M,b[1]=O}class tO{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(p){const m=Math.ceil(Math.log2(p.dim/8)),y=[];let b=Math.ceil(Math.pow(2,m));const S=1/b,C=(R,O,N,V,G)=>{const K=V?1:0,q=(R+1)*N-K,ee=O*N,te=(O+1)*N-K;G[0]=R*N,G[1]=ee,G[2]=q,G[3]=te};let I=new KL(b);const M=[];for(let R=0;R<b*b;R++){C(R%b,Math.floor(R/b),S,!1,M);const O=fh(M[0],M[1],p),N=fh(M[2],M[1],p),V=fh(M[2],M[3],p),G=fh(M[0],M[3],p);I.minimums.push(Math.min(O,N,V,G)),I.maximums.push(Math.max(O,N,V,G)),I.leaves.push(1)}for(y.push(I),b/=2;b>=1;b/=2){const R=y.at(-1);I=new KL(b);for(let O=0;O<b*b;O++){C(O%b,Math.floor(O/b),2,!0,M);const N=R.getElevation(M[0],M[1]),V=R.getElevation(M[2],M[1]),G=R.getElevation(M[2],M[3]),K=R.getElevation(M[0],M[3]),q=R.isLeaf(M[0],M[1]),ee=R.isLeaf(M[2],M[1]),te=R.isLeaf(M[2],M[3]),le=R.isLeaf(M[0],M[3]),xe=Math.min(N.min,V.min,G.min,K.min),de=Math.max(N.max,V.max,G.max,K.max),ve=q&&ee&&te&≤I.maximums.push(de),I.minimums.push(xe),I.leaves.push(de-xe<=5&&ve?1:0)}y.push(I)}return y}(this.dem),l=i.length-1,d=i[l];this._addNode(d.minimums[0],d.maximums[0],d.leaves[0]),this._construct(i,0,0,l,0)}raycastRoot(e,i,l,d,p,m,y=1){return YL([e,i,-100],[l,d,this.maximums[0]*y],p,m)}raycast(e,i,l,d,p,m,y=1){if(!this.nodeCount)return null;const b=this.raycastRoot(e,i,l,d,p,m,y);if(b==null)return null;const S=[],C=[],I=[],M=[],R=[{idx:0,t:b,nodex:0,nodey:0,depth:0}];for(;R.length>0;){const{idx:O,t:N,nodex:V,nodey:G,depth:K}=R.pop();if(this.leaves[O]){eO(V,G,K,e,i,l,d,I,M);const ee=1<<K,te=(V+0)/ee,le=(V+1)/ee,xe=(G+0)/ee,de=(G+1)/ee,ve=fh(te,xe,this.dem)*y,Se=fh(le,xe,this.dem)*y,we=fh(le,de,this.dem)*y,Fe=fh(te,de,this.dem)*y,Ve=QL(I[0],I[1],ve,M[0],I[1],Se,M[0],M[1],we,p,m),qe=QL(M[0],M[1],we,I[0],M[1],Fe,I[0],I[1],ve,p,m),Ke=Math.min(Ve!==null?Ve:Number.MAX_VALUE,qe!==null?qe:Number.MAX_VALUE);if(Ke!==Number.MAX_VALUE)return Ke;{const je=Wr([],p,m,N);if(nO(ve,Se,Fe,we,JL(je[0],I[0],M[0]),JL(je[1],I[1],M[1]))>=je[2])return N}continue}let q=0;for(let ee=0;ee<this._siblingOffset.length;ee++){eO((V<<1)+this._siblingOffset[ee][0],(G<<1)+this._siblingOffset[ee][1],K+1,e,i,l,d,I,M),I[2]=-100,M[2]=this.maximums[this.childOffsets[O]+ee]*y;const te=YL(I,M,p,m);if(te!=null){const le=te;S[ee]=le;let xe=!1;for(let de=0;de<q&&!xe;de++)le>=S[C[de]]&&(C.splice(de,0,ee),xe=!0);xe||(C[q]=ee),q++}}for(let ee=0;ee<q;ee++){const te=C[ee];R.push({idx:this.childOffsets[O]+te,t:S[te],nodex:(V<<1)+this._siblingOffset[te][0],nodey:(G<<1)+this._siblingOffset[te][1],depth:K+1})}}return null}_addNode(e,i,l){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(l),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,l,d,p){if(e[d].isLeaf(i,l)===1)return;this.childOffsets[p]||(this.childOffsets[p]=this.nodeCount);const m=d-1,y=e[m];let b=0,S=0;for(let C=0;C<this._siblingOffset.length;C++){const I=2*i+this._siblingOffset[C][0],M=2*l+this._siblingOffset[C][1],R=y.getElevation(I,M),O=y.isLeaf(I,M),N=this._addNode(R.min,R.max,O);O&&(b|=1<<C),S||(S=N)}for(let C=0;C<this._siblingOffset.length;C++)b&1<<C||this._construct(e,2*i+this._siblingOffset[C][0],2*l+this._siblingOffset[C][1],m,S+C)}}function nO(o,e,i,l,d,p){return Jt(Jt(o,i,p),Jt(e,l,p),d)}function fh(o,e,i){const l=i.dim,d=Ie(o*l-.5,0,l-1),p=Ie(e*l-.5,0,l-1),m=Math.floor(d),y=Math.floor(p),b=Math.min(m+1,l-1),S=Math.min(y+1,l-1);return nO(i.get(m,y),i.get(b,y),i.get(m,S),i.get(b,S),d-m,p-y)}const g$={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function _$(o,e,i){return(256*o*256+256*e+i)/10-1e4}function y$(o,e,i){return 256*o+e+i/256-32768}class xw{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,l,d=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(l&&l!=="mapbox"&&l!=="terrarium")return void Cn(`"${l}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const p=this.dim=i.height-2,m=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=d,this._modifiedForSources={},!d){for(let b=0;b<p;b++)m[this._idx(-1,b)]=m[this._idx(0,b)],m[this._idx(p,b)]=m[this._idx(p-1,b)],m[this._idx(b,-1)]=m[this._idx(b,0)],m[this._idx(b,p)]=m[this._idx(b,p-1)];m[this._idx(-1,-1)]=m[this._idx(0,0)],m[this._idx(p,-1)]=m[this._idx(p-1,0)],m[this._idx(-1,p)]=m[this._idx(0,p-1)],m[this._idx(p,p)]=m[this._idx(p-1,p-1)]}const y=l==="terrarium"?y$:_$;for(let b=0;b<m.length;++b){const S=4*b;this.floatView[b]=y(this.pixels[S],this.pixels[S+1],this.pixels[S+2])}this._timestamp=Zo.now()}_buildQuadTree(){this._tree=new tO(this)}get(e,i,l=!1){l&&(e=Ie(e,-1,this.dim),i=Ie(i,-1,this.dim));const d=this._idx(e,i);return this.floatView[d]}set(e,i,l){const d=this._idx(e,i),p=this.floatView[d];return this.floatView[d]=l,l-p}static getUnpackVector(e){return g$[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 l=[0,0,0,0],d=xw.getUnpackVector(i);let p=Math.floor((e+d[3])/d[2]);return l[2]=p%256,p=Math.floor(p/256),l[1]=p%256,p=Math.floor(p/256),l[0]=p,l}getPixels(){return new P({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,l){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let d=i*this.dim,p=i*this.dim+this.dim,m=l*this.dim,y=l*this.dim+this.dim;switch(i){case-1:d=p-1;break;case 1:p=d+1}switch(l){case-1:m=y-1;break;case 1:y=m+1}const b=-i*this.dim,S=-l*this.dim;for(let C=m;C<y;C++)for(let I=d;I<p;I++){const M=4*this._idx(I,C),R=4*this._idx(I+b,C+S);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)}}Mt(xw,"DEMData"),Mt(tO,"DemMinMaxQuadTree",{omit:["dem"]});const rO=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ro=new Uint32Array(96);class xk{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[i,l]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const d=l>>4;if(d!==1)throw new Error(`Got v${d} data when expected v1.`);const p=rO[15&l];if(!p)throw new Error("Unrecognized array type.");const[m]=new Uint16Array(e,2,1),[y]=new Uint32Array(e,4,1);return new xk(y,m,p,void 0,e)}constructor(e,i=64,l=Float64Array,d=ArrayBuffer,p){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=l,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const m=rO.indexOf(this.ArrayType),y=2*e*this.ArrayType.BYTES_PER_ELEMENT,b=e*this.IndexArrayType.BYTES_PER_ELEMENT,S=(8-b%8)%8;if(m<0)throw new Error(`Unexpected typed array class: ${l}.`);if(p)this.data=p,this.ids=new this.IndexArrayType(p,8,e),this.coords=new l(p,8+b+S,2*e),this._pos=2*e,this._finished=!0;else{const C=this.data=new d(8+y+b+S);this.ids=new this.IndexArrayType(C,8,e),this.coords=new l(C,8+b+S,2*e),this._pos=0,this._finished=!1,new Uint8Array(C,0,2).set([219,16+m]),new Uint16Array(C,2,1)[0]=i,new Uint32Array(C,4,1)[0]=e}}add(e,i){const l=this._pos>>1;return this.ids[l]=l,this.coords[this._pos++]=e,this.coords[this._pos++]=i,l}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return bk(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,l,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:m,nodeSize:y}=this;ro[0]=0,ro[1]=p.length-1,ro[2]=0;let b=3;const S=[];for(;b>0;){const C=ro[--b],I=ro[--b],M=ro[--b];if(I-M<=y){for(let V=M;V<=I;V++){const G=m[2*V],K=m[2*V+1];G>=e&&G<=l&&K>=i&&K<=d&&S.push(p[V])}continue}const R=M+I>>1,O=m[2*R],N=m[2*R+1];O>=e&&O<=l&&N>=i&&N<=d&&S.push(p[R]),(C===0?e<=O:i<=N)&&(ro[b++]=M,ro[b++]=R-1,ro[b++]=1-C),(C===0?l>=O:d>=N)&&(ro[b++]=R+1,ro[b++]=I,ro[b++]=1-C)}return S}within(e,i,l){const d=[];return this.withinInto(e,i,l,d),d}withinInto(e,i,l,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:m,nodeSize:y}=this;ro[0]=0,ro[1]=p.length-1,ro[2]=0;let b=3,S=0;const C=l*l;for(;b>0;){const I=ro[--b],M=ro[--b],R=ro[--b];if(M-R<=y){for(let G=R;G<=M;G++)oO(m[2*G],m[2*G+1],e,i)<=C&&(d[S++]=p[G]);continue}const O=R+M>>1,N=m[2*O],V=m[2*O+1];oO(N,V,e,i)<=C&&(d[S++]=p[O]),(I===0?e-l<=N:i-l<=V)&&(ro[b++]=R,ro[b++]=O-1,ro[b++]=1-I),(I===0?e+l>=N:i+l>=V)&&(ro[b++]=O+1,ro[b++]=M,ro[b++]=1-I)}return S}}function bk(o,e,i,l,d,p){if(d-l<=i)return;const m=l+d>>1;iO(o,e,m,l,d,p),bk(o,e,i,l,m-1,1-p),bk(o,e,i,m+1,d,1-p)}function iO(o,e,i,l,d,p){for(;d>l;){if(d-l>600){const S=d-l+1,C=i-l+1,I=Math.log(S),M=.5*Math.exp(2*I/3),R=.5*Math.sqrt(I*M*(S-M)/S)*(C-S/2<0?-1:1);iO(o,e,i,Math.max(l,Math.floor(i-C*M/S+R)),Math.min(d,Math.floor(i+(S-C)*M/S+R)),p)}const m=e[2*i+p];let y=l,b=d;for(g0(o,e,l,i),e[2*d+p]>m&&g0(o,e,l,d);y<b;){for(g0(o,e,y,b),y++,b--;e[2*y+p]<m;)y++;for(;e[2*b+p]>m;)b--}e[2*l+p]===m?g0(o,e,l,b):(b++,g0(o,e,b,d)),b<=i&&(l=b+1),i<=b&&(d=b-1)}}function g0(o,e,i,l){wk(o,i,l),wk(e,2*i,2*l),wk(e,2*i+1,2*l+1)}function wk(o,e,i){const l=o[e];o[e]=o[i],o[i]=l}function oO(o,e,i,l){const d=o-i,p=e-l;return d*d+p*p}T.$=class{constructor(o){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(o&&o.maxTextureMemoryMB?o.maxTextureMemoryMB:256)*1024,this.currentFrameAtlases=new Set,this.finalizationRegistry=new FinalizationRegistry(e=>{this.cache.delete(e),this.clearExpiredTextures()})}beginFrame(){this.currentFrameAtlases.clear()}calculateTextureMemory(o){return o.image?Math.ceil(o.image.width*o.image.height*4*(o.patternPositions.size>0?1.33:1)):0}evictTexture(o){const e=this.textures.get(o);if(e){const i=this.calculateTextureMemory(o);e.destroy(),this.textures.delete(o),this.textureAccessTimes.delete(o),this.textureMemoryUsed-=i,o.uploaded=!1}}evictTexturesIfNeeded(o){for(;this.textureMemoryUsed+o>this.maxTextureMemory&&this.textures.size>0;){let e=null,i=1/0;for(const[l]of this.textures.entries()){if(this.currentFrameAtlases.has(l))continue;const d=this.textureAccessTimes.get(l)||0;d<i&&(i=d,e=l)}if(!e)break;this.evictTexture(e)}}findCachedAtlas(o){const e=this.cache.get(o.hash);if(e){const i=e.deref();if(i&&i.contentDescriptor&&this.isMipmapCompatible(o,i.contentDescriptor))return i}for(const[,i]of this.cache.entries()){const l=i.deref();if(l&&l.contentDescriptor){const d=o.subsetOf(l.contentDescriptor),p=this.isMipmapCompatible(o,l.contentDescriptor);if(d&&p)return l}}}getTextureForAtlas(o,e,i){this.textureAccessTimes.set(o,performance.now()),this.currentFrameAtlases.add(o);let l=this.textures.get(o);if(l)return l;if(o.image){const d=this.calculateTextureMemory(o);return this.evictTexturesIfNeeded(d),l=new Jc(e,o.image,i,{useMipmap:!!o.patternPositions.size}),this.textures.set(o,l),this.textureMemoryUsed+=d,l}return null}clearExpiredTextures(){for(const[o]of this.textures.entries())if(!this.isAtlasCached(o)){const e=this.textures.get(o);if(e){const i=this.calculateTextureMemory(o);e.destroy(),this.textureMemoryUsed-=i}this.textures.delete(o),this.textureAccessTimes.delete(o)}}isAtlasCached(o){if(!o.contentDescriptor)return!1;const e=this.cache.get(o.contentDescriptor.hash);return!!e&&e.deref()===o}getOrCache(o){if(!("image"in o)){const d=this.cache.get(o.sourceAtlasHash);if(d){const p=d.deref();if(p)return p}return Cn("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!o.contentDescriptor)return o;const e=o.contentDescriptor,i=e.hash,l=this.cache.get(i);if(l){const d=l.deref();if(d&&d.contentDescriptor&&this.isMipmapCompatible(e,d.contentDescriptor))return d}return this.cache.set(i,new WeakRef(o)),this.finalizationRegistry.register(o,i,o),o}isMipmapCompatible(o,e){return!o.requiresMipMaps||e.requiresMipMaps}destroyTextures(){for(const o of this.textures.values())o&&o.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(const o of this.textures.values())o&&o.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}},T.A=Qr,T.B=2,T.C=BG,T.D=xw,T.E=450,T.F=7,T.G=4,T.H=5,T.I=DL,T.J=lg,T.K=sw,T.L=P,T.M=kR,T.N=wE,T.O=xE,T.P=Xo,T.Q=45,T.R=6,T.S=5,T.T=class{constructor(o){this._createGrid(o),this._createPoles(o)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const o of this._poleSegments)o.destroy();for(const o of this._gridSegments)o.withSkirts.destroy(),o.withoutSkirts.destroy()}_fillGridMeshWithLods(o,e){const i=new ea,l=new _i,d=[],p=o+1+2,m=e[0]+1,y=e[0]+1+(1+e.length),b=(S,C,I)=>{let M=S===p-1?S-2:S===0?S:S-1;return M+=I?24575:0,[M,C]};for(let S=0;S<p;++S)i.emplaceBack(...b(S,0,!0));for(let S=0;S<m;++S)for(let C=0;C<p;++C)i.emplaceBack(...b(C,S,(C===0||C===p-1)&&!0));for(let S=0;S<e.length;++S){const C=e[S];for(let I=0;I<p;++I)i.emplaceBack(...b(I,C,!0))}for(let S=0;S<e.length;++S){const C=l.length,I=e[S]+1+2,M=new _i;for(let N=0;N<I-1;N++){const V=N===I-2,G=V?p*(y-e.length+S-N):p;for(let K=0;K<p-1;K++){const q=N*p+K;N===0||V||K===0||K===p-2?(M.emplaceBack(q+1,q,q+G),M.emplaceBack(q+G,q+G+1,q+1)):(l.emplaceBack(q+1,q,q+G),l.emplaceBack(q+G,q+G+1,q+1))}}const R=pr.simpleSegment(0,C,i.length,l.length-C);for(let N=0;N<M.uint16.length;N+=3)l.emplaceBack(M.uint16[N],M.uint16[N+1],M.uint16[N+2]);const O=pr.simpleSegment(0,C,i.length,l.length-C);d.push({withoutSkirts:R,withSkirts:O})}return{vertices:i,indices:l,segments:d}}_createGrid(o){const e=this._fillGridMeshWithLods(ju,dv);this._gridSegments=e.segments,this._gridBuffer=o.createVertexBuffer(e.vertices,Hv.members),this._gridIndexBuffer=o.createIndexBuffer(e.indices,!0)}_createPoles(o){const e=new _i;for(let m=0;m<=ju;m++)e.emplaceBack(0,m+1,m+2);this._poleIndexBuffer=o.createIndexBuffer(e,!0);const i=new Hu,l=new Hu,d=new Hu,p=new Hu;this._poleSegments=[];for(let m=0,y=0;m<6;m++){const b=360/(1<<m);i.emplaceBack(0,-Xo,0,.5,0),l.emplaceBack(0,-Xo,0,.5,1),d.emplaceBack(0,-Xo,0,.5,.5),p.emplaceBack(0,-Xo,0,.5,.5);for(let S=0;S<=ju;S++){let C=S/ju,I=0;const M=Jt(0,b,C),[R,O,N]=Xd(r8,i8,M,Xo);i.emplaceBack(R,O,N,C,I),l.emplaceBack(R,O,N,C,1-I);const V=Te(M);C=.5+.5*Math.sin(V),I=.5+.5*Math.cos(V),d.emplaceBack(R,O,N,C,I),p.emplaceBack(R,O,N,C,1-I)}this._poleSegments.push(pr.simpleSegment(y,0,66,64)),y+=66}this._poleNorthVertexBuffer=o.createVertexBuffer(i,A1,!1),this._poleSouthVertexBuffer=o.createVertexBuffer(l,A1,!1),this._texturedPoleNorthVertexBuffer=o.createVertexBuffer(d,A1,!1),this._texturedPoleSouthVertexBuffer=o.createVertexBuffer(p,A1,!1)}getGridBuffers(o,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[o].withSkirts:this._gridSegments[o].withoutSkirts]}getPoleBuffers(o,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[o]]}},T.U=x1,T.V=Vf,T.W="hd_road_elevation",T.X="hd_road_coverage",T.Y=Ju,T.Z=1,T._=DP,T.a=class{constructor(o,e,i){this.target=o,this.parent=e,this.mapId=i,this.callbacks={},this.cancelCallbacks={},mn(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new qG}send(o,e,i,l,d=!1,p){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=p,this.callbacks[m]=i);const y=new Set;return this.target.postMessage({id:m,type:o,hasCallback:!!i,targetMapId:l,mustQueue:d,sourceMapId:this.mapId,data:Jl(e,y)},y),{cancel:()=>{i&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:l,sourceMapId:this.mapId})}}}receive(o){const e=o.data;if(!e)return;const i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){const l=this.cancelCallbacks[i];delete this.cancelCallbacks[i],l&&l.cancel()}else if(e.mustQueue||xs(self)){const l=this.callbacks[i],d=this.scheduler.add(()=>this.processTask(i,e),l&&l.metadata||{type:"message"});d&&(this.cancelCallbacks[i]=d)}else this.processTask(i,e)}processTask(o,e){if(delete this.cancelCallbacks[o],e.type==="<response>"){const i=this.callbacks[o];delete this.callbacks[o],i&&(e.error?i(Nc(e.error)):i(null,Nc(e.data)))}else{const i=new Set,l=e.hasCallback?(p,m)=>{this.target.postMessage({id:o,type:"<response>",sourceMapId:this.mapId,error:p?Jl(p):null,data:Jl(m,i)},i)}:()=>{},d=Nc(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const p=e.type.split("."),{source:m,scope:y}=d;this.parent.getWorkerSource(e.sourceMapId,{type:p[0],source:m,scope:y,uid:0})[p[1]](d,l)}else l(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},T.a$=class{constructor(o,e,i,l){this.context=o,this.format=l,this.size=i,this.texture=o.gl.createTexture();const[d,p,m]=this.size,{gl:y}=o;y.bindTexture(y.TEXTURE_3D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&y.texImage3D(y.TEXTURE_3D,0,this.format,d,p,m,0,aE(this.format),lE(this.format),e.data)}bind(o,e){const{context:i}=this,{gl:l}=i;l.bindTexture(l.TEXTURE_3D,this.texture),o!==this.minFilter&&(l.texParameteri(l.TEXTURE_3D,l.TEXTURE_MAG_FILTER,o),l.texParameteri(l.TEXTURE_3D,l.TEXTURE_MIN_FILTER,o),this.minFilter=o),e!==this.wrapS&&(l.texParameteri(l.TEXTURE_3D,l.TEXTURE_WRAP_S,e),l.texParameteri(l.TEXTURE_3D,l.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}},T.a0=PP,T.a1=Ut,T.a2=jv,T.a3=pL,T.a4=xa,T.a5=class{static calculate(o,e,i){const l=new Set,d=new Map,p=new Set,m=new Set;for(const b of Object.values(o))for(const[S,C]of Object.entries(b.floors)){p.add(S),C.isDefault&&m.add(S),C.conflicts&&d.set(S,C.conflicts);const I=S===e,M=C.connections&&e&&C.connections.has(e);(I||M)&&l.add(S)}const y=b=>{const S=d.get(b)||new Set;for(const C of l)if((d.get(C)||new Set).has(b)||S.has(C))return!0;return!1};if(i)for(const b of i)p.has(b)&&(y(b)||l.add(b));for(const b of m)l.has(b)||y(b)||l.add(b);return l}},T.a6=xk,T.a7=mk,T.a8=J1,T.a9=D,T.aA=mL,T.aB=vE,T.aC=FL,T.aD=p8,T.aE=Qv,T.aF=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new et(1/0,1/0),max:new et(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(o,e=!1){const i=mD(new et(0,0),new et(St,St),o),l=[];if(e&&!CE(i,this._globalClipBounds))return l;for(const d of this._activeRegions){if(d.hiddenByOverlap||!CE(i,d))continue;const p=m8(d.min,d.max,o);l.push({min:p.min,max:p.max,sourceId:this._sourceIds[d.priority],footprint:d.footprint,footprintTileId:d.tileId,order:d.order,clipMask:d.clipMask,clipScope:d.clipScope})}return l}setSources(o){this._setSources(o.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const l of e.cache.getVisibleCoordinates()){const d=e.cache.getTile(l).buckets[e.layer];d&&d.updateFootprints(l.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(o){const e=o.getFootprints();if(e.length===0)return;const i=o.getOrder(),l=o.getClipMask(),d=o.getClipScope();for(const p of e){if(!p.footprint)continue;const m=mD(p.footprint.min,p.footprint.max,p.id);this._activeRegions.push({min:m.min,max:m.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:p.id,footprint:p.footprint,order:i,clipMask:l,clipScope:d})}this._sourceIds.push(o.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||L1(e.min,i.min)||L1(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(l,d){const p=(m,y)=>m+y;return l.length-d.length||l.reduce(p,"").localeCompare(d.reduce(p,""))}(e.clipScope,i.clipScope));let o=this._activeRegions.length!==this._prevRegions.length;if(!o){let e=0;for(;!o&&e!==this._activeRegions.length;){const i=this._activeRegions[e],l=this._prevRegions[e];o=i.priority!==l.priority||!pD(i,l)||i.order!==l.order||i.clipMask!==l.clipMask||!ji(i.clipScope,l.clipScope),this._activeRegions[e].hiddenByOverlap=l.hiddenByOverlap,++e}}if(o){++this._updateTime;for(const i of this._activeRegions)i.order!==Qv&&(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 l=this._activeRegions;if(i>=l.length)return i;const d=l[i].priority;for(;i<l.length&&l[i].priority===d;)++i;return i};if(this._sourceIds.length>1){let i=0,l=e(i);for(;i!==l;){let d=i;const p=i;for(;d!==l;){const m=this._activeRegions[d];m.hiddenByOverlap=!1;for(let y=0;y<p;y++){const b=this._activeRegions[y];if(!b.hiddenByOverlap&&m.order===Qv&&CE(m,b)&&(m.hiddenByOverlap=gD(m.footprint,m.tileId,b.footprint,b.tileId),m.hiddenByOverlap))break}++d}i=l,l=e(i)}}}}_setSources(o){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=o.length-1;e>=0;e--)this._addSource(o[e]);this._computeReplacement()}},T.aG=ls,T.aH=Ac,T.aI=2,T.aJ=pr,T.aK=Ev,T.aL=Qf,T.aM=Cl,T.aN=bv,T.aO=Wu,T.aP=Wc,T.aQ=ea,T.aR=ta,T.aS=Ca,T.aT=_i,T.aU=Hu,T.aV=Tv,T.aW=kv,T.aX=Rl,T.aY=/^(.*)-transition$/,T.aZ=class extends _p{constructor(o,e){super(o._vectorTileFeature,o._z,o._x,o._y,o.id),o.state&&(this.state=Object.assign({},o.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=o.source,this.sourceLayer=o.sourceLayer,this.layer=o.layer)}toJSON(){const o=super.toJSON();return o.target=this.target,o.namespace=this.namespace,o}},T.a_=Jc,T.aa=J,T.ab=Qn,T.ac=ec,T.ad=hE,T.ae=Ss,T.af=vw,T.ag=No,T.ah=nR,T.ai=yp,T.aj=xg,T.ak=3,T.al=2,T.am=0,T.an=1,T.ao=ct,T.ap=fs,T.aq=2,T.ar=z,T.as=En,T.at=class{constructor(o=new Uint8Array(16)){this.buf=ArrayBuffer.isView(o)?o:new Uint8Array(o),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.length=this.buf.length}writeTag(o,e){this.writeVarint(o<<3|e)}realloc(o){let e=this.length||16;for(;e<this.pos+o;)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(o){this.realloc(4),this.dataView.setInt32(this.pos,o,!0),this.pos+=4}writeSFixed32(o){this.realloc(4),this.dataView.setInt32(this.pos,o,!0),this.pos+=4}writeFixed64(o){this.realloc(8),this.dataView.setInt32(this.pos,-1&o,!0),this.dataView.setInt32(this.pos+4,Math.floor(o*nn),!0),this.pos+=8}writeSFixed64(o){this.realloc(8),this.dataView.setInt32(this.pos,-1&o,!0),this.dataView.setInt32(this.pos+4,Math.floor(o*nn),!0),this.pos+=8}writeVarint(o){if((o=+o||0)>=0&&o<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=o);o>268435455||o<0?function(e,i){let l,d;if(e>=0?(l=e%4294967296|0,d=e/4294967296|0):(l=~(-e%4294967296),d=~(-e/4294967296),4294967295^l?l=l+1|0:(l=0,d=d+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(p,m,y){y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,y.buf[y.pos]=127&(p>>>=7)}(l,0,i),function(p,m){const y=(7&p)<<4;m.buf[m.pos++]|=y|((p>>>=3)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p)))))}(d,i)}(o,this):(this.realloc(4),this.buf[this.pos++]=127&o|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=o>>>7&127))))}writeSVarint(o){this.writeVarint(o<0?2*-o-1:2*o)}writeBoolean(o){this.writeVarint(+o)}writeString(o){o=String(o),this.realloc(4*o.length),this.pos++;const e=this.pos;this.pos=function(l,d,p){for(let m,y,b=0;b<d.length;b++){if(m=d.charCodeAt(b),m>55295&&m<57344){if(!y){m>56319||b+1===d.length?(l[p++]=239,l[p++]=191,l[p++]=189):y=m;continue}if(m<56320){l[p++]=239,l[p++]=191,l[p++]=189,y=m;continue}m=y-55296<<10|m-56320|65536,y=null}else y&&(l[p++]=239,l[p++]=191,l[p++]=189,y=null);m<128?l[p++]=m:(m<2048?l[p++]=m>>6|192:(m<65536?l[p++]=m>>12|224:(l[p++]=m>>18|240,l[p++]=m>>12&63|128),l[p++]=m>>6&63|128),l[p++]=63&m|128)}return p}(this.buf,o,this.pos);const i=this.pos-e;i>=128&&fn(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(o){this.realloc(4),this.dataView.setFloat32(this.pos,o,!0),this.pos+=4}writeDouble(o){this.realloc(8),this.dataView.setFloat64(this.pos,o,!0),this.pos+=8}writeBytes(o){const e=o.length;this.writeVarint(e),this.realloc(e),this.buf.set(o,this.pos),this.pos+=e}writeRawMessage(o,e){this.pos++;const i=this.pos;o(e,this);const l=this.pos-i;l>=128&&fn(i,l,this),this.pos=i-1,this.writeVarint(l),this.pos+=l}writeMessage(o,e,i){this.writeTag(o,2),this.writeRawMessage(e,i)}writePackedVarint(o,e){e.length&&this.writeMessage(o,un,e)}writePackedSVarint(o,e){e.length&&this.writeMessage(o,Dn,e)}writePackedBoolean(o,e){e.length&&this.writeMessage(o,Hn,e)}writePackedFloat(o,e){e.length&&this.writeMessage(o,Jn,e)}writePackedDouble(o,e){e.length&&this.writeMessage(o,Mr,e)}writePackedFixed32(o,e){e.length&&this.writeMessage(o,Wn,e)}writePackedSFixed32(o,e){e.length&&this.writeMessage(o,Fr,e)}writePackedFixed64(o,e){e.length&&this.writeMessage(o,or,e)}writePackedSFixed64(o,e){e.length&&this.writeMessage(o,ri,e)}writeBytesField(o,e){this.writeTag(o,2),this.writeBytes(e)}writeFixed32Field(o,e){this.writeTag(o,5),this.writeFixed32(e)}writeSFixed32Field(o,e){this.writeTag(o,5),this.writeSFixed32(e)}writeFixed64Field(o,e){this.writeTag(o,1),this.writeFixed64(e)}writeSFixed64Field(o,e){this.writeTag(o,1),this.writeSFixed64(e)}writeVarintField(o,e){this.writeTag(o,0),this.writeVarint(e)}writeSVarintField(o,e){this.writeTag(o,0),this.writeSVarint(e)}writeStringField(o,e){this.writeTag(o,2),this.writeString(e)}writeFloatField(o,e){this.writeTag(o,5),this.writeFloat(e)}writeDoubleField(o,e){this.writeTag(o,1),this.writeDouble(e)}writeBooleanField(o,e){this.writeVarintField(o,+e)}},T.au=et,T.av=class{constructor(o){this.specification=o}possiblyEvaluate(o,e){return Na(o.expression.evaluate(e))}interpolate(o,e,i){return{x:Jt(o.x,e.x,i),y:Jt(o.y,e.y,i),z:Jt(o.z,e.z,i),azimuthal:Jt(o.azimuthal,e.azimuthal,i),polar:Jt(o.polar,e.polar,i)}}},T.aw=Gc,T.ax=fr,T.ay=A,T.az=SL,T.b=k,T.b$=jy,T.b0=class{constructor(o,e,i,l,d,p){this.tileID=o,this.uid=Un(),this.uses=0,this.tileSize=e,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=d,l&&l.style&&(this._lastUpdatedBrightness=l.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",l&&l.transform&&(this.projection=l.transform.projection),this.worldview=p,this._hasAppearances=null}registerFadeDuration(o){const e=o+this.timeAdded;e<Zo.now()||this.fadeEndTime!==void 0&&e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=fp(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(o,e,i){if(this.unloadVectorData(),this.state="loaded",o){o.featureIndex&&(this.latestFeatureIndex=o.featureIndex,o.rawTileData?(this.latestRawTileData=o.rawTileData,this.latestFeatureIndex.rawTileData=o.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=o.collisionBoxArray,this.buckets=LL(o.buckets,e.style),o.frcCoveragePolygons&&o.frcCoveragePolygons.length>0&&(this.frcCoveragePolygons=o.frcCoveragePolygons),this.hasDeferredRoadStructure=!!o.hasDeferredRoadStructure,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!o.hasTunnelGeometry;for(const l in this.buckets){const d=this.buckets[l];if(d instanceof Rl){if(this.hasSymbolBuckets=!0,!i)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const d=this.buckets[l];if(d instanceof Rl&&d.hasRTLText){this.hasRTLText=!0,I2();break}}this.queryPadding=0;for(const l in this.buckets){const d=this.buckets[l],p=e.style.getOwnLayer(l);if(!p)continue;const m=p.queryRadius(d)||0;this.queryPadding=Math.max(this.queryPadding,m)}o.imageAtlas&&(this.imageAtlas=e.style.imageManager.imageAtlasCache.getOrCache(o.imageAtlas)),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage),o.lineAtlas&&(this.lineAtlas=o.lineAtlas),this._lastUpdatedBrightness=o.brightness}else this.collisionBoxArray=new ig}unloadVectorData(){if(this.hasData()){for(const o in this.buckets)this.buckets[o].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=null),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(o,e,i){o&&(o.resourceTiming&&(this.resourceTiming=o.resourceTiming),this.buckets=Object.assign({},this.buckets,LL(o.buckets,e.style)),o.featureIndex&&(this.latestFeatureIndex=o.featureIndex))}getBucket(o){return this.buckets[o.fqid]}upload(o,e){for(const d in this.buckets){const p=this.buckets[d];if(p.uploadPending()){let m={},y=[],b={zoom:0,pitch:0,brightness:0,worldview:""};if(e){if(e.style){y=e.style.listImages();const S=p.layers[0],C=S.sourceLayer||"_geojsonTileLayer",I=e.style.getLayerSourceCache(S);I&&(m=I._state.getState(C,void 0))}b={zoom:e.transform.zoom||0,pitch:e.transform.pitch||0,brightness:e.style.getBrightness()||0,worldview:e.worldview||""}}p.upload(o,this.tileID.canonical,m,y,b)}}const i=o.gl,l=this.imageAtlas;l&&e&&(this.imageAtlasTexture=e.style.imageManager.imageAtlasCache.getTextureForAtlas(l,o,i.RGBA8),l.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Jc(o,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Jc(o,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0)}prepare(o,e,i){if(this.imageAtlas&&this.imageAtlasTexture&&e){const I=e.style.getLut(i);this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture,i,I)}if(!e||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const l=e.style.getBrightness(),d=e.style.listImages(),p=d.length,m=e.style._changes.getUpdatedPaintProperties(),y=Object.keys(this.buckets).some(I=>this.buckets[I].layers.some(M=>m.has(M.fqid))),b=Object.keys(this.buckets).some(I=>this.buckets[I].layers.some(M=>M.hasTransition&&M.hasTransition())),S=this._firstPrepareComplete&&p!==this._lastAvailableImagesCount;this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(e));const C=this._lastUpdatedBrightness!==l;this._lastAvailableImagesCount=p,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||l||this._hasAppearances||y||b||S)&&(!(this._hasAppearances||y||b||S)&&this._lastUpdatedBrightness&&l&&Math.abs(this._lastUpdatedBrightness-l)<.001||(this.updateBuckets(e,C,void 0,S||y||b,m,d),this._lastUpdatedBrightness=l))}evaluateQueryRenderedFeaturePadding(){let o=0;for(const e in this.buckets){const i=this.buckets[e];i.evaluateQueryRenderedFeaturePadding&&(o=Math.max(o,i.evaluateQueryRenderedFeaturePadding()))}return o}queryRenderedFeatures(o,e,i,l,d,p,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=this.evaluateQueryRenderedFeaturePadding(),b=function(S,C){const I=At([],[.5*S.width,.5*-S.height,1]);return _e(I,I,[1,-1,0]),he(I,I,S.calculateProjMatrix(C.toUnwrapped())),Float32Array.from(I)}(d,this.tileID);return this.latestFeatureIndex.query(o,{tilespaceGeometry:e,pixelPosMatrix:b,transform:l,availableImages:i,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:y,scope:m})}querySourceFeatures(o,e){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const l=i.loadVTLayers(),d=e?e.sourceLayer:"",p=l._geojsonTileLayer||l[d];if(!p)return;const m=Gm(e&&e.filter),{z:y,x:b,y:S}=this.tileID.canonical,C={z:y,x:b,y:S};for(let I=0;I<p.length;I++){const M=p.feature(I);if(m.needGeometry){const N=Ls(M,!0);if(!m.filter(new Yn(this.tileID.overscaledZ,{worldview:this.worldview}),N,this.tileID.canonical))continue}else if(!m.filter(new Yn(this.tileID.overscaledZ,{worldview:this.worldview}),M))continue;const R=i.getId(M,d),O=new _p(M,y,b,S,R);O.tile=C,o.push(O)}}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(o){const e=this.expirationTime;if(o.cacheControl){const i=Zr(o.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else o.expires&&(this.expirationTime=new Date(o.expires).getTime());if(this.expirationTime){const i=Date.now();let l=!1;if(this.expirationTime>i)l=!1;else if(e)if(this.expirationTime<e)l=!0;else{const d=this.expirationTime-e;d?this.expirationTime=i+Math.max(d,3e4):l=!0}else l=!0;l?(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-Date.now(),Math.pow(2,31)-1)}refreshFeatureState(o,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!o)return;const i=o.style.listImages();this.updateBuckets(o,!1,e,void 0,void 0,i)}hasAppearances(o){for(const e in this.buckets)if(o.style.hasLayer(e)&&this.buckets[e].layers.some(i=>i.appearances&&i.appearances.length>0))return!0;return!1}updateBuckets(o,e,i,l,d,p){if(!this.latestFeatureIndex||!o.style)return;const m=p||o.style.listImages(),y=o.style.getBrightness(),b=d||new Set;for(const S in this.buckets){if(!o.style.hasLayer(S))continue;const C=this.buckets[S],I=C.layers[0],M=I.sourceLayer||"_geojsonTileLayer",R=o.style.getLayerSourceCache(I),O=C.layers.some(te=>b.has(te.fqid)),N=(l||O)&&C instanceof Rl?o.style.getOwnLayer(S):void 0;let V=i&&i[M]||{};R&&!i&&(V=R._state.getState(M,void 0));const G=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},K=Object.keys(V).length>0&&!e;C.hasAppearances=C.layers.some(te=>te.appearances&&te.appearances.length>0);const q=K?C.stateDependentLayers:C.layers;if(K&&C.stateDependentLayers.length!==0||e||O||l){const te=this.latestFeatureIndex.loadVTLayers()[M];if(C.update(V,te,m,G,q,e,y,this.tileID.canonical),(l||O)&&(!e||e&&C instanceof Rl&&(!C.text.uboBinder||C.text.uboBinder.isLightConstant||!C.icon.uboBinder||C.icon.uboBinder.isLightConstant))&&C instanceof Rl&&N&&N.type==="symbol"){const le=C;le.text&&le.text.uboBinder&&le.text.uboBinder.updateDynamicExpressions(N,te,this.tileID.canonical,m,V,y),le.icon&&le.icon.uboBinder&&le.icon.uboBinder.updateDynamicExpressions(N,te,this.tileID.canonical,m,V,y)}if(C instanceof Rl){const le=C,xe=o.context;le.text&&le.text.uboBinder&&le.text.uboBinder.upload(xe),le.icon&&le.icon.uboBinder&&le.icon.uboBinder.upload(xe)}}if(K&&C.stateDependentLayers.length!==0||e||C.hasAppearances){const te={zoom:o.transform.zoom,pitch:o.transform.pitch,brightness:o.style.getBrightness()||0,worldview:o.worldview},le=C.updateAppearances(this.tileID.canonical,V,m,te,o.imageManager,K&&C.stateDependentLayers.length!==0);if(le&&le.hasUboChanges){const xe=o.context;C instanceof Rl&&C.text&&C.text.uboBinder&&C.text.uboBinder.upload(xe),C instanceof Rl&&C.icon&&C.icon.uboBinder&&C.icon.uboBinder.upload(xe)}}(C instanceof J||C instanceof lg)&&o._terrain&&o._terrain.enabled&&R&&C.uploadPending()&&o._terrain._clearRenderCacheForTile(R.id,this.tileID);const ee=o&&o.style&&o.style.getOwnLayer(S);ee&&(this.queryPadding=Math.max(this.queryPadding,ee.queryRadius(C)||0))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Zo.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(o){this.symbolFadeHoldUntil=Zo.now()+o}setTexture(o,e){const i=e.context,l=i.gl;this.texture=this.texture||e.getTileTexture(o.width),this.texture&&this.texture instanceof Jc?this.texture.update(o):(this.texture=new Jc(i,o,l.RGBA8,{useMipmap:!0}),this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE))}setDependencies(o,e){const i={};for(const l of e)i[l]=!0;this.dependencies[o]=i}hasDependency(o,e){for(const i of o){const l=this.dependencies[i];if(l){for(const d of e)if(l[d])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(o,e){if(!e||e.name==="mercator"||this._tileDebugBuffer)return;const i=Js(zL,this.tileID.canonical,this.tileTransform)[0],l=new ea,d=new Cl;for(let p=0;p<i.length;p++){const{x:m,y}=i[p];l.emplaceBack(m,y),d.emplaceBack(p)}d.emplaceBack(0),this._tileDebugIndexBuffer=o.createIndexBuffer(d),this._tileDebugBuffer=o.createVertexBuffer(l,Hv.members),this._tileDebugSegments=pr.simpleSegment(0,0,l.length,d.length)}_makeTileBoundsBuffers(o,e){if(this._tileBoundsBuffer||!e||e.name==="mercator")return;const i=Js(zL,this.tileID.canonical,this.tileTransform)[0];let l,d;if(this.isRaster){const p=function(m,y){const b=fp(m,y),S=Math.pow(2,m.z);for(let N=0;N<ru;N++)for(let V=0;V<ru;V++){const G=cs((m.x+(V+OL(V))/Ll)/S),K=Si((m.y+(N+OL(N))/Ll)/S),q=y.project(G,K),ee=N*ru+V;iu[2*ee+0]=Math.round((q.x*b.scale-b.x)*St),iu[2*ee+1]=Math.round((q.y*b.scale-b.y)*St)}hh.fill(0),yw.fill(0);for(let N=2045;N>=0;N--){const V=4*N,G=dh[V+0],K=dh[V+1],q=dh[V+2],ee=dh[V+3],te=G+q>>1,le=K+ee>>1,xe=te+le-K,de=le+G-te,ve=K*ru+G,Se=ee*ru+q,we=le*ru+te,Fe=Math.hypot((iu[2*ve+0]+iu[2*Se+0])/2-iu[2*we+0],(iu[2*ve+1]+iu[2*Se+1])/2-iu[2*we+1])>=16;hh[we]=hh[we]||(Fe?1:0),N<1022&&(hh[we]=hh[we]||hh[(K+de>>1)*ru+(G+xe>>1)]||hh[(ee+de>>1)*ru+(q+xe>>1)])}const C=new Wc,I=new _i;let M=0;function R(N,V){const G=V*ru+N;return yw[G]===0&&(C.emplaceBack(iu[2*G+0],iu[2*G+1],N*St/Ll,V*St/Ll),yw[G]=++M),yw[G]-1}function O(N,V,G,K,q,ee){const te=N+G>>1,le=V+K>>1;if(Math.abs(N-q)+Math.abs(V-ee)>1&&hh[le*ru+te])O(q,ee,N,V,te,le),O(G,K,q,ee,te,le);else{const xe=R(N,V),de=R(G,K),ve=R(q,ee);I.emplaceBack(xe,de,ve)}}return O(0,0,Ll,Ll,Ll,0),O(Ll,Ll,0,0,0,Ll),{vertices:C,indices:I}}(this.tileID.canonical,e);l=p.vertices,d=p.indices}else{l=new Wc,d=new _i;for(const{x:m,y}of i)l.emplaceBack(m,y,0,0);const p=Nu(l.int16.subarray(0,4*l.length),void 0,4);for(let m=0;m<p.length;m+=3)d.emplaceBack(p[m],p[m+1],p[m+2])}this._tileBoundsBuffer=o.createVertexBuffer(l,dw.members),this._tileBoundsIndexBuffer=o.createIndexBuffer(d),this._tileBoundsSegments=pr.simpleSegment(0,0,l.length,d.length)}_makeGlobeTileDebugBuffers(o,e){const i=e.projection;if(!i||i.name!=="globe"||e.freezeTileCoverage)return;const l=this.tileID.canonical,d=qv(QP(l,e)),p=Ku(e.zoom);let m;p>0&&(m=re(new Float64Array(16),e.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(o,l,e,d,m,p),this._makeGlobeTileDebugTextBuffer(o,l,e,d,m,p)}_globePoint(o,e,i,l,d,p,m){let y=Wv(o,e,i);if(p){const b=1<<i.z,S=wl(l.center.lng),C=ba(l.center.lat),I=(i.x+.5)/b-S;let M=0;I>.5?M=-1:I<-.5&&(M=1);let R=(o/St+i.x)/b+M,O=(e/St+i.y)/b;R=(R-S)*l._pixelsPerMercatorPixel+S,O=(O-C)*l._pixelsPerMercatorPixel+C;const N=[R*l.worldSize,O*l.worldSize,0];Tr(N,N,p),y=Xu(y,N,m)}return Tr(y,y,d)}_makeGlobeTileDebugBorderBuffer(o,e,i,l,d,p){const m=new ea,y=new Cl,b=new Hc,S=(I,M,R,O,N)=>{const V=(R-I)/(N-1),G=(O-M)/(N-1),K=m.length;for(let q=0;q<N;q++){const ee=I+q*V,te=M+q*G;m.emplaceBack(ee,te);const le=this._globePoint(ee,te,e,i,l,d,p);b.emplaceBack(le[0],le[1],le[2]),y.emplaceBack(K+q)}},C=St;S(0,0,C,0,16),S(C,0,C,C,16),S(C,C,0,C,16),S(0,C,0,0,16),this._tileDebugIndexBuffer=o.createIndexBuffer(y),this._tileDebugBuffer=o.createVertexBuffer(m,Hv.members),this._globeTileDebugBorderBuffer=o.createVertexBuffer(b,qP.members),this._tileDebugSegments=pr.simpleSegment(0,0,m.length,y.length)}_makeGlobeTileDebugTextBuffer(o,e,i,l,d,p){const m=new ea,y=new _i,b=new Hc,S=25;y.reserve(32),m.reserve(S),b.reserve(S);const C=(I,M)=>S*I+M;for(let I=0;I<S;I++){const M=2048*I;for(let R=0;R<S;R++){const O=2048*R;m.emplaceBack(O,M);const N=this._globePoint(O,M,e,i,l,d,p);b.emplaceBack(N[0],N[1],N[2])}}for(let I=0;I<4;I++)for(let M=0;M<4;M++){const R=C(I,M),O=C(I,M+1),N=C(I+1,M),V=C(I+1,M+1);y.emplaceBack(R,O,N),y.emplaceBack(N,O,V)}this._tileDebugTextIndexBuffer=o.createIndexBuffer(y),this._tileDebugTextBuffer=o.createVertexBuffer(m,Hv.members),this._globeTileDebugTextBuffer=o.createVertexBuffer(b,qP.members),this._tileDebugTextSegments=pr.simpleSegment(0,0,S,32)}destroy(o=!0){for(const e in this.buckets)this.buckets[e].destroy(o);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&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),o&&this.texture&&this.texture instanceof Jc&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof Jc&&(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"}},T.b1=_w,T.b2=rv,T.b3=/^(.*)-use-theme$/,T.b4=Ti,T.b5=op,T.b6=Fs,T.b7=Kc,T.b8=Mv,T.b9=Pv,T.bA=K1,T.bB=function(o,e,i){const l=Math.sqrt(o*o+e*e+i*i),d=l>0?Math.acos(i/l)*Re:0;let p=o!==0||e!==0?Math.atan2(-e,-o)*Re+90:0;return p<0&&(p+=360),[l,p,d]},T.bC=IR,T.bD=(o,e,i,l,d,p)=>{const m=o.transform,y=m.projection.name==="globe";let b;if(p.paint.get("circle-pitch-alignment")==="map")if(y){const C=tD(m.zoom,e.canonical)*m._pixelsPerMercatorPixel;b=Float32Array.from([C,0,0,C])}else b=m.calculatePixelsToTileUnitsMatrix(i);else b=new Float32Array([m.pixelsToGLUnits[0],0,0,m.pixelsToGLUnits[1]]);const S={u_camera_to_center_distance:o.transform.getCameraToCenterDistance(m.projection),u_matrix:o.translatePosMatrix(e.projMatrix,i,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Zo.devicePixelRatio,u_extrude_scale:b,u_inv_rot_matrix:RG,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:p.paint.get("circle-emissive-strength")};if(y){S.u_inv_rot_matrix=l,S.u_merc_center=d,S.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],S.u_zoom_transition=Ku(m.zoom);const C=d[0]*St,I=d[1]*St;S.u_up_dir=m.projection.upVector(new hp(0,0,0),C,I)}return S},T.bE=o=>({u_camera_to_center_distance:new Ti(o),u_extrude_scale:new ap(o),u_device_pixel_ratio:new Ti(o),u_matrix:new sp(o),u_inv_rot_matrix:new sp(o),u_merc_center:new Fs(o),u_tile_id:new Kc(o),u_zoom_transition:new Ti(o),u_up_dir:new Kc(o),u_emissive_strength:new Ti(o)}),T.bF=fv,T.bG=Ie,T.bH=function(o){const e=ry();if(!e)return;const i=e.delete(rb);o&&i.then(()=>o()).catch(o)},T.bI=r,T.bJ=me,T.bK=Zt,T.bL=Dr,T.bM=Ne,T.bN=Nr,T.bO=function(o,e){return o[0]=-e[0],o[1]=-e[1],o[2]=-e[2],o[3]=e[3],o},T.bP=kc,T.bQ=QE,T.bR=X1,T.bS=function(o,e){return o[0]=e[0],o[1]=e[1],o[2]=e[2],o[3]=e[3],o[4]=e[4],o[5]=e[5],o[6]=e[6],o[7]=e[7],o[8]=e[8],o[9]=e[9],o[10]=e[10],o[11]=e[11],o[12]=e[12],o[13]=e[13],o[14]=e[14],o[15]=e[15],o},T.bT=ne,T.bU=wt,T.bV=H,T.bW=rs,T.bX=ys,T.bY=Ql,T.bZ=Gm,T.b_=Sn,T.ba=class extends Ka{constructor(o){super(o),this.current=new Float32Array(9)}set(o,e,i){if(!this.fetchUniformLocation(o,e))return;const l=this.current;for(let d=0;d<9;d++)if(i[d]!==l[d]){l.set(i),this.gl.uniformMatrix3fv(this.location,!1,l);break}}},T.bb=sp,T.bc=sD,T.bd=Vv,T.be=Rv,T.bf=Yc,T.bg=Kt,T.bh=Bd,T.bi=eD,T.bj=Pt,T.bk=is,T.bl=gg,T.bm=function(o,e){if(!o||!e)throw new Error("TileProvider name and URL are required");Nr.TILE_PROVIDER_URLS[o]=Zo.resolveURL(e)},T.bn=Ym,T.bo=um,T.bp=Tt,T.bq=function(o){return decodeURIComponent(atob(o).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},T.br=function(o){return btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},T.bs=mn,T.bt=dw,T.bu=function(o,e){const i=[];for(let l=0;l<o.length;l++){const d=dt(l-1,-1,o.length-1),p=dt(l+1,-1,o.length-1),m=o[l],y=o[p],b=o[d].sub(m).unit(),S=y.sub(m).unit(),C=S.angleWithSep(b.x,b.y),I=b.add(S).unit().mult(-1*e/Math.sin(C/2));i.push(m.add(I))}return i},T.bv=function(o){im++,im>Ds&&(o.getActor().send("enforceCacheSizeLimit",ib),im=0)},T.bw=function(o,e){const{x:i,y:l}=o.point,d=nD(i,l,o.worldSize/o._pixelsPerMercatorPixel,0,0);return he(d,d,EE(eu(e)))},T.bx=function(o){const{x:e,y:i}=o.point,{lng:l,lat:d}=o._center;return nD(e,i,o.worldSize,l,d)},T.by=function(o){const e=o.pixelsPerMeter,i=e/Ko(1,o.center.lat),l=oe(new Float64Array(16));return _e(l,l,[o.point.x,o.point.y,0]),De(l,l,[i,i,e]),Float32Array.from(l)},T.bz=pg,T.c=sE,T.c$=hD,T.c0=function(o,e,i,l){return o.type==="custom"?new NG(o,e):new $G[o.type](o,e,i,l)},T.c1=pi,T.c2=ji,T.c3=jm,T.c4=Te,T.c5=Kn,T.c6=function(o,e,i){return o[0]=e[0]/i[0],o[1]=e[1]/i[1],o[2]=e[2]/i[2],o},T.c7=Ar,T.c8=Nu,T.c9=Kd,T.cA=function(o,e){var i=Math.sin(e),l=Math.cos(e);return o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=l,o[6]=i,o[7]=0,o[8]=0,o[9]=-i,o[10]=l,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o},T.cB=function(o,e){var i=Math.sin(e),l=Math.cos(e);return o[0]=l,o[1]=0,o[2]=-i,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=i,o[9]=0,o[10]=l,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o},T.cC=function(o){const e=Math.round((o+45+360)%360/90)%4;return Me[e]},T.cD=function(o,e,i){let l=0;for(let d=0;d<2;++d)o[d]>0&&(l+=(o[d]-0)*(o[d]-0)),e[d]<0&&(l+=(0-e[d])*(0-e[d]));return l},T.cE=di,T.cF=mE,T.cG=Mc,T.cH=function(o,e){var i=2*Math.acos(e[3]),l=Math.sin(i/2);return l>L?(o[0]=e[0]/l,o[1]=e[1]/l,o[2]=e[2]/l):(o[0]=1,o[1]=0,o[2]=0),i},T.cI=function(o){let e=1/0,i=1/0,l=-1/0,d=-1/0;for(const p of o)e=Math.min(e,p.x),i=Math.min(i,p.y),l=Math.max(l,p.x),d=Math.max(d,p.y);return{min:new et(e,i),max:new et(l,d)}},T.cJ=function(){return{API_URL:Nr.API_URL,DRACO_URL:Nr.DRACO_URL,MESHOPT_URL:Nr.MESHOPT_URL,MESHOPT_SIMD_URL:Nr.MESHOPT_SIMD_URL,BUILDING_GEN_URL:Nr.BUILDING_GEN_URL}},T.cK=tb,T.cL=ja,T.cM=function(o,e){return ku(Object.assign(o,{method:"GET"}),e)},T.cN=Jx,T.cO=function(o){return o?{cacheControl:o.get("cache-control"),expires:o.get("expires")}:{cacheControl:void 0,expires:void 0}},T.cP=function(o,e,i,l){const d=e.getNorth(),p=e.getSouth(),m=e.getWest(),y=e.getEast(),b=1<<o.z,S=y-m,C=d-p,I=S/ju,M=-C/dv[i],R=[0,I,0,M,0,0,d,m,0];if(o.z>0){const O=180/l;ae(R,R,[O/S+1,0,0,0,O/C+1,0,-.5*O/I,.5*O/M,1])}return R[2]=b,R[5]=o.x,R[8]=o.y,R},T.cQ=am,T.cR=cE,T.cS=function(o){const e=o.lastIndexOf(Hf);return e>=0?o.slice(e+1):""},T.cT=Ic,T.cU=function(o){const e=80.051129;o=Ie(o,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(Te(o))),3);return Math.round(i*(dv.length-1))},T.cV=Sf,T.cW=eb,T.cX=Gu,T.cY=function(o){const e=o.indexOf(Hf);return e>=0?o.slice(0,e):o},T.cZ=$b,T.c_=function(o,e){const{scale:i}=o.tileTransform,l=i*St/(o.tileSize*Math.pow(2,e.zoom-o.tileID.overscaledZ+o.tileID.canonical.z)),d=e.inverseAdjustmentMatrix;return new Float32Array([d[0]*l,d[1]*l,d[2]*l,d[3]*l])},T.ca=ge,T.cb=Ue,T.cc=function(o){return o*o*o*o*o},T.cd=function([o,e,i]){const l=Math.hypot(o,e,i),d=Math.atan2(o,i),p=.5*Math.PI-Math.acos(-e/l);return new Qn(ke(d),ke(p))},T.ce=rh,T.cf=function(o){uf(),va!=null&&va.then(e=>{e.keys().then(i=>{for(let l=0;l<i.length-o;l++)e.delete(i[l]).catch(d=>Cn(d.message))}).catch(i=>Cn(i.message))}).catch(e=>Cn(e.message))},T.cg=function(o){return o>>>=0,o=Math.imul(2747636419^o,2654435769)>>>0,o=Math.imul(o^o>>>16,2654435769)>>>0,(o=Math.imul(o^o>>>16,2654435769)>>>0)/4294967296},T.ch=na,T.ci=Mo,T.cj=NP,T.ck=ev,T.cl=function(o,e){return o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]&&o[3]===e[3]},T.cm=Ci,T.cn=iy,T.co=Zo,T.cp=V1,T.cq=vR,T.cr=xr,T.cs=function(o,e){return o[0]=e[0],o[1]=e[1],o[2]=e[2],o[3]=e[4],o[4]=e[5],o[5]=e[6],o[6]=e[8],o[7]=e[9],o[8]=e[10],o},T.ct=It,T.cu=function(o,e){var i=Math.sin(e),l=Math.cos(e);return o[0]=l,o[1]=i,o[2]=0,o[3]=-i,o[4]=l,o[5]=0,o[6]=0,o[7]=0,o[8]=1,o},T.cv=At,T.cw=ft,T.cx=vt,T.cy=function(o,e,i,l){var d=new B(4);return d[0]=o,d[1]=e,d[2]=i,d[3]=l,d},T.cz=qs,T.d=256,T.d$=tL,T.d0=function(o){const e=QD(o,!0);return U([],[e[0],e[1],e[4],e[5]])},T.d1=QD,T.d2=q1,T.d3=tv,T.d4=sy,T.d5=function(o,e){var i=new B(3);Dt(i,e);var l=1/i[0],d=1/i[1],p=1/i[2],m=e[0]*l,y=e[1]*d,b=e[2]*p,S=e[4]*l,C=e[5]*d,I=e[6]*p,M=e[8]*l,R=e[9]*d,O=e[10]*p,N=m+C+O,V=0;return N>0?(V=2*Math.sqrt(N+1),o[3]=.25*V,o[0]=(I-R)/V,o[1]=(M-b)/V,o[2]=(y-S)/V):m>C&&m>O?(V=2*Math.sqrt(1+m-C-O),o[3]=(I-R)/V,o[0]=.25*V,o[1]=(y+S)/V,o[2]=(M+b)/V):C>O?(V=2*Math.sqrt(1+C-m-O),o[3]=(M-b)/V,o[0]=(y+S)/V,o[1]=.25*V,o[2]=(I+R)/V):(V=2*Math.sqrt(1+O-m-C),o[3]=(y-S)/V,o[0]=(M+b)/V,o[1]=(I+R)/V,o[2]=.25*V),o},T.d6=JD,T.d7=Dt,T.d8=aD,T.d9=function(o,e,i=0){return vt(((e.x-i)*o.scale-o.x)*St,(e.y*o.scale-o.y)*St,Ym(e.z,e.y))},T.dA=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},T.dB=Ny,T.dC=Tl,T.dD=sb,T.dE=AE,T.dF=function(o){return Nr.API_CDN_URL_REGEX.test(o)},T.dG=function(o){return Nr.API_FONTS_REGEX.test(o)},T.dH=nb,T.dI=function(o){return Nr.API_STYLE_REGEX.test(o)&&!nb(o)},T.dJ=function(o){return Nr.API_TILEJSON_REGEX.test(o)},T.dK=ty,T.dL=function(o){return o.indexOf("mapbox:")===0},T.dM=fm,T.dN=cy,T.dO=function(o){const e=o.navigator?o.navigator.userAgent:null;return!!function(i){if(Va==null){const l=i.navigator?i.navigator.userAgent:null;Va=!!i.safari||!(!l||!(ie.test(l)||l.match("Safari")&&!l.match("Chrome")))}return Va}(o)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(pe)))},T.dP=Dd,T.dQ=Rc,T.dR=xs,T.dS=function(o,e){const i=[];for(const l in o)l in e||i.push(l);return i},T.dT=Si,T.dU=Uu,T.dV=To,T.dW=zt,T.dX=function(o){var e=o[0],i=o[1],l=o[2],d=o[3];return Math.sqrt(e*e+i*i+l*l+d*d)},T.dY=Jt,T.dZ=zo,T.d_=function(o,e,i,l){var d=e[0],p=e[1],m=e[2],y=e[3];return o[0]=d+l*(i[0]-d),o[1]=p+l*(i[1]-p),o[2]=m+l*(i[2]-m),o[3]=y+l*(i[3]-y),o},T.da=Id,T.db=function(o,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let l=0;l<o.length;l++){const d=document.createElement("source");ab(o[l])||(i.crossOrigin="Anonymous"),d.src=o[l],i.appendChild(d)}return{cancel:()=>{}}},T.dc=HE,T.dd=function(o){const e=[0,0,0],i=oe(new Float64Array(16));return he(i,o.pixelMatrix,o.globeMatrix),Tr(e,e,i),new et(e[0],e[1])},T.de=EE,T.df=function(o,e){const i=[0,0,0];return Tr(i,i,qv(eu(e.canonical))),Tr(i,i,o),i},T.dg=C1,T.dh=qv,T.di=tD,T.dj=function(o,e,i){const l=oe(new Float64Array(16)),d=(e/(1<<o)-.5)*Math.PI*2;return nt(l,i.globeMatrix,d),Float32Array.from(l)},T.dk=eu,T.dl=rD,T.dm=Ku,T.dn=function(o,e,i){const l=Ku(i.zoom),d=o.style.map._antialias,p=o.terrain&&o.terrain.exaggeration()>0;return l===0&&!d&&!p},T.dp=vs,T.dq=oe,T.dr=re,T.ds=U,T.dt=function(o,e){var i=e[0],l=e[1],d=e[2],p=e[3],m=e[4],y=e[5],b=e[6],S=e[7],C=e[8],I=C*m-y*S,M=-C*p+y*b,R=S*p-m*b,O=i*I+l*M+d*R;return O?(o[0]=I*(O=1/O),o[1]=(-C*l+d*S)*O,o[2]=(y*l-d*m)*O,o[3]=M*O,o[4]=(C*i-d*b)*O,o[5]=(-y*i+d*p)*O,o[6]=R*O,o[7]=(-S*i+l*b)*O,o[8]=(m*i-l*p)*O,o):null},T.du=uy,T.dv=Nf,T.dw=Um,T.dx=function(o){return o.includes(Hf)},T.dy=wn,T.dz=function(o,e){const i=V1(o);return i!==null&&!!(e&1<<i)},T.e=uk,T.e$=c0,T.e0=(o,e,i,l,d,p,m,y,b,S)=>{const C=o.transform,I=C.pitch<15?Jt(.07,.7,Ie((14-C.zoom)/5,0,1)):.07,M=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:eL(o,e,i,l),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:C.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:d,u_width_scale:p,u_floor_width_scale:m,u_image:0,u_tile_units_to_pixels:JR(e,C),u_units_to_pixels:[1/C.pixelsToGLUnits[0],1/C.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:y,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:I,u_tile_to_meter:Qs(e.tileID.canonical,0),u_ground_shadow_factor:b,u_pattern_transition:S,u_opacity_multiplier:1}},T.e1=o=>({u_matrix:new sp(o),u_texsize:new Fs(o),u_pixels_to_tile_units:new ap(o),u_device_pixel_ratio:new Ti(o),u_width_scale:new Ti(o),u_floor_width_scale:new Ti(o),u_image:new op(o),u_units_to_pixels:new Fs(o),u_tile_units_to_pixels:new Ti(o),u_alpha_discard_threshold:new Ti(o),u_trim_offset:new Fs(o),u_trim_fade_range:new Fs(o),u_trim_gradient_mix_range:new Fs(o),u_trim_color:new Mv(o),u_zbias_factor:new Ti(o),u_tile_to_meter:new Ti(o),u_ground_shadow_factor:new Kc(o),u_pattern_transition:new Ti(o),u_opacity_multiplier:new Ti(o)}),T.e2=(o,e,i,l,d,p,m,y,b,S)=>{const C=o.transform,I=C.calculatePixelsToTileUnitsMatrix(e),M=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",R=C.pitch<15?Jt(.07,.7,Ie((14-C.zoom)/5,0,1)):.07;return{u_matrix:eL(o,e,i,l),u_pixels_to_tile_units:I,u_device_pixel_ratio:p,u_width_scale:m,u_floor_width_scale:y,u_units_to_pixels:[1/C.pixelsToGLUnits[0],1/C.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:d,u_texsize:nL(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:JR(e,o.transform),u_alpha_discard_threshold:0,u_trim_offset:b,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:Qs(e.tileID.canonical,0),u_ground_shadow_factor:S,u_opacity_multiplier:1}},T.e3=o=>({u_matrix:new sp(o),u_pixels_to_tile_units:new ap(o),u_device_pixel_ratio:new Ti(o),u_width_scale:new Ti(o),u_floor_width_scale:new Ti(o),u_units_to_pixels:new Fs(o),u_dash_image:new op(o),u_gradient_image:new op(o),u_image_height:new Ti(o),u_texsize:new Fs(o),u_tile_units_to_pixels:new Ti(o),u_alpha_discard_threshold:new Ti(o),u_trim_offset:new Fs(o),u_trim_fade_range:new Fs(o),u_trim_gradient_mix_range:new Fs(o),u_trim_color:new Mv(o),u_zbias_factor:new Ti(o),u_tile_to_meter:new Ti(o),u_ground_shadow_factor:new Kc(o),u_opacity_multiplier:new Ti(o)}),T.e4=function(o){return[Math.pow(o[0],1/2.2),Math.pow(o[1],1/2.2),Math.pow(o[2],1/2.2)]},T.e5=function(o){let e=0;if(new Uint32Array(o,0,1)[0]!==WD){const i=new Uint32Array(o,0,7),[,,l,d,p,m]=i;e=i.byteLength+d+p+m+p,(l!==o.byteLength||e>=o.byteLength)&&Cn("Invalid b3dm header information.")}return KD(o,e)},T.e6=YD,T.e7=function(o,e,i,l,d){const p=function(y,b){if(y)return d(y);if(b){o.url&&b.tiles&&o.tiles&&delete o.tiles;const S=ZL(o,b,e);if(S instanceof Error)return d(S);d(null,S)}},m=function(y,b,S){if(!y)return null;if(!b&&!S)return y;S=S||y.worldview_default;const C=Object.values(y.language||{});if(C.length===0)return null;const I=Object.values(y.worldview||{});if(I.length===0)return null;const M=C.every(O=>O===b),R=I.every(O=>O===S);return M&&R?y:b in(y.language_options||{})||S in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(o.data,i,l);return m?Zo.frame(()=>p(null,m)):o.url?Ic(e.transformRequest(e.normalizeSourceURL(o.url,null,i,l),Ac.Source),p):Zo.frame(()=>{const{data:y,...b}=o;p(null,b)})},T.e8=async function(o,e){const i=XL.get(o);if(i)return i;const l=vk.get(o);if(l!==void 0)return l;const d=import(e).catch(p=>{throw new Error(`TileProvider "${o}" failed to load: ${p instanceof Error?p.message:String(p)}`)}).then(p=>{const m=p.default;if(typeof m!="function")throw new Error(`TileProvider "${o}" module must default-export a class`);if(typeof m.prototype.loadTile!="function")throw new Error(`TileProvider "${o}" class must have a loadTile method`);return XL.set(o,m),m}).finally(()=>{vk.delete(o)});return vk.set(o,d),d},T.e9=function(o,e,i){const l=JSON.stringify(o.request);return o.data&&(this.deduped.entries[l]={result:[null,o.data]}),this.deduped.request(l,{type:"parseTile",renderSourceType:o.renderSourceType,zoom:o.tileZoom},d=>{const p=Mc(o.request,(m,y,b)=>{m?sb(m)?d(null,null):d(m):y&&d(null,{rawData:y,vectorTile:i?void 0:new Rv(new En(y)),responseHeaders:new Map(b.entries())})});return()=>{p.cancel(),d(null,null)}},e)},T.eA=lf,T.eB=function(o,e,i,l,d,p,m){var y=1/(e-i),b=1/(l-d),S=1/(p-m);return o[0]=-2*y,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*b,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*S,o[11]=0,o[12]=(e+i)*y,o[13]=(d+l)*b,o[14]=(m+p)*S,o[15]=1,o},T.eC=function(o,e){const i=o.url&&!o.tiles?e.transformRequest(o.url,Ac.Source):void 0;return{request:i,options:i?Object.assign({},o,{url:i.url}):o}},T.eD=function(o,e,i,l,d,p,m,y=1,b,S,C,I,M,R,O,N,V){o.createArrays(),o.tilePixelRatio=St/(512*o.overscaling),o.compareText={},o.iconsNeedLinear=!1;const G=o.layers[0].layout,K=o.layers[0]._unevaluatedLayout._values,q={};q.scaleFactor=y,q.textSizeScaleRange=G.get("text-size-scale-range"),q.iconSizeScaleRange=G.get("icon-size-scale-range");const[ee,te]=q.textSizeScaleRange,[le,xe]=q.iconSizeScaleRange;q.textScaleFactor=Ie(q.scaleFactor,ee,te),q.iconScaleFactor=Ie(q.scaleFactor,le,xe);const de=K["text-size"],ve=K["icon-size"];if(o.textSizeData.kind==="composite"){const{minZoom:je,maxZoom:at}=o.textSizeData;q.compositeTextSizes=[de.possiblyEvaluate(new Yn(je,{worldview:C}),p),de.possiblyEvaluate(new Yn(at,{worldview:C}),p)]}if(o.iconSizeData.kind==="composite"){const{minZoom:je,maxZoom:at}=o.iconSizeData;q.compositeIconSizes=[ve.possiblyEvaluate(new Yn(je,{worldview:C}),p,I),ve.possiblyEvaluate(new Yn(at,{worldview:C}),p,I)]}q.layoutTextSize=de.possiblyEvaluate(new Yn(m+1,{worldview:C}),p),q.layoutIconSize=ve.possiblyEvaluate(new Yn(m+1,{worldview:C}),p,I),q.textMaxSize=de.possiblyEvaluate(new Yn(18,{worldview:C}),p);const Se=G.get("symbol-placement"),we=G.get("text-rotation-alignment")==="map"&&Se!=="point",Fe=G.get("text-size");let Ve=!1;const qe=[],Ke=M!=null&&M!==0;for(const je of o.features){if(Ke&&je.properties&&N&&N(je.properties,M))continue;const at=G.get("text-font").evaluate(je,{},p).join(","),Ge=Fe.evaluate(je,{},p)*q.textScaleFactor,$e=q.layoutTextSize.evaluate(je,{},p)*q.textScaleFactor,Ye=q.layoutIconSize.evaluate(je,{},p,I)*q.iconScaleFactor,rt={horizontal:{},vertical:void 0},lt=je.text;let yt,tt=[0,0];if(lt){const Po=lt.toString(),Sr=G.get("text-letter-spacing").evaluate(je,{},p)*ct,kr=G.get("text-line-height").evaluate(je,{},p)*ct,Mi=T2(Po)?Sr:0,uo=G.get("text-anchor").evaluate(je,{},p),ki=G.get("text-variable-anchor");if(!ki){const qi=G.get("text-radial-offset").evaluate(je,{},p);if(qi)tt=NP(uo,[qi*ct,pE]);else{const Zi=G.get("text-offset").evaluate(je,{},p);tt=[Zi[0]*ct,Zi[1]*ct]}}let yn=we?"center":G.get("text-justify").evaluate(je,{},p);const Vo=Se==="point",jo=Vo?G.get("text-max-width").evaluate(je,{},p)*ct:1/0,Do=qi=>{o.allowVerticalPlacement&&Yy(Po)&&(rt.vertical=si(lt,e,i,d,at,jo,kr,uo,qi,Mi,tt,Kt.vertical,!0,$e,Ge,b,q.textScaleFactor))};if(!we&&ki){const qi=yn==="auto"?ki.map(Ro=>mE(Ro)):[yn];let Zi=!1;for(let Ro=0;Ro<qi.length;Ro++){const Pi=qi[Ro];if(!rt.horizontal[Pi])if(Zi)rt.horizontal[Pi]=rt.horizontal[0];else{const Pr=si(lt,e,i,d,at,jo,kr,"center",Pi,Mi,tt,Kt.horizontal,!1,$e,Ge,b,q.textScaleFactor);Pr&&(rt.horizontal[Pi]=Pr,Zi=Pr.positionedLines.length===1)}}Do("left")}else{if(yn==="auto"&&(yn=mE(uo)),Vo||G.get("text-writing-mode").includes("horizontal")||!Yy(Po)){const qi=si(lt,e,i,d,at,jo,kr,uo,yn,Mi,tt,Kt.horizontal,!1,$e,Ge,b,q.textScaleFactor);qi&&(rt.horizontal[yn]=qi)}Do(Vo?"left":yn)}}let mt,bt,Ft,Rt,Wt,ln,en=!1;const gn=G.get("icon-text-fit").evaluate(je,{},p);if(je.icon&&je.icon.hasPrimary()){const Po=$v(je.icon,o.iconSizeData,K["icon-size"],p,o.zoom,je,b,q.iconScaleFactor,C,I);mt=Po.iconPrimary,Ft=Po.iconSecondary;const Sr=mt.toString();if(bt=l.get(Sr),bt&&(Wt=G.get("icon-offset").evaluate(je,{},p),ln=G.get("icon-anchor").evaluate(je,{},p),yt=mr(d.get(Sr),Ft?d.get(Ft.toString()):void 0,Wt,ln),en=bt.sdf,o.sdfIcons===void 0?o.sdfIcons=bt.sdf:o.sdfIcons!==bt.sdf&&Cn("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(bt.pixelRatio!==o.pixelRatio||G.get("icon-rotate").constantOr(1)!==0)&&(o.iconsNeedLinear=!0)),Ft){const kr=Ft.toString();Rt=l.get(kr)}}Ve=Ve||!(!je.icon||!je.icon.hasSecondary());const cn=E1(rt.horizontal)||rt.vertical;o.iconsInText||(o.iconsInText=!!cn&&cn.iconsInText);const Gn=$e*q.textScaleFactor/ct,{defaultShapedIcon:Yt,verticallyShapedIcon:gr}=X6(o,yt,G,je,p,rt,Gn,Wt,gn);gn!=="none"&&yt&&(On(yt)||ai(yt))&&(T1(0,bt,mt,yt,Yt,gn,S,l,d),T1(0,Rt,Ft,yt,Yt,gn,S,l,d),gr&&(T1(0,bt,mt,yt,gr,gn,S,l,d),T1(0,Rt,Ft,yt,gr,gn,S,l,d))),yt=Yt;const{iconBBox:ar,iconVerticalBBox:Er,textBBox:wr,textVerticalBBox:li}=$6(o,yt,gr,G,je,p,Ye,Wt,q,d,ln,rt,$e,tt,I);qe.push({feature:je,shapedTextOrientations:rt,shapedText:cn,shapedIcon:yt,iconPrimary:mt,iconSecondary:Ft,iconOffset:Wt,iconAnchor:ln,verticallyShapedIcon:gr,layoutTextSize:$e,layoutIconSize:Ye,textOffset:tt,isSDFIcon:en,iconTextFit:gn,iconCollisionBounds:ar,iconVerticalCollisionBounds:Er,textCollisionBounds:wr,textVerticalCollisionBounds:li})}return{featureData:qe,sizes:q,hasAnySecondaryIcon:Ve,textAlongLine:we,symbolPlacement:Se,coverageFrcMask:M,coveragePolygons:R,coverageTileZoom:O,isFeatureCoveredByFrcMask:N,symbolAnchorInFrcCoverage:V}},T.eE=function(o,e,i,l,d){var p=1/Math.tan(e/2);if(o[0]=p/i,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=p,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[11]=-1,o[12]=0,o[13]=0,o[15]=0,d!=null&&d!==1/0){var m=1/(l-d);o[10]=(d+l)*m,o[14]=2*d*l*m}else o[10]=-1,o[14]=-2*l;return o},T.eF=jt,T.eG=QR,T.eH=qa,T.eI=yD,T.eJ=ss,T.eK=function(o){const e=oe(new Float64Array(16));he(e,o.pixelMatrix,o.globeMatrix);const i=[0,ka,0],l=[0,Aa,0];return Tr(i,i,e),Tr(l,l,e),[i[0]>0&&i[0]<=o.width&&i[1]>0&&i[1]<=o.height&&!AE(o,new Qn(o.center.lat,90)),l[0]>0&&l[0]<=o.width&&l[1]>0&&l[1]<=o.height&&!AE(o,new Qn(o.center.lat,-90))]},T.eL=Qc,T.eM=v1,T.eN=Ov,T.eO=Lv,T.eP=function(o,e,i=0,l=!0){const d=new et(i,i),p=o.sub(d),m=e.add(d),y=[p,new et(m.x,p.y),m,new et(p.x,m.y)];return l&&y.push(p.clone()),y},T.eQ=Hv,T.eR=function(o,e){return ku(Object.assign(o,{method:"POST"}),e)},T.eS=function(o,e,i,l,d,p,m,y,b,S){o.iconAtlasPositions=S.iconPositions;const{featureData:C,hasAnySecondaryIcon:I,sizes:M,textAlongLine:R,symbolPlacement:O,coveragePolygons:N,coverageTileZoom:V,symbolAnchorInFrcCoverage:G}=e;for(const K of C){const{shapedIcon:q,verticallyShapedIcon:ee,feature:te,shapedTextOrientations:le,shapedText:xe,layoutTextSize:de,textOffset:ve,isSDFIcon:Se,iconPrimary:we,iconSecondary:Fe,iconTextFit:Ve,iconOffset:qe,iconCollisionBounds:Ke,iconVerticalCollisionBounds:je,textCollisionBounds:at}=K;GP(q,S.iconPositions,we,Fe),GP(ee,S.iconPositions,we,Fe),Z6(le,S.iconPositions),q6(we,Fe,S.iconPositions),(xe||q)&&K6(o,te,le,q,ee,b,M,de,0,ve,Se,l,d,m,y,I,Ve,qe,R,O,Ke,je,at,0,0,N,V,G)}i&&o.generateCollisionDebugBuffers(p,o.collisionBoxArray,M.textScaleFactor),o.text.uboBinder&&o.text.uboBinder.finalize(),o.icon.uboBinder&&o.icon.uboBinder.finalize()},T.eT=hg,T.eU=function(o){return o<=1?1:Math.pow(2,Math.floor(Math.log2(o)))},T.eV=function(o,e){const i=o.json.extensionsUsed&&o.json.extensionsUsed.includes("mbx_bvh"),l=QE(o);for(const d of l){if(!i)for(const p of d.meshes)nG(p);d.lights&&(d.lightMeshIndex=d.meshes.length,d.meshes.push(rG(d.lights,e)))}return l},T.eW=function(o,e,i){return e?ZL(o,e,i):o.tiles&&o.tiles.length>0?{tiles:o.tiles}:new Error('TileJSON is missing required "tiles" property')},T.eX=ke,T.eY=["type","source","source-layer","minzoom","maxzoom","filter","layout"],T.eZ=Mt,T.e_=function(o){return o({pluginStatus:us,pluginURL:Vc}),ev.on("pluginStateChange",o),o},T.ea=ov,T.eb=Nn,T.ec=function(o,e,i,l,d){return Ie((o-e)/(i-e)*(d-l)+l,l,d)},T.ed=UE,T.ee=function(o,e,i){return o[0]=Math.max(e[0],i[0]),o[1]=Math.max(e[1],i[1]),o[2]=Math.max(e[2],i[2]),o[3]=Math.max(e[3],i[3]),o},T.ef=function(o){const e=o.layers[0];e.type==="circle"&&e.layout.get("circle-elevation-reference")==="hd-road-markup"&&(o.hdExt=new zD)},T.eg=function(o,e){const i=o.layers[0].layout.get("fill-elevation-reference"),l=i==="hd-road-base"||i==="hd-road-markup"?i:null,d=!!e&&e.length>0&&UE(e,o.layers[0].source,o.sourceLayerName);(l||d)&&(o.hdExt=new OD(o,l,d))},T.eh=function(o,e){const i=o.layers[0].layout.get("line-elevation-reference")==="hd-road-markup",l=!!e&&e.length>0&&UE(e,o.layers[0].source,o.sourceLayerName);(i||l)&&(o.hdExt=new FD(i,l))},T.ei=function(o){o.layers[0].layout.get("symbol-elevation-reference")==="hd-road-markup"&&(o.hdExt=new BD)},T.ej=tc,T.ek=wl,T.el=ba,T.em=Ko,T.en=function(o,e,i){return o[0]=Math.min(e[0],i[0]),o[1]=Math.min(e[1],i[1]),o[2]=Math.min(e[2],i[2]),o[3]=Math.min(e[3],i[3]),o},T.eo=kt,T.ep=Vi,T.eq=Cm,T.er=he,T.es=bn,T.et=lm,T.eu=wo,T.ev=o8,T.ew=hn,T.ex=$n,T.ey=hr,T.ez=Ec,T.f=hp,T.f$=dt,T.f0=t1,T.f1=function(o){if("provider"in o&&!o.provider)return null;let e=o.provider;if(!e&&"url"in o&&o.url&&(e=function(d){try{const p=new URL(d).pathname.split("/").pop()||"",m=p.lastIndexOf(".");return m>=0?p.slice(m+1):""}catch{return""}}(o.url)),!e)return null;const i=Nr.TILE_PROVIDER_URLS[e];if(!i)return null;let l;try{l=new URL(i,Nr.API_URL).href}catch{return new Error(`TileProvider "${e}" has an invalid URL: "${i}"`)}return{name:e,url:l}},T.f2=Ct,T.f3=He,T.f4=sn,T.f5=function(o,e,i){i*=.5;var l=e[0],d=e[1],p=e[2],m=e[3],y=Math.sin(i),b=Math.cos(i);return o[0]=l*b+d*y,o[1]=d*b-l*y,o[2]=p*b+m*y,o[3]=m*b-p*y,o},T.f6=Xe,T.f7=ws,T.f8=function(o,e){return[Math.pow(o[0],2.2)*e,Math.pow(o[1],2.2)*e,Math.pow(o[2],2.2)*e]},T.f9=Eu,T.fA=By,T.fB=kb,T.fC=Ys,T.fD=zy,T.fE=function(o,e,i,l,d,p,m,y,b){if(b.name==="globe")return eD(o,e,new hp(i,l,d),!1);const S=fp({z:i,x:l,y:d},b);return new Qr([(p+S.x/S.scale)*e,e*(S.y/S.scale),m],[(p+S.x2/S.scale)*e,e*(S.y2/S.scale),y])},T.fF=I1,T.fG=pk,T.fH=Qs,T.fI=fp,T.fJ=Ls,T.fK=ns,T.fL=Tr,T.fM=oi,T.fN=_D,T.fO=ma,T.fP=QP,T.fQ=_e,T.fR=function(o,e){if(o===e){var i=e[1],l=e[2],d=e[3],p=e[6],m=e[7],y=e[11];o[1]=e[4],o[2]=e[8],o[3]=e[12],o[4]=i,o[6]=e[9],o[7]=e[13],o[8]=l,o[9]=p,o[11]=e[14],o[12]=d,o[13]=m,o[14]=y}else o[0]=e[0],o[1]=e[4],o[2]=e[8],o[3]=e[12],o[4]=e[1],o[5]=e[5],o[6]=e[9],o[7]=e[13],o[8]=e[2],o[9]=e[6],o[10]=e[10],o[11]=e[14],o[12]=e[3],o[13]=e[7],o[14]=e[11],o[15]=e[15];return o},T.fS=Fb,T.fT=Nb,T.fU=Un,T.fV=vr,T.fW=function(o,e,i,l,d){const p=5*e+2;o.float32[p+0]=i,o.float32[p+1]=l,o.float32[p+2]=d},T.fX=function(){return function o(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,o)}()},T.fY=function(o){const e=[],i=o.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),o.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),o.renderingMode&&o.renderingMode!=="2d"&&o.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},T.fZ=function(o){return!!o&&Z.test(o)},T.f_=Cn,T.fa=Tn,T.fb=za,T.fc=De,T.fd=mi,T.fe=Wr,T.ff=pt,T.fg=function(o){Nr.ACCESS_TOKEN=o},T.fh=function(o){Nr.API_URL=o},T.fi=function(o){Nr.BUILDING_GEN_URL=Zo.resolveURL(o)},T.fj=function(o,e){ib=o,Ds=e},T.fk=function(o,e,i){o[4*e+0]=i[0],o[4*e+1]=i[1],o[4*e+2]=i[2],o[4*e+3]=i[3]},T.fl=function(o){Nr.DRACO_URL=Zo.resolveURL(o)},T.fm=function(o){Nr.MAX_PARALLEL_IMAGE_REQUESTS=o},T.fn=function(o){const e=Zo.resolveURL(o);Nr.MESHOPT_URL=e,Nr.MESHOPT_SIMD_URL=e},T.fo=function(o,e,i=!1){if(us===ws.deferred||us===ws.loading||us===ws.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Vc=Zo.resolveURL(o),us=ws.deferred,$f=e,Jy(),i||zb()},T.fp=fD,T.fq=st,T.fr=uE,T.fs=Le,T.ft=Na,T.fu=Ni,T.fv=function(o){try{const e=self[o];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},T.fw=ny,T.fx=Or,T.fy=zn,T.fz=An,T.g=Ae,T.g0=So,T.h=ig,T.i=qn,T.j=bs,T.k=Sg,T.l=_t,T.m=class{constructor(o){this.entries={},this.scheduler=o}request(o,e,i,l){const d=this.entries[o]=this.entries[o]||{callbacks:[]};if(d.result){const[p,m]=d.result;return this.scheduler?this.scheduler.add(()=>{l(p,m)},e):l(p,m),()=>{}}return d.callbacks.push(l),d.cancel||(d.cancel=i((p,m)=>{d.result=[p,m];for(const y of d.callbacks)this.scheduler?this.scheduler.add(()=>{y(p,m)},e):y(p,m);setTimeout(()=>delete this.entries[o],3e3)})),()=>{d.result||(d.callbacks=d.callbacks.filter(p=>p!==l),d.callbacks.length||(d.cancel(),delete this.entries[o]))}}},T.n=[1,1,1],T.o=PL,T.p=class{constructor(o){this.specification=o}possiblyEvaluate(o,e){return function([i,l]){const d=Na([1,i,l]);return{x:d.x,y:d.y,z:d.z}}(o.expression.evaluate(e))}interpolate(o,e,i){return{x:Jt(o.x,e.x,i),y:Jt(o.y,e.y,i),z:Jt(o.z,e.z,i)}}},T.q=7,T.r=St,T.s=class{isDataAvailableAtPoint(o){const e=this._source();if(this.isUsingMockSource()||!e||o.y<0||o.y>1)return!1;const i=e.getSource().maxzoom,l=1<<i,d=Math.floor(o.x),p=Math.floor((o.x-d)*l),m=Math.floor(o.y*l),y=this.findDEMTileFor(new fs(i,d,i,p,m));return!(!y||!y.dem)}getAtPointOrZero(o,e=0){return this.getAtPoint(o,e)||0}getAtPoint(o,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const l=this._source();if(!l||o.y<0||o.y>1)return e;const d=l.getSource().maxzoom,p=1<<d,m=Math.floor(o.x),y=o.x-m,b=new fs(d,m,d,Math.floor(y*p),Math.floor(o.y*p)),S=this.findDEMTileFor(b);if(!S||!S.dem)return e;const C=S.dem,I=1<<S.tileID.canonical.z,M=(y*I-S.tileID.canonical.x)*C.dim,R=(o.y*I-S.tileID.canonical.y)*C.dim,O=Math.floor(M),N=Math.floor(R);return(i?this.exaggeration():1)*Jt(Jt(C.get(O,N),C.get(O,N+1),R-N),Jt(C.get(O+1,N),C.get(O+1,N+1),R-N),M-O)}static getAtTileOffset(o,e,i,l){const d=1<<o.canonical.z;return l?l.pointElevation(e):i?i.getAtPointOrZero(new No(o.wrap+(o.canonical.x+e.x/St)/d,(o.canonical.y+e.y/St)/d)):0}static getAtTileOffsetFunc(o,e,i,l){return(d,p,m)=>{const y=this.getAtTileOffset(o,d,p,m),b=l.upVector(o.canonical,d.x,d.y);return Tn(b,b,y*l.upVectorScale(o.canonical,e,i).metersToTile),b}}getForTilePoints(o,e,i,l){if(this.isUsingMockSource())return!1;const d=Sg.create(this,o,l);return!!d&&(e.forEach(p=>{p[2]=this.exaggeration()*d.getElevationAt(p[0],p[1],i,!0)}),!0)}getMinMaxForTile(o){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(o);if(!e||!e.dem)return null;const i=e.dem.tree,l=e.tileID,d=1<<o.canonical.z-l.canonical.z;let p=o.canonical.x/d-l.canonical.x,m=o.canonical.y/d-l.canonical.y,y=0;for(let b=0;b<o.canonical.z-l.canonical.z&&!i.leaves[y];b++){p*=2,m*=2;const S=2*Math.floor(m)+Math.floor(p);y=i.childOffsets[y]+S,p%=1,m%=1}return{min:this.exaggeration()*i.minimums[y],max:this.exaggeration()*i.maximums[y]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(o,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(o){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(o){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const o=this.visibleDemTiles;if(o.length===0)return null;let e=!1,i=Number.MAX_VALUE,l=Number.MIN_VALUE;for(const d of o){const p=this.getMinMaxForTile(d.tileID);p&&(i=Math.min(i,p.min),l=Math.max(l,p.max),e=!0)}return e?{min:i,max:l}:null}},T.t=class{static parseFrom(o,e){const i=Qu.parse(o);if(!i)return[];let{vertices:l,features:d}=i;const p=1/Qs(e);d.sort((S,C)=>S.id-C.id),l.sort((S,C)=>S.id-C.id||S.idx-C.idx),l=l.filter((S,C,I)=>C===I.findIndex(M=>M.id===S.id&&M.idx===S.idx));const m=new Array;let y=0;const b=l.length;for(const S of d){if(S.constantHeight){m.push(new DE(S.id,S.bounds,S.constantHeight));continue}for(;y!==b&&l[y].id<S.id;)y++;if(y===b||l[y].id!==S.id)continue;const C=new Array,I=new Array,M=y;for(;y!==b&&l[y].id===S.id;){const R=l[y];if(C.push({position:R.position,height:R.height,extent:R.extent}),y!==M&&l[y-1].idx===R.idx-1){const O=y-M;I.push({a:O-1,b:O})}y++}m.push(new DE(S.id,S.bounds,void 0,C,I,p))}return m}},T.u=Yu,T.v=cm,T.w=Yn,T.x=Xl,T.y=Au,T.z=6}),v(["require","./shared"],function(c,T){function L(Re){const Z=Re?Re.url.toString():void 0;return Z?performance.getEntriesByName(Z):[]}function B(Re,Z){if(Object.hasOwn(Re.layers,T.W))return T.t.parseFrom(Re.layers[T.W],Z)}function U({buckets:Re,data:Z,sourceLayerCoder:ie,canonical:pe,options:Te}){if(!Te.elevationFeatures||Te.elevationFeatures.length===0)return;const ke=[];for(const Ue of Object.values(Re))if(Ue instanceof T.J&&Ue.hdExt){const ge=Ue.hdExt.getUnevaluatedPortalGraph();ge&&ke.push(ge)}const Me=T.u.evaluate(ke);for(const Ue of Object.values(Re))if(Ue instanceof T.J&&Ue.hdExt){const ge=Z.layers[ie.decode(Ue.sourceLayerIndex)];Ue.hdExt.setEvaluatedPortalGraph(Me,ge,pe,Te.availableImages,Te.brightness,Ue.worldview)}}function H(Re){const Z=[];for(let ie=0;ie<Re.length;ie++){const pe=Re.feature(ie),Te=pe.properties.frc_mask;if(Te==null)continue;const ke=Number(Te);if(!ke)continue;const Me=pe.loadGeometry();if(Me.length>0){let ge=!1;for(const Ie of Me[0])if(Ie.x<0||Ie.x>T.r||Ie.y<0||Ie.y>T.r){ge=!0;break}if(ge)continue}const Ue=Me.length===1&&Me[0].length===5&&Me[0].some(ge=>ge.x<=0&&ge.y<=0)&&Me[0].some(ge=>ge.x>=T.r&&ge.y<=0)&&Me[0].some(ge=>ge.x>=T.r&&ge.y>=T.r)&&Me[0].some(ge=>ge.x<=0&&ge.y>=T.r);Z.push(new T.M(ke,Ue?[]:Me))}return Z}function X(Re,Z,ie,pe,Te){const ke=T.cp(Z);if(ke===null)return!1;let Me=ie.x,Ue=ie.y;const ge=Te??pe.z;if(pe.z!==ge){const Ie=1<<pe.z-ge,st=T.r/Ie;Me=pe.x%Ie*st+ie.x/Ie,Ue=pe.y%Ie*st+ie.y/Ie}for(const Ie of Re){if(!(Ie.hasGeometry()&&Ie.frcMask&1<<ke))continue;const st=Ie.rings.map(dt=>dt.map(Tt=>[Tt.x,Tt.y]));if(T.eJ([Me,Ue],st))return!0}return!1}function ae(Re,Z,ie,pe){const Te=Z.indoorState.activeFloorsVisible;if(!Z.sourceLayers)return Te?Z.indoorState.activeFloors:void 0;const ke=function(ge,Ie){if(!ge)return T.f_("No source layers defined in indoor specification"),Ie;if(ge.size===0)return Ie;const st=ge.difference(Ie);for(const dt of st)T.f_(`Missing source layer required in indoor specification: ${dt}`);return Ie.intersection(Ie)}(Z.sourceLayers,new Set(Object.keys(Re.layers))),Me=Z.indoorState,Ue=function(ge,Ie,st,dt,Tt){const jt={};for(const Xt of Ie){const Un=ge.layers[Xt];if(Un)for(let hn=0;hn<Un.length;hn++){const mn=Un.feature(hn);if(_e(mn)){const{id:Nn,center:xr}=oe(mn);ne(jt,Nn,xr);continue}if(De(mn)){const Nn=re(mn,Tt);me(jt,Nn.buildings,Nn.id,Nn)}}else T.f_(`indoor source layer not found: ${Xt}`)}return{buildings:jt,activeFloors:T.a5.calculate(jt,dt,st)}}(Re,ke,Me.activeFloors,Me.selectedFloorId,pe);return ie.send("setIndoorData",Ue),Te?Ue.activeFloors:void 0}function ne(Re,Z,ie){Re[Z]?ie&&(Re[Z].center=ie):Re[Z]={floorIds:new Set,center:ie||[0,0],floors:{}}}function me(Re,Z,ie,pe){for(const Te of Z)ne(Re,Te),Re[Te].floors[ie]=pe,Re[Te].floorIds.add(ie)}function oe(Re){return{id:Re.properties.id.toString(),center:[Re.properties.center_lon||0,Re.properties.center_lat||0]}}function re(Re,Z){const ie=Re.properties.id.toString(),pe=!!Re.properties.is_default&&Re.properties.is_default,Te=Re.properties.connected_floor_ids?new Set(Re.properties.connected_floor_ids.toString().split(";")):new Set,ke=Re.properties.conflicted_floor_ids?new Set(Re.properties.conflicted_floor_ids.toString().split(";")):new Set,Me=Re.properties.structure_ids?new Set(Re.properties.structure_ids.toString().split(";")):new Set,Ue=Re.properties.name.toString(),ge=Re.properties.z_index,Ie=function(st,dt){const Tt=st.loadGeometry();if(!Tt||Tt.length===0)return;const jt=Tt.map(Xt=>Xt.map(Un=>T.cV(Un,dt,st.extent)));return jt.length===0?void 0:{type:"Polygon",coordinates:[jt[0]]}}(Re,Z);return{id:ie,isDefault:pe,connections:Te,conflicts:ke,buildings:Me,name:Ue,zIndex:ge,geometry:Ie}}function he(Re,Z){return Z.every(ie=>Re.properties&&Re.properties[ie]!=null)}function _e(Re){return he(Re,["type","id","name"])&&Re.properties.type==="structure"}function De(Re){return he(Re,["type","id","name","z_index"])&&Re.properties.type==="floor"}function He(Re,Z){Re instanceof T.J?T.eg(Re,Z):Re instanceof T.aa?T.eh(Re,Z):Re instanceof T.g?T.ef(Re):Re instanceof T.aX&&T.ei(Re)}function nt(Re){if(typeof Re=="number"||typeof Re=="boolean"||typeof Re=="string"||Re==null)return JSON.stringify(Re);if(Array.isArray(Re)){let ie="[";for(const pe of Re)ie+=`${nt(pe)},`;return`${ie}]`}let Z="{";for(const ie of Object.keys(Re).sort())Z+=`${ie}:${nt(Re[ie])},`;return`${Z}}`}function Xe(Re){let Z="";for(const ie of T.eY)Z+=`/${nt(Re[ie])}`;return Z}function ft(Re,Z){return function ie(pe){return typeof pe=="string"&&pe===Z||(Array.isArray(pe)?pe.some(ie):!(!pe||typeof pe!="object")&&Object.values(pe).some(ie))}(Re)}class At{constructor(Z){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),Z&&this.replace(Z)}replace(Z,ie){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(Z,[],ie)}update(Z,ie,pe){this._options=pe;for(const ke of Z)this._layerConfigs[ke.id]=ke,(this._layers[ke.id]=T.c0(ke,this.scope,null,this._options)).compileFilter(pe),this.keyCache[ke.id]&&delete this.keyCache[ke.id];for(const ke of ie)delete this.keyCache[ke],delete this._layerConfigs[ke],delete this._layers[ke];this.familiesBySource=Object.create(null);const Te=function(ke,Me){const Ue=Object.create(null);for(let Ie=0;Ie<ke.length;Ie++){const st=ke[Ie];let dt=Me&&Me[st.id];dt||(st.type==="symbol"?dt=st.id:(dt=Xe(st),st.type==="line"&&st.paint&&(ft(st.paint["line-width"],"line-progress")&&(dt+=`/${nt(st.paint["line-width"])}`),ft(st.paint["line-emissive-strength"],"line-progress")&&(dt+=`/${nt(st.paint["line-emissive-strength"])}`)))),Me&&(Me[st.id]=dt);let Tt=Ue[dt];Tt||(Tt=Ue[dt]=[]),Tt.push(st)}const ge=[];for(const Ie in Ue)ge.push(Ue[Ie]);return ge}(Object.values(this._layerConfigs),this.keyCache);for(const ke of Te){const Me=ke.map(Tt=>this._layers[Tt.id]),Ue=Me[0];if(Ue.visibility==="none")continue;const ge=Ue.source||"";let Ie=this.familiesBySource[ge];Ie||(Ie=this.familiesBySource[ge]=Object.create(null));const st=Ue.sourceLayer||"_geojsonTileLayer";let dt=Ie[st];dt||(dt=Ie[st]=[]),dt.push(Me)}}}const Bt=1*T.aI;class Dt{constructor(Z){const ie={},pe=[];for(const Ue in Z){const ge=Z[Ue],Ie=ie[Ue]={};for(const st in ge.glyphs){const dt=ge.glyphs[+st];if(!dt||dt.bitmap.width===0||dt.bitmap.height===0)continue;const Tt=dt.metrics.localGlyph?Bt:1,jt={x:0,y:0,w:dt.bitmap.width+2*Tt,h:dt.bitmap.height+2*Tt};pe.push(jt),Ie[st]=jt}}const{w:Te,h:ke}=T.eT(pe),Me=new T.b({width:Te||1,height:ke||1});for(const Ue in Z){const ge=Z[Ue];for(const Ie in ge.glyphs){const st=ge.glyphs[+Ie];if(!st||st.bitmap.width===0||st.bitmap.height===0)continue;const dt=ie[Ue][Ie],Tt=st.metrics.localGlyph?Bt:1;T.b.copy(st.bitmap,Me,{x:0,y:0},{x:dt.x+Tt,y:dt.y+Tt},st.bitmap)}}this.image=Me,this.positions=ie}}function It(Re){for(const Z of Re)if(Z.hdExt!=null||Z.requiresHDRuntime)return!0;return!1}function kt(Re){for(const Z of Re)if(Z.requiresStandardRuntime)return!0;return!1}T.eZ(Dt,"GlyphAtlas");class wt{constructor(Z){this.tileID=new T.ap(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.tileZoom=Z.tileZoom,this.uid=Z.uid,this.zoom=Z.zoom,this.lut=Z.lut,this.canonical=Z.tileID.canonical,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.scope=Z.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.showElevationIdDebug=Z.showElevationIdDebug,this.collectResourceTiming=!!Z.request&&Z.request.collectResourceTiming,this.promoteId=Z.promoteId,this.renderSourceType=Z.renderSourceType,this.frcCoverage=Z.frcCoverage||null,this.deferRoadStructure=!1,this.tileTransform=T.fI(Z.tileID.canonical,Z.projection),this.projection=Z.projection,this.worldview=Z.worldview,this.localizableLayerIds=Z.localizableLayerIds,this.brightness=Z.brightness,this.extraShadowCaster=!!Z.extraShadowCaster,this.tessellationStep=Z.tessellationStep,this.scaleFactor=Z.scaleFactor,this.worldview=Z.worldview,this.indoor=Z.indoor}isLayerActiveForTile(Z){return!(this.renderSourceType===T.aC.Symbol&&Z.type!=="symbol"||this.renderSourceType===T.aC.FillExtrusion&&Z.type!=="fill-extrusion"||this.renderSourceType===T.aC.Other&&(Z.type==="symbol"||Z.type==="fill-extrusion")||Z.minzoom&&this.zoom<Math.floor(Z.minzoom)||Z.maxzoom&&this.zoom>=Z.maxzoom||Z.visibility==="none")}parse(Z,ie,pe,Te,ke,Me){this._parseAfterHD(Z,ie,pe,Te,ke,Me)}_parseAfterHD(Z,ie,pe,Te,ke,Me){let Ue;if(this.status="parsing",this.data=Z,this.renderSourceType===T.aC.HdRoadCoverage){const hn=Z.layers[T.X];Ue=hn&&H?H(hn):[]}this.collisionBoxArray=new T.h;const ge=new T.o(Object.keys(Z.layers).sort()),Ie=new T.I(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const st={},dt=new T.a9(256,256),Tt={featureIndex:Ie,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:dt,availableImages:pe,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&ae&&(Tt.activeFloors=ae(Z,this.indoor,ke,this.canonical));const jt=[],Xt=ie.familiesBySource[this.source];if(this.deferRoadStructure=!1,this.renderSourceType!==T.aC.HdRoadCoverage&&this.frcCoverage!=null&&!this.frcCoverage.resolved&&this.frcCoverage.frcMask===null){for(const hn in Xt)if(T.ed&&T.ed(this.frcCoverage.sourceLayers,this.source,hn)){this.deferRoadStructure=!0;break}}for(const hn in Xt){const mn=Z.layers[hn];if(!mn)continue;let Nn=!1,xr=!1,Dr=!1,Ii=!1;for(const Zr of Xt[hn])Zr[0].type==="symbol"?Nn=!0:Zr[0].type==="fill-extrusion"?xr=!0:Dr=!0,Zr[0].is3D()&&Zr[0].type!=="model"&&(Ii=!0);if(this.extraShadowCaster&&!Ii||this.renderSourceType===T.aC.Symbol&&!Nn||this.renderSourceType===T.aC.FillExtrusion&&!xr||(this.renderSourceType===T.aC.Other||this.renderSourceType===T.aC.HdRoadCoverage)&&!Dr)continue;const Gi=this.frcCoverage!=null&&!!T.ed&&T.ed(this.frcCoverage.sourceLayers,this.source,hn);if(this.deferRoadStructure&&Gi)continue;mn.version===1&&T.f_(`Vector tile source "${this.source}" layer "${hn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Cn=ge.encode(hn),ci=[],Na=this.localizableLayerIds&&this.localizableLayerIds.has(hn);let xs=!1;for(let Zr=0,Xr=0;Zr<mn.length;Zr++){const Li=mn.feature(Zr),gi=Ie.getId(Li,hn),Yr=Li.properties?Li.properties.worldview:null;if(Na&&this.worldview&&typeof Yr=="string")if(Yr==="all")Li.properties.$localized=!0;else{if(!Yr.split(",").includes(this.worldview))continue;Li.properties.$localized=!0,Li.properties.worldview=this.worldview}!xs&&Li.properties&&Object.hasOwn(Li.properties,T.ar)&&(xs=!0),Gi&&this.frcCoverage&&this.frcCoverage.frcMask&&Li.properties&&T.dz&&T.dz(Li.properties,this.frcCoverage.frcMask)||(ci.push({feature:Li,id:gi,index:Xr,sourceLayerIndex:Cn}),Xr++)}xs&&!Tt.elevationFeatures&&B&&(Tt.elevationFeatures=B(Z,this.canonical));for(const Zr of Xt[hn]){const Xr=Zr[0];if(this.extraShadowCaster&&(!Xr.is3D()||Xr.type==="model")||this.renderSourceType===T.aC.Symbol&&Xr.type!=="symbol"||this.renderSourceType===T.aC.FillExtrusion&&Xr.type!=="fill-extrusion"||!(this.renderSourceType!==T.aC.Other&&this.renderSourceType!==T.aC.HdRoadCoverage||Xr.type!=="symbol"&&Xr.type!=="fill-extrusion")||!this.isLayerActiveForTile(Xr))continue;Zt(Zr,this.zoom,Tt.brightness,pe,this.worldview,Tt.activeFloors);const Li=Ie.bucketLayerIDs.length;Ie.bucketLayerIDs.push(Zr.map(Yr=>T.ea(Yr.id,Yr.scope)));const gi=()=>{const Yr=st[Xr.id]=Xr.createBucket({index:Li,layers:Zr,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Cn,sourceLayerName:hn,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:Te,worldview:this.worldview,localizable:Na,availableImages:pe,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});He&&He(Yr,this.frcCoverage?this.frcCoverage.sourceLayers:null),Yr.populate(ci,Tt,this.tileID.canonical,this.tileTransform)};Xr.mayUse("HD")||Xr.mayUse("Standard")?jt.push(Xr.prepare().then(()=>gi())):gi()}}const Un=()=>{dt.trim();const hn=!(!Tt.elevationFeatures||!Tt.elevationFeatures.some(Zr=>Zr.heightRange.min<0));let mn,Nn,xr,Dr,Ii,Gi,Cn;const ci={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},Na=()=>{if(mn)return this.status="done",Me(mn);if(this.extraShadowCaster){this.status="done";const Zr=Object.values(st).filter(Xr=>!Xr.isEmpty());Me(null,{buckets:Zr,containsHdExt:It(Zr),containsStandardExt:kt(Zr),featureIndex:Ie,collisionBoxArray:null,hasTunnelGeometry:hn,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Tt.brightness,glyphMap:null,iconMap:null,glyphPositions:null})}else if(Nn&&xr&&Dr&&Cn){const Xr=new Dt(Nn),Li=new Map;for(const[Yr,qo]of xr.entries()){const{imagePosition:eo}=T.cR(Yr,qo,T.Z);Li.set(Yr,eo)}const gi={};for(const Yr in st){const qo=st[Yr];qo instanceof T.aX&&(Zt(qo.layers,this.zoom,Tt.brightness,pe,this.worldview,Tt.activeFloors),gi[Yr]=T.eD(qo,Nn,Xr.positions,xr,Li,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Ii,this.worldview,pe,this.frcCoverage?this.frcCoverage.frcMask:null,this.frcCoverage?this.frcCoverage.polygons:null,this.frcCoverage?this.frcCoverage.tileZoom:null,T.dz||null,X||null))}Ii.size||Gi.size?this.rasterizeTask=ke.send("rasterizeImages",{scope:this.scope,iconTasks:Ii,patternTasks:Gi},(Yr,qo)=>{if(!Yr)for(const[eo,ko]of qo.entries())xr.has(eo)&&xr.set(eo,Object.assign(xr.get(eo),{data:ko})),Dr.has(eo)&&Dr.set(eo,Object.assign(Dr.get(eo),{data:ko}));xs(gi,Xr,void 0,Cn)}):xs(gi,Xr,void 0,Cn)}},xs=(Zr,Xr,Li,gi)=>{const Yr=xr.size>0||Dr.size>0,qo=Object.keys(Zr).length>0;if(!Yr&&!qo){this.status="done";const ko=Object.values(st).filter(Va=>!Va.isEmpty());return void Me(null,{buckets:ko,containsHdExt:It(ko),containsStandardExt:kt(ko),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:hn,glyphAtlasImage:Xr.image,lineAtlas:dt,imageAtlas:null,brightness:Tt.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:Ue})}const eo=(ko,Va)=>{for(const Cr in st){const ui=st[Cr];if(Cr in Zr)T.eS(ui,Zr[Cr],this.showCollisionBoxes,pe,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,xr,Va);else if(ui.hasPattern&&(ui instanceof T.aa||ui instanceof T.J||ui instanceof T.K)){Zt(ui.layers,this.zoom,Tt.brightness,pe,this.worldview,Tt.activeFloors);const kc=Object.fromEntries(Va.patternPositions);ui.addFeatures(Tt,this.tileID.canonical,kc,pe,this.tileTransform,this.brightness)}}this.status="done";const ja=Object.values(st).filter(Cr=>!Cr.isEmpty());Me(null,{buckets:ja,containsHdExt:It(ja),containsStandardExt:kt(ja),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:hn,glyphAtlasImage:Xr.image,lineAtlas:dt,imageAtlas:ko,brightness:Tt.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:Ue})};if(Yr){const ko=new Map,Va=T.fr(xr,ko),ja=T.fr(Dr,ko),Cr=new T.c(Va,ja,gi,this.lut,ko);ke.send("checkAtlasCache",{descriptor:Cr,scope:this.scope},(ui,kc)=>{let Eu,Ps;if(ui&&T.f_(`[Worker] Error checking atlas cache: ${ui.message}`),kc)Eu=new T.a0(kc.sourceHash),Ps=kc;else{const lf=new T._(xr,Dr,this.lut,gi);Eu=lf,Ps=lf}eo(Eu,Ps)})}else eo(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){const Zr=T.eb(Tt.glyphDependencies,gi=>Object.keys(gi).map(Number));Object.keys(Zr).length?ke.send("getGlyphs",{uid:this.uid,stacks:Zr},(gi,Yr)=>{mn||(mn=gi,Nn=Yr,Na())},void 0,!1,ci):Nn={},Cn=new Map;const Xr=Array.from(Tt.iconDependencies.keys()).map(gi=>T.a1.parse(gi)),Li=Array.from(Tt.patternDependencies.keys()).map(gi=>T.a1.parse(gi));Xr.length||Li.length?ke.send("getImages",{icons:Xr,patterns:Li,source:this.source,scope:this.scope,tileID:this.tileID},(gi,Yr)=>{if(!mn){mn=gi,xr=new Map,Dr=new Map,Ii=this.updateImageMapAndGetImageTaskQueue(xr,Yr.images,Tt.iconDependencies),Gi=this.updateImageMapAndGetImageTaskQueue(Dr,Yr.images,Tt.patternDependencies);for(const[qo,eo]of Yr.versions.entries())Cn.set(qo,eo);Na()}},void 0,!1,ci):(xr=new Map,Dr=new Map,Ii=new Map,Gi=new Map)}U&&U({buckets:st,data:Z,sourceLayerCoder:ge,canonical:this.tileID.canonical,options:Tt}),Na()};jt.length>0?Promise.allSettled(jt).then(Un).catch(Me):Un()}updateParameters(Z){this.scaleFactor=Z.scaleFactor,this.showCollisionBoxes=Z.showCollisionBoxes,this.showElevationIdDebug=Z.showElevationIdDebug,this.projection=Z.projection,this.brightness=Z.brightness,this.tileTransform=T.fI(Z.tileID.canonical,Z.projection),this.extraShadowCaster=Z.extraShadowCaster,this.lut=Z.lut,this.worldview=Z.worldview,this.indoor=Z.indoor,this.frcCoverage=Z.frcCoverage||null}updateImageMapAndGetImageTaskQueue(Z,ie,pe){const Te=new Map;for(const ke of ie.keys()){const Me=pe.get(ke)||[];for(const Ue of Me){const ge=Ue.toString(),Ie=ie.get(Ue.id.toString());Ie.usvg?Te.has(ge)||(Te.set(ge,Ue),Z.set(ge,Object.assign({},Ie))):Z.set(ge,Ie)}}return Te}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Zt(Re,Z,ie,pe,Te,ke){const Me=new T.w(Z,{brightness:ie,worldview:Te,activeFloors:ke});for(const Ue of Re)Ue.recalculate(Me,pe)}class zt extends T.y{constructor({actor:Z,layerIndex:ie,availableImages:pe,availableModels:Te,isSpriteLoaded:ke,tileProvider:Me,brightness:Ue,maxUniformBufferBindings:ge,maxUniformBlockSizeDwords:Ie,disableSymbolUBO:st}){super(),this.actor=Z,this.layerIndex=ie,this.availableImages=pe,this.availableModels=Te,this.loadVectorData=T.e9,this.tileProvider=Me,this.loading={},this.loaded={},this.deduped=new T.m(Z.scheduler),this.isSpriteLoaded=ke,this.scheduler=Z.scheduler,this.brightness=Ue,this.maxUniformBufferBindings=ge,this.maxUniformBlockSizeDwords=Ie,this.disableSymbolUBO=st}loadTileData(Z,ie){if(!this.tileProvider)return this.loadVectorData(Z,ie);const pe=new AbortController;return this.loadTileWithProvider(this.tileProvider,Z,pe,ie),()=>pe.abort()}async loadTileWithProvider(Z,ie,pe,Te){const{z:ke,x:Me,y:Ue}=ie.tileID.canonical;try{const ge=await Z.loadTile({z:ke,x:Me,y:Ue},{request:ie.request,signal:pe.signal});if(pe.signal.aborted)return;if(ge==null){const st=new Error("Tile not found");return st.status=404,Te(st)}if(ge.data==null)return Te(null,null);if(ge.data instanceof ImageBitmap)return Te(new Error("Vector tiles require ArrayBuffer data"));const Ie=new Map;ge.expires&&Ie.set("expires",ge.expires),ge.cacheControl&&Ie.set("cache-control",ge.cacheControl),Te(null,{rawData:ge.data,responseHeaders:Ie})}catch(ge){if(pe.signal.aborted)return;Te(ge instanceof Error?ge:new Error(String(ge)))}}loadTile(Z,ie){const pe=Z.uid,Te=Z&&Z.request,ke=Te&&Te.collectResourceTiming,Me=this.loading[pe]=new wt(Z);Me.maxUniformBufferBindings=this.maxUniformBufferBindings,Me.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,Me.disableSymbolUBO=this.disableSymbolUBO,Me.abort=this.loadTileData(Z,(Ue,ge)=>{const Ie=!this.loading[pe];if(delete this.loading[pe],Me.cancelRasterize(),Ie||Ue||!ge)return Me.status="done",Ie||(this.loaded[pe]=Me),ie(Ue);const st=ge.rawData,dt={},Tt=T.cO(ge.responseHeaders);Tt&&Tt.expires&&(dt.expires=Tt.expires),Tt&&Tt.cacheControl&&(dt.cacheControl=Tt.cacheControl),Me.vectorTile=ge.vectorTile||new T.be(new T.as(st));const jt=()=>{Me.parse(Me.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Xt,Un)=>{if(Xt||!Un)return ie(Xt);const hn={};if(ke){const mn=L(Te);mn.length>0&&(hn.resourceTiming=JSON.parse(JSON.stringify(mn)))}ie(null,Object.assign({rawTileData:st.slice(0),responseHeaders:ge.responseHeaders},Un,dt,hn))})};this.isSpriteLoaded?jt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(jt,{type:"parseTile",renderSourceType:Z.renderSourceType,zoom:Z.tileZoom}):jt()}),this.loaded=this.loaded||{},this.loaded[pe]=Me})}reloadTile(Z,ie){const pe=this.loaded,Te=Z.uid;if(pe&&pe[Te]){const ke=pe[Te];ke.updateParameters(Z);const Me=(Ue,ge)=>{const Ie=ke.reloadCallback;Ie&&(delete ke.reloadCallback,ke.parse(ke.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ie)),ie(Ue,ge)};ke.status==="parsing"?ke.reloadCallback=Me:ke.status==="done"&&(ke.vectorTile?ke.parse(ke.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Me):Me())}else ie(null,void 0)}abortTile(Z,ie){const pe=Z.uid,Te=this.loading[pe];Te&&(Te.abort&&Te.abort(),delete this.loading[pe]),ie()}removeTile(Z,ie){const pe=this.loaded,Te=Z.uid;pe&&pe[Te]&&delete pe[Te],ie()}}class vt{constructor(Z){this.tileProvider=Z.tileProvider,this.loading={}}loadTile(Z,ie){const pe=Z.uid;if(this.tileProvider){const ke=new AbortController;return this.loading[pe]={cancel:()=>ke.abort()},void this.loadTileWithProvider(this.tileProvider,pe,Z,ke,ie)}const{cancel:Te}=T.cG(Z.request,(ke,Me,Ue)=>{const ge=!this.loading[pe];if(delete this.loading[pe],ge||ke||!Me)return ie(ke);this.decodeTile(pe,Me,Z.encoding).then(Ie=>{const{expires:st,cacheControl:dt}=T.cO(Ue);ie(null,Object.assign(Ie,{expires:st,cacheControl:dt}))}).catch(Ie=>ie(Ie))});this.loading[pe]={cancel:Te}}async decodeTile(Z,ie,pe){const Te=ie instanceof ImageBitmap?ie:await createImageBitmap(new Blob([new Uint8Array(ie)],{type:"image/png"})),ke=1-(Te.width-T.eU(Te.width))/2,Me=ke<1,Ue=this.getImageData(Te,ke);return Te.close(),{dem:new T.D(Z,Ue,pe,Me),borderReady:Me}}async loadTileWithProvider(Z,ie,pe,Te,ke){const{z:Me,x:Ue,y:ge}=pe.tileID.canonical;try{const Ie=await Z.loadTile({z:Me,x:Ue,y:ge},{request:pe.request,signal:Te.signal});if(Te.signal.aborted)return ke(null,null);if(Ie==null){const dt=new Error("Tile not found");return dt.status=404,ke(dt)}if(Ie.data==null)return ke(null,null);const st=await this.decodeTile(ie,Ie.data,pe.encoding);if(Te.signal.aborted)return ke(null,null);ke(null,Object.assign(st,{expires:Ie.expires,cacheControl:Ie.cacheControl}))}catch(Ie){if(Te.signal.aborted||Ie instanceof DOMException&&Ie.name==="AbortError")return ke(null,null);ke(Ie instanceof Error?Ie:new Error(String(Ie)))}finally{delete this.loading[ie]}}reloadTile(Z,ie){ie(null,null)}abortTile(Z,ie){const pe=Z.uid,Te=this.loading[pe];Te&&(Te.cancel(),delete this.loading[pe]),ie()}removeTile(Z,ie){ie()}getImageData(Z,ie){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Z.width,Z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=Z.width,this.offscreenCanvas.height=Z.height,this.offscreenCanvasContext.drawImage(Z,0,0,Z.width,Z.height);const pe=this.offscreenCanvasContext.getImageData(-ie,-ie,Z.width+2*ie,Z.height+2*ie);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),pe}}T.af.setPbf(T.as);class pt{constructor(Z){this._mrt=new T.af(Z.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=Z.uid,this.tileID=Z.tileID,this.source=Z.source}parse(Z,ie){const pe=this._mrt;this.status="parsing",this._entireBuffer=Z;try{pe.parseHeader(Z),this._isHeaderLoaded=!0;const Te=[];for(const ke in pe.layers){const Me=pe.getLayer(ke),Ue=Me.getDataRange(Me.getBandList()),ge=pe.createDecodingTask(Ue),Ie=Z.slice(Ue.firstByte,Ue.lastByte+1),st=T.af.performDecoding(Ie,ge).then(dt=>ge.complete(null,dt)).catch(dt=>ge.complete(dt,null));Te.push(st)}Promise.allSettled(Te).then(()=>ie(null,pe)).catch(ke=>ie(ke))}catch(Te){ie(Te)}}}class Pt{constructor({actor:Z}){this.actor=Z,this.loading={},this.loaded={}}loadTile(Z,ie){const pe=Z.uid,Te=Z.request,ke=this.loading[pe]=new pt(Z),{cancel:Me}=T.cG(Te,(Ue,ge,Ie)=>{const st=!this.loading[pe];if(delete this.loading[pe],st||Ue||!ge)return ke.status="done",st||(this.loaded[pe]=ke),ie(Ue);ke.parse(ge,(dt,Tt)=>{if(dt||!Tt)return ie(dt);ie(null,Tt,Ie)}),this.loaded[pe]=ke});ke.abort=Me}reloadTile(Z,ie){ie(null,void 0)}abortTile(Z,ie){const pe=Z.uid,Te=this.loading[pe];Te&&(Te.abort&&Te.abort(),delete this.loading[pe]),ie()}removeTile(Z,ie){const pe=Z.uid;this.loaded[pe]&&delete this.loaded[pe],ie()}decodeRasterArray(Z,ie){T.af.performDecoding(Z.buffer,Z.task).then(pe=>ie(null,pe)).catch(pe=>ie(pe))}}const An=T.bf.prototype.toGeoJSON;class bn{constructor(Z){this._feature=Z,this.extent=T.r,this.type=Z.type,this.properties=Z.tags,"id"in Z&&!isNaN(Z.id)&&(this.id=parseInt(Z.id,10))}loadGeometry(){if(this._feature.type===1){const Z=[];for(const ie of this._feature.geometry)Z.push([new T.au(ie[0],ie[1])]);return Z}{const Z=[];for(const ie of this._feature.geometry){const pe=[];for(const Te of ie)pe.push(new T.au(Te[0],Te[1]));Z.push(pe)}return Z}}toGeoJSON(Z,ie,pe){return An.call(this,Z,ie,pe)}}class Vn{constructor(Z,ie){this.name=Z,this.extent=T.r,this.length=ie.length,this._jsonFeatures=ie}feature(Z){return new bn(this._jsonFeatures[Z])}}class Mn{constructor(Z){this.layers={},this.extent=T.r;for(const ie of Object.keys(Z))this.layers[ie]=new Vn(ie,Z[ie])}}const Tn=64/4096;class Wr{constructor(){this.features=new Map}clear(){this.features.clear()}load(Z=[],ie){for(const pe of Z){const Te=pe.id;if(Te==null)continue;let ke=this.features.get(Te);ke&&this.updateCache(ke,ie),pe.geometry?(ke=Ho(pe),this.updateCache(ke,ie),this.features.set(Te,ke)):this.features.delete(Te),this.updateCache(ke,ie)}}updateCache(Z,ie){for(const{canonical:pe,uid:Te}of Object.values(ie)){const{z:ke,x:Me,y:Ue}=pe;Kn(Z,Math.pow(2,ke),Me,Ue)&&delete ie[Te]}}getTile(Z,ie,pe){const Te=Math.pow(2,Z),ke=[];for(const Me of this.features.values())Kn(Me,Te,ie,pe)&&ke.push(Ar(Me,Te,ie,pe));return{features:ke}}getFeatures(){return[...this.features.values()]}}function Kn({minX:Re,minY:Z,maxX:ie,maxY:pe},Te,ke,Me){return Re<(ke+1+Tn)/Te&&Z<(Me+1+Tn)/Te&&ie>(ke-Tn)/Te&&pe>(Me-Tn)/Te}function Ho(Re){const{id:Z,geometry:ie,properties:pe}=Re;if(!ie)return;if(ie.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:Te,coordinates:ke}=ie,Me={id:Z,type:1,geometry:[],tags:pe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Ue=Me.geometry;if(Te==="Point")Ni(ke,Ue,Me);else if(Te==="MultiPoint")for(const ge of ke)Ni(ge,Ue,Me);else if(Te==="LineString")Me.type=2,wo(ke,Ue,Me);else if(Te==="MultiLineString")Me.type=2,$n(ke,Ue,Me);else if(Te==="Polygon")Me.type=3,$n(ke,Ue,Me,!0);else{if(Te!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Me.type=3;for(const ge of ke)$n(ge,Ue,Me,!0)}return Me}function Ni([Re,Z],ie,pe){const Te=T.ek(Re);let ke=T.el(Z);ke=ke<0?0:ke>1?1:ke,ie.push(Te,ke),pe.minX=Math.min(pe.minX,Te),pe.minY=Math.min(pe.minY,ke),pe.maxX=Math.max(pe.maxX,Te),pe.maxY=Math.max(pe.maxY,ke)}function wo(Re,Z,ie,pe=!1,Te=!1){const ke=[];for(const Me of Re)Ni(Me,ke,ie);Z.push(ke),pe&&function(Me,Ue){let ge=0;for(let Ie=0,st=Me.length,dt=st-2;Ie<st;dt=Ie,Ie+=2)ge+=(Me[Ie]-Me[dt])*(Me[Ie+1]+Me[dt+1]);if(ge>0===Ue)for(let Ie=0,st=Me.length;Ie<st/2;Ie+=2){const dt=Me[Ie],Tt=Me[Ie+1];Me[Ie]=Me[st-2-Ie],Me[Ie+1]=Me[st-1-Ie],Me[st-2-Ie]=dt,Me[st-1-Ie]=Tt}}(ke,Te)}function $n(Re,Z,ie,pe=!1){for(let Te=0;Te<Re.length;Te++)wo(Re[Te],Z,ie,pe,Te===0)}function Ar(Re,Z,ie,pe){const{id:Te,type:ke,geometry:Me,tags:Ue}=Re,ge=[];if(ke===1)(function(Ie,st,dt,Tt,jt){for(let Xt=0;Xt<Ie.length;Xt+=2){const Un=Math.round(T.r*(Ie[Xt+0]*st-dt)),hn=Math.round(T.r*(Ie[Xt+1]*st-Tt));jt.push([Un,hn])}})(Me,Z,ie,pe,ge);else if(ke===2)for(const Ie of Me)pi(Ie,Z,ie,pe,ge);else if(ke===3)for(const Ie of Me)zo(Ie,Z,ie,pe,ge);return{id:Te,type:ke,geometry:ge,tags:Ue}}function pi(Re,Z,ie,pe,Te){const Me=T.r+128;let Ue;for(let ge=0;ge<Re.length-2;ge+=2){let Ie=Math.round(T.r*(Re[ge+0]*Z-ie)),st=Math.round(T.r*(Re[ge+1]*Z-pe)),dt=Math.round(T.r*(Re[ge+2]*Z-ie)),Tt=Math.round(T.r*(Re[ge+3]*Z-pe));const jt=dt-Ie,Xt=Tt-st;Ie<-128&&dt<-128||(Ie<-128?(st+=Math.round(Xt*((-128-Ie)/jt)),Ie=-128):dt<-128&&(Tt=st+Math.round(Xt*((-128-Ie)/jt)),dt=-128),st<-128&&Tt<-128||(st<-128?(Ie+=Math.round(jt*((-128-st)/Xt)),st=-128):Tt<-128&&(dt=Ie+Math.round(jt*((-128-st)/Xt)),Tt=-128),Ie>=Me&&dt>=Me||(Ie>=Me?(st+=Math.round(Xt*((Me-Ie)/jt)),Ie=Me):dt>=Me&&(Tt=st+Math.round(Xt*((Me-Ie)/jt)),dt=Me),st>=Me&&Tt>=Me||(st>=Me?(Ie+=Math.round(jt*((Me-st)/Xt)),st=Me):Tt>=Me&&(dt=Ie+Math.round(jt*((Me-st)/Xt)),Tt=Me),Ue&&Ie===Ue.at(-1)[0]&&st===Ue.at(-1)[1]||(Ue=[[Ie,st]],Te.push(Ue)),Ue.push([dt,Tt])))))}}function zo(Re,Z,ie,pe,Te){const ke=(ie-Tn)/Z,Me=(pe-Tn)/Z,Ue=(ie+1+Tn)/Z,ge=(pe+1+Tn)/Z;function Ie(Tt,jt){let Xt=0;return Tt<ke?Xt|=1:Tt>Ue&&(Xt|=2),jt<Me?Xt|=4:jt>ge&&(Xt|=8),Xt}let st=[];for(let Tt=1;Tt<=8;Tt*=2){let jt=Re[Re.length-2],Xt=Re.at(-1),Un=!(Ie(jt,Xt)&Tt);for(let hn=0;hn<Re.length;hn+=2){const mn=Re[hn],Nn=Re[hn+1],xr=!(Ie(mn,Nn)&Tt);xr!==Un&&(8&Tt?st.push(jt+(mn-jt)*(ge-Xt)/(Nn-Xt),ge):4&Tt?st.push(jt+(mn-jt)*(Me-Xt)/(Nn-Xt),Me):2&Tt?st.push(Ue,Xt+(Nn-Xt)*(Ue-jt)/(mn-jt)):1&Tt&&st.push(ke,Xt+(Nn-Xt)*(ke-jt)/(mn-jt))),xr&&st.push(mn,Nn),jt=mn,Xt=Nn,Un=xr}if(!(Re=st).length||Tt===8)break;st=[]}const dt=[];for(let Tt=0;Tt<st.length;Tt+=2)dt.push([Math.round(T.r*(st[Tt]*Z-ie)),Math.round(T.r*(st[Tt+1]*Z-pe))]);dt.length&&Te.push(dt)}function Tr({name:Re,features:Z},ie){ie.writeStringField(1,Re),ie.writeVarintField(5,T.r);const pe=new Map,Te=new Map,ke={keys:pe,values:Te,feature:null};for(const Me of Z)ke.feature=Me,ie.writeMessage(2,ns,ke);for(const Me of pe.keys())ie.writeStringField(3,Me);for(const Me of Te.keys())ie.writeMessage(4,Vi,Me)}function ns(Re,Z){const ie=Re.feature;ie.id!==void 0&&Number.isSafeInteger(+ie.id)&&Z.writeVarintField(1,+ie.id),ie.tags&&Z.writeMessage(2,ma,Re),Z.writeVarintField(3,ie.type),Z.writeMessage(4,Or,ie)}function ma({keys:Re,values:Z,feature:ie},pe){for(const Te of Object.keys(ie.tags)){let ke=ie.tags[Te];if(ke===null)continue;let Me=Re.get(Te);Me===void 0&&(Me=Re.size,Re.set(Te,Me)),pe.writeVarint(Me);const Ue=typeof ke;Ue!=="string"&&Ue!=="boolean"&&Ue!=="number"&&(ke=JSON.stringify(ke));let ge=Z.get(ke);ge===void 0&&(ge=Z.size,Z.set(ke,ge)),pe.writeVarint(ge)}}function So(Re,Z){return(Z<<3)+(7&Re)}function Ci(Re){return Re<<1^Re>>31}function Or(Re,Z){const{geometry:ie,type:pe}=Re;let Te=0,ke=0;if(pe===1){Z.writeVarint(So(1,ie.length));for(const Me of ie){const Ue=Me[0]-Te,ge=Me[1]-ke;Z.writeVarint(Ci(Ue)),Z.writeVarint(Ci(ge)),Te+=Ue,ke+=ge}}else for(const Me of ie){if(Me.length===0)continue;Z.writeVarint(So(1,1));const Ue=Me.length-(pe===3?1:0);for(let ge=0;ge<Ue;ge++){ge===1&&Z.writeVarint(So(2,Ue-1));const Ie=Me[ge][0]-Te,st=Me[ge][1]-ke;Z.writeVarint(Ci(Ie)),Z.writeVarint(Ci(st)),Te+=Ie,ke+=st}pe===3&&Z.writeVarint(So(7,1))}}function Vi(Re,Z){const ie=typeof Re;ie==="string"?Z.writeStringField(1,Re):ie==="boolean"?Z.writeBooleanField(7,Re):ie==="number"&&(Re%1!=0?Z.writeDoubleField(3,Re):Re<0?Z.writeSVarintField(6,Re):Z.writeVarintField(5,Re))}const To={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Re=>Re},ys=Math.fround||(za=new Float32Array(1),Re=>(za[0]=+Re,za[0]));var za;class Ec{constructor(Z){this.options=Object.assign(Object.create(To),Z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Z){const{log:ie,minZoom:pe,maxZoom:Te}=this.options;ie&&console.time("total time");const ke=`prepare ${Z.length} points`;ie&&console.time(ke),this.points=Z;const Me=[];for(let ge=0;ge<Z.length;ge++){const Ie=Z[ge];if(!Ie.geometry)continue;const[st,dt]=Ie.geometry.coordinates,Tt=ys(vs(st)),jt=ys(Ct(dt));Me.push(Tt,jt,1/0,ge,-1,1),this.options.reduce&&Me.push(0)}let Ue=this.trees[Te+1]=this._createTree(Me);ie&&console.timeEnd(ke);for(let ge=Te;ge>=pe;ge--){const Ie=+Date.now();Ue=this.trees[ge]=this._createTree(this._cluster(Ue,ge)),ie&&console.log("z%d: %d clusters in %dms",ge,Ue.numItems,+Date.now()-Ie)}return ie&&console.timeEnd("total time"),this}getClusters(Z,ie){let pe=((Z[0]+180)%360+360)%360-180;const Te=Math.max(-90,Math.min(90,Z[1]));let ke=Z[2]===180?180:((Z[2]+180)%360+360)%360-180;const Me=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)pe=-180,ke=180;else if(pe>ke){const dt=this.getClusters([pe,Te,180,Me],ie),Tt=this.getClusters([-180,Te,ke,Me],ie);return dt.concat(Tt)}const Ue=this.trees[this._limitZoom(ie)],ge=Ue.range(vs(pe),Ct(Me),vs(ke),Ct(Te)),Ie=Ue.data,st=[];for(const dt of ge){const Tt=this.stride*dt;st.push(Ie[Tt+5]>1?oi(Ie,Tt,this.clusterProps):this.points[Ie[Tt+3]])}return st}getChildren(Z){const ie=this._getOriginId(Z),pe=this._getOriginZoom(Z),Te="No cluster with the specified id.",ke=this.trees[pe];if(!ke)throw new Error(Te);const Me=ke.data;if(ie*this.stride>=Me.length)throw new Error(Te);const Ue=this.options.radius/(this.options.extent*Math.pow(2,pe-1)),ge=ke.within(Me[ie*this.stride],Me[ie*this.stride+1],Ue),Ie=[];for(const st of ge){const dt=st*this.stride;Me[dt+4]===Z&&Ie.push(Me[dt+5]>1?oi(Me,dt,this.clusterProps):this.points[Me[dt+3]])}if(Ie.length===0)throw new Error(Te);return Ie}getLeaves(Z,ie,pe){const Te=[];return this._appendLeaves(Te,Z,ie=ie||10,pe=pe||0,0),Te}getTile(Z,ie,pe){const Te=this.trees[this._limitZoom(Z)],ke=Math.pow(2,Z),{extent:Me,radius:Ue}=this.options,ge=Ue/Me,Ie=(pe-ge)/ke,st=(pe+1+ge)/ke,dt={features:[]};return this._addTileFeatures(Te.range((ie-ge)/ke,Ie,(ie+1+ge)/ke,st),Te.data,ie,pe,ke,dt),ie===0&&this._addTileFeatures(Te.range(1-ge/ke,Ie,1,st),Te.data,ke,pe,ke,dt),ie===ke-1&&this._addTileFeatures(Te.range(0,Ie,ge/ke,st),Te.data,-1,pe,ke,dt),dt.features.length?dt:null}getClusterExpansionZoom(Z){let ie=this._getOriginZoom(Z)-1;for(;ie<=this.options.maxZoom;){const pe=this.getChildren(Z);if(ie++,pe.length!==1)break;Z=pe[0].properties.cluster_id}return ie}_appendLeaves(Z,ie,pe,Te,ke){const Me=this.getChildren(ie);for(const Ue of Me){const ge=Ue.properties;if(ge&&ge.cluster?ke+ge.point_count<=Te?ke+=ge.point_count:ke=this._appendLeaves(Z,ge.cluster_id,pe,Te,ke):ke<Te?ke++:Z.push(Ue),Z.length===pe)break}return ke}_createTree(Z){const ie=new T.a6(Z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let pe=0;pe<Z.length;pe+=this.stride)ie.add(Z[pe],Z[pe+1]);return ie.finish(),ie.data=Z,ie}_addTileFeatures(Z,ie,pe,Te,ke,Me){for(const Ue of Z){const ge=Ue*this.stride,Ie=ie[ge+5]>1;let st,dt,Tt;if(Ie)st=rs(ie,ge,this.clusterProps),dt=ie[ge],Tt=ie[ge+1];else{const Un=this.points[ie[ge+3]];st=Un.properties;const[hn,mn]=Un.geometry.coordinates;dt=vs(hn),Tt=Ct(mn)}const jt={type:1,geometry:[[Math.round(this.options.extent*(dt*ke-pe)),Math.round(this.options.extent*(Tt*ke-Te))]],tags:st};let Xt;Xt=Ie||this.options.generateId?ie[ge+3]:this.points[ie[ge+3]].id,Xt!==void 0&&(jt.id=Xt),Me.features.push(jt)}}_limitZoom(Z){return Math.max(this.options.minZoom,Math.min(Math.floor(+Z),this.options.maxZoom+1))}_cluster(Z,ie){const{radius:pe,extent:Te,reduce:ke,minPoints:Me}=this.options,Ue=pe/(Te*Math.pow(2,ie)),ge=Z.data,Ie=[],st=this.stride;for(let dt=0;dt<ge.length;dt+=st){if(ge[dt+2]<=ie)continue;ge[dt+2]=ie;const Tt=ge[dt],jt=ge[dt+1],Xt=Z.within(ge[dt],ge[dt+1],Ue),Un=ge[dt+5];let hn=Un;for(const mn of Xt){const Nn=mn*st;ge[Nn+2]>ie&&(hn+=ge[Nn+5])}if(hn>Un&&hn>=Me){let mn,Nn=Tt*Un,xr=jt*Un,Dr=-1;const Ii=(dt/st<<5)+(ie+1)+this.points.length;for(const Gi of Xt){const Cn=Gi*st;if(ge[Cn+2]<=ie)continue;ge[Cn+2]=ie;const ci=ge[Cn+5];Nn+=ge[Cn]*ci,xr+=ge[Cn+1]*ci,ge[Cn+4]=Ii,ke&&(mn||(mn=this._map(ge,dt,!0),Dr=this.clusterProps.length,this.clusterProps.push(mn)),ke(mn,this._map(ge,Cn)))}ge[dt+4]=Ii,Ie.push(Nn/hn,xr/hn,1/0,Ii,-1,hn),ke&&Ie.push(Dr)}else{for(let mn=0;mn<st;mn++)Ie.push(ge[dt+mn]);if(hn>1)for(const mn of Xt){const Nn=mn*st;if(!(ge[Nn+2]<=ie)){ge[Nn+2]=ie;for(let xr=0;xr<st;xr++)Ie.push(ge[Nn+xr])}}}}return Ie}_getOriginId(Z){return Z-this.points.length>>5}_getOriginZoom(Z){return(Z-this.points.length)%32}_map(Z,ie,pe){if(Z[ie+5]>1){const Me=this.clusterProps[Z[ie+6]];return pe?Object.assign({},Me):Me}const Te=this.points[Z[ie+3]].properties,ke=this.options.map(Te);return pe&&ke===Te?Object.assign({},ke):ke}}function oi(Re,Z,ie){return{type:"Feature",id:Re[Z+3],properties:rs(Re,Z,ie),geometry:{type:"Point",coordinates:[(pe=Re[Z],360*(pe-.5)),sn(Re[Z+1])]}};var pe}function rs(Re,Z,ie){const pe=Re[Z+5],Te=pe>=1e4?`${Math.round(pe/1e3)}k`:pe>=1e3?Math.round(pe/100)/10+"k":pe,ke=Re[Z+6],Me=ke===-1?{}:Object.assign({},ie[ke]);return Object.assign(Me,{cluster:!0,cluster_id:Re[Z+3],point_count:pe,point_count_abbreviated:Te})}function vs(Re){return Re/360+.5}function Ct(Re){const Z=Math.sin(Re*Math.PI/180),ie=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return ie<0?0:ie>1?1:ie}function sn(Re){const Z=(180-360*Re)*Math.PI/180;return 360*Math.atan(Math.exp(Z))/Math.PI-90}function pn(Re,Z,ie,pe){let Te=pe;const ke=Z+(ie-Z>>1);let Me,Ue=ie-Z;const ge=Re[Z],Ie=Re[Z+1],st=Re[ie],dt=Re[ie+1];for(let Tt=Z+3;Tt<ie;Tt+=3){const jt=jn(Re[Tt],Re[Tt+1],ge,Ie,st,dt);if(jt>Te)Me=Tt,Te=jt;else if(jt===Te){const Xt=Math.abs(Tt-ke);Xt<Ue&&(Me=Tt,Ue=Xt)}}Te>pe&&(Me-Z>3&&pn(Re,Z,Me,pe),Re[Me+2]=Te,ie-Me>3&&pn(Re,Me,ie,pe))}function jn(Re,Z,ie,pe,Te,ke){let Me=Te-ie,Ue=ke-pe;if(Me!==0||Ue!==0){const ge=((Re-ie)*Me+(Z-pe)*Ue)/(Me*Me+Ue*Ue);ge>1?(ie=Te,pe=ke):ge>0&&(ie+=Me*ge,pe+=Ue*ge)}return Me=Re-ie,Ue=Z-pe,Me*Me+Ue*Ue}function Fn(Re,Z,ie,pe){const Te={id:Re??null,type:Z,geometry:ie,tags:pe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")hr(Te,ie);else if(Z==="Polygon")hr(Te,ie[0]);else if(Z==="MultiLineString")for(const ke of ie)hr(Te,ke);else if(Z==="MultiPolygon")for(const ke of ie)hr(Te,ke[0]);return Te}function hr(Re,Z){for(let ie=0;ie<Z.length;ie+=3)Re.minX=Math.min(Re.minX,Z[ie]),Re.minY=Math.min(Re.minY,Z[ie+1]),Re.maxX=Math.max(Re.maxX,Z[ie]),Re.maxY=Math.max(Re.maxY,Z[ie+1])}function qr(Re,Z,ie,pe){if(!Z.geometry)return;const Te=Z.geometry.coordinates;if(Te&&Te.length===0)return;const ke=Z.geometry.type,Me=Math.pow(ie.tolerance/((1<<ie.maxZoom)*ie.extent),2);let Ue=[],ge=Z.id;if(ie.promoteId?ge=Z.properties[ie.promoteId]:ie.generateId&&(ge=pe||0),ke==="Point")ti(Te,Ue);else if(ke==="MultiPoint")for(const Ie of Te)ti(Ie,Ue);else if(ke==="LineString")qs(Te,Ue,Me,!1);else if(ke==="MultiLineString"){if(ie.lineMetrics){for(const Ie of Te)Ue=[],qs(Ie,Ue,Me,!1),Re.push(Fn(ge,"LineString",Ue,Z.properties));return}Ba(Te,Ue,Me,!1)}else if(ke==="Polygon")Ba(Te,Ue,Me,!0);else{if(ke!=="MultiPolygon"){if(ke==="GeometryCollection"){for(const Ie of Z.geometry.geometries)qr(Re,{id:ge,geometry:Ie,properties:Z.properties},ie,pe);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Ie of Te){const st=[];Ba(Ie,st,Me,!0),Ue.push(st)}}Re.push(Fn(ge,ke,Ue,Z.properties))}function ti(Re,Z){Z.push(is(Re[0]),Ms(Re[1]),0)}function qs(Re,Z,ie,pe){let Te,ke,Me=0;for(let ge=0;ge<Re.length;ge++){const Ie=is(Re[ge][0]),st=Ms(Re[ge][1]);Z.push(Ie,st,0),ge>0&&(Me+=pe?(Te*st-Ie*ke)/2:Math.sqrt(Math.pow(Ie-Te,2)+Math.pow(st-ke,2))),Te=Ie,ke=st}const Ue=Z.length-3;Z[2]=1,pn(Z,0,Ue,ie),Z[Ue+2]=1,Z.size=Math.abs(Me),Z.start=0,Z.end=Z.size}function Ba(Re,Z,ie,pe){for(let Te=0;Te<Re.length;Te++){const ke=[];qs(Re[Te],ke,ie,pe),Z.push(ke)}}function is(Re){return Re/360+.5}function Ms(Re){const Z=Math.sin(Re*Math.PI/180),ie=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return ie<0?0:ie>1?1:ie}function mi(Re,Z,ie,pe,Te,ke,Me,Ue){if(pe/=Z,ke>=(ie/=Z)&&Me<pe)return Re;if(Me<ie||ke>=pe)return null;const ge=[];for(const Ie of Re){const st=Ie.geometry;let dt=Ie.type;const Tt=Te===0?Ie.minX:Ie.minY,jt=Te===0?Ie.maxX:Ie.maxY;if(Tt>=ie&&jt<pe){ge.push(Ie);continue}if(jt<ie||Tt>=pe)continue;let Xt=[];if(dt==="Point"||dt==="MultiPoint")ga(st,Xt,ie,pe,Te);else if(dt==="LineString")Wo(st,Xt,ie,pe,Te,!1,Ue.lineMetrics);else if(dt==="MultiLineString")zn(st,Xt,ie,pe,Te,!1);else if(dt==="Polygon")zn(st,Xt,ie,pe,Te,!0);else if(dt==="MultiPolygon")for(const Un of st){const hn=[];zn(Un,hn,ie,pe,Te,!0),hn.length&&Xt.push(hn)}if(Xt.length){if(Ue.lineMetrics&&dt==="LineString"){for(const Un of Xt)ge.push(Fn(Ie.id,dt,Un,Ie.tags));continue}dt!=="LineString"&&dt!=="MultiLineString"||(Xt.length===1?(dt="LineString",Xt=Xt[0]):dt="MultiLineString"),dt!=="Point"&&dt!=="MultiPoint"||(dt=Xt.length===3?"Point":"MultiPoint"),ge.push(Fn(Ie.id,dt,Xt,Ie.tags))}}return ge.length?ge:null}function ga(Re,Z,ie,pe,Te){for(let ke=0;ke<Re.length;ke+=3){const Me=Re[ke+Te];Me>=ie&&Me<=pe&&vr(Z,Re[ke],Re[ke+1],Re[ke+2])}}function Wo(Re,Z,ie,pe,Te,ke,Me){let Ue=_a(Re);const ge=Te===0?et:ji;let Ie,st,dt=Re.start;for(let hn=0;hn<Re.length-3;hn+=3){const mn=Re[hn],Nn=Re[hn+1],xr=Re[hn+2],Dr=Re[hn+3],Ii=Re[hn+4],Gi=Te===0?mn:Nn,Cn=Te===0?Dr:Ii;let ci=!1;Me&&(Ie=Math.sqrt(Math.pow(mn-Dr,2)+Math.pow(Nn-Ii,2))),Gi<ie?Cn>=ie&&(st=ge(Ue,mn,Nn,Dr,Ii,ie),Me&&(Ue.start=dt+Ie*st)):Gi>pe?Cn<=pe&&(st=ge(Ue,mn,Nn,Dr,Ii,pe),Me&&(Ue.start=dt+Ie*st)):vr(Ue,mn,Nn,xr),Cn<ie&&Gi>=ie&&(st=ge(Ue,mn,Nn,Dr,Ii,ie),ci=!0),Cn>pe&&Gi<=pe&&(st=ge(Ue,mn,Nn,Dr,Ii,pe),ci=!0),!ke&&ci&&(Me&&(Ue.end=dt+Ie*st),Z.push(Ue),Ue=_a(Re)),Me&&(dt+=Ie)}let Tt=Re.length-3;const jt=Re[Tt],Xt=Re[Tt+1],Un=Te===0?jt:Xt;Un>=ie&&Un<=pe&&vr(Ue,jt,Xt,Re[Tt+2]),Tt=Ue.length-3,ke&&Tt>=3&&(Ue[Tt]!==Ue[0]||Ue[Tt+1]!==Ue[1])&&vr(Ue,Ue[0],Ue[1],Ue[2]),Ue.length&&Z.push(Ue)}function _a(Re){const Z=[];return Z.size=Re.size,Z.start=Re.start,Z.end=Re.end,Z}function zn(Re,Z,ie,pe,Te,ke){for(const Me of Re)Wo(Me,Z,ie,pe,Te,ke,!1)}function vr(Re,Z,ie,pe){Re.push(Z,ie,pe)}function et(Re,Z,ie,pe,Te,ke){const Me=(ke-Z)/(pe-Z);return vr(Re,ke,ie+(Te-ie)*Me,1),Me}function ji(Re,Z,ie,pe,Te,ke){const Me=(ke-ie)/(Te-ie);return vr(Re,Z+(pe-Z)*Me,ke,1),Me}function Eo(Re,Z){const ie=[];for(let pe=0;pe<Re.length;pe++){const Te=Re[pe],ke=Te.type;let Me;if(ke==="Point"||ke==="MultiPoint"||ke==="LineString")Me=ao(Te.geometry,Z);else if(ke==="MultiLineString"||ke==="Polygon"){Me=[];for(const Ue of Te.geometry)Me.push(ao(Ue,Z))}else if(ke==="MultiPolygon"){Me=[];for(const Ue of Te.geometry){const ge=[];for(const Ie of Ue)ge.push(ao(Ie,Z));Me.push(ge)}}ie.push(Fn(Te.id,ke,Me,Te.tags))}return ie}function ao(Re,Z){const ie=[];ie.size=Re.size,Re.start!==void 0&&(ie.start=Re.start,ie.end=Re.end);for(let pe=0;pe<Re.length;pe+=3)ie.push(Re[pe]+Z,Re[pe+1],Re[pe+2]);return ie}function Bo(Re,Z){if(Re.transformed)return Re;const ie=1<<Re.z,pe=Re.x,Te=Re.y;for(const ke of Re.features){const Me=ke.geometry,Ue=ke.type;if(ke.geometry=[],Ue===1)for(let ge=0;ge<Me.length;ge+=2)ke.geometry.push(Ui(Me[ge],Me[ge+1],Z,ie,pe,Te));else for(let ge=0;ge<Me.length;ge++){const Ie=[];for(let st=0;st<Me[ge].length;st+=2)Ie.push(Ui(Me[ge][st],Me[ge][st+1],Z,ie,pe,Te));ke.geometry.push(Ie)}}return Re.transformed=!0,Re}function Ui(Re,Z,ie,pe,Te,ke){return[Math.round(ie*(Re*pe-Te)),Math.round(ie*(Z*pe-ke))]}function os(Re,Z,ie,pe,Te){const ke=Z===Te.maxZoom?0:Te.tolerance/((1<<Z)*Te.extent),Me={features:[],numPoints:0,numSimplified:0,numFeatures:Re.length,source:null,x:ie,y:pe,z:Z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Ue of Re)Bn(Me,Ue,ke,Te);return Me}function Bn(Re,Z,ie,pe){const Te=Z.geometry,ke=Z.type,Me=[];if(Re.minX=Math.min(Re.minX,Z.minX),Re.minY=Math.min(Re.minY,Z.minY),Re.maxX=Math.max(Re.maxX,Z.maxX),Re.maxY=Math.max(Re.maxY,Z.maxY),ke==="Point"||ke==="MultiPoint")for(let Ue=0;Ue<Te.length;Ue+=3)Me.push(Te[Ue],Te[Ue+1]),Re.numPoints++,Re.numSimplified++;else if(ke==="LineString")Ur(Me,Te,Re,ie,!1,!1);else if(ke==="MultiLineString"||ke==="Polygon")for(let Ue=0;Ue<Te.length;Ue++)Ur(Me,Te[Ue],Re,ie,ke==="Polygon",Ue===0);else if(ke==="MultiPolygon")for(let Ue=0;Ue<Te.length;Ue++){const ge=Te[Ue];for(let Ie=0;Ie<ge.length;Ie++)Ur(Me,ge[Ie],Re,ie,!0,Ie===0)}if(Me.length){let Ue=Z.tags||null;if(ke==="LineString"&&pe.lineMetrics){Ue={};for(const Ie in Z.tags)Ue[Ie]=Z.tags[Ie];Ue.mapbox_clip_start=Te.start/Te.size,Ue.mapbox_clip_end=Te.end/Te.size}const ge={geometry:Me,type:ke==="Polygon"||ke==="MultiPolygon"?3:ke==="LineString"||ke==="MultiLineString"?2:1,tags:Ue};Z.id!==null&&(ge.id=Z.id),Re.features.push(ge)}}function Ur(Re,Z,ie,pe,Te,ke){const Me=pe*pe;if(pe>0&&Z.size<(Te?Me:pe))return void(ie.numPoints+=Z.length/3);const Ue=[];for(let ge=0;ge<Z.length;ge+=3)(pe===0||Z[ge+2]>Me)&&(ie.numSimplified++,Ue.push(Z[ge],Z[ge+1])),ie.numPoints++;Te&&function(ge,Ie){let st=0;for(let dt=0,Tt=ge.length,jt=Tt-2;dt<Tt;jt=dt,dt+=2)st+=(ge[dt]-ge[jt])*(ge[dt+1]+ge[jt+1]);if(st>0===Ie)for(let dt=0,Tt=ge.length;dt<Tt/2;dt+=2){const jt=ge[dt],Xt=ge[dt+1];ge[dt]=ge[Tt-2-dt],ge[dt+1]=ge[Tt-1-dt],ge[Tt-2-dt]=jt,ge[Tt-1-dt]=Xt}}(Ue,ke),Re.push(Ue)}const ni={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class _o{constructor(Z,ie){const pe=(ie=this.options=function(ke,Me){for(const Ue in Me)ke[Ue]=Me[Ue];return ke}(Object.create(ni),ie)).debug;if(pe&&console.time("preprocess data"),ie.maxZoom<0||ie.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ie.promoteId&&ie.generateId)throw new Error("promoteId and generateId cannot be used together.");let Te=function(ke,Me){const Ue=[];if(ke.type==="FeatureCollection")for(let ge=0;ge<ke.features.length;ge++)qr(Ue,ke.features[ge],Me,ge);else qr(Ue,ke.type==="Feature"?ke:{geometry:ke},Me);return Ue}(Z,ie);this.tiles={},this.tileCoords=[],pe&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ie.indexMaxZoom,ie.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Te=function(ke,Me){const Ue=Me.buffer/Me.extent;let ge=ke;const Ie=mi(ke,1,-1-Ue,Ue,0,-1,2,Me),st=mi(ke,1,1-Ue,2+Ue,0,-1,2,Me);return(Ie||st)&&(ge=mi(ke,1,-Ue,1+Ue,0,-1,2,Me)||[],Ie&&(ge=Eo(Ie,1).concat(ge)),st&&(ge=ge.concat(Eo(st,-1)))),ge}(Te,ie),Te.length&&this.splitTile(Te,0,0,0),pe&&(Te.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(Z,ie,pe,Te,ke,Me,Ue){const ge=[Z,ie,pe,Te],Ie=this.options,st=Ie.debug;for(;ge.length;){Te=ge.pop(),pe=ge.pop(),ie=ge.pop(),Z=ge.pop();const dt=1<<ie,Tt=ya(ie,pe,Te);let jt=this.tiles[Tt];if(!jt&&(st>1&&console.time("creation"),jt=this.tiles[Tt]=os(Z,ie,pe,Te,Ie),this.tileCoords.push({z:ie,x:pe,y:Te}),st)){st>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ie,pe,Te,jt.numFeatures,jt.numPoints,jt.numSimplified),console.timeEnd("creation"));const ci=`z${ie}`;this.stats[ci]=(this.stats[ci]||0)+1,this.total++}if(jt.source=Z,ke==null){if(ie===Ie.indexMaxZoom||jt.numPoints<=Ie.indexMaxPoints)continue}else{if(ie===Ie.maxZoom||ie===ke)continue;if(ke!=null){const ci=ke-ie;if(pe!==Me>>ci||Te!==Ue>>ci)continue}}if(jt.source=null,Z.length===0)continue;st>1&&console.time("clipping");const Xt=.5*Ie.buffer/Ie.extent,Un=.5-Xt,hn=.5+Xt,mn=1+Xt;let Nn=null,xr=null,Dr=null,Ii=null;const Gi=mi(Z,dt,pe-Xt,pe+hn,0,jt.minX,jt.maxX,Ie),Cn=mi(Z,dt,pe+Un,pe+mn,0,jt.minX,jt.maxX,Ie);Gi&&(Nn=mi(Gi,dt,Te-Xt,Te+hn,1,jt.minY,jt.maxY,Ie),xr=mi(Gi,dt,Te+Un,Te+mn,1,jt.minY,jt.maxY,Ie)),Cn&&(Dr=mi(Cn,dt,Te-Xt,Te+hn,1,jt.minY,jt.maxY,Ie),Ii=mi(Cn,dt,Te+Un,Te+mn,1,jt.minY,jt.maxY,Ie)),st>1&&console.timeEnd("clipping"),ge.push(Nn||[],ie+1,2*pe,2*Te),ge.push(xr||[],ie+1,2*pe,2*Te+1),ge.push(Dr||[],ie+1,2*pe+1,2*Te),ge.push(Ii||[],ie+1,2*pe+1,2*Te+1)}}getTile(Z,ie,pe){Z=+Z,ie=+ie,pe=+pe;const Te=this.options,{extent:ke,debug:Me}=Te;if(Z<0||Z>24)return null;const Ue=1<<Z,ge=ya(Z,ie=ie+Ue&Ue-1,pe);if(this.tiles[ge])return Bo(this.tiles[ge],ke);Me>1&&console.log("drilling down to z%d-%d-%d",Z,ie,pe);let Ie,st=Z,dt=ie,Tt=pe;for(;!Ie&&st>0;)st--,dt>>=1,Tt>>=1,Ie=this.tiles[ya(st,dt,Tt)];return Ie&&Ie.source?(Me>1&&(console.log("found parent tile z%d-%d-%d",st,dt,Tt),console.time("drilling down")),this.splitTile(Ie.source,st,dt,Tt,Z,ie,pe),Me>1&&console.timeEnd("drilling down"),this.tiles[ge]?Bo(this.tiles[ge],ke):null):null}}function ya(Re,Z,ie){return 32*((1<<Re)*ie+Z)+Re}function ss(Re,Z){const ie=Re.tileID.canonical;if(!this._geoJSONIndex)return void Z(null,null);const pe=this._geoJSONIndex.getTile(ie.z,ie.x,ie.y);if(!pe)return void Z(null,null);const Te=Ie=>Ie.tags&&"3d_elevation_id"in Ie.tags&&"source"in Ie.tags&&Ie.tags.source==="elevation",ke=pe.features.filter(Ie=>Te(Ie));let Me={_geojsonTileLayer:pe.features};ke.length>0&&(Me={_geojsonTileLayer:pe.features.filter(Ie=>!Te(Ie)),hd_road_elevation:ke});const Ue=new Mn(Me),ge=function(Ie){const st=new T.at;for(const dt of Object.keys(Ie))st.writeMessage(3,Tr,{name:dt,features:Ie[dt]});return st.finish()}(Me).buffer;Z(null,{vectorTile:Ue,rawData:ge})}class Zs extends zt{constructor(Z){super(Z),this.loadVectorData=ss,this._dynamicIndex=new Wr}loadData(Z,ie){const pe=Z&&Z.request,Te=pe&&pe.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(Z,(ke,Me)=>{if(ke||!Me)return ie(ke);if(typeof Me!="object")return ie(new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`));{try{if(Z.filter){const ge=T.bY(Z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ge.result==="error")throw new Error(ge.value.map(Ie=>`${Ie.key}: ${Ie.message}`).join(", "));Me.features=Me.features.filter(Ie=>ge.value.evaluate({zoom:0},Ie))}Z.dynamic?(Me.type==="Feature"&&(Me={type:"FeatureCollection",features:[Me]}),Z.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Me.features,this.loaded),Z.cluster&&(Me.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=Z.cluster?new Ec(function({superclusterOptions:ge,clusterProperties:Ie}){if(!Ie||!ge)return ge;const st={},dt={},Tt={accumulated:null,zoom:0},jt={properties:null},Xt=Object.keys(Ie);for(const Un of Xt){const[hn,mn]=Ie[Un],Nn=T.bY(mn),xr=T.bY(typeof hn=="string"?[hn,["accumulated"],["get",Un]]:hn);st[Un]=Nn.value,dt[Un]=xr.value}return ge.map=Un=>{jt.properties=Un;const hn={};for(const mn of Xt)hn[mn]=st[mn].evaluate(Tt,jt);return hn},ge.reduce=(Un,hn)=>{jt.properties=hn;for(const mn of Xt)Tt.accumulated=Un[mn],Un[mn]=dt[mn].evaluate(Tt,jt)},ge}(Z)).load(Me.features):Z.dynamic?this._dynamicIndex:function(ge,Ie){return new _o(ge,Ie)}(Me,Z.geojsonVtOptions)}catch(ge){return ie(ge)}const Ue={};if(Te){const ge=L(pe);ge&&(Ue.resourceTiming={},Ue.resourceTiming[Z.source]=JSON.parse(JSON.stringify(ge)))}ie(null,Ue)}})}reloadTile(Z,ie){const pe=this.loaded;return pe&&pe[Z.uid]?Z.partial?ie(null,void 0):super.reloadTile(Z,ie):this.loadTile(Z,ie)}loadGeoJSON(Z,ie){if(Z.request)T.cT(Z.request,ie);else{if(typeof Z.data!="string")return ie(new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return ie(null,JSON.parse(Z.data))}catch{return ie(new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(Z,ie){try{ie(null,this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId))}catch(pe){ie(pe)}}getClusterChildren(Z,ie){try{ie(null,this._geoJSONIndex.getChildren(Z.clusterId))}catch(pe){ie(pe)}}getClusterLeaves(Z,ie){try{ie(null,this._geoJSONIndex.getLeaves(Z.clusterId,Z.limit,Z.offset))}catch(pe){ie(pe)}}}class Wl{constructor(Z,ie,pe){this.tileID=new T.ap(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.tileZoom=Z.tileZoom,this.uid=Z.uid,this.zoom=Z.zoom,this.canonical=Z.tileID.canonical,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=Z.projection,this.brightness=ie,this.worldview=pe}parse(Z,ie,pe,Te){this.status="parsing";const ke=new T.ap(pe.tileID.overscaledZ,pe.tileID.wrap,pe.tileID.canonical.z,pe.tileID.canonical.x,pe.tileID.canonical.y),Me=[],Ue=ie.familiesBySource[pe.source],ge=new T.I(ke,pe.promoteId);ge.bucketLayerIDs=[],ge.is3DTile=!0,T.e5(Z).then(Ie=>{const st=Ie.json.extensionsUsed&&Ie.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ie.json.asset.extras&&Ie.json.asset.extras.MAPBOX_mesh_features,dt=Ie.json.extensionsUsed&&Ie.json.extensionsUsed.includes("EXT_meshopt_compression"),Tt=new T.w(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const jt in Ue)for(const Xt of Ue[jt]){const Un=Xt[0];ge.bucketLayerIDs.push(Xt.map(Nn=>T.ea(Nn.id,Nn.scope))),Un.recalculate(Tt,[]);const hn=T.eV(Ie,1/T.fH(pe.tileID.canonical)),mn=new T.b1(Xt,hn,ke,st,dt,this.brightness,ge,this.worldview);st||(mn.needsUpload=!0),Me.push(mn),mn.evaluate(Un)}this.status="done",Te(null,{buckets:Me,featureIndex:ge,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ie=>Te(new Error(Ie.message)))}}class ql{constructor({actor:Z,layerIndex:ie,availableImages:pe,availableModels:Te,brightness:ke,worldview:Me}){this.actor=Z,this.layerIndex=ie,this.availableImages=pe,this.availableModels=Te,this.brightness=ke,this.loading={},this.loaded={},this.worldview=Me}loadTile(Z,ie){const pe=Z.uid,Te=this.loading[pe]=new Wl(Z,this.brightness,this.worldview);T.cG(Z.request,(ke,Me)=>{const Ue=!this.loading[pe];return delete this.loading[pe],Ue||ke?(Te.status="done",Ue||(this.loaded[pe]=Te),ie(ke)):Me&&Me.byteLength!==0?void Te.parse(Me,this.layerIndex,Z,(ge,Ie)=>{Te.status="done",this.loaded=this.loaded||{},this.loaded[pe]=Te,ge||!Ie?ie(ge):ie(null,Ie)}):(Te.status="done",this.loaded[pe]=Te,ie())})}reloadTile(Z,ie){const pe=this.loaded,Te=Z.uid;if(pe&&pe[Te]){const ke=pe[Te];ke.projection=Z.projection,ke.brightness=Z.brightness;const Me=(Ue,ge)=>{ke.reloadCallback&&(delete ke.reloadCallback,this.loadTile(Z,ie)),ie(Ue,ge)};ke.status==="parsing"?ke.reloadCallback=Me:ke.status==="done"&&this.loadTile(Z,ie)}}abortTile(Z,ie){const pe=Z.uid;this.loading[pe]&&delete this.loading[pe],ie()}removeTile(Z,ie){const pe=this.loaded,Te=Z.uid;pe&&pe[Te]&&delete pe[Te],ie()}}class af{constructor(Z){this.self=Z,this.actor=new T.a(Z,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=T.c$({name:"mercator"}),this.workerSourceTypes={vector:zt,geojson:Zs,"raster-dem":vt,"raster-array":Pt,"batched-model":ql},this.workerSources={},this.self.registerWorkerSource=(ie,pe)=>{if(this.workerSourceTypes[ie])throw new Error(`Worker source with name "${ie}" already registered.`);this.workerSourceTypes[ie]=pe},this.self.registerRTLTextPlugin=ie=>{if(T.eH.isParsed())throw new Error("RTL text plugin already registered.");T.eH.setState({pluginStatus:T.f7.parsed,pluginURL:T.eH.getPluginURL()}),T.eH.applyArabicShaping=ie.applyArabicShaping,T.eH.processBidirectionalText=ie.processBidirectionalText,T.eH.processStyledBidirectionalText=ie.processStyledBidirectionalText;for(const pe of this.rtlPluginParsingListeners)pe(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(Z,ie,pe){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.availableModels[Z],delete this.workerSources[Z],pe()}checkIfReady(Z,ie,pe){pe()}setReferrer(Z,ie){this.referrer=ie}spriteLoaded(Z,ie){this.isSpriteLoaded[Z]||(this.isSpriteLoaded[Z]={});const{scope:pe,isLoaded:Te}=ie;if(this.isSpriteLoaded[Z][pe]=Te,this.workerSources[Z]&&this.workerSources[Z][pe])for(const ke in this.workerSources[Z][pe]){const Me=this.workerSources[Z][pe][ke];for(const Ue in Me){const ge=Me[Ue];ge instanceof zt&&(ge.isSpriteLoaded=Te,ge.fire(new T.x("isSpriteLoaded")))}}}setImages(Z,ie,pe){this.availableImages[Z]||(this.availableImages[Z]={});const{scope:Te,images:ke}=ie;if(this.availableImages[Z][Te]=ke,this.workerSources[Z]&&this.workerSources[Z][Te]){for(const Me in this.workerSources[Z][Te]){const Ue=this.workerSources[Z][Te][Me];for(const ge in Ue)Ue[ge].availableImages=ke}pe()}else pe()}setModels(Z,{scope:ie,models:pe},Te){if(this.availableModels[Z]||(this.availableModels[Z]={}),this.availableModels[Z][ie]=pe,this.workerSources[Z]&&this.workerSources[Z][ie]){for(const ke in this.workerSources[Z][ie]){const Me=this.workerSources[Z][ie][ke];for(const Ue in Me)Me[Ue].availableModels=pe}Te()}else Te()}setProjection(Z,ie){this.projections[Z]=T.c$(ie)}setBrightness(Z,ie,pe){this.brightness=ie,pe()}setContextParams(Z,ie,pe){this.maxUniformBufferBindings=ie.maxBindingPoints,this.maxUniformBlockSizeDwords=ie.maxUniformBlockSizeDwords,this.disableSymbolUBO=ie.disableSymbolUBO,pe()}setWorldview(Z,ie,pe){this.worldview=ie,pe()}setLayers(Z,ie,pe){this.getLayerIndex(Z,ie.scope).replace(ie.layers,ie.options),pe()}updateLayers(Z,ie,pe){this.getLayerIndex(Z,ie.scope).update(ie.layers,ie.removedIds,ie.options),pe()}loadTile(Z,ie,pe){ie.projection=this.projections[Z]||this.defaultProjection,this.getWorkerSource(Z,ie).loadTile(ie,pe)}decodeRasterArray(Z,ie,pe){this.getWorkerSource(Z,ie).decodeRasterArray(ie,pe)}reloadTile(Z,ie,pe){ie.projection=this.projections[Z]||this.defaultProjection,this.getWorkerSource(Z,ie).reloadTile(ie,pe)}abortTile(Z,ie,pe){this.getWorkerSource(Z,ie).abortTile(ie,pe)}removeTile(Z,ie,pe){this.getWorkerSource(Z,ie).removeTile(ie,pe)}removeSource(Z,ie,pe){if(!(this.workerSources[Z]&&this.workerSources[Z][ie.scope]&&this.workerSources[Z][ie.scope][ie.type]&&this.workerSources[Z][ie.scope][ie.type][ie.source]))return;const Te=this.workerSources[Z][ie.scope][ie.type][ie.source];delete this.workerSources[Z][ie.scope][ie.type][ie.source],Te.removeSource!==void 0?Te.removeSource(ie,pe):pe()}loadTileProvider(Z,ie,pe){T.e8(ie.name,ie.url).then(Te=>{const ke=new Te(ie.options);return this.getWorkerSource(Z,{type:ie.type,source:ie.source,scope:ie.scope},ke),ke.load&&ie.request?ke.load({request:ie.request}):null}).then(Te=>pe(null,Te)).catch(Te=>pe(Te instanceof Error?Te:new Error(String(Te))))}async syncRTLPluginState(Z,ie,pe){if(T.eH.isParsed())return void pe(null,!0);if(T.eH.isParsing())return void this.rtlPluginParsingListeners.push(pe);T.eH.setState(ie);const Te=T.eH.getPluginURL();if(!T.eH.isLoaded()||T.eH.isParsed()||T.eH.isParsing())pe(null,!1);else{T.eH.setState({pluginStatus:T.f7.parsing,pluginURL:Te});try{await import(Te),T.eH.isParsed()?pe(null,!0):this.rtlPluginParsingListeners.push(pe)}catch(ke){T.eH.setState({pluginStatus:T.f7.error,pluginURL:Te}),pe(ke);for(const Me of this.rtlPluginParsingListeners)Me(ke);this.rtlPluginParsingListeners=[]}}}setConfig(Z,ie){Object.assign(T.bN,ie)}getAvailableImages(Z,ie){this.availableImages[Z]||(this.availableImages[Z]={});let pe=this.availableImages[Z][ie];return pe||(pe=[]),pe}getAvailableModels(Z,ie){this.availableModels[Z]||(this.availableModels[Z]={});let pe=this.availableModels[Z][ie];return pe||(pe={}),pe}getLayerIndex(Z,ie){this.layerIndexes[Z]||(this.layerIndexes[Z]={});let pe=this.layerIndexes[Z][ie];return pe||(pe=this.layerIndexes[Z][ie]=new At,pe.scope=ie),pe}getWorkerSource(Z,ie,pe){const{type:Te,source:ke,scope:Me}=ie,Ue=this.workerSources;if(Ue[Z]||(Ue[Z]={}),Ue[Z][Me]||(Ue[Z][Me]={}),Ue[Z][Me][Te]||(Ue[Z][Me][Te]={}),this.isSpriteLoaded[Z]||(this.isSpriteLoaded[Z]={}),Ue[Z][Me][Te][ke])pe&&(Ue[Z][Me][Te][ke].tileProvider=pe);else{const ge={send:(st,dt,Tt,jt,Xt,Un)=>this.actor.send(st,dt,Tt,Z,Xt,Un),scheduler:this.actor.scheduler},Ie=this.workerSourceTypes[Te];if(!Ie)throw new Error(`Unknown worker source type "${Te}".`);Ue[Z][Me][Te][ke]=new Ie({actor:ge,layerIndex:this.getLayerIndex(Z,Me),availableImages:this.getAvailableImages(Z,Me),availableModels:this.getAvailableModels(Z,Me),isSpriteLoaded:this.isSpriteLoaded[Z][Me],tileProvider:pe,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return Ue[Z][Me][Te][ke]}enforceCacheSizeLimit(Z,ie){T.cf(ie)}getWorkerPerformanceMetrics(Z,ie,pe){pe(void 0,void 0)}}return T.dR(self)&&(self.worker=new af(self)),af}),v(["./shared"],function(c){var T="3.25.0";const L={create:"create",load:"load",fullLoad:"fullLoad"},B={mark(u){performance.mark(u)},measure(u,r,a){performance.measure(u,r,a)}};function U(u){const r=u.name.split("?")[0];return c.dF(r)&&r.includes("mapbox-gl.js")?"javascript":c.dF(r)&&r.includes("mapbox-gl.css")?"css":c.dG(r)?"fontRange":c.dH(r)?"sprite":c.dI(r)?"style":c.dJ(r)?"tilejson":"other"}const H={antialias:!1,alpha:!0,stencil:!0,depth:!0};let X,ae;function ne(u){const r=document.createElement("canvas"),a=Object.create(H);a.failIfMajorPerformanceCaveat=u;const f=r.getContext("webgl2",a);if(!f)return!1;let _;try{_=f.createShader(f.VERTEX_SHADER)}catch{return!1}return!(!_||f.isContextLost())&&(f.shaderSource(_,"void main() {}"),f.compileShader(_),f.getShaderParameter(_,f.COMPILE_STATUS)===!0)}const me=/firefox/i,oe=/macintosh/i;function re(u,r,a){const f=document.createElement(u);return r!=null&&(f.className=r),a&&a.appendChild(f),f}function he(u,r,a){const f=document.createElementNS("http://www.w3.org/2000/svg",u);for(const _ of Object.keys(r))f.setAttributeNS(null,_,String(r[_]));return a&&a.appendChild(f),f}const _e=typeof document<"u"?document.documentElement&&document.documentElement.style:null,De=_e&&_e.userSelect!==void 0?"userSelect":"WebkitUserSelect";let He;function nt(){_e&&De&&(He=_e[De],_e[De]="none")}function Xe(){_e&&De&&(_e[De]=He)}function ft(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",ft,!0)}function At(){window.addEventListener("click",ft,!0),window.setTimeout(()=>{window.removeEventListener("click",ft,!0)},0)}function Bt(u,r){const a=u.getBoundingClientRect();return kt(u,a,r)}function Dt(u,r){const a=u.getBoundingClientRect(),f=[];for(let _=0;_<r.length;_++)f.push(kt(u,a,r[_]));return f}function It(u){return me.test(navigator.userAgent)&&oe.test(navigator.userAgent)&&u.button===2&&u.ctrlKey?0:u.button}function kt(u,r,a){const f=u.offsetWidth===r.width?1:u.offsetWidth/r.width;return new c.au((a.clientX-r.left)*f,(a.clientY-r.top)*f)}const wt="01",Zt=/(\.(png|jpg)\d*)(?=$)/,zt=/^.+\/v4\//,vt=/\.[\w]+$/,pt=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,Pt=/^access_token=(.*)$/,An="NO_ACCESS_TOKEN";class bn{constructor(r,a,f){this._transformRequestFn=r,this._customAccessToken=a,this._silenceAuthErrors=!!f,this._createSkuToken()}_createSkuToken(){const r=function(){let a="";for(let f=0;f<10;f++)a+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",wt,a].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=r.token,this._skuTokenExpiresAt=r.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(r,a){return this._transformRequestFn&&this._transformRequestFn(r,a)||{url:r}}normalizeStyleURL(r,a){if(!c.dL(r))return r;const f=Mn(r);return f.params.push(`sdk=js-${T}`),f.path=`/styles/v1${f.path}`,this._makeAPIURL(f,this._customAccessToken||a)}normalizeGlyphsURL(r,a){if(!c.dL(r))return r;const f=Mn(r);return f.path=`/fonts/v1${f.path}`,this._makeAPIURL(f,this._customAccessToken||a)}normalizeModelURL(r,a){if(!c.dL(r))return r;const f=Mn(r);return f.path=`/models/v1${f.path}`,this._makeAPIURL(f,this._customAccessToken||a)}normalizeSourceURL(r,a,f,_){if(!c.dL(r))return r;const x=Mn(r);return x.path=`/v4/${x.authority}.json`,x.params.push("secure"),f&&x.params.push(`language=${f}`),_&&x.params.push(`worldview=${_}`),this._makeAPIURL(x,this._customAccessToken||a)}normalizeIconsetURL(r,a){const f=Mn(r);return c.dL(r)?(f.path=`/styles/v1${f.path}/iconset.pbf`,this._makeAPIURL(f,this._customAccessToken||a)):Tn(f)}normalizeSpriteURL(r,a,f,_){const x=Mn(r);return c.dL(r)?(x.path=`/styles/v1${x.path}/sprite${a}${f}`,this._makeAPIURL(x,this._customAccessToken||_)):(x.path+=`${a}${f}`,Tn(x))}normalizeTileURL(r,a,f){if(this._isSkuTokenExpired()&&this._createSkuToken(),r&&!c.dL(r))return r;const _=Mn(r);_.path=_.path.replace(Zt,`${a||f&&_.authority!=="raster"&&f===512?"@2x":""}${c.cn.supported?".webp":"$1"}`),_.authority==="raster"?_.path=`/${c.bN.RASTER_URL_PREFIX}${_.path}`:_.authority==="rasterarrays"?_.path=`/${c.bN.RASTERARRAYS_URL_PREFIX}${_.path}`:_.authority==="3dtiles"?_.path=`/${c.bN.TILES3D_URL_PREFIX}${_.path}`:(_.path=_.path.replace(zt,"/"),_.path=`/${c.bN.TILE_URL_VERSION}${_.path}`);const x=this._customAccessToken||function(w){for(const k of w){const A=k.match(Pt);if(A)return A[1]}return null}(_.params)||c.bN.ACCESS_TOKEN;return c.bN.REQUIRE_ACCESS_TOKEN&&x&&this._skuToken&&_.params.push(`sku=${this._skuToken}`),this._makeAPIURL(_,x)}canonicalizeTileURL(r,a){const f=Mn(r);if(!pt.test(f.path)||!vt.test(f.path))return r;let _="mapbox://";f.path.startsWith("/raster/v1/")?_+=`raster/${f.path.replace(`/${c.bN.RASTER_URL_PREFIX}/`,"")}`:f.path.startsWith("/rasterarrays/v1/")?_+=`rasterarrays/${f.path.replace(`/${c.bN.RASTERARRAYS_URL_PREFIX}/`,"")}`:_+=`tiles/${f.path.replace(`/${c.bN.TILE_URL_VERSION}/`,"")}`;let x=f.params;return a&&(x=x.filter(w=>!w.match(Pt))),x.length&&(_+=`?${x.join("&")}`),_}canonicalizeTileset(r,a){const f=!!a&&c.dL(a),_=[];for(const x of r.tiles||[])c.dK(x)?_.push(this.canonicalizeTileURL(x,f)):_.push(x);return _}_makeAPIURL(r,a){const f="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",_=Mn(c.bN.API_URL);if(r.protocol=_.protocol,r.authority=_.authority,r.protocol==="http"){const x=r.params.indexOf("secure");x>=0&&r.params.splice(x,1)}if(_.path!=="/"&&(r.path=`${_.path}${r.path}`),!c.bN.REQUIRE_ACCESS_TOKEN)return Tn(r);if(a=a||c.bN.ACCESS_TOKEN,!this._silenceAuthErrors){if(!a)throw new Error(`An API access token is required to use Mapbox GL. ${f}`);if(a[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${f}`)}return r.params=r.params.filter(x=>!x.includes("access_token")),r.params.push(`access_token=${a||""}`),Tn(r)}}const Vn=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Mn(u){const r=u.match(Vn);if(!r)throw new Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function Tn(u){const r=u.params.length?`?${u.params.join("&")}`:"";return`${u.protocol}://${u.authority}${u.path}${r}`}const Wr="mapbox.eventData";function Kn(u){if(!u)return null;const r=u.split(".");if(!r||r.length!==3)return null;try{return JSON.parse(c.bq(r[1]))}catch{return null}}function Ho(u){return!(!c.bN.EVENTS_URL||!u&&!c.bN.ACCESS_TOKEN)}let Ni;const wo=/^[\w.+-]+(\/[\w.+-]+)?$/;let $n="other";class Ar{constructor(r){this.type=r,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(r){const a=Kn(c.bN.ACCESS_TOKEN);let f="";return f=a&&a.u?c.br(a.u):c.bN.ACCESS_TOKEN||"",r?`${Wr}.${r}:${f}`:`${Wr}:${f}`}fetchEventData(){const r=c.fv("localStorage"),a=this.getStorageKey(),f=this.getStorageKey("uuid"),_=this.getStorageKey("uuidTimestamp");if(r)try{const x=localStorage.getItem(a);x&&(this.eventData=JSON.parse(x));const w=localStorage.getItem(f);w&&(this.anonId=w);const k=localStorage.getItem(_);k&&(this.anonIdTimestamp=Number(k));const A=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<A)&&this.refreshUUID()}catch{c.f_("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=c.fX(),this.anonIdTimestamp=Date.now()}saveEventData(){const r=c.fv("localStorage"),a=this.getStorageKey(),f=this.getStorageKey("uuid"),_=this.getStorageKey("uuidTimestamp"),x=this.anonId,w=this.anonIdTimestamp;if(r&&x)try{localStorage.setItem(f,x),Object.keys(this.eventData).length>=1&&localStorage.setItem(a,JSON.stringify(this.eventData)),w&&localStorage.setItem(_,w.toString())}catch{c.f_("Unable to write to LocalStorage")}}processRequests(r){}postEvent(r,a,f,_){if(!c.bN.EVENTS_URL)return;const x=Mn(c.bN.EVENTS_URL);x.params.push(`access_token=${_||c.bN.ACCESS_TOKEN||""}`);const w={event:this.type,created:new Date(r).toISOString()},k=a?Object.assign(w,a):w,A={url:Tn(x),headers:{"Content-Type":"text/plain"},body:JSON.stringify([k])};this.pendingRequest=c.eR(A,P=>{this.pendingRequest=null,f(P),this.saveEventData(),this.processRequests(_)})}queueRequest(r,a){this.queue.push(r),this.processRequests(a)}}class pi extends Ar{constructor(r){super("metrics"),r&&(this.data=r)}postMetricsEvent(r){if(!Ho(r))return;this.anonId||this.fetchEventData(),c.fZ(this.anonId)||this.refreshUUID();const a=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:a},r)}processRequests(r){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:a,payload:f}=this.queue.shift();this.postEvent(a,f,()=>{},r)}}const zo=new class extends Ar{constructor(u){super("appUserTurnstile"),this._customAccessToken=u}postTurnstileEvent(u,r){Ho(r)&&Array.isArray(u)&&u.some(a=>c.dL(a)||c.dK(a))&&this.queueRequest(Date.now(),r)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=Kn(c.bN.ACCESS_TOKEN),a=r?r.u:c.bN.ACCESS_TOKEN;let f=a!==this.eventData.tokenU;c.fZ(this.anonId)||(this.refreshUUID(),f=!0);const _=this.queue.shift();if(this.eventData.lastSuccess){const w=new Date(this.eventData.lastSuccess),k=new Date(_),A=(_-this.eventData.lastSuccess)/864e5;f=f||A>=1||A<-1||w.getDate()!==k.getDate()}else f=!0;if(!f)return void this.processRequests();const x={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:T,skuId:wt,"enabled.telemetry":!1,userId:this.anonId,bundleFormat:"umd",bundleDistribution:$n};Ni&&(x.sdkInfo=Ni),this.postEvent(_,x,w=>{w||(this.eventData.lastSuccess=_,this.eventData.tokenU=a)},u)}},Tr=zo.postTurnstileEvent.bind(zo),ns=new class extends Ar{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(u,r,a,f){this.skuToken=r,this.errorCb=f,c.bN.EVENTS_URL&&(a||c.bN.ACCESS_TOKEN?this.queueRequest({id:u,timestamp:Date.now()},a):this.errorCb(new Error(An)))}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{id:r,timestamp:a}=this.queue.shift();if(r&&this.success[r])return;this.anonId&&this.anonIdTimestamp||this.fetchEventData(),c.fZ(this.anonId)||this.refreshUUID();const f={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:T,skuId:wt,skuToken:this.skuToken,userId:this.anonId,bundleFormat:"umd",bundleDistribution:$n};Ni&&(f.sdkInfo=Ni),this.postEvent(a,f,_=>{_?this.errorCb(_):r&&(this.success[r]=!0)},u)}remove(){this.errorCb=null}},ma=ns.postMapLoadEvent.bind(ns),So=new class extends Ar{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(u){let r=this.mapInstanceIdMap.get(u);return r||(r=c.fX(),this.mapInstanceIdMap.set(u,r)),r}getEventId(u){const r=this.eventIdPerMapInstanceMap.get(u)||0;return this.eventIdPerMapInstanceMap.set(u,r+1),r}postStyleLoadEvent(u,r){const{map:a,style:f,importedStyles:_}=r;if(!Ho(u))return;const x=this.getMapInstanceId(a),w={mapInstanceId:x,eventId:this.getEventId(x),style:f};_.length&&(w.importedStyles=_),this.queueRequest({timestamp:Date.now(),payload:w},u)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},u)}},Ci=So.postStyleLoadEvent.bind(So),Or=new pi({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Vi=Or.postMetricsEvent.bind(Or),To=new pi({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),ys=To.postMetricsEvent.bind(To),za=new class extends Ar{constructor(){super("gljs.performance")}postPerformanceEvent(u,r){Ho(u)&&this.queueRequest({timestamp:Date.now(),performanceData:r},u)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:r,performanceData:a}=this.queue.shift(),f=function(_){const x=performance.getEntriesByType("resource"),w=performance.getEntriesByType("mark"),k=function(j){const $={};if(j){for(const W in j)if(W!=="other")for(const J of j[W]){const Q=`${W}ResolveRangeMin`,ce=`${W}ResolveRangeMax`,fe=`${W}RequestCount`,se=`${W}RequestCachedCount`;$[Q]=Math.min($[Q]||1/0,J.startTime),$[ce]=Math.max($[ce]||-1/0,J.responseEnd);const Ae=Ee=>{$[Ee]===void 0&&($[Ee]=0),++$[Ee]};J.transferSize!==void 0&&J.transferSize===0&&Ae(se),Ae(fe)}}return $}(function(j,$){const W={};if(j)for(const J of j){const Q=$(J);W[Q]===void 0&&(W[Q]=[]),W[Q].push(J)}return W}(x,U)),A=window.devicePixelRatio,P=navigator.connection||navigator.mozConnection||navigator.webkitConnection,D=P?P.effectiveType:void 0,z={counters:[],metadata:[],attributes:[]},F=(j,$,W)=>{W!=null&&j.push({name:$,value:W.toString()})};for(const j in k)F(z.counters,j,k[j]);if(_.interactionRange[0]!==1/0&&_.interactionRange[1]!==-1/0&&(F(z.counters,"interactionRangeMin",_.interactionRange[0]),F(z.counters,"interactionRangeMax",_.interactionRange[1])),w)for(const j of Object.values(L)){const $=w.find(W=>W.name===j);$&&F(z.counters,j,$.startTime)}return F(z.counters,"visibilityHidden",_.visibilityHidden),F(z.attributes,"style",function(j){if(j)for(const $ of j){const W=$.name.split("?")[0];if(c.dI(W)){const J=W.split("/").slice(-2);if(J.length===2)return`mapbox://styles/${J[0]}/${J[1]}`}}}(x)),F(z.attributes,"terrainEnabled",_.terrainEnabled?"true":"false"),F(z.attributes,"fogEnabled",_.fogEnabled?"true":"false"),F(z.attributes,"projection",_.projection),F(z.attributes,"zoom",_.zoom),F(z.metadata,"devicePixelRatio",A),F(z.metadata,"connectionEffectiveType",D),F(z.metadata,"navigatorUserAgent",navigator.userAgent),F(z.metadata,"screenWidth",window.screen.width),F(z.metadata,"screenHeight",window.screen.height),F(z.metadata,"windowWidth",window.innerWidth),F(z.metadata,"windowHeight",window.innerHeight),F(z.metadata,"mapWidth",_.width/A),F(z.metadata,"mapHeight",_.height/A),F(z.metadata,"webglRenderer",_.renderer),F(z.metadata,"webglVendor",_.vendor),F(z.metadata,"sdkVersion",T),F(z.metadata,"sdkIdentifier","mapbox-gl-js"),z}(a);for(const _ of f.metadata);for(const _ of f.counters);for(const _ of f.attributes);this.postEvent(r,f,()=>{},u)}},Ec=za.postPerformanceEvent.bind(za),oi=new class extends Ar{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(u,r,a,f){if(!c.bN.API_URL||!c.bN.SESSION_PATH)return;const _=Mn(c.bN.API_URL+c.bN.SESSION_PATH);_.params.push(`sku=${r||""}`),_.params.push(`access_token=${f||c.bN.ACCESS_TOKEN||""}`);const x={url:Tn(_),headers:{"Content-Type":"text/plain"}};this.pendingRequest=c.cM(x,w=>{this.pendingRequest=null,a(w),this.saveEventData(),this.processRequests(f)})}getSessionAPI(u,r,a,f){this.skuToken=r,this.errorCb=f,c.bN.EVENTS_URL&&c.bN.SESSION_PATH&&c.bN.API_URL&&(a||c.bN.ACCESS_TOKEN?this.queueRequest({id:u,timestamp:Date.now()},a):this.errorCb(new Error(An)))}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||this.getSession(a,this.skuToken,f=>{f?this.errorCb(f):r&&(this.success[r]=!0)},u)}remove(){this.errorCb=null}},rs=oi.getSessionAPI.bind(oi),vs=new Set;function Ct(u,r){r?vs.add(u):vs.delete(u)}class sn{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(r,a){this._updatedSourceCaches[r]=a,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const a=r.scope;this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._updatedLayers[a].add(r.id),this.setDirty()}removeLayer(r){const a=r.scope;this._removedLayers[a]=this._removedLayers[a]||{},this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._removedLayers[a][r.id]=r,this._updatedLayers[a].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const a in this._updatedLayers)r[a]=r[a]||{},r[a].updatedIds=Array.from(this._updatedLayers[a].values());for(const a in this._removedLayers)r[a]=r[a]||{},r[a].removedIds=Object.keys(this._removedLayers[a]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(r){return this._updatedImages[r]?Array.from(this._updatedImages[r].values()):[]}updateImage(r,a){this._updatedImages[a]=this._updatedImages[a]||new Set,this._updatedImages[a].add(c.a1.toString(r)),this.setDirty()}resetUpdatedImages(r){this._updatedImages[r]&&this._updatedImages[r].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function pn(u){const{userImage:r}=u;return!!(r&&r.render&&r.render())&&(u.data.replace(new Uint8Array(r.data.buffer)),!0)}const jn=new c.i(0,0,0);function Fn(u,r){const a=[],f=u[`stretch_${r}`];let _=null;for(let x=0;x<f.length;x++)_===null?_=a.length===0?f[0]:a.at(-1)[1]+f[x]:(a.push([_,_+f[x]]),_=null);u[`stretch_${r}_areas`]=a}function hr(u,r){const a={name:void 0};let f;for(;f=u.nextField(r);)f===1?a.name=u.readString():f===2?a.metadata=qr(u,u.readVarint()+u.pos):f===3&&(a.usvg_tree=Ba(u,u.readVarint()+u.pos),a.data="usvg_tree");return function(_){if(_.usvg_tree.height||(_.usvg_tree.height=_.usvg_tree.width),!_.metadata)return _;const{metadata:x}=_;if(x.content_area){const{content_area:w}=x;w.left==null&&(w.left=0),w.top==null&&(w.top=w.left),w.width==null&&(w.width=_.usvg_tree.width),w.height==null&&(w.height=w.width)}if(x.text_placeholder){const{text_placeholder:w}=x;w.top==null&&(w.top=w.left),w.height==null&&(w.height=w.width)}return x.stretch_x&&x.stretch_x.length&&Fn(x,"x"),x.stretch_y&&x.stretch_y.length&&Fn(x,"y"),_}(a)}function qr(u,r){const a={stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]};let f;for(;f=u.nextField(r);)f===1?a.stretch_x=u.readPackedVarint():f===2?a.stretch_y=u.readPackedVarint():f===3?a.content_area=ti(u,u.readVarint()+u.pos):f===4?a.variables.push(qs(u,u.readVarint()+u.pos)):f===5&&(a.text_placeholder=ti(u,u.readVarint()+u.pos));return a}function ti(u,r){const a={};let f;for(;f=u.nextField(r);)f===1?a.left=u.readVarint():f===2?a.width=u.readVarint():f===3?a.top=u.readVarint():f===4&&(a.height=u.readVarint());return a}function qs(u,r){const a={name:void 0};let f;for(;f=u.nextField(r);)f===1?a.name=u.readString():f===2&&(a.rgb_color=zn(u.readVarint()),a.value="rgb_color");return a}function Ba(u,r){const a={width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[],height:20};let f;for(;f=u.nextField(r);)f===1?a.width=a.height=u.readVarint():f===2?a.height=u.readVarint():f===3?a.children.push(is(u,u.readVarint()+u.pos)):f===4?a.linear_gradients.push(vr(u,u.readVarint()+u.pos)):f===5?a.radial_gradients.push(ji(u,u.readVarint()+u.pos)):f===7?a.clip_paths.push(Eo(u,u.readVarint()+u.pos)):f===8&&a.masks.push(ao(u,u.readVarint()+u.pos));return a}function is(u,r){const a={};let f;for(;f=u.nextField(r);)f===1?(a.group=Ms(u,u.readVarint()+u.pos),a.node="group"):f===2&&(a.path=ga(u,u.readVarint()+u.pos),a.node="path");return a}function Ms(u,r){const a={opacity:255,children:[]};let f;for(;f=u.nextField(r);)f===1?a.transform=mi(u,u.readVarint()+u.pos):f===2?a.opacity=u.readVarint():f===5?a.clip_path_idx=u.readVarint():f===6?a.mask_idx=u.readVarint():f===7&&a.children.push(is(u,u.readVarint()+u.pos));return a}function mi(u,r){const a={sx:1,ky:0,kx:0,sy:1,tx:0,ty:0};let f;for(;f=u.nextField(r);)f===1?a.sx=u.readFloat():f===2?a.ky=u.readFloat():f===3?a.kx=u.readFloat():f===4?a.sy=u.readFloat():f===5?a.tx=u.readFloat():f===6&&(a.ty=u.readFloat());return a}function ga(u,r){const a={paint_order:1,commands:[],step:1,diffs:[],rule:1};let f;for(;f=u.nextField(r);)f===1?a.fill=Wo(u,u.readVarint()+u.pos):f===2?a.stroke=_a(u,u.readVarint()+u.pos):f===3?a.paint_order=u.readVarint():f===5?u.readPackedVarint(a.commands):f===6?a.step=u.readFloat():f===7?u.readPackedSVarint(a.diffs):f===8&&(a.rule=u.readVarint());return a}function Wo(u,r){const a={rgb_color:jn,paint:"rgb_color",opacity:255};let f;for(;f=u.nextField(r);)f===1?(a.rgb_color=zn(u.readVarint()),a.paint="rgb_color"):f===2?(a.linear_gradient_idx=u.readVarint(),a.paint="linear_gradient_idx"):f===3?(a.radial_gradient_idx=u.readVarint(),a.paint="radial_gradient_idx"):f===5&&(a.opacity=u.readVarint());return a}function _a(u,r){const a={rgb_color:jn,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1};let f;for(;f=u.nextField(r);)f===1?(a.rgb_color=zn(u.readVarint()),a.paint="rgb_color"):f===2?(a.linear_gradient_idx=u.readVarint(),a.paint="linear_gradient_idx"):f===3?(a.radial_gradient_idx=u.readVarint(),a.paint="radial_gradient_idx"):f===5?u.readPackedFloat(a.dasharray):f===6?a.dashoffset=u.readFloat():f===7?a.miterlimit=u.readFloat():f===8?a.opacity=u.readVarint():f===9?a.width=u.readFloat():f===10?a.linecap=u.readVarint():f===11&&(a.linejoin=u.readVarint());return a}function zn(u){return new c.i((u>>16&255)/255,(u>>8&255)/255,(255&u)/255,1)}function vr(u,r){const a={spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0};let f;for(;f=u.nextField(r);)f===1?a.transform=mi(u,u.readVarint()+u.pos):f===2?a.spread_method=u.readVarint():f===3?a.stops.push(et(u,u.readVarint()+u.pos)):f===4?a.x1=u.readFloat():f===5?a.y1=u.readFloat():f===6?a.x2=u.readFloat():f===7&&(a.y2=u.readFloat());return a}function et(u,r){const a={offset:0,opacity:255,rgb_color:jn};let f;for(;f=u.nextField(r);)f===1?a.offset=u.readFloat():f===2?a.opacity=u.readVarint():f===3&&(a.rgb_color=zn(u.readVarint()));return a}function ji(u,r){const a={spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0};let f;for(;f=u.nextField(r);)f===1?a.transform=mi(u,u.readVarint()+u.pos):f===2?a.spread_method=u.readVarint():f===3?a.stops.push(et(u,u.readVarint()+u.pos)):f===4?a.cx=u.readFloat():f===5?a.cy=u.readFloat():f===6?a.r=u.readFloat():f===7?a.fx=u.readFloat():f===8?a.fy=u.readFloat():f===9&&(a.fr=u.readFloat());return a}function Eo(u,r){const a={children:[]};let f;for(;f=u.nextField(r);)f===1?a.transform=mi(u,u.readVarint()+u.pos):f===2?a.clip_path_idx=u.readVarint():f===3&&a.children.push(is(u,u.readVarint()+u.pos));return a}function ao(u,r){const a={left:0,width:20,mask_type:1,children:[]};let f;for(;f=u.nextField(r);)f===1?a.left=a.top=u.readFloat():f===2?a.width=a.height=u.readFloat():f===3?a.top=u.readFloat():f===4?a.height=u.readFloat():f===5?a.mask_type=u.readVarint():f===6?a.mask_idx=u.readVarint():f===7&&a.children.push(is(u,u.readVarint()+u.pos));return a.height==null&&(a.height=a.width),a.top==null&&(a.top=a.left),a}class Bo{static calculate(r={},a=[]){const f=new Map,_=new Map;if(Object.keys(r).length===0)return f;a.forEach(x=>{_.set(x.name,x.rgb_color||new c.i(0,0,0))});for(const[x,w]of Object.entries(r))_.has(x)?f.set(_.get(x).toString(),w):console.warn(`Ignoring unknown image variable "${x}"`);return f}}function Ui(u,r=255,a){const f=a.get(u.toString())||u;return r===255?f.toString():new c.i(f.r,f.g,f.b,f.a*r/255).toString()}const os=[];let Bn=0;function Ur(u,r){if(Bn>=os.length){const f=c.eA()?new OffscreenCanvas(u,r).getContext("2d",{willReadFrequently:!0}):document.createElement("canvas").getContext("2d",{willReadFrequently:!0});os.push(f)}const a=os[Bn++];return a.canvas.width=u,a.canvas.height=r,a}function ni(){Bn--}function _o(u,r,a,f,_){for(const x of f.children)ya(u,r,a,x,_)}function ya(u,r,a,f,_){f.group?(u.save(),function(x,w,k,A,P){const D=A.mask_idx!=null?k.masks[A.mask_idx]:null,z=A.clip_path_idx!=null?k.clip_paths[A.clip_path_idx]:null;if(A.transform&&(w=pe(A.transform).preMultiplySelf(w)),!function(j,$,W){return j.opacity!==255||$||W}(A,z!=null,D!=null))return void _o(x,w,k,A,P);const F=Ur(x.canvas.width,x.canvas.height);_o(F,w,k,A,P),z&&Z(F,w,k,z),D&&ie(F,w,k,D,P),x.globalAlpha=A.opacity/255,x.drawImage(F.canvas,0,0),ni()}(u,r,a,f.group,_),u.restore()):f.path&&(u.save(),function(x,w,k,A,P){x.setTransform(w),A.paint_order===1?(ss(x,k,A,P),Wl(x,k,A,P)):(Wl(x,k,A,P),ss(x,k,A,P))}(u,r,a,f.path,_),u.restore())}function ss(u,r,a,f){const _=a.fill;if(!_)return;const x=_.opacity/255;switch(u.save(),u.beginPath(),Te(a,u),_.paint){case"rgb_color":u.fillStyle=Ui(_.rgb_color,_.opacity,f);break;case"linear_gradient_idx":{const w=r.linear_gradients[_.linear_gradient_idx];w.transform&&u.setTransform(pe(w.transform).preMultiplySelf(u.getTransform())),u.fillStyle=ql(u,w,x,f);break}case"radial_gradient_idx":{const w=r.radial_gradients[_.radial_gradient_idx];w.transform&&u.setTransform(pe(w.transform).preMultiplySelf(u.getTransform())),u.fillStyle=af(u,w,x,f)}}u.fill(Zs(a)),u.restore()}function Zs(u){return u.rule===1?"nonzero":u.rule===2?"evenodd":void 0}function Wl(u,r,a,f){const _=a.stroke;if(!_)return;const x=ke(a);u.lineWidth=_.width,u.miterLimit=_.miterlimit,u.setLineDash(_.dasharray),u.lineDashOffset=_.dashoffset;const w=_.opacity/255;switch(_.paint){case"rgb_color":u.strokeStyle=Ui(_.rgb_color,_.opacity,f);break;case"linear_gradient_idx":u.strokeStyle=ql(u,r.linear_gradients[_.linear_gradient_idx],w,f,!0);break;case"radial_gradient_idx":u.strokeStyle=af(u,r.radial_gradients[_.radial_gradient_idx],w,f,!0)}switch(_.linejoin){case 2:case 1:u.lineJoin="miter";break;case 3:u.lineJoin="round";break;case 4:u.lineJoin="bevel"}switch(_.linecap){case 1:u.lineCap="butt";break;case 2:u.lineCap="round";break;case 3:u.lineCap="square"}u.stroke(x)}function ql(u,r,a,f,_=!1){if(r.stops.length===1){const F=r.stops[0];return Ui(F.rgb_color,F.opacity*a,f)}const{x1:x,y1:w,x2:k,y2:A}=r;let P=new DOMPoint(x,w),D=new DOMPoint(k,A);if(_){const F=pe(r.transform);P=F.transformPoint(P),D=F.transformPoint(D)}const z=u.createLinearGradient(P.x,P.y,D.x,D.y);for(const F of r.stops)z.addColorStop(F.offset,Ui(F.rgb_color,F.opacity*a,f));return z}function af(u,r,a,f,_=!1){if(r.stops.length===1){const Q=r.stops[0];return Ui(Q.rgb_color,Q.opacity*a,f)}const x=pe(r.transform),{fx:w,fy:k,fr:A,cx:P,cy:D,r:z}=r;let F=new DOMPoint(w,k),j=new DOMPoint(P,D),$=A,W=z;if(_){F=x.transformPoint(F),j=x.transformPoint(j);const Q=(x.a+x.d)/2;$=A*Q,W=r.r*Q}const J=u.createRadialGradient(F.x,F.y,$,j.x,j.y,W);for(const Q of r.stops)J.addColorStop(Q.offset,Ui(Q.rgb_color,Q.opacity*a,f));return J}function Re(u,r,a,f){const _=f.transform?pe(f.transform).preMultiplySelf(r):r,x=Ur(u.canvas.width,u.canvas.height);for(const k of f.children)if(k.group)Re(x,_,a,k.group);else if(k.path){const A=k.path,P=new Path2D;P.addPath(ke(A),_),x.fill(P,Zs(A))}const w=f.clip_path_idx!=null?a.clip_paths[f.clip_path_idx]:null;w&&Z(x,_,a,w),u.globalCompositeOperation="source-over",u.drawImage(x.canvas,0,0),ni()}function Z(u,r,a,f){const _=Ur(u.canvas.width,u.canvas.height);Re(_,r,a,f),u.globalCompositeOperation="destination-in",u.drawImage(_.canvas,0,0),ni()}function ie(u,r,a,f,_){if(f.children.length===0)return;const x=f.mask_idx!=null?a.masks[f.mask_idx]:null;x&&ie(u,r,a,x,_);const w=u.canvas.width,k=u.canvas.height,A=Ur(w,k),P=f.width,D=f.height,z=f.left,F=f.top,j=new Path2D,$=new Path2D;$.rect(z,F,P,D),j.addPath($,r),A.clip(j);for(const Q of f.children)ya(A,r,a,Q,_);const W=A.getImageData(0,0,w,k),J=W.data;if(f.mask_type===1)for(let Q=0;Q<J.length;Q+=4)J[Q+3]=J[Q+3]/255*(.2126*J[Q]+.7152*J[Q+1]+.0722*J[Q+2]);A.putImageData(W,0,0),u.globalCompositeOperation="destination-in",u.drawImage(A.canvas,0,0),ni()}function pe(u){return u?new DOMMatrix([u.sx,u.ky,u.kx,u.sy,u.tx,u.ty]):new DOMMatrix}function Te(u,r){const a=u.step;let f=u.diffs[0]*a,_=u.diffs[1]*a;r.moveTo(f,_);for(let x=0,w=2;x<u.commands.length;x++)switch(u.commands[x]){case 1:f+=u.diffs[w++]*a,_+=u.diffs[w++]*a,r.moveTo(f,_);break;case 2:f+=u.diffs[w++]*a,_+=u.diffs[w++]*a,r.lineTo(f,_);break;case 3:{const k=f+u.diffs[w++]*a,A=_+u.diffs[w++]*a;f=k+u.diffs[w++]*a,_=A+u.diffs[w++]*a,r.quadraticCurveTo(k,A,f,_);break}case 4:{const k=f+u.diffs[w++]*a,A=_+u.diffs[w++]*a,P=k+u.diffs[w++]*a,D=A+u.diffs[w++]*a;f=P+u.diffs[w++]*a,_=D+u.diffs[w++]*a,r.bezierCurveTo(k,A,P,D,f,_);break}case 5:r.closePath()}return r}function ke(u){return Te(u,new Path2D)}class Me{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new c.ay(r,r.data)}getFromCache(r,a,f){return this.cacheMap.has(f)||this.cacheMap.set(f,new c.a7(150)),this.cacheMap.get(f).get(c.ea(r.toString(),a))}setInCache(r,a,f,_){this.cacheDependenciesMap.has(_)||this.cacheDependenciesMap.set(_,new Map),this.cacheMap.has(_)||this.cacheMap.set(_,new c.a7(150));const x=this.cacheDependenciesMap.get(_),w=c.ea(r.id.toString(),f);x.get(w)||x.set(w,new Set);const k=this.cacheMap.get(_),A=r.toString();x.get(w).add(A),k.put(c.ea(r.toString(),f),a)}removeImagesFromCacheByIds(r,a,f=0){if(!this.cacheMap.has(f)||!this.cacheDependenciesMap.has(f))return;const _=this.cacheMap.get(f),x=this.cacheDependenciesMap.get(f);for(const w of r){const k=c.ea(w.toString(),a);if(x.has(k)){for(const A of x.get(k))_.delete(A);x.delete(k)}}}rasterize(r,a,f,_){const x=this.getFromCache(r,f,_);if(x)return x.clone();const w=function(A,P){const D=Bo.calculate(P.params,A.metadata?A.metadata.variables:[]),z=A.usvg_tree,F=z.width,j=z.height,$=Math.max(1,Math.round(F*P.sx)),W=Math.max(1,Math.round(j*P.sy)),J=new DOMMatrix([$/F,0,0,W/j,0,0]),Q=Ur($,W);_o(Q,J,z,z,D);const ce=Q.getImageData(0,0,$,W);return ni(),ce}(a.icon,r),k=Me._getImage(w);return this.setInCache(r,k,f,_),k.clone()}}class Ue extends c.y{constructor(r){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.imageVersions=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.imageAtlasCache=new c.$,this.dirty=!0,this.spriteFormat=r,this.imageRasterizer=new Me}addScope(r){this.loaded.set(r,!1),this.imageProviders.set(r,new Map),this.images.set(r,new Map),this.updatedImages.set(r,new Set),this.callbackDispatchedThisFrame.set(r,new Set),this.imageVersions.set(r,new Map),this.patterns.set(r,new Map),this.atlasImage.set(r,new c.ay({width:1,height:1}))}removeScope(r){this.loaded.delete(r),this.imageProviders.delete(r),this.images.delete(r),this.updatedImages.delete(r),this.callbackDispatchedThisFrame.delete(r),this.imageVersions.delete(r),this.patterns.delete(r),this.atlasImage.delete(r);const a=this.atlasTexture.get(r);a&&(a.destroy(),this.atlasTexture.delete(r))}addImageProvider(r,a){this.imageProviders.has(a)||this.imageProviders.set(a,new Map),this.imageProviders.get(a).set(r.id,r)}removeImageProvider(r,a){this.imageProviders.has(a)&&this.imageProviders.get(a).delete(r)}getPendingImageProviders(){const r=[];for(const a of this.imageProviders.values())for(const f of a.values())f.hasPendingRequests()&&r.push(f);return r}isLoaded(){for(const r of this.loaded.keys())if(!this.loaded.get(r))return!1;return!0}setLoaded(r,a){if(this.loaded.get(a)!==r&&(this.loaded.set(a,r),r)){for(const{ids:f,callback:_}of this.requestors)this._notify(f,a,_);this.requestors=[]}}hasImage(r,a){return!!this.getImage(r,a)}getImage(r,a){return this.images.get(a).get(r.toString())}addImage(r,a,f){if(this._validate(r,f)){this.images.get(a).set(r.toString(),f);const _=this.imageVersions.get(a),x=_.get(r.toString())||0;_.set(r.toString(),x+1)}}_validate(r,a){let f=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new c.v(new Error(`Image "${r.name}" has invalid "stretchX" value`))),f=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new c.v(new Error(`Image "${r.name}" has invalid "stretchY" value`))),f=!1),this._validateContent(a.content,a)||(this.fire(new c.v(new Error(`Image "${r.name}" has invalid "content" value`))),f=!1),f}_validateStretch(r,a){if(!r)return!0;let f=0;for(const _ of r){if(_[0]<f||_[1]<_[0]||a<_[1])return!1;f=_[1]}return!0}_validateContent(r,a){return r?r.length!==4||!a.usvg&&(r[0]<0||a.data.width<r[0]||r[1]<0||a.data.height<r[1]||r[2]<0||a.data.width<r[2]||r[3]<0||a.data.height<r[3])?!1:!(r[2]<r[0]||r[3]<r[1]):!0}updateImage(r,a,f){const _=this.images.get(a).get(r.toString());f.version=_.version+1,this.images.get(a).set(r.toString(),f),this.updatedImages.get(a).add(r);const x=this.imageVersions.get(a),w=x.get(r.toString())||0;x.set(r.toString(),w+1),this.removeFromImageRasterizerCache(r,a)}clearUpdatedImages(r){this.updatedImages.get(r).clear()}removeFromImageRasterizerCache(r,a){this.spriteFormat!=="raster"&&this.imageRasterizer.removeImagesFromCacheByIds([r],a)}removeImage(r,a){const f=this.images.get(a),_=f.get(r.toString());f.delete(r.toString());const x=this.imageVersions.get(a),w=x.get(r.toString())||0;x.set(r.toString(),w+1),this.patterns.get(a).delete(r.toString()),this.removeFromImageRasterizerCache(r,a),_.userImage&&_.userImage.onRemove&&_.userImage.onRemove()}listImages(r){return Array.from(this.images.get(r).keys()).map(a=>c.a1.from(a))}getImageVersions(r){return this.imageVersions.get(r)||new Map}getImages(r,a,f){const _=[],x=[],w=this.imageProviders.get(a);for(const D of r){if(!D.iconsetId){_.push(D);continue}const z=w.get(D.iconsetId);z&&(this.getImage(D,a)?x.push(D):z.addPendingRequest(D))}if(_.length===0)return void this._notify(x,a,f);let k=!0;const A=!!this.loaded.get(a),P=this.images.get(a);if(!A)for(const D of _)P.has(D.toString())||(k=!1);A||k?this._notify(_,a,f):this.requestors.push({ids:_,scope:a,callback:f})}rasterizeImages(r,a){const f=new Map,{iconTasks:_,patternTasks:x,scope:w}=r;for(const k of[_,x])for(const[A,P]of k.entries()){const D=this.getImage(P.id,w);D&&f.set(A,{image:D,imageVariant:P})}a(null,this._rasterizeImages(w,f))}_rasterizeImages(r,a){const f=new Map;for(const[_,{image:x,imageVariant:w}]of a.entries())f.set(_,this.imageRasterizer.rasterize(w,x,r,0));return f}getUpdatedImages(r){return this.updatedImages.get(r)||new Set}_notify(r,a,f){const _=this.images.get(a),x=new Map;for(const w of r){if(!_.get(w.toString())){if(w.iconsetId)continue;this.fire(new c.x("styleimagemissing",{id:w.name}))}const k=_.get(w.toString());if(!k){c.f_(`Image "${w.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 A={data:k.usvg?null:k.data.clone(),pixelRatio:k.pixelRatio,sdf:k.sdf,usvg:k.usvg,stretchX:k.stretchX,stretchY:k.stretchY,content:k.content,hasRenderCallback:!!(k.userImage&&k.userImage.render)};k.usvg&&Object.assign(A,{width:k.icon.usvg_tree.width,height:k.icon.usvg_tree.height}),x.set(c.a1.toString(w),A)}f(null,{images:x,versions:this.getImageVersions(a)})}getPixelSize(r){const{width:a,height:f}=this.atlasImage.get(r);return{width:a,height:f}}getPattern(r,a,f){const _=r.toString(),x=this.patterns.get(a),w=x.get(_),k=this.getImage(r,a);if(!k)return null;if(w){if(w.position.version===k.version)return w.position;w.position.version=k.version}else{if(k.usvg&&!k.data){const A=this.getPatternInFlightId(_,a);if(this.patternsInFlight.has(A))return null;this.patternsInFlight.add(A);const P=new c.a4(r).scaleSelf(c.co.devicePixelRatio),D=new Map([[P.toString(),{image:k,imageVariant:P}]]),z=this._rasterizeImages(a,D);return this.storePatternImage(P,a,k,f,z),null}this.storePattern(r,a,k)}return this._updatePatternAtlas(a,f),x.get(_).position}getPatternInFlightId(r,a){return c.ea(r,a)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(r,a,f,_,x){const w=r.toString(),k=x?x.get(w):void 0;k&&(f.data=k,this.storePattern(r.id,a,f),this._updatePatternAtlas(a,_),this.patternsInFlight.delete(this.getPatternInFlightId(r.id.toString(),a)))}storePattern(r,a,f){const _={w:f.data.width+2*c.aq,h:f.data.height+2*c.aq,x:0,y:0},x=new c.a2(_,f,c.aq);this.patterns.get(a).set(r.toString(),{bin:_,position:x})}destroyAtlasTextures(){for(const r of this.atlasTexture.values())r&&r.destroy();this.atlasTexture.clear()}bind(r,a){const f=r.gl;let _=this.atlasTexture.get(a);_?this.dirty&&(_.update(this.atlasImage.get(a)),this.dirty=!1):(_=new c.a_(r,this.atlasImage.get(a),f.RGBA8),this.atlasTexture.set(a,_)),_.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(r,a){const f=this.patterns.get(r),_=Array.from(f.values()).map(({bin:P})=>P),{w:x,h:w}=c.eT(_),k=this.atlasImage.get(r);k.resize({width:x||1,height:w||1});const A=this.images.get(r);for(const[P,{bin:D,position:z}]of f.entries()){let F=z.padding;const j=D.x+F,$=D.y+F,W=A.get(P).data,J=W.width,Q=W.height;F=F>1?F-1:F,c.ay.copy(W,k,{x:0,y:0},{x:j,y:$},{width:J,height:Q},a),c.ay.copy(W,k,{x:0,y:Q-F},{x:j,y:$-F},{width:J,height:F},a),c.ay.copy(W,k,{x:0,y:0},{x:j,y:$+Q},{width:J,height:F},a),c.ay.copy(W,k,{x:J-F,y:0},{x:j-F,y:$},{width:F,height:Q},a),c.ay.copy(W,k,{x:0,y:0},{x:j+J,y:$},{width:F,height:Q},a),c.ay.copy(W,k,{x:J-F,y:Q-F},{x:j-F,y:$-F},{width:F,height:F},a),c.ay.copy(W,k,{x:0,y:Q-F},{x:j+J,y:$-F},{width:F,height:F},a),c.ay.copy(W,k,{x:0,y:0},{x:j+J,y:$+Q},{width:F,height:F},a),c.ay.copy(W,k,{x:J-F,y:0},{x:j-F,y:$+Q},{width:F,height:F},a)}this.dirty=!0}beginFrame(){for(const r of this.images.keys())this.callbackDispatchedThisFrame.set(r,new Set);this.imageAtlasCache.beginFrame()}dispatchRenderCallbacks(r,a){const f=this.images.get(a);for(const _ of r){if(this.callbackDispatchedThisFrame.get(a).has(_.toString()))continue;this.callbackDispatchedThisFrame.get(a).add(_.toString());const x=f.get(_.toString());pn(x)&&this.updateImage(_,a,x)}}}class ge{constructor(r,a,f,_){this.message=(r?`${r}: `:"")+f,_&&(this.identifier=_),a!=null&&a.__line__&&(this.line=a.__line__)}}class Ie extends ge{}function st(u){const r=u.value,a=u.valueSpec,f=u.style,_=u.styleSpec,x=u.key,w=u.arrayElementValidator||Cr;if(!Array.isArray(r))return[new ge(x,r,`array expected, ${c.da(r)} found`)];if(a.length&&r.length!==a.length)return[new ge(x,r,`array length ${a.length} expected, length ${r.length} found`)];if(a["min-length"]&&r.length<a["min-length"])return[new ge(x,r,`array length at least ${a["min-length"]} expected, length ${r.length} found`)];let k={type:a.value,values:a.values,minimum:a.minimum,maximum:a.maximum,function:void 0};_.$version<7&&(k.function=a.function),c.dN(a.value)&&(k=a.value);let A=[];for(let P=0;P<r.length;P++)A=A.concat(w({array:r,arrayIndex:P,value:r[P],valueSpec:k,style:f,styleSpec:_,key:`${x}[${P}]`},!0));return A}function dt(u){const r=u.key,a=u.value,f=u.valueSpec;if(!c.dM(a))return[new ge(r,a,`number expected, ${c.da(a)} found`)];if(a!=a)return[new ge(r,a,"number expected, NaN found")];if("minimum"in f){let _=f.minimum;if(Array.isArray(f.minimum)&&(_=f.minimum[u.arrayIndex]),a<_)return[new ge(r,a,`${a} is less than the minimum value ${_}`)]}if("maximum"in f){let _=f.maximum;if(Array.isArray(f.maximum)&&(_=f.maximum[u.arrayIndex]),a>_)return[new ge(r,a,`${a} is greater than the maximum value ${_}`)]}return[]}function Tt(u){const r=u.key,a=u.value;if(!c.dN(a))return[new ge(r,a,`object expected, ${c.da(a)} found`)];const f=u.valueSpec,_=c.fT(a.type);let x,w,k,A={};const P=_!=="categorical"&&a.property===void 0,D=!P,z=function(W){const J=W.stops;return Array.isArray(J)&&Array.isArray(J[0])&&c.dN(J[0][0])}(a),F=ui({key:u.key,value:u.value,valueSpec:u.styleSpec.function,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(W){if(_==="identity")return[new ge(W.key,W.value,'identity function may not have a "stops" property')];let J=[];const Q=W.value;return J=J.concat(st({key:W.key,value:Q,valueSpec:W.valueSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:j})),Array.isArray(Q)&&Q.length===0&&J.push(new ge(W.key,Q,"array must have at least one stop")),J},default:function(W){return Cr({key:W.key,value:W.value,valueSpec:f,style:W.style,styleSpec:W.styleSpec})}}});return _==="identity"&&P&&F.push(new ge(u.key,u.value,'missing required property "property"')),_==="identity"||a.stops||F.push(new ge(u.key,u.value,'missing required property "stops"')),_==="exponential"&&f.expression&&!c.fA(f)&&F.push(new ge(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(D&&!c.fC(f)?F.push(new ge(u.key,u.value,"property functions not supported")):P&&!c.fD(f)&&F.push(new ge(u.key,u.value,"zoom functions not supported"))),_!=="categorical"&&!z||a.property!==void 0||F.push(new ge(u.key,u.value,'"property" property is required')),F;function j(W){let J=[];const Q=W.value,ce=W.key;if(!Array.isArray(Q))return[new ge(ce,Q,`array expected, ${c.da(Q)} found`)];if(Q.length!==2)return[new ge(ce,Q,`array length 2 expected, length ${Q.length} found`)];if(z){if(!c.dN(Q[0]))return[new ge(ce,Q,`object expected, ${c.da(Q[0])} found`)];const fe=Q[0];if(fe.zoom===void 0)return[new ge(ce,Q,"object stop key must have zoom")];if(fe.value===void 0)return[new ge(ce,Q,"object stop key must have value")];const se=c.fT(fe.zoom);if(typeof se!="number")return[new ge(ce,fe.zoom,"stop zoom values must be numbers")];if(k&&k>se)return[new ge(ce,fe.zoom,"stop zoom values must appear in ascending order")];se!==k&&(k=se,w=void 0,A={}),J=J.concat(ui({key:`${ce}[0]`,value:Q[0],valueSpec:{zoom:{}},style:W.style,styleSpec:W.styleSpec,objectElementValidators:{zoom:dt,value:$}}))}else J=J.concat($({key:`${ce}[0]`,value:Q[0],style:W.style,styleSpec:W.styleSpec},Q));return c.dv(c.c3(Q[1]))?J.concat([new ge(`${ce}[1]`,Q[1],"expressions are not allowed in function stops.")]):J.concat(Cr({key:`${ce}[1]`,value:Q[1],valueSpec:f,style:W.style,styleSpec:W.styleSpec}))}function $(W,J){const Q=c.da(W.value),ce=c.fT(W.value),fe=W.value!==null?W.value:J;if(x){if(Q!==x)return[new ge(W.key,fe,`${Q} stop domain type must match previous stop domain type ${x}`)]}else x=Q;if(Q!=="number"&&Q!=="string"&&Q!=="boolean"&&typeof ce!="number"&&typeof ce!="string"&&typeof ce!="boolean")return[new ge(W.key,fe,"stop domain value must be a number, string, or boolean")];if(Q!=="number"&&_!=="categorical"){let se=`number expected, ${Q} found`;return c.fC(f)&&_===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ge(W.key,fe,se)]}return _!=="categorical"||Q!=="number"||typeof ce=="number"&&isFinite(ce)&&Math.floor(ce)===ce?_!=="categorical"&&Q==="number"&&typeof ce=="number"&&typeof w=="number"&&w!==void 0&&ce<w?[new ge(W.key,fe,"stop domain values must appear in ascending order")]:(w=ce,_==="categorical"&&ce in A?[new ge(W.key,fe,"stop domain values must be unique")]:(A[ce]=!0,[])):[new ge(W.key,fe,`integer expected, found ${String(ce)}`)]}}function jt(u){const r=(u.expressionContext==="property"?c.b$:c.bY)(c.c3(u.value),u.valueSpec);if(r.result==="error")return r.value.map(f=>new ge(`${u.key}${f.key}`,u.value,f.message));const a=r.value.expression||r.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!a.outputDefined())return[new ge(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!c.dP(a))return[new ge(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter")return Xt(a,u);if(u.expressionContext==="appearance")return mn(a,u);if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!c.dC(a,["zoom","feature-state"]))return[new ge(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!c.dy(a))return[new ge(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Xt(u,r){const a=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const _ of r.valueSpec.expression.parameters)a.delete(_);if(a.size===0)return[];const f=[];return u instanceof c.j&&a.has(u.name)?[new ge(r.key,r.value,`["${u.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(u.eachChild(_=>{f.push(...Xt(_,r))}),f)}const Un=new Set(["get","has","properties","geometry-type","id"]),hn=new Set(["zoom","pitch","distance-from-center","feature","feature-state","measure-light","heatmap-density","line-progress","raster-value","raster-particle-speed","sky-radial-progress"]);function mn(u,r){if(r.valueSpec&&r.valueSpec.expression)for(const f of r.valueSpec.expression.parameters)hn.delete(f);if(hn.size===0)return[];const a=[];if(u instanceof c.j){const f=Un.has(u.name)?"feature":u.name;if(hn.has(f))return[new ge(r.key,r.value,`["${u.name}"] is not an allowed parameter`)]}return u.eachChild(f=>{a.push(...mn(f,r))}),a}function Nn(u){const r=u.key,a=u.value,f=u.valueSpec,_=[];return Array.isArray(f.values)?f.values.includes(c.fT(a))||_.push(new ge(r,a,`expected one of [${f.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(f.values).includes(c.fT(a))||_.push(new ge(r,a,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(a)} found`)),_}function xr(u){return c.dw(c.c3(u.value))?jt(Object.assign({},u,{expressionContext:"filter",valueSpec:u.styleSpec[`filter_${u.layerType||"fill"}`]})):Dr(u)}function Dr(u){const r=u.value,a=u.key;if(!Array.isArray(r))return[new ge(a,r,`array expected, ${c.da(r)} found`)];if(r.length<1)return[new ge(a,r,"filter array must have at least 1 element")];const f=u.styleSpec;let _=Nn({key:`${a}[0]`,value:r[0],valueSpec:f.filter_operator});const x=()=>{r.length>=2&&(c.dQ(r[1])||_.push(new ge(`${a}[1]`,r[1],`string expected, ${c.da(r[1])} found`)));for(let w=2;w<r.length;w++)c.fT(r[1])==="$type"?_=_.concat(Nn({key:`${a}[${w}]`,value:r[w],valueSpec:f.geometry_type})):c.dQ(r[w])||c.dM(r[w])||c.du(r[w])||_.push(new ge(`${a}[${w}]`,r[w],`string, number, or boolean expected, ${c.da(r[w])} found.`))};switch(c.fT(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&c.fT(r[1])==="$type"&&_.push(new ge(a,r,`"$type" cannot be use with operator "${r[0]}"`)),r.length!==3&&_.push(new ge(a,r,`filter array for operator "${r[0]}" must have 3 elements`)),x();break;case"==":case"!=":r.length!==3&&_.push(new ge(a,r,`filter array for operator "${r[0]}" must have 3 elements`)),x();break;case"in":case"!in":x();break;case"any":case"all":case"none":for(let w=1;w<r.length;w++)_=_.concat(Dr({key:`${a}[${w}]`,value:r[w],style:u.style,styleSpec:u.styleSpec}));break;case"has":case"!has":r.length!==2?_.push(new ge(a,r,`filter array for "${r[0]}" operator must have 2 elements`)):c.dQ(r[1])||_.push(new ge(`${a}[1]`,r[1],`string expected, ${c.da(r[1])} found`))}return _}const Ii=/^{([^}]+)}$/;function Gi(u,r){const a=u.key,f=u.style,_=u.layer,x=u.styleSpec,w=u.value,k=u.objectKey,A=x[`${r}_${u.layerType}`];if(!A)return[];const P=k.match(c.b3);if(P&&A[P[1]])return c.dv(c.c3(w))?[].concat(Cr({key:a,value:w,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:f,styleSpec:x,expressionContext:"property",propertyType:r,propertyKey:k})):Cr({key:a,value:w,valueSpec:{type:"string"},style:f,styleSpec:x});const D=k.match(c.aY);if(r==="paint"&&D&&A[D[1]]&&A[D[1]].transition)return Cr({key:a,value:w,valueSpec:x.transition,style:f,styleSpec:x});const z=u.valueSpec||A[k];if(!z)return[new Ie(a,w,`unknown property "${k}"`)];let F;if(c.dQ(w)&&c.fC(z)&&!z.tokens&&(F=Ii.exec(w))){const $=`\`{ "type": "identity", "property": ${F?JSON.stringify(F[1]):'"_"'} }\``;return[new ge(a,w,`"${k}" does not support interpolation syntax
|
||
Use an identity property function instead: ${$}.`)]}const j=[];if(u.layerType==="symbol")k!=="text-field"||!f||f.glyphs||f.imports||j.push(new ge(a,w,'use of "text-field" requires a style "glyphs" property')),k==="text-font"&&c.dB(c.c3(w))&&c.fT(w.type)==="identity"&&j.push(new ge(a,w,'"text-font" does not support identity functions'));else if(u.layerType==="model"&&r==="paint"&&_&&_.layout&&Object.hasOwn(_.layout,"model-id")&&c.fC(z)&&(c.fB(z)||c.fD(z))){const $=c.b$(c.c3(w),z).value,W="expression"in $&&$.expression||"_styleExpression"in $&&$._styleExpression&&$._styleExpression.expression;W&&!c.dC(W,["measure-light"])&&(k==="model-emissive-strength"&&c.dy(W)&&c.dP(W)||j.push(new ge(a,w,`${k} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return j.concat(Cr({key:u.key,value:w,valueSpec:z,style:f,styleSpec:x,expressionContext:"property",propertyType:r,propertyKey:k}))}function Cn(u){return Gi(u,"paint")}function ci(u){return Gi(u,"layout")}function Na(u){let r=[];const a=u.value,f=u.key,_=u.style,x=u.styleSpec;if(!c.dN(a))return[new ge(f,a,"object expected")];a.type||a.ref||r.push(new ge(f,a,'either "type" or "ref" is required'));let w=c.fT(a.type);const k=c.fT(a.ref);if(a.id){const A=c.fT(a.id);for(let P=0;P<u.arrayIndex;P++){const D=_.layers[P];c.fT(D.id)===A&&r.push(new ge(f,a.id,`duplicate layer id "${A}", previously used at line ${D.id.__line__}`))}}if("ref"in a){let A;["type","source","source-layer","filter","layout"].forEach(P=>{P in a&&r.push(new ge(f,a[P],`"${P}" is prohibited for ref layers`))}),_.layers.forEach(P=>{c.fT(P.id)===k&&(A=P)}),A?A.ref?r.push(new ge(f,a.ref,"ref cannot reference another ref layer")):w=c.fT(A.type):typeof k=="string"&&r.push(new ge(f,a.ref,`ref layer "${k}" not found`))}else if(w!=="background"&&w!=="sky"&&w!=="slot")if(a.source)if(c.dQ(a.source)){const A=_.sources&&Object.hasOwn(_.sources,a.source)?_.sources[a.source]:void 0,P=A&&c.fT(A.type);A?P==="vector"&&w==="raster"?r.push(new ge(f,a.source,`layer "${a.id}" requires a raster source`)):P==="raster"&&w!=="raster"?r.push(new ge(f,a.source,`layer "${a.id}" requires a vector source`)):P!=="vector"||a["source-layer"]?P==="raster-dem"&&w!=="hillshade"?r.push(new ge(f,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):P!=="raster-array"||["raster","raster-particle"].includes(w)?w==="line"&&a.paint&&a.paint["line-gradient"]&&P==="geojson"&&!A.lineMetrics?r.push(new ge(f,a,`layer "${a.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):w==="line"&&a.paint&&a.paint["line-trim-offset"]&&P==="geojson"&&!A.lineMetrics?r.push(new ge(f,a,`layer "${a.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):w==="raster-particle"&&P!=="raster-array"&&r.push(new ge(f,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new ge(f,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new ge(f,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new ge(f,a.source,`source "${a.source}" not found`))}else r.push(new ge(`${f}.source`,a.source,'"source" must be a string'));else r.push(new ge(f,a,'missing required property "source"'));return r=r.concat(ui({key:f,value:a,valueSpec:x.layer,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Cr({key:`${f}.type`,value:a.type,valueSpec:x.layer.type,style:u.style,styleSpec:u.styleSpec,object:a,objectKey:"type"}),filter:A=>xr(Object.assign({layerType:w},A)),layout:A=>ui({layer:a,key:A.key,value:A.value,valueSpec:{},style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":P=>ci(Object.assign({layerType:w},P))}}),paint:A=>ui({layer:a,key:A.key,value:A.value,valueSpec:{},style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":P=>Cn(Object.assign({layerType:w,layer:a},P))}}),appearances(A){const P=st({key:A.key,value:A.value,valueSpec:A.valueSpec,style:A.style,styleSpec:A.styleSpec,arrayElementValidator:F=>function(j){const{key:$,layer:W,layerType:J}=j,Q=c.fT(j.value),ce=c.fT(Q.name),fe=c.fT(Q.condition),se=ui({key:$,value:Q,valueSpec:j.styleSpec.appearance,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{condition:Ae=>function(Ee){const Pe=[];return Pe.push(...jt({key:Ee.key,value:Ee.object.condition,valueSpec:c.fs.appearance.condition,expressionContext:"appearance"})),Pe}(Object.assign({layer:W,layerType:J},Ae)),properties:Ae=>function(Ee){const Pe=[],{styleSpec:ye,layer:be,layerType:Ce}=Ee,ze=ye[`paint_${Ce}`],Oe=ye[`layout_${Ce}`],Ze=Ee.object[Ee.objectKey];for(const We in Ze){const ut=We in ze?"paint":We in Oe?"layout":void 0;if(!ut){Pe.push(new ge(Ee.key,We,`unknown property "${We}" for layer type "${Ce}"`));continue}const Ne=Object.assign({},Ee,{key:`${Ee.key}.${We}`,object:Ze,objectKey:We,layer:be,layerType:Ce,value:Ze[We],valueSpec:ut==="paint"?ze[We]:Oe[We]});Pe.push(...Gi(Ne,ut))}return Pe}(Object.assign({layer:W,layerType:J},Ae))}});return ce!=="hidden"&&fe===void 0&&se.push(new ge(j.key,"name",'Appearance with name different than "hidden" must have a condition')),se}(Object.assign({layerType:w,layer:a},F))}),D=Array.isArray(A.value)?A.value:[],z=new Set;return D.forEach((F,j)=>{const $=c.fT(F.name);if($)if(z.has($)){const W=c.fT(a.id);P.push(new ge(A.key,$,`Duplicated appearance name "${$}" for layer "${W}"`))}else z.add($)}),P}}})),r}function xs({key:u,value:r}){return c.dQ(r)?[]:[new ge(u,r,`string expected, ${c.da(r)} found`)]}const Zr={promoteId:function u({key:r,value:a}){if(c.dQ(a))return xs({key:r,value:a});if(Array.isArray(a)){const _=[],x=c.c3(a),w=c.bY(x);return w.result==="error"?(w.value.forEach(k=>{_.push(new ge(`${r}${k.key}`,null,`${k.message}`))}),_):(c.dC(w.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"])||_.push(new ge(`${r}`,null,"promoteId expression should be only feature dependent")),_)}if(!c.dN(a))return[new ge(r,a,`string, expression or object expected, "${c.da(a)}" found`)];const f=[];for(const _ in a)f.push(...u({key:`${r}.${_}`,value:a[_]}));return f}};function Xr(u){const r=u.value,a=u.key,f=u.styleSpec,_=u.style;if(!c.dN(r))return[new ge(a,r,`object expected, ${c.da(r)} found`)];if(!("type"in r))return[new ge(a,r,'"type" is required')];const x=c.fT(r.type);let w=[];switch(["vector","raster","raster-dem","raster-array"].includes(x)&&("url"in r||"tiles"in r||w.push(new Ie(a,r,'Either "url" or "tiles" is required.'))),x){case"vector":case"raster":case"raster-dem":case"raster-array":return w=w.concat(ui({key:a,value:r,valueSpec:f[`source_${x.replace("-","_")}`],style:u.style,styleSpec:f,objectElementValidators:Zr})),w;case"geojson":if(w=ui({key:a,value:r,valueSpec:f.source_geojson,style:_,styleSpec:f,objectElementValidators:Zr}),"cluster"in r&&"clusterProperties"in r){if(!c.dN(r.clusterProperties))return[new ge(`${a}.clusterProperties`,r,`object expected, ${c.da(r)} found`)];for(const k in r.clusterProperties){const A=r.clusterProperties[k];if(!Array.isArray(A))return[new ge(`${a}.clusterProperties.${k}`,A,"array expected")];const[P,D]=A,z=typeof P=="string"?[P,["accumulated"],["get",k]]:P;w.push(...jt({key:`${a}.${k}.map`,value:D,expressionContext:"cluster-map"})),w.push(...jt({key:`${a}.${k}.reduce`,value:z,expressionContext:"cluster-reduce"}))}}return w;case"video":return ui({key:a,value:r,valueSpec:f.source_video,style:_,styleSpec:f});case"image":return ui({key:a,value:r,valueSpec:f.source_image,style:_,styleSpec:f});case"canvas":return[new ge(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Nn({key:`${a}.type`,value:r.type,valueSpec:{values:Li(f)}})}}function Li(u){return u.source.reduce((r,a)=>{const f=u[a];return f.type.type==="enum"&&(r=r.concat(Object.keys(f.type.values||{}))),r},[])}function gi(u,r){const a=!u.includes("://");try{return new URL(u,a&&r?"http://example.com":void 0),!0}catch{return!1}}function Yr(u){const r=u.value;return r?c.dQ(r)?gi(r,!0)?[]:[new ge(u.key,r,`invalid url "${r}"`)]:[new ge(u.key,r,`string expected, "${c.da(r)}" found`)]:[]}function qo(u){const r=u.value,a=u.styleSpec,f=a.light,_=u.style;if(r===void 0)return[];if(!c.dN(r))return[new ge("light",r,`object expected, ${c.da(r)} found`)];let x=[];for(const w in r){const k=w.match(c.aY),A=w.match(c.b3);x=x.concat(A&&f[A[1]]?Cr({key:w,value:r[w],valueSpec:{type:"string"},style:_,styleSpec:a}):k&&f[k[1]]&&f[k[1]].transition?Cr({key:w,value:r[w],valueSpec:a.transition,style:_,styleSpec:a}):f[w]?Cr({key:w,value:r[w],valueSpec:f[w],style:_,styleSpec:a}):[new ge(w,r[w],`unknown property "${w}"`)])}return x}function eo(u){const r=u.value;if(!r)return[];const a=u.key;if(!c.dN(r))return[new ge(a,r,`object expected, ${c.da(r)} found`)];let f=[];const _=u.styleSpec,x=_["light-3d"],w=u.style,k=u.style.lights;for(const D of["type","id"])if(!(D in r))return f=f.concat([new ge(a,r,`missing property "${D}"`)]),f;if(!c.dQ(r.type))return f=f.concat([new ge(`${a}.type`,r.type,"string expected")]),f;if(k)for(let D=0;D<u.arrayIndex;D++){const z=c.fT(r.type),F=k[D];c.fT(F.type)===z&&f.push(new ge(a,r.id,`duplicate light type "${r.type}", previously defined at line ${F.id.__line__}`))}const A=`properties_light_${r.type}`;if(!(A in _))return f=f.concat([new ge(`${a}.type`,r,`Invalid light type ${r.type}`)]),f;const P=_[A];for(const D in r)if(D==="properties"){const z=r[D];if(!c.dN(z))return f=f.concat([new ge("properties",z,`object expected, ${c.da(z)} found`)]),f;for(const F in z){const j=F.match(c.aY),$=F.match(c.b3);f=f.concat($&&P[$[1]]?Cr({key:D,value:z[F],valueSpec:{type:"string"},style:w,styleSpec:_}):j&&P[j[1]]&&P[j[1]].transition?Cr({key:D,value:r[D],valueSpec:_.transition,style:w,styleSpec:_}):P[F]?Cr({key:F,value:z[F],valueSpec:P[F],style:w,styleSpec:_}):[new Ie(u.key,z[F],`unknown property "${F}"`)])}}else f=f.concat(x[D]?Cr({key:D,value:r[D],valueSpec:x[D],style:w,styleSpec:_}):[new Ie(D,r[D],`unknown property "${D}"`)]);return f}function ko(u){const r=u.value,a=u.key,f=u.style,_=u.styleSpec,x=_.terrain;if(r==null)return[];if(!c.dN(r))return[new ge("terrain",r,`object expected, ${c.da(r)} found`)];let w=[];for(const k in r){const A=k.match(c.aY),P=k.match(c.b3);w=w.concat(P&&x[P[1]]?Cr({key:k,value:r[k],valueSpec:{type:"string"},style:f,styleSpec:_}):A&&x[A[1]]&&x[A[1]].transition?Cr({key:k,value:r[k],valueSpec:_.transition,style:f,styleSpec:_}):x[k]?Cr({key:k,value:r[k],valueSpec:x[k],style:f,styleSpec:_}):[new Ie(k,r[k],`unknown property "${k}"`)])}if(r.source)if(c.dQ(r.source)){const k=f.sources&&Object.hasOwn(f.sources,r.source)?f.sources[r.source]:void 0,A=k&&c.fT(k.type);k?A!=="raster-dem"&&w.push(new ge(`${a}.source`,r.source,`terrain cannot be used with a source of type ${A}, it only be used with a "raster-dem" source type`)):w.push(new ge(`${a}.source`,r.source,`source "${r.source}" not found`))}else w.push(new ge(`${a}.source`,r.source,"source must be a string"));else w.push(new ge(a,r,'terrain is missing required property "source"'));return w}function Va(u){const r=u.value,a=u.style,f=u.styleSpec,_=f.fog;if(r===void 0)return[];if(!c.dN(r))return[new ge("fog",r,`object expected, ${c.da(r)} found`)];let x=[];for(const w in r){const k=w.match(c.aY),A=w.match(c.b3);x=x.concat(A&&_[A[1]]?Cr({key:w,value:r[w],valueSpec:{type:"string"},style:a,styleSpec:f}):k&&_[k[1]]&&_[k[1]].transition?Cr({key:w,value:r[w],valueSpec:f.transition,style:a,styleSpec:f}):_[w]?Cr({key:w,value:r[w],valueSpec:_[w],style:a,styleSpec:f}):[new Ie(w,r[w],`unknown property "${w}"`)])}return x}const ja={"*":()=>[],array:st,boolean:function(u){const r=u.value,a=u.key;return c.du(r)?[]:[new ge(a,r,`boolean expected, ${c.da(r)} found`)]},number:dt,color:function({key:u,value:r}){return c.dQ(r)?c.i.parse(c.fT(r))===void 0?[new ge(u,r,`color expected, "${r}" found`)]:[]:[new ge(u,r,`color expected, ${c.da(r)} found`)]},enum:Nn,filter:xr,function:Tt,layer:Na,object:ui,source:Xr,model:Yr,light:qo,"light-3d":eo,terrain:ko,fog:Va,string:xs,formatted:function(u){return xs(u).length===0?[]:jt(u)},resolvedImage:function(u){return xs(u).length===0?[]:jt(u)},projection:function(u){const r=u.value,a=u.styleSpec,f=a.projection,_=u.style;if(c.dN(r)){let x=[];for(const w in r)x=x.concat(Cr({key:w,value:r[w],valueSpec:f[w],style:_,styleSpec:a}));return x}return c.dQ(r)?[]:[new ge("projection",r,`object or string expected, ${c.da(r)} found`)]},import:function(u){const r=u.key,{value:a,styleSpec:f}=u;if(!c.dN(a))return[new ge(r,a,"import must be an object")];const{data:_,...x}=a;Object.defineProperty(x,"__line__",{value:a.__line__,enumerable:!1});let w=ui(Object.assign({},u,{value:x,valueSpec:f.import}));return c.fT(x.id)===""&&w.push(new ge(`${u.key}.id`,x,"import id can't be an empty string")),c.fT(x.id)==="__proto__"&&w.push(new ge(`${u.key}.id`,x,`import id can't be "__proto__"`)),_&&(w=w.concat(Eu(_,f,{key:`${u.key}.data`}))),w},iconset:function(u){const r=u.value,a=u.key,f=u.styleSpec,_=u.style;if(!c.dN(r))return[new ge(a,r,"object expected")];if(!r.type)return[new ge(a,r,'"type" is required')];const x=c.fT(r.type);let w=[];if(w=w.concat(ui({key:a,value:r,valueSpec:f[`iconset_${x}`],style:_,styleSpec:f})),function(k,A){return!(k!=="source"||!A.source)}(x,r)){const k=_.sources&&Object.hasOwn(_.sources,r.source)?_.sources[r.source]:void 0,A=k&&c.fT(k.type);k?A!=="raster-array"&&w.push(new ge(a,r.source,`iconset cannot be used with a source of type ${String(A)}, it only be used with a "raster-array" source type`)):w.push(new ge(a,r.source,`source "${r.source}" not found`))}return w},option:function(u){const r=u.styleSpec,a=u.value,f=c.dN(a)&&c.fT(a.array)===!0||!c.dN(a)?void 0:c.fT(a.type);return ui(Object.assign({},u,{valueSpec:r.option,objectElementValidators:f?{default:_=>Array.isArray(_.value)?Cr(Object.assign({},_,{valueSpec:Object.assign({},_.valueSpec,{type:f})})):Cr(_)}:void 0}))}};function Cr(u,r=!1){const a=u.value,f=u.valueSpec,_=u.styleSpec;if(f.expression){if(c.dB(c.fT(a)))return Tt(u);if(c.dv(c.c3(a)))return jt(u)}if(f.type&&ja[f.type]){const x=ja[f.type](u);return r===!0&&x.length>0&&Array.isArray(u.value)?jt(u):x}return ui(Object.assign({},u,{valueSpec:f.type?_[f.type]:f}))}function ui(u){const r=u.key,a=u.value,f=u.valueSpec||{},_=u.objectElementValidators||{},x=u.style,w=u.styleSpec;if(!c.dN(a))return[new ge(r,a,`object expected, ${c.da(a)} found`)];let k=[];for(const A in a){if(!Object.hasOwn(a,A))continue;const P=A.split(".")[0],D=Object.hasOwn(f,P),z=Object.hasOwn(f,"*"),F=D?f[P]:z?f["*"]:void 0;let j;Object.hasOwn(_,P)?j=_[P]:D?j=Cr:Object.hasOwn(_,"*")?j=_["*"]:z&&(j=Cr),j?k=k.concat(j({key:(r&&`${r}.`)+A,value:a[A],valueSpec:F,style:x,styleSpec:w,object:a,objectKey:A},a)):k.push(new Ie(r,a[A],`unknown property "${A}"`))}for(const A in f){if(!Object.hasOwn(f,A)||Object.hasOwn(_,A))continue;const P=f[A];!P.required||P.default!==void 0||Object.hasOwn(a,A)&&a[A]!==void 0||k.push(new ge(r,a,`missing required property "${A}"`))}return k}function kc({key:u,value:r}){const a=xs({key:u,value:r});if(a.length)return a;const f=r;return f.includes("{fontstack}")||a.push(new ge(u,r,'"glyphs" url must include a "{fontstack}" token')),f.includes("{range}")||a.push(new ge(u,r,'"glyphs" url must include a "{range}" token')),a}function Eu(u,r=c.fs,a={}){return ui({key:a.key||"",value:u,valueSpec:Object.assign({},r.$root,{"*":{type:"*"}}),styleSpec:r,style:u,objectElementValidators:{glyphs:kc}})}function Ps(u,r=c.fs){return Ds(Eu(u,r))}const lf=u=>Ds(Xr(u)),Zo=u=>Ds(qo(u)),Nr=u=>Ds(eo(u)),Jx=u=>Ds(ko(u)),eb=u=>Ds(Va(u)),tb=u=>Ds(function(r){const a=r.value,f=r.style,_=r.styleSpec,x=_.snow;if(a===void 0)return[];if(!c.dN(a))return[new ge("snow",a,`object expected, ${c.da(a)} found`)];let w=[];for(const k in a){const A=k.match(c.aY);w=w.concat(A&&x[A[1]]&&x[A[1]].transition?Cr({key:k,value:a[k],valueSpec:_.transition,style:f,styleSpec:_}):x[k]?Cr({key:k,value:a[k],valueSpec:x[k],style:f,styleSpec:_}):[new Ie(k,a[k],`unknown property "${k}"`)])}return w}(u)),ty=u=>Ds(function(r){const a=r.value,f=r.style,_=r.styleSpec,x=_.rain;if(a===void 0)return[];if(!c.dN(a))return[new ge("rain",a,`object expected, ${c.da(a)} found`)];let w=[];for(const k in a){const A=k.match(c.aY);w=w.concat(A&&x[A[1]]&&x[A[1]].transition?Cr({key:k,value:a[k],valueSpec:_.transition,style:f,styleSpec:_}):x[k]?Cr({key:k,value:a[k],valueSpec:x[k],style:f,styleSpec:_}):[new Ie(k,a[k],`unknown property "${k}"`)])}return w}(u)),nb=u=>Ds(Na(u)),cf=u=>Ds(xr(u)),ny=u=>Ds(Cn(u)),rb=u=>Ds(ci(u)),ib=u=>Ds(Yr(u));function Ds(u){return u.slice().sort((r,a)=>r.line&&a.line?r.line-a.line:0)}function Td(u,r){let a=!1;if(r&&r.length)for(const f of r)f instanceof Ie?c.f_(f.message):(u.fire(new c.v(new Error(f.message))),a=!0);return a}const va=c.fs.light;let ry;class uf extends c.y{constructor(r,a="flat"){super(),this._transitionable=new c.b2(ry||(ry=new c.ax({anchor:new c.l(va.anchor),position:new c.av(va.position),color:new c.l(va.color),intensity:new c.l(va.intensity)}))),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,a,f={}){this._validate(Zo,r,f)||(this._transitionable.setTransitionOrValue(r),this.id=a)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,f){return(!f||f.validate!==!1)&&Td(this,r.call(Ps,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:c.fs})))}}const im=c.fs.terrain;let iy=class extends c.y{constructor(u,r,a,f,_){super(),this.scope=a,this._transitionable=new c.b2(new c.ax({source:new c.l(im.source),exaggeration:new c.l(im.exaggeration)}),a,f),this._transitionable.setTransitionOrValue(u,f),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r,this.worldview=_}get(){return this._transitionable.serialize()}set(u,r){this._transitionable.setTransitionOrValue(u,r)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}getExaggeration(u){return this._transitioning.possiblyEvaluate(new c.w(u,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const u=this._transitionable._values.exaggeration;if(!u)return null;const r=u.value.expression;if(!r)return null;let a=-1,f=-1,_=1;for(const x of r.zoomStops)_=r.evaluate(new c.w(x,{worldview:this.worldview})),_>.01?(a=x,f=-1):f=x;return _<.01&&a>0&&f>a?[a,f]:null}isZoomDependent(){const u=this._transitionable._values.exaggeration;return u!=null&&u.value!=null&&u.value.expression!=null&&u.value.expression instanceof c.bh}};const Ua=.05;function Zl(u,r,a){const f=c.fq(45,65,a),[_,x]=u.range;let w=1-Math.min(1,Math.exp((r-_)/(x-_)*-6));return w*=w*w,w=Math.min(1,1.00747*w),w*f*u.alpha}function om(u,r,a,f,_){const x=c.fL([],[r,a,f],_.mercatorFogMatrix);return Zl(u,c.dW(x),_.pitch)}function oy(u,r,a,f,_,x,w){const k=[[a,f,0],[_,f,0],[_,x,0],[a,x,0]];let A=Number.MAX_VALUE,P=-Number.MAX_VALUE;for(const D of k){const z=c.fL([],D,r),F=c.dW(z);A=Math.min(A,F),P=Math.max(P,F)}return[Zl(u,A,w.pitch),Zl(u,P,w.pitch)]}const _l=c.fs.fog;class ob extends c.y{constructor(r,a,f,_){super();const x=new c.ax({range:new c.l(_l.range),color:new c.l(_l.color),"color-use-theme":new c.l({type:"string","property-type":"data-constant",default:"default"}),"high-color":new c.l(_l["high-color"]),"high-color-use-theme":new c.l({type:"string","property-type":"data-constant",default:"default"}),"space-color":new c.l(_l["space-color"]),"space-color-use-theme":new c.l({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new c.l(_l["horizon-blend"]),"star-intensity":new c.l(_l["star-intensity"]),"vertical-range":new c.l(_l["vertical-range"])});this._transitionable=new c.b2(x,f,_),this.set(r,_),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new c.aw(x),this.scope=f}get state(){const r=this._transform,a=r.projection.name==="globe",f=c.dm(r.zoom),_=this.properties.get("range"),x=[2,4.5],w=.5/Math.tan(.5*r._fov),k=[_[0]+w,_[1]+w];return{range:a?[c.dY(x[0],k[0],f),c.dY(x[1],k[1],f)]:k,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,a,f={}){if(this._validate(eb,r,f))return;const _=Object.assign({},r);for(const x of Object.keys(_l))_[x]===void 0&&(_[x]=_l[x].default);this._options=_,this._transitionable.setTransitionOrValue(this._options,a)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const a=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:c.fq(45,65,r))*a.a}getOpacityAtLatLng(r,a){return this._transform.projection.supportsFog?function(f,_,x){const w=c.ag.fromLngLat(_),k=x.elevation?x.elevation.getAtPointOrZero(w):0;return om(f,w.x,w.y,k,x)}(this.state,r,a):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return oy(this.state,a,0,0,c.r,c.r,this._transform)}getOpacityForBounds(r,a,f,_,x){return this._transform.projection.supportsFog?oy(this.state,r,a,f,_,x,this._transform):[1,1]}getRangeForProjection(){return this._transform.projection.supportsFog?this.state.range:[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const a=[4,5,6,7];for(const f of a){const _=r.points[f];let x;if(_[2]>=0)x=_;else{const w=r.points[f-4];x=c.bo(w,_,w[2]/(w[2]-_[2]))}if(om(this.state,x[0],x[1],0,this._transform)>=Ua)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,r)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,f){return(!f||f.validate!==!1)&&Td(this,r.call(Ps,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:c.fs})))}}let Ac,sm,sb=class extends c.y{constructor(u,r,a,f){super();const _=Ac||(Ac=new c.ax({density:new c.l(c.fs.snow.density),intensity:new c.l(c.fs.snow.intensity),color:new c.l(c.fs.snow.color),opacity:new c.l(c.fs.snow.opacity),vignette:new c.l(c.fs.snow.vignette),"vignette-color":new c.l(c.fs.snow["vignette-color"]),"center-thinning":new c.l(c.fs.snow["center-thinning"]),direction:new c.l(c.fs.snow.direction),"flake-size":new c.l(c.fs.snow["flake-size"])}));this._transitionable=new c.b2(_,a,f),this.set(u,f),this._transitioning=this._transitionable.untransitioned(),this.properties=new c.aw(_),this.scope=a}get state(){const u=this.properties.get("opacity"),r=this.properties.get("color"),a=this.properties.get("direction"),f=c.c4(a[0]),_=-Math.max(c.c4(a[1]),.01),x=[Math.cos(f)*Math.cos(_),Math.sin(f)*Math.cos(_),Math.sin(_)],w=this.properties.get("vignette"),k=this.properties.get("vignette-color"),A=new c.i(k.r,k.g,k.b,w);return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new c.i(r.r,r.g,r.b,r.a*u),direction:x,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:A}}get(){return this._transitionable.serialize()}set(u,r,a={}){if(this._validate(tb,u,a))return;const f=Object.assign({},u),_=c.fs.snow;for(const x of Object.keys(_))f[x]===void 0&&(f[x]=_[x].default);this._options=f,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(u){this._transitionable.setTransitionOrValue(this._options,u)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,r,a){return(!a||a.validate!==!1)&&Td(this,u.call(Ps,Object.assign({value:r,style:{glyphs:!0,sprite:!0},styleSpec:c.fs})))}},sy=class extends c.y{constructor(u,r,a,f){super();const _=sm||(sm=new c.ax({density:new c.l(c.fs.rain.density),intensity:new c.l(c.fs.rain.intensity),color:new c.l(c.fs.rain.color),opacity:new c.l(c.fs.rain.opacity),vignette:new c.l(c.fs.rain.vignette),"vignette-color":new c.l(c.fs.rain["vignette-color"]),"center-thinning":new c.l(c.fs.rain["center-thinning"]),direction:new c.l(c.fs.rain.direction),"droplet-size":new c.l(c.fs.rain["droplet-size"]),"distortion-strength":new c.l(c.fs.rain["distortion-strength"])}));this._transitionable=new c.b2(_,a,f),this.set(u,f),this._transitioning=this._transitionable.untransitioned(),this.properties=new c.aw(_),this.scope=a}get state(){const u=this.properties.get("opacity"),r=this.properties.get("color"),a=this.properties.get("direction"),f=c.c4(a[0]),_=-Math.max(c.c4(a[1]),.01),x=[Math.cos(f)*Math.cos(_),Math.sin(f)*Math.cos(_),Math.sin(_)],w=this.properties.get("vignette-color"),k=new c.i(w.r,w.g,w.b,this.properties.get("vignette"));return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new c.i(r.r,r.g,r.b,r.a*u),direction:x,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:k}}get(){return this._transitionable.serialize()}set(u,r,a={}){if(this._validate(ty,u,a))return;const f=Object.assign({},u),_=c.fs.rain;for(const x of Object.keys(_))f[x]===void 0&&(f[x]=_[x].default);this._options=f,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(u){this._transitionable.setTransitionOrValue(this._options,u)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,r,a){return(!a||a.validate!==!1)&&Td(this,u.call(Ps,Object.assign({value:r,style:{glyphs:!0,sprite:!0},styleSpec:c.fs})))}};const Cc={workerUrl:"",workerClass:null,workerParams:void 0};function f2(u){return Cc.workerClass!=null?new Cc.workerClass:new self.Worker(Cc.workerUrl,Object.assign({name:u},Cc.workerParams))}const ku="mapboxgl_preloaded_worker_pool";class Ic{constructor(r){this.active={},this.name=r}acquire(r,a=Ic.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<a;){const f=f2(`${this.name||""}WorkerPool: ${r}-${this.workers.length}`);this.workers.push(f)}return this.active[r]=!0,this.workers.slice()}release(r){delete this.active[r],this.workers&&this.numActive()===0&&(this.workers.forEach(a=>{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[ku]}numActive(){return Object.keys(this.active).length}}Ic.workerCount=2;class Mc{constructor(r,a,f="Worker",_=Ic.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=c.fU();const x=this.workerPool.acquire(this.id,_);for(let w=0;w<x.length;w++){const k=new Mc.Actor(x[w],a,this.id);k.name=`${f} ${w}`,this.actors.push(k)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,a,f){c.bp(this.actors,(_,x)=>{_.send(r,a,x)},f=f||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(r=>{r.remove()}),this.actors=[],this.workerPool.release(this.id)}}Mc.Actor=c.a;class ab extends c.y{constructor(r,a,f,_){super(),this.scope=f,this._options=r,this.properties=new c.aw(a),this._transitionable=new c.b2(a,f,_),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,r)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,a){this._options=r,this._transitionable.setTransitionOrValue(r.properties,a)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}let df;const hf=()=>df||(df=new c.ax({color:new c.l(c.fs.properties_light_ambient.color),"color-use-theme":new c.l({type:"string",default:"default","property-type":"data-constant"}),intensity:new c.l(c.fs.properties_light_ambient.intensity)}));let am;const lm=()=>am||(am=new c.ax({direction:new c.p(c.fs.properties_light_directional.direction),color:new c.l(c.fs.properties_light_directional.color),"color-use-theme":new c.l({type:"string",default:"default","property-type":"data-constant"}),intensity:new c.l(c.fs.properties_light_directional.intensity),"cast-shadows":new c.l(c.fs.properties_light_directional["cast-shadows"]),"shadow-quality":new c.l(c.fs.properties_light_directional["shadow-quality"]),"shadow-intensity":new c.l(c.fs.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new c.l(c.fs.properties_light_directional["shadow-draw-before-layer"])})),Xl=(u,r,a,f,_,x,w,k,A,P=[0,0,1])=>({u_matrix:u,u_normal_matrix:r,u_opacity:a,u_faux_facade_ao_intensity:f,u_camera_pos:_,u_tile_to_meter:x,u_facade_emissive_chance:w,u_flood_light_color:k,u_flood_light_intensity:A,u_front_cutoff_params:P}),cm=u=>({u_matrix:u}),lb=u=>({u_matrix:u}),ff=1029,Au=2305;class Ut{constructor(r,a,f){this.enable=r,this.mode=a,this.frontFace=f}}Ut.disabled=new Ut(!1,ff,Au),Ut.backCCW=new Ut(!0,ff,Au),Ut.backCW=new Ut(!0,ff,2304),Ut.frontCW=new Ut(!0,1028,2304),Ut.frontCCW=new Ut(!0,1028,Au);class Vt{constructor(r,a,f){this.func=r,this.mask=a,this.range=f}}Vt.ReadOnly=!1,Vt.ReadWrite=!0,Vt.disabled=new Vt(519,Vt.ReadOnly,[0,1]);class pf{constructor(r=0,a=0,f=0,_=0){if(isNaN(r)||r<0||isNaN(a)||a<0||isNaN(f)||f<0||isNaN(_)||_<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=a,this.left=f,this.right=_}interpolate(r,a,f){return a.top!=null&&r.top!=null&&(this.top=c.dY(r.top,a.top,f)),a.bottom!=null&&r.bottom!=null&&(this.bottom=c.dY(r.bottom,a.bottom,f)),a.left!=null&&r.left!=null&&(this.left=c.dY(r.left,a.left,f)),a.right!=null&&r.right!=null&&(this.right=c.dY(r.right,a.right,f)),this}getCenter(r,a){const f=c.bG((this.left+r-this.right)/2,0,r),_=c.bG((this.top+a-this.bottom)/2,0,a);return new c.au(f,_)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new pf(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function cb(u,r){const a=c.cL(u,3);c.ct(u,r),c.fk(u,3,a)}function Jt(u,r){const a=c.dp([]);return c.f5(a,a,-r),c.f2(a,a,-u),a}function ay(u,r){const a=[u[0],u[1],0],f=[r[0],r[1],0];if(c.dW(a)>=1e-15){const w=c.ex([],a);c.fa(f,w,c.c7(f,w)),r[0]=f[0],r[1]=f[1]}const _=c.c1([],r,u);if(c.dV(_)<1e-15)return null;const x=Math.atan2(-_[1],_[0]);return Jt(Math.atan2(Math.sqrt(u[0]*u[0]+u[1]*u[1]),-u[2]),x)}class qn{constructor(r,a){this.position=r,this.orientation=a}get position(){return this._position}set position(r){if(r){const a=r instanceof c.ag?r:new c.ag(r[0],r[1],r[2]);this._renderWorldCopies&&(a.x=c.f$(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a,f){if(this.orientation=null,!this.position)return;const _=this.position,x=f||(this._elevation?this._elevation.getAtPointOrZero(c.ag.fromLngLat(r)):0),w=c.ag.fromLngLat(r,x),k=[w.x-_.x,w.y-_.y,w.z-_.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=ay(k,a)}setPitchBearing(r,a){this.orientation=Jt(c.c4(r),c.c4(-a))}}class mf{constructor(r,a){this._transform=c.dq([]),this.orientation=a,this.position=r}get mercatorPosition(){const r=this.position;return new c.ag(r[0],r[1],r[2])}get position(){const r=c.cL(this._transform,3);return[r[0],r[1],r[2]]}set position(r){var a;r&&c.fk(this._transform,3,[(a=r)[0],a[1],a[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||c.dp([]),r&&cb(this._transform,this._orientation)}getPitchBearing(){const r=this.forward(),a=this.right();return{bearing:Math.atan2(-a[1],a[0]),pitch:Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2])}}setPitchBearing(r,a){this._orientation=Jt(r,a),cb(this._transform,this._orientation)}forward(){const r=c.cL(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=c.cL(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=c.cL(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){const f=new Float64Array(16);return c.dr(f,this.getWorldToCamera(r,a)),f}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,f){const _=this.position;c.fa(_,_,-r);const x=new Float64Array(16);return c.cv(x,[f,f,f]),c.fQ(x,x,_),x[10]*=a,x}getWorldToCamera(r,a){const f=new Float64Array(16),_=new Float64Array(4),x=this.position;return c.bO(_,this._orientation),c.fa(x,x,-r),c.ct(f,_),c.fQ(f,f,x),f[1]*=-1,f[5]*=-1,f[9]*=-1,f[13]*=-1,f[8]*=a,f[9]*=a,f[10]*=a,f[11]*=a,f}getCameraToClipPerspective(r,a,f,_){const x=new Float64Array(16);return c.eE(x,r,a,f,_),x}getCameraToClipOrthographic(r,a,f,_,x,w){const k=new Float64Array(16);return c.eB(k,r,a,f,_,x,w),k}getDistanceToElevation(r,a=!1){const f=r===0?0:c.em(r,a?c.dT(this.position[1]):this.position[1]),_=this.forward();return(f-this.position[2])/_[2]}clone(){return new mf([...this.position],[...this.orientation])}}const p2=Math.tan(85*Math.PI/180);function gf(u,r,a,f,_,x,w){const k=c.bT();if(a)if(x.name==="globe"){const A=c.bw(_,r);c.er(k,k,A)}else{const A=c.ds([],w);k[0]=A[0],k[1]=A[1],k[4]=A[2],k[5]=A[3],f||c.f6(k,k,_.angle)}else c.er(k,_.labelPlaneMatrix,u);return k}function um(u,r,a,f,_,x,w){const k=gf(u,r,a,f,_,x,w);return x.name==="globe"&&a||(k[2]=k[6]=k[10]=k[14]=0),k}function Ed(u,r,a,f,_,x,w){if(a){if(x.name==="globe"){const k=gf(u,r,a,f,_,x,w);return c.dr(k,k),c.er(k,u,k),k}{const k=c.bJ(u),[A,P,D,z]=w,[F,j,$,W,J,Q,ce,fe]=k;return k[0]=A*F+P*J,k[1]=A*j+P*Q,k[2]=A*$+P*ce,k[3]=A*W+P*fe,k[4]=D*F+z*J,k[5]=D*j+z*Q,k[6]=D*$+z*ce,k[7]=D*W+z*fe,f||c.f6(k,k,-_.angle),k}}return _.glCoordMatrix}function lo(u,r,a,f){const _=[u,r,a,1];a?c.fM(_,_,f):Ad(_,_,f);const x=_[3];return _[0]/=x,_[1]/=x,_[2]/=x,_}function dm(u,r){return Math.min(.5+u/r*.5,1.5)}function kd(u,r){const a=u[0]/u[3],f=u[1]/u[3];return a>=-r[0]&&a<=r[0]&&f>=-r[1]&&f<=r[1]}function Gt(u,r,a,f,_,x,w,k,A,P,D=1){const z=a.transform,F=f?u.textSizeData:u.iconSizeData,j=c.ci(F,a.transform.zoom,D),$=z.projection.name==="globe",W=[256/a.width*2+1,256/a.height*2+1],J=f?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;J.clear();let Q=null;$&&(Q=f?u.text.globeExtVertexArray:u.icon.globeExtVertexArray);const ce=u.lineVertexArray,fe=f?u.text.placedSymbolArray:u.icon.placedSymbolArray,se=a.transform.width/a.transform.height;let Ae,Ee=!1;for(let Pe=0;Pe<fe.length;Pe++){const ye=fe.get(Pe),{numGlyphs:be,writingMode:Ce}=ye;if(Ce!==c.bg.vertical||Ee||Ae===c.bg.horizontal||(Ee=!0),Ae=Ce,(ye.hidden||Ce===c.bg.vertical)&&!Ee){yl(be,J);continue}Ee=!1;const ze=new c.au(ye.tileAnchorX,ye.tileAnchorY),Oe=u.elevationType==="road",Ze=!!z.elevation||Oe;let{x:We,y:ut,z:Ne}=z.projection.projectTilePoint(ze.x,ze.y,P.canonical),Je=null;if(Ze){const $t=Oe&&u.hdExt?u.hdExt.getElevationFeatureForPlacedSymbol(u,f?u.text:u.icon,Pe):null;Je={getElevation:A,elevation:z.elevation,elevationFeature:$t};const[an,nn,xn]=A(ze,z.elevation,$t);We+=an,ut+=nn,Ne+=xn}const Be=[We,ut,Ne,1];if(c.fM(Be,Be,r),!kd(Be,W)){yl(be,J);continue}const it=Be[3],Qe=dm(a.transform.getCameraToCenterDistance(z.projection),it),ot=c.ch(F,j,ye),Et=w?ot/Qe:ot*Qe,ht=lo(We,ut,Ne,_);if(ht[3]<=0){yl(be,J);continue}let gt={};const ct=c.c4(u.layers[0].layout.get("text-max-angle")),Ht=Math.cos(ct),Ot=w?null:Je,Nt=as(ye,Et,!1,k,r,_,x,u.glyphOffsetArray,ce,J,Q,ht,ze,gt,se,Ot,z.projection,P,w,Ht);Ee=Nt.useVertical,Ot&&Nt.needsFlipping&&(gt={}),(Nt.notEnoughRoom||Ee||Nt.needsFlipping&&as(ye,Et,!0,k,r,_,x,u.glyphOffsetArray,ce,J,Q,ht,ze,gt,se,Ot,z.projection,P,w,Ht).notEnoughRoom)&&yl(be,J)}f?(u.text.dynamicLayoutVertexBuffer.updateData(J),Q&&u.text.globeExtVertexBuffer&&u.text.globeExtVertexBuffer.updateData(Q)):(u.icon.dynamicLayoutVertexBuffer.updateData(J),Q&&u.icon.globeExtVertexBuffer&&u.icon.globeExtVertexBuffer.updateData(Q))}function tr(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J){const{lineStartIndex:Q,glyphStartIndex:ce,segment:fe}=k,se=ce+k.numGlyphs,Ae=Q+k.lineLength,Ee=r.getoffsetX(ce),Pe=r.getoffsetX(se-1),ye=Iu(u*Ee,a,f,_,x,w,fe,Q,Ae,A,P,D,z,F,!0,j,$,W,J);if(!ye)return null;const be=Iu(u*Pe,a,f,_,x,w,fe,Q,Ae,A,P,D,z,F,!0,j,$,W,J);return be?{first:ye,last:be}:null}function rr(u,r,a,f){return u===c.bg.horizontal&&Math.abs(f)>Math.abs(a)?{useVertical:!0}:u===c.bg.vertical?f>0?{needsFlipping:!0}:null:r!==0&&function(_,x){return _===0||Math.abs(x/_)>p2}(a,f)?r===1?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function as(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce,fe){const se=r/24,Ae=u.lineOffsetX*se,Ee=u.lineOffsetY*se,{lineStartIndex:Pe,glyphStartIndex:ye,numGlyphs:be,segment:Ce,writingMode:ze,flipState:Oe}=u,Ze=Pe+u.lineLength,We=ut=>{if(D){const[it,Qe,ot]=ut.up,Et=P.length;c.fW(D,Et+0,it,Qe,ot),c.fW(D,Et+1,it,Qe,ot),c.fW(D,Et+2,it,Qe,ot),c.fW(D,Et+3,it,Qe,ot)}const[Ne,Je,Be]=ut.point;c.bl(P,Ne,Je,Be,ut.angle)};if(be>1){const ut=tr(se,k,Ae,Ee,a,z,F,u,A,x,j,W,!1,J,Q,ce,fe);if(!ut)return{notEnoughRoom:!0};if(f&&!a){let[Ne,Je,Be]=ut.first.point,[it,Qe,ot]=ut.last.point;[Ne,Je]=lo(Ne,Je,Be,w),[it,Qe]=lo(it,Qe,ot,w);const Et=rr(ze,Oe,(it-Ne)*$,Qe-Je);if(u.flipState=Et&&Et.needsFlipping?1:2,Et)return Et}We(ut.first);for(let Ne=ye+1;Ne<ye+be-1;Ne++){const Je=Iu(se*k.getoffsetX(Ne),Ae,Ee,a,z,F,Ce,Pe,Ze,A,x,j,W,!1,!1,J,Q,ce,fe);if(!Je)return P.length-=4*(Ne-ye),{notEnoughRoom:!0};We(Je)}We(ut.last)}else{if(f&&!a){const Ne=lo(F.x,F.y,0,_),Je=Pe+Ce+1,Be=new c.au(A.getx(Je),A.gety(Je)),it=lo(Be.x,Be.y,0,_),Qe=it[3]>0?it:ir(F,Be,Ne,1,_,void 0,J,Q.canonical),ot=rr(ze,Oe,(Qe[0]-Ne[0])*$,Qe[1]-Ne[1]);if(u.flipState=ot&&ot.needsFlipping?1:2,ot)return ot}const ut=Iu(se*k.getoffsetX(ye),Ae,Ee,a,z,F,Ce,Pe,Ze,A,x,j,W,!1,!1,J,Q,ce,fe);if(!ut)return{notEnoughRoom:!0};We(ut)}return{}}function Cu(u,r,a,f,_){const{x,y:w,z:k}=f.projectTilePoint(u.x,u.y,r);if(!_)return lo(x,w,k,a);const[A,P,D]=_.getElevation(u,_.elevation,_.elevationFeature);return lo(x+A,w+P,k+D,a)}function ir(u,r,a,f,_,x,w,k){const A=Cu(u.sub(r)._unit()._add(u),k,_,w,x);return c.fx(A,a,A),c.ex(A,A),c.fe(A,a,A,f)}function Iu(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce){const fe=f?u-r:u+r;let se=fe>0?1:-1,Ae=0;f&&(se*=-1,Ae=Math.PI),se<0&&(Ae+=Math.PI);let Ee=k+w+(se>0?0:1)|0,Pe=_,ye=_,be=0,Ce=0;const ze=Math.abs(fe),Oe=[],Ze=[];let We=x,ut=We,Ne=c.g0([]);const Je=()=>ir(ut,We,ye,ze-be+1,D,F,W,J.canonical);for(;be+Ce<=ze;){if(Ee+=se,Ee<k||Ee>=A)return null;if(ye=Pe,ut=We,Oe.push(ye),j&&Ze.push(ut),We=new c.au(P.getx(Ee),P.gety(Ee)),Pe=z[Ee],!Pe){const Ot=Cu(We,J.canonical,D,W,F);Pe=Ot[3]>0?z[Ee]=Ot:Je()}be+=Ce;const ct=c.fx([],Pe,ye),Ht=c.c5(ye,Pe);if(a&&Ht>0&&Ce>0&&c.c7(Ne,ct)/(Ce*Ht)<ce)return null;Ce=Ht,Ne=ct}$&&F&&(z[Ee]&&(Pe=Je(),Ce=c.c5(ye,Pe),Ne=c.fx([],Pe,ye)),z[Ee]=Pe);const Be=(ze-be)/Ce,it=We.sub(ut)._mult(Be)._add(ut),Qe=c.fe([],ye,Ne,Be);let ot=[0,0,1],Et=Ne[0],ht=Ne[1];if(Q&&(ot=W.upVector(J.canonical,it.x,it.y),ot[0]!==0||ot[1]!==0||ot[2]!==1)){const ct=[ot[2],0,-ot[0]],Ht=c.c1([],ot,ct);c.ex(ct,ct),c.ex(Ht,Ht),Et=c.c7(Ne,ct),ht=c.c7(Ne,Ht)}if(a){const ct=c.c1([],ot,Ne);c.ex(ct,ct),c.fe(Qe,Qe,ct,a*se)}const gt=Ae+Math.atan2(ht,Et);return Oe.push(Qe),j&&Ze.push(it),{point:Qe,angle:gt,path:Oe,tilePath:Ze,up:ot}}function yl(u,r){const a=r.length,f=a+4*u;r.resize(f),r.float32.fill(-1/0,4*a,4*f)}function Ad(u,r,a){const f=r[0],_=r[1];return u[0]=a[0]*f+a[4]*_+a[12],u[1]=a[1]*f+a[5]*_+a[13],u[3]=a[3]*f+a[7]*_+a[15],u}const $i=15;class bi{constructor(r,a,f,_,x,w,k){this.tileSize=512,this._renderWorldCopies=x===void 0||x,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=f??0,this._maxPitch=_??60,this.setProjection(w),this.setMaxBounds(k),this.width=0,this.height=0,this._center=new c.ab(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._nearClipOffset=0,this._unmodified=!0,this._edgeInsets=new pf,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new mf,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,this.mercatorMatrix=new Float64Array(16),this.mercatorFogMatrix=new Float32Array(16),this.invProjMatrix=new Float64Array(16),this._expandedFarZProjMatrixBuf=new Float64Array(16),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf,this.starsProjMatrix=new Float32Array(16),this.skyboxMatrix=new Float32Array(16),this._mat4Scratch=new Float64Array(16),this.alignedProjMatrix=new Float64Array(16),this.labelPlaneMatrix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){const r=new bi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return r._elevation=this._elevation,r._centerAltitude=this._centerAltitude,r._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,r.tileSize=this.tileSize,r.mercatorFromTransition=this.mercatorFromTransition,r.width=this.width,r.height=this.height,r.cameraElevationReference=this.cameraElevationReference,r._center=this._center,r._setZoom(this.zoom),r._seaLevelZoom=this._seaLevelZoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._nearZ=this._nearZ,r._farZ=this._farZ,r._nearClipOffset=this._nearClipOffset,r._averageElevation=this._averageElevation,r._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._camera=this._camera.clone(),r._calcMatrices(),r.freezeTileCoverage=this.freezeTileCoverage,r.frustumCorners=this.frustumCorners,r._allowWorldUnderZoom=this._allowWorldUnderZoom,r}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<$i}get elevation(){return this._elevation}set elevation(r){this._elevation!==r&&(this._elevation=r,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(r){this._nearClipOffset=r,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(r,a=!1){const f=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||f)&&this._updateCameraOnTerrain(),(r||f)&&this._constrainCamera(a),this._calcMatrices()}getProjection(){return c.eF(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};const a=this.projection?this.getProjection():void 0;this.projection=c.c$(this.projectionOptions);const f=this.getProjection(),_=!c.c2(a,f);return _&&this._calcMatrices(),this.mercatorFromTransition=!1,_}setOrthographicProjectionAtLowPitch(r){return this._orthographicProjectionAtLowPitch!==r&&(this._orthographicProjectionAtLowPitch=r,this._calcMatrices(),!0)}setMercatorFromTransition(){const r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=c.c$({name:"mercator"});const a=r!==this.projection.name;return a&&this._calcMatrices(),a}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get cameraWorldSize(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return c.em(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.au(this.width,this.height)}get bearing(){return c.f$(this.rotation,-180,180)}set bearing(r){this.rotation=r}get rotation(){return-this.angle/Math.PI*180}set rotation(r){const a=-r*Math.PI/180;if(this.angle===a)return;this._unmodified=!1,this.angle=a,this._calcMatrices();const f=Math.sin(this.angle),_=Math.cos(this.angle);this.rotationMatrix=[_,f,-f,_]}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const a=c.bG(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=c.c4(r),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const r=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/r)}get averageElevation(){return this._averageElevation}set averageElevation(r){this._averageElevation=r,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(r){const a=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._setZoom(a),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(r){this._zoom=r,this.scale=this.zoomScale(r),this.tileZoom=Math.floor(r),this.zoomFraction=r-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(r){this._tileCoverLift!==r&&(this._tileCoverLift=r)}_updateCameraOnTerrain(){const r=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,a=this.elevation&&r===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||r===Number.NEGATIVE_INFINITY&&(!a||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const f=this._elevation;a||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&f.exaggeration()&&this._centerAltitudeValidForExaggeration!==f.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*f.exaggeration(),this._centerAltitudeValidForExaggeration=f.exaggeration()):(this._centerAltitude=r||0,this._centerAltitudeValidForExaggeration=f.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const r=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(r)}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],f=this.horizonLineFromTop();let _=0,x=0;for(let w=0;w<a.length;w++){const k=new c.au(a[w][0]*this.width,f+a[w][1]*(this.height-f)),A=r.pointCoordinate(k);if(!A)continue;const P=1/Math.hypot(A[0]-this._camera.position[0],A[1]-this._camera.position[1]);_+=A[3]*P,x+=P}return x===0?NaN:_/x}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const r=this._seaLevelZoom,a=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),f=this.pixelsPerMeter/this.worldSize*a,_=this._mercatorZfromZoom(r),x=this._mercatorZfromZoom(this._maxZoom),w=Math.max(_-f,x);this._setZoom(this._zoomFromMercatorZ(w))}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}equals(r){const a=this.elevation,f=r.elevation,_=a!=null!=(f!=null)||a&&f&&a.exaggeration()!==f.exaggeration();return this.width===r.width&&this.height===r.height&&this.center.lng===r.center.lng&&this.center.lat===r.center.lat&&this.zoom===r.zoom&&this.bearing===r.bearing&&this.pitch===r.pitch&&this.fov===r.fov&&this.projection.name===r.projection.name&&this._edgeInsets.equals(r.padding)&&!_}computeZoomRelativeTo(r){const a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));let f;f=r.z<this._camera.position[2]?[a.x,a.y,a.z]:[r.x,r.y,r.z];const _=c.dW(c.fx([],this._camera.position,f));return c.bG(this._zoomFromMercatorZ(_),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let a=!1;if(r.orientation&&!c.cl(r.orientation,this._camera.orientation)&&(a=this._setCameraOrientation(r.orientation)),r.position){const f=[r.position.x,r.position.y,r.position.z];c.cm(f,this._camera.position)||(this._setCameraPosition(f),a=!0)}a&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const r=this._camera.position,a=new qn;return a.position=new c.ag(r[0],r[1],r[2]),a.orientation=this._camera.orientation,a._elevation=this.elevation,a._renderWorldCopies=this.renderWorldCopies,a}_setCameraOrientation(r){if(!c.dX(r))return!1;c.ey(r,r);const a=c.fO([],[0,0,-1],r),f=c.fO([],[0,-1,0],r);if(f[2]<0)return!1;const _=ay(a,f);return!!_&&(this._camera.orientation=_,!0)}_setCameraPosition(r){const a=this.zoomScale(this.minZoom)*this.tileSize,f=this.zoomScale(this.maxZoom)*this.tileSize,_=this.cameraToCenterDistance;r[2]=c.bG(r[2],_/f,_/a),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,a,f){this._unmodified=!1,this._edgeInsets.interpolate(r,a,f),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const a=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,a)}getVisibleUnwrappedCoordinates(r){const a=[new c.bc(0,r)];if(this.renderWorldCopies){const f=this.pointCoordinate(new c.au(0,0)),_=this.pointCoordinate(new c.au(this.width,0)),x=this.pointCoordinate(new c.au(this.width,this.height)),w=this.pointCoordinate(new c.au(0,this.height)),k=Math.floor(Math.min(f.x,_.x,x.x,w.x)),A=Math.floor(Math.max(f.x,_.x,x.x,w.x)),P=1;for(let D=k-P;D<=A+P;D++)D!==0&&a.push(new c.bc(D,r))}return a}isLODDisabled(r){return(!r||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(r,a,f,_){let x=[];const w=f!=null,k=!w;if(k&&this.zoom<a||w&&f[0]===0&&f[1]===0)return x;const A=new Set,P=(z,F,j,$,W)=>{const J=c.bz(F,z,j,$,W);A.has(J)||(x.push(new c.ap(z,F,j,$,W)),A.add(J))};for(let z=0;z<r.length;z++){const F=r[z];if(k&&F.canonical.z!==a||w&&_!==void 0&&_>F.canonical.z)continue;const j=F.canonical,$=F.overscaledZ,W=F.wrap,J=1<<j.z,Q=j.x+1<J,ce=j.x>0,fe=j.y+1<J,se=j.y>0,Ae=F.wrap-(ce?0:1),Ee=F.wrap+(Q?0:1),Pe=ce?j.x-1:J-1,ye=Q?j.x+1:0;if(w)f[0]<0?(P($,Ee,j.z,ye,j.y),f[1]<0&&fe&&(P($,W,j.z,j.x,j.y+1),P($,Ee,j.z,ye,j.y+1)),f[1]>0&&se&&(P($,W,j.z,j.x,j.y-1),P($,Ee,j.z,ye,j.y-1))):f[0]>0?(P($,Ae,j.z,Pe,j.y),f[1]<0&&fe&&(P($,W,j.z,j.x,j.y+1),P($,Ae,j.z,Pe,j.y+1)),f[1]>0&&se&&(P($,W,j.z,j.x,j.y-1),P($,Ae,j.z,Pe,j.y-1))):f[1]<0&&fe?P($,W,j.z,j.x,j.y+1):se&&P($,W,j.z,j.x,j.y-1);else{const be=F.visibleQuadrants;1&be&&(P($,Ae,j.z,Pe,j.y),se&&(P($,W,j.z,j.x,j.y-1),P($,Ae,j.z,Pe,j.y-1))),2&be&&(P($,Ee,j.z,ye,j.y),se&&(P($,W,j.z,j.x,j.y-1),P($,Ee,j.z,ye,j.y-1))),4&be&&(P($,Ae,j.z,Pe,j.y),fe&&(P($,W,j.z,j.x,j.y+1),P($,Ae,j.z,Pe,j.y+1))),8&be&&(P($,Ee,j.z,ye,j.y),fe&&(P($,W,j.z,j.x,j.y+1),P($,Ee,j.z,ye,j.y+1)))}}const D=[];for(const z of x)x.some(F=>z.isChildOf(F))||D.push(z);if(x=D.filter(z=>!r.some(F=>!!(z.overscaledZ<a&&F.isChildOf(z))||z.equals(F)||z.isChildOf(F))),k){const z=1<<a,F=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),j=[z*F.x,z*F.y],$=4,W=$*$;x=x.filter(J=>{const Q=J.canonical.x+.5-j[0],ce=J.canonical.y+.5-j[1];return Q*Q+ce*ce<W})}return x}extendTileCoverToNearPlane(r,a,f){const _=[],x=new Set;for(const ce of r)x.add(ce.key);const w=(ce,fe,se,Ae,Ee)=>{const Pe=c.bz(fe,ce,se,Ae,Ee);x.has(Pe)||(_.push(new c.ap(ce,fe,se,Ae,Ee)),x.add(Pe))},k=r.reduce((ce,fe)=>Math.max(ce,fe.overscaledZ),f),A=1<<f,P=[new c.au(0,0),new c.au(c.r,0),new c.au(c.r,c.r),new c.au(0,c.r)],D=new c.au(0,0),z=new c.au(0,0),F=(ce,fe)=>{const se=Math.floor(ce[0]),Ae=Math.floor(ce[1]),Ee=(ce[0]-se)*c.r,Pe=(ce[1]-Ae)*c.r,ye=Math.floor(fe[0]),be=Math.floor(fe[1]),Ce=(fe[0]-ye)*c.r,ze=(fe[1]-be)*c.r;for(let Oe=-1;Oe<=1;Oe++){const Ze=se+Oe;if(!(Ze<0||Ze>=A)){D.x=Ee-Oe*c.r,z.x=Ce-(Ze-ye)*c.r;for(let We=-1;We<=1;We++){const ut=Ae+We;D.y=Pe-We*c.r,z.y=ze-(ut-be)*c.r,c.ce(D,z,P)&&w(k,0,f,Ze,ut)}}}},j=a.points,$=j[c.ak],W=j[c.al],J=this._projectToGround($,j[c.F]),Q=this._projectToGround(W,j[c.z]);return F($,J),F(W,Q),_}_projectToGround(r,a){return c.dZ(c.bU(),r,a,r[2]/(r[2]-a[2]))}_projectToZ(r,a,f){const _=r[2]-a[2];return Math.abs(_)<1e-6?c.bK(r):c.dZ(c.bU(),r,a,(r[2]-f)/_)}extendTileCoverForTunnels(r,a,f,_){if(f<18)return[];const x=a.points,w=x[c.am],k=x[c.an],A=x[c.G],P=x[c.H];if(A[2]>=0&&P[2]>=0||w[2]<=0||k[2]<=0)return[];const D=A[2]<0?this._projectToZ(w,A,0):A,z=P[2]<0?this._projectToZ(k,P,0):P,F=-_,j=A[2]<F?this._projectToZ(w,A,F):A,$=P[2]<F?this._projectToZ(k,P,F):P,W=this._findExtensionTilesInQuad(r,f,[$,j,z,D],[.5*(D[0]+z[0]),.5*(D[1]+z[1])]);return W.length>3&&(W.length=3),W}_findExtensionTilesInQuad(r,a,f,_){const x=[],w=new Set;for(const ye of r)w.add(ye.key);const k=r.reduce((ye,be)=>Math.max(ye,be.overscaledZ),a),A=1<<a,P=[new c.au(f[0][0],f[0][1]),new c.au(f[1][0],f[1][1]),new c.au(f[3][0],f[3][1]),new c.au(f[2][0],f[2][1]),new c.au(f[0][0],f[0][1])],D=f[0][0],z=f[1][0],F=f[2][0],j=f[3][0],$=f[0][1],W=f[1][1],J=f[2][1],Q=f[3][1],ce=Math.max(0,Math.floor(Math.min(D,z,F,j))),fe=Math.min(A-1,Math.ceil(Math.max(D,z,F,j))-1),se=Math.max(0,Math.floor(Math.min($,W,J,Q))),Ae=Math.min(A-1,Math.ceil(Math.max($,W,J,Q))-1);for(let ye=se;ye<=Ae;ye++)for(let be=ce;be<=fe;be++){if(!c.eM(P,be,ye,be+1,ye+1))continue;const Ce=c.bz(0,k,a,be,ye);w.has(Ce)||(x.push(new c.ap(k,0,a,be,ye)),w.add(Ce))}const Ee=_[0],Pe=_[1];return x.sort((ye,be)=>{const Ce=ye.canonical.x+.5-Ee,ze=ye.canonical.y+.5-Pe,Oe=be.canonical.x+.5-Ee,Ze=be.canonical.y+.5-Pe;return Ce*Ce+ze*ze-(Oe*Oe+Ze*Ze)||ye.canonical.x-be.canonical.x||ye.canonical.y-be.canonical.y}),x}coveringTiles(r){let a=this.coveringZoomLevel(r);const f=a,_=this.elevation&&this.elevation.exaggeration(),x=_&&!r.isTerrainDEM,w=this.projection.name==="mercator";if(r.minzoom!==void 0&&a<r.minzoom)return[];r.maxzoom!==void 0&&a>r.maxzoom&&(a=r.maxzoom);const k=this.locationCoordinate(this.center),A=this.center.lat,P=1<<a,D=[P*k.x,P*k.y,0],z=this.projection.name==="globe",F=!z,j=c.N.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,F),$=z?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),W=P*c.em(1,this.center.lat),J=this._camera.position[2]/c.em(1,this.center.lat),Q=[P*$.x,P*$.y,J*(F?1:W)],ce=z||_,fe=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),se=this.isLODDisabled(!0)?a:0;let Ae;if(this._elevation&&r.isTerrainDEM)Ae=1e4*this._elevation.exaggeration();else if(this._elevation){const Be=this._elevation.getMinMaxForVisibleTiles();Ae=Be?Be.max:this._centerAltitude}else Ae=this._centerAltitude;const Ee=r.isTerrainDEM?-Ae:this._elevation?this._elevation.getMinElevationBelowMSL():0,Pe=this.projection.isReprojectedInTileSpace?c.d6(this):1,ye=Be=>{const Qe=new c.ag(Be.x+25e-6,Be.y,Be.z),ot=new c.ag(Be.x,Be.y+25e-6,Be.z),Et=Be.toLngLat(),ht=Qe.toLngLat(),gt=ot.toLngLat(),ct=this.locationCoordinate(Et),Ht=this.locationCoordinate(ht),Ot=this.locationCoordinate(gt),Nt=Math.hypot(Ht.x-ct.x,Ht.y-ct.y),$t=Math.hypot(Ot.x-ct.x,Ot.y-ct.y);return Math.sqrt(Nt*$t)*Pe/25e-6},be=Be=>{const it=Ae,Qe=Ee;return{aabb:c.fE(this,P,0,0,0,Be,Qe,it,this.projection),zoom:0,x:0,y:0,minZ:Qe,maxZ:it,wrap:Be,fullyVisible:!1}},Ce=[];let ze=[];const Oe=a,Ze=r.reparseOverscaled?f:a,We=(J-this._centerAltitude)*W,ut=Be=>{if(!this._elevation||!Be.tileID||!w)return;const it=this._elevation.getMinMaxForTile(Be.tileID),Qe=Be.aabb;it?(Qe.min[2]=it.min,Qe.max[2]=it.max,Qe.center[2]=(Qe.min[2]+Qe.max[2])/2):(Be.shouldSplit=Je(Be),Be.shouldSplit||(Qe.min[2]=Qe.max[2]=Qe.center[2]=this._centerAltitude))},Ne=(Be,it)=>{if(.707*it<Be)return 1;const Qe=it/Be;return Qe/(1.4144271570014144+(Math.pow(1.1,Qe-1.4144271570014144+1)-1)/(1.1-1)-1)},Je=Be=>{if(Be.zoom<se)return!0;if(Be.zoom===Oe)return!1;if(Be.shouldSplit!=null)return Be.shouldSplit;const it=Be.aabb.distanceX(Q),Qe=Be.aabb.distanceY(Q);let ot=We,Et=1;if(z){ot=Be.aabb.distanceZ(Q);const $t=Math.pow(2,Be.zoom),an=c.dT((Be.y+1)/$t),nn=c.dT(Be.y/$t),xn=Math.min(Math.max(A,an),nn),En=c.bF(xn)/c.bF(A);if(Et=xn===A?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,En/this._mercatorScaleRatio),this.zoom<=c.S&&Be.zoom===Oe-1&&En>=.9)return!0}else if(x&&(ot=Be.aabb.distanceZ(Q)*W),this.projection.isReprojectedInTileSpace&&f<=5){const $t=Math.pow(2,Be.zoom),an=ye(new c.ag((Be.x+.5)/$t,(Be.y+.5)/$t));Et=an>.85?1:an}if(!w&&!z){const $t=Math.sqrt(it*it+Qe*Qe+ot*ot);let an=(1<<Oe-Be.zoom)*fe*Et;return an*=Ne(Math.max(ot,We),$t),$t<an}let ht=Number.MAX_VALUE,gt=0;const ct=Be.aabb.getCorners(),Ht=[0,0,0];for(const $t of ct){c.fx(Ht,$t,Q),z||(x?Ht[2]*=W:Ht[2]=We);const an=c.c7(Ht,this._camera.forward());an<ht&&(ht=an,gt=Math.abs(Ht[2]))}let Ot=(1<<Oe-Be.zoom)*fe*Et;if(Ot*=Ne(Math.max(gt,We),ht),ht<Ot)return!0;const Nt=Be.aabb.closestPoint(D);return Nt[0]===D[0]&&Nt[1]===D[1]};if(this.renderWorldCopies)for(let Be=1;Be<=3;Be++)Ce.push(be(-Be)),Ce.push(be(Be));for(Ce.push(be(0));Ce.length>0;){const Be=Ce.pop(),it=Be.x,Qe=Be.y;let ot=Be.fullyVisible;const Et=()=>this.projection.name==="globe"&&(Be.y===0||Be.y===(1<<Be.zoom)-1);if(!ot){let ht=ce?Be.aabb.intersects(j):Be.aabb.intersectsFlat(j);if(ht===0&&Et()){const gt=new c.f(Be.zoom,it,Qe);ht=c.bi(this,P,gt,!0).intersects(j)}if(ht===0)continue;ot=ht===2}if(Be.zoom===Oe||!Je(Be)){const ht=Be.zoom===Oe?Ze:Be.zoom;if(r.minzoom&&r.minzoom>ht)continue;let gt=0;if(!ot){let Nt=ce?Be.aabb.intersectsPrecise(j):Be.aabb.intersectsPreciseFlat(j);if(Nt===0&&Et()){const $t=new c.f(Be.zoom,it,Qe);Nt=c.bi(this,P,$t,!0).intersectsPrecise(j)}if(Nt===0)continue;if(r.calculateQuadrantVisibility)if(j.containsPoint(Be.aabb.center))gt=15;else for(let $t=0;$t<4;$t++)Be.aabb.quadrant($t).intersects(j)!==0&&(gt|=1<<$t)}const ct=D[0]-(.5+it+(Be.wrap<<Be.zoom))*(1<<a-Be.zoom),Ht=D[1]-.5-Qe,Ot=Be.tileID?Be.tileID:new c.ap(ht,Be.wrap,Be.zoom,it,Qe);r.calculateQuadrantVisibility&&(Ot.visibleQuadrants=gt),ze.push({tileID:Ot,distanceSq:ct*ct+Ht*Ht});continue}for(let ht=0;ht<4;ht++){const gt=(it<<1)+ht%2,ct=(Qe<<1)+(ht>>1),Ht={aabb:w?Be.aabb.quadrant(ht):c.fE(this,P,Be.zoom+1,gt,ct,Be.wrap,Be.minZ,Be.maxZ,this.projection),zoom:Be.zoom+1,x:gt,y:ct,wrap:Be.wrap,fullyVisible:ot,tileID:void 0,shouldSplit:void 0,minZ:Be.minZ,maxZ:Be.maxZ};x&&!z&&(Ht.tileID=new c.ap(Be.zoom+1===Oe?Ze:Be.zoom+1,Be.wrap,Be.zoom+1,gt,ct),ut(Ht)),Ce.push(Ht)}}if(this.fogCullDistSq){const Be=this.fogCullDistSq,it=this.horizonLineFromTop();ze=ze.filter(Qe=>{const ot=[0,0,0,1],Et=[c.r,c.r,0,1],ht=this.calculateFogTileMatrix(Qe.tileID.toUnwrapped());c.fM(ot,ot,ht),c.fM(Et,Et,ht);const gt=c.en([],ot,Et),ct=c.ee([],ot,Et),Ht=c.cD(gt,ct);if(Ht===0)return!0;let Ot=!1;const Nt=this._elevation;if(Nt&&Ht>Be&&it!==0){const $t=this.calculateProjMatrix(Qe.tileID.toUnwrapped());let an;r.isTerrainDEM||(an=Nt.getMinMaxForTile(Qe.tileID)),an||(an={min:Ee,max:Ae});const nn=c.cC(this.rotation),xn=[nn[0]*c.r,nn[1]*c.r,an.max];c.fL(xn,xn,$t),Ot=(1-xn[1])*this.height*.5<it}return Ht<Be||Ot})}return ze.sort((Be,it)=>Be.distanceSq-it.distanceSq).map(Be=>Be.tileID)}resize(r,a){this.width=r,this.height=a,this.pixelsToGLUnits=[2/r,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log2(r)}project(r){const a=c.bG(r.lat,-c.ae,c.ae),f=this.projection.project(r.lng,a);return new c.au(f.x*this.worldSize,f.y*this.worldSize)}unproject(r){return this.projection.unproject(r.x/this.worldSize,r.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/c.em(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let f,_;const x=this.centerPoint;if(this.projection.name==="globe"){const k=this.worldSize;f=(a.x-x.x)/k,_=(a.y-x.y)/k}else{const k=this.pointCoordinate(a),A=this.pointCoordinate(x);f=k.x-A.x,_=k.y-A.y}const w=this.locationCoordinate(r);this.setLocation(new c.ag(w.x-f,w.y-_))}setLocation(r){this.center=this.coordinateLocation(r),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(r,a){return this.projection.locationPoint(this,r,a)}locationPoint3D(r,a){return this.projection.locationPoint(this,r,a,!0)}pointLocation(r){return this.coordinateLocation(this.pointCoordinate(r))}pointLocation3D(r,a){return this.coordinateLocation(this.pointCoordinate3D(r,a))}locationCoordinate(r,a){const f=a?c.em(a,r.lat):void 0,_=this.projection.project(r.lng,r.lat);return new c.ag(_.x,_.y,f)}coordinateLocation(r){return this.projection.unproject(r.x,r.y)}pointRayIntersection(r,a){const f=a??this._centerAltitude,_=[r.x,r.y,0,1],x=[r.x,r.y,1,1];c.fM(_,_,this.pixelMatrixInverse),c.fM(x,x,this.pixelMatrixInverse);const w=x[3];c.fb(_,_,1/_[3]),c.fb(x,x,1/w);const k=_[2],A=x[2];return{p0:_,p1:x,t:k===A?0:(f-k)/(A-k)}}screenPointToMercatorRay(r){const a=[r.x,r.y,0,1],f=[r.x,r.y,1,1];return c.fM(a,a,this.pixelMatrixInverse),c.fM(f,f,this.pixelMatrixInverse),c.fb(a,a,1/a[3]),c.fb(f,f,1/f[3]),a[2]=c.em(a[2],this._center.lat)*this.worldSize,f[2]=c.em(f[2],this._center.lat)*this.worldSize,c.fb(a,a,1/this.worldSize),c.fb(f,f,1/this.worldSize),new c.aB([a[0],a[1],a[2]],c.ex([],c.fx([],f,a)))}rayIntersectionCoordinate(r){const{p0:a,p1:f,t:_}=r,x=c.em(a[2],this._center.lat),w=c.em(f[2],this._center.lat);return new c.ag(c.dY(a[0],f[0],_)/this.worldSize,c.dY(a[1],f[1],_)/this.worldSize,c.dY(x,w,_))}pointCoordinate(r,a=this._centerAltitude){return this.projection.pointCoordinate(this,r.x,r.y,a)}pointCoordinate3D(r,a){if(!this.elevation)return this.pointCoordinate(r,a);let f=this.projection.pointCoordinate3D(this,r.x,r.y);if(f)return new c.ag(f[0],f[1],f[2]);let _=0,x=this.horizonLineFromTop();if(r.y>x)return this.pointCoordinate(r,a);const w=.02*x,k=r.clone();for(let A=0;A<10&&x-_>w;A++){k.y=c.dY(_,x,.66);const P=this.projection.pointCoordinate3D(this,k.x,k.y);P?(x=k.y,f=P):_=k.y}return f?new c.ag(f[0],f[1],f[2]):this.pointCoordinate(r)}isPointAboveHorizon(r){return this.projection.isPointAboveHorizon(this,r)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=c.R)return!this.isPointAboveHorizon(r);const a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){const f=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,_=[r.x*this.worldSize,r.y*this.worldSize,f+r.toAltitude(),1];return c.fM(_,_,this.pixelMatrix),_[3]>0?new c.au(_[0]/_[3],_[1]/_[3]):new c.au(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:r,left:a}=this._edgeInsets,f=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,x=this.pointLocation3D(new c.au(a,r)),w=this.pointLocation3D(new c.au(_,r)),k=this.pointLocation3D(new c.au(_,f)),A=this.pointLocation3D(new c.au(a,f));let P=Math.min(x.lng,w.lng,k.lng,A.lng),D=Math.max(x.lng,w.lng,k.lng,A.lng),z=Math.min(x.lat,w.lat,k.lat,A.lat),F=Math.max(x.lat,w.lat,k.lat,A.lat);const j=Math.pow(2,-this.zoom)/16*270,$=this.projection.name==="globe"?1:4,W=(J,Q,ce,fe,se)=>{const Ae=(J+ce)/2,Ee=(Q+fe)/2,Pe=new c.au(Ae,Ee),{lng:ye,lat:be}=this.pointLocation3D(Pe),Ce=Math.max(0,P-ye,z-be,ye-D,be-F);P=Math.min(P,ye),D=Math.max(D,ye),z=Math.min(z,be),F=Math.max(F,be),(se<$||Ce>j)&&(W(J,Q,Ae,Ee,se+1),W(Ae,Ee,ce,fe,se+1))};if(W(a,r,_,r,1),W(_,r,_,f,1),W(_,f,a,f,1),W(a,f,a,r,1),this.projection.name==="globe"){const[J,Q]=c.eK(this);J?(F=90,D=180,P=-180):Q&&(z=-90,D=180,P=-180)}return new c.ac(new c.ab(P,z),new c.ab(D,F))}_getBoundsRectangular(r,a){const{top:f,left:_}=this._edgeInsets,x=this.height-this._edgeInsets.bottom,w=this.width-this._edgeInsets.right,k=new c.au(_,f),A=new c.au(w,f),P=new c.au(w,x),D=new c.au(_,x);let z=this.pointCoordinate(k,r),F=this.pointCoordinate(A,r);const j=this.pointCoordinate(P,a),$=this.pointCoordinate(D,a),W=(J,Q)=>(Q.y-J.y)/(Q.x-J.x);return z.y>1&&F.y>=0?z=new c.ag((1-$.y)/W($,z)+$.x,1):z.y<0&&F.y<=1&&(z=new c.ag(-$.y/W($,z)+$.x,0)),F.y>1&&z.y>=0?F=new c.ag((1-j.y)/W(j,F)+j.x,1):F.y<0&&z.y<=1&&(F=new c.ag(-j.y/W(j,F)+j.x,0)),new c.ac().extend(this.coordinateLocation(z)).extend(this.coordinateLocation(F)).extend(this.coordinateLocation($)).extend(this.coordinateLocation(j))}_getBoundsRectangularTerrain(){const r=this.elevation;if(!r.visibleDemTiles.length||r.isUsingMockSource())return this._getBoundsRectangular(0,0);const a=r.visibleDemTiles.reduce((f,_)=>{if(_.dem){const x=_.dem.tree;f.min=Math.min(f.min,x.minimums[0]),f.max=Math.max(f.max,x.maximums[0])}return f},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(a.min*r.exaggeration(),a.max*r.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(r=!0){const a=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,f=this.height/2-a*(1-this._horizonShift);return r?Math.max(0,f):f}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-c.ae,this.maxLat=c.ae,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=c.ek(this.minLng)*this.tileSize,this.worldMaxX=c.ek(this.maxLng)*this.tileSize,this.worldMinY=c.el(this.maxLat)*this.tileSize,this.worldMaxY=c.el(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(r,a){return this.projection.createTileMatrix(this,a,r)}calculateDistanceTileData(r){const a=r.key,f=this._distanceTileDataCache;if(f[a])return f[a];const _=r.canonical,x=1/this.height,w=this.cameraWorldSize,k=w/this.zoomScale(_.z),A=(_.x+Math.pow(2,_.z)*r.wrap)*k,P=_.y*k,D=this.point;D.x*=w/this.worldSize,D.y*=w/this.worldSize;const z=this.angle,F=Math.sin(-z),j=-Math.cos(-z);return f[a]={bearing:[F,j],center:[(D.x-A)*x,(D.y-P)*x],scale:k/c.r*x},f[a]}calculateFogTileMatrix(r){const a=r.key,f=this._fogTileMatrixCache;if(f[a])return f[a];const _=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return c.er(_,this.worldToFogMatrix,_),f[a]=new Float32Array(_),f[a]}calculateProjMatrix(r,a=!1,f=!1){const _=r.key;let x;if(x=f?this._expandedProjMatrixCache:a?this._alignedProjMatrixCache:this._projMatrixCache,x[_])return x[_];const w=this.calculatePosMatrix(r,this.worldSize);let k;return k=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:f?this.expandedFarZProjMatrix:a?this.alignedProjMatrix:this.projMatrix,c.er(w,k,w),x[_]=new Float32Array(w),x[_]}calculatePixelsToTileUnitsMatrix(r){const a=r.tileID.key,f=this._pixelsToTileUnitsCache;if(f[a])return f[a];const _=c.c_(r,this);return f[a]=_,f[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const r=1/this.worldSize,a=c.cv([],[r,r,r]);return c.er(a,a,this.globeMatrix),a}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const r=this._elevation;this._updateCameraState();const a=c.em(1,this._center.lat)*this.worldSize,f=this._computeCameraPosition(a),_=this._camera.forward(),x=c.em(1,this._center.lat);f[2]/=x,_[2]/=x,c.ex(_,_);const w=r.raycast(f,_,r.exaggeration());if(w){const k=c.fe([],f,_,w),A=new c.ag(k[0],k[1],c.em(k[2],c.dT(k[1]))),P=(A.z+c.dW([A.x-f[0],A.y-f[1],A.z-f[2]*x]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(P),this._centerAltitude=A.toAltitude(),this._center=this.coordinateLocation(A),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;const a=this._elevation,f=c.em(1,this._center.lat)*this.worldSize,_=this._computeCameraPosition(f),x=a.getAtPointOrZero(new c.ag(..._)),w=this.pixelsPerMeter/this.worldSize*x,k=this._minimumHeightOverTerrain(),A=_[2]-w;if(A<=k)if(A<0||r){const P=this.locationCoordinate(this._center,this._centerAltitude),D=[_[0],_[1],P.z-_[2]],z=c.dW(D);D[2]-=(k-A)/this._pixelsPerMercatorPixel;const F=c.dW(D);if(F===0)return;c.fa(D,D,z/F*this._pixelsPerMercatorPixel),this._camera.position=[_[0],_[1],P.z*this._pixelsPerMercatorPixel-D[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){const F=this.center;return F.lat=c.bG(F.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!r)&&(F.lng=c.bG(F.lng,this.minLng,this.maxLng)),this.center=F,void(this._constraining=!1)}const a=this._unmodified,{x:f,y:_}=this.point;let x=0,w=f,k=_;const A=this.width/2,P=this.height/2,D=this.worldMinY*this.scale,z=this.worldMaxY*this.scale;if(_-P<D&&(k=D+P),_+P>z&&(k=z-P),z-D<this.height&&(x=Math.max(x,this.height/(z-D)),k=(z+D)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const F=this.worldMinX*this.scale,j=this.worldMaxX*this.scale,$=this.worldSize/2-(F+j)/2;w=(f+$+this.worldSize)%this.worldSize-$,w-A<F&&(w=F+A),w+A>j&&(w=j-A),j-F<this.width&&(x=Math.max(x,this.width/(j-F)),w=(j+F)/2)}w===f&&k===_||this._allowWorldUnderZoom||(this.center=this.unproject(new c.au(w,k))),x&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(x)),this._constrainCamera(),this._unmodified=a,this._constraining=!1}_minZoomForBounds(){let r=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(r=Math.max(r,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),r}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const r=this.centerOffset,a=this.projection.name==="globe",f=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=c.em(1,this.center.lat)/c.em(1,c.Q));const _=c.d2(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,_),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 x=this.projection.zAxisUnit==="meters"?f:1,w=this._camera.getWorldToCamera(this.worldSize,x);let k;const A=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(A[8]=2*-r.x/this.width,A[9]=2*r.y/this.height,this.isOrthographic){let Ae=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),Ee=Ae*this.aspect,Pe=-Ee,ye=-Ae;Ee-=r.x,Pe-=r.x,Ae+=r.y,ye+=r.y,k=this._camera.getCameraToClipOrthographic(Pe,Ee,ye,Ae,this._nearZ+this._nearClipOffset,this._farZ),((be,Ce,ze,Oe)=>{for(let Ze=0;Ze<16;Ze++)be[Ze]=c.dY(Ce[Ze],ze[Ze],Oe)})(k,k,A,c.cc(this.pitch>=$i?1:this.pitch/$i))}else k=A;const P=c.eo([],A,w),D=c.eo([],k,w);if(this.projection.isReprojectedInTileSpace){const Ae=this.locationCoordinate(this.center);c.dq(this._mat4Scratch);const Ee=this._mat4Scratch;c.fQ(Ee,Ee,[Ae.x*this.worldSize,Ae.y*this.worldSize,0]),c.er(Ee,Ee,c.d1(this)),c.fQ(Ee,Ee,[-Ae.x*this.worldSize,-Ae.y*this.worldSize,0]),c.er(D,D,Ee),c.er(P,P,Ee),this.inverseAdjustmentMatrix=c.d0(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(c.fc(this.mercatorMatrix,D,[this.worldSize,this.worldSize,this.worldSize/x,1]),this.projMatrix=D,c.dr(this.invProjMatrix,this.projMatrix),a){const Ae=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);Ae[8]=2*-r.x/this.width,Ae[9]=2*r.y/this.height,c.eo(this._expandedFarZProjMatrixBuf,Ae,w),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;c.dr(this._mat4Scratch,k),this.frustumCorners=c.O.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=c.N.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a),c.cv(this.skyboxMatrix,[1,-1,1]),c.f3(this.skyboxMatrix,this.skyboxMatrix,this._pitch),c.f6(this.skyboxMatrix,this.skyboxMatrix,this.angle),c.eE(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);const z=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;c.bS(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=2*-r.x/this.width,this._mat4Scratch[9]=2*(r.y+z)/this.height,c.er(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);const F=this.point,j=F.x,$=F.y,W=this.width%2/2,J=this.height%2/2,Q=Math.cos(this.angle),ce=Math.sin(this.angle),fe=j-Math.round(j)+Q*W+ce*J,se=$-Math.round($)+Q*J+ce*W;if(c.bS(this.alignedProjMatrix,D),c.fQ(this.alignedProjMatrix,this.alignedProjMatrix,[fe>.5?fe-1:fe,se>.5?se-1:se,0]),c.cv(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),c.fQ(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),c.cv(this.glCoordMatrix,[1,-1,1]),c.fQ(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),c.fc(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),c.er(this.pixelMatrix,this.labelPlaneMatrix,P),this._calcFogMatrices(),this._distanceTileDataCache={},!c.dr(this.pixelMatrixInverse,this.pixelMatrix))throw new Error("failed to invert matrix");if(this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=c.bx(this);const Ae=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=c.fL(Ae,Ae,w),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=this.pixelMatrixInverse;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,f=this._camera.position,_=1/this.height/this._pixelsPerMercatorPixel,x=[r,r,a];c.fa(x,x,_),c.fa(f,f,-1),c.es(f,f,x),c.cw(this.mercatorFogMatrix,f),c.fc(this.mercatorFogMatrix,this.mercatorFogMatrix,x),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,_)}_computeCameraPosition(r){const a=(r=r||this.pixelsPerMeter)/this.pixelsPerMeter,f=this._camera.forward(),_=this.point,x=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*a-r/this.worldSize*this._centerAltitude;return[_.x/this.worldSize-f[0]*x,_.y/this.worldSize-f[1]*x,r/this.worldSize*this._centerAltitude-f[2]*x]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),f=this._camera.position[2],_=r[2];let x=1;this.projection.wrap&&(this.center=this.center.wrap()),_>0&&(x=Math.min((a-f)/_,1)),this._camera.position=c.fe([],this._camera.position,r,x),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,a=this._camera.forward(),{pitch:f,bearing:_}=this._camera.getPitchBearing(),x=c.em(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,w=this._mercatorZfromZoom(this._maxZoom)*Math.cos(c.c4(this._maxPitch)),k=Math.max((r[2]-x)/Math.cos(f),w),A=this._zoomFromMercatorZ(k);c.fe(r,r,a,k),this._pitch=c.bG(f,c.c4(this.minPitch),c.c4(this.maxPitch)),this.angle=c.f$(_,-Math.PI,Math.PI),this._setZoom(c.bG(A,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new c.ag(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(r){return Math.pow(2,r)*this.tileSize}_mercatorZfromZoom(r){return this.cameraToCenterDistance/this._worldSizeFromZoom(r)}_minimumHeightOverTerrain(){const r=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(r)}_zoomFromMercatorZ(r){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,r)*this.tileSize))}zoomFromMercatorZAdjusted(r){let a=0,f=c.R,_=0,x=1/0;for(;f-a>1e-6&&f>a;){const w=a+.5*(f-a),k=this.tileSize*Math.pow(2,w),A=this.getCameraToCenterDistance(this.projection,w,k),P=this.scaleZoom(A/(Math.max(0,r)*this.tileSize)),D=Math.abs(w-P);D<x&&(x=D,_=w),w<P?a=w:f=w}return _}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(c.f_("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,a){const f=Math.min(r.x,a.x),_=Math.max(r.x,a.x),x=Math.min(r.y,a.y),w=Math.max(r.y,a.y);if(x<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const k=[new c.au(f,x),new c.au(_,w),new c.au(f,w),new c.au(_,x)],A=this.renderWorldCopies?-3:0,P=this.renderWorldCopies?4:1;for(const D of k){const z=this.pointRayIntersection(D);if(z.t<0)return!0;const F=this.rayIntersectionCoordinate(z);if(F.x<A||F.y<0||F.x>P||F.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+c.eX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new c.au(0,0),new c.au(this.width,this.height))}zoomDeltaToMovement(r,a){const f=c.dW(c.fx([],this._camera.position,r)),_=this._zoomFromMercatorZ(f)+a;return f-this._mercatorZfromZoom(_)}getCameraPoint(){if(this.projection.name==="globe"){const r=function([a,f,_],x){const w=[a,f,_,1];c.fM(w,w,x);const k=w[3]=Math.max(w[3],1e-6);return w[0]/=k,w[1]/=k,w[2]/=k,w}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new c.au(r[0],r[1])}{const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.au(0,r))}}getCameraToCenterDistance(r,a=this.zoom,f=this.worldSize){const _=c.d2(r,a,this.width,this.height,1024),x=r.pixelSpaceConversion(this.center.lat,f,_);let w=.5/Math.tan(.5*this._fov)*this.height*x;return this.isOrthographic&&(w=c.dY(1,w,c.cc(this.pitch>=$i?1:this.pitch/$i))),w}getWorldToCameraMatrix(){const r=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&c.er(r,r,this.globeMatrix),r}getFrustum(r){return c.N.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,this.projection.zAxisUnit==="meters")}}const Pc=(u,r)=>{if(r<=0||u.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const a=u.transform,f=a.pitch,_=a.isLODDisabled(!1)?60:30;if(f<_-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const x=a._farZ-a._nearZ,w=r*a.height*1.3,k=Math.pow(2,.85*Math.max(a._zoom-u.minCutoffZoom,0)),A=1.4*a.cameraToCenterDistance*k,P=c.fq(_-15,_,f),D=c.dY(a._farZ+w,A,P),z=Math.min(w,D-a._nearZ);return{shouldRenderCutoff:P>0,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(D-a._nearZ)/x,(D-z-a._nearZ)/x]}}},Mu=7680;class rn{constructor(r,a,f,_,x,w){this.test=r,this.ref=a,this.mask=f,this.fail=_,this.depthFail=x,this.pass=w}}rn.disabled=new rn({func:519,mask:0},0,0,Mu,Mu,Mu);const Dc=770,vl=771;class tn{constructor(r,a,f,_){this.blendFunction=r,this.blendColor=a.toNonPremultipliedRenderColor(null),this.mask=f,this.blendEquation=_}}function _f(u,r,a=0){const f=Math.pow(2,r.tileID.overscaledZ),_=r.tileSize*Math.pow(2,u.transform.tileZoom)/f,x=_*(r.tileID.canonical.x+r.tileID.wrap*f),w=_*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/c.eG(r,1,u.transform.tileZoom),u_pixel_coord_upper:[x>>16,w>>16],u_pixel_coord_lower:[65535&x,65535&w],u_pattern_transition:a}}tn.Replace=[1,0,1,0],tn.disabled=new tn(tn.Replace,c.i.transparent,[!1,!1,!1,!1]),tn.unblended=new tn(tn.Replace,c.i.transparent,[!0,!0,!0,!0]),tn.alphaBlended=new tn([1,vl,1,vl],c.i.transparent,[!0,!0,!0,!0]),tn.alphaBlendedNonPremultiplied=new tn([Dc,vl,Dc,vl],c.i.transparent,[!0,!0,!0,!0]),tn.multiply=new tn([774,0,774,0],c.i.transparent,[!0,!0,!0,!0]),tn.multiplyAccumulateAlpha=new tn([774,0,1,vl],c.i.transparent,[!0,!0,!0,!0]),tn.additive=new tn([1,1,1,1],c.i.transparent,[!0,!0,!0,!0]),tn.additiveAlphaWeighted=new tn([Dc,1,773,1],c.i.transparent,[!0,!0,!0,!0]),tn.additiveAlphaWeightedUnboundedAlpha=new tn([Dc,1,1,1],c.i.transparent,[!0,!0,!0,!0]);const Ao={terrain:0,flat:1},xa=c.bT(),ls=(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce=[0,0,1])=>{const fe=r.style.light,se=fe.properties.get("position"),Ae=[se.x,se.y,se.z],Ee=c.bV();fe.properties.get("anchor")==="viewport"&&(c.cu(Ee,-r.transform.angle),c.fK(Ae,Ae,Ee));const Pe=fe.properties.get("color").toPremultipliedRenderColor(null),ye=r.transform,be={u_matrix:u,u_lightpos:Ae,u_lightintensity:fe.properties.get("intensity"),u_lightcolor:[Pe.r,Pe.g,Pe.b],u_vertical_gradient:+a,u_opacity:f,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:xa,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ao[P],u_base_type:Ao[D],u_ao:_,u_edge_radius:x,u_width_scale:w,u_flood_light_color:$,u_vertical_scale:W,u_flood_light_intensity:J,u_ground_shadow_factor:Q,u_front_cutoff_params:ce};return ye.projection.name==="globe"&&(be.u_tile_id=[k.canonical.x,k.canonical.y,1<<k.canonical.z],be.u_zoom_transition=z,be.u_inv_rot_matrix=j,be.u_merc_center=F,be.u_up_dir=ye.projection.upVector(new c.f(0,0,0),F[0]*c.r,F[1]*c.r),be.u_height_lift=A),be},ub=(u,r,a,f,_,x)=>({u_matrix:u,u_edge_radius:r,u_width_scale:a,u_vertical_scale:f,u_height_type:Ao[_],u_base_type:Ao[x]}),Cd=(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q)=>{const ce=ls(u,r,a,f,_,x,w,k,P,D,z,F,j,$,W,J,1,[0,0,0]),fe={u_height_factor:-Math.pow(2,k.overscaledZ)/A.tileSize/8};return Object.assign(ce,_f(r,A,Q),fe)},to=(u,r)=>({u_matrix:u,u_ground_shadow_factor:r}),Xs=[];function xl(u){return Xs[u]=Xs[u]||new Float64Array(16)}const wi=[],ly=new Float32Array(16);class Ga{constructor(r,a){this.aabb=r,this.lastCascade=a}}class yf{add(r,a){const f=this.receivers[r.key];f!==void 0?(f.aabb.min[0]=Math.min(f.aabb.min[0],a.min[0]),f.aabb.min[1]=Math.min(f.aabb.min[1],a.min[1]),f.aabb.min[2]=Math.min(f.aabb.min[2],a.min[2]),f.aabb.max[0]=Math.max(f.aabb.max[0],a.max[0]),f.aabb.max[1]=Math.max(f.aabb.max[1],a.max[1]),f.aabb.max[2]=Math.max(f.aabb.max[2],a.max[2])):this.receivers[r.key]=new Ga(a,null)}clear(){this.receivers={}}get(r){return this.receivers[r.key]}computeRequiredCascades(r,a,f){const _=c.A.fromPoints(r.points);let x=0;for(const w in this.receivers){const k=this.receivers[w];if(!k||!_.intersectsAabb(k.aabb))continue;k.aabb.min=_.closestPoint(k.aabb.min),k.aabb.max=_.closestPoint(k.aabb.max);const A=k.aabb.getCorners();for(let P=0;P<f.length;P++){let D=!0;for(const z of A){const F=[z[0]*a,z[1]*a,z[2]];if(c.fL(F,F,f[P].matrix),F[0]<-1||F[0]>1||F[1]<-1||F[1]>1){D=!1;break}}if(k.lastCascade=P,x=Math.max(x,P),D)break}}return x+1}}class hm{constructor(r){this.painter=r,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new yf,this._depthMode=new Vt(r.context.gl.LEQUAL,Vt.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._devtoolsFolder=null,this.useNormalOffset=!1,this._shadowParameters={cascadeCount:2,normalOffset:3,shadowMapResolution:2048}}destroy(){for(const r of this._cascades)r.texture.destroy(),r.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){const f=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!a||!a.properties)return;const _=a.properties.get("shadow-intensity"),x=a.properties.get("shadow-draw-before-layer");if(!a.shadowsEnabled()||_<=0)return;let w=-1,k=0;for(const Q of f.style.order){const ce=f.style._mergedLayers[Q];ce.hasShadowPass()&&!ce.isHidden(r.zoom)&&(w=k),!x||x!==Q&&x!==ce.slot||(this._drawShadowAfterLayer=k>0?k-1:0),k+=1}if(this._enabled=w>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=w);const A=f.context,P=this._shadowParameters.shadowMapResolution,D=this._shadowParameters.shadowMapResolution;if(this._cascades.length===0||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let Q=0;Q<this._shadowParameters.cascadeCount;++Q){const ce=A.gl,fe=A.createFramebuffer(P,D,0,"texture"),se=new c.a_(A,{width:P,height:D,data:null},ce.DEPTH_COMPONENT16);fe.depthAttachment.set(se.texture),this._cascades.push({framebuffer:fe,texture:se,matrix:[],far:0,boundingSphereRadius:0,frustum:new c.N,scale:0})}}this.shadowDirection=cy(a);let z=0;if(r.elevation){const Q=r.elevation,ce=[1e4,-1e4];Q.visibleDemTiles.filter(fe=>fe.dem).forEach(fe=>{const se=fe.dem.tree;ce[0]=Math.min(ce[0],se.minimums[0]),ce[1]=Math.max(ce[1],se.maximums[0])}),ce[0]!==1e4&&(z=(ce[1]-ce[0])*Q.exaggeration())}const F=1.5*r.cameraToCenterDistance,j=3*F,$=new Float64Array(16);for(let Q=0;Q<this._cascades.length;++Q){const ce=this._cascades[Q];let fe=r.height/50,se=1;this._shadowParameters.cascadeCount===1?se=j:Q===0?se=F:(fe=F,se=j);const[Ae,Ee]=fm(r,this.shadowDirection,fe,se,this._shadowParameters.shadowMapResolution,z);ce.scale=r.scale,ce.matrix=Ae,ce.boundingSphereRadius=Ee,c.dr($,ce.matrix),ce.frustum=c.N.fromInvProjectionMatrix($,1,0,!0),ce.far=se}const W=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[W].far,this._cascades[W].far],this._uniformValues.u_shadow_intensity=_,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=f.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const J=f.transform.elevation;for(const Q of this._groundShadowTiles){let ce={min:0,max:0};if(J){const fe=J.getMinMaxForTile(Q);fe&&(ce=fe)}this.addShadowReceiver(Q.toUnwrapped(),ce.min,ce.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(r){this._enabled=r}drawShadowPass(r,a){if(!this.enabled)return;const f=this.painter,_=f.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(f.transform.getFrustum(0),f.transform.worldSize,this._cascades),_.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let x=0;x<this._numCascadesToRender;++x){f.currentShadowCascade=x,_.bindFramebuffer.set(this._cascades[x].framebuffer.framebuffer),_.clear({color:c.i.white,depth:1});for(const w of r.order){const k=r._mergedLayers[w];if(!k.hasShadowPass()||k.isHidden(f.transform.zoom))continue;const A=r.getLayerSourceCache(k),P=A?a[A.id]:void 0;(k.type==="model"||P&&P.length)&&f.renderLayer(f,A,k,P)}}f.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const r=this.painter,a=r.style,f=r.context,_=f.gl,x=a.directionalLight,w=a.ambientLight;if(!x||!w)return;const k=[],A=Pc(r,r.longestCutoffRange);A.shouldRenderCutoff&&k.push("RENDER_CUTOFF"),k.push("RENDER_SHADOWS"),this.useNormalOffset&&k.push("NORMAL_OFFSET");const P=Rc(a,x,w),D=new Vt(_.LEQUAL,Vt.ReadOnly,r.depthRangeFor3D),z=new rn({func:_.EQUAL,mask:255},0,255,_.KEEP,_.KEEP,_.KEEP);for(const F of this._groundShadowTiles){const j=F.toUnwrapped(),$=r.isTileAffectedByFog(F),W=r.getOrCreateProgram("groundShadow",{defines:k,overrideFog:$});this.setupShadows(j,W),r.uploadCommonUniforms(f,W,j,null,A);const J=to(r.transform.calculateProjMatrix(j),P);W.draw(r,_.TRIANGLES,D,z,tn.multiply,Ut.disabled,J,"ground_shadow",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments,null,r.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(r){const a=this.painter.transform,f=a.calculatePosMatrix(r,a.worldSize);return c.er(f,this._cascades[this.painter.currentShadowCascade].matrix,f),Float32Array.from(f)}calculateShadowPassMatrixFromMatrix(r){return c.er(ly,this._cascades[this.painter.currentShadowCascade].matrix,r)}setupShadows(r,a,f){if(!this.enabled)return;const _=this.painter.transform,x=this.painter.context,w=x.gl,k=this._uniformValues,A=_.calculatePosMatrix(r,_.worldSize);for(let P=0;P<this._cascades.length;P++){const D=xl(P);c.er(D,this._cascades[P].matrix,A),k[P===0?"u_light_matrix_0":"u_light_matrix_1"]=D,x.activeTexture.set(w.TEXTURE0+11+P),this._cascades[P].texture.bindExtraParam(w.LINEAR,w.LINEAR,w.CLAMP_TO_EDGE,w.CLAMP_TO_EDGE,w.GREATER)}if(this.useNormalOffset=!!f,this.useNormalOffset){const P=c.fH(r.canonical),D=2/_.tileSize*c.r/this._shadowParameters.shadowMapResolution,z=D*this._cascades[0].boundingSphereRadius,F=D*this._cascades.at(-1).boundingSphereRadius,j=(f==="vector-tile"?1:3)*function($){const W=c.bG(($-22)/-22,0,1);return .125*(1-W)+4*W}(_.zoom);k.u_shadow_normal_offset=[P,z*j,F*j],k.u_shadow_bias=[1e-4,.0012,.012]}else k.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(x,k)}computeCascadeTileMatrices(r){const a=this._shadowParameters.cascadeCount;for(let f=0;f<a;f++){const _=wi[f]=wi[f]||new Float64Array(16);c.er(_,this._cascades[f].matrix,r)}return wi.length=a,wi}setupShadowsFromMatrix(r,a,f=!1){if(!this.enabled)return;const _=this._shadowParameters.cascadeCount;for(let x=0;x<_;x++)c.er(xl(x),this._cascades[x].matrix,r);Xs.length=_,this.setupShadowsFromCascadeMatrices(Xs,a,f)}setupShadowsFromCascadeMatrices(r,a,f=!1){if(!this.enabled)return;const _=this.painter.context,x=_.gl,w=this._uniformValues;for(let k=0;k<this._shadowParameters.cascadeCount;k++)w[k===0?"u_light_matrix_0":"u_light_matrix_1"]=r[k],_.activeTexture.set(x.TEXTURE0+11+k),this._cascades[k].texture.bindExtraParam(x.LINEAR,x.LINEAR,x.CLAMP_TO_EDGE,x.CLAMP_TO_EDGE,x.GREATER);if(this.useNormalOffset=f,f){const k=this._shadowParameters.normalOffset;w.u_shadow_normal_offset=[1,k,k],w.u_shadow_bias=[6e-5,.0012,.012]}else w.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(_,w)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,a,f,_){if(_[2]>=0)return{};const x=function(A,P,D){const z=D/(1<<A.canonical.z);return new c.A([A.canonical.x*z+A.wrap*D,A.canonical.y*z+A.wrap*D,0],[(A.canonical.x+1)*z+A.wrap*D,(A.canonical.y+1)*z+A.wrap*D,P])}(r,a,f).getCorners(),w=a/-_[2];_[0]<0?(c.bj(x[0],x[0],[_[0]*w,0,0]),c.bj(x[3],x[3],[_[0]*w,0,0])):_[0]>0&&(c.bj(x[1],x[1],[_[0]*w,0,0]),c.bj(x[2],x[2],[_[0]*w,0,0])),_[1]<0?(c.bj(x[0],x[0],[0,_[1]*w,0]),c.bj(x[1],x[1],[0,_[1]*w,0])):_[1]>0&&(c.bj(x[2],x[2],[0,_[1]*w,0]),c.bj(x[3],x[3],[0,_[1]*w,0]));const k={};return k.vertices=x,k.planes=[Id(x[1],x[0],x[4]),Id(x[2],x[1],x[5]),Id(x[3],x[2],x[6]),Id(x[0],x[3],x[7])],k}addShadowReceiver(r,a,f){this._receivers.add(r,c.A.fromTileIdAndHeight(r,a,f))}getMaxCascadeForTile(r){const a=this._receivers.get(r);return a&&a.lastCascade?a.lastCascade:0}}function Id(u,r,a){const f=c.fx([],a,r),_=c.fx([],u,r),x=c.c1([],f,_),w=c.dW(x);return w===0?[0,0,1,0]:(c.fa(x,x,1/w),[x[0],x[1],x[2],-c.c7(x,r)])}function cy(u){const r=u.properties.get("direction"),a=c.bB(r.x,r.y,r.z);a[2]=c.bG(a[2],0,75);const f=c.ft([a[0],a[1],a[2]]);return c.cx(f.x,f.y,f.z)}function Rc(u,r,a){const f=r.properties.get("color-use-theme")==="none",_=r.properties.get("color"),x=r.properties.get("intensity"),w=r.properties.get("direction"),k=[w.x,w.y,w.z],A=a.properties.get("color-use-theme")==="none",P=a.properties.get("color"),D=a.properties.get("intensity"),z=Math.max(c.c7([0,0,1],k),0),F=[0,0,0];c.fa(F,P.toPremultipliedRenderColor(A?null:u.getLut(r.scope)).toArray01Linear().slice(0,3),D);const j=[0,0,0];return c.fa(j,_.toPremultipliedRenderColor(f?null:u.getLut(a.scope)).toArray01Linear().slice(0,3),z*x),c.e4([F[0]>0?F[0]/(F[0]+j[0]):0,F[1]>0?F[1]/(F[1]+j[1]):0,F[2]>0?F[2]/(F[2]+j[2]):0])}function fm(u,r,a,f,_,x){const w=u.zoom,k=u.scale,A=u.worldSize,P=1/A,D=u.aspect,z=Math.sqrt(1+D*D)*Math.tan(.5*u.fovX),F=z*z,j=f-a,$=f+a;let W,J;F>j/$?(W=f,J=f*z):(W=.5*$*(1+F),J=.5*Math.sqrt(j*j+2*(f*f+a*a)*F+$*$*F*F));const Q=u.projection.pixelsPerMeter(u.center.lat,A),ce=u._camera.getCameraToWorldMercator(),fe=[0,0,-W*P];c.fL(fe,fe,ce);let se=J*P;const Ae=function(ot){return ot[0]/=k,ot[1]/=k,ot[2]=c.em(ot[2],u._center.lat),ot},Ee=u._edgeInsets;if(!(Ee.left===0&&Ee.top===0&&Ee.right===0&&Ee.bottom===0||Ee.left===Ee.right&&Ee.top===Ee.bottom)){const ot=u._camera.getWorldToCamera(u.worldSize,u.projection.zAxisUnit==="meters"?Q:1),Et=u._camera.getCameraToClipPerspective(u._fov,u.width/u.height,a,f);Et[8]=2*-u.centerOffset.x/u.width,Et[9]=2*u.centerOffset.y/u.height;const ht=new Float64Array(16);c.eo(ht,Et,ot);const gt=new Float64Array(16);c.dr(gt,ht);const ct=c.N.fromInvProjectionMatrix(gt,A,w,!0);for(const Ht of ct.points){const Ot=Ae(Ht);se=Math.max(se,c.dV(c.fz([],fe,Ot)))}}se*=_/(_-1);const Pe=Math.acos(r[2]),ye=Math.atan2(-r[0],-r[1]),be=new mf;be.position=fe,be.setPitchBearing(Pe,ye);const Ce=be.getWorldToCamera(A,Q),ze=se*A,Oe=Math.min(u._mercatorZfromZoom(17)*A*-2,-2*ze),Ze=be.getCameraToClipOrthographic(-ze,ze,-ze,ze,Oe,(ze+x*Q)/r[2]),We=new Float64Array(16);c.er(We,Ze,Ce);const ut=c.cx(Math.floor(1e6*fe[0])/1e6*A,Math.floor(1e6*fe[1])/1e6*A,0),Ne=.5*_,Je=[0,0,0];c.fL(Je,ut,We),c.fa(Je,Je,Ne);const Be=[Math.floor(Je[0]),Math.floor(Je[1]),Math.floor(Je[2])],it=[0,0,0];c.fx(it,Je,Be),c.fa(it,it,-1/Ne);const Qe=new Float64Array(16);return c.dq(Qe),c.fQ(Qe,Qe,it),c.er(We,Qe,We),[We,ze]}const uy=new Float32Array(16);function pm(u,r,a,f,_,x,w,k){a.resetLayerRenderingStats(u);const A=u.context,P=A.gl,D=u.transform,z=a.paint.get("fill-extrusion-pattern"),F=a.paint.get("fill-extrusion-pattern-cross-fade"),j=z.constantOr(null),$=z.constantOr(1),W=a.paint.get("fill-extrusion-opacity"),J=u.style.enable3dLights(),Q=a.paint.get(J&&!$?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),ce=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),Q],fe=a.layout.get("fill-extrusion-edge-radius"),se=fe>0&&!a.paint.get("fill-extrusion-rounded-roof"),Ae=se?0:fe,Ee=D.projection.name==="globe"?c.cq():0,Pe=D.projection.name==="globe",ye=Pe?c.dm(D.zoom):0,be=[c.ek(D.center.lng),c.el(D.center.lat)],Ce=a.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ze=a.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Ce?null:a.lut).toArray01().slice(0,3),Oe=a.paint.get("fill-extrusion-flood-light-intensity"),Ze=a.paint.get("fill-extrusion-vertical-scale"),We=a.paint.get("fill-extrusion-line-width").constantOr(1)!==0,ut=a.paint.get("fill-extrusion-height-alignment"),Ne=a.paint.get("fill-extrusion-base-alignment"),Je=Pc(u,a.paint.get("fill-extrusion-cutoff-fade-range")),Be=a.paint.get("fill-extrusion-front-cutoff"),it=dy(D.pitch,Be,!!u.terrain),Qe=it[2]<1;Qe&&(u.maxFrontCutoffRawStart=Math.max(u.maxFrontCutoffRawStart,Be[0]));const ot=[];let Et;Pe&&ot.push("PROJECTION_GLOBE_VIEW"),ce[0]>0&&ot.push("FAUX_AO"),se&&ot.push("ZERO_ROOF_RADIUS"),k&&ot.push("HAS_CENTROID"),Oe>0&&ot.push("FLOOD_LIGHT"),Je.shouldRenderCutoff&&ot.push("RENDER_CUTOFF"),Qe&&ot.push("RENDER_FRONT_CUTOFF"),We&&ot.push("RENDER_WALL_MODE");const ht=u.renderPass==="shadow",gt=u.shadowRenderer,ct=ht&&!!gt,Ht=ht?Ut.disabled:Ut.backCCW;u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!0);let Ot=[0,0,0];if(gt){const an=u.style.directionalLight,nn=u.style.ambientLight;an&&nn&&(Ot=Rc(u.style,an,nn)),ht||(ot.push("RENDER_SHADOWS"),gt.useNormalOffset&&ot.push("NORMAL_OFFSET")),Et=ot.concat(["SHADOWS_SINGLE_CASCADE"])}const Nt=ct?"fillExtrusionDepth":$?"fillExtrusionPattern":"fillExtrusion",$t=a.getLayerRenderingStats();for(const an of f){const nn=r.getTile(an),xn=nn.getBucket(a);if(!xn||xn.projection.name!==D.projection.name)continue;let En=!1;gt&&(En=gt.getMaxCascadeForTile(an.toUnwrapped())===0);const qt=u.isTileAffectedByFog(an),fn=xn.programConfigurations.get(a.id);let un=!1;if(j&&nn.imageAtlas){const or=nn.imageAtlas,ri=c.aG.from(j),Pn=ri.getPrimary().scaleSelf(c.co.devicePixelRatio).toString(),Rn=ri.getSecondary(),Kt=or.patternPositions.get(Pn),lr=Rn?or.patternPositions.get(Rn.scaleSelf(c.co.devicePixelRatio).toString()):null;un=!!Kt&&!!lr,Kt&&fn.setConstantPatternPositions(Kt,lr)}F>0&&(un||fn.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&ot.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Dn=u.getOrCreateProgram(Nt,{config:fn,defines:En?Et:ot,overrideFog:qt});if(u.terrain&&u.terrain.setupElevationDraw(nn,Dn,{useMeterToDem:!0}),!xn.centroidVertexBuffer){const or=Dn.getAttributeLocation(P,"a_centroid_pos");or!==-1&&P.vertexAttribI4ui(or,0,0,0,0)}!ht&>&>.setupShadows(nn.tileID.toUnwrapped(),Dn,"vector-tile"),$&&(u.context.activeTexture.set(P.TEXTURE0),nn.imageAtlasTexture&&nn.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),fn.updatePaintBuffers());const Jn=a.paint.get("fill-extrusion-vertical-gradient"),Mr=1/xn.tileToMeter;let Hn;if(ht&>){if(ba(nn.tileID,xn.maxHeight,u))continue;const or=gt.calculateShadowPassMatrixFromTile(nn.tileID.toUnwrapped());Hn=ub(or,Ae,Mr,Ze,ut,Ne)}else{const or=u.translatePosMatrix(an.expandedProjMatrix,nn,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),ri=D.projection.createInversionMatrix(D,an.canonical);Hn=$?Cd(or,u,Jn,W,ce,Ae,Mr,an,nn,Ee,ut,Ne,ye,be,ri,ze,Ze,F):ls(or,u,Jn,W,ce,Ae,Mr,an,Ee,ut,Ne,ye,be,ri,ze,Ze,Oe,Ot,it)}u.uploadCommonUniforms(A,Dn,an.toUnwrapped(),null,Je);let Wn=xn.segments;if(D.projection.name==="mercator"&&!ht&&(Wn=xn.getVisibleSegments(nn.tileID,u.terrain,u.transform.getFrustum(0)),!Wn.get().length))continue;if($t)if(ht)for(const or of Wn.get())$t.numRenderedVerticesInShadowPass+=or.primitiveLength;else for(const or of Wn.get())$t.numRenderedVerticesInTransparentPass+=or.primitiveLength;const Fr=[];(u.terrain||k)&&Fr.push(xn.centroidVertexBuffer),Pe&&Fr.push(xn.layoutVertexExtBuffer),We&&Fr.push(xn.wallVertexBuffer),Dn.draw(u,A.gl.TRIANGLES,_,x,w,Ht,Hn,a.id,xn.layoutVertexBuffer,xn.indexBuffer,Wn,a.paint,u.transform.zoom,fn,Fr)}u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!1)}class bl{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function dy(u,r,a){if(!(r[2]<1)||a)return[0,0,1];const f=180*u/Math.PI;if(f<15)return[-.5,r[1],r[2]];const _=Math.min(1,Math.max(0,(f-15)/5)),x=_*_*(3-2*_);return[-.5*(1-x)+r[0]*x,r[1],r[2]]}function $a(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce,fe,se){const Ae=r.context,Ee=Ae.gl,Pe=r.transform,ye=r.transform.zoom,be=[],Ce=u.translate,ze=u.translateAnchor,Oe=u.edgeRadius,Ze=Pc(r,u.cutoffFadeRange);D==="clear"?(be.push("CLEAR_SUBPASS"),fe&&(be.push("CLEAR_FROM_TEXTURE"),Ae.activeTexture.set(Ee.TEXTURE0),fe.bind(Ee.LINEAR,Ee.CLAMP_TO_EDGE))):D==="sdf"?be.push("SDF_SUBPASS"):D==="emissive"&&(be.push("USE_MRT1"),Ae.activeTexture.set(Ee.TEXTURE0),fe.bind(Ee.LINEAR,Ee.CLAMP_TO_EDGE)),Q&&be.push("HAS_CENTROID"),Ze.shouldRenderCutoff&&be.push("RENDER_CUTOFF");const We=(ut,Ne,Je,Be,it)=>{let Qe=be;Ne.groundRadiusBuffer!=null&&(Qe=be.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const ot=Ne.programConfigurations.get(f.id),Et=r.isTileAffectedByFog(ut),ht=r.getOrCreateProgram("fillExtrusionGroundEffect",{config:ot,defines:Qe,overrideFog:Et}),gt=((Ht,Ot,Nt,$t,an,nn,xn,En,qt,fn,un)=>({u_matrix:Ot,u_opacity:Nt,u_ao_pass:$t?1:0,u_meter_to_tile:an,u_ao:nn,u_flood_light_intensity:xn,u_flood_light_color:En,u_attenuation:qt,u_edge_radius:fn,u_fb:0,u_fb_size:un,u_dynamic_offset:1}))(0,Be,z,P,it,[F,j*it],$,W,J,ye>=17?0:Oe*it,fe?fe.size[0]:0),ct=[];Q&&ct.push(Ne.hiddenByLandmarkVertexBuffer),Ne.groundRadiusBuffer!=null&&ct.push(Ne.groundRadiusBuffer),r.uploadCommonUniforms(Ae,ht,ut.toUnwrapped(),null,Ze),ht.draw(r,Ae.gl.TRIANGLES,x,w,k,A,gt,f.id,Ne.vertexBuffer,Ne.indexBuffer,Je,f.paint,ye,ot,ct)};for(const ut of _){const Ne=a.getTile(ut),Je=Ne.getBucket(f);if(!Je||Je.projection.name!==Pe.projection.name||!Je.groundEffect||Je.groundEffect&&!Je.groundEffect.hasData())continue;const Be=Je.groundEffect,it=1/Je.tileToMeter;{const Qe=r.translatePosMatrix(ut.projMatrix,Ne,Ce,ze),ot=Be.getDefaultSegment();We(ut,Be,ot,Qe,it)}if(ce)for(let Qe=0;Qe<4;Qe++){const ot=c.ev[Qe](ut),Et=a.getTile(ot);if(!Et)continue;const ht=Et.getBucket(f);if(!ht||ht.projection.name!==Pe.projection.name||!ht.groundEffect||ht.groundEffect&&!ht.groundEffect.hasData())continue;const gt=ht.groundEffect;let ct,Ht;Qe===0?(ct=[-c.r,0,0],Ht=1):Qe===1?(ct=[c.r,0,0],Ht=0):Qe===2?(ct=[0,-c.r,0],Ht=3):(ct=[0,c.r,0],Ht=2);const Ot=gt.regionSegments[Ht];Ot&&(c.fQ(uy,ut.projMatrix,ct),We(ut,gt,Ot,r.translatePosMatrix(uy,Ne,Ce,ze),it))}}}function bs(u,r,a,f,_,x,w){f.centroidVertexArray.length===0&&f.createCentroidsBuffer();const k=x?x.findDEMTileFor(a):null;if(!(k&&k.dem||w))return;x&&k&&k.dem&&f.selfDEMTileTimestamp!==k.dem._timestamp&&(f.borderDoneWithNeighborZ=[-1,-1,-1,-1],f.selfDEMTileTimestamp=k.dem._timestamp);const A=(Q,ce)=>{(Q.flags|ce.flags)&c.Y?(Q.flags|=c.Y,ce.flags|=c.Y):(Q.flags&=~c.Y,ce.flags&=~c.Y)},P=Q=>new c.au(Math.ceil((Q+c.E)*c.q),0),D=(Q,ce,fe)=>{const se=Math.ceil((Q+c.E)*c.q),Ae=Math.floor(Math.max(0,Math.min(c.r-1,fe))/4);return new c.au(se,Ae<<5|(3&ce)<<3|7)},z=Q=>{const ce=r.getSource().minzoom,fe=Ae=>{const Ee=r.getTileByID(Ae);if(Ee&&Ee.hasData())return Ee.getBucket(_)},se=[0,-1,1];for(const Ae of se){if(Q.overscaledZ+Ae<ce)continue;const Ee=fe(Q.calculateScaledKey(Q.overscaledZ+Ae));if(Ee)return Ee}},F=[0,0,0],j=(Q,ce)=>(F[0]=Math.min(Q.min.y,ce.min.y),F[1]=Math.max(Q.max.y,ce.max.y),F[2]=c.r-ce.min.x>Q.max.x?ce.min.x-c.r:Q.max.x,F),$=(Q,ce)=>(F[0]=Math.min(Q.min.x,ce.min.x),F[1]=Math.max(Q.max.x,ce.max.x),F[2]=c.r-ce.min.y>Q.max.y?ce.min.y-c.r:Q.max.y,F),W=[(Q,ce)=>j(Q,ce),(Q,ce)=>j(ce,Q),(Q,ce)=>$(Q,ce),(Q,ce)=>$(ce,Q)],J=(Q,ce,fe,se,Ae,Ee,Pe)=>{if(!x)return 0;const ye=[[Ee?fe:Q,Ee?Q:fe,0],[Ee?fe:ce,Ee?ce:fe,0]],be=Pe<0?c.r+Pe:Pe,Ce=[Ee?be:(Q+ce)/2,Ee?(Q+ce)/2:be,0];return fe===0&&Pe<0||fe!==0&&Pe>0?x.getForTilePoints(Ae,[Ce],!0,se):ye.push(Ce),x.getForTilePoints(a,ye,!0,k),Math.max(ye[0][2],ye[1][2],Ce[2])/x.exaggeration()};for(let Q=0;Q<4;Q++){const ce=f.borderFeatureIndices[Q];if(ce.length===0)continue;const fe=c.ev[Q](a),se=z(fe);if(!(se&&se instanceof c.K))continue;const Ae=x?x.findDEMTileFor(fe):null;if(!(Ae&&Ae.dem||w)||(x&&Ae&&Ae.dem&&f.borderDEMTileTimestamp[Q]!==Ae.dem._timestamp&&(f.borderDoneWithNeighborZ[Q]=-1,f.borderDEMTileTimestamp[Q]=Ae.dem._timestamp),f.borderDoneWithNeighborZ[Q]===se.canonical.z))continue;se.centroidVertexArray.length===0&&se.createCentroidsBuffer();const Ee=(Q<2?1:5)-Q,Pe=se.borderDoneWithNeighborZ[Ee]!==f.canonical.z,ye=se.borderFeatureIndices[Ee];let be=0;if(f.canonical.z!==se.canonical.z){for(const Ze of ce)f.showCentroid(f.featuresOnBorder[Ze]);if(Pe)for(const Ze of ye)se.showCentroid(se.featuresOnBorder[Ze]);f.borderDoneWithNeighborZ[Q]=se.canonical.z,se.borderDoneWithNeighborZ[Ee]=f.canonical.z;continue}const Ce=new Map,ze=new Set,Oe=new Set;for(let Ze=0;Ze<ye.length;Ze++){const We=se.featuresOnBorder[ye[Ze]];We.buildingId!==void 0&&Ce.set(We.buildingId,Ze)}for(const Ze of ce){const We=f.featuresOnBorder[Ze],ut=f.centroidData.get(We.centroidDataIndex);if(We.buildingId===void 0)continue;const Ne=Ce.get(We.buildingId);if(Ne===void 0)continue;const Je=se.featuresOnBorder[ye[Ne]],Be=se.centroidData.get(Je.centroidDataIndex);ze.add(Ze),Oe.add(Ne),w&&A(ut,Be);const it=ut.groupCentroidPos.x!==0||ut.groupCentroidPos.y!==0?ut.groupCentroidPos:We.centroid(),Qe=Be.groupCentroidPos.x!==0||Be.groupCentroidPos.y!==0?Be.groupCentroidPos:Je.centroid(),ot=Q<2?Math.round((it.y+Qe.y)/2):Math.round((it.x+Qe.x)/2),Et=We.intersectsCount()>1||Je.intersectsCount()>1;{let ht=0;if(Ae&&Ae.dem&&!Et){const gt=W[Q](ut,Be),ct=Q%2?c.r-1:0;ht=J(gt[0],Math.min(c.r-1,gt[1]),ct,Ae,fe,Q<2,gt[2])}ut.centroidXY=D(ht,Q,ot),Be.centroidXY=D(ht,Ee,ot)}if(f.writeCentroidToBuffer(ut),se.writeCentroidToBuffer(Be),We.buildingId!==void 0){for(const ht of f.centroidData)ht.buildingId===We.buildingId&&ht!==ut&&(ht.centroidXY=ut.centroidXY,f.writeCentroidToBuffer(ht));for(const ht of se.centroidData)ht.buildingId===We.buildingId&&ht!==Be&&(ht.centroidXY=Be.centroidXY,se.writeCentroidToBuffer(ht))}}for(const Ze of ce){if(ze.has(Ze))continue;const We=f.featuresOnBorder[Ze],ut=f.centroidData.get(We.centroidDataIndex),Ne=We.borders[Q];let Je;for(;be<ye.length;){if(Oe.has(be)){be++;continue}Je=se.featuresOnBorder[ye[be]];const Be=Je.borders[Ee];if(Be[1]>Ne[0]+3||Be[0]>Ne[0]-3)break;se.showCentroid(Je),be++}if(Je&&be<ye.length){let Be=be,it=0;for(;;)if(Oe.has(be)){if(++be===ye.length)break;Je=se.featuresOnBorder[ye[be]]}else{if(Je.borders[Ee][0]>Ne[1]-3||(it++,++be===ye.length))break;Je=se.featuresOnBorder[ye[be]]}for(;Be<ye.length&&Oe.has(Be);)Be++;if(Be>=ye.length){f.showCentroid(We);continue}Je=se.featuresOnBorder[ye[Be]];let Qe=!1;if(it>=1){const ht=Je.borders[Ee];Math.abs(Ne[0]-ht[0])<3&&Math.abs(Ne[1]-ht[1])<3&&(it=1,Qe=!0,be=Be+1)}else if(it===0){f.showCentroid(We);continue}const ot=se.centroidData.get(Je.centroidDataIndex);w&&Qe&&A(ut,ot);const Et=We.intersectsCount()>1||Je.intersectsCount()>1;if(it>1)be=Be,ut.centroidXY=ot.centroidXY=new c.au(0,0);else if(Ae&&Ae.dem&&!Et){const ht=W[Q](ut,ot),gt=Q%2?c.r-1:0,ct=J(ht[0],Math.min(c.r-1,ht[1]),gt,Ae,fe,Q<2,ht[2]);ut.centroidXY=ot.centroidXY=P(ct)}else Et?ut.centroidXY=ot.centroidXY=new c.au(0,0):(ut.centroidXY=f.encodeBorderCentroid(We),ot.centroidXY=se.encodeBorderCentroid(Je));f.writeCentroidToBuffer(ut),se.writeCentroidToBuffer(ot)}else f.showCentroid(We)}f.borderDoneWithNeighborZ[Q]=se.canonical.z,se.borderDoneWithNeighborZ[Ee]=f.canonical.z}(f.needsCentroidUpdate||!f.centroidVertexBuffer&&f.centroidVertexArray.length!==0)&&f.uploadCentroid(u)}const m2=[1,0,0],mm=[0,1,0],wl=[0,0,1];function ba(u,r,a){const f=a.transform,_=a.shadowRenderer;if(!_)return!0;const x=a.frameCounter,w=a.currentShadowCascade;let k=a._shadowCullCache;if(!k||k.frame!==x||k.cascade!==w){const Q=f.tileSize*_._cascades[w].scale,ce=f.scaleZoom(Q),fe=_.shadowDirection,se=[fe[0],fe[1],-fe[2]],Ae=[m2,mm,wl,se,[se[0],0,se[2]],[0,se[1],se[2]]];k={frame:x,cascade:w,cameraFrustum:c.N.fromInvProjectionMatrix(f.invProjMatrix,f.worldSize,ce,f.projection.name!=="globe"),edges:Ae,shadowDir:se,ws:Q,zoom:ce},a._shadowCullCache=k}const{cameraFrustum:A,edges:P,shadowDir:D,ws:z,zoom:F}=k;let j=r;if(f.elevation){const Q=f.elevation.getMinMaxForTile(u);Q&&(j+=Q.max)}j/=c.cX(f.center.lat,F);const $=_.computeSimplifiedTileShadowVolume(u.toUnwrapped(),j,z,D);if(!$)return!1;const{vertices:W,planes:J}=$;return A.intersectsPrecise(W,J,P)===0||_.getCurrentCascadeFrustum().intersectsPrecise(W,J,P)===0}const cs=new Float32Array(16),Si=new Float32Array(16);function Ha(u){const{painter:r,source:a,layer:f,coords:_}=u;let x=u.defines;const w=r.context,k=r.renderPass==="shadow",A=r.renderPass==="light-beam",P=r.shadowRenderer,D=c.cX(r.transform.center.lat,r.transform.zoom),z=Pc(r,f.paint.get("building-cutoff-fade-range"));z.shouldRenderCutoff&&(x=x.concat("RENDER_CUTOFF"));const F=f.paint.get("building-front-cutoff"),j=F[2]<1&&!r.terrain,$=dy(r.transform.pitch,F,!!r.terrain);j&&(x=x.concat("RENDER_FRONT_CUTOFF"),r.maxFrontCutoffRawStart=Math.max(r.maxFrontCutoffRawStart,F[0])),u.floodLightIntensity>0&&(x=x.concat("FLOOD_LIGHT"));for(const W of _){const J=a.getTile(W),Q=J.getBucket(f);if(!Q)continue;P&&P.getMaxCascadeForTile(W.toUnwrapped())===0&&(x=x.concat("SHADOWS_SINGLE_CASCADE"));const ce=Q.programConfigurations.get(f.id);let fe,se;const Ae=r.translatePosMatrix(W.expandedProjMatrix,J,[0,0],"map");c.fc(cs,Ae,[1,1,u.verticalScale]);const Ee=cs;let Pe;if(k&&P){if(ba(J.tileID,Q.maxHeight*D,r))continue;const be=P.calculateShadowPassMatrixFromTile(J.tileID.toUnwrapped());c.fc(be,be,[1,1,u.verticalScale]),Pe=lb(be),fe=se=r.getOrCreateProgram("buildingDepth",{config:ce,defines:x,overrideFog:!1})}else if(A)fe=se=r.getOrCreateProgram("buildingBloom",{config:ce,defines:x,overrideFog:!1}),Pe=cm(Ee);else{const be=r.transform.calculatePosMatrix(W.toUnwrapped(),r.transform.worldSize);c.fc(be,be,[1,1,u.verticalScale]),c.fc(Si,be,[1,-1,1/D]),c.dr(Si,Si),c.fR(Si,Si);const Ce=Si,ze=r.transform.getFreeCameraOptions().position,Oe=1<<W.canonical.z;if(Pe=Xl(Ee,Ce,u.opacity,u.facadeAOIntensity,[((ze.x-W.wrap)*Oe-W.canonical.x)*c.r,(ze.y*Oe-W.canonical.y)*c.r,ze.z*Oe*c.r],Q.tileToMeter,u.facadeEmissiveChance,u.floodLightColor,u.floodLightIntensity,$),se=r.getOrCreateProgram("building",{config:ce,defines:x,overrideFog:!1}),u.depthOnly===!0)fe=se;else{const Ze=x.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);fe=r.getOrCreateProgram("building",{config:ce,defines:Ze,overrideFog:!1})}P&&(P.setupShadowsFromMatrix(be,se,!0),fe!==se&&fe.setShadowUniformValues(w,P.getShadowUniformValues()))}const ye=(be,Ce)=>{if(A){const ze=be.entranceBloom;Ce.draw(r,w.gl.TRIANGLES,u.depthMode,rn.disabled,u.blendMode,Ut.disabled,Pe,f.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segmentsBucket,f.paint,r.transform.zoom,ce,[ze.layoutAttenuationBuffer,ze.layoutColorBuffer])}else{const ze=be.segmentsBucket;let Oe=[be.layoutNormalBuffer,be.layoutCentroidBuffer,be.layoutColorBuffer,be.layoutFloodLightDataBuffer];be.layoutFacadePaintBuffer&&(Oe=Oe.concat([be.layoutFacadeDataBuffer,be.layoutFacadeVerticalRangeBuffer,be.layoutFacadePaintBuffer])),Ce.draw(r,w.gl.TRIANGLES,u.depthMode,rn.disabled,u.blendMode,k?Ut.disabled:Ut.backCW,Pe,f.id,be.layoutVertexBuffer,be.indexBuffer,ze,f.paint,r.transform.zoom,ce,Oe)}};r.uploadCommonUniforms(w,se,W.toUnwrapped(),null,z),Q.buildingWithoutFacade&&ye(Q.buildingWithoutFacade,se),Q.buildingWithFacade&&(fe!==se&&r.uploadCommonUniforms(w,fe,W.toUnwrapped(),null,z),ye(Q.buildingWithFacade,fe))}}function db(u,r,a,f,_,x,w,k,A,P,D,z,F,j){const $=u.context.gl,W=u.depthModeForSublayer(1,Vt.ReadOnly,$.LEQUAL,!0),J=c.dY(.1,3,D),Q=u._showOverdrawInspector,ce=z,fe=new bl;Q||$a(fe,u,r,a,f,W,new rn({func:$.ALWAYS,mask:255},255,255,$.KEEP,$.KEEP,$.REPLACE),new tn([$.ONE,$.ONE,$.ONE,$.ONE],c.i.transparent,[!1,!1,!1,!0],$.MIN),Ut.disabled,_,"sdf",x,w,k,A,P,J,ce,!1,void 0);{const se=Q?rn.disabled:new rn({func:$.EQUAL,mask:255},255,255,$.KEEP,$.DECR,$.DECR),Ae=Q?u.colorModeForRenderPass():new tn([$.ONE_MINUS_DST_ALPHA,$.DST_ALPHA,$.ONE,$.ONE],c.i.transparent,[!0,!0,!0,!0]);$a(fe,u,r,a,f,W,se,Ae,Ut.disabled,_,"color",x,w,k,A,P,J,ce,!1,void 0)}}class g2{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(r,a,f,_,x){if(f<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let w=null,k=Number.MAX_VALUE,A=Number.MAX_VALUE,P=!1;const D=this._previousClosestBuildingId?r[this._previousClosestBuildingId]:null;this._previousClosestBuildingId&&D&&this._isBuildingVisible(D,_,x)&&(P=!0,A=this._calculateDistance(a,D));for(const[z,F]of Object.entries(r)){if(!this._isBuildingVisible(F,_,x))continue;const j=this._calculateDistance(a,F);j<k&&(k=j,w=z)}return P&&w&&this._previousClosestBuildingId&&w!==this._previousClosestBuildingId?k>A*this._hysteresisRatio&&(w=this._previousClosestBuildingId):P&&!w&&(w=this._previousClosestBuildingId),this._previousClosestBuildingId=w,w}_calculateDistance(r,a){if(!a.center)return Number.MAX_VALUE;const f=r.lat-a.center[1],_=r.lng-a.center[0];return f*f+_*_}_isBuildingVisible(r,a,f){if(!f)return!1;for(const _ of r.floorIds){const x=r.floors[_];if(!x.geometry)continue;const w=x.geometry;if(w.type==="Polygon"){const k=this._convertRingToPoints(w.coordinates[0]);if(c.eO(k,f))return!0}else if(w.type==="MultiPolygon"){const k=this._convertMultiPolygonToPoints(w.coordinates);if(c.eN(f,k))return!0}}return!1}_convertRingToPoints(r){return r.map(a=>new c.au(a[0],a[1]))}_convertMultiPolygonToPoints(r){return r.map(a=>a.length===0?[]:a[0].map(f=>new c.au(f[0],f[1])))}}const Md=.05,hb=(u,r,a,f,_,x,w,k,A,P,D,z)=>({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:f,u_grid_matrix:_,u_tl_parent:x,u_scale_parent:P,u_fade_t:D.mix,u_opacity:D.opacity,u_image0:0,u_image1:1,u_raster_elevation:z,u_zoom_transition:w,u_merc_center:k,u_cutoff_params:A}),_2=(u,r,a,f,_,x,w,k,A,P)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:f,u_color_ramp:x,u_velocity_res:_,u_max_speed:w,u_uv_offset:k,u_data_scale:[255*A[0],255*A[1]],u_data_offset:P,u_particle_pos_scale:1.1,u_particle_pos_offset:[Md,Md]}),hy=(u,r,a,f,_,x,w,k,A,P)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:f,u_max_speed:_,u_speed_factor:x,u_reset_rate:w,u_rand_seed:Math.random(),u_uv_offset:k,u_data_scale:[255*A[0],255*A[1]],u_data_offset:P,u_particle_pos_scale:1.1,u_particle_pos_offset:[Md,Md]});function fy(u,[r,a,f,_],[x,w]){if(x===w)return[0,0,0,0];const k=255*(u-1)/(u*(w-x));return[r*k,a*k,f*k,_*k]}function py(u,r,[a,f]){return a===f?0:.5/u+(r-a)*(u-1)/(u*(f-a))}c.af.setPbf(c.as);class gm extends c.b0{constructor(r,a,f,_,x){super(r,a,f,_,x),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(r){return this._mrt&&this._mrt.getLayer(r)}setTexturePerLayer(r,a,f){const _=f.context,x=_.gl;let w=this.texturePerLayer.get(r)||f.getTileTexture(a.width);w&&w instanceof c.a_?w.update(a,{premultiply:!1}):w=new c.a_(_,a,x.RGBA8,{premultiply:!1}),this.texturePerLayer.has(r)||this.texturePerLayer.set(r,w)}flushQueues(r){const a=this._workQueuePerLayer.get(r)||[],f=this._fetchQueuePerLayer.get(r)||[];for(;a.length;)a.pop()();for(;f.length;)f.pop()()}flushAllQueues(){for(const r of this._workQueuePerLayer.keys()){const a=this._workQueuePerLayer.get(r)||[];for(;a.length;)a.pop()()}for(const r of this._fetchQueuePerLayer.keys()){const a=this._fetchQueuePerLayer.get(r)||[];for(;a.length;)a.pop()()}}fetchHeader(r=16384,a){const f=this._mrt=new c.af(30),_=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(r-1)}});return this.entireBuffer=null,this.request=c.cG(_,(x,w,k)=>{if(x)a(x);else try{const A=f.getHeaderLength(w);if(A>r)return void(this.request=this.fetchHeader(A,a));f.parseHeader(w),this._isHeaderLoaded=!0;let P=0;for(const D of Object.values(f.layers))P=Math.max(P,D.dataIndex.at(-1).lastByte);w.byteLength>=P&&(this.entireBuffer=w),a(null,this.entireBuffer||w,k)}catch(A){a(A)}}),this.request}fetchBandForRender(r,a,f,_){this.fetchBand(r,a,f,x=>{if(x)return void _(x);this.updateTextureDescriptor(r,a,f);const w=this.textureDescriptorPerLayer.get(a);_(null,w?w.img:null)})}fetchBand(r,a,f,_,x=!0){const w=this._mrt;if(!this._isHeaderLoaded||!w)return void _(new Error("Tile header is not ready"));const k=this.actor;if(!k)return void _(new Error("Can't fetch tile band without an actor"));let A;const P=c.ea(String(f),c.ea(this.tileID.key,r));let D=this._taskQueue.get(P);D?D.add(_):(D=new Set,D.add(_),this._taskQueue.set(P,D));const z=(W,J)=>{A.complete(W,J),W?_(W):(D.forEach(Q=>Q(null,J)),this._taskQueue.delete(P))},F=(W,J)=>{if(W)return _(W);const Q=k.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:J,task:A},z,void 0,!0);if(a!==null){const ce=this._workQueuePerLayer.get(a)||[];ce.push(()=>{Q&&Q.cancel(),A.cancel()}),this._workQueuePerLayer.has(a)||this._workQueuePerLayer.set(a,ce)}};let j;try{j=w.getLayer(r)}catch(W){if(this.state==="reloading")return;throw W}if(!j)return void _(new Error(`Unknown sourceLayer "${r}"`));if(j.hasDataForBand(f))return D.forEach(W=>W(null,null)),void this._taskQueue.delete(P);const $=j.getDataRange([f]);if(A=w.createDecodingTask($),!A||A.tasks.length)if(a!==null&&this.flushQueues(a),this.entireBuffer)F(null,this.entireBuffer.slice($.firstByte,$.lastByte+1));else{const W=Object.assign({},this.requestParams,{headers:{Range:`bytes=${$.firstByte}-${$.lastByte}`}}),J=c.cG(W,F);if(a!==null){const Q=this._fetchQueuePerLayer.get(a)||[];Q.push(()=>{J.cancel(),A.cancel()}),this._fetchQueuePerLayer.has(a)||this._fetchQueuePerLayer.set(a,Q)}}}updateNeeded(r,a){return(!this.textureDescriptorPerLayer.get(r)||this.textureDescriptorPerLayer.get(r).band!==a||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(r,a,f){if(!this._mrt)return;const _=this._mrt.getLayer(r);if(!_||!_.hasBand(f)||!_.hasDataForBand(f))return;const{bytes:x,tileSize:w,buffer:k,offset:A,scale:P}=_.getBandView(f),D=w+2*k,z=new c.ay({width:D,height:D},x),F=this.texturePerLayer.get(a);F&&F instanceof c.a_&&F.update(z,{premultiply:!1}),this.textureDescriptorPerLayer.set(a,{layer:r,band:f,img:z,buffer:k,offset:A,tileSize:w,format:_.pixelFormat,mix:[P,256*P,65536*P,16777216*P]})}destroy(r=!1){if(super.destroy(r),delete this._mrt,!r)for(const a of this.texturePerLayer.values())a&&a instanceof c.a_&&a.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}function my(u,r){const a=Math.pow(2,r.z),f=Math.floor(c.ek(u.getWest())*a),_=Math.floor(c.el(u.getNorth())*a),x=Math.ceil(c.ek(u.getEast())*a),w=Math.ceil(c.el(u.getSouth())*a);return r.x>=f&&r.x<x&&r.y>=_&&r.y<w}class wa{constructor(r,a,f){this.bounds=r?c.ac.convert(this.validateBounds(r)):null,this.minzoom=a||0,this.maxzoom=f||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}addExtraBounds(r){if(r){this.extraBounds||(this.extraBounds=[]);for(const a of r)this.extraBounds.push(c.ac.convert(this.validateBounds(a)))}}contains(r){if(r.z>this.maxzoom||r.z<this.minzoom||this.bounds&&!my(this.bounds,r))return!1;if(!this.extraBounds)return!0;for(const a of this.extraBounds)if(my(a,r))return!0;return!1}static fromTileJSON(r){if(!r.bounds&&!r.extra_bounds)return null;const a=new wa(r.bounds,r.minzoom,r.maxzoom);return a.addExtraBounds(r.extra_bounds),a}}class Pu extends c.y{constructor(r,a,f,_){super(),this.id=r,this.dispatcher=f,this.setEventedParent(_),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"},a),Object.assign(this,c.eF(a,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new c.x("dataloading",{dataType:"source"}));const a=this.map.getWorldview(),f=(x,w)=>{this._tileJSONRequest=null,this._loaded=!0,x?this.fire(new c.v(x)):w&&(Object.assign(this,w),w.raster_layers&&(this.rasterLayers=w.raster_layers,this.rasterLayerIds=this.rasterLayers.map(k=>k.id)),this.tileBounds=wa.fromTileJSON(w),Tr(w.tiles),this.fire(new c.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.x("data",{dataType:"source",sourceDataType:"content"}))),r&&r(x)};this.provider=typeof this._options.provider=="string"?this._options.provider:void 0,this._tileProvider=void 0;const _=c.f1(this._options);return _ instanceof Error?(this._loaded=!0,this.fire(new c.v(_)),void(r&&r())):this.provider&&!_?(this._loaded=!0,this.fire(new c.v(new Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=_?this.loadTileJSONWithProvider(_,f):c.e7(this._options,this.map._requestManager,null,a,f))}loadTileJSONWithProvider(r,a){this.provider=r.name;const{request:f,options:_}=c.eC(this._options,this.map._requestManager),x=new AbortController;return c.e8(r.name,r.url).then(w=>{if(x.signal.aborted)return;const k=new w(_);return k.load&&f?k.load({request:f}).then(A=>(this._tileProvider=k,A)):(this._tileProvider=k,null)}).then(w=>{if(x.signal.aborted)return;const k=c.eW(this._options,w,this.map._requestManager);k instanceof Error?a(k):a(null,k)}).catch(w=>{x.signal.aborted||a(w instanceof Error?w:new Error(String(w)))}),{cancel:()=>x.abort()}}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=c.ea(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r,a){const f=c.co.devicePixelRatio>=2,_=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),f,this.tileSize),x=this.map._requestManager.transformRequest(_,c.aH.Tile);if(this._tileProvider){const w=new AbortController;r.request={cancel:()=>w.abort()},this.loadTileWithProvider(r,this._tileProvider,x,w,a)}else r.request=c.cQ(x,(w,k,A)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(w)return r.state="errored",a(w);if(!k)return a(null);const P=c.cO(A);this.map._refreshExpiredTiles&&r.setExpiryData(P),r.setTexture(k,this.map.painter),r.state="loaded",c.bv(this.dispatcher),a(null)})}async loadTileWithProvider(r,a,f,_,x){const{z:w,x:k,y:A}=r.tileID.canonical;try{const P=await a.loadTile({z:w,x:k,y:A},{request:f,signal:_.signal});if(_.signal.aborted)return r.state="unloaded",x(null);if(P==null){const z=new Error("Tile not found");return z.status=404,r.state="errored",x(z)}if(P.data==null)return r.state="loaded",x(null);const D=P.data instanceof ImageBitmap?P.data:await createImageBitmap(new Blob([P.data]));if(_.signal.aborted)return r.state="unloaded",x(null);r.setTexture(D,this.map.painter),r.state="loaded",this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:P.cacheControl,expires:P.expires}),x(null)}catch(P){if(_.signal.aborted||P instanceof DOMException&&P.name==="AbortError")return r.state="unloaded",x(null);r.state="errored",x(P instanceof Error?P:new Error(String(P)))}finally{delete r.request}}abortTile(r,a){r.request&&(r.request.cancel(),delete r.request),a&&a()}unloadTile(r,a){r.texture&&r.texture instanceof c.a_?(r.destroy(!1),r.texture&&r.texture instanceof c.a_&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function fb([u,r],a,f,{scaled:_=!0}={}){const{tileSize:x,buffer:w}=f,{x:k,y:A,z:P}=a;if(!isFinite(k)||!isFinite(A)||!isFinite(P))throw new Error("Invalid MRT header");const D=2**P,z=D*c.ek(u),F=D*c.el(r);return function([j,$],W,{scaled:J=!0}={}){if(!W)throw new Error("bandView is undefined");const{data:Q,tileSize:ce,buffer:fe,offset:se,scale:Ae,dimension:Ee}=W;if(j<-fe||j>ce+fe||$<-fe||$>ce+fe)throw new Error(`Point (${j}, ${$}) out of bounds for tileSize=${ce}, buffer=${fe}`);const Pe=($+fe)*(ce+2*fe)+(j+fe);if(new Uint32Array(Q.buffer)[Pe]===4294967295)return null;let ye=[];ye=J?[]:new W.data.constructor(Ee);for(let be=0;be<Ee;be++)ye[be]=Math.round(1e12*(Q[Ee*Pe+be]*Ae+se))/1e12;return ye}([Math.min(Math.max(-w,Math.floor((z-k)*x)),x-1+w),Math.min(Math.max(-w,Math.floor((F-A)*x)),x-1+w)],f,{scaled:_})}class Du extends Pu{constructor(r,a,f,_){super(r,a,f,_),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},a)}triggerRepaint(r){const a=this.map.painter._terrain,f=this.map.style.getSourceCache(this.id);a&&a.enabled&&f&&a._clearRenderCacheForTile(f.id,r.tileID),this.map.triggerRepaint()}loadTile(r,a){const f=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),_=this.map._requestManager.transformRequest(f,c.aH.Tile),x={request:_,uid:r.uid,tileID:r.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};r.source=this.id,r.scope=this.scope,r.requestParams=_,r.actor||(r.actor=this.dispatcher.getActor());const w=(k,A,P)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(k)return k.name==="AbortError"?void 0:(r.state="errored",a(k));if(this.map._refreshExpiredTiles&&A){const D=c.cO(P);r.setExpiryData(D)}if(this.partial&&r.state!=="expired")r.state="empty";else if(!this.partial){if(!A)return a(null);r.state="loaded",r._isHeaderLoaded=!0,r._mrt=A}a(null)};r.request=this.partial?r.fetchHeader(void 0,w.bind(this)):r.actor.send("loadTile",x,w.bind(this),void 0,!0)}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(r,a){const f=r.texturePerLayer;if(r.flushAllQueues(),f.size){r.destroy(!1);for(const _ of f.values())this.map.painter.saveTileTexture(_)}else r.destroy()}prepareTile(r,a,f,_){r._isHeaderLoaded&&(r.state!=="empty"&&(r.state="reloading"),r.fetchBandForRender(a,f,_,(x,w)=>{x?(r.state="errored",this.fire(new c.v(x))):w&&(r._isHeaderLoaded=!0,r.setTexturePerLayer(f,w,this.map.painter),r.state="loaded"),this.triggerRepaint(r)}))}getInitialBand(r){if(!this.rasterLayers)return 0;const a=this.rasterLayers.find(({id:x})=>x===r),f=a&&a.fields,_=f&&f.bands&&f.bands;return _?_[0]:0}getTextureDescriptor(r,a,f){if(!r)return;const _=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!_)return;let x=null;a instanceof c.aA?x=a.paint.get("raster-array-band"):a instanceof c.az&&(x=a.paint.get("raster-particle-array-band"));const w=x||this.getInitialBand(_);if(w==null)return;if(!r.textureDescriptorPerLayer.get(a.id))return void this.prepareTile(r,_,a.id,w);if(r.updateNeeded(a.id,w)&&!f)return;const k=r.textureDescriptorPerLayer.get(a.id);return Object.assign({},k,{texture:r.texturePerLayer.get(a.id)})}getImages(r,a){const f=new Map;for(const _ of r)for(const x of a){const[w,k]=x.split("/"),A=_.getLayer(w);if(!A||!A.hasBand(k)||!A.hasDataForBand(k))continue;const{bytes:P,tileSize:D,buffer:z}=A.getBandView(k),F=D+2*z,j={data:new c.ay({width:F,height:F},P),pixelRatio:2,sdf:!1,usvg:!1,version:0};f.set(x,j)}return f}queryRasterArrayValueByBandId(r,a,f){const _=a._mrt;return new Promise(x=>{const w={},k=new Set;for(const[A,P]of Object.entries(_.layers)){if(f.layerName&&A!==f.layerName)continue;const D={};w[A]=D;for(const{bands:z}of P.dataIndex)for(const F of z)f.bands&&!f.bands.includes(F)||(k.add(c.ea(A,F)),a.fetchBand(A,null,F,j=>{c.co.frame(()=>{D[F]=j?null:fb([r.lng,r.lat],_,P.getBandView(F)),k.delete(c.ea(A,F)),k.size===0&&x(w)})},!1))}k.size===0&&x(w)})}_loadTileForQuery(r,a){if(this._loadTileLoaded[r.uid])return void a(null,r._mrt);if(this._loadTilePending[r.uid])return void this._loadTilePending[r.uid].push(a);this._loadTilePending[r.uid]=[a];const f=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),_=this.map._requestManager.transformRequest(f,c.aH.Tile);r.actor.send("loadTile",{request:_,uid:r.uid,tileID:r.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(x,w,k)=>{if(x)return this._loadTilePending[r.uid].forEach(A=>A(x,null)),void delete this._loadTilePending[r.uid];if(!w)return this._loadTilePending[r.uid].forEach(A=>A(null,null)),void delete this._loadTilePending[r.uid];if(this.map._refreshExpiredTiles&&w){const A=c.cO(k);r.setExpiryData(A)}r._mrt=w,r._isHeaderLoaded=!0,r.state="loaded",this._loadTilePending[r.uid].forEach(A=>A(null,w)),this._loadTileLoaded[r.uid]=!0,delete this._loadTilePending[r.uid]},void 0,!0)}queryRasterArrayValueByAllBands(r,a,f){return new Promise((_,x)=>{this._loadTileForQuery(a,(w,k)=>{w?x(w):_(k?this.queryRasterArrayValueByBandId(r,a,f):null)})})}queryRasterArrayValue(r,a){const f=c.ab.convert(r),_=this.findLoadedParent(f);return _&&_._mrt?a.bands||!this.partial?this.queryRasterArrayValueByBandId(f,_,a):this.queryRasterArrayValueByAllBands(f,_,a):Promise.resolve(null)}findLoadedParent(r){const a=c.ag.fromLngLat(r,this.map.transform.tileSize),f=this.maxzoom+1,_=1<<f,x=Math.floor(a.x),w=Math.floor((a.x-x)*_),k=Math.floor(a.y*_),A=this.map.style.getSourceCache(this.id),P=new c.ap(f,x,f,w,k);return A.findLoadedParent(P,this.minzoom)}}var vf=c.b_([{name:"a_index",type:"Int16",components:1}]);class xf{constructor(r,a,f,_){const x={width:f[0],height:f[1],data:null},w=r.gl;this.targetColorTexture=new c.a_(r,x,w.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new c.a_(r,x,w.RGBA8,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,_),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const f=this.context.gl,_=a.width*a.height;this.particleTexture0=new c.a_(this.context,a,f.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new c.a_(this.context,a,f.RGBA8,{premultiply:!1,useMipmap:!1});const x=new c.aL;x.reserve(_);for(let w=0;w<_;w++)x.emplaceBack(w);this.particleIndexBuffer=this.context.createVertexBuffer(x,vf.members,!0),this.particleSegment=c.aJ.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=a.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=c.co.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function _m(u,r,a,f,_){if(_>0){const x=c.co.now(),w=(x-u.timeAdded)/_,k=r?(x-r.timeAdded)/_:-1,A=a.getSource(),P=f.coveringZoomLevel({tileSize:A.tileSize,roundZoom:A.roundZoom}),D=!r||Math.abs(r.tileID.overscaledZ-P)>Math.abs(u.tileID.overscaledZ-P),z=D&&u.refreshedUponExpiration?1:c.bG(D?w:1-k,0,1);return r?{opacity:1,mix:1-z,isFading:w<1}:{opacity:z,mix:0,isFading:w<1}}return{opacity:1,mix:0,isFading:!1}}function gy(u,r,a){if(!u)return null;const f=r.getTextureDescriptor(u,a,!0);if(!f)return null;let{texture:_,mix:x,offset:w,tileSize:k,buffer:A,format:P}=f;if(!_||!P)return null;let D=!1;return P==="uint32"&&(D=!0,x[3]=0,x=fy(c.d,x,[0,a.paint.get("raster-particle-max-speed")]),w=py(c.d,w,[0,a.paint.get("raster-particle-max-speed")])),{texture:_,textureOffset:[A/(k+2*A),k/(k+2*A)],tileSize:k,scalarData:D,scale:x,offset:w,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[P]]}}function Sa(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),f=a-r,_=.2*u.height,x=r+_;return[r,a,(x-_-r)/f,(x-r)/f]}var bf=`#ifdef RASTER_ARRAY
|
||
uniform 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;}
|
||
#endif
|
||
uniform 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;}`,St=`
|
||
#define EPSILON 0.0000001
|
||
#define PI 3.141592653589793
|
||
#ifdef RENDER_CUTOFF
|
||
float 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);}
|
||
#endif`,_y=`
|
||
#ifdef DUAL_SOURCE_BLENDING
|
||
layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
|
||
#elif defined(FLOAT_RENDER_TARGET)
|
||
layout(location=0) out highp vec4 glFragColor;
|
||
#else
|
||
layout(location=0) out vec4 glFragColor;
|
||
#endif
|
||
#ifdef USE_MRT1
|
||
layout(location=1) out vec4 out_Target1;
|
||
#endif
|
||
highp float unpack_depth(highp vec4 rgba_depth)
|
||
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}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;}
|
||
#ifdef INDICATOR_CUTOUT
|
||
uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
|
||
#endif
|
||
const float DITHER_THRESHOLDS[16]=float[16](
|
||
1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0
|
||
);vec4 applyCutout(vec4 color,float height) {
|
||
#ifdef INDICATOR_CUTOUT
|
||
float 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;float 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);
|
||
#else
|
||
return color;
|
||
#endif
|
||
}float cutoutGroundRoofOpacity(vec4 groundRoof) {
|
||
#ifdef INDICATOR_CUTOUT
|
||
float fadeStartX=u_indicator_cutout_params.w;float holeRadius=u_indicator_cutout_params.y;float holeMinOpacity=mix(u_indicator_cutout_params.x,1.0,smoothstep(u_indicator_cutout_params.z,u_indicator_cutout_centers.z,groundRoof.y));float distX=abs(u_indicator_cutout_centers.x-groundRoof.x);float roofOpacity=mix(holeMinOpacity,1.0,smoothstep(fadeStartX,holeRadius,u_indicator_cutout_centers.y-groundRoof.w));float groundOpacity=min(smoothstep(fadeStartX,holeRadius,distX)+holeMinOpacity,1.0);return max(roofOpacity,groundOpacity);
|
||
#else
|
||
return 1.0;
|
||
#endif
|
||
}
|
||
#ifdef DEBUG_WIREFRAME
|
||
#define HANDLE_WIREFRAME_DEBUG \\
|
||
glFragColor=vec4(0.7,0.0,0.0,0.7); \\
|
||
gl_FragDepth=gl_FragCoord.z-0.0001;
|
||
#else
|
||
#define HANDLE_WIREFRAME_DEBUG
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
|
||
#endif
|
||
vec4 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 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}`,yy=`
|
||
#define EXTENT 8192.0
|
||
#define RAD_TO_DEG 180.0/PI
|
||
#define DEG_TO_RAD PI/180.0
|
||
#define GLOBE_RADIUS EXTENT/PI/2.0
|
||
float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
|
||
#ifndef PROJECTED_POS_ON_VIEWPORT
|
||
float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
|
||
#else
|
||
return vec3(0.0);
|
||
#endif
|
||
}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
|
||
#endif
|
||
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4(
|
||
unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
||
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const 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);}
|
||
#ifdef RENDER_CUTOFF
|
||
uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
|
||
#endif
|
||
const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)
|
||
{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}
|
||
#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer
|
||
#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib
|
||
#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib
|
||
#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib
|
||
#define DECLARE_MATERIAL_TABLE_INFO
|
||
#endif`,wf="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Sl=`
|
||
#define ELEVATION_SCALE 7.0
|
||
#define ELEVATION_OFFSET 450.0
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
|
||
mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
|
||
#else
|
||
vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
|
||
#endif
|
||
#ifdef TERRAIN
|
||
uniform 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) {
|
||
#ifdef TERRAIN_DEM_FLOAT_FORMAT
|
||
vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
|
||
#else
|
||
float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=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);
|
||
#endif
|
||
}float prevElevation(vec2 apos) {
|
||
#ifdef TERRAIN_DEM_FLOAT_FORMAT
|
||
vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
|
||
#else
|
||
float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=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);
|
||
#endif
|
||
}
|
||
#ifdef TERRAIN_VERTEX_MORPHING
|
||
float elevation(vec2 apos) {
|
||
#ifdef ZERO_EXAGGERATION
|
||
return 0.0;
|
||
#endif
|
||
float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
|
||
#else
|
||
float elevation(vec2 apos) {
|
||
#ifdef ZERO_EXAGGERATION
|
||
return 0.0;
|
||
#endif
|
||
return currentElevation(apos);}
|
||
#endif
|
||
vec4 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);}
|
||
#else
|
||
float elevation(vec2 pos) { return 0.0; }
|
||
#endif
|
||
#ifdef DEPTH_OCCLUSION
|
||
uniform 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;
|
||
#ifdef DEPTH_D24
|
||
float 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);}
|
||
#else
|
||
highp float unpack_depth_rgba(vec4 rgba_depth)
|
||
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
|
||
#endif
|
||
bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
|
||
#ifdef CLIP_ZERO_TO_ONE
|
||
coord.z=-1.0+2.0*coord.z;
|
||
#endif
|
||
#ifdef DEPTH_D24
|
||
float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
|
||
#else
|
||
float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
|
||
#endif
|
||
return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
|
||
#ifdef DEPTH_D24
|
||
highp vec4 depth=vec4(
|
||
texture(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
|
||
);depth=unpack_depth4(depth);
|
||
#else
|
||
highp vec4 depth=vec4(
|
||
unpack_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))
|
||
);
|
||
#endif
|
||
return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;
|
||
#ifdef CLIP_ZERO_TO_ONE
|
||
coord.z=-1.0+2.0*coord.z;
|
||
#endif
|
||
int 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) {
|
||
#ifdef DEPTH_D24
|
||
highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
|
||
#else
|
||
highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
|
||
#endif
|
||
res+=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;
|
||
#ifdef CLIP_ZERO_TO_ONE
|
||
coord.z=-1.0+2.0*coord.z;
|
||
#endif
|
||
highp 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));}
|
||
#else
|
||
bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
|
||
#endif`,ym=`#ifdef FOG
|
||
uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;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);}
|
||
#endif`,Lc=`#ifdef FOG
|
||
uniform 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;
|
||
#ifdef FLIP_Y
|
||
uv.y=1.0-uv.y;
|
||
#endif
|
||
highp vec3 ray_dir=mix(
|
||
mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float 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;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}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);}
|
||
#endif`,Pd=`
|
||
#ifdef LIGHTING_3D_MODE
|
||
uniform 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));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);}
|
||
#endif`,Ru=`#ifdef RASTER_ARRAY
|
||
uniform 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)
|
||
);}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)
|
||
);}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);}
|
||
#endif`,Sf=`#ifdef RENDER_SHADOWS
|
||
uniform 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];}
|
||
#endif`,pb=`#ifdef RENDER_SHADOWS
|
||
precision 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,highp float bias) {
|
||
#ifdef CLIP_ZERO_TO_ONE
|
||
highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
|
||
#else
|
||
highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
|
||
#endif
|
||
return 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;
|
||
#ifdef SHADOWS_SINGLE_CASCADE
|
||
vec2 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);
|
||
#else
|
||
light_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);
|
||
#endif
|
||
}highp float calculate_shadow_bias(float NDotL) {
|
||
#ifdef NORMAL_OFFSET
|
||
return 0.5*u_shadow_bias.x;
|
||
#else
|
||
return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
|
||
#endif
|
||
}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)
|
||
{highp vec2 biasUV=vec2(
|
||
pos_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);}
|
||
#endif`;const vy=/#include\s+"([^"]+)"/g,xy=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,by=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,y2=new Set(["ifdef","ifndef","elif","if","defined"]),vm=new Set;Oc(St,vm),Oc(yy,vm),Oc(_y,vm);const Tf={"_prelude_fog.vertex.glsl":ym,"_prelude_terrain.vertex.glsl":Sl,"_prelude_shadow.vertex.glsl":Sf,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer
|
||
#define MATERIAL_TABLE_DEBUG 0
|
||
uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;
|
||
#if MATERIAL_TABLE_DEBUG
|
||
vec4 colorDebug;
|
||
#endif
|
||
};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);}float 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++) {
|
||
if (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;
|
||
}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 {
|
||
iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;
|
||
#if MATERIAL_TABLE_DEBUG
|
||
const 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;
|
||
#endif
|
||
uint offset=0u;
|
||
#if MATERIAL_TABLE_DEBUG
|
||
bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}
|
||
#endif
|
||
offset++;
|
||
#if MATERIAL_TABLE_DEBUG
|
||
uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}
|
||
#endif
|
||
offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);
|
||
#if MATERIAL_TABLE_DEBUG
|
||
if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}
|
||
#endif
|
||
uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);
|
||
#if MATERIAL_TABLE_DEBUG
|
||
if(keepFinding)
|
||
{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;}}}
|
||
#endif
|
||
offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;
|
||
#if MATERIAL_TABLE_DEBUG
|
||
if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}
|
||
#endif
|
||
info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)
|
||
{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);}
|
||
#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)
|
||
#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)
|
||
#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)
|
||
#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));
|
||
#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;
|
||
#endif`,"_prelude_fog.fragment.glsl":Lc,"_prelude_shadow.fragment.glsl":pb,"_prelude_lighting.glsl":Pd,"_prelude_raster_array.glsl":Ru},xm={},wy="precision highp float;",mb="precision mediump float;",Ef=`
|
||
#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
|
||
#extension GL_EXT_blend_func_extended : require
|
||
#endif`,gb={preludeTerrain:wn("",Sl),preludeFog:wn(Lc,ym),preludeShadow:wn(pb,Sf),preludeRasterArray:wn(Ru,""),preludeLighting:wn(Pd,Pd),preludePrecisionQualifiers:wn(mb,wy),prelude:wn(_y,yy),preludeExtensions:wn(Ef,"")},_b=[Ef,mb,St,gb.prelude.fragmentSource].join(`
|
||
`),Sy=[wy,St,gb.prelude.vertexSource].join(`
|
||
`);var bm={background:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;
|
||
#ifdef LIGHTING_3D_MODE
|
||
in vec4 v_color;
|
||
#endif
|
||
void main() {vec4 out_color;
|
||
#ifdef FEATURE_CUTOUT
|
||
vec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;
|
||
#ifdef FLIP_Y
|
||
uv.y=1.0-uv.y;
|
||
#endif
|
||
float factorTex=min(texture(u_cutout_factor_image,uv).r,1.0);float cutoutFactor=(1.0-u_feature_cutout_params.x)*factorTex;out_color=u_color*(1.0-cutoutFactor);
|
||
#else
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=v_color;
|
||
#else
|
||
out_color=u_color;
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
#endif
|
||
glFragColor=out_color*u_opacity;
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
in ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;
|
||
#ifdef LIGHTING_3D_MODE
|
||
uniform mediump vec4 u_color;out vec4 v_color;
|
||
#endif
|
||
void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
|
||
#ifndef FEATURE_CUTOUT
|
||
#ifdef LIGHTING_3D_MODE
|
||
v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));
|
||
#endif
|
||
#endif
|
||
}`),backgroundPattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform 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);
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
glFragColor=out_color*u_opacity;
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
uniform 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 ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
}`),circle:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
in vec3 v_data;in float v_visibility;
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define mediump float radius
|
||
#pragma mapbox: define lowp float blur
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define highp vec4 stroke_color
|
||
#pragma mapbox: define mediump float stroke_width
|
||
#pragma mapbox: define lowp float stroke_opacity
|
||
uniform float u_emissive_strength;void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize mediump float radius
|
||
#pragma mapbox: initialize lowp float blur
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize highp vec4 stroke_color
|
||
#pragma mapbox: initialize mediump float stroke_width
|
||
#pragma mapbox: initialize lowp float stroke_opacity
|
||
vec2 extrude=v_data.xy;float 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 ?
|
||
smoothstep(0.0,-antialiased_blur,1.0-extrude_length) :
|
||
smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
|
||
antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
|
||
);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_apply_premultiplied(out_color,v_fog_pos);
|
||
#endif
|
||
glFragColor=out_color*(v_visibility*opacity_t);
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
#define NUM_VISIBILITY_RINGS 2
|
||
#define INV_SQRT2 0.70710678
|
||
#define ELEVATION_BIAS 0.0001
|
||
#define NUM_SAMPLES_PER_RING 16
|
||
uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
in float a_circle_z_offset;
|
||
#endif
|
||
out vec3 v_data;out float v_visibility;
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define mediump float radius
|
||
#pragma mapbox: define lowp float blur
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define highp vec4 stroke_color
|
||
#pragma mapbox: define mediump float stroke_width
|
||
#pragma mapbox: define lowp float stroke_opacity
|
||
vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
|
||
#if defined(TERRAIN)
|
||
return elevation(pos)+ELEVATION_BIAS;
|
||
#else
|
||
return 0.0;
|
||
#endif
|
||
}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
|
||
#ifdef PITCH_WITH_MAP
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
|
||
#else
|
||
return u_matrix*( world_center+vec4(sample_offset,0,0) );
|
||
#endif
|
||
#else
|
||
return projected_center+vec4(sample_offset,0,0);
|
||
#endif
|
||
}float get_sample_step() {
|
||
#ifdef PITCH_WITH_MAP
|
||
return 2.0*PI/float(NUM_SAMPLES_PER_RING);
|
||
#else
|
||
return PI/float(NUM_SAMPLES_PER_RING);
|
||
#endif
|
||
}void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize mediump float radius
|
||
#pragma mapbox: initialize lowp float blur
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize highp vec4 stroke_color
|
||
#pragma mapbox: initialize mediump float stroke_width
|
||
#pragma mapbox: initialize lowp float stroke_opacity
|
||
vec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
surface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,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)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
|
||
#else
|
||
surface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
|
||
#endif
|
||
vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
|
||
#ifdef PITCH_WITH_MAP
|
||
#ifdef SCALE_WITH_MAP
|
||
view_scale=1.0;
|
||
#else
|
||
view_scale=projected_center.w/u_camera_to_center_distance;
|
||
#endif
|
||
#else
|
||
#ifdef SCALE_WITH_MAP
|
||
view_scale=u_camera_to_center_distance;
|
||
#else
|
||
view_scale=projected_center.w;
|
||
#endif
|
||
#endif
|
||
gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
|
||
#ifdef TERRAIN
|
||
float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
|
||
#ifdef PITCH_WITH_MAP
|
||
float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
|
||
#else
|
||
occlusion_world_center=world_center;occlusion_projected_center=projected_center;
|
||
#endif
|
||
for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
|
||
#else
|
||
visibility=1.0;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
visibility=1.0;
|
||
#endif
|
||
v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(world_center.xyz);
|
||
#endif
|
||
}`),clippingMask:wn("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:wn(`#include "_prelude_fog.fragment.glsl"
|
||
uniform highp float u_intensity;in vec2 v_extrude;
|
||
#pragma mapbox: define highp float weight
|
||
#define GAUSS_COEF 0.3989422804014327
|
||
void main() {
|
||
#pragma mapbox: initialize highp float weight
|
||
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
|
||
#ifdef FOG
|
||
if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
|
||
#include "_prelude_fog.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
|
||
#endif
|
||
out vec2 v_extrude;
|
||
#pragma mapbox: define highp float weight
|
||
#pragma mapbox: define mediump float radius
|
||
const highp float ZERO=1.0/255.0/16.0;
|
||
#define GAUSS_COEF 0.3989422804014327
|
||
void main() {
|
||
#pragma mapbox: initialize highp float weight
|
||
#pragma mapbox: initialize mediump float radius
|
||
vec2 unscaled_extrude=vec2(mod(vec2(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(vec2(a_pos)*0.5);vec3 pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec3 pos_normal_3=vec3(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=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
#else
|
||
pos=vec3(tilePos+extrude,elevation(tilePos));
|
||
#endif
|
||
gl_Position=u_matrix*vec4(pos,1);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
}`),heatmapTexture:wn(`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;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(0.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,"in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),collisionBox:wn("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"
|
||
in ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 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;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
|
||
#endif
|
||
out float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);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(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
#ifndef PROJECTED_POS_ON_VIEWPORT
|
||
vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
|
||
#endif
|
||
#endif
|
||
vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
|
||
0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}`),collisionCircle:wn("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 ivec2 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;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
|
||
mix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
|
||
0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:wn("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"
|
||
in ivec2 a_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in ivec4 a_pos_3;
|
||
#endif
|
||
out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
gl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);
|
||
#else
|
||
gl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);
|
||
#endif
|
||
}`),fill:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define lowp float opacity
|
||
uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
in highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
in highp float v_z_offset;
|
||
#endif
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
vec4 out_color=color;
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
out_color*=(opacity*u_opacity_multiplier);
|
||
#ifdef INDICATOR_CUTOUT
|
||
if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
glFragColor=out_color;
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
in ivec2 a_pos;
|
||
#ifdef ELEVATED_ROADS
|
||
in float a_road_z_offset;out highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
out highp float v_z_offset;
|
||
#endif
|
||
uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define highp float z_offset
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize highp float z_offset
|
||
#ifdef ELEVATED_ROADS
|
||
z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
|
||
#endif
|
||
float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=z_offset;
|
||
#endif
|
||
}`),fillOutline:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#pragma mapbox: define highp vec4 outline_color
|
||
#pragma mapbox: define lowp float opacity
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 outline_color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
glFragColor=out_color*(alpha*opacity*u_opacity_multiplier);
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
in ivec2 a_pos;
|
||
#ifdef ELEVATED_ROADS
|
||
in float a_road_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;
|
||
#pragma mapbox: define highp vec4 outline_color
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define highp float z_offset
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 outline_color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize highp float z_offset
|
||
#ifdef ELEVATED_ROADS
|
||
z_offset+=a_road_z_offset;
|
||
#endif
|
||
float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
|
||
#ifdef FLIP_Y
|
||
v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
|
||
#else
|
||
v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));
|
||
#endif
|
||
}`),fillOutlinePattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
uniform vec2 u_texsize;uniform sampler2D u_image;
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
uniform float u_pattern_transition;
|
||
#endif
|
||
uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
uniform highp sampler3D u_lutTexture;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
in highp vec2 v_pos;in highp vec2 v_pos_world;
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define lowp uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
void main() {
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(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);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
out_color=applyLUT(u_lutTexture,out_color);
|
||
#endif
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
vec2 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;
|
||
#endif
|
||
vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
glFragColor=out_color*(alpha*opacity*u_opacity_multiplier);
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
|
||
#ifdef ELEVATED_ROADS
|
||
in float a_road_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
out highp vec2 v_pos;out highp vec2 v_pos_world;
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define lowp uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: define lowp float pixel_ratio
|
||
#pragma mapbox: define highp float z_offset
|
||
void main() {
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize lowp float pixel_ratio
|
||
#pragma mapbox: initialize highp float z_offset
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);
|
||
#ifdef ELEVATED_ROADS
|
||
z_offset+=a_road_z_offset;
|
||
#endif
|
||
float hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(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,pos);
|
||
#ifdef FLIP_Y
|
||
v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
|
||
#else
|
||
v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
}`),fillPattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
uniform vec2 u_texsize;uniform sampler2D u_image;
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
uniform float u_pattern_transition;
|
||
#endif
|
||
in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
in highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
uniform highp sampler3D u_lutTexture;
|
||
#endif
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define lowp uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
void main() {
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(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);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
out_color=applyLUT(u_lutTexture,out_color);
|
||
#endif
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(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;
|
||
#endif
|
||
vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
|
||
#ifdef ELEVATED_ROADS
|
||
out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
#else
|
||
out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
glFragColor=out_color*(opacity*u_opacity_multiplier);
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
|
||
#ifdef ELEVATED_ROADS
|
||
in float a_road_z_offset;out highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
out highp vec2 v_pos;
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define lowp uvec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: define lowp float pixel_ratio
|
||
#pragma mapbox: define highp float z_offset
|
||
void main() {
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#pragma mapbox: initialize lowp float pixel_ratio
|
||
#pragma mapbox: initialize highp float z_offset
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
|
||
#ifdef ELEVATED_ROADS
|
||
z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
|
||
#endif
|
||
float hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
}`),lineBlendComposite:wn(`uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;
|
||
#define ADDITIVE 1
|
||
void main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(0.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,"in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),lineBlendReduce:wn("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
in vec4 v_color;in vec4 v_flat;
|
||
#ifdef RENDER_SHADOWS
|
||
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
|
||
#endif
|
||
uniform lowp float u_opacity;
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
in float v_front_cutoff_opacity;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
in vec4 v_ground_roof;
|
||
#endif
|
||
#endif
|
||
#ifdef FAUX_AO
|
||
uniform lowp vec2 u_ao;in vec2 v_ao;
|
||
#endif
|
||
#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
|
||
in vec4 v_roof_color;
|
||
#endif
|
||
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
in highp vec3 v_normal;
|
||
#endif
|
||
uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
|
||
#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
|
||
in float v_flood_radius;in float v_has_floodlight;
|
||
#endif
|
||
in float v_height;
|
||
#pragma mapbox: define highp float emissive_strength
|
||
void main() {
|
||
#pragma mapbox: initialize highp float emissive_strength
|
||
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
vec3 normal=normalize(v_normal);
|
||
#endif
|
||
float z;vec4 color=v_color;
|
||
#ifdef ZERO_ROOF_RADIUS
|
||
z=float(normal.z > 0.00001);
|
||
#ifdef LIGHTING_3D_MODE
|
||
normal=mix(normal,vec3(0.0,0.0,1.0),z);
|
||
#else
|
||
color=mix(v_color,v_roof_color,z);
|
||
#endif
|
||
#endif
|
||
float h=max(0.0,v_height);float ao_shade=1.0;
|
||
#ifdef FAUX_AO
|
||
float 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;
|
||
#ifdef ZERO_ROOF_RADIUS
|
||
concave*=(1.0-z);
|
||
#endif
|
||
float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
|
||
#ifdef LIGHTING_3D_MODE
|
||
#ifdef FLOOD_LIGHT
|
||
color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
|
||
#else
|
||
color.rgb*=ao_shade;
|
||
#endif
|
||
#else
|
||
color.rgb*=ao_shade;
|
||
#endif
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
float flood_radiance=0.0;
|
||
#ifdef FLOOD_LIGHT
|
||
flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
#ifdef FLOOD_LIGHT
|
||
float 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);
|
||
#else
|
||
float shadowed_lighting_factor;
|
||
#ifdef RENDER_CUTOFF
|
||
shadowed_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;}
|
||
#else
|
||
shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
|
||
#endif
|
||
color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
|
||
#endif
|
||
#else
|
||
color.rgb=apply_lighting(color.rgb,normal);
|
||
#ifdef FLOOD_LIGHT
|
||
color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
|
||
#endif
|
||
#endif
|
||
color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
|
||
#endif
|
||
#ifdef FOG
|
||
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}
|
||
#else
|
||
color=applyCutout(color,h);
|
||
#endif
|
||
#endif
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
if (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
#endif
|
||
glFragColor=color;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_material_table.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
in uvec2 a_centroid_pos;
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
in ivec4 a_join_normal_inside;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
|
||
#endif
|
||
#ifdef TERRAIN
|
||
uniform int u_height_type;uniform int u_base_type;
|
||
#endif
|
||
uniform highp float u_vertical_scale;
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
|
||
#endif
|
||
out vec4 v_color;out vec4 v_flat;
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
|
||
out vec4 v_roof_color;
|
||
#endif
|
||
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
out highp vec3 v_normal;
|
||
#endif
|
||
#ifdef FAUX_AO
|
||
uniform lowp vec2 u_ao;out vec2 v_ao;
|
||
#endif
|
||
#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
|
||
out float v_flood_radius;out float v_has_floodlight;
|
||
#endif
|
||
out float v_height;
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
out vec4 v_ground_roof;
|
||
#endif
|
||
#endif
|
||
vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
|
||
#pragma mapbox: define highp float base
|
||
#pragma mapbox: define highp float height
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define highp float flood_light_wall_radius
|
||
#pragma mapbox: define highp float line_width
|
||
#pragma mapbox: define highp float emissive_strength
|
||
void main() {DECLARE_MATERIAL_TABLE_INFO
|
||
#pragma mapbox: initialize highp float base
|
||
#pragma mapbox: initialize highp float height
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize highp float flood_light_wall_radius
|
||
#pragma mapbox: initialize highp float line_width
|
||
#pragma mapbox: initialize highp float emissive_strength
|
||
base*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));
|
||
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
v_normal=normal;
|
||
#endif
|
||
base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
centroid_pos=vec2(a_centroid_pos);
|
||
#endif
|
||
float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
|
||
#ifdef TERRAIN
|
||
bool 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);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? 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;
|
||
#else
|
||
h=t > 0.0 ? height : base;
|
||
#endif
|
||
pos=vec3(pos_nx.xy,h);
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
#endif
|
||
float cutoff=1.0;vec3 scaled_pos=pos;
|
||
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
vec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}
|
||
#endif
|
||
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
vec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
#ifdef CLIP_ZERO_TO_ONE
|
||
cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
|
||
#else
|
||
cutoff=cutoff_opacity(u_cutoff_params,ground.z);
|
||
#endif
|
||
if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.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);
|
||
#endif
|
||
float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
v_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;
|
||
#endif
|
||
gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos0=pos;vec3 shd_pos1=pos;
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
#endif
|
||
v_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);
|
||
#endif
|
||
float NdotL=0.0;float colorvalue=0.0;
|
||
#ifndef LIGHTING_3D_MODE
|
||
colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
|
||
(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
|
||
#endif
|
||
#ifdef FAUX_AO
|
||
float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
|
||
#ifdef TERRAIN
|
||
top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
|
||
#endif
|
||
v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
top_height+=u_height_lift;
|
||
#endif
|
||
gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
#ifdef FLOOD_LIGHT
|
||
float is_wall=1.0-float(t > 0.0 && top_up_ny_start.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;
|
||
#endif
|
||
v_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);
|
||
#else
|
||
v_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;
|
||
#endif
|
||
#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
|
||
float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=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;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
vec4 pos_ground=u_matrix*vec4(pos.xy,ele,1.0);vec4 pos_roof=u_matrix*vec4(pos.xy,ele+height,1.0);v_ground_roof=vec4(pos_ground.xy/pos_ground.w,pos_roof.xy/pos_roof.w);
|
||
#endif
|
||
#endif
|
||
}`),fillExtrusionDepth:wn("void main() {}",`#include "_prelude_terrain.vertex.glsl"
|
||
#include "_prelude_material_table.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
|
||
#ifdef TERRAIN
|
||
uniform int u_height_type;uniform int u_base_type;
|
||
#endif
|
||
in ivec4 a_pos_normal_ed;
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
in uvec2 a_centroid_pos;
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
in ivec4 a_join_normal_inside;
|
||
#endif
|
||
#pragma mapbox: define highp float base
|
||
#pragma mapbox: define highp float height
|
||
#pragma mapbox: define highp float line_width
|
||
#pragma mapbox: define highp vec4 color
|
||
void main() {DECLARE_MATERIAL_TABLE_INFO
|
||
#pragma mapbox: initialize highp float base
|
||
#pragma mapbox: initialize highp float height
|
||
#pragma mapbox: initialize highp float line_width
|
||
#pragma mapbox: initialize highp vec4 color
|
||
base*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
centroid_pos=vec2(a_centroid_pos);
|
||
#endif
|
||
vec3 pos;
|
||
#ifdef TERRAIN
|
||
bool 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);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? 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);
|
||
#else
|
||
pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;
|
||
#endif
|
||
float 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);}`),fillExtrusionPattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform vec2 u_texsize;uniform sampler2D u_image;
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
uniform float u_pattern_transition;
|
||
#endif
|
||
#ifdef FAUX_AO
|
||
uniform lowp vec2 u_ao;in vec3 v_ao;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
in vec3 v_normal;
|
||
#endif
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
uniform highp sampler3D u_lutTexture;
|
||
#endif
|
||
in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
|
||
#pragma mapbox: define highp float base
|
||
#pragma mapbox: define highp float height
|
||
#pragma mapbox: define mediump uvec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: define highp float pixel_ratio
|
||
void main() {
|
||
#pragma mapbox: initialize highp float base
|
||
#pragma mapbox: initialize highp float height
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize highp float pixel_ratio
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(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);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
out_color=applyLUT(u_lutTexture,out_color);
|
||
#endif
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(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;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
|
||
#else
|
||
out_color=out_color*v_lighting;
|
||
#endif
|
||
#ifdef FAUX_AO
|
||
float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
out_color=applyCutout(out_color,height);
|
||
#endif
|
||
glFragColor=out_color;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_material_table.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in ivec4 a_pos_normal_ed;
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
in uvec2 a_centroid_pos;
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
in ivec4 a_join_normal_inside;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
|
||
#endif
|
||
#ifdef TERRAIN
|
||
uniform int u_height_type;uniform int u_base_type;
|
||
#endif
|
||
out highp vec2 v_pos;out vec4 v_lighting;
|
||
#ifdef FAUX_AO
|
||
uniform lowp vec2 u_ao;out vec3 v_ao;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out vec3 v_normal;
|
||
#endif
|
||
#pragma mapbox: define highp float base
|
||
#pragma mapbox: define highp float height
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define mediump uvec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: define highp float pixel_ratio
|
||
#pragma mapbox: define highp float line_width
|
||
void main() {DECLARE_MATERIAL_TABLE_INFO
|
||
#pragma mapbox: initialize highp float base
|
||
#pragma mapbox: initialize highp float height
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize highp float pixel_ratio
|
||
#pragma mapbox: initialize highp float line_width
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(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_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
centroid_pos=vec2(a_centroid_pos);
|
||
#endif
|
||
float ele=0.0;float h=z;vec3 p;float c_ele;
|
||
#ifdef TERRAIN
|
||
bool 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);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? 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);
|
||
#else
|
||
p=vec3(pos_nx.xy,z);
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;
|
||
#endif
|
||
float 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
|
||
? pos_nx.xy
|
||
: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
|
||
#ifdef LIGHTING_3D_MODE
|
||
NdotL=calculate_NdotL(normal);
|
||
#else
|
||
NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
|
||
#endif
|
||
if (normal.y !=0.0) {float r=0.84;
|
||
#ifndef LIGHTING_3D_MODE
|
||
r=mix(0.7,0.98,1.0-u_lightintensity);
|
||
#endif
|
||
NdotL*=(
|
||
(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
|
||
#ifdef FAUX_AO
|
||
float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
|
||
#ifdef TERRAIN
|
||
top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
|
||
#endif
|
||
v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
top_height+=u_height_lift;
|
||
#endif
|
||
gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
v_normal=normal;
|
||
#else
|
||
v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(p);
|
||
#endif
|
||
}`),groundShadow:wn(`#include "_prelude_shadow.fragment.glsl"
|
||
precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
|
||
#ifdef FOG
|
||
in float v_fog_opacity;
|
||
#endif
|
||
void 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);
|
||
#ifdef RENDER_CUTOFF
|
||
shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
|
||
#endif
|
||
#ifdef FOG
|
||
shadow=mix(shadow,vec3(1.0),v_fog_opacity);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
shadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y);
|
||
#endif
|
||
glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
|
||
#ifdef FOG
|
||
out float v_fog_opacity;
|
||
#endif
|
||
void 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);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);
|
||
#endif
|
||
}`),fillExtrusionGroundEffect:wn(`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;
|
||
#ifdef SDF_SUBPASS
|
||
in 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);}
|
||
#ifdef FOG
|
||
in highp float v_fog;
|
||
#endif
|
||
#endif
|
||
void main() {
|
||
#ifdef CLEAR_SUBPASS
|
||
vec4 color=vec4(1.0);
|
||
#ifdef CLEAR_FROM_TEXTURE
|
||
color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
|
||
#endif
|
||
glFragColor=color;
|
||
#else
|
||
#ifdef SDF_SUBPASS
|
||
highp 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;
|
||
#ifdef FOG
|
||
fog=v_fog;
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
fog*=v_cutoff_opacity;
|
||
#endif
|
||
glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
|
||
#else
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
|
||
#else
|
||
vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
color=vec4(1.0);
|
||
#endif
|
||
glFragColor=color;
|
||
#endif
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;
|
||
#endif
|
||
}`,`#include "_prelude_fog.vertex.glsl"
|
||
in highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;
|
||
#ifdef SDF_SUBPASS
|
||
out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
|
||
#ifdef FOG
|
||
out highp float v_fog;
|
||
#endif
|
||
#endif
|
||
uniform 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;
|
||
#pragma mapbox: define highp float flood_light_ground_radius
|
||
const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
|
||
#pragma mapbox: initialize highp float flood_light_ground_radius
|
||
vec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float 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=float(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;
|
||
#ifdef SDF_SUBPASS
|
||
v_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);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
|
||
#endif
|
||
#endif
|
||
float hidden_by_landmark=0.0;
|
||
#ifdef HAS_CENTROID
|
||
hidden_by_landmark=float(a_hidden_by_landmark);
|
||
#endif
|
||
float 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));
|
||
#ifdef RENDER_CUTOFF
|
||
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
|
||
#endif
|
||
}`),hillshadePrepare:wn(`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(
|
||
(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
|
||
)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
|
||
deriv.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 ivec2 a_pos;in uvec2 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=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),hillshade:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform 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;
|
||
#ifdef LIGHTING_3D_MODE
|
||
glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
|
||
#endif
|
||
#ifdef FOG
|
||
glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
|
||
#endif
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
uniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));
|
||
#endif
|
||
}`),line:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;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;uniform bool u_emissive_in_shadows;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;in vec2 v_tile_pos;
|
||
#ifdef ELEVATED_ROADS
|
||
in highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef VARIABLE_LINE_WIDTH
|
||
in float stub_side;
|
||
#endif
|
||
#ifdef RENDER_LINE_DASH
|
||
uniform sampler2D u_dash_image;in vec2 v_tex;
|
||
#endif
|
||
#ifdef DEBUG_ELEVATION_ID
|
||
in vec3 v_elevation_id_col;
|
||
#endif
|
||
#ifdef RENDER_LINE_GRADIENT
|
||
uniform sampler2D u_gradient_image;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
in highp float v_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define lowp float floorwidth
|
||
#pragma mapbox: define mediump uvec4 dash
|
||
#pragma mapbox: define lowp float blur
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define mediump float side_z_offset
|
||
#pragma mapbox: define lowp float border_width
|
||
#pragma mapbox: define lowp vec4 border_color
|
||
#pragma mapbox: define lowp float emissive_strength
|
||
float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize lowp float floorwidth
|
||
#pragma mapbox: initialize mediump uvec4 dash
|
||
#pragma mapbox: initialize lowp float blur
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump float side_z_offset
|
||
#pragma mapbox: initialize lowp float border_width
|
||
#pragma mapbox: initialize lowp vec4 border_color
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
float dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;
|
||
#ifdef RENDER_LINE_BORDER
|
||
#ifndef VARIABLE_LINE_WIDTH
|
||
ANTIALIASING*=8.0;
|
||
#endif
|
||
#endif
|
||
#ifdef VARIABLE_LINE_WIDTH
|
||
blur=mix(blur,0.0,stub_side);
|
||
#endif
|
||
float diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);float pxStep;float delta;
|
||
#ifdef RENDER_LINE_BORDER
|
||
#ifndef VARIABLE_LINE_WIDTH
|
||
pxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;
|
||
#endif
|
||
#endif
|
||
#ifdef RENDER_LINE_DASH
|
||
float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=ANTIALIASING/(float(dash.z)+float(dash.w)/65535.0);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
|
||
#endif
|
||
highp vec4 out_color;
|
||
#ifdef RENDER_LINE_GRADIENT
|
||
out_color=texture(u_gradient_image,v_uv.xy);
|
||
#else
|
||
out_color=color;
|
||
#endif
|
||
float trim_alpha=1.0;
|
||
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
highp 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;
|
||
#ifdef RENDER_LINE_GRADIENT
|
||
gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);
|
||
#endif
|
||
highp 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;}
|
||
#endif
|
||
if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
|
||
#ifdef RENDER_LINE_BORDER
|
||
#ifndef VARIABLE_LINE_WIDTH
|
||
float edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {if (border_color.a==0.0) {
|
||
#ifndef RENDER_LINE_GRADIENT
|
||
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-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}
|
||
#else
|
||
out_color.rgb*=(0.6+0.4*alpha2);
|
||
#endif
|
||
} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}out_color*=v_width2_dilute.w;}
|
||
#endif
|
||
#endif
|
||
vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;
|
||
#ifdef ELEVATED_ROADS
|
||
out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
#else
|
||
out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
out_color*=(alpha*diluted_opacity*u_opacity_multiplier);
|
||
#ifdef INDICATOR_CUTOUT
|
||
out_color=applyCutout(out_color,v_z_offset);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
#ifdef LINE_BLEND_ADDITIVE
|
||
{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}
|
||
#else
|
||
#ifdef LINE_BLEND_MULTIPLY
|
||
glFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);
|
||
#else
|
||
glFragColor=out_color;
|
||
#endif
|
||
#endif
|
||
#ifdef DUAL_SOURCE_BLENDING
|
||
glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
|
||
#else
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
#ifdef DEBUG_ELEVATION_ID
|
||
glFragColor=vec4(v_elevation_id_col,1.0);
|
||
#endif
|
||
if (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
#define EXTRUDE_SCALE 0.015873016
|
||
in ivec2 a_pos_normal;in uvec4 a_data;
|
||
#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)
|
||
in vec4 a_z_offset_width;
|
||
#endif
|
||
#ifdef DEBUG_ELEVATION_ID
|
||
in vec3 a_elevation_id_col;
|
||
#endif
|
||
#ifdef DEBUG_ELEVATION_ID
|
||
out vec3 v_elevation_id_col;
|
||
#endif
|
||
#ifdef ELEVATION_GROUND_SCALE
|
||
in float a_elevation_ground_scale;
|
||
#endif
|
||
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
|
||
in highp vec3 a_packed;
|
||
#endif
|
||
#ifdef RENDER_LINE_DASH
|
||
in float a_linesofar;
|
||
#endif
|
||
uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_floor_width_scale;
|
||
#ifdef RENDER_LINE_CURVE
|
||
uniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;
|
||
#endif
|
||
#ifdef ELEVATED
|
||
uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
|
||
#ifdef ELEVATION_REFERENCE_SEA
|
||
return 0.0;
|
||
#else
|
||
return elevation(apos);
|
||
#endif
|
||
}
|
||
#endif
|
||
out vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;out vec2 v_tile_pos;
|
||
#ifdef ELEVATED_ROADS
|
||
out highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef VARIABLE_LINE_WIDTH
|
||
out float stub_side;
|
||
#endif
|
||
#ifdef RENDER_LINE_DASH
|
||
uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
|
||
#endif
|
||
#ifdef RENDER_LINE_GRADIENT
|
||
uniform float u_image_height;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
out highp float v_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#pragma mapbox: define highp vec4 color
|
||
#pragma mapbox: define lowp float floorwidth
|
||
#pragma mapbox: define mediump uvec4 dash
|
||
#pragma mapbox: define lowp float blur
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define mediump float gapwidth
|
||
#pragma mapbox: define lowp float offset
|
||
#pragma mapbox: define mediump float width
|
||
#pragma mapbox: define mediump float side_z_offset
|
||
#pragma mapbox: define lowp float border_width
|
||
#pragma mapbox: define lowp vec4 border_color
|
||
#pragma mapbox: define lowp float emissive_strength
|
||
#ifdef RENDER_LINE_CURVE
|
||
vec3 getCurvePoint(int index) {int row=index/3;int col=index-row*3;float x=u_curve_points_x[row][col];float y=u_curve_points_y[row][col];float z=u_curve_points_z[row][col];return vec3(x,y,z);}vec3 catmullRom(vec3 p0,vec3 p1,vec3 p2,vec3 p3,float t) {float t2=t*t;float t3=t2*t;return 0.5*(
|
||
2.0*p1+(-p0+p2)*t+(2.0*p0-5.0*p1+4.0*p2-p3)*t2+(-p0+3.0*p1-3.0*p2+p3)*t3
|
||
);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(
|
||
(-p0+p2)+(2.0*p0-5.0*p1+4.0*p2-p3)*2.0*t+(-p0+3.0*p1-3.0*p2+p3)*3.0*t2
|
||
);}struct CurveResult {vec3 point;vec2 tangent;};CurveResult calculateCurve(float line_progress) {float curve_progress=line_progress*(u_curve_point_count-1.0);float curve_progress_local=fract(curve_progress);float curve_segment=floor(curve_progress);int seg=int(curve_segment);vec3 p1=getCurvePoint(seg);vec3 p2=getCurvePoint(seg+1);float is_first_seg=step(curve_segment,0.5);vec3 p0_extrapolated=p1-(p2-p1);vec3 p0_fetched=getCurvePoint(max(seg-1,0));vec3 p0=mix(p0_fetched,p0_extrapolated,is_first_seg);int last_seg=int(u_curve_point_count)-2;float is_last_seg=step(float(last_seg)-0.5,curve_segment);vec3 p3_extrapolated=p2+(p2-p1);vec3 p3_fetched=getCurvePoint(min(seg+2,int(u_curve_point_count)-1));vec3 p3=mix(p3_fetched,p3_extrapolated,is_last_seg);vec3 point=catmullRom(p0,p1,p2,p3,curve_progress_local);vec2 tangent=catmullRomTangent(p0.xy,p1.xy,p2.xy,p3.xy,curve_progress_local)*(u_curve_point_count-1.0);CurveResult result;result.point=point;result.tangent=tangent;return result;}
|
||
#endif
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize lowp float floorwidth
|
||
#pragma mapbox: initialize mediump uvec4 dash
|
||
#pragma mapbox: initialize lowp float blur
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump float gapwidth
|
||
#pragma mapbox: initialize lowp float offset
|
||
#pragma mapbox: initialize mediump float width
|
||
#pragma mapbox: initialize mediump float side_z_offset
|
||
#pragma mapbox: initialize lowp float border_width
|
||
#pragma mapbox: initialize lowp vec4 border_color
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH
|
||
emissive_strength=a_z_offset_width.w;
|
||
#endif
|
||
float a_z_offset=u_z_offset;
|
||
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
a_z_offset+=a_z_offset_width.x;
|
||
#endif
|
||
#ifdef DEBUG_ELEVATION_ID
|
||
v_elevation_id_col=a_elevation_id_col;
|
||
#endif
|
||
highp float line_progress=0.0;
|
||
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
|
||
line_progress=a_packed[2];
|
||
#endif
|
||
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;
|
||
#ifdef RENDER_LINE_BORDER
|
||
#ifndef VARIABLE_LINE_WIDTH
|
||
ANTIALIASING*=8.0;
|
||
#endif
|
||
#endif
|
||
vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;
|
||
#ifdef RENDER_LINE_CURVE
|
||
CurveResult curve=calculateCurve(line_progress);pos=curve.point.xy*8192.0;a_extrude=length(a_extrude)*normalize(curve.tangent);a_extrude=left ? vec2(-a_extrude.y,a_extrude.x) : vec2(a_extrude.y,-a_extrude.x);a_z_offset+=curve.point.z;
|
||
#endif
|
||
gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;
|
||
#ifdef VARIABLE_LINE_WIDTH
|
||
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);if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale : 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;symmetric_outset=zero_right_width ? u_width_scale*left_width : halfwidth;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;
|
||
#else
|
||
halfwidth=(u_width_scale*width)/2.0;
|
||
#endif
|
||
float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);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;
|
||
#ifdef ELEVATED_ROADS
|
||
v_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);
|
||
#else
|
||
#ifdef ELEVATED
|
||
vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
|
||
#ifdef ELEVATION_GROUND_SCALE
|
||
scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
|
||
#endif
|
||
#ifdef CROSS_SLOPE_VERTICAL
|
||
float top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
|
||
#else
|
||
#ifdef CROSS_SLOPE_HORIZONTAL
|
||
float 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+scaled_z_offset;
|
||
#else
|
||
float 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+scaled_z_offset;
|
||
#endif
|
||
#endif
|
||
v_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_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);
|
||
#else
|
||
v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);
|
||
#endif
|
||
#endif
|
||
#ifndef ELEVATED
|
||
#ifndef VARIABLE_LINE_WIDTH
|
||
#ifndef RENDER_TO_TEXTURE
|
||
float base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else
|
||
{
|
||
#ifdef RENDER_LINE_BORDER
|
||
float border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);
|
||
#endif
|
||
}}
|
||
#endif
|
||
#endif
|
||
v_tile_pos=(v_tile_pos+extrude)/EXTENT;
|
||
#ifdef ELEVATED_ROADS
|
||
gl_Position=gl_Position+projected_extrude;
|
||
#else
|
||
gl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);
|
||
#endif
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#endif
|
||
#ifndef RENDER_TO_TEXTURE
|
||
float 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));
|
||
#else
|
||
v_gamma_scale=1.0;
|
||
#endif
|
||
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
|
||
highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];
|
||
#ifdef RENDER_LINE_GRADIENT
|
||
highp 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);
|
||
#else
|
||
v_uv=vec3(a_uv_x,0.0,line_progress);
|
||
#endif
|
||
#endif
|
||
#ifdef RENDER_LINE_DASH
|
||
vec4 dashf=vec4(dash);float totalLength=dashf.z+dashf.w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dashf.y+dashf.x+0.5)/u_texsize.y);
|
||
#endif
|
||
v_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);
|
||
#ifdef VARIABLE_LINE_WIDTH
|
||
v_width2_dilute.x=symmetric_outset;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=a_z_offset;
|
||
#endif
|
||
}`),linePattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;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;
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
uniform highp sampler3D u_lutTexture;
|
||
#endif
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
uniform float u_pattern_transition;
|
||
#endif
|
||
in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
|
||
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
in highp vec3 v_uv;
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
in highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef LINE_JOIN_NONE
|
||
in vec2 v_pattern_data;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
in highp float v_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#pragma mapbox: define mediump uvec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: define mediump float pixel_ratio
|
||
#pragma mapbox: define mediump float blur
|
||
#pragma mapbox: define mediump float opacity
|
||
#pragma mapbox: define lowp float emissive_strength
|
||
void main() {
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize mediump float pixel_ratio
|
||
#pragma mapbox: initialize mediump float blur
|
||
#pragma mapbox: initialize mediump float opacity
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(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);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
color=applyLUT(u_lutTexture,color);
|
||
#endif
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(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;
|
||
#endif
|
||
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
highp 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);}
|
||
#endif
|
||
#ifdef LINE_JOIN_NONE
|
||
highp 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);}
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
color=apply_lighting_with_emission_ground(color,emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
|
||
#ifdef ELEVATED_ROADS
|
||
color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
#else
|
||
color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#endif
|
||
#ifdef FOG
|
||
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
|
||
#endif
|
||
color*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
|
||
#ifdef INDICATOR_CUTOUT
|
||
color=applyCutout(color,v_z_offset);
|
||
#endif
|
||
glFragColor=color;
|
||
#ifdef DUAL_SOURCE_BLENDING
|
||
glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
|
||
#else
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
#define scale 0.015873016
|
||
in ivec2 a_pos_normal;in uvec4 a_data;
|
||
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
in vec4 a_z_offset_width;
|
||
#endif
|
||
#ifdef ELEVATION_GROUND_SCALE
|
||
in float a_elevation_ground_scale;
|
||
#endif
|
||
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
in highp vec3 a_packed;
|
||
#endif
|
||
in highp float a_linesofar;
|
||
#ifdef LINE_JOIN_NONE
|
||
in highp vec3 a_pattern_data;out vec2 v_pattern_data;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
out highp float v_z_offset;
|
||
#endif
|
||
uniform 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;
|
||
#ifdef ELEVATED
|
||
uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
|
||
#ifdef ELEVATION_REFERENCE_SEA
|
||
return 0.0;
|
||
#else
|
||
return elevation(apos);
|
||
#endif
|
||
}
|
||
#endif
|
||
out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
|
||
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
out highp vec3 v_uv;
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
out highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#pragma mapbox: define mediump float blur
|
||
#pragma mapbox: define mediump float opacity
|
||
#pragma mapbox: define mediump float offset
|
||
#pragma mapbox: define mediump float gapwidth
|
||
#pragma mapbox: define mediump float width
|
||
#pragma mapbox: define mediump float floorwidth
|
||
#pragma mapbox: define mediump uvec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: define mediump float pixel_ratio
|
||
#pragma mapbox: define lowp float emissive_strength
|
||
void main() {
|
||
#pragma mapbox: initialize mediump float blur
|
||
#pragma mapbox: initialize mediump float opacity
|
||
#pragma mapbox: initialize mediump float offset
|
||
#pragma mapbox: initialize mediump float gapwidth
|
||
#pragma mapbox: initialize mediump float width
|
||
#pragma mapbox: initialize mediump float floorwidth
|
||
#pragma mapbox: initialize mediump uvec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize mediump float pixel_ratio
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
float a_z_offset;
|
||
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
a_z_offset=a_z_offset_width.x;
|
||
#endif
|
||
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=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;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
|
||
#ifdef ELEVATED_ROADS
|
||
v_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;
|
||
#else
|
||
#ifdef ELEVATED
|
||
vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
|
||
#ifdef ELEVATION_GROUND_SCALE
|
||
scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
|
||
#endif
|
||
#ifdef CROSS_SLOPE_VERTICAL
|
||
float top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
|
||
#else
|
||
#ifdef CROSS_SLOPE_HORIZONTAL
|
||
float 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+scaled_z_offset;
|
||
#else
|
||
float 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+scaled_z_offset;
|
||
#endif
|
||
#endif
|
||
gl_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);
|
||
#else
|
||
gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
|
||
#endif
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#endif
|
||
#ifndef RENDER_TO_TEXTURE
|
||
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
|
||
#else
|
||
v_gamma_scale=1.0;
|
||
#endif
|
||
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
|
||
#endif
|
||
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
|
||
#ifdef LINE_JOIN_NONE
|
||
v_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/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(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);
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=a_z_offset;
|
||
#endif
|
||
}`),raster:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_raster_array.glsl"
|
||
uniform 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;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in float v_split_fade;
|
||
#endif
|
||
uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;
|
||
#ifndef RASTER_ARRAY
|
||
uniform highp sampler2D u_image0;uniform sampler2D u_image1;
|
||
#endif
|
||
#ifdef RASTER_COLOR
|
||
uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
|
||
#endif
|
||
void main() {vec4 color0,color1,color;vec2 value;
|
||
#ifdef RASTER_COLOR
|
||
#ifdef RASTER_ARRAY
|
||
#ifdef RASTER_ARRAY_LINEAR
|
||
value=mix(
|
||
raTexture2D_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
|
||
);
|
||
#else
|
||
value=mix(
|
||
raTexture2D_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
|
||
);
|
||
#endif
|
||
if (value.y > 0.0) value.x/=value.y;
|
||
#else
|
||
color=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);
|
||
#endif
|
||
color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
|
||
#else
|
||
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);
|
||
#endif
|
||
color.a*=u_opacity;
|
||
#ifdef GLOBE_POLES
|
||
color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
|
||
#endif
|
||
vec3 rgb=color.rgb;rgb=vec3(
|
||
dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
|
||
#endif
|
||
#ifdef FOG
|
||
highp 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));
|
||
#endif
|
||
glFragColor=vec4(out_color*color.a,color.a);
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
#ifdef USE_MRT1
|
||
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
uniform 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;
|
||
#ifdef ELEVATED
|
||
uniform lowp float u_zbias_factor;
|
||
#endif
|
||
#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
|
||
#ifdef GLOBE_POLES
|
||
in vec3 a_globe_pos;in vec2 a_uv;
|
||
#else
|
||
in ivec2 a_pos;in uvec2 a_texture_pos;
|
||
#endif
|
||
out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
out float v_split_fade;
|
||
#endif
|
||
void main() {vec2 uv;
|
||
#ifdef GLOBE_POLES
|
||
vec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;
|
||
#ifdef ELEVATION_REFERENCE_GROUND
|
||
ele+=elevation(uv*EXTENT);
|
||
#endif
|
||
globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
|
||
#endif
|
||
#else
|
||
vec4 world_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;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 mercatorX=mercatorXfromLng(latLng[1]);
|
||
float tiles=u_grid_matrix[0][2];if (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);}float ele=u_raster_elevation;
|
||
#ifdef ELEVATION_REFERENCE_GROUND
|
||
ele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;
|
||
#endif
|
||
vec4 merc_world_pos=vec4(0.0);
|
||
v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,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)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
|
||
#endif
|
||
#else
|
||
float ele=0.0;vec2 decodedPos=vec2(a_pos);
|
||
#ifdef ELEVATION_REFERENCE_GROUND
|
||
vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;
|
||
#else
|
||
uv=vec2(a_texture_pos)/8192.0;
|
||
#endif
|
||
world_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(decodedPos);
|
||
#endif
|
||
#endif
|
||
float w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;
|
||
#endif
|
||
v_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;
|
||
#ifdef ELEVATED
|
||
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);gl_Position.z-=(gl_Position.w*zbias);
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
v_depth=gl_Position.z;
|
||
#endif
|
||
}`),symbol:wn(`#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#define SDF_PX 8.0
|
||
#define SDF 1.0
|
||
#define ICON 0.0
|
||
uniform 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;uniform lowp float u_opacity_multiplier;
|
||
#ifdef ICON_TRANSITION
|
||
uniform float u_icon_transition;
|
||
#endif
|
||
#ifdef COLOR_ADJUSTMENT
|
||
uniform mat4 u_color_adj_mat;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
in highp float v_z_offset;
|
||
#else
|
||
#ifdef RENDER_SHADOWS
|
||
in highp float v_z_offset;
|
||
#endif
|
||
#endif
|
||
in vec2 v_tex_a;
|
||
#ifdef ICON_TRANSITION
|
||
in vec2 v_tex_b;
|
||
#endif
|
||
in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
|
||
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
in float is_sdf;in vec2 v_tex_a_icon;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
uniform highp sampler3D u_lutTexture;
|
||
#endif
|
||
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
in lowp float v_opacity;
|
||
#ifdef RENDER_SDF
|
||
in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
in lowp float v_emissive_strength;
|
||
#endif
|
||
#else
|
||
#pragma mapbox: define highp vec4 fill_color
|
||
#pragma mapbox: define highp vec4 halo_color
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define lowp float halo_width
|
||
#pragma mapbox: define lowp float halo_blur
|
||
#pragma mapbox: define lowp float emissive_strength
|
||
#endif
|
||
void main() {
|
||
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;
|
||
#ifdef RENDER_SDF
|
||
fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;
|
||
#endif
|
||
lowp float emissive_strength=0.0;
|
||
#ifdef LIGHTING_3D_MODE
|
||
emissive_strength=v_emissive_strength;
|
||
#endif
|
||
#else
|
||
#pragma mapbox: initialize highp vec4 fill_color
|
||
#pragma mapbox: initialize highp vec4 halo_color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize lowp float halo_width
|
||
#pragma mapbox: initialize lowp float halo_blur
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
#endif
|
||
vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
|
||
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
return;}
|
||
#endif
|
||
vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
#ifdef RENDER_SDF
|
||
float 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;
|
||
#else
|
||
#ifdef ICON_TRANSITION
|
||
vec4 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);
|
||
#else
|
||
out_color=texture(u_texture,v_tex_a);
|
||
#endif
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
out_color=applyLUT(u_lutTexture,out_color);
|
||
#endif
|
||
#ifdef COLOR_ADJUSTMENT
|
||
out_color=u_color_adj_mat*out_color;
|
||
#endif
|
||
#endif
|
||
out_color*=opacity*fade_opacity*u_opacity_multiplier;
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
|
||
#ifdef TERRAIN
|
||
out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
#else
|
||
out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
#endif
|
||
#endif
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
out_color=applyCutout(out_color,v_z_offset);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
glFragColor=out_color;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
#define USING_APPEARANCE 1.0
|
||
in ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;
|
||
#ifdef Z_OFFSET
|
||
in float a_auto_z_offset;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in ivec4 a_globe_anchor;in vec3 a_globe_normal;
|
||
#endif
|
||
#ifdef ICON_TRANSITION
|
||
in uvec2 a_texb;
|
||
#endif
|
||
#ifdef OCCLUSION_QUERIES
|
||
in float a_occlusion_query_opacity;
|
||
#endif
|
||
#ifdef ELEVATED_ROADS
|
||
in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
out highp float v_z_offset;
|
||
#else
|
||
#ifdef RENDER_SHADOWS
|
||
out highp float v_z_offset;
|
||
#endif
|
||
#endif
|
||
uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_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;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
|
||
#endif
|
||
out vec2 v_tex_a;
|
||
#ifdef ICON_TRANSITION
|
||
out vec2 v_tex_b;
|
||
#endif
|
||
out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
|
||
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
out float is_sdf;out vec2 v_tex_a_icon;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
#ifndef MAX_UBO_SIZE_VEC4
|
||
#define MAX_UBO_SIZE_VEC4 1024u
|
||
#endif
|
||
#define SPP_HEADER_SIZE_VEC4 3u
|
||
#define DWORDS_PER_VEC4 4u
|
||
struct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;float zoomFactor;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_fill_color_zoom_factor;uniform highp float u_spp_halo_color_zoom_factor;uniform highp float u_spp_opacity_zoom_factor;uniform highp float u_spp_halo_width_zoom_factor;uniform highp float u_spp_halo_blur_zoom_factor;uniform highp float u_spp_emissive_strength_zoom_factor;uniform highp float u_spp_occlusion_opacity_zoom_factor;uniform highp float u_spp_z_offset_zoom_factor;uniform highp float u_spp_translate_zoom_factor;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;
|
||
#ifdef RENDER_SDF
|
||
out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
out lowp float v_emissive_strength;
|
||
#endif
|
||
PropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint offsetDwords,float zoomFactor) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;type.zoomFactor=zoomFactor;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask =u_spp_header.header[0][0];uint zoomDependentMask =u_spp_header.header[0][1];header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color =getPropertyType(0u,dataDrivenMask,zoomDependentMask,u_spp_header.header[0][3],u_spp_fill_color_zoom_factor);header.halo_np_color =getPropertyType(1u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][0],u_spp_halo_color_zoom_factor);header.opacity =getPropertyType(2u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][1],u_spp_opacity_zoom_factor);header.halo_width =getPropertyType(3u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][2],u_spp_halo_width_zoom_factor);header.halo_blur =getPropertyType(4u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][3],u_spp_halo_blur_zoom_factor);header.emissive_strength=getPropertyType(5u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][0],u_spp_emissive_strength_zoom_factor);header.occlusion_opacity=getPropertyType(6u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][1],u_spp_occlusion_opacity_zoom_factor);header.z_offset =getPropertyType(7u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][2],u_spp_z_offset_zoom_factor);header.translate =getPropertyType(8u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][3],u_spp_translate_zoom_factor);return header;}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :
|
||
(index==1u) ? v.y :
|
||
(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :
|
||
(index==1u) ? v.y :
|
||
(index==2u) ? v.z : v.w;}vec4 readVec4(uint baseOffsetVec4,uint propertyOffsetDwords) {return u_spp_properties.properties[baseOffsetVec4+propertyOffsetDwords/DWORDS_PER_VEC4];}float readFloat(vec4 slot,uint propertyOffsetDwords) {return slot[propertyOffsetDwords % DWORDS_PER_VEC4];}uint readUint(uvec4 slot,uint offset) {return slot[offset % DWORDS_PER_VEC4];}vec2 readVec2(vec4 slot,uint propertyOffsetDwords) {float x=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);float y=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4+1u);return vec2(x,y);}uint getDataDrivenBlockOffsetVec4(uint dataDrivenBlockSizeVec4) {uint featureIndex=uint(a_feature_index);uvec4 slot=u_spp_index.block_indices[featureIndex/DWORDS_PER_VEC4];uint blockIndex=uvec4At(slot,featureIndex % DWORDS_PER_VEC4);return blockIndex*dataDrivenBlockSizeVec4;}vec4 readColorProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 color=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {color=unpack_mix_color(color,propertyType.zoomFactor);} else {vec2 packedColor=readVec2(color,propertyType.offsetDwords);color=decode_color(packedColor);}return color;}vec2 readVec2Property(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {return mix(slot.xy,slot.zw,propertyType.zoomFactor);}return readVec2(slot,propertyType.offsetDwords);}float readFloatProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);float value;if (propertyType.isZoomDependent) {vec2 packedValues=readVec2(slot,propertyType.offsetDwords);value=unpack_mix_vec2(packedValues,propertyType.zoomFactor);} else {value=readFloat(slot,propertyType.offsetDwords);}return value;}SymbolPaintProperties readSymbolPaintProperties() {SymbolPropertyHeader header=readSymbolPropertiesHeader();uint sizeVec4=header.dataDrivenBlockSizeVec4;SymbolPaintProperties props;props.fill_np_color =header.fill_np_color.isDataDriven ? readColorProperty(header.fill_np_color,sizeVec4) : u_spp_fill_np_color;props.halo_np_color =header.halo_np_color.isDataDriven ? readColorProperty(header.halo_np_color,sizeVec4) : u_spp_halo_np_color;props.opacity =header.opacity.isDataDriven ? readFloatProperty(header.opacity,sizeVec4) : u_spp_opacity;props.halo_width =header.halo_width.isDataDriven ? readFloatProperty(header.halo_width,sizeVec4) : u_spp_halo_width;props.halo_blur =header.halo_blur.isDataDriven ? readFloatProperty(header.halo_blur,sizeVec4) : u_spp_halo_blur;props.emissive_strength =header.emissive_strength.isDataDriven ? readFloatProperty(header.emissive_strength,sizeVec4) : u_spp_emissive_strength;props.occlusion_opacity =header.occlusion_opacity.isDataDriven ? readFloatProperty(header.occlusion_opacity,sizeVec4) : u_spp_occlusion_opacity;props.z_offset =header.z_offset.isDataDriven ? readFloatProperty(header.z_offset,sizeVec4) : u_spp_z_offset;props.translate =header.translate.isDataDriven ? readVec2Property(header.translate,sizeVec4) : vec2(0.0);return props;}
|
||
#else
|
||
#pragma mapbox: define highp vec4 fill_color
|
||
#pragma mapbox: define highp vec4 halo_color
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define lowp float halo_width
|
||
#pragma mapbox: define lowp float halo_blur
|
||
#pragma mapbox: define lowp float emissive_strength
|
||
#pragma mapbox: define lowp float occlusion_opacity
|
||
#pragma mapbox: define highp float z_offset
|
||
#endif
|
||
vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {
|
||
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;
|
||
#ifdef RENDER_SDF
|
||
v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
v_emissive_strength=paint_properties.emissive_strength;
|
||
#endif
|
||
lowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;
|
||
#else
|
||
#pragma mapbox: initialize highp vec4 fill_color
|
||
#pragma mapbox: initialize highp vec4 halo_color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize lowp float halo_width
|
||
#pragma mapbox: initialize lowp float halo_blur
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
#pragma mapbox: initialize lowp float occlusion_opacity
|
||
#pragma mapbox: initialize highp float z_offset
|
||
#endif
|
||
vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(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=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(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);
|
||
#ifdef Z_OFFSET
|
||
e+=a_auto_z_offset;
|
||
#endif
|
||
vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(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;
|
||
#else
|
||
world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
|
||
#endif
|
||
vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
|
||
camera_to_anchor_distance/u_camera_to_center_distance :
|
||
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
|
||
0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(vec3(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;
|
||
#else
|
||
offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
|
||
#endif
|
||
vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
#ifdef PROJECTED_POS_ON_VIEWPORT
|
||
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
|
||
#else
|
||
vec3 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);
|
||
#endif
|
||
#else
|
||
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
|
||
#endif
|
||
highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
|
||
#ifdef TERRAIN
|
||
#ifdef PITCH_WITH_MAP_TERRAIN
|
||
vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
|
||
#endif
|
||
#endif
|
||
#ifdef Z_OFFSET
|
||
z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
|
||
#else
|
||
z+=u_pitch_with_map ? z_offset : 0.0;
|
||
#endif
|
||
float 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));
|
||
#ifdef DEPTH_OCCLUSION
|
||
float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
|
||
#endif
|
||
#ifdef OCCLUSION_QUERIES
|
||
float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
|
||
#endif
|
||
#ifdef Z_TEST_OCCLUSION
|
||
out_fade_opacity*=occlusion_opacity;
|
||
#endif
|
||
float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
|
||
#else
|
||
#ifdef ELEVATED_ROADS
|
||
vec3 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;
|
||
#else
|
||
pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
|
||
#endif
|
||
#endif
|
||
gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);
|
||
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(
|
||
u_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y
|
||
);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}
|
||
#endif
|
||
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;
|
||
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
|
||
#endif
|
||
#ifdef ICON_TRANSITION
|
||
v_tex_b=vec2(a_texb)/u_texsize;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=e;
|
||
#else
|
||
#ifdef RENDER_SHADOWS
|
||
v_z_offset=e;
|
||
#endif
|
||
#endif
|
||
}`),terrainRaster:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform sampler2D u_image0;
|
||
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
uniform sampler2D u_image1;uniform float u_emissive_texture_available;
|
||
#endif
|
||
in vec2 v_pos0;
|
||
#ifdef FOG
|
||
in float v_fog_opacity;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
|
||
#endif
|
||
uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
|
||
#ifdef LIGHTING_3D_MODE
|
||
const vec3 normal=vec3(0.0,0.0,1.0);
|
||
#ifdef RENDER_SHADOWS
|
||
float cutoffOpacity=1.0;
|
||
#ifdef RENDER_CUTOFF
|
||
cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
|
||
#endif
|
||
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
float 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;
|
||
#else
|
||
float 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));
|
||
#endif
|
||
#else
|
||
float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
|
||
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
float 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;
|
||
#endif
|
||
#endif
|
||
#else
|
||
color=image_color;
|
||
#endif
|
||
#ifdef FOG
|
||
#ifdef ZERO_EXAGGERATION
|
||
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
|
||
#else
|
||
color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
|
||
#endif
|
||
#endif
|
||
glFragColor=color;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;
|
||
#ifdef FOG
|
||
out float v_fog_opacity;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
void 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);
|
||
#ifdef FOG
|
||
#ifdef ZERO_EXAGGERATION
|
||
v_fog_pos=fog_position(decodedPos);
|
||
#else
|
||
v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
|
||
#endif
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
|
||
#endif
|
||
}`),terrainDepth:wn("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
|
||
uniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:wn(`#include "_prelude_fog.fragment.glsl"
|
||
in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
|
||
cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
|
||
#ifdef FOG
|
||
sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
|
||
#endif
|
||
sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
}`,wf),skyboxGradient:wn(`#include "_prelude_fog.fragment.glsl"
|
||
in 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));
|
||
#ifdef FOG
|
||
color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
|
||
#endif
|
||
color*=u_opacity;glFragColor=color;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
}`,wf),skyboxCapture:wn(`
|
||
in 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;
|
||
#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)
|
||
#define BETA_M vec3(21e-6,21e-6,21e-6)
|
||
#define MIE_G 0.76
|
||
#define DENSITY_HEIGHT_SCALE_R 8000.0
|
||
#define DENSITY_HEIGHT_SCALE_M 1200.0
|
||
#define PLANET_RADIUS 6360e3
|
||
#define ATMOSPHERE_RADIUS 6420e3
|
||
#define SAMPLE_STEPS 10
|
||
#define DENSITY_STEPS 4
|
||
float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;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);}"),globeRaster:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform sampler2D u_image0;
|
||
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
uniform sampler2D u_image1;uniform float u_emissive_texture_available;
|
||
#endif
|
||
uniform float u_far_z_cutoff;in vec2 v_pos0;
|
||
#ifndef FOG
|
||
uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
|
||
#endif
|
||
void main() {vec4 color;
|
||
#ifdef CUSTOM_ANTIALIASING
|
||
highp vec2 uv=gl_FragCoord.xy/u_viewport;
|
||
#ifdef FLIP_Y
|
||
uv.y=1.0-uv.y;
|
||
#endif
|
||
highp vec3 ray_dir=mix(
|
||
mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float 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);
|
||
#ifdef LIGHTING_3D_MODE
|
||
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
float 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);
|
||
#else
|
||
raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
|
||
#endif
|
||
#else
|
||
color=vec4(raster.rgb*antialias,raster.a*antialias);
|
||
#endif
|
||
#else
|
||
color=texture(u_image0,v_pos0);
|
||
#ifdef LIGHTING_3D_MODE
|
||
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
float 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;
|
||
#else
|
||
color=apply_lighting_ground(color);
|
||
#endif
|
||
#endif
|
||
#endif
|
||
#ifdef FOG
|
||
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
|
||
#endif
|
||
color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_terrain.vertex.glsl"
|
||
uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
|
||
#ifdef GLOBE_POLES
|
||
in vec3 a_globe_pos;in vec2 a_uv;
|
||
#else
|
||
in ivec2 a_pos;
|
||
#endif
|
||
out vec2 v_pos0;void main() {
|
||
#ifdef GLOBE_POLES
|
||
vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
|
||
#else
|
||
float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
|
||
#endif
|
||
v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
|
||
#ifdef GLOBE_POLES
|
||
vec3 up_vector=globe_derived_up_vector;
|
||
#else
|
||
vec3 up_vector=elevationVector(tile_pos);
|
||
#endif
|
||
float height=elevation(tile_pos);globe_pos+=up_vector*height;
|
||
#ifndef GLOBE_POLES
|
||
globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
|
||
#endif
|
||
#ifdef GLOBE_POLES
|
||
vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
|
||
#else
|
||
vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
|
||
#endif
|
||
gl_Position=u_proj_matrix*interpolated_pos;
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
|
||
#endif
|
||
}`),globeAtmosphere:wn(`#include "_prelude_fog.fragment.glsl"
|
||
uniform 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;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
|
||
#ifdef ALPHA_PASS
|
||
glFragColor=vec4(0,0,0,0);return;
|
||
#else
|
||
#ifdef NATIVE
|
||
glFragColor=vec4(1,1,1,1);
|
||
#else
|
||
glFragColor=vec4(0,0,0,1);
|
||
#endif
|
||
return;
|
||
#endif
|
||
}
|
||
#endif
|
||
highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
|
||
0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
highp 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 ?
|
||
PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
|
||
#else
|
||
horizon_angle=horizon_angle_mercator;
|
||
#endif
|
||
horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_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;vec3 color_stop_2=u_space_color.rgb;
|
||
#ifdef ALPHA_PASS
|
||
float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
|
||
#else
|
||
vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);
|
||
#endif
|
||
}`,`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(
|
||
mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
|
||
mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),stars:wn(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
|
||
{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;}`,`
|
||
in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_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_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);}`),occlusion:wn("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
|
||
in 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;
|
||
#ifdef TERRAIN
|
||
float e=elevation(world_pos.xy);world_pos.z+=e;
|
||
#endif
|
||
vec4 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 Oc(u,r){const a=u.split(`
|
||
`);for(let f of a){if(f=f.trimStart(),f[0]!=="#"||!f.includes("if")||f.startsWith("#endif"))continue;const _=f.match(by);if(_)for(const x of _)y2.has(x)||r.add(x)}}function Fc(u){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(u)}function wn(u,r){const a=new Set,f=[],_=[];u=u.replace(vy,(w,k)=>(_.push(k),"")),r=r.replace(vy,(w,k)=>(f.push(k),""));let x=new Set(vm);Oc(u,x),Oc(r,x);for(const w of[...f,..._])xm[w]||(xm[w]=new Set,Oc(Tf[w],xm[w])),x=new Set([...x,...xm[w]]);return{fragmentSource:u=u.replace(xy,(w,k,A,P,D)=>(a.add(D),k==="define"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
${Fc(P)?"flat ":""}in ${A} ${P} ${D};
|
||
#else
|
||
uniform ${A} ${P} u_${D};
|
||
#endif
|
||
`:k==="initialize"?`
|
||
#ifdef HAS_UNIFORM_u_${D}
|
||
${A} ${P} ${D} = u_${D};
|
||
#endif
|
||
`:k==="define-attribute"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
in ${A} ${P} ${D};
|
||
#endif
|
||
`:k==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(xy,(w,k,A,P,D)=>{const z=`MATERIAL_ATTRIBUTE_OFFSET_${D}`,F=P==="float"?"vec2":P,j=`GET_ATTRIBUTE_${F}(a_${D}, materialInfo, ${z})`,$=D.includes("color")?"color":F;return k==="define-attribute-vertex-shader-only"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
in ${A} ${P} a_${D};
|
||
#endif
|
||
`:a.has(D)?k==="define"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
uniform lowp float u_${D}_t;
|
||
#if !defined(${z})
|
||
in ${A} ${F} a_${D};
|
||
#endif
|
||
${Fc(P)?"flat ":""}out ${A} ${P} ${D};
|
||
#else
|
||
uniform ${A} ${P} u_${D};
|
||
#endif
|
||
`:k==="initialize"?$==="vec4"||$==="uvec4"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
${D} = a_${D};
|
||
#else
|
||
${A} ${P} ${D} = u_${D};
|
||
#endif
|
||
`:`
|
||
#if !defined(HAS_UNIFORM_u_${D})
|
||
#ifdef ${z}
|
||
${D} = unpack_mix_${$}(${j}, u_${D}_t);
|
||
#else
|
||
${D} = unpack_mix_${$}(a_${D}, u_${D}_t);
|
||
#endif
|
||
#else
|
||
${A} ${P} ${D} = u_${D};
|
||
#endif
|
||
`:k==="define-attribute"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
in ${A} ${P} a_${D};
|
||
out ${A} ${P} ${D};
|
||
#endif
|
||
`:k==="initialize-attribute"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
${D} = a_${D};
|
||
#endif
|
||
`:void 0:k==="define"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
uniform lowp float u_${D}_t;
|
||
#if !defined(${z})
|
||
in ${A} ${F} a_${D};
|
||
#endif
|
||
#else
|
||
uniform ${A} ${P} u_${D};
|
||
#endif
|
||
`:k==="define-instanced"?$==="mat4"?`
|
||
#ifdef INSTANCED_ARRAYS
|
||
in vec4 a_${D}0;
|
||
in vec4 a_${D}1;
|
||
in vec4 a_${D}2;
|
||
in vec4 a_${D}3;
|
||
#else
|
||
uniform ${A} ${P} u_${D};
|
||
#endif
|
||
`:`
|
||
#ifdef INSTANCED_ARRAYS
|
||
in ${A} ${F} a_${D};
|
||
#else
|
||
uniform ${A} ${P} u_${D};
|
||
#endif
|
||
`:k==="initialize-attribute-custom"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
${A} ${P} ${D} = a_${D};
|
||
#endif
|
||
`:$==="vec4"||$==="uvec4"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
#ifdef ${z}
|
||
${A} ${P} ${D} = ${j};
|
||
#else
|
||
${A} ${P} ${D} = a_${D};
|
||
#endif
|
||
#else
|
||
${A} ${P} ${D} = u_${D};
|
||
#endif
|
||
`:`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
#ifdef ${z}
|
||
${A} ${P} ${D} = unpack_mix_${$}(${j}, u_${D}_t);
|
||
#else
|
||
${A} ${P} ${D} = unpack_mix_${$}(a_${D}, u_${D}_t);
|
||
#endif
|
||
#else
|
||
${A} ${P} ${D} = u_${D};
|
||
#endif
|
||
`}),usedDefines:x,vertexIncludes:f,fragmentIncludes:_}}Tf["_prelude_raster_particle.glsl"]||(Tf["_prelude_raster_particle.glsl"]=bf);var Dd={building:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
const 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;
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
in float v_front_cutoff_opacity;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
in vec4 v_ground_roof;
|
||
#endif
|
||
#endif
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
in 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;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
|
||
#endif
|
||
#ifdef FLOOD_LIGHT
|
||
in highp float v_flood_radius;in float v_has_flood_light;
|
||
#endif
|
||
uniform 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));}
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
highp float hash12(in highp vec2 p) {highp 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);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp 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;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp 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;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp 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 highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp 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;
|
||
#if 0
|
||
if (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;
|
||
#else
|
||
if (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;
|
||
#endif
|
||
return out_color;}
|
||
#endif
|
||
vec3 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;
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
if (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp 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);}
|
||
#endif
|
||
vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
|
||
#ifdef RENDER_SHADOWS
|
||
#ifdef RENDER_CUTOFF
|
||
shadowed_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;}
|
||
#else
|
||
shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
|
||
#endif
|
||
#else
|
||
shadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));
|
||
#endif
|
||
color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
|
||
#ifdef FLOOD_LIGHT
|
||
float 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);
|
||
#endif
|
||
color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
|
||
#ifdef FOG
|
||
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
|
||
#endif
|
||
color*=u_opacity;
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}
|
||
#else
|
||
color=applyCutout(color,v_pos.z);
|
||
#endif
|
||
#endif
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
if (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
#endif
|
||
glFragColor=color;
|
||
#ifdef DEBUG_SHOW_NORMALS
|
||
color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
|
||
#endif
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
in vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;
|
||
#ifdef FLOOD_LIGHT
|
||
in int a_flood_light_wall_radius_1i16;
|
||
#endif
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
in uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;
|
||
#endif
|
||
uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
out vec4 v_ground_roof;
|
||
#endif
|
||
#endif
|
||
out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
out 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;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#ifdef FLOOD_LIGHT
|
||
out highp float v_flood_radius;out float v_has_flood_light;
|
||
#endif
|
||
const 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));}
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
mat3 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);}
|
||
#endif
|
||
#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
|
||
#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive
|
||
void main() {
|
||
#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
|
||
#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive
|
||
#ifdef FLOOD_LIGHT
|
||
v_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);
|
||
#endif
|
||
vec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(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;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3);
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
vec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=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=(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=(vec2(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(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;}
|
||
#endif
|
||
v_pos=a_pos_3f;
|
||
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
float halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;
|
||
#endif
|
||
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
vec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shadow_pos=v_pos;
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
|
||
#endif
|
||
v_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);
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(v_pos);
|
||
#endif
|
||
#ifdef RENDER_FRONT_CUTOFF
|
||
v_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}
|
||
#endif
|
||
gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;
|
||
#ifdef INDICATOR_CUTOUT
|
||
#ifdef FEATURE_CUTOUT
|
||
vec4 ic_ground=u_matrix*vec4(v_pos.xy,0.0,1.0);vec4 ic_roof=u_matrix*vec4(v_pos.xy,v_pos.z,1.0);v_ground_roof=vec4(ic_ground.xy/ic_ground.w,ic_roof.xy/ic_roof.w);
|
||
#endif
|
||
#endif
|
||
}`),buildingBloom:wn(`in vec4 v_color_emissive;
|
||
#pragma mapbox: define-attribute highp vec4 bloom_attenuation
|
||
#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
|
||
float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
|
||
#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
|
||
float 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));opacity*=saturate(1.0-distance*distance);
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
opacity*=v_cutoff_opacity;
|
||
#endif
|
||
glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
|
||
#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
|
||
#pragma mapbox: define-attribute highp vec4 bloom_attenuation
|
||
out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
|
||
#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
|
||
#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
|
||
#ifdef HAS_ATTRIBUTE_a_part_color_emissive
|
||
vec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
|
||
#else
|
||
v_color_emissive=vec4(1.0);
|
||
#endif
|
||
gl_Position=u_matrix*vec4(a_pos_3f,1.0);
|
||
#ifdef RENDER_CUTOFF
|
||
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
|
||
#endif
|
||
}`),buildingDepth:wn("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform 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;
|
||
#ifdef LIGHTING_3D_MODE
|
||
out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
|
||
#endif
|
||
#ifdef FOG
|
||
highp 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));
|
||
#endif
|
||
glFragColor=vec4(out_color*color.a,color.a);
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
uniform 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;
|
||
#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
|
||
in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
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 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;
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
|
||
#endif
|
||
#else
|
||
uv=vec2(a_texture_pos)/8192.0;gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));
|
||
#endif
|
||
#endif
|
||
v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:wn("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"
|
||
in int 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(
|
||
mod(float(a_index),u_particle_texture_side_len),float(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:wn("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 ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:wn(`#include "_prelude_raster_particle.glsl"
|
||
uniform 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;vec2 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(
|
||
linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
|
||
);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 ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),snowParticle:wn("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;}",`
|
||
in 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;
|
||
uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius;
|
||
uniform float u_horizontalOscillationRate;
|
||
uniform 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+
|
||
localY*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:wn("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;}",`
|
||
in 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;
|
||
uniform float u_velocity;
|
||
uniform 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;pos*=halfBoxSize;
|
||
pos+=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+
|
||
localY*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:wn("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);}"),elevatedStructuresDepth:wn("void main() {}","in ivec2 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;}"),elevatedStructures:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
in vec3 v_normal;in float v_height;
|
||
#ifdef RENDER_SHADOWS
|
||
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
|
||
#endif
|
||
vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
|
||
{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;uniform float u_opacity_multiplier;
|
||
#pragma mapbox: define highp vec4 structure_color
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 structure_color
|
||
vec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);
|
||
#ifdef FEATURE_CUTOUT
|
||
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
#endif
|
||
#ifdef LIGHTING_3D_MODE
|
||
vec3 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);
|
||
#ifdef RENDER_SHADOWS
|
||
float light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light);
|
||
#else
|
||
color=apply_lighting(color,transformed_normal);
|
||
#endif
|
||
color=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);}
|
||
#endif
|
||
#ifdef FOG
|
||
color=fog_apply(color,v_fog_pos);
|
||
#endif
|
||
vec4 out_color=vec4(color,1.0);
|
||
#ifdef INDICATOR_CUTOUT
|
||
out_color=applyCutout(out_color,v_height);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
#endif
|
||
out_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
in ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
#pragma mapbox: define highp vec4 structure_color
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 structure_color
|
||
v_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1);
|
||
#ifdef RENDER_SHADOWS
|
||
vec3 shd_pos0=pos;vec3 shd_pos1=pos;
|
||
#ifdef NORMAL_OFFSET
|
||
vec3 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();
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(vec2(a_pos));
|
||
#endif
|
||
}`),elevatedStructuresDepthReconstruct:wn(`#ifdef DEPTH_RECONSTRUCTION
|
||
in float v_height;
|
||
#endif
|
||
void main() {
|
||
#ifdef DEPTH_RECONSTRUCTION
|
||
if (v_height >=0.0)
|
||
discard;
|
||
#else
|
||
#ifdef FEATURE_CUTOUT
|
||
apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
#endif
|
||
#endif
|
||
glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in ivec2 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;
|
||
#ifdef DEPTH_RECONSTRUCTION
|
||
out float v_height;
|
||
#endif
|
||
void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
|
||
#ifdef DEPTH_RECONSTRUCTION
|
||
if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
|
||
#endif
|
||
gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`)};wn(bf,"");const Tl=c.b_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),yb=c.b_([{type:"Float32",name:"a_pos_2f",components:2}]);class Ty{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(r,a){const f=r.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const w=new c.aO,k=new c.aT;w.emplaceBack(-1,-1),w.emplaceBack(1,-1),w.emplaceBack(1,1),w.emplaceBack(-1,1),k.emplaceBack(0,1,2),k.emplaceBack(0,2,3),this.vignetteVx=r.context.createVertexBuffer(w,yb.members),this.vignetteIdx=r.context.createIndexBuffer(k)}const _=c.aJ.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,f);const w={u_vignetteShape:(x={vignetteShape:[a.start,a.range,Math.pow(10,a.fadePower)],vignetteColor:[a.color.r,a.color.g,a.color.b,a.color.a*a.strength]}).vignetteShape,u_vignetteColor:x.vignetteColor};f.draw(r,r.context.gl.TRIANGLES,Vt.disabled,rn.disabled,tn.alphaBlended,Ut.disabled,w,"vignette",this.vignetteVx,this.vignetteIdx,_)}var x}}class vb{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(r,a){const f=r.getFreeCameraOptions().position,_=f.toAltitude(),x=f.toLngLat(),w=c.c4(x.lng),k=c.c4(x.lat),A=r.pixelsPerMeter/a,P=w*c.c9,D=c.c9*Math.log(Math.tan(Math.PI/4+k/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 z=-this._offsetYPrev+D,F=-this._elevationPrev+_;this._accumulatedOffsetX+=(-this._offsetXPrev+P)*A,this._accumulatedOffsetY+=z*A,this._accumulatedElevation+=F*A,this._offsetXPrev=P,this._offsetYPrev=D,this._elevationPrev=_}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Lu(u,r){return[-(u[0]-Math.floor(u[0]/r)*r),-(u[1]-Math.floor(u[1]/r)*r),-(u[2]-Math.floor(u[2]/r)*r)]}function kf(u){const r=c.eq(1323123451230),a=[];for(let f=0;f<u;++f){const _=2*r()-1,x=2*r()-1,w=2*r()-1;a.push(c.cx(_,x,w))}return a}function Wa(u,r,a,f,_){const x=c.bG((_-a)/(f-a),0,1);return c.dY(u,r,x)}class wm{constructor(r){this._movement=new vb,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Ty,this._ppmScaleFactor=r}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(r,a){const f=r.transform;this._movement.update(f,this._ppmScaleFactor);const _=f.starsProjMatrix,x=c.dp([]);c.f2(x,x,c.c4(90)-f._pitch),c.f5(x,x,-f.angle);const w=c.ct(new Float32Array(16),x),k=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),A=c.fR([],k),P=c.er([],A,w),D=Date.now()/1e3;return this._accumulatedTimeFromStart+=(D-this._prevTime)*a,this._prevTime=D,{projectionMatrix:_,modelviewMatrix:P}}}const Sm=c.b_([{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}]),Af=(u,r)=>({u_matrix:u,u_depth_bias:r}),xb=(u,r)=>({u_matrix:u,u_ground_shadow_factor:r,u_opacity_multiplier:1}),Cf=(u,r,a,f,_)=>({u_matrix:u,u_camera_pos:[r[0],r[1],r[2]],u_depth_bias:a,u_height_scale:f,u_reset_depth:_}),bb={building:u=>({u_matrix:new c.bb(u),u_normal_matrix:new c.bb(u),u_opacity:new c.b4(u),u_faux_facade_ao_intensity:new c.b4(u),u_camera_pos:new c.b7(u),u_tile_to_meter:new c.b4(u),u_facade_emissive_chance:new c.b4(u),u_flood_light_color:new c.b7(u),u_flood_light_intensity:new c.b4(u),u_front_cutoff_params:new c.b7(u)}),buildingBloom:u=>({u_matrix:new c.bb(u)}),buildingDepth:u=>({u_matrix:new c.bb(u)}),elevatedStructuresDepth:u=>({u_matrix:new c.bb(u),u_depth_bias:new c.b4(u)}),elevatedStructures:u=>({u_matrix:new c.bb(u),u_ground_shadow_factor:new c.b7(u),u_opacity_multiplier:new c.b4(u)}),elevatedStructuresDepthReconstruct:u=>({u_matrix:new c.bb(u),u_camera_pos:new c.b7(u),u_depth_bias:new c.b4(u),u_height_scale:new c.b4(u),u_reset_depth:new c.b4(u)}),rasterParticle:u=>({u_matrix:new c.bb(u),u_normalize_matrix:new c.bb(u),u_globe_matrix:new c.bb(u),u_merc_matrix:new c.bb(u),u_grid_matrix:new c.ba(u),u_tl_parent:new c.b6(u),u_scale_parent:new c.b4(u),u_fade_t:new c.b4(u),u_opacity:new c.b4(u),u_image0:new c.b5(u),u_image1:new c.b5(u),u_raster_elevation:new c.b4(u),u_zoom_transition:new c.b4(u),u_merc_center:new c.b6(u),u_cutoff_params:new c.b8(u)}),rasterParticleTexture:u=>({u_texture:new c.b5(u),u_opacity:new c.b4(u)}),rasterParticleDraw:u=>({u_particle_texture:new c.b5(u),u_particle_texture_side_len:new c.b4(u),u_tile_offset:new c.b6(u),u_velocity:new c.b5(u),u_color_ramp:new c.b5(u),u_velocity_res:new c.b6(u),u_max_speed:new c.b4(u),u_uv_offset:new c.b6(u),u_data_scale:new c.b6(u),u_data_offset:new c.b4(u),u_particle_pos_scale:new c.b4(u),u_particle_pos_offset:new c.b6(u)}),rasterParticleUpdate:u=>({u_particle_texture:new c.b5(u),u_particle_texture_side_len:new c.b4(u),u_velocity:new c.b5(u),u_velocity_res:new c.b6(u),u_max_speed:new c.b4(u),u_speed_factor:new c.b4(u),u_reset_rate:new c.b4(u),u_rand_seed:new c.b4(u),u_uv_offset:new c.b6(u),u_data_scale:new c.b6(u),u_data_offset:new c.b4(u),u_particle_pos_scale:new c.b4(u),u_particle_pos_offset:new c.b6(u)}),snowParticle:u=>({u_modelview:new c.bb(u),u_projection:new c.bb(u),u_time:new c.b4(u),u_cam_pos:new c.b7(u),u_velocityConeAperture:new c.b4(u),u_velocity:new c.b4(u),u_horizontalOscillationRadius:new c.b4(u),u_horizontalOscillationRate:new c.b4(u),u_boxSize:new c.b4(u),u_billboardSize:new c.b4(u),u_simpleShapeParameters:new c.b6(u),u_screenSize:new c.b6(u),u_thinningCenterPos:new c.b6(u),u_thinningShape:new c.b7(u),u_thinningAffectedRatio:new c.b4(u),u_thinningParticleOffset:new c.b4(u),u_particleColor:new c.b8(u),u_direction:new c.b7(u)}),rainParticle:u=>({u_modelview:new c.bb(u),u_projection:new c.bb(u),u_time:new c.b4(u),u_cam_pos:new c.b7(u),u_texScreen:new c.b5(u),u_velocityConeAperture:new c.b4(u),u_velocity:new c.b4(u),u_boxSize:new c.b4(u),u_rainDropletSize:new c.b6(u),u_distortionStrength:new c.b4(u),u_rainDirection:new c.b7(u),u_color:new c.b8(u),u_screenSize:new c.b6(u),u_thinningCenterPos:new c.b6(u),u_thinningShape:new c.b7(u),u_thinningAffectedRatio:new c.b4(u),u_thinningParticleOffset:new c.b4(u),u_shapeDirectionalPower:new c.b4(u),u_shapeNormalPower:new c.b4(u),u_mode:new c.b4(u)}),vignette:u=>({u_vignetteShape:new c.b7(u),u_vignetteColor:new c.b8(u)})};function Ou(u,r){const a=1<<u.canonical.z,f=(r.x*a-u.canonical.x-u.wrap*a)*c.r,_=(r.y*a-u.canonical.y)*c.r,x=c.bn(r.z,r.y);return c.cx(f,_,x)}function wb(u){let r=0;for(const a of u)r|=a.frcMask;return r}class Sb{constructor(r=[]){this.tiles=r}getTile(r){for(const a of this.tiles)if(a.tileId.z===r.z&&a.tileId.x===r.x&&a.tileId.y===r.y)return a;return null}getTileOrParent(r){for(let a=r.z;a>0;--a){const f=Math.floor(r.x/(1<<r.z-a)),_=Math.floor(r.y/(1<<r.z-a));for(const x of this.tiles)if(x.tileId.z===a&&x.tileId.x===f&&x.tileId.y===_&&x.frcMask!==0)return x}return null}getFullCoverageMask(r){let a=null,f=0;for(let z=r.z;z>0;--z){const F=Math.floor(r.x/(1<<r.z-z)),j=Math.floor(r.y/(1<<r.z-z));for(const $ of this.tiles)if($.tileId.z===z&&$.tileId.x===F&&$.tileId.y===j){a=$,f=z;break}if(a)break}if(!a||a.frcMask===0)return null;const _=1<<r.z-f,x=c.r/_,w=r.x%_*x,k=r.y%_*x,A=w+x,P=k+x;let D=0;for(const z of a.polygons)z.frcMask!==0&&(z.hasGeometry()?z.rings.length===0||r.z<=f||v2(z.rings,w,k,A,P)&&(D|=z.frcMask):D|=z.frcMask);return D!==0?D:null}equals(r){if(this.tiles.length!==r.length)return!1;for(let a=0;a<this.tiles.length;++a){const f=this.tiles[a],_=r[a];if(f.tileId.z!==_.tileId.z||f.tileId.x!==_.tileId.x||f.tileId.y!==_.tileId.y||f.frcMask!==_.frcMask||f.polygons.length!==_.polygons.length)return!1}return!0}empty(){return this.tiles.length===0}}function v2(u,r,a,f,_){const x=[0,0,0,0],w=[r,f,f,r],k=[a,a,_,_];for(const A of u){const P=A.length;if(!(P<2))for(let D=0,z=P-1;D<P;z=D++){const F=A[z].x,j=A[z].y,$=A[D].x,W=A[D].y;for(let ce=0;ce<4;++ce)j>k[ce]!=W>k[ce]&&w[ce]<F+($-F)*(k[ce]-j)/(W-j)&&x[ce]++;let J=0,Q=0;if(F<r?J|=1:F>f&&(J|=2),j<a?J|=4:j>_&&(J|=8),$<r?Q|=1:$>f&&(Q|=2),W<a?Q|=4:W>_&&(Q|=8),!(J&Q)&&(J===0||Q===0||x2(F,j,$,W,r,a,f,_)))return!1}}for(let A=0;A<4;++A)if(!(1&x[A]))return!1;return!0}function x2(u,r,a,f,_,x,w,k){const A=(P,D,z,F,j,$,W,J)=>{const Q=(z-P)*($-D)-(F-D)*(j-P),ce=(z-P)*(J-D)-(F-D)*(W-P);if(Q>0&&ce>0||Q<0&&ce<0)return!1;const fe=(W-j)*(D-$)-(J-$)*(P-j),se=(W-j)*(F-$)-(J-$)*(z-j);return!(fe>0&&se>0||fe<0&&se<0)};return!!(A(u,r,a,f,_,x,w,x)||A(u,r,a,f,w,x,w,k)||A(u,r,a,f,_,k,w,k)||A(u,r,a,f,_,x,_,k))}class Ey{constructor(){this._tileCoverages=[],this._snapshot=new Sb}clear(){this._tileCoverages=[]}addTileCoverage(r,a){this._tileCoverages.push({tileId:r,polygons:a,frcMask:wb(a)})}empty(){return this._tileCoverages.length===0}updateSnapshotIfNeeded(){if(this._snapshot.equals(this._tileCoverages))return this._snapshot;const r=this._tileCoverages.map(a=>({tileId:a.tileId,polygons:a.polygons,frcMask:a.frcMask}));return this._snapshot=new Sb(r),this._snapshot}}class ky{constructor(r,a){this.max=r,this.onRemove=a,this.reset()}reset(){for(const r in this.data)for(const a of this.data[r])a.timeout&&clearTimeout(a.timeout),this.onRemove(a.value);return this.data={},this.order=[],this}add(r,a,f){const _=r.wrapped().key;this.data[_]===void 0&&(this.data[_]=[]);const x={value:a,timeout:void 0};if(f!==void 0&&(x.timeout=setTimeout(()=>{this.remove(r,x)},f)),this.data[_].push(x),this.order.push(_),this.order.length>this.max){const w=this._getAndRemoveByKey(this.order[0]);w&&this.onRemove(w)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const a=this.data[r].shift();return a.timeout&&clearTimeout(a.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),a.value}getByKey(r){const a=this.data[r];return a?a[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,a){if(!this.has(r))return this;const f=r.wrapped().key,_=a===void 0?0:this.data[f].indexOf(a),x=this.data[f][_];return this.data[f].splice(_,1),x.timeout&&clearTimeout(x.timeout),this.data[f].length===0&&delete this.data[f],this.onRemove(x.value),this.order.splice(this.order.indexOf(f),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(r){const a=[];for(const f in this.data)for(const _ of this.data[f])r(_.value)||a.push(_);for(const f of a)this.remove(f.value.tileID,f)}}class Ay{constructor(){this.state=Object.create(null),this.stateChanges=Object.create(null),this.deletedStates=Object.create(null)}updateState(r,a,f){const _=String(a);if(this.stateChanges[r]=this.stateChanges[r]||Object.create(null),this.stateChanges[r][_]=this.stateChanges[r][_]||Object.create(null),Object.assign(this.stateChanges[r][_],f),this.deletedStates[r]===null){this.deletedStates[r]=Object.create(null);for(const x in this.state[r])x!==_&&(this.deletedStates[r][x]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][_]===null){this.deletedStates[r][_]=Object.create(null);for(const x in this.state[r][_])f[x]||(this.deletedStates[r][_][x]=null)}else for(const x in f)this.deletedStates[r]&&this.deletedStates[r][_]&&this.deletedStates[r][_][x]===null&&delete this.deletedStates[r][_][x]}removeFeatureState(r,a,f){if(this.deletedStates[r]===null)return;const _=String(a);if(this.deletedStates[r]=this.deletedStates[r]||Object.create(null),f&&a!==void 0)this.deletedStates[r][_]!==null&&(this.deletedStates[r][_]=this.deletedStates[r][_]||Object.create(null),this.deletedStates[r][_][f]=null);else if(a!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][_])for(f in this.deletedStates[r][_]=Object.create(null),this.stateChanges[r][_])this.deletedStates[r][_][f]=null;else this.deletedStates[r][_]=null;else this.deletedStates[r]=null}getState(r,a){const f=this.state[r]||Object.create(null),_=this.stateChanges[r]||Object.create(null),x=this.deletedStates[r];if(x===null)return Object.create(null);if(a!==void 0){const k=String(a),A=Object.assign(Object.create(null),f[k],_[k]);if(x){const P=x[a];if(P===null)return Object.create(null);for(const D in P)delete A[D]}return A}const w=Object.assign(Object.create(null),f,_);if(x)for(const k in x)delete w[k];return w}initializeTileState(r,a){r.refreshFeatureState(a)}coalesceChanges(r,a){const f=Object.create(null);for(const _ in this.stateChanges){this.state[_]=this.state[_]||Object.create(null);const x=Object.create(null);for(const w in this.stateChanges[_])this.state[_][w]||(this.state[_][w]=Object.create(null)),Object.assign(this.state[_][w],this.stateChanges[_][w]),x[w]=this.state[_][w];f[_]=x}for(const _ in this.deletedStates){this.state[_]=this.state[_]||Object.create(null);const x=Object.create(null);if(this.deletedStates[_]===null)for(const w in this.state[_])x[w]=Object.create(null),this.state[_][w]=Object.create(null);else for(const w in this.deletedStates[_]){if(this.deletedStates[_][w]===null)this.state[_][w]=Object.create(null);else if(this.state[_][w])for(const k of Object.keys(this.deletedStates[_][w]))delete this.state[_][w][k];x[w]=this.state[_][w]}f[_]=f[_]||Object.create(null),Object.assign(f[_],x)}if(this.stateChanges=Object.create(null),this.deletedStates=Object.create(null),Object.keys(f).length!==0)for(const _ in r)r[_].refreshFeatureState(a,f)}}class Rs extends c.y{constructor(r,a,f){super(),this.id=r,this._renderSourceType=f,this._maxzoomOverride=null,a.on("data",_=>{_.dataType==="source"&&_.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&_.dataType==="source"&&_.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),a.on("error",()=>{this._sourceErrored=!0}),this._source=a,this._tiles={},this._cache=new ky(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=a.minTileCacheSize,this._maxTileCacheSize=a.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Ay,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&"_dataType"in this._source&&this._source._dataType==="raster",this._supportsFading=this._source.type==="raster"||this._source.type==="raster-array"||this._source.type==="image"||this._source.type==="video"||this._source.type==="custom",this._isRasterElevatedOverTerrain=!1}onAdd(r){this.map=r,this._minTileCacheSize=this._minTileCacheSize===void 0&&r?r._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&r?r._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const r in this._tiles)if(!this._tiles[r].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(r){this._maxzoomOverride=r}_loadTile(r,a){return r.renderSourceType=this._renderSourceType,r.isExtraShadowCaster=this._shadowCasterTiles[r.tileID.key],this._source.loadTile(r,a)}_unloadTile(r){if(this._source.unloadTile)return this._source.unloadTile(r)}_abortTile(r){if(this._source.abortTile)return this._source.abortTile(r)}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const a in this._tiles){const f=this._tiles[a];f.upload(r,this.map?this.map.painter:void 0),f.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(Cy).map(r=>r.key)}getRenderableIds(r,a){const f=[];for(const _ in this._tiles)this._isIdRenderable(+_,r,a)&&f.push(this._tiles[_]);return r?f.sort((_,x)=>{const w=_.tileID,k=x.tileID,A=new c.au(w.canonical.x,w.canonical.y)._rotate(this.transform.angle),P=new c.au(k.canonical.x,k.canonical.y)._rotate(this.transform.angle);return w.overscaledZ-k.overscaledZ||P.y-A.y||P.x-A.x}).map(_=>_.tileID.key):f.map(_=>_.tileID).sort(Cy).map(_=>_.key)}hasRenderableParent(r){const a=this.findLoadedParent(r,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(r,a,f){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(a||!this._tiles[r].holdingForFade())&&(f||!this._shadowCasterTiles[r])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(+r,"reloading")}}_reloadTile(r,a){const f=this._tiles[r];f&&(f.state!=="loading"&&(f.state=a),this._loadTile(f,this._tileLoaded.bind(this,f,r,a)))}_tileLoaded(r,a,f,_,x){if(_){if(r.state="errored",c.dD(_)){if(this._source.fire(new c.x("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:r})),!(r.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const k=this.map.painter.terrain;this.update(this.transform,k.getScaledDemTileSize(),!0),k.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new c.v(_,{tile:r}));return}r.timeAdded=c.co.now(),f==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(a,r),this._source.type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null);let w=new Map;x&&x.responseHeaders&&(w=x.responseHeaders),this._source.fire(new c.x("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id,responseHeaders:w}))}_hasTunnelGeometry(){for(const r in this._tiles){const a=this._tiles[r];if(a&&a.hasTunnelGeometry)return!0}return!1}_backfillDEM(r){const a=this.getRenderableIds();for(let _=0;_<a.length;_++){const x=a[_];if(r.neighboringTiles&&r.neighboringTiles[x]){const w=this.getTileByID(x);f(r,w),f(w,r)}}function f(_,x){if(!_.dem||_.dem.borderReady)return;_.needsHillshadePrepare=!0,_.needsDEMTextureUpload=!0;let w=x.tileID.canonical.x-_.tileID.canonical.x;const k=x.tileID.canonical.y-_.tileID.canonical.y,A=Math.pow(2,_.tileID.canonical.z),P=x.tileID.key;w===0&&k===0||Math.abs(k)>1||(Math.abs(w)>1&&(Math.abs(w+A)===1?w+=A:Math.abs(w-A)===1&&(w-=A)),x.dem&&_.dem&&(_.dem.backfillBorder(x.dem,w,k),_.neighboringTiles&&_.neighboringTiles[P]&&(_.neighboringTiles[P].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,a,f,_){for(const x in this._tiles){let w=this._tiles[x];if(_[x]||!w.hasData()||w.tileID.overscaledZ<=a||w.tileID.overscaledZ>f)continue;let k=w.tileID;for(;w&&w.tileID.overscaledZ>a+1;){const P=w.tileID.scaledTo(w.tileID.overscaledZ-1);w=this._tiles[P.key],w&&w.hasData()&&(k=P)}let A=k;for(;A.overscaledZ>a;)if(A=A.scaledTo(A.overscaledZ-1),r[A.key]){_[k.key]=k;break}}}findLoadedParent(r,a){if(r.key in this._loadedParentTiles){const f=this._loadedParentTiles[r.key];return f&&f.tileID.overscaledZ>=a?f:null}for(let f=r.overscaledZ-1;f>=a;f--){const _=r.scaledTo(f),x=this._getLoadedTile(_);if(x)return x}}_getLoadedTile(r){const a=this._tiles[r.key];return a&&a.hasData()?a:this._cache.getByKey(this._source.reparseOverscaled?r.wrapped().key:r.canonical.key)}updateCacheSize(r,a){a=a||this._source.tileSize;const f=Math.ceil(r.width/a)+1,_=Math.ceil(r.height/a)+1,x=Math.floor(f*_*5),w=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,x):x,k=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,w):w;this._cache.setMaxSize(k)}handleWrapJump(r){const a=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,a){const f={};for(const _ in this._tiles){const x=this._tiles[_];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+a),f[x.tileID.key]=x}this._tiles=f;for(const _ in this._timers)clearTimeout(this._timers[_]),delete this._timers[_];for(const _ in this._tiles)this._setTileReloadTimer(+_,this._tiles[_])}}update(r,a,f,_,x){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!f)return;this.updateCacheSize(r,a),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const w=this._source.type==="batched-model";let k,A=this._source.maxzoom;this._maxzoomOverride!==null&&(A=Math.min(A,this._maxzoomOverride));const P=this.map&&this.map.painter?this.map.painter._terrain:null;if(P&&P.sourceCache===this&&P.attenuationRange()){const j=P.attenuationRange()[0],$=Math.floor(j)-Math.log2(P.getDemUpscale());A>$&&(A=$)}const D=this._maxzoomOverride===null&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)k=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(j=>new c.ap(j.canonical.z,j.wrap,j.canonical.z,j.canonical.x,j.canonical.y));else if(this.tileCoverLift!==0){const j=r.clone();j.tileCoverLift=this.tileCoverLift,k=j.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:A,roundZoom:this._source.roundZoom&&!f,reparseOverscaled:D,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:w}),this._source.minzoom<=1&&r.projection.name==="globe"&&(k.push(new c.ap(1,0,1,0,0)),k.push(new c.ap(1,0,1,1,0)),k.push(new c.ap(1,0,1,0,1)),k.push(new c.ap(1,0,1,1,1)))}else if(k=r.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:A,roundZoom:this._source.roundZoom&&!f,reparseOverscaled:D,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:w}),this._source.hasTile){const j=this._source.hasTile.bind(this._source);k=k.filter($=>j($))}}else k=[];if(k.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!this._supportsFading){const j=r.coveringZoomLevel({tileSize:a||this._source.tileSize,roundZoom:this._source.roundZoom&&!f}),$=Math.min(j,A);if(w){const W=r.extendTileCover(k,$);for(const J of W)k.push(J)}else if(x){const W=this.transform.getFrustum($),J=r.extendTileCoverToNearPlane(k,W,$);for(const Q of J)k.push(Q);if($>=18&&this._hasTunnelGeometry()){const Q=r.extendTileCoverForTunnels(k,W,$,20);for(const ce of Q)k.push(ce)}}else if(this.castsShadows&&_){const W=r.extendTileCover(k,$,_,16);for(const J of W)this._shadowCasterTiles[J.key]=!0,k.push(J)}}const z=this._updateRetainedTiles(k);if(this._supportsFading&&k.length!==0){const j={},$={},W=c.co.now(),J=Object.keys(z);for(const ce of J){const fe=z[ce],se=this._tiles[ce];if(!se||se.fadeEndTime!==void 0&&se.fadeEndTime<=W)continue;const Ae=this.findLoadedParent(fe,Math.max(fe.overscaledZ-Rs.maxOverzooming,this._source.minzoom));Ae&&(this._addTile(Ae.tileID),j[Ae.tileID.key]=Ae.tileID),$[ce]=fe}const Q=k.at(-1).overscaledZ;for(const ce in this._tiles){const fe=this._tiles[ce];if(z[ce]||!fe.hasData())continue;let se=fe.tileID;for(;se.overscaledZ>Q;){se=se.scaledTo(se.overscaledZ-1);const Ae=this._tiles[se.key];if(Ae&&Ae.hasData()&&$[se.key]){z[ce]=fe.tileID;break}}}for(const ce in j)z[ce]||(this._coveredTiles[ce]=!0,z[ce]=j[ce])}for(const j in z)this._tiles[j].clearFadeHold();const F=c.dS(this._tiles,z);for(const j of F){const $=this._tiles[j];$.hasSymbolBuckets&&!$.holdingForFade()?$.setHoldDuration(this.map._fadeDuration):$.hasSymbolBuckets&&!$.symbolFadeFinished()||this._removeTile(+j)}this._updateLoadedParentTileCache(),this._renderSourceType===c.aC.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(+r)}_updateRetainedTiles(r){const a={};if(r.length===0)return a;const f={},_=r.reduce((P,D)=>Math.min(P,D.overscaledZ),1/0),x=r[0].overscaledZ,w=Math.max(x-Rs.maxOverzooming,this._source.minzoom),k=Math.max(x+Rs.maxUnderzooming,this._source.minzoom),A={};for(const P of r){const D=this._addTile(P);a[P.key]=P,D.hasData()||_<this._source.maxzoom&&(A[P.key]=P)}this._retainLoadedChildren(A,_,k,a);for(const P of r){let D=this._tiles[P.key];if(D.hasData())continue;if(P.canonical.z>=this._source.maxzoom){const F=P.children(this._source.maxzoom)[0],j=this.getTile(F);if(j&&j.hasData()){a[F.key]=F;continue}}else{const F=P.children(this._source.maxzoom);if(a[F[0].key]&&a[F[1].key]&&a[F[2].key]&&a[F[3].key])continue}let z=D.wasRequested();for(let F=P.overscaledZ-1;F>=w;--F){const j=P.scaledTo(F);if(f[j.key]||(f[j.key]=!0,D=this.getTile(j),!D&&z&&(D=this._addTile(j)),D&&(a[j.key]=j,z=D.wasRequested(),D.hasData())))break}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const a=[];let f,_=this._tiles[r].tileID;for(;_.overscaledZ>0;){if(_.key in this._loadedParentTiles){f=this._loadedParentTiles[_.key];break}a.push(_.key);const x=_.scaledTo(_.overscaledZ-1);if(f=this._getLoadedTile(x),f)break;_=x}for(const x of a)this._loadedParentTiles[x]=f}}_addTile(r){let a=this._tiles[r.key];if(a)return a.isExtraShadowCaster!==!0||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),a;a=this._cache.getAndRemove(r),a&&(this._setTileReloadTimer(r.key,a),a.tileID=r,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,a)));const f=!!a;if(!f){const _=this.map?this.map.painter:null,x=this._source.tileSize*r.overscaleFactor();a=this._source.type==="raster-array"?new gm(r,x,this.transform.tileZoom,_,this._isRaster):new c.b0(r,x,this.transform.tileZoom,_,this._isRaster,this._source.worldview),this._loadTile(a,this._tileLoaded.bind(this,a,r.key,a.state))}return a.uses++,this._tiles[r.key]=a,f||this._source.fire(new c.x("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(r,a){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const f=a.getExpiryTimeout();f&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},f))}_removeTile(r){const a=this._tiles[r];a&&(a.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),a.uses>0||(a.hasData()&&a.state!=="reloading"||a.state==="empty"?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(+r);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,a,f){const _=[],x=this.transform;if(!x)return _;const w=x.projection.name==="globe",k=c.ek(x.center.lng);for(const A in this._tiles){const P=this._tiles[A];if(f&&P.clearQueryDebugViz(),P.holdingForFade())continue;let D;if(w){const z=P.tileID.canonical;if(z.z===0){const F=[Math.abs(c.bG(k,...Rd(z,-1))-k),Math.abs(c.bG(k,...Rd(z,1))-k)];D=[0,2*F.indexOf(Math.min(...F))-1]}else{const F=[Math.abs(c.bG(k,...Rd(z,-1))-k),Math.abs(c.bG(k,...Rd(z,0))-k),Math.abs(c.bG(k,...Rd(z,1))-k)];D=[F.indexOf(Math.min(...F))-1]}}else D=[0];for(const z of D){const F=r.containsTile(P,x,a,z);F&&_.push(F)}}return _}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(r){return this._getRenderableCoordinates(r)}_getRenderableCoordinates(r,a){if(!this.transform)return[];const f=this.getRenderableIds(r,a).map(x=>this._tiles[x].tileID),_=this.transform.projection.name==="globe";for(const x of f)x.projMatrix=this.transform.calculateProjMatrix(x.toUnwrapped()),x.expandedProjMatrix=_?this.transform.calculateProjMatrix(x.toUnwrapped(),!1,!0):x.projMatrix;return f}sortCoordinatesByDistance(r){const a=r.slice(),f=this.transform._camera.position,_=this.transform._camera.forward(),x={};for(const w of a){const k=1/(1<<w.canonical.z);x[w.key]=((w.canonical.x+.5)*k+w.wrap-f[0])*_[0]+((w.canonical.y+.5)*k-f[1])*_[1]-f[2]*_[2]}return a.sort((w,k)=>x[w.key]-x[k.key]),a}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){const r=c.co.now();for(const a in this._tiles){const f=this._tiles[a];if(f.fadeEndTime!==void 0&&f.fadeEndTime>=r)return!0}}return!1}setFeatureState(r,a,f){this._state.updateState(r=r||"_geojsonTileLayer",a,f)}removeFeatureState(r,a,f){this._state.removeFeatureState(r=r||"_geojsonTileLayer",a,f)}getFeatureState(r,a){return this._state.getState(r=r||"_geojsonTileLayer",a)}setDependencies(r,a,f){const _=this._tiles[r];_&&_.setDependencies(a,f)}reloadTilesForDependencies(r,a){for(const f in this._tiles)this._tiles[f].hasDependency(r,a)&&this._reloadTile(+f,"reloading");this._cache.filter(f=>!f.hasDependency(r,a))}_preloadTiles(r,a){if(!this._sourceLoaded){const A=()=>{this._sourceLoaded&&(this._source.off("data",A),this._preloadTiles(r,a))};return void this._source.on("data",A)}const f=new Map,_=Array.isArray(r)?r:[r],x=this.map.painter.terrain,w=this.usedForTerrain&&x?x.getScaledDemTileSize():this._source.tileSize;for(const A of _){const P=A.coveringTiles({tileSize:w,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const D of P)f.set(D.key,D);this.usedForTerrain&&A.updateElevation(!1)}const k=Array.from(f.values());c.bp(k,(A,P)=>{const D=new c.b0(A,this._source.tileSize*A.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(D,z=>{this._source.type==="raster-dem"&&D.dem&&this._backfillDEM(D),P(z,D)})},a)}}function Cy(u,r){const a=Math.abs(2*u.wrap)-+(u.wrap<0),f=Math.abs(2*r.wrap)-+(r.wrap<0);return u.overscaledZ-r.overscaledZ||f-a||r.canonical.y-u.canonical.y||r.canonical.x-u.canonical.x}function Rd(u,r){const a=1<<u.z;return[u.x/a+r,(u.x+1)/a+r]}Rs.maxOverzooming=10,Rs.maxUnderzooming=3;const If=u=>({u_matrix:u});function Mf(u,r){const a=u.context.gl;return new rn({func:a.EQUAL,mask:255},u._tileClippingMaskIDs[r.key]||0,0,a.KEEP,a.KEEP,a.KEEP)}function Pf(u,r){const a=u.context.gl;return new rn({func:a.EQUAL,mask:255},255&~(u._tileClippingMaskIDs[r.key]||0),0,a.KEEP,a.KEEP,a.KEEP)}function Iy(u,r){if(!u.frcCoverageSnapshot||!u.frcCoverageRenderer)return null;const a=u.frcCoverageSnapshot.getTileOrParent(r.canonical);if(!a||a.frcMask===0)return null;const f=u.frcCoverageRenderer.getBuffers(a.tileId);if(!f)return null;const _=new c.f(a.tileId.z,a.tileId.x,a.tileId.y),x=new c.bc(r.wrap,_);return{buffers:f,projMatrix:u.transform.calculateProjMatrix(x),coverageTile:a}}function Ks(u,r,a){if(!u.frcCoverageSnapshot)return;const f=u.context,_=f.gl,x=u.getOrCreateProgram("clippingMask");f.setColorMode(tn.disabled),f.setDepthMode(Vt.disabled);for(const w of r){const k=Iy(u,w);if(!k)continue;const A=k.buffers.frcLevelSegments[a];A&&x.draw(u,_.TRIANGLES,Vt.disabled,new rn({func:_.EQUAL,mask:255},u._tileClippingMaskIDs[w.key]||0,255,_.KEEP,_.KEEP,_.INVERT),tn.disabled,Ut.disabled,If(k.projMatrix),`$frc_coverage_${a}`,k.buffers.vertexBuffer,k.buffers.indexBuffer,A)}}function My(u,r,a){if(!u.frcCoverageSnapshot)return;const f=u.context,_=f.gl,x=u.getOrCreateProgram("clippingMask");f.setColorMode(tn.disabled),f.setDepthMode(Vt.disabled);for(const w of r){const k=Iy(u,w);if(!k)continue;const A=k.buffers.frcLevelSegments[a];A&&x.draw(u,_.TRIANGLES,Vt.disabled,new rn({func:_.EQUAL,mask:255},255&~(u._tileClippingMaskIDs[w.key]||0),255,_.KEEP,_.KEEP,_.INVERT),tn.disabled,Ut.disabled,If(k.projMatrix),`$frc_coverage_restore_${a}`,k.buffers.vertexBuffer,k.buffers.indexBuffer,A)}}function Df(u,r,a,f,_){if(r.length===0)return;let x=0;for(const k of r)x|=k.frcMask;const w=r.map(k=>k.coord);for(let k=0;k<9;++k)if(x&1<<k){if(Ks(u,w,k),f)for(const A of r)A.frcMask&1<<k&&f(A,k,Mf(u,A.coord));if(a>0&&_)for(const A of r)A.frcMask&1<<k&&_(A,k,Pf(u,A.coord));My(u,w,k)}}function Tb(u){for(const r of u)if(r.rings.length>0&&r.rings[0].length>0)return!0;return!1}function Rf(u){const r=u.frcCoverageFadeRange;return!r||r[1]<=r[0]?0:1-Math.max(0,Math.min(1,(u.transform.zoom-r[0])/(r[1]-r[0])))}const Py={loaded:!0,drawBuilding:function(u,r,a,f){u.currentLayer<u.firstLightBeamLayer&&(u.firstLightBeamLayer=u.currentLayer);const _=a.paint.get("building-ambient-occlusion-ground-intensity"),x=a.paint.get("building-ambient-occlusion-ground-radius"),w=a.paint.get("building-ambient-occlusion-ground-attenuation"),k=a.paint.get("building-opacity");if(k<=0)return;let A=_>0&&x>0,P=!0;const D=a.paint.get("building-vertical-scale");if(D<=0)return;u.shadowRenderer||(P=!1);const z=u.conflationActive&&u.style.isLayerClipped(a,r.getSource()),F=u.style.order.indexOf(a.fqid);if(function(j,$,W,J,Q,ce){for(const fe of ce){const se=$.getTile(fe).getBucket(W);se&&(Q&&se.updateReplacement(fe,j.replacementSource,J),se.uploadUpdatedIndexBuffer(j.context))}}(u,r,a,F,z,f),function(j,$,W,J){for(const Q of J){const ce=$.getTile(Q).getBucket(W);ce&&ce.needsEvaluation()&&ce.uploadUpdatedColorBuffer(j.context)}}(u,r,a,f),a.resetLayerRenderingStats(u),u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!0),u.renderPass==="shadow"&&u.shadowRenderer){const j=[],$=u.shadowRenderer.getShadowPassDepthMode();Ha({painter:u,source:r,layer:a,coords:f,defines:j,blendMode:tn.disabled,depthMode:$,opacity:k,verticalScale:D,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(u.renderPass==="translucent"){let j=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];P&&(j=j.concat("RENDER_SHADOWS")),u.shadowRenderer&&u.shadowRenderer.useNormalOffset&&(j=j.concat("NORMAL_OFFSET"));const $=a.paint.get("building-facade-emissive-chance"),W=a.paint.get("building-ambient-occlusion-intensity"),J=a.paint.get("building-flood-light-intensity"),Q=a.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",ce=a.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Q?null:a.lut).toArray01().slice(0,3),fe=a.paint.get("building-flood-light-ground-attenuation"),se=J>0,Ae=new Vt(u.context.gl.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D);k<1&&Ha({painter:u,source:r,layer:a,coords:f,defines:j,blendMode:tn.disabled,depthMode:Ae,opacity:k,verticalScale:D,facadeEmissiveChance:$,facadeAOIntensity:W,floodLightIntensity:J,floodLightColor:ce,depthOnly:!0});const Ee=u.colorModeForRenderPass();Ha({painter:u,source:r,layer:a,coords:f,defines:j,blendMode:Ee,depthMode:Ae,opacity:k,verticalScale:D,facadeEmissiveChance:$,facadeAOIntensity:W,floodLightIntensity:J,floodLightColor:ce});const Pe=a.paint.get("building-front-cutoff");dy(u.transform.pitch,Pe,!!u.terrain),A&&db(u,r,a,f,!0,k,_,x,J,ce,w,z),se&&db(u,r,a,f,!1,k,_,x,J,ce,fe,z)}else if(u.renderPass==="light-beam"){const j=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],$=new Vt(u.context.gl.LEQUAL,Vt.ReadOnly,u.depthRangeFor3D);Ha({painter:u,source:r,layer:a,coords:f,defines:j,blendMode:tn.alphaBlended,depthMode:$,opacity:k,verticalScale:D,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!1),u.resetStencilClippingMasks()},drawRasterParticle:function(u,r,a,f,_,x){u.renderPass==="offscreen"&&function(w,k,A,P){if(!P.length)return;const D=w.context,z=D.gl,F=k.getSource();if(!(F instanceof Du))return;const j=Math.ceil(Math.sqrt(A.paint.get("raster-particle-count")));let $=A.particlePositionRGBAImage;if(!$||$.width!==j){const fe=function(se){const Ae=se*se,Ee=new Uint8Array(4*Ae),Pe=.9090909090909091;for(let ye=0;ye<Ae;ye++){const be=Pe*(c.cg(2*ye+0)+Md),Ce=Pe*(c.cg(2*ye+1)+Md),ze=255*be%1,Oe=255*Ce%1,Ze=ze,We=Ce-Oe/255,ut=Oe;Ee[4*ye+0]=255*(be-ze/255),Ee[4*ye+1]=255*Ze,Ee[4*ye+2]=255*We,Ee[4*ye+3]=255*ut}return Ee}(j);$=A.particlePositionRGBAImage=new c.ay({width:j,height:j},fe)}let W=A.particleFramebuffer;W?W.width!==j&&(W.destroy(),W=A.particleFramebuffer=D.createFramebuffer(j,j,1,null)):W=A.particleFramebuffer=D.createFramebuffer(j,j,1,null);const J=[];for(const fe of P){const se=k.getTile(fe);if(!(se instanceof gm))continue;const Ae=gy(se,F,A);if(!Ae)continue;const Ee=[se.tileSize,se.tileSize];let Pe=A.tileFramebuffer;Pe||(Pe=A.tileFramebuffer=D.createFramebuffer(Ee[0],Ee[1],1,null));let ye=se.rasterParticleState;ye||(ye=se.rasterParticleState=new xf(D,fe,Ee,$));const be=ye.update(A.lastInvalidatedAt);ye.particleTextureDimension!==j&&ye.updateParticleTexture(fe,$);const Ce=ye.targetColorTexture;ye.targetColorTexture=ye.backgroundColorTexture,ye.backgroundColorTexture=Ce;const ze=ye.particleTexture0;ye.particleTexture0=ye.particleTexture1,ye.particleTexture1=ze,J.push([fe,Ae,ye,be])}if(J.length===0)return;const Q=c.co.now(),ce=A.previousDrawTimestamp?.001*(Q-A.previousDrawTimestamp):.0167;if(A.previousDrawTimestamp=Q,A.hasColorMap()){D.activeTexture.set(z.TEXTURE0+2);let fe=A.colorRampTexture;fe||(fe=A.colorRampTexture=new c.a_(D,A.colorRamp,z.RGBA8)),fe.bind(z.LINEAR,z.CLAMP_TO_EDGE)}D.bindFramebuffer.set(A.tileFramebuffer.framebuffer),function(fe,se,Ae){const Ee=fe.context,Pe=Ee.gl,ye=se.tileFramebuffer;Ee.activeTexture.set(Pe.TEXTURE0);const be={u_texture:0,u_opacity:1.05*(ze=se.paint.get("raster-particle-fade-opacity-factor"))/(ze+.05)},Ce=fe.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var ze;for(const Oe of Ae){const[,,Ze,We]=Oe;ye.colorAttachment0.set(Ze.targetColorTexture.texture),Ee.viewport.set([0,0,ye.width,ye.height]),Ee.clear({color:c.i.transparent}),We&&(Ze.backgroundColorTexture.bind(Pe.NEAREST,Pe.CLAMP_TO_EDGE),Ce.draw(fe,Pe.TRIANGLES,Vt.disabled,rn.disabled,tn.alphaBlended,Ut.disabled,be,se.id,fe.viewportBuffer,fe.quadTriangleIndexBuffer,fe.viewportSegments))}}(w,A,J),function(fe,se,Ae,Ee){const Pe=fe.context,ye=Pe.gl,be=Ae.tileFramebuffer,Ce=fe.transform.projection.name==="globe",ze=Ae.paint.get("raster-particle-max-speed");for(const Oe of Ee){const[Ze,We,ut]=Oe;Pe.activeTexture.set(ye.TEXTURE0+0),We.texture.bind(ye.LINEAR,ye.CLAMP_TO_EDGE),be.colorAttachment0.set(ut.targetColorTexture.texture);const Ne=fe.getOrCreateProgram("rasterParticleDraw",{defines:We.defines,overrideFog:!1});Pe.activeTexture.set(ye.TEXTURE0+1);const Je=We.scalarData?[]:[0,1,2,3].map(Qe=>c.ev[Qe](Ze));Je.push(Ze);const Be=Ze.canonical.x,it=Ze.canonical.y;for(const Qe of Je){const ot=se.getTile(Ce?Qe.wrapped():Qe);if(!ot)continue;const Et=ot.rasterParticleState;if(!Et)continue;const ht=Qe.canonical.x+(1<<Qe.canonical.z)*(Qe.wrap-Ze.wrap),gt=Qe.canonical.y;Et.particleTexture0.bind(ye.NEAREST,ye.CLAMP_TO_EDGE);const ct=_2(1,Et.particleTexture0.size[0],[ht-Be,gt-it],0,We.texture.size,2,ze,We.textureOffset,We.scale,We.offset);Ne.draw(fe,ye.POINTS,Vt.disabled,rn.disabled,tn.alphaBlended,Ut.disabled,ct,Ae.id,Et.particleIndexBuffer,void 0,Et.particleSegment)}}}(w,k,A,J),D.bindFramebuffer.set(A.particleFramebuffer.framebuffer),function(fe,se,Ae,Ee){const Pe=fe.context,ye=Pe.gl,be=se.paint.get("raster-particle-max-speed"),Ce=Ee*se.paint.get("raster-particle-speed-factor")*.15,ze=function(Ze){return Math.pow(Ze,6)}(.01+1*se.paint.get("raster-particle-reset-rate-factor")),Oe=se.particleFramebuffer;Pe.viewport.set([0,0,Oe.width,Oe.height]);for(const Ze of Ae){const[,We,ut]=Ze;Pe.activeTexture.set(ye.TEXTURE0+0),We.texture.bind(ye.LINEAR,ye.CLAMP_TO_EDGE),Pe.activeTexture.set(ye.TEXTURE0+1);const Ne=ut.particleTexture0;Ne.bind(ye.NEAREST,ye.CLAMP_TO_EDGE);const Je=hy(1,Ne.size[0],0,We.texture.size,be,Ce,ze,We.textureOffset,We.scale,We.offset);Oe.colorAttachment0.set(ut.particleTexture1.texture),Pe.clear({color:c.i.transparent}),fe.getOrCreateProgram("rasterParticleUpdate",{defines:We.defines}).draw(fe,ye.TRIANGLES,Vt.disabled,rn.disabled,tn.unblended,Ut.disabled,Je,se.id,fe.viewportBuffer,fe.quadTriangleIndexBuffer,fe.viewportSegments)}}(w,A,J,ce)}(u,r,a,f),u.renderPass==="translucent"&&(function(w,k,A,P){const D=w.context,z=D.gl,F=k.getSource().tileSize,j=5*(1-c.fq(c.R,c.R+1,w.transform.zoom))*F+A.paint.get("raster-particle-elevation"),$=!w.options.moving,W=w.transform.projection.name==="globe";if(!P.length)return;const[J,Q]=w.stencilConfigForOverlap(P),ce=[];W&&ce.push("PROJECTION_GLOBE_VIEW");const fe=w.stencilModeFor3D();for(const se of Q){const Ae=se.toUnwrapped(),Ee=k.getTile(se);if(!Ee.rasterParticleState)continue;const Pe=Ee.rasterParticleState,ye=100;Ee.registerFadeDuration(ye);const be=k.findLoadedParent(se,0),Ce=_m(Ee,be,k,w.transform,ye);let ze,Oe;w.terrain&&w.terrain.prepareDrawTile(),D.activeTexture.set(z.TEXTURE0),Pe.targetColorTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),D.activeTexture.set(z.TEXTURE1),be&&be.rasterParticleState?(be.rasterParticleState.targetColorTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),ze=Math.pow(2,be.tileID.overscaledZ-Ee.tileID.overscaledZ),Oe=[Ee.tileID.canonical.x*ze%1,Ee.tileID.canonical.y*ze%1]):Pe.targetColorTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Ze=W?w.transform.expandedFarZProjMatrix:w.transform.calculateProjMatrix(Ae,$),We=w.transform,ut=Sa(We),Ne=c.fF(se.canonical),Je=c.cU(Ne.getCenter().lat);let Be,it,Qe,ot,Et;W?(Be=Float32Array.from(c.dh(c.dk(se.canonical))),it=Float32Array.from(We.globeMatrix),Qe=Float32Array.from(c.by(We)),ot=[c.ek(We.center.lng),c.el(We.center.lat)],Et=Float32Array.from(c.cP(se.canonical,Ne,Je,We.worldSize/We._pixelsPerMercatorPixel))):(Be=new Float32Array(16),it=new Float32Array(9),Qe=new Float32Array(16),ot=[0,0],Et=new Float32Array(9));const ht=hb(Ze,Be,it,Qe,Et,Oe||[0,0],c.dm(w.transform.zoom),ot,ut,ze||1,Ce,j),gt=w.isTileAffectedByFog(se),ct=w.getOrCreateProgram("rasterParticle",{defines:ce,overrideFog:gt});if(w.uploadCommonUniforms(D,ct,Ae),W){const Ht=new Vt(z.LEQUAL,Vt.ReadOnly,w.depthRangeFor3D),Ot=0,Nt=w.globeSharedBuffers;if(Nt){const[$t,an,nn]=Nt.getGridBuffers(Je,Ot!==0);ct.draw(w,z.TRIANGLES,Ht,fe,tn.alphaBlended,w.renderElevatedRasterBackface?Ut.frontCCW:Ut.backCCW,ht,A.id,$t,an,nn)}}else{const Ht=w.depthModeForSublayer(0,Vt.ReadOnly),Ot=J[se.overscaledZ],{tileBoundsBuffer:Nt,tileBoundsIndexBuffer:$t,tileBoundsSegments:an}=w.getTileBoundsBuffers(Ee);ct.draw(w,z.TRIANGLES,Ht,Ot,tn.alphaBlended,Ut.disabled,ht,A.id,Nt,$t,an)}}w.resetStencilClippingMasks()}(u,r,a,f),u.style.map.triggerRepaint())},prepareRasterParticle:function(u,r,a){const f=r.getSource();if(!(f instanceof Du&&f.loaded()))return;const _=u.sourceLayer||f.rasterLayerIds&&f.rasterLayerIds[0];if(!_)return;const x=u.paint.get("raster-particle-array-band")||f.getInitialBand(_);if(x==null)return;const w=r.getIds().map(k=>r.getTileByID(k));for(const k of w)k.updateNeeded(u.id,x)&&f.prepareTile(k,_,u.id,x)},Rain:class extends wm{constructor(){super(4.25),this._params={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._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(u){const r=u.context;if(!this.particlesVx){const a=kf(this.particlesCount),f=new c.aW,_=new c.aT;let x=0;const w=c.eq(1323123451230);for(let k=0;k<a.length;++k){const A=a[k],P=[2*w()-1,w(),w(),w()];f.emplaceBack(A[0],A[1],A[2],-1,-1,...P),f.emplaceBack(A[0],A[1],A[2],1,-1,...P),f.emplaceBack(A[0],A[1],A[2],1,1,...P),f.emplaceBack(A[0],A[1],A[2],-1,1,...P),_.emplaceBack(x+0,x+1,x+2),_.emplaceBack(x+0,x+2,x+3),x+=4}this.particlesVx=r.createVertexBuffer(f,Tl.members),this.particlesIdx=r.createIndexBuffer(_)}}getDrawParams(u){if(!u.style.rain)return null;const r=u.style.rain.state,a=structuredClone(this._params);a.intensity=r.density,a.timeFactor=r.intensity,a.color=structuredClone(r.color),a.screenThinning.intensity=r.centerThinning,a.dropletSizeX=r.dropletSize[0],a.dropletSizeYScale=r.dropletSize[1]/r.dropletSize[0],a.distortionStrength=100*r.distortionStrength;const f=structuredClone(this._vignetteParams);return f.strength=1,f.color=structuredClone(r.vignetteColor),{params:a,vignetteParams:f,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(u){const r=this.getDrawParams(u);if(!r)return;const{params:a,revealParams:f,direction:_,vignetteParams:x}=r,w=u.transform.zoom;if(f.revealStart>w)return;const k=Wa(0,1,f.revealStart,f.revealStart+f.revealRange,w);if(!this.particlesVx||!this.particlesIdx)return;x.strength*=k;const A=this.updateOnRender(u,a.timeFactor),P=u.context,D=P.gl,z=u.transform;this.screenTexture&&this.screenTexture.size[0]===u.width&&this.screenTexture.size[1]===u.height||(this.screenTexture=new c.a_(P,{width:u.width,height:u.height,data:null},D.RGBA8)),a.distortionStrength>0&&(P.activeTexture.set(D.TEXTURE0),this.screenTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,u.width,u.height));const F=u.getOrCreateProgram("rainParticle");u.uploadCommonUniforms(P,F),P.activeTexture.set(D.TEXTURE0),this.screenTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const j=[a.color.r,a.color.g,a.color.b,a.color.a],$=(W,J)=>{const Q=Lu(this._movement.getPosition(),W),ce=a.dropletSizeX,fe=a.dropletSizeX*a.dropletSizeYScale,se=u.width/2,Ae=u.height/2,Ee=Wa(0,a.screenThinning.start,0,1,a.screenThinning.intensity),Pe=Wa(.001,a.screenThinning.range,0,1,a.screenThinning.intensity),ye=Wa(0,a.screenThinning.particleOffset,0,1,a.screenThinning.intensity),be=(Ce={modelview:A.modelviewMatrix,projection:A.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Q,velocityConeAperture:a.velocityConeAperture,velocity:a.velocity,boxSize:W,rainDropletSize:[ce,fe],distortionStrength:a.distortionStrength,rainDirection:_,color:j,screenSize:[z.width,z.height],thinningCenterPos:[se,Ae],thinningShape:[Ee,Pe,Math.pow(10,a.screenThinning.fadePower)],thinningAffectedRatio:a.screenThinning.affectedRatio,thinningParticleOffset:ye,shapeDirectionalPower:a.shapeDirPower,shapeNormalPower:a.shapeNormalPower,mode:J?0:1},{u_modelview:Float32Array.from(Ce.modelview),u_projection:Float32Array.from(Ce.projection),u_time:Ce.time,u_cam_pos:Ce.camPos,u_texScreen:0,u_velocityConeAperture:Ce.velocityConeAperture,u_velocity:Ce.velocity,u_boxSize:Ce.boxSize,u_rainDropletSize:Ce.rainDropletSize,u_distortionStrength:Ce.distortionStrength,u_rainDirection:Ce.rainDirection,u_color:Ce.color,u_screenSize:Ce.screenSize,u_thinningCenterPos:Ce.thinningCenterPos,u_thinningShape:Ce.thinningShape,u_thinningAffectedRatio:Ce.thinningAffectedRatio,u_thinningParticleOffset:Ce.thinningParticleOffset,u_shapeDirectionalPower:Ce.shapeDirectionalPower,u_shapeNormalPower:Ce.shapeNormalPower,u_mode:Ce.mode});var Ce;const ze=Math.round(a.intensity*this.particlesCount),Oe=c.aJ.simpleSegment(0,0,4*ze,2*ze);F.draw(u,D.TRIANGLES,Vt.disabled,rn.disabled,tn.alphaBlended,Ut.disabled,be,"rain_particles",this.particlesVx,this.particlesIdx,Oe)};a.distortionStrength>0&&$(a.boxSize,!0),$(a.boxSize,!1),this._vignette.draw(u,x)}},Snow:class extends wm{constructor(){super(2.25),this._params={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._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(u){const r=u.context;if(!this.particlesVx){const a=kf(this.particlesCount),f=new c.aK,_=new c.aT;let x=0;const w=c.eq(1323123451230);for(let k=0;k<a.length;++k){const A=a[k],P=w(),D=w(),z=w(),F=[k/a.length,P,D,z],j=[w(),w()];f.emplaceBack(A[0],A[1],A[2],-1,-1,...F,...j),f.emplaceBack(A[0],A[1],A[2],1,-1,...F,...j),f.emplaceBack(A[0],A[1],A[2],1,1,...F,...j),f.emplaceBack(A[0],A[1],A[2],-1,1,...F,...j),_.emplaceBack(x+0,x+1,x+2),_.emplaceBack(x+0,x+2,x+3),x+=4}this.particlesVx=r.createVertexBuffer(f,Sm.members),this.particlesIdx=r.createIndexBuffer(_)}}getDrawParams(u){if(!u.style.snow)return null;const r=u.style.snow.state,a=structuredClone(this._params);a.intensity=r.density,a.timeFactor=r.intensity,a.color=structuredClone(r.color),a.screenThinning.intensity=r.centerThinning,a.billboardSize=2.79*r.flakeSize;const f=structuredClone(this._vignetteParams);return f.strength=1,f.color=structuredClone(r.vignetteColor),{params:a,vignetteParams:f,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(u){const r=this.getDrawParams(u);if(!r)return;const{params:a,revealParams:f,direction:_,vignetteParams:x}=r,w=u.transform.zoom;if(f.revealStart>w)return;const k=Wa(0,1,f.revealStart,f.revealStart+f.revealRange,w);x.strength*=k;const A=this.updateOnRender(u,a.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const P=u.context,D=P.gl,z=u.transform,F=u.getOrCreateProgram("snowParticle");u.uploadCommonUniforms(P,F),((j,$,W)=>{const J=Lu(this._movement.getPosition(),j),Q=z.width/2,ce=z.height/2,fe=Wa(0,W.screenThinning.start,0,1,W.screenThinning.intensity),se=Wa(.001,W.screenThinning.range,0,1,W.screenThinning.intensity),Ae=Wa(0,W.screenThinning.particleOffset,0,1,W.screenThinning.intensity),Ee=(Pe={modelview:A.modelviewMatrix,projection:A.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:J,velocityConeAperture:W.velocityConeAperture,velocity:W.velocity,horizontalOscillationRadius:W.horizontalOscillationRadius,horizontalOscillationRate:W.horizontalOscillationRate,boxSize:j,billboardSize:1*W.billboardSize,simpleShapeParameters:[W.shapeFadeStart,W.shapeFadePower],screenSize:[z.width,z.height],thinningCenterPos:[Q,ce],thinningShape:[fe,se,Math.pow(10,W.screenThinning.fadePower)],thinningAffectedRatio:W.screenThinning.affectedRatio,thinningParticleOffset:Ae,color:[W.color.r,W.color.g,W.color.b,W.color.a],direction:_},{u_modelview:Float32Array.from(Pe.modelview),u_projection:Float32Array.from(Pe.projection),u_time:Pe.time,u_cam_pos:Pe.camPos,u_velocityConeAperture:Pe.velocityConeAperture,u_velocity:Pe.velocity,u_horizontalOscillationRadius:Pe.horizontalOscillationRadius,u_horizontalOscillationRate:Pe.horizontalOscillationRate,u_boxSize:Pe.boxSize,u_billboardSize:Pe.billboardSize,u_simpleShapeParameters:Pe.simpleShapeParameters,u_screenSize:Pe.screenSize,u_thinningCenterPos:Pe.thinningCenterPos,u_thinningShape:Pe.thinningShape,u_thinningAffectedRatio:Pe.thinningAffectedRatio,u_thinningParticleOffset:Pe.thinningParticleOffset,u_particleColor:Pe.color,u_direction:Pe.direction});var Pe;const ye=Math.round(W.intensity*this.particlesCount),be=c.aJ.simpleSegment(0,0,4*ye,2*ye);this.particlesVx&&this.particlesIdx&&F.draw(u,D.TRIANGLES,Vt.disabled,rn.disabled,tn.alphaBlended,Ut.disabled,Ee,"snow_particles",this.particlesVx,this.particlesIdx,be)})(a.boxSize,0,a),this._vignette.draw(u,x)}},shaders:Dd,programUniforms:bb,drawElevatedStructures:function(u){const{painter:r,sourceCache:a,layer:f,coords:_,colorMode:x}=u,w=r.context.gl,k=u.painter.shadowRenderer,A=!!k&&k.enabled,P=new Vt(r.context.gl.LEQUAL,Vt.ReadOnly,r.depthRangeFor3D);let D=[0,0,0];if(A){const F=r.style.directionalLight,j=r.style.ambientLight;F&&j&&(D=Rc(r.style,F,j))}const z=F=>{for(const j of _){const $=a.getTile(j),W=$.getBucket(f);if(!W)continue;const J=W.hdExt?W.hdExt.elevatedStructures:void 0;if(!J)continue;let Q,ce;if(F?(Q=J.renderableBridgeSegments,ce=J.bridgeProgramConfigurations.get(f.id)):(Q=J.renderableTunnelSegments,ce=J.tunnelProgramConfigurations.get(f.id)),!Q||Q.segments[0].primitiveLength===0)continue;ce.updatePaintBuffers(),r.prepareDrawTile();const fe=r.isTileAffectedByFog(j),se=[];A&&se.push("RENDER_SHADOWS","NORMAL_OFFSET");const Ae=r.getOrCreateProgram("elevatedStructures",{config:ce,overrideFog:fe,defines:se}),Ee=r.translatePosMatrix(j.projMatrix,$,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));A&&k.setupShadows($.tileID.toUnwrapped(),Ae,"vector-tile");const Pe=xb(Ee,D);r.uploadCommonUniforms(r.context,Ae,j.toUnwrapped()),Ae.draw(r,w.TRIANGLES,P,rn.disabled,x,Ut.backCCW,Pe,f.id,J.vertexBuffer,J.indexBuffer,Q,f.paint,r.transform.zoom,ce,[J.vertexBufferNormal])}};z(!0),z(!1)},drawElevatedFillShadows:function(u){const{painter:r,sourceCache:a,layer:f,coords:_}=u,x=r.context.gl,w=u.painter.shadowRenderer;for(const k of _){const A=a.getTile(k),P=A.getBucket(f);if(!P)continue;const D=P.hdExt?P.hdExt.elevatedStructures:void 0;if(!D||!D.shadowCasterSegments||D.shadowCasterSegments.segments[0].primitiveLength===0)continue;r.prepareDrawTile();const z=P.bufferData.programConfigurations.get(f.id),F=r.isTileAffectedByFog(k),j=r.getOrCreateProgram("elevatedStructuresDepth",{config:z,overrideFog:F}),$=w.calculateShadowPassMatrixFromTile(A.tileID.toUnwrapped());r.uploadCommonUniforms(r.context,j,k.toUnwrapped());const W=Af($,0);j.draw(r,x.TRIANGLES,w.getShadowPassDepthMode(),rn.disabled,tn.disabled,Ut.disabled,W,f.id,D.vertexBuffer,D.indexBuffer,D.shadowCasterSegments,f.paint,r.transform.zoom,z)}},drawDepthPrepass:function(u,r,a,f,_){if(!r||!a.layout||a.layout.get("fill-elevation-reference")==="none"||a.paint.get("fill-opacity").constantOr(1)===0)return;const x=u.context.gl,w=new Vt(u.context.gl.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D),k=new Vt(u.context.gl.GREATER,Vt.ReadWrite,u.depthRangeFor3D),A=function(j){let $=.01;return j.isOrthographic&&($=c.dY(1e-4,$,c.cc(j.pitch>=$i?1:j.pitch/$i))),2*$}(u.transform),P=u.transform.getFreeCameraOptions().position,D="elevatedStructuresDepthReconstruct",z=u.getOrCreateProgram(D,{defines:["DEPTH_RECONSTRUCTION"]}),F=u.getOrCreateProgram(D);for(const j of f){const $=r.getTile(j),W=$.getBucket(a);if(!W||!W.hdExt)continue;const J=W.hdExt.elevatedStructures,Q=W.hdExt.elevationBufferData;if(!J||!J.depthSegments||!Q)continue;const ce=Q.heightRange,fe=Ou(j.toUnwrapped(),P),se=u.translatePosMatrix(j.projMatrix,$,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));let Ae,Ee,Pe,ye;if(_==="initialize"){if(!ce||ce.min>=1||J.depthSegments.segments[0].primitiveLength===0)continue;Ae=Cf(se,fe,A,1,0),Ee=w,Pe=J.depthSegments,ye=z}else if(_==="reset"){if(!ce||ce.min>=0||J.maskSegments.segments[0].primitiveLength===0)continue;Ae=Cf(se,fe,0,0,1),Ee=k,Pe=J.maskSegments,ye=z}else if(_==="geometry"){if(J.depthSegments.segments[0].primitiveLength===0)continue;Ae=Cf(se,fe,A,1,0),Ee=w,Pe=J.depthSegments,ye=F}ye.draw(u,x.TRIANGLES,Ee,rn.disabled,tn.disabled,Ut.disabled,Ae,a.id,J.vertexBuffer,J.indexBuffer,Pe,a.paint,u.transform.zoom)}},drawGroundShadowMask:function(u,r,a,f){if(!r||!a.layout||a.layout.get("fill-elevation-reference")==="none"||a.paint.get("fill-opacity").constantOr(1)===0)return;const _=u.context.gl,x=new Vt(_.LEQUAL,Vt.ReadOnly,u.depthRangeFor3D),w=new rn({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),k=u.transform.getFreeCameraOptions().position,A=u.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const P of f){const D=r.getTile(P),z=D.getBucket(a);if(!z)continue;const F=z.hdExt?z.hdExt.elevatedStructures:void 0;if(!F||!F.depthSegments||F.depthSegments.segments[0].primitiveLength===0)continue;const j=Ou(P.toUnwrapped(),k),$=u.translatePosMatrix(P.projMatrix,D,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),W=Cf($,j,0,1,0);A.draw(u,_.TRIANGLES,x,w,tn.disabled,Ut.disabled,W,a.id,F.vertexBuffer,F.indexBuffer,F.depthSegments,a.paint,u.transform.zoom)}},IndoorManager:class extends c.y{constructor(u,r=!1){super(),this._style=u,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new g2,this._initialLoadDone=!1,c.bs(["_updateUI"],this);const a=()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))};r?(this._initialLoadDone=!0,a()):this._style.on("style.load",a)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(u){u===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=u,this._recalculateActiveFloors())}setActiveFloorsVisibility(u){this._updateActiveFloors(u),this._updateIndoorSelector()}setIndoorData(u){let r=!1;for(const[a,f]of Object.entries(u.buildings))if(this._buildings[a])for(const _ of f.floorIds)this._buildings[a].floorIds.add(_),this._buildings[a].floors[_]?this._mergeFloors(this._buildings[a].floors[_],f.floors[_]):(this._buildings[a].floors[_]=f.floors[_],r=!0);else this._buildings[a]=f,r=!0;r&&this._recalculateActiveFloors()}getIndoorTileOptions(u,r){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(u,r),indoorState:this._indoorState}:null}getControlState(){const u=this._buildings,r=this._closestBuildingId,a=r&&u?u[r]:void 0;if(!a)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let f=null;for(const x of a.floorIds)if(this._activeFloors&&this._activeFloors.has(x)){f=x;break}const _=Array.from(a.floorIds).map(x=>({id:x,name:a.floors[x].name,zIndex:a.floors[x].zIndex})).sort((x,w)=>w.zIndex-x.zIndex).filter((x,w,k)=>w===0||x.zIndex!==k[w-1].zIndex);return{selectedFloorId:f,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:_}}_updateUI(){this._initialLoadDone=!0;const u=this._style.map.transform,r=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,u.center,u.zoom,u.getBounds(),this._makeViewportPolygon());if(r!==this._closestBuildingId){const a=this._closestBuildingId;this._closestBuildingId=r,this._onBuildingTransition(a,r),this._updateIndoorSelector()}}_onBuildingTransition(u,r){if(!this._indoorState)return;!r&&u?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):!!r&&!u&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0))}_updateIndoorSelector(){this.fire(new c.x("selector-update",this.getControlState()))}_updateActiveFloors(u){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:u,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;const u=c.a5.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(r,a){if(r===a)return!0;if(!r||!a||r.size!==a.size)return!1;for(const f of r)if(!a.has(f))return!1;return!0})(u,this._activeFloors)||(this._activeFloors=u,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(u,r){r.geometry&&(u.geometry?(u.geometry.type==="Polygon"&&(u.geometry={type:"MultiPolygon",coordinates:[u.geometry.coordinates]}),r.geometry.type==="Polygon"?u.geometry.coordinates.push(r.geometry.coordinates):r.geometry.type==="MultiPolygon"&&u.geometry.coordinates.push(...r.geometry.coordinates)):u.geometry=r.geometry)}_makeViewportPolygon(){const u=this._style.map.transform,r=u.width,a=u.height;return[u.pointLocation(new c.au(0,0)),u.pointLocation(new c.au(r,0)),u.pointLocation(new c.au(r,a)),u.pointLocation(new c.au(0,a))].map(f=>new c.au(f.lng,f.lat))}},HdCoverageState:class{constructor(){this.coverageSourceCaches={},this.manager=new Ey}},updateFrcCoverage:function(u,r){r.manager.clear();for(const f in u._mergedHdRoadCoverageSourceCaches){const _=u._mergedHdRoadCoverageSourceCaches[f]._tiles;for(const x in _){const w=_[x];if(!w||!w.loaded())continue;const k=w.frcCoveragePolygons;r.manager.addTileCoverage(w.tileID.canonical,k&&k.length>0?k:[])}}const a=r.manager.updateSnapshotIfNeeded();if(u.map.painter&&(u.map.painter.frcCoverageSnapshot=a.empty()?null:a),!a.empty()){const f=[u._mergedOtherSourceCaches,u._mergedSymbolSourceCaches];for(const _ of f)for(const x in _){const w=_[x];for(const k in w._tiles){const A=w._tiles[k];A&&A.hasDeferredRoadStructure&&(A.hasDeferredRoadStructure=!1,w._reloadTile(+k,"reloading"))}}}},updateHdCoverageSourceCache:function(u,r,a){if(a.type!=="fill"||a.sourceLayer!==c.X||r.coverageSourceCaches[a.source])return;const f=u.getOwnSource(a.source);if(!f||f.type!=="vector")return;const _=`hd-road-coverage:${a.source}`,x=c.ea(_,u.scope),w=u._sourceCaches[_]=new Rs(x,f,c.aC.HdRoadCoverage);r.coverageSourceCaches[a.source]=w,w.setMaxzoomOverride(14),w.onAdd(u.map);const k=u._otherSourceCaches[a.source];k&&k._sourceLoaded&&(w._sourceLoaded=!0)},updateFrcCoverageFadeRange:function(u,r){let a=null,f=null;const _={globals:{zoom:0}};u.forEachFragmentStyle(x=>{if(a)return;const w=x.stylesheet?x.stylesheet.schema:null;if(!w||!w.sdCoverageFadeRange)return;const k=c.ea("sdCoverageFadeRange",x.scope),A=x.options?x.options.get(k):void 0,P=A?A.value||A.default:null;if(P){const j=P.evaluate(_);Array.isArray(j)&&j.length===2&&(j[0]>0||j[1]>0)&&(a=[j[0],j[1]])}const D=c.ea("sdCoverageSourceLayers",x.scope),z=x.options?x.options.get(D):void 0,F=z?z.value||z.default:null;if(F){const j=F.evaluate(_);Array.isArray(j)&&j.length>0&&(f=j)}else{const j=u.stylesheet&&u.stylesheet.imports||[];for(const $ of j)if($.id===x.scope){const W=$.config?$.config.sdCoverageSourceLayers:void 0;Array.isArray(W)&&W.length>0&&(f=W);break}}}),r.frcCoverageFadeRange=a,r.frcCoverageSourceLayers=a!=null?f||["road","structure"]:[]},FrcCoverageRenderer:class{constructor(){this.tileBuffers=new Map,this._context=null}update(u,r){this._context=u;const a=new Set;for(const f of r){if(f.frcMask===0)continue;let _=!1;for(const w of f.polygons)if(w.hasGeometry()){_=!0;break}if(!_)continue;const x=`${f.tileId.z}/${f.tileId.x}/${f.tileId.y}`;if(a.add(x),!this.tileBuffers.has(x)){const w=this._createBuffers(u,f);w&&this.tileBuffers.set(x,w)}}for(const f of this.tileBuffers.keys())if(!a.has(f)){const _=this.tileBuffers.get(f);_.vertexBuffer.destroy(),_.indexBuffer.destroy();for(const x of _.frcLevelSegments)x&&x.destroy();this.tileBuffers.delete(f)}}getBuffers(u){return this.tileBuffers.get(`${u.z}/${u.x}/${u.y}`)||null}destroy(){for(const u of this.tileBuffers.values()){u.vertexBuffer.destroy(),u.indexBuffer.destroy();for(const r of u.frcLevelSegments)r&&r.destroy()}this.tileBuffers.clear()}_createBuffers(u,r){const a=new c.aQ,f=new c.aT,_=[];for(const w of r.polygons){if(!w.hasGeometry()||w.rings.length===0)continue;const k=a.length,A=f.length,P=a.length,D=[],z=[];let F=0;for(let $=0;$<w.rings.length;$++){const W=w.rings[$];if(!(W.length<3)){$>0&&z.push(F);for(const J of W)a.emplaceBack(J.x,J.y),D.push(J.x,J.y),F++}}const j=c.c8(D,z.length>0?z:void 0);for(let $=0;$<j.length;$+=3)f.emplaceBack(P+j[$],P+j[$+1],P+j[$+2]);_.push({vertexOffset:k,indexOffset:A,vertexCount:a.length-k,indexCount:f.length-A,frcMask:w.frcMask})}if(a.length===0)return null;const x=new Array(9).fill(null);for(let w=0;w<9;++w){const k=1<<w;if(!(r.frcMask&k))continue;let A=1/0,P=0,D=0,z=!1;for(const F of _)F.frcMask&k&&(A=Math.min(A,F.indexOffset),P=Math.max(P,F.indexOffset+F.indexCount),D=Math.max(D,F.vertexOffset+F.vertexCount),z=!0);z&&(x[w]=c.aJ.simpleSegment(0,A,D,P-A))}return{vertexBuffer:u.createVertexBuffer(a,c.eQ.members),indexBuffer:u.createIndexBuffer(f),frcLevelSegments:x}}},drawFillFrcCoverageFirstPass:function(u){const{painter:r,bucket:a,coord:f,elevatedGeometry:_}=u,x=a.sourceLayerName==="road",w=a.sourceLayerName==="structure";if(!x&&!w||!r.frcCoverageSnapshot||_)return"fallthrough";const k=r.frcCoverageSnapshot.getTileOrParent(f.canonical);if(!k||k.frcMask===0)return"fallthrough";const A=a.hdExt&&a.hdExt.frcData,P=!!A&&!A.empty(),D=Tb(k.polygons);if(w&&!D)return"skip";if(w&&D)return u.polygonCoverageTiles.push({coord:u.coord,bufferData:u.bufferData,program:u.program,programConfiguration:u.programConfiguration,uniformValues:u.uniformValues,depthMode:u.depthMode,dynamicBuffers:u.dynamicBuffers,indexBuffer:u.indexBuffer,segments:u.segments,frcMask:k.frcMask}),"deferred";if(x&&P&&A){const z=k.frcMask,F=r.transform.zoom;for(const[j,$]of A.frcPerLevel)z&1<<j||$.segments.length!==0&&u.program.draw(r,u.drawMode,u.depthMode,u.stencilMode,u.colorMode,Ut.disabled,u.uniformValues,u.layer.id,u.bufferData.layoutVertexBuffer,u.indexBuffer,$,u.layer.paint,F,u.programConfiguration,u.dynamicBuffers);return A.frcNonRoadSegments.segments.length>0&&u.program.draw(r,u.drawMode,u.depthMode,u.stencilMode,u.colorMode,Ut.disabled,u.uniformValues,u.layer.id,u.bufferData.layoutVertexBuffer,u.indexBuffer,A.frcNonRoadSegments,u.layer.paint,F,u.programConfiguration,u.dynamicBuffers),"drawn"}return"fallthrough"},drawFillFrcCoverageSecondPass:function(u,r,a,f,_){if(a.length===0)return;const x=Rf(u),w=u.transform.zoom,k=(A,P,D)=>{D!==1&&(A.uniformValues.u_opacity_multiplier=D),A.program.draw(u,f,A.depthMode,P,_,Ut.disabled,A.uniformValues,r.id,A.bufferData.layoutVertexBuffer,A.indexBuffer,A.segments,r.paint,w,A.programConfiguration,A.dynamicBuffers),D!==1&&(A.uniformValues.u_opacity_multiplier=1)};Df(u,a,x,(A,P,D)=>k(A,D,1),(A,P,D)=>k(A,D,x))},drawLineFrcCoverageDetect:function(u,r,a,f,_,x,w,k,A,P){const D=r.hdExt&&r.hdExt.frcData;if(!D||D.frcPerLevel.size===0||!u.frcCoverageSnapshot||f)return null;const z=u.frcCoverageSnapshot.getTileOrParent(a.canonical);if(!z||z.frcMask===0)return null;const F=Tb(z.polygons),j=u.frcCoverageFadeRange,$=j!=null&&u.transform.zoom>=j[0];if(F&&$){let W=!1;for(const J of D.frcPerLevel.keys())if(z.frcMask&1<<J){W=!0;break}W&&P.push({coord:a,bucket:r,uniformValues:_,programConfiguration:x,program:w,depthMode:k,colorMode:A,frcMask:z.frcMask})}return{coverageTile:z,frcMask:z.frcMask,active:$,hasPolygonGeometry:F}},drawLineFrcRenderLine:function(u,r,a,f){const _=u.hdExt&&u.hdExt.frcData;if(!_)return;const x=r.frcMask;for(const[k,A]of _.frcPerLevel)x&1<<k||f(a,A);const w=_.frcNonRoadSegments;w.segments.length>0&&f(a,w)},drawLineFrcFadePass:function(u,r,a,f,_,x,w){if(f.hasPolygonGeometry)return;const k=r.hdExt&&r.hdExt.frcData;if(!k||!u.frcCoverageFadeRange)return;const[A,P]=u.frcCoverageFadeRange;if(A>=P)return;const D=1-Math.max(0,Math.min(1,(u.transform.zoom-A)/(P-A)));if(D<=0)return;const z=_?x:u.stencilModeForClipping(a),F=f.frcMask;for(const[j,$]of k.frcPerLevel)F&1<<j&&w(z,$,D)},drawLineFrcCoverageSecondPass:function(u,r,a){if(a.length===0)return;const f=u.context.gl,_=Rf(u),x=u.transform.zoom,w=(k,A,P,D)=>{const z=k.bucket.hdExt&&k.bucket.hdExt.frcData,F=z&&z.frcPerLevel.get(A);F&&F.segments.length!==0&&(D!==1&&(k.uniformValues.u_opacity_multiplier=D),k.program.draw(u,f.TRIANGLES,k.depthMode,P,k.colorMode,Ut.disabled,k.uniformValues,r.id,k.bucket.layoutVertexBuffer,k.bucket.indexBuffer,F,r.paint,x,k.programConfiguration,[k.bucket.layoutVertexBuffer2,k.bucket.patternVertexBuffer,k.bucket.zOffsetVertexBuffer,k.bucket.elevationIdColVertexBuffer,k.bucket.elevationGroundScaleVertexBuffer]),D!==1&&(k.uniformValues.u_opacity_multiplier=1))};Df(u,a,_,(k,A,P)=>w(k,A,P,1),(k,A,P)=>w(k,A,P,_))}},Zn=Py;async function Ld(){return Promise.resolve()}const Od=new Float32Array(c.dq([])),Lf=(u,r,a,f,_,x,w,k,A,P,D,z,F,j=[0,0,0],$,W,J,Q=1)=>{const ce=_.style.light,fe=ce.properties.get("position"),se=[-fe.x,-fe.y,fe.z],Ae=c.bV();ce.properties.get("anchor")==="viewport"&&(c.cu(Ae,-_.transform.angle),c.fK(se,se,Ae));const Ee=D.alphaMode==="MASK",Pe=ce.properties.get("color").toNonPremultipliedRenderColor(null),ye=F.paint.get("model-ambient-occlusion-intensity"),be=F.paint.get("model-color").constantOr(c.i.white).toNonPremultipliedRenderColor(null);return be.a=F.paint.get("model-color-mix-intensity").constantOr(0),J&&(be.r=J[0],be.g=J[1],be.b=J[2],be.a=J[3]),W&&(be.r=W.color.r,be.g=W.color.g,be.b=W.color.b,be.a=W.colorMix,z=W.emissionStrength,x*=W.opacity),{u_matrix:u,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:f||Od,u_lightpos:se,u_lightintensity:ce.properties.get("intensity"),u_lightcolor:[Pe.r,Pe.g,Pe.b],u_camera_pos:j,u_opacity:x,u_baseTextureIsAlpha:0,u_alphaMask:+Ee,u_alphaCutoff:D.alphaCutoff,u_baseColorFactor:w.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:k.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:A,u_roughnessFactor:P,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:be.toArray01(),u_aoIntensity:ye,u_emissive_strength:z,u_occlusionTextureTransform:$||[0,0,0,0],u_dithered_discard_threshold:Q}},Tm=(u,r=Od,a=Od)=>({u_matrix:u,u_instance:r,u_node_matrix:a}),Fd=(u,r,a=1)=>({u_matrix:u,u_color:r,u_overlay:0,u_overlay_scale:a}),Ta=new Float64Array(16),Kl=new Float64Array(16),Dy=new Float64Array(16),zc=new Float64Array(16),Ry=new Float64Array(16),Em=new Float64Array(16),b2=new Float64Array(16),km=[0,0,0],w2=new Float32Array(16),Am=[0,0,0],Ly=[0,0,0],Of=[];function Cm(u,r,a){const f=a.cameraWorldSizeForFog/a.worldSize;return c.fc(u,a.worldToFogMatrix,[f,f,1]),c.er(u,u,r),u}function El(u,r,a,f){return c.fQ(u,r,a),c.cm(f,c.n)||c.fc(u,u,f),u}function Im(u,r,a,f,_){const x=a.material,w=f.context,{baseColorTexture:k,metallicRoughnessTexture:A}=x.pbrMetallicRoughness,{normalTexture:P,occlusionTexture:D,emissionTexture:z}=x;function F($,W,J){if($&&(u.push(W),w.activeTexture.set(w.gl.TEXTURE0+J),$.gfxTexture)){const{minFilter:Q,magFilter:ce,wrapS:fe,wrapT:se}=$.sampler;$.gfxTexture.bindExtraParam(Q,ce,fe,se)}}F(k,"HAS_TEXTURE_u_baseColorTexture",5),F(A,"HAS_TEXTURE_u_metallicRoughnessTexture",6),F(P,"HAS_TEXTURE_u_normalTexture",7),F(D,"HAS_TEXTURE_u_occlusionTexture",8),F(z,"HAS_TEXTURE_u_emissionTexture",9),_&&(_.texture||(_.texture=new c.a$(f.context,_.image,[_.image.height,_.image.height,_.image.height],w.gl.RGBA8)),w.activeTexture.set(w.gl.TEXTURE0+10),_.texture&&_.texture.bind(w.gl.LINEAR,w.gl.CLAMP_TO_EDGE),u.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(u.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(u.push(a.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(u.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(u.push("HAS_ATTRIBUTE_a_pbr"),u.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),x.alphaMode!=="OPAQUE"&&x.alphaMode!=="MASK"||u.push("UNPREMULT_TEXTURE_IN_SHADER"),x.defined||u.push("DIFFUSE_SHADED");const j=f.shadowRenderer;j&&(u.push("RENDER_SHADOWS"),j.useNormalOffset&&u.push("NORMAL_OFFSET"))}function Mm(u,r,a,f,_,x){const w=u.modelOpacity,k=r.context,A=new Vt(r.context.gl.LEQUAL,u.isLightMesh?Vt.ReadOnly:Vt.ReadWrite,r.depthRangeFor3D),P=r.transform,D=u.mesh,z=D.material,F=z.pbrMetallicRoughness,j=r.style.fog;r.transform.projection.zAxisUnit==="pixels"?Ta.set(u.nodeModelMatrix):c.er(Ta,f.zScaleMatrix,u.nodeModelMatrix),c.er(Ta,f.negCameraPosMatrix,Ta),c.dr(Kl,Ta),c.fR(Kl,Kl);const $=a.paint.get("model-color-use-theme").constantOr("default")==="none",W=a.paint.get("model-emissive-strength").constantOr(0),J=Lf(u.worldViewProjection,Ta,Kl,null,r,w,F.baseColorFactor,z.emissiveFactor,F.metallicFactor,F.roughnessFactor,z,W,a,void 0,void 0,u.materialOverride,u.modelColor),Q={defines:[]},ce=[],fe=r.shadowRenderer;fe&&(fe.useNormalOffset=!1),Im(Q.defines,ce,D,r,$?null:a.lut);let se=null;if(j&&(se=Cm(Dy,u.nodeModelMatrix,r.transform),P.projection.name!=="globe")){const Pe=D.aabb.min,ye=D.aabb.max,[be,Ce]=j.getOpacityForBounds(se,Pe[0],Pe[1],ye[0],ye[1]);Q.overrideFog=be>=Ua||Ce>=Ua}const Ae=Pc(r,a.paint.get("model-cutoff-fade-range"));Ae.shouldRenderCutoff&&Q.defines.push("RENDER_CUTOFF");const Ee=r.getOrCreateProgram("model",Q);r.uploadCommonUniforms(k,Ee,null,se,Ae),r.renderPass!=="shadow"&&fe&&fe.setupShadowsFromMatrix(u.nodeModelMatrix,Ee),Ee.draw(r,k.gl.TRIANGLES,A,_,x,D.material.doubleSided?Ut.disabled:Ut.backCCW,J,a.id,D.vertexBuffer,D.indexBuffer,D.segments,a.paint,r.transform.zoom,void 0,ce)}function Oy(u,r){return u.style._importedAsBasemap?"basemap":r.scope}function Ff(u,r,a,f,_,x,w,k,A,P){const D=u.transform,z=!!r.isGeometryBloom&&r.isGeometryBloom;if(r.minZoom!==void 0&&u.transform.zoom<r.minZoom||r.maxZoom!==void 0&&u.transform.zoom>r.maxZoom||z&&u.renderPass==="shadow")return;const F=D.projection.name==="globe"?c.bR(a,D):[...a];c.er(F,F,r.globalMatrix);const j=c.er([],f,F);if(r.meshes)for(const $ of r.meshes){const W=k.get($.material.name);if(W&&W.opacity<=0)continue;if($.material.alphaMode!=="BLEND"){w.push({mesh:$,depth:0,modelIndex:_,worldViewProjection:j,nodeModelMatrix:F,isLightMesh:z,materialOverride:W,modelOpacity:A,modelColor:P,node:r,modelMatrix:a});continue}const J=c.fL([],$.centroid,j);!D.isOrthographic&&J[2]<=0||x.push({mesh:$,depth:J[2],modelIndex:_,worldViewProjection:j,nodeModelMatrix:F,isLightMesh:z,materialOverride:W,modelOpacity:A,modelColor:P,node:r,modelMatrix:a})}if(r.children)for(const $ of r.children)Ff(u,$,a,f,_,x,w,k,A,P)}function Ea(u,r,a,f,_){const x=a.shadowRenderer;if(!x)return;const w=x.getShadowPassDepthMode(),k=_||x.calculateShadowPassMatrixFromMatrix(r),A=Tm(k);a.getOrCreateProgram("modelDepth").draw(a,a.context.gl.TRIANGLES,w,rn.disabled,tn.disabled,Ut.disabled,A,f.id,u.vertexBuffer,u.indexBuffer,u.segments,f.paint,a.transform.zoom,void 0,void 0)}function zf(u,r,a,f){const _=function(D,z){if(z.footprintDebugMesh)return z.footprintDebugMesh;if(!z.footprint)return null;const F=D.context,j=z.footprint.vertices,$=z.footprint.indices,W=new c.aQ;W.reserve(j.length);for(const Ce of j)W.emplaceBack(Ce.x,Ce.y);const J=new c.aT;J.reserve($.length);for(let Ce=0;Ce<$.length;Ce+=3)J.emplaceBack($[Ce],$[Ce+1],$[Ce+2]);const Q=F.createVertexBuffer(W,c.eQ.members),ce=F.createIndexBuffer(J),fe=c.aJ.simpleSegment(0,0,j.length,$.length),se=z.id||z.name||"footprint";let Ae;const Ee=parseInt(se,10);Ae=isNaN(Ee)?function(Ce){let ze=0;for(let Oe=0;Oe<Ce.length;Oe++)ze=(ze<<5)-ze+Ce.charCodeAt(Oe)|0;return ze}(se):Ee;const Pe=c.cg(Ae),ye=c.cg(Ae+1),be=c.cg(Ae+2);return z.footprintDebugMesh={vertexBuffer:Q,indexBuffer:ce,segments:fe,color:new c.i(Pe,ye,be,.5)},z.footprintDebugMesh}(u,a);if(!_)return;const x=u.context,w=x.gl,k=u.getOrCreateProgram("debug"),A=_.color,P=Vt.disabled;x.activeTexture.set(w.TEXTURE0),u.emptyTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),k.draw(u,w.TRIANGLES,P,rn.disabled,tn.alphaBlended,Ut.disabled,Fd(f,A.toPremultipliedRenderColor(null)),"$debug",_.vertexBuffer,_.indexBuffer,_.segments)}function Pm(u,r,a,f,_,x){for(const w of _){const k=Object.assign({},f);k.part=w;const A={type:"Unknown",id:r,properties:k},P={orientation:u.paint.get("model-rotation").evaluate(A,a)};x.set(w,P)}}function Eb(u,r,a,f,_,x){for(const w of _){const k=Object.assign({},f);k.part=w;const A={type:"Unknown",id:r,properties:k},P={color:u.paint.get("model-color").evaluate(A,a),colorMix:u.paint.get("model-color-mix-intensity").evaluate(A,a),opacity:u.paint.get("model-opacity").evaluate(A,a),emissionStrength:u.paint.get("model-emissive-strength").evaluate(A,a)};x.set(w,P)}}function Yl(u,r,a,f,_){let x=!1;for(const k of f)k.modelOpacity!==1&&(Mm(k,u,r,_[k.modelIndex],rn.disabled,tn.disabled),x=!0);for(const k of f)Mm(k,u,r,_[k.modelIndex],k.modelOpacity!==1?u.stencilModeFor3D():rn.disabled,u.colorModeForRenderPass());x&&u.resetStencilClippingMasks();const w=tn.additive;for(const k of a)Mm(k,u,r,_[k.modelIndex],rn.disabled,k.isLightMesh?w:u.colorModeForRenderPass())}function Fy(u,r,a){const f=r.updateZoomBasedPaintProperties(),_=function(x,w,k){let A,P,D,z=x.terrain?x.terrain.exaggeration():0;if(x.terrain&&z>0){const F=x.terrain,j=F.findDEMTileFor(k);j&&j.dem?A=c.k.create(F,k,j):z=0}if(z===0&&(w.terrainElevationMin=0,w.terrainElevationMax=0),z===w.validForExaggeration&&(z===0||A&&A._demTile&&A._demTile.tileID===w.validForDEMTile.id&&A._dem._timestamp===w.validForDEMTile.timestamp))return!1;for(const F in w.instancesPerModel){const j=w.instancesPerModel[F];for(let $=0;$<j.instancedDataArray.length;++$){const W=(A?z*A.getElevationAt(0|j.instancedDataArray.float32[16*$],0|j.instancedDataArray.float32[16*$+1],!0,!0):0)+j.instancesEvaluatedElevation[$];j.instancedDataArray.float32[16*$+6]=W,P=P?Math.min(w.terrainElevationMin,W):W,D=D?Math.max(w.terrainElevationMax,W):W}}return w.terrainElevationMin=P||0,w.terrainElevationMax=D||0,w.validForExaggeration=z,w.validForDEMTile=A&&A._demTile?{id:A._demTile.tileID,timestamp:A._dem._timestamp}:{id:void 0,timestamp:0},!0}(u,r,a);(f||_)&&(r.uploaded=!1,r.upload(u.context))}const Ys={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new c.A([0,0,0],[c.r,c.r,0])};function kb(u,r){const a=1<<u.canonical.z,f=r.getFreeCameraOptions().position,_=r.elevation,x=u.canonical.x/a,w=(u.canonical.x+1)/a,k=u.canonical.y/a,A=(u.canonical.y+1)/a;let P=r._centerAltitude;if(_){const j=_.getMinMaxForTile(u);j&&j.max>P&&(P=j.max)}const D=c.bG(f.x,x,w)-f.x,z=c.bG(f.y,k,A)-f.y,F=c.em(P,r.center.lat)-f.z;return r._zoomFromMercatorZ(Math.sqrt(D*D+z*z+F*F))}function zy(u,r,a,f,_,x,w){const k=u.context,A=u.renderPass==="shadow",P=u.shadowRenderer,D=A&&P?P.getShadowPassDepthMode():new Vt(k.gl.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D),z=u.isTileAffectedByFog(x),F=u.transform.projection.name==="globe";if(a.meshes)for(const j of a.meshes){const $=F?[]:["MODEL_POSITION_ON_GPU"],W=[];let J,Q,ce;const fe=!F&&f.instancedDataArray.length>20;fe&&$.push("INSTANCED_ARRAYS");const se=Pc(u,r.paint.get("model-cutoff-fade-range"));if(se.shouldRenderCutoff&&$.push("RENDER_CUTOFF"),A&&P)J=u.getOrCreateProgram("modelDepth",{defines:$}),Q=Tm(w.shadowTileMatrix,w.shadowTileMatrix,a.globalMatrix),ce=tn.disabled;else{Im($,W,j,u,r.paint.get("model-color-use-theme").constantOr("default")==="none"?null:r.lut),J=u.getOrCreateProgram("model",{defines:$,overrideFog:z});const Ee=j.material,Pe=Ee.pbrMetallicRoughness,ye=r.paint.get("model-opacity").constantOr(1),be=r.paint.get("model-emissive-strength").constantOr(0);Q=Lf(x.expandedProjMatrix,a.globalMatrix,w2,null,u,ye,Pe.baseColorFactor,Ee.emissiveFactor,Pe.metallicFactor,Pe.roughnessFactor,Ee,be,r,_),P&&(w.shadowUniformsInitialized?J.setShadowUniformValues(k,P.getShadowUniformValues()):(P.setupShadows(x.toUnwrapped(),J,"model-tile"),w.shadowUniformsInitialized=!0)),ce=se.shouldRenderCutoff||ye<1||Ee.alphaMode!=="OPAQUE"?tn.alphaBlended:tn.unblended}u.uploadCommonUniforms(k,J,x.toUnwrapped(),null,se);const Ae=j.material.doubleSided?Ut.disabled:Ut.backCCW;if(fe)W.push(f.instancedDataBuffer),J.draw(u,k.gl.TRIANGLES,D,rn.disabled,ce,Ae,Q,r.id,j.vertexBuffer,j.indexBuffer,j.segments,r.paint,u.transform.zoom,void 0,W,f.instancedDataArray.length);else{const Ee=A?"u_instance":"u_normal_matrix";for(let Pe=0;Pe<f.instancedDataArray.length;++Pe)Q[Ee]=new Float32Array(f.instancedDataArray.arrayBuffer,64*Pe,16),J.draw(u,k.gl.TRIANGLES,D,rn.disabled,ce,Ae,Q,r.id,j.vertexBuffer,j.indexBuffer,j.segments,r.paint,u.transform.zoom,void 0,W)}}if(a.children)for(const j of a.children)zy(u,r,j,f,_,x,w)}function By(u,r,a,f,_){const x=u.node;if(x.lodMeshes&&x.lodMeshes.length>0)if(u.targetLod<0)u.targetLod=r>f?1:0;else{const w=_>0?a/1e3/_:1;u.targetLod=c.bG(r>f?u.targetLod+w:u.targetLod-w,0,1)}else u.targetLod=0}function Ny(u,r,a,f){if(!a.modelManager)return!0;const _=a.modelManager;if(!a.shadowRenderer)return!0;const x=a.shadowRenderer,w=r.aabb;let k=!0,A=u.maxHeight;if(A===0){let D=0;for(const z in u.instancesPerModel){const F=_.getModel(z,f);F?D=Math.max(D,Math.max(Math.max(F.aabb.max[0],F.aabb.max[1]),F.aabb.max[2])):k=!1}A=u.maxScale*D*1.41+u.maxVerticalOffset,k&&(u.maxHeight=A)}w.max[2]=A,w.min[2]+=u.terrainElevationMin,w.max[2]+=u.terrainElevationMax,c.fL(w.min,w.min,r.tileMatrix),c.fL(w.max,w.max,r.tileMatrix);const P=w.intersects(x.getCurrentCascadeFrustum());return a.currentShadowCascade===0&&(u.isInsideFirstShadowMapFrustum=P===2),P===0}function S2(u,r){const a=u.uniformValues.u_cutoff_params[0],f=u.uniformValues.u_cutoff_params[1],_=u.uniformValues.u_cutoff_params[2],x=u.uniformValues.u_cutoff_params[3];return f===a||x===_?1:c.bG(((r-a)/(f-a)-_)/(x-_),0,1)}function Ab(u,r,a,f){if(r.pitch<20)return 1;const _=r.getWorldToCameraMatrix();c.er(_,_,u);const x=c.cy(a.min[0],a.min[1],a.min[2],1);let w=c.fM(c.bX(),x,_),k=w,A=w;x[1]=a.max[1],w=c.fM(c.bX(),x,_),k=w[1]<k[1]?w:k,A=w[1]>A[1]?w:A,x[0]=a.max[0],w=c.fM(c.bX(),x,_),k=w[1]<k[1]?w:k,A=w[1]>A[1]?w:A,x[1]=a.min[1],w=c.fM(c.bX(),x,_),k=w[1]<k[1]?w:k,A=w[1]>A[1]?w:A;const P=c.bG(f[0],0,1),D=100*r.pixelsPerMeter*c.bG(f[1],0,1),z=c.bG(f[2],0,1),F=c.d_(c.bX(),k,A,P),j=Math.tan(.5*r.fovX),$=-F[2]*j;if(D===0)return F[1]<-Math.abs($)?z:1;const W=(-Math.abs($)-F[1])/D,J=c.bG(c.dY(1,z,W),z,1);return c.dY(1,J,c.bG((r.pitch-20)/20,0,1))}const Bc={drawModels:function(u,r,a,f){if(u.renderPass==="opaque")return;const _=a.paint.get("model-opacity").constantOr(1),x=a.paint.get("model-elevation-reference"),w=x==="ground",k=x==="ground";if(_===0)return;const A=a.paint.get("model-cast-shadows");if(u.renderPass==="shadow"&&(!A||u.terrain&&_<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof c.bh))return;const P=u.shadowRenderer,D=a.paint.get("model-receive-shadows");P&&(P.useNormalOffset=!0,D||(P.enabled=!1));const z=()=>{P&&(P.useNormalOffset=!0,D||(P.enabled=!0))},F=r.getSource();if(u.renderPass==="light-beam"&&F.type!=="batched-model")return;if(F.type==="vector"||F.type==="geojson")return function(se,Ae,Ee,Pe,ye){const be=se.transform,Ce=be.projection.name==="globe",ze=be.getFreeCameraOptions().position;if(!se.modelManager)return;const Oe=se.modelManager;Ee.modelManager=Oe;const Ze=se.shadowRenderer;if(!Object.hasOwn(Ee._unevaluatedLayout._values,"model-id"))return;const We=Ee._unevaluatedLayout._values["model-id"],ut=Object.assign({},Ee.layout.get("model-id").parameters),Ne=se.style.order.indexOf(Ee.fqid),Je=Ee.paint.get("model-opacity").constantOr(1);for(const Be of Pe){const it=Ae.getTile(Be).getBucket(Ee);if(!it||it.projection.name!==be.projection.name)continue;const Qe=it.getModelUris();if(Qe&&!it.modelsRequested&&(Oe.addModelsFromBucket(Qe,ye),it.modelsRequested=!0),Ce)ut.zoom=Be.overscaledZ;else{const Nt=kb(Be,be);ut.zoom=Nt}const ot=We.possiblyEvaluate(ut);if(Fy(se,it,Be),Ys.shadowUniformsInitialized=!1,Ys.useSingleShadowCascade=!!Ze&&Ze.getMaxCascadeForTile(Be.toUnwrapped())===0,se.renderPass==="shadow"&&Ze){if(se.currentShadowCascade===1&&it.isInsideFirstShadowMapFrustum)continue;const Nt=be.calculatePosMatrix(Be.toUnwrapped(),be.worldSize);if(Ys.tileMatrix.set(Nt),Ys.shadowTileMatrix.set(Ze.calculateShadowPassMatrixFromMatrix(Nt)),Ys.aabb.min=[0,0,0],Ys.aabb.max[0]=Ys.aabb.max[1]=c.r,Ys.aabb.max[2]=0,Ny(it,Ys,se,Ee.scope))continue}const Et=1<<Be.canonical.z,ht=[((ze.x-Be.wrap)*Et-Be.canonical.x)*c.r,(ze.y*Et-Be.canonical.y)*c.r,ze.z*Et*c.r];se.conflationActive&&Object.keys(it.instancesPerModel).length>0&&se.style.isLayerClipped(Ee,Ae.getSource())&&it.updateReplacement(Be,se.replacementSource,Ne,Ee.scope)&&(it.uploaded=!1,it.upload(se.context));let gt=0;const ct=new Array,Ht=new Array,Ot=new Array;for(let Nt in it.instancesPerModel){const $t=it.instancesPerModel[Nt];$t.features.length>0&&!Ce&&(Nt=ot.evaluate($t.features[0].feature,{}));const an=Oe.getModel(Nt,ye);if(an||Oe.hasURLBeenRequested(Nt)||it.modelUris.includes(Nt)||(it.modelUris.push(Nt),it.modelsRequested=!1),an&&an.uploaded)if(Ce){const nn=c.fa([],[ze.x,ze.y,ze.z],se.transform.worldSize);c.eu(nn,nn);for(let xn=0;xn<$t.instancedDataArray.length;++xn){const En=[0,0,0],qt=[1,1,1],fn=c.bW(),un=$t.tileCoordinatesForInstance(xn),Dn=$t.transformForInstance(xn);c.d7(qt,Dn),c.d5(fn,Dn),c.cH(En,fn);const Jn=$t.translationForInstance(xn),Mr=new c.ab(0,0);c.fG(it.canonical,Mr,un.x,un.y);const Hn=c.bT();c.bA(Hn,an,se.transform,Mr,En,qt,Jn,!0,!1,!1);const Wn=$t.colorForInstance(xn),Fr=c.cw([],nn),or=c.cX(Mr.lat,se.transform.zoom),ri=c.cv([],[1,1,1/or]);Ot.push({zScaleMatrix:ri,negCameraPosMatrix:Fr});for(const Pn of an.nodes)Ff(se,Pn,Hn,se.transform.expandedFarZProjMatrix,gt,ct,Ht,an.materialOverrides,Je,Wn);++gt}}else for(const nn of an.nodes)zy(se,Ee,nn,$t,ht,Be,Ys)}if(Ce)if(se.renderPass==="shadow"){for(const Nt of Ht)Ea(Nt.mesh,Nt.nodeModelMatrix,se,Ee);for(const Nt of ct)Ea(Nt.mesh,Nt.nodeModelMatrix,se,Ee)}else Yl(se,Ee,ct,Ht,Ot)}}(u,r,a,f,Oy(u,a)),void z();if(!F.loaded())return;if(F.type==="batched-model")return function(se,Ae,Ee,Pe){Ee.resetLayerRenderingStats(se);const ye=se.context,be=se.transform,Ce=se.style.fog,ze=se.shadowRenderer;if(be.projection.name!=="mercator")return void c.f_(`Drawing 3D landmark models for ${be.projection.name} projection is not yet implemented`);const Oe=se.transform.getFreeCameraOptions().position,Ze=c.fa([],[Oe.x,Oe.y,Oe.z],se.transform.worldSize),We=c.eu([],Ze),ut=c.cw([],We),Ne=c.cX(be.center.lat,be.zoom),Je=c.cv([],[1,1,1/Ne]),Be=c.er([],ut,Je),it=Ee.paint.get("model-opacity").constantOr(1),Qe=new Vt(ye.gl.LEQUAL,Vt.ReadWrite,se.depthRangeFor3D),ot=new Vt(ye.gl.LEQUAL,Vt.ReadOnly,se.depthRangeFor3D),Et=new c.A([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),ht=se.renderPass==="shadow",gt=se.renderPass==="light-beam",ct=Ee.paint.get("model-color-use-theme").constantOr("default")==="none",Ht=ht&&ze?ze.getCurrentCascadeFrustum():be.getFrustum(be.scaleZoom(be.worldSize)),Ot=Ee.paint.get("model-front-cutoff"),Nt=Ot[2]<1,$t=Pc(se,Ee.paint.get("model-cutoff-fade-range")),an=Ee.getLayerRenderingStats();(function(nn,xn,En,qt){const fn=nn.terrain?nn.terrain.exaggeration():0,un=nn.transform.zoom;for(const Dn of qt){const Jn=xn.getTile(Dn).getBucket(En);Jn&&(Jn.setFilter(En.filter),nn.conflationActive&&Jn.updateReplacement(Dn,nn.replacementSource),Jn.evaluateTransform(nn,En),nn.terrain&&fn>0&&Jn.elevationUpdate(nn.terrain,fn,Dn,En.source),Jn.needsReEvaluation(nn,un,En)&&Jn.evaluate(En))}})(se,Ae,Ee,Pe),function(){const nn=new Map;let xn,En,qt;Nt?(xn=Pe.length-1,En=-1,qt=-1):(xn=0,En=Pe.length,qt=1);const fn=c.bU(),un=new c.au(0,0);for(let Dn=xn;Dn!==En;Dn+=qt){const Jn=Pe[Dn],Mr=Ae.getTile(Jn).getBucket(Ee);if(!Mr||!Mr.uploaded)continue;let Hn=!1;ze&&(Hn=ze.getMaxCascadeForTile(Jn.toUnwrapped())===0);const Wn=be.calculatePosMatrix(Jn.toUnwrapped(),be.worldSize),Fr=!!(Mr.modelTraits&c.aj.HasMapboxMeshFeatures);c.er(zc,Be,Wn),c.er(Ry,be.expandedFarZProjMatrix,Wn),c.dr(Em,zc),c.fR(Em,Em);const or=!ht&&ze&&ze.enabled?ze.computeCascadeTileMatrices(Wn):null;!ht&&Nt&&(c.dr(Kl,Wn),c.fL(fn,Ze,Kl),un.x=fn[0],un.y=fn[1]);const ri=[];Mr.setFilter(Ee.filter);for(const Pn of Mr.getNodesInfo()){if(Pn.hiddenByReplacement||!Pn.node.meshes)continue;const Rn=Pn.node;let Kt=0;se.terrain&&Rn.elevation&&(Kt=Rn.elevation*se.terrain.exaggeration());const lr=(()=>{const Vr=Pn.aabb,Hi=Et.min,mr=Et.max;return Hi[0]=Vr.min[0],Hi[1]=Vr.min[1],Hi[2]=Vr.min[2]+Kt,mr[0]=Vr.max[0],mr[1]=Vr.max[1],mr[2]=Vr.max[2]+Kt,c.fL(Hi,Hi,Wn),c.fL(mr,mr,Wn),Et})(),nr=Pn.evaluatedScale;if(nr[0]<=1&&nr[1]<=1&&nr[2]<=1&&lr.intersects(Ht)===0)continue;if(!ht){const Vr=lr.min,Hi=lr.max;Am[0]=.5*(Vr[0]+Hi[0]),Am[1]=.5*(Vr[1]+Hi[1]),Am[2]=.5*(Vr[2]+Hi[2]);const mr=c.c5(Ze,Am)*Ne;By(Pn,mr,Math.min(se._debugParams.dt,1e3/30),se._debugParams.lodSwitchDistance,se._debugParams.lodSwitchFadeDuration)}if(!ht&&Nt){const Vr=.16666666666666666;Pn.cameraCollisionOpacity=Ze[0]>lr.min[0]&&Ze[0]<lr.max[0]&&Ze[1]>lr.min[1]&&Ze[1]<lr.max[1]&&Ze[2]*Ne<lr.max[2]&&Rn.footprint&&c.eI(un,Rn.footprint)?Math.max(Pn.cameraCollisionOpacity-Vr,0):Math.min(1,Pn.cameraCollisionOpacity+Vr)}const si=1/c.fH(Jn.canonical),Lr=Rn.anchor?Rn.anchor[0]:0,co=Rn.anchor?Rn.anchor[1]:0,yo=[Lr*(nr[0]-1)+Pn.evaluatedTranslation[0]*si,co*(nr[1]-1)+Pn.evaluatedTranslation[1]*si,Kt+Pn.evaluatedTranslation[2]],Co=El(new Float64Array(16),Wn,yo,nr),sr=c.er([],Co,Rn.globalMatrix),zr=c.er([],be.expandedFarZProjMatrix,sr),Ei=zr[2]*Lr+zr[6]*co+zr[10]*Kt+zr[14];Rn.hidden=!1;let di=it;ht||(Nt&&(di*=Pn.cameraCollisionOpacity,di*=Ab(Co,be,Pn.aabb,Ot)),di*=S2($t,Ei)),di!==0?ri.push({nodeInfo:Pn,depth:Ei,opacity:di,wvpForNode:zr,nodeModelMatrix:sr,tileModelMatrix:Co,tileTranslation:yo}):Rn.hidden=!0}ht||ri.sort((Pn,Rn)=>!Nt||Pn.opacity===1&&Rn.opacity===1?Pn.depth<Rn.depth?-1:1:Pn.opacity===1?-1:Rn.opacity===1?1:Pn.depth>Rn.depth?-1:1);for(const Pn of ri){const Rn=Pn.nodeInfo,Kt=Rn.node;let lr=null;if(se._debugParams.show3DModelFootprints&&Kt.footprint){const di=Kt.id||Kt.name||"footprint";if(!nn.has(di)){const Vr=El(new Float64Array(16),Ry,Pn.tileTranslation,Pn.nodeInfo.evaluatedScale);nn.set(di,{node:Kt,mvp:Vr})}}const nr=Pn.nodeInfo.evaluatedScale;El(Ta,zc,Pn.tileTranslation,nr),km[0]=1/nr[0],km[1]=-1/nr[1],km[2]=1/nr[2],c.fc(Kl,Em,km),c.er(Ta,Ta,Kt.globalMatrix);const si=Fr?0:Rn.evaluatedRMEA[0][2],Lr=Rn.targetLod,co=Kt.lodMeshes&&Kt.lodMeshes.length>0,yo=co&&Lr>0&&Lr<1;if(ht&&co&&Math.round(Lr)===1)continue;const Co=!ht&&Ce?Cm(Dy,Pn.nodeModelMatrix,se.transform):null,sr=ht&&ze?ze.calculateShadowPassMatrixFromMatrix(Pn.nodeModelMatrix):null,zr=yo?2:1,Ei=co&&Math.round(Lr)===1;for(let di=0;di<zr;++di){const Vr=yo?di===1:Ei,Hi=Vr?Kt.lodMeshes:Kt.meshes,mr=yo?Vr?-Lr:1-Lr:1;for(let br=0;br<Hi.length;++br){const On=Hi[br],ai=!Vr&&br===Kt.lightMeshIndex;let Io=Pn.wvpForNode;if(ai){if(!gt&&!se.terrain&&se.shadowRenderer){se.currentLayer<se.firstLightBeamLayer&&(se.firstLightBeamLayer=se.currentLayer);continue}Io=El(b2,Ry,Pn.tileTranslation,Pn.nodeInfo.evaluatedScale)}else if(gt)continue;const ur={defines:[]},no=[],na=!!On.normalBuffer;if(!ht&&ze&&(ze.useNormalOffset=na),Im(ur.defines,no,On,se,ct?null:Ee.lut),Fr||ur.defines.push("DIFFUSE_SHADED"),Hn&&ur.defines.push("SHADOWS_SINGLE_CASCADE"),an&&(ht?an.numRenderedVerticesInShadowPass+=On.vertexArray.length:an.numRenderedVerticesInTransparentPass+=On.vertexArray.length),ht){Ea(On,Pn.nodeModelMatrix,se,Ee,sr);continue}if(Ce&&be.projection.name!=="globe"){const Ts=On.aabb.min,Qa=On.aabb.max,[ic,oh]=Ce.getOpacityForBounds(Co,Ts[0],Ts[1],Qa[0],Qa[1]);ur.overrideFog=ic>=Ua||oh>=Ua}const Mo=On.material;let hs;Mo.occlusionTexture&&Mo.occlusionTexture.offsetScale&&(hs=Mo.occlusionTexture.offsetScale,ur.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),yo&&ur.defines.push("DITHERED_DISCARD");const ra=se.getOrCreateProgram("model",ur);if(!ht&&ze&&ze.enabled)if(lr!==na){for(let Ts=0;Ts<or.length;Ts++)El(Of[Ts]=Of[Ts]||new Float64Array(16),or[Ts],Pn.tileTranslation,Pn.nodeInfo.evaluatedScale);ze.setupShadowsFromCascadeMatrices(Of,ra,na),lr=na}else ra.setShadowUniformValues(ye,ze.getShadowUniformValues());se.uploadCommonUniforms(ye,ra,null,Co);const zs=Mo.pbrMetallicRoughness;zs.metallicFactor=.9,zs.roughnessFactor=.5;const ia=Lf(Io,Ta,Kl,Kt.globalMatrix,se,Pn.opacity,zs.baseColorFactor,Mo.emissiveFactor,zs.metallicFactor,zs.roughnessFactor,Mo,si,Ee,Ly,hs,void 0,void 0,mr);!ai&&(Rn.hasTranslucentParts||Pn.opacity<1)&&ra.draw(se,ye.gl.TRIANGLES,Qe,rn.disabled,tn.disabled,Ut.backCCW,ia,Ee.id,On.vertexBuffer,On.indexBuffer,On.segments,Ee.paint,se.transform.zoom,void 0,no),ra.draw(se,ye.gl.TRIANGLES,ai?ot:Qe,rn.disabled,ai||Pn.opacity<1||Rn.hasTranslucentParts?tn.alphaBlended:tn.unblended,Ut.backCCW,ia,Ee.id,On.vertexBuffer,On.indexBuffer,On.segments,Ee.paint,se.transform.zoom,void 0,no)}}}}if(se._debugParams.show3DModelFootprints&&nn.size>0){const Dn=Array.from(nn.keys()).sort();for(const Jn of Dn){const{node:Mr,mvp:Hn}=nn.get(Jn);zf(se,0,Mr,Hn)}}}()}(u,r,a,f),void z();if(F.type!=="model")return;const j=F.getModels(),$=[],W=u.transform.getFreeCameraOptions().position,J=c.fa([],[W.x,W.y,W.z],u.transform.worldSize);c.eu(J,J);const Q=[],ce=[];let fe=0;for(const se of j){const Ae=r.getFeatureState("",se.id),Ee={type:"Unknown",id:se.id,properties:se.featureProperties},Pe=a.paint.get("model-rotation").evaluate(Ee,Ae),ye=a.paint.get("model-scale").evaluate(Ee,Ae),be=a.paint.get("model-translation").evaluate(Ee,Ae),Ce=a.paint.get("model-opacity").evaluate(Ee,Ae);Pm(a,se.id,Ae,se.featureProperties,se.nodeOverrideNames,se.nodeOverrides),Eb(a,se.id,Ae,se.featureProperties,se.materialOverrideNames,se.materialOverrides),se.nodeOverrides.size>0&&se.computeBoundsAndApplyParent(),se.computeModelMatrix(u,Pe,ye,be,k,w,!1);const ze=c.cw([],J),Oe=c.cX(se.position.lat,u.transform.zoom),Ze=c.cv([],[1,1,1/Oe]);$.push({zScaleMatrix:Ze,negCameraPosMatrix:ze});for(const We of se.nodes)Ff(u,We,se.matrix,u.transform.expandedFarZProjMatrix,fe,Q,ce,se.materialOverrides,Ce);fe++}if(Q.sort((se,Ae)=>Ae.depth-se.depth),u.renderPass!=="shadow"){if(u._debugParams.show3DModelFootprints){const se=u.transform.projMatrix,Ae=new Map,Ee=(ye,be)=>{if(ye.footprint){const Ce=ye.id||ye.name||"footprint";if(!Ae.has(Ce)){const ze=c.er([],se,be);Ae.set(Ce,{node:ye,mvp:ze})}}};for(const ye of ce)Ee(ye.node,ye.modelMatrix);for(const ye of Q)Ee(ye.node,ye.modelMatrix);const Pe=Array.from(Ae.keys()).sort();for(const ye of Pe){const{node:be,mvp:Ce}=Ae.get(ye);zf(u,0,be,Ce)}}Yl(u,a,Q,ce,$),z()}else{for(const se of ce)Ea(se.mesh,se.nodeModelMatrix,u,a);for(const se of Q)Ea(se.mesh,se.nodeModelMatrix,u,a);z()}},prepare:function(u,r,a){const f=r.getSource();if(!f.loaded())return;if(f.type==="vector"||f.type==="geojson")return void(a.modelManager&&a.modelManager.upload(a,Oy(a,u)));if(f.type==="batched-model"||f.type!=="model")return;const _=f.getModels();for(const x of _)x.upload(a.context)},shaders:{model:wn(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform float u_opacity;
|
||
#ifdef DITHERED_DISCARD
|
||
uniform float u_dithered_discard_threshold;
|
||
#endif
|
||
uniform 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;
|
||
#ifdef RENDER_SHADOWS
|
||
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
|
||
#endif
|
||
#ifdef OCCLUSION_TEXTURE_TRANSFORM
|
||
uniform vec4 u_occlusionTextureTransform;
|
||
#endif
|
||
#pragma mapbox: define-attribute highp vec3 normal_3f
|
||
#pragma mapbox: define-attribute highp vec3 color_3f
|
||
#pragma mapbox: define-attribute highp vec4 color_4f
|
||
#pragma mapbox: define-attribute highp vec2 uv_2f
|
||
#pragma mapbox: initialize-attribute highp vec3 normal_3f
|
||
#pragma mapbox: initialize-attribute highp vec3 color_3f
|
||
#pragma mapbox: initialize-attribute highp vec4 color_4f
|
||
#pragma mapbox: initialize-attribute highp vec2 uv_2f
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
|
||
#endif
|
||
#ifdef HAS_TEXTURE_u_baseColorTexture
|
||
uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
|
||
#endif
|
||
#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
|
||
uniform sampler2D u_metallicRoughnessTexture;
|
||
#endif
|
||
#ifdef HAS_TEXTURE_u_occlusionTexture
|
||
uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
|
||
#endif
|
||
#ifdef HAS_TEXTURE_u_normalTexture
|
||
uniform sampler2D u_normalTexture;
|
||
#endif
|
||
#ifdef HAS_TEXTURE_u_emissionTexture
|
||
uniform sampler2D u_emissionTexture;
|
||
#endif
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
uniform highp sampler3D u_lutTexture;
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT_VERTEX
|
||
in highp float v_cutout_factor;
|
||
#endif
|
||
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
|
||
#ifdef DEPTH_D24
|
||
highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
|
||
#else
|
||
highp float unpack_depth_rgba(highp vec4 rgba_depth)
|
||
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
|
||
#endif
|
||
bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
|
||
#ifdef FLIP_Y
|
||
coord.y=1.0-coord.y;
|
||
#endif
|
||
#ifdef DEPTH_D24
|
||
highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
|
||
#else
|
||
highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
|
||
#endif
|
||
return v_depth > depth+0.0005;}
|
||
#endif
|
||
#define saturate(_x) clamp(_x,0.,1.)
|
||
vec3 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)
|
||
{
|
||
#ifdef LIGHTING_3D_MODE
|
||
vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
|
||
#ifdef RENDER_SHADOWS
|
||
lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
|
||
#else
|
||
lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
|
||
#endif
|
||
return apply_lighting(albedo,transformed_normal,lighting_factor);
|
||
#else
|
||
vec3 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)-lightColor),vec3(1.0));return c3;
|
||
#endif
|
||
}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
|
||
#ifdef HAS_ATTRIBUTE_a_color_3f
|
||
albedo*=vec4(color_3f,1.0);
|
||
#endif
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
#else
|
||
#ifdef HAS_ATTRIBUTE_a_color_4f
|
||
albedo*=color_4f;
|
||
#endif
|
||
#endif
|
||
#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
|
||
vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
|
||
#ifdef UNPREMULT_TEXTURE_IN_SHADER
|
||
texColor=vec4(unpremultiplyColor(texColor),1.0);
|
||
#endif
|
||
if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
|
||
#endif
|
||
vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
color=applyLUT(u_lutTexture,color);
|
||
#endif
|
||
return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
|
||
#ifdef HAS_TEXTURE_u_normalTexture
|
||
highp 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;
|
||
#ifdef FLIP_Y
|
||
T=-T;B=-B;
|
||
#endif
|
||
highp 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;
|
||
#else
|
||
return mat3(1.0);
|
||
#endif
|
||
}highp vec3 getNormal(){highp vec3 n;
|
||
#ifdef HAS_ATTRIBUTE_a_normal_3f
|
||
n=normalize(normal_3f);
|
||
#else
|
||
highp 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));
|
||
#ifdef FLIP_Y
|
||
n=normalize(cross(fdx,fdy));
|
||
#else
|
||
n=normalize(cross(fdx,fdy))*-1.0;
|
||
#endif
|
||
#endif
|
||
#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
vec3 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);
|
||
#endif
|
||
return 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;
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
|
||
#endif
|
||
#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
|
||
#endif
|
||
const 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)
|
||
{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)
|
||
{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
|
||
{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)
|
||
{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)
|
||
{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)
|
||
{
|
||
#ifdef LIGHTING_3D_MODE
|
||
return mat.diffuseColor;
|
||
#else
|
||
return mat.diffuseColor/PI;
|
||
#endif
|
||
}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
|
||
{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)
|
||
{vec3 env_light=vec3(0.65,0.65,0.65);
|
||
#ifdef LIGHTING_3D_MODE
|
||
float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
|
||
#endif
|
||
vec3 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)
|
||
{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;
|
||
#ifdef RENDER_SHADOWS
|
||
lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
|
||
#else
|
||
lighting_factor=NdotL;
|
||
#endif
|
||
vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
|
||
#if !defined(LIGHTING_3D_MODE)
|
||
const 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);
|
||
#endif
|
||
color*=intensityFactor;return color;}void main() {
|
||
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
if (isOccluded()) {discard;}
|
||
#endif
|
||
vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
|
||
#ifdef LIGHTING_3D_MODE
|
||
lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
|
||
#endif
|
||
vec4 finalColor;
|
||
#ifdef DIFFUSE_SHADED
|
||
vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
|
||
#ifdef HAS_TEXTURE_u_occlusionTexture
|
||
float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
|
||
#endif
|
||
finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
|
||
#else
|
||
Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
|
||
#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
#ifdef OCCLUSION_TEXTURE_TRANSFORM
|
||
vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
|
||
#else
|
||
vec2 uv=uv_2f;
|
||
#endif
|
||
ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
|
||
#endif
|
||
vec4 emissive=u_emissiveFactor;
|
||
#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
|
||
#endif
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
|
||
#endif
|
||
color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
float 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;
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
color_mix=applyLUT(u_lutTexture,color_mix);
|
||
#endif
|
||
color=mix(color,color_mix,min(1.0,resEmission));
|
||
#ifdef HAS_ATTRIBUTE_a_color_4f
|
||
float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));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);
|
||
#endif
|
||
#endif
|
||
vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
|
||
#endif
|
||
#ifdef DITHERED_DISCARD
|
||
if (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;}}
|
||
#endif
|
||
#ifdef FOG
|
||
finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
finalColor*=v_cutoff_opacity;
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
finalColor=applyCutout(finalColor,v_position_height.w);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT_VERTEX
|
||
apply_feature_cutout_dither(gl_FragCoord,v_cutout_factor);
|
||
#else
|
||
#ifdef FEATURE_CUTOUT
|
||
finalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
#endif
|
||
#endif
|
||
glFragColor=finalColor;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
in vec3 a_pos_3f;
|
||
#pragma mapbox: define-attribute highp vec3 normal_3f
|
||
#pragma mapbox: define-attribute highp vec2 uv_2f
|
||
#pragma mapbox: define-attribute highp vec3 color_3f
|
||
#pragma mapbox: define-attribute highp vec4 color_4f
|
||
#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr
|
||
#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
|
||
uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
|
||
#ifdef INSTANCED_ARRAYS
|
||
in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
|
||
#else
|
||
uniform highp mat4 u_normal_matrix;
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
uniform 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;
|
||
#endif
|
||
out vec4 v_position_height;out lowp vec4 v_color_mix;
|
||
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
out highp float v_depth;
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT_VERTEX
|
||
out highp float v_cutout_factor;
|
||
#endif
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
|
||
#endif
|
||
vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
|
||
#pragma mapbox: initialize-attribute highp vec3 normal_3f
|
||
#pragma mapbox: initialize-attribute highp vec2 uv_2f
|
||
#pragma mapbox: initialize-attribute highp vec3 color_3f
|
||
#pragma mapbox: initialize-attribute highp vec4 color_4f
|
||
#pragma mapbox: initialize-attribute-custom highp uvec4 pbr
|
||
#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
|
||
highp mat4 normal_matrix;
|
||
#ifdef INSTANCED_ARRAYS
|
||
normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
|
||
#else
|
||
normal_matrix=u_normal_matrix;
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT_VERTEX
|
||
v_cutout_factor=1.0;
|
||
#endif
|
||
vec3 local_pos;mat3 rs;
|
||
#ifdef MODEL_POSITION_ON_GPU
|
||
vec3 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;
|
||
#ifdef FEATURE_CUTOUT_VERTEX
|
||
highp vec4 ground_pos=vec4(pos_a.xy,0.0,1.0);highp vec4 cutout_clip_pos=mix(u_matrix*ground_pos,AWAY,hidden);highp vec3 cutout_ndc=cutout_clip_pos.xyz/cutout_clip_pos.w;vec2 uv=cutout_ndc.xy*0.5+0.5;highp float fragDepthNDC=cutout_ndc.z*0.5+0.5;
|
||
#ifdef FLIP_Y
|
||
fragDepthNDC=cutout_ndc.z;
|
||
#endif
|
||
highp float cutoutFactor=get_cutout_factors_vert(uv).x;highp float cutoutDepthNDC=sample_cutout_depth(u_cutout_depth_image,uv);highp float groundThreshold=0.001;highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);v_cutout_factor=mix(1.0-cutoutFactor,1.0,groundLimit);
|
||
#endif
|
||
#else
|
||
local_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);
|
||
#endif
|
||
v_position_height.w=a_pos_3f.z;
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
vec4 albedo_c=decode_color(vec2(pbr.xy));vec2 e_r_m=unpack_float(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(float(pbr.w))/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(local_pos);
|
||
#endif
|
||
#ifdef RENDER_CUTOFF
|
||
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
|
||
#endif
|
||
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
v_depth=gl_Position.z/gl_Position.w;
|
||
#ifdef CLIP_ZERO_TO_ONE
|
||
v_depth=-1.0+2.0*v_depth;
|
||
#endif
|
||
#endif
|
||
#ifdef HAS_ATTRIBUTE_a_normal_3f
|
||
#ifdef MODEL_POSITION_ON_GPU
|
||
float 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);
|
||
#else
|
||
normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
|
||
#endif
|
||
#endif
|
||
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
#ifdef HAS_ATTRIBUTE_a_color_4f
|
||
v_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);
|
||
#endif
|
||
#endif
|
||
#ifdef RENDER_SHADOWS
|
||
vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
|
||
#ifdef NORMAL_OFFSET
|
||
#ifdef HAS_ATTRIBUTE_a_normal_3f
|
||
#ifdef MODEL_POSITION_ON_GPU
|
||
vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
|
||
#else
|
||
vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
|
||
#endif
|
||
#endif
|
||
#endif
|
||
v_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;
|
||
#endif
|
||
}`),modelDepth:wn("void main() {}",`in vec3 a_pos_3f;uniform mat4 u_matrix;
|
||
#ifdef MODEL_POSITION_ON_GPU
|
||
#ifdef INSTANCED_ARRAYS
|
||
in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
|
||
#else
|
||
uniform highp mat4 u_instance;
|
||
#endif
|
||
uniform highp mat4 u_node_matrix;
|
||
#endif
|
||
void main() {
|
||
#ifdef MODEL_POSITION_ON_GPU
|
||
highp mat4 instance;
|
||
#ifdef INSTANCED_ARRAYS
|
||
instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
|
||
#else
|
||
instance=u_instance;
|
||
#endif
|
||
vec3 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;rs[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);
|
||
#else
|
||
gl_Position=u_matrix*vec4(a_pos_3f,1);
|
||
#endif
|
||
}`)},programUniforms:{model:u=>({u_matrix:new c.bb(u),u_lighting_matrix:new c.bb(u),u_normal_matrix:new c.bb(u),u_node_matrix:new c.bb(u),u_lightpos:new c.b7(u),u_lightintensity:new c.b4(u),u_lightcolor:new c.b7(u),u_camera_pos:new c.b7(u),u_opacity:new c.b4(u),u_baseColorFactor:new c.b8(u),u_emissiveFactor:new c.b8(u),u_metallicFactor:new c.b4(u),u_roughnessFactor:new c.b4(u),u_baseTextureIsAlpha:new c.b5(u),u_alphaMask:new c.b5(u),u_alphaCutoff:new c.b4(u),u_baseColorTexture:new c.b5(u),u_metallicRoughnessTexture:new c.b5(u),u_normalTexture:new c.b5(u),u_occlusionTexture:new c.b5(u),u_emissionTexture:new c.b5(u),u_lutTexture:new c.b5(u),u_color_mix:new c.b8(u),u_aoIntensity:new c.b4(u),u_emissive_strength:new c.b4(u),u_occlusionTextureTransform:new c.b8(u),u_dithered_discard_threshold:new c.b4(u)}),modelDepth:u=>({u_matrix:new c.bb(u),u_instance:new c.bb(u),u_node_matrix:new c.bb(u)})}};async function Cb(){return Promise.resolve()}class Vy{constructor(r,a,f){this.screenBounds=r,this.cameraPoint=f.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=a,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,f)}static createFromScreenPoints(r,a){let f,_;if(r instanceof c.au||typeof r[0]=="number"){const x=c.au.convert(r);f=[x],_=a.isPointAboveHorizon(x)}else{const x=c.au.convert(r[0]),w=c.au.convert(r[1]),k=x.add(w)._div(2);f=[x,w],_=c.eP(x,w).every(A=>a.isPointAboveHorizon(A))&&a.isPointAboveHorizon(k)}return new Vy(f,_,a)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return c.eP(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const a=this.screenBounds[0],f=this.screenBounds.length===1?this.screenBounds[0].add(new c.au(1,1)):this.screenBounds[1],_=c.eP(a,f,0,!1);return this.cameraPoint.y>f.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x<f.x?_.splice(3,0,this.cameraPoint):this.cameraPoint.x>=f.x?_[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(_[3]=this.cameraPoint)),c.bu(_,r)}bufferedCameraGeometryGlobe(r){const a=this.screenBounds[0],f=this.screenBounds.length===1?this.screenBounds[0].add(new c.au(1,1)):this.screenBounds[1],_=c.eP(a,f,r),x=this.cameraPoint.clone(),w=+(x.x>a.x)+ +(x.x>f.x);switch(3*(+(x.y>a.y)+ +(x.y>f.y))+w){case 0:_[0]=x,_[4]=x.clone();break;case 1:_.splice(1,0,x);break;case 2:_[1]=x;break;case 3:_.splice(4,0,x);break;case 5:_.splice(2,0,x);break;case 6:_[3]=x;break;case 7:_.splice(3,0,x);break;case 8:_[2]=x}return _}containsTile(r,a,f,_=0){const x=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/a._pixelsPerMercatorPixel+1,w=f?this._bufferedCameraMercator(x,a):this._bufferedScreenMercator(x,a);let k=r.tileID.wrap+(w.unwrapped?_:0);const A=w.polygon.map(J=>c.d8(r.tileTransform,J,k));if(!c.eM(A,0,0,c.r,c.r))return;k=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?_:0);const P=this.screenGeometryMercator.polygon.map(J=>c.d9(r.tileTransform,J,k)),D=P.map(J=>new c.au(J[0],J[1])),z=a.getFreeCameraOptions().position||new c.ag(0,0,0),F=c.d9(r.tileTransform,z,k),j=P.map(J=>{const Q=c.fx(J,J,F);return c.ex(Q,Q),new c.aB(F,Q)}),$=c.eG(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:D,tilespaceRays:j,bufferedTilespaceGeometry:A,bufferedTilespaceBounds:(W=c.cI(A),W.min.x=c.bG(W.min.x,0,c.r),W.min.y=c.bG(W.min.y,0,c.r),W.max.x=c.bG(W.max.x,0,c.r),W.max.y=c.bG(W.max.y,0,c.r),W),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:$};var W}_bufferedScreenMercator(r,a){const f=Rm(r);if(this._screenRaycastCache[f])return this._screenRaycastCache[f];{let _;return _=a.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),a):{polygon:this.bufferedScreenGeometry(r).map(x=>a.pointCoordinate3D(x)),unwrapped:!0},this._screenRaycastCache[f]=_,_}}_bufferedCameraMercator(r,a){const f=Rm(r);if(this._cameraRaycastCache[f])return this._cameraRaycastCache[f];{let _;return _=a.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),a):{polygon:this.bufferedCameraGeometry(r).map(x=>a.pointCoordinate3D(x)),unwrapped:!0},this._cameraRaycastCache[f]=_,_}}_projectAndResample(r,a){const f=function(x,w){const k=c.er([],w.pixelMatrix,w.globeMatrix),A=[0,-c.P,0,1],P=[0,c.P,0,1],D=[0,0,0,1];c.fM(A,A,k),c.fM(P,P,k),c.fM(D,D,k);const z=new c.au(A[0]/A[3],A[1]/A[3]),F=new c.au(P[0]/P[3],P[1]/P[3]),j=c.eL(x,z)&&A[3]<D[3],$=c.eL(x,F)&&P[3]<D[3];if(!j&&!$)return null;const W=function(ye,be,Ce){for(let ze=1;ze<ye.length;ze++){const Oe=Bf(be.pointCoordinate3D(ye[ze-1]).x),Ze=Bf(be.pointCoordinate3D(ye[ze]).x);if(Ce<0){if(Oe<Ze)return{idx:ze,t:-Oe/(Ze-1-Oe)}}else if(Ze<Oe)return{idx:ze,t:(1-Oe)/(Ze+1-Oe)}}return null}(x,w,j?-1:1);if(!W)return null;const{idx:J,t:Q}=W;let ce=J>1?Dm(x.slice(0,J),w):[],fe=J<x.length?Dm(x.slice(J),w):[];ce=ce.map(ye=>new c.au(Bf(ye.x),ye.y)),fe=fe.map(ye=>new c.au(Bf(ye.x),ye.y));const se=[...ce];se.length===0&&se.push(fe.at(-1));const Ae=se.at(-1),Ee=c.dY(Ae.y,(fe.length===0?ce[0]:fe[0]).y,Q);let Pe;return Pe=j?[new c.au(0,Ee),new c.au(0,0),new c.au(1,0),new c.au(1,Ee)]:[new c.au(1,Ee),new c.au(1,1),new c.au(0,1),new c.au(0,Ee)],se.push(...Pe),fe.length===0?se.push(ce[0]):se.push(...fe),{polygon:se.map(ye=>new c.ag(ye.x,ye.y)),unwrapped:!1}}(r,a);if(f)return f;const _=function(x,w){let k=!1,A=-1/0,P=0;for(let z=0;z<x.length-1;z++)x[z].x>A&&(A=x[z].x,P=z);for(let z=0;z<x.length-1;z++){const F=(P+z)%(x.length-1),j=x[F],$=x[F+1];Math.abs(j.x-$.x)>.5&&(j.x<$.x?(j.x+=1,F===0&&(x.at(-1).x+=1)):($.x+=1,F+1===x.length-1&&(x[0].x+=1)),k=!0)}const D=c.ek(w.center.lng);return k&&D<Math.abs(D-1)&&x.forEach(z=>{z.x-=1}),{polygon:x,unwrapped:k}}(Dm(r,a).map(x=>new c.au(Bf(x.x),x.y)),a);return{polygon:_.polygon.map(x=>new c.ag(x.x,x.y)),unwrapped:_.unwrapped}}}function Dm(u,r){return c.f0(u,a=>{const f=r.pointCoordinate3D(a);a.x=f.x,a.y=f.y},1/256)}function Bf(u){return u<0?1+u%1:u%1}function Rm(u){return 100*u|0}class Nf extends c.y{constructor(r,a,f,_){if(super(),this.id=r,this.dispatcher=f,this.type="vector",this.provider=a.provider,this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,c.eF(a,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(_),this._tileWorkers={},this._deduped=new c.m}load(r){this._loaded=!1,this.fire(new c.x("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,f=this.map.getWorldview(),_=(w,k)=>{this._tileJSONRequest=null,this._loaded=!0,w?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),f&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${f}`),this.fire(new c.v(w))):k&&(this._setTileJSON(k),Tr(k.tiles,this.map._requestManager._customAccessToken),this.fire(new c.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.x("data",{dataType:"source",sourceDataType:"content"}))),r&&r(w)};this.provider=this._options.provider;const x=c.f1(this._options);return x instanceof Error?(this._loaded=!0,this.fire(new c.v(x)),void(r&&r())):this.provider&&!x?(this._loaded=!0,this.fire(new c.v(new Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=x?this.loadTileJSONWithProvider(x,_):c.e7(this._options,this.map._requestManager,a,f,_))}loadTileJSONWithProvider(r,a){this.provider=r.name;const{request:f,options:_}=c.eC(this._options,this.map._requestManager),x=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:_,request:f},(w,k)=>{if(x.signal.aborted)return;if(w)return void a(w);const A=k?k.find(D=>D!=null):null,P=c.eW(this._options,A,this.map._requestManager);P instanceof Error?a(P):a(null,P)}),{cancel:()=>x.abort()}}_setTileJSON(r){if(Object.assign(this,r),this.hasWorldviews=!!r.worldview_options,r.worldview_default&&(this.worldviewDefault=r.worldview_default),r.vector_layers){this.vectorLayers=r.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const a of r.vector_layers)this.vectorLayerIds.push(a.id),r.worldview&&r.worldview[a.source]&&this.localizableLayerIds.add(a.id)}this.tileBounds=wa.fromTileJSON(r)}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=c.ea(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(r,a){const f=r.tileID.canonical.url(this.tiles,this.scheme),_=this.map._requestManager.normalizeTileURL(f),x=this.map._requestManager.transformRequest(_,c.aH.Tile),w=this.map.style?this.map.style.getLut(this.scope):null,k=w?{image:w.image.clone()}:null,A={request:x,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,lut:k,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:c.co.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:r.renderSourceType,frcCoverage:(()=>{const D=this.map.painter,z=D?D.frcCoverageFadeRange:null;if(z==null)return null;const F=D?D.frcCoverageSnapshot:null,j=this.map.transform.zoom<z[0],$=F?F.getTileOrParent(r.tileID.canonical):null,W=r.tileID.overscaledZ>=Math.ceil(z[1]),J=F&&W?F.getFullCoverageMask(r.tileID.canonical):null;return{frcMask:W&&J!=null?J:null,resolved:j||F!=null,polygons:$&&$.frcMask!==0?$.polygons:null,tileZoom:$&&$.frcMask!==0?$.tileId.z:null,sourceLayers:D?D.frcCoverageSourceLayers:["road","structure"]}})(),brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.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&&c.dL(f)&&(A.localizableLayerIds=this.localizableLayerIds),A.request.collectResourceTiming=this._collectResourceTiming,r.actor&&r.state!=="expired")r.state==="loading"?r.reloadCallback=a:r.request=r.actor.send("reloadTile",A,P.bind(this));else if(r.actor=this._tileWorkers[_]=this._tileWorkers[_]||this.dispatcher.getActor(),this.dispatcher.ready||this.provider)r.request=r.actor.send("loadTile",A,P.bind(this),void 0,!0);else{const D=c.e9.call({deduped:this._deduped},A,(z,F)=>{if(z||!F)P.call(this,z);else{const j=c.cO(F.responseHeaders);A.data={rawData:F.rawData.slice(0),expires:j.expires,cacheControl:j.cacheControl},r.actor&&r.actor.send("loadTile",A,P.bind(this),void 0,!0)}},!0);r.request={cancel:D}}function P(D,z){return delete r.request,r.aborted?a(null):D?a(D):(z&&z.resourceTiming&&(r.resourceTiming=z.resourceTiming),this.map._refreshExpiredTiles&&z&&r.setExpiryData(z),void(function(){if(r.aborted)return a(null);r.loadVectorData(z,this.map.painter),c.bv(this.dispatcher),a(null,z),r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)}).call(this))}}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(r,a){r.actor&&r.actor.send("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}const Ql={vector:Nf,raster:Pu,"raster-dem":class extends Pu{constructor(u,r,a,f){super(u,r,a,f),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTileJSONWithProvider(u,r){this.provider=u.name;const{request:a,options:f}=c.eC(this._options,this.map._requestManager),_=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:u.name,url:u.url,source:this.id,scope:this.scope,type:this.type,options:f,request:a},(x,w)=>{if(_.signal.aborted)return;if(x)return void r(x);const k=w?w.find(P=>P!=null):null,A=c.eW(this._options,k,this.map._requestManager);A instanceof Error?r(A):r(null,A)}),{cancel:()=>_.abort()}}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),f=this.map._requestManager.transformRequest(a,c.aH.Tile),_={uid:u.uid,tileID:u.tileID,source:this.id,type:this.type,scope:this.scope,request:f,encoding:this.encoding};u.actor&&u.state!=="expired"||(u.actor=this.dispatcher.getActor(),u.request=u.actor.send("loadTile",_,(function(x,w){return delete u.request,u.aborted?(u.state="unloaded",r(null)):x?(u.state="errored",r(x)):(w&&(this.map._refreshExpiredTiles&&u.setExpiryData(w),w.borderReady||u.neighboringTiles||(u.neighboringTiles=this._getNeighboringTiles(u.tileID)),u.dem=w.dem,u.dem.onDeserialize(),u.needsHillshadePrepare=!0,u.needsDEMTextureUpload=!0),u.state="loaded",void r(null))}).bind(this),void 0,!0))}abortTile(u,r){u.request&&(u.request.cancel(),delete u.request),u.actor&&u.actor.send("abortTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope}),r&&r()}_getNeighboringTiles(u){const r=u.canonical,a=Math.pow(2,r.z),f=(r.x-1+a)%a,_=r.x===0?u.wrap-1:u.wrap,x=(r.x+1+a)%a,w=r.x+1===a?u.wrap+1:u.wrap,k={};return k[new c.ap(u.overscaledZ,_,r.z,f,r.y).key]={backfilled:!1},k[new c.ap(u.overscaledZ,w,r.z,x,r.y).key]={backfilled:!1},r.y>0&&(k[new c.ap(u.overscaledZ,_,r.z,f,r.y-1).key]={backfilled:!1},k[new c.ap(u.overscaledZ,u.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},k[new c.ap(u.overscaledZ,w,r.z,x,r.y-1).key]={backfilled:!1}),r.y+1<a&&(k[new c.ap(u.overscaledZ,_,r.z,f,r.y+1).key]={backfilled:!1},k[new c.ap(u.overscaledZ,u.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},k[new c.ap(u.overscaledZ,w,r.z,x,r.y+1).key]={backfilled:!1}),k}},"raster-array":Du,geojson:class extends c.y{constructor(u,r,a,f){super(),this.id=u,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(f),this._data=r.data,this._options=Object.assign({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.minzoom!==void 0&&(this.minzoom=r.minzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const _=c.r/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*_,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*_,extent:c.r,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:r.clusterMaxZoom!==void 0?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:c.r,radius:(r.clusterRadius!==void 0?r.clusterRadius:50)*_,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(u){this.map=u,this.setData(this._data)}setData(u){return this._data=u,this._updateWorkerData(),this}updateData(u){if(!this._options.dynamic)return this.fire(new c.v(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof u!="string"&&(u.type==="Feature"&&(u={type:"FeatureCollection",features:[u]}),u.type!=="FeatureCollection"))return this.fire(new c.v(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof u!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const r=new Map;for(const a of this._data.features)r.set(a.id,a);for(const a of u.features)r.set(a.id,a);this._data.features=[...r.values()]}else this._data=u;return this._updateWorkerData(!0),this}getClusterExpansionZoom(u,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:u,source:this.id,scope:this.scope},r),this}getClusterChildren(u,r){return this.actor.send("geojson.getClusterChildren",{clusterId:u,source:this.id,scope:this.scope},r),this}getClusterLeaves(u,r,a,f){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:u,limit:r,offset:a},f),this}_updateWorkerData(u=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new c.x("dataloading",{dataType:"source"})),this._loaded=!1;const r=Object.assign({append:u},this.workerOptions);r.scope=this.scope;const a=this._data;typeof a=="string"?(r.request=this.map._requestManager.transformRequest(c.co.resolveURL(a),c.aH.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(f,_)=>{if(this._loaded=!0,this._pendingLoad=null,f)this.fire(new c.v(f));else{const x={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&_&&_.resourceTiming&&_.resourceTiming[this.id]&&(x.resourceTiming=_.resourceTiming[this.id]),u&&(this._partialReload=!0),this.fire(new c.x("data",x)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(u),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const u=c.ea(this.id,this.scope);this.map.style.clearSource(u),this._updateWorkerData()}loadTile(u,r){const a=u.actor?"reloadTile":"loadTile";u.actor=this.actor;const f=this.map.style?this.map.style.getLut(this.scope):null,_=f?{image:f.image.clone()}:null,x=this._partialReload,w={type:this.type,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:_,scope:this.scope,pixelRatio:c.co.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:u.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:x,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};u.request=this.actor.send(a,w,(k,A)=>x&&!A?(u.state="loaded",r(null)):(delete u.request,u.destroy(!1),u.aborted?r(null):k?r(k):(u.loadVectorData(A,this.map.painter,a==="reloadTile"),r(null))),void 0,a==="loadTile")}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.aborted=!0}unloadTile(u,r){this.actor.send("removeTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope}),u.destroy()}onRemove(u){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends c.a3{constructor(u,r,a,f){super(u,r,a,f),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const u=this.options;this.urls=[];for(const r of u.urls)this.urls.push(this.map._requestManager.transformRequest(r,c.aH.Source).url);c.db(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new c.v(r)):a&&(this.video=a,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(u){if(this.video){const r=this.video.seekable;u<r.start(0)||u>r.end(0)?this.fire(new c.v(new ge(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,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 u=this.map.painter.context,r=u.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new c.a_(u,this.video,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(u)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:c.a3,model:c.ai,"batched-model":class extends c.y{constructor(u,r,a,f){super(),this.type="batched-model",this.id=u,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(f)}onAdd(u){this.map=u,this.load()}reload(){this.cancelTileJSONRequest();const u=c.ea(this.id,this.scope);this.load(()=>this.map.style.clearSource(u))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(u){this._loaded=!1,this.fire(new c.x("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=c.e7(this._options,this.map._requestManager,r,a,(f,_)=>{this._tileJSONRequest=null,this._loaded=!0,f?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&a.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new c.v(f))):_&&(Object.assign(this,_),_.bounds&&(this.tileBounds=new wa(_.bounds,this.minzoom,this.maxzoom)),Tr(_.tiles,this.map._requestManager._customAccessToken),this.fire(new c.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.x("data",{dataType:"source",sourceDataType:"content"}))),u&&u(f)})}hasTransition(){return!1}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loaded(){return this._loaded}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme)),f={request:this.map._requestManager.transformRequest(a,c.aH.Tile),data:void 0,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:u.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:c.co.devicePixelRatio,promoteId:this.promoteId};if(u.actor&&u.state!=="expired")if(u.state==="loading")u.reloadCallback=r;else{if(u.buckets){const x=Object.values(u.buckets);for(const w of x)w.dirty=!0;return void(u.state="loaded")}u.request=u.actor.send("reloadTile",f,_.bind(this))}else u.actor=this.dispatcher.getActor(),u.request=u.actor.send("loadTile",f,_.bind(this),void 0,!0);function _(x,w){return u.aborted?r(null):x&&x.status!==404?r(x):(this.map._refreshExpiredTiles&&w&&u.setExpiryData(w),u.loadModelData(w,this.map.painter),u.state="loaded",void r(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends c.a3{constructor(u,r,a,f){super(u,r,a,f),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(x=>typeof x!="number"))||this.fire(new c.v(new ge(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.v(new ge(`sources.${u}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new c.v(new ge(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new c.v(new ge(`sources.${u}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.v(new ge(`sources.${u}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.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 c.v(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(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(u){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!u&&!this._playing||this.texture instanceof c.bd||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new c.a_(r,this.canvas,r.gl.RGBA8,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}},custom:class extends c.y{constructor(u,r,a,f){super(),this.id=u,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(f),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new c.v(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new c.v(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new wa(this._implementation.bounds,this.minzoom,this.maxzoom));const _=r;_.update=this._update.bind(this),_.clearTiles=this._clearTiles.bind(this),_.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,c.eF(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return c.eF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new c.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.x("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(u){this.map=u,this._loaded=!1,this.fire(new c.x("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(u),this.load()}onRemove(u){this._implementation.onRemove&&this._implementation.onRemove(u)}hasTile(u){if(this._implementation.hasTile){const{x:r,y:a,z:f}=u.canonical;return this._implementation.hasTile({x:r,y:a,z:f})}return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u,r){const{x:a,y:f,z:_}=u.tileID.canonical,x=new AbortController,w=Promise.resolve(this._implementation.loadTile({x:a,y:f,z:_},{signal:x.signal})).then((function(k){return delete u.request,u.aborted?(u.state="unloaded",r(null)):k===void 0?(u.state="errored",r(null)):k===null?(this.loadTileData(u,{width:this.tileSize,height:this.tileSize,data:null}),u.state="loaded",r(null)):function(A){return A instanceof ImageData||A instanceof HTMLCanvasElement||A instanceof ImageBitmap||A instanceof HTMLImageElement}(k)?(this.loadTileData(u,k),u.state="loaded",void r(null)):(u.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(k=>{k.name!=="AbortError"&&(u.state="errored",r(k))});w.cancel=()=>x.abort(),u.request=w}loadTileData(u,r){u.setTexture(r,this.map.painter)}unloadTile(u,r){if(u.texture&&u.texture instanceof c.a_?(u.destroy(!1),u.texture&&u.texture instanceof c.a_&&this.map.painter.saveTileTexture(u.texture)):u.destroy(),this._implementation.unloadTile){const{x:a,y:f,z:_}=u.tileID.canonical;this._implementation.unloadTile({x:a,y:f,z:_})}r&&r()}abortTile(u,r){u.request&&u.request.cancel&&(u.request.cancel(),delete u.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(u=>({x:u.canonical.x,y:u.canonical.y,z:u.canonical.z}))}_clearTiles(){const u=c.ea(this.id,this.scope);this.map.style.clearSource(u)}_update(){this.fire(new c.x("data",{dataType:"source",sourceDataType:"content"}))}}},zd=function(u,r,a,f){const _=new Ql[r.type](u,r,a,f);if(_.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${_.id}`);return c.bs(["load","abort","unload","serialize","prepare"],_),_};function Bd(u,r,a=""){return`${a}:${r.id||""}:${r.layer.id}:${function(f){if("layerId"in f)return`layer:${f.layerId}`;{const{featuresetId:_,importId:x}=f;return`featureset:${_}${x?`:import:${x}`:""}`}}(u.target)}`}function jy(u,r,a,f=""){if(u.uniqueFeatureID){const _=Bd(u,r,f);if(a.has(_))return!0;a.add(_)}return!1}function Lm(u,r,a,f,_=!1,x=void 0){const w=r.sourceCache.transform,k=r.sourceCache.tilesIn(u,r.has3DLayers,_);k.sort(jf);const A=[];for(const P of k){const D=P.tile.queryRenderedFeatures(r,P,a,f,w,_,x);Object.keys(D).length&&A.push({wrappedTileID:P.tile.tileID.wrapped().key,queryResults:D})}for(const P in r.layers){const D=r.layers[P];if(D.styleLayer){const z=D.styleLayer.queryRenderedFeatures(u,r.sourceCache,f);Object.keys(z).length&&A.push({wrappedTileID:0,queryResults:z})}}return A.length===0?{}:function(P){const D={},z={};for(const F of P){const j=F.queryResults,$=F.wrappedTileID,W=z[$]=z[$]||{};for(const J in j){const Q=j[J],ce=W[J]=W[J]||{},fe=D[J]=D[J]||[];for(const se of Q)ce[se.featureIndex]||(ce[se.featureIndex]=!0,fe.push(se))}}return D}(A)}function Om(u,r,a,f,_,x){const w={},k=f.queryRenderedSymbols(u),A=[];for(const P of Object.keys(k).map(Number))A.push(_[P]);A.sort(jf);for(const P of A){const D=P.featureIndex.lookupSymbolFeatures(k[P.bucketInstanceId],P.bucketIndex,P.sourceLayerIndex,r,a,x);for(const z in D){const F=w[z]=w[z]||[],j=D[z];j.sort(($,W)=>{const J=P.featureSortOrder;if(J){const Q=J.indexOf($.featureIndex);return J.indexOf(W.featureIndex)-Q}return W.featureIndex-$.featureIndex});for(const $ of j)F.push($)}}return w}function Vf(u,r){const a=u.getRenderableIds().map(x=>u.getTileByID(x)),f=[],_={};for(let x=0;x<a.length;x++){const w=a[x],k=w.tileID.canonical.key;_[k]||(_[k]=!0,w.querySourceFeatures(f,r))}return f}function jf(u,r){const a=u.tileID,f=r.tileID;return a.overscaledZ-f.overscaledZ||a.canonical.y-f.canonical.y||a.wrap-f.wrap||a.canonical.x-f.canonical.x}class Mt{constructor(r){this.style=r,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const r=!1,a=!1;for(const f in this.style._mergedLayers){const _=this.style._mergedLayers[f];if(_.type==="fill-extrusion"||_.type==="building")this.layers.push({layer:_,visible:r,visibilityChanged:a});else if(_.type==="model"){const x=this.style.getLayerSource(_);x&&x.type==="batched-model"&&this.layers.push({layer:_,visible:r,visibilityChanged:a})}}}onNewFrame(r){this.layersGotHidden=!1;for(const a of this.layers){const f=a.layer;let _=!1;f.type==="fill-extrusion"?_=!f.isHidden(r)&&f.paint.get("fill-extrusion-opacity")>0:f.type==="building"?_=!f.isHidden(r)&&f.paint.get("building-opacity")>0:f.type==="model"&&(_=!f.isHidden(r)&&f.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!_&&a.visible,a.visible=_}}updateZOffset(r,a){this.currentBuildingBuckets=[];for(const _ of this.layers){const x=_.layer,w=this.style.getLayerSourceCache(x);let k=1;x.type==="fill-extrusion"?k=_.visible?x.paint.get("fill-extrusion-vertical-scale"):0:x.type==="building"&&(k=_.visible?x.paint.get("building-vertical-scale"):0);let A=w?w.getTile(a):null;if(!A&&w)for(const P in w._tiles){const D=w._tiles[P];if(a.canonical.isChildOf(D.tileID.canonical)){A=D;break}}this.currentBuildingBuckets.push({bucket:A?A.getBucket(x):null,tileID:A?A.tileID:a,verticalScale:k})}r.hasAnyZOffset=!1;let f=!1;for(let _=0;_<r.symbolInstances.length;_++){const x=r.symbolInstances.get(_),w=x.zOffset,k=this._getHeightAtTileOffset(a,x.tileAnchorX,x.tileAnchorY);x.zOffset=k!==Number.NEGATIVE_INFINITY?k:w,f||w===x.zOffset||(f=!0),r.hasAnyZOffset||x.zOffset===0||(r.hasAnyZOffset=!0)}f&&(r.zOffsetBuffersNeedUpload=!0,r.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,a,f,_){let x=a,w=f;if(r.canonical.z!==_.canonical.z){const k=_.canonical,A=1/(1<<r.canonical.z-k.z);x=(a+r.canonical.x*c.r)*A-k.x*c.r|0,w=(f+r.canonical.y*c.r)*A-k.y*c.r|0}return{tileX:x,tileY:w}}_getHeightAtTileOffset(r,a,f){let _,x;for(let w=0;w<this.layers.length;++w){const k=this.layers[w].layer;if(k.type!=="fill-extrusion"&&k.type!=="building")continue;const{bucket:A,tileID:P,verticalScale:D}=this.currentBuildingBuckets[w];if(!A)continue;const{tileX:z,tileY:F}=this._mapCoordToOverlappingTile(r,a,f,P),j=A.getHeightAtTileCoord(z,F);j&&j.height!==void 0&&(j.hidden?_=j.height:x=Math.max(j.height*D,x||0))}if(x!==void 0)return x;for(let w=0;w<this.layers.length;++w){const k=this.layers[w];if(k.layer.type!=="model"||!k.visible)continue;const{bucket:A,tileID:P}=this.currentBuildingBuckets[w];if(!A)continue;const{tileX:D,tileY:z}=this._mapCoordToOverlappingTile(r,a,f,P),F=A.getHeightAtTileCoord(D,z);if(F&&!F.hidden)return F.height===void 0&&_!==void 0?Math.min(F.maxHeight,_)*F.verticalScale:F.height?F.height*F.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}let Nd;function Jl(){return Nd||(Nd=new Ic),Nd}function Nc(u,r){const a={},f=u,_=r,x=a;for(const w in f)w!=="ref"&&(x[w]=f[w]);return c.eY.forEach(w=>{w in _&&(x[w]=_[w])}),a}function Uy(u){u=u.slice();const r=Object.create(null);for(const a of u)r[a.id]=a;for(let a=0;a<u.length;a++){const f=u[a];if(f&&"ref"in f){const _=r[f.ref];_&&(u[a]=Nc(f,_))}}return u}const Xn={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 Gy(u,r,a){a.push({command:Xn.addSource,args:[u,r[u]]})}function $y(u,r,a){r.push({command:Xn.removeSource,args:[u]}),a[u]=!0}function Ib(u,r,a,f){$y(u,a,f),Gy(u,r,a)}function Mb(u,r,a){let f;for(f in u[a])if(Object.hasOwn(u[a],f)&&f!=="data"&&!c.c2(u[a][f],r[a][f]))return!1;for(f in r[a])if(Object.hasOwn(r[a],f)&&f!=="data"&&!c.c2(u[a][f],r[a][f]))return!1;return!0}function Fu(u,r,a,f,_,x){let w;for(w in r=r||{},u=u||{})Object.hasOwn(u,w)&&(c.c2(u[w],r[w])||a.push({command:x,args:[f,w,r[w],_]}));for(w in r)Object.hasOwn(r,w)&&!Object.hasOwn(u,w)&&(c.c2(u[w],r[w])||a.push({command:x,args:[f,w,r[w],_]}))}function Vd(u){return u.id}function zu(u,r){return u[r.id]=r,u}function Fm(u,r,a){const f=r.createTileMatrix(u,u.worldSize,a.toUnwrapped());return c.er(new Float32Array(16),u.projMatrix,f)}function Pb(u,r,a){if(r.projection.name===a.projection.name)return u.projMatrix;const f=a.clone();return f.setProjection(r.projection),Fm(f,r.getProjection(),u)}function zm(u,r,a){return r.name===a.projection.name?u.projMatrix:Fm(a,r,u)}class Hy{constructor(r,a,f,_){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?a:-a))):_&&f?1:0,this.placed=f}isHidden(){return this.opacity===0&&!this.placed}}class jd{constructor(r,a,f,_,x,w=!1){this.text=new Hy(r?r.text:null,a,f,x),this.icon=new Hy(r?r.icon:null,a,_,x),this.clipped=w}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Uf{constructor(r,a,f,_=!1){this.text=r,this.icon=a,this.skipFade=f,this.clipped=_}}class Wy{constructor(){this.invProjMatrix=c.bT(),this.viewportMatrix=c.bT(),this.circles=[]}}class qy{constructor(r,a,f,_,x){this.bucketInstanceId=r,this.featureIndex=a,this.sourceLayerIndex=f,this.bucketIndex=_,this.tileID=x}}class Db{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const a=++this.maxGroupID;this.collisionGroups[r]={ID:a,predicate:f=>f.collisionGroupID===a}}return this.collisionGroups[r]}}function Zy(u,r,a,f,_){const{horizontalAlign:x,verticalAlign:w}=c.cE(u),k=-(x-.5)*r,A=-(w-.5)*a,P=c.cj(u,f);return new c.au(k+P[0]*_,A+P[1]*_)}function Bm(u,r,a,f,_){const x=new c.au(u,r);return a&&x._rotate(f?_:-_),x}function Gf(u,r,a,f){const{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:x,rightJustifiedTextSymbolIndex:w,verticalPlacedTextSymbolIndex:k,crossTileID:A}=a,P=c.cF(r),D=f===c.bg.vertical?k:P==="left"?_:P==="center"?x:P==="right"?w:-1;_>=0&&(u.text.placedSymbolArray.get(_).crossTileID=D>=0&&_!==D?0:A),x>=0&&(u.text.placedSymbolArray.get(x).crossTileID=D>=0&&x!==D?0:A),w>=0&&(u.text.placedSymbolArray.get(w).crossTileID=D>=0&&w!==D?0:A),k>=0&&(u.text.placedSymbolArray.get(k).crossTileID=D>=0&&k!==D?0:A)}function Ud(u,r,a){const f=r===c.bg.horizontal||r===c.bg.horizontalOnly?r:0,_=r===c.bg.vertical?r:0,{leftJustifiedTextSymbolIndex:x,centerJustifiedTextSymbolIndex:w,rightJustifiedTextSymbolIndex:k,verticalPlacedTextSymbolIndex:A}=a,P=u.text.placedSymbolArray;x>=0&&(P.get(x).placedOrientation=f),w>=0&&(P.get(w).placedOrientation=f),k>=0&&(P.get(k).placedOrientation=f),A>=0&&(P.get(A).placedOrientation=_)}class Rb{constructor(r,a,f,_,x,w,k,A){this.transform=r.clone(),this.projection=r.projection.name,this.algorithm=_,this.collisionIndex=this.algorithm.createCollisionDetector(this.transform,w,A),this.buildingIndex=k,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Db(f),this.collisionCircleArrays={},this.prevPlacement=x,x&&(x.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(r,a,f,_,x=1){const w=f.getBucket(a),k=f.latestFeatureIndex;if(!w||!k||a.fqid!==w.layerIds[0])return;const A=w.layers[0].layout,P=w.layers[0].paint,D=f.collisionBoxArray,z=Math.pow(2,this.transform.zoom-f.tileID.overscaledZ),F=f.tileSize/c.r,j=f.tileID.toUnwrapped();this.transform.setProjection(w.projection);const $=(W=f.tileID,J=w.getProjection(),Q=this.transform,J.name===this.projection?Q.calculateProjMatrix(W.toUnwrapped()):Fm(Q,J,W));var W,J,Q;const ce=A.get("text-pitch-alignment")==="map",fe=A.get("text-rotation-alignment")==="map";a.compileFilter(a.options);const se=a.dynamicFilter(),Ae=a.dynamicFilterNeedsFeature(),Ee=a.dynamicFilterNeedsGeometry(),Pe=this.transform.calculatePixelsToTileUnitsMatrix(f),ye=um($,f.tileID.canonical,ce,fe,this.transform,w.getProjection(),Pe);let be=null;const Ce=w.getProjection().createInversionMatrix(this.transform,f.tileID.canonical);if(ce){const it=Ed($,f.tileID.canonical,ce,fe,this.transform,w.getProjection(),Pe);be=c.er([],this.transform.labelPlaneMatrix,it)}let ze=null;se&&f.latestFeatureIndex&&(ze={unwrappedTileID:j,dynamicFilter:se,dynamicFilterNeedsFeature:Ae,needGeometry:Ee}),this.retainedQueryData[w.bucketInstanceId]=new qy(w.bucketInstanceId,k,w.sourceLayerIndex,w.index,f.tileID);const[Oe,Ze]=w.layers[0].layout.get("text-size-scale-range"),We=c.bG(x,Oe,Ze),[ut,Ne]=A.get("icon-size-scale-range"),Je=c.bG(x,ut,Ne),Be={bucket:w,layout:A,paint:P,posMatrix:$,invMatrix:Ce,mercatorCenter:[c.ek(this.transform.center.lng),c.el(this.transform.center.lat)],textLabelPlaneMatrix:ye,labelToScreenMatrix:be,clippingData:ze,scale:z,textPixelRatio:F,holdingForFade:f.holdingForFade(),collisionBoxArray:D,partiallyEvaluatedTextSize:c.ci(w.textSizeData,this.transform.zoom,We),partiallyEvaluatedIconSize:c.ci(w.iconSizeData,this.transform.zoom,Je),collisionGroup:this.collisionGroups.get(w.sourceID),latestFeatureIndex:f.latestFeatureIndex};if(_)for(const it of w.sortKeyRanges){const{sortKey:Qe,symbolInstanceStart:ot,symbolInstanceEnd:Et}=it;r.push({sortKey:Qe,symbolInstanceStart:ot,symbolInstanceEnd:Et,parameters:Be})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:w.symbolInstances.length,parameters:Be})}placeLayerBucketPart(r,a,f,_,x=1){this.algorithm.placeLayerBucketPart(this,r,a,f,_,x)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let f=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const _=a?a.symbolFadeChange(r):1,x=a?a.opacities:{},w=a?a.variableOffsets:{},k=a?a.placedOrientations:{};for(const A in this.placements){const P=this.placements[A],D=x[A];D?(this.opacities[A]=new jd(D,_,P.text,P.icon,null,P.clipped),f=f||P.text!==D.text.placed||P.icon!==D.icon.placed):(this.opacities[A]=new jd(null,_,P.text,P.icon,P.skipFade,P.clipped),f=f||P.text||P.icon)}for(const A in x){const P=x[A];if(!this.opacities[A]){const D=new jd(P,_,!1,!1);D.isHidden()||(this.opacities[A]=D,f=f||P.text.placed||P.icon.placed)}}for(const A in w)this.variableOffsets[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.variableOffsets[A]=w[A]);for(const A in k)this.placedOrientations[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.placedOrientations[A]=k[A]);f?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:r)}updateLayerOpacities(r,a,f,_){_&&(this.lastReplacementSourceUpdateTime=_.updateTime);const x=new Set;for(const w of a){const k=w.getBucket(r);k&&w.latestFeatureIndex&&r.fqid===k.layerIds[0]&&(this.updateBucketOpacities(k,x,w,w.collisionBoxArray,f,_,w.tileID,r.scope),k.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(k,w.tileID),k.elevationType==="road"&&k.hdExt&&k.hdExt.updateRoadElevation(k,w.tileID.canonical),k.updateZOffset())}}updateBucketOpacities(r,a,f,_,x,w,k,A){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const P=r.layers[0].layout,D=r.layers[0].paint,z=!!r.layers[0].dynamicFilter(),F=new jd(null,0,!1,!1,!0),j=P.get("text-allow-overlap"),$=P.get("icon-allow-overlap"),W=P.get("text-variable-anchor"),J=P.get("text-rotation-alignment")==="map",Q=P.get("text-pitch-alignment")==="map",ce=D.get("symbol-z-offset"),fe=P.get("symbol-elevation-reference")==="sea",se=!ce.isConstant(),Ae=new jd(null,0,j&&($||!r.hasIconData()||P.get("icon-optional")),$&&(j||!r.hasTextData()||P.get("text-optional")),!0);!r.collisionArrays&&_&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(_);const Ee=(ye,be,Ce)=>{for(let ze=0;ze<be/4;ze++)ye.opacityVertexArray.emplaceBack(Ce)};let Pe=0;w&&r.updateReplacement(k,w),this.collisionIndex.clearClippedSymbolsForBucket(r.bucketInstanceId);for(let ye=0;ye<r.symbolInstances.length;ye++){const be=r.symbolInstances.get(ye),{numHorizontalGlyphVertices:Ce,numVerticalGlyphVertices:ze,crossTileID:Oe,numIconVertices:Ze,tileAnchorX:We,tileAnchorY:ut}=be;let Ne=null;const Je=this.retainedQueryData[r.bucketInstanceId];se&&be&&Je&&(Ne=f.latestFeatureIndex.loadFeature({featureIndex:be.featureIndex,bucketIndex:Je.bucketIndex,sourceLayerIndex:Je.sourceLayerIndex,layoutVertexArrayOffset:0}));const Be=ce.evaluate(Ne,{}),it=a.has(Oe);let Qe=this.opacities[Oe];it?Qe=F:Qe||(Qe=Ae,this.opacities[Oe]=Qe),a.add(Oe);const ot=Ce>0||ze>0,Et=Ze>0,ht=this.placedOrientations[Oe],gt=ht===c.bg.vertical,ct=ht===c.bg.horizontal||ht===c.bg.horizontalOnly;!ot&&!Et||Qe.isHidden()||Pe++;let Ht=!1;if((ot||Et)&&w)for(const Ot of r.activeReplacements){if(c.fp(Ot,x,c.a8.Symbol,A)||Ot.min.x>We||We>Ot.max.x||Ot.min.y>ut||ut>Ot.max.y)continue;const Nt=c.fN(We,ut,k.canonical,Ot.footprintTileId.canonical);if(Ht=c.eI(Nt,Ot.footprint),Ht)break}if(Ht&&this.collisionIndex.markSymbolAsClipped(r.bucketInstanceId,be.featureIndex),ot){const Ot=Ht?$d:Nm(Qe.text);Ee(r.text,Ce,gt?$d:Ot),Ee(r.text,ze,ct?$d:Ot);const Nt=Qe.text.isHidden(),{leftJustifiedTextSymbolIndex:$t,centerJustifiedTextSymbolIndex:an,rightJustifiedTextSymbolIndex:nn,verticalPlacedTextSymbolIndex:xn}=be,En=r.text.placedSymbolArray,qt=Nt||gt?1:0;$t>=0&&(En.get($t).hidden=qt),an>=0&&(En.get(an).hidden=qt),nn>=0&&(En.get(nn).hidden=qt),xn>=0&&(En.get(xn).hidden=Nt||ct?1:0);const fn=this.variableOffsets[Oe];fn&&Gf(r,fn.anchor,be,ht);const un=this.placedOrientations[Oe];un&&(Gf(r,"left",be,un),Ud(r,un,be))}if(Et){const Ot=Ht?$d:Nm(Qe.icon),{placedIconSymbolIndex:Nt,verticalPlacedIconSymbolIndex:$t}=be,an=r.icon.placedSymbolArray,nn=Qe.icon.isHidden()?1:0;Nt>=0&&(Ee(r.icon,Ze,gt?$d:Ot),an.get(Nt).hidden=nn),$t>=0&&(Ee(r.icon,be.numVerticalIconVertices,ct?$d:Ot),an.get($t).hidden=nn)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const Ot=r.collisionArrays[ye];if(Ot){let Nt=new c.au(0,0),$t=!0;if(Ot.textBox||Ot.verticalTextBox){if(W){const nn=this.variableOffsets[Oe];nn?(Nt=Zy(nn.anchor,nn.width,nn.height,nn.textOffset,nn.textScale),J&&Nt._rotate(Q?this.transform.angle:-this.transform.angle)):$t=!1}z&&($t=!Qe.clipped),Ot.textBox&&Gd(r.textCollisionBox.collisionVertexArray,Qe.text.placed,!$t||gt,Be,fe,Nt.x,Nt.y),Ot.verticalTextBox&&Gd(r.textCollisionBox.collisionVertexArray,Qe.text.placed,!$t||ct,Be,fe,Nt.x,Nt.y)}const an=$t&&!!(!ct&&Ot.verticalIconBox);Ot.iconBox&&Gd(r.iconCollisionBox.collisionVertexArray,Qe.icon.placed,an,Be,fe,be.hasIconTextFit?Nt.x:0,be.hasIconTextFit?Nt.y:0),Ot.verticalIconBox&&Gd(r.iconCollisionBox.collisionVertexArray,Qe.icon.placed,!an,Be,fe,be.hasIconTextFit?Nt.x:0,be.hasIconTextFit?Nt.y:0)}}}if(r.fullyClipped=Pe===0,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const ye=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=ye.invProjMatrix,r.placementViewportMatrix=ye.viewportMatrix,r.collisionCircleArray=ye.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return r-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(r,a){const f=this.zoomAtLastRecencyCheck===a?1-this.zoomAdjustment(a):1;return this.zoomAtLastRecencyCheck=a,this.commitTime+this.fadeDuration*f>r}isStale(){return this.stale}setStale(){this.stale=!0}}function Gd(u,r,a,f,_,x,w){u.emplaceBack(r?1:0,a?1:0,x||0,w||0,f,_?1:0),u.emplaceBack(r?1:0,a?1:0,x||0,w||0,f,_?1:0),u.emplaceBack(r?1:0,a?1:0,x||0,w||0,f,_?1:0),u.emplaceBack(r?1:0,a?1:0,x||0,w||0,f,_?1:0)}const Lb=Math.pow(2,25),Xy=Math.pow(2,24),Ky=Math.pow(2,17),Yy=Math.pow(2,16),T2=Math.pow(2,9),E2=Math.pow(2,8),k2=Math.pow(2,1);function Nm(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const r=u.placed?1:0,a=Math.floor(127*u.opacity);return a*Lb+r*Xy+a*Ky+r*Yy+a*T2+r*E2+a*k2+r}const $d=0;class Ob{constructor(r,a){this.reset(r,a)}reset(r,a){this.points=r||[],this._distances=[0];for(let f=1;f<this.points.length;f++)this._distances[f]=this._distances[f-1]+this.points[f].dist(this.points[f-1]);this.length=this._distances.at(-1),this.padding=Math.min(a||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(this.points.length===1)return this.points[0];r=c.bG(r,0,1);let a=1,f=this._distances[a];const _=r*this.paddedLength+this.padding;for(;f<_&&a<this._distances.length;)f=this._distances[++a];const x=a-1,w=this._distances[x],k=f-w,A=k>0?(_-w)/k:0;return this.points[x].mult(1-A).add(this.points[a].mult(A))}}const kl=100;class Qy{constructor(r,a){this.gridRightBoundary=0,this.gridBottomBoundary=0,this.clippedSymbols=new Map,this.reset(r,a)}reset(r,a){const f=r.width+200,_=r.height+200;f!==this.gridRightBoundary||_!==this.gridBottomBoundary?(this.grid=new c.V(f,_,25),this.ignoredGrid=new c.V(f,_,25)):(this.grid.clear(),this.ignoredGrid.clear()),this.transform=r,this.fogState=a,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+kl,this.screenBottomBoundary=r.height+kl,this.gridRightBoundary=f,this.gridBottomBoundary=_,this.clippedSymbols.clear()}clearClippedSymbolsForBucket(r){this.clippedSymbols.delete(r)}markSymbolAsClipped(r,a){let f=this.clippedSymbols.get(r);f||(f=new Set,this.clippedSymbols.set(r,f)),f.add(a)}placeCollisionBox(r,a,f,_,x,w,k,A,P,D,z){let F=f.projectedAnchorX,j=f.projectedAnchorY,$=f.projectedAnchorZ;const W=f.tileAnchorX,J=f.tileAnchorY,Q=f.elevation,ce=f.tileID,fe=r.getProjection();if(Q&&ce){const[Ze,We,ut]=fe.upVector(ce.canonical,f.tileAnchorX,f.tileAnchorY),Ne=fe.upVectorScale(ce.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;F+=Ze*Q*Ne,j+=We*Q*Ne,$+=ut*Q*Ne}const se=r.projection.name==="globe",Ae=r.projection.name==="globe"?c.dm(this.transform.zoom):0;if(ce&&se&&Ae<1&&!w){const Ze=1<<ce.canonical.z,We=c.cz(W,J);c.fd(We,We,1/c.r),c.bk(We,We,c.cz(ce.canonical.x,ce.canonical.y)),c.fd(We,We,1/Ze),c.fy(We,We,c.cz(_[0],_[1])),We[0]=c.f$(We[0],-.5,.5),c.fd(We,We,c.r);const ut=c.cy(We[0],We[1],c.r/(2*Math.PI),1);c.fM(ut,ut,x),F=c.dY(F,ut[0],Ae),j=c.dY(j,ut[1],Ae),$=c.dY($,ut[2],Ae)}const Ee=this.projectAndGetPerspectiveRatio(D,F,j,$,f.tileID,fe.name==="globe"||!!Q||this.transform.pitch>0,fe),Pe=P*Ee.perspectiveRatio,ye=(f.x1*a+k.x-f.padding)*Pe+Ee.point.x,be=(f.y1*a+k.y-f.padding)*Pe+Ee.point.y,Ce=(f.x2*a+k.x+f.padding)*Pe+Ee.point.x,ze=(f.y2*a+k.y+f.padding)*Pe+Ee.point.y,Oe=Ee.perspectiveRatio<=.55||Ee.occluded;return!this.isInsideGrid(ye,be,Ce,ze)||!A&&this.grid.hitTest(ye,be,Ce,ze,z)||Oe?{box:[],offscreen:!1,occluded:Ee.occluded}:{box:[ye,be,Ce,ze],offscreen:this.isOffscreen(ye,be,Ce,ze),occluded:!1}}placeCollisionCircles(r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J){const Q=[],ce=this.transform.elevation,fe=r.getProjection(),se=r.elevationType==="road",Ae=!!ce||se,Ee=c.s.getAtTileOffsetFunc(J,this.transform.center.lat,this.transform.worldSize,fe),Pe=new c.au(f.tileAnchorX,f.tileAnchorY),ye=new c.au(f.tileAnchorX,f.tileAnchorY);let{x:be,y:Ce,z:ze}=fe.projectTilePoint(ye.x,ye.y,J.canonical),Oe=null;if(Ae){const Ht=se&&r.hdExt?r.hdExt.getElevationFeatureForPlacedSymbol(r,r.text,_):null;Oe={getElevation:Ee,elevation:ce,elevationFeature:Ht};const[Ot,Nt,$t]=Ee(Pe,ce,Ht);be+=Ot,Ce+=Nt,ze+=$t}const Ze=fe.name==="globe",We=this.projectAndGetPerspectiveRatio(A,be,Ce,ze,J,Ze||!!ce||this.transform.pitch>0,fe),{perspectiveRatio:ut}=We,Ne=(F?k/ut:k*ut)/c.ao,Je=lo(be,Ce,ze,P),Be=f.lineOffsetX*Ne,it=f.lineOffsetY*Ne,Qe=c.c4(r.layers[0].layout.get("text-max-angle")),ot=Math.cos(Qe),Et=We.signedDistanceFromCamera>0?tr(Ne,w,Be,it,se&&f.flipState===1,Je,ye,f,x,P,{},Ae&&!F?Oe:null,F&&Ae,fe,J,F,ot):null;let ht=!1,gt=!1,ct=!0;if(Et&&!We.occluded){const Ht=.5*$*ut+W,Ot=new c.au(-100,-100),Nt=new c.au(this.screenRightBoundary,this.screenBottomBoundary),$t=new Ob,{first:an,last:nn}=Et,xn=an.path.length;let En=[];for(let un=xn-1;un>=1;un--)En.push(an.path[un]);for(let un=1;un<nn.path.length;un++)En.push(nn.path[un]);const qt=2.5*Ht;D&&(En=En.map(([un,Dn,Jn],Mr)=>(Ae&&!Ze&&(Jn=Ee(Mr<xn-1?an.tilePath[xn-1-Mr]:nn.tilePath[Mr-xn+2],ce,Oe.elevationFeature)[2]),lo(un,Dn,Jn,D))),En.some(un=>un[3]<=0)&&(En=[]));let fn=[];if(En.length>0){let un=1/0,Dn=-1/0,Jn=1/0,Mr=-1/0;for(const Hn of En)un=Math.min(un,Hn[0]),Jn=Math.min(Jn,Hn[1]),Dn=Math.max(Dn,Hn[0]),Mr=Math.max(Mr,Hn[1]);Dn>=Ot.x&&un<=Nt.x&&Mr>=Ot.y&&Jn<=Nt.y&&(fn=[En.map(Hn=>new c.au(Hn[0],Hn[1]))],(un<Ot.x||Dn>Nt.x||Jn<Ot.y||Mr>Nt.y)&&(fn=c.bI(fn,Ot.x,Ot.y,Nt.x,Nt.y)))}for(const un of fn){$t.reset(un,.25*Ht);let Dn=0;Dn=$t.length<=.5*Ht?1:Math.ceil($t.paddedLength/qt)+1;for(let Jn=0;Jn<Dn;Jn++){const Mr=Jn/Math.max(Dn-1,1),Hn=$t.lerp(Mr),Wn=Hn.x+kl,Fr=Hn.y+kl;Q.push(Wn,Fr,Ht,0);const or=Wn-Ht,ri=Fr-Ht,Pn=Wn+Ht,Rn=Fr+Ht;if(ct=ct&&this.isOffscreen(or,ri,Pn,Rn),gt=gt||this.isInsideGrid(or,ri,Pn,Rn),!a&&this.grid.hitTestCircle(Wn,Fr,Ht,j)&&(ht=!0,!z))return{circles:[],offscreen:!1,collisionDetected:ht,occluded:!1}}}}return{circles:!z&&ht||!gt?[]:Q,offscreen:ct,collisionDetected:ht,occluded:We.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let f=1/0,_=1/0,x=-1/0,w=-1/0;for(const D of r){const z=new c.au(D.x+kl,D.y+kl);f=Math.min(f,z.x),_=Math.min(_,z.y),x=Math.max(x,z.x),w=Math.max(w,z.y),a.push(z)}const k=this.grid.query(f,_,x,w).concat(this.ignoredGrid.query(f,_,x,w)),A={},P={};for(const D of k){const z=D.key;if(A[z.bucketInstanceId]===void 0&&(A[z.bucketInstanceId]={}),A[z.bucketInstanceId][z.featureIndex])continue;const F=this.clippedSymbols.get(z.bucketInstanceId);if(F&&F.has(z.featureIndex))continue;const j=[new c.au(D.x1,D.y1),new c.au(D.x2,D.y1),new c.au(D.x2,D.y2),new c.au(D.x1,D.y2)];c.eO(a,j)&&(A[z.bucketInstanceId][z.featureIndex]=!0,P[z.bucketInstanceId]===void 0&&(P[z.bucketInstanceId]=[]),P[z.bucketInstanceId].push(z.featureIndex))}return P}insertCollisionBox(r,a,f,_,x){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:f,featureIndex:_,collisionGroupID:x},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,a,f,_,x){const w=a?this.ignoredGrid:this.grid,k={bucketInstanceId:f,featureIndex:_,collisionGroupID:x};for(let A=0;A<r.length;A+=4)w.insertCircle(k,r[A],r[A+1],r[A+2])}projectAndGetPerspectiveRatio(r,a,f,_,x,w,k){const A=[a,f,_,1];let P=!1;_||this.transform.pitch>0?(c.fM(A,A,r),this.fogState&&x&&k.name!=="globe"&&(P=function(F,j,$,W,J,Q){const ce=Q.calculateFogTileMatrix(J),fe=[j,$,W];return c.fL(fe,fe,ce),Zl(F,c.dW(fe),Q.pitch)}(this.fogState,a,f,_,x.toUnwrapped(),this.transform)>.9)):Ad(A,A,r);const D=A[3];return{point:new c.au((A[0]/D+1)/2*this.transform.width+kl,(-A[1]/D+1)/2*this.transform.height+kl),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(k)/D*.5,1.5),signedDistanceFromCamera:D,occluded:w&&A[2]>D||P}}isOffscreen(r,a,f,_){return f<kl||r>=this.screenRightBoundary||_<kl||a>this.screenBottomBoundary}isInsideGrid(r,a,f,_){return f>=0&&r<this.gridRightBoundary&&_>=0&&a<this.gridBottomBoundary}getViewportMatrix(){const r=c.dq([]);return c.fQ(r,r,[-100,-100,0]),r}}const A2={default:new class{createCollisionDetector(u,r,a){return a instanceof Qy?(a.reset(u,r),a):new Qy(u,r)}shouldPause(u){return u>2}placeLayerBucketPart(u,r,a,f,_,x=1){const{bucket:w,layout:k,paint:A,posMatrix:P,textLabelPlaneMatrix:D,labelToScreenMatrix:z,clippingData:F,textPixelRatio:j,mercatorCenter:$,invMatrix:W,holdingForFade:J,collisionBoxArray:Q,partiallyEvaluatedTextSize:ce,partiallyEvaluatedIconSize:fe,collisionGroup:se,latestFeatureIndex:Ae}=r.parameters,Ee=k.get("text-optional"),Pe=k.get("icon-optional"),ye=k.get("text-allow-overlap"),be=k.get("icon-allow-overlap"),Ce=k.get("text-rotation-alignment")==="map",ze=k.get("icon-rotation-alignment")==="map",Oe=k.get("text-pitch-alignment")==="map",Ze=A.get("symbol-z-offset"),We=k.get("symbol-elevation-reference")==="sea",ut=k.get("symbol-placement"),[Ne,Je]=k.get("text-size-scale-range"),[Be,it]=k.get("icon-size-scale-range"),Qe=c.bG(x,Ne,Je),ot=c.bG(x,Be,it),Et=k.get("text-variable-anchor"),ht=Ce&&ut!=="point",gt=ze&&ut!=="point",ct=Et&&w.hasTextData(),Ht=w.hasIconTextFit()&&ct&&w.hasIconData();u.transform.setProjection(w.projection);const Ot=ct||ht,Nt=gt||Ht;let $t=ye&&(be||!w.hasIconData()||Pe),an=be&&(ye||!w.hasTextData()||Ee);const nn=!Ze.isConstant();!w.collisionArrays&&Q&&w.deserializeCollisionBoxes(Q),f&&_&&w.updateCollisionDebugBuffers(u.transform.zoom,Q,Qe,ot);const xn=(qt,fn,un)=>{const{crossTileID:Dn,numVerticalGlyphVertices:Jn}=qt;let Mr=null;if(F&&F.dynamicFilterNeedsFeature||nn){const mr=u.retainedQueryData[w.bucketInstanceId],br=Ae.loadFeature({featureIndex:qt.featureIndex,bucketIndex:mr.bucketIndex,sourceLayerIndex:mr.sourceLayerIndex,layoutVertexArrayOffset:0}),On=br.properties?br.properties.worldview:null;if(w.localizable&&w.worldview&&typeof On=="string")if(On==="all")br.properties.$localized=!0;else{if(!On.split(",").includes(w.worldview))return;br.properties.$localized=!0,br.properties.worldview=w.worldview}Mr=F&&F.needGeometry?c.fJ(br,!0):br}if(F&&!(0,F.dynamicFilter)({zoom:u.transform.zoom,pitch:u.transform.pitch,worldview:w.worldview},Mr,u.retainedQueryData[w.bucketInstanceId].tileID.canonical,new c.au(qt.tileAnchorX,qt.tileAnchorY),u.transform.calculateDistanceTileData(F.unwrappedTileID)))return u.placements[Dn]=new Uf(!1,!1,!1,!0),void a.add(Dn);const Hn=Ze.evaluate(Mr,{});if((qt.zOffset||0)+(Hn||0)>0&&u.frontCutoffStart>0){const mr=2*u.frontCutoffStart-1,br=[qt.tileAnchorX,qt.tileAnchorY,0,1],On=c.fM(c.bX(),br,P);if(On[1]/On[3]<mr)return u.placements[Dn]=new Uf(!1,!1,!1,!0),void a.add(Dn)}if(a.has(Dn))return;if(J)return void(u.placements[Dn]=new Uf(!1,!1,!1));let Wn=!1,Fr=!1,or=!0,ri=!1,Pn=!1,Rn=null,Kt={box:null,offscreen:null,occluded:null},lr={box:null},nr=null,si=null,Lr=null,co=0,yo=0,Co=0;un.textFeatureIndex?co=un.textFeatureIndex:qt.useRuntimeCollisionCircles&&(co=qt.featureIndex),un.verticalTextFeatureIndex&&(yo=un.verticalTextFeatureIndex);const sr=w.hdExt?w.hdExt.elevationFeatures[qt.elevationFeatureIndex]:void 0,zr=mr=>{mr.tileID=u.retainedQueryData[w.bucketInstanceId].tileID;const br=u.transform.elevation;mr.elevation=We?Hn:Hn+c.s.getAtTileOffset(mr.tileID,new c.au(mr.tileAnchorX,mr.tileAnchorY),br,sr),mr.elevation+=qt.zOffset},Ei=un.textBox;if(Ei){zr(Ei);const mr=On=>{let ai=c.bg.horizontal;if(w.allowVerticalPlacement&&!On&&u.prevPlacement){const Io=u.prevPlacement.placedOrientations[Dn];Io&&(u.placedOrientations[Dn]=Io,ai=Io,Ud(w,ai,qt))}return ai},br=(On,ai)=>{if(w.allowVerticalPlacement&&Jn>0&&un.verticalTextBox){for(const Io of w.writingModes)if(Io===c.bg.vertical?(Kt=ai(),lr=Kt):Kt=On(),Kt&&Kt.box&&Kt.box.length)break}else Kt=On()};if(Et){let On=Et;if(u.prevPlacement&&u.prevPlacement.variableOffsets[Dn]){const ur=u.prevPlacement.variableOffsets[Dn];On.indexOf(ur.anchor)>0&&(On=On.filter(no=>no!==ur.anchor),On.unshift(ur.anchor))}const ai=(ur,no,na)=>{const Mo=w.getSymbolInstanceTextSize(ce,qt,u.transform.zoom,fn),hs=(ur.x2-ur.x1)*Mo+2*ur.padding,ra=(ur.y2-ur.y1)*Mo+2*ur.padding,zs=qt.hasIconTextFit&&!be?no:null;zs&&zr(zs);let ia={box:[],offscreen:!1,occluded:!1};const Ts=ye?2*On.length:On.length;for(let Qa=0;Qa<Ts;++Qa){const ic=this.attemptAnchorPlacement(u,On[Qa%On.length],ur,$,W,Ot,hs,ra,Mo,Ce,Oe,j,P,se,Qa>=On.length,qt,fn,w,na,zs,ce,fe);if(ic&&(ia=ic.placedGlyphBoxes,ia&&ia.box&&ia.box.length)){Wn=!0,Rn=ic.shift;break}}return ia};br(()=>ai(Ei,un.iconBox,c.bg.horizontal),()=>{const ur=un.verticalTextBox;return ur&&zr(ur),w.allowVerticalPlacement&&!(Kt&&Kt.box&&Kt.box.length)&&Jn>0&&ur?ai(ur,un.verticalIconBox,c.bg.vertical):{box:null,offscreen:null,occluded:null}}),Kt&&(Wn=Kt.box,or=Kt.offscreen,ri=Kt.occluded);const Io=mr(!(!Kt||!Kt.box));if(!Wn&&u.prevPlacement){const ur=u.prevPlacement.variableOffsets[Dn];ur&&(u.variableOffsets[Dn]=ur,Gf(w,ur.anchor,qt,Io))}}else{const On=(ai,Io)=>{const ur=w.getSymbolInstanceTextSize(ce,qt,u.transform.zoom,fn),no=u.collisionIndex.placeCollisionBox(w,ur,ai,$,W,Ot,new c.au(0,0),ye,j,P,se.predicate);return no&&no.box&&no.box.length&&(Ud(w,Io,qt),u.placedOrientations[Dn]=Io),no};br(()=>On(Ei,c.bg.horizontal),()=>{const ai=un.verticalTextBox;return w.allowVerticalPlacement&&Jn>0&&ai?(zr(ai),On(ai,c.bg.vertical)):{box:null,offscreen:null,occluded:null}}),mr(!!(Kt&&Kt.box&&Kt.box.length))}}if(nr=Kt,Wn=nr&&nr.box&&nr.box.length>0,or=nr&&nr.offscreen,ri=nr&&nr.occluded,qt.useRuntimeCollisionCircles){const mr=qt.centerJustifiedTextSymbolIndex>=0?qt.centerJustifiedTextSymbolIndex:qt.verticalPlacedTextSymbolIndex,br=w.text.placedSymbolArray.get(mr),On=c.ch(w.textSizeData,ce,br),ai=k.get("text-padding");si=u.collisionIndex.placeCollisionCircles(w,ye,br,mr,w.lineVertexArray,w.glyphOffsetArray,On,P,D,z,f,Oe,se.predicate,qt.collisionCircleDiameter*On/c.ao,ai,u.retainedQueryData[w.bucketInstanceId].tileID),Wn=ye||si.circles.length>0&&!si.collisionDetected,or=or&&si.offscreen,ri=si.occluded}if(un.iconFeatureIndex&&(Co=un.iconFeatureIndex),un.iconBox){const mr=br=>{zr(br);const On=qt.hasIconTextFit&&Rn?Bm(Rn.x,Rn.y,Ce,Oe,u.transform.angle):new c.au(0,0),ai=w.getSymbolInstanceIconSize(fe,u.transform.zoom,qt.placedIconSymbolIndex);return u.collisionIndex.placeCollisionBox(w,ai,br,$,W,Nt,On,be,j,P,se.predicate)};lr&&lr.box&&lr.box.length&&un.verticalIconBox?(Lr=mr(un.verticalIconBox),Fr=Lr.box.length>0):(Lr=mr(un.iconBox),Fr=Lr.box.length>0),or=or&&Lr.offscreen,Pn=Lr.occluded}const di=Ee||qt.numHorizontalGlyphVertices===0&&Jn===0,Vr=Pe||qt.numIconVertices===0;if(di||Vr?Vr?di||(Fr=Fr&&Wn):Wn=Fr&&Wn:Fr=Wn=Fr&&Wn,Wn&&nr&&nr.box&&u.collisionIndex.insertCollisionBox(nr.box,k.get("text-ignore-placement"),w.bucketInstanceId,lr&&lr.box&&yo?yo:co,se.ID),Fr&&Lr&&u.collisionIndex.insertCollisionBox(Lr.box,k.get("icon-ignore-placement"),w.bucketInstanceId,Co,se.ID),si&&(Wn&&u.collisionIndex.insertCollisionCircles(si.circles,k.get("text-ignore-placement"),w.bucketInstanceId,co,se.ID),f)){const mr=w.bucketInstanceId;let br=u.collisionCircleArrays[mr];br===void 0&&(br=u.collisionCircleArrays[mr]=new Wy);for(let On=0;On<si.circles.length;On+=4)br.circles.push(si.circles[On+0]),br.circles.push(si.circles[On+1]),br.circles.push(si.circles[On+2]),br.circles.push(si.collisionDetected?1:0)}const Hi=w.projection.name!=="globe";$t=$t&&(Hi||!ri),an=an&&(Hi||!Pn),u.placements[Dn]=new Uf(Wn||$t,Fr||an,or||w.justReloaded),a.add(Dn)},En=u.retainedQueryData[w.bucketInstanceId].tileID;if(w.elevationType==="offset"&&u.buildingIndex&&u.buildingIndex.updateZOffset(w,En),w.elevationType==="road"&&w.hdExt&&w.hdExt.updateRoadElevation(w,En.canonical),w.updateZOffset(),w.sortFeaturesByY){const qt=w.getSortedSymbolIndexes(u.transform.angle);for(let fn=qt.length-1;fn>=0;--fn){const un=qt[fn];xn(w.symbolInstances.get(un),un,w.collisionArrays[un])}w.hasAnyZOffset&&c.f_(`${w.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(w.hasAnyZOffset){const qt=w.getSortedIndexesByZOffset();for(let fn=0;fn<qt.length;++fn){const un=qt[fn];xn(w.symbolInstances.get(un),un,w.collisionArrays[un])}}else for(let qt=r.symbolInstanceStart;qt<r.symbolInstanceEnd;qt++)xn(w.symbolInstances.get(qt),qt,w.collisionArrays[qt]);if(f&&w.bucketInstanceId in u.collisionCircleArrays){const qt=u.collisionCircleArrays[w.bucketInstanceId];c.dr(qt.invProjMatrix,P),qt.viewportMatrix=u.collisionIndex.getViewportMatrix()}w.justReloaded=!1}attemptAnchorPlacement(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce,fe,se,Ae){const{textOffset0:Ee,textOffset1:Pe,crossTileID:ye}=W,be=[Ee,Pe],Ce=Zy(r,w,k,be,A),ze=u.collisionIndex.placeCollisionBox(Q,A,a,f,_,x,Bm(Ce.x,Ce.y,P,D,u.transform.angle),$,z,F,j.predicate);if(fe){const Oe=Q.getSymbolInstanceIconSize(Ae,u.transform.zoom,W.placedIconSymbolIndex);if(u.collisionIndex.placeCollisionBox(Q,Oe,fe,f,_,x,Bm(Ce.x,Ce.y,P,D,u.transform.angle),$,z,F,j.predicate).box.length===0)return}if(ze.box.length>0){let Oe;return u.prevPlacement&&u.prevPlacement.variableOffsets[ye]&&u.prevPlacement.placements[ye]&&u.prevPlacement.placements[ye].text&&(Oe=u.prevPlacement.variableOffsets[ye].anchor),u.variableOffsets[ye]={textOffset:be,width:w,height:k,anchor:r,textScale:A,prevAnchor:Oe},Gf(Q,r,W,ce),Q.allowVerticalPlacement&&(Ud(Q,ce,W),u.placedOrientations[ye]=ce),{shift:Ce,placedGlyphBoxes:ze}}}}};class C2{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,a,f,_,x,w){const k=this._bucketParts;for(;this._currentTileIndex<r.length;)if(a.getBucketParts(k,_,r[this._currentTileIndex],this._sortAcrossTiles,w),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,k.sort((A,P)=>A.sortKey-P.sortKey));this._currentPartIndex<k.length;){const A=k[this._currentPartIndex];if(a.placeLayerBucketPart(A,this._seenCrossTileIDs,f,A.symbolInstanceStart===0,w),this._currentPartIndex++,x())return!0}return!1}}class ws{constructor(){this._retiredCI=null}startNewPlacement(r,a,f,_,x,w,k,A,P){return this.placement=new Rb(r,_,x,A2[P||"default"],w,k,A,this._retiredCI),this._retiredCI=null,this._currentPlacementIndex=a.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=f,this._fadeDuration=_,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(r,a,f,_,x){const w=c.co.now(),k=()=>!this.isFullPlacementRequested()&&this._fadeDuration!==0&&this.placement.algorithm.shouldPause(c.co.now()-w);for(;this._currentPlacementIndex>=0;){const A=a[r[this._currentPlacementIndex]],P=this.placement.collisionIndex.transform.zoom;if(A.type==="symbol"&&A.visibility!=="none"&&(!A.minzoom||A.minzoom<=P)&&(!A.maxzoom||A.maxzoom>P)){const D=A,z=D.layout.get("symbol-z-elevate"),F=D.layout.get("symbol-sort-key").constantOr(1)!==void 0,j=D.layout.get("symbol-z-order"),$=j==="viewport-y"||j==="auto"&&!(j!=="viewport-y"&&F),W=D.layout.get("text-allow-overlap")||D.layout.get("icon-allow-overlap")||D.layout.get("text-ignore-placement")||D.layout.get("icon-ignore-placement"),J=$&&W,Q=this._inProgressLayer=this._inProgressLayer||new C2(D),ce=c.ea(A.source,A.scope);if(Q.continuePlacement(z||J?_[ce]:f[ce],this.placement,this._showCollisionBoxes,A,k,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(r){return this._retiredCI=this.placement.prevPlacement?this.placement.prevPlacement.collisionIndex:null,this.placement.commit(r),this.placement}}const $f=512/c.r/2;class us{constructor(r,a,f){this.tileID=r,this.bucketInstanceId=f,this.index=new c.a6(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const _=r.canonical.x*c.r,x=r.canonical.y*c.r;for(let w=0;w<a.length;w++){const{key:k,crossTileID:A,tileAnchorX:P,tileAnchorY:D}=a.get(w),z=Math.floor((_+P)*$f),F=Math.floor((x+D)*$f);this.index.add(z,F),this.keys.push(k),this.crossTileIDs.push(A)}this.index.finish()}findMatches(r,a,f){const _=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z),x=$f/Math.pow(2,a.canonical.z-this.tileID.canonical.z),w=a.canonical.x*c.r,k=a.canonical.y*c.r;for(let A=0;A<r.length;A++){const P=r.get(A);if(P.crossTileID)continue;const{key:D,tileAnchorX:z,tileAnchorY:F}=P,j=Math.floor((w+z)*x),$=Math.floor((k+F)*x),W=this.index.range(j-_,$-_,j+_,$+_).sort((J,Q)=>J-Q);for(const J of W){const Q=this.crossTileIDs[J];if(this.keys[J]===D&&!f.has(Q)){f.add(Q),P.crossTileID=Q;break}}}}}class Vc{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Fb{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const a=Math.round((r-this.lng)/360);if(a!==0)for(const f in this.indexes){const _=this.indexes[f],x={};for(const w in _){const k=_[w];k.tileID=k.tileID.unwrapTo(k.tileID.wrap+a),x[k.tileID.key]=k}this.indexes[f]=x}this.lng=r}addBucket(r,a,f){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===a.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let x=0;x<a.symbolInstances.length;x++)a.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[r.overscaledZ]||(this.usedCrossTileIDs[r.overscaledZ]=new Set);const _=this.usedCrossTileIDs[r.overscaledZ];for(const x in this.indexes){const w=this.indexes[x];if(Number(x)>r.overscaledZ)for(const k in w){const A=w[k];A.tileID.isChildOf(r)&&A.findMatches(a.symbolInstances,r,_)}else{const k=w[r.scaledTo(Number(x)).key];k&&k.findMatches(a.symbolInstances,r,_)}}for(let x=0;x<a.symbolInstances.length;x++){const w=a.symbolInstances.get(x);w.crossTileID||(w.crossTileID=f.generate(),_.add(w.crossTileID))}return this.indexes[r.overscaledZ]===void 0&&(this.indexes[r.overscaledZ]={}),this.indexes[r.overscaledZ][r.key]=new us(r,a.symbolInstances,a.bucketInstanceId),!0}removeBucketCrossTileIDs(r,a){for(const f of a.crossTileIDs)this.usedCrossTileIDs[r].delete(f)}removeStaleBuckets(r){let a=!1;for(const f in this.indexes){const _=this.indexes[f];for(const x in _)r[_[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(f,_[x]),delete _[x],a=!0)}return a}}class Jy{constructor(){this.layerIndexes={},this.crossTileIDs=new Vc,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(r,a,f,_){let x=this.layerIndexes[r.fqid];x===void 0&&(x=this.layerIndexes[r.fqid]=new Fb);let w=!1;const k={};_.name!=="globe"&&x.handleWrapJump(f);for(const A of a){const P=A.getBucket(r);P&&r.fqid===P.layerIds[0]&&(P.bucketInstanceId||(P.bucketInstanceId=++this.maxBucketInstanceId),x.addBucket(A.tileID,P,this.crossTileIDs)&&(w=!0),k[P.bucketInstanceId]=!0)}return x.removeStaleBuckets(k)&&(w=!0),w}pruneUnusedLayers(r){const a={};r.forEach(f=>{a[f]=!0});for(const f in this.layerIndexes)a[f]||delete this.layerIndexes[f]}}class ev extends c.y{constructor(r){super(),this.requestManager=r,this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}loadModel(r,a){return c.e6(this.requestManager.transformRequest(a,c.aH.Model).url).then(f=>{const _=c.bQ(f),x=new c.ah(r,a,void 0,void 0,_);return x.computeBoundsAndApplyParent(),x}).catch(f=>{if(f&&f.status===404)return null;this.fire(new c.v(new Error(`Could not load model ${r} from ${a}: ${f.message}`)))})}load(r,a,f={forceReload:!1}){this.models[a]||(this.models[a]=Object.create(null));const _=Object.keys(r),x=[],w=[];for(const k of _){const A=r[k];this.hasURLBeenRequested(A)&&!f.forceReload||(this.modelByURL[A]={modelId:k,scope:a},x.push(this.loadModel(k,A)),w.push(k)),this.models[a][k]||(this.models[a][k]={model:null,numReferences:1})}this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+w.length,Promise.allSettled(x).then(k=>{for(let A=0;A<k.length;A++){const{status:P}=k[A];if(P==="rejected")continue;const{value:D}=k[A];this.models[a][w[A]]||(this.models[a][w[A]]={model:null,numReferences:1}),this.models[a][w[A]].model=D}this.numModelsLoading[a]-=w.length,this.fire(new c.x("data",{dataType:"style"}))}).catch(k=>{this.fire(new c.v(new Error(`Could not load models: ${k.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,a,f={exactIdMatch:!1}){return!!(f.exactIdMatch?this.getModel(r,a):this.getModelByURL(this.modelUris[a][r]))}getModel(r,a){return this.models[a]||(this.models[a]=Object.create(null)),this.models[a][r]?this.models[a][r].model:void 0}getModelByURL(r){if(!r)return null;const a=this.modelByURL[r];return a?this.models[a.scope][a.modelId].model:null}hasModelBeenAdded(r,a){return this.models[a]&&this.models[a][r]!==void 0}getModelURIs(r){return this.modelUris[r]||Object.create(null)}addModel(r,a,f){this.models[f]||(this.models[f]=Object.create(null)),this.modelUris[f]||(this.modelUris[f]=Object.create(null));const _=this.requestManager.normalizeModelURL(a);if((this.hasModel(r,f,{exactIdMatch:!0})||this.hasModelBeenAdded(r,f))&&this.modelUris[f][r]===_)this.models[f][r].numReferences++;else if(this.hasURLBeenRequested(_)){const{scope:x,modelId:w}=this.modelByURL[_];this.models[x][w].numReferences++}else this.modelUris[f][r]=_,this.load({[r]:this.modelUris[f][r]},f)}addModelURLs(r,a){this.models[a]||(this.models[a]=Object.create(null)),this.modelUris[a]||(this.modelUris[a]=Object.create(null));const f=this.modelUris[a];for(const _ of Object.keys(r))f[_]=this.requestManager.normalizeModelURL(r[_])}reloadModels(r){this.load(this.modelUris[r],r,{forceReload:!0})}addModelsFromBucket(r,a){this.models[a]||(this.models[a]=Object.create(null)),this.modelUris[a]||(this.modelUris[a]=Object.create(null));const f=Object.create(null);for(const _ of r)this.hasModel(_,a,{exactIdMatch:!0})||this.hasURLBeenRequested(_)?this.models[a][_].numReferences++:this.modelUris[a][_]&&!this.hasURLBeenRequested(_)?f[_]=this.modelUris[a][_]:!this.hasURLBeenRequested(_)&&gi(_,!1)&&(this.modelUris[a][_]=this.requestManager.normalizeModelURL(_),f[_]=this.modelUris[a][_]);this.load(f,a)}hasURLBeenRequested(r){return this.modelByURL[r]!==void 0}removeModel(r,a,f=!1,_=!1){if(this.models[a]&&this.models[a][r]&&(this.models[a][r].numReferences--,this.models[a][r].numReferences===0||_)){const x=this.modelUris[a][r];f||delete this.modelUris[a][r],delete this.modelByURL[x];const w=this.models[a][r].model;if(!w)return;delete this.models[a][r],w.destroy()}}destroy(){for(const r of Object.keys(this.models))for(const a of Object.keys(this.models[r])){const f=this.models[r][a].model;delete this.models[r][a],f&&f.destroy()}this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}listModels(r){return this.models[r]||(this.models[r]=Object.create(null)),Object.keys(this.models[r])}upload(r,a){this.models[a]||(this.models[a]=Object.create(null));for(const f in this.models[a])this.models[a][f].model&&this.models[a][f].model.upload(r.context)}}const tv=["RENDER_SHADOWS","NORMAL_OFFSET"],zb=new Set(["symbol","circle"]),qa=class YC{constructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(r,a,f){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;const _=f.stylesheet,x=!!f.fog,w=!!(f.getTerrain()||_&&_.terrain),k=!(!f.projection||f.projection.name!=="globe"),A=w||k,P=!(!f.directionalLight||!f.directionalLight.shadowsEnabled()),D=f.map&&f.map.painter,z=!D||!D.context.extParallelShaderCompile,F=!!D&&D.emissiveMode==="mrt-fallback",j=($,W=[],J={})=>{this._queue.push({programId:$,params:Object.assign({},J.params,{defines:W,overrideFog:!!J.fog,overrideTerrain:!!J.terrain,overrideGlobe:!!J.globe,overrideRtt:!!J.rtt,precompiled:!0})})};for(const $ of r){if($.visibility==="none")continue;const W=$.getProgramIds();if(W)for(const J of W){if(zb.has(J))continue;const Q=$.getDefaultProgramParams(J,a.zoom,f._styleColorTheme.lut);if(!Q)continue;const ce=D?D.getShaderSource(J):null,fe=A&&(!ce||ce.usedDefines.has("RENDER_TO_TEXTURE")),se=F&&fe?(Q.defines||[]).concat("USE_MRT1"):Q.defines;if(z){j(J,Q.defines,{params:Q}),fe&&j(J,se,{params:Q,rtt:!0});continue}const Ae=x&&(!ce||ce.usedDefines.has("FOG")),Ee=w&&!$.isDraped()&&(!ce||ce.usedDefines.has("TERRAIN")),Pe=k&&(!ce||ce.usedDefines.has("GLOBE")),ye=P&&$.hasElevation()&&(!ce||ce.usedDefines.has("RENDER_SHADOWS"));for(const be of ye?[!1,!0]:[!1]){const Ce=be?(Q.defines||[]).concat(tv):Q.defines||[];for(const ze of Ee?[!1,!0]:[!1])for(const Oe of Pe?[!1,!0]:[!1])for(const Ze of Ae?[!1,!0]:[!1])j(J,Ce,{params:Q,fog:Ze,terrain:ze,globe:Oe})}fe&&j(J,se,{params:Q,rtt:!0})}}if(j("clippingMask"),w)for(const $ of[!1,!0])j("terrainRaster",$?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:x});if(!z){if(r.some($=>$.type==="hillshade")&&j("hillshadePrepare"),P)for(const $ of[!1,!0])for(const W of[!1,!0]){const J=[];$&&J.push("RENDER_CUTOFF"),J.push("RENDER_SHADOWS"),W&&J.push("NORMAL_OFFSET"),j("groundShadow",J),x&&j("groundShadow",J,{fog:!0})}if(k){for(const $ of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(const W of[!1,!0]){const J=[...$,"PROJECTION_GLOBE_VIEW"];W&&J.push("CUSTOM_ANTIALIASING"),j("globeRaster",J,{terrain:w,globe:!0,fog:x})}for(const $ of[!1,!0]){const W=$?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];j("globeAtmosphere",W,{fog:!0,terrain:w,globe:$}),j("globeAtmosphere",[...W,"ALPHA_PASS"],{fog:!0,terrain:w,globe:$})}j("stars",[],{fog:x,terrain:w,globe:!0})}}}_executeBatch(r,a,f){if(f.map&&f.map.isMoving())return void(this._idleHandle=c.co.requestIdleCallback(k=>this._executeBatch(k,a,f)));a.context.sweepPendingPrograms();const _=a.context.extParallelShaderCompile?YC.DEADLINE_MARGIN_KHR_MS:YC.DEADLINE_MARGIN_SYNC_MS;let x=0;for(;this._queue.length>0;){const k=this._queue.shift();if(!k||(a.style=f,a._fogVisible=!!k.params.overrideFog,a.getOrCreateProgram(k.programId,k.params),x++,r.timeRemaining()<=_))break}const w=this._queue.length===0||r.timeRemaining()>_;x>0&&w&&a.context.gl.flush(),this._idleHandle=this._queue.length>0||a.context._pendingPrograms.size>0?c.co.requestIdleCallback(k=>this._executeBatch(k,a,f)):null}processQueue(r,a){this._queue.length!==0&&(this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=c.co.requestIdleCallback(f=>this._executeBatch(f,r,a)))}reset(){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};qa.DEADLINE_MARGIN_KHR_MS=5,qa.DEADLINE_MARGIN_SYNC_MS=25;let I2=qa;const Yn=c.fs.colorTheme,Vm=new c.ax({data:new c.l(Yn.data)});function nv(u){if(!u.metadata||!u.metadata.content_area)return;const r=c.co.devicePixelRatio,{left:a,top:f,width:_,height:x}=u.metadata.content_area,w=a*r,k=f*r;return[w,k,w+_*r,k+x*r]}function rv(u){if(u)return u.map(([r,a])=>[r*c.co.devicePixelRatio,a*c.co.devicePixelRatio])}class Bb{constructor(r,a,f){this.id=r,this.scope=a,this.sourceCache=f,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(r){this.missingRequests.has(r.name)||this.pendingRequests.has(r.name)||this.pendingRequests.add(r.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const r=new Map;if(!this.sourceCache.loaded())return r;const a=this.sourceCache.getVisibleCoordinates();if(a.length===0)return r;const f=this.sourceCache.getSource();if(!(f instanceof Du))return r;const _=a.map(w=>this.sourceCache.getTile(w)),x=f.getImages(_,Array.from(this.pendingRequests));for(const[w,k]of x)r.set(c.a1.from({name:w,iconsetId:this.id}),k),this.pendingRequests.delete(w);for(const w of this.pendingRequests)this.missingRequests.add(w);return this.pendingRequests.clear(),r}}const jc=(u,r)=>Td(u,r&&r.filter(a=>a.identifier!=="source.canvas")),Hd=(u,r)=>{const a=u.type&&!u.array&&Array.isArray(r)?{type:u.type,"property-type":"data-constant"}:void 0;return c.bY(r,a)},Uc=c.eF(Xn,["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"]),Gc=c.eF(Xn,["setCenter","setZoom","setBearing","setPitch"]),_t=new Set(["background","sky","slot","custom"]),xt={version:8,layers:[],sources:{}},Bu={duration:300,delay:0};class fr extends c.y{constructor(r,a={}){if(super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=Object.assign({},Bu),this._buildingIndex=new Mt(this),this.crossTileSymbolIndex=new Jy,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers=Object.create(null),this._mergedIndoor={},this._indoorEnabled=!1,this._mergedSourceCaches={},this._mergedOtherSourceCaches=Object.create(null),this._mergedSymbolSourceCaches=Object.create(null),this._mergedFillExtrusionSourceCaches=Object.create(null),this._mergedHdRoadCoverageSourceCaches=Object.create(null),this._hdCoverage=null,this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=a.styleChanges||new sn,this._hasDataDrivenEmissive=!1,this.indoorManager=null,this.dispatcher=a.dispatcher?a.dispatcher:new Mc(Jl(),this),this.map.painter&&this.map.painter.context){const _=this.map.painter.context.maxUniformBufferBindings,x=Math.floor(this.map.painter.context.maxUniformBlockSize/4);this.dispatcher.broadcast("setContextParams",{maxBindingPoints:_,maxUniformBlockSizeDwords:x,disableSymbolUBO:this.map.painter.context.disableSymbolUBO})}a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new Ue(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new c.U(r._requestManager,a.localFontFamily?c.ad.all:a.localIdeographFontFamily?c.ad.ideographs:c.ad.none,a.localFontFamily||a.localIdeographFontFamily,a.fontstackCompositing),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new ev(r._requestManager),this.modelManager.setEventedParent(this)),this._layers=Object.create(null),this._sourceCaches={},this._otherSourceCaches=Object.create(null),this._symbolSourceCaches=Object.create(null),this._fillExtrusionSourceCaches=Object.create(null),this._hdCoverage=null,this._loaded=!1,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new I2:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._indoorDependentLayers=a.indoorDependentLayers?a.indoorDependentLayers:new Set,this._config=a.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:a.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",c.d4()),this.dispatcher.broadcast("setConfig",c.cJ());const f=this;this._rtlTextPluginCallback=fr.registerForPluginStateChange(_=>{f.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:_.pluginStatus,pluginURL:_.pluginURL},(x,w)=>{if(c.fS(x),w&&w.every(k=>k))for(const k in f._sourceCaches){const A=f._sourceCaches[k],P=A.getSource().type;P!=="vector"&&P!=="geojson"||A.reload()}})}),this.on("data",_=>{if(_.dataType!=="source"||_.sourceDataType!=="metadata")return;const x=this.getOwnSource(_.sourceId);if(x&&x.vectorLayerIds)for(const w in this._layers){const k=this._layers[w];k.source===x.id&&this._validateLayer(k)}})}load(r){return r?(typeof r=="string"?this.loadURL(r):this.loadJSON(r),this):this}_getGlobalId(r){if(!r)return null;if(typeof r=="string"){if(c.dL(r))return r;const a=c.fw(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch{return a}return a}return`json://${c.et(JSON.stringify(r))}`}_diffStyle(r,a,f){this.globalId=this._getGlobalId(r);const _=(x,w)=>{try{w(null,this.setState(x,f))}catch(k){w(k,!1)}};if(typeof r=="string"){const x=this.map._requestManager.normalizeStyleURL(r),w=this.map._requestManager.transformRequest(x,c.aH.Style);c.cT(w,(k,A)=>{k?this.fire(new c.v(k)):A&&_(A,a)})}else typeof r=="object"&&_(r,a)}loadURL(r,a={}){this.fire(new c.x("dataloading",{dataType:"style"}));const f=typeof a.validate=="boolean"?a.validate:!c.dL(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);const _=this.importsCache.get(r);if(_)return this._load(_,f);const x=this.map._requestManager.transformRequest(r,c.aH.Style);this._request=c.cT(x,(w,k)=>{if(this._request=null,w)this.fire(new c.v(w));else if(k)return this.importsCache.set(r,k),this._load(k,f)})}loadJSON(r,a={}){this.fire(new c.x("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=c.co.frame(()=>{this._request=null,this._load(r,a.validate!==!1)})}loadEmpty(){this.fire(new c.x("dataloading",{dataType:"style"})),this._load(xt,!1)}_loadImports(r,a,f){if(this.importDepth>=4)return c.f_("Style doesn't support nesting deeper than 5"),Promise.resolve();const _=[];for(const x of r){const w=this._createFragmentStyle(x),k=new Promise(D=>{w.once("style.import.load",D),w.once("error",D)}).then(()=>{this.mergeAll(),this.fire(new c.x("data",{dataType:"style"}))});if(_.push(k),this.resolvedImports.has(x.url)){w.loadEmpty();continue}const A=x.data||this.importsCache.get(x.url);A?(x.data?(w.fire(new c.x("dataloading",{dataType:"style"})),w.globalId=w._getGlobalId(A),queueMicrotask(()=>w._load(A,a))):w.loadJSON(A,{validate:a}),this._isInternalStyle(A)&&(w.globalId=null)):x.url?w.loadURL(x.url,{validate:a}):w.loadEmpty();const P={style:w,id:x.id,config:x.config};if(f){const D=this.fragments.findIndex(({id:z})=>z===f);this.fragments=this.fragments.slice(0,D).concat(P).concat(this.fragments.slice(D))}else this.fragments.push(P)}return Promise.allSettled(_)}getImportGlobalIds(r=this,a=new Set){for(const f of r.fragments)f.style.globalId&&a.add(f.style.globalId),this.getImportGlobalIds(f.style,a);return[...a.values()]}_createFragmentStyle(r){const a=this.scope?c.ea(r.id,this.scope):r.id;let f;const _=this._initialConfig&&this._initialConfig[a];(r.config||_)&&(f=Object.assign({},r.config,_));const x=new fr(this.map,{scope:a,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:f,configOptions:this.options,colorThemeOverride:r["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return x.setEventedParent(this.map,{style:x}),x}_reloadImports(r=!1){this.mergeAll(),this._updateMapProjection(),r||this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),(!r||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(r&&this.isRootStyle()?(this.forEachFragmentStyle(a=>{this.dispatcher.broadcast("setLayers",{layers:a._serializeLayers(a._order),scope:a.scope,options:a.options})}),this._initialBroadcastDone=!0):this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}))}_isInternalStyle(r){return this.isRootStyle()&&(r.fragment||!!r.schema&&r.fragment!==!1)}_load(r,a){if(this._isInternalStyle(r)){const x=Object.assign({},xt,{imports:[{id:"basemap",data:r,url:""}]},r.center?{center:r.center}:{},r.bearing?{bearing:r.bearing}:{},r.pitch?{pitch:r.pitch}:{},r.zoom?{zoom:r.zoom}:{},r.light?{light:r.light}:{});return this._importedAsBasemap=!0,void this._load(x,a)}if(this.updateConfig(this._config,r.schema),a&&jc(this,Ps(r)))return;this._loaded=!0;for(const x in r.sources)this.addSource(x,r.sources[x],{validate:!1,isInitialLoad:!0});this.stylesheet=c.bL(r);const f=()=>{if(r.iconsets)for(const P in r.iconsets)this.addIconset(P,r.iconsets[P]);r.sprite?this._loadIconset(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&r.glyphs&&this.glyphManager.setURL(r.glyphs);const x=Uy(this.stylesheet.layers);if(this._order=x.map(P=>P.id),this.stylesheet.light&&c.f_("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 P=this.stylesheet.lights[0];this.light=new uf(P.properties,P.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new uf(this.stylesheet.light)),this._layers=Object.create(null);let w=!1;for(const P of x){const D=c.c0(P,this.scope,this._styleColorTheme.lut,this.options);D.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D.fqid),D.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D.fqid),this._hasAppearances=this._hasAppearances||D.getAppearances().length!==0,D.setEventedParent(this,{layer:{id:D.id}}),this._layers[D.id]=D,this._updateHdCoverageSourceCache(D)&&(w=!0);const z=this.getOwnLayerSourceCache(D),F=!!this.directionalLight&&this.directionalLight.shadowsEnabled();z&&D.canCastShadows()&&F&&(z.castsShadows=!0)}if(w&&Ld().then(()=>{if(!this.map)return;for(const D in this._layers)this._updateHdCoverageSourceCache(this._layers[D]);this.map.style.mergeAll();const P=this.map.transform;for(const D in this.map.style._mergedHdRoadCoverageSourceCaches){const z=this.map.style._mergedHdRoadCoverageSourceCaches[D];z.used=!0,P&&z.update(P)}this.map._update()}),this.glyphManager.url){const P=new Set;for(const D in this._layers){const z=this._layers[D];if(z.type==="symbol"&&z.layout){const F=z.layout.get("text-font");F&&F.value&&F.value.kind==="constant"&&P.add(F.value.value.join(","))}}for(const D of P)this.glyphManager.prefetchRange(D,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const k=this.stylesheet.terrain;k&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(k,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 c.x("data",{dataType:"style"}));const A=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(!0),this.fire(new c.x(A?"style.load":"style.import.load"))}).catch(P=>{this.fire(new c.v(new Error("Failed to load imports",P))),this.fire(new c.x(A?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new c.x(A?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const _=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(_){const x=this._evaluateColorThemeData(_);this._loadColorTheme(x).then(()=>{f()}).catch(w=>{c.f_(`Couldn't load color theme from the stylesheet: ${w}`),f()})}else this._styleColorTheme.lut=null,f()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(r=>r.style.hasAppearances())}mergeAll(){let r,a,f,_,x,w,k,A,P,D;const z={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(F=>{if(F.stylesheet){if(F.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),F.light!=null&&(r=F.light),F.stylesheet.lights)for(const j of F.stylesheet.lights)j.type==="ambient"&&F.ambientLight!=null&&(a=F.ambientLight),j.type==="directional"&&F.directionalLight!=null&&(f=F.directionalLight);_=this._prioritizeTerrain(_,F.terrain,F.stylesheet.terrain),F.stylesheet.fog&&F.fog!=null&&(x=F.fog),F.stylesheet.snow&&F.snow!=null&&(w=F.snow),F.stylesheet.rain&&F.rain!=null&&(k=F.rain),F.stylesheet.camera!=null&&(D=F.stylesheet.camera),F.stylesheet.projection!=null&&(A=F.stylesheet.projection),F.stylesheet.transition!=null&&(P=F.stylesheet.transition),z[F.scope]=F._styleColorTheme}}),this.light=r,this.ambientLight=a,this.directionalLight=f,this.fog=x,this.snow=w,this.rain=k,this._styleColorThemeForScope=z,_===null?delete this.terrain:this.terrain=_,this.camera=D||{"camera-projection":"perspective"},this.projection=A||{name:"mercator"},this.transition=Object.assign({},Bu,P),this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(r){const a=f=>{for(const _ of f.fragments)a(_.style);r(f)};a(this)}_prioritizeTerrain(r,a,f){const _=r&&r.drapeRenderMode===0;return f===null?a&&a.drapeRenderMode===0?a:_?r:null:a!=null&&(!r||_||a&&a.drapeRenderMode===1)?a:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(a=>{r=this._prioritizeTerrain(r,a.terrain,a.stylesheet.terrain)}),r===null?delete this.terrain:this.terrain=r,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let r;this.forEachFragmentStyle(a=>{a.stylesheet.projection!=null&&(r=a.stylesheet.projection)}),this.projection=r||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){const r={},a=Object.create(null),f=Object.create(null),_=Object.create(null),x=Object.create(null);this.forEachFragmentStyle(w=>{for(const k in w._sourceCaches){const A=c.ea(k,w.scope);r[A]=w._sourceCaches[k]}for(const k in w._otherSourceCaches){const A=c.ea(k,w.scope);a[A]=w._otherSourceCaches[k]}for(const k in w._symbolSourceCaches){const A=c.ea(k,w.scope);f[A]=w._symbolSourceCaches[k]}for(const k in w._fillExtrusionSourceCaches){const A=c.ea(k,w.scope);_[A]=w._fillExtrusionSourceCaches[k]}if(w._hdCoverage){const k=w._hdCoverage.coverageSourceCaches;for(const A in k)x[c.ea(A,w.scope)]=k[A]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=f,this._mergedFillExtrusionSourceCaches=_,this._mergedHdRoadCoverageSourceCaches=x,Object.keys(x).length>0&&!this._hdCoverage&&Zn.HdCoverageState&&(this._hdCoverage=new Zn.HdCoverageState)}mergeIndoor(){this._mergedIndoor={},this.forEachFragmentStyle(r=>{if(r.stylesheet&&r.stylesheet.indoor)for(const a of Object.values(r.stylesheet.indoor)){const f=a,_=c.ea(f.sourceId,r.scope);this._mergedIndoor[_]=new Set(f.sourceLayers||[])}}),this._updateIndoorEnabled()}_updateIndoorEnabled(){const r=this._indoorEnabled;if(this._indoorEnabled=!1,Object.keys(this._mergedIndoor).length>0)for(const a of this._mergedOrder){const f=this._mergedLayers[a];if(f.visibility!=="none"&&this._mergedIndoor[c.ea(f.source,f.scope)]){this._indoorEnabled=!0;break}}!this._indoorEnabled||r||this.indoorManager||Ld().then(()=>{this._initIndoorManager()})}_initIndoorManager(){if(!this.indoorManager&&Zn.IndoorManager&&this.isRootStyle()&&Object.keys(this._mergedIndoor).length!==0&&(this.indoorManager=new Zn.IndoorManager(this,this._loaded),this._loaded))for(const r of Object.keys(this._mergedIndoor)){const a=this._mergedSourceCaches[r]||this._mergedOtherSourceCaches[r];a&&a.reload()}}mergeLayers(){const r={},a=[],f=Object.create(null);this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(w=>{for(const k of w._order){const A=w._layers[k];if(A.type==="slot"){const P=c.cY(k);if(r[P])continue;r[P]=[]}A.slot&&r[A.slot]?r[A.slot].push(A):a.push(A)}}),this._mergedOrder=[];let _=-1;const x=(w=[])=>{for(const k of w)if(k.type==="slot"){const A=c.cY(k.id);r[A]&&x(r[A]),this._mergedSlots.push(A)}else{const A=c.ea(k.id,k.scope);this._mergedOrder.push(A),f[A]=k,k.is3D(!!this.terrain)&&(this._has3DLayers=!0,_=this._mergedOrder.length-1),k.type==="circle"&&(this._hasCircleLayers=!0),k.type==="symbol"&&(this._hasSymbolLayers=!0),k.type==="clip"&&(this._clipLayerPresent=!0)}};if(x(a),this._has3DLayers){const w={};for(let k=0;k<this._mergedOrder.length;++k){const A=this._mergedOrder[k];w[A]=k===_?1:k<_?f[A].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((k,A)=>w[k]-w[A])}this._mergedLayers=f,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,r),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?function(a,f,_){const x=Object.assign({},f);for(const k of Object.keys(Yn))x[k]===void 0&&(x[k]=Yn[k].default);const w=new c.b2(Vm,a,new Map(_));return w.setTransitionOrValue(x,_),w.untransitioned().possiblyEvaluate(new c.w(0,{worldview:void 0}))}(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((f,_)=>{const x="data:image/png;base64,";if(!r||r.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void f();let w=r;w.startsWith(x)||(w=x+w);const k=c.a1.from("mapbox-reserved-lut"),A=new Image;A.src=w,A.onerror=()=>{this._styleColorTheme.lutLoading=!1,_(new Error("Failed to load image data"))},A.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void f();this._styleColorTheme.lutLoading=!1;const{width:P,height:D,data:z}=c.co.getImageData(A);if(D>32)return void _(new Error("The height of the image must be less than or equal to 32 pixels."));if(P!==D*D)return void _(new Error("The width of the image must be equal to the height squared."));this.getImage(k)&&this.removeImage(k),this.addImage(k,{data:new c.ay({width:P,height:D},z),pixelRatio:1,sdf:!1,usvg:!1,version:0});const F=this.imageManager.getImage(k,this.scope);F?(this._styleColorTheme.lut={image:F.data,data:r},f()):_(new Error("Missing LUT image."))}})}getLut(r){const a=this._styleColorThemeForScope[r];return a?a.lut:null}setProjection(r){r?this.stylesheet.projection=r: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(r){this._spriteRequest=function(a,f,_){let x,w,k;const A=c.co.devicePixelRatio>1?"@2x":"";let P=c.cT(f.transformRequest(f.normalizeSpriteURL(a,A,".json"),c.aH.SpriteJSON),(F,j)=>{P=null,k||(k=F,x=j,z())}),D=c.cQ(f.transformRequest(f.normalizeSpriteURL(a,A,".png"),c.aH.SpriteImage),(F,j)=>{D=null,k||(k=F,w=j,z())});function z(){if(k)_(k);else if(x&&w){const F=c.co.getImageData(w),j={};for(const $ in x){const{width:W,height:J,x:Q,y:ce,sdf:fe,pixelRatio:se,stretchX:Ae,stretchY:Ee,content:Pe}=x[$],ye=new c.ay({width:W,height:J});c.ay.copy(F,ye,{x:Q,y:ce},{x:0,y:0},{width:W,height:J},null),j[$]={data:ye,pixelRatio:se!==void 0?se:1,sdf:fe!==void 0&&fe,stretchX:Ae,stretchY:Ee,content:Pe,usvg:!1,version:0}}_(null,j)}}return{cancel(){P&&(P.cancel(),P=null),D&&(D.cancel(),D=null)}}}(r,this.map._requestManager,(a,f)=>{if(this._spriteRequest=null,a)this.fire(new c.v(a));else if(f){const _=new Map;for(const x in f)_.set(c.a1.from(x),f[x]);this.addImages(_)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new c.x("data",{dataType:"style"}))})}addIconset(r,a){if(a.type==="sprite")return void this._loadSprite(a.url);const f=this.getOwnSourceCache(a.source);if(!f)return void this.fire(new c.v(new Error(`Source "${a.source}" as specified by iconset "${r}" does not exist and cannot be used as an iconset source`)));const _=f.getSource();if(_.type!=="raster-array")return void this.fire(new c.v(new Error(`Source "${a.source}" as specified by iconset "${r}" is not a "raster-array" source and cannot be used as an iconset source`)));_.partial=!1;const x=new Bb(r,this.scope,f);this.imageManager.addImageProvider(x,this.scope)}removeIconset(r){this.imageManager.removeImageProvider(r,this.scope)}_loadIconset(r){if(!c.dL(r)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(r);const a=this.map._spriteFormat==="auto";var f,_;this._spriteRequest=(_=(x,w)=>{if(this._spriteRequest=null,x)a?this._loadSprite(r):this.fire(new c.v(x));else if(w){const k=new Map;for(const A in w)k.set(c.a1.from(A),w[A]);this.addImages(k)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new c.x("data",{dataType:"style"}))},c.cG((f=this.map._requestManager).transformRequest(f.normalizeIconsetURL(r),c.aH.Iconset),(x,w)=>{if(x)return void _(x);const k={},A=function(P){const D={icons:[]};let z;for(;z=P.nextField(void 0);)z===1&&D.icons.push(hr(P,P.readVarint()+P.pos));return D}(new c.as(w));for(const P of A.icons){const D={version:1,pixelRatio:c.co.devicePixelRatio,content:nv(P),stretchX:P.metadata?rv(P.metadata.stretch_x_areas):void 0,stretchY:P.metadata?rv(P.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:P};k[P.name]=D}_(null,k)}))}_validateLayer(r){const a=this.getOwnSource(r.source);if(!a)return;const f=r.sourceLayer;f&&(a.type==="geojson"||a.vectorLayerIds&&!a.vectorLayerIds.includes(f))&&this.fire(new c.v(new Error(`Source layer "${f}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,a)=>{const f=this.fragments[a];return f&&f.style&&(r.data=f.style.serialize()),r})}_serializeSources(){const r={};for(const a in this._sourceCaches){const f=this._sourceCaches[a].getSource();r[f.id]||(r[f.id]=f.serialize())}return r}_serializeLayers(r){const a=[];for(const f of r){const _=this._layers[f];_&&_.type!=="custom"&&a.push(_.serialize())}return a}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 r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const r in this._mergedLayers){const a=this._mergedLayers[r];if(a._transitionablePaint&&a._transitionablePaint._values){const f=a._transitionablePaint._values["line-emissive-strength"];if(f&&f.value&&f.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(r){return r?this.order:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&r.isDraped(this.getLayerSourceCache(r))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const a=this.getOwnLayer(r);if(a)return a;this.fire(new c.v(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const a=this.getOwnSource(r);if(a)return a;this.fire(new c.v(new Error(`The source '${r}' does not exist in the map's style.`)))}handleIdle(){const r=this.map.painter;r&&(r.context.sweepPendingPrograms(),this._programPrecompiler&&this._programPrecompiler.processQueue(r,this))}handleContextLost(){this._programPrecompiler&&this._programPrecompiler.reset()}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a)),r.worldview!==this._worldview&&(this._worldview=r.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const f=this._changes.isDirty();let _=!1;if(this._changes.isDirty()){const A=this._changes.getLayerUpdatesByScope();for(const P in A){const{updatedIds:D,removedIds:z}=A[P];(D||z)&&(this._updateWorkerLayers(P,D,z),_=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this.snow&&this.snow.updateTransitions(r),this.rain&&this.rain.updateTransitions(r),this._changes.reset()}const x={};for(const A in this._mergedSourceCaches){const P=this._mergedSourceCaches[A];x[A]=P.used,P.used=!1,P.tileCoverLift=0}const w={};for(const A of this._mergedOrder){const P=this._mergedLayers[A];if((P.visibility!=="none"||P.hasTransition())&&P.recalculate(r,this._availableImages),!P.isHidden(r.zoom)){P.mayUse("HD")&&(P.prepare(),Ld()),P.mayUse("Standard")&&(P.prepare(),Cb());const D=this.getLayerSourceCache(P);D&&(D.used=!0,D.tileCoverLift=Math.max(D.tileCoverLift,P.tileCoverLift()))}if(P.source){const D=c.ea(P.source,P.scope),z=this._mergedHdRoadCoverageSourceCaches[D];z&&!z.used&&(z.used=!0)}if(P.type==="fill-extrusion"){const D=c.ea(P.source,P.scope);if(D in this._mergedFillExtrusionSourceCaches){const z=P.layout&&P.layout.get("source-max-zoom");if(z!=null){const F=w[D];w[D]=F==null?z:Math.min(F,z)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){const A=this._mergedOrder.map(P=>this._mergedLayers[P]);this._programPrecompiler.buildQueue(A,r,this)}for(const A in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[A].setMaxzoomOverride(w[A]!=null?w[A]:null);this.terrain&&_&&this.mergeLayers();const k=this.imageManager.getPendingImageProviders();for(const A of k)A.sourceCache.used=!0;for(const A in x){const P=this._mergedSourceCaches[A];x[A]!==P.used&&P.getSource().fire(new c.x("data",{sourceDataType:"visibility",dataType:"source",sourceId:P.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.snow&&this.snow.recalculate(r),this.rain&&this.rain.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),f&&this.fire(new c.x("data",{dataType:"style"}))}updateImageProviders(){const r=this.imageManager.getPendingImageProviders();for(const a of r){const f=a.resolvePendingRequests(),_=this.getFragmentStyle(a.scope);_&&_.addImages(f)}}_updateTilesForChangedImages(){const r={};for(const a in this._mergedSourceCaches){const f=this._mergedSourceCaches[a].getSource().scope;r[f]=r[f]||this._changes.getUpdatedImages(f),r[f].length!==0&&this._mergedSourceCaches[a].reloadTilesForDependencies(["icons","patterns"],r[f])}for(const a in r)this._changes.resetUpdatedImages(a)}_updateWorkerLayers(r,a,f){const _=this.getFragmentStyle(r);_&&this.dispatcher.broadcast("updateLayers",{layers:a?_._serializeLayers(a):[],scope:r,removedIds:f||[],options:_.options})}setState(r,a){if(this._checkLoaded(),jc(this,Ps(r)))return!1;(r=c.bL(r)).layers=Uy(r.layers);const f=function(w,k){if(!w)return[{command:Xn.setStyle,args:[k]}];let A=[];try{if(!c.c2(w.version,k.version))return[{command:Xn.setStyle,args:[k]}];if(c.c2(w.center,k.center)||A.push({command:Xn.setCenter,args:[k.center]}),c.c2(w.zoom,k.zoom)||A.push({command:Xn.setZoom,args:[k.zoom]}),c.c2(w.bearing,k.bearing)||A.push({command:Xn.setBearing,args:[k.bearing]}),c.c2(w.pitch,k.pitch)||A.push({command:Xn.setPitch,args:[k.pitch]}),c.c2(w.sprite,k.sprite)||A.push({command:Xn.setSprite,args:[k.sprite]}),c.c2(w.glyphs,k.glyphs)||A.push({command:Xn.setGlyphs,args:[k.glyphs]}),c.c2(w.imports,k.imports)||function(j=[],$=[],W){$=$||[];const J=(j=j||[]).map(Vd),Q=$.map(Vd),ce=j.reduce(zu,{}),fe=$.reduce(zu,{}),se=J.slice();let Ae,Ee,Pe,ye;for(Ae=0,Ee=0;Ae<J.length;Ae++)Pe=J[Ae],Object.hasOwn(fe,Pe)?Ee++:(W.push({command:Xn.removeImport,args:[Pe]}),se.splice(se.indexOf(Pe,Ee),1));for(Ae=0,Ee=0;Ae<Q.length;Ae++)Pe=Q[Q.length-1-Ae],se[se.length-1-Ae]!==Pe&&(Object.hasOwn(ce,Pe)?(W.push({command:Xn.removeImport,args:[Pe]}),se.splice(se.lastIndexOf(Pe,se.length-Ee),1)):Ee++,ye=se[se.length-Ae],W.push({command:Xn.addImport,args:[fe[Pe],ye]}),se.splice(se.length-Ae,0,Pe));for(const be of $){const Ce=ce[be.id];Ce&&(delete Ce.data,c.c2(Ce,be)||W.push({command:Xn.updateImport,args:[be.id,be]}))}}(w.imports,k.imports,A),c.c2(w.transition,k.transition)||A.push({command:Xn.setTransition,args:[k.transition]}),c.c2(w.light,k.light)||A.push({command:Xn.setLight,args:[k.light]}),c.c2(w.fog,k.fog)||A.push({command:Xn.setFog,args:[k.fog]}),c.c2(w.snow,k.snow)||A.push({command:Xn.setSnow,args:[k.snow]}),c.c2(w.rain,k.rain)||A.push({command:Xn.setRain,args:[k.rain]}),c.c2(w.projection,k.projection)||A.push({command:Xn.setProjection,args:[k.projection]}),c.c2(w.lights,k.lights)||A.push({command:Xn.setLights,args:[k.lights]}),c.c2(w.camera,k.camera)||A.push({command:Xn.setCamera,args:[k.camera]}),c.c2(w.iconsets,k.iconsets)||function(j,$,W){let J;for(J in $=$||{},j=j||{})Object.hasOwn(j,J)&&(Object.hasOwn($,J)||W.push({command:Xn.removeIconset,args:[J]}));for(J in $){if(!Object.hasOwn($,J))continue;const Q=$[J];Object.hasOwn(j,J)?c.c2(j[J],Q)||(W.push({command:Xn.removeIconset,args:[J]}),W.push({command:Xn.addIconset,args:[J,Q]})):W.push({command:Xn.addIconset,args:[J,Q]})}}(w.iconsets,k.iconsets,A),!c.c2(w["color-theme"],k["color-theme"]))return[{command:Xn.setStyle,args:[k]}];const P={},D=[];(function(j,$,W,J){let Q;for(Q in $=$||{},j=j||{})Object.hasOwn(j,Q)&&(Object.hasOwn($,Q)||$y(Q,W,J));for(Q in $){if(!Object.hasOwn($,Q))continue;const ce=$[Q];Object.hasOwn(j,Q)?c.c2(j[Q],ce)||(j[Q].type==="geojson"&&ce.type==="geojson"&&Mb(j,$,Q)?W.push({command:Xn.setGeoJSONSourceData,args:[Q,ce.data]}):Ib(Q,$,W,J)):Gy(Q,$,W)}})(w.sources,k.sources,D,P);const z=[];w.layers&&w.layers.forEach(j=>{j.source&&P[j.source]?A.push({command:Xn.removeLayer,args:[j.id]}):z.push(j)});let F=w.terrain;F&&P[F.source]&&(A.push({command:Xn.setTerrain,args:[void 0]}),F=void 0),A=A.concat(D),c.c2(F,k.terrain)||A.push({command:Xn.setTerrain,args:[k.terrain]}),function(j,$,W){$=$||[];const J=(j=j||[]).map(Vd),Q=$.map(Vd),ce=j.reduce(zu,{}),fe=$.reduce(zu,{}),se=J.slice(),Ae=Object.create(null);let Ee,Pe,ye,be,Ce,ze,Oe;for(Ee=0,Pe=0;Ee<J.length;Ee++)ye=J[Ee],Object.hasOwn(fe,ye)?Pe++:(W.push({command:Xn.removeLayer,args:[ye]}),se.splice(se.indexOf(ye,Pe),1));for(Ee=0,Pe=0;Ee<Q.length;Ee++)ye=Q[Q.length-1-Ee],se[se.length-1-Ee]!==ye&&(Object.hasOwn(ce,ye)?(W.push({command:Xn.removeLayer,args:[ye]}),se.splice(se.lastIndexOf(ye,se.length-Pe),1)):Pe++,ze=se[se.length-Ee],W.push({command:Xn.addLayer,args:[fe[ye],ze]}),se.splice(se.length-Ee,0,ye),Ae[ye]=!0);for(Ee=0;Ee<Q.length;Ee++)if(ye=Q[Ee],be=ce[ye],Ce=fe[ye],!Ae[ye]&&!c.c2(be,Ce))if(c.c2(be.source,Ce.source)&&c.c2(be["source-layer"],Ce["source-layer"])&&c.c2(be.type,Ce.type)){for(Oe in Fu(be.layout,Ce.layout,W,ye,null,Xn.setLayoutProperty),Fu(be.paint,Ce.paint,W,ye,null,Xn.setPaintProperty),c.c2(be.slot,Ce.slot)||W.push({command:Xn.setSlot,args:[ye,Ce.slot]}),c.c2(be.filter,Ce.filter)||W.push({command:Xn.setFilter,args:[ye,Ce.filter]}),c.c2(be.minzoom,Ce.minzoom)&&c.c2(be.maxzoom,Ce.maxzoom)||W.push({command:Xn.setLayerZoomRange,args:[ye,Ce.minzoom,Ce.maxzoom]}),be)Object.hasOwn(be,Oe)&&Oe!=="layout"&&Oe!=="paint"&&Oe!=="filter"&&Oe!=="metadata"&&Oe!=="minzoom"&&Oe!=="maxzoom"&&Oe!=="slot"&&(Oe.indexOf("paint.")===0?Fu(be[Oe],Ce[Oe],W,ye,Oe.slice(6),Xn.setPaintProperty):c.c2(be[Oe],Ce[Oe])||W.push({command:Xn.setLayerProperty,args:[ye,Oe,Ce[Oe]]}));for(Oe in Ce)Object.hasOwn(Ce,Oe)&&!Object.hasOwn(be,Oe)&&Oe!=="layout"&&Oe!=="paint"&&Oe!=="filter"&&Oe!=="metadata"&&Oe!=="minzoom"&&Oe!=="maxzoom"&&Oe!=="slot"&&(Oe.indexOf("paint.")===0?Fu(be[Oe],Ce[Oe],W,ye,Oe.slice(6),Xn.setPaintProperty):c.c2(be[Oe],Ce[Oe])||W.push({command:Xn.setLayerProperty,args:[ye,Oe,Ce[Oe]]}))}else W.push({command:Xn.removeLayer,args:[ye]}),ze=se[se.lastIndexOf(ye)+1],W.push({command:Xn.addLayer,args:[Ce,ze]})}(z,k.layers,A)}catch(P){console.warn("Unable to compute style diff:",P),A=[{command:Xn.setStyle,args:[k]}]}return A}(this.serialize(),r).filter(w=>!(w.command in Gc));if(f.length===0)return!1;const _=f.filter(w=>!(w.command in Uc));if(_.length>0)throw new Error(`Unimplemented: ${_.map(w=>w.command).join(", ")}.`);const x=[];return f.forEach(w=>{x.push(this[w.command](...w.args))}),a&&Promise.all(x).then(a).catch(a),this.stylesheet=r,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(r){if(r.size===0)return this;for(const[a,f]of r.entries()){if(this.getImage(a))return this.fire(new c.v(new Error(`An image with the name "${a.name}" already exists.`)));this.imageManager.addImage(a,this.scope,f),this._changes.updateImage(a,this.scope)}return this._updateWorkerImages(),this.fire(new c.x("data",{dataType:"style"})),this}addImage(r,a){return this.getImage(r)?this.fire(new c.v(new Error(`An image with the name "${r.name}" already exists.`))):(this.imageManager.addImage(r,this.scope,a),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new c.x("data",{dataType:"style"})),this)}updateImage(r,a,f=!1){this.imageManager.updateImage(r,this.scope,a),f&&(this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new c.x("data",{dataType:"style"})))}getImage(r){return this.imageManager.getImage(r,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new c.x("data",{dataType:"style"})),this):this.fire(new c.v(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(r){return this.modelManager.addModelURLs(r,this.getActualScope()),this._updateWorkerModels(),this.fire(new c.x("data",{dataType:"style"})),this}addModel(r,a,f={}){return this._checkLoaded(),this._validate(ib,`models.${r}`,a,null,f)||(this.modelManager.addModel(r,a,this.getActualScope()),this.fire(new c.x("data",{dataType:"style"}))),this}hasModel(r){return this.modelManager.hasModel(r,this.getActualScope())}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.getActualScope(),!1,!0),this.fire(new c.x("data",{dataType:"style"})),this):this.fire(new c.v(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(r,a,f={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(a.type)&&this._validate(lf,`sources.${r}`,a,null,f))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const _=zd(r,a,this.dispatcher,this);_.scope=this.scope,_.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(_.id),source:_.serialize(),sourceId:_.id}));const x=w=>{const k=(w===c.aC.Symbol?"symbol:":w===c.aC.FillExtrusion?"fill-extrusion:":"other:")+_.id,A=c.ea(k,this.scope),P=this._sourceCaches[k]=new Rs(A,_,w);w===c.aC.Symbol?this._symbolSourceCaches[_.id]=P:w===c.aC.FillExtrusion?this._fillExtrusionSourceCaches[_.id]=P:this._otherSourceCaches[_.id]=P,P.onAdd(this.map)};x(c.aC.Other),a.type!=="vector"&&a.type!=="geojson"||(x(c.aC.Symbol),a.type==="vector"&&x(c.aC.FillExtrusion)),_.onAdd&&_.onAdd(this.map),f.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const a=this.getOwnSource(r);if(!a)throw new Error("There is no source with this ID");for(const _ in this._layers)if(this._layers[_].source===r)return this.fire(new c.v(new Error(`Source "${r}" cannot be removed while layer "${_}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new c.v(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const _=Object.entries(this.stylesheet.iconsets).find(([x,w])=>w.type==="source"&&w.source===r);if(_)return this.fire(new c.v(new Error(`Source "${r}" cannot be removed while iconset "${_[0]}" is using it.`)))}const f=this.getOwnSourceCaches(r);for(const _ of f){const x=c.cY(_.id);delete this._sourceCaches[x],this._changes.discardSourceCacheUpdate(_.id),_.fire(new c.x("data",{sourceDataType:"metadata",dataType:"source",sourceId:_.getSource().id})),_.setEventedParent(null),_.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],delete this._fillExtrusionSourceCaches[r],this._hdCoverage&&delete this._hdCoverage.coverageSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(r,a){this._checkLoaded(),this.getOwnSource(r).setData(a),this._changes.setDirty()}getOwnSource(r){const a=this.getOwnSourceCache(r);return a&&a.getSource()}getOwnSources(){const r=[];for(const a in this._otherSourceCaches){const f=this.getOwnSourceCache(a);f&&r.push(f.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const a in r){const f=r[a]._tiles;for(const _ in f){const x=f[_];if(x.state!=="loaded"&&x.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),this._programPrecompiler&&this._programPrecompiler.reset(),!r)return delete this.ambientLight,void delete this.directionalLight;const a=this._getTransitionParameters();for(const x of r){if(this._validate(Nr,"lights",x))return;switch(x.type){case"ambient":if(this.ambientLight){const w=this.ambientLight;w.set(x),w.updateTransitions(a)}else this.ambientLight=new ab(x,hf(),this.scope,this.options);break;case"directional":if(this.directionalLight){const w=this.directionalLight;w.set(x),w.updateTransitions(a)}else this.directionalLight=new ab(x,lm(),this.scope,this.options)}}const f=Object.assign(a,{worldview:this.map.getWorldview()}),_=new c.w(this.z||0,f);this.ambientLight&&this.ambientLight.recalculate(_),this.directionalLight&&this.directionalLight.recalculate(_),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;const f=F=>.2126*(F[0]<=.03928?F[0]/12.92:Math.pow((F[0]+.055)/1.055,2.4))+.7152*(F[1]<=.03928?F[1]/12.92:Math.pow((F[1]+.055)/1.055,2.4))+.0722*(F[2]<=.03928?F[2]/12.92:Math.pow((F[2]+.055)/1.055,2.4)),_=r.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),x=r.properties.get("intensity"),w=r.properties.get("direction"),k=1-c.bB(w.x,w.y,w.z)[2]/90,A=f(_)*x*k,P=a.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),D=a.properties.get("intensity"),z=f(P)*D;return Number(((A+z)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(r==null||r===""&&this.isRootStyle())return this;if(c.dx(r)){const a=c.cS(r),f=this.fragments.find(({id:x})=>x===a);if(!f)return;const _=c.cY(r);return f.style.getFragmentStyle(_)}{const a=this.fragments.find(({id:f})=>f===r);return a?a.style:void 0}}setFeaturesetSelectors(r){if(!r)return;const a=(f,_="")=>`${f}::${_}`;this._featuresetSelectors={};for(const f in r){const _={},x=this._featuresetSelectors[f]=[];for(const w of r[f].selectors){if(w.featureNamespace){const A=this.getOwnLayer(w.layer);if(!A){c.f_(`Layer is undefined for selector: ${w.layer}`);continue}const P=a(A.source,A.sourceLayer);if(P in _&&_[P]!==w.featureNamespace){c.f_(`"featureNamespace ${w.featureNamespace} of featureset ${f}'s selector is not associated to the same source, skip this selector`);continue}_[P]=w.featureNamespace}let k;if(w.properties)for(const A in w.properties){const P=c.bY(w.properties[A]);P.result==="success"&&(k=k||{},k[A]=P.value)}x.push({layerId:w.layer,namespace:w.featureNamespace,properties:k,uniqueFeatureID:w._uniqueFeatureID})}}}getFeaturesetDescriptors(r){const a=this.getFragmentStyle(r);if(!a||!a.stylesheet.featuresets)return[];const f=[];for(const _ in a.stylesheet.featuresets)f.push({featuresetId:_,importId:a.scope?a.scope:void 0});return f}getFeaturesetLayers(r,a){const f=this.getFragmentStyle(a),_=f.stylesheet.featuresets;if(!_||!_[r])return this.fire(new c.v(new Error(`The featureset '${r}' does not exist in the map's style and cannot be queried.`))),[];const x=[];for(const w of _[r].selectors){const k=f.getOwnLayer(w.layer);k&&x.push(k)}return x}getConfigProperty(r,a){const f=this.getFragmentStyle(r);if(!f)return null;const _=c.ea(a,f.scope),x=f.options.get(_),w=x?x.value||x.default:null;return w?w.serialize():null}isIndoorEnabled(){return this._indoorEnabled}getIndoorSourceLayers(r,a){const f=c.ea(r,a);return this._mergedIndoor[f]}setIndoorData(r,a){this.indoorManager&&this.indoorManager.setIndoorData(a)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(r,a,f){const _=this.getFragmentStyle(r);if(!_)return;const x=_.stylesheet.schema;if(!x||!x[a])return;const w=Hd(x[a],f);if(w.result!=="success")return void jc(this,w.value);const k=w.value.expression,A=c.ea(a,_.scope),P=_.options.get(A);if(!P)return;let D;const{minValue:z,maxValue:F,stepValue:j,type:$,values:W}=x[a],J=Hd(x[a],x[a].default);J.result==="success"&&(D=J.value.expression),D?(this.options.set(A,Object.assign({},P,{value:k,default:D,minValue:z,maxValue:F,stepValue:j,type:$,values:W})),this.updateConfigDependencies(a)):this.fire(new c.v(new Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){const a=this.getFragmentStyle(r);if(!a)return null;const f=a.stylesheet.schema;if(!f)return null;const _={};for(const x in f){const w=c.ea(x,a.scope),k=a.options.get(w),A=k?k.value||k.default:null;_[x]=A?A.serialize():null}return _}setConfig(r,a){const f=this.getFragmentStyle(r);f&&(f.updateConfig(a,f.stylesheet.schema),this.updateConfigDependencies())}getSchema(r){const a=this.getFragmentStyle(r);return a?a.stylesheet.schema:null}setSchema(r,a){const f=this.getFragmentStyle(r);f&&(f.stylesheet.schema=a,f.updateConfig(f._config,a),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(const f in a){let _,x;const w=Hd(a[f],a[f].default);if(w.result==="success"&&(_=w.value.expression),r&&r[f]!==void 0){const F=Hd(a[f],r[f]);F.result==="success"&&(x=F.value.expression)}const{minValue:k,maxValue:A,stepValue:P,type:D,values:z}=a[f];if(_){const F=c.ea(f,this.scope);this.options.set(F,{default:_,value:x,minValue:k,maxValue:A,stepValue:P,type:D,values:z})}else this.fire(new c.v(new Error(`No schema defined for config option "${f}".`)))}else this.fire(new c.v(new Error("Attempting to set config for a style without schema.")))}_updateLayers(r,a=()=>!0){for(const f of r){const _=this.getLayer(f);_&&a(_)&&(_.possiblyEvaluateVisibility(),this._updateLayer(_),this._changes.setDirty())}}updateConfigDependencies(r){this._updateLayers(this._configDependentLayers,a=>!r||a.expressionDependencies.configDependencies.has(r)),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(a=>{const f=a._styleColorTheme.colorThemeOverride?a._styleColorTheme.colorThemeOverride:a._styleColorTheme.colorTheme;if(f){const _=a._evaluateColorThemeData(f);(!a._styleColorTheme.lut&&_!==""||a._styleColorTheme.lut&&_!==a._styleColorTheme.lut.data)&&a.setColorTheme(f)}}),this._updateIndoorEnabled(),this._changes.setDirty()}addLayer(r,a,f={}){this._checkLoaded();const _=r.id;if(this._layers[_])return void this.fire(new c.v(new Error(`Layer with id "${_}" already exists on this map`)));let x;if(r.type==="custom"){if(jc(this,c.fY(r)))return;x=c.c0(r,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof r.source=="object"&&(this.addSource(_,r.source),r=c.bL(r),r=Object.assign(r,{source:_})),this._validate(nb,`layers.${_}`,r,{arrayIndex:-1},f))return;x=c.c0(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(x),x.setEventedParent(this,{layer:{id:_}})}const w=c.ea(x.source,x.scope);x.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(w),x.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(w);let k=this._order.length;if(a){const z=this._order.indexOf(a);if(z===-1)return void this.fire(new c.v(new Error(`Layer with id "${a}" does not exist on this map.`)));x.slot&&x.slot!==this._layers[a].slot?c.f_(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):k=z}this._order.splice(k,0,_),this._handleLayerOrderChange(),this._layers[_]=x;const A=this.getOwnLayerSourceCache(x),P=!!this.directionalLight&&this.directionalLight.shadowsEnabled();A&&x.canCastShadows()&&P&&(A.castsShadows=!0);const D=this._changes.getRemovedLayer(x);if(D&&x.source&&A&&x.type!=="custom"){this._changes.discardLayerRemoval(x);const z=c.ea(x.source,x.scope);D.type!==x.type?this._changes.updateSourceCache(z,"clear"):(this._changes.updateSourceCache(z,"reload"),A.pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map),x.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();const f=this._checkLayer(r);if(!f||r===a)return;const _=this._order.indexOf(r);this._order.splice(_,1);let x=this._order.length;if(a){const w=this._order.indexOf(a);if(w===-1)return void this.fire(new c.v(new Error(`Layer with id "${a}" does not exist on this map.`)));f.slot&&f.slot!==this._layers[a].slot?c.f_(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):x=w}this._order.splice(x,0,r),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(r){this._checkLoaded();const a=this._checkLayer(r);if(!a)return;a.setEventedParent(null);const f=this._order.indexOf(r);this._order.splice(f,1),delete this._layers[r],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(a.fqid),this._indoorDependentLayers.delete(a.fqid),this._changes.removeLayer(a);const _=this.getOwnLayerSourceCache(a);if(_&&_.castsShadows){let x=!1;for(const w in this._layers)if(this._layers[w].source===a.source&&this._layers[w].canCastShadows()){x=!0;break}_.castsShadows=x}a.onRemove&&a.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const a in this._layers)if(this._layers[a].type===r)return!0;return!1}setLayerZoomRange(r,a,f){this._checkLoaded();const _=this._checkLayer(r);_&&(_.minzoom===a&&_.maxzoom===f||(a!=null&&(_.minzoom=a),f!=null&&(_.maxzoom=f),this._updateLayer(_)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(r,a){this._checkLoaded();const f=this._checkLayer(r);f&&f.slot!==a&&(f.slot=a,this._updateLayer(f))}setFilter(r,a,f={}){this._checkLoaded();const _=this._checkLayer(r);if(_&&!c.c2(_.filter,a))return a==null?(_.filter=void 0,void this._updateLayer(_)):void(this._validate(cf,`layers.${_.id}.filter`,a,{layerType:_.type},f)||(_.filter=c.bL(a),this._updateLayer(_)))}getFilter(r){const a=this._checkLayer(r);if(a)return c.bL(a.filter)}setLayoutProperty(r,a,f,_={}){this._checkLoaded();const x=this._checkLayer(r);if(x&&!c.c2(x.getLayoutProperty(a),f)){if(f!=null&&(!_||_.validate!==!1)&&jc(x,rb.call(Ps,{key:`layers.${r}.layout.${a}`,layerType:x.type,objectKey:a,value:f,styleSpec:c.fs,style:{glyphs:!0,sprite:!0}})))return;x.setLayoutProperty(a,f),x.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(x.fqid),x.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(x.fqid),this._updateLayer(x)}}getLayerProperty(r,a){const f=this._checkLayer(r);if(f){switch(a){case"minzoom":return f.minzoom;case"maxzoom":return f.maxzoom;case"filter":return this.getFilter(r);case"slot":return f.slot;case"appearances":return f.getAppearances().map(_=>_.serialize())}return f.isPaintProperty(a)?this.getPaintProperty(r,a):this.getLayoutProperty(r,a)}}setLayerProperty(r,a,f,_={}){this._checkLoaded();const x=this._checkLayer(r);if(x){switch(a){case"appearances":return x.setAppearances(f),void this._updateLayer(x);case"minzoom":return this.setLayerZoomRange(r,f);case"maxzoom":return this.setLayerZoomRange(r,null,f);case"filter":return this.setFilter(r,f,_);case"slot":return this.setSlot(r,f)}x.isPaintProperty(a)?this.setPaintProperty(r,a,f,_):this.setLayoutProperty(r,a,f,_)}}getLayoutProperty(r,a){const f=this._checkLayer(r);if(f)return f.getLayoutProperty(a)}setPaintProperty(r,a,f,_={}){this._checkLoaded();const x=this._checkLayer(r);if(!x||c.c2(x.getPaintProperty(a),f)||f!=null&&(!_||_.validate!==!1)&&jc(x,ny.call(Ps,{key:`layers.${r}.paint.${a}`,layerType:x.type,objectKey:a,value:f,styleSpec:c.fs})))return;const w=x.setPaintProperty(a,f);x.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(x.fqid),x.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(x.fqid),w&&this._updateLayer(x),this._changes.updatePaintProperties(x)}getPaintProperty(r,a){const f=this._checkLayer(r);if(f)return f.getPaintProperty(a)}setFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){const{featuresetId:A,importId:P}=r.target,D=this.getFragmentStyle(P),z=D.getFeaturesetLayers(A);for(const{source:F,sourceLayer:j}of z)D.setFeatureState({id:r.id,source:F,sourceLayer:j},a)}else if("layerId"in r.target){const{layerId:A}=r.target,P=this.getLayer(A);this.setFeatureState({id:r.id,source:P.source,sourceLayer:P.sourceLayer},a)}return}const f=r.source,_=r.sourceLayer,x=this._checkSource(f);if(!x)return;const w=x.type;if(w==="geojson"&&_)return void this.fire(new c.v(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(w==="vector"&&!_)return void this.fire(new c.v(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new c.v(new Error("The feature id parameter must be provided.")));const k=this.getOwnSourceCaches(f);for(const A of k)A.setFeatureState(_,r.id,a)}removeFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){const{featuresetId:A,importId:P}=r.target,D=this.getFragmentStyle(P),z=D.getFeaturesetLayers(A);for(const{source:F,sourceLayer:j}of z)D.removeFeatureState({id:r.id,source:F,sourceLayer:j},a)}else if("layerId"in r.target){const{layerId:A}=r.target,P=this.getLayer(A);this.removeFeatureState({id:r.id,source:P.source,sourceLayer:P.sourceLayer},a)}return}const f=r.source,_=this._checkSource(f);if(!_)return;const x=_.type,w=x==="vector"?r.sourceLayer:void 0;if(x==="vector"&&!w)return void this.fire(new c.v(new Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new c.v(new Error("A feature id is required to remove its specific state property.")));const k=this.getOwnSourceCaches(f);for(const A of k)A.removeFeatureState(w,r.id,a)}getFeatureState(r){if(this._checkLoaded(),"target"in r){let x;if("featuresetId"in r.target){const{featuresetId:w,importId:k}=r.target,A=this.getFragmentStyle(k),P=A.getFeaturesetLayers(w);for(const{source:D,sourceLayer:z}of P){const F=A.getFeatureState({id:r.id,source:D,sourceLayer:z});if(F&&!x)x=F;else if(!c.c2(x,F))return void this.fire(new c.v(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 r.target){const{layerId:w}=r.target,k=this.getLayer(w);x=this.getFeatureState({id:r.id,source:k.source,sourceLayer:k.sourceLayer})}return x}const a=r.source,f=r.sourceLayer,_=this._checkSource(a);if(_){if(_.type!=="vector"||f)return r.id===void 0&&this.fire(new c.v(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(f,r.id);this.fire(new c.v(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(r){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,r),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}setWorldview(r){r!==this._worldview&&(this._worldview=r,this.dispatcher.broadcast("setWorldview",this._worldview),this.reloadSources())}serialize(){this._checkLoaded();const r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return c.cr({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:a,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)},f=>f!==void 0)}_updateFilteredLayers(r){for(const a of Object.values(this._mergedLayers))r(a)&&this._updateLayer(a)}_updateLayer(r){this._changes.updateLayer(r);const a=this.getLayerSourceCache(r),f=c.ea(r.source,r.scope),_=this._changes.getUpdatedSourceCaches();r.source&&!_[f]&&a&&a.getSource().type!=="raster"&&(this._changes.updateSourceCache(f,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const a=k=>this._mergedLayers[k].is3D(!!this.terrain),f=this.order,_={},x=[];for(let k=f.length-1;k>=0;k--){const A=f[k];if(a(A)){_[A]=k;for(const P of r){const D=P[A];if(D)for(const z of D)x.push(z)}}}x.sort((k,A)=>A.intersectionZ-k.intersectionZ);const w=[];for(let k=f.length-1;k>=0;k--){const A=f[k];if(a(A))for(let P=x.length-1;P>=0;P--){const D=x[P].feature;if(D.layer&&_[D.layer.id]<k)break;w.push(D),x.pop()}else for(const P of r){const D=P[A];if(D)for(const z of D)w.push(z.feature)}}return w}queryRasterValue(r,a,f){const _=this.getOwnSource(r);return _?_.type!=="raster-array"?(this.fire(new c.v(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):_.queryRasterArrayValue(a,f):(this.fire(new c.v(new Error(`Source with id "${r}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(r,a,f){let _;a&&!Array.isArray(a)&&a.filter&&(this._validate(cf,"queryRenderedFeatures.filter",a.filter,null,a),_=c.bZ(a.filter));const x={},w=D=>{if(_t.has(D.type))return;const z=this.getOwnLayerSourceCache(D),F=x[z.id]=x[z.id]||{sourceCache:z,layers:{},has3DLayers:!1};D.is3D(!!this.terrain)&&(F.has3DLayers=!0),F.layers[D.fqid]=F.layers[D.fqid]||{styleLayer:D,targets:[]},F.layers[D.fqid].targets.push({filter:_})};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new c.v(new Error("parameters.layers must be an Array."))),[];for(const D of a.layers){const z=this._layers[D];if(!z)return this.fire(new c.v(new Error(`The layer '${D}' does not exist in the map's style and cannot be queried for features.`))),[];w(z)}}else for(const D in this._layers)w(this._layers[D]);const k=this._queryRenderedFeatures(r,x,f),A=this._flattenAndSortRenderedFeatures(k),P=[];for(const D of A)c.cZ(D.layer.id)===this.scope&&P.push(D);return P}queryRenderedFeatureset(r,a,f){let _;a&&!Array.isArray(a)&&a.filter&&(this._validate(cf,"queryRenderedFeatures.filter",a.filter,null,a),_=c.bZ(a.filter));const x="mock",w=[];if(a&&a.target)w.push(Object.assign({},a,{targetId:x,filter:_}));else{const D=this.getFeaturesetDescriptors();for(const z of D)w.push({targetId:x,filter:_,target:z});for(const{style:z}of this.fragments){const F=z.getFeaturesetDescriptors();for(const j of F)w.push({targetId:x,filter:_,target:j})}}const k=this.queryRenderedTargets(r,w,f),A=[],P=new Set;for(const D of k)for(const z of D.variants[x])jy(z,D,P)||A.push(new c.aZ(D,z));return A}queryRenderedTargets(r,a,f){const _={},x=(k,A,P,D)=>{const z=_[A.id]=_[A.id]||{sourceCache:A,layers:{},has3DLayers:!1};if(z.layers[k.fqid]=z.layers[k.fqid]||{styleLayer:k,targets:[]},k.is3D(!!this.terrain)&&(z.has3DLayers=!0),!D)return P.uniqueFeatureID=!1,void z.layers[k.fqid].targets.push(P);z.layers[k.fqid].targets.push(Object.assign({},P,{namespace:D.namespace,properties:D.properties,uniqueFeatureID:D.uniqueFeatureID}))};for(const k of a)if("featuresetId"in k.target){const{featuresetId:A,importId:P}=k.target,D=this.getFragmentStyle(P);if(!D||!D._featuresetSelectors)continue;const z=D._featuresetSelectors[A];if(!z){this.fire(new c.v(new Error(`The featureset '${A}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const F of z){const j=D.getOwnLayer(F.layerId);j&&!_t.has(j.type)&&x(j,D.getOwnLayerSourceCache(j),k,F)}}else if("layerId"in k.target){const{layerId:A}=k.target,P=this.getLayer(A);if(!P||_t.has(P.type))continue;x(P,this.getLayerSourceCache(P),k)}const w=this._queryRenderedFeatures(r,_,f);return this._flattenAndSortRenderedFeatures(w)}_queryRenderedFeatures(r,a,f){const _=[],x=!!this.map._showQueryGeometry,w=Vy.createFromScreenPoints(r,f);for(const k in a){const A=Lm(w,a[k],this._availableImages,f,x,this.getActualScope());Object.keys(A).length&&_.push(A)}if(this.placement)for(const k in a){if(a[k].sourceCache._renderSourceType!==c.aC.Symbol)continue;const A=Om(w.screenGeometry,a[k],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(A).length&&_.push(A)}return _}querySourceFeatures(r,a){const f=a&&a.filter;f&&this._validate(cf,"querySourceFeatures.filter",f,null,a);let _=[];const x=this.getOwnSourceCaches(r);for(const w of x)_=_.concat(Vf(w,a));return _}addSourceType(r,a,f){return fr.getSourceType(r)?f(new Error(`A source type called "${r}" already exists.`)):(fr.setSourceType(r,a),f(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,f={}){this._checkLoaded();const _=this.light.getLight();let x=!1;for(const k in r)if(!c.c2(r[k],_[k])){x=!0;break}if(!x)return;const w=this._getTransitionParameters();this.light.setLight(r,a,f),this.light.updateTransitions(w)}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=c.co.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&c.f_("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),a===0&&delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let f=r;const _=!("source"in r)||r.source==null;if(a===1){if(this.disableElevatedTerrain)return;if("source"in f&&typeof f.source=="object"){const k="terrain-dem-src";this.addSource(k,f.source),f=c.bL(f),f=Object.assign(f,{source:k})}const x=Object.assign({},f),w={};if(this.terrain&&_){x.source=this.terrain.get().source;const k=this.terrain?this.getFragmentStyle(this.terrain.scope):null;k&&(w.style=k.serialize())}if(this._validate(Jx,"terrain",x,w))return}if(!this.terrain||this.terrain.scope!==this.scope&&!_||this.terrain&&a!==this.terrain.drapeRenderMode){if(!f)return;this._createTerrain(f,a),this.fire(new c.x("data",{dataType:"style"}))}else{const x=this.terrain,w=x.get();for(const k of Object.keys(c.fs.terrain))!Object.hasOwn(f,k)&&c.fs.terrain[k].default&&(f[k]=c.fs.terrain[k].default);for(const k in r)if(!c.c2(r[k],w[k])){x.set(r,this.options),this.stylesheet.terrain=r;const A=this._getTransitionParameters({duration:0});x.updateTransitions(A),this.fire(new c.x("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const a=this.fog=new ob(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=a.get();const f=this._getTransitionParameters({duration:0});a.updateTransitions(f)}_createSnow(r){const a=this.snow=new sb(r,this.map.transform,this.scope,this.options);this.stylesheet.snow=a.get();const f=this._getTransitionParameters({duration:0});a.updateTransitions(f)}_createRain(r){const a=this.rain=new sy(r,this.map.transform,this.scope,this.options);this.stylesheet.rain=a.get();const f=this._getTransitionParameters({duration:0});a.updateTransitions(f)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),r)if(this.fog){const a=this.fog;if(!c.c2(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();const f=this._getTransitionParameters({duration:0});a.updateTransitions(f)}}else this._createFog(r);else delete this.fog,delete this.stylesheet.fog;this._markersNeedUpdate=!0,this._programPrecompiler&&this._programPrecompiler.reset()}getSnow(){return this.snow?this.snow.get():null}setSnow(r){if(this._checkLoaded(),!r)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const a=this.snow;if(!c.c2(a.get(),r)){a.set(r,this.options),this.stylesheet.snow=a.get();const f=this._getTransitionParameters({duration:0});a.updateTransitions(f)}}else this._createSnow(r);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(r){if(this._checkLoaded(),!r)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const a=this.rain;if(!c.c2(a.get(),r)){a.set(r,this.options),this.stylesheet.rain=a.get();const f=this._getTransitionParameters({duration:0});a.updateTransitions(f)}}else this._createRain(r);this._markersNeedUpdate=!0}_reloadColorTheme(){const r=()=>{for(const _ in this._layers)this._layers[_].lut=this._styleColorTheme.lut;for(const _ in this._sourceCaches)this._sourceCaches[_].clearTiles()},a=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!a)return this._styleColorTheme.lut=null,void r();const f=this._evaluateColorThemeData(a);this._loadColorTheme(f).then(()=>{this.fire(new c.x("colorthemeset")),r()}).catch(_=>{c.f_(`Couldn't set color theme: ${_}`)})}setColorTheme(r){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&c.f_("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=r,this._reloadColorTheme()}setImportColorTheme(r,a){const f=this.getFragmentStyle(r);f&&(f._styleColorTheme.colorThemeOverride=a,f._reloadColorTheme())}_getTransitionParameters(r){return{now:c.co.now(),transition:Object.assign(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],a=[];for(const f of this._mergedOrder)this.isLayerDraped(this._mergedLayers[f])?r.push(f):a.push(f);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...a)}_createTerrain(r,a){const f=this.terrain=new iy(r,a,this.scope,this.options,this.map.getWorldview());a===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const _=this._getTransitionParameters({duration:0});f.updateTransitions(_)}_force3DLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="fill-extrusion"&&this._updateLayer(a)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="symbol"&&this._updateLayer(a)}}_validate(r,a,f,_,x={}){if(x&&x.validate===!1)return!1;const w=Object.assign({},this.serialize());return jc(this,r.call(Ps,Object.assign({key:a,style:w,value:f,styleSpec:c.fs},_)))}_remove(){this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.ck.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches){const a=this._mergedSourceCaches[r];a.clearTiles(),a.setEventedParent(null);const f=a.getSource();f&&f.onRemove&&f.onRemove(this.map)}this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager&&this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(r){const a=this.getSourceCaches(r);for(const f of a)f.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}clearLayers(){for(const r in this._mergedLayers){const a=this._mergedLayers[r];a._clear&&a._clear()}}reloadSource(r){const a=this.getSourceCaches(r);for(const f of a)f.resume(),f.reload()}reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(r=>{r.modelManager.reloadModels(r.scope)})}updateSources(r){let a;this.directionalLight&&(a=cy(this.directionalLight));const f=new Set,_=new Set,x=new Set;for(const w in this._mergedLayers){const k=this._mergedLayers[w];k.type==="building"?f.add(k.source):k.type==="raster"&&k.paint&&k.paint.get("raster-elevation-reference")==="ground"&&x.add(k.source),k.hasElevation()&&!_.has(k.source)&&_.add(k.source)}this.updateFrcCoverageFadeRange();for(const w in this._mergedSourceCaches){const k=this._mergedSourceCaches[w],A=_.has(k._source.id);k._isRasterElevatedOverTerrain=x.has(k._source.id),f.has(k._source.id)&&(k._source.reparseOverscaled=!1),k.update(r,void 0,void 0,a,A)}this.updateFrcCoverage()}_reloadSources(){for(const r in this._sourceCaches){const a=this._sourceCaches[r];a.resume(),a.reload()}}updateFrcCoverageFadeRange(){this.map.painter&&Zn.updateFrcCoverageFadeRange&&Zn.updateFrcCoverageFadeRange(this,this.map.painter)}updateFrcCoverage(){this._hdCoverage&&Zn.updateFrcCoverage&&Zn.updateFrcCoverage(this,this._hdCoverage)}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new c.x("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new ws),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(r,a,f,_,x,w){this.pauseablePlacement||(this.pauseablePlacement=new ws);let k=!1,A=!1;const P={},D={};for(const J of this._mergedOrder){const Q=this._mergedLayers[J];if(Q.type!=="symbol")continue;const ce=c.ea(Q.source,Q.scope);let fe=P[ce];if(!fe){const Ae=this.getLayerSourceCache(Q);if(!Ae)continue;const Ee=Ae.getRenderableIds(!0).map(Pe=>Ae.getTileByID(Pe));D[ce]=Ee.slice(),fe=P[ce]=Ee.sort((Pe,ye)=>ye.tileID.overscaledZ-Pe.tileID.overscaledZ||(Pe.tileID.isLessThan(ye.tileID)?-1:1))}const se=this.crossTileSymbolIndex.addLayer(Q,fe,r.center.lng,r.projection);k=k||se}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const z=!!(this.placement&&!r.equals(this.placement.transform)),F=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!x||this.placement.lastReplacementSourceUpdateTime!==x.updateTime)),j=z||F||k,$=(j||this.pauseablePlacement.isStale())&&f===0,W=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.co.now(),r.zoom)&&f!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||$||W)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(r,this._mergedOrder,a,f,_,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex,w),this.map.painter)){const J=this.map.painter.maxFrontCutoffRawStart;if(J>0){const Q=180*r.pitch/Math.PI;if(Q>=15){const ce=Math.min(1,Math.max(0,(Q-15)/5)),fe=ce*ce*(3-2*ce);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-fe)+J*fe}}}if(this.pauseablePlacement.isDone()?j&&f!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,P,D,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c.co.now()),A=!0),k&&this.pauseablePlacement.setStale()),A||k){this._buildingIndex.onNewFrame(r.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 ce=this.isLayerClipped(Q);this.placement.updateLayerOpacities(Q,P[c.ea(Q.source,Q.scope)],J,ce?x:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(c.co.now())}_releaseSymbolFadeTiles(){for(const r in this._sourceCaches)this._sourceCaches[r].releaseSymbolFadeTiles()}addImport(r,a){this._checkLoaded();const f=this.stylesheet.imports=this.stylesheet.imports||[];if(f.findIndex(({id:x})=>x===r.id)!==-1)return void this.fire(new c.v(new Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return f.push(r),this._loadImports([r],!0);const _=f.findIndex(({id:x})=>x===a);return _===-1&&this.fire(new c.v(new Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=f.slice(0,_).concat(r).concat(f.slice(_)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();const f=this.stylesheet.imports||[],_=this.getImportIndex(r);return _===-1?this:typeof a=="string"?(this.setImportUrl(r,a),this):(a.url&&a.url!==f[_].url&&this.setImportUrl(r,a.url),c.c2(a.config,f[_].config)||this.setImportConfig(r,a.config,a.data.schema),c.c2(a.data,f[_].data)||this.setImportData(r,a.data),this)}moveImport(r,a){this._checkLoaded();let f=this.stylesheet.imports||[];const _=this.getImportIndex(r);if(_===-1)return this;const x=this.getImportIndex(a);if(x===-1)return this;const w=f[_],k=this.fragments[_];return f=f.filter(({id:A})=>A!==r),this.fragments=this.fragments.filter(({id:A})=>A!==r),this.stylesheet.imports=f.slice(0,x).concat(w).concat(f.slice(x)),this.fragments=this.fragments.slice(0,x).concat(k).concat(this.fragments.slice(x)),this.mergeLayers(),this}setImportUrl(r,a){this._checkLoaded();const f=this.stylesheet.imports||[],_=this.getImportIndex(r);if(_===-1)return this;f[_].url=a;const x=this.fragments[_];return x.style=this._createFragmentStyle(f[_]),x.style.on("style.import.load",()=>this.mergeAll()),x.style.loadURL(a),this}setImportData(r,a){this._checkLoaded();const f=this.getImportIndex(r),_=this.stylesheet.imports||[];return f===-1?this:a?(this.fragments[f].style.setState(a),this._reloadImports(),this):(delete _[f].data,this.setImportUrl(r,_[f].url))}setImportConfig(r,a,f){this._checkLoaded();const _=this.getImportIndex(r),x=this.stylesheet.imports||[];if(_===-1)return this;a?x[_].config=a:delete x[_].config;const w=this.fragments[_];f&&w.style.stylesheet&&(w.style.stylesheet.schema=f);const k=w.style.stylesheet&&w.style.stylesheet.schema;return w.config=a,w.style.updateConfig(a,k),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const a=this.stylesheet.imports||[],f=this.getImportIndex(r);f!==-1&&(a.splice(f,1),this.fragments[f].style._remove(),this.fragments.splice(f,1),this._reloadImports())}getImportIndex(r){const a=(this.stylesheet.imports||[]).findIndex(f=>f.id===r);return a===-1&&this.fire(new c.v(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const a in this._mergedOtherSourceCaches){const f=this._mergedOtherSourceCaches[a];f&&r.push(f.getSource())}return r}getSource(r,a){const f=this.getSourceCache(r,a);return f&&f.getSource()}getLayerSource(r){const a=this.getLayerSourceCache(r);return a&&a.getSource()}getSourceCache(r,a){const f=c.ea(r,a);return this._mergedOtherSourceCaches[f]}getLayerSourceCache(r){const a=c.ea(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[a]:r.type==="fill-extrusion"?this._mergedFillExtrusionSourceCaches[a]||this._mergedOtherSourceCaches[a]:r.type==="fill"&&r.sourceLayer===c.X&&this._mergedHdRoadCoverageSourceCaches[a]?this._mergedHdRoadCoverageSourceCaches[a]:this._mergedOtherSourceCaches[a]}getSourceCaches(r){if(r==null)return Object.values(this._mergedSourceCaches);const a=[];return this._mergedOtherSourceCaches[r]&&a.push(this._mergedOtherSourceCaches[r]),this._mergedSymbolSourceCaches[r]&&a.push(this._mergedSymbolSourceCaches[r]),this._mergedFillExtrusionSourceCaches[r]&&a.push(this._mergedFillExtrusionSourceCaches[r]),this._mergedHdRoadCoverageSourceCaches[r]&&a.push(this._mergedHdRoadCoverageSourceCaches[r]),a}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const a in r){const f=r[a];f==="reload"?this.reloadSource(a):f==="clear"&&this.clearSource(a)}}updateLayers(r){const a=this._changes.getUpdatedPaintProperties();for(const f of a){const _=this.getLayer(f);_&&_.updateTransitions(r)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(r){this.stylesheet.glyphs=r,this.glyphManager.setURL(r)}getImages(r,a,f){this.imageManager.getImages(a.icons.concat(a.patterns),a.scope,f),this._updateTilesForChangedImages();const _=a.icons.map(A=>c.a1.toString(A)),x=a.patterns.map(A=>c.a1.toString(A)),w=A=>{A&&(A.setDependencies(a.tileID.key,"icons",_),A.setDependencies(a.tileID.key,"patterns",x))},k=c.ea(a.source,a.scope);w(this._mergedOtherSourceCaches[k]),w(this._mergedSymbolSourceCaches[k]),(a.icons.some(A=>A.iconsetId)||a.patterns.some(A=>A.iconsetId))&&this.fire(new c.x("data",{dataType:"style"}))}rasterizeImages(r,a,f){this.imageManager.rasterizeImages(a,f)}checkAtlasCache(r,a,f){const _=this.imageManager.imageAtlasCache.findCachedAtlas(a.descriptor);f(null,_&&_.contentDescriptor?{iconPositions:_.iconPositions,patternPositions:_.patternPositions,sourceHash:_.contentDescriptor.hash}:null)}getGlyphs(r,a,f){this.glyphManager.getGlyphs(a.stacks,f)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:r.type==="fill-extrusion"&&this._fillExtrusionSourceCaches[r.source]||this._otherSourceCaches[r.source]}getOwnSourceCaches(r){const a=[];return this._otherSourceCaches[r]&&a.push(this._otherSourceCaches[r]),this._symbolSourceCaches[r]&&a.push(this._symbolSourceCaches[r]),this._fillExtrusionSourceCaches[r]&&a.push(this._fillExtrusionSourceCaches[r]),this._hdCoverage&&this._hdCoverage.coverageSourceCaches[r]&&a.push(this._hdCoverage.coverageSourceCaches[r]),a}_updateHdCoverageSourceCache(r){return Zn.HdCoverageState&&Zn.updateHdCoverageSourceCache?(this._hdCoverage||(this._hdCoverage=new Zn.HdCoverageState),Zn.updateHdCoverageSourceCache(this,this._hdCoverage,r),!1):r.type==="fill"&&r.sourceLayer===c.X}_isSourceCacheLoaded(r){const a=this.getOwnSourceCaches(r);return a.length===0?(this.fire(new c.v(new Error(`There is no source with ID '${r}'`))),!1):a.every(f=>f.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(r,a){if(!this._clipLayerPresent&&r.type!=="fill-extrusion"&&r.type!=="building")return!1;const f=r.type==="fill-extrusion"&&(r.sourceLayer==="building"||r.sourceLayer==="procedural_buildings"),_=r.type==="building";if(r.is3D(!!this.terrain)){if(f||_||a&&a.type==="batched-model"||r.type==="model")return!0}else if(r.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}fr.getSourceType=function(u){return Ql[u]},fr.setSourceType=function(u,r){Ql[u]=r},fr.registerForPluginStateChange=c.e_;class Le{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,a,f,_,x,w,k,A){this.context=r;let P=this.boundPaintVertexBuffers.length!==_.length;for(let z=0;!P&&z<_.length;z++)this.boundPaintVertexBuffers[z]!==_[z]&&(P=!0);let D=this.boundDynamicVertexBuffers.length!==k.length;for(let z=0;!D&&z<k.length;z++)this.boundDynamicVertexBuffers[z]!==k[z]&&(D=!0);if(!this.vao||this.boundProgram!==a||this.boundLayoutVertexBuffer!==f||P||D||this.boundIndexBuffer!==x||this.boundVertexOffset!==w)this.freshBind(a,f,_,x,w,k,A);else{r.bindVertexArrayOES.set(this.vao);for(const z of k)z&&(z.bind(),A&&z.instanceCount&&z.setVertexAttribDivisor(r.gl,a,A));x&&x.dynamicDraw&&x.bind()}}freshBind(r,a,f,_,x,w,k){const A=this.context,P=A.gl;this.vao&&this.destroy(),this.vao=A.gl.createVertexArray(),A.bindVertexArrayOES.set(this.vao),this.boundProgram=r,this.boundLayoutVertexBuffer=a,this.boundPaintVertexBuffers=f,this.boundIndexBuffer=_,this.boundVertexOffset=x,this.boundDynamicVertexBuffers=w,a.enableAttributes(P,r),a.bind(),a.setVertexAttribPointers(P,r,x);for(const D of f)D.enableAttributes(P,r),D.bind(),D.setVertexAttribPointers(P,r,x);for(const D of w)D&&(D.enableAttributes(P,r),D.bind(),D.setVertexAttribPointers(P,r,x),k&&D.instanceCount&&D.setVertexAttribDivisor(P,r,k));_&&_.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Nb(u,r){const a=Math.pow(2,r.canonical.z),f=r.canonical.y;return[new c.ag(0,f/a).toLngLat().lat,new c.ag(0,(f+1)/a).toLngLat().lat]}function jm(u,r,a,f,_,x,w){const k=u.context,A=k.gl,P=a.hillshadeFBO;if(!P)return;u.prepareDrawTile();const D=u.isTileAffectedByFog(r),z=[];u.terrain&&u.terrain.renderingToTexture&&u.emissiveMode==="mrt-fallback"&&z.push("USE_MRT1");const F=u.getOrCreateProgram("hillshade",{overrideFog:D,defines:z});k.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,P.colorAttachment0.get());const j=((Q,ce,fe,se)=>{const Ae=fe.paint.get("hillshade-shadow-color"),Ee=fe.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",Pe=fe.paint.get("hillshade-highlight-color"),ye=fe.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",be=fe.paint.get("hillshade-accent-color"),Ce=fe.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ze=fe.paint.get("hillshade-emissive-strength");let Oe=c.c4(fe.paint.get("hillshade-illumination-direction"));if(fe.paint.get("hillshade-illumination-anchor")==="viewport")Oe-=Q.transform.angle;else if(Q.style&&Q.style.enable3dLights()&&Q.style.directionalLight){const We=Q.style.directionalLight.properties.get("direction"),ut=c.bB(We.x,We.y,We.z);Oe=c.c4(ut[1])}const Ze=!Q.options.moving;return{u_matrix:se||Q.transform.calculateProjMatrix(ce.tileID.toUnwrapped(),Ze),u_image:0,u_latrange:Nb(0,ce.tileID),u_light:[fe.paint.get("hillshade-exaggeration"),Oe],u_shadow:Ae.toPremultipliedRenderColor(Ee?null:fe.lut),u_highlight:Pe.toPremultipliedRenderColor(ye?null:fe.lut),u_emissive_strength:ze,u_accent:be.toPremultipliedRenderColor(Ce?null:fe.lut)}})(u,a,f,u.terrain?r.projMatrix:null);u.uploadCommonUniforms(k,F,r.toUnwrapped());const{tileBoundsBuffer:$,tileBoundsIndexBuffer:W,tileBoundsSegments:J}=u.getTileBoundsBuffers(a);F.draw(u,A.TRIANGLES,_,x,w,Ut.disabled,j,f.id,$,W,J)}function Um(u,r,a){if(!r.needsDEMTextureUpload)return;const f=u.context,_=f.gl;f.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||u.getTileTexture(a.stride);const x=a.getPixels();r.demTexture?r.demTexture.update(x,{premultiply:!1}):r.demTexture=new c.a_(f,x,_.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function Gm(u,r,a){const f=u.context,_=f.gl;if(!r.dem)return;const x=r.dem;if(f.activeTexture.set(_.TEXTURE1),Um(u,r,x),!r.demTexture)return;r.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);const w=x.dim;f.activeTexture.set(_.TEXTURE0);let k=r.hillshadeFBO;if(!k){const F=new c.a_(f,{width:w,height:w,data:null},_.RGBA8);F.bind(_.LINEAR,_.CLAMP_TO_EDGE),k=r.hillshadeFBO=f.createFramebuffer(w,w,1,"renderbuffer"),k.colorAttachment0.set(F.texture)}f.bindFramebuffer.set(k.framebuffer),f.viewport.set([0,0,w,w]);const{tileBoundsBuffer:A,tileBoundsIndexBuffer:P,tileBoundsSegments:D}=u.getMercatorTileBoundsBuffers(),z=[];u.linearFloatFilteringSupported()&&z.push("TERRAIN_DEM_FLOAT_FORMAT"),u.terrain&&u.terrain.renderingToTexture&&u.emissiveMode==="mrt-fallback"&&z.push("USE_MRT1"),u.getOrCreateProgram("hillshadePrepare",{defines:z}).draw(u,_.TRIANGLES,Vt.disabled,rn.disabled,tn.unblended,Ut.disabled,((F,j)=>{const $=j.stride,W=c.bT();return c.eB(W,0,c.r,-c.r,0,0,1),c.fQ(W,W,[0,-c.r,0]),{u_matrix:W,u_image:1,u_dimension:[$,$],u_zoom:F.overscaledZ}})(r.tileID,x),a.id,A,P,D),r.needsHillshadePrepare=!1}class $r{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Vb extends $r{getDefault(){return c.i.transparent.toNonPremultipliedRenderColor(null)}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Wd extends $r{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class M2 extends $r{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class P2 extends $r{getDefault(){return[!0,!0,!0,!0]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class jb extends $r{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class $m extends $r{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class iv extends $r{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const a=this.current;(r.func!==a.func||r.ref!==a.ref||r.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class Ub extends $r{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class Gb extends $r{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=r,this.dirty=!1}}class Hm extends $r{getDefault(){return[0,1]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Hf extends $r{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=r,this.dirty=!1}}class ov extends $r{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class $b extends $r{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.BLEND):a.disable(a.BLEND),this.current=r,this.dirty=!1}}class Hb extends $r{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Wb extends $r{getDefault(){return c.i.transparent.toNonPremultipliedRenderColor(null)}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class qb extends $r{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class Zb extends $r{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=r,this.dirty=!1}}class D2 extends $r{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class Xb extends $r{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let R2=class extends $r{getDefault(){return null}set(u){(u!==this.current||this.dirty)&&(this.gl.useProgram(u),this.current=u,this.dirty=!1)}};class ds extends $r{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class Wm extends $r{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Nu extends $r{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class Kb extends $r{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Vu extends $r{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class Wf extends $r{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class L2 extends $r{getDefault(){return null}set(r){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class O2 extends $r{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class F2 extends $r{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class z2 extends $r{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class B2 extends $r{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class sv extends $r{constructor(r,a){super(r),this.context=r,this.parent=a}getDefault(){return null}}class qm extends sv{constructor(r,a,f=0){super(r,a),this.attachmentPoint=r.gl.COLOR_ATTACHMENT0+f}setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,this.attachmentPoint,a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Zm extends sv{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,this.attachment(),a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class N2 extends sv{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,this.attachment(),a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Yb extends Zm{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const qf=(u,r,a,f)=>({u_matrix:u,u_image0:0,u_image1:1,u_skirt_height:r,u_ground_shadow_factor:a,u_emissive_texture_available:f}),Qb=(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J)=>({u_proj_matrix:Float32Array.from(u),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(f),u_merc_matrix:a,u_zoom_transition:_,u_merc_center:x,u_image0:0,u_image1:1,u_frustum_tl:w,u_frustum_tr:k,u_frustum_br:A,u_frustum_bl:P,u_globe_pos:D,u_globe_radius:z,u_viewport:F,u_grid_matrix:J?Float32Array.from(J):new Float32Array(9),u_skirt_height:j,u_far_z_cutoff:$,u_emissive_texture_available:W});function Oi(u,r){return u!=null&&r!=null&&!(!u.hasData()||!r.hasData())&&u.demTexture!=null&&r.demTexture!=null&&u.tileID.key!==r.tileID.key}const Za=new class{constructor(){this.operations={}}newMorphing(u,r,a,f,_){if(u in this.operations){const x=this.operations[u];x.to.tileID.key!==a.tileID.key&&(x.queued=a)}else this.operations[u]={startTime:f,phase:0,duration:_,from:r,to:a,queued:null}}getMorphValuesForProxy(u){if(!(u in this.operations))return null;const r=this.operations[u];return{from:r.from,to:r.to,phase:r.phase}}update(u){for(const r in this.operations){const a=this.operations[r];for(a.phase=(u-a.startTime)/a.duration;a.phase>=1||!this._validOp(a);)if(!this._nextOp(a,u)){delete this.operations[r];break}}}_nextOp(u,r){return!!u.queued&&(u.from=u.to,u.to=u.queued,u.queued=null,u.phase=0,u.startTime=r,!0)}_validOp(u){return u.from.hasData()&&u.to.hasData()}};function av(u,r,a){if(r===0)return 0;const f=r<1&&a===514?.25/r:1;return 6*Math.pow(1.5,22-u)*Math.max(r,1)*f}function Xm(u,r){const a=1<<u.z;return!r&&(u.x===0||u.x===a-1)||u.y===0||u.y===a-1}function qd(u,r){if(!u.style||!u.style.enable3dLights())return;const a=u.context,f=a.gl;a.activeTexture.set(f.TEXTURE1),r?r.bind(f.LINEAR,f.CLAMP_TO_EDGE):u.emptyTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}class Zf extends Rs{constructor(r){const a={type:"raster-dem",maxzoom:Math.ceil(r.transform.maxZoom)},f=zd("mock-dem",a,r.style.dispatcher,r.style);super("mock-dem",f,null),f.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,a){r.state="loaded",a(null)}}class Jb extends Rs{constructor(r){const a=zd("proxy",{type:"geojson",maxzoom:Math.ceil(r.transform.maxZoom)},r.style.dispatcher,r.style);super("proxy",a,null),a.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,f){if(r.freezeTileCoverage)return;this.transform=r;const _=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((x,w)=>{if(x[w.key]="",!this._tiles[w.key]){const k=new c.b0(w,this._source.tileSize*w.overscaleFactor(),r.tileZoom,void 0,void 0,this._source.worldview);k.state="loaded",this._tiles[w.key]=k}return x},{});for(const x in this._tiles)x in _||(this.freeFBO(x),this._tiles[x].unloadVectorData(),delete this._tiles[x])}freeFBO(r){const a=this.proxyCachedFBO[r];if(a!==void 0){const f=Object.values(a);this.renderCachePool.push(...f),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class lv extends c.ap{constructor(r,a,f){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=a,this.projMatrix=f}}class Zd extends c.s{constructor(r,a){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[f,_,x]=function(){const A=new c.aQ,P=new c.aT,D=131;A.reserve(17161),P.reserve(33800);const z=c.r/128,F=c.r+z/2,j=F+z;for(let W=-z;W<j;W+=z)for(let J=-z;J<j;J+=z){const Q=J<0||J>F||W<0||W>F?24575:0,ce=c.bG(Math.round(J),0,c.r),fe=c.bG(Math.round(W),0,c.r);A.emplaceBack(ce+Q,fe)}const $=(W,J)=>{const Q=J*D+W;P.emplaceBack(Q+1,Q,Q+D),P.emplaceBack(Q+D,Q+D+1,Q+1)};for(let W=1;W<129;W++)for(let J=1;J<129;J++)$(J,W);return[0,129].forEach(W=>{for(let J=0;J<130;J++)$(J,W),$(W,J)}),[A,P,32768]}(),w=r.context;this.gridBuffer=w.createVertexBuffer(f,c.eQ.members),this.gridIndexBuffer=w.createIndexBuffer(_),this.gridSegments=c.aJ.simpleSegment(0,0,f.length,_.length),this.gridNoSkirtSegments=c.aJ.simpleSegment(0,0,f.length,x),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Jb(a.map),this.orthoMatrix=c.bT(),c.eB(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,c.r,0,c.r,0,1);const k=w.gl;this._overlapStencilMode=new rn({func:k.GEQUAL,mask:255},0,255,k.KEEP,k.KEEP,k.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Zf(a.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1,this._devtoolsFolder=null}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,f){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const _=r.terrain.properties,x=r.terrain.drapeRenderMode===0,w=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=c.co.now();const k=r.terrain&&r.terrain.scope,A=_.get("source"),P=x?this._mockSourceCache:r.getSourceCache(A,k);if(!P)return void c.f_(`Couldn't find terrain source "${A}".`);if(this.sourceCache=P,this._attenuationRange=r.terrain.getAttenuationRange(),this._exaggeration=w?this.calculateExaggeration(a):_.get("exaggeration"),!a.projection.requiresDraping&&w&&this._exaggeration===0)return void this._disable();this.enabled=!0;const D=()=>{this.sourceCache.used&&c.f_(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
|
||
This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const z=this.getScaledDemTileSize();this.sourceCache.update(a,z,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,D(),this._initializing=!0),D(),a.updateElevation(!0,f),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){if(this._attenuationRange&&r.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(r.zoom);const a=this._previousCameraAltitude,f=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=f;const _=a!=null?f-a:Number.MAX_VALUE;if(Math.abs(_)<2)return this._exaggeration;const x=r.zoom,w=this._style.terrain;if(!this._previousUpdateTimestamp)return w.getExaggeration(x);let k=x-this._previousZoom;const A=this._previousUpdateTimestamp;let P=x;this._evaluationZoom!=null&&(P=this._evaluationZoom,Math.abs(x-P)>.5&&(k=.5*(x-P+k)),k*_<0&&(P+=k)),this._evaluationZoom=P;const D=w.getExaggeration(P),z=D===w.getExaggeration(Math.max(0,P-.1));if(z&&Math.abs(D-this._exaggeration)<.01)return D;let F=Math.min(.1,.00375*(this._updateTimestamp-A));return(z||D<.1||Math.abs(k)<1e-4)&&(F=Math.min(.2,4*F)),c.dY(this._exaggeration,D,F)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.dataType==="source"&&r.coord?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.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 r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(r=>r.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 r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const a=this.proxySourceCache,f=this.painter.transform;this._initializing&&(this._initializing=f._centerAltitude===0&&this.getAtPointOrZero(c.ag.fromLngLat(f.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const _=this.proxyCoords=a.getIds().map(A=>{const P=a.getTileByID(A).tileID;return P.projMatrix=f.calculateProjMatrix(P.toUnwrapped()),P});(function(A,P){const D=P.transform.pointCoordinate(P.transform.getCameraPoint()),z=new c.au(D.x,D.y);A.sort((F,j)=>{if(j.overscaledZ-F.overscaledZ)return j.overscaledZ-F.overscaledZ;const $=new c.au(F.canonical.x+(1<<F.canonical.z)*F.wrap,F.canonical.y),W=new c.au(j.canonical.x+(1<<j.canonical.z)*j.wrap,j.canonical.y),J=z.mult(1<<F.canonical.z);return J.x-=.5,J.y-=.5,J.distSqr($)-J.distSqr(W)})})(_,this.painter);const x=this.proxyToSource||{};this.proxyToSource={},_.forEach(A=>{this.proxyToSource[A.key]={}}),this.terrainTileForTile={};const w=this._style._mergedSourceCaches;for(const A in w){const P=w[A];if(!P.used||(P!==this.sourceCache&&this.resetTileLookupCache(P.id),this._setupProxiedCoordsForOrtho(P,r[A],x),P.usedForTerrain))continue;const D=r[A];(P.getSource().reparseOverscaled||P._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(D)}this.proxiedCoords[a.id]=_.map(A=>new lv(A,A.key,this.orthoMatrix)),this._assignTerrainTiles(_),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(x),this.renderingToTexture=!1;const k={};this._visibleDemTiles=[];for(const A of this.proxyCoords){const P=this.terrainTileForTile[A.key];if(!P)continue;const D=P.tileID.key;D in k||(this._visibleDemTiles.push(P),k[D]=D)}}_assignTerrainTiles(r){this._initializing||r.forEach(a=>{if(this.terrainTileForTile[a.key])return;const f=this._findTileCoveringTileID(a,this.sourceCache);f&&(this.terrainTileForTile[a.key]=f)})}_prepareDEMTextures(){const r=this.painter.context,a=r.gl;for(const f in this.terrainTileForTile){const _=this.terrainTileForTile[f],x=_.dem;!x||_.demTexture&&!_.needsDEMTextureUpload||(r.activeTexture.set(a.TEXTURE1),Um(this.painter,_,x))}}_prepareDemTileUniforms(r,a,f,_){if(!a||a.demTexture==null)return!1;const x=r.tileID.canonical,w=Math.pow(2,a.tileID.canonical.z-x.z),k=_||"";return f[`u_dem_tl${k}`]=[x.x*w%1,x.y*w%1],f[`u_dem_scale${k}`]=w,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let r=0;const a=this._visibleDemTiles.reduce((f,_)=>{if(!_.dem)return f;const x=_.dem.tree.minimums[0];return x>0&&r++,f+x},0);return r?a/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);const f=this._getLoadedAreaMinimum(),_=new c.L({width:1,height:1},new Float32Array([f]));this._emptyDEMTextureDirty=!1;let x=this._emptyDEMTexture;return x?x.update(_,{premultiply:!1}):x=this._emptyDEMTexture=new c.a_(r,_,a.R32F,{premultiply:!1}),x}setupElevationDraw(r,a,f){const _=this.painter.context,x=_.gl,w={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};w.u_exaggeration=this.exaggeration();let k=null,A=null,P=1;if(f&&f.morphing&&this._useVertexMorphing){const j=f.morphing.srcDemTile,$=f.morphing.dstDemTile;P=f.morphing.phase,j&&$&&(this._prepareDemTileUniforms(r,j,w,"_prev")&&(A=j),this._prepareDemTileUniforms(r,$,w)&&(k=$))}const D=j=>j&&j.demTexture&&this.painter.linearFloatFilteringSupported()?x.LINEAR:x.NEAREST;let z=null;var F;if(this.enabled?A&&k?(z=k.demTexture,_.activeTexture.set(x.TEXTURE4),A.demTexture.bind(D(A),x.CLAMP_TO_EDGE),w.u_dem_lerp=P):(k=this.terrainTileForTile[r.tileID.key],z=this._prepareDemTileUniforms(r,k,w)?k.demTexture:this.emptyDEMTexture):z=this.emptyDEMTexture,_.activeTexture.set(x.TEXTURE2),z&&(w.u_dem_size=(F=z).size[0]===1?1:F.size[0]-2,z.bind(D(k),x.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(f&&f.useDepthForOcclusion,a,w),f&&f.useMeterToDem&&k){const j=(1<<k.tileID.canonical.z)*c.em(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;w.u_meter_to_dem=j}if(f&&f.labelPlaneMatrixInv&&(w.u_label_plane_matrix_inv=f.labelPlaneMatrixInv),a.setTerrainUniformValues(_,w),this.painter.transform.projection.name==="globe"){const j=this.globeUniformValues(this.painter.transform,r.tileID.canonical,f&&f.useDenormalizedUpVectorScale);a.setGlobeUniformValues(_,j)}}globeUniformValues(r,a,f){const _=r.projection;return{u_tile_tl_up:_.upVector(a,0,0),u_tile_tr_up:_.upVector(a,c.r,0),u_tile_br_up:_.upVector(a,c.r,c.r),u_tile_bl_up:_.upVector(a,0,c.r),u_tile_up_scale:f?c.dg(1):_.upVectorScale(a,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){const a=this.painter,f=this.painter.context;r.length!==0&&(f.bindFramebuffer.set(null),f.viewport.set([0,0,a.width,a.height]),a.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(_,x,w,k,A){if(_.transform.projection.name==="globe")(function(P,D,z,F,j){const $=P.context,W=$.gl;let J,Q;const ce=P.transform,fe=c.dn(P,$,ce),se=(Ze,We)=>{if(Q===We)return;const ut=[];We===1&&ut.push("TERRAIN_VERTEX_MORPHING"),ut.push("PROJECTION_GLOBE_VIEW"),fe&&ut.push("CUSTOM_ANTIALIASING");const Ne=P.isTileAffectedByFog(Ze);J=P.getOrCreateProgram("globeRaster",{defines:ut,overrideFog:Ne}),Q=We},Ae=P.colorModeForRenderPass(),Ee=new Vt(W.LEQUAL,Vt.ReadWrite,P.depthRangeFor3D);Za.update(j);const Pe=c.by(ce),ye=[c.ek(ce.center.lng),c.el(ce.center.lat)],be=P.globeSharedBuffers,Ce=[ce.width*c.co.devicePixelRatio,ce.height*c.co.devicePixelRatio],ze=Float32Array.from(ce.globeMatrix),Oe={useDenormalizedUpVectorScale:!0};{const Ze=P.transform,We=av(Ze.zoom,D.exaggeration(),D.sourceCache._source.tileSize);Q=-1;const ut=W.TRIANGLES;for(const Ne of F){const Je=z.getTile(Ne),Be=rn.disabled,it=D.prevTerrainTileForTile[Ne.key],Qe=D.terrainTileForTile[Ne.key];Oi(it,Qe)&&Za.newMorphing(Ne.key,it,Qe,j,250),qd(P,Je.emissiveTexture),$.activeTexture.set(W.TEXTURE0),Je.texture&&Je.texture.bind(W.LINEAR,W.CLAMP_TO_EDGE);const ot=Za.getMorphValuesForProxy(Ne.key),Et=ot?1:0;ot&&Object.assign(Oe,{morphing:{srcDemTile:ot.from,dstDemTile:ot.to,phase:c.cb(ot.phase)}});const ht=c.fF(Ne.canonical),gt=c.cU(ht.getCenter().lat),ct=c.cP(Ne.canonical,ht,gt,Ze.worldSize/Ze._pixelsPerMercatorPixel),Ht=c.dh(c.dk(Ne.canonical)),Ot=P.emissiveMode==="mrt-fallback"?1:0,Nt=Qb(Ze.expandedFarZProjMatrix,ze,Pe,Ht,c.dm(Ze.zoom),ye,Ze.frustumCorners.TL,Ze.frustumCorners.TR,Ze.frustumCorners.BR,Ze.frustumCorners.BL,Ze.globeCenterInViewSpace,Ze.globeRadius,Ce,We,Ze._farZ,Ot,ct);if(se(Ne,Et),J&&(D.setupElevationDraw(Je,J,Oe),P.uploadCommonUniforms($,J,Ne.toUnwrapped()),be)){const[$t,an,nn]=be.getGridBuffers(gt,We!==0);J.draw(P,ut,Ee,Be,Ae,Ut.backCCW,Nt,"globe_raster",$t,an,nn)}}}if(be&&(P.renderDefaultNorthPole||P.renderDefaultSouthPole)){const Ze=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];fe&&Ze.push("CUSTOM_ANTIALIASING"),J=P.getOrCreateProgram("globeRaster",{defines:Ze});for(const We of F){const{x:ut,y:Ne,z:Je}=We.canonical,Be=Ne===0,it=Ne===(1<<Je)-1,[Qe,ot,Et,ht]=be.getPoleBuffers(Je,!1);if(ht&&(Be||it)){const gt=z.getTile(We);qd(P,gt.emissiveTexture),$.activeTexture.set(W.TEXTURE0),gt.texture&>.texture.bind(W.LINEAR,W.CLAMP_TO_EDGE);let ct=c.dj(Je,ut,ce);const Ht=c.dh(c.dk(We.canonical)),Ot=P.emissiveMode==="mrt-fallback"?1:0,Nt=($t,an)=>$t.draw(P,W.TRIANGLES,Ee,rn.disabled,Ae,Ut.disabled,Qb(ce.expandedFarZProjMatrix,ct,ct,Ht,0,ye,ce.frustumCorners.TL,ce.frustumCorners.TR,ce.frustumCorners.BR,ce.frustumCorners.BL,ce.globeCenterInViewSpace,ce.globeRadius,Ce,0,ce._farZ,Ot),"globe_pole_raster",an,Et,ht);D.setupElevationDraw(gt,J,Oe),P.uploadCommonUniforms($,J,We.toUnwrapped()),Be&&P.renderDefaultNorthPole&&Nt(J,Qe),it&&P.renderDefaultSouthPole&&(ct=c.fc(c.bT(),ct,[1,-1,1]),Nt(J,ot))}}}})(_,x,w,k,A);else{const P=_.context,D=P.gl;let z,F;const j=_.shadowRenderer,$=Pc(_,_.longestCutoffRange),W=Ae=>{if(F===Ae)return;const Ee=[];Ae===1&&Ee.push("TERRAIN_VERTEX_MORPHING"),$.shouldRenderCutoff&&Ee.push("RENDER_CUTOFF"),j&&(Ee.push("RENDER_SHADOWS"),j.useNormalOffset&&Ee.push("NORMAL_OFFSET")),z=_.getOrCreateProgram("terrainRaster",{defines:Ee}),F=Ae},J=_.colorModeForRenderPass(),Q=new Vt(D.LEQUAL,Vt.ReadWrite,_.depthRangeFor3D);Za.update(A);const ce=_.transform,fe=av(ce.zoom,x.exaggeration(),x.sourceCache._source.tileSize);let se=[0,0,0];if(j){const Ae=_.style.directionalLight,Ee=_.style.ambientLight;Ae&&Ee&&(se=Rc(_.style,Ae,Ee))}{F=-1;const Ae=D.TRIANGLES,[Ee,Pe]=[x.gridIndexBuffer,x.gridSegments];for(const ye of k){const be=w.getTile(ye),Ce=rn.disabled,ze=x.prevTerrainTileForTile[ye.key],Oe=x.terrainTileForTile[ye.key];Oi(ze,Oe)&&Za.newMorphing(ye.key,ze,Oe,A,250),qd(_,be.emissiveTexture),P.activeTexture.set(D.TEXTURE0),be.texture&&be.texture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const Ze=Za.getMorphValuesForProxy(ye.key),We=Ze?1:0;let ut;Ze&&(ut={morphing:{srcDemTile:Ze.from,dstDemTile:Ze.to,phase:c.cb(Ze.phase)}});const Ne=_.emissiveMode==="mrt-fallback"?1:0,Je=qf(ye.projMatrix,Xm(ye.canonical,ce.renderWorldCopies)?fe/10:fe,se,Ne);if(W(We),!z)continue;x.setupElevationDraw(be,z,ut);const Be=ye.toUnwrapped();j&&j.setupShadows(Be,z),_.uploadCommonUniforms(P,z,Be,null,$),z.draw(_,Ae,Q,Ce,J,Ut.backCCW,Je,"terrain_raster",x.gridBuffer,Ee,Pe)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const a=this.painter,f=this.painter.context,_=this.proxySourceCache,x=this.proxiedCoords[_.id],w=this._drapedRenderBatches.shift(),k=a.style.order,A=[];this._updateFBOs(a.emissiveMode==="mrt-fallback");let P=0;for(const D of x){const z=_.getTileByID(D.proxyTileKey),F=_.proxyCachedFBO[D.key]?_.proxyCachedFBO[D.key][r]:void 0,j=F!==void 0?_.renderCache[F]:this.pool[P++],$=F!==void 0;if(z.texture=j.tex,z.emissiveTexture=j.emissiveTex,$&&!j.dirty){A.push(z.tileID);continue}f.bindFramebuffer.set(j.fb.framebuffer);const W=f.gl;let J;W.drawBuffers(a.emissiveMode==="mrt-fallback"?[W.COLOR_ATTACHMENT0,W.COLOR_ATTACHMENT1]:[W.COLOR_ATTACHMENT0]),this.renderedToTile=!1,j.dirty&&(f.clear({color:c.i.transparent,stencil:0}),j.dirty=!1);for(let Q=w.start;Q<=w.end;++Q){const ce=a.style._mergedLayers[k[Q]];if(ce.isHidden(a.transform.zoom))continue;const fe=a.style.getLayerSourceCache(ce),se=fe?this.proxyToSource[D.key][fe.id]:[D];if(!se)continue;const Ae=se;f.viewport.set([0,0,j.fb.width,j.fb.height]),J!==(fe?fe.id:null)&&(this._setupStencil(j,se,ce,fe),J=fe?fe.id:null),a.renderLayer(a,fe,ce,Ae)}if(W.drawBuffers([W.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Q of this._pendingGroundEffectLayers){const ce=a.style._mergedLayers[k[Q]];if(ce.isHidden(a.transform.zoom))continue;const fe=a.style.getLayerSourceCache(ce),se=fe?this.proxyToSource[D.key][fe.id]:[D];if(!se)continue;const Ae=se;f.viewport.set([0,0,j.fb.width,j.fb.height]),J!==(fe?fe.id:null)&&(this._setupStencil(j,se,ce,fe),J=fe?fe.id:null),a.renderLayer(a,fe,ce,Ae)}this.renderedToTile?(j.dirty=!0,A.push(z.tileID)):$||--P,P===5&&(P=0,this.renderToBackBuffer(A))}return this.renderToBackBuffer(A),this.renderingToTexture=!1,f.bindFramebuffer.set(null),f.viewport.set([0,0,a.width,a.height]),w.end+1}postRender(){}isLayerOrderingCorrect(r){const a=r.order.length;let f=-1,_=a;for(let x=0;x<a;++x)this._style.isLayerDraped(r._mergedLayers[r.order[x]])?f=Math.max(f,x):_=Math.min(_,x);return _>f}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(a=>a.dem).forEach(a=>{r=Math.min(r,a.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,a,f){if(!this._visibleDemTiles)return null;const _=this._visibleDemTiles.filter(x=>x.dem).map(x=>{const w=x.tileID,k=1<<w.overscaledZ,{x:A,y:P}=w.canonical,D=A/k,z=(A+1)/k,F=P/k,j=(P+1)/k;return{minx:D,miny:F,maxx:z,maxy:j,t:x.dem.tree.raycastRoot(D,F,z,j,r,a,f),tile:x}});_.sort((x,w)=>(x.t!==null?x.t:Number.MAX_VALUE)-(w.t!==null?w.t:Number.MAX_VALUE));for(const x of _){if(x.t==null)return null;const w=x.tile.dem.tree.raycast(x.minx,x.miny,x.maxx,x.maxy,r,a,f);if(w!=null)return w}return null}_createFBO(){const r=this.painter.context,a=r.gl,f=this.drapeBufferSize;r.activeTexture.set(a.TEXTURE0);const _=new c.a_(r,{width:f[0],height:f[1],data:null},a.RGBA8);_.bind(a.LINEAR,a.CLAMP_TO_EDGE);const x=r.createFramebuffer(f[0],f[1],1,null);let w;return x.colorAttachment0.set(_.texture),this._emissiveTexture&&(w=new c.a_(r,{width:f[0],height:f[1],data:null},a.R8),w.bind(a.LINEAR,a.CLAMP_TO_EDGE),x.createColorAttachment(r,1),x.colorAttachment1.set(w.texture)),x.depthAttachment=new Yb(r,x.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,f[0],f[1]),this._stencilRef=0,x.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):x.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:x,tex:_,emissiveTex:w,dirty:!1}}_updateFBOs(r){if(this._emissiveTexture!==r){for(const a of this.pool)this._updateFBO(a,r);for(const a of this.proxySourceCache.renderCache)this._updateFBO(a,r);this._emissiveTexture=r}}_updateFBO(r,a){const f=r.fb,_=this.painter.context,x=_.gl,w=this.drapeBufferSize;if(a){const k=new c.a_(_,{width:w[0],height:w[1],data:null},x.R8);k.bind(x.LINEAR,x.CLAMP_TO_EDGE),r.emissiveTex=k,f.createColorAttachment(_,1),f.colorAttachment1.set(k.texture)}else r.emissiveTex=void 0,f.removeColorAttachment(_,1);r.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(const r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r].hasTransition())return!0;return this._style.order.some(r=>{const a=this._style._mergedLayers[r],f=a.isHidden(this.painter.transform.zoom);return a.type==="hillshade"||a.type==="custom"?!f&&a.shouldRedrape():!f&&a.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const f of this._style.getSources())if(f instanceof Nf){r=!0;break}if(!r)return;const a={};for(let f=0;f<this._style.order.length;++f){const _=this._style._mergedLayers[this._style.order[f]],x=this._style.getLayerSourceCache(_);if(!x||a[x.id]||_.isHidden(this.painter.transform.zoom)||_.type!=="line")continue;const w=_.widthExpression(),k=_.emissiveStrengthExpression();if(w instanceof c.bh||k instanceof c.bh){a[x.id]=!0;for(const A of this.proxyCoords){const P=this.proxyToSource[A.key][x.id];if(P)for(const D of P)this._clearRenderCacheForTile(x.id,D)}}}}_clearRasterLayersFromRenderCache(){let r=!1;for(const f in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[f]._source instanceof Pu){r=!0;break}if(!r)return;const a={};for(let f=0;f<this._style.order.length;++f){const _=this._style._mergedLayers[this._style.order[f]],x=this._style.getLayerSourceCache(_);if(!x||a[x.id]||_.isHidden(this.painter.transform.zoom)||_.type!=="raster")continue;const w=_.paint.get("raster-fade-duration");for(const k of this.proxyCoords){const A=this.proxyToSource[k.key][x.id];if(A)for(const P of A){const D=_m(x.getTile(P),x.findLoadedParent(P,0),x,this.painter.transform,w);(D.opacity!==1||D.mix!==0)&&this._clearRenderCacheForTile(x.id,P)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const r=this._style.order,a=r.length;if(a===0)return;const f=[];this._pendingGroundEffectLayers=[];let _,x=0,w=this._style._mergedLayers[r[x]];for(;!this._style.isLayerDraped(w)&&w.isHidden(this.painter.transform.zoom)&&++x<a;)w=this._style._mergedLayers[r[x]];for(;x<a;++x){const k=this._style._mergedLayers[r[x]];k.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(k)?_===void 0&&(_=x):(k.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(x),_!==void 0&&(f.push({start:_,end:x-1}),_=void 0)))}if(_!==void 0&&f.push({start:_,end:x-1}),f.length!==0){const k=f.at(-1);this._pendingGroundEffectLayers.every(A=>A>k.end)||c.f_("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=f}_setupRenderCache(r){const a=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,a.renderCache.length>a.renderCachePool.length){const w=Object.values(a.proxyCachedFBO);a.proxyCachedFBO={};for(let k=0;k<w.length;++k){const A=Object.values(w[k]);a.renderCachePool.push(...A)}}return}this._clearRasterLayersFromRenderCache();const f=this.proxyCoords,_=this._tilesDirty;for(let w=f.length-1;w>=0;w--){const k=f[w];if(a.getTileByID(k.key),a.proxyCachedFBO[k.key]!==void 0){const A=r[k.key],P=this.proxyToSource[k.key];let D=0;for(const z in P){const F=P[z],j=A[z];if(!j||j.length!==F.length||F.some(($,W)=>$!==j[W]||_[z]&&Object.hasOwn(_[z],$.key))){D=-1;break}++D}for(const z in a.proxyCachedFBO[k.key])a.renderCache[a.proxyCachedFBO[k.key][z]].dirty=D<0||D!==Object.values(A).length}}const x=[...this._drapedRenderBatches];x.sort((w,k)=>k.end-k.start-(w.end-w.start));for(const w of x)for(const k of f){if(a.proxyCachedFBO[k.key])continue;let A=a.renderCachePool.pop();A===void 0&&a.renderCache.length<50&&(A=a.renderCache.length,a.renderCache.push(this._createFBO())),A!==void 0&&(a.proxyCachedFBO[k.key]={},a.proxyCachedFBO[k.key][w.start]=A,a.renderCache[A].dirty=!0)}this._tilesDirty={}}_setupStencil(r,a,f,_){if(!_||!this._sourceTilesOverlap[_.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const x=this.painter.context,w=x.gl;if(a.length<=1)return void(this._overlapStencilType=!1);let k;if(f.isTileClipped())k=a.length,this._overlapStencilMode.test={func:w.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(a[0].overscaledZ>a.at(-1).overscaledZ))return void(this._overlapStencilType=!1);k=1,this._overlapStencilMode.test={func:w.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+k>255&&(x.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=k,this._overlapStencilMode.ref=this._stencilRef,f.isTileClipped()&&this._renderTileClippingMasks(a,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):rn.disabled}_renderTileClippingMasks(r,a){const f=this.painter,_=this.painter.context,x=_.gl;f._tileClippingMaskIDs={},_.setColorMode(tn.disabled),_.setDepthMode(Vt.disabled);const w=f.getOrCreateProgram("clippingMask");for(const k of r){const A=f._tileClippingMaskIDs[k.key]=--a;w.draw(f,x.TRIANGLES,Vt.disabled,new rn({func:x.ALWAYS,mask:0},A,255,x.KEEP,x.KEEP,x.REPLACE),tn.disabled,Ut.disabled,If(k.projMatrix),"$clipping",f.tileExtentBuffer,f.quadTriangleIndexBuffer,f.tileExtentSegments)}}pointCoordinate(r){const a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;const f=[r.x,r.y,1,1];c.fM(f,f,a.pixelMatrixInverse),c.fb(f,f,1/f[3]),f[0]/=a.worldSize,f[1]/=a.worldSize;const _=a._camera.position,x=c.em(1,a.center.lat),w=[_[0],_[1],_[2]/x,0],k=c.fz([],f.slice(0,3),w);c.ex(k,k);const A=this.raycast(w,k,this._exaggeration);return A!==null&&A?(c.fe(w,w,k,A),w[3]=w[2],w[2]*=x,w):null}_setupProxiedCoordsForOrtho(r,a,f){if(r.getSource()instanceof c.a3)return this._setupProxiedCoordsForImageSource(r,a,f);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const _=this.proxiedCoords[r.id]=[],x=this.proxyCoords;for(let A=0;A<x.length;A++){const P=x[A],D=this._findTileCoveringTileID(P,r);if(D){const z=this._createProxiedId(P,D,f[P.key]&&f[P.key][r.id]);_.push(z),this.proxyToSource[P.key][r.id]=[z]}}let w=!1;const k=new Set;for(let A=0;A<a.length;A++){const P=r.getTile(a[A]);if(!P||!P.hasData())continue;const D=this._findTileCoveringTileID(P.tileID,this.proxySourceCache);if(D&&D.tileID.canonical.z!==P.tileID.canonical.z){const z=this.proxyToSource[D.tileID.key][r.id],F=this._createProxiedId(D.tileID,P,f[D.tileID.key]&&f[D.tileID.key][r.id]);z?z.splice(z.length-1,0,F):this.proxyToSource[D.tileID.key][r.id]=[F];const j=this.proxyToSource[D.tileID.key][r.id];k.has(j)||k.add(j),_.push(F),w=!0}}if(this._sourceTilesOverlap[r.id]=w,w)for(const A of k)A.sort((P,D)=>D.overscaledZ-P.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,f){if(!r.getSource().loaded())return;const _=this.proxiedCoords[r.id]=[],x=this.proxyCoords,w=r.getSource(),k=w.tileID;if(!k)return;const A=new c.au(k.x,k.y)._div(1<<k.z),P=w.coordinates.map(c.ag.fromLngLat).reduce((z,F)=>(z.min.x=Math.min(z.min.x,F.x-A.x),z.min.y=Math.min(z.min.y,F.y-A.y),z.max.x=Math.max(z.max.x,F.x-A.x),z.max.y=Math.max(z.max.y,F.y-A.y),z),{min:new c.au(Number.MAX_VALUE,Number.MAX_VALUE),max:new c.au(-Number.MAX_VALUE,-Number.MAX_VALUE)}),D=(z,F)=>{const j=z.wrap+z.canonical.x/(1<<z.canonical.z),$=z.canonical.y/(1<<z.canonical.z),W=c.r/(1<<z.canonical.z),J=F.wrap+F.canonical.x/(1<<F.canonical.z),Q=F.canonical.y/(1<<F.canonical.z);return j+W<J+P.min.x||j>J+P.max.x||$+W<Q+P.min.y||$>Q+P.max.y};for(let z=0;z<x.length;z++){const F=x[z];for(let j=0;j<a.length;j++){const $=r.getTile(a[j]);if(!$||!$.hasData()||D(F,$.tileID))continue;const W=this._createProxiedId(F,$,f[F.key]&&f[F.key][r.id]),J=this.proxyToSource[F.key][r.id];J?J.push(W):this.proxyToSource[F.key][r.id]=[W],_.push(W)}}}_createProxiedId(r,a,f){let _=this.orthoMatrix;if(f){const x=f.find(w=>w.key===a.tileID.key);if(x)return x}if(a.tileID.key!==r.key){const x=r.canonical.z-a.tileID.canonical.z;let w,k,A;_=c.bT();const P=a.tileID.wrap-r.wrap<<r.overscaledZ;x>0?(w=c.r>>x,k=w*((a.tileID.canonical.x<<x)-r.canonical.x+P),A=w*((a.tileID.canonical.y<<x)-r.canonical.y)):(w=c.r<<-x,k=c.r*(a.tileID.canonical.x-(r.canonical.x+P<<-x)),A=c.r*(a.tileID.canonical.y-(r.canonical.y<<-x))),c.eB(_,0,w,0,w,0,1),c.fQ(_,_,[k,A,0])}return new lv(a.tileID,r.key,_)}_findTileCoveringTileID(r,a){let f=a.getTile(r);if(f&&f.hasData())return f;const _=this._findCoveringTileCache[a.id],x=_[r.key];if(f=x?a.getTileByID(x):null,f&&f.hasData()||x===null)return f;let w=f?f.tileID:r,k=w.overscaledZ;const A=a.getSource().minzoom,P=[];if(!x){const z=a.getSource().maxzoom;if(r.canonical.z>=z){const F=r.canonical.z-z;a.getSource().reparseOverscaled?(k=Math.max(r.canonical.z+2,a.transform.tileZoom),w=new c.ap(k,r.wrap,z,r.canonical.x>>F,r.canonical.y>>F)):F!==0&&(k=z,w=new c.ap(k,r.wrap,z,r.canonical.x>>F,r.canonical.y>>F))}w.key!==r.key&&(P.push(w.key),f=a.getTile(w))}const D=z=>{P.forEach(F=>{_[F]=z}),P.length=0};for(k-=1;k>=A&&(!f||!f.hasData());k--){f&&D(f.tileID.key);const z=w.calculateScaledKey(k);if(f=a.getTileByID(z),f&&f.hasData())break;const F=_[z];if(F===null)break;F===void 0?P.push(z):f=a.getTileByID(F)}return D(f?f.tileID.key:null),f&&f.hasData()?f:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,a){let f=this._tilesDirty[r];f||(f=this._tilesDirty[r]={}),f[a.key]=!0}}function cv(u,r,a){const f=function(k,A,P){const D=c.c7(A,k),z=c.c7(P,[.2126,.7152,.0722]),F=1-.3*Math.min(z,1),j=c.dY(F,1,Math.min(D+1,1));return c.dY(.92,1,Math.asin(c.bG(A[2],-1,1))/Math.PI+.5)*j}(u,[0,0,1],r),_=[0,0,0];c.fa(_,a.slice(0,3),f);const x=[0,0,0];c.fa(x,r.slice(0,3),u[2]);const w=[0,0,0];return c.bj(w,_,x),c.e4(w)}const e1=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],uv=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Km{static cacheKey(r,a,f,_){const x=[a];_&&x.push(_.cacheKey);for(const w of f)(typeof w=="string"&&w.includes(" ")||r.usedDefines.has(w))&&x.push(w);return x.join("/")}constructor(r,a,f,_,x,w,k=!1){const A=r.gl;this.program=A.createProgram(),this._context=r,this._fixedUniformsFn=x,this._pending=!0,this._precompiled=k,this.attributes={},this.configuration=_,this.name=a,this.fixedDefines=[...w],k?r._compileStats.precompiled++:r._compileStats.onDemand++;const P=`#version 300 es
|
||
${(_?_.defines():[]).concat(w.map(J=>`#define ${J}`)).join(`
|
||
`)}`,D=[P,_b];for(const J of f.fragmentIncludes)D.push(Tf[J]);D.push(f.fragmentSource);const z=D.join(`
|
||
`),F=[P,Sy];for(const J of f.vertexIncludes)F.push(Tf[J]);this.forceManualRenderingForInstanceIDShaders=r.forceManualRenderingForInstanceIDShaders&&f.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&F.push("uniform int u_instanceID;"),F.push(f.vertexSource);let j=F.join(`
|
||
`);this.forceManualRenderingForInstanceIDShaders&&(j=j.replaceAll("gl_InstanceID","u_instanceID"));const $=A.createShader(A.FRAGMENT_SHADER);if(A.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);A.shaderSource($,z),A.compileShader($),A.attachShader(this.program,$);const W=A.createShader(A.VERTEX_SHADER);if(A.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);A.shaderSource(W,j),A.compileShader(W),A.attachShader(this.program,W),A.linkProgram(this.program),this._fragmentShader=$,this._vertexShader=W,r.extParallelShaderCompile?r._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;const r=this._context,a=r.gl;r._pendingPrograms.delete(this);const f=c.co.now(),_=a.getProgramParameter(this.program,a.LINK_STATUS),x=c.co.now()-f,w=r._compileStats;if(w.totalStallMs+=x,x>w.maxStallMs&&(w.maxStallMs=x),x>1){w.framesMissed+=Math.floor(60*x/1e3);const P=this.fixedDefines.join(",");w.stalls.push({name:`${this.name}${P?"/":""}${P}`,ms:x,timestamp:f})}if(this._fragmentShader&&(_||c.f_(`Fragment shader '${this.name}': ${a.getShaderInfoLog(this._fragmentShader)}`),a.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(_||c.f_(`Vertex shader '${this.name}': ${a.getShaderInfoLog(this._vertexShader)}`),a.deleteShader(this._vertexShader),this._vertexShader=null),!_)return c.f_(`Failed to link program '${this.name}': ${a.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(r),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(r):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(P=>({u_instanceID:new c.b5(P)}))(r));const k=this.fixedDefines,A=this.name;(k.includes("TERRAIN")||k.includes("ELEVATED")||A.includes("symbol")||A.includes("circle"))&&(this.terrainUniforms=(P=>({u_dem:new c.b5(P),u_dem_prev:new c.b5(P),u_dem_tl:new c.b6(P),u_dem_scale:new c.b4(P),u_dem_tl_prev:new c.b6(P),u_dem_scale_prev:new c.b4(P),u_dem_size:new c.b4(P),u_dem_lerp:new c.b4(P),u_exaggeration:new c.b4(P),u_depth:new c.b5(P),u_depth_size_inv:new c.b6(P),u_depth_range_unpack:new c.b6(P),u_occluder_half_size:new c.b4(P),u_occlusion_depth_offset:new c.b4(P),u_meter_to_dem:new c.b4(P),u_label_plane_matrix_inv:new c.bb(P)}))(r)),k.includes("GLOBE")&&(this.globeUniforms=(P=>({u_tile_tl_up:new c.b7(P),u_tile_tr_up:new c.b7(P),u_tile_br_up:new c.b7(P),u_tile_bl_up:new c.b7(P),u_tile_up_scale:new c.b4(P)}))(r)),k.includes("FOG")&&(this.fogUniforms=(P=>({u_fog_matrix:new c.bb(P),u_fog_range:new c.b6(P),u_fog_color:new c.b8(P),u_fog_horizon_blend:new c.b4(P),u_fog_vertical_limit:new c.b6(P),u_fog_temporal_offset:new c.b4(P),u_frustum_tl:new c.b7(P),u_frustum_tr:new c.b7(P),u_frustum_br:new c.b7(P),u_frustum_bl:new c.b7(P),u_globe_pos:new c.b7(P),u_globe_radius:new c.b4(P),u_globe_transition:new c.b4(P),u_is_globe:new c.b5(P),u_viewport:new c.b6(P)}))(r)),k.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(P=>({u_cutoff_params:new c.b8(P)}))(r)),k.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(P=>({u_lighting_ambient_color:new c.b7(P),u_lighting_directional_dir:new c.b7(P),u_lighting_directional_color:new c.b7(P),u_ground_radiance:new c.b7(P)}))(r)),k.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(P=>({u_light_matrix_0:new c.bb(P),u_light_matrix_1:new c.bb(P),u_fade_range:new c.b6(P),u_shadow_normal_offset:new c.b7(P),u_shadow_intensity:new c.b4(P),u_shadow_texel_size:new c.b4(P),u_shadow_map_resolution:new c.b4(P),u_shadow_direction:new c.b7(P),u_shadow_bias:new c.b7(P),u_shadowmap_0:new c.b5(P),u_shadowmap_1:new c.b5(P)}))(r))}maybeFinalize(){if(!this._pending)return;const r=this._context.extParallelShaderCompile;r&&!this._context.gl.getProgramParameter(this.program,r.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(r,a){this._ensureReady();let f=this.attributes[a];return f===void 0&&(f=this.attributes[a]=r.getAttribLocation(this.program,a)),f}setTerrainUniformValues(r,a){if(this._ensureReady(),!this.terrainUniforms)return;const f=this.terrainUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const _ in a)f[_]&&f[_].set(this.program,_,a[_])}}setGlobeUniformValues(r,a){if(this._ensureReady(),!this.globeUniforms)return;const f=this.globeUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const _ in a)f[_]&&f[_].set(this.program,_,a[_])}}setFogUniformValues(r,a){if(this._ensureReady(),!this.fogUniforms)return;const f=this.fogUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const _ in a)f[_].set(this.program,_,a[_])}}setCutoffUniformValues(r,a){if(this._ensureReady(),!this.cutoffUniforms)return;const f=this.cutoffUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const _ in a)f[_].set(this.program,_,a[_])}}setLightsUniformValues(r,a){if(this._ensureReady(),!this.lightsUniforms)return;const f=this.lightsUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const _ in a)f[_].set(this.program,_,a[_])}}setShadowUniformValues(r,a){if(this._ensureReady(),this.failedToCreate||!this.shadowUniforms)return;const f=this.shadowUniforms;r.program.set(this.program);for(const _ in a)f[_].set(this.program,_,a[_])}_drawDebugWireframe(r,a,f,_,x,w,k,A,P,D){const z=r.options.wireframe;if(z.terrain===!1&&z.layers2D===!1&&z.layers3D===!1)return;const F=r.context;if(!(!(!z.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!z.layers2D||r._terrain&&r._terrain.renderingToTexture||!e1.includes(this.name))||!(!z.layers3D||!uv.includes(this.name))))return;const j=F.gl,$=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,x,F);if(!$)return;const W=[...this.fixedDefines,"DEBUG_WIREFRAME"],J=r.getOrCreateProgram(this.name,{config:this.configuration,defines:W});J._ensureReady(),F.program.set(J.program);const Q=(se,Ae,Ee)=>{if(Ae[se]&&Ee[se])for(const Pe in Ae[se])Ee[se][Pe]&&Ee[se][Pe].set(Ee.program,Pe,Ae[se][Pe].current)};P&&P.setUniforms(J.program,F,J.binderUniforms,k,{zoom:A}),Q("fixedUniforms",this,J),Q("terrainUniforms",this,J),Q("globeUniforms",this,J),Q("fogUniforms",this,J),Q("lightsUniforms",this,J),Q("shadowUniforms",this,J),$.bind(),F.setColorMode(new tn([j.ONE,j.ONE_MINUS_SRC_ALPHA,j.ZERO,j.ONE],c.i.transparent,[!0,!0,!0,!1])),F.setDepthMode(new Vt(a.func===j.LESS?j.LEQUAL:a.func,Vt.ReadOnly,a.range)),F.setStencilMode(rn.disabled);const ce=3*w.primitiveLength*2,fe=3*w.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const se=D||1;for(let Ae=0;Ae<se;++Ae)J.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Ae),j.drawElements(j.LINES,ce,j.UNSIGNED_SHORT,fe)}else D&&D>1?j.drawElementsInstanced(j.LINES,ce,j.UNSIGNED_SHORT,fe,D):j.drawElements(j.LINES,ce,j.UNSIGNED_SHORT,fe);x.bind(),F.program.set(this.program),F.setDepthMode(a),F.setStencilMode(f),F.setColorMode(_)}checkUniforms(r,a,f){if(this.fixedDefines.includes(a)){for(const _ of Object.keys(f))if(!f[_].initialized)throw new Error(`Program '${this.name}', from draw '${r}': uniform ${_} not set but required by ${a} being defined`)}}draw(r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J){const Q=r.context,ce=Q.gl;if(this._ensureReady(),this.failedToCreate)return;Q.program.set(this.program),Q.setDepthMode(f),Q.setStencilMode(_),Q.setColorMode(x),Q.setCullFace(w);for(const[ye,be]of this.fixedUniformsEntries)be.set(this.program,ye,k[ye]);$&&$.setUniforms(this.program,Q,this.binderUniforms,F,{zoom:j});const fe={[ce.POINTS]:1,[ce.LINES]:2,[ce.TRIANGLES]:3,[ce.LINE_STRIP]:1}[a];this.checkUniforms(A,"RENDER_SHADOWS",this.shadowUniforms);const se=W||[],Ae=$?$.getPaintVertexBuffers():[],Ee=a===ce.TRIANGLES&&D,Pe=J&&J>0?1:void 0;for(const ye of z.get()){const be=ye.vaos||(ye.vaos={});if((be[A]||(be[A]=new Le)).bind(Q,this,P,Ae,D,ye.vertexOffset,se,Pe),this.forceManualRenderingForInstanceIDShaders){const Ce=J||1;for(let ze=0;ze<Ce;++ze)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ze),D?ce.drawElements(a,ye.primitiveLength*fe,ce.UNSIGNED_SHORT,ye.primitiveOffset*fe*2):ce.drawArrays(a,ye.vertexOffset,ye.vertexLength)}else J&&J>1?ce.drawElementsInstanced(a,ye.primitiveLength*fe,ce.UNSIGNED_SHORT,ye.primitiveOffset*fe*2,J):D?ce.drawElements(a,ye.primitiveLength*fe,ce.UNSIGNED_SHORT,ye.primitiveOffset*fe*2):ce.drawArrays(a,ye.vertexOffset,ye.vertexLength);Ee&&this._drawDebugWireframe(r,f,_,x,D,ye,F,j,$,J)}}}const Xo=(u,r,a)=>({u_matrix:u,u_emissive_strength:r,u_ground_shadow_factor:a,u_opacity_multiplier:1}),ju=(u,r,a,f,_,x=0)=>Object.assign(Xo(u,r,_),_f(a,f,x)),dv=(u,r,a,f)=>({u_matrix:u,u_world:a,u_emissive_strength:r,u_ground_shadow_factor:f,u_opacity_multiplier:1}),ka=(u,r,a,f,_,x,w=0)=>Object.assign(ju(u,r,a,f,x,w),{u_world:_}),Aa=(u,r,a)=>({u_image:u,u_texel_size:r,u_first_pass:a?1:0}),Xd=(u,r,a,f,_,x,w,k)=>{const A=c.r/x.tileSize;return{u_matrix:u,u_inv_rot_matrix:r,u_camera_to_center_distance:a.getCameraToCenterDistance(k),u_extrude_scale:[a.pixelsToGLUnits[0]/A,a.pixelsToGLUnits[1]/A],u_zoom_transition:f,u_tile_id:w,u_merc_center:_}},Uu=(u,r,a,f)=>({u_matrix:u,u_inv_matrix:r,u_camera_to_center_distance:a.getCameraToCenterDistance(f),u_viewport_size:[a.width,a.height]}),Kd=c.bT(),hv=(u,r,a,f,_,x,w)=>{const k=u.transform,A=k.projection.name==="globe",P=A?c.di(k.zoom,r.canonical)*k._pixelsPerMercatorPixel:c.eG(a,1,x),D={u_matrix:r.projMatrix,u_extrude_scale:P,u_intensity:w,u_inv_rot_matrix:Kd,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(A){D.u_inv_rot_matrix=f,D.u_merc_center=_,D.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],D.u_zoom_transition=c.dm(k.zoom);const z=_[0]*c.r,F=_[1]*c.r;D.u_up_dir=k.projection.upVector(new c.f(0,0,0),z,F)}return D};function Qn(u){const r=u.terrain?u.terrain.exaggeration():1;return(u.transform.pitch<15?c.dY(.07,.7,c.bG((14-u.transform.zoom)/5,0,1)):.07)*r}const ec=(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce,fe,se,Ae)=>({u_matrix:r,u_normalize_matrix:a,u_globe_matrix:f,u_merc_matrix:_,u_grid_matrix:x,u_tl_parent:w,u_scale_parent:D,u_fade_t:z.mix,u_opacity:z.opacity*F.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:F.paint.get("raster-brightness-min"),u_brightness_high:F.paint.get("raster-brightness-max"),u_saturation_factor:c.f9(F.paint.get("raster-saturation")),u_contrast_factor:c.bP(F.paint.get("raster-contrast")),u_spin_weights:fv(F.paint.get("raster-hue-rotate")),u_perspective_transform:j,u_raster_elevation:$,u_zoom_transition:k,u_merc_center:A,u_cutoff_params:P,u_colorization_mix:fy(c.e,J,ce),u_colorization_offset:py(c.e,Q,ce),u_color_ramp:W,u_texture_offset:[se/(fe+2*se),fe/(fe+2*se)],u_texture_res:[fe+2*se,fe+2*se],u_emissive_strength:Ae,u_zbias_factor:Qn(u)});function fv(u){u*=Math.PI/180;const r=Math.sin(u),a=Math.cos(u);return[(2*a+1)/3,(-Math.sqrt(3)*r-a+1)/3,(Math.sqrt(3)*r-a+1)/3]}const Ko=c.bT(),Ym=(u,r,a,f,_,x,w,k,A,P,D,z,F,j,$,W,J,Q,ce,fe,se,Ae,Ee,Pe)=>{const ye=_.transform,be={u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:ye.getCameraToCenterDistance(ce),u_rotate_symbol:+a,u_aspect_ratio:ye.width/ye.height,u_fade_change:_.options.fadeDuration?_.symbolFadeChange:1,u_matrix:x,u_label_plane_matrix:w,u_coord_matrix:k,u_is_text:+P,u_elevation_from_sea:A?1:0,u_pitch_with_map:+f,u_texsize:D,u_texsize_icon:z,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ko,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Ko,u_up_vector:[0,-1,0],u_color_adj_mat:Ae,u_icon_transition:Ee||0,u_gamma_scale:f?_.transform.getCameraToCenterDistance(ce)*Math.cos(_.terrain?0:_.transform._pitch):1,u_device_pixel_ratio:c.co.devicePixelRatio,u_is_halo:1,u_scale_factor:Pe||1,u_ground_shadow_factor:fe,u_inv_matrix:c.dr(c.bT(),w),u_normal_scale:se,u_lutTexture:10,u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0],u_spp_fill_color_zoom_factor:0,u_spp_halo_color_zoom_factor:0,u_spp_opacity_zoom_factor:0,u_spp_halo_width_zoom_factor:0,u_spp_halo_blur_zoom_factor:0,u_spp_emissive_strength_zoom_factor:0,u_spp_occlusion_opacity_zoom_factor:0,u_spp_z_offset_zoom_factor:0,u_spp_translate_zoom_factor:0,u_opacity_multiplier:1};return ce.name==="globe"&&(be.u_tile_id=[j.canonical.x,j.canonical.y,1<<j.canonical.z],be.u_zoom_transition=$,be.u_inv_rot_matrix=J,be.u_merc_center=W,be.u_camera_forward=ye._camera.forward(),be.u_ecef_origin=c.df(ye.globeMatrix,j.toUnwrapped()),be.u_tile_matrix=ye.globeMatrix,be.u_up_vector=Q),be},Ss=(u,r,a,f)=>({u_matrix:u,u_emissive_strength:r,u_opacity:a,u_color:f}),pv=(u,r,a,f,_,x,w,k,A)=>Object.assign(function(P,D,z,F,j,$){const{width:W,height:J}=F.imageManager.getPixelSize(D),Q=Math.pow(2,$.tileID.overscaledZ),ce=$.tileSize*Math.pow(2,F.transform.tileZoom)/Q,fe=ce*($.tileID.canonical.x+$.tileID.wrap*Q),se=ce*$.tileID.canonical.y;return{u_image:0,u_pattern_tl:z.tl,u_pattern_br:z.br,u_texsize:[W,J],u_pattern_size:z.displaySize,u_pattern_units_to_pixels:j?[F.transform.width,-1*F.transform.height]:[1/c.eG($,1,F.transform.tileZoom),1/c.eG($,1,F.transform.tileZoom)],u_pixel_coord_upper:[fe>>16,se>>16],u_pixel_coord_lower:[65535&fe,65535&se]}}(0,x,w,f,k,A),{u_matrix:u,u_emissive_strength:r,u_opacity:a}),Gu={fillExtrusion:u=>({u_matrix:new c.bb(u),u_lightpos:new c.b7(u),u_lightintensity:new c.b4(u),u_lightcolor:new c.b7(u),u_vertical_gradient:new c.b4(u),u_opacity:new c.b4(u),u_edge_radius:new c.b4(u),u_width_scale:new c.b4(u),u_ao:new c.b6(u),u_height_type:new c.b5(u),u_base_type:new c.b5(u),u_tile_id:new c.b7(u),u_zoom_transition:new c.b4(u),u_inv_rot_matrix:new c.bb(u),u_merc_center:new c.b6(u),u_up_dir:new c.b7(u),u_height_lift:new c.b4(u),u_flood_light_color:new c.b7(u),u_vertical_scale:new c.b4(u),u_flood_light_intensity:new c.b4(u),u_ground_shadow_factor:new c.b7(u),u_front_cutoff_params:new c.b7(u)}),fillExtrusionDepth:u=>({u_matrix:new c.bb(u),u_edge_radius:new c.b4(u),u_width_scale:new c.b4(u),u_vertical_scale:new c.b4(u),u_height_type:new c.b5(u),u_base_type:new c.b5(u)}),fillExtrusionPattern:u=>({u_matrix:new c.bb(u),u_lightpos:new c.b7(u),u_lightintensity:new c.b4(u),u_lightcolor:new c.b7(u),u_vertical_gradient:new c.b4(u),u_height_factor:new c.b4(u),u_edge_radius:new c.b4(u),u_width_scale:new c.b4(u),u_ao:new c.b6(u),u_height_type:new c.b5(u),u_base_type:new c.b5(u),u_tile_id:new c.b7(u),u_zoom_transition:new c.b4(u),u_inv_rot_matrix:new c.bb(u),u_merc_center:new c.b6(u),u_up_dir:new c.b7(u),u_height_lift:new c.b4(u),u_image:new c.b5(u),u_texsize:new c.b6(u),u_pixel_coord_upper:new c.b6(u),u_pixel_coord_lower:new c.b6(u),u_tile_units_to_pixels:new c.b4(u),u_opacity:new c.b4(u),u_pattern_transition:new c.b4(u)}),fillExtrusionGroundEffect:u=>({u_matrix:new c.bb(u),u_opacity:new c.b4(u),u_ao_pass:new c.b4(u),u_meter_to_tile:new c.b4(u),u_ao:new c.b6(u),u_flood_light_intensity:new c.b4(u),u_flood_light_color:new c.b7(u),u_attenuation:new c.b4(u),u_edge_radius:new c.b4(u),u_fb:new c.b5(u),u_fb_size:new c.b4(u),u_dynamic_offset:new c.b4(u)}),fill:u=>({u_matrix:new c.bb(u),u_emissive_strength:new c.b4(u),u_ground_shadow_factor:new c.b7(u),u_opacity_multiplier:new c.b4(u)}),fillPattern:u=>({u_matrix:new c.bb(u),u_emissive_strength:new c.b4(u),u_image:new c.b5(u),u_texsize:new c.b6(u),u_pixel_coord_upper:new c.b6(u),u_pixel_coord_lower:new c.b6(u),u_tile_units_to_pixels:new c.b4(u),u_ground_shadow_factor:new c.b7(u),u_pattern_transition:new c.b4(u),u_opacity_multiplier:new c.b4(u)}),fillOutline:u=>({u_matrix:new c.bb(u),u_emissive_strength:new c.b4(u),u_world:new c.b6(u),u_ground_shadow_factor:new c.b7(u),u_opacity_multiplier:new c.b4(u)}),fillOutlinePattern:u=>({u_matrix:new c.bb(u),u_emissive_strength:new c.b4(u),u_world:new c.b6(u),u_image:new c.b5(u),u_texsize:new c.b6(u),u_pixel_coord_upper:new c.b6(u),u_pixel_coord_lower:new c.b6(u),u_tile_units_to_pixels:new c.b4(u),u_ground_shadow_factor:new c.b7(u),u_pattern_transition:new c.b4(u),u_opacity_multiplier:new c.b4(u)}),lineBlendComposite:u=>({u_image:new c.b5(u),u_opacity:new c.b4(u),u_blend_mode:new c.b5(u),u_max_density:new c.b4(u)}),lineBlendReduce:u=>({u_image:new c.b5(u),u_texel_size:new c.b6(u),u_first_pass:new c.b5(u)}),circle:c.bE,collisionBox:u=>({u_matrix:new c.bb(u),u_inv_rot_matrix:new c.bb(u),u_camera_to_center_distance:new c.b4(u),u_extrude_scale:new c.b6(u),u_zoom_transition:new c.b4(u),u_merc_center:new c.b6(u),u_tile_id:new c.b7(u)}),collisionCircle:u=>({u_matrix:new c.bb(u),u_inv_matrix:new c.bb(u),u_camera_to_center_distance:new c.b4(u),u_viewport_size:new c.b6(u)}),debug:u=>({u_color:new c.b9(u),u_matrix:new c.bb(u),u_overlay:new c.b5(u),u_overlay_scale:new c.b4(u)}),clippingMask:u=>({u_matrix:new c.bb(u)}),heatmap:u=>({u_extrude_scale:new c.b4(u),u_intensity:new c.b4(u),u_matrix:new c.bb(u),u_inv_rot_matrix:new c.bb(u),u_merc_center:new c.b6(u),u_tile_id:new c.b7(u),u_zoom_transition:new c.b4(u),u_up_dir:new c.b7(u)}),heatmapTexture:u=>({u_image:new c.b5(u),u_color_ramp:new c.b5(u),u_opacity:new c.b4(u)}),hillshade:u=>({u_matrix:new c.bb(u),u_image:new c.b5(u),u_latrange:new c.b6(u),u_light:new c.b6(u),u_shadow:new c.b9(u),u_highlight:new c.b9(u),u_emissive_strength:new c.b4(u),u_accent:new c.b9(u)}),hillshadePrepare:u=>({u_matrix:new c.bb(u),u_image:new c.b5(u),u_dimension:new c.b6(u),u_zoom:new c.b4(u)}),line:c.e3,linePattern:c.e1,raster:u=>({u_matrix:new c.bb(u),u_normalize_matrix:new c.bb(u),u_globe_matrix:new c.bb(u),u_merc_matrix:new c.bb(u),u_grid_matrix:new c.ba(u),u_tl_parent:new c.b6(u),u_scale_parent:new c.b4(u),u_fade_t:new c.b4(u),u_opacity:new c.b4(u),u_image0:new c.b5(u),u_image1:new c.b5(u),u_brightness_low:new c.b4(u),u_brightness_high:new c.b4(u),u_saturation_factor:new c.b4(u),u_contrast_factor:new c.b4(u),u_spin_weights:new c.b7(u),u_perspective_transform:new c.b6(u),u_raster_elevation:new c.b4(u),u_zoom_transition:new c.b4(u),u_merc_center:new c.b6(u),u_cutoff_params:new c.b8(u),u_colorization_mix:new c.b8(u),u_colorization_offset:new c.b4(u),u_color_ramp:new c.b5(u),u_texture_offset:new c.b6(u),u_texture_res:new c.b6(u),u_emissive_strength:new c.b4(u),u_zbias_factor:new c.b4(u)}),symbol:u=>({u_is_size_zoom_constant:new c.b5(u),u_is_size_feature_constant:new c.b5(u),u_size_t:new c.b4(u),u_size:new c.b4(u),u_camera_to_center_distance:new c.b4(u),u_rotate_symbol:new c.b5(u),u_aspect_ratio:new c.b4(u),u_fade_change:new c.b4(u),u_matrix:new c.bb(u),u_label_plane_matrix:new c.bb(u),u_coord_matrix:new c.bb(u),u_is_text:new c.b5(u),u_elevation_from_sea:new c.b5(u),u_pitch_with_map:new c.b5(u),u_texsize:new c.b6(u),u_texsize_icon:new c.b6(u),u_texture:new c.b5(u),u_texture_icon:new c.b5(u),u_gamma_scale:new c.b4(u),u_device_pixel_ratio:new c.b4(u),u_tile_id:new c.b7(u),u_zoom_transition:new c.b4(u),u_inv_rot_matrix:new c.bb(u),u_merc_center:new c.b6(u),u_camera_forward:new c.b7(u),u_tile_matrix:new c.bb(u),u_up_vector:new c.b7(u),u_ecef_origin:new c.b7(u),u_is_halo:new c.b5(u),u_icon_transition:new c.b4(u),u_color_adj_mat:new c.bb(u),u_scale_factor:new c.b4(u),u_ground_shadow_factor:new c.b7(u),u_inv_matrix:new c.bb(u),u_normal_scale:new c.b4(u),u_lutTexture:new c.b5(u),u_spp_fill_np_color:new c.b8(u),u_spp_halo_np_color:new c.b8(u),u_spp_opacity:new c.b4(u),u_spp_halo_width:new c.b4(u),u_spp_halo_blur:new c.b4(u),u_spp_emissive_strength:new c.b4(u),u_spp_occlusion_opacity:new c.b4(u),u_spp_z_offset:new c.b4(u),u_spp_translate_rotation:new c.b6(u),u_spp_fill_color_zoom_factor:new c.b4(u),u_spp_halo_color_zoom_factor:new c.b4(u),u_spp_opacity_zoom_factor:new c.b4(u),u_spp_halo_width_zoom_factor:new c.b4(u),u_spp_halo_blur_zoom_factor:new c.b4(u),u_spp_emissive_strength_zoom_factor:new c.b4(u),u_spp_occlusion_opacity_zoom_factor:new c.b4(u),u_spp_z_offset_zoom_factor:new c.b4(u),u_spp_translate_zoom_factor:new c.b4(u),u_opacity_multiplier:new c.b4(u)}),background:u=>({u_matrix:new c.bb(u),u_emissive_strength:new c.b4(u),u_opacity:new c.b4(u),u_color:new c.b9(u)}),backgroundPattern:u=>({u_matrix:new c.bb(u),u_emissive_strength:new c.b4(u),u_opacity:new c.b4(u),u_image:new c.b5(u),u_pattern_tl:new c.b6(u),u_pattern_br:new c.b6(u),u_texsize:new c.b6(u),u_pattern_size:new c.b6(u),u_pixel_coord_upper:new c.b6(u),u_pixel_coord_lower:new c.b6(u),u_pattern_units_to_pixels:new c.b6(u)}),terrainRaster:u=>({u_matrix:new c.bb(u),u_image0:new c.b5(u),u_image1:new c.b5(u),u_skirt_height:new c.b4(u),u_ground_shadow_factor:new c.b7(u),u_emissive_texture_available:new c.b4(u)}),skybox:u=>({u_matrix:new c.bb(u),u_sun_direction:new c.b7(u),u_cubemap:new c.b5(u),u_opacity:new c.b4(u),u_temporal_offset:new c.b4(u)}),skyboxGradient:u=>({u_matrix:new c.bb(u),u_color_ramp:new c.b5(u),u_center_direction:new c.b7(u),u_radius:new c.b4(u),u_opacity:new c.b4(u),u_temporal_offset:new c.b4(u)}),skyboxCapture:u=>({u_matrix_3f:new c.ba(u),u_sun_direction:new c.b7(u),u_sun_intensity:new c.b4(u),u_color_tint_r:new c.b8(u),u_color_tint_m:new c.b8(u),u_luminance:new c.b4(u)}),globeRaster:u=>({u_proj_matrix:new c.bb(u),u_globe_matrix:new c.bb(u),u_normalize_matrix:new c.bb(u),u_merc_matrix:new c.bb(u),u_zoom_transition:new c.b4(u),u_merc_center:new c.b6(u),u_image0:new c.b5(u),u_image1:new c.b5(u),u_grid_matrix:new c.ba(u),u_skirt_height:new c.b4(u),u_far_z_cutoff:new c.b4(u),u_frustum_tl:new c.b7(u),u_frustum_tr:new c.b7(u),u_frustum_br:new c.b7(u),u_frustum_bl:new c.b7(u),u_globe_pos:new c.b7(u),u_globe_radius:new c.b4(u),u_viewport:new c.b6(u),u_emissive_texture_available:new c.b4(u)}),globeAtmosphere:u=>({u_frustum_tl:new c.b7(u),u_frustum_tr:new c.b7(u),u_frustum_br:new c.b7(u),u_frustum_bl:new c.b7(u),u_horizon:new c.b4(u),u_transition:new c.b4(u),u_fadeout_range:new c.b4(u),u_atmosphere_fog_color:new c.b8(u),u_high_color:new c.b8(u),u_space_color:new c.b8(u),u_temporal_offset:new c.b4(u),u_horizon_angle:new c.b4(u)}),groundShadow:u=>({u_matrix:new c.bb(u),u_ground_shadow_factor:new c.b7(u)}),stars:u=>({u_matrix:new c.bb(u),u_up:new c.b7(u),u_right:new c.b7(u),u_intensity_multiplier:new c.b4(u)}),occlusion:u=>({u_matrix:new c.bb(u),u_anchorPos:new c.b7(u),u_screenSizePx:new c.b6(u),u_occluderSizePx:new c.b6(u),u_color:new c.b8(u)})};class tc{constructor(r,a,f,_){this.id=tc.uniqueIdxCounter,tc.uniqueIdxCounter++,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),this.dynamicDraw=!!f,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),x.bufferData(x.ELEMENT_ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||_||a.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){this.id=tc.uniqueIdxCounter,tc.uniqueIdxCounter++;const a=this.context.gl;this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}tc.uniqueIdxCounter=0;const Qs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class No{constructor(r,a,f,_,x,w){this.length=a.length,this.attributes=f,this.itemSize=a.bytesPerElement,this.dynamicDraw=_,this.instanceCount=w,this.context=r;const k=r.gl;this.buffer=k.createBuffer(),r.bindVertexBuffer.set(this.buffer),k.bufferData(k.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?k.DYNAMIC_DRAW:k.STATIC_DRAW),this.dynamicDraw||x||a.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,a){for(const f of this.attributes){const _=a.getAttributeLocation(r,f.name);_!==-1&&r.enableVertexAttribArray(_)}}setVertexAttribPointers(r,a,f){for(const _ of this.attributes){const x=a.getAttributeLocation(r,_.name);if(x!==-1){const w=_.offset+this.itemSize*(f||0);_.type==="Float32"?r.vertexAttribPointer(x,_.components,r.FLOAT,!1,this.itemSize,w):r.vertexAttribIPointer(x,_.components,r[Qs[_.type]],this.itemSize,w)}}}setVertexAttribDivisor(r,a,f){for(let _=0;_<this.attributes.length;_++){const x=a.getAttributeLocation(r,this.attributes[_].name);x!==-1&&this.instanceCount&&this.instanceCount>0&&r.vertexAttribDivisor(x,f)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class $c{constructor(r,a,f,_,x){this.context=r,this.width=a,this.height=f;const w=this.framebuffer=r.gl.createFramebuffer();_>0&&(this.colorAttachment0=new qm(r,w,0)),_>1&&(this.colorAttachment1=new qm(r,w,1)),x&&(this.depthAttachmentType=x,this.depthAttachment=x==="renderbuffer"?new Zm(r,w):new N2(r,w))}static createWithTexture(r,a,f,_,x){const w=r.gl;if(r.activeTexture.set(w.TEXTURE1),r.viewport.set([0,0,f,_]),a&&a.width===f&&a.height===_)return w.bindTexture(w.TEXTURE_2D,a.colorAttachment0.get()),r.bindFramebuffer.set(a.framebuffer),a;a&&a.destroy();const k=r.extRenderToTextureHalfFloat||r.extColorBufferFloat?r.gl.RGBA16F:r.gl.RGBA8,A=new c.a_(r,{width:f,height:_,data:null},k);A.bind(w.LINEAR,w.CLAMP_TO_EDGE);const P=r.createFramebuffer(f,_,1,null);if(P.format=k,P.colorAttachment0.set(A.texture),x){const D=r.createRenderbuffer(w.DEPTH24_STENCIL8,f,_);r.bindFramebuffer.set(P.framebuffer),w.framebufferRenderbuffer(w.FRAMEBUFFER,w.DEPTH_STENCIL_ATTACHMENT,w.RENDERBUFFER,D),P._stencilRbo=D}return P}createColorAttachment(r,a){a===0?this.colorAttachment0=new qm(r,this.framebuffer,0):a===1&&(this.colorAttachment1=new qm(r,this.framebuffer,1))}removeColorAttachment(r,a){const f=this.context.gl;let _;a===0?(_=this.colorAttachment0.get(),this.colorAttachment0=void 0):a===1&&(_=this.colorAttachment1.get(),this.colorAttachment1=void 0),_&&f.deleteTexture(_)}destroy(){const r=this.context.gl;if(this.colorAttachment0){const a=this.colorAttachment0.get();a&&r.deleteTexture(a)}if(this.colorAttachment1){const a=this.colorAttachment1.get();a&&r.deleteTexture(a)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const a=this.depthAttachment.get();a&&r.deleteRenderbuffer(a)}else{const a=this.depthAttachment.get();a&&r.deleteTexture(a)}this._stencilRbo&&(r.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),r.deleteFramebuffer(this.framebuffer)}}class t1{constructor(r,a){this.gl=r,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new Vb(this),this.clearDepth=new Wd(this),this.clearStencil=new M2(this),this.colorMask=new P2(this),this.depthMask=new jb(this),this.stencilMask=new $m(this),this.stencilFunc=new iv(this),this.stencilOp=new Ub(this),this.stencilTest=new Gb(this),this.depthRange=new Hm(this),this.depthTest=new Hf(this),this.depthFunc=new ov(this),this.blend=new $b(this),this.blendFunc=new Hb(this),this.blendColor=new Wb(this),this.blendEquation=new qb(this),this.cullFace=new Zb(this),this.cullFaceSide=new D2(this),this.frontFace=new Xb(this),this.program=new R2(this),this.activeTexture=new ds(this),this.viewport=new Wm(this),this.bindFramebuffer=new Nu(this),this.bindRenderbuffer=new Kb(this),this.bindTexture=new Vu(this),this.bindVertexBuffer=new Wf(this),this.bindElementBuffer=new L2(this),this.bindVertexArrayOES=new O2(this),this.pixelStoreUnpack=new F2(this),this.pixelStoreUnpackPremultiplyAlpha=new z2(this),this.pixelStoreUnpackFlipY=new B2(this),this.options=a?Object.assign({},a):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=a&&!!a.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),this.disableSymbolUBO=a&&!!a.forceDisableSymbolUBO,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extColorBufferFloat=r.getExtension("EXT_color_buffer_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=Math.min(r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE),32768),this.maxUniformBufferBindings=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=r.getExtension("WEBGL_blend_func_extended"),this.extParallelShaderCompile=r.getExtension("KHR_parallel_shader_compile")}sweepPendingPrograms(){if(this._pendingPrograms.size!==0)for(const r of this._pendingPrograms)r.maybeFinalize()}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(r,a,f){return new tc(this,r,a,f)}createVertexBuffer(r,a,f,_,x){return new No(this,r,a,f,_,x)}createRenderbuffer(r,a,f){const _=this.gl,x=_.createRenderbuffer();return this.bindRenderbuffer.set(x),_.renderbufferStorage(_.RENDERBUFFER,r,a,f),this.bindRenderbuffer.set(null),x}createFramebuffer(r,a,f,_){return new $c(this,r,a,f,_)}clear({color:r,depth:a,stencil:f,colorMask:_}){const x=this.gl;let w=0;r&&(w|=x.COLOR_BUFFER_BIT,this.clearColor.set(r.toNonPremultipliedRenderColor(null)),this.colorMask.set(_||[!0,!0,!0,!0])),a!==void 0&&(w|=x.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),f!==void 0&&(w|=x.STENCIL_BUFFER_BIT,this.clearStencil.set(f),this.stencilMask.set(255)),x.clear(w)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){c.c2(r.blendFunction,tn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Yd;function n1(u,r,a,f,_,x,w){const k=u.context,A=k.gl,P=u.transform,D=[c.ek(P.center.lng),c.el(P.center.lat)],z=a.layout.get("symbol-placement"),F=a.layout.get("text-variable-anchor"),j=a.layout.get("icon-rotation-alignment")==="map",$=a.layout.get("text-rotation-alignment")==="map",W=z!=="point",J=[];let Q=0,ce=0;for(let ye=0;ye<f.length;ye++){const be=f[ye],Ce=r.getTile(be),ze=Ce.getBucket(a);if(!ze)continue;const Oe=ze.getProjection().createInversionMatrix(P,be.canonical),Ze=[],We=Pb(be,ze,P),ut=!w&&j&&W,Ne=w&&$&&W,Je=F&&ze.hasTextData(),Be=ze.hasIconTextFit()&&Je&&ze.hasIconData(),it=ut||Ne||w&&Je||Be,Qe=ze.projection.name==="globe",ot=Qe?c.dm(P.zoom):0;Qe&&(Ze.push("PROJECTION_GLOBE_VIEW"),it&&Ze.push("PROJECTED_POS_ON_VIEWPORT"));const Et=u.getOrCreateProgram("collisionBox",{defines:Ze});let ht=We;_[0]===0&&_[1]===0||(ht=u.translatePosMatrix(We,Ce,_,x));const gt=w?ze.textCollisionBox:ze.iconCollisionBox,ct=ze.collisionCircleArray;if(ct.length>0){const Ot=c.bT(),Nt=ht;c.eo(Ot,ze.placementInvProjMatrix,P.glCoordMatrix),c.eo(Ot,Ot,ze.placementViewportMatrix),J.push({circleArray:ct,circleOffset:ce,transform:Nt,invTransform:Ot,projection:ze.getProjection()}),Q+=ct.length/4,ce=Q}if(!gt)continue;u.terrain&&u.terrain.setupElevationDraw(Ce,Et);const Ht=Qe?[be.canonical.x,be.canonical.y,1<<be.canonical.z]:[0,0,0];Et.draw(u,A.LINES,Vt.disabled,rn.disabled,u.colorModeForRenderPass(),Ut.disabled,Xd(ht,Oe,P,ot,D,Ce,Ht,ze.getProjection()),a.id,gt.layoutVertexBuffer,gt.indexBuffer,gt.segments,null,P.zoom,null,[gt.collisionVertexBuffer,gt.collisionVertexBufferExt])}if(!w||!J.length)return;const fe=u.getOrCreateProgram("collisionCircle"),se=new c.aN;se.resize(4*Q),se._trim();let Ae=0;for(const ye of J)for(let be=0;be<ye.circleArray.length/4;be++){const Ce=4*be,ze=ye.circleArray[Ce+0],Oe=ye.circleArray[Ce+1],Ze=ye.circleArray[Ce+2],We=ye.circleArray[Ce+3];se.emplace(Ae++,ze,Oe,Ze,We,0),se.emplace(Ae++,ze,Oe,Ze,We,1),se.emplace(Ae++,ze,Oe,Ze,We,2),se.emplace(Ae++,ze,Oe,Ze,We,3)}(!Yd||Yd.length<2*Q)&&(Yd=function(ye){const be=2*ye,Ce=new c.aT;Ce.resize(be),Ce._trim();for(let ze=0;ze<be;ze++){const Oe=6*ze;Ce.uint16[Oe+0]=4*ze+0,Ce.uint16[Oe+1]=4*ze+1,Ce.uint16[Oe+2]=4*ze+2,Ce.uint16[Oe+3]=4*ze+2,Ce.uint16[Oe+4]=4*ze+3,Ce.uint16[Oe+5]=4*ze+0}return Ce}(Q));const Ee=k.createIndexBuffer(Yd,!0),Pe=k.createVertexBuffer(se,c.bM.members,!0);for(const ye of J){const be=Uu(ye.transform,ye.invTransform,P,ye.projection);fe.draw(u,A.TRIANGLES,Vt.disabled,rn.disabled,u.colorModeForRenderPass(),Ut.disabled,be,a.id,Pe,Ee,c.aJ.simpleSegment(0,2*ye.circleOffset,ye.circleArray.length,ye.circleArray.length/2),null,P.zoom)}Pe.destroy(),Ee.destroy()}const Qd=c.bT();function mv(u){const r=u._camera.getWorldToCamera(u.worldSize,1),a=c.er([],r,u.globeMatrix);c.dr(a,a);const f=[0,0,0],_=[0,1,0,0];return c.fM(_,_,a),f[0]=_[0],f[1]=_[1],f[2]=_[2],c.ex(f,f),f}function V2({width:u,height:r,anchor:a,textOffset:f,textScale:_},x){const{horizontalAlign:w,verticalAlign:k}=c.cE(a),A=-(w-.5)*u,P=-(k-.5)*r,D=c.cj(a,f);return new c.au((A/_+D[0])*x,(P/_+D[1])*x)}function Js(u,r,a,f,_,x,w,k,A,P){const D=u.text.placedSymbolArray,z=u.text.dynamicLayoutVertexArray,F=u.icon.dynamicLayoutVertexArray,j={},$=u.getProjection(),W=zm(w,$,_),J=_.elevation,Q=$.upVectorScale(w.canonical,_.center.lat,_.worldSize).metersToTile;z.clear();for(let ce=0;ce<D.length;ce++){const fe=D.get(ce),{tileAnchorX:se,tileAnchorY:Ae,numGlyphs:Ee}=fe,Pe=fe.hidden||!fe.crossTileID||u.allowVerticalPlacement&&!fe.placedOrientation?null:f[fe.crossTileID];if(Pe){let ye=0,be=0,Ce=0;const ze=u.elevationType==="road";if(J||ze){const Qe=ze&&u.hdExt?u.hdExt.getElevationFeatureForPlacedSymbol(u,u.text,ce):null,ot=c.s.getAtTileOffset(w,new c.au(se,Ae),J,Qe),[Et,ht,gt]=$.upVector(w.canonical,se,Ae);ye=ot*Et*Q,be=ot*ht*Q,Ce=ot*gt*Q}let[Oe,Ze,We,ut]=lo(fe.projectedAnchorX+ye,fe.projectedAnchorY+be,fe.projectedAnchorZ+Ce,a?W:x);const Ne=dm(_.getCameraToCenterDistance($),ut);let Je=c.ch(u.textSizeData,A,fe)*Ne/c.ao;a&&(Je*=u.tilePixelRatio/k);const Be=V2(Pe,Je);a?({x:Oe,y:Ze,z:We}=$.projectTilePoint(se+Be.x,Ae+Be.y,w.canonical),[Oe,Ze,We]=lo(Oe+ye,Ze+be,We+Ce,x)):(r&&Be._rotate(-_.angle),Oe+=Be.x,Ze+=Be.y,We=0);const it=u.allowVerticalPlacement&&fe.placedOrientation===c.bg.vertical?Math.PI/2:0;for(let Qe=0;Qe<Ee;Qe++)c.bl(z,Oe,Ze,We,it);P&&fe.associatedIconIndex>=0&&(j[fe.associatedIconIndex]={x:Oe,y:Ze,z:We,angle:it})}else yl(Ee,z)}if(P){F.clear();const ce=u.icon.placedSymbolArray;for(let fe=0;fe<ce.length;fe++){const se=ce.get(fe),{numGlyphs:Ae}=se,Ee=j[fe];if(se.hidden||!Ee)yl(Ae,F);else{const{x:Pe,y:ye,z:be,angle:Ce}=Ee;for(let ze=0;ze<Ae;ze++)c.bl(F,Pe,ye,be,Ce)}}u.icon.dynamicLayoutVertexBuffer.updateData(F)}u.text.dynamicLayoutVertexBuffer.updateData(z)}function Ls(u,r,a,f,_,x,w={}){const k=a.paint.get("icon-translate"),A=a.paint.get("text-translate"),P=a.paint.get("icon-translate-anchor"),D=a.paint.get("text-translate-anchor"),z=a.layout.get("icon-rotation-alignment"),F=a.layout.get("text-rotation-alignment"),j=a.layout.get("icon-pitch-alignment"),$=a.layout.get("text-pitch-alignment"),W=a.layout.get("icon-keep-upright"),J=a.layout.get("text-keep-upright"),Q=a.paint.get("icon-color-saturation"),ce=a.paint.get("icon-color-contrast"),fe=a.paint.get("icon-color-brightness-min"),se=a.paint.get("icon-color-brightness-max"),Ae=a.layout.get("symbol-elevation-reference")==="sea",Ee=a.layout.get("icon-image-use-theme")==="none",Pe=u.context,ye=Pe.gl,be=u.transform,Ce=z==="map",ze=F==="map",Oe=j==="map",Ze=$==="map",We=a.layout.get("symbol-sort-key").constantOr(1)!==void 0;let ut=!1;const Ne=u.depthModeForSublayer(0,Vt.ReadOnly),Je=new Vt(u.context.gl.LEQUAL,Vt.ReadOnly,u.depthRangeFor3D),Be=[c.ek(be.center.lng),c.el(be.center.lat)],it=a.layout.get("text-variable-anchor"),Qe=be.projection.name==="globe",ot=[],Et=[0,-1,0];for(const ht of f){const gt=r.getTile(ht),ct=gt.getBucket(a);if(!ct||ct.projection.name==="mercator"&&Qe||ct.fullyClipped)continue;const Ht=ct.projection.name==="globe",Ot=Ht?c.dm(be.zoom):0,Nt=zm(ht,ct.getProjection(),be),$t=be.calculatePixelsToTileUnitsMatrix(gt),an=it&&ct.hasTextData(),nn=ct.hasIconTextFit()&&an&&ct.hasIconData(),xn=ct.getProjection().createInversionMatrix(be,ht.canonical),En=(1<<gt.tileID.canonical.z)*c.r/u.transform.worldSize,qt=Rn=>{let Kt=[0,0,0];if(Rn){const lr=u.style.directionalLight,nr=u.style.ambientLight;lr&&nr&&(Kt=Rc(u.style,lr,nr))}return Kt},fn=Rn=>{if(u.context.disableSymbolUBO)return;Rn.push("USE_PAINT_PROPERTIES_UBO");const Kt=Math.floor(u.context.maxUniformBlockSize/4),lr=Math.floor(Kt/4);Rn.push(`MAX_UBO_SIZE_VEC4 ${lr}u`)},un=Rn=>{be.depthOcclusionForSymbolsAndCircles&&(a.hasOcclusionOpacityProperties||u.terrain)&&(Rn.push("DEPTH_D24"),Rn.push("DEPTH_OCCLUSION"))},Dn=Rn=>{a.lut&&!Ee&&(a.lut.texture||(a.lut.texture=new c.a$(u.context,a.lut.image,[a.lut.image.height,a.lut.image.height,a.lut.image.height],Pe.gl.RGBA8)),Pe.activeTexture.set(Pe.gl.TEXTURE0+10),a.lut.texture&&a.lut.texture.bind(Pe.gl.LINEAR,Pe.gl.CLAMP_TO_EDGE),Rn.push("APPLY_LUT_ON_GPU"))},Jn=()=>{const Rn=Ce&&a.layout.get("symbol-placement")!=="point",Kt=[];un(Kt),Dn(Kt);const lr=Rn||nn,nr=ct.elevationType==="road",si=u.shadowRenderer,Lr=nr&&Oe&&!!si&&si.enabled,co=qt(Lr),yo=nr&&Oe&&!u.terrain?Je:Ne,Co=a.paint.get("icon-image-cross-fade");u.terrainRenderModeElevated()&&Oe&&Kt.push("PITCH_WITH_MAP_TERRAIN"),Ht&&(Kt.push("PROJECTION_GLOBE_VIEW"),lr&&Kt.push("PROJECTED_POS_ON_VIEWPORT")),Co>0&&ct.hasAnySecondaryIcon&&Kt.push("ICON_TRANSITION"),!ct.icon.zOffsetVertexBuffer||nr&&u.terrain||Kt.push("Z_OFFSET"),Q===0&&ce===0&&fe===0&&se===1||Kt.push("COLOR_ADJUSTMENT"),ct.sdfIcons&&Kt.push("RENDER_SDF"),Lr&&Kt.push("RENDER_SHADOWS","NORMAL_OFFSET"),nr&&Oe&&!u.terrain&&ct.icon.orientationVertexBuffer&&Kt.push("ELEVATED_ROADS"),fn(Kt);const sr=Pe.disableSymbolUBO?ct.icon.programConfigurations.get(a.id):null,zr=u.getOrCreateProgram("symbol",{config:sr,defines:Kt}),Ei=gt.imageAtlasTexture?gt.imageAtlasTexture.size:[0,0],di=ct.iconSizeData,Vr=c.ci(di,be.zoom),Hi=Oe||!be.isOrthographic,mr=gf(Nt,gt.tileID.canonical,Oe,Ce,be,ct.getProjection(),$t),br=Ed(Nt,gt.tileID.canonical,Oe,Ce,be,ct.getProjection(),$t),On=ct.icon.uboBinder&&ct.icon.uboBinder.hasPerFeatureTranslate()?[0,0]:k,ai=u.translatePosMatrix(br,gt,On,P,!0),Io=u.translatePosMatrix(Nt,gt,On,P),ur=lr?Qd:mr,no=Ce&&!Oe&&!Rn;let na=Et;!Qe&&!be.mercatorFromTransition||Ce||(na=mv(be));const Mo=Ht?na:Et,hs=a.getColorAdjustmentMatrix(Q,ce,fe,se),ra=Ym(di.kind,Vr,no,Oe,u,Io,ur,ai,Ae,!1,Ei,[0,0],0,ht,Ot,Be,xn,Mo,ct.getProjection(),co,En,hs,Co,null),zs=gt.imageAtlasTexture?gt.imageAtlasTexture:null,ia=a.layout.get("icon-size").constantOr(0)!==1||ct.iconsNeedLinear,Ts=ct.sdfIcons||u.options.rotating||u.options.zooming||ia||Hi?ye.LINEAR:ye.NEAREST,Qa=ct.sdfIcons&&a.paint.get("icon-halo-width").constantOr(1)!==0,ic=u.terrain&&Oe&&Rn?c.dr(c.bT(),mr):Qd;if(Rn&&ct.icon){const oh=c.s.getAtTileOffsetFunc(ht,be.center.lat,be.worldSize,ct.getProjection()),hg=um(Nt,gt.tileID.canonical,Oe,Ce,be,ct.getProjection(),$t),up=a.layout.get("icon-size-scale-range"),Nv=c.bG(u.scaleFactor,up[0],up[1]);Gt(ct,Nt,u,!1,hg,br,Oe,W,oh,ht,Nv)}return{program:zr,buffers:ct.icon,uniformValues:ra,atlasTexture:zs,atlasTextureIcon:null,atlasInterpolation:Ts,atlasInterpolationIcon:null,isSDF:ct.sdfIcons,hasHalo:Qa,depthMode:yo,tile:gt,renderWithShadows:Lr,labelPlaneMatrixInv:ic}},Mr=()=>{const Rn=ze&&a.layout.get("symbol-placement")!=="point",Kt=[],lr=Rn||it||nn,nr=ct.elevationType==="road",si=u.shadowRenderer,Lr=nr&&Ze&&!!si&&si.enabled,co=qt(Lr),yo=nr&&Ze&&!u.terrain?Je:Ne;u.terrainRenderModeElevated()&&Ze&&Kt.push("PITCH_WITH_MAP_TERRAIN"),Ht&&(Kt.push("PROJECTION_GLOBE_VIEW"),lr&&Kt.push("PROJECTED_POS_ON_VIEWPORT")),!ct.text.zOffsetVertexBuffer||nr&&u.terrain||Kt.push("Z_OFFSET"),ct.iconsInText&&Kt.push("RENDER_TEXT_AND_SYMBOL"),Kt.push("RENDER_SDF"),Lr&&Kt.push("RENDER_SHADOWS","NORMAL_OFFSET"),nr&&Ze&&!u.terrain&&ct.text.orientationVertexBuffer&&Kt.push("ELEVATED_ROADS"),un(Kt),fn(Kt);const Co=Pe.disableSymbolUBO?ct.text.programConfigurations.get(a.id):null,sr=u.getOrCreateProgram("symbol",{config:Co,defines:Kt});let zr,Ei=[0,0],di=null;const Vr=ct.textSizeData;ct.iconsInText&&(Ei=gt.imageAtlasTexture?gt.imageAtlasTexture.size:[0,0],di=gt.imageAtlasTexture?gt.imageAtlasTexture:null,zr=Ze||!be.isOrthographic||u.options.rotating||u.options.zooming||Vr.kind==="composite"||Vr.kind==="camera"?ye.LINEAR:ye.NEAREST);const Hi=gt.glyphAtlasTexture?gt.glyphAtlasTexture.size:[0,0],mr=a.layout.get("text-size-scale-range"),br=c.bG(u.scaleFactor,mr[0],mr[1]),On=c.ci(Vr,be.zoom,br),ai=gf(Nt,gt.tileID.canonical,Ze,ze,be,ct.getProjection(),$t),Io=Ed(Nt,gt.tileID.canonical,Ze,ze,be,ct.getProjection(),$t),ur=ct.text.uboBinder&&ct.text.uboBinder.hasPerFeatureTranslate()?[0,0]:A,no=u.translatePosMatrix(Io,gt,ur,D,!0),na=u.translatePosMatrix(Nt,gt,ur,D),Mo=lr?Qd:ai,hs=ze&&!Ze&&!Rn;let ra=Et;!Qe&&!be.mercatorFromTransition||ze||(ra=mv(be));const zs=Ym(Vr.kind,On,hs,Ze,u,na,Mo,no,Ae,!0,Hi,Ei,0,ht,Ot,Be,xn,Ht?ra:Et,ct.getProjection(),co,En,null,null,br),ia=gt.glyphAtlasTexture?gt.glyphAtlasTexture:null,Ts=ye.LINEAR,Qa=a.paint.get("text-halo-width").constantOr(1)!==0,ic=u.terrain&&Ze&&Rn?c.dr(c.bT(),ai):Qd;if(Rn&&ct.text){const oh=c.s.getAtTileOffsetFunc(ht,be.center.lat,be.worldSize,ct.getProjection()),hg=um(Nt,gt.tileID.canonical,Ze,ze,be,ct.getProjection(),$t);Gt(ct,Nt,u,!0,hg,Io,Ze,J,oh,ht,br)}return{program:sr,buffers:ct.text,uniformValues:zs,atlasTexture:ia,atlasTextureIcon:di,atlasInterpolation:Ts,atlasInterpolationIcon:zr,isSDF:!0,hasHalo:Qa,depthMode:yo,tile:gt,renderWithShadows:Lr,labelPlaneMatrixInv:ic}},Hn=ct.icon.segments.get().length,Wn=ct.text.segments.get().length,Fr=Hn&&!w.onlyText?Jn():null,or=Wn&&!w.onlyIcons?Mr():null,ri=a.paint.get("icon-opacity").constantOr(1),Pn=a.paint.get("text-opacity").constantOr(1);if(We&&ct.canOverlap){ut=!0;const Rn=ri&&!w.onlyText?ct.icon.segments.get():[],Kt=Pn&&!w.onlyIcons?ct.text.segments.get():[];for(const lr of Rn)ot.push({segments:new c.aJ([lr]),sortKey:lr.sortKey,state:Fr});for(const lr of Kt)ot.push({segments:new c.aJ([lr]),sortKey:lr.sortKey,state:or})}else w.onlyText||ot.push({segments:ri?ct.icon.segments:new c.aJ([]),sortKey:0,state:Fr}),w.onlyIcons||ot.push({segments:Pn?ct.text.segments:new c.aJ([]),sortKey:0,state:or})}ut&&ot.sort((ht,gt)=>ht.sortKey-gt.sortKey);for(const ht of ot){const gt=ht.state;if(gt)if(u.terrain?u.terrain.setupElevationDraw(gt.tile,gt.program,{useDepthForOcclusion:be.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:gt.labelPlaneMatrixInv}):u.setupDepthForOcclusion(be.depthOcclusionForSymbolsAndCircles,gt.program),Pe.activeTexture.set(ye.TEXTURE0),gt.atlasTexture&>.atlasTexture.bind(gt.atlasInterpolation,ye.CLAMP_TO_EDGE,!0),gt.atlasTextureIcon&&(Pe.activeTexture.set(ye.TEXTURE1),gt.atlasTextureIcon&>.atlasTextureIcon.bind(gt.atlasInterpolationIcon,ye.CLAMP_TO_EDGE,!0)),gt.renderWithShadows&&u.shadowRenderer.setupShadows(gt.tile.tileID.toUnwrapped(),gt.program,"vector-tile"),u.uploadCommonLightUniforms(u.context,gt.program),gt.hasHalo){const ct=gt.uniformValues;ct.u_is_halo=1,gv(gt.buffers,ht.segments,a,u,gt.program,gt.depthMode,_,x,ct,2),ct.u_is_halo=0}else{if(gt.isSDF){const ct=gt.uniformValues;gt.hasHalo&&(ct.u_is_halo=1,gv(gt.buffers,ht.segments,a,u,gt.program,gt.depthMode,_,x,ct,1)),ct.u_is_halo=0}gv(gt.buffers,ht.segments,a,u,gt.program,gt.depthMode,_,x,gt.uniformValues,1)}}}function gv(u,r,a,f,_,x,w,k,A,P){const D=f.context,z=D.gl,F=[u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer,u.iconTransitioningVertexBuffer,u.globeExtVertexBuffer,u.zOffsetVertexBuffer,u.orientationVertexBuffer];u.featureIdBuffer&&F.push(u.featureIdBuffer);const j=u.uboBinder?null:u.programConfigurations.get(a.id);if(u.uboBinder){u.uboBinder.layer=a;const J=f.transform.zoom,Q=f.style.getBrightness?f.style.getBrightness():null,ce=u.uboBinder.getConstantUniformValues(J,Q);A.u_spp_fill_np_color=ce.fill_np_color,A.u_spp_halo_np_color=ce.halo_np_color,A.u_spp_opacity=ce.opacity,A.u_spp_halo_width=ce.halo_width,A.u_spp_halo_blur=ce.halo_blur,A.u_spp_emissive_strength=ce.emissive_strength,A.u_spp_occlusion_opacity=ce.occlusion_opacity,A.u_spp_z_offset=ce.z_offset;const fe=ce.zoomFactors;A.u_spp_fill_color_zoom_factor=fe[0],A.u_spp_halo_color_zoom_factor=fe[1],A.u_spp_opacity_zoom_factor=fe[2],A.u_spp_halo_width_zoom_factor=fe[3],A.u_spp_halo_blur_zoom_factor=fe[4],A.u_spp_emissive_strength_zoom_factor=fe[5],A.u_spp_occlusion_opacity_zoom_factor=fe[6],A.u_spp_z_offset_zoom_factor=fe[7],A.u_spp_translate_zoom_factor=fe[8];const se=a.paint.get(u.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),Ae=u.uboBinder.hasPerFeatureTranslate()&&se==="map"?f.transform.angle:0;A.u_spp_translate_rotation=[Math.cos(Ae),Math.sin(Ae)]}const{batchIndices:$,batchSegments:W}=u.getBatchGrouping(r);for(const J of $){const Q=W.get(J);u.uboBinder&&u.uboBinder.bind(D,_.program,J),_.draw(f,z.TRIANGLES,x,w,k,Ut.disabled,A,a.id,u.layoutVertexBuffer,u.indexBuffer,Q,a.paint,f.transform.zoom,j,F,P)}}function $u(u,r,a,f,_,x){const w=a.paint.get("line-width"),k=a.paint.get("line-emissive-strength").isConstant(),A=a.paint.get("line-emissive-strength").constantOr(0),P=a.paint.get("line-occlusion-opacity"),D=a.layout.get("line-elevation-reference"),z=a.layout.get("line-width-unit")==="meters",F=D==="sea",j=!(!u.terrain||!u.terrain.enabled),$=u.context,W=$.gl;if(a.hasElevatedBuckets&&u.transform.projection.name==="globe")return;const J=a.layout.get("line-cross-slope"),Q=J!==void 0,ce=J<1,fe=_||u.colorModeForDrapableLayerRenderPass(k?A:null),se=u.terrain&&u.terrain.renderingToTexture||x,Ae=se?1:c.co.devicePixelRatio,Ee=a.paint.get("line-dasharray"),Pe=Ee.constantOr(1),ye=a.layout.get("line-cap"),be=Ee.constantOr(null),Ce=ye.constantOr(null),ze=a.paint.get("line-pattern"),Oe=ze.constantOr(1),Ze=a.paint.get("line-pattern-cross-fade"),We=ze.constantOr(null),ut=a.paint.get("line-opacity").constantOr(1);let Ne=!Oe&&ut!==1||u.depthOcclusion&&P>0&&P<1;const Je=a.paint.get("line-gradient"),Be=Oe?"linePattern":"line",it=c.d$(a);let Qe;if(se&&u.terrain&&u.terrain.clipOrMaskOverlapStencilType()&&(Ne=!1),P!==0&&u.depthOcclusion){const Ot=a.paint._values["line-opacity"];Ot&&Ot.value&&Ot.value.kind==="constant"?Qe=Ot.value:c.f_(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}w.value.kind!=="constant"&&w.value.isLineProgressConstant===!1&&it.push("VARIABLE_LINE_WIDTH");const ot=a.paint.get("line-emissive-strength");Oe||ot.value.kind==="constant"||ot.value.isLineProgressConstant!==!1||it.push("VARIABLE_LINE_EMISSIVE_STRENGTH"),u._debugParams.showElevationIdDebug&&it.push("DEBUG_ELEVATION_ID"),se&&(u.emissiveMode!=="dual-source-blending"||k?u.emissiveMode==="mrt-fallback"&&it.push("USE_MRT1"):it.push("DUAL_SOURCE_BLENDING"));const Et={},ht=[],gt=(Ot,Nt,$t,an,nn,xn)=>{for(const En of Ot){const qt=r.getTile(En);if(Oe&&!qt.patternsLoaded())continue;const fn=qt.getBucket(a);if(!fn||fn.elevationType!=="none"&&!nn||fn.elevationType==="none"&&nn)continue;u.prepareDrawTile();const un=[...Nt],Dn=u.shadowRenderer,Jn=fn.elevationType==="road"&&!!Dn&&Dn.enabled;let Mr=[0,0,0];if(Jn){const sr=u.style.directionalLight,zr=u.style.ambientLight;sr&&zr&&(Mr=Rc(u.style,sr,zr)),un.push("RENDER_SHADOWS","NORMAL_OFFSET")}const Hn=fn.programConfigurations.get(a.id);let Wn=!1;if(We&&qt.imageAtlas){const sr=c.aG.from(We),zr=sr.getPrimary().scaleSelf(Ae).toString(),Ei=qt.imageAtlas.patternPositions.get(zr),di=sr.getSecondary(),Vr=di?qt.imageAtlas.patternPositions.get(di.scaleSelf(Ae).toString()):null;Wn=!!Ei&&!!Vr,Ei&&Hn.setConstantPatternPositions(Ei,Vr)}Ze>0&&(Wn||Hn.getPatternTransitionVertexBuffer("line-pattern"))&&un.push("LINE_PATTERN_TRANSITION"),fn.elevationGroundScaleVertexBuffer&&un.push("ELEVATION_GROUND_SCALE");const Fr=u.isTileAffectedByFog(En),or=u.getOrCreateProgram(Be,{config:Hn,defines:un,overrideFog:Fr});if(!Oe&&be&&Ce&&qt.lineAtlas){const sr=qt.lineAtlas.getDash(be,Ce);sr&&Hn.setConstantPatternPositions(sr)}Jn&&Dn.setupShadows(qt.tileID.toUnwrapped(),or,"vector-tile");let[ri,Pn]=a.paint.get("line-trim-offset");(Ce==="round"||Ce==="square")&&ri!==Pn&&(ri===0&&(ri-=1),Pn===1&&(Pn+=1));const Rn=se?En.projMatrix:null,Kt=z?1/fn.tileToMeter/c.eG(qt,1,u.transform.zoom):1,lr=z?1/fn.tileToMeter/c.eG(qt,1,Math.floor(u.transform.zoom)):1,nr=Pe?a.paint._values["line-floorwidth"]:null;let si;if(nr&&nr.value.kind==="constant"){const sr=fn.zoom;sr in Et||(Et[sr]=Math.max(.01,a.widthExpression().evaluate({zoom:sr}))),si=nr.value.value;const zr=Math.floor(u.transform.zoom);nr.value.value=Et[sr]*Math.pow(2,zr-qt.tileID.overscaledZ)}const Lr=Oe?c.e0(u,qt,a,Rn,Ae,Kt,lr,[ri,Pn],Mr,Ze):c.e2(u,qt,a,Rn,fn.lineClipsArray.length,Ae,Kt,lr,[ri,Pn],Mr);if(Je){const sr=fn.gradients[a.id];let zr=sr.texture;if(a.gradientVersion!==sr.version){let Ei=256;if(a.stepInterpolant){const Vr=r.getSource().maxzoom,Hi=En.canonical.z===Vr?Math.ceil(1<<u.transform.maxZoom-En.canonical.z):1;Ei=c.bG(c.ew(fn.maxLineLength/c.r*1024*Hi),256,$.maxTextureSize)}const di=a.paint.get("line-gradient-use-theme").constantOr("default")==="none";sr.gradient=c.e$({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:Ei,image:sr.gradient||void 0,clips:fn.lineClipsArray,lut:di?null:a.lut}),sr.texture?sr.texture.update(sr.gradient):sr.texture=new c.a_($,sr.gradient,W.RGBA8),sr.version=a.gradientVersion,zr=sr.texture}$.activeTexture.set(W.TEXTURE1),zr.bind(a.stepInterpolant?W.NEAREST:W.LINEAR,W.CLAMP_TO_EDGE)}Pe&&($.activeTexture.set(W.TEXTURE0),qt.lineAtlasTexture&&qt.lineAtlasTexture.bind(W.LINEAR,W.REPEAT),Hn.updatePaintBuffers()),Oe&&($.activeTexture.set(W.TEXTURE0),qt.imageAtlasTexture&&qt.imageAtlasTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE),Hn.updatePaintBuffers()),nn&&u.terrain.setupElevationDraw(qt,or),u.uploadCommonUniforms($,or,En.toUnwrapped());const co=Zn.drawLineFrcCoverageDetect?Zn.drawLineFrcCoverageDetect(u,fn,En,nn,Lr,Hn,or,$t,fe,ht):null,yo=(sr,zr,Ei)=>{zr&&zr.get().length!==0&&(Qe!=null&&(Qe.value=ut*P),Ei!==void 0&&(Lr.u_opacity_multiplier=Ei),or.draw(u,W.TRIANGLES,$t,sr,fe,Ut.disabled,Lr,a.id,fn.layoutVertexBuffer,fn.indexBuffer,zr,a.paint,u.transform.zoom,Hn,[fn.layoutVertexBuffer2,fn.patternVertexBuffer,fn.zOffsetVertexBuffer,fn.elevationIdColVertexBuffer,fn.elevationGroundScaleVertexBuffer]),Ei!==void 0&&(Lr.u_opacity_multiplier=1),Qe!=null&&(Qe.value=ut))},Co=sr=>{co&&co.active&&Zn.drawLineFrcRenderLine?Zn.drawLineFrcRenderLine(fn,co,sr,yo):yo(sr,fn.segments)};if(Ne&&!nn){const sr=u.stencilModeForClipping(En).ref;sr===0&&se&&$.clear({stencil:0});const zr={func:W.EQUAL,mask:255};Lr.u_alpha_discard_threshold=.8,Co(new rn(zr,sr,255,W.KEEP,W.KEEP,W.INVERT)),Lr.u_alpha_discard_threshold=0,Co(new rn(zr,sr,255,W.KEEP,W.KEEP,W.KEEP))}else Lr.u_alpha_discard_threshold=Ne&&nn&&xn?.8:0,Co(nn?an:u.stencilModeForClipping(En));co&&Zn.drawLineFrcFadePass&&Zn.drawLineFrcFadePass(u,fn,En,co,nn,an,yo),si!==void 0&&(nr.value.value=si)}};let ct=u.depthModeForSublayer(0,Vt.ReadOnly);const Ht=new Vt(u.depthOcclusion?W.GREATER:W.LEQUAL,Vt.ReadOnly,u.depthRangeFor3D);if(a.hasNonElevatedBuckets){const Ot=!se&&u.terrain;P!==0&&Ot?c.f_(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has line-z-offset enabled.`):Ot?c.f_(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${a.id}.`):gt(f,it,ct,rn.disabled,!1,!0)}if(a.hasElevatedBuckets){D==="hd-road-markup"?j||(ct=Ht,it.push("ELEVATED_ROADS")):(it.push("ELEVATED"),ct=Ht,Q&&it.push(ce?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),F&&it.push("ELEVATION_REFERENCE_SEA"));const Ot=Ne?u.stencilModeFor3D():rn.disabled;u.forceTerrainMode=!0,gt(f,it,ct,Ot,!0,!0),Ne&>(f,it,ct,Ot,!0,!1),u.forceTerrainMode=!1}Zn.drawLineFrcCoverageSecondPass&&Zn.drawLineFrcCoverageSecondPass(u,a,ht),Ne&&(u.resetStencilClippingMasks(),se&&$.clear({stencil:0})),P===0||u.depthOcclusion||se||u.layersWithOcclusionOpacity.push(u.currentLayer)}class r1{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class Rr{constructor(r){this.pbo=r.createBuffer(),this.sync=null,this.fboA=null,this.fboB=null,this.maxDensity=0}destroy(r){this.sync&&(r.deleteSync(this.sync),this.sync=null),r.deleteBuffer(this.pbo),this.fboA&&(this.fboA.destroy(),this.fboA=null),this.fboB&&(this.fboB.destroy(),this.fboB=null)}}const Sn={additive:{clearColor:new c.i(0,0,0,0),colorMode:tn.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new c.i(1,1,1,1),colorMode:tn.multiply,compositeUniformValue:0}};function Xf(u){return!(!u.extRenderToTextureHalfFloat&&!u.extColorBufferFloat)}function ea(u,r){return u==="additive"&&Xf(r)?tn.additiveAlphaWeightedUnboundedAlpha:Sn[u].colorMode}function Hc(u,r,a){const f=u.context,_=f.gl;let x=a.width,w=a.height,k=a.colorAttachment0.get();r.lineBlendDensityReadback||(r.lineBlendDensityReadback=new Rr(_));const A=r.lineBlendDensityReadback;let P=0,D=!0;for(;x>1||w>1;){const j=Math.max(1,Math.floor(x/2)),$=Math.max(1,Math.floor(w/2)),W=P===0?"fboA":"fboB";A[W]=$c.createWithTexture(f,A[W],j,$,!1);const J=A[W];f.bindFramebuffer.set(J.framebuffer),f.viewport.set([0,0,j,$]),f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,k),u.getOrCreateProgram("lineBlendReduce").draw(u,_.TRIANGLES,Vt.disabled,rn.disabled,tn.unblended,Ut.disabled,Aa(0,[1/x,1/w],D),r.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,r.paint,u.transform.zoom),x=j,w=$,k=J.colorAttachment0.get(),P=1-P,D=!1}const z=Xf(f),F=z?16:4;A.sync&&(_.deleteSync(A.sync),A.sync=null),_.bindBuffer(_.PIXEL_PACK_BUFFER,A.pbo),_.bufferData(_.PIXEL_PACK_BUFFER,F,_.STREAM_READ),_.readPixels(0,0,1,1,_.RGBA,z?_.FLOAT:_.UNSIGNED_BYTE,0),_.bindBuffer(_.PIXEL_PACK_BUFFER,null),A.sync=_.fenceSync(_.SYNC_GPU_COMMANDS_COMPLETE,0),f.viewport.set([0,0,u.width,u.height])}function Wc(u,r,a){if(!Xf(u.context))return;const f=r.lineBlendDensityReadback;f&&f.sync?(function(_,x,w){if(_.sync&&x.getSyncParameter(_.sync,x.SYNC_STATUS)===x.SIGNALED){if(x.deleteSync(_.sync),_.sync=null,x.bindBuffer(x.PIXEL_PACK_BUFFER,_.pbo),Xf(w)){const k=new Float32Array(4);x.getBufferSubData(x.PIXEL_PACK_BUFFER,0,k);const A=k[1];_.maxDensity=Math.max(2*(A>0?k[0]/A:0),1)}else _.maxDensity=1;x.bindBuffer(x.PIXEL_PACK_BUFFER,null)}}(f,u.context.gl,u.context),f.sync||(Hc(u,r,a),u.style.map.triggerRepaint())):(Hc(u,r,a),u.style.map.triggerRepaint())}function Xa(u,r,a,f,_,x){const w=u.context,k=w.gl,A=a==="additive"?1:r.paint.get("line-opacity").constantOr(1),P=a==="additive"?function(z,F){const j=F.paint.get("line-blend-additive-clamp");if(j>0)return j;const $=F.lineBlendDensityReadback;return $&&$.maxDensity!==0?$.maxDensity:null}(0,r):1;if(P===null)return;w.bindFramebuffer.set(_),x&&w.viewport.set([0,0,x[0],x[1]]),w.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,f.colorAttachment0.get());const D=ea(a,u.context);u.getOrCreateProgram("lineBlendComposite").draw(u,k.TRIANGLES,Vt.disabled,rn.disabled,D,Ut.disabled,((z,F,j,$)=>({u_image:0,u_opacity:F,u_blend_mode:j,u_max_density:$}))(0,A,Sn[a].compositeUniformValue,P),r.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,r.paint,u.transform.zoom)}function Kf(u,r,a,f){const{painter:_,sourceCache:x,layer:w,coords:k,colorMode:A,elevationType:P,terrainEnabled:D,pass:z}=u,F=_.context.gl,j=w.paint.get("fill-pattern"),$=w.paint.get("fill-pattern-cross-fade"),W=j.constantOr(null);let J=P;P!=="road"||r&&!D||(J="none");const Q=J==="road",ce=u.painter.shadowRenderer,fe=Q&&!!ce&&ce.enabled,se=new Vt(_.context.gl.LEQUAL,Vt.ReadOnly,_.depthRangeFor3D);let Ae=[0,0,0];if(fe){const be=_.style.directionalLight,Ce=_.style.ambientLight;be&&Ce&&(Ae=Rc(_.style,be,Ce))}const Ee=j&&j.constantOr(1),Pe=_.terrain&&_.terrain.renderingToTexture,ye=(be,Ce)=>{let ze,Oe,Ze,We,ut;Ce?(ze=Ee&&!w.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ze=F.LINES):(ze=Ee?"fillPattern":"fill",Ze=F.TRIANGLES);const Ne=[];for(const Je of k){const Be=x.getTile(Je);if(Ee&&!Be.patternsLoaded())continue;const it=Be.getBucket(w);if(!it)continue;const Qe=r?it.hdExt&&it.hdExt.elevationBufferData:it.bufferData;if(!Qe||Qe.isEmpty())continue;_.prepareDrawTile();const ot=Qe.programConfigurations.get(w.id),Et=_.isTileAffectedByFog(Je),ht=[],gt=[];Q&&(ht.push("ELEVATED_ROADS"),gt.push(Qe.elevatedLayoutVertexBuffer)),fe&&ht.push("RENDER_SHADOWS","NORMAL_OFFSET"),Pe&&a&&ht.push("USE_MRT1"),Ee&&(_.context.activeTexture.set(F.TEXTURE0),Be.imageAtlasTexture&&Be.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),ot.updatePaintBuffers());let ct=!1;if(W&&Be.imageAtlas){const xn=Be.imageAtlas,En=c.aG.from(W),qt=En.getPrimary().scaleSelf(c.co.devicePixelRatio).toString(),fn=En.getSecondary(),un=xn.patternPositions.get(qt),Dn=fn?xn.patternPositions.get(fn.scaleSelf(c.co.devicePixelRatio).toString()):null;ct=!!un&&!!Dn,un&&ot.setConstantPatternPositions(un,Dn)}$>0&&(ct||ot.getPatternTransitionVertexBuffer("fill-pattern"))&&ht.push("FILL_PATTERN_TRANSITION");const Ht=_.getOrCreateProgram(ze,{config:ot,overrideFog:Et,defines:ht}),Ot=_.translatePosMatrix(Je.projMatrix,Be,w.paint.get("fill-translate"),w.paint.get("fill-translate-anchor"));fe&&ce.setupShadows(Be.tileID.toUnwrapped(),Ht,"vector-tile");const Nt=w.paint.get("fill-emissive-strength");if(Ce){We=Qe.lineIndexBuffer,ut=Qe.lineSegments;const xn=_.terrain&&_.terrain.renderingToTexture?_.terrain.drapeBufferSize:[F.drawingBufferWidth,F.drawingBufferHeight];Oe=ze==="fillOutlinePattern"&&Ee?ka(Ot,Nt,_,Be,xn,Ae,$):dv(Ot,Nt,xn,Ae)}else We=Qe.indexBuffer,ut=Qe.triangleSegments,Oe=Ee?ju(Ot,Nt,_,Be,Ae,$):Xo(Ot,Nt,Ae);_.uploadCommonUniforms(_.context,Ht,Je.toUnwrapped());let $t=be;if((P==="road"&&!D||P==="offset")&&($t=se),!ut||ut.get&&ut.get().length===0)continue;const an=f||_.stencilModeForClipping(Je);let nn="fallthrough";!Ce&&Zn.drawFillFrcCoverageFirstPass&&(nn=Zn.drawFillFrcCoverageFirstPass({painter:_,layer:w,bucket:it,coord:Je,elevatedGeometry:r,program:Ht,programConfiguration:ot,uniformValues:Oe,drawMode:Ze,depthMode:$t,stencilMode:an,colorMode:A,bufferData:Qe,indexBuffer:We,segments:ut,dynamicBuffers:gt,polygonCoverageTiles:Ne})),nn==="fallthrough"&&Ht.draw(_,Ze,$t,an,A,Ut.disabled,Oe,w.id,Qe.layoutVertexBuffer,We,ut,w.paint,_.transform.zoom,ot,gt)}!Ce&&Zn.drawFillFrcCoverageSecondPass&&Zn.drawFillFrcCoverageSecondPass(_,w,Ne,Ze,A)};_.renderPass===z&&ye(_.depthModeForSublayer(1,_.renderPass==="opaque"?Vt.ReadWrite:Vt.ReadOnly),!1),J==="none"&&_.renderPass==="translucent"&&w.paint.get("fill-antialias")&&ye(_.depthModeForSublayer(w.getPaintProperty("fill-outline-color")?2:0,Vt.ReadOnly),!0)}function Qm(u){return[u[0]*c.C,u[1]*c.C,u[2]*c.C,0]}function Yf(u,r,a,f,_,x,w,k,A){const P=f.getSource(),D=a.globeSharedBuffers;if(!D)return;let z,F,j;if(r&&(z=f.getTile(r)),P instanceof c.a3?(F=P.texture,j=c.dj(0,0,a.transform)):z&&r&&(F=z.texture,j=c.dj(r.canonical.z,r.canonical.x,a.transform)),!F||!j)return;u||(j=c.fc(c.bT(),j,[1,-1,1]));const $=a.context,W=$.gl,J=_.paint.get("raster-resampling")==="nearest"?W.NEAREST:W.LINEAR,Q=a.colorModeForDrapableLayerRenderPass(x),ce=w.defines;ce.push("GLOBE_POLES");const fe=new Vt(W.LEQUAL,Vt.ReadWrite,a.depthRangeFor3D),se=a.transform.expandedFarZProjMatrix,Ae=Float32Array.from(c.dh(c.dk(new c.f(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),$.activeTexture.set(W.TEXTURE0),F.bind(J,W.CLAMP_TO_EDGE),$.activeTexture.set(W.TEXTURE1),F.bind(J,W.CLAMP_TO_EDGE),"useMipmap"in F&&$.extTextureFilterAnisotropic&&a.transform.pitch>20&&W.texParameterf(W.TEXTURE_2D,$.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,$.extTextureFilterAnisotropicMax);const[Ee,Pe,ye,be]=r?D.getPoleBuffers(r.canonical.z,!1):D.getPoleBuffers(0,!0),Ce=_.paint.get("raster-elevation");let ze;u?(ze=Ee,a.renderDefaultNorthPole=Ce!==0):(ze=Pe,a.renderDefaultSouthPole=Ce!==0);const Oe=Qm(w.mix),Ze=((ut,Ne,Je,Be,it,Qe,ot,Et,ht,gt,ct,Ht,Ot,Nt)=>ec(ut,Ne,Je,Be,new Float32Array(16),new Float32Array(9),[0,0],it,[0,0],[0,0,0,0],1,{opacity:1,mix:0},ot,[0,0],ht,2,ct,Ht,Ot,1,0,Nt))(a,se,Ae,j,c.dm(a.transform.zoom),0,_,0,Ce,0,Oe,w.offset,w.range,x),We=a.getOrCreateProgram("raster",{defines:ce});a.uploadCommonUniforms($,We,null),We.draw(a,W.TRIANGLES,fe,A,Q,k,Ze,_.id,ze,ye,be)}function _v(u){if(u.isOrthographic)return[0,0,0,0];const r=u._nearZ,a=u.projection.farthestPixelDistance(u),f=a-r,_=.2*u.height,x=r+_;return[r,a,(x-_-r)/f,(x-r)/f]}function yv(u,r,a,f){if(u)return r instanceof Du&&u instanceof gm?r.getTextureDescriptor(u,a,!0):{texture:u.texture,mix:Qm(f.mix),offset:f.offset,buffer:0,tileSize:1}}const Ca=c.dq(new Float32Array(16)),qc=new c.i(1,0,0,1),Jd=new c.i(0,1,0,1),Jm=new c.i(0,0,1,1),vv=new c.i(1,0,1,1),xv=new c.i(0,1,1,1);function nc(u,r,a,f,_,x,w){const k=u.context,A=u.transform,P=k.gl,D=A.projection.name==="globe",z=D?["PROJECTION_GLOBE_VIEW"]:[];let F=c.bJ(a.projMatrix);if(D&&c.dm(A.zoom)>0){const Oe=c.fP(a.canonical,A),Ze=c.de(Oe);F=c.er(new Float32Array(16),A.globeMatrix,Ze),c.er(F,A.projMatrix,F)}const j=c.bT();j[12]+=2*_/(c.co.devicePixelRatio*A.width),j[13]+=2*x/(c.co.devicePixelRatio*A.height),c.er(F,j,F);const $=u.getOrCreateProgram("debug",{defines:z}),W=r.getTileByID(a.key);u.terrain&&u.terrain.setupElevationDraw(W,$);const J=Vt.disabled,Q=rn.disabled,ce=u.colorModeForRenderPass(),fe="$debug";k.activeTexture.set(P.TEXTURE0),u.emptyTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),D?W._makeGlobeTileDebugBuffers(u.context,A):W._makeDebugTileBoundsBuffers(u.context,A.projection);const se=W._tileDebugBuffer||u.debugBuffer,Ae=W._tileDebugIndexBuffer||u.debugIndexBuffer,Ee=W._tileDebugSegments||u.debugSegments;if($.draw(u,P.LINE_STRIP,J,Q,ce,Ut.disabled,Fd(F,f.toPremultipliedRenderColor(null)),fe,se,Ae,Ee,null,null,null,[W._globeTileDebugBorderBuffer]),w){const Oe=W.latestRawTileData,Ze=Math.floor((Oe&&Oe.byteLength||0)/1024);let We=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(We+=` => ${a.overscaledZ}`),We+=` ${W.state}`,We+=` ${Ze}kb`,function(ut,Ne){ut.initDebugOverlayCanvas();const Je=ut.debugOverlayCanvas,Be=ut.context.gl,it=ut.debugOverlayCanvas.getContext("2d");it.clearRect(0,0,Je.width,Je.height),it.shadowColor="white",it.shadowBlur=2,it.lineWidth=1.5,it.strokeStyle="white",it.textBaseline="top",it.font="bold 36px Open Sans, sans-serif",it.fillText(Ne,5,5),it.strokeText(Ne,5,5),ut.debugOverlayTexture.update(Je),ut.debugOverlayTexture.bind(Be.LINEAR,Be.CLAMP_TO_EDGE)}(u,We)}const Pe=r.getTile(a).tileSize,ye=512/Math.min(Pe,512)*(a.overscaledZ/A.zoom)*.5,be=W._tileDebugTextBuffer||u.debugBuffer,Ce=W._tileDebugTextIndexBuffer||u.quadTriangleIndexBuffer,ze=W._tileDebugTextSegments||u.debugSegments;$.draw(u,P.TRIANGLES,J,Q,tn.alphaBlended,Ut.disabled,Fd(F,c.i.transparent.toPremultipliedRenderColor(null),ye),fe,be,Ce,ze,null,null,null,[W._globeTileDebugTextBuffer])}function eg(u,r,a,f){eh(u,0,r+a/2,u.transform.width,a,f)}function ta(u,r,a,f){eh(u,r-a/2,0,a,u.transform.height,f)}function eh(u,r,a,f,_,x){const w=u.context,k=w.gl;k.enable(k.SCISSOR_TEST),k.scissor(r*c.co.devicePixelRatio,a*c.co.devicePixelRatio,f*c.co.devicePixelRatio,_*c.co.devicePixelRatio),w.clear({color:x}),k.disable(k.SCISSOR_TEST)}const tg=c.b_([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:bv}=tg;function Al(u,r,a,f){u.emplaceBack(r,a,f)}class _i{constructor(r){this.vertexArray=new c.aS,this.indices=new c.aT,Al(this.vertexArray,-1,-1,1),Al(this.vertexArray,1,-1,1),Al(this.vertexArray,-1,1,1),Al(this.vertexArray,1,1,1),Al(this.vertexArray,-1,-1,-1),Al(this.vertexArray,1,-1,-1),Al(this.vertexArray,-1,1,-1),Al(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=r.createVertexBuffer(this.vertexArray,bv),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=c.aJ.simpleSegment(0,0,36,12)}}function Zc(u,r,a,f,_,x){const w=u.context.gl,k=r.paint.get("sky-atmosphere-color"),A=r.paint.get("sky-atmosphere-halo-color"),P=r.paint.get("sky-atmosphere-sun-intensity"),D=((z,F,j,$,W)=>({u_matrix_3f:z,u_sun_direction:F,u_sun_intensity:j,u_color_tint_r:[$.r,$.g,$.b,$.a],u_color_tint_m:[W.r,W.g,W.b,W.a],u_luminance:5e-5}))(c.cs(c.bV(),f),_,P,k.toPremultipliedRenderColor(null),A.toPremultipliedRenderColor(null));w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+x,r.skyboxTexture,0),a.draw(u,w.TRIANGLES,Vt.disabled,rn.disabled,tn.unblended,Ut.frontCW,D,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const wv=c.b_([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Sv{constructor(r){const a=new c.aU;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);const f=new c.aT;f.emplaceBack(0,1,2),f.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,wv.members),this.indexBuffer=r.createIndexBuffer(f),this.segments=c.aJ.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Hu=c.b_([{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_opacity",components:1}]);class Tv{constructor(){this.colorModeAlphaBlendedWriteRGB=new tn([1,vl,1,vl],c.i.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new tn([1,0,1,0],c.i.transparent,[!1,!1,!1,!0]),this.params={starsCount:16e3,sizeMultiplier:.15,sizeRange:100,intensityRange:200},this.updateNeeded=!0,this._painter=null,this._devtoolsFolder=null}update(r){this._painter=r;const a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Sv(a);let f=this.params;const _=f.sizeRange,x=f.intensityRange,w=function(z){const F=c.eq(30),j=[];for(let $=0;$<z;++$){const W=2*Math.PI*F(),J=Math.acos(1-2*F())-.5*Math.PI;j.push(c.cx(Math.cos(J)*Math.cos(W),Math.cos(J)*Math.sin(W),Math.sin(J)))}return j}(f.starsCount),k=c.eq(300),A=new c.aV,P=new c.aT;let D=0;for(let z=0;z<w.length;++z){const F=c.fa([],w[z],200),j=Math.max(0,1+.01*_*(1*k()-.5)),$=Math.max(0,1+.01*x*(1*k()-.5));A.emplaceBack(F[0],F[1],F[2],-1,-1,j,$),A.emplaceBack(F[0],F[1],F[2],1,-1,j,$),A.emplaceBack(F[0],F[1],F[2],1,1,j,$),A.emplaceBack(F[0],F[1],F[2],-1,1,j,$),P.emplaceBack(D+0,D+1,D+2),P.emplaceBack(D+0,D+2,D+3),D+=4}this.starsVx=a.createVertexBuffer(A,Hu.members),this.starsIdx=a.createIndexBuffer(P),this.starsSegments=c.aJ.simpleSegment(0,0,A.length,P.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(r,a){const f=r.context,_=f.gl,x=r.transform,w=new Vt(_.LEQUAL,Vt.ReadOnly,[0,1]),k=c.dm(x.zoom),A=r.style.getLut(a.scope),P=a.properties.get("color-use-theme")==="none",D=a.properties.get("color").toNonPremultipliedRenderColor(P?null:A),z=a.properties.get("high-color-use-theme")==="none",F=a.properties.get("high-color").toNonPremultipliedRenderColor(z?null:A),j=a.properties.get("space-color-use-theme")==="none",$=a.properties.get("space-color").toNonPremultipliedRenderColor(j?null:A),W=5e-4,J=c.ec(a.properties.get("horizon-blend"),0,1,W,.25),Q=c.dn(r,f,x)&&J===W?x.worldSize/(2*Math.PI*1.025)-1:x.globeRadius,ce=r.frameCounter/1e3%1,fe=c.dW(x.globeCenterInViewSpace),se=Math.sqrt(Math.pow(fe,2)-Math.pow(Q,2)),Ae=Math.acos(se/fe),Ee=Pe=>{const ye=x.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Pe&&ye.push("ALPHA_PASS");const be=r.getOrCreateProgram("globeAtmosphere",{defines:ye}),Ce=((Oe,Ze,We,ut,Ne,Je,Be,it,Qe,ot,Et,ht)=>({u_frustum_tl:Oe,u_frustum_tr:Ze,u_frustum_br:We,u_frustum_bl:ut,u_horizon:Ne,u_transition:Je,u_fadeout_range:Be,u_atmosphere_fog_color:it.toArray01(),u_high_color:Qe.toArray01(),u_space_color:ot.toArray01(),u_temporal_offset:Et,u_horizon_angle:ht}))(x.frustumCorners.TL,x.frustumCorners.TR,x.frustumCorners.BR,x.frustumCorners.BL,x.frustumCorners.horizon,k,J,D,F,$,ce,Ae);r.uploadCommonUniforms(f,be);const ze=this.atmosphereBuffer;ze&&be.draw(r,_.TRIANGLES,w,rn.disabled,Pe?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Ut.backCW,Ce,Pe?"atmosphere_glow_alpha":"atmosphere_glow",ze.vertexBuffer,ze.indexBuffer,ze.segments)};Ee(!1),Ee(!0)}drawStars(r,a){const f=c.bG(a.properties.get("star-intensity"),0,1);if(f===0)return;const _=r.context,x=_.gl,w=r.transform,k=r.getOrCreateProgram("stars"),A=c.dp([]);c.f2(A,A,-w._pitch),c.f5(A,A,-w.angle),c.f2(A,A,c.c4(w._center.lat)),c.f4(A,A,-c.c4(w._center.lng));const P=c.ct(new Float32Array(16),A),D=c.er([],w.starsProjMatrix,P),z=c.cs([],P),F=c.dt([],z);let j=this.params.sizeMultiplier;const $=[0,1,0];c.fK($,$,F),c.fa($,$,j);const W=[1,0,0];c.fK(W,W,F),c.fa(W,W,j);const J=(Q=$,ce=W,fe=f,{u_matrix:Float32Array.from(D),u_up:Q,u_right:ce,u_intensity_multiplier:fe});var Q,ce,fe;r.uploadCommonUniforms(_,k),this.starsVx&&this.starsIdx&&k.draw(r,x.TRIANGLES,Vt.disabled,rn.disabled,this.colorModeAlphaBlendedWriteRGB,Ut.disabled,J,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Ev{constructor(){this.visibleTiles=[]}updateBorders(r,a){const f=[],_=[],x=r._getRenderableCoordinates(!1,!0);for(const A of x){const P=r.getTile(A);if(!P.hasData())continue;const D=P.getBucket(a);D&&(D.isEmpty()||(f.push(A.key),_.push({bucket:D,tileID:A.canonical})))}let w=f.length!==this.visibleTiles.length;if(!w){f.sort();for(let A=0;A<f.length;A++)if(f[A]!==this.visibleTiles[A]){w=!0;break}}if(!w)return;const k=new Set;this.visibleTiles=f,_.sort((A,P)=>A.tileID.z-P.tileID.z||A.tileID.x-P.tileID.x||A.tileID.y-P.tileID.y);for(const A of _){const P=new Array,D=new Array,z=A.bucket;for(const F of z.featuresOnBorder)k.has(F.featureId)?D.push(F.footprintIndex):(k.add(F.featureId),P.push(F.footprintIndex));z.updateFootprintHiddenFlags(P,c.B,!1),z.updateFootprintHiddenFlags(D,c.B,!0)}}}class kv{}class Wu{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,f){{const z=this._storage.get(a.id);if(z)return z.lastUsedFrameIdx=r,z.buf}const _=f.gl,x=_.getBufferParameter(_.ELEMENT_ARRAY_BUFFER,_.BUFFER_SIZE),w=new ArrayBuffer(x),k=new Int16Array(w);_.getBufferSubData(_.ELEMENT_ARRAY_BUFFER,0,new Int16Array(w));const A=new c.aR;for(let z=0;z<x/2;z+=3){const F=k[z],j=k[z+1],$=k[z+2];A.emplaceBack(F,j),A.emplaceBack(j,$),A.emplaceBack($,F)}const P=f.bindVertexArrayOES.current,D=new kv;return D.buf=new tc(f,A),D.lastUsedFrameIdx=r,this._storage.set(a.id,D),f.bindVertexArrayOES.set(P),D.buf}update(r){for(const[a,f]of this._storage)r-f.lastUsedFrameIdx>30&&(f.buf.destroy(),this._storage.delete(a))}destroy(){for(const[r,a]of this._storage)a.buf.destroy(),this._storage.delete(r)}}class Av{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Cl={symbol:function(u,r,a,f,_){if(u.renderPass!=="translucent")return;const x=rn.disabled,w=u.colorModeForRenderPass(),k=a.layout.get("text-variable-anchor"),A=a.layout.get("text-size-scale-range"),P=c.bG(u.scaleFactor,A[0],A[1]);k&&function(F,j,$,W,J,Q,ce,fe){const se=j.transform,Ae=J==="map",Ee=Q==="map";for(const Pe of F){const ye=W.getTile(Pe),be=ye.getBucket($);if(!be||!be.text||!be.text.segments.get().length)continue;const Ce=c.ci(be.textSizeData,se.zoom,fe),ze=zm(Pe,be.getProjection(),se),Oe=se.calculatePixelsToTileUnitsMatrix(ye),Ze=gf(ze,ye.tileID.canonical,Ee,Ae,se,be.getProjection(),Oe),We=be.hasIconTextFit()&&be.hasIconData();Ce&&Js(be,Ae,Ee,ce,se,Ze,Pe,Math.pow(2,se.zoom-ye.tileID.overscaledZ),Ce,We)}}(f,u,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),_,P);const D=a.paint.get("icon-opacity").constantOr(1)!==0,z=a.paint.get("text-opacity").constantOr(1)!==0;a.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(D||z)?Ls(u,r,a,f,x,w):(D&&Ls(u,r,a,f,x,w,{onlyIcons:!0}),z&&Ls(u,r,a,f,x,w,{onlyText:!0})),r.map.showCollisionBoxes&&(n1(u,r,a,f,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),n1(u,r,a,f,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(u,r,a,f){if(u.renderPass!=="translucent")return;const _=a.paint.get("circle-opacity"),x=a.paint.get("circle-stroke-width"),w=a.paint.get("circle-stroke-opacity"),k=a.layout.get("circle-sort-key").constantOr(1)!==void 0,A=a.paint.get("circle-emissive-strength");if(_.constantOr(1)===0&&(x.constantOr(1)===0||w.constantOr(1)===0))return;const P=u.context,D=P.gl,z=u.transform,F=!(!u.terrain||!u.terrain.enabled),j=a.layout.get("circle-elevation-reference"),$=u.depthModeForSublayer(0,Vt.ReadOnly),W=new Vt(u.context.gl.LEQUAL,Vt.ReadOnly,u.depthRangeFor3D),J=j==="none"||F?$:W,Q=rn.disabled,ce=u.colorModeForDrapableLayerRenderPass(A),fe=z.projection.name==="globe",se=[c.ek(z.center.lng),c.el(z.center.lat)],Ae=[];for(let Pe=0;Pe<f.length;Pe++){const ye=f[Pe],be=r.getTile(ye),Ce=be.getBucket(a);if(!Ce||Ce.projection.name!==z.projection.name)continue;const ze=Ce.programConfigurations.get(a.id),Oe=Ce.layoutVertexBuffer,Ze=Ce.globeExtVertexBuffer,We=Ce.indexBuffer,ut=c.bC(a),Ne=[Ze],Je=u.isTileAffectedByFog(ye);fe&&ut.push("PROJECTION_GLOBE_VIEW"),ut.push("DEPTH_D24"),u.terrain&&z.depthOcclusionForSymbolsAndCircles&&ut.push("DEPTH_OCCLUSION"),Ce.hdExt&&Ce.hdExt.hasElevation&&!u.terrain&&(ut.push("ELEVATED_ROADS"),Ne.push(Ce.hdExt.elevatedLayoutVertexBuffer));const Be=u.getOrCreateProgram("circle",{config:ze,defines:ut,overrideFog:Je}),it=z.projection.createInversionMatrix(z,ye.canonical),Qe={programConfiguration:ze,program:Be,layoutVertexBuffer:Oe,dynamicBuffers:Ne,indexBuffer:We,uniformValues:c.bD(u,ye,be,it,se,a),tile:be};if(k){const ot=Ce.segments.get();for(const Et of ot)Ae.push({segments:new c.aJ([Et]),sortKey:Et.sortKey,state:Qe})}else Ae.push({segments:Ce.segments,sortKey:0,state:Qe})}k&&Ae.sort((Pe,ye)=>Pe.sortKey-ye.sortKey);const Ee={useDepthForOcclusion:z.depthOcclusionForSymbolsAndCircles};for(const Pe of Ae){const{programConfiguration:ye,program:be,layoutVertexBuffer:Ce,dynamicBuffers:ze,indexBuffer:Oe,uniformValues:Ze,tile:We}=Pe.state,ut=Pe.segments;u.terrain&&u.terrain.setupElevationDraw(We,be,Ee),u.uploadCommonUniforms(P,be,We.tileID.toUnwrapped()),be.draw(u,D.TRIANGLES,J,Q,ce,Ut.disabled,Ze,a.id,Ce,Oe,ut,a.paint,z.zoom,ye,ze)}},heatmap:function(u,r,a,f){if(a.paint.get("heatmap-opacity")!==0)if(u.renderPass==="offscreen"){const _=u.context,x=_.gl,w=rn.disabled,k=new tn([x.ONE,x.ONE,x.ONE,x.ONE],c.i.transparent,[!0,!0,!0,!0]),A=u.transform.projection.name==="globe"?.5:.25;a.heatmapFbo=$c.createWithTexture(_,a.heatmapFbo,u.width*A,u.height*A),_.clear({color:c.i.transparent});const P=u.transform,D=P.projection.name==="globe",z=D?["PROJECTION_GLOBE_VIEW"]:[],F=D?Ut.frontCCW:Ut.disabled,j=[c.ek(P.center.lng),c.el(P.center.lat)];for(let $=0;$<f.length;$++){const W=f[$];if(r.hasRenderableParent(W))continue;const J=r.getTile(W),Q=J.getBucket(a);if(!Q||Q.projection.name!==P.projection.name)continue;const ce=u.isTileAffectedByFog(W),fe=Q.programConfigurations.get(a.id),se=u.getOrCreateProgram("heatmap",{config:fe,defines:z,overrideFog:ce}),{zoom:Ae}=u.transform;u.terrain&&u.terrain.setupElevationDraw(J,se),u.uploadCommonUniforms(_,se,W.toUnwrapped());const Ee=P.projection.createInversionMatrix(P,W.canonical);se.draw(u,x.TRIANGLES,Vt.disabled,w,k,F,hv(u,W,J,Ee,j,Ae,a.paint.get("heatmap-intensity")),a.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,a.paint,u.transform.zoom,fe,D?[Q.globeExtVertexBuffer]:null)}_.viewport.set([0,0,u.width,u.height])}else u.renderPass==="translucent"&&(u.context.setColorMode(u.colorModeForRenderPass()),function(_,x){const w=_.context,k=w.gl,A=x.heatmapFbo;if(!A)return;w.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,A.colorAttachment0.get()),w.activeTexture.set(k.TEXTURE1);let P=x.colorRampTexture;P||(P=x.colorRampTexture=new c.a_(w,x.colorRamp,k.RGBA8)),P.bind(k.LINEAR,k.CLAMP_TO_EDGE),_.getOrCreateProgram("heatmapTexture").draw(_,k.TRIANGLES,Vt.disabled,rn.disabled,_.colorModeForRenderPass(),Ut.disabled,((D,z)=>({u_image:0,u_color_ramp:1,u_opacity:z.paint.get("heatmap-opacity")}))(0,x),x.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments,x.paint,_.transform.zoom)}(u,a))},line:function(u,r,a,f){const _=a.paint.get("line-opacity"),x=a.paint.get("line-width");if(_.constantOr(1)===0||x.constantOr(1)===0)return;const w=a.paint.get("line-blend-mode"),k=u.terrain&&u.terrain.renderingToTexture;if(w==="default"||u.transform.projection.name==="globe")u.renderPass==="translucent"&&$u(u,r,a,f);else{if(k)return void function(A,P,D,z,F){if(A.renderPass!=="translucent")return;const j=A.context,$=j.gl,W=A.terrain;if(!W)return;const J=j.bindFramebuffer.current,Q=A.emissiveMode==="mrt-fallback",ce=W.drapeBufferSize[0],fe=W.drapeBufferSize[1];D.lineBlendFbos||(D.lineBlendFbos=new r1),D.lineBlendFbos.drapeFbo=$c.createWithTexture(j,D.lineBlendFbos.drapeFbo,ce,fe,!0),Q&&$.drawBuffers([$.COLOR_ATTACHMENT0]),j.clear({color:Sn[F].clearColor,depth:1,stencil:0});const se=A.currentStencilSource,Ae=A._tileClippingMaskIDs,Ee=A.nextStencilID;A.currentStencilSource=void 0,A._tileClippingMaskIDs={},A.nextStencilID=1;const Pe=A._terrain;A._terrain=null,A._renderTileClippingMasks(D,P,z),$u(A,P,D,z,ea(F,A.context),!0),A._terrain=Pe,A.currentStencilSource=se,A._tileClippingMaskIDs=Ae,A.nextStencilID=Ee,Q&&$.drawBuffers([$.COLOR_ATTACHMENT0,$.COLOR_ATTACHMENT1]);const ye=W.drapeBufferSize,be=D.lineBlendFbos&&D.lineBlendFbos.drapeFbo;be&&(F==="additive"&&Wc(A,D,be),Xa(A,D,F,be,J,ye))}(u,r,a,f,w);if(u.renderPass==="offscreen")return void function(A,P,D,z,F){const j=A.context,$=Math.ceil(A.width),W=Math.ceil(A.height);D.lineBlendFbos||(D.lineBlendFbos=new r1),D.lineBlendFbos.fbo=$c.createWithTexture(j,D.lineBlendFbos.fbo,$,W,!0),j.clear({color:Sn[F].clearColor,depth:1,stencil:0});const J=A.currentStencilSource,Q=A._tileClippingMaskIDs,ce=A.nextStencilID;A.currentStencilSource=void 0,A._tileClippingMaskIDs={},A.nextStencilID=1,A._renderTileClippingMasks(D,P,z);const fe=A.renderPass;A.renderPass="translucent",$u(A,P,D,z,ea(F,A.context)),A.renderPass=fe,A.currentStencilSource=J,A._tileClippingMaskIDs=Q,A.nextStencilID=ce,j.viewport.set([0,0,A.width,A.height]),F==="additive"&&Wc(A,D,D.lineBlendFbos.fbo)}(u,r,a,f,w);if(u.renderPass==="translucent"){const A=a.lineBlendFbos&&a.lineBlendFbos.fbo;return void(A&&Xa(u,a,w,A,null))}}},fill:function(u,r,a,f){const _=a.paint.get("fill-color"),x=a.paint.get("fill-opacity");if(x.constantOr(1)===0)return;const w=a.paint.get("fill-emissive-strength"),k=u.colorModeForDrapableLayerRenderPass(w),A=a.paint.get("fill-pattern"),P=u.opaquePassEnabledForLayer()&&!A.constantOr(1)&&_.constantOr(c.i.transparent).a===1&&x.constantOr(0)===1?"opaque":"translucent";let D="none";a.layout.get("fill-elevation-reference")!=="none"?D="road":a.paint.get("fill-z-offset").constantOr(1)!==0&&(D="offset");const z=!(!u.terrain||!u.terrain.enabled),F={painter:u,sourceCache:r,layer:a,coords:f,colorMode:k,elevationType:D,terrainEnabled:z,pass:P};if(u.renderPass==="shadow")return void(u.shadowRenderer&&D==="road"&&!z&&Zn.drawElevatedFillShadows&&Zn.drawElevatedFillShadows(F));const j=u.emissiveMode==="mrt-fallback";if(D!=="offset"){if(Kf(F,!1,j),D==="road"){const $=!z&&u.renderPass==="translucent";$&&Zn.drawDepthPrepass&&Zn.drawDepthPrepass(u,r,a,f,"geometry"),Kf(F,!0,j,rn.disabled),$&&Zn.drawElevatedStructures&&Zn.drawElevatedStructures(F)}}else Kf(F,!1,j,u.stencilModeFor3D())},"fill-extrusion":function(u,r,a,f){const _=a.paint.get("fill-extrusion-opacity"),x=u.context,w=x.gl,k=u.terrain,A=k&&k.renderingToTexture;if(_===0)return;const P=u.emissiveMode==="mrt-fallback",D=u.conflationActive&&u.style.isLayerClipped(a,r.getSource()),z=u.style.order.indexOf(a.fqid);if(D&&function(F,j,$,W,J){for(const Q of W){const ce=j.getTile(Q).getBucket($);ce&&(ce.updateReplacement(Q,F.replacementSource,J),ce.uploadCentroid(F.context))}}(u,r,a,f,z),k||D)for(const F of f){const j=r.getTile(F).getBucket(a);j&&bs(u.context,r,F,j,a,k,D)}if(u.renderPass==="shadow"&&u.shadowRenderer){if(k&&_<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof c.bh)return;const F=u.shadowRenderer.getShadowPassDepthMode();pm(u,r,a,f,F,rn.disabled,tn.disabled,D)}else if(u.renderPass==="translucent"){const F=!a.paint.get("fill-extrusion-pattern").constantOr(1),j=a.paint.get("fill-extrusion-color").constantOr(c.i.white);if(!A&&j.a!==0){const $=new Vt(u.context.gl.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D);_===1&&F?pm(u,r,a,f,$,rn.disabled,tn.unblended,D):(pm(u,r,a,f,$,rn.disabled,tn.disabled,D),pm(u,r,a,f,$,u.stencilModeFor3D(),u.colorModeForRenderPass(),D),u.resetStencilClippingMasks())}if(u.style.enable3dLights()&&F&&(!k&&u.transform.projection.name!=="globe"||A)){const $=a.paint.get("fill-extrusion-opacity"),W=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),J=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Q=a.paint.get("fill-extrusion-flood-light-intensity"),ce=a.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",fe=a.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ce?null:a.lut).toArray01().slice(0,3),se=W>0&&J>0,Ae=Q>0,Ee=new bl;Ee.translate=a.paint.get("fill-extrusion-translate"),Ee.translateAnchor=a.paint.get("fill-extrusion-translate-anchor"),Ee.edgeRadius=a.layout.get("fill-extrusion-edge-radius"),Ee.cutoffFadeRange=a.paint.get("fill-extrusion-cutoff-fade-range");const Pe=ye=>{const be=u.depthModeForSublayer(1,Vt.ReadOnly,w.LEQUAL,!0),Ce=a.paint.get(ye?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ze=c.dY(.1,3,Ce),Oe=u._showOverdrawInspector;if(!Oe){const Ze=new rn({func:w.ALWAYS,mask:255},255,255,w.KEEP,w.KEEP,w.REPLACE),We=new tn([w.ONE,w.ONE,w.ONE,w.ONE],c.i.transparent,[!1,!1,!1,!0],w.MIN);$a(Ee,u,r,a,f,be,Ze,We,Ut.disabled,ye,"sdf",$,W,J,Q,fe,ze,D,!1)}{const Ze=Oe?rn.disabled:new rn({func:w.EQUAL,mask:255},255,255,w.KEEP,w.DECR,w.DECR),We=Oe?u.colorModeForRenderPass():new tn([w.ONE_MINUS_DST_ALPHA,w.DST_ALPHA,w.ONE,w.ONE],c.i.transparent,[!0,!0,!0,!0]);$a(Ee,u,r,a,f,be,Ze,We,Ut.disabled,ye,"color",$,W,J,Q,fe,ze,D,!1)}};if(A){const ye=()=>{const Ce=k.drapeBufferSize[0],ze=k.drapeBufferSize[1];let Oe=k.framebufferCopyTexture;return Oe&&(!Oe||Oe.size[0]===Ce&&Oe.size[1]===ze)||(Oe&&Oe.destroy(),Oe=k.framebufferCopyTexture=new c.a_(x,new c.ay({width:Ce,height:ze}),w.RGBA8)),Oe.bind(w.LINEAR,w.CLAMP_TO_EDGE),w.copyTexSubImage2D(w.TEXTURE_2D,0,0,0,0,0,Ce,ze),Oe},be=(Ce,ze,Oe)=>{const Ze=u.depthModeForSublayer(1,Vt.ReadOnly,w.LEQUAL,!1),We=a.paint.get(Ce?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ut=c.dY(.1,3,We);{const Ne=new tn([w.ONE,w.ONE,w.ONE,w.ONE],c.i.transparent,[!1,!1,!1,!0]);$a(Ee,u,r,a,f,Ze,rn.disabled,Ne,Ut.disabled,Ce,"clear",$,W,J,Q,fe,ut,D,ze)}{const Ne=new rn({func:w.ALWAYS,mask:255},255,255,w.KEEP,w.KEEP,w.REPLACE),Je=new tn([w.ONE,w.ONE,w.ONE,w.ONE],c.i.transparent,[!1,!1,!1,!0],w.MIN);$a(Ee,u,r,a,f,Ze,Ne,Je,Ut.disabled,Ce,"sdf",$,W,J,Q,fe,ut,D,ze)}P&&!Ce&&(Oe=ye());{const Ne=Ce?w.ZERO:w.ONE_MINUS_DST_ALPHA,Je=new rn({func:w.EQUAL,mask:255},255,255,w.KEEP,w.DECR,w.DECR),Be=new tn([Ne,w.DST_ALPHA,w.ONE_MINUS_DST_ALPHA,w.ZERO],c.i.transparent,[!0,!0,!0,!0]);$a(Ee,u,r,a,f,Ze,Je,Be,Ut.disabled,Ce,"color",$,W,J,Q,fe,ut,D,ze)}if(!P||Ce){const Ne=new tn([w.ONE,w.ONE,w.ONE,Ce?w.ZERO:w.ONE],c.i.transparent,[!1,!1,!1,!0],Ce?w.FUNC_ADD:w.MAX);$a(Ee,u,r,a,f,Ze,rn.disabled,Ne,Ut.disabled,Ce,"clear",$,W,J,Q,fe,ut,D,ze,Oe)}else{w.drawBuffers([w.NONE,w.COLOR_ATTACHMENT1]);const Ne=new rn({func:w.EQUAL,mask:255},254,255,w.KEEP,w.DECR,w.DECR),Je=new tn([w.ONE,w.ONE,w.ONE,w.ONE],c.i.transparent,[!0,!1,!1,!1],w.MAX);$a(Ee,u,r,a,f,Ze,Ne,Je,Ut.disabled,Ce,"emissive",$,W,J,Q,fe,ut,D,ze,Oe),w.drawBuffers([w.COLOR_ATTACHMENT0])}};if(se||Ae){let Ce;u.prepareDrawTile(),P&&!se||(Ce=ye()),se&&be(!0,!1,Ce),Ae&&be(!1,!0,Ce)}}else se&&Pe(!0),Ae&&Pe(!1),(se||Ae)&&u.resetStencilClippingMasks()}}},hillshade:function(u,r,a,f){if(u.renderPass!=="offscreen"&&u.renderPass!=="translucent"||u.style.disableElevatedTerrain)return;const _=u.context,x=u.terrain&&u.terrain.renderingToTexture,[w,k]=u.renderPass!=="translucent"||x?[{},f]:u.stencilConfigForOverlap(f);for(const A of k){const P=r.getTile(A);if(P.needsHillshadePrepare&&u.renderPass==="offscreen")Gm(u,P,a);else if(u.renderPass==="translucent"){const D=u.depthModeForSublayer(0,Vt.ReadOnly),z=a.paint.get("hillshade-emissive-strength"),F=u.colorModeForDrapableLayerRenderPass(z),j=x&&u.terrain?u.terrain.stencilModeForRTTOverlap(A):w[A.overscaledZ];jm(u,A,P,a,D,j,F)}}_.viewport.set([0,0,u.width,u.height]),u.resetStencilClippingMasks()},raster:function(u,r,a,f,_,x){if(u.renderPass!=="translucent")return;const w=a.paint.get("raster-opacity");if(w===0)return;const k=u.transform.projection.name==="globe",A=a.paint.get("raster-elevation")!==0,P=A&&k,D=u.terrain&&u.terrain.exaggeration()>0&&A&&a.paint.get("raster-elevation-reference")==="ground",z=!k&&D;if(u.renderElevatedRasterBackface&&!P)return;const F=u.context,j=F.gl,$=r.getSource(),W=function(be,Ce,ze,Oe,Ze){const We=Ce.paint.get("raster-color"),ut=be.type==="raster-array",Ne=[],Je=Ce.paint.get("raster-resampling"),Be=Ce.paint.get("raster-color-mix");let it=Ce.paint.get("raster-color-range");const Qe=[Be[0],Be[1],Be[2],0],ot=Be[3];let Et=Je==="nearest"?Oe.NEAREST:Oe.LINEAR;if(ut&&(Ne.push("RASTER_ARRAY"),We||Ne.push("RASTER_COLOR"),Je==="linear"&&Ne.push("RASTER_ARRAY_LINEAR"),Et=Oe.NEAREST,!it&&be.rasterLayers)){const ht=be.rasterLayers.find(({id:gt})=>gt===Ce.sourceLayer);ht&&ht.fields&&ht.fields.range&&(it=ht.fields.range)}if(it=it||[0,1],We){Ne.push("RASTER_COLOR"),ze.activeTexture.set(Oe.TEXTURE2),Ce.updateColorRamp(it);let ht=Ce.colorRampTexture;ht||(ht=Ce.colorRampTexture=new c.a_(ze,Ce.colorRamp,Oe.RGBA8)),ht.bind(Et,Oe.CLAMP_TO_EDGE)}return Ze&&Ne.push("USE_MRT1"),{mix:Qe,range:it,offset:ot,defines:Ne,resampling:Et}}($,a,F,j,u.terrain&&u.terrain.renderingToTexture&&u.emissiveMode==="mrt-fallback");if($ instanceof c.a3&&!f.length&&!k)return;const J=a.paint.get("raster-emissive-strength"),Q=u.colorModeForDrapableLayerRenderPass(J),ce=u.terrain&&u.terrain.renderingToTexture,fe=!u.options.moving,se=a.paint.get("raster-resampling")==="nearest"?j.NEAREST:j.LINEAR;if($ instanceof c.a3&&!f.length&&($.onNorthPole||$.onSouthPole)){const be=A?u.stencilModeFor3D():rn.disabled;return void Yf(!!$.onNorthPole,null,u,r,a,J,W,Ut.disabled,be)}if(!f.length)return;const[Ae,Ee]=$ instanceof c.a3||ce?[{},f]:u.stencilConfigForOverlap(f),Pe=Ee.at(-1).overscaledZ;P&&W.defines.push("PROJECTION_GLOBE_VIEW"),A&&W.defines.push("RENDER_CUTOFF","ELEVATED"),D&&W.defines.push("ELEVATION_REFERENCE_GROUND");const ye=(be,Ce,ze)=>{for(const Oe of be){const Ze=Oe.toUnwrapped(),We=r.getTile(Oe);if(ce&&(!We||!We.hasData()))continue;F.activeTexture.set(j.TEXTURE0);const ut=yv(We,$,a,W);if(!ut||!ut.texture)continue;const{texture:Ne,mix:Je,offset:Be,tileSize:it,buffer:Qe}=ut;let ot,Et;ce?(ot=Vt.disabled,Et=Oe.projMatrix):A?(ot=new Vt(j.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D),Et=k?u.transform.expandedFarZProjMatrix:u.transform.calculateProjMatrix(Ze,fe)):(ot=u.depthModeForSublayer(Oe.overscaledZ-Pe,w===1?Vt.ReadWrite:Vt.ReadOnly,j.LESS),Et=u.transform.calculateProjMatrix(Ze,fe));const ht=u.terrain&&ce?u.terrain.stencilModeForRTTOverlap(Oe):Ae[Oe.overscaledZ],gt=x?0:a.paint.get("raster-fade-duration");We.registerFadeDuration(gt);const ct=r.findLoadedParent(Oe,0),Ht=_m(We,ct,r,u.transform,gt);let Ot,Nt;!Ht.isFading&&We.refreshedUponExpiration&&(We.refreshedUponExpiration=!1),u.terrain&&u.terrain.prepareDrawTile(),F.activeTexture.set(j.TEXTURE0),Ne.bind(se,j.CLAMP_TO_EDGE),F.activeTexture.set(j.TEXTURE1),ct?(ct.texture&&ct.texture.bind(se,j.CLAMP_TO_EDGE),Ot=Math.pow(2,ct.tileID.overscaledZ-We.tileID.overscaledZ),Nt=[We.tileID.canonical.x*Ot%1,We.tileID.canonical.y*Ot%1]):Ne.bind(se,j.CLAMP_TO_EDGE),"useMipmap"in Ne&&F.extTextureFilterAnisotropic&&u.transform.pitch>20&&j.texParameterf(j.TEXTURE_2D,F.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,F.extTextureFilterAnisotropicMax);const $t=u.transform;let an;const nn=A?_v($t):[0,0,0,0];let xn,En,qt,fn,un,Dn=0;if(P&&$ instanceof c.a3&&$.coordinates.length>3)xn=Float32Array.from(c.dh(c.dk(new c.f(0,0,0)))),En=Float32Array.from($t.globeMatrix),qt=Float32Array.from(c.by($t)),fn=[c.ek($t.center.lng),c.el($t.center.lat)],an=$.elevatedGlobePerspectiveTransform,un=$.elevatedGlobeGridMatrix||new Float32Array(9);else if(P){const Wn=c.fF(Oe.canonical);Dn=c.cU(Wn.getCenter().lat),xn=Float32Array.from(c.dh(c.dk(Oe.canonical))),En=Float32Array.from($t.globeMatrix),qt=Float32Array.from(c.by($t)),fn=[c.ek($t.center.lng),c.el($t.center.lat)],an=[0,0],un=Float32Array.from(c.cP(Oe.canonical,Wn,Dn,$t.worldSize/$t._pixelsPerMercatorPixel))}else an=$ instanceof c.a3?$.perspectiveTransform:[0,0],xn=new Float32Array(16),En=new Float32Array(9),qt=new Float32Array(16),fn=[0,0],un=new Float32Array(9);const Jn=ec(u,Et,xn,En,qt,un,Nt||[0,0],c.dm(u.transform.zoom),fn,nn,Ot||1,Ht,a,an,A?a.paint.get("raster-elevation"):0,2,Je,Be,W.range,it,Qe,J),Mr=u.isTileAffectedByFog(Oe),Hn=u.getOrCreateProgram("raster",{defines:W.defines,overrideFog:Mr});if(u.uploadCommonUniforms(F,Hn,Ze),$ instanceof c.a3){const Wn=$.elevatedGlobeVertexBuffer,Fr=$.elevatedGlobeIndexBuffer;if(ce||!k)$.boundsBuffer&&$.boundsSegments&&Hn.draw(u,j.TRIANGLES,ot,rn.disabled,Q,Ut.disabled,Jn,a.id,$.boundsBuffer,u.quadTriangleIndexBuffer,$.boundsSegments);else if(Wn&&Fr){const or=$t.zoom<=c.S?$.elevatedGlobeSegments:$.getSegmentsForLongitude($t.center.lng);or&&Hn.draw(u,j.TRIANGLES,ot,rn.disabled,Q,Ce,Jn,a.id,Wn,Fr,or)}}else if(P){ot=new Vt(j.LEQUAL,Vt.ReadOnly,u.depthRangeFor3D);const Wn=u.globeSharedBuffers;if(Wn){D&&(u.terrain.setupElevationDraw(We,Hn),u.uploadCommonUniforms(F,Hn,We.tileID.toUnwrapped()));const[Fr,or,ri]=Wn.getGridBuffers(Dn,!1),Pn=Hn.getAttributeLocation(j,"a_texture_pos");Pn!==-1&&j.vertexAttribI4ui(Pn,0,0,0,0),Hn.draw(u,j.TRIANGLES,ot,ze||ht,u.colorModeForRenderPass(),Ce,Jn,a.id,Fr,or,ri)}}else if(z)ot=new Vt(j.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D),u.terrain.setupElevationDraw(We,Hn),u.uploadCommonUniforms(F,Hn,We.tileID.toUnwrapped()),$t.pitch>20&&Hn.draw(u,j.TRIANGLES,ot,rn.disabled,tn.disabled,Ut.frontCCW,Jn,a.id,u.terrain.gridBuffer,u.terrain.gridIndexBuffer,u.terrain.gridSegments),Hn.draw(u,j.TRIANGLES,ot,ht,Q,Ut.backCCW,Jn,a.id,u.terrain.gridBuffer,u.terrain.gridIndexBuffer,u.terrain.gridSegments);else{const{tileBoundsBuffer:Wn,tileBoundsIndexBuffer:Fr,tileBoundsSegments:or}=u.getTileBoundsBuffers(We);Hn.draw(u,j.TRIANGLES,ot,ht,Q,Ut.disabled,Jn,a.id,Wn,Fr,or)}}if(!($ instanceof c.a3)&&P)for(const Oe of be){const Ze=Oe.canonical.y===(1<<Oe.canonical.z)-1;Oe.canonical.y===0&&Yf(!0,Oe,u,r,a,J,W,Ce,ze||rn.disabled),Ze&&Yf(!1,Oe,u,r,a,J,W,Ce===Ut.frontCW?Ut.backCW:Ut.frontCW,ze||rn.disabled)}};P?ye(Ee,u.renderElevatedRasterBackface?Ut.backCW:Ut.frontCW,u.stencilModeFor3D()):ye(Ee,Ut.disabled,void 0),u.resetStencilClippingMasks()},background:function(u,r,a,f){const _=a.paint.get("background-color"),x=a.paint.get("background-color-use-theme").constantOr("default")==="none",w=a.paint.get("background-opacity"),k=a.paint.get("background-emissive-strength"),A=a.paint.get("background-pitch-alignment")==="viewport";if(w===0)return;const P=u.context,D=P.gl,z=u.transform,F=z.tileSize,j=a.paint.get("background-pattern");let $;if(j!==void 0&&(j===null||($=u.imageManager.getPattern(c.a1.from(j.toString()),a.scope,u.style.getLut(a.scope)),!$)))return;const W=!j&&_.a===1&&w===1&&u.opaquePassEnabledForLayer()?"opaque":"translucent";if(u.renderPass!==W)return;const J=rn.disabled,Q=u.depthModeForSublayer(0,W==="opaque"?Vt.ReadWrite:Vt.ReadOnly),ce=u.colorModeForDrapableLayerRenderPass(k),fe=j?"backgroundPattern":"background";let se,Ae=f;Ae||(se=u.getBackgroundTiles(),Ae=Object.values(se).map(Pe=>Pe.tileID)),j&&(P.activeTexture.set(D.TEXTURE0),u.imageManager.bind(u.context,a.scope));const Ee=[];if(u.terrain&&u.terrain.renderingToTexture&&u.emissiveMode==="mrt-fallback"&&Ee.push("USE_MRT1"),A){const Pe=u.getOrCreateProgram(fe,{overrideFog:!1,overrideRtt:!0,defines:Ee}),ye=Ca,be=new c.ap(0,0,0,0,0),Ce=j?pv(ye,k,w,u,0,a.scope,$,A,{tileID:be,tileSize:F}):Ss(ye,k,w,_.toPremultipliedRenderColor(x?null:a.lut));return void Pe.draw(u,D.TRIANGLES,Q,J,ce,Ut.disabled,Ce,a.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments)}for(const Pe of Ae){const ye=u.isTileAffectedByFog(Pe),be=u.getOrCreateProgram(fe,{overrideFog:ye,defines:Ee}),Ce=Pe.toUnwrapped(),ze=f?Pe.projMatrix:u.transform.calculateProjMatrix(Ce);u.prepareDrawTile();const Oe=r?r.getTile(Pe):se?se[Pe.key]:new c.b0(Pe,F,z.zoom,u),Ze=j?pv(ze,k,w,u,0,a.scope,$,A,{tileID:Pe,tileSize:F}):Ss(ze,k,w,_.toPremultipliedRenderColor(x?null:a.lut));u.uploadCommonUniforms(P,be,Ce);const{tileBoundsBuffer:We,tileBoundsIndexBuffer:ut,tileBoundsSegments:Ne}=u.getTileBoundsBuffers(Oe);be.draw(u,D.TRIANGLES,Q,J,ce,Ut.disabled,Ze,a.id,We,ut,Ne)}},sky:function(u,r,a){const f=u._atmosphere?c.dm(u.transform.zoom):1,_=a.paint.get("sky-opacity")*f;if(_===0)return;const x=u.context,w=a.paint.get("sky-type"),k=new Vt(x.gl.LEQUAL,Vt.ReadOnly,[0,1]),A=u.frameCounter/1e3%1;w==="atmosphere"?u.renderPass==="offscreen"?a.needsSkyboxCapture(u)&&(function(P,D){const z=P.context,F=z.gl;let j=D.skyboxFbo;if(!j){j=D.skyboxFbo=z.createFramebuffer(32,32,1,null),D.skyboxGeometry=new _i(z),D.skyboxTexture=z.gl.createTexture(),F.bindTexture(F.TEXTURE_CUBE_MAP,D.skyboxTexture),F.texParameteri(F.TEXTURE_CUBE_MAP,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_CUBE_MAP,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_CUBE_MAP,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_CUBE_MAP,F.TEXTURE_MAG_FILTER,F.LINEAR);for(let Q=0;Q<6;++Q)F.texImage2D(F.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,F.RGBA,32,32,0,F.RGBA,F.UNSIGNED_BYTE,null)}z.bindFramebuffer.set(j.framebuffer),z.viewport.set([0,0,32,32]);const $=D.getCenter(P,!0),W=P.getOrCreateProgram("skyboxCapture"),J=new Float64Array(16);c.cB(J,.5*-Math.PI),Zc(P,D,W,J,$,0),c.cB(J,.5*Math.PI),Zc(P,D,W,J,$,1),c.cA(J,.5*-Math.PI),Zc(P,D,W,J,$,2),c.cA(J,.5*Math.PI),Zc(P,D,W,J,$,3),c.dq(J),Zc(P,D,W,J,$,4),c.cB(J,Math.PI),Zc(P,D,W,J,$,5),z.viewport.set([0,0,P.width,P.height])}(u,a),a.markSkyboxValid(u)):u.renderPass==="sky"&&function(P,D,z,F,j){const $=P.context,W=$.gl,J=P.transform,Q=P.getOrCreateProgram("skybox");$.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_CUBE_MAP,D.skyboxTexture);const ce=((fe,se,Ae,Ee,Pe)=>({u_matrix:fe,u_sun_direction:se,u_cubemap:0,u_opacity:Ee,u_temporal_offset:Pe}))(J.skyboxMatrix,D.getCenter(P,!1),0,F,j);P.uploadCommonUniforms($,Q),Q.draw(P,W.TRIANGLES,z,rn.disabled,P.colorModeForRenderPass(),Ut.backCW,ce,"skybox",D.skyboxGeometry.vertexBuffer,D.skyboxGeometry.indexBuffer,D.skyboxGeometry.segment)}(u,a,k,_,A):w==="gradient"&&u.renderPass==="sky"&&function(P,D,z,F,j){const $=P.context,W=$.gl,J=P.transform,Q=P.getOrCreateProgram("skyboxGradient");D.skyboxGeometry||(D.skyboxGeometry=new _i($)),$.activeTexture.set(W.TEXTURE0);let ce=D.colorRampTexture;ce||(ce=D.colorRampTexture=new c.a_($,D.colorRamp,W.RGBA8)),ce.bind(W.LINEAR,W.CLAMP_TO_EDGE);const fe=((se,Ae,Ee,Pe,ye)=>({u_matrix:se,u_color_ramp:0,u_center_direction:Ae,u_radius:c.c4(Ee),u_opacity:Pe,u_temporal_offset:ye}))(J.skyboxMatrix,D.getCenter(P,!1),D.paint.get("sky-gradient-radius"),F,j);P.uploadCommonUniforms($,Q),Q.draw(P,W.TRIANGLES,z,rn.disabled,P.colorModeForRenderPass(),Ut.backCW,fe,"skyboxGradient",D.skyboxGeometry.vertexBuffer,D.skyboxGeometry.indexBuffer,D.skyboxGeometry.segment)}(u,a,k,_,A)},custom:function(u,r,a,f){const _=u.context,x=a.implementation;if(!u.transform.projection.unsupportedLayers||!u.transform.projection.unsupportedLayers.includes("custom")||u.terrain&&(u.terrain.renderingToTexture||u.renderPass==="offscreen")&&a.isDraped(r)){if(u.renderPass==="offscreen"){const w=x.prerender;if(w){if(u.setCustomLayerDefaults(),_.setColorMode(u.colorModeForRenderPass()),u.transform.projection.name==="globe"){const k=u.transform.pointMerc;w.call(x,_.gl,u.transform.customLayerMatrix(),u.transform.getProjection(),u.transform.globeToMercatorMatrix(),c.dm(u.transform.zoom),[k.x,k.y],u.transform.pixelsPerMeterRatio)}else w.call(x,_.gl,u.transform.customLayerMatrix());_.setDirty(),u.setBaseState()}}else if(u.renderPass==="translucent"){if(u.terrain&&u.terrain.renderingToTexture){const k=x.renderToTile;if(k){const A=f[0].canonical,P={x:A.x+f[0].wrap*(x.wrapTileId?0:1<<A.z),y:A.y,z:A.z};_.setDepthMode(Vt.disabled),_.setStencilMode(rn.disabled),_.setColorMode(u.colorModeForRenderPass()),u.setCustomLayerDefaults();const D=_.gl;u.emissiveMode==="mrt-fallback"&&D.drawBuffers([D.COLOR_ATTACHMENT0]),k.call(x,_.gl,P),u.emissiveMode==="mrt-fallback"&&D.drawBuffers([D.COLOR_ATTACHMENT0,D.COLOR_ATTACHMENT1]),_.setDirty(),u.setBaseState()}return}u.setCustomLayerDefaults(),_.setColorMode(u.colorModeForRenderPass()),_.setStencilMode(rn.disabled);const w=x.renderingMode==="3d"?new Vt(u.context.gl.LEQUAL,Vt.ReadWrite,u.depthRangeFor3D):u.depthModeForSublayer(0,Vt.ReadOnly);if(_.setDepthMode(w),u.transform.projection.name==="globe"){const k=u.transform.pointMerc;x.render(_.gl,u.transform.customLayerMatrix(),u.transform.getProjection(),u.transform.globeToMercatorMatrix(),c.dm(u.transform.zoom),[k.x,k.y],u.transform.pixelsPerMeterRatio)}else x.render(_.gl,u.transform.customLayerMatrix());_.setDirty(),u.setBaseState(),_.bindFramebuffer.set(null)}}else c.f_("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},th={line:function(u,r,a){if(u.hasElevatedBuckets=!1,u.hasNonElevatedBuckets=!1,u._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||u._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(r){const f=r.getVisibleCoordinates();for(const _ of f){const x=r.getTile(_).getBucket(u);if(x&&(x.elevationType!=="none"?u.hasElevatedBuckets=!0:u.hasNonElevatedBuckets=!0,u.hasElevatedBuckets&&u.hasNonElevatedBuckets))break}}}else u.hasNonElevatedBuckets=!0},raster:function(u,r,a){const f=r.getSource();if(!(f instanceof Du&&f.loaded()))return;const _=u.sourceLayer||f.rasterLayerIds&&f.rasterLayerIds[0];if(!_)return;const x=u.paint.get("raster-array-band")||f.getInitialBand(_);if(x==null)return;const w=r.getIds().map(k=>r.getTileByID(k));for(const k of w)k.updateNeeded(u.id,x)&&f.prepareTile(k,_,u.id,x)}};class ng{constructor(r,a,f,_,x){this.context=new t1(r,a),this.transform=f,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.frcCoverageSnapshot=null,this.frcCoverageFadeRange=null,this.frcCoverageSourceLayers=[],this.frcCoverageRenderer=Zn.FrcCoverageRenderer?new Zn.FrcCoverageRenderer:null,this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,dt:0,timeStamp:c.co.now(),continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParamsOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:5e3,lodSwitchFadeDuration:.5},this.occlusionParams=new Av,this.setup(),this.numSublayers=Rs.maxUnderzooming+Rs.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new c.aF,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new hm(this),this._wireframeDebugCache=new Wu,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const w=new c.ay({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new c.a_(this.context,w,r.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=_,this.maxFrontCutoffRawStart=0,this.worldview=x,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(r,a){const f=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(f||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Zd(this,r));const _=this._terrain;this.transform.elevation=f?_:null,_.update(r,this.transform,a),this.transform.elevation&&!_.enabled&&(this.transform.elevation=null)}_updateFog(r){const a=r.fog;if(!a||this.transform.projection.name==="globe"||a.getOpacity(this.transform.pitch)<1||a.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[f,_]=a.getRangeForProjection();if(f>_)return void(this.transform.fogCullDistSq=null);const x=f+.78*(_-f);this.transform.fogCullDistSq=x*x}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(r){r&&!this._terrain&&(this._terrain=new Zd(this,this.style)),this._forceTerrainMode=r}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*c.co.devicePixelRatio,this.height=a*c.co.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style.order)this.style._mergedLayers[f].resize()}setup(){const r=this.context,a=new c.aQ;a.emplaceBack(0,0),a.emplaceBack(c.r,0),a.emplaceBack(0,c.r),a.emplaceBack(c.r,c.r),this.tileExtentBuffer=r.createVertexBuffer(a,c.eQ.members),this.tileExtentSegments=c.aJ.simpleSegment(0,0,4,2);const f=new c.aQ;f.emplaceBack(0,0),f.emplaceBack(c.r,0),f.emplaceBack(0,c.r),f.emplaceBack(c.r,c.r),this.debugBuffer=r.createVertexBuffer(f,c.eQ.members),this.debugSegments=c.aJ.simpleSegment(0,0,4,5);const _=new c.aQ;_.emplaceBack(-1,-1),_.emplaceBack(1,-1),_.emplaceBack(-1,1),_.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(_,c.eQ.members),this.viewportSegments=c.aJ.simpleSegment(0,0,4,2);const x=new c.aP;x.emplaceBack(0,0,0,0),x.emplaceBack(c.r,0,c.r,0),x.emplaceBack(0,c.r,0,c.r),x.emplaceBack(c.r,c.r,c.r,c.r),this.mercatorBoundsBuffer=r.createVertexBuffer(x,c.bt.members),this.mercatorBoundsSegments=c.aJ.simpleSegment(0,0,4,2);const w=new c.aT;w.emplaceBack(0,1,2),w.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(w);const k=new c.aM;for(const P of[0,1,3,2,0])k.emplaceBack(P);this.debugIndexBuffer=r.createIndexBuffer(k),this.emptyTexture=new c.a_(r,new c.ay({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA8),this.identityMat=c.bT();const A=this.context.gl;this.stencilClearMode=new rn({func:A.ALWAYS,mask:0},0,255,A.ZERO,A.ZERO,A.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,Vt.disabled,this.stencilClearMode,tn.disabled,Ut.disabled,If(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,a,f){if(!a||this.currentStencilSource===a.id||!r.isTileClipped()||!f||f.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let k=!1;for(const A of f)if(this._tileClippingMaskIDs[A.key]===void 0){k=!0;break}if(!k)return}this.currentStencilSource=a.id;const _=this.context,x=_.gl;this.nextStencilID+f.length>256&&this.clearStencil(),_.setColorMode(tn.disabled),_.setDepthMode(Vt.disabled);const w=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const k of f){const A=a.getTile(k),P=this._tileClippingMaskIDs[k.key]=this.nextStencilID++,{tileBoundsBuffer:D,tileBoundsIndexBuffer:z,tileBoundsSegments:F}=this.getTileBoundsBuffers(A);w.draw(this,x.TRIANGLES,Vt.disabled,new rn({func:x.ALWAYS,mask:0},P,255,x.KEEP,x.KEEP,x.REPLACE),tn.disabled,Ut.disabled,If(k.projMatrix),"$clipping",D,z,F)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,a=this.context.gl;return new rn({func:a.NOTEQUAL,mask:255},r,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const a=this.context.gl;return new rn({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(r){const a=this.context.gl,f=r.sort((w,k)=>k.overscaledZ-w.overscaledZ),_=f.at(-1).overscaledZ,x=f[0].overscaledZ-_+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const w={};for(let k=0;k<x;k++)w[k+_]=new rn({func:a.GEQUAL,mask:255},k+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=x,[w,f]}return[{[_]:rn.disabled},f]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new tn([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new c.i(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?tn.unblended:tn.alphaBlended}colorModeForDrapableLayerRenderPass(r){const a=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?r!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new tn([a.ONE,a.ONE_MINUS_SRC_ALPHA,a.CONSTANT_ALPHA,a.ONE_MINUS_SRC_ALPHA],new c.i(0,0,0,r??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new tn([a.ONE,a.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,a.ONE_MINUS_SRC_ALPHA],c.i.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(r,a,f,_=!1){if(this.depthOcclusion)return new Vt(this.context.gl.GREATER,Vt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!_)return Vt.disabled;const x=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new Vt(f||this.context.gl.LEQUAL,a,[x,x])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const r=this.context.gl,a=Math.ceil(this.width),f=Math.ceil(this.height),_=this.context.bindFramebuffer.get(),x=r.getParameter(r.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===a&&this.depthFBO.height===f||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),a!==0&&f!==0&&(this.depthFBO=new $c(this.context,a,f,0,"texture"),this.depthTexture=new c.a_(this.context,{width:a,height:f,data:null},r.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(_),r.bindTexture(r.TEXTURE_2D,x),this.depthFBO&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),r.blitFramebuffer(0,0,a,f,0,0,a,f,r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(r,a){this.context.sweepPendingPrograms(),this._wireframeDebugCache.update(this.frameCounter),this.style=r,this.options=a,this.frcCoverageSnapshot&&!this.frcCoverageSnapshot.empty()&&(!this.frcCoverageRenderer&&Zn.FrcCoverageRenderer&&(this.frcCoverageRenderer=new Zn.FrcCoverageRenderer),this.frcCoverageRenderer&&this.frcCoverageRenderer.update(this.context,this.frcCoverageSnapshot.tiles));const f=this.style._mergedLayers,_=!(!this.terrain||!this.terrain.enabled),x=()=>this.style._getOrder(_);let w=x(),k=!1,A=!1,P=null,D=0,z=!1;for(const Ne of w){const Je=f[Ne];Je.visibility!=="none"&&(Je.type==="circle"?k=!0:Je.type==="building"?(P=Je,++D):Je.type==="symbol"&&(Je.hasOcclusionOpacityProperties?A=!0:k=!0))}this.updateEmissiveMode();let F=w.map(Ne=>f[Ne]);const j=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(c.co.now()),this.imageManager.beginFrame();for(const Ne in j){const Je=j[Ne];Je.used&&(Je.prepare(this.context),Je.getSource().usedInConflation&&++D)}let $=!1;for(const Ne of F)Ne.isHidden(this.transform.zoom)||(Ne.type==="clip"&&($=!0),this.prepareLayer(Ne));const W={},J={},Q={},ce={},fe={};for(const Ne in j){const Je=j[Ne];W[Ne]=Je.getVisibleCoordinates(),J[Ne]=W[Ne].slice().reverse(),Q[Ne]=Je.getVisibleCoordinates(!0).reverse(),ce[Ne]=Je.getShadowCasterCoordinates(),fe[Ne]=Je.sortCoordinatesByDistance(W[Ne])}const se=Ne=>{const Je=this.style.getLayerSourceCache(Ne);return Je&&Je.used?Je.getSource():null};if(D||$||this._clippingActiveLastFrame){const Ne=[],Je=[];let Be=0;for(const it of F)this.isSourceForClippingOrConflation(it,se(it))&&(Ne.push(it),Je.push(Be)),Be++;if(Ne&&($||Ne.length>1)||this._clippingActiveLastFrame){$=!1;const it=[];for(let Qe=0;Qe<Ne.length;Qe++){const ot=Ne[Qe],Et=Je[Qe],ht=this.style.getLayerSourceCache(ot);if(!ht||!ht.used||!ht.getSource().usedInConflation&&ot.type!=="clip"&&ot.type!=="building")continue;let gt=c.aE,ct=c.a8.None;const Ht=[];let Ot=!0;if(ot.type==="building")gt=c.aD;else if(ot.type==="clip")if(gt=Et,ot.isHidden(this.transform.zoom))Ot=!1;else{if(!ot.layout){Ot=!1;continue}for(const Nt of ot.layout.get("clip-layer-types"))ct|=Nt==="model"?c.a8.Model:Nt==="symbol"?c.a8.Symbol:c.a8.FillExtrusion;for(const Nt of ot.layout.get("clip-layer-scope"))Ht.push(c.ea(Nt,ot.scope));$=!0}Ot&&it.push({layer:ot.fqid,cache:ht,order:gt,clipMask:ct,clipScope:Ht})}this.replacementSource.setSources(it),z=!0}}this._clippingActiveLastFrame=$,z||this.replacementSource.clear(),this.conflationActive=z,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Ne=0;Ne<F.length;Ne++){const Je=F[Ne];if(Je.visibility==="none")continue;const Be=Je.cutoffRange();if(this.longestCutoffRange=Math.max(Be,this.longestCutoffRange),Be>0){const it=se(Je);it&&(this.minCutoffZoom=Math.max(it.minzoom,this.minCutoffZoom)),Je.minzoom&&(this.minCutoffZoom=Math.max(Je.minzoom,this.minCutoffZoom))}Je.is3D(_)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Ne),this._lastOcclusionLayer=Ne)}const Ae=this.style&&this.style.fog;Ae?(this._fogVisible=Ae.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=Ae.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(Q),this.opaquePassCutoff=0,w=x(),F=w.map(Ne=>f[Ne]));const Ee=this._shadowRenderer;if(Ee){Ee.updateShadowParameters(this.transform,this.style.directionalLight);for(const Ne in j)for(const Je of W[Ne]){let Be={min:0,max:0};this.terrain&&(Be=this.terrain.getMinMaxForTile(Je)||Be),Ee.addShadowReceiver(Je.toUnwrapped(),Be.min,Be.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new c.T(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Tv),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let Pe=!(!this.style||!this.style.snow),ye=!(!this.style||!this.style.rain);if(Pe&&!this._snow&&Zn.Snow&&(this._snow=new Zn.Snow),!Pe&&this._snow&&(this._snow.destroy(),delete this._snow),ye&&!this._rain&&Zn.Rain&&(this._rain=new Zn.Rain),!ye&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),P){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Ev);const Ne=this.style.getLayerSourceCache(P);this.buildingTileBorderManager.updateBorders(Ne,P)}if(!vs.has(this.context.gl))return;this.renderPass="offscreen";for(const Ne of F){const Je=r.getLayerSourceCache(Ne);if(!Ne.hasOffscreenPass()||Ne.isHidden(this.transform.zoom))continue;const Be=Je?J[Je.id]:void 0;(Ne.type==="custom"||Ne.type==="raster"||Ne.type==="raster-particle"||Ne.isSky()||Be&&Be.length)&&this.renderLayer(this,Je,Ne,Be)}this.depthRangeFor3D=[0,1-(F.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,ce)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const be=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Ce=(()=>{if(a.showOverdrawInspector)return c.i.black;const Ne=this.style.fog;if(Ne&&this.transform.projection.supportsFog){const Je=this.style.getLut(Ne.scope);if(!be){const Be=Ne.properties.get("color-use-theme")==="none",it=Ne.properties.get("color").toNonPremultipliedRenderColor(Be?null:Je).toArray01();return new c.i(...it)}if(be){const Be=Ne.properties.get("space-color-use-theme")==="none",it=Ne.properties.get("space-color").toNonPremultipliedRenderColor(Be?null:Je).toArray01();return new c.i(...it)}}return c.i.transparent})();if(this.context.clear({color:Ce,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&be&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=w.length-1;this.currentLayer>=0;this.currentLayer--){const Ne=F[this.currentLayer],Je=r.getLayerSourceCache(Ne);if(Ne.isSky())continue;const Be=Je?(Ne.is3D(_)?fe:J)[Je.id]:void 0;this._renderTileClippingMasks(Ne,Je,Be),this.renderLayer(this,Je,Ne,Be)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&be&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||c.dm(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<w.length;this.currentLayer++){const Ne=F[this.currentLayer],Je=r.getLayerSourceCache(Ne);Ne.isSky()&&this.renderLayer(this,Je,Ne,Je?J[Je.id]:void 0)}function ze(Ne,Je){let Be;return Je&&(Be=(Ne.type==="symbol"?Q:Ne.is3D(_)?fe:J)[Je.id]),Be}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<w.length;){const Ne=F[this.currentLayer];if(Ne.type==="raster"||Ne.type==="raster-particle"){const Je=r.getLayerSourceCache(Ne);this.renderLayer(this,Je,Ne,ze(Ne,Je))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const Oe=Ee?Ee.getGroundShadowLayerIndex():-1;let Ze=!1,We=-1;for(let Ne=0;Ne<w.length;++Ne){const Je=F[Ne];Je.isHidden(this.transform.zoom)||Je.is3D(_)&&(We=Ne)}A&&We===-1&&(k=!0);let ut=!1;for(;this.currentLayer<w.length;){const Ne=F[this.currentLayer],Je=r.getLayerSourceCache(Ne);if(Ne.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(Ne)){if(Ne.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!ut&&Ne.is3D(_)&&!_){const Be=this.currentLayer,it=Qe=>{for(this.currentLayer=0;this.currentLayer<F.length;this.currentLayer++){const ot=F[this.currentLayer];if(ot.type==="fill"&&Zn.drawDepthPrepass){const Et=this.style.getLayerSourceCache(ot);Zn.drawDepthPrepass(this,Et,ot,ze(ot,Et),Qe)}}};it("initialize"),it("reset"),this.currentLayer=Be,ut=!0}if(k&&!Ze&&this.terrain&&!this.transform.isOrthographic&&(Ze=!0,this.blitDepth()),A&&We!==-1&&this.currentLayer===We+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(Ne,Je,Je?W[Je.id]:void 0),this.renderLayer(this,Je,Ne,ze(Ne,Je)),!this.terrain&&Ee&&this.currentLayer===Oe){{this.clearStencil(),this.resetStencilClippingMasks();const Be=this.currentLayer;for(this.currentLayer=0;this.currentLayer<F.length;this.currentLayer++){const it=F[this.currentLayer];if(it.type==="fill"&&Zn.drawGroundShadowMask){const Qe=this.style.getLayerSourceCache(it);Zn.drawGroundShadowMask(this,Qe,it,ze(it,Qe))}}this.currentLayer=Be}if(Ee.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Be=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Be;this.currentLayer++){const it=F[this.currentLayer];if(!it.hasLightBeamPass())continue;const Qe=r.getLayerSourceCache(it);this.renderLayer(this,Qe,it,Qe?J[Qe.id]:void 0)}this.currentLayer=Be,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Be=this.currentLayer;this.depthOcclusion=!0;for(const it of this.layersWithOcclusionOpacity){this.currentLayer=it;const Qe=F[this.currentLayer],ot=r.getLayerSourceCache(Qe),Et=ot?J[ot.id]:void 0;this.terrain||this._renderTileClippingMasks(Qe,ot,ot?W[ot.id]:void 0),this.renderLayer(this,ot,Qe,Et)}this.depthOcclusion=!1,this.currentLayer=Be,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 Ne=null;F.forEach(Je=>{const Be=r.getLayerSourceCache(Je);Be&&!Je.isHidden(this.transform.zoom)&&Be.getVisibleCoordinates().length&&(!Ne||Ne.getSource().maxzoom<Be.getSource().maxzoom)&&(Ne=Be)}),Ne&&this.options.showTileBoundaries&&function(Je,Be,it,Qe,ot,Et){for(let ht=0;ht<it.length;ht++)nc(Je,Be,it[ht],Qe,0,0,Et)}(this,Ne,Ne.getVisibleCoordinates(),c.i.red,0,this.options.showParseStatus)}this.options.showPadding&&function(Ne){const Je=Ne.transform.padding;eg(Ne,Ne.transform.height-(Je.top||0),3,qc),eg(Ne,Je.bottom||0,3,Jd),ta(Ne,Je.left||0,3,Jm),ta(Ne,Ne.transform.width-(Je.right||0),3,vv);const Be=Ne.transform.centerPoint;(function(it,Qe,ot,Et){eh(it,Qe-1,ot-10,2,20,Et),eh(it,Qe-10,ot-1,20,2,Et)})(Ne,Be.x,Ne.transform.height-Be.y,xv)}(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()),z||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:a}=this.transform.projection,f=!a||!a.includes(r.type);if(th[r.type]&&(f||this.terrain&&r.type==="custom")){const _=this.style.getLayerSourceCache(r);th[r.type](r,_,this)}this.gpuTimingEnd()}renderLayer(r,a,f,_){f.isHidden(this.transform.zoom)||(f.type==="background"||f.type==="sky"||f.type==="custom"||f.type==="model"||f.type==="raster"||f.type==="raster-particle"||_&&_.length)&&(this.id=f.id,this.gpuTimingStart(f),(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes(f.type)||r.terrain&&f.type==="custom")&&f.type!=="clip"&&f.type!=="slot"&&Cl[f.type]&&Cl[f.type](r,a,f,_,this.style.placement.variableOffsets,this.options.isInitialLoad),Cl[f.type]||(f.mayUse("HD")&&async function(){await Ld(),Object.assign(Cl,{building:Zn.drawBuilding,"raster-particle":Zn.drawRasterParticle}),Object.assign(th,{"raster-particle":Zn.prepareRasterParticle})}(),f.mayUse("Standard")&&async function(){await Cb(),Object.assign(Cl,{model:Bc.drawModels}),Object.assign(th,{model:Bc.prepare})}()),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const a=this.context.extTimerQuery,f=this.context.gl;let _=this.gpuTimers[r.id];_||(_=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:f.createQuery()}),_.calls++,f.beginQuery(a.TIME_ELAPSED_EXT,_.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,a=this.context.gl,f=a.createQuery();this.deferredRenderGpuTimeQueries.push(f),a.beginQuery(r.TIME_ELAPSED_EXT,f)}}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 r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const a={};for(const f in r){const _=r[f],x=this.context.extTimerQuery,w=x.getQueryParameter(_.query,this.context.gl.QUERY_RESULT)/1e6;x.deleteQueryEXT(_.query),a[f]=w}return a}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const a=this.context.gl;let f=0;for(const _ of r)f+=a.getQueryParameter(_,a.QUERY_RESULT)/1e6,a.deleteQuery(_);return f}translatePosMatrix(r,a,f,_,x){if(!f[0]&&!f[1])return r;const w=x?_==="map"?this.transform.angle:0:_==="viewport"?-this.transform.angle:0;if(w){const P=Math.sin(w),D=Math.cos(w);f=[f[0]*D-f[1]*P,f[0]*P+f[1]*D]}const k=[x?f[0]:c.eG(a,f[0],this.transform.zoom),x?f[1]:c.eG(a,f[1],this.transform.zoom),0],A=new Float32Array(16);return c.fQ(A,r,k),A}saveTileTexture(r){if(r.context!==this.context)return;const a=r.size[0],f=this._tileTextures[a];f?f.push(r):this._tileTextures[a]=[r]}getTileTexture(r){const a=this._tileTextures[r];return a&&a.length>0?a.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,a,f,_,x){const w=f===void 0?this.terrain&&this.terrain.renderingToTexture:f,k=_===void 0?this.terrainRenderModeElevated():_,A=x===void 0?this.transform.projection.name==="globe":x,P=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(P.push("LIGHTING_3D_MODE"),P.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):w||P.push("LIGHTING_3D_MODE")),k&&(P.push("TERRAIN"),this.linearFloatFilteringSupported()&&P.push("TERRAIN_DEM_FLOAT_FORMAT")),A&&P.push("GLOBE"),!this._fogVisible||w||a!==void 0&&!a||P.push("FOG"),w&&P.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&P.push("OVERDRAW_INSPECTOR"),P}getOrCreateProgram(r,a){this.cache=this.cache||{};const{defines:f,config:_,overrideFog:x,overrideRtt:w,overrideTerrain:k,overrideGlobe:A,precompiled:P}=a||{},D=this.currentGlobalDefines(r,x,w,k,A).concat(f||[]),z=this.getShaderSource(r),F=Zn.programUniforms,j=Bc.programUniforms,$=Gu[r]||F&&F[r]||j&&j[r],W=Km.cacheKey(z,r,D,_);return this.cache[W]||(this.cache[W]=new Km(this.context,r,z,_,$,D,P)),this.cache[W]}getShaderSource(r){const a=Zn.shaders,f=Bc.shaders;return bm[r]||a&&a[r]||f&&f[r]}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 r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new c.a_(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(r,a){if(this.style.enable3dLights()){const f=this.style.directionalLight,_=this.style.ambientLight;if(f&&_){const x=((w,k,A)=>{const P=w.properties.get("direction"),D=w.properties.get("color-use-theme")==="none",z=w.properties.get("color").toNonPremultipliedRenderColor(D?null:A.getLut(w.scope)).toArray01(),F=w.properties.get("intensity"),j=k.properties.get("color-use-theme")==="none",$=k.properties.get("color").toNonPremultipliedRenderColor(j?null:A.getLut(k.scope)).toArray01(),W=k.properties.get("intensity"),J=[P.x,P.y,P.z],Q=c.f8($,W),ce=c.f8(z,F);return{u_lighting_ambient_color:Q,u_lighting_directional_dir:J,u_lighting_directional_color:ce,u_ground_radiance:cv(J,ce,Q)}})(f,_,this.style);a.setLightsUniformValues(r,x)}}}uploadCommonUniforms(r,a,f,_,x){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;const w=this.style.fog;if(w){const k=w.getOpacity(this.transform.pitch),A=((P,D,z,F,j,$,W,J,Q,ce,fe,se)=>{const Ae=P.transform,Ee=D.properties.get("color-use-theme")==="none",Pe=D.properties.get("color").toNonPremultipliedRenderColor(Ee?null:P.style.getLut(D.scope)).toArray01();Pe[3]=F;const ye=P.frameCounter/1e3%1,[be,Ce]=D.properties.get("vertical-range");return{u_fog_matrix:z?Ae.calculateFogTileMatrix(z):se||P.identityMat,u_fog_range:D.getRangeForProjection(),u_fog_color:Pe,u_fog_horizon_blend:D.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(be,Ce),Ce],u_fog_temporal_offset:ye,u_frustum_tl:j,u_frustum_tr:$,u_frustum_br:W,u_frustum_bl:J,u_globe_pos:Q,u_globe_radius:ce,u_viewport:fe,u_globe_transition:c.dm(Ae.zoom),u_is_globe:+(Ae.projection.name==="globe")}})(this,w,f,k,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*c.co.devicePixelRatio,this.transform.height*c.co.devicePixelRatio],_);a.setFogUniformValues(r,A)}x&&a.setCutoffUniformValues(r,x.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,a=r.createTexture();return r.bindTexture(r.TEXTURE_2D,a),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),a}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const r=this._backgroundTiles,a=this._backgroundTiles={},f=this.transform.coveringTiles({tileSize:512});for(const _ of f)a[_.key]=r[_.key]||new c.b0(_,512,this.transform.tileZoom,this,void 0,this.worldview);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(r,a){return!(!r.is3D(!(!this.terrain||!this.terrain.enabled))||r.type!=="clip"&&r.type!=="building"&&(r.minzoom&&r.minzoom>this.transform.zoom||(this.style._clipLayerPresent||r.sourceLayer!=="building"&&r.sourceLayer!=="procedural_buildings")&&(!a||a.type!=="batched-model")))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let a=this._cachedTileFogOpacities[r.key];return a||(this._cachedTileFogOpacities[r.key]=a=this.style.fog.getOpacityForTile(r)),a[0]>=Ua||a[1]>=Ua}setupDepthForOcclusion(r,a,f){const _=this.context,x=_.gl,w=!!f;var k;f||(f={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}),_.activeTexture.set(x.TEXTURE3),r&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(x.NEAREST,x.CLAMP_TO_EDGE),f.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],f.u_depth_range_unpack=[2/((k=this.depthRangeFor3D)[1]-k[0]),-1-2*k[0]/(k[1]-k[0])],f.u_occluder_half_size=.5*this.occlusionParams.occluderSize,f.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(x.NEAREST,x.CLAMP_TO_EDGE),_.activeTexture.set(x.TEXTURE0),w||a.setTerrainUniformValues(_,f)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const r=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=r?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function Qf(u,r){let a=!1,f=null;const _=()=>{f=null,a&&(u(),f=setTimeout(_,r),a=!1)};return()=>(a=!0,f||_(),f)}const rg=/(#.+)?$/;class i1{constructor(r){this._hashName=r&&encodeURIComponent(r),c.bs(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Qf(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.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 r=this._map;if(!r)return"";const a=ig(r);if(this._hashName){const f=this._hashName;let _=!1;const x=location.hash.slice(1).split("&").map(w=>{const k=w.split("=")[0];return k===f?(_=!0,`${k}=${a}`):w}).filter(w=>w);return _||x.push(`${f}=${a}`),`#${x.join("&")}`}return`#${a}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let a;return r.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(a=f)}),(a&&a[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const a=this._getCurrentHash();if(a.length>=3&&!a.some(f=>isNaN(Number(f)))){const f=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(a[3]||0):r.getBearing();return r.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:f,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(rg,this.getHashString()))}}function ig(u,r){const a=u.getCenter(),f=Math.round(100*u.getZoom())/100,_=Math.ceil((f*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,_),w=Math.round(a.lng*x)/x,k=Math.round(a.lat*x)/x,A=u.getBearing(),P=u.getPitch();let D=r?`/${w}/${k}/${f}`:`${f}/${k}/${w}`;return(A||P)&&(D+="/"+Math.round(10*A)/10),P&&(D+=`/${Math.round(P)}`),D}const Jf={linearity:.3,easing:c.fV(0,0,.3,1)},o1=Object.assign({deceleration:2500,maxSpeed:1400},Jf),s1=Object.assign({deceleration:20,maxSpeed:1400},Jf),a1=Object.assign({deceleration:1e3,maxSpeed:360},Jf),l1=Object.assign({deceleration:1e3,maxSpeed:90},Jf);class c1{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.co.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,a=c.co.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const a={zoom:0,bearing:0,pitch:0,pan:new c.au(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)a.zoom+=x.zoomDelta||0,a.bearing+=x.bearingDelta||0,a.pitch+=x.pitchDelta||0,x.panDelta&&a.pan._add(x.panDelta),x.around&&(a.around=x.around),x.pinchAround&&(a.pinchAround=x.pinchAround);const f=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,_={};if(a.pan.mag()){const x=tp(a.pan.mag(),f,Object.assign({},o1,r||{}));_.offset=a.pan.mult(x.amount/a.pan.mag()),_.center=this._map.transform.center,ep(_,x)}if(a.zoom){const x=tp(a.zoom,f,s1);_.zoom=this._map.transform.zoom+x.amount,ep(_,x)}if(a.bearing){const x=tp(a.bearing,f,a1);_.bearing=this._map.transform.bearing+c.bG(x.amount,-179,179),ep(_,x)}if(a.pitch){const x=tp(a.pitch,f,l1);_.pitch=this._map.transform.pitch+x.amount,ep(_,x)}if(_.zoom||_.bearing){const x=a.pinchAround===void 0?a.around:a.pinchAround;_.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),_.noMoveStart=!0,_}}function ep(u,r){(!u.duration||u.duration<r.duration)&&(u.duration=r.duration,u.easing=r.easing)}function tp(u,r,a){const{maxSpeed:f,linearity:_,deceleration:x}=a,w=c.bG(u*_/(r/1e3),-f,f),k=Math.abs(w)/(x*_);return{easing:a.easing,duration:1e3*k,amount:w*(k/2)}}class Os extends c.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,f,_={}){const x=Bt(a.getCanvasContainer(),f),w=a.unproject(x);super(r,Object.assign({point:x,lngLat:w,originalEvent:f},_)),this._defaultPrevented=!1,this.target=a}}class np extends c.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,f){const _=r==="touchend"?f.changedTouches:f.touches,x=Dt(a.getCanvasContainer(),_),w=x.map(A=>a.unproject(A)),k=x.reduce((A,P,D,z)=>A.add(P.div(z.length)),new c.au(0,0));super(r,{points:x,point:k,lngLats:w,lngLat:a.unproject(k),originalEvent:f}),this._defaultPrevented=!1}}class u1 extends c.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a){super("wheel",{originalEvent:a}),this._defaultPrevented=!1}}class j2{constructor(r,a){this._map=r,this._clickTolerance=a.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new u1(this._map,r))}mousedown(r,a){return this._mousedownPos=a,this._firePreventable(new Os(r.type,this._map,r))}mouseup(r){this._map.fire(new Os(r.type,this._map,r))}preclick(r){const a=new MouseEvent("preclick",r);this._map.fire(new Os(a.type,this._map,a))}click(r,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||(this.preclick(r),this._map.fire(new Os(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new Os(r.type,this._map,r))}mouseover(r){this._map.fire(new Os(r.type,this._map,r))}mouseout(r){this._map.fire(new Os(r.type,this._map,r))}touchstart(r){return this._firePreventable(new np(r.type,this._map,r))}touchmove(r){this._map.fire(new np(r.type,this._map,r))}touchend(r){this._map.fire(new np(r.type,this._map,r))}touchcancel(r){this._map.fire(new np(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class U2{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new Os(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Os("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new Os(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class G2{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,a){this.isEnabled()&&r.shiftKey&&r.button===0&&(nt(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(r,a){if(!this._active)return;const f=a,_=this._startPos,x=this._lastPos;if(!_||!x||x.equals(f)||!this._box&&f.dist(_)<this._clickTolerance)return;this._lastPos=f,this._box||(this._box=re("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",r));const w=Math.min(_.x,f.x),k=Math.max(_.x,f.x),A=Math.min(_.y,f.y),P=Math.max(_.y,f.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${w}px,${A}px)`,this._box.style.width=k-w+"px",this._box.style.height=P-A+"px")})}mouseupWindow(r,a){if(!this._active)return;const f=this._startPos,_=a;if(f&&r.button===0){if(this.reset(),At(),f.x!==_.x||f.y!==_.y)return this._map.fire(new c.x("boxzoomend",{originalEvent:r})),{cameraAnimation:x=>x.fitScreenCoordinates(f,_,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Xe(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new c.x(r,{originalEvent:a}))}}function Cv(u,r){const a={};for(let f=0;f<u.length;f++)a[u[f].identifier]=r[f];return a}class pr{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,a,f){(this.centroid||f.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),f.length===this.numTouches&&(this.centroid=function(_){const x=new c.au(0,0);for(const w of _)x._add(w);return x.div(_.length)}(a),this.touches=Cv(f,a)))}touchmove(r,a,f){if(this.aborted||!this.centroid)return;const _=Cv(f,a);for(const x in this.touches){const w=_[x];(!w||w.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(r,a,f){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),f.length===0){const _=!this.aborted&&this.centroid;if(this.reset(),_)return _}}}class Xc{constructor(r){this.singleTap=new pr(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,a,f){this.singleTap.touchstart(r,a,f)}touchmove(r,a,f){this.singleTap.touchmove(r,a,f)}touchend(r,a,f){const _=this.singleTap.touchend(r,a,f);if(_){const x=r.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(_)<30;if(x&&w||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=_,this.count===this.numTaps)return this.reset(),_}}}class $2{constructor(){this._zoomIn=new Xc({numTouches:1,numTaps:2}),this._zoomOut=new Xc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,a,f){this._zoomIn.touchstart(r,a,f),this._zoomOut.touchstart(r,a,f)}touchmove(r,a,f){this._zoomIn.touchmove(r,a,f),this._zoomOut.touchmove(r,a,f)}touchend(r,a,f){const _=this._zoomIn.touchend(r,a,f),x=this._zoomOut.touchend(r,a,f);return _?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:w=>w.easeTo({duration:300,zoom:w.getZoom()+1,around:w.unproject(_)},{originalEvent:r})}):x?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:w=>w.easeTo({duration:300,zoom:w.getZoom()-1,around:w.unproject(x)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const H2=0,W2=2,rp={[H2]:1,[W2]:2},Iv={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class ip{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,a){return!1}_move(r,a){return{}}mousedown(r,a){if(this._lastPoint)return;const f=It(r);this._correctButton(r,f)&&(this._lastPoint=a,this._eventButton=f)}mousemoveWindow(r,a){const f=this._lastPoint;if(f){if(r.preventDefault(),this._eventButton!=null&&function(_,x){const w=rp[x];return _.buttons===void 0||(_.buttons&w)!==w}(r,this._eventButton))this.reset();else if(this._moved||!(a.dist(f)<this._clickTolerance))return this._moved=!0,this._lastPoint=a,this._move(f,a)}}mouseupWindow(r){this._lastPoint&&It(r)===this._eventButton&&(this._moved&&At(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class og extends ip{mousedown(r,a){super.mousedown(r,a),this._lastPoint&&(this._active=!0)}_correctButton(r,a){return a===0&&!r.ctrlKey}_move(r,a){return{around:a,panDelta:a.sub(r)}}}class Ka extends ip{constructor(r){super(r),this._pitchRotateKey=r.pitchRotateKey?Iv[r.pitchRotateKey]:void 0}_correctButton(r,a){return this._pitchRotateKey?a===0&&r[this._pitchRotateKey]:a===0&&r.ctrlKey||a===2}_move(r,a){const f=.8*(a.x-r.x);if(f)return this._active=!0,{bearingDelta:f}}contextmenu(r){this._pitchRotateKey||r.preventDefault()}}class op extends ip{constructor(r){super(r),this._pitchRotateKey=r.pitchRotateKey?Iv[r.pitchRotateKey]:void 0}_correctButton(r,a){return this._pitchRotateKey?a===0&&r[this._pitchRotateKey]:a===0&&r.ctrlKey||a===2}_move(r,a){const f=-.5*(a.y-r.y);if(f)return this._active=!0,{pitchDelta:f}}contextmenu(r){this._pitchRotateKey||r.preventDefault()}}class Ti{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset(),c.bs(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new c.au(0,0)}touchstart(r,a,f){return this._calculateTransform(r,a,f)}touchmove(r,a,f){if(this._active&&!(f.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(f.length===1&&!c.dA())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,a,f)}}touchend(r,a,f){this._calculateTransform(r,a,f),this._active&&f.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,a,f){f.length>0&&(this._active=!0);const _=Cv(f,a),x=new c.au(0,0),w=new c.au(0,0);let k=0;for(const P in _){const D=_[P],z=this._touches[P];z&&(x._add(D),w._add(D.sub(z)),k++,_[P]=D)}if(this._touches=_,k<this._minTouches||!w.mag())return;const A=w.div(k);return this._sum._add(A),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(k),panDelta:A}}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=re("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 Fs{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,a,f){return{}}touchstart(r,a,f){this._firstTwoTouches||f.length<2||(this._firstTwoTouches=[f[0].identifier,f[1].identifier],this._start([a[0],a[1]]))}touchmove(r,a,f){const _=this._firstTwoTouches;if(!_)return;r.preventDefault();const[x,w]=_,k=Kc(f,a,x),A=Kc(f,a,w);if(!k||!A)return;const P=this._aroundCenter?null:k.add(A).div(2);return this._move([k,A],P,r)}touchend(r,a,f){if(!this._firstTwoTouches)return;const[_,x]=this._firstTwoTouches,w=Kc(f,a,_),k=Kc(f,a,x);w&&k||(this._active&&At(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Kc(u,r,a){for(let f=0;f<u.length;f++)if(u[f].identifier===a)return r[f]}function d1(u,r){return Math.log2(u/r)}class Mv extends Fs{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,a){const f=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(d1(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:d1(this._distance,f),pinchAround:a}}}function Pv(u,r){return 180*u.angleWith(r)/Math.PI}class sp extends Fs{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,a){const f=this._vector;if(this._vector=r[0].sub(r[1]),f&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Pv(this._vector,f),pinchAround:a}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());const a=25/(Math.PI*this._minDiameter)*360,f=this._startVector;if(!f)return!1;const _=Pv(r,f);return Math.abs(_)<a}}function ap(u){return Math.abs(u.y)>Math.abs(u.x)}class Dv extends Fs{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,ap(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,a,f){const _=this._lastPoints;if(!_)return;const x=r[0].sub(_[0]),w=r[1].sub(_[1]);return this._map._cooperativeGestures&&!c.dA()&&f.touches.length<3||(this._valid=this.gestureBeginsVertically(x,w,f.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(x.y+w.y)/2*-.5})}gestureBeginsVertically(r,a,f){if(this._valid!==void 0)return this._valid;const _=r.mag()>=2,x=a.mag()>=2;if(!_&&!x)return;if(!_||!x)return this._firstMove==null&&(this._firstMove=f),f-this._firstMove<100&&void 0;const w=r.y>0==a.y>0;return ap(r)&&ap(a)&&w}}const sg={panStep:100,bearingStep:15,pitchStep:10};class ag{constructor(){const r=sg;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1,this._panDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let a=0,f=0,_=0,x=0,w=0;switch(r.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:r.shiftKey?f=-1:(r.preventDefault(),x=-1);break;case 39:r.shiftKey?f=1:(r.preventDefault(),x=1);break;case 38:r.shiftKey?_=1:(r.preventDefault(),w=-1);break;case 40:r.shiftKey?_=-1:(r.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(f=0,_=0),this._panDisabled&&(x=0,w=0),{cameraAnimation:k=>{const A=k.getZoom();k.easeTo({duration:300,easeId:"keyboardHandler",easing:lp,zoom:a?Math.round(A)+a*(r.shiftKey?2:1):A,bearing:k.getBearing()+f*this._bearingStep,pitch:k.getPitch()+_*this._pitchStep,offset:[-x*this._panStep,-w*this._panStep],center:k.getCenter()},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}disablePan(){this._panDisabled=!0}enablePan(){this._panDisabled=!1}}function lp(u){return u*(2-u)}const Il=4.000244140625,Ml=1/450,Pl=/(Mac|iPad)/i;class qu{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Ml,c.bs(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||c.dA()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const f=c.co.now(),_=f-(this._lastWheelEventTime||0);this._lastWheelEventTime=f,a!==0&&a%Il===0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":_>400?(this._type=null,this._lastValue=a,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(_*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const a=Bt(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:a,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 r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const P=this._type==="wheel"&&Math.abs(this._delta)>Il?this._wheelZoomRate:this._defaultZoomRate;let D=2/(1+Math.exp(-Math.abs(this._delta*P)));this._delta<0&&D!==0&&(D=1/D);const z=a(),F=Math.pow(2,z),j=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):F;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(j*D))),this._type==="wheel"&&(this._startZoom=z,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:a(),_=this._startZoom,x=this._easing;let w,k=!1;if(this._type==="wheel"&&_&&x){const P=Math.min((c.co.now()-this._lastWheelEventTime)/200,1),D=x(P);w=c.dY(_,f,D),P<1?this._frameId||(this._frameId=!0):k=!0}else w=f,k=!0;this._active=!0,k&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let A=w-a();return A*this._lastDelta<0&&(A=0),{noInertia:!0,needsRenderFrame:!k,zoomDelta:A,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=c.ca;if(this._prevEase){const f=this._prevEase,_=(c.co.now()-f.start)/f.duration,x=f.easing(_+.01)-f.easing(_),w=.27/Math.sqrt(x*x+1e-4)*.01,k=Math.sqrt(.0729-w*w);a=c.fV(w,k,.25,1)}return this._prevEase={start:c.co.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=re("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=Pl.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 Ya{constructor(r,a){this._clickZoom=r,this._tapZoom=a}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class q2{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,a){return r.preventDefault(),{cameraAnimation:f=>{f.easeTo({duration:300,zoom:f.getZoom()+(r.shiftKey?-1:1),around:f.unproject(a)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Z2{constructor(){this._tap=new Xc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,a,f){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?f.length>0&&(this._swipePoint=a[0],this._swipeTouch=f[0].identifier):this._tap.touchstart(r,a,f))}touchmove(r,a,f){if(this._tapTime){if(this._swipePoint){if(f[0].identifier!==this._swipeTouch)return;const _=a[0],x=_.y-this._swipePoint.y;return this._swipePoint=_,r.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(r,a,f)}touchend(r,a,f){this._tapTime?this._swipePoint&&f.length===0&&this.reset():this._tap.touchend(r,a,f)&&(this._tapTime=r.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class X2{constructor(r,a,f){this._el=r,this._mousePan=a,this._touchPan=f}enable(r){this._inertiaOptions=r||{},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 K2{constructor(r,a,f){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=a,this._mousePitch=f,this._pitchDisabled=!1}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&!this._pitchDisabled&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._pitchDisabled||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}disablePitch(){this._pitchDisabled=!0,this._mousePitch.disable()}enablePitch(){this._pitchDisabled=!1,this._pitchWithRotate&&this._mouseRotate.isEnabled()&&this._mousePitch.enable()}}class h1{constructor(r,a,f,_){this._el=r,this._touchZoom=a,this._touchRotate=f,this._tapDragZoom=_,this._rotationDisabled=!1,this._tapDragZoomDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoomDisabled||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._tapDragZoomDisabled||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()}disableTapDragZoom(){this._tapDragZoomDisabled=!0,this._tapDragZoom.disable()}enableTapDragZoom(){this._tapDragZoomDisabled=!1,this._touchZoom.isEnabled()&&this._tapDragZoom.enable()}}const nh=u=>u.zoom||u.drag||u.pitch||u.rotate;class lg extends c.x{}class Y2{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){const f=c.fx([],a,r);this.radius=c.dW(f[2]<0?c.c6([],f,this.constants):[f[0],f[1],0])}projectRay(r){c.c6(r,r,this.constants),c.ex(r,r),c.ep(r,r,this.constants);const a=c.fa([],r,this.radius);if(a[2]>0){const f=c.fa([],[0,0,1],c.c7(a,[0,0,1])),_=c.fa([],c.ex([],[a[0],a[1],0]),this.radius),x=c.bj([],a,c.fa([],c.fx([],c.bj([],_,f),a),2));a[0]=x[0],a[1]=x[1]}return a}}function cg(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Q2{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new c1(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Y2,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),c.bs(["handleEvent","handleWindowEvent"],this);const f=this._el;this._listeners=[[f,"touchstart",{passive:!0}],[f,"touchmove",{passive:!1}],[f,"touchend",void 0],[f,"touchcancel",void 0],[f,"mousedown",void 0],[f,"mousemove",void 0],[f,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[f,"mouseover",void 0],[f,"mouseout",void 0],[f,"dblclick",void 0],[f,"click",void 0],[f,"keydown",{capture:!1}],[f,"keyup",void 0],[f,"wheel",{passive:!1}],[f,"contextmenu",void 0],[window,"blur",void 0]];for(const[_,x,w]of this._listeners){const k=_===document?this.handleWindowEvent:this.handleEvent;_.addEventListener(x,k,w)}}destroy(){for(const[r,a,f]of this._listeners){const _=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(a,_,f)}}_addDefaultHandlers(r){const a=this._map,f=a.getCanvasContainer();this._add("mapEvent",new j2(a,r));const _=a.boxZoom=new G2(a,r);this._add("boxZoom",_);const x=new $2,w=new q2;a.doubleClickZoom=new Ya(w,x),this._add("tapZoom",x),this._add("clickZoom",w);const k=new Z2;this._add("tapDragZoom",k);const A=a.touchPitch=new Dv(a);this._add("touchPitch",A);const P=new Ka(r),D=new op(r);a.dragRotate=new K2(r,P,D),this._add("mouseRotate",P,["mousePitch"]),this._add("mousePitch",D,["mouseRotate"]);const z=new og(r),F=new Ti(a,r);a.dragPan=new X2(f,z,F),this._add("mousePan",z),this._add("touchPan",F,["touchZoom","touchRotate"]);const j=new sp,$=new Mv;a.touchZoomRotate=new h1(f,$,j,k),this._add("touchRotate",j,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]),this._add("blockableMapEvent",new U2(a));const W=a.scrollZoom=new qu(a,this);this._add("scrollZoom",W,["mousePan"]);const J=a.keyboard=new ag;this._add("keyboard",J);for(const Q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[Q]&&a[Q].enable(r[Q])}_add(r,a,f){this._handlers.push({handlerName:r,handler:a,allowed:f}),this._handlersById[r]=a}stop(r){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!nh(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(r,a,f){for(const _ in r)if(!(_===f||a&&a.includes(_)))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const a=[];for(const f of r)this._el.contains(f.target)&&a.push(f);return a}handleEvent(r,a){this._updatingCamera=!0;const f=r.type==="renderFrame",_=f?void 0:r,x={needsRenderFrame:!1},w={},k={},A=r.touches?this._getMapTouches(r.touches):void 0,P=A?Dt(this._el,A):f?void 0:Bt(this._el,r);for(const{handlerName:F,handler:j,allowed:$}of this._handlers){if(!j.isEnabled())continue;let W;this._blockedByActive(k,$,F)?j.reset():j[a||r.type]&&(W=j[a||r.type](r,P,A),this.mergeHandlerResult(x,w,W,F,_),W&&W.needsRenderFrame&&this._triggerRenderFrame()),(W||j.isActive())&&(k[F]=j)}const D={};for(const F in this._previousActiveHandlers)k[F]||(D[F]=_);this._previousActiveHandlers=k,(Object.keys(D).length||cg(x))&&(this._changes.push([x,w,D]),this._triggerRenderFrame()),(Object.keys(k).length||cg(x))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:z}=x;z&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],z(this._map))}mergeHandlerResult(r,a,f,_,x){if(!f)return;Object.assign(r,f);const w={handlerName:_,originalEvent:f.originalEvent||x};f.zoomDelta!==void 0&&(a.zoom=w),f.panDelta!==void 0&&(a.drag=w),f.pitchDelta!==void 0&&(a.pitch=w),f.bearingDelta!==void 0&&(a.rotate=w)}_applyChanges(){const r={},a={},f={};for(const[_,x,w]of this._changes)_.panDelta&&(r.panDelta=(r.panDelta||new c.au(0,0))._add(_.panDelta)),_.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+_.zoomDelta),_.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+_.bearingDelta),_.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+_.pitchDelta),_.around!==void 0&&(r.around=_.around),_.aroundCoord!==void 0&&(r.aroundCoord=_.aroundCoord),_.pinchAround!==void 0&&(r.pinchAround=_.pinchAround),_.noInertia&&(r.noInertia=_.noInertia),Object.assign(a,x),Object.assign(f,w);this._updateMapTransform(r,a,f),this._changes=[]}_updateMapTransform(r,a,f){const _=this._map,x=_.transform,w=ce=>[ce.x,ce.y,ce.z];if((()=>{const ce=this._eventsInProgress.drag;return ce&&!this._handlersById[ce.handlerName].isActive()})()&&!cg(r)){const ce=x.zoom;x.cameraElevationReference="sea",this._originalZoom!=null&&x._orthographicProjectionAtLowPitch&&x.projection.name!=="globe"&&x.pitch===0?(x.cameraElevationReference="ground",x.zoom=this._originalZoom):(x.recenterOnTerrain(),x.cameraElevationReference="ground"),ce!==x.zoom&&this._map._update(!0)}if(x._isCameraConstrained&&_._stop(!0),!cg(r))return void this._fireEvents(a,f,!0);let{panDelta:k,zoomDelta:A,bearingDelta:P,pitchDelta:D,around:z,aroundCoord:F,pinchAround:j}=r;x._isCameraConstrained&&(A>0&&(A=0),x._isCameraConstrained=!1),j!==void 0&&(z=j),(A||(ce=>a[ce]&&!this._eventsInProgress[ce])("drag"))&&z&&(this._dragOrigin=w(x.pointCoordinate3D(z)),this._originalZoom=x.zoom,this._trackingEllipsoid.setup(x._camera.position,this._dragOrigin)),x.cameraElevationReference="sea",_._stop(!0),z=z||_.transform.centerPoint,P&&(x.bearing+=P),D&&(x.pitch+=D),x._updateCameraState();const $=[0,0,0];if(k)if(x.projection.name==="mercator"){const ce=this._trackingEllipsoid.projectRay(x.screenPointToMercatorRay(z).dir),fe=this._trackingEllipsoid.projectRay(x.screenPointToMercatorRay(z.sub(k)).dir);$[0]=fe[0]-ce[0],$[1]=fe[1]-ce[1]}else{const ce=x.pointCoordinate(z);if(x.projection.name==="globe"){k=k.rotate(-x.angle);const fe=x._pixelsPerMercatorPixel/x.worldSize;$[0]=-k.x*c.ej(c.dT(ce.y))*fe,$[1]=-k.y*c.ej(x.center.lat)*fe}else{const fe=x.pointCoordinate(z.sub(k));ce&&fe&&($[0]=fe.x-ce.x,$[1]=fe.y-ce.y)}}const W=x.zoom,J=[0,0,0];if(A){const ce=w(F||x.pointCoordinate3D(z)),fe={dir:c.ex([],c.fx([],ce,x._camera.position))};if(fe.dir[2]<0){const se=x.zoomDeltaToMovement(ce,A);c.fa(J,fe.dir,se)}}const Q=c.bj($,$,J);x._translateCameraConstrained(Q),A&&Math.abs(x.zoom-W)>1e-4&&x.recenterOnTerrain(),x.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,f,!0)}_fireEvents(r,a,f){const _=nh(this._eventsInProgress),x=nh(r),w={};for(const D in r){const{originalEvent:z}=r[D];this._eventsInProgress[D]||(w[`${D}start`]=z),this._eventsInProgress[D]=r[D]}!_&&x&&this._fireEvent("movestart",x.originalEvent);for(const D in w)this._fireEvent(D,w[D]);x&&this._fireEvent("move",x.originalEvent);for(const D in r){const{originalEvent:z}=r[D];this._fireEvent(D,z)}const k={};let A;for(const D in this._eventsInProgress){const{handlerName:z,originalEvent:F}=this._eventsInProgress[D];this._handlersById[z].isActive()||(delete this._eventsInProgress[D],A=a[z]||F,k[`${D}end`]=A)}for(const D in k)this._fireEvent(D,k[D]);const P=nh(this._eventsInProgress);if(f&&(_||x)&&!P){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;D?(z(D.bearing||this._map.getBearing())&&(D.bearing=0),this._map.easeTo(D,{originalEvent:A})):(this._map.fire(new c.x("moveend",{originalEvent:A})),z(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,a){this._map.fire(new c.x(r,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(r=>{this._frameId=void 0,this.handleEvent(new lg("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const f1="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class J2 extends c.y{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=a.respectPrefersReducedMotion!==!1,c.bs(["_renderFrameCallback"],this)}getCenter(){return new c.ab(this.transform.center.lng,this.transform.center.lat)}setCenter(r,a){return this.jumpTo({center:r},a)}panBy(r,a,f){return r=c.au.convert(r).mult(-1),this.panTo(this.transform.center,Object.assign({offset:r},a),f)}panTo(r,a,f){return this.easeTo(Object.assign({center:r},a),f)}getZoom(){return this.transform.zoom}setZoom(r,a){return this.jumpTo({zoom:r},a),this}zoomTo(r,a,f){return this.easeTo(Object.assign({zoom:r},a),f)}zoomIn(r,a){return this.zoomTo(this.getZoom()+1,r,a),this}zoomOut(r,a){return this.zoomTo(this.getZoom()-1,r,a),this}getBearing(){return this.transform.bearing}setBearing(r,a){return this.jumpTo({bearing:r},a),this}getPadding(){return this.transform.padding}setPadding(r,a){return this.jumpTo({padding:r},a),this}rotateTo(r,a,f){return this.easeTo(Object.assign({bearing:r},a),f)}resetNorth(r,a){return this.rotateTo(0,Object.assign({duration:1e3},r),a),this}resetNorthPitch(r,a){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},r),a),this}snapToNorth(r,a){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,a):this}getPitch(){return this.transform.pitch}setPitch(r,a){return this.jumpTo({pitch:r},a),this}cameraForBounds(r,a){r=c.ac.convert(r);const f=a&&a.bearing||0,_=a&&a.pitch||0,x=r.getNorthWest(),w=r.getSouthEast();return this._cameraForBounds(this.transform,x,w,f,_,a)}_extendPadding(r){const a={top:0,right:0,bottom:0,left:0};return r==null?Object.assign({},a,this.transform.padding):typeof r=="number"?{top:r,bottom:r,right:r,left:r}:Object.assign({},a,r)}_extendCameraOptions(r){return(r=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding=this._extendPadding(r.padding),r}_minimumAABBFrustumDistance(r,a){const f=a.max[0]-a.min[0],_=a.max[1]-a.min[1];return f/_>r.aspect?f/(2*Math.tan(.5*r.fovX)*r.aspect):_/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,a,f,_,x,w){const k=r.clone(),A=this._extendCameraOptions(w);k.bearing=_,k.pitch=x;const P=c.ab.convert(a),D=c.ab.convert(f),z=.5*(P.lat+D.lat),F=.5*(P.lng+D.lng),j=c.dU(z,F),$=c.ex([],j),W=c.ex([],c.c1([],$,[0,1,0])),J=c.c1([],W,$),Q=[W[0],W[1],W[2],0,J[0],J[1],J[2],0,$[0],$[1],$[2],0,0,0,0,1],ce=[j,c.dU(P.lat,P.lng),c.dU(D.lat,P.lng),c.dU(D.lat,D.lng),c.dU(P.lat,D.lng),c.dU(z,P.lng),c.dU(z,D.lng),c.dU(P.lat,F),c.dU(D.lat,F)];let fe=c.A.fromPoints(ce.map(Qe=>[c.c7(W,Qe),c.c7(J,Qe),c.c7($,Qe)]));const se=c.fL([],fe.center,Q);c.fu(se)===0&&c.ff(se,0,0,1),c.ex(se,se),c.fa(se,se,c.P),k.center=c.cd(se);const Ae=k.getWorldToCameraMatrix(),Ee=c.dr(new Float64Array(16),Ae);fe=c.A.applyTransform(fe,c.er([],Ae,Q));const Pe=this._extendAABB(fe,k,A,_);if(!Pe)return void c.f_("Map cannot fit within canvas with the given bounds, padding, and/or offset.");fe=Pe,c.fL(se,se,Ae);const ye=.5*(fe.max[2]-fe.min[2]),be=this._minimumAABBFrustumDistance(k,fe),Ce=c.fa([],[0,0,1],ye),ze=c.bj(Ce,se,Ce),Oe=be+(k.pitch===0?0:c.c5(se,ze)),Ze=k.globeCenterInViewSpace,We=c.fx([],se,[Ze[0],Ze[1],Ze[2]]);c.ex(We,We),c.fa(We,We,Oe);const ut=c.bj([],se,We);c.fL(ut,ut,Ee);const Ne=c.c9/c.P,Je=c.dW(ut),Be=c.em(Math.max(Je*Ne-c.c9,Number.EPSILON),0),it=Math.min(k.zoomFromMercatorZAdjusted(Be),A.maxZoom);return it>.5*(c.S+c.R)?(k.setProjection({name:"mercator"}),k.zoom=it,this._cameraForBounds(k,a,f,_,x,w)):{center:k.center,zoom:it,bearing:_,pitch:x}}_extendAABB(r,a,f,_){const x=.5*((f.padding.left||0)+(f.padding.right||0)),w=.5*((f.padding.top||0)+(f.padding.bottom||0)),k=w,A=x,P=x,D=w,z=a.width-(A+P),F=a.height-(k+D),j=c.fx([],r.max,r.min),$=Math.min(z/j[0],F/j[1]),W=Math.min(a.scaleZoom(a.scale*$),f.maxZoom);if(isNaN(W))return null;const J=a.scale/a.zoomScale(W),Q=new c.A([r.min[0]-A*J,r.min[1]-D*J,r.min[2]],[r.max[0]+P*J,r.max[1]+k*J,r.max[2]]),ce=(typeof f.offset.x=="number"&&typeof f.offset.y=="number"?new c.au(f.offset.x,f.offset.y):c.au.convert(f.offset)).rotate(-c.c4(_));return Q.center[0]-=ce.x*J,Q.center[1]+=ce.y*J,Q}queryTerrainElevation(r,a){const f=this.transform.elevation;return f?(a=Object.assign({},{exaggerated:!0},a),f.getAtPoint(c.ag.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,f,_,x,w){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,a,f,_,x,w);const k=r.clone(),A=this._extendCameraOptions(w);k.bearing=_,k.pitch=x;const P=c.ab.convert(a),D=c.ab.convert(f),z=new c.ab(P.lng,D.lat),F=new c.ab(D.lng,P.lat),j=k.project(P),$=k.project(D),W=this.queryTerrainElevation(P),J=this.queryTerrainElevation(D),Q=this.queryTerrainElevation(z),ce=this.queryTerrainElevation(F),fe=[[j.x,j.y,Math.min(W||0,J||0,Q||0,ce||0)],[$.x,$.y,Math.max(W||0,J||0,Q||0,ce||0)]];let se=c.A.fromPoints(fe);const Ae=k.getWorldToCameraMatrix(),Ee=c.dr(new Float64Array(16),Ae);se=c.A.applyTransform(se,Ae);const Pe=this._extendAABB(se,k,A,_);if(!Pe)return void c.f_("Map cannot fit within canvas with the given bounds, padding, and/or offset.");se=Pe;const ye=.5*c.fx([],se.max,se.min)[2],be=this._minimumAABBFrustumDistance(k,se),Ce=[0,0,1,0];c.fM(Ce,Ce,Ae),c.ez(Ce,Ce);const ze=c.fa([],Ce,be+ye),Oe=c.bj([],se.center,ze);c.fL(se.center,se.center,Ee),c.fL(Oe,Oe,Ee);const Ze=k.unproject(new c.au(se.center[0],se.center[1])),We=c.dc(k.projection,Ze),ut=Math.pow(2,We),Ne=Math.min(k._zoomFromMercatorZ(Oe[2]*k.pixelsPerMeter*ut/k.worldSize),A.maxZoom);return k.mercatorFromTransition&&Ne<.5*(c.S+c.R)?(k.setProjection({name:"globe"}),k.zoom=Ne,this._cameraForBounds(k,a,f,_,x,w)):{center:Ze,zoom:Ne,bearing:_,pitch:x}}fitBounds(r,a,f){const _=this.cameraForBounds(r,a);return this._fitInternal(_,a,f)}fitScreenCoordinates(r,a,f,_,x){const w=c.au.convert(r),k=c.au.convert(a),A=new c.au(Math.min(w.x,k.x),Math.min(w.y,k.y)),P=new c.au(Math.max(w.x,k.x),Math.max(w.y,k.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(w,k))return this;const D=this.transform.pointLocation3D(A),z=this.transform.pointLocation3D(P),F=this.transform.pointLocation3D(new c.au(A.x,P.y)),j=this.transform.pointLocation3D(new c.au(P.x,A.y)),$=[Math.min(D.lng,z.lng,F.lng,j.lng),Math.min(D.lat,z.lat,F.lat,j.lat)],W=[Math.max(D.lng,z.lng,F.lng,j.lng),Math.max(D.lat,z.lat,F.lat,j.lat)],J=_&&_.pitch?_.pitch:this.getPitch(),Q=this._cameraForBounds(this.transform,$,W,f,J,_);return this._fitInternal(Q,_,x)}_fitInternal(r,a,f){return r?(a=Object.assign(r,a)).linear?this.easeTo(a,f):this.flyTo(a,f):this}jumpTo(r,a){this.stop();const f=r.preloadOnly?this.transform.clone():this.transform;let _=!1,x=!1,w=!1;"zoom"in r&&f.zoom!==+r.zoom&&(_=!0,f.zoom=+r.zoom),r.center!==void 0&&(f.center=c.ab.convert(r.center)),"bearing"in r&&f.bearing!==+r.bearing&&(x=!0,f.bearing=+r.bearing),"pitch"in r&&f.pitch!==+r.pitch&&(w=!0,f.pitch=+r.pitch);const k=typeof r.padding=="number"?this._extendPadding(r.padding):r.padding;if(r.padding!=null&&!f.isPaddingEqual(k))if(r.retainPadding===!1){const A=f.clone();A.padding=k,f.setLocationAtPoint(f.center,A.centerPoint)}else f.padding=k;return r.preloadOnly?(this._preloadTiles(f),this):(this.fire(new c.x("movestart",a)).fire(new c.x("move",a)),_&&this.fire(new c.x("zoomstart",a)).fire(new c.x("zoom",a)).fire(new c.x("zoomend",a)),x&&this.fire(new c.x("rotatestart",a)).fire(new c.x("rotate",a)).fire(new c.x("rotateend",a)),w&&this.fire(new c.x("pitchstart",a)).fire(new c.x("pitch",a)).fire(new c.x("pitchend",a)),this.fire(new c.x("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||c.f_(f1),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){const f=this.transform;if(!f.projection.supportsFreeCamera)return c.f_(f1),this;this.stop();const _=f.zoom,x=f.pitch,w=f.bearing;f.setFreeCameraOptions(r);const k=_!==f.zoom,A=x!==f.pitch,P=w!==f.bearing;return this.fire(new c.x("movestart",a)).fire(new c.x("move",a)),k&&this.fire(new c.x("zoomstart",a)).fire(new c.x("zoom",a)).fire(new c.x("zoomend",a)),P&&this.fire(new c.x("rotatestart",a)).fire(new c.x("rotate",a)).fire(new c.x("rotateend",a)),A&&this.fire(new c.x("pitchstart",a)).fire(new c.x("pitch",a)).fire(new c.x("pitchend",a)),this.fire(new c.x("moveend",a)),this}easeTo(r,a){this._stop(!1,r.easeId),((r=Object.assign({offset:[0,0],duration:500,easing:c.ca},r)).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const f=this.transform,_=this.getZoom(),x=this.getBearing(),w=this.getPitch(),k=this.getPadding(),A="zoom"in r?+r.zoom:_,P="bearing"in r?this._normalizeBearing(r.bearing,x):x,D="pitch"in r?+r.pitch:w,z=this._extendPadding(r.padding),F=c.au.convert(r.offset);let j,$,W;if(f.projection.name==="globe"){const Ce=c.ag.fromLngLat(f.center),ze=F.rotate(-f.angle);Ce.x+=ze.x/f.worldSize,Ce.y+=ze.y/f.worldSize;const Oe=Ce.toLngLat(),Ze=c.ab.convert(r.center||Oe);this._normalizeCenter(Ze),j=f.centerPoint.add(ze),$=new c.au(Ce.x,Ce.y).mult(f.worldSize),W=new c.au(c.ek(Ze.lng),c.el(Ze.lat)).mult(f.worldSize).sub($)}else{j=f.centerPoint.add(F);const Ce=f.pointLocation(j),ze=c.ab.convert(r.center||Ce);this._normalizeCenter(ze),$=f.project(Ce),W=f.project(ze).sub($)}const J=f.zoomScale(A-_);let Q,ce;r.around&&(Q=c.ab.convert(r.around),ce=f.locationPoint(Q));const fe=this._zooming||A!==_,se=this._rotating||x!==P,Ae=this._pitching||D!==w,Ee=!f.isPaddingEqual(z),Pe=r.retainPadding===!1?f.clone():f,ye=Ce=>ze=>{if(fe&&(Ce.zoom=c.dY(_,A,ze)),se&&(Ce.bearing=c.dY(x,P,ze)),Ae&&(Ce.pitch=c.dY(w,D,ze)),Ee&&(Pe.interpolatePadding(k,z,ze),j=Pe.centerPoint.add(F)),Q)Ce.setLocationAtPoint(Q,ce);else{const Oe=Ce.zoomScale(Ce.zoom-_),Ze=A>_?Math.min(2,J):Math.max(.5,J),We=Math.pow(Ze,1-ze),ut=Ce.unproject($.add(W.mult(ze*We)).mult(Oe));Ce.setLocationAtPoint(Ce.renderWorldCopies?ut.wrap():ut,j)}return r.preloadOnly||this._fireMoveEvents(a),Ce};if(r.preloadOnly){const Ce=this._emulate(ye,r.duration,f);return this._preloadTiles(Ce),this}const be={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=fe,this._rotating=se,this._pitching=Ae,this._padding=Ee,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,be),this._ease(ye(f),Ce=>{f.cameraElevationReference==="sea"&&f.recenterOnTerrain(),this._afterEase(a,Ce)},r),this}_prepareEase(r,a,f={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),a||f.moving||this.fire(new c.x("movestart",r)),this._zooming&&!f.zooming&&this.fire(new c.x("zoomstart",r)),this._rotating&&!f.rotating&&this.fire(new c.x("rotatestart",r)),this._pitching&&!f.pitching&&this.fire(new c.x("pitchstart",r))}_fireMoveEvents(r){this.fire(new c.x("move",r)),this._zooming&&this.fire(new c.x("zoom",r)),this._rotating&&this.fire(new c.x("rotate",r)),this._pitching&&this.fire(new c.x("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const f=this._zooming,_=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,f&&this.fire(new c.x("zoomend",r)),_&&this.fire(new c.x("rotateend",r)),x&&this.fire(new c.x("pitchend",r)),this.fire(new c.x("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){const Qe=c.eF(r,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Qe,a)}this.stop(),r=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:c.ca},r);const f=this.transform,_=this.getZoom(),x=this.getBearing(),w=this.getPitch(),k=this.getPadding(),A="zoom"in r?c.bG(+r.zoom,f.minZoom,f.maxZoom):_,P="bearing"in r?this._normalizeBearing(r.bearing,x):x,D="pitch"in r?+r.pitch:w,z=this._extendPadding(r.padding),F=f.zoomScale(A-_),j=c.au.convert(r.offset);let $=f.centerPoint.add(j);const W=f.pointLocation($),J=c.ab.convert(r.center||W);this._normalizeCenter(J);const Q=f.project(W),ce=f.project(J).sub(Q);let fe=r.curve;const se=Math.max(f.width,f.height),Ae=se/F,Ee=ce.mag();if("minZoom"in r){const Qe=c.bG(Math.min(r.minZoom,_,A),f.minZoom,f.maxZoom),ot=se/f.zoomScale(Qe-_);fe=Math.sqrt(ot/Ee*2)}const Pe=fe*fe;function ye(Qe){const ot=(Ae*Ae-se*se+(Qe?-1:1)*Pe*Pe*Ee*Ee)/(2*(Qe?Ae:se)*Pe*Ee);return Math.log(Math.sqrt(ot*ot+1)-ot)}function be(Qe){return(Math.exp(Qe)-Math.exp(-Qe))/2}function Ce(Qe){return(Math.exp(Qe)+Math.exp(-Qe))/2}const ze=ye(0);let Oe=function(Qe){return Ce(ze)/Ce(ze+fe*Qe)},Ze=function(Qe){return se*((Ce(ze)*(be(ot=ze+fe*Qe)/Ce(ot))-be(ze))/Pe)/Ee;var ot},We=(ye(1)-ze)/fe;if(Math.abs(Ee)<1e-6||!isFinite(We)){if(Math.abs(se-Ae)<1e-6)return this.easeTo(r,a);const Qe=Ae<se?-1:1;We=Math.abs(Math.log(Ae/se))/fe,Ze=function(){return 0},Oe=function(ot){return Math.exp(Qe*fe*ot)}}r.duration="duration"in r?+r.duration:1e3*We/("screenSpeed"in r?+r.screenSpeed/fe:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);const ut=x!==P,Ne=D!==w,Je=!f.isPaddingEqual(z),Be=r.retainPadding===!1?f.clone():f,it=Qe=>ot=>{const Et=ot*We,ht=1/Oe(Et);Qe.zoom=ot===1?A:_+Qe.scaleZoom(ht),ut&&(Qe.bearing=c.dY(x,P,ot)),Ne&&(Qe.pitch=c.dY(w,D,ot)),Je&&(Be.interpolatePadding(k,z,ot),$=Be.centerPoint.add(j));const gt=ot===1?J:Qe.unproject(Q.add(ce.mult(Ze(Et))).mult(ht));return Qe.setLocationAtPoint(Qe.renderWorldCopies?gt.wrap():gt,$),Qe._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),Qe};if(r.preloadOnly){const Qe=this._emulate(it,r.duration,f);return this._preloadTiles(Qe),this}return this._zooming=!0,this._rotating=ut,this._pitching=Ne,this._padding=Je,this._prepareEase(a,!1),this._ease(it(f),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(r){}_cancelRenderFrame(r){}_stop(r,a){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const f=this._onEaseEnd;this._onEaseEnd=void 0,f.call(this,a)}if(!r){const f=this.handlers;f&&f.stop(!1)}return this}_ease(r,a,f){f.animate===!1||f.duration===0?(r(1),a()):(this._easeStart=c.co.now(),this._easeOptions=f,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((c.co.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){r=c.f$(r,-180,180);const f=Math.abs(r-a);return Math.abs(r-360-a)<f&&(r-=360),Math.abs(r+360-a)<f&&(r+=360),r}_normalizeCenter(r){const a=this.transform;if(a.maxBounds||a.projection.name!=="globe"&&!a.renderWorldCopies)return;const f=r.lng-a.center.lng;r.lng+=f>180?-360:f<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&c.co.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,a,f){const _=Math.ceil(15*a/1e3),x=[],w=r(f.clone());for(let k=0;k<=_;k++){const A=w(k/_);x.push(A.clone())}return x}_preloadTiles(r,a){}}const eE=/^(https?:|mailto:)/i;class p1{constructor(r={}){this.options=r,c.bs(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const a=this.options&&this.options.compact,f=r._getUIString("AttributionControl.ToggleAttribution");this._map=r,this._container=re("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=re("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",f);const _=re("span","mapboxgl-ctrl-icon",this._compactButton);return _.setAttribute("aria-hidden","true"),_.setAttribute("title",f),this._innerContainer=re("div","mapboxgl-ctrl-attrib-inner",this._container),a&&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),a===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 r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||c.bN.ACCESS_TOKEN}];if(r){const f=a.reduce((_,x,w)=>(x.value&&(_+=`${x.key}=${x.value}${w<a.length-1?"&":""}`),_),"?");r.href=`${c.bN.FEEDBACK_URL}/${f}#${ig(this._map,!0)}`,r.rel="noopener nofollow"}}_updateData(r){!r||(r.dataType!=="source"||r.sourceDataType!=="metadata"&&r.sourceDataType!=="visibility")&&r.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let r=[];if(this._map.style.stylesheet){const _=this._map.style.stylesheet;this.styleOwner=_.owner,this.styleId=_.id}const a=this._map.style._mergedSourceCaches;for(const _ in a){const x=a[_];if(x.used){const w=x.getSource();w.attribution&&!r.includes(w.attribution)&&r.push(w.attribution)}}r.sort((_,x)=>_.length-x.length),r=r.filter((_,x)=>{for(let w=x+1;w<r.length;w++)if(r[w].includes(_))return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const f=r.map(_=>function(x){const w=new DOMParser().parseFromString(x,"text/html");return Array.from(w.body.querySelectorAll("*")).reverse().forEach(k=>{const A=k.textContent||"";if(k.tagName!=="A")return void k.replaceWith(...k.childNodes);const P=k.getAttribute("href");if(!P||!eE.test(P))return void k.replaceWith(w.createTextNode(A));const D=w.createElement("a");D.href=P,D.textContent=A,D.rel="noopener nofollow";const z=k.getAttribute("class");z&&(D.className=z),k.replaceWith(D)}),w.body.innerHTML}(_)).join(" | ");f!==this._attribHTML&&(this._attribHTML=f,r.length?(this._innerContainer.innerHTML=f,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 m1{constructor(){c.bs(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=re("div","mapboxgl-ctrl");const a=re("a","mapboxgl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://www.mapbox.com/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),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(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const a in r){const f=r[a].getSource();if(Object.hasOwn(f,"mapbox_logo")&&!f.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const a=r[0];this._map.getCanvasContainer().offsetWidth<250?a.classList.add("mapboxgl-compact"):a.classList.remove("mapboxgl-compact")}}}class g1{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const a=++this._id;return this._queue.push({callback:r,id:a,cancelled:!1}),a}remove(r){const a=this._currentlyRunning,f=a?this._queue.concat(a):this._queue;for(const _ of f)if(_.id===r)return void(_.cancelled=!0)}run(r=0){const a=this._currentlyRunning=this._queue;this._queue=[];for(const f of a)if(!f.cancelled&&(f.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Yc{constructor(r){this.jumpTo(r)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const a=c.cb((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,a,f){this._start=this.getValue(a),this._end=r,this._startTime=a,this._endTime=a+f}}const tE={"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 _1 extends c.x{constructor(r,a,f,_){const{point:x,lngLat:w,originalEvent:k,target:A}=r;super(r.type,{point:x,lngLat:w,originalEvent:k,target:A}),this.preventDefault=()=>{r.preventDefault()},this.id=a,this.interaction=f,this.feature=_}}class nE{constructor(r){this.map=r,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(r,a){if(this.typeById.has(r))throw new Error(`Interaction id "${r}" already exists.`);const f=a.filter;let _=a.type;f&&this.filters.set(r,c.bZ(f)),_==="mouseover"&&(_="mouseenter"),_==="mouseout"&&(_="mouseleave");const x=this.interactionsByType.get(_)||new Map;_==="mouseenter"||_==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(r,a)):x.size===0&&this.map.on(_,this.handleType),x.size===0&&this.interactionsByType.set(_,x),x.set(r,a),this.typeById.set(r,_)}get(r){const a=this.typeById.get(r);if(!a)return;const f=this.interactionsByType.get(a);return f?f.get(r):void 0}remove(r){const a=this.typeById.get(r);if(!a)return;this.typeById.delete(r),this.filters.delete(r);const f=this.interactionsByType.get(a);f&&(f.delete(r),a==="mouseenter"||a==="mouseleave"?(this.delegatedInteractions.delete(r),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):f.size===0&&this.map.off(a,this.handleType))}queryTargets(r,a){const f=[];for(const[_,x]of a)x.target&&f.push({targetId:_,target:x.target,filter:this.filters.get(_)});return this.map.style.queryRenderedTargets(r,f,this.map.transform)}handleMove(r){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const a=this.queryTargets(r.point,Array.from(this.delegatedInteractions).reverse());a.length&&(r.type="mouseenter",this.handleType(r,a));const f=new Map;for(const[_,{feature:x}]of this.prevHoveredFeatures)this.hoveredFeatures.has(_)||f.set(x.id,x);f.size&&(r.type="mouseleave",this.handleType(r,Array.from(f.values())))}handleOut(r){const a=Array.from(this.hoveredFeatures.values()).map(({feature:f})=>f);a.length&&(r.type="mouseleave",this.handleType(r,a)),this.hoveredFeatures.clear()}handleType(r,a){const f=r.type==="mouseenter";if(f&&!this.interactionsByType.has(r.type))return void c.f_("mouseenter interaction required for mouseleave to work.");const _=Array.from(this.interactionsByType.get(r.type)).reverse(),x=!!a;a=a||this.queryTargets(r.point,_);let w=!1;const k=new Set;for(const A of a){for(const[P,D]of _){if(!D.target)continue;const z=A.variants?A.variants[P]:null;if(z){for(const F of z){if(jy(F,A,k,P))continue;const j=new c.aZ(A,F),$=Bd(F,A,P);x&&j.id!==void 0&&(j.state=this.map.getFeatureState(j));const W=f?this.prevHoveredFeatures.get($):null,J=new _1(r,P,D,j),Q=W?W.stop:D.handler(J);if(f&&this.hoveredFeatures.set($,{feature:A,stop:Q}),Q!==!1){w=!0;break}}if(w)break}}if(w)break}if(!w)for(const[A,P]of _){const{handler:D,target:z}=P;if(!z&&D(new _1(r,A,P,null))!==!1)break}}}function Rv(u,r){if(Array.isArray(u)&&Array.isArray(r)){const a=new Set(u),f=new Set(r);return a.size===f.size&&u.every(_=>f.has(_))}return c.c2(u,r)}const Lv=/matrix.*\((.+)\)/,rE={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,fontstackCompositing:"client",transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},Ov={showCompass:!0,showZoom:!0,visualizePitch:!1};class iE{constructor(r,a,f=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new Ka({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,f&&(this.mousePitch=new op({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),c.bs(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(r,a){this.mouseRotate.mousedown(r,a),this.mousePitch&&this.mousePitch.mousedown(r,a),nt()}move(r,a){const f=this.map,_=this.mouseRotate.mousemoveWindow(r,a),x=_&&_.bearingDelta;if(x&&f.setBearing(f.getBearing()+x),this.mousePitch){const w=this.mousePitch.mousemoveWindow(r,a),k=w&&w.pitchDelta;k&&f.setPitch(f.getPitch()+k)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Xe(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(Object.assign({},r,{button:r.button,type:r.type,ctrlKey:!0,preventDefault:()=>r.preventDefault()}),Bt(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,Bt(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Dt(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=Dt(this.element,r.targetTouches)[0],this.move({buttons:1,preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.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 ug(u,r,a){if(u=new c.ab(u.lng,u.lat),r){const f=new c.ab(u.lng-360,u.lat),_=new c.ab(u.lng+360,u.lat),x=360*Math.ceil(Math.abs(u.lng-a.center.lng)/360),w=a.locationPoint3D(u).distSqr(r),k=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint3D(f).distSqr(r)<w&&(k||Math.abs(f.lng-a.center.lng)<x)?u=f:a.locationPoint3D(_).distSqr(r)<w&&(k||Math.abs(_.lng-a.center.lng)<x)&&(u=_)}for(;Math.abs(u.lng-a.center.lng)>180;){const f=a.locationPoint3D(u);if(f.x>=0&&f.y>=0&&f.x<=a.width&&f.y<=a.height)break;u.lng>a.center.lng?u.lng-=360:u.lng+=360}return u}const Fv={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%)"},zv=/\s+/,Dl={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class cp extends c.y{constructor(r,a){super(),(r instanceof HTMLElement||a)&&(r=Object.assign({element:r},a)),c.bs(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:f="center",color:_="#3FB1CE",scale:x=1,draggable:w=!1,clickTolerance:k=0,rotation:A=Dl.rotation,rotationAlignment:P=Dl.rotationAlignment,pitchAlignment:D=Dl.pitchAlignment,occludedOpacity:z=Dl.occludedOpacity,altitude:F=Dl.altitude}=r||{};this._anchor=f,this._color=_,this._scale=x,this._draggable=w,this._clickTolerance=k,this._rotation=A,this._rotationAlignment=P,this._pitchAlignment=D,this._occludedOpacity=z,this._altitude=F,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),r&&r.element?(this._element=r.element,this._offset=c.au.convert(r&&r.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=c.au.convert(r&&r.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",$=>{$.preventDefault()}),this._element.addEventListener("mousedown",$=>{$.preventDefault()});const j=this._element.classList;for(const $ in Fv)j.remove(`mapboxgl-marker-anchor-${$}`);j.add(`mapboxgl-marker-anchor-${this._anchor}`),r&&r.className&&j.add(...r.className.trim().split(zv)),this._popup=null}_createDefaultMarker(){const r=re("div"),a=he("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},r);this._svgElement=a;const f=he("radialGradient",{id:"shadowGradient"},he("defs",{},a));he("stop",{offset:"10%","stop-opacity":.4},f),he("stop",{offset:"100%","stop-opacity":.05},f);const _=he("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"});return this._shadowElement=_,this._altitude===0&&a.insertBefore(_,a.firstChild),he("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},a),he("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},a),he("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},a),r}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=c.ab.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(r){if(r===this._altitude)return this;const a=this._altitude;return this._altitude=r||Dl.altitude,this._defaultMarker&&a===0!=(this._altitude===0)&&(this._altitude===0?this._svgElement.insertBefore(this._shadowElement,this._svgElement.firstChild):this._shadowElement.remove()),this._update(),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(r){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")),r){if(!("offset"in r.options)){const _=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[_,-1*(38.1-13.5+_)],"bottom-right":[-_,-1*(38.1-13.5+_)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,r._marker=this,r._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(r){const a=r.code,f=r.charCode||r.keyCode;a!=="Space"&&a!=="Enter"&&f!==32&&f!==13||this.togglePopup()}_onMapClick(r){const a=r.originalEvent.target,f=this._element;this._popup&&(a===f||f.contains(a))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,a=this._pos;if(!r||!a)return!1;const f=r.unproject(a,this._altitude),_=r.getFreeCameraOptions();if(!_.position)return!1;const x=_.position.toLngLat();return x.distanceTo(f)<.9*x.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();const f=r.unproject(a,this._altitude);let _;r._showingGlobe()&&c.dE(r.transform,this._lngLat)?_=0:(_=1-r._queryFogOpacity(f),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(_*=this._occludedOpacity)),this._element.style.opacity=`${_}`,this._element.style.pointerEvents=_>0?"auto":"none",this._popup&&this._popup._setOpacity(_),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const a=this._offset.mult(this._scale);this._element.style.transform=`
|
||
translate(${r.x}px,${r.y}px)
|
||
${Fv[this._anchor]}
|
||
${this._calculateXYTransform()} ${this._calculateZTransform()}
|
||
translate(${a.x}px,${a.y}px)
|
||
`}_calculateXYTransform(){const r=this._pos,a=this._map,f=this.getPitchAlignment();if(!a||!r||f!=="map")return"";if(!a._showingGlobe()){const A=a.getPitch();return A?`rotateX(${A}deg)`:""}const _=c.eX(c.dl(a.transform,this._lngLat)),x=r.sub(c.dd(a.transform)),w=Math.abs(x.x)+Math.abs(x.y);if(w===0)return"";const k=_/w;return`rotateX(${-x.y*k}deg) rotateY(${x.x*k}deg)`}_calculateZTransform(){const r=this._pos,a=this._map;if(!a||!r)return"";let f=0;const _=this.getRotationAlignment();if(_==="map")if(a._showingGlobe()){const x=a.project(new c.ab(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),w=a.project(new c.ab(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(x);f=c.eX(Math.atan2(w.y,w.x))-90}else f=-a.getBearing();else if(_==="horizon"){const x=c.fq(4,6,a.getZoom()),w=c.dd(a.transform);w.y+=x*a.transform.height;const k=r.sub(w),A=c.eX(Math.atan2(k.y,k.x));f=(A>90?A-270:A+90)*(1-x)}return f+=this._rotation,f?`rotateZ(${f}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const a=this._map;a&&(a.transform.renderWorldCopies&&(this._lngLat=ug(this._lngLat,this._pos,a.transform)),this._pos=a.project(this._lngLat,this._altitude),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),a._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(a._showingGlobe()||a.getTerrain()||a.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=c.au.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const a=this._map;if(!a)return;const f=this._pointerdownPos,_=this._positionDelta;if(f&&_){if(!this._isDragging){const x=this._clickTolerance||a._clickTolerance;if(r.point.dist(f)<x)return;this._isDragging=!0}this._pos=r.point.sub(_),this._lngLat=a.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.x("dragstart"))),this.fire(new c.x("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new c.x("dragend")),this._state="inactive"}_addDragHandler(r){const a=this._map,f=this._pos;a&&f&&this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(f),this._pointerdownPos=r.point,this._state="pending",a.on("mousemove",this._onMove),a.on("touchmove",this._onMove),a.once("mouseup",this._onUp),a.once("touchend",this._onUp))}setDraggable(r){this._draggable=!!r;const a=this._map;return a&&(r?(a.on("mousedown",this._addDragHandler),a.on("touchstart",this._addDragHandler)):(a.off("mousedown",this._addDragHandler),a.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||Dl.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||Dl.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r||Dl.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(r){return this._occludedOpacity=r||Dl.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Zu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},y1={maxWidth:100,unit:"metric"},Qc={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},v1=/\s+/,rh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},ih=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function dg(u=new c.au(0,0),r="bottom"){if(typeof u=="number"){const a=Math.round(Math.sqrt(.5*Math.pow(u,2)));switch(r){case"top":return new c.au(0,u);case"top-left":return new c.au(a,a);case"top-right":return new c.au(-a,a);case"bottom":return new c.au(0,-u);case"bottom-left":return new c.au(a,-a);case"bottom-right":return new c.au(-a,-a);case"left":return new c.au(u,0);case"right":return new c.au(-u,0)}return new c.au(0,0)}return u instanceof c.au||Array.isArray(u)?c.au.convert(u):c.au.convert(u[r]||[0,0])}const rc=typeof document<"u"?document.currentScript:null;var Bv;return Bv=rc&&rc.src&&c.dF(rc.src)?"cdn":"other",$n=Bv,{version:T,supported:function(u){return!function(r){return typeof window<"u"&&typeof document<"u"?Object.hasOwn?function(){const a=document.createElement("canvas");a.width=a.height=1;const f=a.getContext("2d");return!!f&&f.getImageData(0,0,1,1).width===a.width}()?function(a){return a?(ae===void 0&&(ae=ne(!0)),ae):(X===void 0&&(X=ne(!1)),X)}(r)?"":"insufficient WebGL2 support":"insufficient Canvas/getImageData support":"Object.hasOwn not supported":"not a browser"}(u)},setRTLTextPlugin:c.fo,getRTLTextPluginStatus:c.d3,setSdkInfo:function(u){typeof u!="string"||u.length>64||!wo.test(u)?c.f_(`Invalid SDK info "${u}"; expected a "Name/version" string. Ignoring.`):Ni=u},addTileProvider:c.bm,Map:class extends J2{constructor(u){B.mark(L.create);const r=u;if((u=Object.assign({},rE,u)).minZoom!=null&&u.maxZoom!=null&&u.minZoom>u.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(u.minPitch!=null&&u.maxPitch!=null&&u.minPitch>u.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(u.minPitch!=null&&u.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(u.maxPitch!=null&&u.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");u.antialias&&c.dO(window)&&(u.antialias=!1,c.f_("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new bi(u.minZoom,u.maxZoom,u.minPitch,u.maxPitch,u.renderWorldCopies,null,null),u),this._repaint=!!u.repaint,this._interactive=u.interactive,this._minTileCacheSize=u.minTileCacheSize,this._maxTileCacheSize=u.maxTileCacheSize,this._failIfMajorPerformanceCaveat=u.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=u.preserveDrawingBuffer,this._antialias=u.antialias,this._trackResize=u.trackResize,this._bearingSnap=u.bearingSnap,this._refreshExpiredTiles=u.refreshExpiredTiles,this._fadeDuration=u.fadeDuration,this._placementAlgorithm=u.placementAlgorithm||"default",this._isInitialLoad=!0,this._crossSourceCollisions=u.crossSourceCollisions,this._collectResourceTiming=u.collectResourceTiming,this._language=this._parseLanguage(u.language),this._worldview=u.worldview,this._renderTaskQueue=new g1,this._domRenderTaskQueue=new g1,this._controls=[],this._markers=[],this._popups=[],this._mapId=c.fU(),this._locale=Object.assign({},tE,u.locale),this._clickTolerance=u.clickTolerance,this._cooperativeGestures=u.cooperativeGestures,this._performanceMetricsCollection=u.performanceMetricsCollection,this._tessellationStep=u.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=u.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Yc(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=u.scaleFactor,this._requestManager=new bn(u.transformRequest,u.accessToken,u.testMode);const a=Kn(u.accessToken||c.bN.ACCESS_TOKEN);if(a&&"atlas"in a&&typeof a.atlas=="number"&&(this._tokenExpiration=a.atlas),this._silenceAuthErrors=!!u.testMode,this._contextCreateOptions=u.contextCreateOptions?Object.assign({},u.contextCreateOptions):{},typeof u.container=="string"){const f=document.getElementById(u.container);if(!f)throw new Error(`Container '${u.container.toString()}' not found.`);this._container=f}else{if(!(u.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=u.container}if(this._container.childNodes.length>0&&c.f_("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."),u.maxBounds&&this.setMaxBounds(u.maxBounds),this._spriteFormat="auto",c.bs(["_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 Q2(this,u),this._localFontFamily=u.localFontFamily,this._localIdeographFontFamily=u.localIdeographFontFamily,this._fontstackCompositing=u.fontstackCompositing,(u.style||!u.testMode)&&this.setStyle(u.style||c.bN.DEFAULT_STYLE,{config:u.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),u.projection&&this.setProjection(u.projection),u.hash&&(this._hash=new i1(typeof u.hash=="string"&&u.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch});const f=u.bounds;f&&(this.resize(),this.fitBounds(f,Object.assign({},u.fitBoundsOptions,{duration:0})))}this.resize(),u.attributionControl&&this.addControl(new p1({customAttribution:u.customAttribution})),this._logoControl=new m1,this.addControl(this._logoControl,u.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",f=>{this._update(f.dataType==="style"),this.fire(new c.x(`${f.dataType}data`,f))}),this.on("dataloading",f=>{this.fire(new c.x(`${f.dataType}dataloading`,f))}),this._interactions=new nE(this)}_getMapId(){return this._mapId}addControl(u,r){if(r===void 0&&(r=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.v(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=u.onAdd(this);this._controls.push(u);const f=this._controlPositions[r];return r.includes("bottom")?f.insertBefore(a,f.firstChild):f.appendChild(a),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.v(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(u);return r>-1&&this._controls.splice(r,1),u.onRemove(this),this}hasControl(u){return this._controls.includes(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(u){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 r=!this._moving;return r&&this.fire(new c.x("movestart",u)).fire(new c.x("move",u)),this.fire(new c.x("resize",u)),r&&this.fire(new c.x("moveend",u)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(u){return this.transform.setMaxBounds(c.ac.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()<u?this.setZoom(u):this.fire(new c.x("zoomstart")).fire(new c.x("zoom")).fire(new c.x("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u?this.setZoom(u):this.fire(new c.x("zoomstart")).fire(new c.x("zoom")).fire(new c.x("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()<u?this.setPitch(u):this.fire(new c.x("pitchstart")).fire(new c.x("pitch")).fire(new c.x("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u?this.setPitch(u):this.fire(new c.x("pitchstart")).fire(new c.x("pitch")).fire(new c.x("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(u){return this._scaleFactor=u,this.painter.scaleFactor=u,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(r=>r.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(u){return u==="auto"?navigator.language:Array.isArray(u)?u.length===0?void 0:u.map(r=>r==="auto"?navigator.language:r):u}setLanguage(u){const r=this._parseLanguage(u);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const a of this._controls)a._setLanguage&&a._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(u){return this.style&&u!==this._worldview?(this._worldview=u,this._styleDirty=!0,this.style.setWorldview(u),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(u){return this._lazyInitEmptyStyle(),u?typeof u=="string"&&(u={name:u}):u=null,this._useExplicitProjection=!!u,this._prioritizeAndUpdateProjection(u,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const u=this.transform,r=u.projection.name;let a;r==="globe"&&u.zoom>=c.R?(u.setMercatorFromTransition(),a=!0):r==="mercator"&&u.zoom<c.R&&(u.setProjection({name:"globe"}),a=!0),a&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(u,r){return this._updateProjection(u||r||{name:"mercator"})}_updateProjection(u){let r;const a=this.transform.mercatorFromTransition;r=u.name==="globe"&&this.transform.zoom>=c.R?this.transform.setMercatorFromTransition():this.transform.setProjection(u),this.style.applyProjectionUpdate();const f=this.transform.getProjection().name==="mercator"&&a!==this.transform.mercatorFromTransition;return(r||f)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(u,r){return this.transform.locationPoint3D(c.ab.convert(u),r)}unproject(u,r){return this.transform.pointLocation3D(c.au.convert(u),r)}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(u,r,a){const f=_=>{let x=[];if(Array.isArray(r)){const w=r.filter(k=>this.getLayer(k));x=w.length?this.queryRenderedFeatures(_,{layers:w}):[]}else x=this.queryRenderedFeatures(_,{target:r});return x};if(u==="mouseenter"||u==="mouseover"){let _=!1;return{listener:a,targets:r,delegates:{mousemove:w=>{const k=f(w.point);k.length?_||(_=!0,a.call(this,new Os(u,this,w.originalEvent,{features:k}))):_=!1},mouseout:()=>{_=!1}}}}if(u==="mouseleave"||u==="mouseout"){let _=!1;return{listener:a,targets:r,delegates:{mousemove:k=>{f(k.point).length?_=!0:_&&(_=!1,a.call(this,new Os(u,this,k.originalEvent)))},mouseout:k=>{_&&(_=!1,a.call(this,new Os(u,this,k.originalEvent)))}}}}{const _=x=>{const w=f(x.point);w.length&&(x.features=w,a.call(this,x),delete x.features)};return{listener:a,targets:r,delegates:{[u]:_}}}}on(u,r,a){if(typeof r=="function"||a===void 0)return super.on(u,r);if(typeof r=="string"&&(r=[r]),!this._areTargetsValid(r))return this;const f=this._createDelegatedListener(u,r,a);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(f);for(const _ in f.delegates)this.on(_,f.delegates[_]);return this}once(u,r,a){if(typeof r=="function"||a===void 0)return super.once(u,r);if(typeof r=="string"&&(r=[r]),!this._areTargetsValid(r))return this;const f=this._createDelegatedListener(u,r,a);for(const _ in f.delegates)this.once(_,f.delegates[_]);return this}off(u,r,a){if(typeof r=="function"||a===void 0)return super.off(u,r);if(typeof r=="string"&&(r=[r]),!this._areTargetsValid(r))return this;const f=this._delegatedListeners?this._delegatedListeners[u]:void 0;return f&&(_=>{for(let x=0;x<_.length;x++){const w=_[x];if(w.listener===a&&Rv(w.targets,r)){for(const k in w.delegates)this.off(k,w.delegates[k]);return _.splice(x,1),this}}})(f),this}queryRenderedFeatures(u,r){if(!this.style)return[];if(u===void 0||u instanceof c.au||Array.isArray(u)||r!==void 0||(r=u,u=void 0),u=u||[[0,0],[this.transform.width,this.transform.height]],!r){const x=this.style.queryRenderedFeatures(u,void 0,this.transform),w=this.style.queryRenderedFeatureset(u,void 0,this.transform);return x.concat(w)}let a=!0;if(r.target&&(a=this._isTargetValid(r.target),a&&!r.layers))return this.style.queryRenderedFeatureset(u,r,this.transform);let f=!0;if(r.layers&&Array.isArray(r.layers)){for(const x of r.layers)if(!this._isValidId(x)){f=!1;break}if(f&&!r.target)return this.style.queryRenderedFeatures(u,r,this.transform)}let _=[];return f&&(_=_.concat(this.style.queryRenderedFeatures(u,r,this.transform))),a&&(_=_.concat(this.style.queryRenderedFeatureset(u,r,this.transform))),_}querySourceFeatures(u,r){return!u||typeof u=="string"&&!this._isValidId(u)?[]:this.style.querySourceFeatures(u,r)}queryRasterValue(u,r,a){return this._isValidId(u)?this.style.queryRasterValue(u,r,a):Promise.resolve(null)}isPointOnSurface(u){const{name:r}=this.transform.projection;return r!=="globe"&&r!=="mercator"&&c.f_(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(c.au.convert(u))}addInteraction(u,r){return this._interactions.add(u,r),this}removeInteraction(u){return this._interactions.remove(u),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(u){return this._cooperativeGestures=u,this}setStyle(u,r){return r=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing},r),this.style&&u&&r.diff!==!1&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&r.fontstackCompositing===this._fontstackCompositing&&!r.config?(this.style._diffStyle(u,(a,f)=>{if(a){const _=typeof a=="string"?a:a instanceof Error?a.message:a.error;c.f_(`Unable to perform style diff: ${_}. Rebuilding the style from scratch.`),this._updateStyle(u,r)}else f&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._fontstackCompositing=r.fontstackCompositing,this._updateStyle(u,r))}_getUIString(u){const r=this._locale[u];if(r==null)throw new Error(`Missing UI string '${u}'`);return r}_updateStyle(u,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),u){const a=Object.assign({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new fr(this,a).load(u),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new fr(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():(c.f_("There is no style added to the map."),!1)}_isValidId(u){return u==null?(this.fire(new c.v(new Error("IDs can't be empty."))),!1):!c.dx(u)||(this.fire(new c.v(new Error(`IDs can't contain special symbols: "${u}".`))),!1)}_isTargetValid(u){return"featuresetId"in u?this._isValidId("importId"in u?u.importId:u.featuresetId):"layerId"in u&&this._isValidId(u.layerId)}_areTargetsValid(u){if(Array.isArray(u)){for(const r of u)if(!this._isValidId(r))return!1;return!0}return this._isTargetValid(u)}addSource(u,r){return this._isValidId(u)?(this._lazyInitEmptyStyle(),this.style.addSource(u,r),this._update(!0)):this}isSourceLoaded(u){return!!this._isValidId(u)&&!!this.style&&this.style._isSourceCacheLoaded(u)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(u,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(u,r,a)}removeSource(u){return this._isValidId(u)?(this.style.removeSource(u),this._updateTerrain(),this._update(!0)):this}getSource(u){return this._isValidId(u)?this.style.getOwnSource(u):null}addImage(u,r,{pixelRatio:a=1,sdf:f=!1,stretchX:_,stretchY:x,content:w}={}){this._lazyInitEmptyStyle();const k=c.a1.from(u);if(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:A,height:P,data:D}=c.co.getImageData(r);this.style.addImage(k,{data:new c.ay({width:A,height:P},D),pixelRatio:a,stretchX:_,stretchY:x,content:w,sdf:f,version:0,usvg:!1})}else if(r.width===void 0||r.height===void 0)this.fire(new c.v(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:A,height:P}=r,D=r;this.style.addImage(k,{data:new c.ay({width:A,height:P},new Uint8Array(D.data)),pixelRatio:a,stretchX:_,stretchY:x,content:w,sdf:f,usvg:!1,version:0,userImage:D}),D.onAdd&&D.onAdd(this,u)}}updateImage(u,r){this._lazyInitEmptyStyle();const a=c.a1.from(u),f=this.style.getImage(a);if(!f)return void this.fire(new c.v(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const _=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?c.co.getImageData(r):r,{width:x,height:w,data:k}=_;if(x===void 0||w===void 0)return void this.fire(new c.v(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(x!==(f.usvg?f.icon.usvg_tree.width:f.data.width)||w!==(f.usvg?f.icon.usvg_tree.height:f.data.height))return void this.fire(new c.v(new Error(`The width and height of the updated image (${x}, ${w})
|
||
must be that same as the previous version of the image
|
||
(${f.data.width}, ${f.data.height})`)));const A=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);let P=!1;f.usvg?(f.data=new c.ay({width:x,height:w},new Uint8Array(k)),f.usvg=!1,f.icon=void 0,P=!0):f.data.replace(k,A),this.style.updateImage(a,f,P)}hasImage(u){return u?!!this.style&&!!this.style.getImage(c.a1.from(u)):(this.fire(new c.v(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(c.a1.from(u))}loadImage(u,r){c.cQ(this._requestManager.transformRequest(u,c.aH.Image),(a,f)=>{r(a,f)})}listImages(){return this.style.listImages().map(u=>u.name)}addModel(u,r){this._lazyInitEmptyStyle(),this.style.addModel(u,r)}hasModel(u){return u?this.style.hasModel(u):(this.fire(new c.v(new Error("Missing required model id"))),!1)}removeModel(u){this.style.removeModel(u)}listModels(){return this.style.listModels()}addLayer(u,r){return this._isValidId(u.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(u,r),this._update(!0)):this}getSlot(u){const r=this.getLayer(u);return r&&r.slot||null}setSlot(u,r){return this.style.setSlot(u,r),this.style.mergeLayers(),this._update(!0)}addImport(u,r){return this.style.addImport(u,r).catch(a=>this.fire(new c.v(new Error("Failed to add import",a)))),this}updateImport(u,r){return typeof r!="string"&&r.id!==u?(this.removeImport(u),this.addImport(r)):(this.style.updateImport(u,r),this._update(!0))}removeImport(u){return this.style.removeImport(u),this}moveImport(u,r){return this.style.moveImport(u,r),this._update(!0)}moveLayer(u,r){return this._isValidId(u)?(this.style.moveLayer(u,r),this._update(!0)):this}removeLayer(u){return this._isValidId(u)?(this.style.removeLayer(u),this._update(!0)):this}getLayer(u){if(!this._isValidId(u))return null;const r=this.style.getOwnLayer(u);return r?r.type==="custom"?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(u,r,a){return this._isValidId(u)?(this.style.setLayerZoomRange(u,r,a),this._update(!0)):this}setFilter(u,r,a={}){return this._isValidId(u)?(this.style.setFilter(u,r,a),this._update(!0)):this}getFilter(u){return this._isValidId(u)?this.style.getFilter(u):null}setPaintProperty(u,r,a,f={}){return this._isValidId(u)?(this.style.setPaintProperty(u,r,a,f),this._update(!0)):this}getPaintProperty(u,r){return this._isValidId(u)?this.style.getPaintProperty(u,r):null}setLayoutProperty(u,r,a,f={}){return this._isValidId(u)?(this.style.setLayoutProperty(u,r,a,f),this._update(!0)):this}getLayoutProperty(u,r){return this._isValidId(u)?this.style.getLayoutProperty(u,r):null}getLayerProperty(u,r){return this._isValidId(u)?this.style.getLayerProperty(u,r):null}setLayerProperty(u,r,a,f={}){return this._isValidId(u)?(r==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(u,r,a,f),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(u){return this.style.setGlyphsUrl(u),this._update(!0)}getSchema(u){return this.style.getSchema(u)}setSchema(u,r){return this.style.setSchema(u,r),this._update(!0)}getConfig(u){return this.style.getConfig(u)}setConfig(u,r){return this.style.setConfig(u,r),this._update(!0)}getConfigProperty(u,r){return this.style.getConfigProperty(u,r)}setConfigProperty(u,r,a){return this.style.setConfigProperty(u,r,a),this._update(!0)}getFeaturesetDescriptors(u){return this.style.getFeaturesetDescriptors(u)}setLights(u){if(this._lazyInitEmptyStyle(),u&&u.length===1&&u[0].type==="flat"){const r=u[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(u),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const u=this.style.getLights()||[];return u.length===0&&u.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),u}setLight(u,r={}){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:u}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(u){return this._lazyInitEmptyStyle(),!u&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(u),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(u){return this._lazyInitEmptyStyle(),this.style.setFog(u),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(u){return this._lazyInitEmptyStyle(),this.style.setSnow(u),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(u){return this._lazyInitEmptyStyle(),this.style.setRain(u),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(u){return this._lazyInitEmptyStyle(),this.style.setColorTheme(u),this._update(!0)}setImportColorTheme(u,r){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(u,r),this._update(!0)}setCamera(u){return this.style.setCamera(u),this._triggerCameraUpdate(u)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(u){const r=this.transform.nearClipOffset!==u;return this.transform.nearClipOffset=u,this._update(r)}_triggerCameraUpdate(u){return this._update(this.transform.setOrthographicProjectionAtLowPitch(u["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(u){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(c.ab.convert(u),this.transform):0}setFeatureState(u,r){return u.source&&!this._isValidId(u.source)?this:(this.style.setFeatureState(u,r),this._update())}removeFeatureState(u,r){return u.source&&!this._isValidId(u.source)?this:(this.style.removeFeatureState(u,r),this._update())}getFeatureState(u){return u.source&&!this._isValidId(u.source)?null:this.style.getFeatureState(u)}_selectIndoorFloor(u){this.style.indoorManager&&this.style.indoorManager.selectFloor(u)}_setIndoorActiveFloorsVisibility(u){this.style.indoorManager&&this.style.indoorManager.setActiveFloorsVisibility(u)}getIndoorTileOptions(u,r){return this.style&&this.style.isIndoorEnabled()&&this.style.indoorManager?this.style.indoorManager.getIndoorTileOptions(u,r):null}_updateContainerDimensions(){if(!this._container)return;const u=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let a,f,_,x=this._container;for(;x&&(!f||!_);){const w=window.getComputedStyle(x).transform;w&&w!=="none"&&(a=w.match(Lv)[1].split(", "),a[0]&&a[0]!=="0"&&a[0]!=="1"&&(f=a[0]),a[3]&&a[3]!=="0"&&a[3]!=="1"&&(_=a[3])),x=x.parentElement}this._containerWidth=f?Math.abs(u/f):u,this._containerHeight=_?Math.abs(r/_):r}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&c.f_("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const u=this._container;u.classList.add("mapboxgl-map"),(this._missingCSSCanary=re("div","mapboxgl-canary",u)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=re("div","mapboxgl-canvas-container",u);this._canvas=re("canvas","mapboxgl-canvas",r),this._interactive&&(r.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 a=this._controlContainer=re("div","mapboxgl-control-container",u),f=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(_=>{f[_]=re("div",`mapboxgl-ctrl-${_}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,r){const a=c.co.devicePixelRatio||1;this._canvas.width=a*Math.ceil(u),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${r}px`}_addMarker(u){this._markers.push(u)}_removeMarker(u){const r=this._markers.indexOf(u);r!==-1&&this._markers.splice(r,1)}_addPopup(u){this._popups.push(u)}_removePopup(u){const r=this._popups.indexOf(u);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const u=Object.assign({},H,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",u);r?(Ct(r,!0),this.painter=new ng(r,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",a=>{if(a.dataType==="source"){const f=this.transform.elevation?this.transform.elevation._source():null;f&&a.sourceCacheId===f.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),c.cn.testSupport(r)):this.fire(new c.v(new Error("Failed to initialize WebGL")))}_contextLost(u){u.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new c.x("webglcontextlost",{originalEvent:u}))}_contextRestored(u){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.imageManager.imageAtlasCache.destroyTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new c.x("webglcontextrestored",{originalEvent:u}))}_onMapScroll(u){if(u.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(u){return this.style?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_requestDomTask(u){!this.loaded()||this.loaded()&&!this.isMoving()?u():this._domRenderTaskQueue.add(u)}_render(u){let r;this.fire(new c.x("renderstart")),++this._frameId;const a=this.painter.context.extTimerQuery,f=c.co.now(),_=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=_.createQuery(),_.beginQuery(a.TIME_ELAPSED_EXT,r)),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(u),this._domRenderTaskQueue.run(u),this._removed)return;this._updateProjectionTransition();const x=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,P=this.transform.pitch,D=c.co.now(),z=new c.w(A,{now:D,fadeDuration:x,pitch:P,transition:this.style.transition,worldview:this._worldview});this.style.update(z)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let w=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),w=this._updateAverageElevation(f),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):w=this._updateAverageElevation(f),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,x,this._crossSourceCollisions,this.painter.replacementSource,this._placementAlgorithm)),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:x,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 c.x("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,B.mark(L.load),this.fire(new c.x("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(),r){const A=c.co.now()-f;_.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{const P=_.getQueryParameter(r,_.QUERY_RESULT)/1e6;_.deleteQuery(r),this.fire(new c.x("gpu-timing-frame",{cpuTime:A,gpuTime:P}))},50)}if(this.listens("gpu-timing-layer")){const A=this.painter.collectGpuTimers();setTimeout(()=>{const P=this.painter.queryGpuTimers(A);this.fire(new c.x("gpu-timing-layer",{layerTimes:P}))},50)}if(this.listens("gpu-timing-deferred-render")){const A=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const P=this.painter.queryGpuTimeDeferredRender(A);this.fire(new c.x("gpu-timing-deferred-render",{gpuTime:P}))},50)}const k=this._sourcesDirty||this._styleDirty||this._placementDirty||w;if(k||this._repaint)this.triggerRepaint();else{const A=this.idle();if(A&&(w=this._updateAverageElevation(f,!0)),w)this.triggerRepaint();else{if(this._triggerFrame(!1),A&&(this.fire(new c.x("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const P=this._calculateSpeedIndex();this.fire(new c.x("speedindexcompleted",{speedIndex:P})),this.speedIndexTiming=!1}A&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||k||(this._fullyLoaded=!0,B.mark(L.fullLoad),this._performanceMetricsCollection&&Ec(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(u){for(const r of this._markers)u&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!u||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(u,r=!1){const a=_=>(this.transform.averageElevation=_,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&a(0);const f=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(f||(r||u-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(u)){const _=this.transform.averageElevation;let x=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(x)?x=0:this._averageElevationLastSampledAt=u;const w=Math.abs(_-x);if(w>1){if(this._isInitialLoad||f)return this._averageElevation.jumpTo(x),a(x);this._averageElevation.easeTo(x,u,300)}else if(w>1e-4)return this._averageElevation.jumpTo(x),a(x)}return!!this._averageElevation.isEasing(u)&&a(this._averageElevation.getValue(u))}_isTokenExpired(){return this._tokenExpiration!=null&&Date.now()>this._tokenExpiration}_revokeAuth(){const u=this.painter.context.gl;Ct(u,!1),this._logoControl instanceof m1&&this._logoControl._updateLogo(),u&&u.clear(u.DEPTH_BUFFER_BIT|u.COLOR_BUFFER_BIT|u.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new c.v(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/")))}_authenticate(){rs(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,u=>{u&&(u.message!==An&&u.status!==401||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),ma(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ci(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Vi(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){ys(this._requestManager._customAccessToken)}_updateTerrain(){const u=this._isDragging();this.painter.updateTerrain(this.style,u)}_calculateSpeedIndex(){const u=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const a=this.painter.context.gl,f=a.createFramebuffer();function _(x){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,x,0);const w=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,w),w}return a.bindFramebuffer(a.FRAMEBUFFER,f),this._canvasPixelComparison(_(u),r.canvasCopies.map(_),r.timeStamps)}_canvasPixelComparison(u,r,a){let f=a[1]-a[0];const _=u.length/4;for(let x=0;x<r.length;x++){const w=r[x];let k=0;for(let A=0;A<w.length;A+=4)w[A]===u[A]&&w[A+1]===u[A+1]&&w[A+2]===u[A+2]&&w[A+3]===u[A+3]&&(k+=1);f+=(a[x+2]-a[x+1])*(1-k/_)}return f}remove(){if(this._removed)return;this._hash&&this._hash.remove();for(const r of this._controls)r.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 u=this.painter.context.gl.getExtension("WEBGL_lose_context");u&&u.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),vs.delete(this.painter.context.gl),oi.remove(),ns.remove(),this._removed=!0,this.fire(new c.x("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(u){this._renderNextFrame=this._renderNextFrame||u,this.style&&!this._frame&&(this._frame=c.co.frame(r=>{const a=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,a&&this._render(r)}))}_preloadTiles(u){const r=this.style?this.style.getSourceCaches():[];return c.bp(r,(a,f)=>a._preloadTiles(u,f),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(u){this._trackResize&&this.resize({originalEvent:u})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(u){this._showParseStatus!==u&&(this._showParseStatus=u,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(u){this._showTerrainWireframe!==u&&(this._showTerrainWireframe=u,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(u){this._showLayers2DWireframe!==u&&(this._showLayers2DWireframe=u,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(u){this._showLayers3DWireframe!==u&&(this._showLayers3DWireframe=u,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(u){this.painter&&this.painter._debugParams.showElevationIdDebug!==u&&(this.painter._debugParams.showElevationIdDebug=u,this.style&&u?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(u){this._speedIndexTiming!==u&&(this._speedIndexTiming=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,this.style&&u?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(u){this._showTileAABBs!==u&&(this._showTileAABBs=u,u&&this._update())}_setCacheLimits(u,r){c.fj(u,r)}get version(){return T}},NavigationControl:class{constructor(u={}){this.options=Object.assign({},Ov,u),this._container=re("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(c.bs(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),re("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),re("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(c.bs(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const a=this._map;a&&(this.options.visualizePitch?a.resetNorthPitch({},{originalEvent:r}):a.resetNorth({},{originalEvent:r}))}),this._compassIcon=re("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const u=this._map;if(!u)return;const r=u.getZoom(),a=r===u.getMaxZoom(),f=r===u.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=f,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",f.toString())}_rotateCompassArrow(){const u=this._map;if(!u)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(u.transform.pitch*(Math.PI/180)),.5)}) rotateX(${u.transform.pitch}deg) rotateZ(${u.transform.angle*(180/Math.PI)}deg)`:`rotate(${u.transform.angle*(180/Math.PI)}deg)`;u._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),u.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&u.on("pitch",this._rotateCompassArrow),u.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new iE(u,this._compass,this.options.visualizePitch)),this._container}onRemove(){const u=this._map;u&&(this._container.remove(),this.options.showZoom&&u.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&u.off("pitch",this._rotateCompassArrow),u.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(u,r){const a=re("button",u,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(u,r){if(!this._map)return;const a=this._map._getUIString(`NavigationControl.${r}`);u.setAttribute("aria-label",a),u.firstElementChild&&u.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends c.y{constructor(u={}){super();const r=navigator.geolocation;this.options=Object.assign({geolocation:r},Zu,u),c.bs(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Qf(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(u){return this._map=u,this._container=re("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(u){const r=(a=!!this.options.geolocation)=>{this._supportsGeolocation=a,u(a)};this._supportsGeolocation!==void 0?u(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(a=>r(a.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(u){const r=this._map.getMaxBounds(),a=u.coords;return!!r&&(a.longitude<r.getWest()||a.longitude>r.getEast()||a.latitude<r.getSouth()||a.latitude>r.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(u){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(u))return this._setErrorState(),this.fire(new c.x("outofmaxbounds",u)),this._updateMarker(),void this._finish();if(this._lastKnownPosition=u,this.options.trackUserLocation)switch(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(u),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(u),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new c.x("geolocate",Object.assign({coords:u.coords,timestamp:u.timestamp},u.toJSON?{toJSON:u.toJSON.bind(u)}:{}))),this._finish()}}_updateCamera(u){const r=new c.ab(u.coords.longitude,u.coords.latitude),a=u.coords.accuracy,f=this._map.getBearing(),_=Object.assign({bearing:f},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),_,{geolocateSource:!0})}_updateMarker(u){if(u){const r=new c.ab(u.coords.longitude,u.coords.latitude);this.options.showAccuracyCircle?this._accuracyCircleMarker.setLngLat(r).addTo(this._map):this._accuracyCircleMarker.remove(),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=u.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const u=this._map.transform,r=c.em(1,u._center.lat)*u.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}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(u){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(u.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 r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(u.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new c.x("error",{code:u.code,message:u.message,PERMISSION_DENIED:u.PERMISSION_DENIED,POSITION_UNAVAILABLE:u.POSITION_UNAVAILABLE,TIMEOUT:u.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const u=this.options.positionOptions.timeout;u&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},u))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(u){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=re("button","mapboxgl-ctrl-geolocate",this._container),re("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",u===!1){c.f_("Geolocation support is not available so the GeolocateControl will be disabled.");const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{const r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._createUserLocationMarkers(),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",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.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 c.x("trackuserlocationend")))}),this.fire(new c.x("ready"))}}_onDeviceOrientation(u){this._userLocationDotMarker&&(u.webkitCompassHeading?this._heading=u.webkitCompassHeading:u.absolute===!0&&(this._heading=-1*u.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return c.f_("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.x("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 c.x("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 c.x("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 u;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(u={maximumAge:6e5,timeout:0},this._noTimeout=!0):(u=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,u),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(u){return this.options.followUserLocation=u??Zu.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 c.x("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_ERROR"||(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 c.x("trackuserlocationend")))),this}setShowAccuracyCircle(u){if(this.options.showAccuracyCircle=u??Zu.showAccuracyCircle,!this._accuracyCircleMarker)return this;if(this.options.showAccuracyCircle){if(this.options.showUserLocation&&this._lastKnownPosition){const{longitude:r,latitude:a,accuracy:f}=this._lastKnownPosition.coords;this._accuracy=f,this._accuracyCircleMarker.setLngLat(new c.ab(r,a)).addTo(this._map),this._updateCircleRadius()}}else this._accuracyCircleMarker.remove();return this}setShowUserHeading(u){return this.options.showUserHeading=u??Zu.showUserHeading,this._setup?(this.options.showUserHeading?this._geolocationWatchID!==void 0&&this._addDeviceOrientationListener():(this._removeDeviceOrientationListener(),this._heading=void 0,this._userLocationDotMarker&&this._updateMarkerRotation()),this):this}setFitBoundsOptions(u){return this.options.fitBoundsOptions=u??Zu.fitBoundsOptions,this}setShowUserLocation(u){return this.options.showUserLocation=u??Zu.showUserLocation,this._setup?(this.options.showUserLocation?(this._userLocationDotMarker||(this._createUserLocationMarkers(),this._map.on("zoom",this._onZoom)),!this._lastKnownPosition||this._watchState!==void 0&&this._watchState==="OFF"||this._updateMarker(this._lastKnownPosition)):(this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this._accuracyCircleMarker&&this._accuracyCircleMarker.remove()),this):this}_addDeviceOrientationListener(){const u=()=>{const r="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(r,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&u()}).catch(console.error):u()}_removeDeviceOrientationListener(){window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation)}_createUserLocationMarkers(){this._dotElement=re("div","mapboxgl-user-location"),this._dotElement.appendChild(re("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(re("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new cp({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=re("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new cp({element:this._circleElement,pitchAlignment:"map"})}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),this._removeDeviceOrientationListener(),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:p1,ScaleControl:class{constructor(u={}){this.options=Object.assign({},y1,u),c.bs(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const u=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,f=r._containerWidth/2-u/2,_=r.unproject([f,a]),x=r.unproject([f+u,a]),w=_.distanceTo(x);if(this.options.unit==="imperial"){const k=3.2808*w;k>5280?this._setScale(u,k/5280,"mile"):this._setScale(u,k,"foot")}else this.options.unit==="nautical"?this._setScale(u,w/1852,"nautical-mile"):w>=1e3?this._setScale(u,w/1e3,"kilometer"):this._setScale(u,w,"meter")}_setScale(u,r,a){this._map._requestDomTask(()=>{const f=function(x){const w=Math.pow(10,`${Math.floor(x)}`.length-1);let k=x/w;return k=k>=10?10:k>=5?5:k>=3?3:k>=2?2:k>=1?1:function(A){const P=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*P)/P}(k),w*k}(r),_=f/r;this._container.innerHTML=a!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(f):`${f} ${Qc[a]}`,this._container.style.width=u*_+"px"})}onAdd(u){return this._map=u,this._language=u.getLanguage(),this._container=re("div","mapboxgl-ctrl mapboxgl-ctrl-scale",u.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(u){this._language=u,this._update()}setUnit(u){this.options.unit=u,this._update()}},FullscreenControl:class{constructor(u={}){this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:c.f_("Full screen control 'container' must be a DOM element.")),c.bs(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=re("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",c.f_("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 u=this._fullscreenButton=re("button","mapboxgl-ctrl-fullscreen",this._controlContainer);re("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",u)}_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:class{constructor(){c.bs(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(u){return this._map=u,this._container=re("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._map.on("idle",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){const u=this._map.style.indoorManager;u.off("selector-update",this._onIndoorUpdate),u.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(u.getControlState()),this._map.off("idle",this._onStyleData)}}_createButton(u,r){const a=re("button",u,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(u,r){u.setAttribute("aria-label",r),u.textContent=r}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.off("idle",this._onStyleData),this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(u){if(!u||!u.floors||u.floors.length===0)return this._model=u,void(this._container.style.display="none");const r=this._model;this._model=u,this._container.style.display="inline-block";const a=!r||r.floors.length!==u.floors.length||r.floors.some((f,_)=>f.id!==u.floors[_].id);if(a&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),u.selectedFloorId){if(u.selectedFloorId!==this._lastSelectedFloorId||a){const f=u.floors.findIndex(_=>_.id===u.selectedFloorId);if(f!==-1){const _=u.floors.length;let x,w;_<=5?(x=0,w=_-1):this._visibleFloorStart===0?(x=0,w=3):this._visibleFloorStart>=_-3?(x=_-3-1,w=_-1):(x=this._visibleFloorStart,w=this._visibleFloorStart+3-1),f<x?this._visibleFloorStart=f:f>w&&(this._visibleFloorStart=f-2)}}this._lastSelectedFloorId=u.selectedFloorId}this._render()}_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";const u=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);re("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||u.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(u);const r=this._model.floors,a=r.length;if(a<=5)return void r.forEach(w=>this._createFloorButton(w));const f=this._visibleFloorStart===0,_=this._visibleFloorStart>=a-3;if(f)this._createFloorButton(r[0]);else{const w=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);re("span","mapboxgl-ctrl-icon",w).setAttribute("aria-hidden","true"),this._container.appendChild(w)}let x=[];if(x=f?r.slice(1,4):_?r.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):r.slice(this._visibleFloorStart,this._visibleFloorStart+3),x.forEach(w=>this._createFloorButton(w)),_)this._createFloorButton(r[a-1]);else{const w=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);re("span","mapboxgl-ctrl-icon",w).setAttribute("aria-hidden","true"),this._container.appendChild(w)}}_createFloorButton(u){const r=this._createButton("mapboxgl-ctrl-level-button",()=>{const x=u.id;this._model&&this._model.selectedFloorId===x&&this._model.activeFloorsVisible||this._map&&(this._model&&!this._model.activeFloorsVisible&&this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.setActiveFloorsVisibility(!0),this._map._selectIndoorFloor(x))}),a=(u.name||"").trim(),f=u.zIndex.toString(),_=a?Array.from(a).slice(0,3).join(""):f;this._setButtonTitle(r,_),this._model&&this._model.activeFloorsVisible&&u.id===this._model.selectedFloorId&&r.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(r)}_toggleIndoor(){this._map&&this._map.style&&this._map.style.indoorManager&&this._model&&this._model.activeFloorsVisible&&this._map.style.indoorManager.setActiveFloorsVisibility(!1)}_scrollUp(){if(this._visibleFloorStart>0){this._visibleFloorStart--,this._visibleFloorStart===1&&(this._visibleFloorStart=0);const u=this._model&&this._model.floors||[];if(u.length>3){const r=u.length-3;this._visibleFloorStart===r-1&&(this._visibleFloorStart=r-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){const u=this._model.floors.length-3;this._visibleFloorStart<u&&(this._visibleFloorStart++,this._visibleFloorStart===1&&(this._visibleFloorStart=2),this._visibleFloorStart===u-1&&(this._visibleFloorStart=u),this._visibleFloorStart>u&&(this._visibleFloorStart=u),this._render())}}},Popup:class extends c.y{constructor(u){super(),this.options=Object.assign(Object.create(rh),u),this._altitude=this.options.altitude,c.bs(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(u&&u.className?u.className.trim().split(v1):[])}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&u.on("preclick",this._onClose),this.options.closeOnMove&&u.on("move",this._onClose),u.on("remove",this.remove),this._update(),u._addPopup(this),this._focusFirstElement(),this._trackPointer?(u.on("mousemove",this._onMouseEvent),u.on("mouseup",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")):u.on("move",this._update),this.fire(new c.x("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const u=this._map;return u&&(u.off("move",this._update),u.off("move",this._onClose),u.off("preclick",this._onClose),u.off("click",this._onClose),u.off("remove",this.remove),u.off("mousemove",this._onMouseEvent),u.off("mouseup",this._onMouseEvent),u.off("drag",this._onMouseEvent),u._canvasContainer&&u._canvasContainer.classList.remove("mapboxgl-track-pointer"),u._removePopup(this),this._map=void 0),this.fire(new c.x("close")),this}getLngLat(){return this._lngLat}setLngLat(u){this._lngLat=c.ab.convert(u),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(u){return this._altitude=u,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const u=this._map;return u&&(u.off("move",this._update),u.on("mousemove",this._onMouseEvent),u.on("drag",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const r=document.createDocumentFragment(),a=document.createElement("body");let f;for(a.innerHTML=u;f=a.firstChild,f;)r.appendChild(f);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=re("div","mapboxgl-popup-content",this._container||void 0);if(r.appendChild(u),this.options.closeButton){const a=this._closeButton=re("button","mapboxgl-popup-close-button",r);a.type="button",a.setAttribute("aria-label","Close popup"),a.innerHTML='<span aria-hidden="true">×</span>',a.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(u){return this._classList.add(u),this._updateClassList(),this}removeClassName(u){return this._classList.delete(u),this._updateClassList(),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){let r;return this._classList.delete(u)?r=!1:(this._classList.add(u),r=!0),this._updateClassList(),r}_onMouseEvent(u){this._update(u.point)}_getAnchor(u){if(this.options.anchor)return this.options.anchor;const r=this._map,a=this._container,f=this._pos;if(!r||!a||!f)return"bottom";const _=a.offsetWidth,x=a.offsetHeight,w=f.x<_/2,k=f.x>r.transform.width-_/2;if(f.y+u<x)return w?"top-left":k?"top-right":"top";if(f.y>r.transform.height-x){if(w)return"bottom-left";if(k)return"bottom-right"}return w?"left":k?"right":"bottom"}_updateClassList(){const u=this._container;if(!u)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),u.className=r.join(" ")}_update(u){const r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let f=this._container;if(f||(f=this._container=re("div","mapboxgl-popup",r.getContainer()),this._tip=re("div","mapboxgl-popup-tip",f),f.appendChild(a)),this.options.maxWidth&&f.style.maxWidth!==this.options.maxWidth&&(f.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ug(this._lngLat,this._pos,r.transform)),!this._trackPointer||u){const _=this._pos=this._trackPointer&&u instanceof c.au?u:r.project(this._lngLat,this._altitude),x=dg(this.options.offset),w=this._anchor=this._getAnchor(x.y),k=dg(this.options.offset,w),A=_.add(k).round();r._requestDomTask(()=>{this._container&&w&&(this._container.style.transform=`${Fv[w]} translate(${A.x}px,${A.y}px)`)})}if(!this._marker&&r._showingGlobe()){const _=c.dE(r.transform,this._lngLat)?0:1;this._setOpacity(_)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(ih);u&&u.focus()}_onClose(){this.remove()}_setOpacity(u){this._container&&(this._container.style.opacity=`${u}`),this._content&&(this._content.style.pointerEvents=u?"auto":"none")}},Marker:cp,Style:fr,LngLat:c.ab,LngLatBounds:c.ac,Point:c.au,MercatorCoordinate:c.ag,FreeCameraOptions:qn,Evented:c.y,config:c.bN,prewarm:function(){Jl().acquire(ku)},clearPrewarmedResources:function(){const u=Nd;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(ku),Nd=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return c.bN.ACCESS_TOKEN},set accessToken(u){c.fg(u)},get baseApiUrl(){return c.bN.API_URL},set baseApiUrl(u){c.fh(u)},get workerCount(){return Ic.workerCount},set workerCount(u){(function(r){Ic.workerCount=r})(u)},get maxParallelImageRequests(){return c.bN.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(u){c.fm(u)},clearStorage(u){c.bH(u)},get workerUrl(){return Cc.workerUrl},set workerUrl(u){Cc.workerUrl=u},get workerClass(){return Cc.workerClass},set workerClass(u){Cc.workerClass=u},get dracoUrl(){return c.cN()},set dracoUrl(u){c.fl(u)},get meshoptUrl(){return c.cW()},set meshoptUrl(u){c.fn(u)},get buildingGenUrl(){return c.cK()},set buildingGenUrl(u){c.fi(u)},setNow:c.co.setNow,restoreNow:c.co.restoreNow}});var E=g;return E})})(XV);var vQ=XV.exports;const rd=wI(vQ),xQ="https://api.quixzoom.com/api/qz/mapbox-token",bQ="pk.eyJ1IjoiY2VydGlmaWVkMTIiLCJhIjoiY21qbnNiN3o3MWZrcDNlc2RocDY2c2hocSJ9.KUWxgt0u05f8jYUrOLaADA";let Qw=null,Bz=0;const wQ=5*60*1e3;async function YV(){if(Qw&&Date.now()<Bz)return Qw;try{const n=new AbortController,t=window.setTimeout(()=>n.abort(),4e3),s=await fetch(xQ,{signal:n.signal});if(window.clearTimeout(t),s.ok){const h=await s.json();if(h!=null&&h.token)return Qw=h.token,Bz=Date.now()+wQ,Qw}}catch(n){console.warn("[mapToken] AMOS fetch failed, using fallback:",n)}return bQ}const SQ=wM("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-lg shadow-primary/25",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-border bg-transparent hover:bg-secondary hover:text-secondary-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-secondary hover:text-secondary-foreground",link:"text-primary underline-offset-4 hover:underline",hero:"bg-gradient-to-r from-primary to-accent text-primary-foreground font-semibold shadow-lg shadow-primary/30 hover:shadow-xl hover:shadow-primary/40 hover:scale-105 border-0",heroOutline:"border border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:border-primary backdrop-blur-sm",glow:"bg-primary text-primary-foreground shadow-[0_0_30px_hsl(var(--primary)/0.4)] hover:shadow-[0_0_40px_hsl(var(--primary)/0.6)] border border-primary/30"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-12 rounded-md px-8 text-base",xl:"h-14 rounded-lg px-10 text-lg",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ol=Y.forwardRef(({className:n,variant:t,size:s,asChild:h=!1,...g},v)=>{const E=h?m7:"button";return ue.jsx(E,{className:fi(SQ({variant:t,size:s,className:n})),ref:v,...g})});ol.displayName="Button";const QC=Y.forwardRef(({className:n,...t},s)=>ue.jsx("div",{ref:s,className:fi("rounded-lg border bg-card text-card-foreground shadow-sm",n),...t}));QC.displayName="Card";const TQ=Y.forwardRef(({className:n,...t},s)=>ue.jsx("div",{ref:s,className:fi("flex flex-col space-y-1.5 p-6",n),...t}));TQ.displayName="CardHeader";const EQ=Y.forwardRef(({className:n,...t},s)=>ue.jsx("h3",{ref:s,className:fi("text-2xl font-semibold leading-none tracking-tight",n),...t}));EQ.displayName="CardTitle";const kQ=Y.forwardRef(({className:n,...t},s)=>ue.jsx("p",{ref:s,className:fi("text-sm text-muted-foreground",n),...t}));kQ.displayName="CardDescription";const AQ=Y.forwardRef(({className:n,...t},s)=>ue.jsx("div",{ref:s,className:fi("p-6 pt-0",n),...t}));AQ.displayName="CardContent";const CQ=Y.forwardRef(({className:n,...t},s)=>ue.jsx("div",{ref:s,className:fi("flex items-center p-6 pt-0",n),...t}));CQ.displayName="CardFooter";const QV=Y.createContext({});function IQ(n){const t=Y.useRef(null);return t.current===null&&(t.current=n()),t.current}const GM=Y.createContext(null),JV=Y.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function MQ(n=!0){const t=Y.useContext(GM);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:h,register:g}=t,v=Y.useId();Y.useEffect(()=>{n&&g(v)},[n]);const E=Y.useCallback(()=>n&&h&&h(v),[v,h,n]);return!s&&h?[!1,E]:[!0]}const $M=typeof window<"u",PQ=$M?Y.useLayoutEffect:Y.useEffect,dl=n=>n;let ej=dl;function HM(n){let t;return()=>(t===void 0&&(t=n()),t)}const F_=(n,t,s)=>{const h=t-n;return h===0?1:(s-n)/h},dd=n=>n*1e3,hd=n=>n/1e3,DQ={useManualTiming:!1};function RQ(n){let t=new Set,s=new Set,h=!1,g=!1;const v=new WeakSet;let E={delta:0,timestamp:0,isProcessing:!1};function c(L){v.has(L)&&(T.schedule(L),n()),L(E)}const T={schedule:(L,B=!1,U=!1)=>{const X=U&&h?t:s;return B&&v.add(L),X.has(L)||X.add(L),L},cancel:L=>{s.delete(L),v.delete(L)},process:L=>{if(E=L,h){g=!0;return}h=!0,[t,s]=[s,t],t.forEach(c),t.clear(),h=!1,g&&(g=!1,T.process(L))}};return T}const Jw=["read","resolveKeyframes","update","preRender","render","postRender"],LQ=40;function tj(n,t){let s=!1,h=!0;const g={delta:0,timestamp:0,isProcessing:!1},v=()=>s=!0,E=Jw.reduce((oe,re)=>(oe[re]=RQ(v),oe),{}),{read:c,resolveKeyframes:T,update:L,preRender:B,render:U,postRender:H}=E,X=()=>{const oe=performance.now();s=!1,g.delta=h?1e3/60:Math.max(Math.min(oe-g.timestamp,LQ),1),g.timestamp=oe,g.isProcessing=!0,c.process(g),T.process(g),L.process(g),B.process(g),U.process(g),H.process(g),g.isProcessing=!1,s&&t&&(h=!1,n(X))},ae=()=>{s=!0,h=!0,g.isProcessing||n(X)};return{schedule:Jw.reduce((oe,re)=>{const he=E[re];return oe[re]=(_e,De=!1,He=!1)=>(s||ae(),he.schedule(_e,De,He)),oe},{}),cancel:oe=>{for(let re=0;re<Jw.length;re++)E[Jw[re]].cancel(oe)},state:g,steps:E}}const{schedule:Ji,cancel:Jh,state:As,steps:aA}=tj(typeof requestAnimationFrame<"u"?requestAnimationFrame:dl,!0),nj=Y.createContext({strict:!1}),Nz={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},z_={};for(const n in Nz)z_[n]={isEnabled:t=>Nz[n].some(s=>!!t[s])};function OQ(n){for(const t in n)z_[t]={...z_[t],...n[t]}}const FQ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function gT(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||FQ.has(n)}let rj=n=>!gT(n);function zQ(n){n&&(rj=t=>t.startsWith("on")?!gT(t):n(t))}try{zQ(require("@emotion/is-prop-valid").default)}catch{}function BQ(n,t,s){const h={};for(const g in n)g==="values"&&typeof n.values=="object"||(rj(g)||s===!0&&gT(g)||!t&&!gT(g)||n.draggable&&g.startsWith("onDrag"))&&(h[g]=n[g]);return h}function NQ(n){if(typeof Proxy>"u")return n;const t=new Map,s=(...h)=>n(...h);return new Proxy(s,{get:(h,g)=>g==="create"?n:(t.has(g)||t.set(g,n(g)),t.get(g))})}const i2=Y.createContext({});function Mx(n){return typeof n=="string"||Array.isArray(n)}function o2(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const WM=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],qM=["initial",...WM];function s2(n){return o2(n.animate)||qM.some(t=>Mx(n[t]))}function ij(n){return!!(s2(n)||n.variants)}function VQ(n,t){if(s2(n)){const{initial:s,animate:h}=n;return{initial:s===!1||Mx(s)?s:void 0,animate:Mx(h)?h:void 0}}return n.inherit!==!1?t:{}}function jQ(n){const{initial:t,animate:s}=VQ(n,Y.useContext(i2));return Y.useMemo(()=>({initial:t,animate:s}),[Vz(t),Vz(s)])}function Vz(n){return Array.isArray(n)?n.join(" "):n}const UQ=Symbol.for("motionComponentSymbol");function Jg(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function GQ(n,t,s){return Y.useCallback(h=>{h&&n.onMount&&n.onMount(h),t&&(h?t.mount(h):t.unmount()),s&&(typeof s=="function"?s(h):Jg(s)&&(s.current=h))},[t])}const ZM=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$Q="framerAppearId",oj="data-"+ZM($Q),{schedule:XM}=tj(queueMicrotask,!1),sj=Y.createContext({});function HQ(n,t,s,h,g){var v,E;const{visualElement:c}=Y.useContext(i2),T=Y.useContext(nj),L=Y.useContext(GM),B=Y.useContext(JV).reducedMotion,U=Y.useRef(null);h=h||T.renderer,!U.current&&h&&(U.current=h(n,{visualState:t,parent:c,props:s,presenceContext:L,blockInitialAnimation:L?L.initial===!1:!1,reducedMotionConfig:B}));const H=U.current,X=Y.useContext(sj);H&&!H.projection&&g&&(H.type==="html"||H.type==="svg")&&WQ(U.current,s,g,X);const ae=Y.useRef(!1);Y.useInsertionEffect(()=>{H&&ae.current&&H.update(s,L)});const ne=s[oj],me=Y.useRef(!!ne&&!(!((v=window.MotionHandoffIsComplete)===null||v===void 0)&&v.call(window,ne))&&((E=window.MotionHasOptimisedAnimation)===null||E===void 0?void 0:E.call(window,ne)));return PQ(()=>{H&&(ae.current=!0,window.MotionIsMounted=!0,H.updateFeatures(),XM.render(H.render),me.current&&H.animationState&&H.animationState.animateChanges())}),Y.useEffect(()=>{H&&(!me.current&&H.animationState&&H.animationState.animateChanges(),me.current&&(queueMicrotask(()=>{var oe;(oe=window.MotionHandoffMarkAsComplete)===null||oe===void 0||oe.call(window,ne)}),me.current=!1))}),H}function WQ(n,t,s,h){const{layoutId:g,layout:v,drag:E,dragConstraints:c,layoutScroll:T,layoutRoot:L}=t;n.projection=new s(n.latestValues,t["data-framer-portal-id"]?void 0:aj(n.parent)),n.projection.setOptions({layoutId:g,layout:v,alwaysMeasureLayout:!!E||c&&Jg(c),visualElement:n,animationType:typeof v=="string"?v:"both",initialPromotionConfig:h,layoutScroll:T,layoutRoot:L})}function aj(n){if(n)return n.options.allowProjection!==!1?n.projection:aj(n.parent)}function qQ({preloadedFeatures:n,createVisualElement:t,useRender:s,useVisualState:h,Component:g}){var v,E;n&&OQ(n);function c(L,B){let U;const H={...Y.useContext(JV),...L,layoutId:ZQ(L)},{isStatic:X}=H,ae=jQ(L),ne=h(L,X);if(!X&&$M){XQ();const me=KQ(H);U=me.MeasureLayout,ae.visualElement=HQ(g,ne,H,t,me.ProjectionNode)}return ue.jsxs(i2.Provider,{value:ae,children:[U&&ae.visualElement?ue.jsx(U,{visualElement:ae.visualElement,...H}):null,s(g,L,GQ(ne,ae.visualElement,B),ne,X,ae.visualElement)]})}c.displayName=`motion.${typeof g=="string"?g:`create(${(E=(v=g.displayName)!==null&&v!==void 0?v:g.name)!==null&&E!==void 0?E:""})`}`;const T=Y.forwardRef(c);return T[UQ]=g,T}function ZQ({layoutId:n}){const t=Y.useContext(QV).id;return t&&n!==void 0?t+"-"+n:n}function XQ(n,t){Y.useContext(nj).strict}function KQ(n){const{drag:t,layout:s}=z_;if(!t&&!s)return{};const h={...t,...s};return{MeasureLayout:t!=null&&t.isEnabled(n)||s!=null&&s.isEnabled(n)?h.MeasureLayout:void 0,ProjectionNode:h.ProjectionNode}}const YQ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function KM(n){return typeof n!="string"||n.includes("-")?!1:!!(YQ.indexOf(n)>-1||/[A-Z]/u.test(n))}function jz(n){const t=[{},{}];return n==null||n.values.forEach((s,h)=>{t[0][h]=s.get(),t[1][h]=s.getVelocity()}),t}function YM(n,t,s,h){if(typeof t=="function"){const[g,v]=jz(h);t=t(s!==void 0?s:n.custom,g,v)}if(typeof t=="string"&&(t=n.variants&&n.variants[t]),typeof t=="function"){const[g,v]=jz(h);t=t(s!==void 0?s:n.custom,g,v)}return t}const JC=n=>Array.isArray(n),QQ=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),JQ=n=>JC(n)?n[n.length-1]||0:n,Hs=n=>!!(n&&n.getVelocity);function kS(n){const t=Hs(n)?n.get():n;return QQ(t)?t.toValue():t}function eJ({scrapeMotionValuesFromProps:n,createRenderState:t,onUpdate:s},h,g,v){const E={latestValues:tJ(h,g,v,n),renderState:t()};return s&&(E.onMount=c=>s({props:h,current:c,...E}),E.onUpdate=c=>s(c)),E}const lj=n=>(t,s)=>{const h=Y.useContext(i2),g=Y.useContext(GM),v=()=>eJ(n,t,h,g);return s?v():IQ(v)};function tJ(n,t,s,h){const g={},v=h(n,{});for(const H in v)g[H]=kS(v[H]);let{initial:E,animate:c}=n;const T=s2(n),L=ij(n);t&&L&&!T&&n.inherit!==!1&&(E===void 0&&(E=t.initial),c===void 0&&(c=t.animate));let B=s?s.initial===!1:!1;B=B||E===!1;const U=B?c:E;if(U&&typeof U!="boolean"&&!o2(U)){const H=Array.isArray(U)?U:[U];for(let X=0;X<H.length;X++){const ae=YM(n,H[X]);if(ae){const{transitionEnd:ne,transition:me,...oe}=ae;for(const re in oe){let he=oe[re];if(Array.isArray(he)){const _e=B?he.length-1:0;he=he[_e]}he!==null&&(g[re]=he)}for(const re in ne)g[re]=ne[re]}}}return g}const Q_=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],rm=new Set(Q_),cj=n=>t=>typeof t=="string"&&t.startsWith(n),uj=cj("--"),nJ=cj("var(--"),QM=n=>nJ(n)?rJ.test(n.split("/*")[0].trim()):!1,rJ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,dj=(n,t)=>t&&typeof n=="number"?t.transform(n):n,xd=(n,t,s)=>s>t?t:s<n?n:s,J_={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Px={...J_,transform:n=>xd(0,1,n)},eS={...J_,default:1},qx=n=>({test:t=>typeof t=="string"&&t.endsWith(n)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${n}`}),xh=qx("deg"),bu=qx("%"),er=qx("px"),iJ=qx("vh"),oJ=qx("vw"),Uz={...bu,parse:n=>bu.parse(n)/100,transform:n=>bu.transform(n*100)},sJ={borderWidth:er,borderTopWidth:er,borderRightWidth:er,borderBottomWidth:er,borderLeftWidth:er,borderRadius:er,radius:er,borderTopLeftRadius:er,borderTopRightRadius:er,borderBottomRightRadius:er,borderBottomLeftRadius:er,width:er,maxWidth:er,height:er,maxHeight:er,top:er,right:er,bottom:er,left:er,padding:er,paddingTop:er,paddingRight:er,paddingBottom:er,paddingLeft:er,margin:er,marginTop:er,marginRight:er,marginBottom:er,marginLeft:er,backgroundPositionX:er,backgroundPositionY:er},aJ={rotate:xh,rotateX:xh,rotateY:xh,rotateZ:xh,scale:eS,scaleX:eS,scaleY:eS,scaleZ:eS,skew:xh,skewX:xh,skewY:xh,distance:er,translateX:er,translateY:er,translateZ:er,x:er,y:er,z:er,perspective:er,transformPerspective:er,opacity:Px,originX:Uz,originY:Uz,originZ:er},Gz={...J_,transform:Math.round},JM={...sJ,...aJ,zIndex:Gz,size:er,fillOpacity:Px,strokeOpacity:Px,numOctaves:Gz},lJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cJ=Q_.length;function uJ(n,t,s){let h="",g=!0;for(let v=0;v<cJ;v++){const E=Q_[v],c=n[E];if(c===void 0)continue;let T=!0;if(typeof c=="number"?T=c===(E.startsWith("scale")?1:0):T=parseFloat(c)===0,!T||s){const L=dj(c,JM[E]);if(!T){g=!1;const B=lJ[E]||E;h+=`${B}(${L}) `}s&&(t[E]=L)}}return h=h.trim(),s?h=s(t,g?"":h):g&&(h="none"),h}function eP(n,t,s){const{style:h,vars:g,transformOrigin:v}=n;let E=!1,c=!1;for(const T in t){const L=t[T];if(rm.has(T)){E=!0;continue}else if(uj(T)){g[T]=L;continue}else{const B=dj(L,JM[T]);T.startsWith("origin")?(c=!0,v[T]=B):h[T]=B}}if(t.transform||(E||s?h.transform=uJ(t,n.transform,s):h.transform&&(h.transform="none")),c){const{originX:T="50%",originY:L="50%",originZ:B=0}=v;h.transformOrigin=`${T} ${L} ${B}`}}const dJ={offset:"stroke-dashoffset",array:"stroke-dasharray"},hJ={offset:"strokeDashoffset",array:"strokeDasharray"};function fJ(n,t,s=1,h=0,g=!0){n.pathLength=1;const v=g?dJ:hJ;n[v.offset]=er.transform(-h);const E=er.transform(t),c=er.transform(s);n[v.array]=`${E} ${c}`}function $z(n,t,s){return typeof n=="string"?n:er.transform(t+s*n)}function pJ(n,t,s){const h=$z(t,n.x,n.width),g=$z(s,n.y,n.height);return`${h} ${g}`}function tP(n,{attrX:t,attrY:s,attrScale:h,originX:g,originY:v,pathLength:E,pathSpacing:c=1,pathOffset:T=0,...L},B,U){if(eP(n,L,U),B){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:H,style:X,dimensions:ae}=n;H.transform&&(ae&&(X.transform=H.transform),delete H.transform),ae&&(g!==void 0||v!==void 0||X.transform)&&(X.transformOrigin=pJ(ae,g!==void 0?g:.5,v!==void 0?v:.5)),t!==void 0&&(H.x=t),s!==void 0&&(H.y=s),h!==void 0&&(H.scale=h),E!==void 0&&fJ(H,E,c,T,!1)}const nP=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),hj=()=>({...nP(),attrs:{}}),rP=n=>typeof n=="string"&&n.toLowerCase()==="svg";function fj(n,{style:t,vars:s},h,g){Object.assign(n.style,t,g&&g.getProjectionStyles(h));for(const v in s)n.style.setProperty(v,s[v])}const pj=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function mj(n,t,s,h){fj(n,t,void 0,h);for(const g in t.attrs)n.setAttribute(pj.has(g)?g:ZM(g),t.attrs[g])}const _T={};function mJ(n){Object.assign(_T,n)}function gj(n,{layout:t,layoutId:s}){return rm.has(n)||n.startsWith("origin")||(t||s!==void 0)&&(!!_T[n]||n==="opacity")}function iP(n,t,s){var h;const{style:g}=n,v={};for(const E in g)(Hs(g[E])||t.style&&Hs(t.style[E])||gj(E,n)||((h=s==null?void 0:s.getValue(E))===null||h===void 0?void 0:h.liveStyle)!==void 0)&&(v[E]=g[E]);return v}function _j(n,t,s){const h=iP(n,t,s);for(const g in n)if(Hs(n[g])||Hs(t[g])){const v=Q_.indexOf(g)!==-1?"attr"+g.charAt(0).toUpperCase()+g.substring(1):g;h[v]=n[g]}return h}function gJ(n,t){try{t.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Hz=["x","y","width","height","cx","cy","r"],_J={useVisualState:lj({scrapeMotionValuesFromProps:_j,createRenderState:hj,onUpdate:({props:n,prevProps:t,current:s,renderState:h,latestValues:g})=>{if(!s)return;let v=!!n.drag;if(!v){for(const c in g)if(rm.has(c)){v=!0;break}}if(!v)return;let E=!t;if(t)for(let c=0;c<Hz.length;c++){const T=Hz[c];n[T]!==t[T]&&(E=!0)}E&&Ji.read(()=>{gJ(s,h),Ji.render(()=>{tP(h,g,rP(s.tagName),n.transformTemplate),mj(s,h)})})}})},yJ={useVisualState:lj({scrapeMotionValuesFromProps:iP,createRenderState:nP})};function yj(n,t,s){for(const h in t)!Hs(t[h])&&!gj(h,s)&&(n[h]=t[h])}function vJ({transformTemplate:n},t){return Y.useMemo(()=>{const s=nP();return eP(s,t,n),Object.assign({},s.vars,s.style)},[t])}function xJ(n,t){const s=n.style||{},h={};return yj(h,s,n),Object.assign(h,vJ(n,t)),h}function bJ(n,t){const s={},h=xJ(n,t);return n.drag&&n.dragListener!==!1&&(s.draggable=!1,h.userSelect=h.WebkitUserSelect=h.WebkitTouchCallout="none",h.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(s.tabIndex=0),s.style=h,s}function wJ(n,t,s,h){const g=Y.useMemo(()=>{const v=hj();return tP(v,t,rP(h),n.transformTemplate),{...v.attrs,style:{...v.style}}},[t]);if(n.style){const v={};yj(v,n.style,n),g.style={...v,...g.style}}return g}function SJ(n=!1){return(s,h,g,{latestValues:v},E)=>{const T=(KM(s)?wJ:bJ)(h,v,E,s),L=BQ(h,typeof s=="string",n),B=s!==Y.Fragment?{...L,...T,ref:g}:{},{children:U}=h,H=Y.useMemo(()=>Hs(U)?U.get():U,[U]);return Y.createElement(s,{...B,children:H})}}function TJ(n,t){return function(h,{forwardMotionProps:g}={forwardMotionProps:!1}){const E={...KM(h)?_J:yJ,preloadedFeatures:n,useRender:SJ(g),createVisualElement:t,Component:h};return qQ(E)}}function vj(n,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==n.length)return!1;for(let h=0;h<s;h++)if(t[h]!==n[h])return!1;return!0}function a2(n,t,s){const h=n.getProps();return YM(h,t,s!==void 0?s:h.custom,n)}const EJ=HM(()=>window.ScrollTimeline!==void 0);class kJ{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,s){for(let h=0;h<this.animations.length;h++)this.animations[h][t]=s}attachTimeline(t,s){const h=this.animations.map(g=>{if(EJ()&&g.attachTimeline)return g.attachTimeline(t);if(typeof s=="function")return s(g)});return()=>{h.forEach((g,v)=>{g&&g(),this.animations[v].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let s=0;s<this.animations.length;s++)t=Math.max(t,this.animations[s].duration);return t}runAll(t){this.animations.forEach(s=>s[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class AJ extends kJ{then(t,s){return Promise.all(this.animations).then(t).catch(s)}}function oP(n,t){return n?n[t]||n.default||n:void 0}const eI=2e4;function xj(n){let t=0;const s=50;let h=n.next(t);for(;!h.done&&t<eI;)t+=s,h=n.next(t);return t>=eI?1/0:t}function sP(n){return typeof n=="function"}function Wz(n,t){n.timeline=t,n.onfinish=null}const aP=n=>Array.isArray(n)&&typeof n[0]=="number",CJ={linearEasing:void 0};function IJ(n,t){const s=HM(n);return()=>{var h;return(h=CJ[t])!==null&&h!==void 0?h:s()}}const yT=IJ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),bj=(n,t,s=10)=>{let h="";const g=Math.max(Math.round(t/s),2);for(let v=0;v<g;v++)h+=n(F_(0,g-1,v))+", ";return`linear(${h.substring(0,h.length-2)})`};function wj(n){return!!(typeof n=="function"&&yT()||!n||typeof n=="string"&&(n in tI||yT())||aP(n)||Array.isArray(n)&&n.every(wj))}const N0=([n,t,s,h])=>`cubic-bezier(${n}, ${t}, ${s}, ${h})`,tI={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:N0([0,.65,.55,1]),circOut:N0([.55,0,1,.45]),backIn:N0([.31,.01,.66,-.59]),backOut:N0([.33,1.53,.69,.99])};function Sj(n,t){if(n)return typeof n=="function"&&yT()?bj(n,t):aP(n)?N0(n):Array.isArray(n)?n.map(s=>Sj(s,t)||tI.easeOut):tI[n]}const fc={x:!1,y:!1};function Tj(){return fc.x||fc.y}function MJ(n,t,s){var h;if(n instanceof Element)return[n];if(typeof n=="string"){let g=document;const v=(h=void 0)!==null&&h!==void 0?h:g.querySelectorAll(n);return v?Array.from(v):[]}return Array.from(n)}function Ej(n,t){const s=MJ(n),h=new AbortController,g={passive:!0,...t,signal:h.signal};return[s,g,()=>h.abort()]}function qz(n){return t=>{t.pointerType==="touch"||Tj()||n(t)}}function PJ(n,t,s={}){const[h,g,v]=Ej(n,s),E=qz(c=>{const{target:T}=c,L=t(c);if(typeof L!="function"||!T)return;const B=qz(U=>{L(U),T.removeEventListener("pointerleave",B)});T.addEventListener("pointerleave",B,g)});return h.forEach(c=>{c.addEventListener("pointerenter",E,g)}),v}const kj=(n,t)=>t?n===t?!0:kj(n,t.parentElement):!1,lP=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,DJ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function RJ(n){return DJ.has(n.tagName)||n.tabIndex!==-1}const V0=new WeakSet;function Zz(n){return t=>{t.key==="Enter"&&n(t)}}function lA(n,t){n.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const LJ=(n,t)=>{const s=n.currentTarget;if(!s)return;const h=Zz(()=>{if(V0.has(s))return;lA(s,"down");const g=Zz(()=>{lA(s,"up")}),v=()=>lA(s,"cancel");s.addEventListener("keyup",g,t),s.addEventListener("blur",v,t)});s.addEventListener("keydown",h,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",h),t)};function Xz(n){return lP(n)&&!Tj()}function OJ(n,t,s={}){const[h,g,v]=Ej(n,s),E=c=>{const T=c.currentTarget;if(!Xz(c)||V0.has(T))return;V0.add(T);const L=t(c),B=(X,ae)=>{window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",H),!(!Xz(X)||!V0.has(T))&&(V0.delete(T),typeof L=="function"&&L(X,{success:ae}))},U=X=>{B(X,s.useGlobalTarget||kj(T,X.target))},H=X=>{B(X,!1)};window.addEventListener("pointerup",U,g),window.addEventListener("pointercancel",H,g)};return h.forEach(c=>{!RJ(c)&&c.getAttribute("tabindex")===null&&(c.tabIndex=0),(s.useGlobalTarget?window:c).addEventListener("pointerdown",E,g),c.addEventListener("focus",L=>LJ(L,g),g)}),v}function FJ(n){return n==="x"||n==="y"?fc[n]?null:(fc[n]=!0,()=>{fc[n]=!1}):fc.x||fc.y?null:(fc.x=fc.y=!0,()=>{fc.x=fc.y=!1})}const Aj=new Set(["width","height","top","left","right","bottom",...Q_]);let AS;function zJ(){AS=void 0}const wu={now:()=>(AS===void 0&&wu.set(As.isProcessing||DQ.useManualTiming?As.timestamp:performance.now()),AS),set:n=>{AS=n,queueMicrotask(zJ)}};function cP(n,t){n.indexOf(t)===-1&&n.push(t)}function uP(n,t){const s=n.indexOf(t);s>-1&&n.splice(s,1)}class dP{constructor(){this.subscriptions=[]}add(t){return cP(this.subscriptions,t),()=>uP(this.subscriptions,t)}notify(t,s,h){const g=this.subscriptions.length;if(g)if(g===1)this.subscriptions[0](t,s,h);else for(let v=0;v<g;v++){const E=this.subscriptions[v];E&&E(t,s,h)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Cj(n,t){return t?n*(1e3/t):0}const Kz=30,BJ=n=>!isNaN(parseFloat(n));class NJ{constructor(t,s={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(h,g=!0)=>{const v=wu.now();this.updatedAt!==v&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(h),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),g&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=wu.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=BJ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new dP);const h=this.events[t].add(s);return t==="change"?()=>{h(),Ji.read(()=>{this.events.change.getSize()||this.stop()})}:h}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t,s=!0){!s||!this.passiveEffect?this.updateAndNotify(t,s):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,s,h){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-h}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=wu.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Kz)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Kz);return Cj(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Dx(n,t){return new NJ(n,t)}function VJ(n,t,s){n.hasValue(t)?n.getValue(t).set(s):n.addValue(t,Dx(s))}function jJ(n,t){const s=a2(n,t);let{transitionEnd:h={},transition:g={},...v}=s||{};v={...v,...h};for(const E in v){const c=JQ(v[E]);VJ(n,E,c)}}function UJ(n){return!!(Hs(n)&&n.add)}function nI(n,t){const s=n.getValue("willChange");if(UJ(s))return s.add(t)}function Ij(n){return n.props[oj]}const Mj=(n,t,s)=>(((1-3*s+3*t)*n+(3*s-6*t))*n+3*t)*n,GJ=1e-7,$J=12;function HJ(n,t,s,h,g){let v,E,c=0;do E=t+(s-t)/2,v=Mj(E,h,g)-n,v>0?s=E:t=E;while(Math.abs(v)>GJ&&++c<$J);return E}function Zx(n,t,s,h){if(n===t&&s===h)return dl;const g=v=>HJ(v,0,1,n,s);return v=>v===0||v===1?v:Mj(g(v),t,h)}const Pj=n=>t=>t<=.5?n(2*t)/2:(2-n(2*(1-t)))/2,Dj=n=>t=>1-n(1-t),Rj=Zx(.33,1.53,.69,.99),hP=Dj(Rj),Lj=Pj(hP),Oj=n=>(n*=2)<1?.5*hP(n):.5*(2-Math.pow(2,-10*(n-1))),fP=n=>1-Math.sin(Math.acos(n)),Fj=Dj(fP),zj=Pj(fP),Bj=n=>/^0[^.\s]+$/u.test(n);function WJ(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||Bj(n):!0}const Q0=n=>Math.round(n*1e5)/1e5,pP=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function qJ(n){return n==null}const ZJ=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,mP=(n,t)=>s=>!!(typeof s=="string"&&ZJ.test(s)&&s.startsWith(n)||t&&!qJ(s)&&Object.prototype.hasOwnProperty.call(s,t)),Nj=(n,t,s)=>h=>{if(typeof h!="string")return h;const[g,v,E,c]=h.match(pP);return{[n]:parseFloat(g),[t]:parseFloat(v),[s]:parseFloat(E),alpha:c!==void 0?parseFloat(c):1}},XJ=n=>xd(0,255,n),cA={...J_,transform:n=>Math.round(XJ(n))},Dp={test:mP("rgb","red"),parse:Nj("red","green","blue"),transform:({red:n,green:t,blue:s,alpha:h=1})=>"rgba("+cA.transform(n)+", "+cA.transform(t)+", "+cA.transform(s)+", "+Q0(Px.transform(h))+")"};function KJ(n){let t="",s="",h="",g="";return n.length>5?(t=n.substring(1,3),s=n.substring(3,5),h=n.substring(5,7),g=n.substring(7,9)):(t=n.substring(1,2),s=n.substring(2,3),h=n.substring(3,4),g=n.substring(4,5),t+=t,s+=s,h+=h,g+=g),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(h,16),alpha:g?parseInt(g,16)/255:1}}const rI={test:mP("#"),parse:KJ,transform:Dp.transform},e_={test:mP("hsl","hue"),parse:Nj("hue","saturation","lightness"),transform:({hue:n,saturation:t,lightness:s,alpha:h=1})=>"hsla("+Math.round(n)+", "+bu.transform(Q0(t))+", "+bu.transform(Q0(s))+", "+Q0(Px.transform(h))+")"},Gs={test:n=>Dp.test(n)||rI.test(n)||e_.test(n),parse:n=>Dp.test(n)?Dp.parse(n):e_.test(n)?e_.parse(n):rI.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Dp.transform(n):e_.transform(n)},YJ=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function QJ(n){var t,s;return isNaN(n)&&typeof n=="string"&&(((t=n.match(pP))===null||t===void 0?void 0:t.length)||0)+(((s=n.match(YJ))===null||s===void 0?void 0:s.length)||0)>0}const Vj="number",jj="color",JJ="var",eee="var(",Yz="${}",tee=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Rx(n){const t=n.toString(),s=[],h={color:[],number:[],var:[]},g=[];let v=0;const c=t.replace(tee,T=>(Gs.test(T)?(h.color.push(v),g.push(jj),s.push(Gs.parse(T))):T.startsWith(eee)?(h.var.push(v),g.push(JJ),s.push(T)):(h.number.push(v),g.push(Vj),s.push(parseFloat(T))),++v,Yz)).split(Yz);return{values:s,split:c,indexes:h,types:g}}function Uj(n){return Rx(n).values}function Gj(n){const{split:t,types:s}=Rx(n),h=t.length;return g=>{let v="";for(let E=0;E<h;E++)if(v+=t[E],g[E]!==void 0){const c=s[E];c===Vj?v+=Q0(g[E]):c===jj?v+=Gs.transform(g[E]):v+=g[E]}return v}}const nee=n=>typeof n=="number"?0:n;function ree(n){const t=Uj(n);return Gj(n)(t.map(nee))}const ef={test:QJ,parse:Uj,createTransformer:Gj,getAnimatableNone:ree},iee=new Set(["brightness","contrast","saturate","opacity"]);function oee(n){const[t,s]=n.slice(0,-1).split("(");if(t==="drop-shadow")return n;const[h]=s.match(pP)||[];if(!h)return n;const g=s.replace(h,"");let v=iee.has(t)?1:0;return h!==s&&(v*=100),t+"("+v+g+")"}const see=/\b([a-z-]*)\(.*?\)/gu,iI={...ef,getAnimatableNone:n=>{const t=n.match(see);return t?t.map(oee).join(" "):n}},aee={...JM,color:Gs,backgroundColor:Gs,outlineColor:Gs,fill:Gs,stroke:Gs,borderColor:Gs,borderTopColor:Gs,borderRightColor:Gs,borderBottomColor:Gs,borderLeftColor:Gs,filter:iI,WebkitFilter:iI},gP=n=>aee[n];function $j(n,t){let s=gP(n);return s!==iI&&(s=ef),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const lee=new Set(["auto","none","0"]);function cee(n,t,s){let h=0,g;for(;h<n.length&&!g;){const v=n[h];typeof v=="string"&&!lee.has(v)&&Rx(v).values.length&&(g=n[h]),h++}if(g&&s)for(const v of t)n[v]=$j(s,g)}const Qz=n=>n===J_||n===er,Jz=(n,t)=>parseFloat(n.split(", ")[t]),e3=(n,t)=>(s,{transform:h})=>{if(h==="none"||!h)return 0;const g=h.match(/^matrix3d\((.+)\)$/u);if(g)return Jz(g[1],t);{const v=h.match(/^matrix\((.+)\)$/u);return v?Jz(v[1],n):0}},uee=new Set(["x","y","z"]),dee=Q_.filter(n=>!uee.has(n));function hee(n){const t=[];return dee.forEach(s=>{const h=n.getValue(s);h!==void 0&&(t.push([s,h.get()]),h.set(s.startsWith("scale")?1:0))}),t}const B_={width:({x:n},{paddingLeft:t="0",paddingRight:s="0"})=>n.max-n.min-parseFloat(t)-parseFloat(s),height:({y:n},{paddingTop:t="0",paddingBottom:s="0"})=>n.max-n.min-parseFloat(t)-parseFloat(s),top:(n,{top:t})=>parseFloat(t),left:(n,{left:t})=>parseFloat(t),bottom:({y:n},{top:t})=>parseFloat(t)+(n.max-n.min),right:({x:n},{left:t})=>parseFloat(t)+(n.max-n.min),x:e3(4,13),y:e3(5,14)};B_.translateX=B_.x;B_.translateY=B_.y;const Gp=new Set;let oI=!1,sI=!1;function Hj(){if(sI){const n=Array.from(Gp).filter(h=>h.needsMeasurement),t=new Set(n.map(h=>h.element)),s=new Map;t.forEach(h=>{const g=hee(h);g.length&&(s.set(h,g),h.render())}),n.forEach(h=>h.measureInitialState()),t.forEach(h=>{h.render();const g=s.get(h);g&&g.forEach(([v,E])=>{var c;(c=h.getValue(v))===null||c===void 0||c.set(E)})}),n.forEach(h=>h.measureEndState()),n.forEach(h=>{h.suspendedScrollY!==void 0&&window.scrollTo(0,h.suspendedScrollY)})}sI=!1,oI=!1,Gp.forEach(n=>n.complete()),Gp.clear()}function Wj(){Gp.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(sI=!0)})}function fee(){Wj(),Hj()}class _P{constructor(t,s,h,g,v,E=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=h,this.motionValue=g,this.element=v,this.isAsync=E}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Gp.add(this),oI||(oI=!0,Ji.read(Wj),Ji.resolveKeyframes(Hj))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:h,motionValue:g}=this;for(let v=0;v<t.length;v++)if(t[v]===null)if(v===0){const E=g==null?void 0:g.get(),c=t[t.length-1];if(E!==void 0)t[0]=E;else if(h&&s){const T=h.readValue(s,c);T!=null&&(t[0]=T)}t[0]===void 0&&(t[0]=c),g&&E===void 0&&g.set(t[0])}else t[v]=t[v-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Gp.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Gp.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const qj=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),pee=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function mee(n){const t=pee.exec(n);if(!t)return[,];const[,s,h,g]=t;return[`--${s??h}`,g]}function Zj(n,t,s=1){const[h,g]=mee(n);if(!h)return;const v=window.getComputedStyle(t).getPropertyValue(h);if(v){const E=v.trim();return qj(E)?parseFloat(E):E}return QM(g)?Zj(g,t,s+1):g}const Xj=n=>t=>t.test(n),gee={test:n=>n==="auto",parse:n=>n},Kj=[J_,er,bu,xh,oJ,iJ,gee],t3=n=>Kj.find(Xj(n));class Yj extends _P{constructor(t,s,h,g,v){super(t,s,h,g,v,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:h}=this;if(!s||!s.current)return;super.readKeyframes();for(let T=0;T<t.length;T++){let L=t[T];if(typeof L=="string"&&(L=L.trim(),QM(L))){const B=Zj(L,s.current);B!==void 0&&(t[T]=B),T===t.length-1&&(this.finalKeyframe=L)}}if(this.resolveNoneKeyframes(),!Aj.has(h)||t.length!==2)return;const[g,v]=t,E=t3(g),c=t3(v);if(E!==c)if(Qz(E)&&Qz(c))for(let T=0;T<t.length;T++){const L=t[T];typeof L=="string"&&(t[T]=parseFloat(L))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,h=[];for(let g=0;g<t.length;g++)WJ(t[g])&&h.push(g);h.length&&cee(t,h,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:h}=this;if(!t||!t.current)return;h==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=B_[h](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const g=s[s.length-1];g!==void 0&&t.getValue(h,g).jump(g,!1)}measureEndState(){var t;const{element:s,name:h,unresolvedKeyframes:g}=this;if(!s||!s.current)return;const v=s.getValue(h);v&&v.jump(this.measuredOrigin,!1);const E=g.length-1,c=g[E];g[E]=B_[h](s.measureViewportBox(),window.getComputedStyle(s.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([T,L])=>{s.getValue(T).set(L)}),this.resolveNoneKeyframes()}}const n3=(n,t)=>t==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ef.test(n)||n==="0")&&!n.startsWith("url("));function _ee(n){const t=n[0];if(n.length===1)return!0;for(let s=0;s<n.length;s++)if(n[s]!==t)return!0}function yee(n,t,s,h){const g=n[0];if(g===null)return!1;if(t==="display"||t==="visibility")return!0;const v=n[n.length-1],E=n3(g,t),c=n3(v,t);return!E||!c?!1:_ee(n)||(s==="spring"||sP(s))&&h}const vee=n=>n!==null;function l2(n,{repeat:t,repeatType:s="loop"},h){const g=n.filter(vee),v=t&&s!=="loop"&&t%2===1?0:g.length-1;return!v||h===void 0?g[v]:h}const xee=40;class Qj{constructor({autoplay:t=!0,delay:s=0,type:h="keyframes",repeat:g=0,repeatDelay:v=0,repeatType:E="loop",...c}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=wu.now(),this.options={autoplay:t,delay:s,type:h,repeat:g,repeatDelay:v,repeatType:E,...c},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>xee?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&fee(),this._resolved}onKeyframesResolved(t,s){this.resolvedAt=wu.now(),this.hasAttemptedResolve=!0;const{name:h,type:g,velocity:v,delay:E,onComplete:c,onUpdate:T,isGenerator:L}=this.options;if(!L&&!yee(t,h,g,v))if(E)this.options.duration=0;else{T&&T(l2(t,this.options,s)),c&&c(),this.resolveFinishedPromise();return}const B=this.initPlayback(t,s);B!==!1&&(this._resolved={keyframes:t,finalKeyframe:s,...B},this.onPostResolved())}onPostResolved(){}then(t,s){return this.currentFinishedPromise.then(t,s)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const po=(n,t,s)=>n+(t-n)*s;function uA(n,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?n+(t-n)*6*s:s<1/2?t:s<2/3?n+(t-n)*(2/3-s)*6:n}function bee({hue:n,saturation:t,lightness:s,alpha:h}){n/=360,t/=100,s/=100;let g=0,v=0,E=0;if(!t)g=v=E=s;else{const c=s<.5?s*(1+t):s+t-s*t,T=2*s-c;g=uA(T,c,n+1/3),v=uA(T,c,n),E=uA(T,c,n-1/3)}return{red:Math.round(g*255),green:Math.round(v*255),blue:Math.round(E*255),alpha:h}}function vT(n,t){return s=>s>0?t:n}const dA=(n,t,s)=>{const h=n*n,g=s*(t*t-h)+h;return g<0?0:Math.sqrt(g)},wee=[rI,Dp,e_],See=n=>wee.find(t=>t.test(n));function r3(n){const t=See(n);if(!t)return!1;let s=t.parse(n);return t===e_&&(s=bee(s)),s}const i3=(n,t)=>{const s=r3(n),h=r3(t);if(!s||!h)return vT(n,t);const g={...s};return v=>(g.red=dA(s.red,h.red,v),g.green=dA(s.green,h.green,v),g.blue=dA(s.blue,h.blue,v),g.alpha=po(s.alpha,h.alpha,v),Dp.transform(g))},Tee=(n,t)=>s=>t(n(s)),Xx=(...n)=>n.reduce(Tee),aI=new Set(["none","hidden"]);function Eee(n,t){return aI.has(n)?s=>s<=0?n:t:s=>s>=1?t:n}function kee(n,t){return s=>po(n,t,s)}function yP(n){return typeof n=="number"?kee:typeof n=="string"?QM(n)?vT:Gs.test(n)?i3:Iee:Array.isArray(n)?Jj:typeof n=="object"?Gs.test(n)?i3:Aee:vT}function Jj(n,t){const s=[...n],h=s.length,g=n.map((v,E)=>yP(v)(v,t[E]));return v=>{for(let E=0;E<h;E++)s[E]=g[E](v);return s}}function Aee(n,t){const s={...n,...t},h={};for(const g in s)n[g]!==void 0&&t[g]!==void 0&&(h[g]=yP(n[g])(n[g],t[g]));return g=>{for(const v in h)s[v]=h[v](g);return s}}function Cee(n,t){var s;const h=[],g={color:0,var:0,number:0};for(let v=0;v<t.values.length;v++){const E=t.types[v],c=n.indexes[E][g[E]],T=(s=n.values[c])!==null&&s!==void 0?s:0;h[v]=T,g[E]++}return h}const Iee=(n,t)=>{const s=ef.createTransformer(t),h=Rx(n),g=Rx(t);return h.indexes.var.length===g.indexes.var.length&&h.indexes.color.length===g.indexes.color.length&&h.indexes.number.length>=g.indexes.number.length?aI.has(n)&&!g.values.length||aI.has(t)&&!h.values.length?Eee(n,t):Xx(Jj(Cee(h,g),g.values),s):vT(n,t)};function eU(n,t,s){return typeof n=="number"&&typeof t=="number"&&typeof s=="number"?po(n,t,s):yP(n)(n,t)}const Mee=5;function tU(n,t,s){const h=Math.max(t-Mee,0);return Cj(s-n(h),t-h)}const xo={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},hA=.001;function Pee({duration:n=xo.duration,bounce:t=xo.bounce,velocity:s=xo.velocity,mass:h=xo.mass}){let g,v,E=1-t;E=xd(xo.minDamping,xo.maxDamping,E),n=xd(xo.minDuration,xo.maxDuration,hd(n)),E<1?(g=L=>{const B=L*E,U=B*n,H=B-s,X=lI(L,E),ae=Math.exp(-U);return hA-H/X*ae},v=L=>{const U=L*E*n,H=U*s+s,X=Math.pow(E,2)*Math.pow(L,2)*n,ae=Math.exp(-U),ne=lI(Math.pow(L,2),E);return(-g(L)+hA>0?-1:1)*((H-X)*ae)/ne}):(g=L=>{const B=Math.exp(-L*n),U=(L-s)*n+1;return-hA+B*U},v=L=>{const B=Math.exp(-L*n),U=(s-L)*(n*n);return B*U});const c=5/n,T=Ree(g,v,c);if(n=dd(n),isNaN(T))return{stiffness:xo.stiffness,damping:xo.damping,duration:n};{const L=Math.pow(T,2)*h;return{stiffness:L,damping:E*2*Math.sqrt(h*L),duration:n}}}const Dee=12;function Ree(n,t,s){let h=s;for(let g=1;g<Dee;g++)h=h-n(h)/t(h);return h}function lI(n,t){return n*Math.sqrt(1-t*t)}const Lee=["duration","bounce"],Oee=["stiffness","damping","mass"];function o3(n,t){return t.some(s=>n[s]!==void 0)}function Fee(n){let t={velocity:xo.velocity,stiffness:xo.stiffness,damping:xo.damping,mass:xo.mass,isResolvedFromDuration:!1,...n};if(!o3(n,Oee)&&o3(n,Lee))if(n.visualDuration){const s=n.visualDuration,h=2*Math.PI/(s*1.2),g=h*h,v=2*xd(.05,1,1-(n.bounce||0))*Math.sqrt(g);t={...t,mass:xo.mass,stiffness:g,damping:v}}else{const s=Pee(n);t={...t,...s,mass:xo.mass},t.isResolvedFromDuration=!0}return t}function nU(n=xo.visualDuration,t=xo.bounce){const s=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:t}:n;let{restSpeed:h,restDelta:g}=s;const v=s.keyframes[0],E=s.keyframes[s.keyframes.length-1],c={done:!1,value:v},{stiffness:T,damping:L,mass:B,duration:U,velocity:H,isResolvedFromDuration:X}=Fee({...s,velocity:-hd(s.velocity||0)}),ae=H||0,ne=L/(2*Math.sqrt(T*B)),me=E-v,oe=hd(Math.sqrt(T/B)),re=Math.abs(me)<5;h||(h=re?xo.restSpeed.granular:xo.restSpeed.default),g||(g=re?xo.restDelta.granular:xo.restDelta.default);let he;if(ne<1){const De=lI(oe,ne);he=He=>{const nt=Math.exp(-ne*oe*He);return E-nt*((ae+ne*oe*me)/De*Math.sin(De*He)+me*Math.cos(De*He))}}else if(ne===1)he=De=>E-Math.exp(-oe*De)*(me+(ae+oe*me)*De);else{const De=oe*Math.sqrt(ne*ne-1);he=He=>{const nt=Math.exp(-ne*oe*He),Xe=Math.min(De*He,300);return E-nt*((ae+ne*oe*me)*Math.sinh(Xe)+De*me*Math.cosh(Xe))/De}}const _e={calculatedDuration:X&&U||null,next:De=>{const He=he(De);if(X)c.done=De>=U;else{let nt=0;ne<1&&(nt=De===0?dd(ae):tU(he,De,He));const Xe=Math.abs(nt)<=h,ft=Math.abs(E-He)<=g;c.done=Xe&&ft}return c.value=c.done?E:He,c},toString:()=>{const De=Math.min(xj(_e),eI),He=bj(nt=>_e.next(De*nt).value,De,30);return De+"ms "+He}};return _e}function s3({keyframes:n,velocity:t=0,power:s=.8,timeConstant:h=325,bounceDamping:g=10,bounceStiffness:v=500,modifyTarget:E,min:c,max:T,restDelta:L=.5,restSpeed:B}){const U=n[0],H={done:!1,value:U},X=Xe=>c!==void 0&&Xe<c||T!==void 0&&Xe>T,ae=Xe=>c===void 0?T:T===void 0||Math.abs(c-Xe)<Math.abs(T-Xe)?c:T;let ne=s*t;const me=U+ne,oe=E===void 0?me:E(me);oe!==me&&(ne=oe-U);const re=Xe=>-ne*Math.exp(-Xe/h),he=Xe=>oe+re(Xe),_e=Xe=>{const ft=re(Xe),At=he(Xe);H.done=Math.abs(ft)<=L,H.value=H.done?oe:At};let De,He;const nt=Xe=>{X(H.value)&&(De=Xe,He=nU({keyframes:[H.value,ae(H.value)],velocity:tU(he,Xe,H.value),damping:g,stiffness:v,restDelta:L,restSpeed:B}))};return nt(0),{calculatedDuration:null,next:Xe=>{let ft=!1;return!He&&De===void 0&&(ft=!0,_e(Xe),nt(Xe)),De!==void 0&&Xe>=De?He.next(Xe-De):(!ft&&_e(Xe),H)}}}const zee=Zx(.42,0,1,1),Bee=Zx(0,0,.58,1),rU=Zx(.42,0,.58,1),Nee=n=>Array.isArray(n)&&typeof n[0]!="number",Vee={linear:dl,easeIn:zee,easeInOut:rU,easeOut:Bee,circIn:fP,circInOut:zj,circOut:Fj,backIn:hP,backInOut:Lj,backOut:Rj,anticipate:Oj},a3=n=>{if(aP(n)){ej(n.length===4);const[t,s,h,g]=n;return Zx(t,s,h,g)}else if(typeof n=="string")return Vee[n];return n};function jee(n,t,s){const h=[],g=s||eU,v=n.length-1;for(let E=0;E<v;E++){let c=g(n[E],n[E+1]);if(t){const T=Array.isArray(t)?t[E]||dl:t;c=Xx(T,c)}h.push(c)}return h}function Uee(n,t,{clamp:s=!0,ease:h,mixer:g}={}){const v=n.length;if(ej(v===t.length),v===1)return()=>t[0];if(v===2&&t[0]===t[1])return()=>t[1];const E=n[0]===n[1];n[0]>n[v-1]&&(n=[...n].reverse(),t=[...t].reverse());const c=jee(t,h,g),T=c.length,L=B=>{if(E&&B<n[0])return t[0];let U=0;if(T>1)for(;U<n.length-2&&!(B<n[U+1]);U++);const H=F_(n[U],n[U+1],B);return c[U](H)};return s?B=>L(xd(n[0],n[v-1],B)):L}function Gee(n,t){const s=n[n.length-1];for(let h=1;h<=t;h++){const g=F_(0,t,h);n.push(po(s,1,g))}}function $ee(n){const t=[0];return Gee(t,n.length-1),t}function Hee(n,t){return n.map(s=>s*t)}function Wee(n,t){return n.map(()=>t||rU).splice(0,n.length-1)}function xT({duration:n=300,keyframes:t,times:s,ease:h="easeInOut"}){const g=Nee(h)?h.map(a3):a3(h),v={done:!1,value:t[0]},E=Hee(s&&s.length===t.length?s:$ee(t),n),c=Uee(E,t,{ease:Array.isArray(g)?g:Wee(t,g)});return{calculatedDuration:n,next:T=>(v.value=c(T),v.done=T>=n,v)}}const qee=n=>{const t=({timestamp:s})=>n(s);return{start:()=>Ji.update(t,!0),stop:()=>Jh(t),now:()=>As.isProcessing?As.timestamp:wu.now()}},Zee={decay:s3,inertia:s3,tween:xT,keyframes:xT,spring:nU},Xee=n=>n/100;class vP extends Qj{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:T}=this.options;T&&T()};const{name:s,motionValue:h,element:g,keyframes:v}=this.options,E=(g==null?void 0:g.KeyframeResolver)||_P,c=(T,L)=>this.onKeyframesResolved(T,L);this.resolver=new E(v,c,s,h,g),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:s="keyframes",repeat:h=0,repeatDelay:g=0,repeatType:v,velocity:E=0}=this.options,c=sP(s)?s:Zee[s]||xT;let T,L;c!==xT&&typeof t[0]!="number"&&(T=Xx(Xee,eU(t[0],t[1])),t=[0,100]);const B=c({...this.options,keyframes:t});v==="mirror"&&(L=c({...this.options,keyframes:[...t].reverse(),velocity:-E})),B.calculatedDuration===null&&(B.calculatedDuration=xj(B));const{calculatedDuration:U}=B,H=U+g,X=H*(h+1)-g;return{generator:B,mirroredGenerator:L,mapPercentToKeyframes:T,calculatedDuration:U,resolvedDuration:H,totalDuration:X}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,s=!1){const{resolved:h}=this;if(!h){const{keyframes:Xe}=this.options;return{done:!0,value:Xe[Xe.length-1]}}const{finalKeyframe:g,generator:v,mirroredGenerator:E,mapPercentToKeyframes:c,keyframes:T,calculatedDuration:L,totalDuration:B,resolvedDuration:U}=h;if(this.startTime===null)return v.next(0);const{delay:H,repeat:X,repeatType:ae,repeatDelay:ne,onUpdate:me}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-B/this.speed,this.startTime)),s?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const oe=this.currentTime-H*(this.speed>=0?1:-1),re=this.speed>=0?oe<0:oe>B;this.currentTime=Math.max(oe,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=B);let he=this.currentTime,_e=v;if(X){const Xe=Math.min(this.currentTime,B)/U;let ft=Math.floor(Xe),At=Xe%1;!At&&Xe>=1&&(At=1),At===1&&ft--,ft=Math.min(ft,X+1),!!(ft%2)&&(ae==="reverse"?(At=1-At,ne&&(At-=ne/U)):ae==="mirror"&&(_e=E)),he=xd(0,1,At)*U}const De=re?{done:!1,value:T[0]}:_e.next(he);c&&(De.value=c(De.value));let{done:He}=De;!re&&L!==null&&(He=this.speed>=0?this.currentTime>=B:this.currentTime<=0);const nt=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&He);return nt&&g!==void 0&&(De.value=l2(T,this.options,g)),me&&me(De.value),nt&&this.finish(),De}get duration(){const{resolved:t}=this;return t?hd(t.calculatedDuration):0}get time(){return hd(this.currentTime)}set time(t){t=dd(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const s=this.playbackSpeed!==t;this.playbackSpeed=t,s&&(this.time=hd(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=qee,onPlay:s,startTime:h}=this.options;this.driver||(this.driver=t(v=>this.tick(v))),s&&s();const g=this.driver.now();this.holdTime!==null?this.startTime=g-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=g):this.startTime=h??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Kee=new Set(["opacity","clipPath","filter","transform"]);function Yee(n,t,s,{delay:h=0,duration:g=300,repeat:v=0,repeatType:E="loop",ease:c="easeInOut",times:T}={}){const L={[t]:s};T&&(L.offset=T);const B=Sj(c,g);return Array.isArray(B)&&(L.easing=B),n.animate(L,{delay:h,duration:g,easing:Array.isArray(B)?"linear":B,fill:"both",iterations:v+1,direction:E==="reverse"?"alternate":"normal"})}const Qee=HM(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),bT=10,Jee=2e4;function ete(n){return sP(n.type)||n.type==="spring"||!wj(n.ease)}function tte(n,t){const s=new vP({...t,keyframes:n,repeat:0,delay:0,isGenerator:!0});let h={done:!1,value:n[0]};const g=[];let v=0;for(;!h.done&&v<Jee;)h=s.sample(v),g.push(h.value),v+=bT;return{times:void 0,keyframes:g,duration:v-bT,ease:"linear"}}const iU={anticipate:Oj,backInOut:Lj,circInOut:zj};function nte(n){return n in iU}class l3 extends Qj{constructor(t){super(t);const{name:s,motionValue:h,element:g,keyframes:v}=this.options;this.resolver=new Yj(v,(E,c)=>this.onKeyframesResolved(E,c),s,h,g),this.resolver.scheduleResolve()}initPlayback(t,s){let{duration:h=300,times:g,ease:v,type:E,motionValue:c,name:T,startTime:L}=this.options;if(!c.owner||!c.owner.current)return!1;if(typeof v=="string"&&yT()&&nte(v)&&(v=iU[v]),ete(this.options)){const{onComplete:U,onUpdate:H,motionValue:X,element:ae,...ne}=this.options,me=tte(t,ne);t=me.keyframes,t.length===1&&(t[1]=t[0]),h=me.duration,g=me.times,v=me.ease,E="keyframes"}const B=Yee(c.owner.current,T,t,{...this.options,duration:h,times:g,ease:v});return B.startTime=L??this.calcStartTime(),this.pendingTimeline?(Wz(B,this.pendingTimeline),this.pendingTimeline=void 0):B.onfinish=()=>{const{onComplete:U}=this.options;c.set(l2(t,this.options,s)),U&&U(),this.cancel(),this.resolveFinishedPromise()},{animation:B,duration:h,times:g,type:E,ease:v,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:s}=t;return hd(s)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:s}=t;return hd(s.currentTime||0)}set time(t){const{resolved:s}=this;if(!s)return;const{animation:h}=s;h.currentTime=dd(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:s}=t;return s.playbackRate}set speed(t){const{resolved:s}=this;if(!s)return;const{animation:h}=s;h.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:s}=t;return s.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:s}=t;return s.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:s}=this;if(!s)return dl;const{animation:h}=s;Wz(h,t)}return dl}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:s}=t;s.playState==="finished"&&this.updateFinishedPromise(),s.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:s}=t;s.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:s,keyframes:h,duration:g,type:v,ease:E,times:c}=t;if(s.playState==="idle"||s.playState==="finished")return;if(this.time){const{motionValue:L,onUpdate:B,onComplete:U,element:H,...X}=this.options,ae=new vP({...X,keyframes:h,duration:g,type:v,ease:E,times:c,isGenerator:!0}),ne=dd(this.time);L.setWithVelocity(ae.sample(ne-bT).value,ae.sample(ne).value,bT)}const{onStop:T}=this.options;T&&T(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:s,name:h,repeatDelay:g,repeatType:v,damping:E,type:c}=t;if(!s||!s.owner||!(s.owner.current instanceof HTMLElement))return!1;const{onUpdate:T,transformTemplate:L}=s.owner.getProps();return Qee()&&h&&Kee.has(h)&&!T&&!L&&!g&&v!=="mirror"&&E!==0&&c!=="inertia"}}const rte={type:"spring",stiffness:500,damping:25,restSpeed:10},ite=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),ote={type:"keyframes",duration:.8},ste={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ate=(n,{keyframes:t})=>t.length>2?ote:rm.has(n)?n.startsWith("scale")?ite(t[1]):rte:ste;function lte({when:n,delay:t,delayChildren:s,staggerChildren:h,staggerDirection:g,repeat:v,repeatType:E,repeatDelay:c,from:T,elapsed:L,...B}){return!!Object.keys(B).length}const xP=(n,t,s,h={},g,v)=>E=>{const c=oP(h,n)||{},T=c.delay||h.delay||0;let{elapsed:L=0}=h;L=L-dd(T);let B={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-L,onUpdate:H=>{t.set(H),c.onUpdate&&c.onUpdate(H)},onComplete:()=>{E(),c.onComplete&&c.onComplete()},name:n,motionValue:t,element:v?void 0:g};lte(c)||(B={...B,...ate(n,B)}),B.duration&&(B.duration=dd(B.duration)),B.repeatDelay&&(B.repeatDelay=dd(B.repeatDelay)),B.from!==void 0&&(B.keyframes[0]=B.from);let U=!1;if((B.type===!1||B.duration===0&&!B.repeatDelay)&&(B.duration=0,B.delay===0&&(U=!0)),U&&!v&&t.get()!==void 0){const H=l2(B.keyframes,c);if(H!==void 0)return Ji.update(()=>{B.onUpdate(H),B.onComplete()}),new AJ([])}return!v&&l3.supports(B)?new l3(B):new vP(B)};function cte({protectedKeys:n,needsAnimating:t},s){const h=n.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,h}function oU(n,t,{delay:s=0,transitionOverride:h,type:g}={}){var v;let{transition:E=n.getDefaultTransition(),transitionEnd:c,...T}=t;h&&(E=h);const L=[],B=g&&n.animationState&&n.animationState.getState()[g];for(const U in T){const H=n.getValue(U,(v=n.latestValues[U])!==null&&v!==void 0?v:null),X=T[U];if(X===void 0||B&&cte(B,U))continue;const ae={delay:s,...oP(E||{},U)};let ne=!1;if(window.MotionHandoffAnimation){const oe=Ij(n);if(oe){const re=window.MotionHandoffAnimation(oe,U,Ji);re!==null&&(ae.startTime=re,ne=!0)}}nI(n,U),H.start(xP(U,H,X,n.shouldReduceMotion&&Aj.has(U)?{type:!1}:ae,n,ne));const me=H.animation;me&&L.push(me)}return c&&Promise.all(L).then(()=>{Ji.update(()=>{c&&jJ(n,c)})}),L}function cI(n,t,s={}){var h;const g=a2(n,t,s.type==="exit"?(h=n.presenceContext)===null||h===void 0?void 0:h.custom:void 0);let{transition:v=n.getDefaultTransition()||{}}=g||{};s.transitionOverride&&(v=s.transitionOverride);const E=g?()=>Promise.all(oU(n,g,s)):()=>Promise.resolve(),c=n.variantChildren&&n.variantChildren.size?(L=0)=>{const{delayChildren:B=0,staggerChildren:U,staggerDirection:H}=v;return ute(n,t,B+L,U,H,s)}:()=>Promise.resolve(),{when:T}=v;if(T){const[L,B]=T==="beforeChildren"?[E,c]:[c,E];return L().then(()=>B())}else return Promise.all([E(),c(s.delay)])}function ute(n,t,s=0,h=0,g=1,v){const E=[],c=(n.variantChildren.size-1)*h,T=g===1?(L=0)=>L*h:(L=0)=>c-L*h;return Array.from(n.variantChildren).sort(dte).forEach((L,B)=>{L.notify("AnimationStart",t),E.push(cI(L,t,{...v,delay:s+T(B)}).then(()=>L.notify("AnimationComplete",t)))}),Promise.all(E)}function dte(n,t){return n.sortNodePosition(t)}function hte(n,t,s={}){n.notify("AnimationStart",t);let h;if(Array.isArray(t)){const g=t.map(v=>cI(n,v,s));h=Promise.all(g)}else if(typeof t=="string")h=cI(n,t,s);else{const g=typeof t=="function"?a2(n,t,s.custom):t;h=Promise.all(oU(n,g,s))}return h.then(()=>{n.notify("AnimationComplete",t)})}const fte=qM.length;function sU(n){if(!n)return;if(!n.isControllingVariants){const s=n.parent?sU(n.parent)||{}:{};return n.props.initial!==void 0&&(s.initial=n.props.initial),s}const t={};for(let s=0;s<fte;s++){const h=qM[s],g=n.props[h];(Mx(g)||g===!1)&&(t[h]=g)}return t}const pte=[...WM].reverse(),mte=WM.length;function gte(n){return t=>Promise.all(t.map(({animation:s,options:h})=>hte(n,s,h)))}function _te(n){let t=gte(n),s=c3(),h=!0;const g=T=>(L,B)=>{var U;const H=a2(n,B,T==="exit"?(U=n.presenceContext)===null||U===void 0?void 0:U.custom:void 0);if(H){const{transition:X,transitionEnd:ae,...ne}=H;L={...L,...ne,...ae}}return L};function v(T){t=T(n)}function E(T){const{props:L}=n,B=sU(n.parent)||{},U=[],H=new Set;let X={},ae=1/0;for(let me=0;me<mte;me++){const oe=pte[me],re=s[oe],he=L[oe]!==void 0?L[oe]:B[oe],_e=Mx(he),De=oe===T?re.isActive:null;De===!1&&(ae=me);let He=he===B[oe]&&he!==L[oe]&&_e;if(He&&h&&n.manuallyAnimateOnMount&&(He=!1),re.protectedKeys={...X},!re.isActive&&De===null||!he&&!re.prevProp||o2(he)||typeof he=="boolean")continue;const nt=yte(re.prevProp,he);let Xe=nt||oe===T&&re.isActive&&!He&&_e||me>ae&&_e,ft=!1;const At=Array.isArray(he)?he:[he];let Bt=At.reduce(g(oe),{});De===!1&&(Bt={});const{prevResolvedValues:Dt={}}=re,It={...Dt,...Bt},kt=zt=>{Xe=!0,H.has(zt)&&(ft=!0,H.delete(zt)),re.needsAnimating[zt]=!0;const vt=n.getValue(zt);vt&&(vt.liveStyle=!1)};for(const zt in It){const vt=Bt[zt],pt=Dt[zt];if(X.hasOwnProperty(zt))continue;let Pt=!1;JC(vt)&&JC(pt)?Pt=!vj(vt,pt):Pt=vt!==pt,Pt?vt!=null?kt(zt):H.add(zt):vt!==void 0&&H.has(zt)?kt(zt):re.protectedKeys[zt]=!0}re.prevProp=he,re.prevResolvedValues=Bt,re.isActive&&(X={...X,...Bt}),h&&n.blockInitialAnimation&&(Xe=!1),Xe&&(!(He&&nt)||ft)&&U.push(...At.map(zt=>({animation:zt,options:{type:oe}})))}if(H.size){const me={};H.forEach(oe=>{const re=n.getBaseTarget(oe),he=n.getValue(oe);he&&(he.liveStyle=!0),me[oe]=re??null}),U.push({animation:me})}let ne=!!U.length;return h&&(L.initial===!1||L.initial===L.animate)&&!n.manuallyAnimateOnMount&&(ne=!1),h=!1,ne?t(U):Promise.resolve()}function c(T,L){var B;if(s[T].isActive===L)return Promise.resolve();(B=n.variantChildren)===null||B===void 0||B.forEach(H=>{var X;return(X=H.animationState)===null||X===void 0?void 0:X.setActive(T,L)}),s[T].isActive=L;const U=E(T);for(const H in s)s[H].protectedKeys={};return U}return{animateChanges:E,setActive:c,setAnimateFunction:v,getState:()=>s,reset:()=>{s=c3(),h=!0}}}function yte(n,t){return typeof t=="string"?t!==n:Array.isArray(t)?!vj(t,n):!1}function Sp(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function c3(){return{animate:Sp(!0),whileInView:Sp(),whileHover:Sp(),whileTap:Sp(),whileDrag:Sp(),whileFocus:Sp(),exit:Sp()}}class sf{constructor(t){this.isMounted=!1,this.node=t}update(){}}class vte extends sf{constructor(t){super(t),t.animationState||(t.animationState=_te(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();o2(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:s}=this.node.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let xte=0;class bte extends sf{constructor(){super(...arguments),this.id=xte++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:h}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===h)return;const g=this.node.animationState.setActive("exit",!t);s&&!t&&g.then(()=>s(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const wte={animation:{Feature:vte},exit:{Feature:bte}};function Lx(n,t,s,h={passive:!0}){return n.addEventListener(t,s,h),()=>n.removeEventListener(t,s)}function Kx(n){return{point:{x:n.pageX,y:n.pageY}}}const Ste=n=>t=>lP(t)&&n(t,Kx(t));function J0(n,t,s,h){return Lx(n,t,Ste(s),h)}const u3=(n,t)=>Math.abs(n-t);function Tte(n,t){const s=u3(n.x,t.x),h=u3(n.y,t.y);return Math.sqrt(s**2+h**2)}class aU{constructor(t,s,{transformPagePoint:h,contextWindow:g,dragSnapToOrigin:v=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const U=pA(this.lastMoveEventInfo,this.history),H=this.startEvent!==null,X=Tte(U.offset,{x:0,y:0})>=3;if(!H&&!X)return;const{point:ae}=U,{timestamp:ne}=As;this.history.push({...ae,timestamp:ne});const{onStart:me,onMove:oe}=this.handlers;H||(me&&me(this.lastMoveEvent,U),this.startEvent=this.lastMoveEvent),oe&&oe(this.lastMoveEvent,U)},this.handlePointerMove=(U,H)=>{this.lastMoveEvent=U,this.lastMoveEventInfo=fA(H,this.transformPagePoint),Ji.update(this.updatePoint,!0)},this.handlePointerUp=(U,H)=>{this.end();const{onEnd:X,onSessionEnd:ae,resumeAnimation:ne}=this.handlers;if(this.dragSnapToOrigin&&ne&&ne(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const me=pA(U.type==="pointercancel"?this.lastMoveEventInfo:fA(H,this.transformPagePoint),this.history);this.startEvent&&X&&X(U,me),ae&&ae(U,me)},!lP(t))return;this.dragSnapToOrigin=v,this.handlers=s,this.transformPagePoint=h,this.contextWindow=g||window;const E=Kx(t),c=fA(E,this.transformPagePoint),{point:T}=c,{timestamp:L}=As;this.history=[{...T,timestamp:L}];const{onSessionStart:B}=s;B&&B(t,pA(c,this.history)),this.removeListeners=Xx(J0(this.contextWindow,"pointermove",this.handlePointerMove),J0(this.contextWindow,"pointerup",this.handlePointerUp),J0(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Jh(this.updatePoint)}}function fA(n,t){return t?{point:t(n.point)}:n}function d3(n,t){return{x:n.x-t.x,y:n.y-t.y}}function pA({point:n},t){return{point:n,delta:d3(n,lU(t)),offset:d3(n,Ete(t)),velocity:kte(t,.1)}}function Ete(n){return n[0]}function lU(n){return n[n.length-1]}function kte(n,t){if(n.length<2)return{x:0,y:0};let s=n.length-1,h=null;const g=lU(n);for(;s>=0&&(h=n[s],!(g.timestamp-h.timestamp>dd(t)));)s--;if(!h)return{x:0,y:0};const v=hd(g.timestamp-h.timestamp);if(v===0)return{x:0,y:0};const E={x:(g.x-h.x)/v,y:(g.y-h.y)/v};return E.x===1/0&&(E.x=0),E.y===1/0&&(E.y=0),E}const cU=1e-4,Ate=1-cU,Cte=1+cU,uU=.01,Ite=0-uU,Mte=0+uU;function pl(n){return n.max-n.min}function Pte(n,t,s){return Math.abs(n-t)<=s}function h3(n,t,s,h=.5){n.origin=h,n.originPoint=po(t.min,t.max,n.origin),n.scale=pl(s)/pl(t),n.translate=po(s.min,s.max,n.origin)-n.originPoint,(n.scale>=Ate&&n.scale<=Cte||isNaN(n.scale))&&(n.scale=1),(n.translate>=Ite&&n.translate<=Mte||isNaN(n.translate))&&(n.translate=0)}function ex(n,t,s,h){h3(n.x,t.x,s.x,h?h.originX:void 0),h3(n.y,t.y,s.y,h?h.originY:void 0)}function f3(n,t,s){n.min=s.min+t.min,n.max=n.min+pl(t)}function Dte(n,t,s){f3(n.x,t.x,s.x),f3(n.y,t.y,s.y)}function p3(n,t,s){n.min=t.min-s.min,n.max=n.min+pl(t)}function tx(n,t,s){p3(n.x,t.x,s.x),p3(n.y,t.y,s.y)}function Rte(n,{min:t,max:s},h){return t!==void 0&&n<t?n=h?po(t,n,h.min):Math.max(n,t):s!==void 0&&n>s&&(n=h?po(s,n,h.max):Math.min(n,s)),n}function m3(n,t,s){return{min:t!==void 0?n.min+t:void 0,max:s!==void 0?n.max+s-(n.max-n.min):void 0}}function Lte(n,{top:t,left:s,bottom:h,right:g}){return{x:m3(n.x,s,g),y:m3(n.y,t,h)}}function g3(n,t){let s=t.min-n.min,h=t.max-n.max;return t.max-t.min<n.max-n.min&&([s,h]=[h,s]),{min:s,max:h}}function Ote(n,t){return{x:g3(n.x,t.x),y:g3(n.y,t.y)}}function Fte(n,t){let s=.5;const h=pl(n),g=pl(t);return g>h?s=F_(t.min,t.max-h,n.min):h>g&&(s=F_(n.min,n.max-g,t.min)),xd(0,1,s)}function zte(n,t){const s={};return t.min!==void 0&&(s.min=t.min-n.min),t.max!==void 0&&(s.max=t.max-n.min),s}const uI=.35;function Bte(n=uI){return n===!1?n=0:n===!0&&(n=uI),{x:_3(n,"left","right"),y:_3(n,"top","bottom")}}function _3(n,t,s){return{min:y3(n,t),max:y3(n,s)}}function y3(n,t){return typeof n=="number"?n:n[t]||0}const v3=()=>({translate:0,scale:1,origin:0,originPoint:0}),t_=()=>({x:v3(),y:v3()}),x3=()=>({min:0,max:0}),Lo=()=>({x:x3(),y:x3()});function zl(n){return[n("x"),n("y")]}function dU({top:n,left:t,right:s,bottom:h}){return{x:{min:t,max:s},y:{min:n,max:h}}}function Nte({x:n,y:t}){return{top:t.min,right:n.max,bottom:t.max,left:n.min}}function Vte(n,t){if(!t)return n;const s=t({x:n.left,y:n.top}),h=t({x:n.right,y:n.bottom});return{top:s.y,left:s.x,bottom:h.y,right:h.x}}function mA(n){return n===void 0||n===1}function dI({scale:n,scaleX:t,scaleY:s}){return!mA(n)||!mA(t)||!mA(s)}function kp(n){return dI(n)||hU(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function hU(n){return b3(n.x)||b3(n.y)}function b3(n){return n&&n!=="0%"}function wT(n,t,s){const h=n-s,g=t*h;return s+g}function w3(n,t,s,h,g){return g!==void 0&&(n=wT(n,g,h)),wT(n,s,h)+t}function hI(n,t=0,s=1,h,g){n.min=w3(n.min,t,s,h,g),n.max=w3(n.max,t,s,h,g)}function fU(n,{x:t,y:s}){hI(n.x,t.translate,t.scale,t.originPoint),hI(n.y,s.translate,s.scale,s.originPoint)}const S3=.999999999999,T3=1.0000000000001;function jte(n,t,s,h=!1){const g=s.length;if(!g)return;t.x=t.y=1;let v,E;for(let c=0;c<g;c++){v=s[c],E=v.projectionDelta;const{visualElement:T}=v.options;T&&T.props.style&&T.props.style.display==="contents"||(h&&v.options.layoutScroll&&v.scroll&&v!==v.root&&r_(n,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),E&&(t.x*=E.x.scale,t.y*=E.y.scale,fU(n,E)),h&&kp(v.latestValues)&&r_(n,v.latestValues))}t.x<T3&&t.x>S3&&(t.x=1),t.y<T3&&t.y>S3&&(t.y=1)}function n_(n,t){n.min=n.min+t,n.max=n.max+t}function E3(n,t,s,h,g=.5){const v=po(n.min,n.max,g);hI(n,t,s,v,h)}function r_(n,t){E3(n.x,t.x,t.scaleX,t.scale,t.originX),E3(n.y,t.y,t.scaleY,t.scale,t.originY)}function pU(n,t){return dU(Vte(n.getBoundingClientRect(),t))}function Ute(n,t,s){const h=pU(n,s),{scroll:g}=t;return g&&(n_(h.x,g.offset.x),n_(h.y,g.offset.y)),h}const mU=({current:n})=>n?n.ownerDocument.defaultView:null,Gte=new WeakMap;class $te{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Lo(),this.visualElement=t}start(t,{snapToCursor:s=!1}={}){const{presenceContext:h}=this.visualElement;if(h&&h.isPresent===!1)return;const g=B=>{const{dragSnapToOrigin:U}=this.getProps();U?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(Kx(B).point)},v=(B,U)=>{const{drag:H,dragPropagation:X,onDragStart:ae}=this.getProps();if(H&&!X&&(this.openDragLock&&this.openDragLock(),this.openDragLock=FJ(H),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),zl(me=>{let oe=this.getAxisMotionValue(me).get()||0;if(bu.test(oe)){const{projection:re}=this.visualElement;if(re&&re.layout){const he=re.layout.layoutBox[me];he&&(oe=pl(he)*(parseFloat(oe)/100))}}this.originPoint[me]=oe}),ae&&Ji.postRender(()=>ae(B,U)),nI(this.visualElement,"transform");const{animationState:ne}=this.visualElement;ne&&ne.setActive("whileDrag",!0)},E=(B,U)=>{const{dragPropagation:H,dragDirectionLock:X,onDirectionLock:ae,onDrag:ne}=this.getProps();if(!H&&!this.openDragLock)return;const{offset:me}=U;if(X&&this.currentDirection===null){this.currentDirection=Hte(me),this.currentDirection!==null&&ae&&ae(this.currentDirection);return}this.updateAxis("x",U.point,me),this.updateAxis("y",U.point,me),this.visualElement.render(),ne&&ne(B,U)},c=(B,U)=>this.stop(B,U),T=()=>zl(B=>{var U;return this.getAnimationState(B)==="paused"&&((U=this.getAxisMotionValue(B).animation)===null||U===void 0?void 0:U.play())}),{dragSnapToOrigin:L}=this.getProps();this.panSession=new aU(t,{onSessionStart:g,onStart:v,onMove:E,onSessionEnd:c,resumeAnimation:T},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:L,contextWindow:mU(this.visualElement)})}stop(t,s){const h=this.isDragging;if(this.cancel(),!h)return;const{velocity:g}=s;this.startAnimation(g);const{onDragEnd:v}=this.getProps();v&&Ji.postRender(()=>v(t,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:h}=this.getProps();!h&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}updateAxis(t,s,h){const{drag:g}=this.getProps();if(!h||!tS(t,g,this.currentDirection))return;const v=this.getAxisMotionValue(t);let E=this.originPoint[t]+h[t];this.constraints&&this.constraints[t]&&(E=Rte(E,this.constraints[t],this.elastic[t])),v.set(E)}resolveConstraints(){var t;const{dragConstraints:s,dragElastic:h}=this.getProps(),g=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,v=this.constraints;s&&Jg(s)?this.constraints||(this.constraints=this.resolveRefConstraints()):s&&g?this.constraints=Lte(g.layoutBox,s):this.constraints=!1,this.elastic=Bte(h),v!==this.constraints&&g&&this.constraints&&!this.hasMutatedConstraints&&zl(E=>{this.constraints!==!1&&this.getAxisMotionValue(E)&&(this.constraints[E]=zte(g.layoutBox[E],this.constraints[E]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!Jg(t))return!1;const h=t.current,{projection:g}=this.visualElement;if(!g||!g.layout)return!1;const v=Ute(h,g.root,this.visualElement.getTransformPagePoint());let E=Ote(g.layout.layoutBox,v);if(s){const c=s(Nte(E));this.hasMutatedConstraints=!!c,c&&(E=dU(c))}return E}startAnimation(t){const{drag:s,dragMomentum:h,dragElastic:g,dragTransition:v,dragSnapToOrigin:E,onDragTransitionEnd:c}=this.getProps(),T=this.constraints||{},L=zl(B=>{if(!tS(B,s,this.currentDirection))return;let U=T&&T[B]||{};E&&(U={min:0,max:0});const H=g?200:1e6,X=g?40:1e7,ae={type:"inertia",velocity:h?t[B]:0,bounceStiffness:H,bounceDamping:X,timeConstant:750,restDelta:1,restSpeed:10,...v,...U};return this.startAxisValueAnimation(B,ae)});return Promise.all(L).then(c)}startAxisValueAnimation(t,s){const h=this.getAxisMotionValue(t);return nI(this.visualElement,t),h.start(xP(t,h,0,s,this.visualElement,!1))}stopAnimation(){zl(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){zl(t=>{var s;return(s=this.getAxisMotionValue(t).animation)===null||s===void 0?void 0:s.pause()})}getAnimationState(t){var s;return(s=this.getAxisMotionValue(t).animation)===null||s===void 0?void 0:s.state}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,h=this.visualElement.getProps(),g=h[s];return g||this.visualElement.getValue(t,(h.initial?h.initial[t]:void 0)||0)}snapToCursor(t){zl(s=>{const{drag:h}=this.getProps();if(!tS(s,h,this.currentDirection))return;const{projection:g}=this.visualElement,v=this.getAxisMotionValue(s);if(g&&g.layout){const{min:E,max:c}=g.layout.layoutBox[s];v.set(t[s]-po(E,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:h}=this.visualElement;if(!Jg(s)||!h||!this.constraints)return;this.stopAnimation();const g={x:0,y:0};zl(E=>{const c=this.getAxisMotionValue(E);if(c&&this.constraints!==!1){const T=c.get();g[E]=Fte({min:T,max:T},this.constraints[E])}});const{transformTemplate:v}=this.visualElement.getProps();this.visualElement.current.style.transform=v?v({},""):"none",h.root&&h.root.updateScroll(),h.updateLayout(),this.resolveConstraints(),zl(E=>{if(!tS(E,t,null))return;const c=this.getAxisMotionValue(E),{min:T,max:L}=this.constraints[E];c.set(po(T,L,g[E]))})}addListeners(){if(!this.visualElement.current)return;Gte.set(this.visualElement,this);const t=this.visualElement.current,s=J0(t,"pointerdown",T=>{const{drag:L,dragListener:B=!0}=this.getProps();L&&B&&this.start(T)}),h=()=>{const{dragConstraints:T}=this.getProps();Jg(T)&&T.current&&(this.constraints=this.resolveRefConstraints())},{projection:g}=this.visualElement,v=g.addEventListener("measure",h);g&&!g.layout&&(g.root&&g.root.updateScroll(),g.updateLayout()),Ji.read(h);const E=Lx(window,"resize",()=>this.scalePositionWithinConstraints()),c=g.addEventListener("didUpdate",({delta:T,hasLayoutChanged:L})=>{this.isDragging&&L&&(zl(B=>{const U=this.getAxisMotionValue(B);U&&(this.originPoint[B]+=T[B].translate,U.set(U.get()+T[B].translate))}),this.visualElement.render())});return()=>{E(),s(),v(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:h=!1,dragPropagation:g=!1,dragConstraints:v=!1,dragElastic:E=uI,dragMomentum:c=!0}=t;return{...t,drag:s,dragDirectionLock:h,dragPropagation:g,dragConstraints:v,dragElastic:E,dragMomentum:c}}}function tS(n,t,s){return(t===!0||t===n)&&(s===null||s===n)}function Hte(n,t=10){let s=null;return Math.abs(n.y)>t?s="y":Math.abs(n.x)>t&&(s="x"),s}class Wte extends sf{constructor(t){super(t),this.removeGroupControls=dl,this.removeListeners=dl,this.controls=new $te(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dl}unmount(){this.removeGroupControls(),this.removeListeners()}}const k3=n=>(t,s)=>{n&&Ji.postRender(()=>n(t,s))};class qte extends sf{constructor(){super(...arguments),this.removePointerDownListener=dl}onPointerDown(t){this.session=new aU(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:mU(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:h,onPanEnd:g}=this.node.getProps();return{onSessionStart:k3(t),onStart:k3(s),onMove:h,onEnd:(v,E)=>{delete this.session,g&&Ji.postRender(()=>g(v,E))}}}mount(){this.removePointerDownListener=J0(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const CS={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function A3(n,t){return t.max===t.min?0:n/(t.max-t.min)*100}const M0={correct:(n,t)=>{if(!t.target)return n;if(typeof n=="string")if(er.test(n))n=parseFloat(n);else return n;const s=A3(n,t.target.x),h=A3(n,t.target.y);return`${s}% ${h}%`}},Zte={correct:(n,{treeScale:t,projectionDelta:s})=>{const h=n,g=ef.parse(n);if(g.length>5)return h;const v=ef.createTransformer(n),E=typeof g[0]!="number"?1:0,c=s.x.scale*t.x,T=s.y.scale*t.y;g[0+E]/=c,g[1+E]/=T;const L=po(c,T,.5);return typeof g[2+E]=="number"&&(g[2+E]/=L),typeof g[3+E]=="number"&&(g[3+E]/=L),v(g)}};class Xte extends Y.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:h,layoutId:g}=this.props,{projection:v}=t;mJ(Kte),v&&(s.group&&s.group.add(v),h&&h.register&&g&&h.register(v),v.root.didUpdate(),v.addEventListener("animationComplete",()=>{this.safeToRemove()}),v.setOptions({...v.options,onExitComplete:()=>this.safeToRemove()})),CS.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:h,drag:g,isPresent:v}=this.props,E=h.projection;return E&&(E.isPresent=v,g||t.layoutDependency!==s||s===void 0?E.willUpdate():this.safeToRemove(),t.isPresent!==v&&(v?E.promote():E.relegate()||Ji.postRender(()=>{const c=E.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),XM.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:h}=this.props,{projection:g}=t;g&&(g.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(g),h&&h.deregister&&h.deregister(g))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function gU(n){const[t,s]=MQ(),h=Y.useContext(QV);return ue.jsx(Xte,{...n,layoutGroup:h,switchLayoutGroup:Y.useContext(sj),isPresent:t,safeToRemove:s})}const Kte={borderRadius:{...M0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:M0,borderTopRightRadius:M0,borderBottomLeftRadius:M0,borderBottomRightRadius:M0,boxShadow:Zte};function Yte(n,t,s){const h=Hs(n)?n:Dx(n);return h.start(xP("",h,t,s)),h.animation}function Qte(n){return n instanceof SVGElement&&n.tagName!=="svg"}const Jte=(n,t)=>n.depth-t.depth;class ene{constructor(){this.children=[],this.isDirty=!1}add(t){cP(this.children,t),this.isDirty=!0}remove(t){uP(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Jte),this.isDirty=!1,this.children.forEach(t)}}function tne(n,t){const s=wu.now(),h=({timestamp:g})=>{const v=g-s;v>=t&&(Jh(h),n(v-t))};return Ji.read(h,!0),()=>Jh(h)}const _U=["TopLeft","TopRight","BottomLeft","BottomRight"],nne=_U.length,C3=n=>typeof n=="string"?parseFloat(n):n,I3=n=>typeof n=="number"||er.test(n);function rne(n,t,s,h,g,v){g?(n.opacity=po(0,s.opacity!==void 0?s.opacity:1,ine(h)),n.opacityExit=po(t.opacity!==void 0?t.opacity:1,0,one(h))):v&&(n.opacity=po(t.opacity!==void 0?t.opacity:1,s.opacity!==void 0?s.opacity:1,h));for(let E=0;E<nne;E++){const c=`border${_U[E]}Radius`;let T=M3(t,c),L=M3(s,c);if(T===void 0&&L===void 0)continue;T||(T=0),L||(L=0),T===0||L===0||I3(T)===I3(L)?(n[c]=Math.max(po(C3(T),C3(L),h),0),(bu.test(L)||bu.test(T))&&(n[c]+="%")):n[c]=L}(t.rotate||s.rotate)&&(n.rotate=po(t.rotate||0,s.rotate||0,h))}function M3(n,t){return n[t]!==void 0?n[t]:n.borderRadius}const ine=yU(0,.5,Fj),one=yU(.5,.95,dl);function yU(n,t,s){return h=>h<n?0:h>t?1:s(F_(n,t,h))}function P3(n,t){n.min=t.min,n.max=t.max}function Fl(n,t){P3(n.x,t.x),P3(n.y,t.y)}function D3(n,t){n.translate=t.translate,n.scale=t.scale,n.originPoint=t.originPoint,n.origin=t.origin}function R3(n,t,s,h,g){return n-=t,n=wT(n,1/s,h),g!==void 0&&(n=wT(n,1/g,h)),n}function sne(n,t=0,s=1,h=.5,g,v=n,E=n){if(bu.test(t)&&(t=parseFloat(t),t=po(E.min,E.max,t/100)-E.min),typeof t!="number")return;let c=po(v.min,v.max,h);n===v&&(c-=t),n.min=R3(n.min,t,s,c,g),n.max=R3(n.max,t,s,c,g)}function L3(n,t,[s,h,g],v,E){sne(n,t[s],t[h],t[g],t.scale,v,E)}const ane=["x","scaleX","originX"],lne=["y","scaleY","originY"];function O3(n,t,s,h){L3(n.x,t,ane,s?s.x:void 0,h?h.x:void 0),L3(n.y,t,lne,s?s.y:void 0,h?h.y:void 0)}function F3(n){return n.translate===0&&n.scale===1}function vU(n){return F3(n.x)&&F3(n.y)}function z3(n,t){return n.min===t.min&&n.max===t.max}function cne(n,t){return z3(n.x,t.x)&&z3(n.y,t.y)}function B3(n,t){return Math.round(n.min)===Math.round(t.min)&&Math.round(n.max)===Math.round(t.max)}function xU(n,t){return B3(n.x,t.x)&&B3(n.y,t.y)}function N3(n){return pl(n.x)/pl(n.y)}function V3(n,t){return n.translate===t.translate&&n.scale===t.scale&&n.originPoint===t.originPoint}class une{constructor(){this.members=[]}add(t){cP(this.members,t),t.scheduleRender()}remove(t){if(uP(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){const s=this.members.findIndex(g=>t===g);if(s===0)return!1;let h;for(let g=s;g>=0;g--){const v=this.members[g];if(v.isPresent!==!1){h=v;break}}return h?(this.promote(h),!0):!1}promote(t,s){const h=this.lead;if(t!==h&&(this.prevLead=h,this.lead=t,t.show(),h)){h.instance&&h.scheduleRender(),t.scheduleRender(),t.resumeFrom=h,s&&(t.resumeFrom.preserveOpacity=!0),h.snapshot&&(t.snapshot=h.snapshot,t.snapshot.latestValues=h.animationValues||h.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:g}=t.options;g===!1&&h.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:s,resumingFrom:h}=t;s.onExitComplete&&s.onExitComplete(),h&&h.options.onExitComplete&&h.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function dne(n,t,s){let h="";const g=n.x.translate/t.x,v=n.y.translate/t.y,E=(s==null?void 0:s.z)||0;if((g||v||E)&&(h=`translate3d(${g}px, ${v}px, ${E}px) `),(t.x!==1||t.y!==1)&&(h+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:L,rotate:B,rotateX:U,rotateY:H,skewX:X,skewY:ae}=s;L&&(h=`perspective(${L}px) ${h}`),B&&(h+=`rotate(${B}deg) `),U&&(h+=`rotateX(${U}deg) `),H&&(h+=`rotateY(${H}deg) `),X&&(h+=`skewX(${X}deg) `),ae&&(h+=`skewY(${ae}deg) `)}const c=n.x.scale*t.x,T=n.y.scale*t.y;return(c!==1||T!==1)&&(h+=`scale(${c}, ${T})`),h||"none"}const Ap={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},j0=typeof window<"u"&&window.MotionDebug!==void 0,gA=["","X","Y","Z"],hne={visibility:"hidden"},j3=1e3;let fne=0;function _A(n,t,s,h){const{latestValues:g}=t;g[n]&&(s[n]=g[n],t.setStaticValue(n,0),h&&(h[n]=0))}function bU(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:t}=n.options;if(!t)return;const s=Ij(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:g,layoutId:v}=n.options;window.MotionCancelOptimisedAnimation(s,"transform",Ji,!(g||v))}const{parent:h}=n;h&&!h.hasCheckedOptimisedAppear&&bU(h)}function wU({attachResizeListener:n,defaultParent:t,measureScroll:s,checkIsScrollRoot:h,resetTransform:g}){return class{constructor(E={},c=t==null?void 0:t()){this.id=fne++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,j0&&(Ap.totalNodes=Ap.resolvedTargetDeltas=Ap.recalculatedProjection=0),this.nodes.forEach(gne),this.nodes.forEach(bne),this.nodes.forEach(wne),this.nodes.forEach(_ne),j0&&window.MotionDebug.record(Ap)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=E,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let T=0;T<this.path.length;T++)this.path[T].shouldResetTransform=!0;this.root===this&&(this.nodes=new ene)}addEventListener(E,c){return this.eventHandlers.has(E)||this.eventHandlers.set(E,new dP),this.eventHandlers.get(E).add(c)}notifyListeners(E,...c){const T=this.eventHandlers.get(E);T&&T.notify(...c)}hasListeners(E){return this.eventHandlers.has(E)}mount(E,c=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=Qte(E),this.instance=E;const{layoutId:T,layout:L,visualElement:B}=this.options;if(B&&!B.current&&B.mount(E),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),c&&(L||T)&&(this.isLayoutDirty=!0),n){let U;const H=()=>this.root.updateBlockedByResize=!1;n(E,()=>{this.root.updateBlockedByResize=!0,U&&U(),U=tne(H,250),CS.hasAnimatedSinceResize&&(CS.hasAnimatedSinceResize=!1,this.nodes.forEach(G3))})}T&&this.root.registerSharedNode(T,this),this.options.animate!==!1&&B&&(T||L)&&this.addEventListener("didUpdate",({delta:U,hasLayoutChanged:H,hasRelativeTargetChanged:X,layout:ae})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const ne=this.options.transition||B.getDefaultTransition()||Ane,{onLayoutAnimationStart:me,onLayoutAnimationComplete:oe}=B.getProps(),re=!this.targetLayout||!xU(this.targetLayout,ae)||X,he=!H&&X;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||he||H&&(re||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(U,he);const _e={...oP(ne,"layout"),onPlay:me,onComplete:oe};(B.shouldReduceMotion||this.options.layoutRoot)&&(_e.delay=0,_e.type=!1),this.startAnimation(_e)}else H||G3(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=ae})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const E=this.getStack();E&&E.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Jh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Sne),this.animationId++)}getTransformTemplate(){const{visualElement:E}=this.options;return E&&E.getProps().transformTemplate}willUpdate(E=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&bU(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let B=0;B<this.path.length;B++){const U=this.path[B];U.shouldResetTransform=!0,U.updateScroll("snapshot"),U.options.layoutRoot&&U.willUpdate(!1)}const{layoutId:c,layout:T}=this.options;if(c===void 0&&!T)return;const L=this.getTransformTemplate();this.prevTransformTemplateValue=L?L(this.latestValues,""):void 0,this.updateSnapshot(),E&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(U3);return}this.isUpdating||this.nodes.forEach(vne),this.isUpdating=!1,this.nodes.forEach(xne),this.nodes.forEach(pne),this.nodes.forEach(mne),this.clearAllSnapshots();const c=wu.now();As.delta=xd(0,1e3/60,c-As.timestamp),As.timestamp=c,As.isProcessing=!0,aA.update.process(As),aA.preRender.process(As),aA.render.process(As),As.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,XM.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(yne),this.sharedNodes.forEach(Tne)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ji.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ji.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let T=0;T<this.path.length;T++)this.path[T].updateScroll();const E=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Lo(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,E?E.layoutBox:void 0)}updateScroll(E="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===E&&(c=!1),c){const T=h(this.instance);this.scroll={animationId:this.root.animationId,phase:E,isRoot:T,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:T}}}resetTransform(){if(!g)return;const E=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!vU(this.projectionDelta),T=this.getTransformTemplate(),L=T?T(this.latestValues,""):void 0,B=L!==this.prevTransformTemplateValue;E&&(c||kp(this.latestValues)||B)&&(g(this.instance,L),this.shouldResetTransform=!1,this.scheduleRender())}measure(E=!0){const c=this.measurePageBox();let T=this.removeElementScroll(c);return E&&(T=this.removeTransform(T)),Cne(T),{animationId:this.root.animationId,measuredBox:c,layoutBox:T,latestValues:{},source:this.id}}measurePageBox(){var E;const{visualElement:c}=this.options;if(!c)return Lo();const T=c.measureViewportBox();if(!(((E=this.scroll)===null||E===void 0?void 0:E.wasRoot)||this.path.some(Ine))){const{scroll:B}=this.root;B&&(n_(T.x,B.offset.x),n_(T.y,B.offset.y))}return T}removeElementScroll(E){var c;const T=Lo();if(Fl(T,E),!((c=this.scroll)===null||c===void 0)&&c.wasRoot)return T;for(let L=0;L<this.path.length;L++){const B=this.path[L],{scroll:U,options:H}=B;B!==this.root&&U&&H.layoutScroll&&(U.wasRoot&&Fl(T,E),n_(T.x,U.offset.x),n_(T.y,U.offset.y))}return T}applyTransform(E,c=!1){const T=Lo();Fl(T,E);for(let L=0;L<this.path.length;L++){const B=this.path[L];!c&&B.options.layoutScroll&&B.scroll&&B!==B.root&&r_(T,{x:-B.scroll.offset.x,y:-B.scroll.offset.y}),kp(B.latestValues)&&r_(T,B.latestValues)}return kp(this.latestValues)&&r_(T,this.latestValues),T}removeTransform(E){const c=Lo();Fl(c,E);for(let T=0;T<this.path.length;T++){const L=this.path[T];if(!L.instance||!kp(L.latestValues))continue;dI(L.latestValues)&&L.updateSnapshot();const B=Lo(),U=L.measurePageBox();Fl(B,U),O3(c,L.latestValues,L.snapshot?L.snapshot.layoutBox:void 0,B)}return kp(this.latestValues)&&O3(c,this.latestValues),c}setTargetDelta(E){this.targetDelta=E,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(E){this.options={...this.options,...E,crossfade:E.crossfade!==void 0?E.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==As.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(E=!1){var c;const T=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=T.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=T.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=T.isSharedProjectionDirty);const L=!!this.resumingFrom||this!==T;if(!(E||L&&this.isSharedProjectionDirty||this.isProjectionDirty||!((c=this.parent)===null||c===void 0)&&c.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:U,layoutId:H}=this.options;if(!(!this.layout||!(U||H))){if(this.resolvedRelativeTargetAt=As.timestamp,!this.targetDelta&&!this.relativeTarget){const X=this.getClosestProjectingParent();X&&X.layout&&this.animationProgress!==1?(this.relativeParent=X,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Lo(),this.relativeTargetOrigin=Lo(),tx(this.relativeTargetOrigin,this.layout.layoutBox,X.layout.layoutBox),Fl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Lo(),this.targetWithTransforms=Lo()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Dte(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Fl(this.target,this.layout.layoutBox),fU(this.target,this.targetDelta)):Fl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const X=this.getClosestProjectingParent();X&&!!X.resumingFrom==!!this.resumingFrom&&!X.options.layoutScroll&&X.target&&this.animationProgress!==1?(this.relativeParent=X,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Lo(),this.relativeTargetOrigin=Lo(),tx(this.relativeTargetOrigin,this.target,X.target),Fl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}j0&&Ap.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||dI(this.parent.latestValues)||hU(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var E;const c=this.getLead(),T=!!this.resumingFrom||this!==c;let L=!0;if((this.isProjectionDirty||!((E=this.parent)===null||E===void 0)&&E.isProjectionDirty)&&(L=!1),T&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(L=!1),this.resolvedRelativeTargetAt===As.timestamp&&(L=!1),L)return;const{layout:B,layoutId:U}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(B||U))return;Fl(this.layoutCorrected,this.layout.layoutBox);const H=this.treeScale.x,X=this.treeScale.y;jte(this.layoutCorrected,this.treeScale,this.path,T),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=Lo());const{target:ae}=c;if(!ae){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(D3(this.prevProjectionDelta.x,this.projectionDelta.x),D3(this.prevProjectionDelta.y,this.projectionDelta.y)),ex(this.projectionDelta,this.layoutCorrected,ae,this.latestValues),(this.treeScale.x!==H||this.treeScale.y!==X||!V3(this.projectionDelta.x,this.prevProjectionDelta.x)||!V3(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",ae)),j0&&Ap.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(E=!0){var c;if((c=this.options.visualElement)===null||c===void 0||c.scheduleRender(),E){const T=this.getStack();T&&T.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=t_(),this.projectionDelta=t_(),this.projectionDeltaWithTransform=t_()}setAnimationOrigin(E,c=!1){const T=this.snapshot,L=T?T.latestValues:{},B={...this.latestValues},U=t_();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const H=Lo(),X=T?T.source:void 0,ae=this.layout?this.layout.source:void 0,ne=X!==ae,me=this.getStack(),oe=!me||me.members.length<=1,re=!!(ne&&!oe&&this.options.crossfade===!0&&!this.path.some(kne));this.animationProgress=0;let he;this.mixTargetDelta=_e=>{const De=_e/1e3;$3(U.x,E.x,De),$3(U.y,E.y,De),this.setTargetDelta(U),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tx(H,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ene(this.relativeTarget,this.relativeTargetOrigin,H,De),he&&cne(this.relativeTarget,he)&&(this.isProjectionDirty=!1),he||(he=Lo()),Fl(he,this.relativeTarget)),ne&&(this.animationValues=B,rne(B,L,this.latestValues,De,re,oe)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=De},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(E){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Jh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ji.update(()=>{CS.hasAnimatedSinceResize=!0,this.currentAnimation=Yte(0,j3,{...E,onUpdate:c=>{this.mixTargetDelta(c),E.onUpdate&&E.onUpdate(c)},onComplete:()=>{E.onComplete&&E.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const E=this.getStack();E&&E.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(j3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const E=this.getLead();let{targetWithTransforms:c,target:T,layout:L,latestValues:B}=E;if(!(!c||!T||!L)){if(this!==E&&this.layout&&L&&SU(this.options.animationType,this.layout.layoutBox,L.layoutBox)){T=this.target||Lo();const U=pl(this.layout.layoutBox.x);T.x.min=E.target.x.min,T.x.max=T.x.min+U;const H=pl(this.layout.layoutBox.y);T.y.min=E.target.y.min,T.y.max=T.y.min+H}Fl(c,T),r_(c,B),ex(this.projectionDeltaWithTransform,this.layoutCorrected,c,B)}}registerSharedNode(E,c){this.sharedNodes.has(E)||this.sharedNodes.set(E,new une),this.sharedNodes.get(E).add(c);const L=c.options.initialPromotionConfig;c.promote({transition:L?L.transition:void 0,preserveFollowOpacity:L&&L.shouldPreserveFollowOpacity?L.shouldPreserveFollowOpacity(c):void 0})}isLead(){const E=this.getStack();return E?E.lead===this:!0}getLead(){var E;const{layoutId:c}=this.options;return c?((E=this.getStack())===null||E===void 0?void 0:E.lead)||this:this}getPrevLead(){var E;const{layoutId:c}=this.options;return c?(E=this.getStack())===null||E===void 0?void 0:E.prevLead:void 0}getStack(){const{layoutId:E}=this.options;if(E)return this.root.sharedNodes.get(E)}promote({needsReset:E,transition:c,preserveFollowOpacity:T}={}){const L=this.getStack();L&&L.promote(this,T),E&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const E=this.getStack();return E?E.relegate(this):!1}resetSkewAndRotation(){const{visualElement:E}=this.options;if(!E)return;let c=!1;const{latestValues:T}=E;if((T.z||T.rotate||T.rotateX||T.rotateY||T.rotateZ||T.skewX||T.skewY)&&(c=!0),!c)return;const L={};T.z&&_A("z",E,L,this.animationValues);for(let B=0;B<gA.length;B++)_A(`rotate${gA[B]}`,E,L,this.animationValues),_A(`skew${gA[B]}`,E,L,this.animationValues);E.render();for(const B in L)E.setStaticValue(B,L[B]),this.animationValues&&(this.animationValues[B]=L[B]);E.scheduleRender()}getProjectionStyles(E){var c,T;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hne;const L={visibility:""},B=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,L.opacity="",L.pointerEvents=kS(E==null?void 0:E.pointerEvents)||"",L.transform=B?B(this.latestValues,""):"none",L;const U=this.getLead();if(!this.projectionDelta||!this.layout||!U.target){const ne={};return this.options.layoutId&&(ne.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,ne.pointerEvents=kS(E==null?void 0:E.pointerEvents)||""),this.hasProjected&&!kp(this.latestValues)&&(ne.transform=B?B({},""):"none",this.hasProjected=!1),ne}const H=U.animationValues||U.latestValues;this.applyTransformsToTarget(),L.transform=dne(this.projectionDeltaWithTransform,this.treeScale,H),B&&(L.transform=B(H,L.transform));const{x:X,y:ae}=this.projectionDelta;L.transformOrigin=`${X.origin*100}% ${ae.origin*100}% 0`,U.animationValues?L.opacity=U===this?(T=(c=H.opacity)!==null&&c!==void 0?c:this.latestValues.opacity)!==null&&T!==void 0?T:1:this.preserveOpacity?this.latestValues.opacity:H.opacityExit:L.opacity=U===this?H.opacity!==void 0?H.opacity:"":H.opacityExit!==void 0?H.opacityExit:0;for(const ne in _T){if(H[ne]===void 0)continue;const{correct:me,applyTo:oe}=_T[ne],re=L.transform==="none"?H[ne]:me(H[ne],U);if(oe){const he=oe.length;for(let _e=0;_e<he;_e++)L[oe[_e]]=re}else L[ne]=re}return this.options.layoutId&&(L.pointerEvents=U===this?kS(E==null?void 0:E.pointerEvents)||"":"none"),L}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(E=>{var c;return(c=E.currentAnimation)===null||c===void 0?void 0:c.stop()}),this.root.nodes.forEach(U3),this.root.sharedNodes.clear()}}}function pne(n){n.updateLayout()}function mne(n){var t;const s=((t=n.resumeFrom)===null||t===void 0?void 0:t.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&s&&n.hasListeners("didUpdate")){const{layoutBox:h,measuredBox:g}=n.layout,{animationType:v}=n.options,E=s.source!==n.layout.source;v==="size"?zl(U=>{const H=E?s.measuredBox[U]:s.layoutBox[U],X=pl(H);H.min=h[U].min,H.max=H.min+X}):SU(v,s.layoutBox,h)&&zl(U=>{const H=E?s.measuredBox[U]:s.layoutBox[U],X=pl(h[U]);H.max=H.min+X,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[U].max=n.relativeTarget[U].min+X)});const c=t_();ex(c,h,s.layoutBox);const T=t_();E?ex(T,n.applyTransform(g,!0),s.measuredBox):ex(T,h,s.layoutBox);const L=!vU(c);let B=!1;if(!n.resumeFrom){const U=n.getClosestProjectingParent();if(U&&!U.resumeFrom){const{snapshot:H,layout:X}=U;if(H&&X){const ae=Lo();tx(ae,s.layoutBox,H.layoutBox);const ne=Lo();tx(ne,h,X.layoutBox),xU(ae,ne)||(B=!0),U.options.layoutRoot&&(n.relativeTarget=ne,n.relativeTargetOrigin=ae,n.relativeParent=U)}}}n.notifyListeners("didUpdate",{layout:h,snapshot:s,delta:T,layoutDelta:c,hasLayoutChanged:L,hasRelativeTargetChanged:B})}else if(n.isLead()){const{onExitComplete:h}=n.options;h&&h()}n.options.transition=void 0}function gne(n){j0&&Ap.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function _ne(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function yne(n){n.clearSnapshot()}function U3(n){n.clearMeasurements()}function vne(n){n.isLayoutDirty=!1}function xne(n){const{visualElement:t}=n.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),n.resetTransform()}function G3(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function bne(n){n.resolveTargetDelta()}function wne(n){n.calcProjection()}function Sne(n){n.resetSkewAndRotation()}function Tne(n){n.removeLeadSnapshot()}function $3(n,t,s){n.translate=po(t.translate,0,s),n.scale=po(t.scale,1,s),n.origin=t.origin,n.originPoint=t.originPoint}function H3(n,t,s,h){n.min=po(t.min,s.min,h),n.max=po(t.max,s.max,h)}function Ene(n,t,s,h){H3(n.x,t.x,s.x,h),H3(n.y,t.y,s.y,h)}function kne(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Ane={duration:.45,ease:[.4,0,.1,1]},W3=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),q3=W3("applewebkit/")&&!W3("chrome/")?Math.round:dl;function Z3(n){n.min=q3(n.min),n.max=q3(n.max)}function Cne(n){Z3(n.x),Z3(n.y)}function SU(n,t,s){return n==="position"||n==="preserve-aspect"&&!Pte(N3(t),N3(s),.2)}function Ine(n){var t;return n!==n.root&&((t=n.scroll)===null||t===void 0?void 0:t.wasRoot)}const Mne=wU({attachResizeListener:(n,t)=>Lx(n,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),yA={current:void 0},TU=wU({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!yA.current){const n=new Mne({});n.mount(window),n.setOptions({layoutScroll:!0}),yA.current=n}return yA.current},resetTransform:(n,t)=>{n.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Pne={pan:{Feature:qte},drag:{Feature:Wte,ProjectionNode:TU,MeasureLayout:gU}};function X3(n,t,s){const{props:h}=n;n.animationState&&h.whileHover&&n.animationState.setActive("whileHover",s==="Start");const g="onHover"+s,v=h[g];v&&Ji.postRender(()=>v(t,Kx(t)))}class Dne extends sf{mount(){const{current:t}=this.node;t&&(this.unmount=PJ(t,s=>(X3(this.node,s,"Start"),h=>X3(this.node,h,"End"))))}unmount(){}}class Rne extends sf{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xx(Lx(this.node.current,"focus",()=>this.onFocus()),Lx(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function K3(n,t,s){const{props:h}=n;n.animationState&&h.whileTap&&n.animationState.setActive("whileTap",s==="Start");const g="onTap"+(s==="End"?"":s),v=h[g];v&&Ji.postRender(()=>v(t,Kx(t)))}class Lne extends sf{mount(){const{current:t}=this.node;t&&(this.unmount=OJ(t,s=>(K3(this.node,s,"Start"),(h,{success:g})=>K3(this.node,h,g?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const fI=new WeakMap,vA=new WeakMap,One=n=>{const t=fI.get(n.target);t&&t(n)},Fne=n=>{n.forEach(One)};function zne({root:n,...t}){const s=n||document;vA.has(s)||vA.set(s,{});const h=vA.get(s),g=JSON.stringify(t);return h[g]||(h[g]=new IntersectionObserver(Fne,{root:n,...t})),h[g]}function Bne(n,t,s){const h=zne(t);return fI.set(n,s),h.observe(n),()=>{fI.delete(n),h.unobserve(n)}}const Nne={some:0,all:1};class Vne extends sf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:s,margin:h,amount:g="some",once:v}=t,E={root:s?s.current:void 0,rootMargin:h,threshold:typeof g=="number"?g:Nne[g]},c=T=>{const{isIntersecting:L}=T;if(this.isInView===L||(this.isInView=L,v&&!L&&this.hasEnteredView))return;L&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",L);const{onViewportEnter:B,onViewportLeave:U}=this.node.getProps(),H=L?B:U;H&&H(T)};return Bne(this.node.current,E,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(jne(t,s))&&this.startObserver()}unmount(){}}function jne({viewport:n={}},{viewport:t={}}={}){return s=>n[s]!==t[s]}const Une={inView:{Feature:Vne},tap:{Feature:Lne},focus:{Feature:Rne},hover:{Feature:Dne}},Gne={layout:{ProjectionNode:TU,MeasureLayout:gU}},pI={current:null},EU={current:!1};function $ne(){if(EU.current=!0,!!$M)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),t=()=>pI.current=n.matches;n.addListener(t),t()}else pI.current=!1}const Hne=[...Kj,Gs,ef],Wne=n=>Hne.find(Xj(n)),Y3=new WeakMap;function qne(n,t,s){for(const h in t){const g=t[h],v=s[h];if(Hs(g))n.addValue(h,g);else if(Hs(v))n.addValue(h,Dx(g,{owner:n}));else if(v!==g)if(n.hasValue(h)){const E=n.getValue(h);E.liveStyle===!0?E.jump(g):E.hasAnimated||E.set(g)}else{const E=n.getStaticValue(h);n.addValue(h,Dx(E!==void 0?E:g,{owner:n}))}}for(const h in s)t[h]===void 0&&n.removeValue(h);return t}const Q3=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Zne{scrapeMotionValuesFromProps(t,s,h){return{}}constructor({parent:t,props:s,presenceContext:h,reducedMotionConfig:g,blockInitialAnimation:v,visualState:E},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=_P,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const X=wu.now();this.renderScheduledAt<X&&(this.renderScheduledAt=X,Ji.render(this.render,!1,!0))};const{latestValues:T,renderState:L,onUpdate:B}=E;this.onUpdate=B,this.latestValues=T,this.baseTarget={...T},this.initialValues=s.initial?{...T}:{},this.renderState=L,this.parent=t,this.props=s,this.presenceContext=h,this.depth=t?t.depth+1:0,this.reducedMotionConfig=g,this.options=c,this.blockInitialAnimation=!!v,this.isControllingVariants=s2(s),this.isVariantNode=ij(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:U,...H}=this.scrapeMotionValuesFromProps(s,{},this);for(const X in H){const ae=H[X];T[X]!==void 0&&Hs(ae)&&ae.set(T[X],!1)}}mount(t){this.current=t,Y3.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,h)=>this.bindToMotionValue(h,s)),EU.current||$ne(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:pI.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Y3.delete(this.current),this.projection&&this.projection.unmount(),Jh(this.notifyUpdate),Jh(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}bindToMotionValue(t,s){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const h=rm.has(t),g=s.on("change",c=>{this.latestValues[t]=c,this.props.onUpdate&&Ji.preRender(this.notifyUpdate),h&&this.projection&&(this.projection.isTransformDirty=!0)}),v=s.on("renderRequest",this.scheduleRender);let E;window.MotionCheckAppearSync&&(E=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{g(),v(),E&&E(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in z_){const s=z_[t];if(!s)continue;const{isEnabled:h,Feature:g}=s;if(!this.features[t]&&g&&h(this.props)&&(this.features[t]=new g(this)),this.features[t]){const v=this.features[t];v.isMounted?v.update():(v.mount(),v.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Lo()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let h=0;h<Q3.length;h++){const g=Q3[h];this.propEventSubscriptions[g]&&(this.propEventSubscriptions[g](),delete this.propEventSubscriptions[g]);const v="on"+g,E=t[v];E&&(this.propEventSubscriptions[g]=this.on(g,E))}this.prevMotionValues=qne(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const h=this.values.get(t);s!==h&&(h&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let h=this.values.get(t);return h===void 0&&s!==void 0&&(h=Dx(s===null?void 0:s,{owner:this}),this.addValue(t,h)),h}readValue(t,s){var h;let g=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(h=this.getBaseTargetFromProps(this.props,t))!==null&&h!==void 0?h:this.readValueFromInstance(this.current,t,this.options);return g!=null&&(typeof g=="string"&&(qj(g)||Bj(g))?g=parseFloat(g):!Wne(g)&&ef.test(s)&&(g=$j(t,s)),this.setBaseTarget(t,Hs(g)?g.get():g)),Hs(g)?g.get():g}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){var s;const{initial:h}=this.props;let g;if(typeof h=="string"||typeof h=="object"){const E=YM(this.props,h,(s=this.presenceContext)===null||s===void 0?void 0:s.custom);E&&(g=E[t])}if(h&&g!==void 0)return g;const v=this.getBaseTargetFromProps(this.props,t);return v!==void 0&&!Hs(v)?v:this.initialValues[t]!==void 0&&g===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new dP),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}}class kU extends Zne{constructor(){super(...arguments),this.KeyframeResolver=Yj}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){return t.style?t.style[s]:void 0}removeValueFromRenderState(t,{vars:s,style:h}){delete s[t],delete h[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Hs(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function Xne(n){return window.getComputedStyle(n)}class Kne extends kU{constructor(){super(...arguments),this.type="html",this.renderInstance=fj}readValueFromInstance(t,s){if(rm.has(s)){const h=gP(s);return h&&h.default||0}else{const h=Xne(t),g=(uj(s)?h.getPropertyValue(s):h[s])||0;return typeof g=="string"?g.trim():g}}measureInstanceViewportBox(t,{transformPagePoint:s}){return pU(t,s)}build(t,s,h){eP(t,s,h.transformTemplate)}scrapeMotionValuesFromProps(t,s,h){return iP(t,s,h)}}class Yne extends kU{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lo}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(rm.has(s)){const h=gP(s);return h&&h.default||0}return s=pj.has(s)?s:ZM(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,h){return _j(t,s,h)}build(t,s,h){tP(t,s,this.isSVGTag,h.transformTemplate)}renderInstance(t,s,h,g){mj(t,s,h,g)}mount(t){this.isSVGTag=rP(t.tagName),super.mount(t)}}const Qne=(n,t)=>KM(n)?new Yne(t):new Kne(t,{allowProjection:n!==Y.Fragment}),Jne=TJ({...wte,...Une,...Pne,...Gne},Qne),Ox=NQ(Jne);function ere(n,t,s){return n===0?{icon:CW,label:s("weather.clear"),isRaining:!1}:n<=2?{icon:yW,label:s("weather.partlyCloudy"),isRaining:!1}:n===3?{icon:EC,label:s("weather.cloudy"),isRaining:!1}:n>=45&&n<=48?{icon:_W,label:s("weather.fog"),isRaining:!1}:n>=51&&n<=55?{icon:Pg,label:s("weather.drizzle"),isRaining:!0}:n>=56&&n<=57?{icon:Pg,label:s("weather.freezingRain"),isRaining:!0}:n>=61&&n<=65?{icon:Pg,label:s("weather.rain"),isRaining:!0}:n>=66&&n<=67?{icon:Pg,label:s("weather.freezingRain"),isRaining:!0}:n>=71&&n<=77?{icon:BF,label:s("weather.snow"),isRaining:!1}:n>=80&&n<=82?{icon:Pg,label:s("weather.rainShowers"),isRaining:!0}:n>=85&&n<=86?{icon:BF,label:s("weather.snowShowers"),isRaining:!1}:n>=95&&n<=99?{icon:Pg,label:s("weather.thunderstorm"),isRaining:!0}:{icon:EC,label:s("weather.unknown"),isRaining:!1}}const AU=Y.forwardRef((n,t)=>{const[s,h]=Y.useState(null),[g,v]=Y.useState(!0),{latitude:E,longitude:c}=UM(),{t:T}=nm();if(Y.useEffect(()=>{if(!E||!c)return;const H=async()=>{var ae,ne,me;try{const oe=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${E}&longitude=${c}¤t_weather=true`);if(!oe.ok)return;const re=await oe.json();h({temperature:Math.round(((ae=re.current_weather)==null?void 0:ae.temperature)??0),weatherCode:((ne=re.current_weather)==null?void 0:ne.weathercode)??0,isDay:((me=re.current_weather)==null?void 0:me.is_day)===1})}catch(oe){console.error("Failed to fetch weather:",oe)}finally{v(!1)}};H();const X=setInterval(H,10*60*1e3);return()=>clearInterval(X)},[E,c]),g||!s)return ue.jsx("div",{ref:t,className:"flex items-center justify-center w-12 h-8",children:ue.jsx(EC,{className:"w-5 h-5 text-muted-foreground/50 animate-pulse"})});const{icon:L,label:B,isRaining:U}=ere(s.weatherCode,s.isDay,T);return ue.jsxs(Ox.div,{ref:t,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"relative flex items-center justify-center",title:B,children:[ue.jsxs("div",{className:"relative",children:[ue.jsx(L,{className:"w-7 h-7 text-muted-foreground"}),ue.jsx("div",{className:"absolute inset-0 flex items-center justify-center pt-0.5",children:ue.jsxs("span",{className:"text-[9px] font-bold text-foreground",children:[s.temperature,"°"]})})]}),U&&ue.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 flex gap-0.5",children:[0,1,2].map(H=>ue.jsx(Ox.div,{className:"w-0.5 h-1.5 bg-muted-foreground rounded-full",animate:{y:[0,4,0],opacity:[.4,.8,.4]},transition:{duration:.6,delay:H*.15,repeat:1/0}},H))})]})});AU.displayName="WeatherIndicator";function tre(){const[n,t]=Y.useState(null),[s,h]=Y.useState(!1),[g,v]=Y.useState(null),E=Y.useCallback(async(T,L,B,U,H)=>{h(!0),v(null);try{const X=await YV();if(!X)throw new Error("Kunde inte hämta karttoken");const ne=`https://api.mapbox.com/directions/v5/mapbox/${H==="driving"?"driving":H==="cycling"?"cycling":"walking"}/${L},${T};${U},${B}?geometries=geojson&steps=true&language=sv&access_token=${X}`,me=await fetch(ne);if(!me.ok)throw new Error(`Kunde inte hämta rutt: ${me.status}`);const oe=await me.json();if(!oe.routes||oe.routes.length===0)throw new Error("Ingen rutt hittades");const re=oe.routes[0],he=re.legs[0].steps.map(_e=>({instruction:_e.maneuver.instruction||nre(_e.maneuver.type,_e.maneuver.modifier),distance:_e.distance,duration:_e.duration,maneuver:_e.maneuver.type}));t({distance:re.distance,duration:re.duration,steps:he,geometry:re.geometry})}catch(X){console.error("Routing error:",X),v(X instanceof Error?X.message:"Kunde inte beräkna rutt")}finally{h(!1)}},[]),c=Y.useCallback(()=>{t(null),v(null)},[]);return{route:n,loading:s,error:g,fetchRoute:E,clearRoute:c}}function nre(n,t){const s={"turn-left":"Sväng vänster","turn-right":"Sväng höger","turn-slight-left":"Sväng lätt vänster","turn-slight-right":"Sväng lätt höger","turn-sharp-left":"Sväng skarpt vänster","turn-sharp-right":"Sväng skarpt höger",straight:"Fortsätt rakt fram",depart:"Starta",arrive:"Framme vid destination",roundabout:"Kör in i rondellen","exit-roundabout":"Kör ut ur rondellen",merge:"Kör samman","fork-left":"Håll vänster i förgreningen","fork-right":"Håll höger i förgreningen","end-of-road-left":"Sväng vänster vid vägens slut","end-of-road-right":"Sväng höger vid vägens slut",continue:"Fortsätt",rotary:"Kör in i cirkulationsplatsen","exit-rotary":"Kör ut ur cirkulationsplatsen","new-name":"Fortsätt på",notification:"","use-lane":"Använd rätt fil"},h=t?`${n}-${t}`:n;return s[h]||s[n]||"Fortsätt"}function rre(n){if(n<60)return`${Math.round(n)} sek`;const t=Math.floor(n/60);if(t<60)return`${t} min`;const s=Math.floor(t/60),h=t%60;if(s<24)return h>0?`${s} tim ${h} min`:`${s} tim`;const g=Math.floor(s/24),v=s%24;return v>0?`${g} d ${v} tim`:`${g} dagar`}function ire(n){if(n<1e3)return`${Math.round(n)} m`;const t=n/1e3;return t<10?`${t.toFixed(1)} km`:`${Math.round(t)} km`}const Yx="https://api.quixzoom.com/api/qz";function CU(){return localStorage.getItem("aamos_token")||localStorage.getItem("qz_token")}function c2(){const n={"Content-Type":"application/json"},t=CU();return t&&(n.Authorization=`Bearer ${t}`),n}async function IU(n){const t=await fetch(`${Yx}${n}`,{method:"GET",headers:c2()});if(!t.ok)throw new Error(`API error: ${t.status}`);return t.json()}async function mI(n,t){const s=await fetch(`${Yx}${n}`,{method:"POST",headers:c2(),body:JSON.stringify(t)});if(!s.ok)throw new Error(`API error: ${s.status}`);return s.json()}async function ore(n,t){const s=await fetch(`${Yx}${n}`,{method:"PATCH",headers:c2(),body:JSON.stringify(t)});if(!s.ok)throw new Error(`API error: ${s.status}`);return s.json()}async function ece(n){const t=await fetch(`${Yx}${n}`,{method:"DELETE",headers:c2()});if(!t.ok)throw new Error(`API error: ${t.status}`);return t.json()}async function sre(n,t,s){const h=new FormData;h.append("file",t,"upload");const g={},v=CU();v&&(g.Authorization=`Bearer ${v}`);const E=await fetch(`${Yx}${n}`,{method:"POST",headers:g,body:h});if(!E.ok)throw new Error(`Upload error: ${E.status}`);return E.json()}const are=()=>{const[n,t]=Y.useState([]),[s,h]=Y.useState(!0);return Y.useEffect(()=>{(async()=>{const v=new Date;v.setDate(v.getDate()-30);try{const E=await IU(`/mission-hotspots?from=${v.toISOString()}&limit=50&order=intensity_score.desc`);t(Array.isArray(E)?E:[])}catch(E){console.warn("useHotspots: could not fetch hotspots",E),t([])}finally{h(!1)}})()},[]),{hotspots:n,loading:s}},lre=[{id:"tokyo-sakura",title:"Körsbärsblomningen",location:"Tokyo, Japan",latitude:35.6762,longitude:139.6503,type:"charity",reward:25e3,themeColor:"#ec4899",gradient:"from-pink-500 to-rose-500",description:"Fånga körsbärsblomningen i Tokyo"},{id:"nyc-christmas",title:"Julgranen på Rockefeller",location:"New York, USA",latitude:40.7587,longitude:-73.9787,type:"charity",reward:1400,themeColor:"#10b981",gradient:"from-emerald-500 to-green-500",description:"Dokumentera julgranen i snöfall"},{id:"paris-eiffel",title:"Eiffeltornet i Dimma",location:"Paris, Frankrike",latitude:48.8584,longitude:2.2945,type:"charity",reward:1050,themeColor:"#64748b",gradient:"from-slate-500 to-zinc-500",description:"Fånga Eiffeltornet i dimma"},{id:"venice-carnival",title:"Karnevalen i Venedig",location:"Venedig, Italien",latitude:45.4408,longitude:12.3155,type:"charity",reward:1750,themeColor:"#8b5cf6",gradient:"from-violet-500 to-purple-500",description:"Dokumentera karnevalens masker"},{id:"northern-lights",title:"Norrskenet",location:"Tromsø, Norge",latitude:69.6492,longitude:18.9553,type:"charity",reward:850,themeColor:"#14b8a6",gradient:"from-teal-500 to-cyan-500",description:"Fånga norrskenet"},{id:"santorini-sunset",title:"Solnedgång i Santorini",location:"Oia, Grekland",latitude:36.4618,longitude:25.3753,type:"charity",reward:525,themeColor:"#6366f1",gradient:"from-blue-500 to-indigo-500",description:"Den berömda solnedgången"},{id:"rio-carnival",title:"Karnevalen i Rio",location:"Rio de Janeiro, Brasilien",latitude:-22.9068,longitude:-43.1729,type:"charity",reward:1550,themeColor:"#eab308",gradient:"from-yellow-500 to-green-500",description:"Världens största fest"},{id:"mcdonalds-stockholm",title:"Sommarglass i Solen",location:"Stockholm, Sverige",latitude:59.3293,longitude:18.0686,type:"sponsored",sponsor:"McDonald's",sponsorEmoji:"🍟",reward:250,themeColor:"#fbbf24",gradient:"from-yellow-500 to-red-500",description:"Fota en McDonald's glass"},{id:"mcdonalds-london",title:"Sommarglass i Solen",location:"London, UK",latitude:51.5074,longitude:-.1278,type:"sponsored",sponsor:"McDonald's",sponsorEmoji:"🍟",reward:250,themeColor:"#fbbf24",gradient:"from-yellow-500 to-red-500",description:"Fota en McDonald's glass"},{id:"cocacola-berlin",title:"Share a Coke Moment",location:"Berlin, Tyskland",latitude:52.52,longitude:13.405,type:"sponsored",sponsor:"Coca-Cola",sponsorEmoji:"🥤",reward:300,themeColor:"#dc2626",gradient:"from-red-600 to-red-500",description:"Dela ett Coca-Cola-ögonblick"},{id:"cocacola-madrid",title:"Share a Coke Moment",location:"Madrid, Spanien",latitude:40.4168,longitude:-3.7038,type:"sponsored",sponsor:"Coca-Cola",sponsorEmoji:"🥤",reward:300,themeColor:"#dc2626",gradient:"from-red-600 to-red-500",description:"Dela ett Coca-Cola-ögonblick"},{id:"starbucks-seattle",title:"Morgonkaffets Magi",location:"Seattle, USA",latitude:47.6062,longitude:-122.3321,type:"sponsored",sponsor:"Starbucks",sponsorEmoji:"☕",reward:200,themeColor:"#047857",gradient:"from-green-700 to-emerald-500",description:"Morgonstunden med Starbucks"},{id:"starbucks-tokyo",title:"Morgonkaffets Magi",location:"Tokyo, Japan",latitude:35.6895,longitude:139.6917,type:"sponsored",sponsor:"Starbucks",sponsorEmoji:"☕",reward:200,themeColor:"#047857",gradient:"from-green-700 to-emerald-500",description:"Morgonstunden med Starbucks"},{id:"nike-barcelona",title:"Just Do It — Urban Run",location:"Barcelona, Spanien",latitude:41.3851,longitude:2.1734,type:"sponsored",sponsor:"Nike",sponsorEmoji:"✓",reward:400,themeColor:"#f97316",gradient:"from-orange-500 to-amber-500",description:"Fånga löpare i action"},{id:"nike-losangeles",title:"Just Do It — Urban Run",location:"Los Angeles, USA",latitude:34.0522,longitude:-118.2437,type:"sponsored",sponsor:"Nike",sponsorEmoji:"✓",reward:400,themeColor:"#f97316",gradient:"from-orange-500 to-amber-500",description:"Fånga löpare i action"},{id:"spotify-amsterdam",title:"Musik i Staden",location:"Amsterdam, Nederländerna",latitude:52.3676,longitude:4.9041,type:"sponsored",sponsor:"Spotify",sponsorEmoji:"🎵",reward:350,themeColor:"#22c55e",gradient:"from-green-500 to-lime-500",description:"Dokumentera gatumusik"},{id:"ikea-malmo",title:"Hemma hos Dig",location:"Malmö, Sverige",latitude:55.605,longitude:13.0038,type:"sponsored",sponsor:"IKEA",sponsorEmoji:"🏠",reward:300,themeColor:"#0284c7",gradient:"from-blue-600 to-yellow-500",description:"IKEA i ditt hem"},{id:"oatly-goteborg",title:"Det Här är Inte Mjölk",location:"Göteborg, Sverige",latitude:57.7089,longitude:11.9746,type:"sponsored",sponsor:"Oatly",sponsorEmoji:"🌾",reward:200,themeColor:"#ca8a04",gradient:"from-amber-500 to-lime-500",description:"Kreativa kaffemoment"},{id:"apple-sanfrancisco",title:"Shot on iPhone",location:"San Francisco, USA",latitude:37.7749,longitude:-122.4194,type:"sponsored",sponsor:"Apple",sponsorEmoji:"🍎",reward:500,themeColor:"#000000",gradient:"from-zinc-800 to-zinc-600",description:"Tagen med iPhone"},{id:"apple-singapore",title:"Shot on iPhone",location:"Singapore",latitude:1.3521,longitude:103.8198,type:"sponsored",sponsor:"Apple",sponsorEmoji:"🍎",reward:500,themeColor:"#000000",gradient:"from-zinc-800 to-zinc-600",description:"Tagen med iPhone"},{id:"tesla-oslo",title:"Electric Dreams",location:"Oslo, Norge",latitude:59.9139,longitude:10.7522,type:"sponsored",sponsor:"Tesla",sponsorEmoji:"⚡",reward:450,themeColor:"#dc2626",gradient:"from-red-600 to-zinc-700",description:"Dokumentera elbilslivet"},{id:"tesla-shanghai",title:"Electric Dreams",location:"Shanghai, Kina",latitude:31.2304,longitude:121.4737,type:"sponsored",sponsor:"Tesla",sponsorEmoji:"⚡",reward:450,themeColor:"#dc2626",gradient:"from-red-600 to-zinc-700",description:"Dokumentera elbilslivet"},{id:"redbull-innsbruck",title:"Red Bull ger dig vingar",location:"Innsbruck, Österrike",latitude:47.2692,longitude:11.4041,type:"sponsored",sponsor:"Red Bull",sponsorEmoji:"🐂",reward:400,themeColor:"#1e3a8a",gradient:"from-blue-900 to-red-500",description:"Extremsport och energi"},{id:"redbull-austin",title:"Red Bull ger dig vingar",location:"Austin, USA",latitude:30.2672,longitude:-97.7431,type:"sponsored",sponsor:"Red Bull",sponsorEmoji:"🐂",reward:400,themeColor:"#1e3a8a",gradient:"from-blue-900 to-red-500",description:"Extremsport och energi"},{id:"adidas-berlin",title:"Impossible is Nothing",location:"Berlin, Tyskland",latitude:52.517,longitude:13.3889,type:"sponsored",sponsor:"Adidas",sponsorEmoji:"👟",reward:350,themeColor:"#000000",gradient:"from-zinc-900 to-zinc-600",description:"Sport och streetwear"},{id:"adidas-mumbai",title:"Impossible is Nothing",location:"Mumbai, Indien",latitude:19.076,longitude:72.8777,type:"sponsored",sponsor:"Adidas",sponsorEmoji:"👟",reward:350,themeColor:"#000000",gradient:"from-zinc-900 to-zinc-600",description:"Sport och streetwear"},{id:"samsung-seoul",title:"Galaxy Moments",location:"Seoul, Sydkorea",latitude:37.5665,longitude:126.978,type:"sponsored",sponsor:"Samsung",sponsorEmoji:"📱",reward:400,themeColor:"#1428a0",gradient:"from-blue-800 to-indigo-500",description:"Fånga magin med Galaxy"},{id:"samsung-dubai",title:"Galaxy Moments",location:"Dubai, UAE",latitude:25.2048,longitude:55.2708,type:"sponsored",sponsor:"Samsung",sponsorEmoji:"📱",reward:400,themeColor:"#1428a0",gradient:"from-blue-800 to-indigo-500",description:"Fånga magin med Galaxy"},{id:"amazon-seattle",title:"Smile Box",location:"Seattle, USA",latitude:47.6097,longitude:-122.3331,type:"sponsored",sponsor:"Amazon",sponsorEmoji:"📦",reward:250,themeColor:"#ff9900",gradient:"from-orange-500 to-amber-400",description:"Glädjen av leverans"},{id:"amazon-london",title:"Smile Box",location:"London, UK",latitude:51.5099,longitude:-.118,type:"sponsored",sponsor:"Amazon",sponsorEmoji:"📦",reward:250,themeColor:"#ff9900",gradient:"from-orange-500 to-amber-400",description:"Glädjen av leverans"},{id:"bmw-munich",title:"Sheer Driving Pleasure",location:"München, Tyskland",latitude:48.1351,longitude:11.582,type:"sponsored",sponsor:"BMW",sponsorEmoji:"🚗",reward:500,themeColor:"#0066b1",gradient:"from-blue-600 to-slate-700",description:"Körglädjen dokumenterad"},{id:"bmw-la",title:"Sheer Driving Pleasure",location:"Los Angeles, USA",latitude:34.0195,longitude:-118.4912,type:"sponsored",sponsor:"BMW",sponsorEmoji:"🚗",reward:500,themeColor:"#0066b1",gradient:"from-blue-600 to-slate-700",description:"Körglädjen dokumenterad"},{id:"hm-stockholm",title:"Fashion Forward",location:"Stockholm, Sverige",latitude:59.3326,longitude:18.0649,type:"sponsored",sponsor:"H&M",sponsorEmoji:"👗",reward:250,themeColor:"#e4002b",gradient:"from-red-600 to-rose-400",description:"Mode på gatan"},{id:"hm-paris",title:"Fashion Forward",location:"Paris, Frankrike",latitude:48.8566,longitude:2.3522,type:"sponsored",sponsor:"H&M",sponsorEmoji:"👗",reward:250,themeColor:"#e4002b",gradient:"from-red-600 to-rose-400",description:"Mode på gatan"},{id:"google-mountainview",title:"Search & Discover",location:"Mountain View, USA",latitude:37.3861,longitude:-122.0839,type:"sponsored",sponsor:"Google",sponsorEmoji:"🔍",reward:450,themeColor:"#4285f4",gradient:"from-blue-500 via-green-500 to-yellow-500",description:"Upptäck med Google"},{id:"google-bangalore",title:"Search & Discover",location:"Bangalore, Indien",latitude:12.9716,longitude:77.5946,type:"sponsored",sponsor:"Google",sponsorEmoji:"🔍",reward:450,themeColor:"#4285f4",gradient:"from-blue-500 via-green-500 to-yellow-500",description:"Upptäck med Google"},{id:"netflix-losangeles",title:"Binge Worthy",location:"Los Angeles, USA",latitude:34.0259,longitude:-118.3547,type:"sponsored",sponsor:"Netflix",sponsorEmoji:"🎬",reward:350,themeColor:"#e50914",gradient:"from-red-600 to-zinc-900",description:"Fånga filmmagin"},{id:"lego-billund",title:"Build Together",location:"Billund, Danmark",latitude:55.7319,longitude:9.1198,type:"sponsored",sponsor:"LEGO",sponsorEmoji:"🧱",reward:300,themeColor:"#d01012",gradient:"from-red-600 to-yellow-500",description:"Kreativitet i klossar"},{id:"volvo-gothenburg",title:"For Life",location:"Göteborg, Sverige",latitude:57.701,longitude:11.9927,type:"sponsored",sponsor:"Volvo",sponsorEmoji:"🚙",reward:400,themeColor:"#003057",gradient:"from-blue-900 to-slate-600",description:"Säkerhet och stil"},{id:"porsche-stuttgart",title:"Driven by Dreams",location:"Stuttgart, Tyskland",latitude:48.7758,longitude:9.1829,type:"sponsored",sponsor:"Porsche",sponsorEmoji:"🏎️",reward:600,themeColor:"#b12b28",gradient:"from-red-700 to-zinc-800",description:"Drömbilar i verkligheten"},{id:"heineken-amsterdam",title:"Open Your World",location:"Amsterdam, Nederländerna",latitude:52.3579,longitude:4.8914,type:"sponsored",sponsor:"Heineken",sponsorEmoji:"🍺",reward:200,themeColor:"#00a650",gradient:"from-green-600 to-emerald-400",description:"Sociala stunder"},{id:"redbull-miami",title:"Red Bull ger dig vingar",location:"Miami, USA",latitude:25.7617,longitude:-80.1918,type:"sponsored",sponsor:"Red Bull",sponsorEmoji:"🐂",reward:400,themeColor:"#1e3a8a",gradient:"from-blue-900 to-red-500",description:"Extremsport och energi"},{id:"mcdonalds-tokyo",title:"Sommarglass i Solen",location:"Tokyo, Japan",latitude:35.6812,longitude:139.7671,type:"sponsored",sponsor:"McDonald's",sponsorEmoji:"🍟",reward:250,themeColor:"#fbbf24",gradient:"from-yellow-500 to-red-500",description:"Fota en McDonald's glass"},{id:"cocacola-sydney",title:"Share a Coke Moment",location:"Sydney, Australien",latitude:-33.8688,longitude:151.2093,type:"sponsored",sponsor:"Coca-Cola",sponsorEmoji:"🥤",reward:300,themeColor:"#dc2626",gradient:"from-red-600 to-red-500",description:"Dela ett Coca-Cola-ögonblick"},{id:"spotify-london",title:"Musik i Staden",location:"London, UK",latitude:51.5155,longitude:-.0922,type:"sponsored",sponsor:"Spotify",sponsorEmoji:"🎵",reward:350,themeColor:"#22c55e",gradient:"from-green-500 to-lime-500",description:"Dokumentera gatumusik"},{id:"uber-newyork",title:"Your Ride, Your Story",location:"New York, USA",latitude:40.7128,longitude:-74.006,type:"sponsored",sponsor:"Uber",sponsorEmoji:"🚕",reward:200,themeColor:"#000000",gradient:"from-zinc-900 to-zinc-600",description:"Fånga resan"},{id:"airbnb-barcelona",title:"Belong Anywhere",location:"Barcelona, Spanien",latitude:41.3874,longitude:2.1686,type:"sponsored",sponsor:"Airbnb",sponsorEmoji:"🏡",reward:300,themeColor:"#ff5a5f",gradient:"from-rose-500 to-pink-400",description:"Unika boenden"},{id:"zara-madrid",title:"Fashion Everywhere",location:"Madrid, Spanien",latitude:40.42,longitude:-3.7025,type:"sponsored",sponsor:"Zara",sponsorEmoji:"🛍️",reward:250,themeColor:"#000000",gradient:"from-zinc-900 to-zinc-600",description:"Mode i vardagen"},{id:"sephora-paris",title:"Beauty Unboxed",location:"Paris, Frankrike",latitude:48.8649,longitude:2.34,type:"sponsored",sponsor:"Sephora",sponsorEmoji:"💄",reward:300,themeColor:"#000000",gradient:"from-zinc-900 to-rose-500",description:"Skönhetsögonblick"},{id:"spotify-stockholm",title:"Musik i Staden",location:"Stockholm, Sverige",latitude:59.3326,longitude:18.0649,type:"sponsored",sponsor:"Spotify",sponsorEmoji:"🎵",reward:350,themeColor:"#22c55e",gradient:"from-green-500 to-lime-500",description:"Dokumentera gatumusik i Stockholm"},{id:"klarna-stockholm",title:"Smoooth Shopping",location:"Stockholm City, Sverige",latitude:59.3346,longitude:18.0632,type:"sponsored",sponsor:"Klarna",sponsorEmoji:"💳",reward:300,themeColor:"#ffb3c7",gradient:"from-pink-400 to-rose-300",description:"Fånga smidiga köpögonblick"},{id:"max-stockholm",title:"Burgare på Svenska",location:"Kungsgatan, Stockholm",latitude:59.336,longitude:18.0674,type:"sponsored",sponsor:"MAX",sponsorEmoji:"🍔",reward:200,themeColor:"#e11d48",gradient:"from-red-600 to-yellow-500",description:"Sveriges godaste burgare"},{id:"systembolaget-stockholm",title:"Ansvarsfullt Firande",location:"Hötorget, Stockholm",latitude:59.3351,longitude:18.0637,type:"sponsored",sponsor:"Systembolaget",sponsorEmoji:"🍷",reward:250,themeColor:"#1d4ed8",gradient:"from-blue-700 to-green-600",description:"Dokumentera ansvarsfullt"},{id:"ica-sodermalm",title:"Vardagens Hjältar",location:"Södermalm, Stockholm",latitude:59.318,longitude:18.0744,type:"sponsored",sponsor:"ICA",sponsorEmoji:"🛒",reward:150,themeColor:"#dc2626",gradient:"from-red-600 to-orange-500",description:"Matglädje varje dag"},{id:"nordic-wellness-stockholm",title:"Träna för Livet",location:"Vasastan, Stockholm",latitude:59.3445,longitude:18.0502,type:"sponsored",sponsor:"Nordic Wellness",sponsorEmoji:"💪",reward:200,themeColor:"#16a34a",gradient:"from-green-600 to-teal-500",description:"Fånga träningsglädjen"},{id:"stena-line-goteborg",title:"Seglats till Äventyr",location:"Masthuggskajen, Göteborg",latitude:57.6969,longitude:11.938,type:"sponsored",sponsor:"Stena Line",sponsorEmoji:"⛴️",reward:300,themeColor:"#0891b2",gradient:"from-cyan-600 to-blue-500",description:"Färjeresor från Göteborg"},{id:"liseberg-goteborg",title:"Tivoli Magi",location:"Liseberg, Göteborg",latitude:57.6951,longitude:11.9935,type:"sponsored",sponsor:"Liseberg",sponsorEmoji:"🎢",reward:350,themeColor:"#16a34a",gradient:"from-green-600 to-yellow-500",description:"Fånga nöjesfältsglädjen"},{id:"coop-goteborg",title:"Hållbar Vardag",location:"Nordstan, Göteborg",latitude:57.7082,longitude:11.97,type:"sponsored",sponsor:"Coop",sponsorEmoji:"🌿",reward:150,themeColor:"#22c55e",gradient:"from-green-500 to-lime-400",description:"Hållbart handlande"},{id:"hasselblad-goteborg",title:"Master the Light",location:"Göteborg Centrum",latitude:57.7045,longitude:11.9654,type:"sponsored",sponsor:"Hasselblad",sponsorEmoji:"📷",reward:500,themeColor:"#0f172a",gradient:"from-slate-900 to-orange-500",description:"Världsklass fotografi"},{id:"oresundsbron-malmo",title:"Bron över Sundet",location:"Öresundsbron, Malmö",latitude:55.5708,longitude:12.856,type:"charity",reward:400,themeColor:"#0284c7",gradient:"from-sky-600 to-blue-400",description:"Fånga Öresundsbron"},{id:"turning-torso-malmo",title:"Arkitektur i Fokus",location:"Turning Torso, Malmö",latitude:55.6133,longitude:12.9756,type:"charity",reward:350,themeColor:"#6366f1",gradient:"from-indigo-500 to-purple-500",description:"Skandinaviens högsta byggnad"},{id:"espresso-house-malmo",title:"Fika med Stil",location:"Stortorget, Malmö",latitude:55.6058,longitude:13.0007,type:"sponsored",sponsor:"Espresso House",sponsorEmoji:"☕",reward:180,themeColor:"#78350f",gradient:"from-amber-900 to-orange-600",description:"Kaffemoment i Malmö"},{id:"domkyrkan-uppsala",title:"Historisk Prakt",location:"Uppsala Domkyrka",latitude:59.8578,longitude:17.632,type:"charity",reward:300,themeColor:"#b91c1c",gradient:"from-red-700 to-amber-600",description:"Skandinaviens största katedral"},{id:"akademiska-uppsala",title:"Studentliv",location:"Uppsala Universitet",latitude:59.8586,longitude:17.6389,type:"charity",reward:250,themeColor:"#7c3aed",gradient:"from-violet-600 to-purple-400",description:"Fånga studentlivet"},{id:"saab-linkoping",title:"Svensk Innovation",location:"Saab, Linköping",latitude:58.4108,longitude:15.6214,type:"sponsored",sponsor:"Saab",sponsorEmoji:"✈️",reward:400,themeColor:"#1e3a8a",gradient:"from-blue-900 to-cyan-600",description:"Svensk flygteknik"},{id:"sla-orebro",title:"Slottsvy",location:"Örebro Slott",latitude:59.2753,longitude:15.2134,type:"charity",reward:220,themeColor:"#854d0e",gradient:"from-amber-800 to-yellow-600",description:"Slottet mitt i stan"},{id:"abb-vasteras",title:"Framtidens Energi",location:"ABB, Västerås",latitude:59.6099,longitude:16.5448,type:"sponsored",sponsor:"ABB",sponsorEmoji:"⚡",reward:350,themeColor:"#dc2626",gradient:"from-red-600 to-zinc-700",description:"Elektrifiering av världen"},{id:"industrilandskap-norrkoping",title:"Industrihistoria",location:"Industrilandskapet, Norrköping",latitude:58.5877,longitude:16.1924,type:"charity",reward:200,themeColor:"#ca8a04",gradient:"from-yellow-600 to-orange-500",description:"Historisk industrimiljö"},{id:"karnan-helsingborg",title:"Kärnan i Fokus",location:"Kärnan, Helsingborg",latitude:56.0465,longitude:12.6945,type:"charity",reward:250,themeColor:"#78716c",gradient:"from-stone-600 to-slate-500",description:"Medeltida torn"},{id:"husqvarna-jonkoping",title:"Trädgårdens Bästa Vän",location:"Jönköping",latitude:57.7826,longitude:14.1618,type:"sponsored",sponsor:"Husqvarna",sponsorEmoji:"🌳",reward:280,themeColor:"#f97316",gradient:"from-orange-500 to-green-600",description:"Husqvarna i action"},{id:"lunds-universitet",title:"Kunskapens Borg",location:"Lunds Universitet",latitude:55.7047,longitude:13.191,type:"charity",reward:280,themeColor:"#0369a1",gradient:"from-sky-700 to-blue-500",description:"Historiskt universitet"},{id:"umea-kulturhuvudstad",title:"Kulturstad i Norr",location:"Umeå Centrum",latitude:63.8258,longitude:20.263,type:"charity",reward:300,themeColor:"#db2777",gradient:"from-pink-600 to-purple-500",description:"Europas kulturhuvudstad 2014"},{id:"lulea-gammelstad",title:"UNESCO Kyrkstad",location:"Gammelstads Kyrkstad, Luleå",latitude:65.6415,longitude:21.701,type:"charity",reward:350,themeColor:"#b91c1c",gradient:"from-red-700 to-amber-500",description:"Världsarv i Norrbotten"},{id:"stenstaden-sundsvall",title:"Stenstaden",location:"Sundsvall Centrum",latitude:62.3908,longitude:17.3069,type:"charity",reward:220,themeColor:"#78716c",gradient:"from-stone-500 to-slate-600",description:"Arkitektur efter branden"},{id:"gavle-bocken",title:"Julbocken",location:"Slottstorget, Gävle",latitude:60.6749,longitude:17.1413,type:"charity",reward:400,themeColor:"#dc2626",gradient:"from-red-600 to-yellow-500",description:"Världens mest kända julbock"},{id:"sola-karlstad",title:"Sola i Karlstad",location:"Karlstad Centrum",latitude:59.4022,longitude:13.5115,type:"charity",reward:200,themeColor:"#fbbf24",gradient:"from-yellow-400 to-orange-400",description:"Solstaden vid Vänern"},{id:"europas-gronaste-vaxjo",title:"Europas Grönaste Stad",location:"Växjö Centrum",latitude:56.879,longitude:14.8059,type:"charity",reward:250,themeColor:"#16a34a",gradient:"from-green-600 to-emerald-400",description:"Hållbar stadsplanering"},{id:"halmstad-strand",title:"Sommar vid Havet",location:"Tylösand, Halmstad",latitude:56.6496,longitude:12.7268,type:"charity",reward:280,themeColor:"#0891b2",gradient:"from-cyan-600 to-sky-400",description:"Sveriges bästa strand"},{id:"boras-textil",title:"Textilstaden",location:"Borås Centrum",latitude:57.721,longitude:12.9401,type:"charity",reward:200,themeColor:"#6366f1",gradient:"from-indigo-500 to-blue-400",description:"Svensk textilindustri"},{id:"eskilstuna-stadsmuseum",title:"Fristaden",location:"Eskilstuna Centrum",latitude:59.3666,longitude:16.5077,type:"charity",reward:180,themeColor:"#0ea5e9",gradient:"from-sky-500 to-blue-400",description:"Fri handelsstad"},{id:"visby-ringmur",title:"Medeltida Magi",location:"Visby Ringmur, Gotland",latitude:57.6348,longitude:18.2948,type:"charity",reward:400,themeColor:"#78716c",gradient:"from-stone-600 to-amber-500",description:"UNESCO Världsarv"},{id:"kiruna-icehotel",title:"Ishotellet",location:"Jukkasjärvi, Kiruna",latitude:67.8558,longitude:20.5928,type:"charity",reward:500,themeColor:"#0ea5e9",gradient:"from-sky-400 to-blue-300",description:"Världens första ishotell"},{id:"are-skidort",title:"Skidåkarnas Paradis",location:"Åre Centrum",latitude:63.3989,longitude:13.0747,type:"charity",reward:350,themeColor:"#0284c7",gradient:"from-sky-600 to-white",description:"Skandinaviens bästa skidort"},{id:"vasaloppet-mora",title:"Vasaloppets Mål",location:"Mora",latitude:61.0051,longitude:14.5421,type:"charity",reward:300,themeColor:"#1d4ed8",gradient:"from-blue-700 to-sky-500",description:"Världens största längdskidlopp"},{id:"kalmar-slott",title:"Renässansslott",location:"Kalmar Slott",latitude:56.6616,longitude:16.3616,type:"charity",reward:280,themeColor:"#854d0e",gradient:"from-amber-700 to-yellow-500",description:"Nordeuropas vackraste renässansslott"},{id:"karlskrona-marinmuseum",title:"Örlogsstaden",location:"Karlskrona",latitude:56.1612,longitude:15.5869,type:"charity",reward:300,themeColor:"#1e3a8a",gradient:"from-blue-900 to-sky-600",description:"UNESCO Världsarv marinstad"},{id:"trollywood",title:"Filmstaden",location:"Film i Väst, Trollhättan",latitude:58.2828,longitude:12.2854,type:"sponsored",sponsor:"Film i Väst",sponsorEmoji:"🎬",reward:300,themeColor:"#7c3aed",gradient:"from-violet-600 to-purple-400",description:"Svenska Hollywoods"},{id:"northvolt-skelleftea",title:"Europas Batterifabrik",location:"Northvolt, Skellefteå",latitude:64.7507,longitude:20.9528,type:"sponsored",sponsor:"Northvolt",sponsorEmoji:"🔋",reward:400,themeColor:"#16a34a",gradient:"from-green-600 to-emerald-400",description:"Grön batteritillverkning"},{id:"falu-gruva",title:"Gruvan",location:"Falu Gruva",latitude:60.5985,longitude:15.6284,type:"charity",reward:350,themeColor:"#b91c1c",gradient:"from-red-700 to-orange-600",description:"UNESCO Världsarv koppargruva"},{id:"ostersund-storsjoodjuret",title:"Storsjöodjuret",location:"Storsjön, Östersund",latitude:63.1792,longitude:14.6357,type:"charity",reward:400,themeColor:"#0891b2",gradient:"from-cyan-600 to-teal-500",description:"Sveriges loch ness"},{id:"atrium-sickla",title:"Stadsutveckling Sickla",location:"Sickla, Stockholm",latitude:59.3055,longitude:18.105,type:"sponsored",sponsor:"Atrium Ljungberg",sponsorEmoji:"🏢",reward:400,themeColor:"#0f172a",gradient:"from-slate-900 to-blue-600",description:"Dokumentera Sicklas transformation"},{id:"atrium-slussen",title:"Nya Slussen",location:"Slussen, Stockholm",latitude:59.32,longitude:18.072,type:"sponsored",sponsor:"Atrium Ljungberg",sponsorEmoji:"🌉",reward:450,themeColor:"#0f172a",gradient:"from-slate-900 to-cyan-600",description:"Slussens omvandling dokumenterad"},{id:"atrium-hagastaden",title:"Hagastaden Växer",location:"Hagastaden, Stockholm",latitude:59.352,longitude:18.0255,type:"sponsored",sponsor:"Atrium Ljungberg",sponsorEmoji:"🏗️",reward:380,themeColor:"#0f172a",gradient:"from-slate-800 to-emerald-600",description:"Livsmiljön Hagastaden"},{id:"atrium-mobilia",title:"Mobilia Malmö",location:"Mobilia, Malmö",latitude:55.5842,longitude:13.0152,type:"sponsored",sponsor:"Atrium Ljungberg",sponsorEmoji:"🛍️",reward:350,themeColor:"#0f172a",gradient:"from-slate-900 to-purple-600",description:"Handelsplatsen Mobilia"},{id:"max-stockholm-central",title:"Sveriges Original",location:"Max, Stockholm Central",latitude:59.3309,longitude:18.0576,type:"sponsored",sponsor:"Max",sponsorEmoji:"🍔",reward:250,themeColor:"#dc2626",gradient:"from-red-600 to-yellow-500",description:"Svenskt burgarhäng på Max"},{id:"max-goteborg-nordstan",title:"Sveriges Original",location:"Max, Nordstan Göteborg",latitude:57.7089,longitude:11.968,type:"sponsored",sponsor:"Max",sponsorEmoji:"🍔",reward:250,themeColor:"#dc2626",gradient:"from-red-600 to-yellow-500",description:"Svenska smakögonblick"},{id:"max-malmo-triangeln",title:"Klimatpositiv Burgare",location:"Max, Triangeln Malmö",latitude:55.5943,longitude:13.0016,type:"sponsored",sponsor:"Max",sponsorEmoji:"🌱",reward:280,themeColor:"#16a34a",gradient:"from-green-600 to-lime-400",description:"Dokumentera hållbar fastfood"},{id:"max-lulea",title:"Norrlands Favorit",location:"Max, Luleå",latitude:65.5848,longitude:22.1547,type:"sponsored",sponsor:"Max",sponsorEmoji:"❄️",reward:300,themeColor:"#dc2626",gradient:"from-red-600 to-orange-500",description:"Max i norrländskt vinterlandskap"},{id:"acoustics-konserthuset",title:"Perfekt Ljudbild",location:"Konserthuset, Stockholm",latitude:59.3342,longitude:18.0607,type:"sponsored",sponsor:"Acoustics",sponsorEmoji:"🎧",reward:400,themeColor:"#7c3aed",gradient:"from-violet-600 to-purple-400",description:"Ljudupplevelser i världsklass"},{id:"acoustics-liseberg",title:"Event Sound",location:"Liseberg, Göteborg",latitude:57.6949,longitude:11.9922,type:"sponsored",sponsor:"Acoustics",sponsorEmoji:"🔊",reward:350,themeColor:"#7c3aed",gradient:"from-purple-600 to-pink-500",description:"Konserter och events"},{id:"acoustics-malmo-arena",title:"Arena Sound",location:"Malmö Arena",latitude:55.5624,longitude:12.9793,type:"sponsored",sponsor:"Acoustics",sponsorEmoji:"🎤",reward:380,themeColor:"#7c3aed",gradient:"from-violet-700 to-fuchsia-500",description:"Dokumentera ljudtekniken"},{id:"ericsson-kista",title:"5G Innovation",location:"Ericsson HQ, Kista",latitude:59.4035,longitude:17.9434,type:"sponsored",sponsor:"Ericsson",sponsorEmoji:"📡",reward:450,themeColor:"#0369a1",gradient:"from-sky-700 to-blue-500",description:"Framtidens uppkoppling"},{id:"ericsson-linköping",title:"R&D Center",location:"Ericsson, Linköping",latitude:58.4108,longitude:15.6214,type:"sponsored",sponsor:"Ericsson",sponsorEmoji:"💡",reward:400,themeColor:"#0369a1",gradient:"from-blue-600 to-cyan-400",description:"Svensk teknikinnovation"},{id:"scandic-grand-stockholm",title:"Scandic Experience",location:"Scandic Grand Central, Stockholm",latitude:59.3311,longitude:18.0575,type:"sponsored",sponsor:"Scandic",sponsorEmoji:"🏨",reward:300,themeColor:"#0d9488",gradient:"from-teal-600 to-emerald-400",description:"Hotellupplevelser dokumenterade"},{id:"scandic-goteborg",title:"Hotel Moments",location:"Scandic Rubinen, Göteborg",latitude:57.7011,longitude:11.9752,type:"sponsored",sponsor:"Scandic",sponsorEmoji:"🛏️",reward:280,themeColor:"#0d9488",gradient:"from-teal-500 to-green-400",description:"Skandinavisk gästfrihet"},{id:"sj-stockholm-central",title:"Tågresan",location:"Stockholm Centralstation",latitude:59.3303,longitude:18.0591,type:"sponsored",sponsor:"SJ",sponsorEmoji:"🚄",reward:300,themeColor:"#b91c1c",gradient:"from-red-700 to-orange-500",description:"Reseglädje på spåren"},{id:"sj-goteborg-central",title:"Snabbtåg X2000",location:"Göteborg Central",latitude:57.7088,longitude:11.9729,type:"sponsored",sponsor:"SJ",sponsorEmoji:"🚃",reward:280,themeColor:"#b91c1c",gradient:"from-red-600 to-yellow-500",description:"Hållbart resande"},{id:"systembolaget-stockholm",title:"Ansvarsfullt Val",location:"Systembolaget, Södermalm",latitude:59.3148,longitude:18.0721,type:"sponsored",sponsor:"Systembolaget",sponsorEmoji:"🍷",reward:250,themeColor:"#15803d",gradient:"from-green-700 to-lime-500",description:"Dokumentera ansvarsfull alkoholhantering"},{id:"circlek-e4",title:"Roadtrip Fuel",location:"Circle K, E4 Upplands Väsby",latitude:59.5182,longitude:17.9101,type:"sponsored",sponsor:"Circle K",sponsorEmoji:"⛽",reward:200,themeColor:"#dc2626",gradient:"from-red-600 to-orange-400",description:"Vägresans pausstationer"},{id:"circlek-goteborg",title:"Quick Stop",location:"Circle K, Eriksberg Göteborg",latitude:57.7007,longitude:11.9134,type:"sponsored",sponsor:"Circle K",sponsorEmoji:"🚗",reward:200,themeColor:"#dc2626",gradient:"from-red-500 to-yellow-400",description:"Service på vägen"},{id:"apotek-hjartat-stockholm",title:"Hälsans Hjärta",location:"Apotek Hjärtat, Drottninggatan",latitude:59.3346,longitude:18.0632,type:"sponsored",sponsor:"Apotek Hjärtat",sponsorEmoji:"💊",reward:220,themeColor:"#dc2626",gradient:"from-red-500 to-pink-400",description:"Hälsovård i vardagen"},{id:"bauhaus-kungens-kurva",title:"DIY Projekt",location:"Bauhaus, Kungens Kurva",latitude:59.2668,longitude:17.9067,type:"sponsored",sponsor:"Bauhaus",sponsorEmoji:"🔨",reward:280,themeColor:"#ea580c",gradient:"from-orange-600 to-red-500",description:"Bygg och renovera"},{id:"bauhaus-malmo",title:"Byggvaruhuset",location:"Bauhaus, Malmö",latitude:55.561,longitude:13.0225,type:"sponsored",sponsor:"Bauhaus",sponsorEmoji:"🏠",reward:260,themeColor:"#ea580c",gradient:"from-orange-500 to-amber-400",description:"Hemmafix dokumenterat"},{id:"electrolux-stockholm",title:"Framtidens Kök",location:"Electrolux HQ, Stockholm",latitude:59.3619,longitude:17.9852,type:"sponsored",sponsor:"Electrolux",sponsorEmoji:"🍳",reward:350,themeColor:"#1e3a8a",gradient:"from-blue-900 to-slate-600",description:"Svensk köksdesign"},{id:"husqvarna-jonkoping",title:"Trädgårdens Kraft",location:"Husqvarna, Jönköping",latitude:57.7826,longitude:14.1618,type:"sponsored",sponsor:"Husqvarna",sponsorEmoji:"🌿",reward:320,themeColor:"#f97316",gradient:"from-orange-500 to-green-500",description:"Trädgårdsredskap i action"},{id:"tetrapak-lund",title:"Hållbar Förpackning",location:"Tetra Pak, Lund",latitude:55.7047,longitude:13.191,type:"sponsored",sponsor:"Tetra Pak",sponsorEmoji:"🥛",reward:380,themeColor:"#0369a1",gradient:"from-sky-600 to-blue-400",description:"Innovation inom förpackning"},{id:"bonniers-konsthall",title:"Konst & Kultur",location:"Bonniers Konsthall, Stockholm",latitude:59.3434,longitude:18.025,type:"sponsored",sponsor:"Bonniers",sponsorEmoji:"🎨",reward:300,themeColor:"#0f172a",gradient:"from-slate-900 to-indigo-600",description:"Konstupplevelser dokumenterade"},{id:"storaenso-skoghall",title:"Hållbart Skogsbruk",location:"Stora Enso, Skoghall",latitude:59.3213,longitude:13.468,type:"sponsored",sponsor:"Stora Enso",sponsorEmoji:"🌲",reward:350,themeColor:"#166534",gradient:"from-green-800 to-emerald-500",description:"Skogen som resurs"},{id:"essity-goteborg",title:"Hygien & Hälsa",location:"Essity, Mölndal",latitude:57.6556,longitude:12.0136,type:"sponsored",sponsor:"Essity",sponsorEmoji:"🧴",reward:280,themeColor:"#0891b2",gradient:"from-cyan-600 to-blue-400",description:"Vardagens hygien"},{id:"securitas-stockholm",title:"Trygghet i Staden",location:"Securitas, Stockholm",latitude:59.3406,longitude:18.047,type:"sponsored",sponsor:"Securitas",sponsorEmoji:"🛡️",reward:320,themeColor:"#0f172a",gradient:"from-slate-800 to-blue-700",description:"Säkerhetstjänster i fokus"},{id:"clasohlson-insjön",title:"Praktiska Lösningar",location:"Clas Ohlson, Insjön",latitude:60.6892,longitude:15.0653,type:"sponsored",sponsor:"Clas Ohlson",sponsorEmoji:"🔧",reward:300,themeColor:"#15803d",gradient:"from-green-700 to-lime-400",description:"Originalet från Insjön"},{id:"clasohlson-stockholm",title:"Fixa Själv",location:"Clas Ohlson, Sergels Torg",latitude:59.3328,longitude:18.0651,type:"sponsored",sponsor:"Clas Ohlson",sponsorEmoji:"🪛",reward:250,themeColor:"#15803d",gradient:"from-green-600 to-emerald-400",description:"Vardagshjältar i butik"},{id:"gekas-ullared",title:"Handelsfenomenet",location:"Gekås, Ullared",latitude:57.1285,longitude:12.7205,type:"sponsored",sponsor:"Gekås",sponsorEmoji:"🛒",reward:350,themeColor:"#fbbf24",gradient:"from-yellow-500 to-orange-500",description:"Skandinaviens största varuhus"},{id:"ssab-lulea",title:"Fossilfritt Stål",location:"SSAB, Luleå",latitude:65.5848,longitude:22.14,type:"sponsored",sponsor:"SSAB",sponsorEmoji:"⚙️",reward:400,themeColor:"#0f172a",gradient:"from-slate-900 to-orange-600",description:"Grön stålproduktion HYBRIT"},{id:"norrmejerier-umea",title:"Norrlänsk Mjölk",location:"Norrmejerier, Umeå",latitude:63.8258,longitude:20.263,type:"sponsored",sponsor:"Norrmejerier",sponsorEmoji:"🥛",reward:260,themeColor:"#3b82f6",gradient:"from-blue-500 to-sky-400",description:"Mjölk från norra Sverige"},{id:"br-leksaker-stockholm",title:"Lekens Värld",location:"BR Leksaker, Mall of Scandinavia",latitude:59.37,longitude:18.004,type:"sponsored",sponsor:"BR Leksaker",sponsorEmoji:"🧸",reward:220,themeColor:"#dc2626",gradient:"from-red-500 to-pink-500",description:"Barnens favoritbutik"},{id:"netonnet-lagershop",title:"Teknik för Alla",location:"NetOnNet, Ullared",latitude:57.129,longitude:12.721,type:"sponsored",sponsor:"NetOnNet",sponsorEmoji:"📺",reward:280,themeColor:"#0ea5e9",gradient:"from-sky-500 to-blue-500",description:"Elektronik till lagerpriser"},{id:"jula-skoevde",title:"Gör det Själv",location:"Jula, Skövde",latitude:58.3907,longitude:13.8457,type:"sponsored",sponsor:"Jula",sponsorEmoji:"🔩",reward:260,themeColor:"#fbbf24",gradient:"from-yellow-400 to-amber-500",description:"Verktyg och praktiska produkter"},{id:"stadium-stockholm",title:"Sportglädjen",location:"Stadium, Gallerian Stockholm",latitude:59.3322,longitude:18.0672,type:"sponsored",sponsor:"Stadium",sponsorEmoji:"⚽",reward:280,themeColor:"#dc2626",gradient:"from-red-600 to-orange-400",description:"Sport för alla"},{id:"xxl-barkarby",title:"Äventyr Väntar",location:"XXL, Barkarby",latitude:59.417,longitude:17.8557,type:"sponsored",sponsor:"XXL",sponsorEmoji:"🏔️",reward:300,themeColor:"#059669",gradient:"from-emerald-600 to-green-400",description:"Friluftsliv och sport"}];function cre(){const n=Y.useMemo(()=>lre,[]),t=Y.useMemo(()=>n.filter(h=>h.type==="charity"),[n]),s=Y.useMemo(()=>n.filter(h=>h.type==="sponsored"),[n]);return{realChangeMissions:n,charityMissions:t,sponsoredMissions:s}}function ure(n){const t=n.toLowerCase();return t.includes("livboj")||t.includes("lifebuoy")||t.includes("life ring")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="12" cy="12" r="10" fill="rgba(255,255,255,0.15)"/>
|
||
<circle cx="12" cy="12" r="4" fill="rgba(255,100,100,0.3)"/>
|
||
<path d="m4.93 4.93 4.24 4.24" stroke-width="2.5"/>
|
||
<path d="m14.83 14.83 4.24 4.24" stroke-width="2.5"/>
|
||
<path d="m14.83 9.17 4.24-4.24" stroke-width="2.5"/>
|
||
<path d="m4.93 19.07 4.24-4.24" stroke-width="2.5"/>
|
||
</svg>`,gradient:"hsl(4 85% 55%)",gradientDark:"hsl(4 85% 42%)"}:t.includes("räddningsstation")||t.includes("rescue station")||t.includes("livräddning")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M8 2h8l4 10H4L8 2Z" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M12 12v10"/>
|
||
<path d="M4 22h16"/>
|
||
<path d="M12 2v2"/>
|
||
<circle cx="12" cy="7" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(350 75% 52%)",gradientDark:"hsl(350 75% 40%)"}:t.includes("nödtelefon")||t.includes("emergency phone")||t.includes("sos")||t.includes("larmtelefon")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="5" y="2" width="14" height="20" rx="2" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M12 18h.01"/>
|
||
<path d="M9 6h6"/>
|
||
<path d="M9 10h6"/>
|
||
<path d="M8 14l2 2 4-4" stroke-width="2.5"/>
|
||
</svg>`,gradient:"hsl(0 85% 50%)",gradientDark:"hsl(0 85% 38%)"}:t.includes("brygga")||t.includes("pier")||t.includes("kaj")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M2 17c6.667-6 13.333 0 20-6" stroke-width="2.5" opacity="0.6"/>
|
||
<path d="M2 21c6.667-6 13.333 0 20-6" stroke-width="2"/>
|
||
<rect x="8" y="4" width="8" height="10" rx="1" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M10 4v10"/>
|
||
<path d="M14 4v10"/>
|
||
</svg>`,gradient:"hsl(200 75% 48%)",gradientDark:"hsl(200 75% 38%)"}:t.includes("strand")||t.includes("beach")||t.includes("bad")||t.includes("vatten")||t.includes("sjö")||t.includes("lake")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1" stroke-width="2.5"/>
|
||
<path d="M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>
|
||
<path d="M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>
|
||
</svg>`,gradient:"hsl(195 85% 48%)",gradientDark:"hsl(195 85% 38%)"}:t.includes("stege")||t.includes("ladder")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M8 3v18"/>
|
||
<path d="M16 3v18"/>
|
||
<path d="M8 6h8"/>
|
||
<path d="M8 10h8"/>
|
||
<path d="M8 14h8"/>
|
||
<path d="M8 18h8"/>
|
||
</svg>`,gradient:"hsl(35 75% 52%)",gradientDark:"hsl(35 75% 40%)"}:t.includes("utegym")||t.includes("outdoor gym")||t.includes("gym")||t.includes("träning")||t.includes("fitness")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M6.5 6.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M2 22v-5l4-1v-5l4 2 4-2v5l4 1v5"/>
|
||
<path d="M6 11V6.5"/>
|
||
<path d="M18 11V6.5"/>
|
||
<rect x="15.5" y="2" width="5" height="4" rx="1" fill="rgba(255,255,255,0.2)"/>
|
||
</svg>`,gradient:"hsl(145 70% 42%)",gradientDark:"hsl(145 70% 32%)"}:t.includes("fotboll")||t.includes("football")||t.includes("soccer")||t.includes("fotbollsplan")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="12" cy="12" r="10" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="M12 2a10 10 0 0 0-7.07 2.93"/>
|
||
<path d="M12 2a10 10 0 0 1 7.07 2.93"/>
|
||
<path d="M2 12a10 10 0 0 0 2.93 7.07"/>
|
||
<path d="M22 12a10 10 0 0 1-2.93 7.07"/>
|
||
<path d="M12 22a10 10 0 0 1-7.07-2.93"/>
|
||
<path d="M12 22a10 10 0 0 0 7.07-2.93"/>
|
||
<polygon points="12,7 15,10 14,14 10,14 9,10" fill="rgba(0,0,0,0.3)" stroke="white"/>
|
||
</svg>`,gradient:"hsl(120 60% 38%)",gradientDark:"hsl(120 60% 28%)"}:t.includes("tennis")||t.includes("padel")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="10" cy="10" r="7" fill="rgba(200,255,0,0.25)"/>
|
||
<path d="M10 3a7 7 0 0 0 0 14"/>
|
||
<path d="M3 10a7 7 0 0 0 14 0"/>
|
||
<path d="m18 18 3 3"/>
|
||
<path d="m15 15 2 2"/>
|
||
</svg>`,gradient:"hsl(75 85% 45%)",gradientDark:"hsl(75 85% 35%)"}:t.includes("basket")||t.includes("basketball")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="12" cy="12" r="10" fill="rgba(255,120,0,0.25)"/>
|
||
<path d="M12 2v20"/>
|
||
<path d="M2 12h20"/>
|
||
<path d="M4.93 4.93c4.08 4.08 10.06 4.08 14.14 0"/>
|
||
<path d="M4.93 19.07c4.08-4.08 10.06-4.08 14.14 0"/>
|
||
</svg>`,gradient:"hsl(25 90% 52%)",gradientDark:"hsl(25 90% 40%)"}:t.includes("golf")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M12 18V2l7 4-7 4"/>
|
||
<path d="M8 22c2.2 0 4-1.8 4-4"/>
|
||
<circle cx="6" cy="20" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(140 50% 40%)",gradientDark:"hsl(140 50% 30%)"}:t.includes("lekplats")||t.includes("playground")||t.includes("lek")||t.includes("gungor")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M4 22V6l8-4 8 4v16"/>
|
||
<path d="M4 12h16"/>
|
||
<path d="M8 12v6"/>
|
||
<path d="M16 12v6"/>
|
||
<circle cx="8" cy="20" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
<circle cx="16" cy="20" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(45 90% 52%)",gradientDark:"hsl(45 90% 42%)"}:t.includes("löpar")||t.includes("running")||t.includes("track")||t.includes("bana")||t.includes("sprint")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="17" cy="5" r="3" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="m4 17 4-4 3 3 5-7 4 4"/>
|
||
<path d="M22 21H2"/>
|
||
</svg>`,gradient:"hsl(10 80% 55%)",gradientDark:"hsl(10 80% 42%)"}:t.includes("skate")||t.includes("skridskor")||t.includes("skridsko")||t.includes("rink")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M5 20a1 1 0 1 0 2 0 1 1 0 1 0-2 0"/>
|
||
<path d="M17 20a1 1 0 1 0 2 0 1 1 0 1 0-2 0"/>
|
||
<path d="M6 20h12"/>
|
||
<path d="m6 16 2-10h8l2 10"/>
|
||
<path d="M10 6v4"/>
|
||
<path d="M14 6v4"/>
|
||
</svg>`,gradient:"hsl(210 80% 55%)",gradientDark:"hsl(210 80% 42%)"}:t.includes("staty")||t.includes("statue")||t.includes("monument")||t.includes("skulptur")||t.includes("sculpture")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="12" cy="5" r="3" fill="rgba(255,255,255,0.25)"/>
|
||
<path d="M12 8v6"/>
|
||
<path d="M8 10l4 4 4-4"/>
|
||
<path d="M9 14l-2 8"/>
|
||
<path d="M15 14l2 8"/>
|
||
<path d="M6 22h12"/>
|
||
</svg>`,gradient:"hsl(280 50% 55%)",gradientDark:"hsl(280 50% 42%)"}:t.includes("mural")||t.includes("väggmålning")||t.includes("graffiti")||t.includes("gatukonst")||t.includes("street art")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="3" y="3" width="18" height="18" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="M9 3v18"/>
|
||
<path d="M15 3v18"/>
|
||
<path d="M3 9h18"/>
|
||
<path d="M3 15h18"/>
|
||
<circle cx="12" cy="12" r="2" fill="rgba(255,100,255,0.4)"/>
|
||
</svg>`,gradient:"hsl(330 70% 55%)",gradientDark:"hsl(330 70% 42%)"}:t.includes("museum")||t.includes("galleri")||t.includes("gallery")||t.includes("utställning")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M3 22h18"/>
|
||
<path d="M6 22V8l6-4 6 4v14"/>
|
||
<path d="M12 4v4"/>
|
||
<path d="M9 10h6"/>
|
||
<rect x="9" y="14" width="6" height="4" fill="rgba(255,255,255,0.2)"/>
|
||
</svg>`,gradient:"hsl(35 60% 50%)",gradientDark:"hsl(35 60% 38%)"}:t.includes("kyrka")||t.includes("church")||t.includes("katedral")||t.includes("cathedral")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M12 2v4"/>
|
||
<path d="M9 4h6"/>
|
||
<path d="M4 22V10l8-4 8 4v12"/>
|
||
<path d="M10 22v-6h4v6"/>
|
||
<circle cx="12" cy="12" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(260 45% 50%)",gradientDark:"hsl(260 45% 38%)"}:t.includes("fontän")||t.includes("fountain")||t.includes("springbrunn")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M12 3v3"/>
|
||
<path d="M8 6c0-2 4-2 4-2s4 0 4 2"/>
|
||
<path d="M6 14c0 4 6 6 6 6s6-2 6-6"/>
|
||
<path d="M12 6c-2 2-2 4-2 6"/>
|
||
<path d="M12 6c2 2 2 4 2 6"/>
|
||
<ellipse cx="12" cy="20" rx="8" ry="2" fill="rgba(100,200,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(200 85% 52%)",gradientDark:"hsl(200 85% 40%)"}:t.includes("skylt")||t.includes("sign")||t.includes("tavla")||t.includes("information")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="3" y="4" width="18" height="10" rx="2" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M12 14v8"/>
|
||
<path d="M8 22h8"/>
|
||
<path d="M7 8h10"/>
|
||
<path d="M7 11h6"/>
|
||
</svg>`,gradient:"hsl(220 75% 52%)",gradientDark:"hsl(220 75% 40%)"}:t.includes("byggnad")||t.includes("building")||t.includes("fasad")||t.includes("facade")||t.includes("hus")||t.includes("house")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="4" y="2" width="16" height="20" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="M9 22v-4h6v4"/>
|
||
<rect x="7" y="5" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
<rect x="14" y="5" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
<rect x="7" y="11" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
<rect x="14" y="11" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
</svg>`,gradient:"hsl(220 40% 50%)",gradientDark:"hsl(220 40% 38%)"}:t.includes("butik")||t.includes("store")||t.includes("shop")||t.includes("affär")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M3 9h18v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9Z" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9"/>
|
||
<path d="M12 3v6"/>
|
||
<rect x="8" y="13" width="8" height="6" rx="1" fill="rgba(100,200,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(280 55% 52%)",gradientDark:"hsl(280 55% 40%)"}:t.includes("restaurang")||t.includes("restaurant")||t.includes("mat")||t.includes("food")||t.includes("cafe")||t.includes("kafé")||t.includes("meny")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"/>
|
||
<path d="M7 2v20"/>
|
||
<path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"/>
|
||
<circle cx="7" cy="17" r="2" fill="rgba(255,255,255,0.2)"/>
|
||
</svg>`,gradient:"hsl(25 85% 52%)",gradientDark:"hsl(25 85% 40%)"}:t.includes("parkering")||t.includes("parking")||t.includes("garage")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="4" y="4" width="16" height="16" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="M9 17V7h4a3 3 0 0 1 0 6H9"/>
|
||
</svg>`,gradient:"hsl(210 75% 52%)",gradientDark:"hsl(210 75% 40%)"}:t.includes("bil")||t.includes("car")||t.includes("fordon")||t.includes("vehicle")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<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.5 2.8C1.4 11.3 1 12.1 1 13v3c0 .6.4 1 1 1h2" fill="rgba(255,255,255,0.15)"/>
|
||
<circle cx="7" cy="17" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
<path d="M9 17h6"/>
|
||
<circle cx="17" cy="17" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
</svg>`,gradient:"hsl(215 70% 52%)",gradientDark:"hsl(215 70% 40%)"}:t.includes("träd")||t.includes("tree")||t.includes("park")||t.includes("natur")||t.includes("nature")||t.includes("skog")||t.includes("forest")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="m17 14-5-8-5 8h3v6h4v-6h3Z" fill="rgba(100,200,100,0.3)"/>
|
||
<path d="M12 22v-4"/>
|
||
<path d="m17 8-5-6-5 6"/>
|
||
</svg>`,gradient:"hsl(140 65% 40%)",gradientDark:"hsl(140 65% 30%)"}:t.includes("blomma")||t.includes("flower")||t.includes("trädgård")||t.includes("garden")||t.includes("rabatt")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M12 7.5a4.5 4.5 0 1 1 4.5 4.5M12 7.5A4.5 4.5 0 1 0 7.5 12M12 7.5V9m-4.5 3a4.5 4.5 0 1 0 4.5 4.5M7.5 12H9m7.5 0a4.5 4.5 0 1 1-4.5 4.5m4.5-4.5H15m-3 4.5V15"/>
|
||
<circle cx="12" cy="12" r="3" fill="rgba(255,200,100,0.4)"/>
|
||
<path d="M12 22v-6"/>
|
||
</svg>`,gradient:"hsl(340 70% 55%)",gradientDark:"hsl(340 70% 42%)"}:t.includes("fågel")||t.includes("bird")||t.includes("djur")||t.includes("animal")||t.includes("wildlife")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M16 7h.01"/>
|
||
<path d="M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20"/>
|
||
<path d="m20 7 2 .5-2 .5"/>
|
||
<path d="M10 18v3"/>
|
||
<path d="M14 17.75V21"/>
|
||
<path d="M7 18a6 6 0 0 0 3.84-10.61"/>
|
||
</svg>`,gradient:"hsl(30 70% 50%)",gradientDark:"hsl(30 70% 38%)"}:t.includes("event")||t.includes("händelse")||t.includes("festival")||t.includes("konsert")||t.includes("marknad")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="3" y="4" width="18" height="18" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="M16 2v4"/>
|
||
<path d="M8 2v4"/>
|
||
<path d="M3 10h18"/>
|
||
<path d="m9 16 2 2 4-4"/>
|
||
</svg>`,gradient:"hsl(320 75% 52%)",gradientDark:"hsl(320 75% 40%)"}:t.includes("utrymningsväg")||t.includes("emergency exit")||t.includes("nödutgång")||t.includes("utrymning")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="3" y="3" width="18" height="18" rx="2" fill="rgba(0,200,0,0.25)"/>
|
||
<path d="M9 3v18"/>
|
||
<path d="m16 8-4 4 4 4"/>
|
||
<path d="M12 12h6"/>
|
||
<circle cx="6" cy="8" r="1.5" fill="rgba(255,255,255,0.4)"/>
|
||
<path d="M5 10v6l2 2"/>
|
||
<path d="M7 10v4"/>
|
||
</svg>`,gradient:"hsl(145 80% 38%)",gradientDark:"hsl(145 80% 28%)"}:t.includes("räcke")||t.includes("railing")||t.includes("ledstång")||t.includes("handledare")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M4 6h16"/>
|
||
<path d="M4 6v12"/>
|
||
<path d="M10 6v12"/>
|
||
<path d="M16 6v12"/>
|
||
<path d="M22 6v12"/>
|
||
<path d="M4 18h18"/>
|
||
</svg>`,gradient:"hsl(220 30% 50%)",gradientDark:"hsl(220 30% 38%)"}:t.includes("bro")||t.includes("bridge")||t.includes("viadukt")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M4 10c0-4 4-6 8-6s8 2 8 6" stroke-width="2.5"/>
|
||
<path d="M4 10v8"/>
|
||
<path d="M20 10v8"/>
|
||
<path d="M2 18h20"/>
|
||
<path d="M8 10v8"/>
|
||
<path d="M12 10v8"/>
|
||
<path d="M16 10v8"/>
|
||
</svg>`,gradient:"hsl(35 50% 45%)",gradientDark:"hsl(35 50% 35%)"}:t.includes("kaj")||t.includes("quay")||t.includes("hamn")||t.includes("harbor")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="2" y="8" width="20" height="6" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M2 14h20"/>
|
||
<path d="M6 8V4"/>
|
||
<path d="M18 8V4"/>
|
||
<circle cx="6" cy="3" r="1" fill="rgba(255,255,255,0.4)"/>
|
||
<circle cx="18" cy="3" r="1" fill="rgba(255,255,255,0.4)"/>
|
||
<path d="M2 18c2-2 4-2 6 0s4 2 6 0 4-2 6 0"/>
|
||
</svg>`,gradient:"hsl(210 60% 45%)",gradientDark:"hsl(210 60% 35%)"}:t.includes("cykelställ")||t.includes("bicycle rack")||t.includes("bike rack")||t.includes("cykelparkering")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="5.5" cy="17.5" r="3.5" fill="rgba(255,255,255,0.15)"/>
|
||
<circle cx="18.5" cy="17.5" r="3.5" fill="rgba(255,255,255,0.15)"/>
|
||
<circle cx="15" cy="5" r="1"/>
|
||
<path d="M12 17.5V14l-3-3 4-3 2 3h3"/>
|
||
<path d="m5.5 17.5 5-7"/>
|
||
<path d="m18.5 17.5-3-8"/>
|
||
</svg>`,gradient:"hsl(180 60% 42%)",gradientDark:"hsl(180 60% 32%)"}:t.includes("elskåp")||t.includes("teknikskåp")||t.includes("electrical cabinet")||t.includes("kopplingsskåp")||t.includes("transformator")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="4" y="2" width="16" height="20" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
<path d="M4 10h16"/>
|
||
<path d="M12 10v12"/>
|
||
<circle cx="8" cy="6" r="1.5" fill="rgba(255,200,0,0.5)"/>
|
||
<circle cx="16" cy="6" r="1.5" fill="rgba(100,255,100,0.5)"/>
|
||
<path d="M9 14l2 3-2 3"/>
|
||
<path d="M15 14l-2 3 2 3"/>
|
||
</svg>`,gradient:"hsl(45 80% 45%)",gradientDark:"hsl(45 80% 35%)"}:t.includes("handikappramp")||t.includes("ramp")||t.includes("handicap")||t.includes("tillgänglighet")||t.includes("accessibility")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<circle cx="12" cy="5" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
<path d="M12 7v5"/>
|
||
<circle cx="9" cy="19" r="2" fill="rgba(255,255,255,0.2)"/>
|
||
<circle cx="17" cy="19" r="2" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M9 17h5l3 2"/>
|
||
<path d="M9 12h6"/>
|
||
<path d="M2 20l6-8"/>
|
||
<path d="M22 20H20"/>
|
||
</svg>`,gradient:"hsl(210 80% 50%)",gradientDark:"hsl(210 80% 38%)"}:t.includes("brandpost")||t.includes("fire hydrant")||t.includes("hydrant")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="7" y="8" width="10" height="14" rx="2" fill="rgba(255,50,50,0.3)"/>
|
||
<path d="M9 8V6a3 3 0 0 1 6 0v2"/>
|
||
<path d="M5 13h2"/>
|
||
<path d="M17 13h2"/>
|
||
<circle cx="12" cy="14" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
<path d="M10 22h4"/>
|
||
</svg>`,gradient:"hsl(0 80% 50%)",gradientDark:"hsl(0 80% 38%)"}:t.includes("bänk")||t.includes("bench")||t.includes("sittplats")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<rect x="3" y="10" width="18" height="3" rx="1" fill="rgba(255,255,255,0.2)"/>
|
||
<path d="M5 13v6"/>
|
||
<path d="M19 13v6"/>
|
||
<path d="M3 10V8c0-1 1-2 3-2h12c2 0 3 1 3 2v2"/>
|
||
<path d="M3 19h18"/>
|
||
</svg>`,gradient:"hsl(25 50% 45%)",gradientDark:"hsl(25 50% 35%)"}:t.includes("papperskorg")||t.includes("soptunna")||t.includes("trash")||t.includes("bin")||t.includes("avfall")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M3 6h18"/>
|
||
<path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
|
||
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/>
|
||
<path d="M10 11v6"/>
|
||
<path d="M14 11v6"/>
|
||
</svg>`,gradient:"hsl(100 40% 40%)",gradientDark:"hsl(100 40% 30%)"}:t.includes("belysning")||t.includes("lyktstolpe")||t.includes("street light")||t.includes("lampa")||t.includes("lantern")?{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M12 2v4"/>
|
||
<path d="M12 22v-6"/>
|
||
<path d="M8 6h8l-1 8H9L8 6Z" fill="rgba(255,220,100,0.4)"/>
|
||
<path d="M9 14h6"/>
|
||
<path d="M5 4l2 2"/>
|
||
<path d="M19 4l-2 2"/>
|
||
</svg>`,gradient:"hsl(45 90% 50%)",gradientDark:"hsl(45 90% 38%)"}:{svg:`<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" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z" fill="rgba(255,255,255,0.15)"/>
|
||
<circle cx="12" cy="13" r="3" fill="rgba(255,255,255,0.2)"/>
|
||
</svg>`,gradient:"hsl(168 55% 45%)",gradientDark:"hsl(168 55% 35%)"}}function dre(n={}){const{enabled:t=!0,autoNavigate:s=!0}=n,[h,g]=Y.useState(!1),[v,E]=Y.useState(!1),[c,T]=Y.useState("idle"),[L,B]=Y.useState(null),[U,H]=Y.useState(null),X=Y.useRef(null),ae=Y.useRef(null),ne=Y.useCallback(()=>{X.current&&(X.current.pause(),X.current=null,E(!1))},[]),me=Y.useCallback(async(De,He,nt)=>{if(!(!t||De==="idle")){ne(),g(!0),T(De);try{const Xe=await fetch("undefined/functions/v1/voice-guide",{method:"POST",headers:{"Content-Type":"application/json",apikey:void 0,Authorization:"Bearer undefined"},body:JSON.stringify({state:De,missionTitle:He.missionTitle,distanceMeters:He.distanceMeters,targetDescription:He.targetDescription,instructions:He.instructions,criticalElements:He.criticalElements,sponsorReward:He.sponsorReward,sponsorBrand:He.sponsorBrand,camera:He.camera,position:He.position,voiceId:nt})});if(!Xe.ok){if(Xe.status===429){Jo.error("Röstguide tillfälligt otillgänglig, försök igen om en stund");return}if(Xe.status===402){Jo.error("AI-krediter slut");return}throw new Error(`Voice guide request failed: ${Xe.status}`)}const ft=decodeURIComponent(Xe.headers.get("X-Generated-Text")||"");H(ft);const At=await Xe.blob(),Bt=URL.createObjectURL(At),Dt=new Audio(Bt);X.current=Dt,Dt.onplay=()=>E(!0),Dt.onended=()=>{E(!1),B(De),URL.revokeObjectURL(Bt),X.current=null},Dt.onerror=()=>{E(!1),URL.revokeObjectURL(Bt),X.current=null},await Dt.play()}catch(Xe){console.error("Voice guide error:",Xe),Jo.error("Kunde inte spela röstguide")}finally{g(!1)}}},[t,ne]),oe=Y.useCallback((De,He)=>{if(!s||!t)return;const nt=ae.current;ae.current=De;let Xe="navigation";De<=10?Xe="photo":De<=50&&(Xe="positioning");const ft=Xe!==c,At=nt!==null&&c==="navigation"&&Math.abs(De-nt)>100;(ft||At)&&(Xe!==L||At)&&me(Xe,{...He,distanceMeters:De})},[s,t,c,L,me]),re=Y.useCallback(De=>{me("completion",De)},[me]),he=Y.useCallback(De=>{De.sponsorReward&&De.sponsorBrand&&me("sponsor",De)},[me]),_e=Y.useCallback((De,He)=>{me(De,He)},[me]);return Y.useEffect(()=>()=>{ne()},[ne]),{speak:me,stop:ne,updateNavigation:oe,speakCompletion:re,speakSponsorReward:he,triggerState:_e,isLoading:h,isPlaying:v,currentState:c,lastSpokenText:U,enabled:t}}const hre={idle:"Starta röstguide",navigation:"Navigerar...",positioning:"Positionering...",photo:"Fotoinstruktion...",completion:"Slutför...",sponsor:"Belöning..."};function fre({isLoading:n,isPlaying:t,currentState:s,onPlay:h,onStop:g,className:v,showLabel:E=!1}){const c=()=>{t?g():h()};return ue.jsxs(ol,{variant:t?"default":"outline",size:E?"sm":"icon",onClick:c,disabled:n,className:fi("transition-all gap-2",t&&"bg-primary animate-pulse",v),children:[n?ue.jsx(rT,{className:"h-4 w-4 animate-spin"}):t?ue.jsx(PW,{className:"h-4 w-4"}):ue.jsx(MW,{className:"h-4 w-4"}),E&&ue.jsx("span",{className:"text-xs",children:n?"Laddar...":t?hre[s]:"Röstguide"})]})}function pre(){const{t:n}=nm(),[t,s]=Y.useState({heading:null,accuracy:null,error:null,supported:!1,permissionGranted:!1}),h=Y.useCallback(async()=>{if(typeof DeviceOrientationEvent.requestPermission=="function")try{return await DeviceOrientationEvent.requestPermission()==="granted"?(s(v=>({...v,permissionGranted:!0,error:null})),!0):(s(v=>({...v,error:n("compass.permissionDenied"),permissionGranted:!1})),!1)}catch{return s(v=>({...v,error:n("compass.couldNotRequest")})),!1}return s(g=>({...g,permissionGranted:!0})),!0},[n]);return Y.useEffect(()=>{const g="DeviceOrientationEvent"in window;if(s(c=>({...c,supported:g})),!g){s(c=>({...c,error:n("compass.notSupported")}));return}const v=c=>{let T=null;"webkitCompassHeading"in c&&typeof c.webkitCompassHeading=="number"?T=c.webkitCompassHeading:(c.alpha!==null&&c.absolute||c.alpha!==null)&&(T=360-c.alpha),T!==null&&(T=(T%360+360)%360,s(L=>({...L,heading:T,accuracy:c.webkitCompassAccuracy??null,error:null,permissionGranted:!0})))};return(async()=>{typeof DeviceOrientationEvent.requestPermission=="function"?s(c=>({...c,permissionGranted:!1})):(window.addEventListener("deviceorientation",v,!0),s(c=>({...c,permissionGranted:!0})))})(),()=>{window.removeEventListener("deviceorientation",v,!0)}},[n]),Y.useEffect(()=>{if(!t.permissionGranted||!t.supported)return;const g=v=>{let E=null;"webkitCompassHeading"in v&&typeof v.webkitCompassHeading=="number"?E=v.webkitCompassHeading:v.alpha!==null&&(E=360-v.alpha),E!==null&&(E=(E%360+360)%360,s(c=>({...c,heading:E,accuracy:v.webkitCompassAccuracy??null,error:null})))};return window.addEventListener("deviceorientation",g,!0),()=>{window.removeEventListener("deviceorientation",g,!0)}},[t.permissionGranted,t.supported]),{...t,requestPermission:h}}function xA(n,t,s,h){const g=H=>H*Math.PI/180,v=H=>H*180/Math.PI,E=g(h-t),c=g(n),T=g(s),L=Math.sin(E)*Math.cos(T),B=Math.cos(c)*Math.sin(T)-Math.sin(c)*Math.cos(T)*Math.cos(E);let U=v(Math.atan2(L,B));return U=(U%360+360)%360,U}function mre(n,t,s,h){const g=H=>H*Math.PI/180,v=H=>H*180/Math.PI,E=g(h-t),c=g(n),T=g(s),L=Math.sin(E)*Math.cos(T),B=Math.cos(c)*Math.sin(T)-Math.sin(c)*Math.cos(T)*Math.cos(E);return(v(Math.atan2(L,B))+360)%360}function gre(n,t,s,h){const v=B=>B*Math.PI/180,E=v(s-n),c=v(h-t),T=Math.sin(E/2)*Math.sin(E/2)+Math.cos(v(n))*Math.cos(v(s))*Math.sin(c/2)*Math.sin(c/2);return 6371e3*(2*Math.atan2(Math.sqrt(T),Math.sqrt(1-T)))}function MU(n){const t=["N","NE","E","SE","S","SW","W","NW"],s=Math.round(n/45)%8;return t[s]}function _re(n){return{N:"Norr",NE:"Nordost",E:"Öster",SE:"Sydost",S:"Söder",SW:"Sydväst",W:"Väster",NW:"Nordväst"}[MU(n)]}function yre({userLocation:n,targetLocation:t,targetName:s,deviceHeading:h,className:g,style:v}){const E=Y.useMemo(()=>{if(!n||!t)return null;const c=gre(n.latitude,n.longitude,t.latitude,t.longitude),T=mre(n.latitude,n.longitude,t.latitude,t.longitude);let L=T;return h!==null&&(L=(T-h+360)%360,L>180&&(L-=360)),{distance:c,bearing:T,relativeBearing:L,cardinalDirection:MU(T),swedishDirection:_re(T),isOnTarget:c<5,isClose:c<20,isPointingRight:h!==null&&Math.abs(L)<15}},[n,t,h]);return!E||!n||!t?null:ue.jsxs("div",{className:fi("bg-card/95 backdrop-blur-md rounded-2xl shadow-xl border border-border p-4 animate-fade-in",g),style:v,children:[s&&ue.jsxs("div",{className:"flex items-center gap-2 mb-3 pb-3 border-b border-border/50",children:[ue.jsx(D4,{className:"w-4 h-4 text-primary"}),ue.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s})]}),ue.jsxs("div",{className:"flex items-center gap-4",children:[ue.jsxs("div",{className:"flex-1",children:[ue.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[ue.jsx(iT,{className:fi("w-4 h-4",E.isOnTarget?"text-green-500":E.isClose?"text-amber-500":"text-primary")}),ue.jsx("span",{className:"text-xs text-muted-foreground",children:"Avstånd"})]}),ue.jsx("div",{className:fi("text-2xl font-bold",E.isOnTarget?"text-green-500":E.isClose?"text-amber-500":"text-foreground"),children:E.isOnTarget?ue.jsxs("span",{className:"flex items-center gap-1",children:[ue.jsx("span",{children:"✓"}),ue.jsx("span",{className:"text-lg",children:"På plats"})]}):ES(E.distance)})]}),ue.jsx("div",{className:"w-px h-12 bg-border"}),ue.jsxs("div",{className:"flex-1",children:[ue.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[ue.jsx(vW,{className:"w-4 h-4 text-primary"}),ue.jsx("span",{className:"text-xs text-muted-foreground",children:"Riktning"})]}),ue.jsxs("div",{className:"flex items-center gap-2",children:[ue.jsx("span",{className:"text-2xl font-bold text-foreground",children:E.cardinalDirection}),ue.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(E.bearing),"°"]})]})]}),ue.jsx("div",{className:"w-px h-12 bg-border"}),ue.jsxs("div",{className:"flex flex-col items-center justify-center w-16",children:[ue.jsx("div",{className:fi("w-12 h-12 rounded-full flex items-center justify-center transition-all duration-300",E.isPointingRight?"bg-green-500/20 text-green-500":"bg-primary/20 text-primary"),children:ue.jsx(kC,{className:"w-6 h-6 transition-transform duration-300",style:{transform:h!==null?`rotate(${E.relativeBearing}deg)`:`rotate(${E.bearing-45}deg)`}})}),ue.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:E.isPointingRight?"Rätt!":E.swedishDirection})]})]}),ue.jsxs("div",{className:"mt-3 pt-3 border-t border-border/50",children:[ue.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:ue.jsx("div",{className:fi("h-full rounded-full transition-all duration-500",E.isOnTarget?"bg-green-500":E.isClose?"bg-amber-500":"bg-primary"),style:{width:`${Math.max(5,Math.min(100,100-E.distance/500*100))}%`}})}),ue.jsxs("div",{className:"flex justify-between mt-1",children:[ue.jsx("span",{className:"text-xs text-muted-foreground",children:"0m"}),ue.jsx("span",{className:"text-xs text-muted-foreground",children:"500m+"})]})]})]})}const vre="mapbox://styles/mapbox/navigation-night-v1",xre="mapbox://styles/mapbox/navigation-day-v1",J3=1.5,bre=4.5,wre=18,Sre=13;function eB(n){const t=Math.min(Math.max(n,0),60)/60;return J3+(bre-J3)*t}const P0=52,D0=-20,tB=[{name:"Södermalm",lat:59.315,lng:18.07,missions:127},{name:"Östermalm",lat:59.338,lng:18.089,missions:98},{name:"Kungsholmen",lat:59.332,lng:18.028,missions:85},{name:"Vasastan",lat:59.345,lng:18.052,missions:73},{name:"Gamla Stan",lat:59.3251,lng:18.0711,missions:156}];function nB(n){var t,s;try{const g=(s=(((t=n.getStyle())==null?void 0:t.layers)??[]).find(v=>{var E;return v.type==="symbol"&&((E=v.layout)==null?void 0:E["text-field"])}))==null?void 0:s.id;return n.getLayer("3d-buildings")||n.addLayer({id:"3d-buildings",source:"composite","source-layer":"building",filter:["==","extrude","true"],type:"fill-extrusion",minzoom:14,paint:{"fill-extrusion-color":"rgba(90, 95, 102, 1)","fill-extrusion-height":["get","height"],"fill-extrusion-base":["get","min_height"],"fill-extrusion-opacity":.92}},g),n.getLayer("sky")||n.addLayer({id:"sky",type:"sky",paint:{"sky-type":"atmosphere","sky-atmosphere-sun":[0,0],"sky-atmosphere-sun-intensity":8}}),!0}catch(h){return console.warn("Failed to enable 3D view",h),!1}}function rB(n){try{n.getLayer("3d-buildings")&&n.removeLayer("3d-buildings"),n.getLayer("sky")&&n.removeLayer("sky"),n.easeTo({pitch:0,bearing:0,duration:500})}catch(t){console.warn("Failed to disable 3D view",t)}}const PU=Y.forwardRef(({missions:n,userLocation:t,onMissionSelect:s,startAboveUser:h=!1,zoomToTarget:g=null,activeRoute:v=null,onStartNavigation:E,onClearNavigation:c,navigationLoading:T=!1,canStartNavigation:L=!1,isNavigating:B=!1,selectedTravelMode:U="walking",showHotspots:H=!0},X)=>{const{t:ae}=nm(),ne=Y_(),{resolvedTheme:me}=tQ(),{hotspots:oe}=are(),{realChangeMissions:re}=cre(),he=Y.useRef(null),_e=Y.useRef(null),De=Y.useRef([]),He=Y.useRef([]),nt=Y.useRef(null),Xe=Y.useRef(null),ft=Y.useRef(!0),At=Y.useRef(!1),[Bt,Dt]=Y.useState(!0),[It,kt]=Y.useState(null),[wt,Zt]=Y.useState(null),[zt,vt]=Y.useState(!1),[pt,Pt]=Y.useState(null),[An,bn]=Y.useState(0),[Vn,Mn]=Y.useState("walking"),[Tn,Wr]=Y.useState(null),[Kn,Ho]=Y.useState(!1),Ni=Y.useRef(!1),wo=Y.useRef(!1),$n=Y.useRef(!1),[Ar,pi]=Y.useState(!0),[zo,Tr]=Y.useState(!1),[ns,ma]=Y.useState(!1),So=pre(),Ci=dre({enabled:ns,autoNavigate:!1}),Or=Ar&&!zo,Vi=Y.useMemo(()=>!t||n.length===0?null:n.reduce((Ct,sn)=>Ct?(sn.distance??1/0)<(Ct.distance??1/0)?sn:Ct:sn,n[0]),[n,t]),To=Y.useMemo(()=>{if(n.length===0)return null;const Ct=.01,sn={};n.forEach(Fn=>{const hr=`${Math.floor(Fn.latitude/Ct)}_${Math.floor(Fn.longitude/Ct)}`;sn[hr]||(sn[hr]={lat:0,lng:0,count:0,missions:[]}),sn[hr].lat+=Fn.latitude,sn[hr].lng+=Fn.longitude,sn[hr].count++,sn[hr].missions.push(Fn)});let pn=null,jn=0;for(const Fn in sn)sn[Fn].count>jn&&(jn=sn[Fn].count,pn=sn[Fn]);return pn?{lat:pn.lat/pn.count,lng:pn.lng/pn.count,count:pn.count}:null},[n]),ys=()=>{!Vi||!_e.current||(Jo.info(`${ae("map.flyingToNearest")}: ${Vi.title}`,{description:ES(Vi.distance)+" "+ae("map.fromHere"),duration:3e3}),kt(Vi),_e.current.flyTo({center:[Vi.longitude,Vi.latitude],zoom:16,pitch:P0,bearing:D0,duration:2e3}))},za=()=>{!To||!_e.current||(Jo.info(ae("map.flyingToCluster"),{description:`${To.count} ${ae("map.missionsHere")}`,duration:3e3}),Wr({lat:To.lat,lng:To.lng}),setTimeout(()=>Wr(null),4e3),_e.current.flyTo({center:[To.lng,To.lat],zoom:13,pitch:60,bearing:D0,duration:2e3}))},Ec=()=>{if(!_e.current)return;const Ct=tB.reduce((sn,pn)=>pn.missions>sn.missions?pn:sn,tB[0]);Jo.info(`${ae("map.flyingToPopular")}: ${Ct.name}`,{description:`${ae("map.popularArea")} ${Ct.missions} ${ae("map.previousMissions")}`,duration:3e3}),_e.current.flyTo({center:[Ct.lng,Ct.lat],zoom:14.5,pitch:70,bearing:D0,duration:2e3})},oi=()=>{!_e.current||!t||(Kn?Jo.info(ae("map.mapUnlocked"),{duration:2e3}):(_e.current.flyTo({center:[t.longitude,t.latitude],zoom:16,pitch:Or?P0:0,duration:1e3}),Jo.info(ae("map.mapLocked"),{duration:2e3})),Ho(!Kn))},rs=Y.useCallback(()=>{const Ct=It||Vi;if(!Ct){Jo.error("Inget uppdrag valt");return}if(ns||ma(!0),Ci.isPlaying){Ci.stop();return}let sn;if(t){const hr=(Ct.latitude-t.latitude)*Math.PI/180,qr=(Ct.longitude-t.longitude)*Math.PI/180,ti=Math.sin(hr/2)*Math.sin(hr/2)+Math.cos(t.latitude*Math.PI/180)*Math.cos(Ct.latitude*Math.PI/180)*Math.sin(qr/2)*Math.sin(qr/2);sn=6371e3*(2*Math.atan2(Math.sqrt(ti),Math.sqrt(1-ti)))}let pn="navigation";sn!==void 0&&(sn<=10?pn="photo":sn<=50&&(pn="positioning"));const jn={missionTitle:Ct.title,distanceMeters:sn,targetDescription:Ct.target_description||void 0,instructions:Ct.instructions||void 0,camera:So.heading!==null&&t?{currentBearing:So.heading,targetBearing:xA(t.latitude,t.longitude,Ct.latitude,Ct.longitude)}:void 0,position:t?{userLatitude:t.latitude,userLongitude:t.longitude,targetLatitude:Ct.latitude,targetLongitude:Ct.longitude,positionError:sn}:void 0};Ci.triggerState(pn,jn)},[It,Vi,t,So.heading,Ci,ns]);Y.useEffect(()=>{if(!_e.current||!zt||!t||$n.current||g)return;$n.current=!0;const Ct=_e.current.getCenter(),sn=Math.abs(Ct.lat-t.latitude),pn=Math.abs(Ct.lng-t.longitude),jn=sn<.05&&pn<.05,Fn=setTimeout(()=>{!_e.current||!ft.current||_e.current.flyTo({center:[t.longitude,t.latitude],zoom:Sre,pitch:P0,bearing:D0,duration:jn?800:0,curve:1.4,easing:hr=>hr<.5?2*hr*hr:1-Math.pow(-2*hr+2,2)/2})},300);return()=>clearTimeout(Fn)},[zt,t,g]),Y.useEffect(()=>{!Kn||!_e.current||!t||!zt||_e.current.easeTo({center:[t.longitude,t.latitude],duration:500})},[Kn,t,zt]),Y.useEffect(()=>{if(!_e.current||!zt)return;const Ct=()=>{Ni.current=!0,Kn&&(Ho(!1),Jo.info(ae("map.mapUnlocked"),{duration:2e3}))},sn=()=>{Ni.current=!0},pn=()=>{if(!_e.current)return;const jn=_e.current.getPitch(),Fn=eB(jn);_e.current.setMinZoom(Fn),_e.current.getZoom()<Fn&&_e.current.easeTo({zoom:Fn,duration:300})};return _e.current.on("dragstart",Ct),_e.current.on("zoomstart",sn),_e.current.on("pitchend",pn),()=>{var jn,Fn,hr;(jn=_e.current)==null||jn.off("dragstart",Ct),(Fn=_e.current)==null||Fn.off("zoomstart",sn),(hr=_e.current)==null||hr.off("pitchend",pn)}},[zt,Kn]),Y.useEffect(()=>{if(!(!_e.current||!zt||!g||!ft.current)){if(v!=null&&v.geometry&&t){const Ct=setTimeout(()=>{var Fn;if(!ft.current||!_e.current)return;const sn=v.geometry.coordinates,pn=sn.length>1?sn[1]:sn[0],jn=xA(t.latitude,t.longitude,pn[1],pn[0]);(Fn=_e.current)==null||Fn.flyTo({center:[t.longitude,t.latitude],zoom:17,pitch:52,bearing:jn,duration:1400,curve:1.5})},200);return()=>clearTimeout(Ct)}if(v!=null&&v.geometry){const Ct=v.geometry.coordinates,sn=new rd.LngLatBounds;Ct.forEach(jn=>sn.extend(jn));const pn=setTimeout(()=>{var jn;!ft.current||!_e.current||(jn=_e.current)==null||jn.fitBounds(sn,{padding:{top:100,bottom:150,left:50,right:50},pitch:45,duration:2e3})},300);return()=>clearTimeout(pn)}_e.current.flyTo({center:[g.longitude,g.latitude],zoom:16,pitch:45,bearing:20,duration:1500,curve:1.2,easing:Ct=>Ct<.5?2*Ct*Ct:1-Math.pow(-2*Ct+2,2)/2})}},[zt,g,v,t]),Y.useEffect(()=>{if(!_e.current||!zt||!ft.current)return;const Ct=_e.current,sn="route-source",pn="route-layer",jn="route-outline-layer";try{Ct.getLayer(pn)&&Ct.removeLayer(pn),Ct.getLayer(jn)&&Ct.removeLayer(jn),Ct.getSource(sn)&&Ct.removeSource(sn)}catch{}if(v!=null&&v.geometry)return Ct.addSource(sn,{type:"geojson",data:{type:"Feature",properties:{},geometry:v.geometry}}),Ct.addLayer({id:jn,type:"line",source:sn,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#ffffff","line-width":10,"line-opacity":.8}}),Ct.addLayer({id:pn,type:"line",source:sn,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#8B7355","line-width":6,"line-opacity":1}}),()=>{try{Ct.getLayer(pn)&&Ct.removeLayer(pn),Ct.getLayer(jn)&&Ct.removeLayer(jn),Ct.getSource(sn)&&Ct.removeSource(sn)}catch{}}},[zt,v]),Y.useEffect(()=>{if(!_e.current||!zt||!H||!Bt||!ft.current||oe.length===0)return;const Ct=_e.current,sn="hotspots-source",pn="hotspots-heat";try{Ct.getLayer(pn)&&Ct.removeLayer(pn),Ct.getSource(sn)&&Ct.removeSource(sn)}catch{}const jn={type:"FeatureCollection",features:oe.map(Fn=>({type:"Feature",properties:{intensity:Fn.intensity_score},geometry:{type:"Point",coordinates:[Number(Fn.longitude),Number(Fn.latitude)]}}))};return Ct.addSource(sn,{type:"geojson",data:jn}),Ct.addLayer({id:pn,type:"heatmap",source:sn,paint:{"heatmap-weight":["interpolate",["linear"],["get","intensity"],0,0,100,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,15,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,255,0)",.2,"rgba(0,255,255,0.4)",.5,"rgba(0,255,0,0.6)",.8,"rgba(255,255,0,0.8)",1,"rgba(255,0,0,0.9)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,15,15,30],"heatmap-opacity":.7}},"waterway-label"),()=>{try{Ct.getLayer(pn)&&Ct.removeLayer(pn),Ct.getSource(sn)&&Ct.removeSource(sn)}catch{}}},[zt,oe,H,Bt]),Y.useEffect(()=>(ft.current=!0,()=>{ft.current=!1}),[]),Y.useEffect(()=>{if(!he.current||_e.current||At.current)return;At.current=!0;const Ct=!!g;return(async()=>{if(!ft.current){At.current=!1;return}try{ft.current&&Pt(null);const pn=await YV();if(!ft.current)return;if(!pn){ft.current&&Pt(ae("map.couldNotLoadMapToken"));return}const jn=rd.supported(),Fn=rd.supported({failIfMajorPerformanceCaveat:!0});if(!jn){Pt(ae("map.couldNotLoadMapWebGL"));return}Fn||console.warn("WebGL available but with major performance caveat; continuing anyway");const hr=me==="dark"?"mapbox/dark-v11":"mapbox/outdoors-v12";try{const Bn=new AbortController,Ur=window.setTimeout(()=>Bn.abort(),5e3),ni=`https://api.mapbox.com/styles/v1/${hr}?access_token=${encodeURIComponent(pn)}`,_o=await fetch(ni,{method:"GET",signal:Bn.signal});if(window.clearTimeout(Ur),!_o.ok){Pt(`${ae("map.couldNotLoadMapStyle")}: ${_o.status}`);return}}catch(Bn){console.error("Mapbox reachability check failed",Bn),Pt(ae("map.couldNotLoadMapNetwork"));return}rd.accessToken=pn;let qr=null;try{const Bn=localStorage.getItem("qz_last_position");if(Bn){const Ur=JSON.parse(Bn);Date.now()-Ur.ts<30*60*1e3&&(qr=[Ur.longitude,Ur.latitude])}}catch{}const ti=Ct?[g.longitude,g.latitude]:t?[t.longitude,t.latitude]:qr??[18.0686,59.3293],qs=Ct||t||qr?14:5,Ba=0,is=0,Ms=me==="dark"?vre:xre;_e.current=new rd.Map({container:he.current,style:Ms,center:ti,zoom:qs,pitch:Ba,bearing:is,minZoom:eB(Ba),maxZoom:wre,attributionControl:!1,logoPosition:"bottom-left"});const mi=()=>{var Bn;try{(Bn=_e.current)==null||Bn.resize()}catch{}};Xe.current=new ResizeObserver(()=>mi()),Xe.current.observe(he.current),window.addEventListener("resize",mi),window.addEventListener("orientationchange",mi);const ga=()=>{document.hidden||window.setTimeout(()=>mi(),250)};document.addEventListener("visibilitychange",ga);const Wo=_e.current.getCanvas(),_a=Bn=>{var Ur;(Ur=Bn.preventDefault)==null||Ur.call(Bn),console.error("Map WebGL context lost"),Pt(ae("map.mapLostContext"))};Wo.addEventListener("webglcontextlost",_a,{passive:!1}),_e.current.on("error",Bn=>{var ya,ss,Zs;const Ur=((ya=Bn==null?void 0:Bn.error)==null?void 0:ya.message)||ae("map.unknownMapError");console.error("Mapbox error",(Bn==null?void 0:Bn.error)??Bn);const ni=_e.current;((ss=ni==null?void 0:ni.loaded)==null?void 0:ss.call(ni))===!0||((Zs=ni==null?void 0:ni.isStyleLoaded)==null?void 0:Zs.call(ni))===!0||Pt(`${ae("map.couldNotLoadMap")}: ${Ur}`)});let zn=!1;const vr=()=>{zn||!ft.current||(zn=!0,ft.current&&vt(!0),requestAnimationFrame(()=>mi()))},et=Bn=>{var Ur;try{(((Ur=Bn.getStyle())==null?void 0:Ur.layers)??[]).forEach(_o=>{_o.id&&(_o.id.includes("road-number-shield")||_o.id.includes("road-exit-shield")||_o.id.includes("hwy-shield")||_o.id.includes("motorway-junction")||_o.id.includes("shield"))&&Bn.setLayoutProperty(_o.id,"visibility","none")})}catch(ni){console.warn("Failed to hide road distance labels",ni)}},ji=Bn=>{const Ur=nB(Bn);return Ur||(console.warn("3D layer failed – falling back to 2D mode"),Tr(!0),rB(Bn)),et(Bn),Ur},Eo=window.setTimeout(()=>{ft.current&&(console.error("Map load timed out"),ft.current&&(vt(!0),Pt(ae("map.mapLoadTimeout"))))},15e3);let ao=!1;const Bo=()=>{var Ur,ni,_o,ya,ss;if(ao)return;const Bn=_e.current;if(Bn)try{const Zs=((Ur=Bn.isStyleLoaded)==null?void 0:Ur.call(Bn))===!0,Wl=((ni=Bn.loaded)==null?void 0:ni.call(Bn))===!0;let ql=!1;if(Zs)try{ql=(((ss=(ya=(_o=Bn.getStyle)==null?void 0:_o.call(Bn))==null?void 0:ya.layers)==null?void 0:ss.length)??0)>0}catch{}(Zs||Wl||ql)&&(ao=!0,window.clearTimeout(Eo),ji(Bn),vr())}catch(Zs){console.warn("unblockIfLoaded check failed, will retry",Zs)}};_e.current.once("load",Bo),_e.current.on("styledata",Bo),_e.current.on("idle",Bo),_e.current.once("render",Bo);const Ui=window.setInterval(Bo,300);window.setTimeout(()=>window.clearInterval(Ui),15e3);const os=()=>{var Bn;try{(Bn=Xe.current)==null||Bn.disconnect(),Xe.current=null}catch{}window.removeEventListener("resize",mi),window.removeEventListener("orientationchange",mi),document.removeEventListener("visibilitychange",ga);try{Wo.removeEventListener("webglcontextlost",_a)}catch{}};_e.current.once("remove",os)}catch(pn){console.error("Map init failed",pn),ft.current&&Pt(ae("map.couldNotLoadMap"))}finally{At.current=!1}})(),()=>{var pn,jn,Fn;At.current=!1;try{De.current.forEach(hr=>hr.remove())}catch{}De.current=[];try{(pn=nt.current)==null||pn.remove()}catch{}nt.current=null;try{(jn=Xe.current)==null||jn.disconnect()}catch{}Xe.current=null;try{(Fn=_e.current)==null||Fn.remove()}catch{}_e.current=null}},[An]),Y.useEffect(()=>{if(!(!_e.current||!zt||!ft.current)){try{De.current.forEach(Ct=>Ct.remove())}catch{}if(De.current=[],n.forEach(Ct=>{var Fn,hr;const sn=document.createElement("div");if(sn.className="mission-marker",(Fn=Ct.sponsor)==null?void 0:Fn.logoUrl){const qr=((hr=Ct.sponsor)==null?void 0:hr.colorPrimary)||"#6366f1";sn.innerHTML=`
|
||
<div class="relative cursor-pointer transform transition-all duration-200 hover:scale-110 hover:-translate-y-0.5">
|
||
<div class="w-14 h-14 rounded-2xl flex items-center justify-center shadow-[0_6px_24px_rgba(0,0,0,0.5)] border-[3px] border-white overflow-hidden" style="background: white;">
|
||
<img
|
||
src="${Ct.sponsor.logoUrl}"
|
||
alt="${Ct.sponsor.brandName}"
|
||
class="w-full h-full object-contain p-1.5"
|
||
onerror="this.style.display='none'; this.parentElement.style.background='linear-gradient(145deg, ${qr}, ${qr}dd)'; this.parentElement.innerHTML='<span style=\\'font-size:20px;font-weight:bold;color:white;\\'>${Ct.sponsor.brandName.charAt(0)}</span>';"
|
||
/>
|
||
</div>
|
||
<div class="absolute -bottom-2.5 left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[8px] border-r-[8px] border-t-[11px] border-l-transparent border-r-transparent border-t-white" style="filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));"></div>
|
||
<div class="absolute -top-1.5 -right-1.5 text-white text-[10px] font-bold rounded-lg px-2 h-[22px] flex items-center justify-center shadow-[0_2px_8px_rgba(0,0,0,0.35)] whitespace-nowrap" style="background: linear-gradient(145deg, ${qr}, ${qr}cc); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
${Ct.reward_credits} krediter
|
||
</div>
|
||
<div class="absolute -bottom-6 left-1/2 transform -translate-x-1/2 text-[9px] font-semibold text-white bg-black/60 px-2 py-0.5 rounded-full whitespace-nowrap backdrop-blur-sm">
|
||
${Ct.sponsor.brandName}
|
||
</div>
|
||
</div>
|
||
`}else{const qr=ure(Ct.title);sn.innerHTML=`
|
||
<div class="relative cursor-pointer transform transition-all duration-200 hover:scale-110 hover:-translate-y-0.5">
|
||
<div class="w-12 h-12 rounded-xl flex items-center justify-center shadow-[0_4px_20px_rgba(0,0,0,0.4)] border-[2.5px] border-white/90" style="background: linear-gradient(145deg, ${qr.gradient} 0%, ${qr.gradientDark} 100%);">
|
||
${qr.svg}
|
||
</div>
|
||
<div class="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[7px] border-r-[7px] border-t-[10px] border-l-transparent border-r-transparent" style="border-top-color: ${qr.gradientDark}; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));"></div>
|
||
<div class="absolute -top-1.5 -right-1.5 text-white text-[10px] font-bold rounded-lg px-2 h-[22px] flex items-center justify-center shadow-[0_2px_8px_rgba(0,0,0,0.35)] whitespace-nowrap" style="background: linear-gradient(145deg, hsl(18 55% 55%) 0%, hsl(18 55% 45%) 100%); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
${Ct.reward_credits} krediter
|
||
</div>
|
||
</div>
|
||
`}if(sn.addEventListener("click",()=>{var qr;ft.current&&(kt(Ct),(qr=_e.current)==null||qr.flyTo({center:[Ct.longitude,Ct.latitude],zoom:15,pitch:60}))}),!_e.current||!ft.current)return;const jn=new rd.Marker(sn).setLngLat([Ct.longitude,Ct.latitude]).addTo(_e.current);De.current.push(jn)}),n.length>1&&!It&&!g&&!Ni.current&&!wo.current&&_e.current&&ft.current)try{wo.current=!0;const Ct=new rd.LngLatBounds;n.forEach(sn=>Ct.extend([sn.longitude,sn.latitude])),t&&Ct.extend([t.longitude,t.latitude]),_e.current.fitBounds(Ct,{padding:80,maxZoom:14,pitch:P0})}catch{}}},[n,zt]),Y.useEffect(()=>{if(!_e.current||!zt||!ft.current||!t)return;nt.current&&(nt.current.remove(),nt.current=null);const Ct=document.createElement("div");Ct.className="user-location-marker",Ct.innerHTML=`
|
||
<div class="relative flex items-center justify-center">
|
||
<!-- Outer pulsing glow ring (like Google Maps accuracy circle) -->
|
||
<div class="absolute w-24 h-24 rounded-full animate-ping" style="background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, rgba(59, 130, 246, 0) 70%); animation-duration: 2s;"></div>
|
||
|
||
<!-- Medium spotlight ring -->
|
||
<div class="absolute w-16 h-16 rounded-full" style="background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0) 70%); animation: user-pulse 3s ease-in-out infinite;"></div>
|
||
|
||
<!-- Inner glow -->
|
||
<div class="absolute w-10 h-10 rounded-full" style="background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, rgba(59, 130, 246, 0.1) 50%, transparent 70%);"></div>
|
||
|
||
<!-- User dot with sharp border -->
|
||
<div class="relative w-5 h-5 rounded-full shadow-[0_0_12px_rgba(59,130,246,0.8),0_2px_6px_rgba(0,0,0,0.4)]" style="background: linear-gradient(145deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%); border: 3px solid white;">
|
||
<!-- Inner bright spot for 3D effect -->
|
||
<div class="absolute top-0.5 left-0.5 w-1.5 h-1.5 rounded-full bg-white/60"></div>
|
||
</div>
|
||
|
||
<!-- Direction indicator arrow (optional - shows heading) -->
|
||
<div class="absolute -top-3 w-0 h-0 border-l-[5px] border-r-[5px] border-b-[8px] border-l-transparent border-r-transparent border-b-blue-500" style="filter: drop-shadow(0 -1px 2px rgba(0,0,0,0.3)); opacity: 0.9;"></div>
|
||
</div>
|
||
`,nt.current=new rd.Marker({element:Ct,anchor:"center"}).setLngLat([t.longitude,t.latitude]).addTo(_e.current)},[t,zt]),Y.useEffect(()=>{if(!(!_e.current||!zt||!ft.current)){try{He.current.forEach(Ct=>Ct.remove())}catch{}He.current=[],re.forEach(Ct=>{const sn=document.createElement("div");sn.className="beauty-mission-marker";const pn=Ct.type==="sponsored",jn=pn&&Ct.sponsorEmoji?`<span style="font-size: 16px;">${Ct.sponsorEmoji}</span>`:`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||
<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>
|
||
</svg>`,Fn=Ct.themeColor;if(sn.innerHTML=`
|
||
<div class="relative cursor-pointer transform transition-all duration-200 hover:scale-110 hover:-translate-y-0.5">
|
||
<div class="w-12 h-12 rounded-xl flex items-center justify-center shadow-[0_4px_20px_rgba(0,0,0,0.4)] border-[2.5px] border-white/90" style="background: linear-gradient(145deg, ${Fn}, ${Fn}dd);">
|
||
${jn}
|
||
</div>
|
||
<div class="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[7px] border-r-[7px] border-t-[10px] border-l-transparent border-r-transparent" style="border-top-color: ${Fn}; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));"></div>
|
||
<div class="absolute -top-1.5 -right-1.5 text-white text-[10px] font-bold rounded-lg px-2 h-[22px] flex items-center justify-center shadow-[0_2px_8px_rgba(0,0,0,0.35)] whitespace-nowrap" style="background: linear-gradient(145deg, ${Fn}, ${Fn}cc); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
${Ct.reward} krediter
|
||
</div>
|
||
${pn&&Ct.sponsor?`
|
||
<div class="absolute -bottom-6 left-1/2 transform -translate-x-1/2 text-[9px] font-semibold text-white px-2 py-0.5 rounded-md whitespace-nowrap shadow-[0_2px_8px_rgba(0,0,0,0.3)]" style="background: ${Fn}; border: 1px solid rgba(255,255,255,0.2);">
|
||
${Ct.sponsor}
|
||
</div>
|
||
`:""}
|
||
</div>
|
||
`,sn.addEventListener("click",()=>{var qr;ft.current&&(Zt(Ct),kt(null),(qr=_e.current)==null||qr.flyTo({center:[Ct.longitude,Ct.latitude],zoom:15,pitch:60}))}),!_e.current||!ft.current)return;const hr=new rd.Marker(sn).setLngLat([Ct.longitude,Ct.latitude]).addTo(_e.current);He.current.push(hr)})}},[re,zt]);const vs=()=>{var Ct,sn,pn;try{De.current.forEach(jn=>jn.remove()),De.current=[],He.current.forEach(jn=>jn.remove()),He.current=[],(Ct=nt.current)==null||Ct.remove(),nt.current=null,(sn=Xe.current)==null||sn.disconnect(),Xe.current=null,(pn=_e.current)==null||pn.remove(),_e.current=null}catch{}Pt(null),vt(!1),kt(null),Zt(null),bn(jn=>jn+1)};return ue.jsxs("div",{ref:X,className:"relative w-full h-full",children:[ue.jsx("div",{ref:he,className:"absolute inset-0"}),Tn&&ue.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 flex items-center justify-center",children:ue.jsxs("div",{className:"relative",children:[ue.jsx("div",{className:"absolute inset-0 w-32 h-32 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/20 animate-ping"}),ue.jsx("div",{className:"absolute w-24 h-24 -translate-x-1/2 -translate-y-1/2 rounded-full border-4 border-primary/50",style:{animation:"pulse 1.5s ease-in-out infinite"}}),ue.jsx("div",{className:"absolute w-12 h-12 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 backdrop-blur-sm flex items-center justify-center",children:ue.jsx(VF,{className:"w-6 h-6 text-primary animate-bounce"})})]})}),!zt&&!pt&&ue.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/40 backdrop-blur-sm",children:ue.jsx("div",{className:"text-sm text-muted-foreground",children:ae("map.loadingMap")})}),pt&&ue.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/40 backdrop-blur-sm p-6",children:ue.jsxs("div",{className:"text-center text-muted-foreground max-w-sm bg-card/90 border border-border rounded-lg p-4 shadow-lg",children:[ue.jsx(iT,{className:"w-10 h-10 mx-auto mb-2 opacity-60"}),ue.jsx("p",{className:"text-sm leading-relaxed",children:pt}),ue.jsx(ol,{onClick:vs,className:"mt-3",variant:"outline",children:ae("map.reloadMap")})]})}),ue.jsxs("div",{className:"absolute left-3 z-20 flex items-center gap-2",style:{top:"calc(env(safe-area-inset-top, 0px) + 12px)"},children:[ue.jsx("div",{className:"bg-background/80 backdrop-blur-sm rounded-lg p-1.5 shadow-md border border-border/50",children:ue.jsx(AU,{})}),ue.jsxs("button",{onClick:()=>{const Ct=_e.current;!Ct||!zt||(Ar?(rB(Ct),pi(!1)):(nB(Ct)?(Tr(!1),Ct.easeTo({pitch:P0,bearing:D0,duration:800})):Tr(!0),pi(!0)))},disabled:!zt,className:"bg-background/80 backdrop-blur-sm rounded-lg px-3 py-1.5 shadow-md border border-border/50 text-xs font-medium text-foreground hover:bg-accent transition-colors disabled:opacity-50",children:[Or?"3D":"2D",zo&&ue.jsx("span",{className:"ml-1 text-muted-foreground",children:"(auto)"})]}),v&&t&&ue.jsxs("button",{onClick:()=>{var jn;const Ct=v.geometry.coordinates,sn=Ct.length>1?Ct[1]:Ct[0],pn=xA(t.latitude,t.longitude,sn[1],sn[0]);(jn=_e.current)==null||jn.flyTo({center:[t.longitude,t.latitude],zoom:17,pitch:52,bearing:pn,duration:700})},className:"bg-primary text-primary-foreground rounded-lg px-3 py-1.5 shadow-md text-xs font-medium hover:bg-primary/90 transition-colors flex items-center gap-1.5",children:[ue.jsx(xW,{className:"w-4 h-4"}),ae("map.centerOnMe")]})]}),L&&ue.jsxs("div",{className:"absolute bottom-32 left-4 right-4 z-40 space-y-3 animate-fade-in",children:[ue.jsxs("div",{className:"flex justify-center gap-2",children:[ue.jsx("button",{onClick:()=>Mn("walking"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${Vn==="walking"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:ue.jsx(NF,{className:"w-6 h-6"})}),ue.jsx("button",{onClick:()=>Mn("cycling"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${Vn==="cycling"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:ue.jsx(FF,{className:"w-6 h-6"})}),ue.jsx("button",{onClick:()=>Mn("driving"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${Vn==="driving"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:ue.jsx(zF,{className:"w-6 h-6"})})]}),ue.jsx(ol,{onClick:()=>E==null?void 0:E(Vn),disabled:T,className:"w-full h-14 text-base font-semibold rounded-2xl shadow-xl bg-primary hover:bg-primary/90",children:T?ue.jsxs(ue.Fragment,{children:[ue.jsx(rT,{className:"w-5 h-5 mr-2 animate-spin"}),ae("map.calculating")]}):ue.jsxs(ue.Fragment,{children:[ue.jsx(kC,{className:"w-5 h-5 mr-2"}),ae("map.startNavigation")]})})]}),(B||T)&&ue.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 animate-fade-in",style:{top:"calc(env(safe-area-inset-top, 0px) + 12px)"},children:ue.jsxs("div",{className:"bg-card/95 backdrop-blur-md rounded-2xl shadow-xl border border-border px-5 py-3 flex items-center gap-4",children:[ue.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:T?ue.jsx(rT,{className:"w-5 h-5 text-primary animate-spin"}):ue.jsxs(ue.Fragment,{children:[U==="walking"&&ue.jsx(NF,{className:"w-5 h-5 text-primary"}),U==="cycling"&&ue.jsx(FF,{className:"w-5 h-5 text-primary"}),U==="driving"&&ue.jsx(zF,{className:"w-5 h-5 text-primary"})]})}),ue.jsx("div",{className:"flex flex-col",children:v?ue.jsxs(ue.Fragment,{children:[ue.jsx("span",{className:"text-lg font-bold text-foreground",children:rre(v.duration)}),ue.jsx("span",{className:"text-xs text-muted-foreground",children:ire(v.distance)})]}):ue.jsxs(ue.Fragment,{children:[ue.jsx("span",{className:"text-base font-medium text-foreground",children:ae("map.calculating")}),ue.jsx("span",{className:"text-xs text-muted-foreground",children:ae("map.waitOrCancel")})]})}),ue.jsx("button",{onClick:c,className:"ml-2 w-10 h-10 rounded-full bg-destructive/10 text-destructive hover:bg-destructive/20 flex items-center justify-center transition-colors",title:ae("map.cancelNavigation"),children:ue.jsx(jp,{className:"w-5 h-5"})})]})}),(It||wt)&&t&&B&&ue.jsx(yre,{userLocation:t,targetLocation:It?{latitude:It.latitude,longitude:It.longitude}:wt?{latitude:wt.latitude,longitude:wt.longitude}:null,targetName:(It==null?void 0:It.title)||(wt==null?void 0:wt.title),deviceHeading:So.heading,className:"absolute left-4 right-4 z-50",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 220px)"}}),ue.jsxs("div",{className:"fixed left-0 right-0 z-30",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 72px)"},children:[ue.jsx("div",{className:"h-px bg-border"}),ue.jsx("div",{className:"bg-background/90 backdrop-blur-md px-4 py-3 rounded-t-2xl shadow-lg border-t border-x border-border/50",children:ue.jsxs("div",{className:"flex gap-3 justify-between items-center",children:[ue.jsxs(ol,{variant:"ghost",size:"sm",onClick:ys,disabled:!Vi,className:"flex-1 h-12 text-sm",children:[ue.jsx(TW,{className:"w-5 h-5 mr-2"}),ue.jsx("span",{className:"hidden sm:inline",children:ae("map.nearest")}),(Vi==null?void 0:Vi.distance)!==void 0&&ue.jsx("span",{className:"ml-1 text-sm text-muted-foreground",children:ES(Vi.distance)})]}),ue.jsx("div",{className:"w-px h-8 bg-border"}),ue.jsxs(ol,{variant:"ghost",size:"sm",onClick:za,disabled:!To,className:"flex-1 h-12 text-sm",children:[ue.jsx(VF,{className:"w-5 h-5 mr-2"}),ue.jsx("span",{className:"hidden sm:inline",children:ae("map.cluster")}),To&&ue.jsxs("span",{className:"ml-1 text-sm text-muted-foreground",children:[To.count," ",ae("map.missionCount")]})]}),ue.jsx("div",{className:"w-px h-8 bg-border"}),ue.jsxs(ol,{variant:"ghost",size:"sm",onClick:Ec,className:"flex-1 h-12 text-sm",children:[ue.jsx(SW,{className:"w-5 h-5 mr-2"}),ue.jsx("span",{className:"hidden sm:inline",children:ae("map.popular")})]}),ue.jsx("div",{className:"w-px h-8 bg-border"}),ue.jsxs(ol,{variant:Kn?"default":"ghost",size:"sm",onClick:oi,disabled:!t,className:`flex-1 h-12 text-sm ${Kn?"bg-primary text-primary-foreground":""}`,children:[Kn?ue.jsx(P4,{className:"w-5 h-5 mr-2"}):ue.jsx(EW,{className:"w-5 h-5 mr-2"}),ue.jsx("span",{className:"hidden sm:inline",children:ae(Kn?"map.locked":"map.lock")})]}),ue.jsx("div",{className:"w-px h-8 bg-border"}),ue.jsx(fre,{isLoading:Ci.isLoading,isPlaying:Ci.isPlaying,currentState:Ci.currentState,onPlay:rs,onStop:Ci.stop,className:"flex-1 h-12"})]})})]}),(It||wt)&&ue.jsx("div",{className:"absolute inset-0 z-40",onClick:()=>{kt(null),Zt(null)}}),It&&ue.jsxs(QC,{className:"absolute left-4 right-4 p-4 bg-card/95 backdrop-blur-sm border-border shadow-xl z-50 touch-pan-y",style:{bottom:L?"calc(env(safe-area-inset-bottom, 0px) + 18rem)":"calc(env(safe-area-inset-bottom, 0px) + 5rem)"},onClick:Ct=>Ct.stopPropagation(),onTouchStart:Ct=>{Ct.currentTarget._touchStartY=Ct.touches[0].clientY},onTouchEnd:Ct=>{const sn=Ct.currentTarget._touchStartY??0;Ct.changedTouches[0].clientY-sn>60&&kt(null)},children:[ue.jsx("div",{className:"flex justify-center mb-2",children:ue.jsx("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/30"})}),ue.jsx("button",{onClick:()=>kt(null),className:"absolute top-2 right-2 p-1 rounded-full hover:bg-muted",children:ue.jsx(jp,{className:"w-4 h-4"})}),ue.jsxs("div",{className:"pr-6",children:[ue.jsx("h3",{className:"font-semibold text-lg mb-1",children:It.title}),It.organization&&ue.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:It.organization.name}),ue.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:It.description}),ue.jsxs("div",{className:"flex items-center justify-between",children:[ue.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[ue.jsxs("span",{className:"flex items-center gap-1 text-primary font-medium",children:[ue.jsx(M4,{className:"w-4 h-4"}),It.reward_credits," krediter"]}),It.distance!==void 0&&ue.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[ue.jsx(kC,{className:"w-4 h-4"}),ES(It.distance)]})]}),ue.jsx(ol,{size:"sm",onClick:()=>s==null?void 0:s(It),children:ae("map.viewMission")})]})]})]}),wt&&ue.jsxs(QC,{className:"absolute left-4 right-4 p-4 border shadow-xl z-50",style:{bottom:L?"calc(env(safe-area-inset-bottom, 0px) + 18rem)":"calc(env(safe-area-inset-bottom, 0px) + 5rem)",background:`linear-gradient(135deg, hsl(var(--card)) 60%, ${wt.themeColor}30)`,borderColor:wt.themeColor+"60"},children:[ue.jsx("button",{onClick:()=>Zt(null),className:"absolute top-2 right-2 p-1 rounded-full hover:bg-muted",children:ue.jsx(jp,{className:"w-4 h-4"})}),ue.jsxs("div",{className:"pr-6",children:[ue.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[wt.type==="sponsored"&&wt.sponsorEmoji&&ue.jsx("span",{className:"text-xl",children:wt.sponsorEmoji}),wt.type==="charity"&&ue.jsx(AW,{className:"w-5 h-5",style:{color:wt.themeColor}}),ue.jsx("h3",{className:"font-semibold text-lg",children:wt.title})]}),wt.sponsor&&ue.jsx("p",{className:"text-sm font-medium mb-1",style:{color:wt.themeColor},children:wt.sponsor}),ue.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:wt.location}),ue.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:wt.description}),ue.jsxs("div",{className:"flex items-center justify-between",children:[ue.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[ue.jsxs("span",{className:"flex items-center gap-1 font-bold px-2 py-1 rounded-full text-white",style:{background:wt.themeColor},children:[wt.reward," krediter"]}),ue.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:wt.type==="charity"?`🎟️ ${ae("map.lottery")}`:`📸 ${ae("map.campaign")}`})]}),ue.jsx(ol,{size:"sm",onClick:()=>{ne("/real-change-mission")},style:{background:wt.themeColor,color:"white"},children:ae("map.participate")})]})]})]}),ue.jsx("style",{children:`
|
||
.mission-marker,
|
||
.beauty-mission-marker,
|
||
.user-location-marker {
|
||
cursor: pointer;
|
||
}
|
||
|
||
/* User location pulse animation */
|
||
@keyframes user-pulse {
|
||
0%, 100% {
|
||
transform: scale(1);
|
||
opacity: 0.6;
|
||
}
|
||
50% {
|
||
transform: scale(1.15);
|
||
opacity: 0.3;
|
||
}
|
||
}
|
||
|
||
/* User location outer glow animation */
|
||
@keyframes user-glow {
|
||
0%, 100% {
|
||
opacity: 0.4;
|
||
transform: scale(0.95);
|
||
}
|
||
50% {
|
||
opacity: 0.2;
|
||
transform: scale(1.1);
|
||
}
|
||
}
|
||
|
||
.user-location-marker > div > div:first-child {
|
||
animation: user-glow 2.5s ease-in-out infinite !important;
|
||
}
|
||
|
||
.mapboxgl-ctrl-group {
|
||
background: hsl(var(--card)) !important;
|
||
border: 1px solid hsl(var(--border)) !important;
|
||
}
|
||
.mapboxgl-ctrl-group button {
|
||
background-color: transparent !important;
|
||
}
|
||
.mapboxgl-ctrl-group button:hover {
|
||
background-color: hsl(var(--muted)) !important;
|
||
}
|
||
.mapboxgl-ctrl-group button span {
|
||
filter: invert(1);
|
||
}
|
||
.mapboxgl-ctrl-logo {
|
||
display: none !important;
|
||
}
|
||
.mapboxgl-ctrl-attrib {
|
||
display: none !important;
|
||
}
|
||
.mapboxgl-ctrl-scale {
|
||
display: none !important;
|
||
}
|
||
`})]})});PU.displayName="MissionMap";const nS="https://api.quixzoom.com/api/qz",yh="qz_token",$p={signUp:async(n,t,s)=>{try{const g=await(await fetch(`${nS}/auth/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:t,name:s,role:"zoomer"})})).json();return g.token&&localStorage.setItem(yh,g.token),g}catch{return{error:"Network error",code:"NETWORK_ERROR"}}},signIn:async(n,t)=>{try{const h=await(await fetch(`${nS}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:t})})).json();return h.token&&localStorage.setItem(yh,h.token),h}catch{return{error:"Network error",code:"NETWORK_ERROR"}}},signOut:async()=>{const n=localStorage.getItem(yh);if(n){try{await fetch(`${nS}/auth/logout`,{method:"POST",headers:{Authorization:`Bearer ${n}`}})}catch{}localStorage.removeItem(yh)}},getToken:()=>localStorage.getItem(yh),getUser:async()=>{const n=localStorage.getItem(yh);if(!n)return null;try{const t=await fetch(`${nS}/auth/me`,{headers:{Authorization:`Bearer ${n}`}});return t.ok?(await t.json()).user??null:(localStorage.removeItem(yh),null)}catch{return null}},isAuthenticated:()=>{const n=localStorage.getItem(yh);if(!n)return!1;try{return(JSON.parse(atob(n.split(".")[1])).exp??0)>Math.floor(Date.now()/1e3)}catch{return!1}}},bA="https://api.quixzoom.com/api/qz",Tre=3e4;function Ere(){const{user:n}=tm(),[t,s]=Y.useState([]),[h,g]=Y.useState(0),[v,E]=Y.useState(!0),c=Y.useRef(null),T=Y.useCallback(async()=>{if(!n){E(!1);return}const U=$p.getToken();if(!U){E(!1);return}try{const H=await fetch(`${bA}/notifications?limit=50`,{headers:{Authorization:`Bearer ${U}`}});if(H.ok){const X=await H.json();s(Array.isArray(X.notifications)?X.notifications:[]),g(X.unread??0)}else H.status===404?(s([]),g(0)):console.error("[useNotifications] fetch error:",H.status)}catch(H){console.error("[useNotifications] network error:",H)}finally{E(!1)}},[n]);return Y.useEffect(()=>(T(),c.current=setInterval(T,Tre),()=>{c.current&&clearInterval(c.current)}),[T]),{notifications:t,unreadCount:h,isLoading:v,markAsRead:async U=>{const H=$p.getToken();if(H)try{(await fetch(`${bA}/notifications/${encodeURIComponent(U)}`,{method:"PATCH",headers:{Authorization:`Bearer ${H}`}})).ok&&(s(ae=>ae.map(ne=>ne.id===U?{...ne,read:!0}:ne)),g(ae=>Math.max(0,ae-1)))}catch(X){console.error("[useNotifications] markAsRead error:",X)}},markAllAsRead:async()=>{if(!n)return;const U=$p.getToken();if(U)try{(await fetch(`${bA}/notifications/read-all`,{method:"PATCH",headers:{Authorization:`Bearer ${U}`}})).ok&&(s(X=>X.map(ae=>({...ae,read:!0}))),g(0))}catch(H){console.error("[useNotifications] markAllAsRead error:",H)}}}}const kre=()=>{const{user:n}=tm(),[t,s]=Y.useState(null),[h,g]=Y.useState(!0),[v,E]=Y.useState(null),c=Y.useRef(!1),T=Y.useCallback(async()=>{var ae,ne,me;if(!n){s(null),g(!1);return}try{g(!0),E(null);const oe=await IU(`/orderer-profiles?user_id=${n.id}`);s(oe)}catch(oe){((oe==null?void 0:oe.status)||((ne=(ae=oe==null?void 0:oe.message)==null?void 0:ae.match(/API error: (\d+)/))==null?void 0:ne[1]))==="404"||(me=oe==null?void 0:oe.message)!=null&&me.includes("404")?s(null):(console.error("Error fetching orderer profile:",oe),E("Kunde inte hämta beställarprofil"))}finally{g(!1)}},[n]);Y.useEffect(()=>{c.current||(c.current=!0,T())},[T]);const L=async ae=>{if(!n)return{error:"Inte inloggad"};try{const ne=await mI("/orderer-profiles",{user_id:n.id,...ae});return s(ne),{data:ne,error:null}}catch(ne){return console.error("Error creating orderer profile:",ne),ne.code==="23505"?{error:"En beställarprofil finns redan för detta konto eller organisationsnummer"}:{error:"Kunde inte skapa beställarprofil"}}},B=async ae=>{if(!n||!t)return{error:"Ingen beställarprofil att uppdatera"};try{const ne=await ore(`/orderer-profiles/${t.id}`,ae);return s(ne),{data:ne,error:null}}catch(ne){return console.error("Error updating orderer profile:",ne),{error:"Kunde inte uppdatera beställarprofil"}}},U=(t==null?void 0:t.status)==="active",H=(t==null?void 0:t.status)==="pending",X=U&&(t.payment_method==="stripe"||t.credit_approved);return{ordererProfile:t,isLoading:h,error:v,isActiveOrderer:U,isPendingOrderer:H,canOrder:X,createOrdererProfile:L,updateOrdererProfile:B,refetch:T}},DU=Y.forwardRef(({className:n},t)=>ue.jsxs("div",{ref:t,className:`relative ${n}`,children:[ue.jsx(I4,{className:"w-6 h-6"}),ue.jsx(bW,{className:"absolute -top-1 -left-1.5 w-3.5 h-3.5 stroke-[3]"})]}));DU.displayName="CameraDollarIcon";const RU=Y.forwardRef((n,t)=>{const s=Y_(),h=em(),{t:g}=nm(),{user:v}=tm(),{unreadCount:E}=Ere();kre();const c=!!v,L=[{id:"home",icon:DU,labelKey:"missions.title",path:"/"},{id:"map",icon:wW,labelKey:"nav.map",path:"/map"},{id:"notifications",icon:pW,labelKey:"nav.notifications",path:"/notifications"},{id:"wallet",icon:DW,labelKey:"nav.wallet",path:"/wallet"}],U=(()=>{const ae=h.pathname;if(ae==="/profile")return"profile";if(ae==="/auth")return"auth";if(ae.startsWith("/orderer/"))return"dashboard";const ne=L.find(me=>me.path===ae);return ne?ne.id:"home"})(),H=ae=>{if(ae.requiresAuth&&!c){Jo.info(g("auth.loginRequired","Logga in för att använda denna funktion")),s("/auth");return}s(ae.path)},X=()=>{s(c?"/profile":"/auth")};return ue.jsxs("nav",{ref:t,className:"fixed bottom-0 left-0 right-0 z-40 safe-area-x",children:[ue.jsx("div",{className:"absolute inset-0 bg-background/95 backdrop-blur-xl border-t border-border/50"}),ue.jsxs("div",{className:"relative flex items-center justify-around px-1 pt-3 pb-3 safe-area-bottom",children:[L.map(ae=>{const ne=U===ae.id,me=ae.icon,oe=ae.requiresAuth&&!c,re=ae.id==="notifications"&&E>0&&!oe;return ue.jsxs("button",{onClick:()=>H(ae),title:g(ae.labelKey),"aria-label":g(ae.labelKey),className:"relative flex items-center justify-center min-w-[56px] min-h-[48px] py-2 px-3 group touch-target",children:[ne&&!oe&&ue.jsx("div",{className:"absolute inset-0 rounded-2xl bg-primary/10"}),ue.jsxs(Ox.div,{animate:{scale:ne?1.1:1},transition:{type:"spring",stiffness:500,damping:30},className:"relative z-10",children:[ue.jsx(me,{className:`w-6 h-6 transition-colors ${oe?"text-muted-foreground/50":ne?"text-primary":"text-muted-foreground group-hover:text-foreground"}`}),re&&ue.jsx("span",{className:"absolute -top-1.5 -right-1.5 h-5 min-w-[20px] px-1 rounded-full bg-destructive text-destructive-foreground text-[11px] font-semibold flex items-center justify-center",children:E>9?"9+":E})]}),ue.jsx("span",{className:"pointer-events-none absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-popover text-popover-foreground text-xs px-2 py-1 shadow-md opacity-0 group-hover:opacity-100 transition-opacity duration-150 z-50",children:g(ae.labelKey)})]},ae.id)}),ue.jsxs("button",{onClick:X,title:c?g("nav.profile"):g("auth.login","Logga in"),"aria-label":c?g("nav.profile"):g("auth.login","Logga in"),className:"relative flex items-center justify-center min-w-[56px] min-h-[48px] py-2 px-3 group touch-target",children:[(U==="profile"&&c||U==="auth"&&!c)&&ue.jsx("div",{className:"absolute inset-0 rounded-2xl bg-primary/10"}),ue.jsx(Ox.div,{whileTap:{scale:.95},className:"relative z-10",children:c?ue.jsx(IW,{className:`w-6 h-6 transition-colors ${U==="profile"?"text-primary":"text-muted-foreground group-hover:text-foreground"}`}):ue.jsx(kW,{className:"w-6 h-6 transition-colors text-primary"})}),ue.jsx("span",{className:"pointer-events-none absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-popover text-popover-foreground text-xs px-2 py-1 shadow-md opacity-0 group-hover:opacity-100 transition-opacity duration-150 z-50",children:c?g("nav.profile"):g("auth.login","Logga in")})]})]})]})});RU.displayName="BottomNav";const gI="https://api.quixzoom.com/api/qz",Are=(n,t,s={})=>{const{isTooFast:h=!1,activeClaimMissionId:g=null}=s,[v,E]=Y.useState([]),[c,T]=Y.useState(!0),[L,B]=Y.useState(null),[U,H]=Y.useState(60),{user:X}=tm(),ae=Y.useRef(U),ne=Y.useRef(n),me=Y.useRef(t),oe=Y.useRef(!1);Y.useEffect(()=>{ae.current=U},[U]),Y.useEffect(()=>{ne.current=n,me.current=t},[n,t]),Y.useEffect(()=>{(async()=>{if(!X)return;const De=$p.getToken();if(De)try{const He=await fetch(`${gI}/missions/stats`,{headers:{Authorization:`Bearer ${De}`}});if(He.ok){const nt=await He.json();(nt==null?void 0:nt.visibility_delay_seconds)!=null&&H(nt.visibility_delay_seconds)}}catch{}})()},[X==null?void 0:X.id]);const re=Y.useCallback(async(_e=!1)=>{_e&&!oe.current&&T(!0);try{const De=new URLSearchParams({limit:"200",status:"active"}),He=ne.current,nt=me.current,Xe=await fetch(`${gI}/missions?${De.toString()}`);if(!Xe.ok){const kt=await Xe.json().catch(()=>({error:`HTTP ${Xe.status}`}));B(kt.error||"Kunde inte hämta uppdrag"),T(!1);return}const ft=await Xe.json(),At=Array.isArray(ft.missions)?ft.missions:[],Bt=Date.now(),Dt=ae.current;let It=At.map(kt=>{const wt=new Date(kt.created_at).getTime(),Zt=Dt*1e3,zt=wt+Zt,vt=Bt<zt,pt=vt?Math.ceil((zt-Bt)/1e3):0,Pt=parseFloat(String(kt.latitude??kt.lat??0)),An=parseFloat(String(kt.longitude??kt.lon??0));return{required_photos:1,radius_meters:100,instructions:null,target_description:null,area_name:null,active_until:null,frequency:null,frequency_count:null,organization_id:null,created_by:null,object_id:null,ad_option:null,stripe_payment_intent_id:null,paid_at:null,...kt,latitude:Pt,longitude:An,reward_credits:Number(kt.reward_credits??kt.credits??0),distance:He&&nt?KY(He,nt,Pt,An):void 0,isDelayed:vt,delayRemaining:pt,organization:null,sponsor:null}});It=It.filter(kt=>!kt.isDelayed),He&&nt&&(It=It.sort((kt,wt)=>(kt.distance||1/0)-(wt.distance||1/0))),E(It),B(null),oe.current=!0}catch{B("Ett oväntat fel uppstod")}finally{T(!1)}},[]);return Y.useEffect(()=>{re(!0);const _e=setInterval(()=>re(!1),6e4);return()=>clearInterval(_e)},[re]),Y.useEffect(()=>{oe.current&&n!==null&&t!==null&&re(!1)},[n,t,re]),{missions:Y.useMemo(()=>h?[]:g?v.filter(_e=>_e.id===g):v,[v,h,g]),allMissions:v,loading:c,error:L,visibilityDelay:U,isSpeedLocked:h,isFocusMode:!!g,refetch:()=>re(!1)}},tce=n=>{const[t,s]=Y.useState(null),[h,g]=Y.useState(!0),[v,E]=Y.useState(null);return Y.useEffect(()=>{if(!n){g(!1);return}(async()=>{g(!0);try{const T=await fetch(`${gI}/missions/${encodeURIComponent(n)}`);if(!T.ok){if(T.status===404)s(null);else{const H=await T.json().catch(()=>({error:`HTTP ${T.status}`}));E(H.error||"Kunde inte hämta uppdraget")}g(!1);return}const L=await T.json(),B="mission"in L&&L.mission?L.mission:L,U={required_photos:1,radius_meters:100,instructions:null,target_description:null,area_name:null,active_until:null,frequency:null,frequency_count:null,organization_id:null,created_by:null,object_id:null,ad_option:null,stripe_payment_intent_id:null,paid_at:null,...B,latitude:parseFloat(String(B.latitude??B.lat??0)),longitude:parseFloat(String(B.longitude??B.lon??0)),reward_credits:Number(B.reward_credits??B.credits??0),organization:null,sponsor:null};s(U)}catch{E("Nätverksfel")}finally{g(!1)}})()},[n]),{mission:t,loading:h,error:v}},iB="https://api.quixzoom.com/api/qz";function oB(n){return{id:n.id||"",user_id:n.id||"",email:n.email||"",display_name:n.display_name||n.name||null,phone_number:n.phone_number||n.phone||null,reach_meters:n.reach_meters??5e3,swish_number:n.swish_number||null,sms_notifications_enabled:n.sms_notifications_enabled??!1,voice_id:n.voice_id||null,self_accounting:n.self_accounting??!1,earnings_growth_enabled:n.earnings_growth_enabled??!1,earnings_growth_type:n.earnings_growth_type||"deposit",avatar_url:n.avatar_url||null,identity_verified:n.identity_verified??!1,identity_verified_at:n.identity_verified_at||null,city:n.city||null,gender:n.gender||null,birth_year:n.birth_year||null,global_mode:n.global_mode??!1}}const Cre=()=>{const[n,t]=Y.useState(null),[s,h]=Y.useState(!0),[g,v]=Y.useState(null),E=Y.useCallback(async()=>{const T=$p.getToken();if(!T){t(null),h(!1);return}try{const L=await fetch(`${iB}/auth/me`,{headers:{Authorization:`Bearer ${T}`}});if(!L.ok){L.status===401?t(null):v(`Kunde inte hämta profil (${L.status})`),h(!1);return}const B=await L.json(),U=B.user||B;t(oB(U)),v(null)}catch{v("Nätverksfel — försök igen")}finally{h(!1)}},[]);return Y.useEffect(()=>{E()},[E]),{profile:n,isLoading:s,error:g,updateProfile:async T=>{const L=$p.getToken();if(!L)return{error:new Error("Not authenticated"),data:null};try{const B=await fetch(`${iB}/auth/me`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${L}`},body:JSON.stringify(T)});if(!B.ok){const ae=await B.json().catch(()=>({}));return{error:new Error(ae.error||`Update failed (${B.status})`),data:null}}const U=await B.json(),H=U.user||U,X=oB(H);return t(X),{error:null,data:X}}catch(B){return{error:B instanceof Error?B:new Error("Network error"),data:null}}},refetch:E}},Ire="https://api.quixzoom.com/api/qz",Mre=15e3,Pre=n=>{const[t,s]=Y.useState(null),[h,g]=Y.useState(!0),{user:v}=tm(),E=Y.useRef(null),c=Y.useCallback(async()=>{if(!v){s(null),g(!1);return}const T=$p.getToken();if(!T){s(null),g(!1);return}try{const L=n?`?mission_id=${encodeURIComponent(n)}`:"",B=await fetch(`${Ire}/missions/claims/active${L}`,{headers:{Authorization:`Bearer ${T}`}});if(B.ok){const U=await B.json();s(U.claim??null)}else B.status===404?s(null):console.error("[useActiveClaim] fetch error:",B.status)}catch(L){console.error("[useActiveClaim] network error:",L)}finally{g(!1)}},[v,n]);return Y.useEffect(()=>(c(),E.current=setInterval(c,Mre),()=>{E.current&&clearInterval(E.current)}),[c]),{activeClaim:t,hasActiveClaim:!!t,loading:h,refetch:c}},Dre=({missionTitle:n,isVisible:t})=>{const{t:s}=nm();return t?ue.jsx(Ox.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"fixed bottom-32 right-4 z-40 max-w-[280px]",children:ue.jsx("div",{className:"bg-primary/95 backdrop-blur-sm text-primary-foreground rounded-xl px-4 py-3 shadow-lg border border-primary",children:ue.jsxs("div",{className:"flex items-center gap-3",children:[ue.jsx("div",{className:"p-2 bg-primary-foreground/20 rounded-full flex-shrink-0",children:ue.jsx(D4,{className:"h-4 w-4"})}),ue.jsxs("div",{className:"flex-1 min-w-0",children:[ue.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[ue.jsx(P4,{className:"h-3 w-3 flex-shrink-0"}),ue.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide opacity-80",children:s("map.focusMode")})]}),ue.jsx("p",{className:"text-sm font-medium leading-tight",title:n,children:n.length>30?n.slice(0,30)+"...":n})]})]})})}):null};var wA="focusScope.autoFocusOnMount",SA="focusScope.autoFocusOnUnmount",sB={bubbles:!1,cancelable:!0},Rre="FocusScope",LU=Y.forwardRef((n,t)=>{const{loop:s=!1,trapped:h=!1,onMountAutoFocus:g,onUnmountAutoFocus:v,...E}=n,[c,T]=Y.useState(null),L=Su(g),B=Su(v),U=Y.useRef(null),H=$o(t,ne=>T(ne)),X=Y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Y.useEffect(()=>{if(h){let ne=function(he){if(X.paused||!c)return;const _e=he.target;c.contains(_e)?U.current=_e:bh(U.current,{select:!0})},me=function(he){if(X.paused||!c)return;const _e=he.relatedTarget;_e!==null&&(c.contains(_e)||bh(U.current,{select:!0}))},oe=function(he){if(document.activeElement===document.body)for(const De of he)De.removedNodes.length>0&&bh(c)};document.addEventListener("focusin",ne),document.addEventListener("focusout",me);const re=new MutationObserver(oe);return c&&re.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",ne),document.removeEventListener("focusout",me),re.disconnect()}}},[h,c,X.paused]),Y.useEffect(()=>{if(c){lB.add(X);const ne=document.activeElement;if(!c.contains(ne)){const oe=new CustomEvent(wA,sB);c.addEventListener(wA,L),c.dispatchEvent(oe),oe.defaultPrevented||(Lre(Nre(OU(c)),{select:!0}),document.activeElement===ne&&bh(c))}return()=>{c.removeEventListener(wA,L),setTimeout(()=>{const oe=new CustomEvent(SA,sB);c.addEventListener(SA,B),c.dispatchEvent(oe),oe.defaultPrevented||bh(ne??document.body,{select:!0}),c.removeEventListener(SA,B),lB.remove(X)},0)}}},[c,L,B,X]);const ae=Y.useCallback(ne=>{if(!s&&!h||X.paused)return;const me=ne.key==="Tab"&&!ne.altKey&&!ne.ctrlKey&&!ne.metaKey,oe=document.activeElement;if(me&&oe){const re=ne.currentTarget,[he,_e]=Ore(re);he&&_e?!ne.shiftKey&&oe===_e?(ne.preventDefault(),s&&bh(he,{select:!0})):ne.shiftKey&&oe===he&&(ne.preventDefault(),s&&bh(_e,{select:!0})):oe===re&&ne.preventDefault()}},[s,h,X.paused]);return ue.jsx(Bi.div,{tabIndex:-1,...E,ref:H,onKeyDown:ae})});LU.displayName=Rre;function Lre(n,{select:t=!1}={}){const s=document.activeElement;for(const h of n)if(bh(h,{select:t}),document.activeElement!==s)return}function Ore(n){const t=OU(n),s=aB(t,n),h=aB(t.reverse(),n);return[s,h]}function OU(n){const t=[],s=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:h=>{const g=h.tagName==="INPUT"&&h.type==="hidden";return h.disabled||h.hidden||g?NodeFilter.FILTER_SKIP:h.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function aB(n,t){for(const s of n)if(!Fre(s,{upTo:t}))return s}function Fre(n,{upTo:t}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(t!==void 0&&n===t)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function zre(n){return n instanceof HTMLInputElement&&"select"in n}function bh(n,{select:t=!1}={}){if(n&&n.focus){const s=document.activeElement;n.focus({preventScroll:!0}),n!==s&&zre(n)&&t&&n.select()}}var lB=Bre();function Bre(){let n=[];return{add(t){const s=n[0];t!==s&&(s==null||s.pause()),n=cB(n,t),n.unshift(t)},remove(t){var s;n=cB(n,t),(s=n[0])==null||s.resume()}}}function cB(n,t){const s=[...n],h=s.indexOf(t);return h!==-1&&s.splice(h,1),s}function Nre(n){return n.filter(t=>t.tagName!=="A")}var rS=0,au=null;function Vre(){Y.useEffect(()=>{au||(au={start:uB(),end:uB()});const{start:n,end:t}=au;return document.body.firstElementChild!==n&&document.body.insertAdjacentElement("afterbegin",n),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),rS++,()=>{rS===1&&(au==null||au.start.remove(),au==null||au.end.remove(),au=null),rS=Math.max(0,rS-1)}},[])}function uB(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var fu=function(){return fu=Object.assign||function(t){for(var s,h=1,g=arguments.length;h<g;h++){s=arguments[h];for(var v in s)Object.prototype.hasOwnProperty.call(s,v)&&(t[v]=s[v])}return t},fu.apply(this,arguments)};function FU(n,t){var s={};for(var h in n)Object.prototype.hasOwnProperty.call(n,h)&&t.indexOf(h)<0&&(s[h]=n[h]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,h=Object.getOwnPropertySymbols(n);g<h.length;g++)t.indexOf(h[g])<0&&Object.prototype.propertyIsEnumerable.call(n,h[g])&&(s[h[g]]=n[h[g]]);return s}function jre(n,t,s){if(s||arguments.length===2)for(var h=0,g=t.length,v;h<g;h++)(v||!(h in t))&&(v||(v=Array.prototype.slice.call(t,0,h)),v[h]=t[h]);return n.concat(v||Array.prototype.slice.call(t))}var IS="right-scroll-bar-position",MS="width-before-scroll-bar",Ure="with-scroll-bars-hidden",Gre="--removed-body-scroll-bar-size";function TA(n,t){return typeof n=="function"?n(t):n&&(n.current=t),n}function $re(n,t){var s=Y.useState(function(){return{value:n,callback:t,facade:{get current(){return s.value},set current(h){var g=s.value;g!==h&&(s.value=h,s.callback(h,g))}}}})[0];return s.callback=t,s.facade}var Hre=typeof window<"u"?Y.useLayoutEffect:Y.useEffect,dB=new WeakMap;function Wre(n,t){var s=$re(null,function(h){return n.forEach(function(g){return TA(g,h)})});return Hre(function(){var h=dB.get(s);if(h){var g=new Set(h),v=new Set(n),E=s.current;g.forEach(function(c){v.has(c)||TA(c,null)}),v.forEach(function(c){g.has(c)||TA(c,E)})}dB.set(s,n)},[n]),s}function qre(n){return n}function Zre(n,t){t===void 0&&(t=qre);var s=[],h=!1,g={read:function(){if(h)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:n},useMedium:function(v){var E=t(v,h);return s.push(E),function(){s=s.filter(function(c){return c!==E})}},assignSyncMedium:function(v){for(h=!0;s.length;){var E=s;s=[],E.forEach(v)}s={push:function(c){return v(c)},filter:function(){return s}}},assignMedium:function(v){h=!0;var E=[];if(s.length){var c=s;s=[],c.forEach(v),E=s}var T=function(){var B=E;E=[],B.forEach(v)},L=function(){return Promise.resolve().then(T)};L(),s={push:function(B){E.push(B),L()},filter:function(B){return E=E.filter(B),s}}}};return g}function Xre(n){n===void 0&&(n={});var t=Zre(null);return t.options=fu({async:!0,ssr:!1},n),t}var zU=function(n){var t=n.sideCar,s=FU(n,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var h=t.read();if(!h)throw new Error("Sidecar medium not found");return Y.createElement(h,fu({},s))};zU.isSideCarExport=!0;function Kre(n,t){return n.useMedium(t),zU}var BU=Xre(),EA=function(){},u2=Y.forwardRef(function(n,t){var s=Y.useRef(null),h=Y.useState({onScrollCapture:EA,onWheelCapture:EA,onTouchMoveCapture:EA}),g=h[0],v=h[1],E=n.forwardProps,c=n.children,T=n.className,L=n.removeScrollBar,B=n.enabled,U=n.shards,H=n.sideCar,X=n.noRelative,ae=n.noIsolation,ne=n.inert,me=n.allowPinchZoom,oe=n.as,re=oe===void 0?"div":oe,he=n.gapMode,_e=FU(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),De=H,He=Wre([s,t]),nt=fu(fu({},_e),g);return Y.createElement(Y.Fragment,null,B&&Y.createElement(De,{sideCar:BU,removeScrollBar:L,shards:U,noRelative:X,noIsolation:ae,inert:ne,setCallbacks:v,allowPinchZoom:!!me,lockRef:s,gapMode:he}),E?Y.cloneElement(Y.Children.only(c),fu(fu({},nt),{ref:He})):Y.createElement(re,fu({},nt,{className:T,ref:He}),c))});u2.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};u2.classNames={fullWidth:MS,zeroRight:IS};var Yre=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Qre(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var t=Yre();return t&&n.setAttribute("nonce",t),n}function Jre(n,t){n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}function eie(n){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(n)}var tie=function(){var n=0,t=null;return{add:function(s){n==0&&(t=Qre())&&(Jre(t,s),eie(t)),n++},remove:function(){n--,!n&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nie=function(){var n=tie();return function(t,s){Y.useEffect(function(){return n.add(t),function(){n.remove()}},[t&&s])}},NU=function(){var n=nie(),t=function(s){var h=s.styles,g=s.dynamic;return n(h,g),null};return t},rie={left:0,top:0,right:0,gap:0},kA=function(n){return parseInt(n||"",10)||0},iie=function(n){var t=window.getComputedStyle(document.body),s=t[n==="padding"?"paddingLeft":"marginLeft"],h=t[n==="padding"?"paddingTop":"marginTop"],g=t[n==="padding"?"paddingRight":"marginRight"];return[kA(s),kA(h),kA(g)]},oie=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return rie;var t=iie(n),s=document.documentElement.clientWidth,h=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,h-s+t[2]-t[0])}},sie=NU(),h_="data-scroll-locked",aie=function(n,t,s,h){var g=n.left,v=n.top,E=n.right,c=n.gap;return s===void 0&&(s="margin"),`
|
||
.`.concat(Ure,` {
|
||
overflow: hidden `).concat(h,`;
|
||
padding-right: `).concat(c,"px ").concat(h,`;
|
||
}
|
||
body[`).concat(h_,`] {
|
||
overflow: hidden `).concat(h,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([t&&"position: relative ".concat(h,";"),s==="margin"&&`
|
||
padding-left: `.concat(g,`px;
|
||
padding-top: `).concat(v,`px;
|
||
padding-right: `).concat(E,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(c,"px ").concat(h,`;
|
||
`),s==="padding"&&"padding-right: ".concat(c,"px ").concat(h,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(IS,` {
|
||
right: `).concat(c,"px ").concat(h,`;
|
||
}
|
||
|
||
.`).concat(MS,` {
|
||
margin-right: `).concat(c,"px ").concat(h,`;
|
||
}
|
||
|
||
.`).concat(IS," .").concat(IS,` {
|
||
right: 0 `).concat(h,`;
|
||
}
|
||
|
||
.`).concat(MS," .").concat(MS,` {
|
||
margin-right: 0 `).concat(h,`;
|
||
}
|
||
|
||
body[`).concat(h_,`] {
|
||
`).concat(Gre,": ").concat(c,`px;
|
||
}
|
||
`)},hB=function(){var n=parseInt(document.body.getAttribute(h_)||"0",10);return isFinite(n)?n:0},lie=function(){Y.useEffect(function(){return document.body.setAttribute(h_,(hB()+1).toString()),function(){var n=hB()-1;n<=0?document.body.removeAttribute(h_):document.body.setAttribute(h_,n.toString())}},[])},cie=function(n){var t=n.noRelative,s=n.noImportant,h=n.gapMode,g=h===void 0?"margin":h;lie();var v=Y.useMemo(function(){return oie(g)},[g]);return Y.createElement(sie,{styles:aie(v,!t,g,s?"":"!important")})},_I=!1;if(typeof window<"u")try{var iS=Object.defineProperty({},"passive",{get:function(){return _I=!0,!0}});window.addEventListener("test",iS,iS),window.removeEventListener("test",iS,iS)}catch{_I=!1}var Dg=_I?{passive:!1}:!1,uie=function(n){return n.tagName==="TEXTAREA"},VU=function(n,t){if(!(n instanceof Element))return!1;var s=window.getComputedStyle(n);return s[t]!=="hidden"&&!(s.overflowY===s.overflowX&&!uie(n)&&s[t]==="visible")},die=function(n){return VU(n,"overflowY")},hie=function(n){return VU(n,"overflowX")},fB=function(n,t){var s=t.ownerDocument,h=t;do{typeof ShadowRoot<"u"&&h instanceof ShadowRoot&&(h=h.host);var g=jU(n,h);if(g){var v=UU(n,h),E=v[1],c=v[2];if(E>c)return!0}h=h.parentNode}while(h&&h!==s.body);return!1},fie=function(n){var t=n.scrollTop,s=n.scrollHeight,h=n.clientHeight;return[t,s,h]},pie=function(n){var t=n.scrollLeft,s=n.scrollWidth,h=n.clientWidth;return[t,s,h]},jU=function(n,t){return n==="v"?die(t):hie(t)},UU=function(n,t){return n==="v"?fie(t):pie(t)},mie=function(n,t){return n==="h"&&t==="rtl"?-1:1},gie=function(n,t,s,h,g){var v=mie(n,window.getComputedStyle(t).direction),E=v*h,c=s.target,T=t.contains(c),L=!1,B=E>0,U=0,H=0;do{if(!c)break;var X=UU(n,c),ae=X[0],ne=X[1],me=X[2],oe=ne-me-v*ae;(ae||oe)&&jU(n,c)&&(U+=oe,H+=ae);var re=c.parentNode;c=re&&re.nodeType===Node.DOCUMENT_FRAGMENT_NODE?re.host:re}while(!T&&c!==document.body||T&&(t.contains(c)||t===c));return(B&&Math.abs(U)<1||!B&&Math.abs(H)<1)&&(L=!0),L},oS=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},pB=function(n){return[n.deltaX,n.deltaY]},mB=function(n){return n&&"current"in n?n.current:n},_ie=function(n,t){return n[0]===t[0]&&n[1]===t[1]},yie=function(n){return`
|
||
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
||
`)},vie=0,Rg=[];function xie(n){var t=Y.useRef([]),s=Y.useRef([0,0]),h=Y.useRef(),g=Y.useState(vie++)[0],v=Y.useState(NU)[0],E=Y.useRef(n);Y.useEffect(function(){E.current=n},[n]),Y.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(g));var ne=jre([n.lockRef.current],(n.shards||[]).map(mB),!0).filter(Boolean);return ne.forEach(function(me){return me.classList.add("allow-interactivity-".concat(g))}),function(){document.body.classList.remove("block-interactivity-".concat(g)),ne.forEach(function(me){return me.classList.remove("allow-interactivity-".concat(g))})}}},[n.inert,n.lockRef.current,n.shards]);var c=Y.useCallback(function(ne,me){if("touches"in ne&&ne.touches.length===2||ne.type==="wheel"&&ne.ctrlKey)return!E.current.allowPinchZoom;var oe=oS(ne),re=s.current,he="deltaX"in ne?ne.deltaX:re[0]-oe[0],_e="deltaY"in ne?ne.deltaY:re[1]-oe[1],De,He=ne.target,nt=Math.abs(he)>Math.abs(_e)?"h":"v";if("touches"in ne&&nt==="h"&&He.type==="range")return!1;var Xe=window.getSelection(),ft=Xe&&Xe.anchorNode,At=ft?ft===He||ft.contains(He):!1;if(At)return!1;var Bt=fB(nt,He);if(!Bt)return!0;if(Bt?De=nt:(De=nt==="v"?"h":"v",Bt=fB(nt,He)),!Bt)return!1;if(!h.current&&"changedTouches"in ne&&(he||_e)&&(h.current=De),!De)return!0;var Dt=h.current||De;return gie(Dt,me,ne,Dt==="h"?he:_e)},[]),T=Y.useCallback(function(ne){var me=ne;if(!(!Rg.length||Rg[Rg.length-1]!==v)){var oe="deltaY"in me?pB(me):oS(me),re=t.current.filter(function(De){return De.name===me.type&&(De.target===me.target||me.target===De.shadowParent)&&_ie(De.delta,oe)})[0];if(re&&re.should){me.cancelable&&me.preventDefault();return}if(!re){var he=(E.current.shards||[]).map(mB).filter(Boolean).filter(function(De){return De.contains(me.target)}),_e=he.length>0?c(me,he[0]):!E.current.noIsolation;_e&&me.cancelable&&me.preventDefault()}}},[]),L=Y.useCallback(function(ne,me,oe,re){var he={name:ne,delta:me,target:oe,should:re,shadowParent:bie(oe)};t.current.push(he),setTimeout(function(){t.current=t.current.filter(function(_e){return _e!==he})},1)},[]),B=Y.useCallback(function(ne){s.current=oS(ne),h.current=void 0},[]),U=Y.useCallback(function(ne){L(ne.type,pB(ne),ne.target,c(ne,n.lockRef.current))},[]),H=Y.useCallback(function(ne){L(ne.type,oS(ne),ne.target,c(ne,n.lockRef.current))},[]);Y.useEffect(function(){return Rg.push(v),n.setCallbacks({onScrollCapture:U,onWheelCapture:U,onTouchMoveCapture:H}),document.addEventListener("wheel",T,Dg),document.addEventListener("touchmove",T,Dg),document.addEventListener("touchstart",B,Dg),function(){Rg=Rg.filter(function(ne){return ne!==v}),document.removeEventListener("wheel",T,Dg),document.removeEventListener("touchmove",T,Dg),document.removeEventListener("touchstart",B,Dg)}},[]);var X=n.removeScrollBar,ae=n.inert;return Y.createElement(Y.Fragment,null,ae?Y.createElement(v,{styles:yie(g)}):null,X?Y.createElement(cie,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function bie(n){for(var t=null;n!==null;)n instanceof ShadowRoot&&(t=n.host,n=n.host),n=n.parentNode;return t}const wie=Kre(BU,xie);var GU=Y.forwardRef(function(n,t){return Y.createElement(u2,fu({},n,{ref:t,sideCar:wie}))});GU.classNames=u2.classNames;var Sie=function(n){if(typeof document>"u")return null;var t=Array.isArray(n)?n[0]:n;return t.ownerDocument.body},Lg=new WeakMap,sS=new WeakMap,aS={},AA=0,$U=function(n){return n&&(n.host||$U(n.parentNode))},Tie=function(n,t){return t.map(function(s){if(n.contains(s))return s;var h=$U(s);return h&&n.contains(h)?h:(console.error("aria-hidden",s,"in not contained inside",n,". Doing nothing"),null)}).filter(function(s){return!!s})},Eie=function(n,t,s,h){var g=Tie(t,Array.isArray(n)?n:[n]);aS[s]||(aS[s]=new WeakMap);var v=aS[s],E=[],c=new Set,T=new Set(g),L=function(U){!U||c.has(U)||(c.add(U),L(U.parentNode))};g.forEach(L);var B=function(U){!U||T.has(U)||Array.prototype.forEach.call(U.children,function(H){if(c.has(H))B(H);else try{var X=H.getAttribute(h),ae=X!==null&&X!=="false",ne=(Lg.get(H)||0)+1,me=(v.get(H)||0)+1;Lg.set(H,ne),v.set(H,me),E.push(H),ne===1&&ae&&sS.set(H,!0),me===1&&H.setAttribute(s,"true"),ae||H.setAttribute(h,"true")}catch(oe){console.error("aria-hidden: cannot operate on ",H,oe)}})};return B(t),c.clear(),AA++,function(){E.forEach(function(U){var H=Lg.get(U)-1,X=v.get(U)-1;Lg.set(U,H),v.set(U,X),H||(sS.has(U)||U.removeAttribute(h),sS.delete(U)),X||U.removeAttribute(s)}),AA--,AA||(Lg=new WeakMap,Lg=new WeakMap,sS=new WeakMap,aS={})}},kie=function(n,t,s){s===void 0&&(s="data-aria-hidden");var h=Array.from(Array.isArray(n)?n:[n]),g=Sie(n);return g?(h.push.apply(h,Array.from(g.querySelectorAll("[aria-live], script"))),Eie(h,g,s,"aria-hidden")):function(){return null}},d2="Dialog",[HU,nce]=$_(d2),[Aie,Tc]=HU(d2),WU=n=>{const{__scopeDialog:t,children:s,open:h,defaultOpen:g,onOpenChange:v,modal:E=!0}=n,c=Y.useRef(null),T=Y.useRef(null),[L,B]=WT({prop:h,defaultProp:g??!1,onChange:v,caller:d2});return ue.jsx(Aie,{scope:t,triggerRef:c,contentRef:T,contentId:SS(),titleId:SS(),descriptionId:SS(),open:L,onOpenChange:B,onOpenToggle:Y.useCallback(()=>B(U=>!U),[B]),modal:E,children:s})};WU.displayName=d2;var qU="DialogTrigger",ZU=Y.forwardRef((n,t)=>{const{__scopeDialog:s,...h}=n,g=Tc(qU,s),v=$o(t,g.triggerRef);return ue.jsx(Bi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":g.open,"aria-controls":g.open?g.contentId:void 0,"data-state":kP(g.open),...h,ref:v,onClick:hi(n.onClick,g.onOpenToggle)})});ZU.displayName=qU;var bP="DialogPortal",[Cie,XU]=HU(bP,{forceMount:void 0}),KU=n=>{const{__scopeDialog:t,forceMount:s,children:h,container:g}=n,v=Tc(bP,t);return ue.jsx(Cie,{scope:t,forceMount:s,children:Y.Children.map(h,E=>ue.jsx(H_,{present:s||v.open,children:ue.jsx(yM,{asChild:!0,container:g,children:E})}))})};KU.displayName=bP;var ST="DialogOverlay",wP=Y.forwardRef((n,t)=>{const s=XU(ST,n.__scopeDialog),{forceMount:h=s.forceMount,...g}=n,v=Tc(ST,n.__scopeDialog);return v.modal?ue.jsx(H_,{present:h||v.open,children:ue.jsx(Mie,{...g,ref:t})}):null});wP.displayName=ST;var Iie=xx("DialogOverlay.RemoveScroll"),Mie=Y.forwardRef((n,t)=>{const{__scopeDialog:s,...h}=n,g=Tc(ST,s),v=P7(),E=$o(t,v);return ue.jsx(GU,{as:Iie,allowPinchZoom:!0,shards:[g.contentRef],children:ue.jsx(Bi.div,{"data-state":kP(g.open),...h,ref:E,style:{pointerEvents:"auto",...h.style}})})}),N_="DialogContent",SP=Y.forwardRef((n,t)=>{const s=XU(N_,n.__scopeDialog),{forceMount:h=s.forceMount,...g}=n,v=Tc(N_,n.__scopeDialog);return ue.jsx(H_,{present:h||v.open,children:v.modal?ue.jsx(Pie,{...g,ref:t}):ue.jsx(Die,{...g,ref:t})})});SP.displayName=N_;var Pie=Y.forwardRef((n,t)=>{const s=Tc(N_,n.__scopeDialog),h=Y.useRef(null),g=$o(t,s.contentRef,h);return Y.useEffect(()=>{const v=h.current;if(v)return kie(v)},[]),ue.jsx(YU,{...n,ref:g,trapFocus:s.open,disableOutsidePointerEvents:s.open,onCloseAutoFocus:hi(n.onCloseAutoFocus,v=>{var E;v.preventDefault(),(E=s.triggerRef.current)==null||E.focus()}),onPointerDownOutside:hi(n.onPointerDownOutside,v=>{const E=v.detail.originalEvent,c=E.button===0&&E.ctrlKey===!0;(E.button===2||c)&&v.preventDefault()}),onFocusOutside:hi(n.onFocusOutside,v=>v.preventDefault())})}),Die=Y.forwardRef((n,t)=>{const s=Tc(N_,n.__scopeDialog),h=Y.useRef(!1),g=Y.useRef(!1);return ue.jsx(YU,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:v=>{var E,c;(E=n.onCloseAutoFocus)==null||E.call(n,v),v.defaultPrevented||(h.current||(c=s.triggerRef.current)==null||c.focus(),v.preventDefault()),h.current=!1,g.current=!1},onInteractOutside:v=>{var T,L;(T=n.onInteractOutside)==null||T.call(n,v),v.defaultPrevented||(h.current=!0,v.detail.originalEvent.type==="pointerdown"&&(g.current=!0));const E=v.target;((L=s.triggerRef.current)==null?void 0:L.contains(E))&&v.preventDefault(),v.detail.originalEvent.type==="focusin"&&g.current&&v.preventDefault()}})}),YU=Y.forwardRef((n,t)=>{const{__scopeDialog:s,trapFocus:h,onOpenAutoFocus:g,onCloseAutoFocus:v,...E}=n,c=Tc(N_,s);return Vre(),ue.jsx(ue.Fragment,{children:ue.jsx(LU,{asChild:!0,loop:!0,trapped:h,onMountAutoFocus:g,onUnmountAutoFocus:v,children:ue.jsx(HT,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":kP(c.open),...E,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),QU="DialogTitle",TP=Y.forwardRef((n,t)=>{const{__scopeDialog:s,...h}=n,g=Tc(QU,s);return ue.jsx(Bi.h2,{id:g.titleId,...h,ref:t})});TP.displayName=QU;var JU="DialogDescription",EP=Y.forwardRef((n,t)=>{const{__scopeDialog:s,...h}=n,g=Tc(JU,s);return ue.jsx(Bi.p,{id:g.descriptionId,...h,ref:t})});EP.displayName=JU;var e6="DialogClose",t6=Y.forwardRef((n,t)=>{const{__scopeDialog:s,...h}=n,g=Tc(e6,s);return ue.jsx(Bi.button,{type:"button",...h,ref:t,onClick:hi(n.onClick,()=>g.onOpenChange(!1))})});t6.displayName=e6;function kP(n){return n?"open":"closed"}const Rie=WU,rce=ZU,Lie=KU,n6=Y.forwardRef(({className:n,...t},s)=>ue.jsx(wP,{ref:s,className:fi("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...t}));n6.displayName=wP.displayName;const r6=Y.forwardRef(({className:n,children:t,...s},h)=>ue.jsxs(Lie,{children:[ue.jsx(n6,{}),ue.jsxs(SP,{ref:h,className:fi("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...s,children:[t,ue.jsxs(t6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[ue.jsx(jp,{className:"h-4 w-4"}),ue.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));r6.displayName=SP.displayName;const i6=({className:n,...t})=>ue.jsx("div",{className:fi("flex flex-col space-y-1.5 text-center sm:text-left",n),...t});i6.displayName="DialogHeader";const o6=Y.forwardRef(({className:n,...t},s)=>ue.jsx(TP,{ref:s,className:fi("text-lg font-semibold leading-none tracking-tight",n),...t}));o6.displayName=TP.displayName;const s6=Y.forwardRef(({className:n,...t},s)=>ue.jsx(EP,{ref:s,className:fi("text-sm text-muted-foreground",n),...t}));s6.displayName=EP.displayName;const a6=Y.forwardRef(({className:n,type:t,...s},h)=>ue.jsx("input",{type:t,className:fi("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:h,...s}));a6.displayName="Input";const l6=Y.forwardRef(({className:n,...t},s)=>ue.jsx("textarea",{className:fi("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:s,...t}));l6.displayName="Textarea";var Oie="Label",c6=Y.forwardRef((n,t)=>ue.jsx(Bi.label,{...n,ref:t,onMouseDown:s=>{var g;s.target.closest("button, input, select, textarea")||((g=n.onMouseDown)==null||g.call(n,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));c6.displayName=Oie;var u6=c6;const Fie=wM("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Cp=Y.forwardRef(({className:n,...t},s)=>ue.jsx(u6,{ref:s,className:fi(Fie(),n),...t}));Cp.displayName=u6.displayName;function d6(n,[t,s]){return Math.min(s,Math.max(t,n))}var zie=Y.createContext(void 0);function Bie(n){const t=Y.useContext(zie);return n||t||"ltr"}function Nie(n){const t=Y.useRef({value:n,previous:n});return Y.useMemo(()=>(t.current.value!==n&&(t.current.previous=t.current.value,t.current.value=n),t.current.previous),[n])}var h6=["PageUp","PageDown"],f6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],p6={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ey="Slider",[yI,Vie,jie]=r4(ey),[AP]=$_(ey,[jie]),[Uie,Qx]=AP(ey),CP=Y.forwardRef((n,t)=>{const{name:s,min:h=0,max:g=100,step:v=1,orientation:E="horizontal",disabled:c=!1,minStepsBetweenThumbs:T=0,defaultValue:L=[h],value:B,onValueChange:U=()=>{},onValueCommit:H=()=>{},inverted:X=!1,form:ae,...ne}=n,me=Y.useRef(new Set),oe=Y.useRef(0),re=Y.useRef(!1),_e=E==="horizontal"?Gie:$ie,[De=[],He]=WT({prop:B,defaultProp:L,onChange:Dt=>{var kt;(kt=[...me.current][oe.current])==null||kt.focus({preventScroll:!0,focusVisible:re.current}),re.current=!1,U(Dt)}}),nt=Y.useRef(De);function Xe(Dt){const It=Zie(De,Dt);Bt(Dt,It)}function ft(Dt){Bt(Dt,oe.current)}function At(){const Dt=nt.current[oe.current];De[oe.current]!==Dt&&H(De)}function Bt(Dt,It,{commit:kt}={commit:!1}){const wt=Qie(v),Zt=Jie(Math.round((Dt-h)/v)*v+h,wt),zt=d6(Zt,[h,g]);He((vt=[])=>{const pt=Wie(vt,zt,It);if(Yie(pt,T*v)){oe.current=pt.indexOf(zt);const Pt=String(pt)!==String(vt);return Pt&&kt&&H(pt),Pt?pt:vt}else return vt})}return ue.jsx(Uie,{scope:n.__scopeSlider,name:s,disabled:c,min:h,max:g,valueIndexToChangeRef:oe,thumbs:me.current,values:De,orientation:E,form:ae,children:ue.jsx(yI.Provider,{scope:n.__scopeSlider,children:ue.jsx(yI.Slot,{scope:n.__scopeSlider,children:ue.jsx(_e,{"aria-disabled":c,"data-disabled":c?"":void 0,...ne,ref:t,onPointerDown:hi(ne.onPointerDown,()=>{c||(nt.current=De,re.current=!1)}),min:h,max:g,inverted:X,onSlideStart:c?void 0:Xe,onSlideMove:c?void 0:ft,onSlideEnd:c?void 0:At,onHomeKeyDown:()=>{c||(re.current=!0,Bt(h,0,{commit:!0}))},onEndKeyDown:()=>{c||(re.current=!0,Bt(g,De.length-1,{commit:!0}))},onStepKeyDown:({event:Dt,direction:It})=>{if(!c){re.current=!0;const Zt=h6.includes(Dt.key)||Dt.shiftKey&&f6.includes(Dt.key)?10:1,zt=oe.current,vt=De[zt],pt=v*Zt*It;Bt(vt+pt,zt,{commit:!0})}}})})})})});CP.displayName=ey;var[m6,g6]=AP(ey,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Gie=Y.forwardRef((n,t)=>{const{min:s,max:h,dir:g,inverted:v,onSlideStart:E,onSlideMove:c,onSlideEnd:T,onStepKeyDown:L,...B}=n,[U,H]=Y.useState(null),X=$o(t,he=>H(he)),ae=Y.useRef(void 0),ne=Bie(g),me=ne==="ltr",oe=me&&!v||!me&&v;function re(he){const _e=ae.current||U.getBoundingClientRect(),De=[0,_e.width],nt=IP(De,oe?[s,h]:[h,s]);return ae.current=_e,nt(he-_e.left)}return ue.jsx(m6,{scope:n.__scopeSlider,startEdge:oe?"left":"right",endEdge:oe?"right":"left",direction:oe?1:-1,size:"width",children:ue.jsx(_6,{dir:ne,"data-orientation":"horizontal",...B,ref:X,style:{...B.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:he=>{const _e=re(he.clientX);E==null||E(_e)},onSlideMove:he=>{const _e=re(he.clientX);c==null||c(_e)},onSlideEnd:()=>{ae.current=void 0,T==null||T()},onStepKeyDown:he=>{const De=p6[oe?"from-left":"from-right"].includes(he.key);L==null||L({event:he,direction:De?-1:1})}})})}),$ie=Y.forwardRef((n,t)=>{const{min:s,max:h,inverted:g,onSlideStart:v,onSlideMove:E,onSlideEnd:c,onStepKeyDown:T,...L}=n,B=Y.useRef(null),U=$o(t,B),H=Y.useRef(void 0),X=!g;function ae(ne){const me=H.current||B.current.getBoundingClientRect(),oe=[0,me.height],he=IP(oe,X?[h,s]:[s,h]);return H.current=me,he(ne-me.top)}return ue.jsx(m6,{scope:n.__scopeSlider,startEdge:X?"bottom":"top",endEdge:X?"top":"bottom",size:"height",direction:X?1:-1,children:ue.jsx(_6,{"data-orientation":"vertical",...L,ref:U,style:{...L.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:ne=>{const me=ae(ne.clientY);v==null||v(me)},onSlideMove:ne=>{const me=ae(ne.clientY);E==null||E(me)},onSlideEnd:()=>{H.current=void 0,c==null||c()},onStepKeyDown:ne=>{const oe=p6[X?"from-bottom":"from-top"].includes(ne.key);T==null||T({event:ne,direction:oe?-1:1})}})})}),_6=Y.forwardRef((n,t)=>{const{__scopeSlider:s,onSlideStart:h,onSlideMove:g,onSlideEnd:v,onHomeKeyDown:E,onEndKeyDown:c,onStepKeyDown:T,...L}=n,B=Qx(ey,s);return ue.jsx(Bi.span,{...L,ref:t,onKeyDown:hi(n.onKeyDown,U=>{U.key==="Home"?(E(U),U.preventDefault()):U.key==="End"?(c(U),U.preventDefault()):h6.concat(f6).includes(U.key)&&(T(U),U.preventDefault())}),onPointerDown:hi(n.onPointerDown,U=>{const H=U.target;H.setPointerCapture(U.pointerId),U.preventDefault(),B.thumbs.has(H)?H.focus({preventScroll:!0,focusVisible:!1}):h(U)}),onPointerMove:hi(n.onPointerMove,U=>{U.target.hasPointerCapture(U.pointerId)&&g(U)}),onPointerUp:hi(n.onPointerUp,U=>{const H=U.target;H.hasPointerCapture(U.pointerId)&&(H.releasePointerCapture(U.pointerId),v(U))})})}),y6="SliderTrack",v6=Y.forwardRef((n,t)=>{const{__scopeSlider:s,...h}=n,g=Qx(y6,s);return ue.jsx(Bi.span,{"data-disabled":g.disabled?"":void 0,"data-orientation":g.orientation,...h,ref:t})});v6.displayName=y6;var vI="SliderRange",x6=Y.forwardRef((n,t)=>{const{__scopeSlider:s,...h}=n,g=Qx(vI,s),v=g6(vI,s),E=Y.useRef(null),c=$o(t,E),T=g.values.length,L=g.values.map(H=>I6(H,g.min,g.max)),B=T>1?Math.min(...L):0,U=100-Math.max(...L);return ue.jsx(Bi.span,{"data-orientation":g.orientation,"data-disabled":g.disabled?"":void 0,...h,ref:c,style:{...n.style,[v.startEdge]:B+"%",[v.endEdge]:U+"%"}})});x6.displayName=vI;var b6="SliderThumb",[Hie,w6]=AP(b6),S6="SliderThumbProvider";function T6(n){const{__scopeSlider:t,name:s,children:h,internal_do_not_use_render:g}=n,v=Qx(S6,t),E=Vie(t),[c,T]=Y.useState(null),L=Y.useMemo(()=>c?E().findIndex(me=>me.ref.current===c):-1,[E,c]),B=tV(c),U=c?!!v.form||!!c.closest("form"):!0,H=v.values[L],X=s??(v.name?v.name+(v.values.length>1?"[]":""):void 0),ae=H===void 0?0:I6(H,v.min,v.max);Y.useEffect(()=>{if(c)return v.thumbs.add(c),()=>{v.thumbs.delete(c)}},[c,v.thumbs]);const ne={value:H,name:X,form:v.form,isFormControl:U,index:L,thumb:c,onThumbChange:T,percent:ae,size:B};return ue.jsx(Hie,{scope:t,...ne,children:eoe(g)?g(ne):h})}T6.displayName=S6;var PS="SliderThumbTrigger",E6=Y.forwardRef((n,t)=>{const{__scopeSlider:s,...h}=n,g=Qx(PS,s),v=g6(PS,s),{index:E,value:c,percent:T,size:L,onThumbChange:B}=w6(PS,s),U=$o(t,ne=>B(ne)),H=qie(E,g.values.length),X=L==null?void 0:L[v.size],ae=X?Xie(X,T,v.direction):0;return ue.jsx("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[v.startEdge]:`calc(${T}% + ${ae}px)`},children:ue.jsx(yI.ItemSlot,{scope:s,children:ue.jsx(Bi.span,{role:"slider","aria-label":n["aria-label"]||H,"aria-valuemin":g.min,"aria-valuenow":c,"aria-valuemax":g.max,"aria-orientation":g.orientation,"data-orientation":g.orientation,"data-disabled":g.disabled?"":void 0,tabIndex:g.disabled?void 0:0,...h,ref:U,style:c===void 0?{display:"none"}:n.style,onFocus:hi(n.onFocus,()=>{g.valueIndexToChangeRef.current=E})})})})});E6.displayName=PS;var k6=Y.forwardRef((n,t)=>{const{__scopeSlider:s,name:h,...g}=n;return ue.jsx(T6,{__scopeSlider:s,name:h,internal_do_not_use_render:({index:v,isFormControl:E})=>ue.jsxs(ue.Fragment,{children:[ue.jsx(E6,{...g,ref:t,__scopeSlider:s}),E?ue.jsx(C6,{__scopeSlider:s},v):null]})})});k6.displayName=b6;var A6="SliderBubbleInput",C6=Y.forwardRef(({__scopeSlider:n,...t},s)=>{const{value:h,name:g,form:v}=w6(A6,n),E=Y.useRef(null),c=$o(E,s),T=Nie(h);return Y.useEffect(()=>{const L=E.current;if(!L)return;const B=window.HTMLInputElement.prototype,H=Object.getOwnPropertyDescriptor(B,"value").set;if(T!==h&&H){const X=new Event("input",{bubbles:!0});H.call(L,h),L.dispatchEvent(X)}},[T,h]),ue.jsx(Bi.input,{style:{display:"none"},name:g,form:v,...t,ref:c,defaultValue:h})});C6.displayName=A6;function Wie(n=[],t,s){const h=[...n];return h[s]=t,h.sort((g,v)=>g-v)}function I6(n,t,s){const v=100/(s-t)*(n-t);return d6(v,[0,100])}function qie(n,t){return t>2?`Value ${n+1} of ${t}`:t===2?["Minimum","Maximum"][n]:void 0}function Zie(n,t){if(n.length===1)return 0;const s=n.map(g=>Math.abs(g-t)),h=Math.min(...s);return s.indexOf(h)}function Xie(n,t,s){const h=n/2,v=IP([0,50],[0,h]);return(h-v(t)*s)*s}function Kie(n){return n.slice(0,-1).map((t,s)=>n[s+1]-t)}function Yie(n,t){if(t>0){const s=Kie(n);return Math.min(...s)>=t}return!0}function IP(n,t){return s=>{if(n[0]===n[1]||t[0]===t[1])return t[0];const h=(t[1]-t[0])/(n[1]-n[0]);return t[0]+h*(s-n[0])}}function Qie(n){if(!Number.isFinite(n))return 0;const t=n.toString();if(t.includes("e")){const[h,g]=t.split("e"),v=h.split(".")[1]||"",E=Number(g);return Math.max(0,v.length-E)}const s=t.split(".")[1];return s?s.length:0}function Jie(n,t){const s=Math.pow(10,t);return Math.round(n*s)/s}function eoe(n){return typeof n=="function"}const DS=Y.forwardRef(({className:n,...t},s)=>ue.jsxs(CP,{ref:s,className:fi("relative flex w-full touch-none select-none items-center",n),...t,children:[ue.jsx(v6,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:ue.jsx(x6,{className:"absolute h-full bg-primary"})}),ue.jsx(k6,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));DS.displayName=CP.displayName;function toe({open:n,onOpenChange:t,location:s,onSuccess:h}){const{t:g}=nm(),{user:v}=tm(),[E,c]=Y.useState(""),[T,L]=Y.useState(""),[B,U]=Y.useState(1),[H,X]=Y.useState(50),[ae,ne]=Y.useState(100),[me,oe]=Y.useState(!1),[re,he]=Y.useState([]),[_e,De]=Y.useState(!1),He=Y.useRef(null),nt=Y.useRef(null),Xe=(It,kt)=>{const wt=It.target.files;wt&&(Array.from(wt).forEach(Zt=>{if(Zt.size>5*1024*1024){Jo.error(g("quickCreate.imageTooLarge"));return}const zt=new FileReader;zt.onload=vt=>{he(pt=>{var Pt;return[...pt,{file:Zt,preview:(Pt=vt.target)==null?void 0:Pt.result,type:kt}]})},zt.readAsDataURL(Zt)}),It.target.value="")},ft=It=>{he(kt=>kt.filter((wt,Zt)=>Zt!==It))},At=()=>{he([])},Bt=async()=>{if(!s||!v){Jo.error(g("quickCreate.loginAndLocationRequired"));return}if(!E.trim()){Jo.error(g("quickCreate.titleRequiredError"));return}oe(!0);try{const It=await mI("/missions",{title:E.trim(),description:T.trim()||null,latitude:s.latitude,longitude:s.longitude,required_photos:B,reward_credits:H,radius_meters:ae,status:"active",created_by:v.id});if(re.length>0&&(It!=null&&It.id)){De(!0);for(let kt=0;kt<re.length;kt++){const wt=re[kt],Zt=await sre(wt.file,`mission-examples/${It.id}/${wt.type}`);Zt!=null&&Zt.url&&await mI("/mission-example-images",{mission_id:It.id,image_url:Zt.url,image_type:wt.type,caption:wt.type==="good"?g("quickCreate.goodExampleCaption"):g("quickCreate.badExampleCaption"),order_index:kt})}De(!1)}Jo.success(g("quickCreate.missionCreated"),{description:g("quickCreate.missionOnMap",{title:E})}),c(""),L(""),U(1),X(50),ne(100),At(),t(!1),h==null||h()}catch(It){console.error("Failed to create mission:",It),Jo.error(g("quickCreate.couldNotCreate"),{description:It.message||g("quickCreate.tryAgain")})}finally{oe(!1)}},Dt=B>0?H/B:H;return ue.jsx(Rie,{open:n,onOpenChange:t,children:ue.jsxs(r6,{className:"max-w-md",children:[ue.jsxs(i6,{children:[ue.jsxs(o6,{className:"flex items-center gap-2",children:[ue.jsx(iT,{className:"h-5 w-5 text-primary"}),g("quickCreate.title")]}),ue.jsx(s6,{children:g("quickCreate.description")})]}),ue.jsxs("div",{className:"space-y-4 py-4",children:[s&&ue.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 p-2 rounded-lg",children:[ue.jsx(iT,{className:"h-4 w-4"}),ue.jsxs("span",{children:[s.latitude.toFixed(5),", ",s.longitude.toFixed(5)]})]}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsx(Cp,{htmlFor:"title",children:g("quickCreate.titleRequired")}),ue.jsx(a6,{id:"title",placeholder:g("quickCreate.titlePlaceholder"),value:E,onChange:It=>c(It.target.value),maxLength:100})]}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsx(Cp,{htmlFor:"description",children:g("quickCreate.descriptionLabel")}),ue.jsx(l6,{id:"description",placeholder:g("quickCreate.descriptionPlaceholder"),value:T,onChange:It=>L(It.target.value),rows:3,maxLength:500})]}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsxs("div",{className:"flex items-center justify-between",children:[ue.jsxs(Cp,{className:"flex items-center gap-2",children:[ue.jsx(I4,{className:"h-4 w-4"}),g("quickCreate.photoCount")]}),ue.jsx("span",{className:"text-sm font-medium",children:B})]}),ue.jsx(DS,{value:[B],onValueChange:([It])=>U(It),min:1,max:10,step:1})]}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsxs("div",{className:"flex items-center justify-between",children:[ue.jsxs(Cp,{className:"flex items-center gap-2",children:[ue.jsx(M4,{className:"h-4 w-4"}),g("quickCreate.reward")]}),ue.jsxs("span",{className:"text-sm font-medium",children:[H," krediter"]})]}),ue.jsx(DS,{value:[H],onValueChange:([It])=>X(It),min:10,max:300,step:10}),ue.jsx("p",{className:"text-xs text-muted-foreground",children:g("quickCreate.creditsPerPhoto",{amount:Dt.toFixed(0)})})]}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsxs("div",{className:"flex items-center justify-between",children:[ue.jsx(Cp,{children:g("quickCreate.radius")}),ue.jsxs("span",{className:"text-sm font-medium",children:[ae," m"]})]}),ue.jsx(DS,{value:[ae],onValueChange:([It])=>ne(It),min:25,max:500,step:25})]}),ue.jsxs("div",{className:"space-y-3",children:[ue.jsx(Cp,{children:g("quickCreate.exampleImages")}),ue.jsx("input",{ref:He,type:"file",accept:"image/*",multiple:!0,onChange:It=>Xe(It,"good"),className:"hidden"}),ue.jsx("input",{ref:nt,type:"file",accept:"image/*",multiple:!0,onChange:It=>Xe(It,"bad"),className:"hidden"}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-green-600 dark:text-green-400",children:[ue.jsx(mW,{className:"h-4 w-4"}),g("quickCreate.goodExamples")]}),ue.jsxs("div",{className:"flex flex-wrap gap-2",children:[re.map((It,kt)=>({img:It,index:kt})).filter(({img:It})=>It.type==="good").map(({img:It,index:kt})=>ue.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden border-2 border-green-500/50",children:[ue.jsx("img",{src:It.preview,alt:g("quickCreate.goodExampleAlt"),className:"w-full h-full object-cover"}),ue.jsx("button",{type:"button",onClick:()=>ft(kt),className:"absolute top-1 right-1 p-0.5 bg-background/80 rounded-full hover:bg-background",children:ue.jsx(jp,{className:"h-3 w-3"})})]},kt)),ue.jsxs("button",{type:"button",onClick:()=>{var It;return(It=He.current)==null?void 0:It.click()},className:"w-20 h-20 rounded-lg border-2 border-dashed border-green-500/30 hover:border-green-500/50 flex flex-col items-center justify-center text-green-600 dark:text-green-400 transition-colors",children:[ue.jsx(AC,{className:"h-5 w-5"}),ue.jsx("span",{className:"text-[10px] mt-0.5",children:g("quickCreate.addImage")})]})]})]}),ue.jsxs("div",{className:"space-y-2",children:[ue.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-red-600 dark:text-red-400",children:[ue.jsx(gW,{className:"h-4 w-4"}),g("quickCreate.badExamples")]}),ue.jsxs("div",{className:"flex flex-wrap gap-2",children:[re.map((It,kt)=>({img:It,index:kt})).filter(({img:It})=>It.type==="bad").map(({img:It,index:kt})=>ue.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden border-2 border-red-500/50",children:[ue.jsx("img",{src:It.preview,alt:g("quickCreate.badExampleAlt"),className:"w-full h-full object-cover"}),ue.jsx("button",{type:"button",onClick:()=>ft(kt),className:"absolute top-1 right-1 p-0.5 bg-background/80 rounded-full hover:bg-background",children:ue.jsx(jp,{className:"h-3 w-3"})})]},kt)),ue.jsxs("button",{type:"button",onClick:()=>{var It;return(It=nt.current)==null?void 0:It.click()},className:"w-20 h-20 rounded-lg border-2 border-dashed border-red-500/30 hover:border-red-500/50 flex flex-col items-center justify-center text-red-600 dark:text-red-400 transition-colors",children:[ue.jsx(AC,{className:"h-5 w-5"}),ue.jsx("span",{className:"text-[10px] mt-0.5",children:g("quickCreate.addImage")})]})]})]}),ue.jsx("p",{className:"text-xs text-muted-foreground",children:g("quickCreate.exampleHint")})]})]}),ue.jsxs("div",{className:"flex gap-2",children:[ue.jsx(ol,{variant:"outline",className:"flex-1",onClick:()=>t(!1),disabled:me,children:g("quickCreate.cancel")}),ue.jsx(ol,{className:"flex-1",onClick:Bt,disabled:me||!E.trim()||!s,children:me?ue.jsxs(ue.Fragment,{children:[ue.jsx(rT,{className:"h-4 w-4 mr-2 animate-spin"}),g("quickCreate.creating")]}):g("quickCreate.createMission")})]})]})})}const noe=()=>{const{t:n}=nm(),{user:t}=tm();Cre();const{latitude:s,longitude:h,requestPosition:g}=UM(),{activeClaim:v,hasActiveClaim:E}=Pre(),[c,T]=Y.useState(""),[L,B]=Y.useState(!1),{missions:U,isFocusMode:H,refetch:X}=Are(s,h,{activeClaimMissionId:v==null?void 0:v.mission_id}),ae=Y_(),[ne]=dY(),[me,oe]=Y.useState(null),[re,he]=Y.useState(!1),[_e,De]=Y.useState("walking"),{route:He,loading:nt,fetchRoute:Xe,clearRoute:ft}=tre();Y.useEffect(()=>{if(v!=null&&v.mission_id&&U.length>0){const wt=U.find(Zt=>Zt.id===v.mission_id);wt&&T(wt.title)}},[v,U]);const At=Y.useMemo(()=>{const wt=ne.get("zoom-to");if(!wt)return null;const[Zt,zt]=wt.split(",").map(Number);return isNaN(Zt)||isNaN(zt)?null:{latitude:Zt,longitude:zt}},[ne]);Y.useEffect(()=>{if(At){sessionStorage.removeItem("activeRoute"),oe(null),he(!1);return}const wt=sessionStorage.getItem("activeRoute");if(wt)try{const Zt=JSON.parse(wt);oe(Zt),he(!0)}catch(Zt){console.error("Failed to parse route data:",Zt)}},[At]);const Bt=Y.useCallback(async wt=>{!s||!h||!At||(De(wt),he(!0),await Xe(s,h,At.latitude,At.longitude,wt))},[s,h,At,Xe]),Dt=Y.useCallback(()=>{sessionStorage.removeItem("activeRoute"),oe(null),he(!1),ft()},[ft]);Y.useEffect(()=>{He&&re&&(oe(He),sessionStorage.setItem("activeRoute",JSON.stringify(He)))},[He,re]);const It=wt=>{sessionStorage.removeItem("activeRoute"),oe(null),ae(`/mission/${wt.id}`)},kt=async()=>{if(!t){Jo.error(n("map.loginToCreate")),ae("/auth");return}if((!s||!h)&&(Jo.info(n("map.gettingLocation")),!await g())){Jo.error(n("map.couldNotGetPosition"));return}B(!0)};return ue.jsxs("div",{className:"h-screen w-full flex flex-col bg-background",children:[t&&ue.jsx("div",{className:"absolute top-4 right-4 z-30",style:{top:"calc(env(safe-area-inset-top, 0px) + 16px)"},children:ue.jsx(ol,{size:"icon",onClick:kt,className:"h-10 w-10 rounded-full shadow-lg bg-primary hover:bg-primary/90",title:n("map.createMissionHere"),children:ue.jsx(AC,{className:"h-5 w-5"})})}),E&&c&&ue.jsx(Dre,{missionTitle:c,isVisible:H}),ue.jsx("div",{className:"flex-1 relative",children:ue.jsx(PU,{missions:U,userLocation:s&&h?{latitude:s,longitude:h}:null,onMissionSelect:It,activeRoute:me,onStartNavigation:Bt,onClearNavigation:Dt,isNavigating:re,navigationLoading:nt,selectedTravelMode:_e,zoomToTarget:At})}),L&&s&&h&&ue.jsx(toe,{open:L,onOpenChange:B,location:{latitude:s,longitude:h},onSuccess:()=>{B(!1),X()}}),ue.jsx(RU,{})]})},roe=Y.lazy(()=>Ri(()=>import("./Index-BHs-gF4l.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),ioe=Y.lazy(()=>Ri(()=>import("./Auth-BZtkFe2c.js"),__vite__mapDeps([7,8,9,10,11,12]))),ooe=Y.lazy(()=>Ri(()=>import("./MissionDetail-Bkj3Z1-2.js"),__vite__mapDeps([13,14,15,16,17,5,11,18,19,20,21,22,23,24,25,2,26,27,1]))),soe=Y.lazy(()=>Ri(()=>import("./Profile-Bs_7SKke.js"),__vite__mapDeps([28,29,4,3,19,30,31,15,32,1,2,33,10,34,35,36,37,8,18,5,38,39,40,41]))),aoe=Y.lazy(()=>Ri(()=>import("./Wallet-DhBioTUc.js"),__vite__mapDeps([42,29,4,3,19,30,31,43,44,22,16,2,45,46,11,47,34,48,37,24,49,50,51,52,53,54,38,33,5]))),loe=Y.lazy(()=>Ri(()=>import("./Notifications-BvwbWrtB.js"),__vite__mapDeps([55,44]))),coe=Y.lazy(()=>Ri(()=>import("./VerifyIdentity-CVO73JZ2.js"),__vite__mapDeps([56,18,51,2,17,5,11,19,39,25,16,1]))),uoe=Y.lazy(()=>Ri(()=>import("./OrdererRegistration-BiflvXWp.js"),__vite__mapDeps([57,58,4,30,25,5,38,59,39,51]))),doe=Y.lazy(()=>Ri(()=>import("./CreateMission-DTYpAitx.js"),__vite__mapDeps([60,11,61,31,58,4,30,36,37,19,25,50,62,54,22,63]))),hoe=Y.lazy(()=>Ri(()=>import("./CreateCampaign-ssmSrgNm.js"),__vite__mapDeps([64,58,4,30,36,37,19,65,35,27,66,1,2,8,45,10,38,47,59,12,26,22,18,21,48,40,67,68,23,49,31,69,3,25,50,11,62,54]))),foe=Y.lazy(()=>Ri(()=>import("./OrdererDashboard-CFnxw39_.js"),__vite__mapDeps([70,31,71,4,72,73,36,37,19,33,11,10,63,24,5,25,35,74,18,2,75,21,6,67,1,26,53,51,52,76,77,38]))),poe=Y.lazy(()=>Ri(()=>import("./RealChangeMission-BP6arpm_.js"),__vite__mapDeps([78,11,25,20,22,2,23,54,26,65,38,47,40,35,34,79,6]))),moe=Y.lazy(()=>Ri(()=>import("./OrdererMissionDetail-rIgIT4BY.js"),__vite__mapDeps([80,31,14,72,5,25,41,10,26,33,2,61,66]))),goe=Y.lazy(()=>Ri(()=>import("./OperationsPopout-BydwqHpi.js"),__vite__mapDeps([81,31,71,4,72,25,35,26,2,5,1,10,53,75]))),_oe=Y.lazy(()=>Ri(()=>import("./AnalyticsPopout-rWRAHbbT.js"),__vite__mapDeps([82,31,25,74,33,21,35,51,52,76]))),yoe=Y.lazy(()=>Ri(()=>import("./AdsPopout-ovL1xFgb.js"),__vite__mapDeps([83,73,31,36,37,19,33,11,10,63,25,26]))),voe=Y.lazy(()=>Ri(()=>import("./Principles-CmpgkpiO.js"),__vite__mapDeps([84,72,18,47,10,85,77,48,37,11,25]))),xoe=Y.lazy(()=>Ri(()=>import("./Policy-mB-84Q1T.js"),__vite__mapDeps([86,71,4,72,68,76,79,59,18,47,10,85,77,48,37,11]))),boe=Y.lazy(()=>Ri(()=>import("./Integritetspolicy-UTJ2l2uy.js"),__vite__mapDeps([87,25]))),woe=Y.lazy(()=>Ri(()=>import("./Villkor-DWXP9YER.js"),__vite__mapDeps([88,25]))),Soe=Y.lazy(()=>Ri(()=>import("./PhotoMarketplace-DHi_u6nN.js"),__vite__mapDeps([89,31,36,37,19,49,90,25,69,10,52,47]))),Toe=Y.lazy(()=>Ri(()=>import("./PhotoDetail-CWLPRqgG.js"),__vite__mapDeps([91,31,90,25,47,10,52,24]))),Eoe=Y.lazy(()=>Ri(()=>import("./PhotoContest-ByCNK-WJ.js"),__vite__mapDeps([92,72,31,32,43,44,25,47,2,54,26,61]))),koe=Y.lazy(()=>Ri(()=>import("./IdentityDisclaimer-D9ew3vwe.js"),__vite__mapDeps([93,25,18,51,2,21]))),Aoe=Y.lazy(()=>Ri(()=>import("./NotFound-Bmr3E4EB.js"),[])),Coe=Y.lazy(()=>Ri(()=>import("./RedeemVoucher-BpkWcNI_.js"),__vite__mapDeps([94,46,16,5]))),Ioe=Y.lazy(()=>Ri(()=>import("./ResetPassword-UPJcC126.js"),__vite__mapDeps([95,16,9,10]))),Moe=()=>ue.jsxs("div",{className:"min-h-screen bg-background p-4 space-y-4",children:[ue.jsx(Yw,{className:"h-12 w-3/4"}),ue.jsx(Yw,{className:"h-32 w-full"}),ue.jsx(Yw,{className:"h-32 w-full"}),ue.jsx(Yw,{className:"h-20 w-full"})]}),Poe=new sK({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1,retry:1}}});function Doe(){try{const n=document.getElementById("loading");n&&(n.style.opacity="0",setTimeout(()=>n.remove(),300))}catch(n){console.warn("[App] failed to hide loading spinner:",n)}}const Roe=()=>(Doe(),ue.jsx(aK,{client:Poe,children:ue.jsx(eQ,{children:ue.jsx(WY,{children:ue.jsxs(MX,{children:[ue.jsx(pq,{}),ue.jsx(Wq,{}),ue.jsx(aY,{children:ue.jsx(nQ,{children:ue.jsx(Y.Suspense,{fallback:ue.jsx(Moe,{}),children:ue.jsxs(JK,{children:[ue.jsx(vi,{path:"/",element:ue.jsx(roe,{})}),ue.jsx(vi,{path:"/auth",element:ue.jsx(ioe,{})}),ue.jsx(vi,{path:"/mission/:id",element:ue.jsx(ooe,{})}),ue.jsx(vi,{path:"/profile",element:ue.jsx(soe,{})}),ue.jsx(vi,{path:"/wallet",element:ue.jsx(aoe,{})}),ue.jsx(vi,{path:"/notifications",element:ue.jsx(loe,{})}),ue.jsx(vi,{path:"/map",element:ue.jsx(noe,{})}),ue.jsx(vi,{path:"/verify-identity",element:ue.jsx(coe,{})}),ue.jsx(vi,{path:"/orderer/register",element:ue.jsx(uoe,{})}),ue.jsx(vi,{path:"/orderer/dashboard",element:ue.jsx(foe,{})}),ue.jsx(vi,{path:"/orderer/create-mission",element:ue.jsx(doe,{})}),ue.jsx(vi,{path:"/orderer/create-campaign",element:ue.jsx(hoe,{})}),ue.jsx(vi,{path:"/orderer/mission/:id",element:ue.jsx(moe,{})}),ue.jsx(vi,{path:"/orderer/operations",element:ue.jsx(goe,{})}),ue.jsx(vi,{path:"/orderer/analytics",element:ue.jsx(_oe,{})}),ue.jsx(vi,{path:"/orderer/ads",element:ue.jsx(yoe,{})}),ue.jsx(vi,{path:"/real-change-mission",element:ue.jsx(poe,{})}),ue.jsx(vi,{path:"/principer",element:ue.jsx(voe,{})}),ue.jsx(vi,{path:"/policy",element:ue.jsx(xoe,{})}),ue.jsx(vi,{path:"/integritetspolicy",element:ue.jsx(boe,{})}),ue.jsx(vi,{path:"/villkor",element:ue.jsx(woe,{})}),ue.jsx(vi,{path:"/photo-marketplace",element:ue.jsx(Soe,{})}),ue.jsx(vi,{path:"/photo/:id",element:ue.jsx(Toe,{})}),ue.jsx(vi,{path:"/photo-contest/:contestId",element:ue.jsx(Eoe,{})}),ue.jsx(vi,{path:"/identity-disclaimer",element:ue.jsx(koe,{})}),ue.jsx(vi,{path:"/redeem",element:ue.jsx(Coe,{})}),ue.jsx(vi,{path:"/reset-password",element:ue.jsx(Ioe,{})}),ue.jsx(vi,{path:"*",element:ue.jsx(Aoe,{})})]})})})})]})})})})),dr=n=>typeof n=="string",R0=()=>{let n,t;const s=new Promise((h,g)=>{n=h,t=g});return s.resolve=n,s.reject=t,s},gB=n=>n==null?"":""+n,Loe=(n,t,s)=>{n.forEach(h=>{t[h]&&(s[h]=t[h])})},Ooe=/###/g,_B=n=>n&&n.indexOf("###")>-1?n.replace(Ooe,"."):n,yB=n=>!n||dr(n),nx=(n,t,s)=>{const h=dr(t)?t.split("."):t;let g=0;for(;g<h.length-1;){if(yB(n))return{};const v=_B(h[g]);!n[v]&&s&&(n[v]=new s),Object.prototype.hasOwnProperty.call(n,v)?n=n[v]:n={},++g}return yB(n)?{}:{obj:n,k:_B(h[g])}},vB=(n,t,s)=>{const{obj:h,k:g}=nx(n,t,Object);if(h!==void 0||t.length===1){h[g]=s;return}let v=t[t.length-1],E=t.slice(0,t.length-1),c=nx(n,E,Object);for(;c.obj===void 0&&E.length;)v=`${E[E.length-1]}.${v}`,E=E.slice(0,E.length-1),c=nx(n,E,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${v}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${v}`]=s},Foe=(n,t,s,h)=>{const{obj:g,k:v}=nx(n,t,Object);g[v]=g[v]||[],g[v].push(s)},TT=(n,t)=>{const{obj:s,k:h}=nx(n,t);if(s&&Object.prototype.hasOwnProperty.call(s,h))return s[h]},zoe=(n,t,s)=>{const h=TT(n,s);return h!==void 0?h:TT(t,s)},M6=(n,t,s)=>{for(const h in t)h!=="__proto__"&&h!=="constructor"&&(h in n?dr(n[h])||n[h]instanceof String||dr(t[h])||t[h]instanceof String?s&&(n[h]=t[h]):M6(n[h],t[h],s):n[h]=t[h]);return n},Og=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Boe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Noe=n=>dr(n)?n.replace(/[&<>"'\/]/g,t=>Boe[t]):n;class Voe{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const s=this.regExpMap.get(t);if(s!==void 0)return s;const h=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,h),this.regExpQueue.push(t),h}}const joe=[" ",",","?","!",";"],Uoe=new Voe(20),Goe=(n,t,s)=>{t=t||"",s=s||"";const h=joe.filter(E=>t.indexOf(E)<0&&s.indexOf(E)<0);if(h.length===0)return!0;const g=Uoe.getRegExp(`(${h.map(E=>E==="?"?"\\?":E).join("|")})`);let v=!g.test(n);if(!v){const E=n.indexOf(s);E>0&&!g.test(n.substring(0,E))&&(v=!0)}return v},xI=function(n,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[t])return Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0;const h=t.split(s);let g=n;for(let v=0;v<h.length;){if(!g||typeof g!="object")return;let E,c="";for(let T=v;T<h.length;++T)if(T!==v&&(c+=s),c+=h[T],E=g[c],E!==void 0){if(["string","number","boolean"].indexOf(typeof E)>-1&&T<h.length-1)continue;v+=T-v+1;break}g=E}return g},ET=n=>n==null?void 0:n.replace("_","-"),$oe={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,t){var s,h;(h=(s=console==null?void 0:console[n])==null?void 0:s.apply)==null||h.call(s,console,t)}};class kT{constructor(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,s)}init(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=s.prefix||"i18next:",this.logger=t||$oe,this.options=s,this.debug=s.debug}log(){for(var t=arguments.length,s=new Array(t),h=0;h<t;h++)s[h]=arguments[h];return this.forward(s,"log","",!0)}warn(){for(var t=arguments.length,s=new Array(t),h=0;h<t;h++)s[h]=arguments[h];return this.forward(s,"warn","",!0)}error(){for(var t=arguments.length,s=new Array(t),h=0;h<t;h++)s[h]=arguments[h];return this.forward(s,"error","")}deprecate(){for(var t=arguments.length,s=new Array(t),h=0;h<t;h++)s[h]=arguments[h];return this.forward(s,"warn","WARNING DEPRECATED: ",!0)}forward(t,s,h,g){return g&&!this.debug?null:(dr(t[0])&&(t[0]=`${h}${this.prefix} ${t[0]}`),this.logger[s](t))}create(t){return new kT(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new kT(this.logger,t)}}var mu=new kT;class h2{constructor(){this.observers={}}on(t,s){return t.split(" ").forEach(h=>{this.observers[h]||(this.observers[h]=new Map);const g=this.observers[h].get(s)||0;this.observers[h].set(s,g+1)}),this}off(t,s){if(this.observers[t]){if(!s){delete this.observers[t];return}this.observers[t].delete(s)}}emit(t){for(var s=arguments.length,h=new Array(s>1?s-1:0),g=1;g<s;g++)h[g-1]=arguments[g];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(E=>{let[c,T]=E;for(let L=0;L<T;L++)c(...h)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(E=>{let[c,T]=E;for(let L=0;L<T;L++)c.apply(c,[t,...h])})}}class xB extends h2{constructor(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const s=this.options.ns.indexOf(t);s>-1&&this.options.ns.splice(s,1)}getResource(t,s,h){var L,B;let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const v=g.keySeparator!==void 0?g.keySeparator:this.options.keySeparator,E=g.ignoreJSONStructure!==void 0?g.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;t.indexOf(".")>-1?c=t.split("."):(c=[t,s],h&&(Array.isArray(h)?c.push(...h):dr(h)&&v?c.push(...h.split(v)):c.push(h)));const T=TT(this.data,c);return!T&&!s&&!h&&t.indexOf(".")>-1&&(t=c[0],s=c[1],h=c.slice(2).join(".")),T||!E||!dr(h)?T:xI((B=(L=this.data)==null?void 0:L[t])==null?void 0:B[s],h,v)}addResource(t,s,h,g){let v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const E=v.keySeparator!==void 0?v.keySeparator:this.options.keySeparator;let c=[t,s];h&&(c=c.concat(E?h.split(E):h)),t.indexOf(".")>-1&&(c=t.split("."),g=s,s=c[1]),this.addNamespaces(s),vB(this.data,c,g),v.silent||this.emit("added",t,s,h,g)}addResources(t,s,h){let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const v in h)(dr(h[v])||Array.isArray(h[v]))&&this.addResource(t,s,v,h[v],{silent:!0});g.silent||this.emit("added",t,s,h)}addResourceBundle(t,s,h,g,v){let E=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[t,s];t.indexOf(".")>-1&&(c=t.split("."),g=h,h=s,s=c[1]),this.addNamespaces(s);let T=TT(this.data,c)||{};E.skipCopy||(h=JSON.parse(JSON.stringify(h))),g?M6(T,h,v):T={...T,...h},vB(this.data,c,T),E.silent||this.emit("added",t,s,h)}removeResourceBundle(t,s){this.hasResourceBundle(t,s)&&delete this.data[t][s],this.removeNamespaces(s),this.emit("removed",t,s)}hasResourceBundle(t,s){return this.getResource(t,s)!==void 0}getResourceBundle(t,s){return s||(s=this.options.defaultNS),this.getResource(t,s)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const s=this.getDataByLanguage(t);return!!(s&&Object.keys(s)||[]).find(g=>s[g]&&Object.keys(s[g]).length>0)}toJSON(){return this.data}}var P6={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,t,s,h,g){return n.forEach(v=>{var E;t=((E=this.processors[v])==null?void 0:E.process(t,s,h,g))??t}),t}};const bB={},wB=n=>!dr(n)&&typeof n!="boolean"&&typeof n!="number";class AT extends h2{constructor(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Loe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mu.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const h=this.resolve(t,s);return(h==null?void 0:h.res)!==void 0}extractFromKey(t,s){let h=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const g=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let v=s.ns||this.options.defaultNS||[];const E=h&&t.indexOf(h)>-1,c=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Goe(t,h,g);if(E&&!c){const T=t.match(this.interpolator.nestingRegexp);if(T&&T.length>0)return{key:t,namespaces:dr(v)?[v]:v};const L=t.split(h);(h!==g||h===g&&this.options.ns.indexOf(L[0])>-1)&&(v=L.shift()),t=L.join(g)}return{key:t,namespaces:dr(v)?[v]:v}}translate(t,s,h){if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const g=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,v=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:E,namespaces:c}=this.extractFromKey(t[t.length-1],s),T=c[c.length-1],L=s.lng||this.language,B=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((L==null?void 0:L.toLowerCase())==="cimode"){if(B){const Bt=s.nsSeparator||this.options.nsSeparator;return g?{res:`${T}${Bt}${E}`,usedKey:E,exactUsedKey:E,usedLng:L,usedNS:T,usedParams:this.getUsedParamsDetails(s)}:`${T}${Bt}${E}`}return g?{res:E,usedKey:E,exactUsedKey:E,usedLng:L,usedNS:T,usedParams:this.getUsedParamsDetails(s)}:E}const U=this.resolve(t,s);let H=U==null?void 0:U.res;const X=(U==null?void 0:U.usedKey)||E,ae=(U==null?void 0:U.exactUsedKey)||E,ne=["[object Number]","[object Function]","[object RegExp]"],me=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,oe=!this.i18nFormat||this.i18nFormat.handleAsObject,re=s.count!==void 0&&!dr(s.count),he=AT.hasDefaultValue(s),_e=re?this.pluralResolver.getSuffix(L,s.count,s):"",De=s.ordinal&&re?this.pluralResolver.getSuffix(L,s.count,{ordinal:!1}):"",He=re&&!s.ordinal&&s.count===0,nt=He&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${_e}`]||s[`defaultValue${De}`]||s.defaultValue;let Xe=H;oe&&!H&&he&&(Xe=nt);const ft=wB(Xe),At=Object.prototype.toString.apply(Xe);if(oe&&Xe&&ft&&ne.indexOf(At)<0&&!(dr(me)&&Array.isArray(Xe))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Bt=this.options.returnedObjectHandler?this.options.returnedObjectHandler(X,Xe,{...s,ns:c}):`key '${E} (${this.language})' returned an object instead of string.`;return g?(U.res=Bt,U.usedParams=this.getUsedParamsDetails(s),U):Bt}if(v){const Bt=Array.isArray(Xe),Dt=Bt?[]:{},It=Bt?ae:X;for(const kt in Xe)if(Object.prototype.hasOwnProperty.call(Xe,kt)){const wt=`${It}${v}${kt}`;he&&!H?Dt[kt]=this.translate(wt,{...s,defaultValue:wB(nt)?nt[kt]:void 0,joinArrays:!1,ns:c}):Dt[kt]=this.translate(wt,{...s,joinArrays:!1,ns:c}),Dt[kt]===wt&&(Dt[kt]=Xe[kt])}H=Dt}}else if(oe&&dr(me)&&Array.isArray(H))H=H.join(me),H&&(H=this.extendTranslation(H,t,s,h));else{let Bt=!1,Dt=!1;!this.isValidLookup(H)&&he&&(Bt=!0,H=nt),this.isValidLookup(H)||(Dt=!0,H=E);const kt=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Dt?void 0:H,wt=he&&nt!==H&&this.options.updateMissing;if(Dt||Bt||wt){if(this.logger.log(wt?"updateKey":"missingKey",L,T,E,wt?nt:H),v){const pt=this.resolve(E,{...s,keySeparator:!1});pt&&pt.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Zt=[];const zt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&zt&&zt[0])for(let pt=0;pt<zt.length;pt++)Zt.push(zt[pt]);else this.options.saveMissingTo==="all"?Zt=this.languageUtils.toResolveHierarchy(s.lng||this.language):Zt.push(s.lng||this.language);const vt=(pt,Pt,An)=>{var Vn;const bn=he&&An!==H?An:kt;this.options.missingKeyHandler?this.options.missingKeyHandler(pt,T,Pt,bn,wt,s):(Vn=this.backendConnector)!=null&&Vn.saveMissing&&this.backendConnector.saveMissing(pt,T,Pt,bn,wt,s),this.emit("missingKey",pt,T,Pt,H)};this.options.saveMissing&&(this.options.saveMissingPlurals&&re?Zt.forEach(pt=>{const Pt=this.pluralResolver.getSuffixes(pt,s);He&&s[`defaultValue${this.options.pluralSeparator}zero`]&&Pt.indexOf(`${this.options.pluralSeparator}zero`)<0&&Pt.push(`${this.options.pluralSeparator}zero`),Pt.forEach(An=>{vt([pt],E+An,s[`defaultValue${An}`]||nt)})}):vt(Zt,E,nt))}H=this.extendTranslation(H,t,s,U,h),Dt&&H===E&&this.options.appendNamespaceToMissingKey&&(H=`${T}:${E}`),(Dt||Bt)&&this.options.parseMissingKeyHandler&&(H=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${T}:${E}`:E,Bt?H:void 0))}return g?(U.res=H,U.usedParams=this.getUsedParamsDetails(s),U):H}extendTranslation(t,s,h,g,v){var L,B;var E=this;if((L=this.i18nFormat)!=null&&L.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...h},h.lng||this.language||g.usedLng,g.usedNS,g.usedKey,{resolved:g});else if(!h.skipInterpolation){h.interpolation&&this.interpolator.init({...h,interpolation:{...this.options.interpolation,...h.interpolation}});const U=dr(t)&&(((B=h==null?void 0:h.interpolation)==null?void 0:B.skipOnVariables)!==void 0?h.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let H;if(U){const ae=t.match(this.interpolator.nestingRegexp);H=ae&&ae.length}let X=h.replace&&!dr(h.replace)?h.replace:h;if(this.options.interpolation.defaultVariables&&(X={...this.options.interpolation.defaultVariables,...X}),t=this.interpolator.interpolate(t,X,h.lng||this.language||g.usedLng,h),U){const ae=t.match(this.interpolator.nestingRegexp),ne=ae&&ae.length;H<ne&&(h.nest=!1)}!h.lng&&g&&g.res&&(h.lng=this.language||g.usedLng),h.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var ae=arguments.length,ne=new Array(ae),me=0;me<ae;me++)ne[me]=arguments[me];return(v==null?void 0:v[0])===ne[0]&&!h.context?(E.logger.warn(`It seems you are nesting recursively key: ${ne[0]} in key: ${s[0]}`),null):E.translate(...ne,s)},h)),h.interpolation&&this.interpolator.reset()}const c=h.postProcess||this.options.postProcess,T=dr(c)?[c]:c;return t!=null&&(T!=null&&T.length)&&h.applyPostProcessor!==!1&&(t=P6.handle(T,t,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...g,usedParams:this.getUsedParamsDetails(h)},...h}:h,this)),t}resolve(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h,g,v,E,c;return dr(t)&&(t=[t]),t.forEach(T=>{if(this.isValidLookup(h))return;const L=this.extractFromKey(T,s),B=L.key;g=B;let U=L.namespaces;this.options.fallbackNS&&(U=U.concat(this.options.fallbackNS));const H=s.count!==void 0&&!dr(s.count),X=H&&!s.ordinal&&s.count===0,ae=s.context!==void 0&&(dr(s.context)||typeof s.context=="number")&&s.context!=="",ne=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);U.forEach(me=>{var oe,re;this.isValidLookup(h)||(c=me,!bB[`${ne[0]}-${me}`]&&((oe=this.utils)!=null&&oe.hasLoadedNamespace)&&!((re=this.utils)!=null&&re.hasLoadedNamespace(c))&&(bB[`${ne[0]}-${me}`]=!0,this.logger.warn(`key "${g}" for languages "${ne.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),ne.forEach(he=>{var He;if(this.isValidLookup(h))return;E=he;const _e=[B];if((He=this.i18nFormat)!=null&&He.addLookupKeys)this.i18nFormat.addLookupKeys(_e,B,he,me,s);else{let nt;H&&(nt=this.pluralResolver.getSuffix(he,s.count,s));const Xe=`${this.options.pluralSeparator}zero`,ft=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(H&&(_e.push(B+nt),s.ordinal&&nt.indexOf(ft)===0&&_e.push(B+nt.replace(ft,this.options.pluralSeparator)),X&&_e.push(B+Xe)),ae){const At=`${B}${this.options.contextSeparator}${s.context}`;_e.push(At),H&&(_e.push(At+nt),s.ordinal&&nt.indexOf(ft)===0&&_e.push(At+nt.replace(ft,this.options.pluralSeparator)),X&&_e.push(At+Xe))}}let De;for(;De=_e.pop();)this.isValidLookup(h)||(v=De,h=this.getResource(he,me,De,s))}))})}),{res:h,usedKey:g,exactUsedKey:v,usedLng:E,usedNS:c}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,s,h){var v;let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(v=this.i18nFormat)!=null&&v.getResource?this.i18nFormat.getResource(t,s,h,g):this.resourceStore.getResource(t,s,h,g)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],h=t.replace&&!dr(t.replace);let g=h?t.replace:t;if(h&&typeof t.count<"u"&&(g.count=t.count),this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),!h){g={...g};for(const v of s)delete g[v]}return g}static hasDefaultValue(t){const s="defaultValue";for(const h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&s===h.substring(0,s.length)&&t[h]!==void 0)return!0;return!1}}class SB{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mu.create("languageUtils")}getScriptPartFromCode(t){if(t=ET(t),!t||t.indexOf("-")<0)return null;const s=t.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(t){if(t=ET(t),!t||t.indexOf("-")<0)return t;const s=t.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(t){if(dr(t)&&t.indexOf("-")>-1){let s;try{s=Intl.getCanonicalLocales(t)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let s;return t.forEach(h=>{if(s)return;const g=this.formatLanguageCode(h);(!this.options.supportedLngs||this.isSupportedCode(g))&&(s=g)}),!s&&this.options.supportedLngs&&t.forEach(h=>{if(s)return;const g=this.getLanguagePartFromCode(h);if(this.isSupportedCode(g))return s=g;s=this.options.supportedLngs.find(v=>{if(v===g)return v;if(!(v.indexOf("-")<0&&g.indexOf("-")<0)&&(v.indexOf("-")>0&&g.indexOf("-")<0&&v.substring(0,v.indexOf("-"))===g||v.indexOf(g)===0&&g.length>1))return v})}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(t,s){if(!t)return[];if(typeof t=="function"&&(t=t(s)),dr(t)&&(t=[t]),Array.isArray(t))return t;if(!s)return t.default||[];let h=t[s];return h||(h=t[this.getScriptPartFromCode(s)]),h||(h=t[this.formatLanguageCode(s)]),h||(h=t[this.getLanguagePartFromCode(s)]),h||(h=t.default),h||[]}toResolveHierarchy(t,s){const h=this.getFallbackCodes(s||this.options.fallbackLng||[],t),g=[],v=E=>{E&&(this.isSupportedCode(E)?g.push(E):this.logger.warn(`rejecting language code not found in supportedLngs: ${E}`))};return dr(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&v(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&v(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&v(this.getLanguagePartFromCode(t))):dr(t)&&v(this.formatLanguageCode(t)),h.forEach(E=>{g.indexOf(E)<0&&v(this.formatLanguageCode(E))}),g}}const TB={zero:0,one:1,two:2,few:3,many:4,other:5},EB={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Hoe{constructor(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=s,this.logger=mu.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,s){this.rules[t]=s}clearCache(){this.pluralRulesCache={}}getRule(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const h=ET(t==="dev"?"en":t),g=s.ordinal?"ordinal":"cardinal",v=JSON.stringify({cleanedCode:h,type:g});if(v in this.pluralRulesCache)return this.pluralRulesCache[v];let E;try{E=new Intl.PluralRules(h,{type:g})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),EB;if(!t.match(/-|_/))return EB;const T=this.languageUtils.getLanguagePartFromCode(t);E=this.getRule(T,s)}return this.pluralRulesCache[v]=E,E}needsPlural(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=this.getRule(t,s);return h||(h=this.getRule("dev",s)),(h==null?void 0:h.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,s){let h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,h).map(g=>`${s}${g}`)}getSuffixes(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=this.getRule(t,s);return h||(h=this.getRule("dev",s)),h?h.resolvedOptions().pluralCategories.sort((g,v)=>TB[g]-TB[v]).map(g=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${g}`):[]}getSuffix(t,s){let h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const g=this.getRule(t,h);return g?`${this.options.prepend}${h.ordinal?`ordinal${this.options.prepend}`:""}${g.select(s)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",s,h))}}const kB=function(n,t,s){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",g=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,v=zoe(n,t,s);return!v&&g&&dr(s)&&(v=xI(n,s,h),v===void 0&&(v=xI(t,s,h))),v},CA=n=>n.replace(/\$/g,"$$$$");class Woe{constructor(){var s;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mu.create("interpolator"),this.options=t,this.format=((s=t==null?void 0:t.interpolation)==null?void 0:s.format)||(h=>h),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:s,escapeValue:h,useRawValueToEscape:g,prefix:v,prefixEscaped:E,suffix:c,suffixEscaped:T,formatSeparator:L,unescapeSuffix:B,unescapePrefix:U,nestingPrefix:H,nestingPrefixEscaped:X,nestingSuffix:ae,nestingSuffixEscaped:ne,nestingOptionsSeparator:me,maxReplaces:oe,alwaysFormat:re}=t.interpolation;this.escape=s!==void 0?s:Noe,this.escapeValue=h!==void 0?h:!0,this.useRawValueToEscape=g!==void 0?g:!1,this.prefix=v?Og(v):E||"{{",this.suffix=c?Og(c):T||"}}",this.formatSeparator=L||",",this.unescapePrefix=B?"":U||"-",this.unescapeSuffix=this.unescapePrefix?"":B||"",this.nestingPrefix=H?Og(H):X||Og("$t("),this.nestingSuffix=ae?Og(ae):ne||Og(")"),this.nestingOptionsSeparator=me||",",this.maxReplaces=oe||1e3,this.alwaysFormat=re!==void 0?re:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(s,h)=>(s==null?void 0:s.source)===h?(s.lastIndex=0,s):new RegExp(h,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,s,h,g){var X;let v,E,c;const T=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},L=ae=>{if(ae.indexOf(this.formatSeparator)<0){const re=kB(s,T,ae,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(re,void 0,h,{...g,...s,interpolationkey:ae}):re}const ne=ae.split(this.formatSeparator),me=ne.shift().trim(),oe=ne.join(this.formatSeparator).trim();return this.format(kB(s,T,me,this.options.keySeparator,this.options.ignoreJSONStructure),oe,h,{...g,...s,interpolationkey:me})};this.resetRegExp();const B=(g==null?void 0:g.missingInterpolationHandler)||this.options.missingInterpolationHandler,U=((X=g==null?void 0:g.interpolation)==null?void 0:X.skipOnVariables)!==void 0?g.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:ae=>CA(ae)},{regex:this.regexp,safeValue:ae=>this.escapeValue?CA(this.escape(ae)):CA(ae)}].forEach(ae=>{for(c=0;v=ae.regex.exec(t);){const ne=v[1].trim();if(E=L(ne),E===void 0)if(typeof B=="function"){const oe=B(t,v,g);E=dr(oe)?oe:""}else if(g&&Object.prototype.hasOwnProperty.call(g,ne))E="";else if(U){E=v[0];continue}else this.logger.warn(`missed to pass in variable ${ne} for interpolating ${t}`),E="";else!dr(E)&&!this.useRawValueToEscape&&(E=gB(E));const me=ae.safeValue(E);if(t=t.replace(v[0],me),U?(ae.regex.lastIndex+=E.length,ae.regex.lastIndex-=v[0].length):ae.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),t}nest(t,s){let h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},g,v,E;const c=(T,L)=>{const B=this.nestingOptionsSeparator;if(T.indexOf(B)<0)return T;const U=T.split(new RegExp(`${B}[ ]*{`));let H=`{${U[1]}`;T=U[0],H=this.interpolate(H,E);const X=H.match(/'/g),ae=H.match(/"/g);(((X==null?void 0:X.length)??0)%2===0&&!ae||ae.length%2!==0)&&(H=H.replace(/'/g,'"'));try{E=JSON.parse(H),L&&(E={...L,...E})}catch(ne){return this.logger.warn(`failed parsing options string in nesting for key ${T}`,ne),`${T}${B}${H}`}return E.defaultValue&&E.defaultValue.indexOf(this.prefix)>-1&&delete E.defaultValue,T};for(;g=this.nestingRegexp.exec(t);){let T=[];E={...h},E=E.replace&&!dr(E.replace)?E.replace:E,E.applyPostProcessor=!1,delete E.defaultValue;let L=!1;if(g[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(g[1])){const B=g[1].split(this.formatSeparator).map(U=>U.trim());g[1]=B.shift(),T=B,L=!0}if(v=s(c.call(this,g[1].trim(),E),E),v&&g[0]===t&&!dr(v))return v;dr(v)||(v=gB(v)),v||(this.logger.warn(`missed to resolve ${g[1]} for nesting ${t}`),v=""),L&&(v=T.reduce((B,U)=>this.format(B,U,h.lng,{...h,interpolationkey:g[1].trim()}),v.trim())),t=t.replace(g[0],v),this.regexp.lastIndex=0}return t}}const qoe=n=>{let t=n.toLowerCase().trim();const s={};if(n.indexOf("(")>-1){const h=n.split("(");t=h[0].toLowerCase().trim();const g=h[1].substring(0,h[1].length-1);t==="currency"&&g.indexOf(":")<0?s.currency||(s.currency=g.trim()):t==="relativetime"&&g.indexOf(":")<0?s.range||(s.range=g.trim()):g.split(";").forEach(E=>{if(E){const[c,...T]=E.split(":"),L=T.join(":").trim().replace(/^'+|'+$/g,""),B=c.trim();s[B]||(s[B]=L),L==="false"&&(s[B]=!1),L==="true"&&(s[B]=!0),isNaN(L)||(s[B]=parseInt(L,10))}})}return{formatName:t,formatOptions:s}},Fg=n=>{const t={};return(s,h,g)=>{let v=g;g&&g.interpolationkey&&g.formatParams&&g.formatParams[g.interpolationkey]&&g[g.interpolationkey]&&(v={...v,[g.interpolationkey]:void 0});const E=h+JSON.stringify(v);let c=t[E];return c||(c=n(ET(h),g),t[E]=c),c(s)}};class Zoe{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mu.create("formatter"),this.options=t,this.formats={number:Fg((s,h)=>{const g=new Intl.NumberFormat(s,{...h});return v=>g.format(v)}),currency:Fg((s,h)=>{const g=new Intl.NumberFormat(s,{...h,style:"currency"});return v=>g.format(v)}),datetime:Fg((s,h)=>{const g=new Intl.DateTimeFormat(s,{...h});return v=>g.format(v)}),relativetime:Fg((s,h)=>{const g=new Intl.RelativeTimeFormat(s,{...h});return v=>g.format(v,h.range||"day")}),list:Fg((s,h)=>{const g=new Intl.ListFormat(s,{...h});return v=>g.format(v)})},this.init(t)}init(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=s.interpolation.formatSeparator||","}add(t,s){this.formats[t.toLowerCase().trim()]=s}addCached(t,s){this.formats[t.toLowerCase().trim()]=Fg(s)}format(t,s,h){let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const v=s.split(this.formatSeparator);if(v.length>1&&v[0].indexOf("(")>1&&v[0].indexOf(")")<0&&v.find(c=>c.indexOf(")")>-1)){const c=v.findIndex(T=>T.indexOf(")")>-1);v[0]=[v[0],...v.splice(1,c)].join(this.formatSeparator)}return v.reduce((c,T)=>{var U;const{formatName:L,formatOptions:B}=qoe(T);if(this.formats[L]){let H=c;try{const X=((U=g==null?void 0:g.formatParams)==null?void 0:U[g.interpolationkey])||{},ae=X.locale||X.lng||g.locale||g.lng||h;H=this.formats[L](c,ae,{...B,...g,...X})}catch(X){this.logger.warn(X)}return H}else this.logger.warn(`there was no format function for ${L}`);return c},t)}}const Xoe=(n,t)=>{n.pending[t]!==void 0&&(delete n.pending[t],n.pendingCount--)};class Koe extends h2{constructor(t,s,h){var v,E;let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=s,this.services=h,this.languageUtils=h.languageUtils,this.options=g,this.logger=mu.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=g.maxParallelReads||10,this.readingCalls=0,this.maxRetries=g.maxRetries>=0?g.maxRetries:5,this.retryTimeout=g.retryTimeout>=1?g.retryTimeout:350,this.state={},this.queue=[],(E=(v=this.backend)==null?void 0:v.init)==null||E.call(v,h,g.backend,g)}queueLoad(t,s,h,g){const v={},E={},c={},T={};return t.forEach(L=>{let B=!0;s.forEach(U=>{const H=`${L}|${U}`;!h.reload&&this.store.hasResourceBundle(L,U)?this.state[H]=2:this.state[H]<0||(this.state[H]===1?E[H]===void 0&&(E[H]=!0):(this.state[H]=1,B=!1,E[H]===void 0&&(E[H]=!0),v[H]===void 0&&(v[H]=!0),T[U]===void 0&&(T[U]=!0)))}),B||(c[L]=!0)}),(Object.keys(v).length||Object.keys(E).length)&&this.queue.push({pending:E,pendingCount:Object.keys(E).length,loaded:{},errors:[],callback:g}),{toLoad:Object.keys(v),pending:Object.keys(E),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(T)}}loaded(t,s,h){const g=t.split("|"),v=g[0],E=g[1];s&&this.emit("failedLoading",v,E,s),!s&&h&&this.store.addResourceBundle(v,E,h,void 0,void 0,{skipCopy:!0}),this.state[t]=s?-1:2,s&&h&&(this.state[t]=0);const c={};this.queue.forEach(T=>{Foe(T.loaded,[v],E),Xoe(T,t),s&&T.errors.push(s),T.pendingCount===0&&!T.done&&(Object.keys(T.loaded).forEach(L=>{c[L]||(c[L]={});const B=T.loaded[L];B.length&&B.forEach(U=>{c[L][U]===void 0&&(c[L][U]=!0)})}),T.done=!0,T.errors.length?T.callback(T.errors):T.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(T=>!T.done)}read(t,s,h){let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,E=arguments.length>5?arguments[5]:void 0;if(!t.length)return E(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:s,fcName:h,tried:g,wait:v,callback:E});return}this.readingCalls++;const c=(L,B)=>{if(this.readingCalls--,this.waitingReads.length>0){const U=this.waitingReads.shift();this.read(U.lng,U.ns,U.fcName,U.tried,U.wait,U.callback)}if(L&&B&&g<this.maxRetries){setTimeout(()=>{this.read.call(this,t,s,h,g+1,v*2,E)},v);return}E(L,B)},T=this.backend[h].bind(this.backend);if(T.length===2){try{const L=T(t,s);L&&typeof L.then=="function"?L.then(B=>c(null,B)).catch(c):c(null,L)}catch(L){c(L)}return}return T(t,s,c)}prepareLoading(t,s){let h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},g=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),g&&g();dr(t)&&(t=this.languageUtils.toResolveHierarchy(t)),dr(s)&&(s=[s]);const v=this.queueLoad(t,s,h,g);if(!v.toLoad.length)return v.pending.length||g(),null;v.toLoad.forEach(E=>{this.loadOne(E)})}load(t,s,h){this.prepareLoading(t,s,{},h)}reload(t,s,h){this.prepareLoading(t,s,{reload:!0},h)}loadOne(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const h=t.split("|"),g=h[0],v=h[1];this.read(g,v,"read",void 0,void 0,(E,c)=>{E&&this.logger.warn(`${s}loading namespace ${v} for language ${g} failed`,E),!E&&c&&this.logger.log(`${s}loaded namespace ${v} for language ${g}`,c),this.loaded(t,E,c)})}saveMissing(t,s,h,g,v){var T,L,B,U,H;let E=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((L=(T=this.services)==null?void 0:T.utils)!=null&&L.hasLoadedNamespace&&!((U=(B=this.services)==null?void 0:B.utils)!=null&&U.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${h}" as the namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(h==null||h==="")){if((H=this.backend)!=null&&H.create){const X={...E,isUpdate:v},ae=this.backend.create.bind(this.backend);if(ae.length<6)try{let ne;ae.length===5?ne=ae(t,s,h,g,X):ne=ae(t,s,h,g),ne&&typeof ne.then=="function"?ne.then(me=>c(null,me)).catch(c):c(null,ne)}catch(ne){c(ne)}else ae(t,s,h,g,c,X)}!t||!t[0]||this.store.addResource(t[0],s,h,g)}}}const AB=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let t={};if(typeof n[1]=="object"&&(t=n[1]),dr(n[1])&&(t.defaultValue=n[1]),dr(n[2])&&(t.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const s=n[3]||n[2];Object.keys(s).forEach(h=>{t[h]=s[h]})}return t},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),CB=n=>{var t,s;return dr(n.ns)&&(n.ns=[n.ns]),dr(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),dr(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((s=(t=n.supportedLngs)==null?void 0:t.indexOf)==null?void 0:s.call(t,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},lS=()=>{},Yoe=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(s=>{typeof n[s]=="function"&&(n[s]=n[s].bind(n))})};class Fx extends h2{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(super(),this.options=CB(t),this.services={},this.logger=mu,this.modules={external:[]},Yoe(this),s&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,s),this;setTimeout(()=>{this.init(t,s)},0)}}init(){var t=this;let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof s=="function"&&(h=s,s={}),s.defaultNS==null&&s.ns&&(dr(s.ns)?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));const g=AB();this.options={...g,...this.options,...CB(s)},this.options.interpolation={...g.interpolation,...this.options.interpolation},s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);const v=B=>B?typeof B=="function"?new B:B:null;if(!this.options.isClone){this.modules.logger?mu.init(v(this.modules.logger),this.options):mu.init(null,this.options);let B;this.modules.formatter?B=this.modules.formatter:B=Zoe;const U=new SB(this.options);this.store=new xB(this.options.resources,this.options);const H=this.services;H.logger=mu,H.resourceStore=this.store,H.languageUtils=U,H.pluralResolver=new Hoe(U,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),B&&(!this.options.interpolation.format||this.options.interpolation.format===g.interpolation.format)&&(H.formatter=v(B),H.formatter.init(H,this.options),this.options.interpolation.format=H.formatter.format.bind(H.formatter)),H.interpolator=new Woe(this.options),H.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},H.backendConnector=new Koe(v(this.modules.backend),H.resourceStore,H,this.options),H.backendConnector.on("*",function(X){for(var ae=arguments.length,ne=new Array(ae>1?ae-1:0),me=1;me<ae;me++)ne[me-1]=arguments[me];t.emit(X,...ne)}),this.modules.languageDetector&&(H.languageDetector=v(this.modules.languageDetector),H.languageDetector.init&&H.languageDetector.init(H,this.options.detection,this.options)),this.modules.i18nFormat&&(H.i18nFormat=v(this.modules.i18nFormat),H.i18nFormat.init&&H.i18nFormat.init(this)),this.translator=new AT(this.services,this.options),this.translator.on("*",function(X){for(var ae=arguments.length,ne=new Array(ae>1?ae-1:0),me=1;me<ae;me++)ne[me-1]=arguments[me];t.emit(X,...ne)}),this.modules.external.forEach(X=>{X.init&&X.init(this)})}if(this.format=this.options.interpolation.format,h||(h=lS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const B=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);B.length>0&&B[0]!=="dev"&&(this.options.lng=B[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(B=>{this[B]=function(){return t.store[B](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(B=>{this[B]=function(){return t.store[B](...arguments),t}});const T=R0(),L=()=>{const B=(U,H)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),T.resolve(H),h(U,H)};if(this.languages&&!this.isInitialized)return B(null,this.t.bind(this));this.changeLanguage(this.options.lng,B)};return this.options.resources||!this.options.initAsync?L():setTimeout(L,0),T}loadResources(t){var v,E;let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lS;const g=dr(t)?t:this.language;if(typeof t=="function"&&(h=t),!this.options.resources||this.options.partialBundledLanguages){if((g==null?void 0:g.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return h();const c=[],T=L=>{if(!L||L==="cimode")return;this.services.languageUtils.toResolveHierarchy(L).forEach(U=>{U!=="cimode"&&c.indexOf(U)<0&&c.push(U)})};g?T(g):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(B=>T(B)),(E=(v=this.options.preload)==null?void 0:v.forEach)==null||E.call(v,L=>T(L)),this.services.backendConnector.load(c,this.options.ns,L=>{!L&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),h(L)})}else h(null)}reloadResources(t,s,h){const g=R0();return typeof t=="function"&&(h=t,t=void 0),typeof s=="function"&&(h=s,s=void 0),t||(t=this.languages),s||(s=this.options.ns),h||(h=lS),this.services.backendConnector.reload(t,s,v=>{g.resolve(),h(v)}),g}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&P6.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let s=0;s<this.languages.length;s++){const h=this.languages[s];if(!(["cimode","dev"].indexOf(h)>-1)&&this.store.hasLanguageSomeTranslations(h)){this.resolvedLanguage=h;break}}}changeLanguage(t,s){var h=this;this.isLanguageChangingTo=t;const g=R0();this.emit("languageChanging",t);const v=T=>{this.language=T,this.languages=this.services.languageUtils.toResolveHierarchy(T),this.resolvedLanguage=void 0,this.setResolvedLanguage(T)},E=(T,L)=>{L?(v(L),this.translator.changeLanguage(L),this.isLanguageChangingTo=void 0,this.emit("languageChanged",L),this.logger.log("languageChanged",L)):this.isLanguageChangingTo=void 0,g.resolve(function(){return h.t(...arguments)}),s&&s(T,function(){return h.t(...arguments)})},c=T=>{var B,U;!t&&!T&&this.services.languageDetector&&(T=[]);const L=dr(T)?T:this.services.languageUtils.getBestMatchFromCodes(T);L&&(this.language||v(L),this.translator.language||this.translator.changeLanguage(L),(U=(B=this.services.languageDetector)==null?void 0:B.cacheUserLanguage)==null||U.call(B,L)),this.loadResources(L,H=>{E(H,L)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(t),g}getFixedT(t,s,h){var g=this;const v=function(E,c){let T;if(typeof c!="object"){for(var L=arguments.length,B=new Array(L>2?L-2:0),U=2;U<L;U++)B[U-2]=arguments[U];T=g.options.overloadTranslationOptionHandler([E,c].concat(B))}else T={...c};T.lng=T.lng||v.lng,T.lngs=T.lngs||v.lngs,T.ns=T.ns||v.ns,T.keyPrefix!==""&&(T.keyPrefix=T.keyPrefix||h||v.keyPrefix);const H=g.options.keySeparator||".";let X;return T.keyPrefix&&Array.isArray(E)?X=E.map(ae=>`${T.keyPrefix}${H}${ae}`):X=T.keyPrefix?`${T.keyPrefix}${H}${E}`:E,g.t(X,T)};return dr(t)?v.lng=t:v.lngs=t,v.ns=s,v.keyPrefix=h,v}t(){var g;for(var t=arguments.length,s=new Array(t),h=0;h<t;h++)s[h]=arguments[h];return(g=this.translator)==null?void 0:g.translate(...s)}exists(){var g;for(var t=arguments.length,s=new Array(t),h=0;h<t;h++)s[h]=arguments[h];return(g=this.translator)==null?void 0:g.exists(...s)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const h=s.lng||this.resolvedLanguage||this.languages[0],g=this.options?this.options.fallbackLng:!1,v=this.languages[this.languages.length-1];if(h.toLowerCase()==="cimode")return!0;const E=(c,T)=>{const L=this.services.backendConnector.state[`${c}|${T}`];return L===-1||L===0||L===2};if(s.precheck){const c=s.precheck(this,E);if(c!==void 0)return c}return!!(this.hasResourceBundle(h,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||E(h,t)&&(!g||E(v,t)))}loadNamespaces(t,s){const h=R0();return this.options.ns?(dr(t)&&(t=[t]),t.forEach(g=>{this.options.ns.indexOf(g)<0&&this.options.ns.push(g)}),this.loadResources(g=>{h.resolve(),s&&s(g)}),h):(s&&s(),Promise.resolve())}loadLanguages(t,s){const h=R0();dr(t)&&(t=[t]);const g=this.options.preload||[],v=t.filter(E=>g.indexOf(E)<0&&this.services.languageUtils.isSupportedCode(E));return v.length?(this.options.preload=g.concat(v),this.loadResources(E=>{h.resolve(),s&&s(E)}),h):(s&&s(),Promise.resolve())}dir(t){var g,v;if(t||(t=this.resolvedLanguage||(((g=this.languages)==null?void 0:g.length)>0?this.languages[0]:this.language)),!t)return"rtl";const s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],h=((v=this.services)==null?void 0:v.languageUtils)||new SB(AB());return s.indexOf(h.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;return new Fx(t,s)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lS;const h=t.forkResourceStore;h&&delete t.forkResourceStore;const g={...this.options,...t,isClone:!0},v=new Fx(g);if((t.debug!==void 0||t.prefix!==void 0)&&(v.logger=v.logger.clone(t)),["store","services","language"].forEach(c=>{v[c]=this[c]}),v.services={...this.services},v.services.utils={hasLoadedNamespace:v.hasLoadedNamespace.bind(v)},h){const c=Object.keys(this.store.data).reduce((T,L)=>(T[L]={...this.store.data[L]},Object.keys(T[L]).reduce((B,U)=>(B[U]={...T[L][U]},B),{})),{});v.store=new xB(c,g),v.services.resourceStore=v.store}return v.translator=new AT(v.services,g),v.translator.on("*",function(c){for(var T=arguments.length,L=new Array(T>1?T-1:0),B=1;B<T;B++)L[B-1]=arguments[B];v.emit(c,...L)}),v.init(g,s),v.translator.options=g,v.translator.backendConnector.services.utils={hasLoadedNamespace:v.hasLoadedNamespace.bind(v)},v}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ts=Fx.createInstance();ts.createInstance=Fx.createInstance;ts.createInstance;ts.dir;ts.init;ts.loadResources;ts.reloadResources;ts.use;ts.changeLanguage;ts.getFixedT;ts.t;ts.exists;ts.setDefaultNamespace;ts.hasLoadedNamespace;ts.loadNamespaces;ts.loadLanguages;const{slice:Qoe,forEach:Joe}=[];function ese(n){return Joe.call(Qoe.call(arguments,1),t=>{if(t)for(const s in t)n[s]===void 0&&(n[s]=t[s])}),n}function tse(n){return typeof n!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(s=>s.test(n))}const IB=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,nse=function(n,t){const h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},g=encodeURIComponent(t);let v=`${n}=${g}`;if(h.maxAge>0){const E=h.maxAge-0;if(Number.isNaN(E))throw new Error("maxAge should be a Number");v+=`; Max-Age=${Math.floor(E)}`}if(h.domain){if(!IB.test(h.domain))throw new TypeError("option domain is invalid");v+=`; Domain=${h.domain}`}if(h.path){if(!IB.test(h.path))throw new TypeError("option path is invalid");v+=`; Path=${h.path}`}if(h.expires){if(typeof h.expires.toUTCString!="function")throw new TypeError("option expires is invalid");v+=`; Expires=${h.expires.toUTCString()}`}if(h.httpOnly&&(v+="; HttpOnly"),h.secure&&(v+="; Secure"),h.sameSite)switch(typeof h.sameSite=="string"?h.sameSite.toLowerCase():h.sameSite){case!0:v+="; SameSite=Strict";break;case"lax":v+="; SameSite=Lax";break;case"strict":v+="; SameSite=Strict";break;case"none":v+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return h.partitioned&&(v+="; Partitioned"),v},MB={create(n,t,s,h){let g=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(g.expires=new Date,g.expires.setTime(g.expires.getTime()+s*60*1e3)),h&&(g.domain=h),document.cookie=nse(n,t,g)},read(n){const t=`${n}=`,s=document.cookie.split(";");for(let h=0;h<s.length;h++){let g=s[h];for(;g.charAt(0)===" ";)g=g.substring(1,g.length);if(g.indexOf(t)===0)return g.substring(t.length,g.length)}return null},remove(n,t){this.create(n,"",-1,t)}};var rse={name:"cookie",lookup(n){let{lookupCookie:t}=n;if(t&&typeof document<"u")return MB.read(t)||void 0},cacheUserLanguage(n,t){let{lookupCookie:s,cookieMinutes:h,cookieDomain:g,cookieOptions:v}=t;s&&typeof document<"u"&&MB.create(s,n,h,g,v)}},ise={name:"querystring",lookup(n){var h;let{lookupQuerystring:t}=n,s;if(typeof window<"u"){let{search:g}=window.location;!window.location.search&&((h=window.location.hash)==null?void 0:h.indexOf("?"))>-1&&(g=window.location.hash.substring(window.location.hash.indexOf("?")));const E=g.substring(1).split("&");for(let c=0;c<E.length;c++){const T=E[c].indexOf("=");T>0&&E[c].substring(0,T)===t&&(s=E[c].substring(T+1))}}return s}},ose={name:"hash",lookup(n){var g;let{lookupHash:t,lookupFromHashIndex:s}=n,h;if(typeof window<"u"){const{hash:v}=window.location;if(v&&v.length>2){const E=v.substring(1);if(t){const c=E.split("&");for(let T=0;T<c.length;T++){const L=c[T].indexOf("=");L>0&&c[T].substring(0,L)===t&&(h=c[T].substring(L+1))}}if(h)return h;if(!h&&s>-1){const c=v.match(/\/([a-zA-Z-]*)/g);return Array.isArray(c)?(g=c[typeof s=="number"?s:0])==null?void 0:g.replace("/",""):void 0}}}return h}};let zg=null;const PB=()=>{if(zg!==null)return zg;try{if(zg=typeof window<"u"&&window.localStorage!==null,!zg)return!1;const n="i18next.translate.boo";window.localStorage.setItem(n,"foo"),window.localStorage.removeItem(n)}catch{zg=!1}return zg};var sse={name:"localStorage",lookup(n){let{lookupLocalStorage:t}=n;if(t&&PB())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(n,t){let{lookupLocalStorage:s}=t;s&&PB()&&window.localStorage.setItem(s,n)}};let Bg=null;const DB=()=>{if(Bg!==null)return Bg;try{if(Bg=typeof window<"u"&&window.sessionStorage!==null,!Bg)return!1;const n="i18next.translate.boo";window.sessionStorage.setItem(n,"foo"),window.sessionStorage.removeItem(n)}catch{Bg=!1}return Bg};var ase={name:"sessionStorage",lookup(n){let{lookupSessionStorage:t}=n;if(t&&DB())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(n,t){let{lookupSessionStorage:s}=t;s&&DB()&&window.sessionStorage.setItem(s,n)}},lse={name:"navigator",lookup(n){const t=[];if(typeof navigator<"u"){const{languages:s,userLanguage:h,language:g}=navigator;if(s)for(let v=0;v<s.length;v++)t.push(s[v]);h&&t.push(h),g&&t.push(g)}return t.length>0?t:void 0}},cse={name:"htmlTag",lookup(n){let{htmlTag:t}=n,s;const h=t||(typeof document<"u"?document.documentElement:null);return h&&typeof h.getAttribute=="function"&&(s=h.getAttribute("lang")),s}},use={name:"path",lookup(n){var g;let{lookupFromPathIndex:t}=n;if(typeof window>"u")return;const s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(s)?(g=s[typeof t=="number"?t:0])==null?void 0:g.replace("/",""):void 0}},dse={name:"subdomain",lookup(n){var g,v;let{lookupFromSubdomainIndex:t}=n;const s=typeof t=="number"?t+1:1,h=typeof window<"u"&&((v=(g=window.location)==null?void 0:g.hostname)==null?void 0:v.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(h)return h[s]}};let D6=!1;try{document.cookie,D6=!0}catch{}const R6=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];D6||R6.splice(1,1);const hse=()=>({order:R6,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:n=>n});class L6{constructor(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,s)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=ese(s,this.options||{},hse()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=g=>g.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=h,this.addDetector(rse),this.addDetector(ise),this.addDetector(sse),this.addDetector(ase),this.addDetector(lse),this.addDetector(cse),this.addDetector(use),this.addDetector(dse),this.addDetector(ose)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,s=[];return t.forEach(h=>{if(this.detectors[h]){let g=this.detectors[h].lookup(this.options);g&&typeof g=="string"&&(g=[g]),g&&(s=s.concat(g))}}),s=s.filter(h=>h!=null&&!tse(h)).map(h=>this.options.convertDetectedLanguage(h)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}cacheUserLanguage(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||s.forEach(h=>{this.detectors[h]&&this.detectors[h].cacheUserLanguage(t,this.options)}))}}L6.type="languageDetector";const fse={title:"Tre Aktörer.",titleHighlight:"Ett System.",subtitle:"Ett operativt marknadsnätverk där efterfrågan möter kapacitet genom AI-orkestrering.",orderer:{title:"Beställare",subtitle:"Institutioner & Företag",description:"Kommuner, myndigheter, fastighetsbolag och entreprenörer som behöver aktuell, verifierad visuell miljödata.",features:{define:"Definiera exakt vad som ska dokumenteras",precision:"Geografisk och tidsstyrd precision",quality:"Automatisk kvalitetskontroll",verified:"Endast verifierad output"}},performer:{title:"Utförare",subtitle:"Privatpersoner",description:"Människor med mobilkamera som utför strikt definierade uppdrag och får betalt per godkänd leverans.",features:{guidance:"AI-guidning i realtid",feedback:"Tydlig feedback (godkänt/underkänt)",payment:"Betalning per leverans",noInterpretation:"Ingen tolkningsfrihet"}},ai:{title:"AI-Systemet",subtitle:"Orkestrering & Validering",description:"Bryter ned beställningar, matchar utförare, guidar fotografering, validerar och levererar strukturerad data.",features:{validation:"Automatisk bildvalidering",review:"Juridisk & teknisk granskning",anonymization:"Anonymisering i realtid",extraction:"Dataextraktion"}},flow:{order:"Beställning",matching:"Matchning",execution:"Utförande",validation:"Validering",data:"Data"}},pse={tagline:"Ett samhällskompatibelt visual intelligence-nätverk där",taglineHighlight:"ingen kan missbruka systemet",taglineEnd:"för privata syften.",institutions:{title:"Institutionella Beställare",description:"Kommuner, myndigheter, fastighetsbolag och infrastrukturägare med verifierat samhällsintresse.",features:{access:"Full tillgång till alla uppdragstyper",periodic:"Periodisk datainsamling tillåten",export:"Strukturerad dataexport"},button:"Ansök om Tillgång"},performers:{title:"Utförare",description:"Använd din mobil för att tjäna pengar. First-claim på uppdrag i din zon. Snabb betalning efter AI-godkännande.",features:{reward:"5–20 SEK per godkänd bild",guidance:"AI-guidning i realtid",flexible:"Flexibelt, ingen tolkningsfrihet"},button:"Bli Utförare"}},mse={back:"Tillbaka",featured:"FEATURED",charityLottery:"Välgörenhetslotteri",title:"QZ Real Change",titleHighlight:"Mission",subtitle:"Ett fotolotteri för välgörenhet. Alla kan delta — fota, ladda upp och var med i dragningen!",infoCards:{free:"Gratis",freeDesc:"att delta",newMissions:"Nya uppdrag",newMissionsDesc:"regelbundet",vernissage:"Vernissage",vernissageDesc:"NYC 11-14 juni"},howItWorks:{title:"Så fungerar det",step1:"Välj ett uppdrag och ta dig till platsen",step2:"Fota och ladda upp ditt bidrag",step3:"En jury väljer vinnare — alla bidrag är med i lottningen",step4:"Vinnande bilder ställs ut på vernissage i New York 11-14 juni"},prizes:{first:"1:a",second:"2:a",third:"3:e"},charityLotteries:"Välgörenhetslotterier",charityLotteriesDesc:"Ikoniska platser världen över — vinnande bilder ställs ut på vernissage i New York 11-14 juni",sponsoredCampaigns:"Sponsrade Kampanjer",sponsoredCampaignsDesc:"Företag som stödjer fotografer och välgörenhet — alla intäkter går till goda ändamål",enterDraw:"Delta i lottningen",deadline:"Deadline",difficulty:{medium:"Utmanande",hard:"Svårt",extreme:"Extrem"},vernissageInfo:{title:"Årlig Vernissage i New York",description:"Alla vinnande bilder ställs ut en gång per år på en exklusiv vernissage i New York där de säljs till förmån för välgörenhet. 100% av intäkterna investeras i att utveckla smart mjukvara och hårdvara för utbildning i länder som behöver det mest."},bottomInfo:"bidrar till att skänka 1 000 utbildningstelefoner till barn i Uganda. Ditt foto kan förändra liv.",yourParticipation:"Ditt deltagande",missions:{tokyoSakura:{title:"Körsbärsblomningen",location:"Tokyo, Japan",description:"Fånga Meguro-floden eller Ueno Park i full körsbärsblom. Miljontals blommor som blommar i bara två veckor.",challenge:"Ta dig till Tokyo under blomningssäsongen och hitta det perfekta ljuset vid soluppgång"},nycChristmas:{title:"Julgranen på Rockefeller",location:"New York, USA",description:"Dokumentera den ikoniska julgranen vid Rockefeller Center i snöfall. 25 meter av glittrande magi.",challenge:"Vänta på snö i New York och fånga granen i perfekt vinterstämning"},parisEiffel:{title:"Eiffeltornet i Dimma",location:"Paris, Frankrike",description:"Fånga Eiffeltornet när dimman sveper in och skapar en drömmande silhuett över Seine.",challenge:"Bevaka vädret och var redo att fota när dimman rullar in över Paris"},veniceCarnival:{title:"Karnevalen i Venedig",location:"Venedig, Italien",description:"Dokumentera de magnifika maskerna och kostymerna under Venedigs berömda karneval på Piazza San Marco.",challenge:"Ta dig till Venedig under karnevalsveckan och fånga den rätta stämningen"},northernLights:{title:"Norrskenet",location:"Tromsø, Norge",description:"Fånga norrskenet dansande över arktiska landskap. Naturens mest spektakulära ljusshow.",challenge:"Vänta på klara nätter och stark solaktivitet"},tajMahal:{title:"Taj Mahal i Gryningen",location:"Agra, Indien",description:"Fånga Taj Mahal när solen stiger och marmorpalatset lyser i rosa och guld.",challenge:"Var på plats vid soluppgång för det perfekta ljuset"},santorini:{title:"Solnedgång i Santorini",location:"Oia, Grekland",description:"Den berömda solnedgången över kalderan med vita hus och blå kupoler.",challenge:"Hitta rätt position bland hundratals turister"},machuPicchu:{title:"Machu Picchu i Dimma",location:"Peru",description:"Den mystiska inkastaden när morgondimman lättar och bergen avslöjas.",challenge:"Vandra upp innan gryningen för att fånga dimman"},dubaiSkyline:{title:"Dubai Skyline",location:"Dubai, UAE",description:"Burj Khalifa och skyline i solnedgång eller nattetid med stadens ljus.",challenge:"Hitta den perfekta utsiktspunkten"},rioCarnival:{title:"Karnevalen i Rio",location:"Rio de Janeiro, Brasilien",description:"Världens största fest — färger, dans och glädje på Sambadrome.",challenge:"Fånga rörelsen och energin mitt i festen"}},campaigns:{sevenEleven:{title:"World Store Hunt",description:"Fota så många 7-Eleven butiker du kan runt om i världen! Den som fotograferat flest unika butiker innan deadline vinner.",charityNote:"Del av vinsten går till lokala matbanker",availability:"Aktiv globalt i 20 länder"},porsche:{title:"Porsche Golden Hour",description:"Fånga din Porsche i det perfekta solnedgångsljuset under april månad. Visa oss den ultimata kombinationen av tysk ingenjörskonst och naturens magi.",charityNote:"Porsche stödjer hållbar motorsport",availability:"8 vinnare globalt"},adobeCityGlow:{title:"City Glow",description:"Fånga stadens magiska glow i vintermörkret. Neonljus, gatlyktor och stadssiluetter — visa oss den sjukaste city glow-bilden!",charityNote:"Stödjer kreativ utbildning för unga",availability:"En vinnare per storstad"},appleShotOnIphone:{title:"Shot on iPhone",description:"Visa vad nya iPhone kan göra! Fånga ett extraordinärt ögonblick med din iPhone — de bästa bidragen visas i Apples globala kampanj.",charityNote:"Apple matchar med donation till utbildning",availability:"Globalt — alla kan delta"}},season:{marchApril:"Mars-April",december:"December",autumnWinter:"Höst/Vinter",february:"Februari",septMarch:"Sept-Mars",octMarch:"Okt-Mars",mayOct:"Maj-Okt",aprilOct:"April-Okt",novMarch:"Nov-Mars"}},gse={title:"Skänk till välgörenhet",description:"Gör skillnad med dina intjänade krediter. 100% av din donation går direkt till organisationen – bra oavsett vems händer de hamnar i.",donationComplete:"Donation genomförd!",donatedTo:"Du har donerat {{amount}} krediter till {{name}}. Vill du dela detta på Facebook?",thankYou:"Tack för ditt bidrag!",shareOnFacebook:"Dela på Facebook",maybeLater:"Kanske senare",thanksForSharing:"Tack för att du sprider ordet!",minDonation:"Minsta donation är 10 krediter",notEnoughCredits:"Du har inte tillräckligt med krediter",thanksDonation:"Tack! Du har donerat {{amount}} krediter till {{name}} 💚",amount:"Belopp (krediter)",enterAmount:"Ange belopp",available:"Tillgängligt",donate:"Donera",donating:"Donerar...",readMoreAt:"Läs mer på",unicef:{name:"UNICEF",description:"Räddar barn världen över",mission:"Arbetar för barns rättigheter i över 190 länder. Varje krona hjälper barn få tillgång till utbildning, rent vatten och sjukvård.",impact:"100 krediter = vaccin till 10 barn"},doctorsWithoutBorders:{name:"Läkare Utan Gränser",description:"Medicinsk hjälp i kriszoner",mission:"Ger livräddande medicinsk vård till människor i nöd, oavsett var de befinner sig eller vilka de är.",impact:"250 krediter = medicin för en familj"},wwf:{name:"WWF",description:"Skyddar naturen och djurlivet",mission:"Kämpar för att bevara biologisk mångfald och skydda utrotningshotade arter runt om i världen.",impact:"150 krediter = skyddar 1 hektar regnskog"},wateraid:{name:"WaterAid",description:"Rent vatten till alla",mission:"Arbetar för att alla människor ska ha tillgång till rent vatten, sanitet och hygien. Vatten är grunden för allt.",impact:"200 krediter = rent vatten i en månad"},plan:{name:"Plan International",description:"Utbildning för flickor",mission:"Kämpar för barns rättigheter och flickors lika möjligheter till utbildning och framtid.",impact:"300 krediter = skolmaterial för ett barn"},stadsmission:{name:"Stadsmissionen",description:"Hjälper utsatta i Sverige",mission:"Ger stöd till människor i hemlöshet och utsatthet. Ingen ska behöva vara hungrig eller frysa.",impact:"100 krediter = en varm måltid"},wfp:{name:"World Food Programme",description:"Bekämpar hunger globalt",mission:"FN:s livsmedelsprogram räddar liv genom att leverera mat till de mest utsatta i världen.",impact:"50 krediter = mat till en familj i en dag"},handInHand:{name:"Hand in Hand",description:"Skapar jobb för att utrota fattigdom",mission:"Hjälper människor i fattigdom att starta egna företag och försörja sig själva och sina familjer.",impact:"500 krediter = en mikroentreprenör får stöd"}},_se={loading:"Laddar...",error:"Ett fel uppstod",save:"Spara",cancel:"Avbryt",confirm:"Bekräfta",delete:"Ta bort",edit:"Redigera",back:"Tillbaka",next:"Nästa",close:"Stäng",search:"Sök",filter:"Filtrera",all:"Alla",none:"Inga",yes:"Ja",no:"Nej",or:"eller",and:"och",credits:"krediter",credit:"kredit",meters:"meter",km:"km",minutes:"minuter",hours:"timmar",days:"dagar",today:"Idag",yesterday:"Igår",tomorrow:"Imorgon",sek:"krediter",currency:"SEK",available:"Tillgänglig",photos:"foton",until:"t.o.m.",daily:"Dagligen",weekly:"Veckovis",biweekly:"Varannan vecka",monthly:"Månadsvis",takeMission:"Ta uppdrag",order:"Beställ"},yse={home:"Hem",map:"Karta",wallet:"Plånbok",profile:"Profil",notifications:"Notiser",howItWorks:"Hur det fungerar",forBusinesses:"För Företag",forPerformers:"För Utförare",api:"API",getStarted:"Kom igång"},vse={login:"Logga in",logout:"Logga ut",signup:"Skapa konto",email:"E-post",password:"Lösenord",forgotPassword:"Glömt lösenord?",noAccount:"Har du inget konto?",hasAccount:"Har du redan ett konto?",signupSuccess:"Konto skapat! Du är nu inloggad.",loginSuccess:"Välkommen tillbaka!",logoutSuccess:"Utloggad!",invalidCredentials:"Fel e-post eller lösenord",emailRequired:"E-post krävs",passwordRequired:"Lösenord krävs",loginRequired:"Logga in för att använda denna funktion",displayName:"Visningsnamn (valfritt)",displayNamePlaceholder:"Ditt namn",emailPlaceholder:"din@email.se",loginSubtitle:"Logga in för att beställa eller utföra uppdrag",signupSubtitle:"Registrera dig för att komma igång",waiting:"Vänta...",createAccount:"Skapa konto",emailAlreadyRegistered:"E-postadressen är redan registrerad",somethingWentWrong:"Något gick fel. Försök igen.",invalidEmail:"Ogiltig e-postadress",passwordMinLength:"Lösenordet måste vara minst 6 tecken",passwordMismatch:"Lösenorden matchar inte",appPrompt:{title:"Fortsätt i appen?",subtitle:"quiXzoom-appen ger en bättre upplevelse med notiser, kamera och GPS.",openApp:"Öppna quiXzoom-appen",continueWeb:"Fortsätt i webbläsaren",hint:"Du kan alltid ladda ner appen senare från din profil."}},xse={welcome:"Välkommen",nearbyMissions:"Uppdrag nära dig",noMissions:"Inga uppdrag tillgängliga just nu",activeMission:"Aktivt uppdrag",claimMission:"Ta uppdraget",viewDetails:"Visa detaljer",distance:"Avstånd",reward:"Belöning",expires:"Går ut",photosRequired:"bilder krävs",missionTypes:"Uppdragstyper",howItWorks:"Så fungerar det",getStarted:"Kom igång",earnMoney:"Tjäna pengar på dina foton",tagline:"Fånga världen. Få betalt.",startEarning:"Börja tjäna",learnMore:"Läs mer"},bse={title:"Uppdrag",active:"Aktiva",completed:"Avklarade",expired:"Utgångna",claimed:"Tagna",available:"Tillgängliga",claim:"Ta uppdrag",submit:"Skicka in",abandon:"Lämna uppdrag",timeRemaining:"Tid kvar",photosSubmitted:"Foton inskickade",instructions:"Instruktioner",requirements:"Krav",location:"Plats",radius:"Radie",description:"Beskrivning",takePhoto:"Ta foto",uploadPhoto:"Ladda upp foto",submitPhotos:"Skicka in foton",missionComplete:"Uppdrag slutfört!",pendingReview:"Väntar på granskning",approved:"Godkänt",rejected:"Avvisat",expiresIn:"Går ut om",noActiveMission:"Inget aktivt uppdrag",findMission:"Hitta ett uppdrag",loadError:"Kunde inte ladda uppdrag",focusMode:"Fokusläge – slutför ditt aktiva uppdrag",noMissionsInArea:"Det finns inga aktiva uppdrag i ditt område. Kom tillbaka snart!",photo:"Fotouppdrag",photoShort:"Foto",video:"Videouppdrag",videoShort:"Video",showingMissions:"Visar {{count}} uppdrag sorterade efter avstånd",noMissionsNearby:"Inga uppdrag i ditt område just nu"},wse={back:"Tillbaka",notFound:"Uppdraget hittades inte",photos:"Foton",reward:"Belöning",timeLeft:"Tid kvar",expired:"Utgånget",fetching:"Hämtar...",unknown:"Okänd",closeEnough:"Du är tillräckligt nära!",withinRadius:"Inom {{distance}}",map:"Karta",workOrder:"Arbetsorder",whatToPhoto:"Vad ska fotograferas",photosRequired:"Antal foton som krävs",photo:"foto",exampleImages:"Exempelbilder",exampleHint:"Så här ska fotot se ut ungefär:",approvedExamples:"Godkända exempel",notApprovedExamples:"Ej godkända exempel",exampleApproved:"Godkänt",exampleNotApproved:"Ej godkänt",exampleComingSoon:"Exempel kommer snart",photoTips:"Tips: Tydlig bild, rätt vinkel, bra ljus. Undvik suddig bild eller fel motiv.",howTo:"Så här gör du",deadline:"Senast",paymentOnApproval:"Ersättning vid godkänt uppdrag",latitude:"Latitud",longitude:"Longitud",frequency:"Frekvens",frequencyDuration:"Frekvens & Varaktighet",activeUntil:"Aktivt till",missionExpires:"Uppdrag löper ut",daily:"Dagligen",weekly:"Veckovis",biweekly:"Varannan vecka",monthly:"Månadsvis",claimTimeLeft:"Tid kvar",hurryUp:"Skynda dig!",completeBeforeExpiry:"Slutför innan tiden går ut",testMode:"Testläge",testModeActive:"Testläge - foton sparas inte",testModeActivated:"Testläge aktiverat!",testCameraHint:"Testa kameran utan att skapa en riktig claim.",cameraTestComplete:"Kameratest slutfört!",photosNotSaved:"Foton sparades inte (testläge).",missionCompleted:"Uppdraget slutfört!",loading:"Laddar...",exitTestMode:"Avsluta testläge",releaseMission:"Släpp uppdraget",verifyForMissions:"Verifiera för uppdrag",verifyDescription:"Slutför din registrering för att ta uppdrag.",testCamera:"Testa kameran (utan att spara)",claimMission:"Ta uppdraget",getCloser:"Gå närmare för att ta uppdraget",confirmClaim:"Ta uppdraget?",confirmClaimDesc:"Du har <strong>15 minuter</strong> på dig att ta bilden och ladda upp den. Är du redo?",cancel:"Avbryt",yesClaim:"Ja, ta uppdraget",couldNotClaim:"Kunde inte ta uppdraget",missionIsYoursAgain:"Uppdraget är ditt igen!",missionIsYours:"Uppdraget är ditt!",youHave15Min:"Du har 15 minuter på dig att slutföra det.",couldNotRelease:"Kunde inte släppa uppdraget",missionReleased:"Uppdraget släppt",someoneElseCanTake:"Nu kan någon annan ta det.",withinRadiusText:"Inom angiven radie"},Sse={title:"Plånbok",balance:"Saldo",totalEarned:"Totalt intjänat",pendingPayout:"Väntar på utbetalning",withdraw:"Ta ut",withdrawFunds:"Ta ut pengar",transactions:"Transaktioner",noTransactions:"Inga transaktioner ännu",earned:"Intjänat",payout:"Utbetalning",pending:"Väntande",completed:"Genomförd",earnings:"Intäkter",thisWeek:"Denna vecka",thisMonth:"Denna månad",allTime:"Totalt",leaderboard:"Topplista",yourRank:"Din placering",rank:"Placering",photographer:"Fotograf",swishNumber:"Swish-nummer",requestPayout:"Begär utbetalning",minPayout:"Minsta utbetalning",taxInfo:"Skatteinfo",taxDeducted:"Skatt dragen",netAmount:"Nettobelopp",earningsGrowth:"Intäktstillväxt",growYourEarnings:"Låt dina intäkter växa",dailyInterest:"daglig ränta",lockedBalance:"Låst saldo",accruedInterest:"Upplupen ränta",loginToEarn:"Logga in för att börja tjäna",transactionHistory:"Transaktionshistorik",loginToSeeTransactions:"Logga in för att se dina transaktioner",minWithdrawError:"Minsta uttag är 100 krediter",invalidSwishError:"Ange ett giltigt Swish-nummer",withdrawViaSwish:"Ta ut via Swish",amount:"Belopp",minAmount:"Minst 100 krediter",available:"Tillgängligt",taxDeduction:"Skatteavdrag",youReceive:"Du får",taxNote:"Skatt dras automatiskt och redovisas till Skatteverket.",processing:"Bearbetar...",confirmWithdraw:"Bekräfta uttag",verifyForPayouts:"Verifiera för utbetalningar",verifyDescription:"Slutför din registrering för att ta ut pengar.",pendingPayouts:"Väntande utbetalningar",creditsToSwish:"krediter till Swish",tapForHistory:"Tryck för historik",completeMissionsToEarn:"Slutför uppdrag för att tjäna krediter"},Tse={title:"Profil",settings:"Inställningar",editProfile:"Redigera profil",displayName:"Visningsnamn",email:"E-post",phone:"Telefon",city:"Stad",verified:"Verifierad",notVerified:"Ej verifierad",verifyIdentity:"Verifiera identitet",identityVerified:"Identitet verifierad",stats:"Statistik",completedMissions:"Avklarade uppdrag",approvalRate:"Godkännandegrad",avgCompletionTime:"Snittid",streak:"Streak",streakDays:"dagar i rad",reach:"Räckvidd",reachDescription:"Din räckvidd för att se uppdrag",notifications:"Notiser",smsNotifications:"SMS-notiser",language:"Språk",theme:"Tema",darkMode:"Mörkt läge",lightMode:"Ljust läge",systemTheme:"Systemtema",privacy:"Integritet",terms:"Villkor",help:"Hjälp",support:"Support",about:"Om",version:"Version",deleteAccount:"Radera konto",logoutConfirm:"Är du säker på att du vill logga ut?",accountType:"Kontotyp",private:"Privat",company:"Företag",selfAccounting:"Egen redovisning",selfAccountingDescription:"Jag hanterar min egen skatt och deklaration",loadingProfile:"Laddar profil...",totalEarned:"Totalt intjänat",available:"Tillgängligt",accountInfo:"Kontoinformation",accountInfoDesc:"Din grundläggande profilinformation",nickname:"Nickname",nicknamePlaceholder:"⭐ SuperFotograf_99",nicknameHint:"Visas på topplistan. Var kreativ men trevlig! 🎮",nicknameMinChars:"Minst 2 tecken",nicknameMaxChars:"Max 20 tecken",nicknameOffensive:"Välj ett trevligare namn",nicknameInvalidChars:"Endast bokstäver, siffror och enkla symboler",required:"Krävs",verifiedAt:"Verifierad",unknownDate:"Okänt datum",orderer:"Beställare",ordererActive:"Aktiv",ordererPending:"Väntar",ordererAsOrg:"Du beställer som {{org}}",ordererApplicationPending:"Din ansökan behandlas",ordererDesc:"Beställ uppdrag som företag, organisation eller myndighet",openOrdererDashboard:"Öppna beställar-dashboard",createNewMission:"Skapa nytt uppdrag",viewOrdererProfile:"Visa beställarprofil",becomeOrderer:"Bli beställare",paymentMethod:"Betalmetod",paymentMethodDesc:"Koppla din Swish för att ta emot utbetalningar",swishNumber:"Swish-nummer",swishConnected:"Kopplat",swishHint:"Ange det mobilnummer som är kopplat till din Swish",phoneVerification:"Telefon & Verifiering",phoneVerificationDesc:"Verifiera ditt konto och aktivera SMS-notiser",phoneNumber:"Telefonnummer",phoneVerified:"Verifierat",phoneNotVerified:"Ej verifierat",phoneHint:"Används för kontoverifiering och SMS-notiser",smsNotificationsLabel:"SMS-notiser",smsNotificationsDesc:"Få SMS om nya uppdrag och statusuppdateringar",addPhoneForSms:"Lägg till ett telefonnummer för att aktivera SMS-notiser",reachTitle:"Räckvidd",reachDesc:"Hur långt från din position vill du se uppdrag?",locationTitle:"Plats",locationDesc:"Din sparade hemposition för uppdragsmatching",lat:"Lat",long:"Long",noLocationSaved:"Ingen plats sparad ännu",updateToCurrentLocation:"Uppdatera till nuvarande plats",notificationsTitle:"Aviseringar",notificationsDesc:"Välj vilka notifikationer du vill få",newMissions:"Nya uppdrag",newMissionsDesc:"Meddela mig när nya uppdrag finns i närheten",missionUpdates:"Uppdragsuppdateringar",missionUpdatesDesc:"Status på mina claimade uppdrag",rewards:"Belöningar",rewardsDesc:"Meddela mig vid nya krediter och belöningar",marketing:"Marknadsföring",marketingDesc:"Erbjudanden och nyheter",countryTax:"Land & Skatt",countryTaxDesc:"Du kan endast se ersättningar för uppdrag i det land du befinner dig",sweden:"Sverige",basedOnGps:"",selfAccountingLabel:"Egen redovisning",weHandleTax:"Vi hanterar skatten",taxAutoDeducted:"Automatiskt skatteavdrag (30%) görs innan utbetalning. Du får en kontrolluppgift för deklarationen.",appearanceTitle:"Utseende & Språk",appearanceDesc:"Välj tema och språk för appen",languageDesc:"Välj vilket språk appen ska visas på",saveChanges:"Spara ändringar",saving:"Sparar...",logOut:"Logga ut",profileSaved:"Profil sparad!",couldNotSave:"Kunde inte spara ändringar",couldNotUpdateLocation:"Kunde inte uppdatera platsen",locationUpdated:"Plats uppdaterad!",loggedOut:"Du har loggat ut",growthModelActivated:"Tillväxtmodell aktiverad!",growthModelDeactivated:"Tillväxtmodell inaktiverad",couldNotSaveGrowth:"Kunde inte spara tillväxtinställning",voiceGuide:"Instruktionsröst",voiceGuideDesc:"Välj vilken röst som ska användas för navigering och fotoinstruktioner"},Ese={title:"Notiser",empty:"Inga aviseringar ännu",markAllRead:"Markera alla som lästa",newMission:"Nytt uppdrag",missionApproved:"Uppdrag godkänt",missionRejected:"Uppdrag avvisat",payoutComplete:"Utbetalning genomförd",newNearby:"Nytt uppdrag nära dig",keepTrack:"Håll koll på nya uppdrag och uppdateringar",previewMission:"Fotografera butiksfasad...",previewApproved:"Uppdrag godkänt!",previewReward:"Du har fått 50 krediter...",loginToSee:"Logga in för att se dina notiser"},kse={title:"Karta",yourLocation:"Din position",missionLocation:"Uppdragsposition",showMissions:"Visa uppdrag",hideMissions:"Dölj uppdrag",centerOnMe:"Centrera på mig",directions:"Vägbeskrivning",navigate:"Navigera",distance:"Avstånd",eta:"Beräknad ankomst",gettingLocation:"Hämtar din position...",locationRequired:"Platsåtkomst behövs",enableLocation:"Aktivera platsdelning för att se uppdrag nära dig",loginToCreate:"Du måste vara inloggad för att skapa uppdrag",couldNotGetPosition:"Kunde inte hämta din position",createMissionHere:"Skapa uppdrag här",verifyForMissions:"Verifiera för uppdrag",verifyDescription:"Slutför din registrering för att ta uppdrag.",couldNotLoadMap:"Kunde inte ladda kartan",viewMission:"Visa uppdrag",focusMode:"Fokusläge",stationary:"Stillastående",walking:"Gång",cycling:"Cykel",vehicle:"Fordon",walk:"Gå",bike:"Cykla",drive:"Bil",startNavigation:"Starta navigering",clearRoute:"Rensa rutt",calculating:"Beräknar...",routeError:"Kunde inte beräkna rutt",loadingMap:"Laddar karta...",reloadMap:"Ladda om kartan",nearest:"Närmsta",cluster:"Kluster",popular:"Populärt",locked:"Låst",lock:"Lås",flyingToNearest:"Flyger till närmsta uppdrag",fromHere:"härifrån",flyingToCluster:"Flyger till tätaste området",missionsHere:"uppdrag samlade här",flyingToPopular:"Flyger till",popularArea:"Populärt område med",previousMissions:"tidigare uppdrag",mapLocked:"Kartan låst vid din position",mapUnlocked:"Kartan upplåst",cancelNavigation:"Avbryt navigation",waitOrCancel:"Vänta eller avbryt",participate:"Delta",couldNotLoadMapToken:"Kunde inte ladda kartan (token)",couldNotLoadMapWebGL:"Kunde inte ladda kartan (WebGL stöds ej på denna enhet)",couldNotLoadMapStyle:"Kunde inte ladda kartan (stil)",couldNotLoadMapNetwork:"Kunde inte ladda kartan (nätverk/adblock)",mapLostContext:"Kartan tappade grafik-kontext. Tryck för att ladda om.",unknownMapError:"Okänt kartfel",mapLoadTimeout:"Kartan tog för lång tid att ladda. Kontrollera nätverk/adblock och försök igen.",missionCount:"st",lottery:"Lotteri",campaign:"Kampanj",goToMap:"Gå till kartan"},Ase={title:"Skapa uppdrag på min plats",description:"Skapa ett nytt uppdrag vid din nuvarande position",titleLabel:"Titel",titleRequired:"Titel *",titlePlaceholder:"T.ex. Fotografera caféet på hörnet",descriptionLabel:"Beskrivning (valfritt)",descriptionPlaceholder:"Beskriv vad som ska fotograferas...",photoCount:"Antal foton",reward:"Belöning",creditsPerPhoto:"{{amount}} krediter per foto (max 300 krediter/foto)",radius:"Radie",exampleImages:"Exempelbilder (valfritt)",goodExamples:"Bra exempel",badExamples:"Dåliga exempel",goodExampleAlt:"Bra exempel",badExampleAlt:"Dåligt exempel",addImage:"Lägg till",exampleHint:"Visa fotografen hur bilden ska (och inte ska) se ut",cancel:"Avbryt",creating:"Skapar...",createMission:"Skapa uppdrag",imageTooLarge:"Bilden får max vara 5 MB",loginAndLocationRequired:"Du måste vara inloggad och ha en position",titleRequiredError:"Ange en titel för uppdraget",missionCreated:"Uppdrag skapat!",missionOnMap:'"{{title}}" finns nu på kartan',couldNotCreate:"Kunde inte skapa uppdrag",tryAgain:"Försök igen",goodExampleCaption:"Bra exempel",badExampleCaption:"Dåligt exempel"},Cse={takePhoto:"Ta foto",retake:"Ta om",use:"Använd",gallery:"Galleri",flash:"Blixt",flashOn:"Blixt på",flashOff:"Blixt av",flashAuto:"Auto",switchCamera:"Byt kamera",permissionDenied:"Kamerabehörighet nekad",enableCamera:"Aktivera kamera i inställningar"},Ise={analyzing:"Analyserar foto...",approved:"Godkänt",rejected:"Avvisat",tooBlurry:"Bilden är för suddig",tooDark:"Bilden är för mörk",wrongSubject:"Fel motiv",outsideArea:"Utanför uppdragsområdet",aestheticScore:"Estetiskt betyg"},Mse={dashboard:"Beställar-dashboard",createMission:"Skapa uppdrag",createCampaign:"Ny kampanj",campaigns:"Kampanjer",activeCampaigns:"Aktiva kampanjer",noCampaigns:"Inga kampanjer ännu",missionStats:"Uppdragsstatistik",photosReceived:"Mottagna foton",pendingApproval:"Väntar på godkännande",totalSpent:"Totalt spenderat",organizationName:"Organisationsnamn",organizationNumber:"Organisationsnummer",contactPerson:"Kontaktperson",billingAddress:"Fakturaadress",paymentMethod:"Betalningsmetod",invoice:"Faktura",card:"Kort",sections:{operations:"Operations",operationsDesc:"Uppdrag & leveranser",dataVault:"Data Vault",dataVaultDesc:"Rådata & arkiv",analytics:"Analytics",analyticsDesc:"Insikter & mönster",ads:"Ads",adsDesc:"Kampanjer & ROI",distribution:"Distribution",distributionDesc:"Aktivering & räckvidd",integrations:"Integrations",integrationsDesc:"API & kopplingar",compliance:"Compliance",complianceDesc:"Audit & juridik"},ads:{title:"Annonsering",description:"Planera kampanjer, beräkna ROI och hantera varumärkessynlighet",brandAwareness:"Varumärkeskännedom",brandAwarenessDesc:"Bygg igenkänning genom uppdragsplaceringar",localPresence:"Lokal närvaro",localPresenceDesc:"Rikta in dig på specifika geografiska områden",impressions:"Impressioner",impressionsDesc:"Spåra synlighet och engagemangsmått"},status:{accountPendingApproval:"Konto väntar på godkännande",profileBeingProcessed:"Din beställarprofil behandlas. Du meddelas när den är aktiverad.",viewStatus:"Visa status",active:"Aktiv",pending:"Väntar",paused:"Pausad",waitingForApproval:"Väntar på godkännande",youAreActivated:"Du är aktiverad som beställare och kan nu skapa uppdrag",applicationBeingProcessed:"Din ansökan behandlas. Du meddelas när den är godkänd.",accountPaused:"Ditt konto är pausat"},frequency:{once:"Engångs",daily:"Dagligen",weekly:"Veckovis",biweekly:"Varannan vecka",monthly:"Månadsvis"},missionStatus:{active:"Aktiv",delivered:"Levererad",cancelled:"Avbruten",pending:"Pending",disputed:"Tvistig"},operations:{createMission:"Skapa uppdrag",defineLocationMedium:"Definiera plats, medium, krav och SLA",photo:"Foto",video:"Video",sensor:"Sensor",live:"Live",assignments:"Uppdrag",noAssignments:"Inga uppdrag",assets:"assets",sla:"SLA"},dataVault:{title:"Data Vault",description:"Immutable rådata-arkiv med full metadata och versionshistorik",original:"Original",unmodifiedRawData:"Omodifierad rådata",processed:"Processed",aiProcessed:"AI-behandlad",metadata:"Metadata",time:"Tid",location:"Plats",equipment:"Utrustning",operator:"Operatör",versions:"Versioner",exported:"Exporterad",apiAccess:"API-åtkomst",apiAccessDesc:"Programmatisk åtkomst till din data",generateKey:"Generera nyckel",noAssets:"Inga assets ännu",completeAssignments:"Slutför uppdrag för att se data här"},analytics:{title:"Analytics",description:"AI-drivna insikter från din data",geographicPatterns:"Geografiska mönster",geographicPatternsDesc:"Heatmaps och områdesanalys",timeSeries:"Tidsserier",timeSeriesDesc:"Trender och säsongsvariationer",anomalies:"Avvikelser",anomaliesDesc:"Automatisk avvikelsedetektering",comparisons:"Jämförelser",comparisonsDesc:"Före/efter-analys",aiInsights:"AI-genererade insikter",aiInsightsDesc:"Automatiska rapporter och rekommendationer",noDataYet:"Ingen data ännu",completeAssignments:"Slutför uppdrag för att generera insikter"},distribution:{title:"Distribution",description:"Riktad aktivering och räckvidd",zoneActivation:"Zon-aktivering",zoneActivationDesc:"Skicka uppdrag till specifika områden",contributorPrioritization:"Contributor-prioritering",contributorPrioritizationDesc:"Prioritera bevisade operatörer",temporaryExposure:"Temporär exponering",temporaryExposureDesc:"Tidsbegränsad synlighet",sponsoredAssignments:"Sponsrade uppdrag",sponsoredAssignmentsDesc:"Framhävda för enterprise",noActiveDistribution:"Ingen aktiv distribution",createAssignments:"Skapa uppdrag för att aktivera distribution"},integrations:{title:"Integrations",description:"Anslut till dina system",apiKeys:"API-nycklar",newKey:"Ny nyckel",noApiKeys:"Inga API-nycklar genererade",generateFirst:"Generera din första nyckel för att komma igång",generateKey:"Generera nyckel",webhooks:"Webhooks",noWebhooks:"Inga webhooks konfigurerade",addWebhook:"Lägg till webhook",systemConnections:"Systemkopplingar",gis:"GIS",erp:"ERP",insurance:"Försäkring",government:"Myndighetssystem"},compliance:{title:"Compliance & Audit",description:"Loggar, åtkomsthistorik, godkännanden och datakällor",activityLogs:"Aktivitetsloggar",activityLogsDesc:"Komplett spårning av alla åtgärder",accessHistory:"Åtkomsthistorik",accessHistoryDesc:"Vem som har tillgång till din data",approvals:"Godkännanden",approvalsDesc:"Godkännandeflöden och signaturer",dataSources:"Datakällor",dataSourcesDesc:"Ursprung och verifiering av data",legalChainOfEvidence:"Juridisk beviskedja",legalChainOfEvidenceDesc:"För försäkring, myndigheter och juridiska ändamål",readyFor:"Redo för:",airlines:"Flygbolag",insuranceCompanies:"Försäkringsbolag",publicSector:"Offentlig sektor",noLogs:"Inga loggar ännu",activityWillAppear:"Aktivitet visas här"},registration:{title:"Bli beställare",stepOf:"Steg {{step}} av {{total}}",ordererStatus:"Beställarstatus",organizationType:"Organisationstyp",selectOrgType:"Välj typ av organisation",company:"Företag",companyDesc:"AB, HB, Enskild firma etc.",authority:"Myndighet",authorityDesc:"Kommun, region, statlig myndighet",organizationDetails:"Organisationsuppgifter",basicInfo:"Grundläggande information om din organisation",companyName:"Företagsnamn",authorityName:"Myndighetsnamn",companyPlaceholder:"AB Exempel",authorityPlaceholder:"Exempelkommun",organizationNumber:"Organisationsnummer",orgNumberPlaceholder:"XXXXXX-XXXX",continue:"Fortsätt",contactDetails:"Kontaktuppgifter",contactDetailsDesc:"Person som ansvarar för beställningar",contactPerson:"Kontaktperson",contactPersonPlaceholder:"Förnamn Efternamn",email:"E-post",emailPlaceholder:"namn@foretag.se",phone:"Telefon (valfritt)",phonePlaceholder:"+46 70 XXX XX XX",billingAddress:"Faktureringsadress",billingAddressDesc:"Adress för fakturering och avtal",streetAddress:"Gatuadress",streetAddressPlaceholder:"Exempelgatan 1",postalCode:"Postnummer",postalCodePlaceholder:"123 45",city:"Ort",cityPlaceholder:"Stockholm",paymentMethod:"Betalmetod",choosePaymentMethod:"Välj hur du vill betala för uppdrag",cardPayment:"Kortbetalning",cardPaymentDesc:"Betala direkt med kort via Stripe. Aktiveras omedelbart.",invoicePayment:"Faktura",invoiceDesc:"30 dagars betalningsvillkor. Kräver godkänd kreditprövning.",creditCheckInProgress:"Kreditprövning pågår...",checkingVia:"Kontrollerar {{orgName}} via CreditSafe.",creditCheckApproved:"Kreditprövning godkänd!",creditCheckApprovedDesc:"{{orgName}} är godkänd för fakturabetalning med 30 dagars kredit.",creditCheckNotApproved:"Kreditprövning ej godkänd",creditCheckNotApprovedDesc:"Tyvärr kunde vi inte godkänna {{orgName}} för fakturabetalning just nu. Du kan fortfarande registrera dig med kortbetalning och komma igång direkt!",chooseCardPayment:"Välj kortbetalning istället",summary:"Sammanfattning",organization:"Organisation",orgNumber:"Org.nummer",contact:"Kontakt",card:"Kort",completeRegistration:"Slutför registrering",registering:"Registrerar...",waitingForCreditCheck:"Väntar på kreditprövning...",profileCreated:"Beställarprofil skapad!",goToMissions:"Gå till uppdrag",activeDescription:"Du är aktiverad som beställare och kan nu skapa uppdrag",pendingDescription:"Din ansökan behandlas. Du meddelas när den är godkänd.",pausedDescription:"Ditt konto är pausat",validation:{enterOrgName:"Ange organisationsnamn",enterValidOrgNumber:"Ange ett giltigt organisationsnummer",enterContactPerson:"Ange kontaktperson",enterValidEmail:"Ange en giltig e-postadress",enterFullAddress:"Fyll i fullständig adress",creditCheckRequired:"Kreditprövningen måste godkännas för fakturabetalning"}},missionDetail:{title:"Hantera uppdrag",ordererView:"Beställarvy",edit:"Redigera",save:"Spara",views:"Visningar",inProgress:"Pågående",approved:"Godkända",photos:"Foton",created:"Skapad",missionDetails:"Uppdragsdetaljer",titleLabel:"Titel",location:"Plats",notSpecified:"Ej angiven",description:"Beskrivning",noDescription:"Ingen beskrivning",instructions:"Instruktioner till fotografen",instructionsPlaceholder:"T.ex. 'Fotografera hela objektet framifrån...'",noInstructions:"Inga instruktioner",reward:"Belöning",activeUntil:"Aktiv till",exampleImages:"Exempelbilder",upload:"Ladda upp",uploading:"Laddar upp...",addImage:"Lägg till",addExampleImage:"Lägg till exempelbild",noExampleImages:"Inga exempelbilder tillagda",cancelMission:"Avbryt uppdrag",cancelConfirm:"Är du säker på att du vill avbryta detta uppdrag?",missionUpdated:"Uppdraget har uppdaterats!",missionCancelled:"Uppdraget har avbrutits",couldNotUpdate:"Kunde inte uppdatera uppdraget",couldNotCancel:"Kunde inte avbryta uppdraget",missionNotFound:"Uppdraget hittades inte",missionNotFoundDesc:"Det uppstod ett fel när uppdraget skulle hämtas.",backToDashboard:"Tillbaka till dashboard",onlyImagesAllowed:"Endast bilder är tillåtna",maxFileSize:"Bilden får max vara 5MB",confirmDeleteImage:"Är du säker på att du vill ta bort denna bild?"}},Pse={title:"Skapa uppdrag",stepOf:"Steg {{step}} av {{total}}",continue:"Fortsätt",creating:"Skapar uppdrag...",create:"Skapa uppdrag",missionCreated:"Uppdrag skapat!",couldNotCreate:"Kunde inte skapa uppdraget",becomeOrderer:"Bli beställare först",mustBeOrderer:"Du måste vara registrerad och godkänd som beställare för att kunna skapa uppdrag.",registerAsOrderer:"Registrera som beställare",step1Title:"Vad ska fotograferas?",step1Desc:"Beskriv objekten eller platserna som ska dokumenteras",missionTitle:"Uppdragens titel",missionTitlePlaceholder:"T.ex. Parkbänkar i Vasaparken",whatToPhoto:"Vad ska fotas?",whatToPhotoPlaceholder:"T.ex. Alla parkbänkar, ta med bild på hela bänken och närbild på eventuella skador",instructions:"Instruktioner till fotografen",instructionsPlaceholder:"T.ex. Ta bilden rakt framifrån, inkludera omgivningen...",description:"Beskrivning (visas för fotograf)",descriptionPlaceholder:"Övrig information om uppdraget...",step2Title:"Plats",step2Desc:"Klicka på kartan för att välja mittpunkt, eller dra markören",areaName:"Områdesnamn",areaNamePlaceholder:"T.ex. Vasaparken, Stockholm",radius:"Radie",radiusHint:"Fotografen måste vara inom denna radie för att kunna genomföra uppdraget",latitude:"Latitud",longitude:"Longitud",step3Title:"Frekvens",step3Desc:"Hur ofta ska uppdraget utföras?",durationTitle:"Varaktighet",durationDesc:"Hur länge ska uppdraget vara aktivt?",frequencyOnce:"En gång",frequencyOnceDesc:"Engångsuppdrag",frequencyDaily:"Dagligen",frequencyDailyDesc:"Varje dag",frequencyWeekly:"Varje vecka",frequencyWeeklyDesc:"En gång per vecka",frequencyBiweekly:"Varannan vecka",frequencyBiweeklyDesc:"Var 14:e dag",frequencyMonthly:"Varje månad",frequencyMonthlyDesc:"En gång per månad",duration1week:"1 vecka",duration2weeks:"2 veckor",duration1month:"1 månad",duration3months:"3 månader",duration6months:"6 månader",duration1year:"1 år",step4Title:"Fotokrav",step4Desc:"Antal foton som krävs per genomfört uppdrag",photoCount:"Antal foton",rewardTitle:"Ersättning",rewardDesc:"Ersättning till fotografen per genomfört uppdrag",reward:"Ersättning",perPhoto:"{{amount}} krediter/foto",maxPerPhoto:"Max {{amount}} krediter/foto",rewardTooHigh:"Ersättningen får inte överstiga {{max}} krediter per foto",summaryTitle:"Sammanfattning",mission:"Uppdrag",area:"Område",frequency:"Frekvens",duration:"Varaktighet",photosPerMission:"Foton/uppdrag",rewardPerMission:"Ersättning/uppdrag",pcs:"st",estimatedTotalCost:"Estimerad totalkostnad",basedOnOnce:"Baserat på engångsuppdrag",basedOnFrequency:"Baserat på {{frequency}} i {{duration}}",validationTitleRequired:"Ange en titel för uppdraget",validationTargetRequired:"Beskriv vad som ska fotograferas",validationAreaRequired:"Ange ett områdesnamn"},Dse={title:"Kampanjtitel",description:"Beskrivning",locationType:"Typ av plats",searchArea:"Sökområde",instructions:"Instruktioner till fotograf",reward:"Belöning per uppdrag",photosPerLocation:"Foton per plats",duration:"Varaktighet",schedule:"Schema",once:"En gång",weekly:"Veckovis",daily:"Dagligen",locations:"Platser",locationsFound:"platser hittades",noLocationsFound:"Inga platser hittades",createCampaign:"Skapa kampanj",estimatedCost:"Beräknad kostnad",confirm:"Bekräfta och skapa"},Rse={title:"Bildmarknaden",subtitle:"Köp bilder • 100% går till välgörenhet",searchPlaceholder:"Sök bilder, länder, kategorier...",sortBy:"Sortera",allCategories:"Alla kategorier",allCountries:"Alla länder",noPhotosFound:"Inga bilder hittades",clearSearch:"Rensa sökning",fromPrice:"från {{price}} krediter",price:"{{price}} krediter",charityBannerTitle:"100% till välgörenhet",charityBannerDescription:"När du köper en bild går alla intäkter direkt till hjälporganisationer som arbetar i det land där bilden är tagen.",featured:"Utvald",popular:"Populära",priceLow:"Pris ↑",priceHigh:"Pris ↓"},Lse={title:"Marknadsplats",buyPhoto:"Köp foto",sellPhoto:"Sälj foto",featured:"Utvalda",popular:"Populära",recent:"Senaste",category:"Kategori",price:"Pris",photographer:"Fotograf",license:"Licens",download:"Ladda ner"},Ose={title:"Fototävling",currentContest:"Pågående tävling",submit:"Skicka in bidrag",vote:"Rösta",votes:"röster",winners:"Vinnare",prizes:"Priser",rules:"Regler",endsIn:"Slutar om",theme:"Tema",supports:"Stödjer {{charity}}",active:"Pågår",ended:"Avslutad",upcoming:"Kommande",daysLeft:"{{count}} dagar kvar",endedAgo:"Avslutad {{time}}",startsOn:"Startar {{date}}",info:"Info",entries:"Bidrag",noEntriesYet:"Inga bidrag ännu",beFirstToParticipate:"Bli först att delta!",contestEntry:"Tävlingsbidrag",winner:"Vinnare",uploadEntry:"Ladda upp bidrag",winnersNotAnnounced:"Vinnare har inte tillkännagivits ännu",winnersAfterEnd:"Vinnare utses när tävlingen avslutats",untitled:"Utan titel",firstPlace:"1:a plats",secondPlace:"2:a plats",thirdPlace:"3:e plats",starts:"Startar",ends:"Slutar"},Fse={photoNotFound:"Bilden hittades inte",backToMarket:"Tillbaka till bildmarknaden",purchaseInitiated:"Köp initierat för {{title}}",fullResolution:"Full upplösning",fullResolutionDesc:"Högsta kvalitet för alla användningsområden",buyDigitalPhoto:"Köp digital bild",charityTitle:"100% till välgörenhet",charityDescription:"Hela köpesumman går oavkortat till humanitärt arbete. Din betalning hjälper verkliga människor.",orderAsPrint:"Beställ som tryck",orderAsPrintDesc:"Efter köp kan du beställa professionella tryck via våra partners:",views:"visningar",downloads:"nedladdningar",linkCopied:"Länk kopierad!",checkOutPhoto:"Kolla in denna bild: {{title}}",opening:"Öppnar {{name}}",uploadForPrint:"Ladda upp din bild efter köp för att beställa tryck",professionalQuality:"Proffskvalitet online",balancedTopService:"Balanserad toppservice"},zse={now:"Nu",minutesAgo:"{{count}} min sedan",hoursAgo:"{{count}} tim sedan",daysAgo:"{{count}} dagar sedan",inMinutes:"Om {{count}} min",inHours:"Om {{count}} tim",inDays:"Om {{count}} dagar"},Bse={networkError:"Nätverksfel",serverError:"Serverfel",notFound:"Hittades inte",unauthorized:"Ej behörig",forbidden:"Förbjudet",tryAgain:"Försök igen",somethingWentWrong:"Något gick fel"},Nse={privacy:"Integritet",terms:"Villkor",contact:"Kontakt",tagline:"Varje foto berättar en historia",pixDriftTagline:"Pix + Drift = Dra iväg och fota 📸",copyright:"© 2024 PixDrift. Den globala plattformen för mobilfotografi.",values:"Ekonomiskt • Miljövänligt • Modernt"},Vse={title:"Topplista",total:"Totalt",thisWeek:"Denna vecka",thisMonth:"Denna månad",efficiency:"Effektivitet",rank:"Plats",earnings:"Intäkter",perMinute:"/min"},jse={statusBadge:"MISSBRUKSRESISTENT • INSTITUTION-GRADE",headline1:"Environmental Intelligence.",headline2:"Samhällskompatibelt.",subtitle:"Ett autonomt beslutssystem för tillfällig, anonym, miljöbaserad visuell datainsamling.",noSurveillance:"Ingen personövervakning. Ingen privat spaning. Aldrig.",institutionalOrder:"Institutionell Beställning",becomePerformer:"Bli Utförare",reasonGate:"Reason Gate",anonymization:"Anonymisering",abuseBlocked:"Missbruk Blockerat"},Use={title:"Kontoutdrag",auditCompliant:"Revisionssäker dokumentation",auditDescription:"Denna redovisning uppfyller kraven för skattedeklaration enligt svensk lagstiftning. Preliminärskatt (35%) säkerställer efterlevnad oavsett hemkommun. Moms (25%) redovisas separat. Kontrolluppgift lämnas årligen till Skatteverket.",grossAmount:"Bruttobelopp (inkl. moms)",vat:"Moms",preliminaryTax:"Preliminärskatt",netPaid:"Netto utbetalt",transactions:"Transaktioner",generating:"Genererar...",pdf:"PDF",download:"Ladda ner",send:"Skicka",sendEmailSoon:"Skicka via e-post kommer snart",noServicesRecorded:"Inga tjänsteutföranden registrerade",completeMissionsForReceipts:"Slutför uppdrag för att generera verifikationer",serviceExecution:"Tjänsteutförande",documentId:"Dokument-ID",executed:"Utförd",payingOrganization:"Betalande organisation",orgNumber:"Org.nr",serviceLocation:"Plats för tjänsteutförande",serviceType:"Tjänstetyp",pdfGenerated:"Kontoutdrag genererat och öppnat i ny flik",pdfProcessing:"PDF genereras... Detta kan ta några sekunder. Försök igen om en stund.",pdfError:"Kunde inte generera PDF. Kontrollera att PDF Monkey är konfigurerad korrekt.",mustBeLoggedIn:"Du måste vara inloggad för att exportera PDF",noTransactionsToExport:"Inga transaktioner att exportera",footer1:"Rewault AB · Org.nr 559XXX-XXXX · Momsreg.nr SE559XXXXXX01",footer2:"Skatteavdrag redovisas till Skatteverket. Kontrolluppgift lämnas årligen.",footer3:"Dokumentet är digitalt genererat. Ingen signatur krävs."},Gse={title:"Intern tillväxtmodell",description:"Delta i bolagets interna värdeutveckling",active:"Aktiv",inactive:"Inaktiv",importantInfo:"Viktig information",importantDescription:"Detta är inte ett sparkonto, en investering eller en finansiell placering. När du aktiverar tillväxt används ditt saldo som riskbärande kapital i bolagets verksamhet. Värdeutveckling är inte garanterad och kan både öka och minska. Funktionen omfattas inte av insättningsgaranti.",confirmParticipation:"Bekräfta deltagande",confirmCheckbox:"Jag förstår att detta inte är ett bankkonto, att mitt kapital används i bolagets operativa verksamhet, och att värdet kan både öka och minska. Jag bekräftar att detta inte är investeringsrådgivning och att funktionen inte omfattas av insättningsgaranti.",cancel:"Avbryt",activate:"Aktivera",enableGrowth:"Aktivera tillväxt",allocateBalance:"Allokera saldo till verksamhetsstöd",balanceActive:"Ditt saldo är aktivt i bolagets tillväxtmodell",valueDevelopment:"Värdeutveckling",historicalDevelopment:"Historisk utveckling baserad på bolagets resultat. Tidigare utveckling garanterar inte framtida resultat.",capitalInUse:"Kapital i användning",resultBasedAllocation:"Resultatbaserad tilldelning",currentValue:"Aktuellt värde",valueBasedOnResults:"Värdet baseras på bolagets aktuella resultat och kan förändras",howDoesItWork:"Hur fungerar det?",participationTitle:"Deltagande i intern tillväxtmodell",participationDescription:"När du aktiverar denna funktion används ditt saldo som riskbärande kapital i bolagets operativa verksamhet. Du deltar därmed i bolagets interna värde- och tillväxtmodell kopplad till kreditverksamhet och affärsdrift.",whatDoesThisMean:"Vad innebär detta?",point1:"Ditt kapital används i bolagets egen verksamhet",point2:"Bolaget är motpart, inte mellanhand",point3:"Eventuell värdeutveckling beror på bolagets faktiska resultat",point4:"Uttag sker enligt bolagets villkor",riskInfo:"Riskinformation",risk1:"Värdeutveckling är osäker och ej garanterad",risk2:"Värdet kan både öka och minska",risk3:"Kapitalet är riskbärande",risk4:"Omfattas inte av insättningsgaranti",complianceInfo:"Compliance-information",complianceDescription:"Detta är inte bankverksamhet, värdepappersverksamhet eller investeringsrådgivning. Funktionen utgör deltagande i bolagets interna affärsmodell där användaren tillhandahåller riskbärande kapital mot resultatbaserad tilldelning.",value:"Värde"},$se={title:"Din Prestation",level:"Nivå",score:"Poäng",tierElite:"Elite",tierPro:"Pro",tierActive:"Aktiv",tierRookie:"Rookie",tierNew:"Ny",seeMissionsFirst:"Du ser uppdrag först!",headStart:"{{seconds}}s försprång",delay:"{{seconds}}s fördröjning",completed:"Klara",approved:"Godkänt",streak:"Streak",expiredAffectScore:"{{count}} utgångna uppdrag påverkar din poäng"},Hse={installTitle:"Installera SnapTask",iosInstructions:'Tryck på dela-knappen och sedan "Lägg till på hemskärmen"',addToHomescreen:"Lägg till appen på din hemskärm för snabb åtkomst",install:"Installera"},Wse={clear:"Klart",partlyCloudy:"Delvis molnigt",cloudy:"Molnigt",fog:"Dimma",drizzle:"Duggregn",freezingRain:"Underkylt regn",rain:"Regn",snow:"Snö",rainShowers:"Regnskurar",snowShowers:"Snöbyar",thunderstorm:"Åska",unknown:"Okänt"},qse={notSupported:"Kompass stöds ej på denna enhet",permissionDenied:"Kompassåtkomst nekad",couldNotRequest:"Kunde inte begära kompassåtkomst",north:"Norr",northeast:"Nordost",east:"Öst",southeast:"Sydost",south:"Syd",southwest:"Sydväst",west:"Väst",northwest:"Nordväst"},Zse={couldNotFetch:"Kunde inte hämta AI-svar",tooManyRequests:"För många förfrågningar, försök igen om en stund",temporarilyUnavailable:"AI-funktionen är tillfälligt otillgänglig"},Xse={detailedAnalysis:"Detaljerad analys",composition:"Komposition",lighting:"Ljussättning",technicalQuality:"Teknisk kvalitet",certifiedRequirements:"Certified Global™ Krav",schoolyard:"Skolgård",goldenHour:"Golden hour",noPeople:"Inga personer",aestheticMin:"Estetik ≥75",requirementsNotMet:"Bilden uppfyller inte alla Certified Global™-krav. Försök ta en ny bild i golden hour på en skolgård utan personer.",gradeExceptional:"Exceptionell",gradeExcellent:"Utmärkt",gradeGood:"Bra",gradeAccepted:"Godkänd",gradeNeedsImprovement:"Behöver förbättras"},Kse={title:"Standardmallar",subtitle:"Köp i Bulk",description:"Fördefinierade uppdragstyper för snabb volym. Klicka för att se fullständig specifikation.",beach_crowd_density:{name:"Strandtäthet",description:"Mät folktäthet på stranden (aggregerad statistik)"},weather_conditions:{name:"Väderförhållanden",description:"Dokumentera aktuellt väder i område"},bus_stop_condition:{name:"Busshållplats Tillstånd",description:"Kontrollera tillstånd på busshållplats"},bridge_inspection:{name:"Bro Inspektion",description:"Visuell dokumentation av brokonstruktion"},pre_post_work:{name:"Före/Efter Arbete",description:"Dokumentera före och efter utfört arbete"},traffic_flow:{name:"Trafikflöde",description:"Mät trafikflöde i område (aggregerat)"},certified_global_schoolyard:{name:"Certified Global™ Skolgårdar",description:"Världstäckande fotoutmaning: vackra skolgårdsbilder i golden hour när skolan är stängd"}},Yse={title:"AI-Granskning",titleHighlight:"Automatisk. Omedelbar. Exakt.",description:"Ingen manuell granskning. Varje bild processas i realtid av AI-systemet för teknisk, juridisk och semantisk validering.",steps:{"01":{title:"Objektidentifiering",description:"AI identifierar alla objekt i bilden – byggnader, vegetation, ytor, fordon, människor."},"02":{title:"Kvalitetsmätning",description:"Skärpa, exponering, komposition och brusnivå analyseras mot uppdragets krav."},"03":{title:"Anonymisering",description:"Automatisk blur/mask på ansikten, registreringsskyltar och andra förbjudna element."},"04":{title:"Juridisk Kontroll",description:"Verifiering mot GDPR och uppdragsspecifika restriktioner."},"05":{title:"Dataextraktion",description:"Strukturerad information extraheras – metadata, klassificering, mätvärden."}},results:{approved:"GODKÄND",retake:"OMTAGNING",rejected:"UNDERKÄND"}},Qse={securityFunction:"Kritisk Säkerhetsfunktion",title:"Legitimate Interest Gate",description:"Alla uppdrag måste passera ett",descriptionHighlight:"Reason Gate",descriptionEnd:"innan de bryts ned till mikrojobb. Detta är algoritmisk moral – inte juridisk text.",approved:{title:"GODKÄNDA ÄNDAMÅL",subtitle:"Passerar Reason Gate"},denied:{title:"AUTOMATISKT NEKADE",subtitle:"Blockeras omedelbart"},approvedReasons:{infrastructure:"Statusbedömning av offentlig infrastruktur",recreation:"Publik belastning i rekreationsområde",environment:"Miljö- och väderförhållanden",commercial:"Kommersiell områdesanalys på aggregerad nivå",documentation:"Före/efter-dokumentation av arbete"},deniedReasons:{lookOutside:"Se hur det ser ut utanför X",followChange:"Följa förändring på samma punkt dagligen",seeIfAnyone:"Se om någon är där",privateResidence:"Kolla aktivitet vid privat bostad",targetedObservation:"Riktad observation av individ"},principle:"Systemet ska hellre falskt neka än riskera missbruk",noOverride:"Ingen mänsklig override tillåts för personkopplade uppdrag"},Jse={light:{label:"Ljust",description:"Rent och tydligt"},dark:{label:"Mörkt",description:"Behagligt för ögonen"},auto:{label:"Auto",description:"UV-index & väder"},currentMode:"Just nu:",darkMode:"Mörkt läge",lightMode:"Ljust läge",lightLevelDark:"Mörkt",lightLevelLight:"Ljust",lightLevel:"Ljusnivå",autoDescription:"Anpassas automatiskt efter UV-index, molntäcke och tid"},eae={title:"Uppdragstyper",titleHighlight:"Strikt Whitelist",description:"Endast följande kategorier existerar i systemet. Allt annat finns inte.",categories:{environment:{title:"Miljö & Natur",items:{beaches:"Stränder (folktäthet som statistik)",parks:"Parker",forest:"Skog",weather:"Snö-/väderläge",erosion:"Erosion"}},infrastructure:{title:"Offentlig Infrastruktur",items:{busStops:"Busshållplatser",bridges:"Broar",walkways:"Gångvägar",playgrounds:"Lekplatser",parkingAreas:"Parkeringsytor"}},commercial:{title:"Kommersiell Omgivning",items:{shoppingCenters:"Köpcentrum (exteriört)",retailAreas:"Handelsområden",streets:"Gator (trafikflöde)",touristAreas:"Turistområden"},note:"Endast aggregerad data"},operational:{title:"Verksamhetsdriven Dok.",items:{construction:"Byggprojekt",facades:"Fasader",publicProperties:"Offentliga fastigheter",facilities:"Anläggningar"}}},forbidden:{title:"EXISTERAR INTE I SYSTEMET",items:{privateAddresses:"Privata adresser",residenceEntrances:"Entréer till bostäder",repetitiveObservation:"Repetitiv observation",personIdentification:"Personidentifiering",privateSurveillance:"Privat spaning"}}},tae={title:"Uppdragsstruktur",titleHighlight:"Maskinläsbar Precision",description:"Varje uppdrag är strikt definierat med geografisk, temporal och semantisk precision. Ingen frihet, ingen tolkning – endast exakt specifikation.",fields:{geographicZone:{label:"Geografisk zon",value:"koordinater, radie, polygon"},timeWindow:{label:"Tidsfönster",value:"giltighet, ljuskrav"},imageType:{label:"Bildtyp",value:"stillbild, serie, panorama"},subjectDefinition:{label:"Motivdefinition",value:"fasader, vegetation, ytor"},forbiddenElements:{label:"Förbjudna element",value:"ansikten, skyltar, interiör"},aiRules:{label:"AI-regler",value:"trösklar, kvalitet, objekt"}},schemaFile:"uppdrag.schema",validated:"VALIDERAT"},nae={systemProtection:"Systemskydd",title:"Självskyddande",titleHighlight:"Intelligens",description:"Systemet är designat att aktivt försvara sig mot missbruk. Dess främsta mål är",descriptionHighlight:"förtroende, inte tillväxt",features:{patternAnalysis:{title:"Mönsteranalys",description:"AI analyserar aktivt beställningsmönster för att upptäcka systematiskt missbruk."},behaviorDetection:{title:"Beteendedetektering",description:"Identifierar misstänkta försök att kringgå systemets skyddsmekanismer."},automaticBlocking:{title:"Automatisk Blockering",description:"Användare som försöker 'spela systemet' blockeras automatiskt och permanent."},dynamicThresholds:{title:"Dynamiska Trösklar",description:"Systemet justerar kontinuerligt sina gränsvärden baserat på upptäckta hot."}}},rae={label:"Repetitionskontroll",title:"Mönster Övervakas",titleHighlight:"Automatiskt",description:"Systemet blockerar aktivt repetitiva förfrågningar till samma zon, vinkel och ändamål – om inte beställaren är institutionell.",institutional:{title:"Institutionell Beställare",subtitle:"Kommun, Myndighet, Företag",features:{periodic:"Periodisk övervakning OK",sameZone:"Samma zon över tid",trend:"Trendanalys tillåten"},status:"REPETITION: TILLÅTEN"},private:{title:"Privatperson",subtitle:"Enskild användare",features:{exactLocation:"Peka ut exakt plats",controlAngle:"Styra vinkel mot objekt",requestRepetition:"Begära repetition"},status:"REPETITION: BLOCKERAD"},allowed:{title:"Privatpersoner får fråga:",examples:{weather:"Hur ser vädret ut i område X just nu?",crowd:"Hur mycket folk är det på strand Y?"},note:'Endast generiska miljöuppdrag. Aldrig "den där", "utanför X", eller "igen imorgon".'}},iae={title:"Absoluta Regler",titleHighlight:"Kan Ej Åsidosättas",description:"Dessa principer är hårdkodade i systemet. De existerar inte som policy – de existerar som algoritm.",critical:"KRITISK",principles:{noPerson:{title:"INGEN PERSON = INGET UPPDRAG",description:"Om ett uppdrag kan kopplas till en specifik individ eller privat adress utan verksamhetskoppling – nekas det automatiskt. Ingen mänsklig override tillåts."},reasonFirst:{title:"REASON-FIRST LOGIC",description:"Varje beställning måste innehålla: explicit ändamål, typ av intresse, och förväntad datanytta. Utan godkänt syfte existerar inte uppdraget."},locationNotAddress:{title:"PLATS ≠ ADRESS",description:"Systemet arbetar med zoner, områden och offentliga noder. Systemet accepterar aldrig exakt privat adress, entré till bostad, eller repetitiv observation utan offentlig funktion."},dataOverImage:{title:"DATA > BILD",description:"Bilder är råmaterial. Slutprodukten är strukturerad, anonymiserad information. Ingen identifierbar individ når beställaren."}},emphasis:"INTE övervakning • INTE spaning • INTE personkontroll"},oae={george:"Lugn, professionell man",sarah:"Vänlig, tydlig kvinna",liam:"Ung, energisk man",matilda:"Varm, förtroendeingivande kvinna",daniel:"Nyhetspresentatör, auktoritativ man"},sae="Hej! Jag heter {{name}} och jag kommer att guida dig genom dina uppdrag.",aae="Lyssna på rösten",lae="Kunde inte spela upp rösten",cae={actors:fse,cta:pse,realChange:mse,charity:gse,common:_se,nav:yse,auth:vse,home:xse,missions:bse,missionDetail:wse,wallet:Sse,profile:Tse,notifications:Ese,map:kse,quickCreate:Ase,camera:Cse,validation:Ise,orderer:Mse,createMission:Pse,campaign:Dse,photoMarketplace:Rse,marketplace:Lse,contest:Ose,photoDetail:Fse,time:zse,errors:Bse,footer:Nse,leaderboard:Vse,hero:jse,earningsHistory:Use,earningsGrowth:Gse,performance:$se,pwa:Hse,weather:Wse,compass:qse,ai:Zse,aesthetic:Xse,templates:Kse,aiValidation:Yse,reasonGate:Qse,themeSelector:Jse,missionTypes:eae,workflow:tae,selfProtection:nae,repetitionControl:rae,principlesSection:iae,voiceDescriptions:oae,voiceSample:sae,voicePreviewButton:aae,voicePreviewError:lae},uae={title:"Three Actors.",titleHighlight:"One System.",subtitle:"An operational marketplace network where demand meets capacity through AI orchestration.",orderer:{title:"Client",subtitle:"Institutions & Companies",description:"Municipalities, authorities, property companies and contractors who need current, verified visual environmental data.",features:{define:"Define exactly what should be documented",precision:"Geographic and time-controlled precision",quality:"Automatic quality control",verified:"Only verified output"}},performer:{title:"Performer",subtitle:"Private Individuals",description:"People with mobile cameras who execute strictly defined assignments and get paid per approved delivery.",features:{guidance:"Real-time AI guidance",feedback:"Clear feedback (approved/rejected)",payment:"Payment per delivery",noInterpretation:"No interpretation freedom"}},ai:{title:"AI System",subtitle:"Orchestration & Validation",description:"Breaks down orders, matches performers, guides photography, validates and delivers structured data.",features:{validation:"Automatic image validation",review:"Legal & technical review",anonymization:"Real-time anonymization",extraction:"Data extraction"}},flow:{order:"Order",matching:"Matching",execution:"Execution",validation:"Validation",data:"Data"}},dae={tagline:"A society-compatible visual intelligence network where",taglineHighlight:"no one can abuse the system",taglineEnd:"for private purposes.",institutions:{title:"Institutional Clients",description:"Municipalities, authorities, property companies and infrastructure owners with verified public interest.",features:{access:"Full access to all assignment types",periodic:"Periodic data collection allowed",export:"Structured data export"},button:"Apply for Access"},performers:{title:"Performers",description:"Use your mobile to earn money. First-claim on assignments in your zone. Quick payment after AI approval.",features:{reward:"5-20 SEK per approved image",guidance:"Real-time AI guidance",flexible:"Flexible, no interpretation freedom"},button:"Become a Performer"}},hae={back:"Back",featured:"FEATURED",charityLottery:"Charity Lottery",title:"QZ Real Change",titleHighlight:"Mission",subtitle:"A photo lottery for charity. Everyone can participate — take photos, upload and join the draw!",infoCards:{free:"Free",freeDesc:"to participate",newMissions:"New missions",newMissionsDesc:"regularly",vernissage:"Vernissage",vernissageDesc:"NYC June 11-14"},howItWorks:{title:"How it works",step1:"Choose a mission and go to the location",step2:"Take photos and upload your entry",step3:"A jury selects winners — all entries are in the draw",step4:"Winning photos are exhibited at vernissage in New York June 11-14"},prizes:{first:"1st",second:"2nd",third:"3rd"},charityLotteries:"Charity Lotteries",charityLotteriesDesc:"Iconic locations worldwide — winning photos are exhibited at vernissage in New York June 11-14",sponsoredCampaigns:"Sponsored Campaigns",sponsoredCampaignsDesc:"Companies supporting photographers and charity — all proceeds go to good causes",enterDraw:"Enter the draw",deadline:"Deadline",difficulty:{medium:"Challenging",hard:"Hard",extreme:"Extreme"},vernissageInfo:{title:"Annual Vernissage in New York",description:"All winning photos are exhibited once a year at an exclusive vernissage in New York where they are sold for charity. 100% of proceeds are invested in developing smart software and hardware for education in countries that need it most."},bottomInfo:"Your participation helps donate 1,000 educational phones to children in Uganda. Your photo can change lives.",yourParticipation:"Your participation",missions:{tokyoSakura:{title:"Cherry Blossom Season",location:"Tokyo, Japan",description:"Capture the Meguro River or Ueno Park in full cherry blossom. Millions of flowers blooming in just two weeks.",challenge:"Get to Tokyo during blooming season and find the perfect sunrise light"},nycChristmas:{title:"Rockefeller Christmas Tree",location:"New York, USA",description:"Document the iconic Christmas tree at Rockefeller Center in snowfall. 25 meters of glittering magic.",challenge:"Wait for snow in New York and capture the tree in perfect winter atmosphere"},parisEiffel:{title:"Eiffel Tower in Fog",location:"Paris, France",description:"Capture the Eiffel Tower when fog sweeps in and creates a dreamy silhouette over the Seine.",challenge:"Monitor weather and be ready to shoot when fog rolls in over Paris"},veniceCarnival:{title:"Venice Carnival",location:"Venice, Italy",description:"Document the magnificent masks and costumes during Venice's famous carnival at Piazza San Marco.",challenge:"Get to Venice during carnival week and capture the right atmosphere"},northernLights:{title:"Northern Lights",location:"Tromsø, Norway",description:"Capture the northern lights dancing over arctic landscapes. Nature's most spectacular light show.",challenge:"Wait for clear nights and strong solar activity"},tajMahal:{title:"Taj Mahal at Dawn",location:"Agra, India",description:"Capture Taj Mahal as the sun rises and the marble palace glows in pink and gold.",challenge:"Be on location at sunrise for perfect light"},santorini:{title:"Santorini Sunset",location:"Oia, Greece",description:"The famous sunset over the caldera with white houses and blue domes.",challenge:"Find the right position among hundreds of tourists"},machuPicchu:{title:"Machu Picchu in Mist",location:"Peru",description:"The mystical Inca city when the morning mist lifts and the mountains are revealed.",challenge:"Hike up before dawn to capture the mist"},dubaiSkyline:{title:"Dubai Skyline",location:"Dubai, UAE",description:"Burj Khalifa and skyline at sunset or night with the city lights.",challenge:"Find the perfect viewpoint"},rioCarnival:{title:"Rio Carnival",location:"Rio de Janeiro, Brazil",description:"The world's biggest party — colors, dance and joy at Sambadrome.",challenge:"Capture the movement and energy in the midst of the party"}},campaigns:{sevenEleven:{title:"World Store Hunt",description:"Photograph as many 7-Eleven stores as you can around the world! Whoever photographs the most unique stores before the deadline wins.",charityNote:"Part of the winnings go to local food banks",availability:"Active globally in 20 countries"},porsche:{title:"Porsche Golden Hour",description:"Capture your Porsche in perfect sunset light during April. Show us the ultimate combination of German engineering and nature's magic.",charityNote:"Porsche supports sustainable motorsport",availability:"8 winners globally"},adobeCityGlow:{title:"City Glow",description:"Capture the city's magical glow in winter darkness. Neon lights, streetlights and city silhouettes — show us the sickest city glow image!",charityNote:"Supports creative education for youth",availability:"One winner per major city"},appleShotOnIphone:{title:"Shot on iPhone",description:"Show what the new iPhone can do! Capture an extraordinary moment with your iPhone — the best entries will be featured in Apple's global campaign.",charityNote:"Apple matches with donation to education",availability:"Global — everyone can participate"}},season:{marchApril:"March-April",december:"December",autumnWinter:"Autumn/Winter",february:"February",septMarch:"Sept-March",octMarch:"Oct-March",mayOct:"May-Oct",aprilOct:"April-Oct",novMarch:"Nov-March"}},fae={title:"Donate to charity",description:"Make a difference with your earned credits. 100% of your donation goes directly to the organization – good no matter whose hands it ends up in.",donationComplete:"Donation complete!",donatedTo:"You donated {{amount}} credits to {{name}}. Would you like to share this on Facebook?",thankYou:"Thank you for your contribution!",shareOnFacebook:"Share on Facebook",maybeLater:"Maybe later",thanksForSharing:"Thanks for spreading the word!",minDonation:"Minimum donation is 10 credits",notEnoughCredits:"You don't have enough credits",thanksDonation:"Thank you! You donated {{amount}} credits to {{name}} 💚",amount:"Amount (credits)",enterAmount:"Enter amount",available:"Available",donate:"Donate",donating:"Donating...",readMoreAt:"Read more at",unicef:{name:"UNICEF",description:"Saves children worldwide",mission:"Works for children's rights in over 190 countries. Every credit helps children access education, clean water and healthcare.",impact:"100 credits = vaccines for 10 children"},doctorsWithoutBorders:{name:"Doctors Without Borders",description:"Medical help in crisis zones",mission:"Provides life-saving medical care to people in need, regardless of where they are or who they are.",impact:"250 credits = medicine for a family"},wwf:{name:"WWF",description:"Protects nature and wildlife",mission:"Fights to preserve biodiversity and protect endangered species around the world.",impact:"150 credits = protects 1 hectare of rainforest"},wateraid:{name:"WaterAid",description:"Clean water for everyone",mission:"Works to ensure everyone has access to clean water, sanitation and hygiene. Water is the foundation of everything.",impact:"200 credits = clean water for a month"},plan:{name:"Plan International",description:"Education for girls",mission:"Fights for children's rights and girls' equal opportunities for education and future.",impact:"300 credits = school supplies for a child"},stadsmission:{name:"City Mission",description:"Helps vulnerable people in Sweden",mission:"Provides support to people experiencing homelessness and vulnerability. No one should have to be hungry or cold.",impact:"100 credits = a warm meal"},wfp:{name:"World Food Programme",description:"Fights hunger globally",mission:"The UN food program saves lives by delivering food to the most vulnerable in the world.",impact:"50 credits = food for a family for a day"},handInHand:{name:"Hand in Hand",description:"Creates jobs to eradicate poverty",mission:"Helps people in poverty start their own businesses and support themselves and their families.",impact:"500 credits = a micro-entrepreneur receives support"}},pae={loading:"Loading...",error:"An error occurred",save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",edit:"Edit",back:"Back",next:"Next",close:"Close",search:"Search",filter:"Filter",all:"All",none:"None",yes:"Yes",no:"No",or:"or",and:"and",credits:"credits",credit:"credit",meters:"meters",km:"km",minutes:"minutes",hours:"hours",days:"days",today:"Today",yesterday:"Yesterday",tomorrow:"Tomorrow",sek:"SEK",currency:"SEK",available:"Available",photos:"photos",until:"until",daily:"Daily",weekly:"Weekly",biweekly:"Biweekly",monthly:"Monthly",takeMission:"Take mission",order:"Order"},mae={home:"Home",map:"Map",wallet:"Wallet",profile:"Profile",notifications:"Notifications",howItWorks:"How it works",forBusinesses:"For Businesses",forPerformers:"For Performers",api:"API",getStarted:"Get Started"},gae={login:"Log in",logout:"Log out",signup:"Sign up",email:"Email",password:"Password",forgotPassword:"Forgot password?",noAccount:"Don't have an account?",hasAccount:"Already have an account?",signupSuccess:"Account created! You are now logged in.",loginSuccess:"Welcome back!",logoutSuccess:"Logged out!",invalidCredentials:"Wrong email or password",emailRequired:"Email is required",passwordRequired:"Password is required",loginRequired:"Log in to use this feature",displayName:"Display name (optional)",displayNamePlaceholder:"Your name",emailPlaceholder:"your@email.com",loginSubtitle:"Log in to order or complete missions",signupSubtitle:"Sign up to get started",waiting:"Please wait...",createAccount:"Create account",emailAlreadyRegistered:"Email is already registered",somethingWentWrong:"Something went wrong. Please try again.",invalidEmail:"Invalid email address",passwordMinLength:"Password must be at least 6 characters",appPrompt:{title:"Continue in the app?",subtitle:"The quiXzoom app gives a better experience with notifications, camera and GPS.",openApp:"Open quiXzoom app",continueWeb:"Continue in browser",hint:"You can always download the app later from your profile."}},_ae={welcome:"Welcome",nearbyMissions:"Missions near you",noMissions:"No missions available right now",activeMission:"Active mission",claimMission:"Claim mission",viewDetails:"View details",distance:"Distance",reward:"Reward",expires:"Expires",photosRequired:"photos required",missionTypes:"Mission types",howItWorks:"How it works",getStarted:"Get started",earnMoney:"Earn money from your photos",tagline:"Capture the world. Get paid.",startEarning:"Start earning",learnMore:"Learn more"},yae={title:"Missions",active:"Active",completed:"Completed",expired:"Expired",claimed:"Claimed",available:"Available",claim:"Claim mission",submit:"Submit",abandon:"Abandon mission",timeRemaining:"Time remaining",photosSubmitted:"Photos submitted",instructions:"Instructions",requirements:"Requirements",location:"Location",radius:"Radius",description:"Description",takePhoto:"Take photo",uploadPhoto:"Upload photo",submitPhotos:"Submit photos",missionComplete:"Mission complete!",pendingReview:"Pending review",approved:"Approved",rejected:"Rejected",expiresIn:"Expires in",noActiveMission:"No active mission",findMission:"Find a mission",loadError:"Could not load missions",focusMode:"Focus mode – complete your active mission",noMissionsInArea:"No active missions in your area. Check back soon!",photo:"Photo missions",photoShort:"Photo",video:"Video missions",videoShort:"Video",showingMissions:"Showing {{count}} missions sorted by distance",noMissionsNearby:"No missions in your area right now"},vae={back:"Back",notFound:"Mission not found",photos:"Photos",reward:"Reward",timeLeft:"Time left",expired:"Expired",fetching:"Fetching...",unknown:"Unknown",closeEnough:"You are close enough!",withinRadius:"Within {{distance}}",map:"Map",workOrder:"Work order",whatToPhoto:"What to photograph",photosRequired:"Photos required",photo:"photo",exampleImages:"Example images",exampleHint:"This is roughly what the photo should look like:",approvedExamples:"Approved examples",notApprovedExamples:"Not approved examples",exampleApproved:"Approved",exampleNotApproved:"Not approved",exampleComingSoon:"Example coming soon",photoTips:"Tips: Clear image, right angle, good lighting. Avoid blurry images or wrong subject.",howTo:"How to do it",deadline:"Deadline",paymentOnApproval:"Payment upon approved mission",latitude:"Latitude",longitude:"Longitude",frequency:"Frequency",frequencyDuration:"Frequency & Duration",activeUntil:"Active until",missionExpires:"Mission expires",daily:"Daily",weekly:"Weekly",biweekly:"Biweekly",monthly:"Monthly",claimTimeLeft:"Time left",hurryUp:"Hurry up!",completeBeforeExpiry:"Complete before time runs out",testMode:"Test mode",testModeActive:"Test mode - photos are not saved",testModeActivated:"Test mode activated!",testCameraHint:"Test the camera without creating a real claim.",cameraTestComplete:"Camera test complete!",photosNotSaved:"Photos were not saved (test mode).",missionCompleted:"Mission completed!",loading:"Loading...",exitTestMode:"Exit test mode",releaseMission:"Release mission",verifyForMissions:"Verify for missions",verifyDescription:"Complete your registration to take missions.",testCamera:"Test camera (without saving)",claimMission:"Claim mission",getCloser:"Get closer to claim the mission",confirmClaim:"Claim mission?",confirmClaimDesc:"You have <strong>15 minutes</strong> to take the photo and upload it. Are you ready?",cancel:"Cancel",yesClaim:"Yes, claim mission",couldNotClaim:"Could not claim mission",missionIsYoursAgain:"The mission is yours again!",missionIsYours:"The mission is yours!",youHave15Min:"You have 15 minutes to complete it.",couldNotRelease:"Could not release mission",missionReleased:"Mission released",someoneElseCanTake:"Now someone else can take it.",withinRadiusText:"Within specified radius"},xae={title:"Wallet",balance:"Balance",totalEarned:"Total earned",pendingPayout:"Pending payout",withdraw:"Withdraw",withdrawFunds:"Withdraw funds",transactions:"Transactions",noTransactions:"No transactions yet",earned:"Earned",payout:"Payout",pending:"Pending",completed:"Completed",earnings:"Earnings",thisWeek:"This week",thisMonth:"This month",allTime:"All time",leaderboard:"Leaderboard",yourRank:"Your rank",rank:"Rank",photographer:"Photographer",swishNumber:"Swish number",requestPayout:"Request payout",minPayout:"Minimum payout",taxInfo:"Tax info",taxDeducted:"Tax deducted",netAmount:"Net amount",earningsGrowth:"Earnings growth",growYourEarnings:"Grow your earnings",dailyInterest:"daily interest",lockedBalance:"Locked balance",accruedInterest:"Accrued interest",loginToEarn:"Log in to start earning",transactionHistory:"Transaction history",loginToSeeTransactions:"Log in to see your transactions",minWithdrawError:"Minimum withdrawal is 100 credits",invalidSwishError:"Enter a valid Swish number",withdrawViaSwish:"Withdraw via Swish",amount:"Amount",minAmount:"Minimum 100 credits",available:"Available",taxDeduction:"Tax deduction",youReceive:"You receive",taxNote:"Tax is automatically deducted and reported to the tax authority.",processing:"Processing...",confirmWithdraw:"Confirm withdrawal",verifyForPayouts:"Verify for payouts",verifyDescription:"Complete your registration to receive payouts.",pendingPayouts:"Pending payouts",creditsToSwish:"credits to Swish",tapForHistory:"Tap for history",completeMissionsToEarn:"Complete missions to earn credits"},bae={title:"Profile",settings:"Settings",editProfile:"Edit profile",displayName:"Display name",email:"Email",phone:"Phone",city:"City",verified:"Verified",notVerified:"Not verified",verifyIdentity:"Verify identity",identityVerified:"Identity verified",stats:"Stats",completedMissions:"Completed missions",approvalRate:"Approval rate",avgCompletionTime:"Avg. completion time",streak:"Streak",streakDays:"days in a row",reach:"Reach",reachDescription:"Your reach for seeing missions",notifications:"Notifications",smsNotifications:"SMS notifications",language:"Language",theme:"Theme",darkMode:"Dark mode",lightMode:"Light mode",systemTheme:"System theme",privacy:"Privacy",terms:"Terms",help:"Help",support:"Support",about:"About",version:"Version",deleteAccount:"Delete account",logoutConfirm:"Are you sure you want to log out?",accountType:"Account type",private:"Private",company:"Company",selfAccounting:"Self accounting",selfAccountingDescription:"I handle my own tax and accounting",loadingProfile:"Loading profile...",totalEarned:"Total earned",available:"Available",accountInfo:"Account information",accountInfoDesc:"Your basic profile information",nickname:"Nickname",nicknamePlaceholder:"⭐ SuperPhotographer_99",nicknameHint:"Shown on the leaderboard. Be creative but nice! 🎮",nicknameMinChars:"At least 2 characters",nicknameMaxChars:"Max 20 characters",nicknameOffensive:"Please choose a nicer name",nicknameInvalidChars:"Only letters, numbers and simple symbols",required:"Required",verifiedAt:"Verified",unknownDate:"Unknown date",orderer:"Orderer",ordererActive:"Active",ordererPending:"Pending",ordererAsOrg:"You order as {{org}}",ordererApplicationPending:"Your application is being processed",ordererDesc:"Order missions as a company, organization or authority",openOrdererDashboard:"Open orderer dashboard",createNewMission:"Create new mission",viewOrdererProfile:"View orderer profile",becomeOrderer:"Become orderer",paymentMethod:"Payment method",paymentMethodDesc:"Connect your Swish to receive payouts",swishNumber:"Swish number",swishConnected:"Connected",swishHint:"Enter the mobile number connected to your Swish",phoneVerification:"Phone & Verification",phoneVerificationDesc:"Verify your account and enable SMS notifications",phoneNumber:"Phone number",phoneVerified:"Verified",phoneNotVerified:"Not verified",phoneHint:"Used for account verification and SMS notifications",smsNotificationsLabel:"SMS notifications",smsNotificationsDesc:"Get SMS about new missions and status updates",addPhoneForSms:"Add a phone number to enable SMS notifications",reachTitle:"Reach",reachDesc:"How far from your position do you want to see missions?",locationTitle:"Location",locationDesc:"Your saved home position for mission matching",lat:"Lat",long:"Long",noLocationSaved:"No location saved yet",updateToCurrentLocation:"Update to current location",notificationsTitle:"Notifications",notificationsDesc:"Choose which notifications you want to receive",newMissions:"New missions",newMissionsDesc:"Notify me when new missions are nearby",missionUpdates:"Mission updates",missionUpdatesDesc:"Status on my claimed missions",rewards:"Rewards",rewardsDesc:"Notify me about new credits and rewards",marketing:"Marketing",marketingDesc:"Offers and news",countryTax:"Country & Tax",countryTaxDesc:"You can only see compensation for missions in the country you are in",sweden:"Sweden",basedOnGps:"",selfAccountingLabel:"Self accounting",weHandleTax:"We handle the tax",taxAutoDeducted:"Automatic tax deduction (30%) is made before payout. You will receive a tax certificate for your declaration.",appearanceTitle:"Appearance & Language",appearanceDesc:"Choose theme and language for the app",languageDesc:"Choose which language the app should be displayed in",saveChanges:"Save changes",saving:"Saving...",logOut:"Log out",profileSaved:"Profile saved!",couldNotSave:"Could not save changes",couldNotUpdateLocation:"Could not update location",locationUpdated:"Location updated!",loggedOut:"You have logged out",growthModelActivated:"Growth model activated!",growthModelDeactivated:"Growth model deactivated",couldNotSaveGrowth:"Could not save growth setting",voiceGuide:"Instruction voice",voiceGuideDesc:"Choose which voice to use for navigation and photo instructions"},wae={title:"Notifications",empty:"No notifications yet",markAllRead:"Mark all as read",newMission:"New mission",missionApproved:"Mission approved",missionRejected:"Mission rejected",payoutComplete:"Payout complete",newNearby:"New mission nearby",keepTrack:"Keep track of new missions and updates",previewMission:"Photograph store front...",previewApproved:"Mission approved!",previewReward:"You received 50 SEK...",loginToSee:"Log in to see your notifications"},Sae={title:"Map",yourLocation:"Your location",missionLocation:"Mission location",showMissions:"Show missions",hideMissions:"Hide missions",centerOnMe:"Center on me",directions:"Directions",navigate:"Navigate",distance:"Distance",eta:"ETA",gettingLocation:"Getting your location...",locationRequired:"Location access required",enableLocation:"Enable location sharing to see missions near you",loginToCreate:"You must be logged in to create missions",couldNotGetPosition:"Could not get your position",createMissionHere:"Create mission here",verifyForMissions:"Verify for missions",verifyDescription:"Complete your registration to take missions.",couldNotLoadMap:"Could not load map",viewMission:"View mission",focusMode:"Focus mode",stationary:"Stationary",walking:"Walking",cycling:"Cycling",vehicle:"Vehicle",walk:"Walk",bike:"Bike",drive:"Drive",startNavigation:"Start navigation",clearRoute:"Clear route",calculating:"Calculating...",routeError:"Could not calculate route",loadingMap:"Loading map...",reloadMap:"Reload map",nearest:"Nearest",cluster:"Cluster",popular:"Popular",locked:"Locked",lock:"Lock",flyingToNearest:"Flying to nearest mission",fromHere:"from here",flyingToCluster:"Flying to densest area",missionsHere:"missions gathered here",flyingToPopular:"Flying to",popularArea:"Popular area with",previousMissions:"previous missions",mapLocked:"Map locked to your position",mapUnlocked:"Map unlocked",cancelNavigation:"Cancel navigation",waitOrCancel:"Wait or cancel",participate:"Participate",couldNotLoadMapToken:"Could not load map (token)",couldNotLoadMapWebGL:"Could not load map (WebGL not supported on this device)",couldNotLoadMapStyle:"Could not load map (style)",couldNotLoadMapNetwork:"Could not load map (network/adblock)",mapLostContext:"Map lost graphics context. Tap to reload.",unknownMapError:"Unknown map error",mapLoadTimeout:"Map took too long to load. Check network/adblock and try again.",missionCount:"pcs",lottery:"Lottery",campaign:"Campaign",goToMap:"Go to map"},Tae={title:"Create mission at my location",description:"Create a new mission at your current position",titleLabel:"Title",titleRequired:"Title *",titlePlaceholder:"E.g. Photograph the café on the corner",descriptionLabel:"Description (optional)",descriptionPlaceholder:"Describe what should be photographed...",photoCount:"Number of photos",reward:"Reward",creditsPerPhoto:"{{amount}} credits per photo (max 300 credits/photo)",radius:"Radius",exampleImages:"Example images (optional)",goodExamples:"Good examples",badExamples:"Bad examples",goodExampleAlt:"Good example",badExampleAlt:"Bad example",addImage:"Add",exampleHint:"Show the photographer how the photo should (and should not) look",cancel:"Cancel",creating:"Creating...",createMission:"Create mission",imageTooLarge:"Image must be max 5 MB",loginAndLocationRequired:"You must be logged in and have a location",titleRequiredError:"Enter a title for the mission",missionCreated:"Mission created!",missionOnMap:'"{{title}}" is now on the map',couldNotCreate:"Could not create mission",tryAgain:"Try again",goodExampleCaption:"Good example",badExampleCaption:"Bad example"},Eae={takePhoto:"Take photo",retake:"Retake",use:"Use",gallery:"Gallery",flash:"Flash",flashOn:"Flash on",flashOff:"Flash off",flashAuto:"Auto",switchCamera:"Switch camera",permissionDenied:"Camera permission denied",enableCamera:"Enable camera in settings"},kae={analyzing:"Analyzing photo...",approved:"Approved",rejected:"Rejected",tooBlurry:"Image is too blurry",tooDark:"Image is too dark",wrongSubject:"Wrong subject",outsideArea:"Outside mission area",aestheticScore:"Aesthetic score"},Aae={dashboard:"Orderer dashboard",createMission:"Create mission",createCampaign:"New campaign",campaigns:"Campaigns",activeCampaigns:"Active campaigns",noCampaigns:"No campaigns yet",missionStats:"Mission stats",photosReceived:"Photos received",pendingApproval:"Pending approval",totalSpent:"Total spent",organizationName:"Organization name",organizationNumber:"Organization number",contactPerson:"Contact person",billingAddress:"Billing address",paymentMethod:"Payment method",invoice:"Invoice",card:"Card",sections:{operations:"Operations",operationsDesc:"Assignments & deliveries",dataVault:"Data Vault",dataVaultDesc:"Raw data & archive",analytics:"Analytics",analyticsDesc:"Insights & patterns",ads:"Ads",adsDesc:"Campaigns & ROI",distribution:"Distribution",distributionDesc:"Activation & reach",integrations:"Integrations",integrationsDesc:"API & connections",compliance:"Compliance",complianceDesc:"Audit & legal"},ads:{title:"Advertising",description:"Plan campaigns, calculate ROI and manage brand visibility",brandAwareness:"Brand Awareness",brandAwarenessDesc:"Build recognition through mission placements",localPresence:"Local Presence",localPresenceDesc:"Target specific geographic areas",impressions:"Impressions",impressionsDesc:"Track visibility and engagement metrics"},status:{accountPendingApproval:"Account pending approval",profileBeingProcessed:"Your orderer profile is being processed. You will be notified when activated.",viewStatus:"View status",active:"Active",pending:"Pending",paused:"Paused",waitingForApproval:"Waiting for approval",youAreActivated:"You are activated as an orderer and can now create missions",applicationBeingProcessed:"Your application is being processed. You will be notified when approved.",accountPaused:"Your account is paused"},frequency:{once:"One-time",daily:"Daily",weekly:"Weekly",biweekly:"Biweekly",monthly:"Monthly"},missionStatus:{active:"Active",delivered:"Delivered",cancelled:"Cancelled",pending:"Pending",disputed:"Disputed"},operations:{createMission:"Create mission",defineLocationMedium:"Define location, medium, requirements and SLA",photo:"Photo",video:"Video",sensor:"Sensor",live:"Live",assignments:"Assignments",noAssignments:"No assignments",assets:"assets",sla:"SLA"},dataVault:{title:"Data Vault",description:"Immutable raw data archive with full metadata and version history",original:"Original",unmodifiedRawData:"Unmodified raw data",processed:"Processed",aiProcessed:"AI-processed",metadata:"Metadata",time:"Time",location:"Location",equipment:"Equipment",operator:"Operator",versions:"Versions",exported:"Exported",apiAccess:"API Access",apiAccessDesc:"Programmatic access to your data",generateKey:"Generate key",noAssets:"No assets yet",completeAssignments:"Complete assignments to see data here"},analytics:{title:"Analytics",description:"AI-driven insights from your data",geographicPatterns:"Geographic patterns",geographicPatternsDesc:"Heat maps and area analysis",timeSeries:"Time series",timeSeriesDesc:"Trends and seasonal variations",anomalies:"Anomalies",anomaliesDesc:"Automatic deviation detection",comparisons:"Comparisons",comparisonsDesc:"Before/after analysis",aiInsights:"AI-generated insights",aiInsightsDesc:"Automatic reports and recommendations",noDataYet:"No data yet",completeAssignments:"Complete assignments to generate insights"},distribution:{title:"Distribution",description:"Targeted activation and reach",zoneActivation:"Zone activation",zoneActivationDesc:"Send assignments to specific areas",contributorPrioritization:"Contributor prioritization",contributorPrioritizationDesc:"Prioritize proven operators",temporaryExposure:"Temporary exposure",temporaryExposureDesc:"Time-limited visibility",sponsoredAssignments:"Sponsored assignments",sponsoredAssignmentsDesc:"Highlighted for enterprise",noActiveDistribution:"No active distribution",createAssignments:"Create assignments to activate distribution"},integrations:{title:"Integrations",description:"Connect to your systems",apiKeys:"API keys",newKey:"New key",noApiKeys:"No API keys generated",generateFirst:"Generate your first key to get started",generateKey:"Generate key",webhooks:"Webhooks",noWebhooks:"No webhooks configured",addWebhook:"Add webhook",systemConnections:"System connections",gis:"GIS",erp:"ERP",insurance:"Insurance",government:"Government systems"},compliance:{title:"Compliance & Audit",description:"Logs, access history, approvals and data sources",activityLogs:"Activity logs",activityLogsDesc:"Complete audit trail of all actions",accessHistory:"Access history",accessHistoryDesc:"Who has accessed your data",approvals:"Approvals",approvalsDesc:"Approval flows and signatures",dataSources:"Data sources",dataSourcesDesc:"Origin and verification of data",legalChainOfEvidence:"Legal chain of evidence",legalChainOfEvidenceDesc:"For insurance, authorities and legal purposes",readyFor:"Ready for:",airlines:"Airlines",insuranceCompanies:"Insurance companies",publicSector:"Public sector",noLogs:"No logs yet",activityWillAppear:"Activity will appear here"},registration:{title:"Become Orderer",stepOf:"Step {{step}} of {{total}}",ordererStatus:"Orderer Status",organizationType:"Organization Type",selectOrgType:"Select organization type",company:"Company",companyDesc:"Ltd, Partnership, Sole proprietorship, etc.",authority:"Authority",authorityDesc:"Municipality, region, government agency",organizationDetails:"Organization Details",basicInfo:"Basic information about your organization",companyName:"Company name",authorityName:"Authority name",companyPlaceholder:"Example Ltd",authorityPlaceholder:"Example Municipality",organizationNumber:"Organization number",orgNumberPlaceholder:"XXXXXX-XXXX",continue:"Continue",contactDetails:"Contact Details",contactDetailsDesc:"Person responsible for orders",contactPerson:"Contact person",contactPersonPlaceholder:"First name Last name",email:"Email",emailPlaceholder:"name@company.com",phone:"Phone (optional)",phonePlaceholder:"+1 555 XXX XXXX",billingAddress:"Billing Address",billingAddressDesc:"Address for invoicing and contracts",streetAddress:"Street address",streetAddressPlaceholder:"123 Example Street",postalCode:"Postal code",postalCodePlaceholder:"12345",city:"City",cityPlaceholder:"New York",paymentMethod:"Payment Method",choosePaymentMethod:"Choose how you want to pay for missions",cardPayment:"Card payment",cardPaymentDesc:"Pay directly with card via Stripe. Activated immediately.",invoicePayment:"Invoice",invoiceDesc:"30 days payment terms. Requires approved credit check.",creditCheckInProgress:"Credit check in progress...",checkingVia:"Checking {{orgName}} via CreditSafe.",creditCheckApproved:"Credit check approved!",creditCheckApprovedDesc:"{{orgName}} is approved for invoice payment with 30 days credit.",creditCheckNotApproved:"Credit check not approved",creditCheckNotApprovedDesc:"Unfortunately, we could not approve {{orgName}} for invoice payment at this time. You can still register with card payment and get started immediately!",chooseCardPayment:"Choose card payment instead",summary:"Summary",organization:"Organization",orgNumber:"Org. number",contact:"Contact",card:"Card",completeRegistration:"Complete registration",registering:"Registering...",waitingForCreditCheck:"Waiting for credit check...",profileCreated:"Orderer profile created!",goToMissions:"Go to missions",activeDescription:"You are activated as an orderer and can now create missions",pendingDescription:"Your application is being processed. You will be notified when approved.",pausedDescription:"Your account is paused",validation:{enterOrgName:"Please enter organization name",enterValidOrgNumber:"Please enter a valid organization number",enterContactPerson:"Please enter contact person",enterValidEmail:"Please enter a valid email address",enterFullAddress:"Please enter full address",creditCheckRequired:"Credit check must be approved for invoice payment"}},missionDetail:{title:"Manage Mission",ordererView:"Orderer view",edit:"Edit",save:"Save",views:"Views",inProgress:"In Progress",approved:"Approved",photos:"Photos",created:"Created",missionDetails:"Mission Details",titleLabel:"Title",location:"Location",notSpecified:"Not specified",description:"Description",noDescription:"No description",instructions:"Instructions to photographer",instructionsPlaceholder:"E.g. 'Photograph the entire object from the front...'",noInstructions:"No instructions",reward:"Reward",activeUntil:"Active until",exampleImages:"Example Images",upload:"Upload",uploading:"Uploading...",addImage:"Add",addExampleImage:"Add example image",noExampleImages:"No example images added",cancelMission:"Cancel Mission",cancelConfirm:"Are you sure you want to cancel this mission?",missionUpdated:"Mission has been updated!",missionCancelled:"Mission has been cancelled",couldNotUpdate:"Could not update mission",couldNotCancel:"Could not cancel mission",missionNotFound:"Mission not found",missionNotFoundDesc:"An error occurred while fetching the mission.",backToDashboard:"Back to dashboard",onlyImagesAllowed:"Only images are allowed",maxFileSize:"Maximum file size is 5MB",confirmDeleteImage:"Are you sure you want to delete this image?"}},Cae={title:"Create mission",stepOf:"Step {{step}} of {{total}}",continue:"Continue",creating:"Creating mission...",create:"Create mission",missionCreated:"Mission created!",couldNotCreate:"Could not create mission",becomeOrderer:"Become orderer first",mustBeOrderer:"You must be registered and approved as an orderer to create missions.",registerAsOrderer:"Register as orderer",step1Title:"What to photograph?",step1Desc:"Describe the objects or locations to be documented",missionTitle:"Mission title",missionTitlePlaceholder:"E.g. Park benches in Central Park",whatToPhoto:"What to photograph?",whatToPhotoPlaceholder:"E.g. All park benches, include full bench photo and close-ups of any damage",instructions:"Instructions for photographer",instructionsPlaceholder:"E.g. Take photo from the front, include surroundings...",description:"Description (shown to photographer)",descriptionPlaceholder:"Additional information about the mission...",step2Title:"Location",step2Desc:"Click on the map to select center point, or drag the marker",areaName:"Area name",areaNamePlaceholder:"E.g. Central Park, New York",radius:"Radius",radiusHint:"The photographer must be within this radius to complete the mission",latitude:"Latitude",longitude:"Longitude",step3Title:"Frequency",step3Desc:"How often should the mission be performed?",durationTitle:"Duration",durationDesc:"How long should the mission be active?",frequencyOnce:"Once",frequencyOnceDesc:"One-time mission",frequencyDaily:"Daily",frequencyDailyDesc:"Every day",frequencyWeekly:"Weekly",frequencyWeeklyDesc:"Once per week",frequencyBiweekly:"Biweekly",frequencyBiweeklyDesc:"Every 14 days",frequencyMonthly:"Monthly",frequencyMonthlyDesc:"Once per month",duration1week:"1 week",duration2weeks:"2 weeks",duration1month:"1 month",duration3months:"3 months",duration6months:"6 months",duration1year:"1 year",step4Title:"Photo requirements",step4Desc:"Number of photos required per completed mission",photoCount:"Number of photos",rewardTitle:"Reward",rewardDesc:"Payment to photographer per completed mission",reward:"Reward",perPhoto:"{{amount}} SEK/photo",maxPerPhoto:"Max {{amount}} SEK/photo",rewardTooHigh:"Reward cannot exceed {{max}} SEK per photo",summaryTitle:"Summary",mission:"Mission",area:"Area",frequency:"Frequency",duration:"Duration",photosPerMission:"Photos/mission",rewardPerMission:"Reward/mission",pcs:"pcs",estimatedTotalCost:"Estimated total cost",basedOnOnce:"Based on one-time mission",basedOnFrequency:"Based on {{frequency}} for {{duration}}",validationTitleRequired:"Please enter a mission title",validationTargetRequired:"Please describe what should be photographed",validationAreaRequired:"Please enter an area name"},Iae={title:"Campaign title",description:"Description",locationType:"Location type",searchArea:"Search area",instructions:"Instructions for photographer",reward:"Reward per mission",photosPerLocation:"Photos per location",duration:"Duration",schedule:"Schedule",once:"Once",weekly:"Weekly",daily:"Daily",locations:"Locations",locationsFound:"locations found",noLocationsFound:"No locations found",createCampaign:"Create campaign",estimatedCost:"Estimated cost",confirm:"Confirm and create"},Mae={title:"Photo Market",subtitle:"Buy photos • 100% goes to charity",searchPlaceholder:"Search photos, countries, categories...",sortBy:"Sort by",allCategories:"All categories",allCountries:"All countries",noPhotosFound:"No photos found",clearSearch:"Clear search",fromPrice:"from {{price}} SEK",price:"{{price}} SEK",charityBannerTitle:"100% to charity",charityBannerDescription:"When you buy a photo, all proceeds go directly to aid organizations working in the country where the photo was taken.",featured:"Featured",popular:"Popular",priceLow:"Price ↑",priceHigh:"Price ↓"},Pae={title:"Marketplace",buyPhoto:"Buy photo",sellPhoto:"Sell photo",featured:"Featured",popular:"Popular",recent:"Recent",category:"Category",price:"Price",photographer:"Photographer",license:"License",download:"Download"},Dae={title:"Photo contest",currentContest:"Current contest",submit:"Submit entry",vote:"Vote",votes:"votes",winners:"Winners",prizes:"Prizes",rules:"Rules",endsIn:"Ends in",theme:"Theme",supports:"Supports {{charity}}",active:"Active",ended:"Ended",upcoming:"Upcoming",daysLeft:"{{count}} days left",endedAgo:"Ended {{time}}",startsOn:"Starts {{date}}",info:"Info",entries:"Entries",noEntriesYet:"No entries yet",beFirstToParticipate:"Be the first to participate!",contestEntry:"Contest entry",winner:"Winner",uploadEntry:"Upload entry",winnersNotAnnounced:"Winners have not been announced yet",winnersAfterEnd:"Winners will be announced after the contest ends",untitled:"Untitled",firstPlace:"1st place",secondPlace:"2nd place",thirdPlace:"3rd place",starts:"Starts",ends:"Ends"},Rae={photoNotFound:"Photo not found",backToMarket:"Back to photo market",purchaseInitiated:"Purchase initiated for {{title}}",fullResolution:"Full resolution",fullResolutionDesc:"Highest quality for all uses",buyDigitalPhoto:"Buy digital photo",charityTitle:"100% to charity",charityDescription:"The entire purchase amount goes directly to humanitarian work. Your payment helps real people.",orderAsPrint:"Order as print",orderAsPrintDesc:"After purchase, you can order professional prints via our partners:",views:"views",downloads:"downloads",linkCopied:"Link copied!",checkOutPhoto:"Check out this photo: {{title}}",opening:"Opening {{name}}",uploadForPrint:"Upload your image after purchase to order prints",professionalQuality:"Professional quality online",balancedTopService:"Balanced top service"},Lae={now:"Now",minutesAgo:"{{count}} min ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago",inMinutes:"In {{count}} min",inHours:"In {{count}} hours",inDays:"In {{count}} days"},Oae={networkError:"Network error",serverError:"Server error",notFound:"Not found",unauthorized:"Unauthorized",forbidden:"Forbidden",tryAgain:"Try again",somethingWentWrong:"Something went wrong"},Fae={privacy:"Privacy",terms:"Terms",contact:"Contact",tagline:"Every photo tells a story",pixDriftTagline:"Pix + Drift = Go out and shoot 📸",copyright:"© 2024 PixDrift. The global platform for mobile photography.",values:"Affordable • Eco-friendly • Modern"},zae={title:"Leaderboard",total:"Total",thisWeek:"This week",thisMonth:"This month",efficiency:"Efficiency",rank:"Rank",earnings:"Earnings",perMinute:"/min"},Bae={statusBadge:"ABUSE-RESISTANT • INSTITUTION-GRADE",headline1:"Environmental Intelligence.",headline2:"Society Compatible.",subtitle:"An autonomous decision system for temporary, anonymous, environment-based visual data collection.",noSurveillance:"No personal surveillance. No private investigation. Never.",institutionalOrder:"Institutional Order",becomePerformer:"Become Performer",reasonGate:"Reason Gate",anonymization:"Anonymization",abuseBlocked:"Abuse Blocked"},Nae={title:"Account Statement",auditCompliant:"Audit-compliant documentation",auditDescription:"This report meets tax declaration requirements under Swedish law. Preliminary tax (35%) ensures compliance regardless of municipality. VAT (25%) is reported separately. Annual control statement is submitted to the Tax Agency.",grossAmount:"Gross amount (incl. VAT)",vat:"VAT",preliminaryTax:"Preliminary tax",netPaid:"Net paid",transactions:"Transactions",generating:"Generating...",pdf:"PDF",download:"Download",send:"Send",sendEmailSoon:"Send via email coming soon",noServicesRecorded:"No services recorded",completeMissionsForReceipts:"Complete missions to generate receipts",serviceExecution:"Service execution",documentId:"Document ID",executed:"Executed",payingOrganization:"Paying organization",orgNumber:"Org. no.",serviceLocation:"Service location",serviceType:"Service type",pdfGenerated:"Account statement generated and opened in new tab",pdfProcessing:"PDF is being generated... This may take a few seconds. Try again shortly.",pdfError:"Could not generate PDF. Check that PDF Monkey is configured correctly.",mustBeLoggedIn:"You must be logged in to export PDF",noTransactionsToExport:"No transactions to export",footer1:"Rewault AB · Org. no. 559XXX-XXXX · VAT no. SE559XXXXXX01",footer2:"Tax deductions are reported to the Tax Agency. Annual control statement is submitted.",footer3:"This document is digitally generated. No signature required."},Vae={title:"Internal growth model",description:"Participate in the company's internal value development",active:"Active",inactive:"Inactive",importantInfo:"Important information",importantDescription:"This is not a savings account, investment, or financial placement. When you activate growth, your balance is used as risk-bearing capital in the company's operations. Value development is not guaranteed and can both increase and decrease. This feature is not covered by deposit insurance.",confirmParticipation:"Confirm participation",confirmCheckbox:"I understand that this is not a bank account, that my capital is used in the company's operational activities, and that the value can both increase and decrease. I confirm that this is not investment advice and that the feature is not covered by deposit insurance.",cancel:"Cancel",activate:"Activate",enableGrowth:"Enable growth",allocateBalance:"Allocate balance to business support",balanceActive:"Your balance is active in the company's growth model",valueDevelopment:"Value development",historicalDevelopment:"Historical development based on company results. Past performance does not guarantee future results.",capitalInUse:"Capital in use",resultBasedAllocation:"Result-based allocation",currentValue:"Current value",valueBasedOnResults:"The value is based on the company's current results and may change",howDoesItWork:"How does it work?",participationTitle:"Participation in internal growth model",participationDescription:"When you activate this feature, your balance is used as risk-bearing capital in the company's operational activities. You thereby participate in the company's internal value and growth model linked to credit operations and business operations.",whatDoesThisMean:"What does this mean?",point1:"Your capital is used in the company's own operations",point2:"The company is the counterparty, not an intermediary",point3:"Any value development depends on the company's actual results",point4:"Withdrawals are made according to company terms",riskInfo:"Risk information",risk1:"Value development is uncertain and not guaranteed",risk2:"The value can both increase and decrease",risk3:"The capital is risk-bearing",risk4:"Not covered by deposit insurance",complianceInfo:"Compliance information",complianceDescription:"This is not banking, securities, or investment advice. The feature constitutes participation in the company's internal business model where the user provides risk-bearing capital for result-based allocation.",value:"Value"},jae={title:"Your Performance",level:"Level",score:"Score",tierElite:"Elite",tierPro:"Pro",tierActive:"Active",tierRookie:"Rookie",tierNew:"New",seeMissionsFirst:"You see missions first!",headStart:"{{seconds}}s head start",delay:"{{seconds}}s delay",completed:"Done",approved:"Approved",streak:"Streak",expiredAffectScore:"{{count}} expired missions affect your score"},Uae={installTitle:"Install SnapTask",iosInstructions:'Tap the share icon and then "Add to Home Screen"',addToHomescreen:"Add the app to your home screen for quick access",install:"Install"},Gae={clear:"Clear",partlyCloudy:"Partly cloudy",cloudy:"Cloudy",fog:"Fog",drizzle:"Drizzle",freezingRain:"Freezing rain",rain:"Rain",snow:"Snow",rainShowers:"Rain showers",snowShowers:"Snow showers",thunderstorm:"Thunderstorm",unknown:"Unknown"},$ae={notSupported:"Compass not supported on this device",permissionDenied:"Compass permission denied",couldNotRequest:"Could not request compass permission",north:"North",northeast:"Northeast",east:"East",southeast:"Southeast",south:"South",southwest:"Southwest",west:"West",northwest:"Northwest"},Hae={couldNotFetch:"Could not fetch AI response",tooManyRequests:"Too many requests, please try again later",temporarilyUnavailable:"AI feature temporarily unavailable"},Wae={detailedAnalysis:"Detailed analysis",composition:"Composition",lighting:"Lighting",technicalQuality:"Technical quality",certifiedRequirements:"Certified Global™ Requirements",schoolyard:"Schoolyard",goldenHour:"Golden hour",noPeople:"No people",aestheticMin:"Aesthetics ≥75",requirementsNotMet:"The image does not meet all Certified Global™ requirements. Try taking a new photo during golden hour at a schoolyard without people.",gradeExceptional:"Exceptional",gradeExcellent:"Excellent",gradeGood:"Good",gradeAccepted:"Accepted",gradeNeedsImprovement:"Needs improvement"},qae={title:"Standard Templates",subtitle:"Buy in Bulk",description:"Predefined mission types for fast volume. Click to see full specification.",beach_crowd_density:{name:"Beach Crowd Density",description:"Measure crowd density at the beach (aggregated statistics)"},weather_conditions:{name:"Weather Conditions",description:"Document current weather in an area"},bus_stop_condition:{name:"Bus Stop Condition",description:"Check condition of bus stop"},bridge_inspection:{name:"Bridge Inspection",description:"Visual documentation of bridge structure"},pre_post_work:{name:"Before/After Work",description:"Document before and after completed work"},traffic_flow:{name:"Traffic Flow",description:"Measure traffic flow in area (aggregated)"},certified_global_schoolyard:{name:"Certified Global™ Schoolyards",description:"Worldwide photo challenge: beautiful schoolyard photos at golden hour when school is closed"}},Zae={title:"AI Review",titleHighlight:"Automatic. Instant. Precise.",description:"No manual review. Every image is processed in real-time by the AI system for technical, legal and semantic validation.",steps:{"01":{title:"Object Identification",description:"AI identifies all objects in the image – buildings, vegetation, surfaces, vehicles, people."},"02":{title:"Quality Measurement",description:"Sharpness, exposure, composition and noise level are analyzed against the assignment requirements."},"03":{title:"Anonymization",description:"Automatic blur/mask on faces, license plates and other prohibited elements."},"04":{title:"Legal Check",description:"Verification against GDPR and assignment-specific restrictions."},"05":{title:"Data Extraction",description:"Structured information is extracted – metadata, classification, measurements."}},results:{approved:"APPROVED",retake:"RETAKE",rejected:"REJECTED"}},Xae={securityFunction:"Critical Security Function",title:"Legitimate Interest Gate",description:"All assignments must pass a",descriptionHighlight:"Reason Gate",descriptionEnd:"before being broken down into micro-jobs. This is algorithmic ethics – not legal text.",approved:{title:"APPROVED PURPOSES",subtitle:"Passes Reason Gate"},denied:{title:"AUTOMATICALLY DENIED",subtitle:"Blocked immediately"},approvedReasons:{infrastructure:"Status assessment of public infrastructure",recreation:"Public load in recreational areas",environment:"Environmental and weather conditions",commercial:"Commercial area analysis at aggregated level",documentation:"Before/after documentation of work"},deniedReasons:{lookOutside:"See what it looks like outside X",followChange:"Follow change at the same point daily",seeIfAnyone:"See if anyone is there",privateResidence:"Check activity at private residence",targetedObservation:"Targeted observation of individual"},principle:"The system should rather falsely deny than risk abuse",noOverride:"No human override is allowed for person-linked assignments"},Kae={light:{label:"Light",description:"Clean and clear"},dark:{label:"Dark",description:"Easy on the eyes"},auto:{label:"Auto",description:"UV-index & weather"},currentMode:"Currently:",darkMode:"Dark mode",lightMode:"Light mode",lightLevelDark:"Dark",lightLevelLight:"Light",lightLevel:"Light level",autoDescription:"Adapts automatically based on UV-index, cloud cover and time"},Yae={title:"Mission Types",titleHighlight:"Strict Whitelist",description:"Only the following categories exist in the system. Everything else does not exist.",categories:{environment:{title:"Environment & Nature",items:{beaches:"Beaches (crowd density as statistics)",parks:"Parks",forest:"Forest",weather:"Snow/weather conditions",erosion:"Erosion"}},infrastructure:{title:"Public Infrastructure",items:{busStops:"Bus stops",bridges:"Bridges",walkways:"Walkways",playgrounds:"Playgrounds",parkingAreas:"Parking areas"}},commercial:{title:"Commercial Environment",items:{shoppingCenters:"Shopping centers (exterior)",retailAreas:"Retail areas",streets:"Streets (traffic flow)",touristAreas:"Tourist areas"},note:"Aggregated data only"},operational:{title:"Operations-Driven Doc.",items:{construction:"Construction projects",facades:"Facades",publicProperties:"Public properties",facilities:"Facilities"}}},forbidden:{title:"DOES NOT EXIST IN THE SYSTEM",items:{privateAddresses:"Private addresses",residenceEntrances:"Residence entrances",repetitiveObservation:"Repetitive observation",personIdentification:"Person identification",privateSurveillance:"Private surveillance"}}},Qae={title:"Mission Structure",titleHighlight:"Machine-Readable Precision",description:"Each mission is strictly defined with geographic, temporal and semantic precision. No freedom, no interpretation – only exact specification.",fields:{geographicZone:{label:"Geographic zone",value:"coordinates, radius, polygon"},timeWindow:{label:"Time window",value:"validity, light requirements"},imageType:{label:"Image type",value:"still image, series, panorama"},subjectDefinition:{label:"Subject definition",value:"facades, vegetation, surfaces"},forbiddenElements:{label:"Forbidden elements",value:"faces, signs, interior"},aiRules:{label:"AI rules",value:"thresholds, quality, objects"}},schemaFile:"mission.schema",validated:"VALIDATED"},Jae={systemProtection:"System Protection",title:"Self-Protecting",titleHighlight:"Intelligence",description:"The system is designed to actively defend against abuse. Its primary goal is",descriptionHighlight:"trust, not growth",features:{patternAnalysis:{title:"Pattern Analysis",description:"AI actively analyzes order patterns to detect systematic abuse."},behaviorDetection:{title:"Behavior Detection",description:"Identifies suspicious attempts to circumvent the system's protection mechanisms."},automaticBlocking:{title:"Automatic Blocking",description:"Users who try to 'game the system' are automatically and permanently blocked."},dynamicThresholds:{title:"Dynamic Thresholds",description:"The system continuously adjusts its limits based on detected threats."}}},ele={label:"Repetition Control",title:"Patterns Are Monitored",titleHighlight:"Automatically",description:"The system actively blocks repetitive requests to the same zone, angle and purpose – unless the orderer is institutional.",institutional:{title:"Institutional Orderer",subtitle:"Municipality, Authority, Company",features:{periodic:"Periodic monitoring OK",sameZone:"Same zone over time",trend:"Trend analysis allowed"},status:"REPETITION: ALLOWED"},private:{title:"Private Person",subtitle:"Individual user",features:{exactLocation:"Point to exact location",controlAngle:"Control angle toward object",requestRepetition:"Request repetition"},status:"REPETITION: BLOCKED"},allowed:{title:"Private persons may ask:",examples:{weather:"What's the weather like in area X right now?",crowd:"How many people are at beach Y?"},note:'Only generic environmental missions. Never "that one", "outside X", or "again tomorrow".'}},tle={title:"Absolute Rules",titleHighlight:"Cannot Be Overridden",description:"These principles are hardcoded in the system. They don't exist as policy – they exist as algorithm.",critical:"CRITICAL",principles:{noPerson:{title:"NO PERSON = NO MISSION",description:"If a mission can be linked to a specific individual or private address without business connection – it is automatically denied. No human override allowed."},reasonFirst:{title:"REASON-FIRST LOGIC",description:"Every order must contain: explicit purpose, type of interest, and expected data benefit. Without approved purpose, the mission doesn't exist."},locationNotAddress:{title:"LOCATION ≠ ADDRESS",description:"The system works with zones, areas and public nodes. The system never accepts exact private addresses, residence entrances, or repetitive observation without public function."},dataOverImage:{title:"DATA > IMAGE",description:"Images are raw material. The end product is structured, anonymized information. No identifiable individual reaches the orderer."}},emphasis:"NOT surveillance • NOT reconnaissance • NOT personal control"},nle={george:"Calm, professional man",sarah:"Friendly, clear woman",liam:"Young, energetic man",matilda:"Warm, trustworthy woman",daniel:"News presenter, authoritative man"},rle="Hi! My name is {{name}} and I will guide you through your missions.",ile="Listen to voice",ole="Could not play voice",sle={actors:uae,cta:dae,realChange:hae,charity:fae,common:pae,nav:mae,auth:gae,home:_ae,missions:yae,missionDetail:vae,wallet:xae,profile:bae,notifications:wae,map:Sae,quickCreate:Tae,camera:Eae,validation:kae,orderer:Aae,createMission:Cae,campaign:Iae,photoMarketplace:Mae,marketplace:Pae,contest:Dae,photoDetail:Rae,time:Lae,errors:Oae,footer:Fae,leaderboard:zae,hero:Bae,earningsHistory:Nae,earningsGrowth:Vae,performance:jae,pwa:Uae,weather:Gae,compass:$ae,ai:Hae,aesthetic:Wae,templates:qae,aiValidation:Zae,reasonGate:Xae,themeSelector:Kae,missionTypes:Yae,workflow:Qae,selfProtection:Jae,repetitionControl:ele,principlesSection:tle,voiceDescriptions:nle,voiceSample:rle,voicePreviewButton:ile,voicePreviewError:ole},ale={loading:"Laden...",error:"Ein Fehler ist aufgetreten",save:"Speichern",cancel:"Abbrechen",confirm:"Bestätigen",delete:"Löschen",edit:"Bearbeiten",back:"Zurück",next:"Weiter",close:"Schließen",search:"Suchen",filter:"Filtern",all:"Alle",none:"Keine",yes:"Ja",no:"Nein",or:"oder",and:"und",credits:"Credits",credit:"Credit",meters:"Meter",km:"km",minutes:"Minuten",hours:"Stunden",days:"Tage",today:"Heute",yesterday:"Gestern",tomorrow:"Morgen",sek:"SEK",currency:"SEK",available:"Verfügbar",photos:"Fotos",until:"bis",daily:"Täglich",weekly:"Wöchentlich",biweekly:"Alle zwei Wochen",monthly:"Monatlich",takeMission:"Auftrag annehmen",order:"Bestellen"},lle={home:"Startseite",map:"Karte",wallet:"Wallet",profile:"Profil",notifications:"Benachrichtigungen",howItWorks:"So funktioniert's",forBusinesses:"Für Unternehmen",forPerformers:"Für Ausführende",api:"API",getStarted:"Los geht's"},cle={login:"Anmelden",logout:"Abmelden",signup:"Registrieren",email:"E-Mail",password:"Passwort",forgotPassword:"Passwort vergessen?",noAccount:"Noch kein Konto?",hasAccount:"Bereits ein Konto?",signupSuccess:"Konto erstellt! Du bist jetzt angemeldet.",loginSuccess:"Willkommen zurück!",logoutSuccess:"Abgemeldet!",invalidCredentials:"Falsche E-Mail oder Passwort",emailRequired:"E-Mail erforderlich",passwordRequired:"Passwort erforderlich",loginRequired:"Anmelden um diese Funktion zu nutzen",displayName:"Anzeigename (optional)",displayNamePlaceholder:"Dein Name",emailPlaceholder:"deine@email.de",loginSubtitle:"Anmelden um Aufträge zu bestellen oder auszuführen",signupSubtitle:"Registriere dich um loszulegen",waiting:"Bitte warten...",createAccount:"Konto erstellen",emailAlreadyRegistered:"E-Mail ist bereits registriert",somethingWentWrong:"Etwas ist schiefgelaufen. Bitte versuche es erneut.",invalidEmail:"Ungültige E-Mail-Adresse",passwordMinLength:"Passwort muss mindestens 6 Zeichen haben"},ule={welcome:"Willkommen",nearbyMissions:"Aufträge in der Nähe",noMissions:"Derzeit keine Aufträge verfügbar",activeMission:"Aktiver Auftrag",claimMission:"Auftrag annehmen",viewDetails:"Details anzeigen",distance:"Entfernung",reward:"Belohnung",expires:"Läuft ab",photosRequired:"Fotos erforderlich",missionTypes:"Auftragstypen",howItWorks:"So funktioniert's",getStarted:"Los geht's",earnMoney:"Verdiene Geld mit deinen Fotos",tagline:"Erfasse die Welt. Werde bezahlt.",startEarning:"Jetzt verdienen",learnMore:"Mehr erfahren"},dle={title:"Aufträge",active:"Aktiv",completed:"Abgeschlossen",expired:"Abgelaufen",claimed:"Angenommen",available:"Verfügbar",claim:"Auftrag annehmen",submit:"Einreichen",abandon:"Auftrag aufgeben",timeRemaining:"Verbleibende Zeit",photosSubmitted:"Eingereichte Fotos",instructions:"Anweisungen",requirements:"Anforderungen",location:"Ort",radius:"Radius",description:"Beschreibung",takePhoto:"Foto aufnehmen",uploadPhoto:"Foto hochladen",submitPhotos:"Fotos einreichen",missionComplete:"Auftrag abgeschlossen!",pendingReview:"Wird überprüft",approved:"Genehmigt",rejected:"Abgelehnt",expiresIn:"Läuft ab in",noActiveMission:"Kein aktiver Auftrag",findMission:"Auftrag finden",loadError:"Aufträge konnten nicht geladen werden",focusMode:"Fokusmodus – schließe deinen aktiven Auftrag ab",noMissionsInArea:"Keine aktiven Aufträge in deiner Nähe. Komm bald wieder!",photo:"Fotoaufträge",photoShort:"Foto",video:"Videoaufträge",videoShort:"Video",showingMissions:"Zeige {{count}} Aufträge sortiert nach Entfernung",noMissionsNearby:"Keine Aufträge in deiner Nähe gerade"},hle={back:"Zurück",notFound:"Auftrag nicht gefunden",photos:"Fotos",reward:"Belohnung",timeLeft:"Verbleibend",expired:"Abgelaufen",fetching:"Wird geladen...",unknown:"Unbekannt",closeEnough:"Du bist nah genug!",withinRadius:"Innerhalb von {{distance}}",map:"Karte",workOrder:"Arbeitsauftrag",whatToPhoto:"Was fotografiert werden soll",photosRequired:"Anzahl erforderlicher Fotos",photo:"Foto",exampleImages:"Beispielbilder",exampleHint:"So sollte das Foto ungefähr aussehen:",approvedExamples:"Genehmigte Beispiele",notApprovedExamples:"Nicht genehmigte Beispiele",exampleApproved:"Genehmigt",exampleNotApproved:"Nicht genehmigt",exampleComingSoon:"Beispiel kommt bald",photoTips:"Tipps: Klares Bild, richtiger Winkel, gute Beleuchtung. Vermeide unscharfe Bilder oder falsches Motiv.",howTo:"So gehts",deadline:"Frist",paymentOnApproval:"Vergütung bei genehmigtem Auftrag",latitude:"Breitengrad",longitude:"Längengrad",frequency:"Häufigkeit",frequencyDuration:"Häufigkeit & Dauer",activeUntil:"Aktiv bis",missionExpires:"Auftrag läuft ab",daily:"Täglich",weekly:"Wöchentlich",biweekly:"Alle zwei Wochen",monthly:"Monatlich",claimTimeLeft:"Verbleibende Zeit",hurryUp:"Beeil dich!",completeBeforeExpiry:"Abschließen bevor die Zeit abläuft",testMode:"Testmodus",testModeActive:"Testmodus - Fotos werden nicht gespeichert",testModeActivated:"Testmodus aktiviert!",testCameraHint:"Teste die Kamera ohne einen echten Auftrag zu erstellen.",cameraTestComplete:"Kameratest abgeschlossen!",photosNotSaved:"Fotos wurden nicht gespeichert (Testmodus).",missionCompleted:"Auftrag abgeschlossen!",loading:"Laden...",exitTestMode:"Testmodus beenden",releaseMission:"Auftrag freigeben",verifyForMissions:"Für Aufträge verifizieren",verifyDescription:"Schließe deine Registrierung ab, um Missionen anzunehmen.",testCamera:"Kamera testen (ohne Speichern)",claimMission:"Auftrag annehmen",getCloser:"Näher kommen um den Auftrag anzunehmen",confirmClaim:"Auftrag annehmen?",confirmClaimDesc:"Du hast <strong>15 Minuten</strong> um das Foto aufzunehmen und hochzuladen. Bist du bereit?",cancel:"Abbrechen",yesClaim:"Ja, Auftrag annehmen",couldNotClaim:"Auftrag konnte nicht angenommen werden",missionIsYoursAgain:"Der Auftrag gehört dir wieder!",missionIsYours:"Der Auftrag gehört dir!",youHave15Min:"Du hast 15 Minuten um ihn abzuschließen.",couldNotRelease:"Auftrag konnte nicht freigegeben werden",missionReleased:"Auftrag freigegeben",someoneElseCanTake:"Jetzt kann jemand anderes ihn annehmen.",withinRadiusText:"Innerhalb des angegebenen Radius"},fle={title:"Wallet",balance:"Guthaben",totalEarned:"Gesamt verdient",pendingPayout:"Ausstehende Auszahlung",withdraw:"Auszahlen",withdrawFunds:"Geld auszahlen",transactions:"Transaktionen",noTransactions:"Noch keine Transaktionen",earned:"Verdient",payout:"Auszahlung",pending:"Ausstehend",completed:"Abgeschlossen",earnings:"Einnahmen",thisWeek:"Diese Woche",thisMonth:"Diesen Monat",allTime:"Gesamt",leaderboard:"Rangliste",yourRank:"Dein Rang",rank:"Rang",photographer:"Fotograf",swishNumber:"Swish-Nummer",requestPayout:"Auszahlung anfordern",minPayout:"Mindestauszahlung",taxInfo:"Steuerinfo",taxDeducted:"Abgezogene Steuer",netAmount:"Nettobetrag",earningsGrowth:"Einnahmenwachstum",growYourEarnings:"Lass deine Einnahmen wachsen",dailyInterest:"tägliche Zinsen",lockedBalance:"Gesperrtes Guthaben",accruedInterest:"Aufgelaufene Zinsen",loginToEarn:"Anmelden um zu verdienen",transactionHistory:"Transaktionshistorie",loginToSeeTransactions:"Anmelden um deine Transaktionen zu sehen",minWithdrawError:"Mindestauszahlung ist 100 kr",invalidSwishError:"Gib eine gültige Swish-Nummer ein",withdrawViaSwish:"Via Swish auszahlen",amount:"Betrag",minAmount:"Mindestens 100 kr",available:"Verfügbar",taxDeduction:"Steuerabzug",youReceive:"Du erhältst",taxNote:"Steuer wird automatisch abgezogen und an die Steuerbehörde gemeldet.",processing:"Verarbeitung...",confirmWithdraw:"Auszahlung bestätigen",verifyForPayouts:"Verifizieren für Auszahlungen",verifyDescription:"Schließe deine Registrierung ab, um Auszahlungen zu erhalten.",pendingPayouts:"Ausstehende Auszahlungen",creditsToSwish:"kr an Swish",tapForHistory:"Für Historie tippen",completeMissionsToEarn:"Erfülle Aufträge um Credits zu verdienen"},ple={title:"Profil",settings:"Einstellungen",editProfile:"Profil bearbeiten",displayName:"Anzeigename",email:"E-Mail",phone:"Telefon",city:"Stadt",verified:"Verifiziert",notVerified:"Nicht verifiziert",verifyIdentity:"Identität verifizieren",identityVerified:"Identität verifiziert",stats:"Statistiken",completedMissions:"Abgeschlossene Aufträge",approvalRate:"Genehmigungsrate",avgCompletionTime:"Durchschn. Zeit",streak:"Serie",streakDays:"Tage in Folge",reach:"Reichweite",reachDescription:"Deine Reichweite für Aufträge",notifications:"Benachrichtigungen",smsNotifications:"SMS-Benachrichtigungen",language:"Sprache",theme:"Thema",darkMode:"Dunkelmodus",lightMode:"Hellmodus",systemTheme:"Systemdesign",privacy:"Datenschutz",terms:"AGB",help:"Hilfe",support:"Support",about:"Über",version:"Version",deleteAccount:"Konto löschen",logoutConfirm:"Möchtest du dich wirklich abmelden?",accountType:"Kontotyp",private:"Privat",company:"Unternehmen",selfAccounting:"Eigene Buchhaltung",selfAccountingDescription:"Ich führe meine eigene Steuer und Buchhaltung",loadingProfile:"Profil wird geladen...",totalEarned:"Gesamt verdient",available:"Verfügbar",accountInfo:"Kontoinformationen",accountInfoDesc:"Deine grundlegenden Profilinformationen",nickname:"Spitzname",nicknamePlaceholder:"⭐ SuperFotograf_99",nicknameHint:"Wird in der Rangliste angezeigt. Sei kreativ aber nett! 🎮",nicknameMinChars:"Mindestens 2 Zeichen",nicknameMaxChars:"Maximal 20 Zeichen",nicknameOffensive:"Bitte wähle einen netteren Namen",nicknameInvalidChars:"Nur Buchstaben, Zahlen und einfache Symbole",required:"Erforderlich",verifiedAt:"Verifiziert",unknownDate:"Unbekanntes Datum",orderer:"Auftraggeber",ordererActive:"Aktiv",ordererPending:"Ausstehend",ordererAsOrg:"Du bestellst als {{org}}",ordererApplicationPending:"Deine Bewerbung wird bearbeitet",ordererDesc:"Bestelle Aufträge als Unternehmen, Organisation oder Behörde",openOrdererDashboard:"Auftraggeber-Dashboard öffnen",createNewMission:"Neuen Auftrag erstellen",viewOrdererProfile:"Auftraggeberprofil anzeigen",becomeOrderer:"Auftraggeber werden",paymentMethod:"Zahlungsmethode",paymentMethodDesc:"Verbinde dein Swish um Auszahlungen zu erhalten",swishNumber:"Swish-Nummer",swishConnected:"Verbunden",swishHint:"Gib die Handynummer ein, die mit deinem Swish verbunden ist",phoneVerification:"Telefon & Verifizierung",phoneVerificationDesc:"Verifiziere dein Konto und aktiviere SMS-Benachrichtigungen",phoneNumber:"Telefonnummer",phoneVerified:"Verifiziert",phoneNotVerified:"Nicht verifiziert",phoneHint:"Wird für Kontoverifizierung und SMS-Benachrichtigungen verwendet",smsNotificationsLabel:"SMS-Benachrichtigungen",smsNotificationsDesc:"Erhalte SMS über neue Aufträge und Statusupdates",addPhoneForSms:"Füge eine Telefonnummer hinzu um SMS-Benachrichtigungen zu aktivieren",reachTitle:"Reichweite",reachDesc:"Wie weit von deiner Position möchtest du Aufträge sehen?",locationTitle:"Standort",locationDesc:"Dein gespeicherter Heimstandort für Auftragsmatching",lat:"Lat",long:"Long",noLocationSaved:"Noch kein Standort gespeichert",updateToCurrentLocation:"Auf aktuellen Standort aktualisieren",notificationsTitle:"Benachrichtigungen",notificationsDesc:"Wähle welche Benachrichtigungen du erhalten möchtest",newMissions:"Neue Aufträge",newMissionsDesc:"Benachrichtige mich wenn neue Aufträge in der Nähe sind",missionUpdates:"Auftragsaktualisierungen",missionUpdatesDesc:"Status meiner angenommenen Aufträge",rewards:"Belohnungen",rewardsDesc:"Benachrichtige mich über neue Credits und Belohnungen",marketing:"Marketing",marketingDesc:"Angebote und Neuigkeiten",countryTax:"Land & Steuer",countryTaxDesc:"Du kannst nur Vergütungen für Aufträge in dem Land sehen, in dem du dich befindest",sweden:"Schweden",basedOnGps:"Basierend auf deiner GPS-Position",selfAccountingLabel:"Eigene Buchhaltung",weHandleTax:"Wir übernehmen die Steuer",taxAutoDeducted:"Automatischer Steuerabzug (30%) erfolgt vor der Auszahlung. Du erhältst eine Steuerbescheinigung für deine Erklärung.",appearanceTitle:"Erscheinungsbild & Sprache",appearanceDesc:"Wähle Thema und Sprache für die App",languageDesc:"Wähle in welcher Sprache die App angezeigt werden soll",saveChanges:"Änderungen speichern",saving:"Speichern...",logOut:"Abmelden",profileSaved:"Profil gespeichert!",couldNotSave:"Änderungen konnten nicht gespeichert werden",couldNotUpdateLocation:"Standort konnte nicht aktualisiert werden",locationUpdated:"Standort aktualisiert!",loggedOut:"Du hast dich abgemeldet",growthModelActivated:"Wachstumsmodell aktiviert!",growthModelDeactivated:"Wachstumsmodell deaktiviert",couldNotSaveGrowth:"Wachstumseinstellung konnte nicht gespeichert werden"},mle={title:"Benachrichtigungen",empty:"Noch keine Benachrichtigungen",markAllRead:"Alle als gelesen markieren",newMission:"Neuer Auftrag",missionApproved:"Auftrag genehmigt",missionRejected:"Auftrag abgelehnt",payoutComplete:"Auszahlung abgeschlossen",newNearby:"Neuer Auftrag in der Nähe",keepTrack:"Bleibe über neue Aufträge und Updates informiert",previewMission:"Ladenfront fotografieren...",previewApproved:"Auftrag genehmigt!",previewReward:"Du hast 50 SEK erhalten...",loginToSee:"Anmelden um Benachrichtigungen zu sehen"},gle={title:"Karte",yourLocation:"Dein Standort",missionLocation:"Auftragsstandort",showMissions:"Aufträge anzeigen",hideMissions:"Aufträge ausblenden",centerOnMe:"Auf mich zentrieren",directions:"Wegbeschreibung",navigate:"Navigieren",distance:"Entfernung",eta:"Ankunftszeit",gettingLocation:"Standort wird ermittelt...",locationRequired:"Standortzugriff erforderlich",enableLocation:"Aktiviere Standortfreigabe um Aufträge in der Nähe zu sehen",loginToCreate:"Du musst angemeldet sein um Aufträge zu erstellen",couldNotGetPosition:"Standort konnte nicht ermittelt werden",createMissionHere:"Auftrag hier erstellen",verifyForMissions:"Für Aufträge verifizieren",verifyDescription:"Schließe deine Registrierung ab, um Missionen anzunehmen.",couldNotLoadMap:"Karte konnte nicht geladen werden",viewMission:"Auftrag anzeigen",focusMode:"Fokusmodus",stationary:"Stationär",walking:"Gehen",cycling:"Radfahren",vehicle:"Fahrzeug",walk:"Gehen",bike:"Rad",drive:"Auto",startNavigation:"Navigation starten",clearRoute:"Route löschen",calculating:"Berechne...",routeError:"Route konnte nicht berechnet werden",loadingMap:"Karte wird geladen...",reloadMap:"Karte neu laden",nearest:"Nächster",cluster:"Cluster",popular:"Beliebt",locked:"Gesperrt",lock:"Sperren",flyingToNearest:"Fliege zum nächsten Auftrag",fromHere:"von hier",flyingToCluster:"Fliege zum dichtesten Bereich",missionsHere:"Aufträge hier gesammelt",flyingToPopular:"Fliege zu",popularArea:"Beliebter Bereich mit",previousMissions:"früheren Aufträgen",mapLocked:"Karte auf deinen Standort gesperrt",mapUnlocked:"Karte entsperrt",cancelNavigation:"Navigation abbrechen",waitOrCancel:"Warten oder abbrechen",participate:"Teilnehmen",couldNotLoadMapToken:"Karte konnte nicht geladen werden (Token)",couldNotLoadMapWebGL:"Karte konnte nicht geladen werden (WebGL wird auf diesem Gerät nicht unterstützt)",couldNotLoadMapStyle:"Karte konnte nicht geladen werden (Stil)",couldNotLoadMapNetwork:"Karte konnte nicht geladen werden (Netzwerk/Werbeblocker)",mapLostContext:"Karte hat Grafikkontext verloren. Tippe zum Neuladen.",unknownMapError:"Unbekannter Kartenfehler",mapLoadTimeout:"Karte hat zu lange zum Laden gebraucht. Netzwerk/Werbeblocker prüfen und erneut versuchen.",missionCount:"Stk",lottery:"Lotterie",campaign:"Kampagne",goToMap:"Zur Karte"},_le={title:"Auftrag an meinem Standort erstellen",description:"Erstelle einen neuen Auftrag an deiner aktuellen Position",titleLabel:"Titel",titleRequired:"Titel *",titlePlaceholder:"Z.B. Das Café an der Ecke fotografieren",descriptionLabel:"Beschreibung (optional)",descriptionPlaceholder:"Beschreibe, was fotografiert werden soll...",photoCount:"Anzahl Fotos",reward:"Belohnung",creditsPerPhoto:"{{amount}} SEK pro Foto (max 300 SEK/Foto)",radius:"Radius",exampleImages:"Beispielbilder (optional)",goodExamples:"Gute Beispiele",badExamples:"Schlechte Beispiele",goodExampleAlt:"Gutes Beispiel",badExampleAlt:"Schlechtes Beispiel",addImage:"Hinzufügen",exampleHint:"Zeige dem Fotografen wie das Foto aussehen soll (und nicht soll)",cancel:"Abbrechen",creating:"Erstelle...",createMission:"Auftrag erstellen",imageTooLarge:"Bild darf max 5 MB groß sein",loginAndLocationRequired:"Du musst angemeldet sein und einen Standort haben",titleRequiredError:"Gib einen Titel für den Auftrag ein",missionCreated:"Auftrag erstellt!",missionOnMap:'"{{title}}" ist jetzt auf der Karte',couldNotCreate:"Auftrag konnte nicht erstellt werden",tryAgain:"Erneut versuchen",goodExampleCaption:"Gutes Beispiel",badExampleCaption:"Schlechtes Beispiel"},yle={takePhoto:"Foto aufnehmen",retake:"Erneut aufnehmen",use:"Verwenden",gallery:"Galerie",flash:"Blitz",flashOn:"Blitz an",flashOff:"Blitz aus",flashAuto:"Auto",switchCamera:"Kamera wechseln",permissionDenied:"Kamerazugriff verweigert",enableCamera:"Kamera in Einstellungen aktivieren"},vle={analyzing:"Foto wird analysiert...",approved:"Genehmigt",rejected:"Abgelehnt",tooBlurry:"Bild ist zu unscharf",tooDark:"Bild ist zu dunkel",wrongSubject:"Falsches Motiv",outsideArea:"Außerhalb des Auftragsbereichs",aestheticScore:"Ästhetische Bewertung"},xle={dashboard:"Auftraggeber-Dashboard",createMission:"Auftrag erstellen",createCampaign:"Neue Kampagne",campaigns:"Kampagnen",activeCampaigns:"Aktive Kampagnen",noCampaigns:"Noch keine Kampagnen",missionStats:"Auftragsstatistik",photosReceived:"Erhaltene Fotos",pendingApproval:"Ausstehende Genehmigung",totalSpent:"Gesamt ausgegeben",organizationName:"Organisationsname",organizationNumber:"Organisationsnummer",contactPerson:"Kontaktperson",billingAddress:"Rechnungsadresse",paymentMethod:"Zahlungsmethode",invoice:"Rechnung",card:"Karte"},ble={title:"Auftrag erstellen",stepOf:"Schritt {{step}} von {{total}}",continue:"Weiter",creating:"Erstelle Auftrag...",create:"Auftrag erstellen",missionCreated:"Auftrag erstellt!",couldNotCreate:"Auftrag konnte nicht erstellt werden",becomeOrderer:"Zuerst Auftraggeber werden",mustBeOrderer:"Du musst als Auftraggeber registriert und genehmigt sein, um Aufträge zu erstellen.",registerAsOrderer:"Als Auftraggeber registrieren",step1Title:"Was soll fotografiert werden?",step1Desc:"Beschreibe die Objekte oder Orte, die dokumentiert werden sollen",missionTitle:"Auftragsbezeichnung",missionTitlePlaceholder:"Z.B. Parkbänke im Stadtpark",whatToPhoto:"Was soll fotografiert werden?",whatToPhotoPlaceholder:"Z.B. Alle Parkbänke, Gesamtaufnahme und Nahaufnahmen von Schäden",instructions:"Anweisungen für den Fotografen",instructionsPlaceholder:"Z.B. Foto frontal aufnehmen, Umgebung einbeziehen...",description:"Beschreibung (für Fotografen sichtbar)",descriptionPlaceholder:"Zusätzliche Informationen zum Auftrag...",step2Title:"Standort",step2Desc:"Klicke auf die Karte um den Mittelpunkt zu wählen, oder ziehe den Marker",areaName:"Gebietsname",areaNamePlaceholder:"Z.B. Stadtpark, München",radius:"Radius",radiusHint:"Der Fotograf muss sich innerhalb dieses Radius befinden um den Auftrag abzuschließen",latitude:"Breitengrad",longitude:"Längengrad",step3Title:"Häufigkeit",step3Desc:"Wie oft soll der Auftrag ausgeführt werden?",durationTitle:"Dauer",durationDesc:"Wie lange soll der Auftrag aktiv sein?",frequencyOnce:"Einmalig",frequencyOnceDesc:"Einmaliger Auftrag",frequencyDaily:"Täglich",frequencyDailyDesc:"Jeden Tag",frequencyWeekly:"Wöchentlich",frequencyWeeklyDesc:"Einmal pro Woche",frequencyBiweekly:"Alle zwei Wochen",frequencyBiweeklyDesc:"Alle 14 Tage",frequencyMonthly:"Monatlich",frequencyMonthlyDesc:"Einmal pro Monat",duration1week:"1 Woche",duration2weeks:"2 Wochen",duration1month:"1 Monat",duration3months:"3 Monate",duration6months:"6 Monate",duration1year:"1 Jahr",step4Title:"Fotoanforderungen",step4Desc:"Anzahl erforderlicher Fotos pro abgeschlossenem Auftrag",photoCount:"Anzahl Fotos",rewardTitle:"Vergütung",rewardDesc:"Vergütung an den Fotografen pro abgeschlossenem Auftrag",reward:"Vergütung",perPhoto:"{{amount}} SEK/Foto",maxPerPhoto:"Max {{amount}} SEK/Foto",rewardTooHigh:"Vergütung darf {{max}} SEK pro Foto nicht überschreiten",summaryTitle:"Zusammenfassung",mission:"Auftrag",area:"Gebiet",frequency:"Häufigkeit",duration:"Dauer",photosPerMission:"Fotos/Auftrag",rewardPerMission:"Vergütung/Auftrag",pcs:"Stk",estimatedTotalCost:"Geschätzte Gesamtkosten",basedOnOnce:"Basierend auf einmaligem Auftrag",basedOnFrequency:"Basierend auf {{frequency}} für {{duration}}",validationTitleRequired:"Bitte gib einen Auftragsitel ein",validationTargetRequired:"Bitte beschreibe was fotografiert werden soll",validationAreaRequired:"Bitte gib einen Gebietsnamen ein"},wle={title:"Kampagnentitel",description:"Beschreibung",locationType:"Ortstyp",searchArea:"Suchgebiet",instructions:"Anweisungen für Fotografen",reward:"Belohnung pro Auftrag",photosPerLocation:"Fotos pro Standort",duration:"Dauer",schedule:"Zeitplan",once:"Einmalig",weekly:"Wöchentlich",daily:"Täglich",locations:"Standorte",locationsFound:"Standorte gefunden",noLocationsFound:"Keine Standorte gefunden",createCampaign:"Kampagne erstellen",estimatedCost:"Geschätzte Kosten",confirm:"Bestätigen und erstellen"},Sle={title:"An Wohltätigkeit spenden",description:"Mach einen Unterschied mit deinen verdienten Credits. 100% deiner Spende geht direkt an die Organisation – gut, egal in wessen Hände es gelangt.",donationComplete:"Spende abgeschlossen!",donatedTo:"Du hast {{amount}} kr an {{name}} gespendet. Möchtest du das auf Facebook teilen?",thankYou:"Danke für deinen Beitrag!",shareOnFacebook:"Auf Facebook teilen",maybeLater:"Vielleicht später",thanksForSharing:"Danke fürs Weitersagen!",minDonation:"Mindestspende ist 10 kr",notEnoughCredits:"Du hast nicht genug Credits",thanksDonation:"Danke! Du hast {{amount}} kr an {{name}} gespendet 💚",amount:"Betrag (kr)",enterAmount:"Betrag eingeben",available:"Verfügbar",donate:"Spenden",donating:"Spende wird verarbeitet...",readMoreAt:"Mehr erfahren auf",unicef:{name:"UNICEF",description:"Rettet Kinder weltweit",mission:"Arbeitet für die Rechte von Kindern in über 190 Ländern. Jede Krone hilft Kindern, Zugang zu Bildung, sauberem Wasser und Gesundheitsversorgung zu erhalten.",impact:"100 kr = Impfstoffe für 10 Kinder"},doctorsWithoutBorders:{name:"Ärzte ohne Grenzen",description:"Medizinische Hilfe in Krisengebieten",mission:"Bietet lebensrettende medizinische Versorgung für Menschen in Not, unabhängig davon, wo sie sind oder wer sie sind.",impact:"250 kr = Medizin für eine Familie"},wwf:{name:"WWF",description:"Schützt Natur und Tierwelt",mission:"Kämpft für den Erhalt der Biodiversität und den Schutz bedrohter Arten auf der ganzen Welt.",impact:"150 kr = schützt 1 Hektar Regenwald"},wateraid:{name:"WaterAid",description:"Sauberes Wasser für alle",mission:"Arbeitet dafür, dass alle Menschen Zugang zu sauberem Wasser, Sanitärversorgung und Hygiene haben. Wasser ist die Grundlage für alles.",impact:"200 kr = sauberes Wasser für einen Monat"},plan:{name:"Plan International",description:"Bildung für Mädchen",mission:"Kämpft für die Rechte von Kindern und gleiche Chancen für Mädchen auf Bildung und Zukunft.",impact:"300 kr = Schulmaterial für ein Kind"},stadsmission:{name:"Stadtmission",description:"Hilft Bedürftigen in Schweden",mission:"Bietet Unterstützung für Menschen in Obdachlosigkeit und Not. Niemand sollte hungern oder frieren müssen.",impact:"100 kr = eine warme Mahlzeit"},wfp:{name:"World Food Programme",description:"Bekämpft Hunger weltweit",mission:"Das UN-Ernährungsprogramm rettet Leben, indem es Nahrung an die Bedürftigsten der Welt liefert.",impact:"50 kr = Essen für eine Familie für einen Tag"},handInHand:{name:"Hand in Hand",description:"Schafft Jobs zur Armutsbekämpfung",mission:"Hilft Menschen in Armut, eigene Unternehmen zu gründen und sich selbst und ihre Familien zu versorgen.",impact:"500 kr = ein Mikrounternehmer erhält Unterstützung"}},Tle={title:"Fotomarkt",subtitle:"Fotos kaufen • 100% geht an Wohltätigkeit",searchPlaceholder:"Fotos, Länder, Kategorien suchen...",sortBy:"Sortieren",allCategories:"Alle Kategorien",allCountries:"Alle Länder",noPhotosFound:"Keine Fotos gefunden",clearSearch:"Suche löschen",fromPrice:"ab {{price}} SEK",price:"{{price}} SEK",charityBannerTitle:"100% an Wohltätigkeit",charityBannerDescription:"Beim Kauf eines Fotos gehen alle Erlöse direkt an Hilfsorganisationen, die in dem Land tätig sind, in dem das Foto aufgenommen wurde.",featured:"Empfohlen",popular:"Beliebt",priceLow:"Preis ↑",priceHigh:"Preis ↓"},Ele={title:"Marktplatz",buyPhoto:"Foto kaufen",sellPhoto:"Foto verkaufen",featured:"Empfohlen",popular:"Beliebt",recent:"Neueste",category:"Kategorie",price:"Preis",photographer:"Fotograf",license:"Lizenz",download:"Herunterladen"},kle={title:"Fotowettbewerb",currentContest:"Aktueller Wettbewerb",submit:"Beitrag einreichen",vote:"Abstimmen",votes:"Stimmen",winners:"Gewinner",prizes:"Preise",rules:"Regeln",endsIn:"Endet in",theme:"Thema",supports:"Unterstützt {{charity}}",active:"Aktiv",ended:"Beendet",upcoming:"Bevorstehend",daysLeft:"{{count}} Tage übrig",endedAgo:"Beendet {{time}}",startsOn:"Startet am {{date}}",info:"Info",entries:"Beiträge",noEntriesYet:"Noch keine Beiträge",beFirstToParticipate:"Sei der Erste, der teilnimmt!",contestEntry:"Wettbewerbsbeitrag",winner:"Gewinner",uploadEntry:"Beitrag hochladen",winnersNotAnnounced:"Gewinner wurden noch nicht bekannt gegeben",winnersAfterEnd:"Gewinner werden nach Ende des Wettbewerbs bekannt gegeben",untitled:"Ohne Titel",firstPlace:"1. Platz",secondPlace:"2. Platz",thirdPlace:"3. Platz",starts:"Startet",ends:"Endet"},Ale={photoNotFound:"Foto nicht gefunden",backToMarket:"Zurück zum Fotomarkt",purchaseInitiated:"Kauf eingeleitet für {{title}}",fullResolution:"Volle Auflösung",fullResolutionDesc:"Höchste Qualität für alle Verwendungen",buyDigitalPhoto:"Digitalfoto kaufen",charityTitle:"100% an Wohltätigkeit",charityDescription:"Der gesamte Kaufbetrag geht direkt an humanitäre Arbeit. Deine Zahlung hilft echten Menschen.",orderAsPrint:"Als Druck bestellen",orderAsPrintDesc:"Nach dem Kauf kannst du professionelle Drucke bei unseren Partnern bestellen:",views:"Aufrufe",downloads:"Downloads",linkCopied:"Link kopiert!",checkOutPhoto:"Schau dir dieses Foto an: {{title}}",opening:"Öffne {{name}}",uploadForPrint:"Lade dein Bild nach dem Kauf hoch, um Drucke zu bestellen",professionalQuality:"Professionelle Qualität online",balancedTopService:"Ausgewogener Top-Service"},Cle={now:"Jetzt",minutesAgo:"Vor {{count}} Min",hoursAgo:"Vor {{count}} Std",daysAgo:"Vor {{count}} Tagen",inMinutes:"In {{count}} Min",inHours:"In {{count}} Std",inDays:"In {{count}} Tagen"},Ile={networkError:"Netzwerkfehler",serverError:"Serverfehler",notFound:"Nicht gefunden",unauthorized:"Nicht autorisiert",forbidden:"Verboten",tryAgain:"Erneut versuchen",somethingWentWrong:"Etwas ist schiefgelaufen"},Mle={privacy:"Datenschutz",terms:"AGB",contact:"Kontakt",tagline:"Jedes Foto erzählt eine Geschichte",pixDriftTagline:"Pix + Drift = Los und fotografieren 📸",copyright:"© 2024 PixDrift. Die globale Plattform für Mobilfotografie.",values:"Erschwinglich • Umweltfreundlich • Modern"},Ple={title:"Rangliste",total:"Gesamt",thisWeek:"Diese Woche",thisMonth:"Diesen Monat",efficiency:"Effizienz",rank:"Rang",earnings:"Einnahmen",perMinute:"/Min"},Dle={statusBadge:"MISSBRAUCHSRESISTENT • INSTITUTION-GRADE",headline1:"Environmental Intelligence.",headline2:"Gesellschaftskompatibel.",subtitle:"Ein autonomes Entscheidungssystem für temporäre, anonyme, umweltbasierte visuelle Datenerfassung.",noSurveillance:"Keine Personenüberwachung. Keine private Ermittlung. Niemals.",institutionalOrder:"Institutionelle Bestellung",becomePerformer:"Ausführender werden",reasonGate:"Reason Gate",anonymization:"Anonymisierung",abuseBlocked:"Missbrauch blockiert"},Rle={title:"Kontoauszug",auditCompliant:"Revisionssichere Dokumentation",auditDescription:"Dieser Bericht erfüllt die Anforderungen der Steuererklärung nach schwedischem Recht. Vorabsteuer (35%) gewährleistet die Einhaltung unabhängig von der Gemeinde. MwSt. (25%) wird separat ausgewiesen. Jährliche Kontrollmitteilung wird an das Finanzamt übermittelt.",grossAmount:"Bruttobetrag (inkl. MwSt.)",vat:"MwSt.",preliminaryTax:"Vorabsteuer",netPaid:"Netto ausgezahlt",transactions:"Transaktionen",generating:"Generiere...",pdf:"PDF",download:"Herunterladen",send:"Senden",sendEmailSoon:"Per E-Mail senden kommt bald",noServicesRecorded:"Keine Dienstleistungen erfasst",completeMissionsForReceipts:"Schließe Aufträge ab um Belege zu generieren",serviceExecution:"Dienstausführung",documentId:"Dokument-ID",executed:"Ausgeführt",payingOrganization:"Zahlende Organisation",orgNumber:"Org.-Nr.",serviceLocation:"Dienstleistungsort",serviceType:"Dienstleistungsart",pdfGenerated:"Kontoauszug generiert und in neuem Tab geöffnet",pdfProcessing:"PDF wird generiert... Dies kann einige Sekunden dauern. Versuche es gleich nochmal.",pdfError:"PDF konnte nicht generiert werden. Überprüfe ob PDF Monkey korrekt konfiguriert ist.",mustBeLoggedIn:"Du musst angemeldet sein um PDF zu exportieren",noTransactionsToExport:"Keine Transaktionen zum Exportieren",footer1:"Rewault AB · Org.-Nr. 559XXX-XXXX · USt.-Nr. SE559XXXXXX01",footer2:"Steuerabzüge werden dem Finanzamt gemeldet. Jährliche Kontrollmitteilung wird eingereicht.",footer3:"Dieses Dokument ist digital erstellt. Keine Unterschrift erforderlich."},Lle={title:"Internes Wachstumsmodell",description:"Nimm an der internen Wertentwicklung des Unternehmens teil",active:"Aktiv",inactive:"Inaktiv",importantInfo:"Wichtige Information",importantDescription:"Dies ist kein Sparkonto, keine Investition oder Finanzanlage. Wenn du Wachstum aktivierst, wird dein Guthaben als risikobehaftetes Kapital im Unternehmen verwendet. Wertentwicklung ist nicht garantiert und kann sowohl steigen als auch fallen. Diese Funktion ist nicht durch die Einlagensicherung gedeckt.",confirmParticipation:"Teilnahme bestätigen",confirmCheckbox:"Ich verstehe, dass dies kein Bankkonto ist, dass mein Kapital in der operativen Geschäftstätigkeit des Unternehmens verwendet wird und dass der Wert sowohl steigen als auch fallen kann. Ich bestätige, dass dies keine Anlageberatung ist und die Funktion nicht durch die Einlagensicherung gedeckt ist.",cancel:"Abbrechen",activate:"Aktivieren",enableGrowth:"Wachstum aktivieren",allocateBalance:"Guthaben für Unternehmensunterstützung zuweisen",balanceActive:"Dein Guthaben ist im Wachstumsmodell des Unternehmens aktiv",valueDevelopment:"Wertentwicklung",historicalDevelopment:"Historische Entwicklung basierend auf Unternehmensergebnissen. Frühere Leistung garantiert keine zukünftigen Ergebnisse.",capitalInUse:"Kapital in Verwendung",resultBasedAllocation:"Ergebnisbasierte Zuteilung",currentValue:"Aktueller Wert",valueBasedOnResults:"Der Wert basiert auf den aktuellen Ergebnissen des Unternehmens und kann sich ändern",howDoesItWork:"Wie funktioniert es?",participationTitle:"Teilnahme am internen Wachstumsmodell",participationDescription:"Wenn du diese Funktion aktivierst, wird dein Guthaben als risikobehaftetes Kapital in der operativen Geschäftstätigkeit des Unternehmens verwendet. Du nimmst damit am internen Wert- und Wachstumsmodell des Unternehmens teil, das mit Kreditgeschäft und Geschäftsbetrieb verbunden ist.",whatDoesThisMean:"Was bedeutet das?",point1:"Dein Kapital wird im eigenen Geschäft des Unternehmens verwendet",point2:"Das Unternehmen ist Vertragspartner, nicht Vermittler",point3:"Jede Wertentwicklung hängt von den tatsächlichen Ergebnissen des Unternehmens ab",point4:"Abhebungen erfolgen gemäß den Bedingungen des Unternehmens",riskInfo:"Risikoinformationen",risk1:"Wertentwicklung ist unsicher und nicht garantiert",risk2:"Der Wert kann sowohl steigen als auch fallen",risk3:"Das Kapital ist risikobehaftet",risk4:"Nicht durch Einlagensicherung gedeckt",complianceInfo:"Compliance-Informationen",complianceDescription:"Dies ist kein Bank-, Wertpapier- oder Anlagegeschäft. Die Funktion stellt eine Teilnahme am internen Geschäftsmodell des Unternehmens dar, bei dem der Benutzer risikobehaftetes Kapital für ergebnisbasierte Zuteilung bereitstellt.",value:"Wert"},Ole={title:"Deine Leistung",level:"Stufe",score:"Punkte",tierElite:"Elite",tierPro:"Pro",tierActive:"Aktiv",tierRookie:"Anfänger",tierNew:"Neu",seeMissionsFirst:"Du siehst Aufträge zuerst!",headStart:"{{seconds}}s Vorsprung",delay:"{{seconds}}s Verzögerung",completed:"Fertig",approved:"Genehmigt",streak:"Serie",expiredAffectScore:"{{count}} abgelaufene Aufträge beeinflussen deine Punkte"},Fle={george:"Ruhiger, professioneller Mann",sarah:"Freundliche, klare Frau",liam:"Junger, energischer Mann",matilda:"Warme, vertrauenswürdige Frau",daniel:"Nachrichtensprecher, autoritativer Mann"},zle="Hallo! Ich bin {{name}} und werde dich durch deine Aufträge führen.",Ble="Stimme anhören",Nle="Stimme konnte nicht abgespielt werden",Vle={common:ale,nav:lle,auth:cle,home:ule,missions:dle,missionDetail:hle,wallet:fle,profile:ple,notifications:mle,map:gle,quickCreate:_le,camera:yle,validation:vle,orderer:xle,createMission:ble,campaign:wle,charity:Sle,photoMarketplace:Tle,marketplace:Ele,contest:kle,photoDetail:Ale,time:Cle,errors:Ile,footer:Mle,leaderboard:Ple,hero:Dle,earningsHistory:Rle,earningsGrowth:Lle,performance:Ole,voiceDescriptions:Fle,voiceSample:zle,voicePreviewButton:Ble,voicePreviewError:Nle},jle={sv:{translation:cae},en:{translation:sle},de:{translation:Vle}};ts.use(L6).use(pQ).init({resources:jle,lng:"sv",fallbackLng:"sv",supportedLngs:["en","sv","de"],detection:{order:["querystring","localStorage"],caches:["localStorage"],lookupLocalStorage:"i18nextLng",lookupQuerystring:"lang"},interpolation:{escapeValue:!1},react:{useSuspense:!1}});ts.on("languageChanged",n=>{document.documentElement.lang=n,document.documentElement.dir="ltr"});ts.language&&(document.documentElement.lang=ts.language);const ice=[{code:"en",name:"English",flag:"🇬🇧"},{code:"sv",name:"Svenska",flag:"🇸🇪"},{code:"de",name:"Deutsch",flag:"🇩🇪"}];try{typeof navigator<"u"&&"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(n=>n.forEach(t=>t.unregister())).catch(()=>{})}catch(n){console.warn("[main] serviceWorker cleanup failed:",n)}try{typeof window<"u"&&"caches"in window&&caches.keys().then(n=>{n.filter(t=>t.includes("mapbox")||t.includes("workbox")).forEach(t=>caches.delete(t))})}catch(n){console.warn("[main] cache cleanup failed:",n)}window.onerror=function(n,t,s,h,g){return console.error("[GLOBAL ERROR]",n,g),!1};window.onunhandledrejection=function(n){console.error("[UNHANDLED REJECTION]",n.reason)};const RB=document.getElementById("root");RB?t4(RB).render(ue.jsx(Roe,{})):console.error("[main] root element not found");export{SQ as $,mI as A,RU as B,I4 as C,sre as D,ore as E,mW as F,wW as G,MW as H,a6 as I,WU as J,nce as K,rT as L,iT as M,KU as N,$o as O,Bi as P,SP as Q,TP as R,AW as S,D4 as T,IW as U,PW as V,EP as W,jp as X,t6 as Y,wP as Z,ZU as _,nm as a,n2 as a$,Kle as a0,em as a1,Cre as a2,tce as a3,dre as a4,KY as a5,fre as a6,kC as a7,gW as a8,$p as a9,aX as aA,lX as aB,rV as aC,yM as aD,r4 as aE,kie as aF,i4 as aG,Vre as aH,GU as aI,LU as aJ,HT as aK,cX as aL,xx as aM,uX as aN,f7 as aO,Ere as aP,dY as aQ,zF as aR,l6 as aS,FF as aT,NF as aU,Hle as aV,Wle as aW,PX as aX,Yle as aY,AC as aZ,SW as a_,Nie as aa,tV as ab,tQ as ac,CW as ad,yW as ae,ice as af,TQ as ag,EQ as ah,rd as ai,YV as aj,kQ as ak,DS as al,TW as am,pW as an,IU as ao,Rie as ap,r6 as aq,i6 as ar,o6 as as,SS as at,H_ as au,yu as av,s6 as aw,Yw as ax,rce as ay,Su as az,M4 as b,qle as b0,Sx as b1,rK as b2,da as b3,Xle as b4,mc as b5,Zle as b6,VF as b7,ece as b8,DW as b9,Qle as ba,JV as bb,IQ as bc,GM as bd,MQ as be,PQ as bf,QV as bg,d6 as bh,$7 as bi,G_ as bj,qX as bk,VX as bl,FC as bm,wV as bn,BX as bo,NX as bp,OC as bq,vV as br,tK as bs,GX as bt,WT as c,hi as d,Bie as e,ES as f,$_ as g,wM as h,fi as i,ue as j,UM as k,Pre as l,Are as m,kre as n,tm as o,Ox as p,Cp as q,Y as r,Yi as s,P4 as t,Y_ as u,ol as v,Jo as w,Hr as x,QC as y,AQ as z};
|
||
//# sourceMappingURL=index-CZD3_4lD.js.map
|