58ca4e68db
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics) - Rust analytics service with parallel report generation - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables, full migrations - Redis cache, sessions, pub/sub - Kafka event streaming with Zookeeper - WebSocket hub for real-time updates - Automation engine with cron jobs, workflows, event triggers - JWT authentication, multi-tenant from start - Docker Compose with all services - Nginx reverse proxy with rate limiting - Integration tests passing - Feature gap analysis against Fortnox/Odoo/Visma Refs: BOC-001
3720 lines
2.6 MiB
Plaintext
3720 lines
2.6 MiB
Plaintext
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Index-B5xg3G3P.js","assets/refresh-cw-DEBvxUr1.js","assets/clock-DRtqJZUo.js","assets/chevron-right-B9rMgght.js","assets/index-DGH-oZ97.js","assets/circle-alert-C1Hs9zwh.js","assets/video-D6Sip5Dx.js","assets/Auth-Gib-waoR.js","assets/mail-BT0S3dBU.js","assets/eye-G89nJUb2.js","assets/MissionDetail-C7kUviJC.js","assets/useMissionExamples-B0el-PHm.js","assets/useIdentityVerification-CD3mPBIt.js","assets/circle-check-D3hjqUcb.js","assets/SecureCamera-mAkOb0O2.js","assets/index-B-MEeiYV.js","assets/shield-BWGzcrms.js","assets/check-CG8zylH4.js","assets/award-By-NEFpe.js","assets/triangle-alert-B87swlNS.js","assets/gift-lxeNwCUB.js","assets/ticket-D1bxyCST.js","assets/external-link-C86N9iPS.js","assets/arrow-left-m6EiMbb-.js","assets/image-DuU1QaV8.js","assets/timer-C5oB41EC.js","assets/Profile-C4xYBVXU.js","assets/dropdown-menu-CBJEO_Gg.js","assets/circle-030W8joh.js","assets/badge-Qwi4CUXx.js","assets/progress-Cql_vZKU.js","assets/trending-up-Be0ZnpBQ.js","assets/leaf-DHbwTQEy.js","assets/zap-RaPdKGJZ.js","assets/select-Bi-TzF3J.js","assets/chevron-down-QDDHZwZg.js","assets/building-2-w77rCUKE.js","assets/credit-card-CfUVKCDe.js","assets/palette-xHAcW495.js","assets/save-BwjzM02b.js","assets/Wallet-DDpmfw68.js","assets/differenceInDays-CJS5VaxB.js","assets/sv-BZPVJm6C.js","assets/star-C6FiGbGr.js","assets/qr-code-BIBWO21n.js","assets/heart-BjLemQnU.js","assets/graduation-cap-Bk5l1TQx.js","assets/scroll-area-B0CEXZGH.js","assets/info-BT66tWy0.js","assets/file-text-CyDVAB5w.js","assets/download-B0vydl5E.js","assets/send-DsElwFaU.js","assets/calendar-Bof-SGwp.js","assets/Notifications-B8XGepdj.js","assets/VerifyIdentity-Ro09dKVe.js","assets/OrdererRegistration-BOhnJl4W.js","assets/radio-group-CcrlZGTP.js","assets/landmark-BYZTTZdl.js","assets/CreateMission-8331plbz.js","assets/upload-LLBu8Q_P.js","assets/repeat-wK6OxTxo.js","assets/megaphone-CztbyYca.js","assets/CreateCampaign-DUvMysdJ.js","assets/waves-DiawweIQ.js","assets/trash-2-A3LTadZ7.js","assets/radio-G_rzhIIH.js","assets/settings-BTJAoFnf.js","assets/search-K36NSOaV.js","assets/OrdererDashboard-5y9XrRsn.js","assets/tabs-CYk3p-Aj.js","assets/useQuery-BxfmyRLz.js","assets/ROICalculator-DVEYTdny.js","assets/layers-DZd3aBRI.js","assets/activity-B0zyNqjw.js","assets/server-BrxxSdWs.js","assets/key-BAzZqC6d.js","assets/RealChangeMission-MIGek0JF.js","assets/blocks-CUUl6oOU.js","assets/OrdererMissionDetail-BnWG6WKo.js","assets/OperationsPopout-BuyROwwG.js","assets/AnalyticsPopout-C0wfA38E.js","assets/AdsPopout-DKNQbVOB.js","assets/Principles-C209eajW.js","assets/network-DAH-TQsi.js","assets/Policy-rMsjW2x7.js","assets/PhotoMarketplace-CAR9gpra.js","assets/taj-mahal-CpmP2aQk.js","assets/PhotoDetail-CGO3w_xn.js","assets/PhotoContest-Dt4wePeS.js","assets/IdentityDisclaimer-BQti7r70.js","assets/RedeemVoucher-NVDK1D_N.js"])))=>i.map(i=>d[i]);
|
||
var BD=t=>{throw TypeError(t)};var y2=(t,e,s)=>e.has(t)||BD("Cannot "+s);var Gt=(t,e,s)=>(y2(t,e,"read from private field"),s?s.call(t):e.get(t)),wi=(t,e,s)=>e.has(t)?BD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),Bn=(t,e,s,u)=>(y2(t,e,"write to private field"),u?u.call(t,s):e.set(t,s),s),Bo=(t,e,s)=>(y2(t,e,"access private method"),s);var zw=(t,e,s,u)=>({set _(h){Bn(t,e,h,s)},get _(){return Gt(t,e,u)}});function lG(t,e){for(var s=0;s<e.length;s++){const u=e[s];if(typeof u!="string"&&!Array.isArray(u)){for(const h in u)if(h!=="default"&&!(h in t)){const _=Object.getOwnPropertyDescriptor(u,h);_&&Object.defineProperty(t,h,_.get?_:{enumerable:!0,get:()=>u[h]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))u(h);new MutationObserver(h=>{for(const _ of h)if(_.type==="childList")for(const w of _.addedNodes)w.tagName==="LINK"&&w.rel==="modulepreload"&&u(w)}).observe(document,{childList:!0,subtree:!0});function s(h){const _={};return h.integrity&&(_.integrity=h.integrity),h.referrerPolicy&&(_.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?_.credentials="include":h.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function u(h){if(h.ep)return;h.ep=!0;const _=s(h);fetch(h.href,_)}})();var cG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function FA(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lF={exports:{}},O1={},cF={exports:{}},ti={};/**
|
||
* @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 k0=Symbol.for("react.element"),uG=Symbol.for("react.portal"),dG=Symbol.for("react.fragment"),hG=Symbol.for("react.strict_mode"),fG=Symbol.for("react.profiler"),pG=Symbol.for("react.provider"),mG=Symbol.for("react.context"),gG=Symbol.for("react.forward_ref"),_G=Symbol.for("react.suspense"),yG=Symbol.for("react.memo"),vG=Symbol.for("react.lazy"),ND=Symbol.iterator;function xG(t){return t===null||typeof t!="object"?null:(t=ND&&t[ND]||t["@@iterator"],typeof t=="function"?t:null)}var uF={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},dF=Object.assign,hF={};function Wg(t,e,s){this.props=t,this.context=e,this.refs=hF,this.updater=s||uF}Wg.prototype.isReactComponent={};Wg.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Wg.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function fF(){}fF.prototype=Wg.prototype;function BA(t,e,s){this.props=t,this.context=e,this.refs=hF,this.updater=s||uF}var NA=BA.prototype=new fF;NA.constructor=BA;dF(NA,Wg.prototype);NA.isPureReactComponent=!0;var jD=Array.isArray,pF=Object.prototype.hasOwnProperty,jA={current:null},mF={key:!0,ref:!0,__self:!0,__source:!0};function gF(t,e,s){var u,h={},_=null,w=null;if(e!=null)for(u in e.ref!==void 0&&(w=e.ref),e.key!==void 0&&(_=""+e.key),e)pF.call(e,u)&&!mF.hasOwnProperty(u)&&(h[u]=e[u]);var o=arguments.length-2;if(o===1)h.children=s;else if(1<o){for(var k=Array(o),P=0;P<o;P++)k[P]=arguments[P+2];h.children=k}if(t&&t.defaultProps)for(u in o=t.defaultProps,o)h[u]===void 0&&(h[u]=o[u]);return{$$typeof:k0,type:t,key:_,ref:w,props:h,_owner:jA.current}}function wG(t,e){return{$$typeof:k0,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function VA(t){return typeof t=="object"&&t!==null&&t.$$typeof===k0}function bG(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(s){return e[s]})}var VD=/\/+/g;function v2(t,e){return typeof t=="object"&&t!==null&&t.key!=null?bG(""+t.key):e.toString(36)}function xb(t,e,s,u,h){var _=typeof t;(_==="undefined"||_==="boolean")&&(t=null);var w=!1;if(t===null)w=!0;else switch(_){case"string":case"number":w=!0;break;case"object":switch(t.$$typeof){case k0:case uG:w=!0}}if(w)return w=t,h=h(w),t=u===""?"."+v2(w,0):u,jD(h)?(s="",t!=null&&(s=t.replace(VD,"$&/")+"/"),xb(h,e,s,"",function(P){return P})):h!=null&&(VA(h)&&(h=wG(h,s+(!h.key||w&&w.key===h.key?"":(""+h.key).replace(VD,"$&/")+"/")+t)),e.push(h)),1;if(w=0,u=u===""?".":u+":",jD(t))for(var o=0;o<t.length;o++){_=t[o];var k=u+v2(_,o);w+=xb(_,e,s,k,h)}else if(k=xG(t),typeof k=="function")for(t=k.call(t),o=0;!(_=t.next()).done;)_=_.value,k=u+v2(_,o++),w+=xb(_,e,s,k,h);else if(_==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return w}function Fw(t,e,s){if(t==null)return t;var u=[],h=0;return xb(t,u,"","",function(_){return e.call(s,_,h++)}),u}function SG(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(s){(t._status===0||t._status===-1)&&(t._status=1,t._result=s)},function(s){(t._status===0||t._status===-1)&&(t._status=2,t._result=s)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var la={current:null},wb={transition:null},TG={ReactCurrentDispatcher:la,ReactCurrentBatchConfig:wb,ReactCurrentOwner:jA};function _F(){throw Error("act(...) is not supported in production builds of React.")}ti.Children={map:Fw,forEach:function(t,e,s){Fw(t,function(){e.apply(this,arguments)},s)},count:function(t){var e=0;return Fw(t,function(){e++}),e},toArray:function(t){return Fw(t,function(e){return e})||[]},only:function(t){if(!VA(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ti.Component=Wg;ti.Fragment=dG;ti.Profiler=fG;ti.PureComponent=BA;ti.StrictMode=hG;ti.Suspense=_G;ti.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=TG;ti.act=_F;ti.cloneElement=function(t,e,s){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var u=dF({},t.props),h=t.key,_=t.ref,w=t._owner;if(e!=null){if(e.ref!==void 0&&(_=e.ref,w=jA.current),e.key!==void 0&&(h=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(k in e)pF.call(e,k)&&!mF.hasOwnProperty(k)&&(u[k]=e[k]===void 0&&o!==void 0?o[k]:e[k])}var k=arguments.length-2;if(k===1)u.children=s;else if(1<k){o=Array(k);for(var P=0;P<k;P++)o[P]=arguments[P+2];u.children=o}return{$$typeof:k0,type:t.type,key:h,ref:_,props:u,_owner:w}};ti.createContext=function(t){return t={$$typeof:mG,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:pG,_context:t},t.Consumer=t};ti.createElement=gF;ti.createFactory=function(t){var e=gF.bind(null,t);return e.type=t,e};ti.createRef=function(){return{current:null}};ti.forwardRef=function(t){return{$$typeof:gG,render:t}};ti.isValidElement=VA;ti.lazy=function(t){return{$$typeof:vG,_payload:{_status:-1,_result:t},_init:SG}};ti.memo=function(t,e){return{$$typeof:yG,type:t,compare:e===void 0?null:e}};ti.startTransition=function(t){var e=wb.transition;wb.transition={};try{t()}finally{wb.transition=e}};ti.unstable_act=_F;ti.useCallback=function(t,e){return la.current.useCallback(t,e)};ti.useContext=function(t){return la.current.useContext(t)};ti.useDebugValue=function(){};ti.useDeferredValue=function(t){return la.current.useDeferredValue(t)};ti.useEffect=function(t,e){return la.current.useEffect(t,e)};ti.useId=function(){return la.current.useId()};ti.useImperativeHandle=function(t,e,s){return la.current.useImperativeHandle(t,e,s)};ti.useInsertionEffect=function(t,e){return la.current.useInsertionEffect(t,e)};ti.useLayoutEffect=function(t,e){return la.current.useLayoutEffect(t,e)};ti.useMemo=function(t,e){return la.current.useMemo(t,e)};ti.useReducer=function(t,e,s){return la.current.useReducer(t,e,s)};ti.useRef=function(t){return la.current.useRef(t)};ti.useState=function(t){return la.current.useState(t)};ti.useSyncExternalStore=function(t,e,s){return la.current.useSyncExternalStore(t,e,s)};ti.useTransition=function(){return la.current.useTransition()};ti.version="18.3.1";cF.exports=ti;var X=cF.exports;const dr=FA(X),UA=lG({__proto__:null,default:dr},[X]);/**
|
||
* @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 EG=X,kG=Symbol.for("react.element"),AG=Symbol.for("react.fragment"),CG=Object.prototype.hasOwnProperty,IG=EG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,PG={key:!0,ref:!0,__self:!0,__source:!0};function yF(t,e,s){var u,h={},_=null,w=null;s!==void 0&&(_=""+s),e.key!==void 0&&(_=""+e.key),e.ref!==void 0&&(w=e.ref);for(u in e)CG.call(e,u)&&!PG.hasOwnProperty(u)&&(h[u]=e[u]);if(t&&t.defaultProps)for(u in e=t.defaultProps,e)h[u]===void 0&&(h[u]=e[u]);return{$$typeof:kG,type:t,key:_,ref:w,props:h,_owner:IG.current}}O1.Fragment=AG;O1.jsx=yF;O1.jsxs=yF;lF.exports=O1;var le=lF.exports,vF={exports:{}},Ya={},xF={exports:{}},wF={};/**
|
||
* @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(t){function e(st,Pt){var qt=st.length;st.push(Pt);e:for(;0<qt;){var _r=qt-1>>>1,yr=st[_r];if(0<h(yr,Pt))st[_r]=Pt,st[qt]=yr,qt=_r;else break e}}function s(st){return st.length===0?null:st[0]}function u(st){if(st.length===0)return null;var Pt=st[0],qt=st.pop();if(qt!==Pt){st[0]=qt;e:for(var _r=0,yr=st.length,hr=yr>>>1;_r<hr;){var Gr=2*(_r+1)-1,mi=st[Gr],Oi=Gr+1,xn=st[Oi];if(0>h(mi,qt))Oi<yr&&0>h(xn,mi)?(st[_r]=xn,st[Oi]=qt,_r=Oi):(st[_r]=mi,st[Gr]=qt,_r=Gr);else if(Oi<yr&&0>h(xn,qt))st[_r]=xn,st[Oi]=qt,_r=Oi;else break e}}return Pt}function h(st,Pt){var qt=st.sortIndex-Pt.sortIndex;return qt!==0?qt:st.id-Pt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var _=performance;t.unstable_now=function(){return _.now()}}else{var w=Date,o=w.now();t.unstable_now=function(){return w.now()-o}}var k=[],P=[],O=1,F=null,V=3,$=!1,Y=!1,Z=!1,se=typeof setTimeout=="function"?setTimeout:null,te=typeof clearTimeout=="function"?clearTimeout:null,ee=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function oe(st){for(var Pt=s(P);Pt!==null;){if(Pt.callback===null)u(P);else if(Pt.startTime<=st)u(P),Pt.sortIndex=Pt.expirationTime,e(k,Pt);else break;Pt=s(P)}}function he(st){if(Z=!1,oe(st),!Y)if(s(k)!==null)Y=!0,Ot(Ie);else{var Pt=s(P);Pt!==null&&Et(he,Pt.startTime-st)}}function Ie(st,Pt){Y=!1,Z&&(Z=!1,te(Je),Je=-1),$=!0;var qt=V;try{for(oe(Pt),F=s(k);F!==null&&(!(F.expirationTime>Pt)||st&&!tr());){var _r=F.callback;if(typeof _r=="function"){F.callback=null,V=F.priorityLevel;var yr=_r(F.expirationTime<=Pt);Pt=t.unstable_now(),typeof yr=="function"?F.callback=yr:F===s(k)&&u(k),oe(Pt)}else u(k);F=s(k)}if(F!==null)var hr=!0;else{var Gr=s(P);Gr!==null&&Et(he,Gr.startTime-Pt),hr=!1}return hr}finally{F=null,V=qt,$=!1}}var Be=!1,je=null,Je=-1,ft=5,kt=-1;function tr(){return!(t.unstable_now()-kt<ft)}function jt(){if(je!==null){var st=t.unstable_now();kt=st;var Pt=!0;try{Pt=je(!0,st)}finally{Pt?Qe():(Be=!1,je=null)}}else Be=!1}var Qe;if(typeof ee=="function")Qe=function(){ee(jt)};else if(typeof MessageChannel<"u"){var xt=new MessageChannel,It=xt.port2;xt.port1.onmessage=jt,Qe=function(){It.postMessage(null)}}else Qe=function(){se(jt,0)};function Ot(st){je=st,Be||(Be=!0,Qe())}function Et(st,Pt){Je=se(function(){st(t.unstable_now())},Pt)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(st){st.callback=null},t.unstable_continueExecution=function(){Y||$||(Y=!0,Ot(Ie))},t.unstable_forceFrameRate=function(st){0>st||125<st?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ft=0<st?Math.floor(1e3/st):5},t.unstable_getCurrentPriorityLevel=function(){return V},t.unstable_getFirstCallbackNode=function(){return s(k)},t.unstable_next=function(st){switch(V){case 1:case 2:case 3:var Pt=3;break;default:Pt=V}var qt=V;V=Pt;try{return st()}finally{V=qt}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(st,Pt){switch(st){case 1:case 2:case 3:case 4:case 5:break;default:st=3}var qt=V;V=st;try{return Pt()}finally{V=qt}},t.unstable_scheduleCallback=function(st,Pt,qt){var _r=t.unstable_now();switch(typeof qt=="object"&&qt!==null?(qt=qt.delay,qt=typeof qt=="number"&&0<qt?_r+qt:_r):qt=_r,st){case 1:var yr=-1;break;case 2:yr=250;break;case 5:yr=1073741823;break;case 4:yr=1e4;break;default:yr=5e3}return yr=qt+yr,st={id:O++,callback:Pt,priorityLevel:st,startTime:qt,expirationTime:yr,sortIndex:-1},qt>_r?(st.sortIndex=qt,e(P,st),s(k)===null&&st===s(P)&&(Z?(te(Je),Je=-1):Z=!0,Et(he,qt-_r))):(st.sortIndex=yr,e(k,st),Y||$||(Y=!0,Ot(Ie))),st},t.unstable_shouldYield=tr,t.unstable_wrapCallback=function(st){var Pt=V;return function(){var qt=V;V=Pt;try{return st.apply(this,arguments)}finally{V=qt}}}})(wF);xF.exports=wF;var MG=xF.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 RG=X,Xa=MG;function ir(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,s=1;s<arguments.length;s++)e+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var bF=new Set,jv={};function Gf(t,e){Lg(t,e),Lg(t+"Capture",e)}function Lg(t,e){for(jv[t]=e,t=0;t<e.length;t++)bF.add(e[t])}var Lu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zE=Object.prototype.hasOwnProperty,DG=/^[: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]*$/,UD={},$D={};function LG(t){return zE.call($D,t)?!0:zE.call(UD,t)?!1:DG.test(t)?$D[t]=!0:(UD[t]=!0,!1)}function OG(t,e,s,u){if(s!==null&&s.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return u?!1:s!==null?!s.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function zG(t,e,s,u){if(e===null||typeof e>"u"||OG(t,e,s,u))return!0;if(u)return!1;if(s!==null)switch(s.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ca(t,e,s,u,h,_,w){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=u,this.attributeNamespace=h,this.mustUseProperty=s,this.propertyName=t,this.type=e,this.sanitizeURL=_,this.removeEmptyString=w}var Ro={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ro[t]=new ca(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ro[e]=new ca(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ro[t]=new ca(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ro[t]=new ca(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ro[t]=new ca(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ro[t]=new ca(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ro[t]=new ca(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ro[t]=new ca(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ro[t]=new ca(t,5,!1,t.toLowerCase(),null,!1,!1)});var $A=/[\-:]([a-z])/g;function GA(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace($A,GA);Ro[e]=new ca(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace($A,GA);Ro[e]=new ca(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace($A,GA);Ro[e]=new ca(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ro[t]=new ca(t,1,!1,t.toLowerCase(),null,!1,!1)});Ro.xlinkHref=new ca("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ro[t]=new ca(t,1,!1,t.toLowerCase(),null,!0,!0)});function HA(t,e,s,u){var h=Ro.hasOwnProperty(e)?Ro[e]:null;(h!==null?h.type!==0:u||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(zG(e,s,h,u)&&(s=null),u||h===null?LG(e)&&(s===null?t.removeAttribute(e):t.setAttribute(e,""+s)):h.mustUseProperty?t[h.propertyName]=s===null?h.type===3?!1:"":s:(e=h.attributeName,u=h.attributeNamespace,s===null?t.removeAttribute(e):(h=h.type,s=h===3||h===4&&s===!0?"":""+s,u?t.setAttributeNS(u,e,s):t.setAttribute(e,s))))}var $u=RG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Bw=Symbol.for("react.element"),Ym=Symbol.for("react.portal"),Jm=Symbol.for("react.fragment"),WA=Symbol.for("react.strict_mode"),FE=Symbol.for("react.profiler"),SF=Symbol.for("react.provider"),TF=Symbol.for("react.context"),qA=Symbol.for("react.forward_ref"),BE=Symbol.for("react.suspense"),NE=Symbol.for("react.suspense_list"),KA=Symbol.for("react.memo"),Dd=Symbol.for("react.lazy"),EF=Symbol.for("react.offscreen"),GD=Symbol.iterator;function rv(t){return t===null||typeof t!="object"?null:(t=GD&&t[GD]||t["@@iterator"],typeof t=="function"?t:null)}var ws=Object.assign,x2;function gv(t){if(x2===void 0)try{throw Error()}catch(s){var e=s.stack.trim().match(/\n( *(at )?)/);x2=e&&e[1]||""}return`
|
||
`+x2+t}var w2=!1;function b2(t,e){if(!t||w2)return"";w2=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(P){var u=P}Reflect.construct(t,[],e)}else{try{e.call()}catch(P){u=P}t.call(e.prototype)}else{try{throw Error()}catch(P){u=P}t()}}catch(P){if(P&&u&&typeof P.stack=="string"){for(var h=P.stack.split(`
|
||
`),_=u.stack.split(`
|
||
`),w=h.length-1,o=_.length-1;1<=w&&0<=o&&h[w]!==_[o];)o--;for(;1<=w&&0<=o;w--,o--)if(h[w]!==_[o]){if(w!==1||o!==1)do if(w--,o--,0>o||h[w]!==_[o]){var k=`
|
||
`+h[w].replace(" at new "," at ");return t.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",t.displayName)),k}while(1<=w&&0<=o);break}}}finally{w2=!1,Error.prepareStackTrace=s}return(t=t?t.displayName||t.name:"")?gv(t):""}function FG(t){switch(t.tag){case 5:return gv(t.type);case 16:return gv("Lazy");case 13:return gv("Suspense");case 19:return gv("SuspenseList");case 0:case 2:case 15:return t=b2(t.type,!1),t;case 11:return t=b2(t.type.render,!1),t;case 1:return t=b2(t.type,!0),t;default:return""}}function jE(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Jm:return"Fragment";case Ym:return"Portal";case FE:return"Profiler";case WA:return"StrictMode";case BE:return"Suspense";case NE:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case TF:return(t.displayName||"Context")+".Consumer";case SF:return(t._context.displayName||"Context")+".Provider";case qA:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case KA:return e=t.displayName||null,e!==null?e:jE(t.type)||"Memo";case Dd:e=t._payload,t=t._init;try{return jE(t(e))}catch{}}return null}function BG(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return jE(e);case 8:return e===WA?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function nh(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function kF(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function NG(t){var e=kF(t)?"checked":"value",s=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),u=""+t[e];if(!t.hasOwnProperty(e)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,_=s.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return h.call(this)},set:function(w){u=""+w,_.call(this,w)}}),Object.defineProperty(t,e,{enumerable:s.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Nw(t){t._valueTracker||(t._valueTracker=NG(t))}function AF(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var s=e.getValue(),u="";return t&&(u=kF(t)?t.checked?"true":"false":t.value),t=u,t!==s?(e.setValue(t),!0):!1}function Gb(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function VE(t,e){var s=e.checked;return ws({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??t._wrapperState.initialChecked})}function HD(t,e){var s=e.defaultValue==null?"":e.defaultValue,u=e.checked!=null?e.checked:e.defaultChecked;s=nh(e.value!=null?e.value:s),t._wrapperState={initialChecked:u,initialValue:s,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function CF(t,e){e=e.checked,e!=null&&HA(t,"checked",e,!1)}function UE(t,e){CF(t,e);var s=nh(e.value),u=e.type;if(s!=null)u==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+s):t.value!==""+s&&(t.value=""+s);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?$E(t,e.type,s):e.hasOwnProperty("defaultValue")&&$E(t,e.type,nh(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function WD(t,e,s){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var u=e.type;if(!(u!=="submit"&&u!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,s||e===t.value||(t.value=e),t.defaultValue=e}s=t.name,s!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,s!==""&&(t.name=s)}function $E(t,e,s){(e!=="number"||Gb(t.ownerDocument)!==t)&&(s==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+s&&(t.defaultValue=""+s))}var _v=Array.isArray;function mg(t,e,s,u){if(t=t.options,e){e={};for(var h=0;h<s.length;h++)e["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=e.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&u&&(t[s].defaultSelected=!0)}else{for(s=""+nh(s),e=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,u&&(t[h].defaultSelected=!0);return}e!==null||t[h].disabled||(e=t[h])}e!==null&&(e.selected=!0)}}function GE(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(ir(91));return ws({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function qD(t,e){var s=e.value;if(s==null){if(s=e.children,e=e.defaultValue,s!=null){if(e!=null)throw Error(ir(92));if(_v(s)){if(1<s.length)throw Error(ir(93));s=s[0]}e=s}e==null&&(e=""),s=e}t._wrapperState={initialValue:nh(s)}}function IF(t,e){var s=nh(e.value),u=nh(e.defaultValue);s!=null&&(s=""+s,s!==t.value&&(t.value=s),e.defaultValue==null&&t.defaultValue!==s&&(t.defaultValue=s)),u!=null&&(t.defaultValue=""+u)}function KD(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function PF(t){switch(t){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 HE(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?PF(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var jw,MF=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,s,u,h){MSApp.execUnsafeLocalFunction(function(){return t(e,s,u,h)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(jw=jw||document.createElement("div"),jw.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=jw.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Vv(t,e){if(e){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=e;return}}t.textContent=e}var bv={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},jG=["Webkit","ms","Moz","O"];Object.keys(bv).forEach(function(t){jG.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),bv[e]=bv[t]})});function RF(t,e,s){return e==null||typeof e=="boolean"||e===""?"":s||typeof e!="number"||e===0||bv.hasOwnProperty(t)&&bv[t]?(""+e).trim():e+"px"}function DF(t,e){t=t.style;for(var s in e)if(e.hasOwnProperty(s)){var u=s.indexOf("--")===0,h=RF(s,e[s],u);s==="float"&&(s="cssFloat"),u?t.setProperty(s,h):t[s]=h}}var VG=ws({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 WE(t,e){if(e){if(VG[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ir(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ir(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ir(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ir(62))}}function qE(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var KE=null;function ZA(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ZE=null,gg=null,_g=null;function ZD(t){if(t=I0(t)){if(typeof ZE!="function")throw Error(ir(280));var e=t.stateNode;e&&(e=j1(e),ZE(t.stateNode,t.type,e))}}function LF(t){gg?_g?_g.push(t):_g=[t]:gg=t}function OF(){if(gg){var t=gg,e=_g;if(_g=gg=null,ZD(t),e)for(t=0;t<e.length;t++)ZD(e[t])}}function zF(t,e){return t(e)}function FF(){}var S2=!1;function BF(t,e,s){if(S2)return t(e,s);S2=!0;try{return zF(t,e,s)}finally{S2=!1,(gg!==null||_g!==null)&&(FF(),OF())}}function Uv(t,e){var s=t.stateNode;if(s===null)return null;var u=j1(s);if(u===null)return null;s=u[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(ir(231,e,typeof s));return s}var XE=!1;if(Lu)try{var nv={};Object.defineProperty(nv,"passive",{get:function(){XE=!0}}),window.addEventListener("test",nv,nv),window.removeEventListener("test",nv,nv)}catch{XE=!1}function UG(t,e,s,u,h,_,w,o,k){var P=Array.prototype.slice.call(arguments,3);try{e.apply(s,P)}catch(O){this.onError(O)}}var Sv=!1,Hb=null,Wb=!1,YE=null,$G={onError:function(t){Sv=!0,Hb=t}};function GG(t,e,s,u,h,_,w,o,k){Sv=!1,Hb=null,UG.apply($G,arguments)}function HG(t,e,s,u,h,_,w,o,k){if(GG.apply(this,arguments),Sv){if(Sv){var P=Hb;Sv=!1,Hb=null}else throw Error(ir(198));Wb||(Wb=!0,YE=P)}}function Hf(t){var e=t,s=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(s=e.return),t=e.return;while(t)}return e.tag===3?s:null}function NF(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function XD(t){if(Hf(t)!==t)throw Error(ir(188))}function WG(t){var e=t.alternate;if(!e){if(e=Hf(t),e===null)throw Error(ir(188));return e!==t?null:t}for(var s=t,u=e;;){var h=s.return;if(h===null)break;var _=h.alternate;if(_===null){if(u=h.return,u!==null){s=u;continue}break}if(h.child===_.child){for(_=h.child;_;){if(_===s)return XD(h),t;if(_===u)return XD(h),e;_=_.sibling}throw Error(ir(188))}if(s.return!==u.return)s=h,u=_;else{for(var w=!1,o=h.child;o;){if(o===s){w=!0,s=h,u=_;break}if(o===u){w=!0,u=h,s=_;break}o=o.sibling}if(!w){for(o=_.child;o;){if(o===s){w=!0,s=_,u=h;break}if(o===u){w=!0,u=_,s=h;break}o=o.sibling}if(!w)throw Error(ir(189))}}if(s.alternate!==u)throw Error(ir(190))}if(s.tag!==3)throw Error(ir(188));return s.stateNode.current===s?t:e}function jF(t){return t=WG(t),t!==null?VF(t):null}function VF(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=VF(t);if(e!==null)return e;t=t.sibling}return null}var UF=Xa.unstable_scheduleCallback,YD=Xa.unstable_cancelCallback,qG=Xa.unstable_shouldYield,KG=Xa.unstable_requestPaint,Ds=Xa.unstable_now,ZG=Xa.unstable_getCurrentPriorityLevel,XA=Xa.unstable_ImmediatePriority,$F=Xa.unstable_UserBlockingPriority,qb=Xa.unstable_NormalPriority,XG=Xa.unstable_LowPriority,GF=Xa.unstable_IdlePriority,z1=null,Hc=null;function YG(t){if(Hc&&typeof Hc.onCommitFiberRoot=="function")try{Hc.onCommitFiberRoot(z1,t,void 0,(t.current.flags&128)===128)}catch{}}var lc=Math.clz32?Math.clz32:eH,JG=Math.log,QG=Math.LN2;function eH(t){return t>>>=0,t===0?32:31-(JG(t)/QG|0)|0}var Vw=64,Uw=4194304;function yv(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Kb(t,e){var s=t.pendingLanes;if(s===0)return 0;var u=0,h=t.suspendedLanes,_=t.pingedLanes,w=s&268435455;if(w!==0){var o=w&~h;o!==0?u=yv(o):(_&=w,_!==0&&(u=yv(_)))}else w=s&~h,w!==0?u=yv(w):_!==0&&(u=yv(_));if(u===0)return 0;if(e!==0&&e!==u&&!(e&h)&&(h=u&-u,_=e&-e,h>=_||h===16&&(_&4194240)!==0))return e;if(u&4&&(u|=s&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=u;0<e;)s=31-lc(e),h=1<<s,u|=t[s],e&=~h;return u}function tH(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 rH(t,e){for(var s=t.suspendedLanes,u=t.pingedLanes,h=t.expirationTimes,_=t.pendingLanes;0<_;){var w=31-lc(_),o=1<<w,k=h[w];k===-1?(!(o&s)||o&u)&&(h[w]=tH(o,e)):k<=e&&(t.expiredLanes|=o),_&=~o}}function JE(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function HF(){var t=Vw;return Vw<<=1,!(Vw&4194240)&&(Vw=64),t}function T2(t){for(var e=[],s=0;31>s;s++)e.push(t);return e}function A0(t,e,s){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-lc(e),t[e]=s}function nH(t,e){var s=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<s;){var h=31-lc(s),_=1<<h;e[h]=0,u[h]=-1,t[h]=-1,s&=~_}}function YA(t,e){var s=t.entangledLanes|=e;for(t=t.entanglements;s;){var u=31-lc(s),h=1<<u;h&e|t[u]&e&&(t[u]|=e),s&=~h}}var Ii=0;function WF(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var qF,JA,KF,ZF,XF,QE=!1,$w=[],Kd=null,Zd=null,Xd=null,$v=new Map,Gv=new Map,zd=[],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 JD(t,e){switch(t){case"focusin":case"focusout":Kd=null;break;case"dragenter":case"dragleave":Zd=null;break;case"mouseover":case"mouseout":Xd=null;break;case"pointerover":case"pointerout":$v.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gv.delete(e.pointerId)}}function iv(t,e,s,u,h,_){return t===null||t.nativeEvent!==_?(t={blockedOn:e,domEventName:s,eventSystemFlags:u,nativeEvent:_,targetContainers:[h]},e!==null&&(e=I0(e),e!==null&&JA(e)),t):(t.eventSystemFlags|=u,e=t.targetContainers,h!==null&&e.indexOf(h)===-1&&e.push(h),t)}function sH(t,e,s,u,h){switch(e){case"focusin":return Kd=iv(Kd,t,e,s,u,h),!0;case"dragenter":return Zd=iv(Zd,t,e,s,u,h),!0;case"mouseover":return Xd=iv(Xd,t,e,s,u,h),!0;case"pointerover":var _=h.pointerId;return $v.set(_,iv($v.get(_)||null,t,e,s,u,h)),!0;case"gotpointercapture":return _=h.pointerId,Gv.set(_,iv(Gv.get(_)||null,t,e,s,u,h)),!0}return!1}function YF(t){var e=vf(t.target);if(e!==null){var s=Hf(e);if(s!==null){if(e=s.tag,e===13){if(e=NF(s),e!==null){t.blockedOn=e,XF(t.priority,function(){KF(s)});return}}else if(e===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function bb(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var s=ek(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(s===null){s=t.nativeEvent;var u=new s.constructor(s.type,s);KE=u,s.target.dispatchEvent(u),KE=null}else return e=I0(s),e!==null&&JA(e),t.blockedOn=s,!1;e.shift()}return!0}function QD(t,e,s){bb(t)&&s.delete(e)}function oH(){QE=!1,Kd!==null&&bb(Kd)&&(Kd=null),Zd!==null&&bb(Zd)&&(Zd=null),Xd!==null&&bb(Xd)&&(Xd=null),$v.forEach(QD),Gv.forEach(QD)}function sv(t,e){t.blockedOn===e&&(t.blockedOn=null,QE||(QE=!0,Xa.unstable_scheduleCallback(Xa.unstable_NormalPriority,oH)))}function Hv(t){function e(h){return sv(h,t)}if(0<$w.length){sv($w[0],t);for(var s=1;s<$w.length;s++){var u=$w[s];u.blockedOn===t&&(u.blockedOn=null)}}for(Kd!==null&&sv(Kd,t),Zd!==null&&sv(Zd,t),Xd!==null&&sv(Xd,t),$v.forEach(e),Gv.forEach(e),s=0;s<zd.length;s++)u=zd[s],u.blockedOn===t&&(u.blockedOn=null);for(;0<zd.length&&(s=zd[0],s.blockedOn===null);)YF(s),s.blockedOn===null&&zd.shift()}var yg=$u.ReactCurrentBatchConfig,Zb=!0;function aH(t,e,s,u){var h=Ii,_=yg.transition;yg.transition=null;try{Ii=1,QA(t,e,s,u)}finally{Ii=h,yg.transition=_}}function lH(t,e,s,u){var h=Ii,_=yg.transition;yg.transition=null;try{Ii=4,QA(t,e,s,u)}finally{Ii=h,yg.transition=_}}function QA(t,e,s,u){if(Zb){var h=ek(t,e,s,u);if(h===null)L2(t,e,u,Xb,s),JD(t,u);else if(sH(h,t,e,s,u))u.stopPropagation();else if(JD(t,u),e&4&&-1<iH.indexOf(t)){for(;h!==null;){var _=I0(h);if(_!==null&&qF(_),_=ek(t,e,s,u),_===null&&L2(t,e,u,Xb,s),_===h)break;h=_}h!==null&&u.stopPropagation()}else L2(t,e,u,null,s)}}var Xb=null;function ek(t,e,s,u){if(Xb=null,t=ZA(u),t=vf(t),t!==null)if(e=Hf(t),e===null)t=null;else if(s=e.tag,s===13){if(t=NF(e),t!==null)return t;t=null}else if(s===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Xb=t,null}function JF(t){switch(t){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(ZG()){case XA:return 1;case $F:return 4;case qb:case XG:return 16;case GF:return 536870912;default:return 16}default:return 16}}var Gd=null,eC=null,Sb=null;function QF(){if(Sb)return Sb;var t,e=eC,s=e.length,u,h="value"in Gd?Gd.value:Gd.textContent,_=h.length;for(t=0;t<s&&e[t]===h[t];t++);var w=s-t;for(u=1;u<=w&&e[s-u]===h[_-u];u++);return Sb=h.slice(t,1<u?1-u:void 0)}function Tb(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Gw(){return!0}function eL(){return!1}function Ja(t){function e(s,u,h,_,w){this._reactName=s,this._targetInst=h,this.type=u,this.nativeEvent=_,this.target=w,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(s=t[o],this[o]=s?s(_):_[o]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Gw:eL,this.isPropagationStopped=eL,this}return ws(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Gw)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Gw)},persist:function(){},isPersistent:Gw}),e}var qg={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tC=Ja(qg),C0=ws({},qg,{view:0,detail:0}),cH=Ja(C0),E2,k2,ov,F1=ws({},C0,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rC,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ov&&(ov&&t.type==="mousemove"?(E2=t.screenX-ov.screenX,k2=t.screenY-ov.screenY):k2=E2=0,ov=t),E2)},movementY:function(t){return"movementY"in t?t.movementY:k2}}),tL=Ja(F1),uH=ws({},F1,{dataTransfer:0}),dH=Ja(uH),hH=ws({},C0,{relatedTarget:0}),A2=Ja(hH),fH=ws({},qg,{animationName:0,elapsedTime:0,pseudoElement:0}),pH=Ja(fH),mH=ws({},qg,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),gH=Ja(mH),_H=ws({},qg,{data:0}),rL=Ja(_H),yH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vH={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"},xH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wH(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=xH[t])?!!e[t]:!1}function rC(){return wH}var bH=ws({},C0,{key:function(t){if(t.key){var e=yH[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Tb(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?vH[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rC,charCode:function(t){return t.type==="keypress"?Tb(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Tb(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),SH=Ja(bH),TH=ws({},F1,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nL=Ja(TH),EH=ws({},C0,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rC}),kH=Ja(EH),AH=ws({},qg,{propertyName:0,elapsedTime:0,pseudoElement:0}),CH=Ja(AH),IH=ws({},F1,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),PH=Ja(IH),MH=[9,13,27,32],nC=Lu&&"CompositionEvent"in window,Tv=null;Lu&&"documentMode"in document&&(Tv=document.documentMode);var RH=Lu&&"TextEvent"in window&&!Tv,e5=Lu&&(!nC||Tv&&8<Tv&&11>=Tv),iL=" ",sL=!1;function t5(t,e){switch(t){case"keyup":return MH.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r5(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Qm=!1;function DH(t,e){switch(t){case"compositionend":return r5(e);case"keypress":return e.which!==32?null:(sL=!0,iL);case"textInput":return t=e.data,t===iL&&sL?null:t;default:return null}}function LH(t,e){if(Qm)return t==="compositionend"||!nC&&t5(t,e)?(t=QF(),Sb=eC=Gd=null,Qm=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return e5&&e.locale!=="ko"?null:e.data;default:return null}}var OH={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 oL(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!OH[t.type]:e==="textarea"}function n5(t,e,s,u){LF(u),e=Yb(e,"onChange"),0<e.length&&(s=new tC("onChange","change",null,s,u),t.push({event:s,listeners:e}))}var Ev=null,Wv=null;function zH(t){p5(t,0)}function B1(t){var e=rg(t);if(AF(e))return t}function FH(t,e){if(t==="change")return e}var i5=!1;if(Lu){var C2;if(Lu){var I2="oninput"in document;if(!I2){var aL=document.createElement("div");aL.setAttribute("oninput","return;"),I2=typeof aL.oninput=="function"}C2=I2}else C2=!1;i5=C2&&(!document.documentMode||9<document.documentMode)}function lL(){Ev&&(Ev.detachEvent("onpropertychange",s5),Wv=Ev=null)}function s5(t){if(t.propertyName==="value"&&B1(Wv)){var e=[];n5(e,Wv,t,ZA(t)),BF(zH,e)}}function BH(t,e,s){t==="focusin"?(lL(),Ev=e,Wv=s,Ev.attachEvent("onpropertychange",s5)):t==="focusout"&&lL()}function NH(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return B1(Wv)}function jH(t,e){if(t==="click")return B1(e)}function VH(t,e){if(t==="input"||t==="change")return B1(e)}function UH(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var uc=typeof Object.is=="function"?Object.is:UH;function qv(t,e){if(uc(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var s=Object.keys(t),u=Object.keys(e);if(s.length!==u.length)return!1;for(u=0;u<s.length;u++){var h=s[u];if(!zE.call(e,h)||!uc(t[h],e[h]))return!1}return!0}function cL(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function uL(t,e){var s=cL(t);t=0;for(var u;s;){if(s.nodeType===3){if(u=t+s.textContent.length,t<=e&&u>=e)return{node:s,offset:e-t};t=u}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=cL(s)}}function o5(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?o5(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function a5(){for(var t=window,e=Gb();e instanceof t.HTMLIFrameElement;){try{var s=typeof e.contentWindow.location.href=="string"}catch{s=!1}if(s)t=e.contentWindow;else break;e=Gb(t.document)}return e}function iC(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function $H(t){var e=a5(),s=t.focusedElem,u=t.selectionRange;if(e!==s&&s&&s.ownerDocument&&o5(s.ownerDocument.documentElement,s)){if(u!==null&&iC(s)){if(e=u.start,t=u.end,t===void 0&&(t=e),"selectionStart"in s)s.selectionStart=e,s.selectionEnd=Math.min(t,s.value.length);else if(t=(e=s.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var h=s.textContent.length,_=Math.min(u.start,h);u=u.end===void 0?_:Math.min(u.end,h),!t.extend&&_>u&&(h=u,u=_,_=h),h=uL(s,_);var w=uL(s,u);h&&w&&(t.rangeCount!==1||t.anchorNode!==h.node||t.anchorOffset!==h.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(e=e.createRange(),e.setStart(h.node,h.offset),t.removeAllRanges(),_>u?(t.addRange(e),t.extend(w.node,w.offset)):(e.setEnd(w.node,w.offset),t.addRange(e)))}}for(e=[],t=s;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<e.length;s++)t=e[s],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var GH=Lu&&"documentMode"in document&&11>=document.documentMode,eg=null,tk=null,kv=null,rk=!1;function dL(t,e,s){var u=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;rk||eg==null||eg!==Gb(u)||(u=eg,"selectionStart"in u&&iC(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),kv&&qv(kv,u)||(kv=u,u=Yb(tk,"onSelect"),0<u.length&&(e=new tC("onSelect","select",null,e,s),t.push({event:e,listeners:u}),e.target=eg)))}function Hw(t,e){var s={};return s[t.toLowerCase()]=e.toLowerCase(),s["Webkit"+t]="webkit"+e,s["Moz"+t]="moz"+e,s}var tg={animationend:Hw("Animation","AnimationEnd"),animationiteration:Hw("Animation","AnimationIteration"),animationstart:Hw("Animation","AnimationStart"),transitionend:Hw("Transition","TransitionEnd")},P2={},l5={};Lu&&(l5=document.createElement("div").style,"AnimationEvent"in window||(delete tg.animationend.animation,delete tg.animationiteration.animation,delete tg.animationstart.animation),"TransitionEvent"in window||delete tg.transitionend.transition);function N1(t){if(P2[t])return P2[t];if(!tg[t])return t;var e=tg[t],s;for(s in e)if(e.hasOwnProperty(s)&&s in l5)return P2[t]=e[s];return t}var c5=N1("animationend"),u5=N1("animationiteration"),d5=N1("animationstart"),h5=N1("transitionend"),f5=new Map,hL="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 ch(t,e){f5.set(t,e),Gf(e,[t])}for(var M2=0;M2<hL.length;M2++){var R2=hL[M2],HH=R2.toLowerCase(),WH=R2[0].toUpperCase()+R2.slice(1);ch(HH,"on"+WH)}ch(c5,"onAnimationEnd");ch(u5,"onAnimationIteration");ch(d5,"onAnimationStart");ch("dblclick","onDoubleClick");ch("focusin","onFocus");ch("focusout","onBlur");ch(h5,"onTransitionEnd");Lg("onMouseEnter",["mouseout","mouseover"]);Lg("onMouseLeave",["mouseout","mouseover"]);Lg("onPointerEnter",["pointerout","pointerover"]);Lg("onPointerLeave",["pointerout","pointerover"]);Gf("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Gf("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Gf("onBeforeInput",["compositionend","keypress","textInput","paste"]);Gf("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Gf("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Gf("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vv="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(" "),qH=new Set("cancel close invalid load scroll toggle".split(" ").concat(vv));function fL(t,e,s){var u=t.type||"unknown-event";t.currentTarget=s,HG(u,e,void 0,t),t.currentTarget=null}function p5(t,e){e=(e&4)!==0;for(var s=0;s<t.length;s++){var u=t[s],h=u.event;u=u.listeners;e:{var _=void 0;if(e)for(var w=u.length-1;0<=w;w--){var o=u[w],k=o.instance,P=o.currentTarget;if(o=o.listener,k!==_&&h.isPropagationStopped())break e;fL(h,o,P),_=k}else for(w=0;w<u.length;w++){if(o=u[w],k=o.instance,P=o.currentTarget,o=o.listener,k!==_&&h.isPropagationStopped())break e;fL(h,o,P),_=k}}}if(Wb)throw t=YE,Wb=!1,YE=null,t}function es(t,e){var s=e[ak];s===void 0&&(s=e[ak]=new Set);var u=t+"__bubble";s.has(u)||(m5(e,t,2,!1),s.add(u))}function D2(t,e,s){var u=0;e&&(u|=4),m5(s,t,u,e)}var Ww="_reactListening"+Math.random().toString(36).slice(2);function Kv(t){if(!t[Ww]){t[Ww]=!0,bF.forEach(function(s){s!=="selectionchange"&&(qH.has(s)||D2(s,!1,t),D2(s,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Ww]||(e[Ww]=!0,D2("selectionchange",!1,e))}}function m5(t,e,s,u){switch(JF(e)){case 1:var h=aH;break;case 4:h=lH;break;default:h=QA}s=h.bind(null,e,s,t),h=void 0,!XE||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(h=!0),u?h!==void 0?t.addEventListener(e,s,{capture:!0,passive:h}):t.addEventListener(e,s,!0):h!==void 0?t.addEventListener(e,s,{passive:h}):t.addEventListener(e,s,!1)}function L2(t,e,s,u,h){var _=u;if(!(e&1)&&!(e&2)&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var o=u.stateNode.containerInfo;if(o===h||o.nodeType===8&&o.parentNode===h)break;if(w===4)for(w=u.return;w!==null;){var k=w.tag;if((k===3||k===4)&&(k=w.stateNode.containerInfo,k===h||k.nodeType===8&&k.parentNode===h))return;w=w.return}for(;o!==null;){if(w=vf(o),w===null)return;if(k=w.tag,k===5||k===6){u=_=w;continue e}o=o.parentNode}}u=u.return}BF(function(){var P=_,O=ZA(s),F=[];e:{var V=f5.get(t);if(V!==void 0){var $=tC,Y=t;switch(t){case"keypress":if(Tb(s)===0)break e;case"keydown":case"keyup":$=SH;break;case"focusin":Y="focus",$=A2;break;case"focusout":Y="blur",$=A2;break;case"beforeblur":case"afterblur":$=A2;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":$=tL;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=dH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=kH;break;case c5:case u5:case d5:$=pH;break;case h5:$=CH;break;case"scroll":$=cH;break;case"wheel":$=PH;break;case"copy":case"cut":case"paste":$=gH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=nL}var Z=(e&4)!==0,se=!Z&&t==="scroll",te=Z?V!==null?V+"Capture":null:V;Z=[];for(var ee=P,oe;ee!==null;){oe=ee;var he=oe.stateNode;if(oe.tag===5&&he!==null&&(oe=he,te!==null&&(he=Uv(ee,te),he!=null&&Z.push(Zv(ee,he,oe)))),se)break;ee=ee.return}0<Z.length&&(V=new $(V,Y,null,s,O),F.push({event:V,listeners:Z}))}}if(!(e&7)){e:{if(V=t==="mouseover"||t==="pointerover",$=t==="mouseout"||t==="pointerout",V&&s!==KE&&(Y=s.relatedTarget||s.fromElement)&&(vf(Y)||Y[Ou]))break e;if(($||V)&&(V=O.window===O?O:(V=O.ownerDocument)?V.defaultView||V.parentWindow:window,$?(Y=s.relatedTarget||s.toElement,$=P,Y=Y?vf(Y):null,Y!==null&&(se=Hf(Y),Y!==se||Y.tag!==5&&Y.tag!==6)&&(Y=null)):($=null,Y=P),$!==Y)){if(Z=tL,he="onMouseLeave",te="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(Z=nL,he="onPointerLeave",te="onPointerEnter",ee="pointer"),se=$==null?V:rg($),oe=Y==null?V:rg(Y),V=new Z(he,ee+"leave",$,s,O),V.target=se,V.relatedTarget=oe,he=null,vf(O)===P&&(Z=new Z(te,ee+"enter",Y,s,O),Z.target=oe,Z.relatedTarget=se,he=Z),se=he,$&&Y)t:{for(Z=$,te=Y,ee=0,oe=Z;oe;oe=Lm(oe))ee++;for(oe=0,he=te;he;he=Lm(he))oe++;for(;0<ee-oe;)Z=Lm(Z),ee--;for(;0<oe-ee;)te=Lm(te),oe--;for(;ee--;){if(Z===te||te!==null&&Z===te.alternate)break t;Z=Lm(Z),te=Lm(te)}Z=null}else Z=null;$!==null&&pL(F,V,$,Z,!1),Y!==null&&se!==null&&pL(F,se,Y,Z,!0)}}e:{if(V=P?rg(P):window,$=V.nodeName&&V.nodeName.toLowerCase(),$==="select"||$==="input"&&V.type==="file")var Ie=FH;else if(oL(V))if(i5)Ie=VH;else{Ie=NH;var Be=BH}else($=V.nodeName)&&$.toLowerCase()==="input"&&(V.type==="checkbox"||V.type==="radio")&&(Ie=jH);if(Ie&&(Ie=Ie(t,P))){n5(F,Ie,s,O);break e}Be&&Be(t,V,P),t==="focusout"&&(Be=V._wrapperState)&&Be.controlled&&V.type==="number"&&$E(V,"number",V.value)}switch(Be=P?rg(P):window,t){case"focusin":(oL(Be)||Be.contentEditable==="true")&&(eg=Be,tk=P,kv=null);break;case"focusout":kv=tk=eg=null;break;case"mousedown":rk=!0;break;case"contextmenu":case"mouseup":case"dragend":rk=!1,dL(F,s,O);break;case"selectionchange":if(GH)break;case"keydown":case"keyup":dL(F,s,O)}var je;if(nC)e:{switch(t){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else Qm?t5(t,s)&&(Je="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Je="onCompositionStart");Je&&(e5&&s.locale!=="ko"&&(Qm||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&Qm&&(je=QF()):(Gd=O,eC="value"in Gd?Gd.value:Gd.textContent,Qm=!0)),Be=Yb(P,Je),0<Be.length&&(Je=new rL(Je,t,null,s,O),F.push({event:Je,listeners:Be}),je?Je.data=je:(je=r5(s),je!==null&&(Je.data=je)))),(je=RH?DH(t,s):LH(t,s))&&(P=Yb(P,"onBeforeInput"),0<P.length&&(O=new rL("onBeforeInput","beforeinput",null,s,O),F.push({event:O,listeners:P}),O.data=je))}p5(F,e)})}function Zv(t,e,s){return{instance:t,listener:e,currentTarget:s}}function Yb(t,e){for(var s=e+"Capture",u=[];t!==null;){var h=t,_=h.stateNode;h.tag===5&&_!==null&&(h=_,_=Uv(t,s),_!=null&&u.unshift(Zv(t,_,h)),_=Uv(t,e),_!=null&&u.push(Zv(t,_,h))),t=t.return}return u}function Lm(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function pL(t,e,s,u,h){for(var _=e._reactName,w=[];s!==null&&s!==u;){var o=s,k=o.alternate,P=o.stateNode;if(k!==null&&k===u)break;o.tag===5&&P!==null&&(o=P,h?(k=Uv(s,_),k!=null&&w.unshift(Zv(s,k,o))):h||(k=Uv(s,_),k!=null&&w.push(Zv(s,k,o)))),s=s.return}w.length!==0&&t.push({event:e,listeners:w})}var KH=/\r\n?/g,ZH=/\u0000|\uFFFD/g;function mL(t){return(typeof t=="string"?t:""+t).replace(KH,`
|
||
`).replace(ZH,"")}function qw(t,e,s){if(e=mL(e),mL(t)!==e&&s)throw Error(ir(425))}function Jb(){}var nk=null,ik=null;function sk(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ok=typeof setTimeout=="function"?setTimeout:void 0,XH=typeof clearTimeout=="function"?clearTimeout:void 0,gL=typeof Promise=="function"?Promise:void 0,YH=typeof queueMicrotask=="function"?queueMicrotask:typeof gL<"u"?function(t){return gL.resolve(null).then(t).catch(JH)}:ok;function JH(t){setTimeout(function(){throw t})}function O2(t,e){var s=e,u=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"){if(u===0){t.removeChild(h),Hv(e);return}u--}else s!=="$"&&s!=="$?"&&s!=="$!"||u++;s=h}while(s);Hv(e)}function Yd(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function _L(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"){if(e===0)return t;e--}else s==="/$"&&e++}t=t.previousSibling}return null}var Kg=Math.random().toString(36).slice(2),Vc="__reactFiber$"+Kg,Xv="__reactProps$"+Kg,Ou="__reactContainer$"+Kg,ak="__reactEvents$"+Kg,QH="__reactListeners$"+Kg,eW="__reactHandles$"+Kg;function vf(t){var e=t[Vc];if(e)return e;for(var s=t.parentNode;s;){if(e=s[Ou]||s[Vc]){if(s=e.alternate,e.child!==null||s!==null&&s.child!==null)for(t=_L(t);t!==null;){if(s=t[Vc])return s;t=_L(t)}return e}t=s,s=t.parentNode}return null}function I0(t){return t=t[Vc]||t[Ou],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function rg(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(ir(33))}function j1(t){return t[Xv]||null}var lk=[],ng=-1;function uh(t){return{current:t}}function ts(t){0>ng||(t.current=lk[ng],lk[ng]=null,ng--)}function Wi(t,e){ng++,lk[ng]=t.current,t.current=e}var ih={},Go=uh(ih),Aa=uh(!1),zf=ih;function Og(t,e){var s=t.type.contextTypes;if(!s)return ih;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===e)return u.__reactInternalMemoizedMaskedChildContext;var h={},_;for(_ in s)h[_]=e[_];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=h),h}function Ca(t){return t=t.childContextTypes,t!=null}function Qb(){ts(Aa),ts(Go)}function yL(t,e,s){if(Go.current!==ih)throw Error(ir(168));Wi(Go,e),Wi(Aa,s)}function g5(t,e,s){var u=t.stateNode;if(e=e.childContextTypes,typeof u.getChildContext!="function")return s;u=u.getChildContext();for(var h in u)if(!(h in e))throw Error(ir(108,BG(t)||"Unknown",h));return ws({},s,u)}function e1(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||ih,zf=Go.current,Wi(Go,t),Wi(Aa,Aa.current),!0}function vL(t,e,s){var u=t.stateNode;if(!u)throw Error(ir(169));s?(t=g5(t,e,zf),u.__reactInternalMemoizedMergedChildContext=t,ts(Aa),ts(Go),Wi(Go,t)):ts(Aa),Wi(Aa,s)}var Iu=null,V1=!1,z2=!1;function _5(t){Iu===null?Iu=[t]:Iu.push(t)}function tW(t){V1=!0,_5(t)}function dh(){if(!z2&&Iu!==null){z2=!0;var t=0,e=Ii;try{var s=Iu;for(Ii=1;t<s.length;t++){var u=s[t];do u=u(!0);while(u!==null)}Iu=null,V1=!1}catch(h){throw Iu!==null&&(Iu=Iu.slice(t+1)),UF(XA,dh),h}finally{Ii=e,z2=!1}}return null}var ig=[],sg=0,t1=null,r1=0,_l=[],yl=0,Ff=null,Mu=1,Ru="";function hf(t,e){ig[sg++]=r1,ig[sg++]=t1,t1=t,r1=e}function y5(t,e,s){_l[yl++]=Mu,_l[yl++]=Ru,_l[yl++]=Ff,Ff=t;var u=Mu;t=Ru;var h=32-lc(u)-1;u&=~(1<<h),s+=1;var _=32-lc(e)+h;if(30<_){var w=h-h%5;_=(u&(1<<w)-1).toString(32),u>>=w,h-=w,Mu=1<<32-lc(e)+h|s<<h|u,Ru=_+t}else Mu=1<<_|s<<h|u,Ru=t}function sC(t){t.return!==null&&(hf(t,1),y5(t,1,0))}function oC(t){for(;t===t1;)t1=ig[--sg],ig[sg]=null,r1=ig[--sg],ig[sg]=null;for(;t===Ff;)Ff=_l[--yl],_l[yl]=null,Ru=_l[--yl],_l[yl]=null,Mu=_l[--yl],_l[yl]=null}var Ka=null,qa=null,as=!1,ac=null;function v5(t,e){var s=vl(5,null,null,0);s.elementType="DELETED",s.stateNode=e,s.return=t,e=t.deletions,e===null?(t.deletions=[s],t.flags|=16):e.push(s)}function xL(t,e){switch(t.tag){case 5:var s=t.type;return e=e.nodeType!==1||s.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ka=t,qa=Yd(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ka=t,qa=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(s=Ff!==null?{id:Mu,overflow:Ru}:null,t.memoizedState={dehydrated:e,treeContext:s,retryLane:1073741824},s=vl(18,null,null,0),s.stateNode=e,s.return=t,t.child=s,Ka=t,qa=null,!0):!1;default:return!1}}function ck(t){return(t.mode&1)!==0&&(t.flags&128)===0}function uk(t){if(as){var e=qa;if(e){var s=e;if(!xL(t,e)){if(ck(t))throw Error(ir(418));e=Yd(s.nextSibling);var u=Ka;e&&xL(t,e)?v5(u,s):(t.flags=t.flags&-4097|2,as=!1,Ka=t)}}else{if(ck(t))throw Error(ir(418));t.flags=t.flags&-4097|2,as=!1,Ka=t}}}function wL(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ka=t}function Kw(t){if(t!==Ka)return!1;if(!as)return wL(t),as=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!sk(t.type,t.memoizedProps)),e&&(e=qa)){if(ck(t))throw x5(),Error(ir(418));for(;e;)v5(t,e),e=Yd(e.nextSibling)}if(wL(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ir(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"){if(e===0){qa=Yd(t.nextSibling);break e}e--}else s!=="$"&&s!=="$!"&&s!=="$?"||e++}t=t.nextSibling}qa=null}}else qa=Ka?Yd(t.stateNode.nextSibling):null;return!0}function x5(){for(var t=qa;t;)t=Yd(t.nextSibling)}function zg(){qa=Ka=null,as=!1}function aC(t){ac===null?ac=[t]:ac.push(t)}var rW=$u.ReactCurrentBatchConfig;function av(t,e,s){if(t=s.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(ir(309));var u=s.stateNode}if(!u)throw Error(ir(147,t));var h=u,_=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===_?e.ref:(e=function(w){var o=h.refs;w===null?delete o[_]:o[_]=w},e._stringRef=_,e)}if(typeof t!="string")throw Error(ir(284));if(!s._owner)throw Error(ir(290,t))}return t}function Zw(t,e){throw t=Object.prototype.toString.call(e),Error(ir(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function bL(t){var e=t._init;return e(t._payload)}function w5(t){function e(te,ee){if(t){var oe=te.deletions;oe===null?(te.deletions=[ee],te.flags|=16):oe.push(ee)}}function s(te,ee){if(!t)return null;for(;ee!==null;)e(te,ee),ee=ee.sibling;return null}function u(te,ee){for(te=new Map;ee!==null;)ee.key!==null?te.set(ee.key,ee):te.set(ee.index,ee),ee=ee.sibling;return te}function h(te,ee){return te=th(te,ee),te.index=0,te.sibling=null,te}function _(te,ee,oe){return te.index=oe,t?(oe=te.alternate,oe!==null?(oe=oe.index,oe<ee?(te.flags|=2,ee):oe):(te.flags|=2,ee)):(te.flags|=1048576,ee)}function w(te){return t&&te.alternate===null&&(te.flags|=2),te}function o(te,ee,oe,he){return ee===null||ee.tag!==6?(ee=$2(oe,te.mode,he),ee.return=te,ee):(ee=h(ee,oe),ee.return=te,ee)}function k(te,ee,oe,he){var Ie=oe.type;return Ie===Jm?O(te,ee,oe.props.children,he,oe.key):ee!==null&&(ee.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===Dd&&bL(Ie)===ee.type)?(he=h(ee,oe.props),he.ref=av(te,ee,oe),he.return=te,he):(he=Mb(oe.type,oe.key,oe.props,null,te.mode,he),he.ref=av(te,ee,oe),he.return=te,he)}function P(te,ee,oe,he){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==oe.containerInfo||ee.stateNode.implementation!==oe.implementation?(ee=G2(oe,te.mode,he),ee.return=te,ee):(ee=h(ee,oe.children||[]),ee.return=te,ee)}function O(te,ee,oe,he,Ie){return ee===null||ee.tag!==7?(ee=Rf(oe,te.mode,he,Ie),ee.return=te,ee):(ee=h(ee,oe),ee.return=te,ee)}function F(te,ee,oe){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=$2(""+ee,te.mode,oe),ee.return=te,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case Bw:return oe=Mb(ee.type,ee.key,ee.props,null,te.mode,oe),oe.ref=av(te,null,ee),oe.return=te,oe;case Ym:return ee=G2(ee,te.mode,oe),ee.return=te,ee;case Dd:var he=ee._init;return F(te,he(ee._payload),oe)}if(_v(ee)||rv(ee))return ee=Rf(ee,te.mode,oe,null),ee.return=te,ee;Zw(te,ee)}return null}function V(te,ee,oe,he){var Ie=ee!==null?ee.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Ie!==null?null:o(te,ee,""+oe,he);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case Bw:return oe.key===Ie?k(te,ee,oe,he):null;case Ym:return oe.key===Ie?P(te,ee,oe,he):null;case Dd:return Ie=oe._init,V(te,ee,Ie(oe._payload),he)}if(_v(oe)||rv(oe))return Ie!==null?null:O(te,ee,oe,he,null);Zw(te,oe)}return null}function $(te,ee,oe,he,Ie){if(typeof he=="string"&&he!==""||typeof he=="number")return te=te.get(oe)||null,o(ee,te,""+he,Ie);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case Bw:return te=te.get(he.key===null?oe:he.key)||null,k(ee,te,he,Ie);case Ym:return te=te.get(he.key===null?oe:he.key)||null,P(ee,te,he,Ie);case Dd:var Be=he._init;return $(te,ee,oe,Be(he._payload),Ie)}if(_v(he)||rv(he))return te=te.get(oe)||null,O(ee,te,he,Ie,null);Zw(ee,he)}return null}function Y(te,ee,oe,he){for(var Ie=null,Be=null,je=ee,Je=ee=0,ft=null;je!==null&&Je<oe.length;Je++){je.index>Je?(ft=je,je=null):ft=je.sibling;var kt=V(te,je,oe[Je],he);if(kt===null){je===null&&(je=ft);break}t&&je&&kt.alternate===null&&e(te,je),ee=_(kt,ee,Je),Be===null?Ie=kt:Be.sibling=kt,Be=kt,je=ft}if(Je===oe.length)return s(te,je),as&&hf(te,Je),Ie;if(je===null){for(;Je<oe.length;Je++)je=F(te,oe[Je],he),je!==null&&(ee=_(je,ee,Je),Be===null?Ie=je:Be.sibling=je,Be=je);return as&&hf(te,Je),Ie}for(je=u(te,je);Je<oe.length;Je++)ft=$(je,te,Je,oe[Je],he),ft!==null&&(t&&ft.alternate!==null&&je.delete(ft.key===null?Je:ft.key),ee=_(ft,ee,Je),Be===null?Ie=ft:Be.sibling=ft,Be=ft);return t&&je.forEach(function(tr){return e(te,tr)}),as&&hf(te,Je),Ie}function Z(te,ee,oe,he){var Ie=rv(oe);if(typeof Ie!="function")throw Error(ir(150));if(oe=Ie.call(oe),oe==null)throw Error(ir(151));for(var Be=Ie=null,je=ee,Je=ee=0,ft=null,kt=oe.next();je!==null&&!kt.done;Je++,kt=oe.next()){je.index>Je?(ft=je,je=null):ft=je.sibling;var tr=V(te,je,kt.value,he);if(tr===null){je===null&&(je=ft);break}t&&je&&tr.alternate===null&&e(te,je),ee=_(tr,ee,Je),Be===null?Ie=tr:Be.sibling=tr,Be=tr,je=ft}if(kt.done)return s(te,je),as&&hf(te,Je),Ie;if(je===null){for(;!kt.done;Je++,kt=oe.next())kt=F(te,kt.value,he),kt!==null&&(ee=_(kt,ee,Je),Be===null?Ie=kt:Be.sibling=kt,Be=kt);return as&&hf(te,Je),Ie}for(je=u(te,je);!kt.done;Je++,kt=oe.next())kt=$(je,te,Je,kt.value,he),kt!==null&&(t&&kt.alternate!==null&&je.delete(kt.key===null?Je:kt.key),ee=_(kt,ee,Je),Be===null?Ie=kt:Be.sibling=kt,Be=kt);return t&&je.forEach(function(jt){return e(te,jt)}),as&&hf(te,Je),Ie}function se(te,ee,oe,he){if(typeof oe=="object"&&oe!==null&&oe.type===Jm&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case Bw:e:{for(var Ie=oe.key,Be=ee;Be!==null;){if(Be.key===Ie){if(Ie=oe.type,Ie===Jm){if(Be.tag===7){s(te,Be.sibling),ee=h(Be,oe.props.children),ee.return=te,te=ee;break e}}else if(Be.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===Dd&&bL(Ie)===Be.type){s(te,Be.sibling),ee=h(Be,oe.props),ee.ref=av(te,Be,oe),ee.return=te,te=ee;break e}s(te,Be);break}else e(te,Be);Be=Be.sibling}oe.type===Jm?(ee=Rf(oe.props.children,te.mode,he,oe.key),ee.return=te,te=ee):(he=Mb(oe.type,oe.key,oe.props,null,te.mode,he),he.ref=av(te,ee,oe),he.return=te,te=he)}return w(te);case Ym:e:{for(Be=oe.key;ee!==null;){if(ee.key===Be)if(ee.tag===4&&ee.stateNode.containerInfo===oe.containerInfo&&ee.stateNode.implementation===oe.implementation){s(te,ee.sibling),ee=h(ee,oe.children||[]),ee.return=te,te=ee;break e}else{s(te,ee);break}else e(te,ee);ee=ee.sibling}ee=G2(oe,te.mode,he),ee.return=te,te=ee}return w(te);case Dd:return Be=oe._init,se(te,ee,Be(oe._payload),he)}if(_v(oe))return Y(te,ee,oe,he);if(rv(oe))return Z(te,ee,oe,he);Zw(te,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ee!==null&&ee.tag===6?(s(te,ee.sibling),ee=h(ee,oe),ee.return=te,te=ee):(s(te,ee),ee=$2(oe,te.mode,he),ee.return=te,te=ee),w(te)):s(te,ee)}return se}var Fg=w5(!0),b5=w5(!1),n1=uh(null),i1=null,og=null,lC=null;function cC(){lC=og=i1=null}function uC(t){var e=n1.current;ts(n1),t._currentValue=e}function dk(t,e,s){for(;t!==null;){var u=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,u!==null&&(u.childLanes|=e)):u!==null&&(u.childLanes&e)!==e&&(u.childLanes|=e),t===s)break;t=t.return}}function vg(t,e){i1=t,lC=og=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ea=!0),t.firstContext=null)}function Sl(t){var e=t._currentValue;if(lC!==t)if(t={context:t,memoizedValue:e,next:null},og===null){if(i1===null)throw Error(ir(308));og=t,i1.dependencies={lanes:0,firstContext:t}}else og=og.next=t;return e}var xf=null;function dC(t){xf===null?xf=[t]:xf.push(t)}function S5(t,e,s,u){var h=e.interleaved;return h===null?(s.next=s,dC(e)):(s.next=h.next,h.next=s),e.interleaved=s,zu(t,u)}function zu(t,e){t.lanes|=e;var s=t.alternate;for(s!==null&&(s.lanes|=e),s=t,t=t.return;t!==null;)t.childLanes|=e,s=t.alternate,s!==null&&(s.childLanes|=e),s=t,t=t.return;return s.tag===3?s.stateNode:null}var Ld=!1;function hC(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function T5(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Du(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Jd(t,e,s){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,pi&2){var h=u.pending;return h===null?e.next=e:(e.next=h.next,h.next=e),u.pending=e,zu(t,s)}return h=u.interleaved,h===null?(e.next=e,dC(u)):(e.next=h.next,h.next=e),u.interleaved=e,zu(t,s)}function Eb(t,e,s){if(e=e.updateQueue,e!==null&&(e=e.shared,(s&4194240)!==0)){var u=e.lanes;u&=t.pendingLanes,s|=u,e.lanes=s,YA(t,s)}}function SL(t,e){var s=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,s===u)){var h=null,_=null;if(s=s.firstBaseUpdate,s!==null){do{var w={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};_===null?h=_=w:_=_.next=w,s=s.next}while(s!==null);_===null?h=_=e:_=_.next=e}else h=_=e;s={baseState:u.baseState,firstBaseUpdate:h,lastBaseUpdate:_,shared:u.shared,effects:u.effects},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=e:t.next=e,s.lastBaseUpdate=e}function s1(t,e,s,u){var h=t.updateQueue;Ld=!1;var _=h.firstBaseUpdate,w=h.lastBaseUpdate,o=h.shared.pending;if(o!==null){h.shared.pending=null;var k=o,P=k.next;k.next=null,w===null?_=P:w.next=P,w=k;var O=t.alternate;O!==null&&(O=O.updateQueue,o=O.lastBaseUpdate,o!==w&&(o===null?O.firstBaseUpdate=P:o.next=P,O.lastBaseUpdate=k))}if(_!==null){var F=h.baseState;w=0,O=P=k=null,o=_;do{var V=o.lane,$=o.eventTime;if((u&V)===V){O!==null&&(O=O.next={eventTime:$,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var Y=t,Z=o;switch(V=e,$=s,Z.tag){case 1:if(Y=Z.payload,typeof Y=="function"){F=Y.call($,F,V);break e}F=Y;break e;case 3:Y.flags=Y.flags&-65537|128;case 0:if(Y=Z.payload,V=typeof Y=="function"?Y.call($,F,V):Y,V==null)break e;F=ws({},F,V);break e;case 2:Ld=!0}}o.callback!==null&&o.lane!==0&&(t.flags|=64,V=h.effects,V===null?h.effects=[o]:V.push(o))}else $={eventTime:$,lane:V,tag:o.tag,payload:o.payload,callback:o.callback,next:null},O===null?(P=O=$,k=F):O=O.next=$,w|=V;if(o=o.next,o===null){if(o=h.shared.pending,o===null)break;V=o,o=V.next,V.next=null,h.lastBaseUpdate=V,h.shared.pending=null}}while(!0);if(O===null&&(k=F),h.baseState=k,h.firstBaseUpdate=P,h.lastBaseUpdate=O,e=h.shared.interleaved,e!==null){h=e;do w|=h.lane,h=h.next;while(h!==e)}else _===null&&(h.shared.lanes=0);Nf|=w,t.lanes=w,t.memoizedState=F}}function TL(t,e,s){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var u=t[e],h=u.callback;if(h!==null){if(u.callback=null,u=s,typeof h!="function")throw Error(ir(191,h));h.call(u)}}}var P0={},Wc=uh(P0),Yv=uh(P0),Jv=uh(P0);function wf(t){if(t===P0)throw Error(ir(174));return t}function fC(t,e){switch(Wi(Jv,e),Wi(Yv,t),Wi(Wc,P0),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:HE(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=HE(e,t)}ts(Wc),Wi(Wc,e)}function Bg(){ts(Wc),ts(Yv),ts(Jv)}function E5(t){wf(Jv.current);var e=wf(Wc.current),s=HE(e,t.type);e!==s&&(Wi(Yv,t),Wi(Wc,s))}function pC(t){Yv.current===t&&(ts(Wc),ts(Yv))}var ys=uh(0);function o1(t){for(var e=t;e!==null;){if(e.tag===13){var s=e.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var F2=[];function mC(){for(var t=0;t<F2.length;t++)F2[t]._workInProgressVersionPrimary=null;F2.length=0}var kb=$u.ReactCurrentDispatcher,B2=$u.ReactCurrentBatchConfig,Bf=0,xs=null,to=null,mo=null,a1=!1,Av=!1,Qv=0,nW=0;function No(){throw Error(ir(321))}function gC(t,e){if(e===null)return!1;for(var s=0;s<e.length&&s<t.length;s++)if(!uc(t[s],e[s]))return!1;return!0}function _C(t,e,s,u,h,_){if(Bf=_,xs=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,kb.current=t===null||t.memoizedState===null?aW:lW,t=s(u,h),Av){_=0;do{if(Av=!1,Qv=0,25<=_)throw Error(ir(301));_+=1,mo=to=null,e.updateQueue=null,kb.current=cW,t=s(u,h)}while(Av)}if(kb.current=l1,e=to!==null&&to.next!==null,Bf=0,mo=to=xs=null,a1=!1,e)throw Error(ir(300));return t}function yC(){var t=Qv!==0;return Qv=0,t}function Fc(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mo===null?xs.memoizedState=mo=t:mo=mo.next=t,mo}function Tl(){if(to===null){var t=xs.alternate;t=t!==null?t.memoizedState:null}else t=to.next;var e=mo===null?xs.memoizedState:mo.next;if(e!==null)mo=e,to=t;else{if(t===null)throw Error(ir(310));to=t,t={memoizedState:to.memoizedState,baseState:to.baseState,baseQueue:to.baseQueue,queue:to.queue,next:null},mo===null?xs.memoizedState=mo=t:mo=mo.next=t}return mo}function e0(t,e){return typeof e=="function"?e(t):e}function N2(t){var e=Tl(),s=e.queue;if(s===null)throw Error(ir(311));s.lastRenderedReducer=t;var u=to,h=u.baseQueue,_=s.pending;if(_!==null){if(h!==null){var w=h.next;h.next=_.next,_.next=w}u.baseQueue=h=_,s.pending=null}if(h!==null){_=h.next,u=u.baseState;var o=w=null,k=null,P=_;do{var O=P.lane;if((Bf&O)===O)k!==null&&(k=k.next={lane:0,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),u=P.hasEagerState?P.eagerState:t(u,P.action);else{var F={lane:O,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null};k===null?(o=k=F,w=u):k=k.next=F,xs.lanes|=O,Nf|=O}P=P.next}while(P!==null&&P!==_);k===null?w=u:k.next=o,uc(u,e.memoizedState)||(Ea=!0),e.memoizedState=u,e.baseState=w,e.baseQueue=k,s.lastRenderedState=u}if(t=s.interleaved,t!==null){h=t;do _=h.lane,xs.lanes|=_,Nf|=_,h=h.next;while(h!==t)}else h===null&&(s.lanes=0);return[e.memoizedState,s.dispatch]}function j2(t){var e=Tl(),s=e.queue;if(s===null)throw Error(ir(311));s.lastRenderedReducer=t;var u=s.dispatch,h=s.pending,_=e.memoizedState;if(h!==null){s.pending=null;var w=h=h.next;do _=t(_,w.action),w=w.next;while(w!==h);uc(_,e.memoizedState)||(Ea=!0),e.memoizedState=_,e.baseQueue===null&&(e.baseState=_),s.lastRenderedState=_}return[_,u]}function k5(){}function A5(t,e){var s=xs,u=Tl(),h=e(),_=!uc(u.memoizedState,h);if(_&&(u.memoizedState=h,Ea=!0),u=u.queue,vC(P5.bind(null,s,u,t),[t]),u.getSnapshot!==e||_||mo!==null&&mo.memoizedState.tag&1){if(s.flags|=2048,t0(9,I5.bind(null,s,u,h,e),void 0,null),go===null)throw Error(ir(349));Bf&30||C5(s,e,h)}return h}function C5(t,e,s){t.flags|=16384,t={getSnapshot:e,value:s},e=xs.updateQueue,e===null?(e={lastEffect:null,stores:null},xs.updateQueue=e,e.stores=[t]):(s=e.stores,s===null?e.stores=[t]:s.push(t))}function I5(t,e,s,u){e.value=s,e.getSnapshot=u,M5(e)&&R5(t)}function P5(t,e,s){return s(function(){M5(e)&&R5(t)})}function M5(t){var e=t.getSnapshot;t=t.value;try{var s=e();return!uc(t,s)}catch{return!0}}function R5(t){var e=zu(t,1);e!==null&&cc(e,t,1,-1)}function EL(t){var e=Fc();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e0,lastRenderedState:t},e.queue=t,t=t.dispatch=oW.bind(null,xs,t),[e.memoizedState,t]}function t0(t,e,s,u){return t={tag:t,create:e,destroy:s,deps:u,next:null},e=xs.updateQueue,e===null?(e={lastEffect:null,stores:null},xs.updateQueue=e,e.lastEffect=t.next=t):(s=e.lastEffect,s===null?e.lastEffect=t.next=t:(u=s.next,s.next=t,t.next=u,e.lastEffect=t)),t}function D5(){return Tl().memoizedState}function Ab(t,e,s,u){var h=Fc();xs.flags|=t,h.memoizedState=t0(1|e,s,void 0,u===void 0?null:u)}function U1(t,e,s,u){var h=Tl();u=u===void 0?null:u;var _=void 0;if(to!==null){var w=to.memoizedState;if(_=w.destroy,u!==null&&gC(u,w.deps)){h.memoizedState=t0(e,s,_,u);return}}xs.flags|=t,h.memoizedState=t0(1|e,s,_,u)}function kL(t,e){return Ab(8390656,8,t,e)}function vC(t,e){return U1(2048,8,t,e)}function L5(t,e){return U1(4,2,t,e)}function O5(t,e){return U1(4,4,t,e)}function z5(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function F5(t,e,s){return s=s!=null?s.concat([t]):null,U1(4,4,z5.bind(null,e,t),s)}function xC(){}function B5(t,e){var s=Tl();e=e===void 0?null:e;var u=s.memoizedState;return u!==null&&e!==null&&gC(e,u[1])?u[0]:(s.memoizedState=[t,e],t)}function N5(t,e){var s=Tl();e=e===void 0?null:e;var u=s.memoizedState;return u!==null&&e!==null&&gC(e,u[1])?u[0]:(t=t(),s.memoizedState=[t,e],t)}function j5(t,e,s){return Bf&21?(uc(s,e)||(s=HF(),xs.lanes|=s,Nf|=s,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ea=!0),t.memoizedState=s)}function iW(t,e){var s=Ii;Ii=s!==0&&4>s?s:4,t(!0);var u=B2.transition;B2.transition={};try{t(!1),e()}finally{Ii=s,B2.transition=u}}function V5(){return Tl().memoizedState}function sW(t,e,s){var u=eh(t);if(s={lane:u,action:s,hasEagerState:!1,eagerState:null,next:null},U5(t))$5(e,s);else if(s=S5(t,e,s,u),s!==null){var h=aa();cc(s,t,u,h),G5(s,e,u)}}function oW(t,e,s){var u=eh(t),h={lane:u,action:s,hasEagerState:!1,eagerState:null,next:null};if(U5(t))$5(e,h);else{var _=t.alternate;if(t.lanes===0&&(_===null||_.lanes===0)&&(_=e.lastRenderedReducer,_!==null))try{var w=e.lastRenderedState,o=_(w,s);if(h.hasEagerState=!0,h.eagerState=o,uc(o,w)){var k=e.interleaved;k===null?(h.next=h,dC(e)):(h.next=k.next,k.next=h),e.interleaved=h;return}}catch{}finally{}s=S5(t,e,h,u),s!==null&&(h=aa(),cc(s,t,u,h),G5(s,e,u))}}function U5(t){var e=t.alternate;return t===xs||e!==null&&e===xs}function $5(t,e){Av=a1=!0;var s=t.pending;s===null?e.next=e:(e.next=s.next,s.next=e),t.pending=e}function G5(t,e,s){if(s&4194240){var u=e.lanes;u&=t.pendingLanes,s|=u,e.lanes=s,YA(t,s)}}var l1={readContext:Sl,useCallback:No,useContext:No,useEffect:No,useImperativeHandle:No,useInsertionEffect:No,useLayoutEffect:No,useMemo:No,useReducer:No,useRef:No,useState:No,useDebugValue:No,useDeferredValue:No,useTransition:No,useMutableSource:No,useSyncExternalStore:No,useId:No,unstable_isNewReconciler:!1},aW={readContext:Sl,useCallback:function(t,e){return Fc().memoizedState=[t,e===void 0?null:e],t},useContext:Sl,useEffect:kL,useImperativeHandle:function(t,e,s){return s=s!=null?s.concat([t]):null,Ab(4194308,4,z5.bind(null,e,t),s)},useLayoutEffect:function(t,e){return Ab(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ab(4,2,t,e)},useMemo:function(t,e){var s=Fc();return e=e===void 0?null:e,t=t(),s.memoizedState=[t,e],t},useReducer:function(t,e,s){var u=Fc();return e=s!==void 0?s(e):e,u.memoizedState=u.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},u.queue=t,t=t.dispatch=sW.bind(null,xs,t),[u.memoizedState,t]},useRef:function(t){var e=Fc();return t={current:t},e.memoizedState=t},useState:EL,useDebugValue:xC,useDeferredValue:function(t){return Fc().memoizedState=t},useTransition:function(){var t=EL(!1),e=t[0];return t=iW.bind(null,t[1]),Fc().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,s){var u=xs,h=Fc();if(as){if(s===void 0)throw Error(ir(407));s=s()}else{if(s=e(),go===null)throw Error(ir(349));Bf&30||C5(u,e,s)}h.memoizedState=s;var _={value:s,getSnapshot:e};return h.queue=_,kL(P5.bind(null,u,_,t),[t]),u.flags|=2048,t0(9,I5.bind(null,u,_,s,e),void 0,null),s},useId:function(){var t=Fc(),e=go.identifierPrefix;if(as){var s=Ru,u=Mu;s=(u&~(1<<32-lc(u)-1)).toString(32)+s,e=":"+e+"R"+s,s=Qv++,0<s&&(e+="H"+s.toString(32)),e+=":"}else s=nW++,e=":"+e+"r"+s.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},lW={readContext:Sl,useCallback:B5,useContext:Sl,useEffect:vC,useImperativeHandle:F5,useInsertionEffect:L5,useLayoutEffect:O5,useMemo:N5,useReducer:N2,useRef:D5,useState:function(){return N2(e0)},useDebugValue:xC,useDeferredValue:function(t){var e=Tl();return j5(e,to.memoizedState,t)},useTransition:function(){var t=N2(e0)[0],e=Tl().memoizedState;return[t,e]},useMutableSource:k5,useSyncExternalStore:A5,useId:V5,unstable_isNewReconciler:!1},cW={readContext:Sl,useCallback:B5,useContext:Sl,useEffect:vC,useImperativeHandle:F5,useInsertionEffect:L5,useLayoutEffect:O5,useMemo:N5,useReducer:j2,useRef:D5,useState:function(){return j2(e0)},useDebugValue:xC,useDeferredValue:function(t){var e=Tl();return to===null?e.memoizedState=t:j5(e,to.memoizedState,t)},useTransition:function(){var t=j2(e0)[0],e=Tl().memoizedState;return[t,e]},useMutableSource:k5,useSyncExternalStore:A5,useId:V5,unstable_isNewReconciler:!1};function ec(t,e){if(t&&t.defaultProps){e=ws({},e),t=t.defaultProps;for(var s in t)e[s]===void 0&&(e[s]=t[s]);return e}return e}function hk(t,e,s,u){e=t.memoizedState,s=s(u,e),s=s==null?e:ws({},e,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var $1={isMounted:function(t){return(t=t._reactInternals)?Hf(t)===t:!1},enqueueSetState:function(t,e,s){t=t._reactInternals;var u=aa(),h=eh(t),_=Du(u,h);_.payload=e,s!=null&&(_.callback=s),e=Jd(t,_,h),e!==null&&(cc(e,t,h,u),Eb(e,t,h))},enqueueReplaceState:function(t,e,s){t=t._reactInternals;var u=aa(),h=eh(t),_=Du(u,h);_.tag=1,_.payload=e,s!=null&&(_.callback=s),e=Jd(t,_,h),e!==null&&(cc(e,t,h,u),Eb(e,t,h))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var s=aa(),u=eh(t),h=Du(s,u);h.tag=2,e!=null&&(h.callback=e),e=Jd(t,h,u),e!==null&&(cc(e,t,u,s),Eb(e,t,u))}};function AL(t,e,s,u,h,_,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,_,w):e.prototype&&e.prototype.isPureReactComponent?!qv(s,u)||!qv(h,_):!0}function H5(t,e,s){var u=!1,h=ih,_=e.contextType;return typeof _=="object"&&_!==null?_=Sl(_):(h=Ca(e)?zf:Go.current,u=e.contextTypes,_=(u=u!=null)?Og(t,h):ih),e=new e(s,_),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=$1,t.stateNode=e,e._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=h,t.__reactInternalMemoizedMaskedChildContext=_),e}function CL(t,e,s,u){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(s,u),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(s,u),e.state!==t&&$1.enqueueReplaceState(e,e.state,null)}function fk(t,e,s,u){var h=t.stateNode;h.props=s,h.state=t.memoizedState,h.refs={},hC(t);var _=e.contextType;typeof _=="object"&&_!==null?h.context=Sl(_):(_=Ca(e)?zf:Go.current,h.context=Og(t,_)),h.state=t.memoizedState,_=e.getDerivedStateFromProps,typeof _=="function"&&(hk(t,e,_,s),h.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(e=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),e!==h.state&&$1.enqueueReplaceState(h,h.state,null),s1(t,s,h,u),h.state=t.memoizedState),typeof h.componentDidMount=="function"&&(t.flags|=4194308)}function Ng(t,e){try{var s="",u=e;do s+=FG(u),u=u.return;while(u);var h=s}catch(_){h=`
|
||
Error generating stack: `+_.message+`
|
||
`+_.stack}return{value:t,source:e,stack:h,digest:null}}function V2(t,e,s){return{value:t,source:null,stack:s??null,digest:e??null}}function pk(t,e){try{console.error(e.value)}catch(s){setTimeout(function(){throw s})}}var uW=typeof WeakMap=="function"?WeakMap:Map;function W5(t,e,s){s=Du(-1,s),s.tag=3,s.payload={element:null};var u=e.value;return s.callback=function(){u1||(u1=!0,Tk=u),pk(t,e)},s}function q5(t,e,s){s=Du(-1,s),s.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var h=e.value;s.payload=function(){return u(h)},s.callback=function(){pk(t,e)}}var _=t.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(s.callback=function(){pk(t,e),typeof u!="function"&&(Qd===null?Qd=new Set([this]):Qd.add(this));var w=e.stack;this.componentDidCatch(e.value,{componentStack:w!==null?w:""})}),s}function IL(t,e,s){var u=t.pingCache;if(u===null){u=t.pingCache=new uW;var h=new Set;u.set(e,h)}else h=u.get(e),h===void 0&&(h=new Set,u.set(e,h));h.has(s)||(h.add(s),t=TW.bind(null,t,e,s),e.then(t,t))}function PL(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function ML(t,e,s,u,h){return t.mode&1?(t.flags|=65536,t.lanes=h,t):(t===e?t.flags|=65536:(t.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(e=Du(-1,1),e.tag=2,Jd(s,e,1))),s.lanes|=1),t)}var dW=$u.ReactCurrentOwner,Ea=!1;function ia(t,e,s,u){e.child=t===null?b5(e,null,s,u):Fg(e,t.child,s,u)}function RL(t,e,s,u,h){s=s.render;var _=e.ref;return vg(e,h),u=_C(t,e,s,u,_,h),s=yC(),t!==null&&!Ea?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~h,Fu(t,e,h)):(as&&s&&sC(e),e.flags|=1,ia(t,e,u,h),e.child)}function DL(t,e,s,u,h){if(t===null){var _=s.type;return typeof _=="function"&&!CC(_)&&_.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(e.tag=15,e.type=_,K5(t,e,_,u,h)):(t=Mb(s.type,null,u,e,e.mode,h),t.ref=e.ref,t.return=e,e.child=t)}if(_=t.child,!(t.lanes&h)){var w=_.memoizedProps;if(s=s.compare,s=s!==null?s:qv,s(w,u)&&t.ref===e.ref)return Fu(t,e,h)}return e.flags|=1,t=th(_,u),t.ref=e.ref,t.return=e,e.child=t}function K5(t,e,s,u,h){if(t!==null){var _=t.memoizedProps;if(qv(_,u)&&t.ref===e.ref)if(Ea=!1,e.pendingProps=u=_,(t.lanes&h)!==0)t.flags&131072&&(Ea=!0);else return e.lanes=t.lanes,Fu(t,e,h)}return mk(t,e,s,u,h)}function Z5(t,e,s){var u=e.pendingProps,h=u.children,_=t!==null?t.memoizedState:null;if(u.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Wi(lg,Ua),Ua|=s;else{if(!(s&1073741824))return t=_!==null?_.baseLanes|s:s,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Wi(lg,Ua),Ua|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=_!==null?_.baseLanes:s,Wi(lg,Ua),Ua|=u}else _!==null?(u=_.baseLanes|s,e.memoizedState=null):u=s,Wi(lg,Ua),Ua|=u;return ia(t,e,h,s),e.child}function X5(t,e){var s=e.ref;(t===null&&s!==null||t!==null&&t.ref!==s)&&(e.flags|=512,e.flags|=2097152)}function mk(t,e,s,u,h){var _=Ca(s)?zf:Go.current;return _=Og(e,_),vg(e,h),s=_C(t,e,s,u,_,h),u=yC(),t!==null&&!Ea?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~h,Fu(t,e,h)):(as&&u&&sC(e),e.flags|=1,ia(t,e,s,h),e.child)}function LL(t,e,s,u,h){if(Ca(s)){var _=!0;e1(e)}else _=!1;if(vg(e,h),e.stateNode===null)Cb(t,e),H5(e,s,u),fk(e,s,u,h),u=!0;else if(t===null){var w=e.stateNode,o=e.memoizedProps;w.props=o;var k=w.context,P=s.contextType;typeof P=="object"&&P!==null?P=Sl(P):(P=Ca(s)?zf:Go.current,P=Og(e,P));var O=s.getDerivedStateFromProps,F=typeof O=="function"||typeof w.getSnapshotBeforeUpdate=="function";F||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(o!==u||k!==P)&&CL(e,w,u,P),Ld=!1;var V=e.memoizedState;w.state=V,s1(e,u,w,h),k=e.memoizedState,o!==u||V!==k||Aa.current||Ld?(typeof O=="function"&&(hk(e,s,O,u),k=e.memoizedState),(o=Ld||AL(e,s,o,u,V,k,P))?(F||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(e.flags|=4194308)):(typeof w.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=u,e.memoizedState=k),w.props=u,w.state=k,w.context=P,u=o):(typeof w.componentDidMount=="function"&&(e.flags|=4194308),u=!1)}else{w=e.stateNode,T5(t,e),o=e.memoizedProps,P=e.type===e.elementType?o:ec(e.type,o),w.props=P,F=e.pendingProps,V=w.context,k=s.contextType,typeof k=="object"&&k!==null?k=Sl(k):(k=Ca(s)?zf:Go.current,k=Og(e,k));var $=s.getDerivedStateFromProps;(O=typeof $=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(o!==F||V!==k)&&CL(e,w,u,k),Ld=!1,V=e.memoizedState,w.state=V,s1(e,u,w,h);var Y=e.memoizedState;o!==F||V!==Y||Aa.current||Ld?(typeof $=="function"&&(hk(e,s,$,u),Y=e.memoizedState),(P=Ld||AL(e,s,P,u,V,Y,k)||!1)?(O||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Y,k),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Y,k)),typeof w.componentDidUpdate=="function"&&(e.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof w.componentDidUpdate!="function"||o===t.memoizedProps&&V===t.memoizedState||(e.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&V===t.memoizedState||(e.flags|=1024),e.memoizedProps=u,e.memoizedState=Y),w.props=u,w.state=Y,w.context=k,u=P):(typeof w.componentDidUpdate!="function"||o===t.memoizedProps&&V===t.memoizedState||(e.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&V===t.memoizedState||(e.flags|=1024),u=!1)}return gk(t,e,s,u,_,h)}function gk(t,e,s,u,h,_){X5(t,e);var w=(e.flags&128)!==0;if(!u&&!w)return h&&vL(e,s,!1),Fu(t,e,_);u=e.stateNode,dW.current=e;var o=w&&typeof s.getDerivedStateFromError!="function"?null:u.render();return e.flags|=1,t!==null&&w?(e.child=Fg(e,t.child,null,_),e.child=Fg(e,null,o,_)):ia(t,e,o,_),e.memoizedState=u.state,h&&vL(e,s,!0),e.child}function Y5(t){var e=t.stateNode;e.pendingContext?yL(t,e.pendingContext,e.pendingContext!==e.context):e.context&&yL(t,e.context,!1),fC(t,e.containerInfo)}function OL(t,e,s,u,h){return zg(),aC(h),e.flags|=256,ia(t,e,s,u),e.child}var _k={dehydrated:null,treeContext:null,retryLane:0};function yk(t){return{baseLanes:t,cachePool:null,transitions:null}}function J5(t,e,s){var u=e.pendingProps,h=ys.current,_=!1,w=(e.flags&128)!==0,o;if((o=w)||(o=t!==null&&t.memoizedState===null?!1:(h&2)!==0),o?(_=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(h|=1),Wi(ys,h&1),t===null)return uk(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(w=u.children,t=u.fallback,_?(u=e.mode,_=e.child,w={mode:"hidden",children:w},!(u&1)&&_!==null?(_.childLanes=0,_.pendingProps=w):_=W1(w,u,0,null),t=Rf(t,u,s,null),_.return=e,t.return=e,_.sibling=t,e.child=_,e.child.memoizedState=yk(s),e.memoizedState=_k,t):wC(e,w));if(h=t.memoizedState,h!==null&&(o=h.dehydrated,o!==null))return hW(t,e,w,u,o,h,s);if(_){_=u.fallback,w=e.mode,h=t.child,o=h.sibling;var k={mode:"hidden",children:u.children};return!(w&1)&&e.child!==h?(u=e.child,u.childLanes=0,u.pendingProps=k,e.deletions=null):(u=th(h,k),u.subtreeFlags=h.subtreeFlags&14680064),o!==null?_=th(o,_):(_=Rf(_,w,s,null),_.flags|=2),_.return=e,u.return=e,u.sibling=_,e.child=u,u=_,_=e.child,w=t.child.memoizedState,w=w===null?yk(s):{baseLanes:w.baseLanes|s,cachePool:null,transitions:w.transitions},_.memoizedState=w,_.childLanes=t.childLanes&~s,e.memoizedState=_k,u}return _=t.child,t=_.sibling,u=th(_,{mode:"visible",children:u.children}),!(e.mode&1)&&(u.lanes=s),u.return=e,u.sibling=null,t!==null&&(s=e.deletions,s===null?(e.deletions=[t],e.flags|=16):s.push(t)),e.child=u,e.memoizedState=null,u}function wC(t,e){return e=W1({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Xw(t,e,s,u){return u!==null&&aC(u),Fg(e,t.child,null,s),t=wC(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function hW(t,e,s,u,h,_,w){if(s)return e.flags&256?(e.flags&=-257,u=V2(Error(ir(422))),Xw(t,e,w,u)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(_=u.fallback,h=e.mode,u=W1({mode:"visible",children:u.children},h,0,null),_=Rf(_,h,w,null),_.flags|=2,u.return=e,_.return=e,u.sibling=_,e.child=u,e.mode&1&&Fg(e,t.child,null,w),e.child.memoizedState=yk(w),e.memoizedState=_k,_);if(!(e.mode&1))return Xw(t,e,w,null);if(h.data==="$!"){if(u=h.nextSibling&&h.nextSibling.dataset,u)var o=u.dgst;return u=o,_=Error(ir(419)),u=V2(_,u,void 0),Xw(t,e,w,u)}if(o=(w&t.childLanes)!==0,Ea||o){if(u=go,u!==null){switch(w&-w){case 4:h=2;break;case 16:h=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:h=32;break;case 536870912:h=268435456;break;default:h=0}h=h&(u.suspendedLanes|w)?0:h,h!==0&&h!==_.retryLane&&(_.retryLane=h,zu(t,h),cc(u,t,h,-1))}return AC(),u=V2(Error(ir(421))),Xw(t,e,w,u)}return h.data==="$?"?(e.flags|=128,e.child=t.child,e=EW.bind(null,t),h._reactRetry=e,null):(t=_.treeContext,qa=Yd(h.nextSibling),Ka=e,as=!0,ac=null,t!==null&&(_l[yl++]=Mu,_l[yl++]=Ru,_l[yl++]=Ff,Mu=t.id,Ru=t.overflow,Ff=e),e=wC(e,u.children),e.flags|=4096,e)}function zL(t,e,s){t.lanes|=e;var u=t.alternate;u!==null&&(u.lanes|=e),dk(t.return,e,s)}function U2(t,e,s,u,h){var _=t.memoizedState;_===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:u,tail:s,tailMode:h}:(_.isBackwards=e,_.rendering=null,_.renderingStartTime=0,_.last=u,_.tail=s,_.tailMode=h)}function Q5(t,e,s){var u=e.pendingProps,h=u.revealOrder,_=u.tail;if(ia(t,e,u.children,s),u=ys.current,u&2)u=u&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&zL(t,s,e);else if(t.tag===19)zL(t,s,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(Wi(ys,u),!(e.mode&1))e.memoizedState=null;else switch(h){case"forwards":for(s=e.child,h=null;s!==null;)t=s.alternate,t!==null&&o1(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=e.child,e.child=null):(h=s.sibling,s.sibling=null),U2(e,!1,h,s,_);break;case"backwards":for(s=null,h=e.child,e.child=null;h!==null;){if(t=h.alternate,t!==null&&o1(t)===null){e.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}U2(e,!0,s,null,_);break;case"together":U2(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Cb(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Fu(t,e,s){if(t!==null&&(e.dependencies=t.dependencies),Nf|=e.lanes,!(s&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(ir(153));if(e.child!==null){for(t=e.child,s=th(t,t.pendingProps),e.child=s,s.return=e;t.sibling!==null;)t=t.sibling,s=s.sibling=th(t,t.pendingProps),s.return=e;s.sibling=null}return e.child}function fW(t,e,s){switch(e.tag){case 3:Y5(e),zg();break;case 5:E5(e);break;case 1:Ca(e.type)&&e1(e);break;case 4:fC(e,e.stateNode.containerInfo);break;case 10:var u=e.type._context,h=e.memoizedProps.value;Wi(n1,u._currentValue),u._currentValue=h;break;case 13:if(u=e.memoizedState,u!==null)return u.dehydrated!==null?(Wi(ys,ys.current&1),e.flags|=128,null):s&e.child.childLanes?J5(t,e,s):(Wi(ys,ys.current&1),t=Fu(t,e,s),t!==null?t.sibling:null);Wi(ys,ys.current&1);break;case 19:if(u=(s&e.childLanes)!==0,t.flags&128){if(u)return Q5(t,e,s);e.flags|=128}if(h=e.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),Wi(ys,ys.current),u)break;return null;case 22:case 23:return e.lanes=0,Z5(t,e,s)}return Fu(t,e,s)}var eB,vk,tB,rB;eB=function(t,e){for(var s=e.child;s!==null;){if(s.tag===5||s.tag===6)t.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return;s=s.return}s.sibling.return=s.return,s=s.sibling}};vk=function(){};tB=function(t,e,s,u){var h=t.memoizedProps;if(h!==u){t=e.stateNode,wf(Wc.current);var _=null;switch(s){case"input":h=VE(t,h),u=VE(t,u),_=[];break;case"select":h=ws({},h,{value:void 0}),u=ws({},u,{value:void 0}),_=[];break;case"textarea":h=GE(t,h),u=GE(t,u),_=[];break;default:typeof h.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=Jb)}WE(s,u);var w;s=null;for(P in h)if(!u.hasOwnProperty(P)&&h.hasOwnProperty(P)&&h[P]!=null)if(P==="style"){var o=h[P];for(w in o)o.hasOwnProperty(w)&&(s||(s={}),s[w]="")}else P!=="dangerouslySetInnerHTML"&&P!=="children"&&P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(jv.hasOwnProperty(P)?_||(_=[]):(_=_||[]).push(P,null));for(P in u){var k=u[P];if(o=h!=null?h[P]:void 0,u.hasOwnProperty(P)&&k!==o&&(k!=null||o!=null))if(P==="style")if(o){for(w in o)!o.hasOwnProperty(w)||k&&k.hasOwnProperty(w)||(s||(s={}),s[w]="");for(w in k)k.hasOwnProperty(w)&&o[w]!==k[w]&&(s||(s={}),s[w]=k[w])}else s||(_||(_=[]),_.push(P,s)),s=k;else P==="dangerouslySetInnerHTML"?(k=k?k.__html:void 0,o=o?o.__html:void 0,k!=null&&o!==k&&(_=_||[]).push(P,k)):P==="children"?typeof k!="string"&&typeof k!="number"||(_=_||[]).push(P,""+k):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&(jv.hasOwnProperty(P)?(k!=null&&P==="onScroll"&&es("scroll",t),_||o===k||(_=[])):(_=_||[]).push(P,k))}s&&(_=_||[]).push("style",s);var P=_;(e.updateQueue=P)&&(e.flags|=4)}};rB=function(t,e,s,u){s!==u&&(e.flags|=4)};function lv(t,e){if(!as)switch(t.tailMode){case"hidden":e=t.tail;for(var s=null;e!==null;)e.alternate!==null&&(s=e),e=e.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var u=null;s!==null;)s.alternate!==null&&(u=s),s=s.sibling;u===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function jo(t){var e=t.alternate!==null&&t.alternate.child===t.child,s=0,u=0;if(e)for(var h=t.child;h!==null;)s|=h.lanes|h.childLanes,u|=h.subtreeFlags&14680064,u|=h.flags&14680064,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)s|=h.lanes|h.childLanes,u|=h.subtreeFlags,u|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=u,t.childLanes=s,e}function pW(t,e,s){var u=e.pendingProps;switch(oC(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jo(e),null;case 1:return Ca(e.type)&&Qb(),jo(e),null;case 3:return u=e.stateNode,Bg(),ts(Aa),ts(Go),mC(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(Kw(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ac!==null&&(Ak(ac),ac=null))),vk(t,e),jo(e),null;case 5:pC(e);var h=wf(Jv.current);if(s=e.type,t!==null&&e.stateNode!=null)tB(t,e,s,u,h),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!u){if(e.stateNode===null)throw Error(ir(166));return jo(e),null}if(t=wf(Wc.current),Kw(e)){u=e.stateNode,s=e.type;var _=e.memoizedProps;switch(u[Vc]=e,u[Xv]=_,t=(e.mode&1)!==0,s){case"dialog":es("cancel",u),es("close",u);break;case"iframe":case"object":case"embed":es("load",u);break;case"video":case"audio":for(h=0;h<vv.length;h++)es(vv[h],u);break;case"source":es("error",u);break;case"img":case"image":case"link":es("error",u),es("load",u);break;case"details":es("toggle",u);break;case"input":HD(u,_),es("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!_.multiple},es("invalid",u);break;case"textarea":qD(u,_),es("invalid",u)}WE(s,_),h=null;for(var w in _)if(_.hasOwnProperty(w)){var o=_[w];w==="children"?typeof o=="string"?u.textContent!==o&&(_.suppressHydrationWarning!==!0&&qw(u.textContent,o,t),h=["children",o]):typeof o=="number"&&u.textContent!==""+o&&(_.suppressHydrationWarning!==!0&&qw(u.textContent,o,t),h=["children",""+o]):jv.hasOwnProperty(w)&&o!=null&&w==="onScroll"&&es("scroll",u)}switch(s){case"input":Nw(u),WD(u,_,!0);break;case"textarea":Nw(u),KD(u);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(u.onclick=Jb)}u=h,e.updateQueue=u,u!==null&&(e.flags|=4)}else{w=h.nodeType===9?h:h.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=PF(s)),t==="http://www.w3.org/1999/xhtml"?s==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(s,{is:u.is}):(t=w.createElement(s),s==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,s),t[Vc]=e,t[Xv]=u,eB(t,e,!1,!1),e.stateNode=t;e:{switch(w=qE(s,u),s){case"dialog":es("cancel",t),es("close",t),h=u;break;case"iframe":case"object":case"embed":es("load",t),h=u;break;case"video":case"audio":for(h=0;h<vv.length;h++)es(vv[h],t);h=u;break;case"source":es("error",t),h=u;break;case"img":case"image":case"link":es("error",t),es("load",t),h=u;break;case"details":es("toggle",t),h=u;break;case"input":HD(t,u),h=VE(t,u),es("invalid",t);break;case"option":h=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},h=ws({},u,{value:void 0}),es("invalid",t);break;case"textarea":qD(t,u),h=GE(t,u),es("invalid",t);break;default:h=u}WE(s,h),o=h;for(_ in o)if(o.hasOwnProperty(_)){var k=o[_];_==="style"?DF(t,k):_==="dangerouslySetInnerHTML"?(k=k?k.__html:void 0,k!=null&&MF(t,k)):_==="children"?typeof k=="string"?(s!=="textarea"||k!=="")&&Vv(t,k):typeof k=="number"&&Vv(t,""+k):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(jv.hasOwnProperty(_)?k!=null&&_==="onScroll"&&es("scroll",t):k!=null&&HA(t,_,k,w))}switch(s){case"input":Nw(t),WD(t,u,!1);break;case"textarea":Nw(t),KD(t);break;case"option":u.value!=null&&t.setAttribute("value",""+nh(u.value));break;case"select":t.multiple=!!u.multiple,_=u.value,_!=null?mg(t,!!u.multiple,_,!1):u.defaultValue!=null&&mg(t,!!u.multiple,u.defaultValue,!0);break;default:typeof h.onClick=="function"&&(t.onclick=Jb)}switch(s){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return jo(e),null;case 6:if(t&&e.stateNode!=null)rB(t,e,t.memoizedProps,u);else{if(typeof u!="string"&&e.stateNode===null)throw Error(ir(166));if(s=wf(Jv.current),wf(Wc.current),Kw(e)){if(u=e.stateNode,s=e.memoizedProps,u[Vc]=e,(_=u.nodeValue!==s)&&(t=Ka,t!==null))switch(t.tag){case 3:qw(u.nodeValue,s,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&qw(u.nodeValue,s,(t.mode&1)!==0)}_&&(e.flags|=4)}else u=(s.nodeType===9?s:s.ownerDocument).createTextNode(u),u[Vc]=e,e.stateNode=u}return jo(e),null;case 13:if(ts(ys),u=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(as&&qa!==null&&e.mode&1&&!(e.flags&128))x5(),zg(),e.flags|=98560,_=!1;else if(_=Kw(e),u!==null&&u.dehydrated!==null){if(t===null){if(!_)throw Error(ir(318));if(_=e.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(ir(317));_[Vc]=e}else zg(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;jo(e),_=!1}else ac!==null&&(Ak(ac),ac=null),_=!0;if(!_)return e.flags&65536?e:null}return e.flags&128?(e.lanes=s,e):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(e.child.flags|=8192,e.mode&1&&(t===null||ys.current&1?no===0&&(no=3):AC())),e.updateQueue!==null&&(e.flags|=4),jo(e),null);case 4:return Bg(),vk(t,e),t===null&&Kv(e.stateNode.containerInfo),jo(e),null;case 10:return uC(e.type._context),jo(e),null;case 17:return Ca(e.type)&&Qb(),jo(e),null;case 19:if(ts(ys),_=e.memoizedState,_===null)return jo(e),null;if(u=(e.flags&128)!==0,w=_.rendering,w===null)if(u)lv(_,!1);else{if(no!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(w=o1(t),w!==null){for(e.flags|=128,lv(_,!1),u=w.updateQueue,u!==null&&(e.updateQueue=u,e.flags|=4),e.subtreeFlags=0,u=s,s=e.child;s!==null;)_=s,t=u,_.flags&=14680066,w=_.alternate,w===null?(_.childLanes=0,_.lanes=t,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=w.childLanes,_.lanes=w.lanes,_.child=w.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=w.memoizedProps,_.memoizedState=w.memoizedState,_.updateQueue=w.updateQueue,_.type=w.type,t=w.dependencies,_.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),s=s.sibling;return Wi(ys,ys.current&1|2),e.child}t=t.sibling}_.tail!==null&&Ds()>jg&&(e.flags|=128,u=!0,lv(_,!1),e.lanes=4194304)}else{if(!u)if(t=o1(w),t!==null){if(e.flags|=128,u=!0,s=t.updateQueue,s!==null&&(e.updateQueue=s,e.flags|=4),lv(_,!0),_.tail===null&&_.tailMode==="hidden"&&!w.alternate&&!as)return jo(e),null}else 2*Ds()-_.renderingStartTime>jg&&s!==1073741824&&(e.flags|=128,u=!0,lv(_,!1),e.lanes=4194304);_.isBackwards?(w.sibling=e.child,e.child=w):(s=_.last,s!==null?s.sibling=w:e.child=w,_.last=w)}return _.tail!==null?(e=_.tail,_.rendering=e,_.tail=e.sibling,_.renderingStartTime=Ds(),e.sibling=null,s=ys.current,Wi(ys,u?s&1|2:s&1),e):(jo(e),null);case 22:case 23:return kC(),u=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(e.flags|=8192),u&&e.mode&1?Ua&1073741824&&(jo(e),e.subtreeFlags&6&&(e.flags|=8192)):jo(e),null;case 24:return null;case 25:return null}throw Error(ir(156,e.tag))}function mW(t,e){switch(oC(e),e.tag){case 1:return Ca(e.type)&&Qb(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Bg(),ts(Aa),ts(Go),mC(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return pC(e),null;case 13:if(ts(ys),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ir(340));zg()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ts(ys),null;case 4:return Bg(),null;case 10:return uC(e.type._context),null;case 22:case 23:return kC(),null;case 24:return null;default:return null}}var Yw=!1,Uo=!1,gW=typeof WeakSet=="function"?WeakSet:Set,Or=null;function ag(t,e){var s=t.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(u){Cs(t,e,u)}else s.current=null}function xk(t,e,s){try{s()}catch(u){Cs(t,e,u)}}var FL=!1;function _W(t,e){if(nk=Zb,t=a5(),iC(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var u=s.getSelection&&s.getSelection();if(u&&u.rangeCount!==0){s=u.anchorNode;var h=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{s.nodeType,_.nodeType}catch{s=null;break e}var w=0,o=-1,k=-1,P=0,O=0,F=t,V=null;t:for(;;){for(var $;F!==s||h!==0&&F.nodeType!==3||(o=w+h),F!==_||u!==0&&F.nodeType!==3||(k=w+u),F.nodeType===3&&(w+=F.nodeValue.length),($=F.firstChild)!==null;)V=F,F=$;for(;;){if(F===t)break t;if(V===s&&++P===h&&(o=w),V===_&&++O===u&&(k=w),($=F.nextSibling)!==null)break;F=V,V=F.parentNode}F=$}s=o===-1||k===-1?null:{start:o,end:k}}else s=null}s=s||{start:0,end:0}}else s=null;for(ik={focusedElem:t,selectionRange:s},Zb=!1,Or=e;Or!==null;)if(e=Or,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Or=t;else for(;Or!==null;){e=Or;try{var Y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(Y!==null){var Z=Y.memoizedProps,se=Y.memoizedState,te=e.stateNode,ee=te.getSnapshotBeforeUpdate(e.elementType===e.type?Z:ec(e.type,Z),se);te.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var oe=e.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ir(163))}}catch(he){Cs(e,e.return,he)}if(t=e.sibling,t!==null){t.return=e.return,Or=t;break}Or=e.return}return Y=FL,FL=!1,Y}function Cv(t,e,s){var u=e.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var h=u=u.next;do{if((h.tag&t)===t){var _=h.destroy;h.destroy=void 0,_!==void 0&&xk(e,s,_)}h=h.next}while(h!==u)}}function G1(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var s=e=e.next;do{if((s.tag&t)===t){var u=s.create;s.destroy=u()}s=s.next}while(s!==e)}}function wk(t){var e=t.ref;if(e!==null){var s=t.stateNode;switch(t.tag){case 5:t=s;break;default:t=s}typeof e=="function"?e(t):e.current=t}}function nB(t){var e=t.alternate;e!==null&&(t.alternate=null,nB(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Vc],delete e[Xv],delete e[ak],delete e[QH],delete e[eW])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function iB(t){return t.tag===5||t.tag===3||t.tag===4}function BL(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||iB(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function bk(t,e,s){var u=t.tag;if(u===5||u===6)t=t.stateNode,e?s.nodeType===8?s.parentNode.insertBefore(t,e):s.insertBefore(t,e):(s.nodeType===8?(e=s.parentNode,e.insertBefore(t,s)):(e=s,e.appendChild(t)),s=s._reactRootContainer,s!=null||e.onclick!==null||(e.onclick=Jb));else if(u!==4&&(t=t.child,t!==null))for(bk(t,e,s),t=t.sibling;t!==null;)bk(t,e,s),t=t.sibling}function Sk(t,e,s){var u=t.tag;if(u===5||u===6)t=t.stateNode,e?s.insertBefore(t,e):s.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(Sk(t,e,s),t=t.sibling;t!==null;)Sk(t,e,s),t=t.sibling}var Io=null,sc=!1;function kd(t,e,s){for(s=s.child;s!==null;)sB(t,e,s),s=s.sibling}function sB(t,e,s){if(Hc&&typeof Hc.onCommitFiberUnmount=="function")try{Hc.onCommitFiberUnmount(z1,s)}catch{}switch(s.tag){case 5:Uo||ag(s,e);case 6:var u=Io,h=sc;Io=null,kd(t,e,s),Io=u,sc=h,Io!==null&&(sc?(t=Io,s=s.stateNode,t.nodeType===8?t.parentNode.removeChild(s):t.removeChild(s)):Io.removeChild(s.stateNode));break;case 18:Io!==null&&(sc?(t=Io,s=s.stateNode,t.nodeType===8?O2(t.parentNode,s):t.nodeType===1&&O2(t,s),Hv(t)):O2(Io,s.stateNode));break;case 4:u=Io,h=sc,Io=s.stateNode.containerInfo,sc=!0,kd(t,e,s),Io=u,sc=h;break;case 0:case 11:case 14:case 15:if(!Uo&&(u=s.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){h=u=u.next;do{var _=h,w=_.destroy;_=_.tag,w!==void 0&&(_&2||_&4)&&xk(s,e,w),h=h.next}while(h!==u)}kd(t,e,s);break;case 1:if(!Uo&&(ag(s,e),u=s.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=s.memoizedProps,u.state=s.memoizedState,u.componentWillUnmount()}catch(o){Cs(s,e,o)}kd(t,e,s);break;case 21:kd(t,e,s);break;case 22:s.mode&1?(Uo=(u=Uo)||s.memoizedState!==null,kd(t,e,s),Uo=u):kd(t,e,s);break;default:kd(t,e,s)}}function NL(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var s=t.stateNode;s===null&&(s=t.stateNode=new gW),e.forEach(function(u){var h=kW.bind(null,t,u);s.has(u)||(s.add(u),u.then(h,h))})}}function Zl(t,e){var s=e.deletions;if(s!==null)for(var u=0;u<s.length;u++){var h=s[u];try{var _=t,w=e,o=w;e:for(;o!==null;){switch(o.tag){case 5:Io=o.stateNode,sc=!1;break e;case 3:Io=o.stateNode.containerInfo,sc=!0;break e;case 4:Io=o.stateNode.containerInfo,sc=!0;break e}o=o.return}if(Io===null)throw Error(ir(160));sB(_,w,h),Io=null,sc=!1;var k=h.alternate;k!==null&&(k.return=null),h.return=null}catch(P){Cs(h,e,P)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)oB(e,t),e=e.sibling}function oB(t,e){var s=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Zl(e,t),zc(t),u&4){try{Cv(3,t,t.return),G1(3,t)}catch(Z){Cs(t,t.return,Z)}try{Cv(5,t,t.return)}catch(Z){Cs(t,t.return,Z)}}break;case 1:Zl(e,t),zc(t),u&512&&s!==null&&ag(s,s.return);break;case 5:if(Zl(e,t),zc(t),u&512&&s!==null&&ag(s,s.return),t.flags&32){var h=t.stateNode;try{Vv(h,"")}catch(Z){Cs(t,t.return,Z)}}if(u&4&&(h=t.stateNode,h!=null)){var _=t.memoizedProps,w=s!==null?s.memoizedProps:_,o=t.type,k=t.updateQueue;if(t.updateQueue=null,k!==null)try{o==="input"&&_.type==="radio"&&_.name!=null&&CF(h,_),qE(o,w);var P=qE(o,_);for(w=0;w<k.length;w+=2){var O=k[w],F=k[w+1];O==="style"?DF(h,F):O==="dangerouslySetInnerHTML"?MF(h,F):O==="children"?Vv(h,F):HA(h,O,F,P)}switch(o){case"input":UE(h,_);break;case"textarea":IF(h,_);break;case"select":var V=h._wrapperState.wasMultiple;h._wrapperState.wasMultiple=!!_.multiple;var $=_.value;$!=null?mg(h,!!_.multiple,$,!1):V!==!!_.multiple&&(_.defaultValue!=null?mg(h,!!_.multiple,_.defaultValue,!0):mg(h,!!_.multiple,_.multiple?[]:"",!1))}h[Xv]=_}catch(Z){Cs(t,t.return,Z)}}break;case 6:if(Zl(e,t),zc(t),u&4){if(t.stateNode===null)throw Error(ir(162));h=t.stateNode,_=t.memoizedProps;try{h.nodeValue=_}catch(Z){Cs(t,t.return,Z)}}break;case 3:if(Zl(e,t),zc(t),u&4&&s!==null&&s.memoizedState.isDehydrated)try{Hv(e.containerInfo)}catch(Z){Cs(t,t.return,Z)}break;case 4:Zl(e,t),zc(t);break;case 13:Zl(e,t),zc(t),h=t.child,h.flags&8192&&(_=h.memoizedState!==null,h.stateNode.isHidden=_,!_||h.alternate!==null&&h.alternate.memoizedState!==null||(TC=Ds())),u&4&&NL(t);break;case 22:if(O=s!==null&&s.memoizedState!==null,t.mode&1?(Uo=(P=Uo)||O,Zl(e,t),Uo=P):Zl(e,t),zc(t),u&8192){if(P=t.memoizedState!==null,(t.stateNode.isHidden=P)&&!O&&t.mode&1)for(Or=t,O=t.child;O!==null;){for(F=Or=O;Or!==null;){switch(V=Or,$=V.child,V.tag){case 0:case 11:case 14:case 15:Cv(4,V,V.return);break;case 1:ag(V,V.return);var Y=V.stateNode;if(typeof Y.componentWillUnmount=="function"){u=V,s=V.return;try{e=u,Y.props=e.memoizedProps,Y.state=e.memoizedState,Y.componentWillUnmount()}catch(Z){Cs(u,s,Z)}}break;case 5:ag(V,V.return);break;case 22:if(V.memoizedState!==null){VL(F);continue}}$!==null?($.return=V,Or=$):VL(F)}O=O.sibling}e:for(O=null,F=t;;){if(F.tag===5){if(O===null){O=F;try{h=F.stateNode,P?(_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(o=F.stateNode,k=F.memoizedProps.style,w=k!=null&&k.hasOwnProperty("display")?k.display:null,o.style.display=RF("display",w))}catch(Z){Cs(t,t.return,Z)}}}else if(F.tag===6){if(O===null)try{F.stateNode.nodeValue=P?"":F.memoizedProps}catch(Z){Cs(t,t.return,Z)}}else if((F.tag!==22&&F.tag!==23||F.memoizedState===null||F===t)&&F.child!==null){F.child.return=F,F=F.child;continue}if(F===t)break e;for(;F.sibling===null;){if(F.return===null||F.return===t)break e;O===F&&(O=null),F=F.return}O===F&&(O=null),F.sibling.return=F.return,F=F.sibling}}break;case 19:Zl(e,t),zc(t),u&4&&NL(t);break;case 21:break;default:Zl(e,t),zc(t)}}function zc(t){var e=t.flags;if(e&2){try{e:{for(var s=t.return;s!==null;){if(iB(s)){var u=s;break e}s=s.return}throw Error(ir(160))}switch(u.tag){case 5:var h=u.stateNode;u.flags&32&&(Vv(h,""),u.flags&=-33);var _=BL(t);Sk(t,_,h);break;case 3:case 4:var w=u.stateNode.containerInfo,o=BL(t);bk(t,o,w);break;default:throw Error(ir(161))}}catch(k){Cs(t,t.return,k)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function yW(t,e,s){Or=t,aB(t)}function aB(t,e,s){for(var u=(t.mode&1)!==0;Or!==null;){var h=Or,_=h.child;if(h.tag===22&&u){var w=h.memoizedState!==null||Yw;if(!w){var o=h.alternate,k=o!==null&&o.memoizedState!==null||Uo;o=Yw;var P=Uo;if(Yw=w,(Uo=k)&&!P)for(Or=h;Or!==null;)w=Or,k=w.child,w.tag===22&&w.memoizedState!==null?UL(h):k!==null?(k.return=w,Or=k):UL(h);for(;_!==null;)Or=_,aB(_),_=_.sibling;Or=h,Yw=o,Uo=P}jL(t)}else h.subtreeFlags&8772&&_!==null?(_.return=h,Or=_):jL(t)}}function jL(t){for(;Or!==null;){var e=Or;if(e.flags&8772){var s=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Uo||G1(5,e);break;case 1:var u=e.stateNode;if(e.flags&4&&!Uo)if(s===null)u.componentDidMount();else{var h=e.elementType===e.type?s.memoizedProps:ec(e.type,s.memoizedProps);u.componentDidUpdate(h,s.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var _=e.updateQueue;_!==null&&TL(e,_,u);break;case 3:var w=e.updateQueue;if(w!==null){if(s=null,e.child!==null)switch(e.child.tag){case 5:s=e.child.stateNode;break;case 1:s=e.child.stateNode}TL(e,w,s)}break;case 5:var o=e.stateNode;if(s===null&&e.flags&4){s=o;var k=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":k.autoFocus&&s.focus();break;case"img":k.src&&(s.src=k.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var P=e.alternate;if(P!==null){var O=P.memoizedState;if(O!==null){var F=O.dehydrated;F!==null&&Hv(F)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ir(163))}Uo||e.flags&512&&wk(e)}catch(V){Cs(e,e.return,V)}}if(e===t){Or=null;break}if(s=e.sibling,s!==null){s.return=e.return,Or=s;break}Or=e.return}}function VL(t){for(;Or!==null;){var e=Or;if(e===t){Or=null;break}var s=e.sibling;if(s!==null){s.return=e.return,Or=s;break}Or=e.return}}function UL(t){for(;Or!==null;){var e=Or;try{switch(e.tag){case 0:case 11:case 15:var s=e.return;try{G1(4,e)}catch(k){Cs(e,s,k)}break;case 1:var u=e.stateNode;if(typeof u.componentDidMount=="function"){var h=e.return;try{u.componentDidMount()}catch(k){Cs(e,h,k)}}var _=e.return;try{wk(e)}catch(k){Cs(e,_,k)}break;case 5:var w=e.return;try{wk(e)}catch(k){Cs(e,w,k)}}}catch(k){Cs(e,e.return,k)}if(e===t){Or=null;break}var o=e.sibling;if(o!==null){o.return=e.return,Or=o;break}Or=e.return}}var vW=Math.ceil,c1=$u.ReactCurrentDispatcher,bC=$u.ReactCurrentOwner,wl=$u.ReactCurrentBatchConfig,pi=0,go=null,qs=null,Mo=0,Ua=0,lg=uh(0),no=0,r0=null,Nf=0,H1=0,SC=0,Iv=null,Ta=null,TC=0,jg=1/0,Au=null,u1=!1,Tk=null,Qd=null,Jw=!1,Hd=null,d1=0,Pv=0,Ek=null,Ib=-1,Pb=0;function aa(){return pi&6?Ds():Ib!==-1?Ib:Ib=Ds()}function eh(t){return t.mode&1?pi&2&&Mo!==0?Mo&-Mo:rW.transition!==null?(Pb===0&&(Pb=HF()),Pb):(t=Ii,t!==0||(t=window.event,t=t===void 0?16:JF(t.type)),t):1}function cc(t,e,s,u){if(50<Pv)throw Pv=0,Ek=null,Error(ir(185));A0(t,s,u),(!(pi&2)||t!==go)&&(t===go&&(!(pi&2)&&(H1|=s),no===4&&Fd(t,Mo)),Ia(t,u),s===1&&pi===0&&!(e.mode&1)&&(jg=Ds()+500,V1&&dh()))}function Ia(t,e){var s=t.callbackNode;rH(t,e);var u=Kb(t,t===go?Mo:0);if(u===0)s!==null&&YD(s),t.callbackNode=null,t.callbackPriority=0;else if(e=u&-u,t.callbackPriority!==e){if(s!=null&&YD(s),e===1)t.tag===0?tW($L.bind(null,t)):_5($L.bind(null,t)),YH(function(){!(pi&6)&&dh()}),s=null;else{switch(WF(u)){case 1:s=XA;break;case 4:s=$F;break;case 16:s=qb;break;case 536870912:s=GF;break;default:s=qb}s=mB(s,lB.bind(null,t))}t.callbackPriority=e,t.callbackNode=s}}function lB(t,e){if(Ib=-1,Pb=0,pi&6)throw Error(ir(327));var s=t.callbackNode;if(xg()&&t.callbackNode!==s)return null;var u=Kb(t,t===go?Mo:0);if(u===0)return null;if(u&30||u&t.expiredLanes||e)e=h1(t,u);else{e=u;var h=pi;pi|=2;var _=uB();(go!==t||Mo!==e)&&(Au=null,jg=Ds()+500,Mf(t,e));do try{bW();break}catch(o){cB(t,o)}while(!0);cC(),c1.current=_,pi=h,qs!==null?e=0:(go=null,Mo=0,e=no)}if(e!==0){if(e===2&&(h=JE(t),h!==0&&(u=h,e=kk(t,h))),e===1)throw s=r0,Mf(t,0),Fd(t,u),Ia(t,Ds()),s;if(e===6)Fd(t,u);else{if(h=t.current.alternate,!(u&30)&&!xW(h)&&(e=h1(t,u),e===2&&(_=JE(t),_!==0&&(u=_,e=kk(t,_))),e===1))throw s=r0,Mf(t,0),Fd(t,u),Ia(t,Ds()),s;switch(t.finishedWork=h,t.finishedLanes=u,e){case 0:case 1:throw Error(ir(345));case 2:ff(t,Ta,Au);break;case 3:if(Fd(t,u),(u&130023424)===u&&(e=TC+500-Ds(),10<e)){if(Kb(t,0)!==0)break;if(h=t.suspendedLanes,(h&u)!==u){aa(),t.pingedLanes|=t.suspendedLanes&h;break}t.timeoutHandle=ok(ff.bind(null,t,Ta,Au),e);break}ff(t,Ta,Au);break;case 4:if(Fd(t,u),(u&4194240)===u)break;for(e=t.eventTimes,h=-1;0<u;){var w=31-lc(u);_=1<<w,w=e[w],w>h&&(h=w),u&=~_}if(u=h,u=Ds()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*vW(u/1960))-u,10<u){t.timeoutHandle=ok(ff.bind(null,t,Ta,Au),u);break}ff(t,Ta,Au);break;case 5:ff(t,Ta,Au);break;default:throw Error(ir(329))}}}return Ia(t,Ds()),t.callbackNode===s?lB.bind(null,t):null}function kk(t,e){var s=Iv;return t.current.memoizedState.isDehydrated&&(Mf(t,e).flags|=256),t=h1(t,e),t!==2&&(e=Ta,Ta=s,e!==null&&Ak(e)),t}function Ak(t){Ta===null?Ta=t:Ta.push.apply(Ta,t)}function xW(t){for(var e=t;;){if(e.flags&16384){var s=e.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var u=0;u<s.length;u++){var h=s[u],_=h.getSnapshot;h=h.value;try{if(!uc(_(),h))return!1}catch{return!1}}}if(s=e.child,e.subtreeFlags&16384&&s!==null)s.return=e,e=s;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Fd(t,e){for(e&=~SC,e&=~H1,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var s=31-lc(e),u=1<<s;t[s]=-1,e&=~u}}function $L(t){if(pi&6)throw Error(ir(327));xg();var e=Kb(t,0);if(!(e&1))return Ia(t,Ds()),null;var s=h1(t,e);if(t.tag!==0&&s===2){var u=JE(t);u!==0&&(e=u,s=kk(t,u))}if(s===1)throw s=r0,Mf(t,0),Fd(t,e),Ia(t,Ds()),s;if(s===6)throw Error(ir(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ff(t,Ta,Au),Ia(t,Ds()),null}function EC(t,e){var s=pi;pi|=1;try{return t(e)}finally{pi=s,pi===0&&(jg=Ds()+500,V1&&dh())}}function jf(t){Hd!==null&&Hd.tag===0&&!(pi&6)&&xg();var e=pi;pi|=1;var s=wl.transition,u=Ii;try{if(wl.transition=null,Ii=1,t)return t()}finally{Ii=u,wl.transition=s,pi=e,!(pi&6)&&dh()}}function kC(){Ua=lg.current,ts(lg)}function Mf(t,e){t.finishedWork=null,t.finishedLanes=0;var s=t.timeoutHandle;if(s!==-1&&(t.timeoutHandle=-1,XH(s)),qs!==null)for(s=qs.return;s!==null;){var u=s;switch(oC(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&Qb();break;case 3:Bg(),ts(Aa),ts(Go),mC();break;case 5:pC(u);break;case 4:Bg();break;case 13:ts(ys);break;case 19:ts(ys);break;case 10:uC(u.type._context);break;case 22:case 23:kC()}s=s.return}if(go=t,qs=t=th(t.current,null),Mo=Ua=e,no=0,r0=null,SC=H1=Nf=0,Ta=Iv=null,xf!==null){for(e=0;e<xf.length;e++)if(s=xf[e],u=s.interleaved,u!==null){s.interleaved=null;var h=u.next,_=s.pending;if(_!==null){var w=_.next;_.next=h,u.next=w}s.pending=u}xf=null}return t}function cB(t,e){do{var s=qs;try{if(cC(),kb.current=l1,a1){for(var u=xs.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}a1=!1}if(Bf=0,mo=to=xs=null,Av=!1,Qv=0,bC.current=null,s===null||s.return===null){no=1,r0=e,qs=null;break}e:{var _=t,w=s.return,o=s,k=e;if(e=Mo,o.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){var P=k,O=o,F=O.tag;if(!(O.mode&1)&&(F===0||F===11||F===15)){var V=O.alternate;V?(O.updateQueue=V.updateQueue,O.memoizedState=V.memoizedState,O.lanes=V.lanes):(O.updateQueue=null,O.memoizedState=null)}var $=PL(w);if($!==null){$.flags&=-257,ML($,w,o,_,e),$.mode&1&&IL(_,P,e),e=$,k=P;var Y=e.updateQueue;if(Y===null){var Z=new Set;Z.add(k),e.updateQueue=Z}else Y.add(k);break e}else{if(!(e&1)){IL(_,P,e),AC();break e}k=Error(ir(426))}}else if(as&&o.mode&1){var se=PL(w);if(se!==null){!(se.flags&65536)&&(se.flags|=256),ML(se,w,o,_,e),aC(Ng(k,o));break e}}_=k=Ng(k,o),no!==4&&(no=2),Iv===null?Iv=[_]:Iv.push(_),_=w;do{switch(_.tag){case 3:_.flags|=65536,e&=-e,_.lanes|=e;var te=W5(_,k,e);SL(_,te);break e;case 1:o=k;var ee=_.type,oe=_.stateNode;if(!(_.flags&128)&&(typeof ee.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Qd===null||!Qd.has(oe)))){_.flags|=65536,e&=-e,_.lanes|=e;var he=q5(_,o,e);SL(_,he);break e}}_=_.return}while(_!==null)}hB(s)}catch(Ie){e=Ie,qs===s&&s!==null&&(qs=s=s.return);continue}break}while(!0)}function uB(){var t=c1.current;return c1.current=l1,t===null?l1:t}function AC(){(no===0||no===3||no===2)&&(no=4),go===null||!(Nf&268435455)&&!(H1&268435455)||Fd(go,Mo)}function h1(t,e){var s=pi;pi|=2;var u=uB();(go!==t||Mo!==e)&&(Au=null,Mf(t,e));do try{wW();break}catch(h){cB(t,h)}while(!0);if(cC(),pi=s,c1.current=u,qs!==null)throw Error(ir(261));return go=null,Mo=0,no}function wW(){for(;qs!==null;)dB(qs)}function bW(){for(;qs!==null&&!qG();)dB(qs)}function dB(t){var e=pB(t.alternate,t,Ua);t.memoizedProps=t.pendingProps,e===null?hB(t):qs=e,bC.current=null}function hB(t){var e=t;do{var s=e.alternate;if(t=e.return,e.flags&32768){if(s=mW(s,e),s!==null){s.flags&=32767,qs=s;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{no=6,qs=null;return}}else if(s=pW(s,e,Ua),s!==null){qs=s;return}if(e=e.sibling,e!==null){qs=e;return}qs=e=t}while(e!==null);no===0&&(no=5)}function ff(t,e,s){var u=Ii,h=wl.transition;try{wl.transition=null,Ii=1,SW(t,e,s,u)}finally{wl.transition=h,Ii=u}return null}function SW(t,e,s,u){do xg();while(Hd!==null);if(pi&6)throw Error(ir(327));s=t.finishedWork;var h=t.finishedLanes;if(s===null)return null;if(t.finishedWork=null,t.finishedLanes=0,s===t.current)throw Error(ir(177));t.callbackNode=null,t.callbackPriority=0;var _=s.lanes|s.childLanes;if(nH(t,_),t===go&&(qs=go=null,Mo=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||Jw||(Jw=!0,mB(qb,function(){return xg(),null})),_=(s.flags&15990)!==0,s.subtreeFlags&15990||_){_=wl.transition,wl.transition=null;var w=Ii;Ii=1;var o=pi;pi|=4,bC.current=null,_W(t,s),oB(s,t),$H(ik),Zb=!!nk,ik=nk=null,t.current=s,yW(s),KG(),pi=o,Ii=w,wl.transition=_}else t.current=s;if(Jw&&(Jw=!1,Hd=t,d1=h),_=t.pendingLanes,_===0&&(Qd=null),YG(s.stateNode),Ia(t,Ds()),e!==null)for(u=t.onRecoverableError,s=0;s<e.length;s++)h=e[s],u(h.value,{componentStack:h.stack,digest:h.digest});if(u1)throw u1=!1,t=Tk,Tk=null,t;return d1&1&&t.tag!==0&&xg(),_=t.pendingLanes,_&1?t===Ek?Pv++:(Pv=0,Ek=t):Pv=0,dh(),null}function xg(){if(Hd!==null){var t=WF(d1),e=wl.transition,s=Ii;try{if(wl.transition=null,Ii=16>t?16:t,Hd===null)var u=!1;else{if(t=Hd,Hd=null,d1=0,pi&6)throw Error(ir(331));var h=pi;for(pi|=4,Or=t.current;Or!==null;){var _=Or,w=_.child;if(Or.flags&16){var o=_.deletions;if(o!==null){for(var k=0;k<o.length;k++){var P=o[k];for(Or=P;Or!==null;){var O=Or;switch(O.tag){case 0:case 11:case 15:Cv(8,O,_)}var F=O.child;if(F!==null)F.return=O,Or=F;else for(;Or!==null;){O=Or;var V=O.sibling,$=O.return;if(nB(O),O===P){Or=null;break}if(V!==null){V.return=$,Or=V;break}Or=$}}}var Y=_.alternate;if(Y!==null){var Z=Y.child;if(Z!==null){Y.child=null;do{var se=Z.sibling;Z.sibling=null,Z=se}while(Z!==null)}}Or=_}}if(_.subtreeFlags&2064&&w!==null)w.return=_,Or=w;else e:for(;Or!==null;){if(_=Or,_.flags&2048)switch(_.tag){case 0:case 11:case 15:Cv(9,_,_.return)}var te=_.sibling;if(te!==null){te.return=_.return,Or=te;break e}Or=_.return}}var ee=t.current;for(Or=ee;Or!==null;){w=Or;var oe=w.child;if(w.subtreeFlags&2064&&oe!==null)oe.return=w,Or=oe;else e:for(w=ee;Or!==null;){if(o=Or,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:G1(9,o)}}catch(Ie){Cs(o,o.return,Ie)}if(o===w){Or=null;break e}var he=o.sibling;if(he!==null){he.return=o.return,Or=he;break e}Or=o.return}}if(pi=h,dh(),Hc&&typeof Hc.onPostCommitFiberRoot=="function")try{Hc.onPostCommitFiberRoot(z1,t)}catch{}u=!0}return u}finally{Ii=s,wl.transition=e}}return!1}function GL(t,e,s){e=Ng(s,e),e=W5(t,e,1),t=Jd(t,e,1),e=aa(),t!==null&&(A0(t,1,e),Ia(t,e))}function Cs(t,e,s){if(t.tag===3)GL(t,t,s);else for(;e!==null;){if(e.tag===3){GL(e,t,s);break}else if(e.tag===1){var u=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Qd===null||!Qd.has(u))){t=Ng(s,t),t=q5(e,t,1),e=Jd(e,t,1),t=aa(),e!==null&&(A0(e,1,t),Ia(e,t));break}}e=e.return}}function TW(t,e,s){var u=t.pingCache;u!==null&&u.delete(e),e=aa(),t.pingedLanes|=t.suspendedLanes&s,go===t&&(Mo&s)===s&&(no===4||no===3&&(Mo&130023424)===Mo&&500>Ds()-TC?Mf(t,0):SC|=s),Ia(t,e)}function fB(t,e){e===0&&(t.mode&1?(e=Uw,Uw<<=1,!(Uw&130023424)&&(Uw=4194304)):e=1);var s=aa();t=zu(t,e),t!==null&&(A0(t,e,s),Ia(t,s))}function EW(t){var e=t.memoizedState,s=0;e!==null&&(s=e.retryLane),fB(t,s)}function kW(t,e){var s=0;switch(t.tag){case 13:var u=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(ir(314))}u!==null&&u.delete(e),fB(t,s)}var pB;pB=function(t,e,s){if(t!==null)if(t.memoizedProps!==e.pendingProps||Aa.current)Ea=!0;else{if(!(t.lanes&s)&&!(e.flags&128))return Ea=!1,fW(t,e,s);Ea=!!(t.flags&131072)}else Ea=!1,as&&e.flags&1048576&&y5(e,r1,e.index);switch(e.lanes=0,e.tag){case 2:var u=e.type;Cb(t,e),t=e.pendingProps;var h=Og(e,Go.current);vg(e,s),h=_C(null,e,u,t,h,s);var _=yC();return e.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ca(u)?(_=!0,e1(e)):_=!1,e.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,hC(e),h.updater=$1,e.stateNode=h,h._reactInternals=e,fk(e,u,t,s),e=gk(null,e,u,!0,_,s)):(e.tag=0,as&&_&&sC(e),ia(null,e,h,s),e=e.child),e;case 16:u=e.elementType;e:{switch(Cb(t,e),t=e.pendingProps,h=u._init,u=h(u._payload),e.type=u,h=e.tag=CW(u),t=ec(u,t),h){case 0:e=mk(null,e,u,t,s);break e;case 1:e=LL(null,e,u,t,s);break e;case 11:e=RL(null,e,u,t,s);break e;case 14:e=DL(null,e,u,ec(u.type,t),s);break e}throw Error(ir(306,u,""))}return e;case 0:return u=e.type,h=e.pendingProps,h=e.elementType===u?h:ec(u,h),mk(t,e,u,h,s);case 1:return u=e.type,h=e.pendingProps,h=e.elementType===u?h:ec(u,h),LL(t,e,u,h,s);case 3:e:{if(Y5(e),t===null)throw Error(ir(387));u=e.pendingProps,_=e.memoizedState,h=_.element,T5(t,e),s1(e,u,null,s);var w=e.memoizedState;if(u=w.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},e.updateQueue.baseState=_,e.memoizedState=_,e.flags&256){h=Ng(Error(ir(423)),e),e=OL(t,e,u,s,h);break e}else if(u!==h){h=Ng(Error(ir(424)),e),e=OL(t,e,u,s,h);break e}else for(qa=Yd(e.stateNode.containerInfo.firstChild),Ka=e,as=!0,ac=null,s=b5(e,null,u,s),e.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(zg(),u===h){e=Fu(t,e,s);break e}ia(t,e,u,s)}e=e.child}return e;case 5:return E5(e),t===null&&uk(e),u=e.type,h=e.pendingProps,_=t!==null?t.memoizedProps:null,w=h.children,sk(u,h)?w=null:_!==null&&sk(u,_)&&(e.flags|=32),X5(t,e),ia(t,e,w,s),e.child;case 6:return t===null&&uk(e),null;case 13:return J5(t,e,s);case 4:return fC(e,e.stateNode.containerInfo),u=e.pendingProps,t===null?e.child=Fg(e,null,u,s):ia(t,e,u,s),e.child;case 11:return u=e.type,h=e.pendingProps,h=e.elementType===u?h:ec(u,h),RL(t,e,u,h,s);case 7:return ia(t,e,e.pendingProps,s),e.child;case 8:return ia(t,e,e.pendingProps.children,s),e.child;case 12:return ia(t,e,e.pendingProps.children,s),e.child;case 10:e:{if(u=e.type._context,h=e.pendingProps,_=e.memoizedProps,w=h.value,Wi(n1,u._currentValue),u._currentValue=w,_!==null)if(uc(_.value,w)){if(_.children===h.children&&!Aa.current){e=Fu(t,e,s);break e}}else for(_=e.child,_!==null&&(_.return=e);_!==null;){var o=_.dependencies;if(o!==null){w=_.child;for(var k=o.firstContext;k!==null;){if(k.context===u){if(_.tag===1){k=Du(-1,s&-s),k.tag=2;var P=_.updateQueue;if(P!==null){P=P.shared;var O=P.pending;O===null?k.next=k:(k.next=O.next,O.next=k),P.pending=k}}_.lanes|=s,k=_.alternate,k!==null&&(k.lanes|=s),dk(_.return,s,e),o.lanes|=s;break}k=k.next}}else if(_.tag===10)w=_.type===e.type?null:_.child;else if(_.tag===18){if(w=_.return,w===null)throw Error(ir(341));w.lanes|=s,o=w.alternate,o!==null&&(o.lanes|=s),dk(w,s,e),w=_.sibling}else w=_.child;if(w!==null)w.return=_;else for(w=_;w!==null;){if(w===e){w=null;break}if(_=w.sibling,_!==null){_.return=w.return,w=_;break}w=w.return}_=w}ia(t,e,h.children,s),e=e.child}return e;case 9:return h=e.type,u=e.pendingProps.children,vg(e,s),h=Sl(h),u=u(h),e.flags|=1,ia(t,e,u,s),e.child;case 14:return u=e.type,h=ec(u,e.pendingProps),h=ec(u.type,h),DL(t,e,u,h,s);case 15:return K5(t,e,e.type,e.pendingProps,s);case 17:return u=e.type,h=e.pendingProps,h=e.elementType===u?h:ec(u,h),Cb(t,e),e.tag=1,Ca(u)?(t=!0,e1(e)):t=!1,vg(e,s),H5(e,u,h),fk(e,u,h,s),gk(null,e,u,!0,t,s);case 19:return Q5(t,e,s);case 22:return Z5(t,e,s)}throw Error(ir(156,e.tag))};function mB(t,e){return UF(t,e)}function AW(t,e,s,u){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vl(t,e,s,u){return new AW(t,e,s,u)}function CC(t){return t=t.prototype,!(!t||!t.isReactComponent)}function CW(t){if(typeof t=="function")return CC(t)?1:0;if(t!=null){if(t=t.$$typeof,t===qA)return 11;if(t===KA)return 14}return 2}function th(t,e){var s=t.alternate;return s===null?(s=vl(t.tag,e,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=e,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&14680064,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,e=t.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s}function Mb(t,e,s,u,h,_){var w=2;if(u=t,typeof t=="function")CC(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case Jm:return Rf(s.children,h,_,e);case WA:w=8,h|=8;break;case FE:return t=vl(12,s,e,h|2),t.elementType=FE,t.lanes=_,t;case BE:return t=vl(13,s,e,h),t.elementType=BE,t.lanes=_,t;case NE:return t=vl(19,s,e,h),t.elementType=NE,t.lanes=_,t;case EF:return W1(s,h,_,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case SF:w=10;break e;case TF:w=9;break e;case qA:w=11;break e;case KA:w=14;break e;case Dd:w=16,u=null;break e}throw Error(ir(130,t==null?t:typeof t,""))}return e=vl(w,s,e,h),e.elementType=t,e.type=u,e.lanes=_,e}function Rf(t,e,s,u){return t=vl(7,t,u,e),t.lanes=s,t}function W1(t,e,s,u){return t=vl(22,t,u,e),t.elementType=EF,t.lanes=s,t.stateNode={isHidden:!1},t}function $2(t,e,s){return t=vl(6,t,null,e),t.lanes=s,t}function G2(t,e,s){return e=vl(4,t.children!==null?t.children:[],t.key,e),e.lanes=s,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function IW(t,e,s,u,h){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=T2(0),this.expirationTimes=T2(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=T2(0),this.identifierPrefix=u,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function IC(t,e,s,u,h,_,w,o,k){return t=new IW(t,e,s,o,k),e===1?(e=1,_===!0&&(e|=8)):e=0,_=vl(3,null,null,e),t.current=_,_.stateNode=t,_.memoizedState={element:u,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},hC(_),t}function PW(t,e,s){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ym,key:u==null?null:""+u,children:t,containerInfo:e,implementation:s}}function gB(t){if(!t)return ih;t=t._reactInternals;e:{if(Hf(t)!==t||t.tag!==1)throw Error(ir(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Ca(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(ir(171))}if(t.tag===1){var s=t.type;if(Ca(s))return g5(t,s,e)}return e}function _B(t,e,s,u,h,_,w,o,k){return t=IC(s,u,!0,t,h,_,w,o,k),t.context=gB(null),s=t.current,u=aa(),h=eh(s),_=Du(u,h),_.callback=e??null,Jd(s,_,h),t.current.lanes=h,A0(t,h,u),Ia(t,u),t}function q1(t,e,s,u){var h=e.current,_=aa(),w=eh(h);return s=gB(s),e.context===null?e.context=s:e.pendingContext=s,e=Du(_,w),e.payload={element:t},u=u===void 0?null:u,u!==null&&(e.callback=u),t=Jd(h,e,w),t!==null&&(cc(t,h,w,_),Eb(t,h,w)),w}function f1(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function HL(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<e?s:e}}function PC(t,e){HL(t,e),(t=t.alternate)&&HL(t,e)}function MW(){return null}var yB=typeof reportError=="function"?reportError:function(t){console.error(t)};function MC(t){this._internalRoot=t}K1.prototype.render=MC.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(ir(409));q1(t,e,null,null)};K1.prototype.unmount=MC.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;jf(function(){q1(null,t,null,null)}),e[Ou]=null}};function K1(t){this._internalRoot=t}K1.prototype.unstable_scheduleHydration=function(t){if(t){var e=ZF();t={blockedOn:null,target:t,priority:e};for(var s=0;s<zd.length&&e!==0&&e<zd[s].priority;s++);zd.splice(s,0,t),s===0&&YF(t)}};function RC(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Z1(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function WL(){}function RW(t,e,s,u,h){if(h){if(typeof u=="function"){var _=u;u=function(){var P=f1(w);_.call(P)}}var w=_B(e,u,t,0,null,!1,!1,"",WL);return t._reactRootContainer=w,t[Ou]=w.current,Kv(t.nodeType===8?t.parentNode:t),jf(),w}for(;h=t.lastChild;)t.removeChild(h);if(typeof u=="function"){var o=u;u=function(){var P=f1(k);o.call(P)}}var k=IC(t,0,!1,null,null,!1,!1,"",WL);return t._reactRootContainer=k,t[Ou]=k.current,Kv(t.nodeType===8?t.parentNode:t),jf(function(){q1(e,k,s,u)}),k}function X1(t,e,s,u,h){var _=s._reactRootContainer;if(_){var w=_;if(typeof h=="function"){var o=h;h=function(){var k=f1(w);o.call(k)}}q1(e,w,t,h)}else w=RW(s,e,t,h,u);return f1(w)}qF=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var s=yv(e.pendingLanes);s!==0&&(YA(e,s|1),Ia(e,Ds()),!(pi&6)&&(jg=Ds()+500,dh()))}break;case 13:jf(function(){var u=zu(t,1);if(u!==null){var h=aa();cc(u,t,1,h)}}),PC(t,1)}};JA=function(t){if(t.tag===13){var e=zu(t,134217728);if(e!==null){var s=aa();cc(e,t,134217728,s)}PC(t,134217728)}};KF=function(t){if(t.tag===13){var e=eh(t),s=zu(t,e);if(s!==null){var u=aa();cc(s,t,e,u)}PC(t,e)}};ZF=function(){return Ii};XF=function(t,e){var s=Ii;try{return Ii=t,e()}finally{Ii=s}};ZE=function(t,e,s){switch(e){case"input":if(UE(t,s),e=s.name,s.type==="radio"&&e!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<s.length;e++){var u=s[e];if(u!==t&&u.form===t.form){var h=j1(u);if(!h)throw Error(ir(90));AF(u),UE(u,h)}}}break;case"textarea":IF(t,s);break;case"select":e=s.value,e!=null&&mg(t,!!s.multiple,e,!1)}};zF=EC;FF=jf;var DW={usingClientEntryPoint:!1,Events:[I0,rg,j1,LF,OF,EC]},cv={findFiberByHostInstance:vf,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},LW={bundleType:cv.bundleType,version:cv.version,rendererPackageName:cv.rendererPackageName,rendererConfig:cv.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:$u.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=jF(t),t===null?null:t.stateNode},findFiberByHostInstance:cv.findFiberByHostInstance||MW,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 Qw=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qw.isDisabled&&Qw.supportsFiber)try{z1=Qw.inject(LW),Hc=Qw}catch{}}Ya.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=DW;Ya.createPortal=function(t,e){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!RC(e))throw Error(ir(200));return PW(t,e,null,s)};Ya.createRoot=function(t,e){if(!RC(t))throw Error(ir(299));var s=!1,u="",h=yB;return e!=null&&(e.unstable_strictMode===!0&&(s=!0),e.identifierPrefix!==void 0&&(u=e.identifierPrefix),e.onRecoverableError!==void 0&&(h=e.onRecoverableError)),e=IC(t,1,!1,null,null,s,!1,u,h),t[Ou]=e.current,Kv(t.nodeType===8?t.parentNode:t),new MC(e)};Ya.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(ir(188)):(t=Object.keys(t).join(","),Error(ir(268,t)));return t=jF(e),t=t===null?null:t.stateNode,t};Ya.flushSync=function(t){return jf(t)};Ya.hydrate=function(t,e,s){if(!Z1(e))throw Error(ir(200));return X1(null,t,e,!0,s)};Ya.hydrateRoot=function(t,e,s){if(!RC(t))throw Error(ir(405));var u=s!=null&&s.hydratedSources||null,h=!1,_="",w=yB;if(s!=null&&(s.unstable_strictMode===!0&&(h=!0),s.identifierPrefix!==void 0&&(_=s.identifierPrefix),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),e=_B(e,null,t,1,s??null,h,!1,_,w),t[Ou]=e.current,Kv(t),u)for(t=0;t<u.length;t++)s=u[t],h=s._getVersion,h=h(s._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[s,h]:e.mutableSourceEagerHydrationData.push(s,h);return new K1(e)};Ya.render=function(t,e,s){if(!Z1(e))throw Error(ir(200));return X1(null,t,e,!1,s)};Ya.unmountComponentAtNode=function(t){if(!Z1(t))throw Error(ir(40));return t._reactRootContainer?(jf(function(){X1(null,null,t,!1,function(){t._reactRootContainer=null,t[Ou]=null})}),!0):!1};Ya.unstable_batchedUpdates=EC;Ya.unstable_renderSubtreeIntoContainer=function(t,e,s,u){if(!Z1(s))throw Error(ir(200));if(t==null||t._reactInternals===void 0)throw Error(ir(38));return X1(t,e,s,!1,u)};Ya.version="18.3.1-next-f1338f8080-20240426";function vB(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vB)}catch(t){console.error(t)}}vB(),vF.exports=Ya;var M0=vF.exports;const xB=FA(M0);var wB,qL=M0;wB=qL.createRoot,qL.hydrateRoot;const OW="modulepreload",zW=function(t){return"/"+t},KL={},cs=function(e,s,u){let h=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const w=document.querySelector("meta[property=csp-nonce]"),o=(w==null?void 0:w.nonce)||(w==null?void 0:w.getAttribute("nonce"));h=Promise.allSettled(s.map(k=>{if(k=zW(k),k in KL)return;KL[k]=!0;const P=k.endsWith(".css"),O=P?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${k}"]${O}`))return;const F=document.createElement("link");if(F.rel=P?"stylesheet":OW,P||(F.as="script"),F.crossOrigin="",F.href=k,o&&F.setAttribute("nonce",o),document.head.appendChild(F),P)return new Promise((V,$)=>{F.addEventListener("load",V),F.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${k}`)))})}))}function _(w){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=w,window.dispatchEvent(o),!o.defaultPrevented)throw w}return h.then(w=>{for(const o of w||[])o.status==="rejected"&&_(o.reason);return e().catch(_)})},FW=1,BW=1e6;let H2=0;function NW(){return H2=(H2+1)%Number.MAX_SAFE_INTEGER,H2.toString()}const W2=new Map,ZL=t=>{if(W2.has(t))return;const e=setTimeout(()=>{W2.delete(t),Mv({type:"REMOVE_TOAST",toastId:t})},BW);W2.set(t,e)},jW=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,FW)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=e;return s?ZL(s):t.toasts.forEach(u=>{ZL(u.id)}),{...t,toasts:t.toasts.map(u=>u.id===s||s===void 0?{...u,open:!1}:u)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)}}},Rb=[];let Db={toasts:[]};function Mv(t){Db=jW(Db,t),Rb.forEach(e=>{e(Db)})}function VW({...t}){const e=NW(),s=h=>Mv({type:"UPDATE_TOAST",toast:{...h,id:e}}),u=()=>Mv({type:"DISMISS_TOAST",toastId:e});return Mv({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:h=>{h||u()}}}),{id:e,dismiss:u,update:s}}function UW(){const[t,e]=X.useState(Db);return X.useEffect(()=>(Rb.push(e),()=>{const s=Rb.indexOf(e);s>-1&&Rb.splice(s,1)}),[t]),{...t,toast:VW,dismiss:s=>Mv({type:"DISMISS_TOAST",toastId:s})}}function Ei(t,e,{checkForDefaultPrevented:s=!0}={}){return function(h){if(t==null||t(h),s===!1||!h.defaultPrevented)return e==null?void 0:e(h)}}function XL(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bB(...t){return e=>{let s=!1;const u=t.map(h=>{const _=XL(h,e);return!s&&typeof _=="function"&&(s=!0),_});if(s)return()=>{for(let h=0;h<u.length;h++){const _=u[h];typeof _=="function"?_():XL(t[h],null)}}}}function Os(...t){return X.useCallback(bB(...t),t)}function $W(t,e){const s=X.createContext(e),u=_=>{const{children:w,...o}=_,k=X.useMemo(()=>o,Object.values(o));return le.jsx(s.Provider,{value:k,children:w})};u.displayName=t+"Provider";function h(_){const w=X.useContext(s);if(w)return w;if(e!==void 0)return e;throw new Error(`\`${_}\` must be used within \`${t}\``)}return[u,h]}function Zg(t,e=[]){let s=[];function u(_,w){const o=X.createContext(w),k=s.length;s=[...s,w];const P=F=>{var te;const{scope:V,children:$,...Y}=F,Z=((te=V==null?void 0:V[t])==null?void 0:te[k])||o,se=X.useMemo(()=>Y,Object.values(Y));return le.jsx(Z.Provider,{value:se,children:$})};P.displayName=_+"Provider";function O(F,V){var Z;const $=((Z=V==null?void 0:V[t])==null?void 0:Z[k])||o,Y=X.useContext($);if(Y)return Y;if(w!==void 0)return w;throw new Error(`\`${F}\` must be used within \`${_}\``)}return[P,O]}const h=()=>{const _=s.map(w=>X.createContext(w));return function(o){const k=(o==null?void 0:o[t])||_;return X.useMemo(()=>({[`__scope${t}`]:{...o,[t]:k}}),[o,k])}};return h.scopeName=t,[u,GW(h,...e)]}function GW(...t){const e=t[0];if(t.length===1)return e;const s=()=>{const u=t.map(h=>({useScope:h(),scopeName:h.scopeName}));return function(_){const w=u.reduce((o,{useScope:k,scopeName:P})=>{const F=k(_)[`__scope${P}`];return{...o,...F}},{});return X.useMemo(()=>({[`__scope${e.scopeName}`]:w}),[w])}};return s.scopeName=e.scopeName,s}function n0(t){const e=WW(t),s=X.forwardRef((u,h)=>{const{children:_,...w}=u,o=X.Children.toArray(_),k=o.find(KW);if(k){const P=k.props.children,O=o.map(F=>F===k?X.Children.count(P)>1?X.Children.only(null):X.isValidElement(P)?P.props.children:null:F);return le.jsx(e,{...w,ref:h,children:X.isValidElement(P)?X.cloneElement(P,void 0,O):null})}return le.jsx(e,{...w,ref:h,children:_})});return s.displayName=`${t}.Slot`,s}var HW=n0("Slot");function WW(t){const e=X.forwardRef((s,u)=>{const{children:h,..._}=s;if(X.isValidElement(h)){const w=XW(h),o=ZW(_,h.props);return h.type!==X.Fragment&&(o.ref=u?bB(u,w):w),X.cloneElement(h,o)}return X.Children.count(h)>1?X.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SB=Symbol("radix.slottable");function qW(t){const e=({children:s})=>le.jsx(le.Fragment,{children:s});return e.displayName=`${t}.Slottable`,e.__radixId=SB,e}function KW(t){return X.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SB}function ZW(t,e){const s={...e};for(const u in e){const h=t[u],_=e[u];/^on[A-Z]/.test(u)?h&&_?s[u]=(...o)=>{const k=_(...o);return h(...o),k}:h&&(s[u]=h):u==="style"?s[u]={...h,..._}:u==="className"&&(s[u]=[h,_].filter(Boolean).join(" "))}return{...t,...s}}function XW(t){var u,h;let e=(u=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:u.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=(h=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:h.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}function TB(t){const e=t+"CollectionProvider",[s,u]=Zg(e),[h,_]=s(e,{collectionRef:{current:null},itemMap:new Map}),w=Z=>{const{scope:se,children:te}=Z,ee=dr.useRef(null),oe=dr.useRef(new Map).current;return le.jsx(h,{scope:se,itemMap:oe,collectionRef:ee,children:te})};w.displayName=e;const o=t+"CollectionSlot",k=n0(o),P=dr.forwardRef((Z,se)=>{const{scope:te,children:ee}=Z,oe=_(o,te),he=Os(se,oe.collectionRef);return le.jsx(k,{ref:he,children:ee})});P.displayName=o;const O=t+"CollectionItemSlot",F="data-radix-collection-item",V=n0(O),$=dr.forwardRef((Z,se)=>{const{scope:te,children:ee,...oe}=Z,he=dr.useRef(null),Ie=Os(se,he),Be=_(O,te);return dr.useEffect(()=>(Be.itemMap.set(he,{ref:he,...oe}),()=>void Be.itemMap.delete(he))),le.jsx(V,{[F]:"",ref:Ie,children:ee})});$.displayName=O;function Y(Z){const se=_(t+"CollectionConsumer",Z);return dr.useCallback(()=>{const ee=se.collectionRef.current;if(!ee)return[];const oe=Array.from(ee.querySelectorAll(`[${F}]`));return Array.from(se.itemMap.values()).sort((Be,je)=>oe.indexOf(Be.ref.current)-oe.indexOf(je.ref.current))},[se.collectionRef,se.itemMap])}return[{Provider:w,Slot:P,ItemSlot:$},Y,u]}var YW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qi=YW.reduce((t,e)=>{const s=n0(`Primitive.${e}`),u=X.forwardRef((h,_)=>{const{asChild:w,...o}=h,k=w?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),le.jsx(k,{...o,ref:_})});return u.displayName=`Primitive.${e}`,{...t,[e]:u}},{});function EB(t,e){t&&M0.flushSync(()=>t.dispatchEvent(e))}function Xc(t){const e=X.useRef(t);return X.useEffect(()=>{e.current=t}),X.useMemo(()=>(...s)=>{var u;return(u=e.current)==null?void 0:u.call(e,...s)},[])}function JW(t,e=globalThis==null?void 0:globalThis.document){const s=Xc(t);X.useEffect(()=>{const u=h=>{h.key==="Escape"&&s(h)};return e.addEventListener("keydown",u,{capture:!0}),()=>e.removeEventListener("keydown",u,{capture:!0})},[s,e])}var QW="DismissableLayer",Ck="dismissableLayer.update",eq="dismissableLayer.pointerDownOutside",tq="dismissableLayer.focusOutside",YL,kB=X.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Y1=X.forwardRef((t,e)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:_,onInteractOutside:w,onDismiss:o,...k}=t,P=X.useContext(kB),[O,F]=X.useState(null),V=(O==null?void 0:O.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,$]=X.useState({}),Y=Os(e,je=>F(je)),Z=Array.from(P.layers),[se]=[...P.layersWithOutsidePointerEventsDisabled].slice(-1),te=Z.indexOf(se),ee=O?Z.indexOf(O):-1,oe=P.layersWithOutsidePointerEventsDisabled.size>0,he=ee>=te,Ie=nq(je=>{const Je=je.target,ft=[...P.branches].some(kt=>kt.contains(Je));!he||ft||(h==null||h(je),w==null||w(je),je.defaultPrevented||o==null||o())},V),Be=iq(je=>{const Je=je.target;[...P.branches].some(kt=>kt.contains(Je))||(_==null||_(je),w==null||w(je),je.defaultPrevented||o==null||o())},V);return JW(je=>{ee===P.layers.size-1&&(u==null||u(je),!je.defaultPrevented&&o&&(je.preventDefault(),o()))},V),X.useEffect(()=>{if(O)return s&&(P.layersWithOutsidePointerEventsDisabled.size===0&&(YL=V.body.style.pointerEvents,V.body.style.pointerEvents="none"),P.layersWithOutsidePointerEventsDisabled.add(O)),P.layers.add(O),JL(),()=>{s&&P.layersWithOutsidePointerEventsDisabled.size===1&&(V.body.style.pointerEvents=YL)}},[O,V,s,P]),X.useEffect(()=>()=>{O&&(P.layers.delete(O),P.layersWithOutsidePointerEventsDisabled.delete(O),JL())},[O,P]),X.useEffect(()=>{const je=()=>$({});return document.addEventListener(Ck,je),()=>document.removeEventListener(Ck,je)},[]),le.jsx(qi.div,{...k,ref:Y,style:{pointerEvents:oe?he?"auto":"none":void 0,...t.style},onFocusCapture:Ei(t.onFocusCapture,Be.onFocusCapture),onBlurCapture:Ei(t.onBlurCapture,Be.onBlurCapture),onPointerDownCapture:Ei(t.onPointerDownCapture,Ie.onPointerDownCapture)})});Y1.displayName=QW;var rq="DismissableLayerBranch",AB=X.forwardRef((t,e)=>{const s=X.useContext(kB),u=X.useRef(null),h=Os(e,u);return X.useEffect(()=>{const _=u.current;if(_)return s.branches.add(_),()=>{s.branches.delete(_)}},[s.branches]),le.jsx(qi.div,{...t,ref:h})});AB.displayName=rq;function nq(t,e=globalThis==null?void 0:globalThis.document){const s=Xc(t),u=X.useRef(!1),h=X.useRef(()=>{});return X.useEffect(()=>{const _=o=>{if(o.target&&!u.current){let k=function(){CB(eq,s,P,{discrete:!0})};const P={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",h.current),h.current=k,e.addEventListener("click",h.current,{once:!0})):k()}else e.removeEventListener("click",h.current);u.current=!1},w=window.setTimeout(()=>{e.addEventListener("pointerdown",_)},0);return()=>{window.clearTimeout(w),e.removeEventListener("pointerdown",_),e.removeEventListener("click",h.current)}},[e,s]),{onPointerDownCapture:()=>u.current=!0}}function iq(t,e=globalThis==null?void 0:globalThis.document){const s=Xc(t),u=X.useRef(!1);return X.useEffect(()=>{const h=_=>{_.target&&!u.current&&CB(tq,s,{originalEvent:_},{discrete:!1})};return e.addEventListener("focusin",h),()=>e.removeEventListener("focusin",h)},[e,s]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function JL(){const t=new CustomEvent(Ck);document.dispatchEvent(t)}function CB(t,e,s,{discrete:u}){const h=s.originalEvent.target,_=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:s});e&&h.addEventListener(t,e,{once:!0}),u?EB(h,_):h.dispatchEvent(_)}var sq=Y1,oq=AB,Bu=globalThis!=null&&globalThis.document?X.useLayoutEffect:()=>{},aq="Portal",DC=X.forwardRef((t,e)=>{var o;const{container:s,...u}=t,[h,_]=X.useState(!1);Bu(()=>_(!0),[]);const w=s||h&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return w?xB.createPortal(le.jsx(qi.div,{...u,ref:e}),w):null});DC.displayName=aq;function lq(t,e){return X.useReducer((s,u)=>e[s][u]??s,t)}var Xg=t=>{const{present:e,children:s}=t,u=cq(e),h=typeof s=="function"?s({present:u.isPresent}):X.Children.only(s),_=Os(u.ref,uq(h));return typeof s=="function"||u.isPresent?X.cloneElement(h,{ref:_}):null};Xg.displayName="Presence";function cq(t){const[e,s]=X.useState(),u=X.useRef(null),h=X.useRef(t),_=X.useRef("none"),w=t?"mounted":"unmounted",[o,k]=lq(w,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return X.useEffect(()=>{const P=eb(u.current);_.current=o==="mounted"?P:"none"},[o]),Bu(()=>{const P=u.current,O=h.current;if(O!==t){const V=_.current,$=eb(P);t?k("MOUNT"):$==="none"||(P==null?void 0:P.display)==="none"?k("UNMOUNT"):k(O&&V!==$?"ANIMATION_OUT":"UNMOUNT"),h.current=t}},[t,k]),Bu(()=>{if(e){let P;const O=e.ownerDocument.defaultView??window,F=$=>{const Z=eb(u.current).includes($.animationName);if($.target===e&&Z&&(k("ANIMATION_END"),!h.current)){const se=e.style.animationFillMode;e.style.animationFillMode="forwards",P=O.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=se)})}},V=$=>{$.target===e&&(_.current=eb(u.current))};return e.addEventListener("animationstart",V),e.addEventListener("animationcancel",F),e.addEventListener("animationend",F),()=>{O.clearTimeout(P),e.removeEventListener("animationstart",V),e.removeEventListener("animationcancel",F),e.removeEventListener("animationend",F)}}else k("ANIMATION_END")},[e,k]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:X.useCallback(P=>{u.current=P?getComputedStyle(P):null,s(P)},[])}}function eb(t){return(t==null?void 0:t.animationName)||"none"}function uq(t){var u,h;let e=(u=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:u.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=(h=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:h.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var dq=UA[" useInsertionEffect ".trim().toString()]||Bu;function J1({prop:t,defaultProp:e,onChange:s=()=>{},caller:u}){const[h,_,w]=hq({defaultProp:e,onChange:s}),o=t!==void 0,k=o?t:h;{const O=X.useRef(t!==void 0);X.useEffect(()=>{const F=O.current;F!==o&&console.warn(`${u} is changing from ${F?"controlled":"uncontrolled"} to ${o?"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.`),O.current=o},[o,u])}const P=X.useCallback(O=>{var F;if(o){const V=fq(O)?O(t):O;V!==t&&((F=w.current)==null||F.call(w,V))}else _(O)},[o,t,_,w]);return[k,P]}function hq({defaultProp:t,onChange:e}){const[s,u]=X.useState(t),h=X.useRef(s),_=X.useRef(e);return dq(()=>{_.current=e},[e]),X.useEffect(()=>{var w;h.current!==s&&((w=_.current)==null||w.call(_,s),h.current=s)},[s,h]),[s,u,_]}function fq(t){return typeof t=="function"}var pq=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"}),mq="VisuallyHidden",Q1=X.forwardRef((t,e)=>le.jsx(qi.span,{...t,ref:e,style:{...pq,...t.style}}));Q1.displayName=mq;var gq=Q1,LC="ToastProvider",[OC,_q,yq]=TB("Toast"),[IB]=Zg("Toast",[yq]),[vq,eS]=IB(LC),PB=t=>{const{__scopeToast:e,label:s="Notification",duration:u=5e3,swipeDirection:h="right",swipeThreshold:_=50,children:w}=t,[o,k]=X.useState(null),[P,O]=X.useState(0),F=X.useRef(!1),V=X.useRef(!1);return s.trim()||console.error(`Invalid prop \`label\` supplied to \`${LC}\`. Expected non-empty \`string\`.`),le.jsx(OC.Provider,{scope:e,children:le.jsx(vq,{scope:e,label:s,duration:u,swipeDirection:h,swipeThreshold:_,toastCount:P,viewport:o,onViewportChange:k,onToastAdd:X.useCallback(()=>O($=>$+1),[]),onToastRemove:X.useCallback(()=>O($=>$-1),[]),isFocusedToastEscapeKeyDownRef:F,isClosePausedRef:V,children:w})})};PB.displayName=LC;var MB="ToastViewport",xq=["F8"],Ik="toast.viewportPause",Pk="toast.viewportResume",RB=X.forwardRef((t,e)=>{const{__scopeToast:s,hotkey:u=xq,label:h="Notifications ({hotkey})",..._}=t,w=eS(MB,s),o=_q(s),k=X.useRef(null),P=X.useRef(null),O=X.useRef(null),F=X.useRef(null),V=Os(e,F,w.onViewportChange),$=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),Y=w.toastCount>0;X.useEffect(()=>{const se=te=>{var oe;u.length!==0&&u.every(he=>te[he]||te.code===he)&&((oe=F.current)==null||oe.focus())};return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[u]),X.useEffect(()=>{const se=k.current,te=F.current;if(Y&&se&&te){const ee=()=>{if(!w.isClosePausedRef.current){const Be=new CustomEvent(Ik);te.dispatchEvent(Be),w.isClosePausedRef.current=!0}},oe=()=>{if(w.isClosePausedRef.current){const Be=new CustomEvent(Pk);te.dispatchEvent(Be),w.isClosePausedRef.current=!1}},he=Be=>{!se.contains(Be.relatedTarget)&&oe()},Ie=()=>{se.contains(document.activeElement)||oe()};return se.addEventListener("focusin",ee),se.addEventListener("focusout",he),se.addEventListener("pointermove",ee),se.addEventListener("pointerleave",Ie),window.addEventListener("blur",ee),window.addEventListener("focus",oe),()=>{se.removeEventListener("focusin",ee),se.removeEventListener("focusout",he),se.removeEventListener("pointermove",ee),se.removeEventListener("pointerleave",Ie),window.removeEventListener("blur",ee),window.removeEventListener("focus",oe)}}},[Y,w.isClosePausedRef]);const Z=X.useCallback(({tabbingDirection:se})=>{const ee=o().map(oe=>{const he=oe.ref.current,Ie=[he,...Dq(he)];return se==="forwards"?Ie:Ie.reverse()});return(se==="forwards"?ee.reverse():ee).flat()},[o]);return X.useEffect(()=>{const se=F.current;if(se){const te=ee=>{var Ie,Be,je;const oe=ee.altKey||ee.ctrlKey||ee.metaKey;if(ee.key==="Tab"&&!oe){const Je=document.activeElement,ft=ee.shiftKey;if(ee.target===se&&ft){(Ie=P.current)==null||Ie.focus();return}const jt=Z({tabbingDirection:ft?"backwards":"forwards"}),Qe=jt.findIndex(xt=>xt===Je);q2(jt.slice(Qe+1))?ee.preventDefault():ft?(Be=P.current)==null||Be.focus():(je=O.current)==null||je.focus()}};return se.addEventListener("keydown",te),()=>se.removeEventListener("keydown",te)}},[o,Z]),le.jsxs(oq,{ref:k,role:"region","aria-label":h.replace("{hotkey}",$),tabIndex:-1,style:{pointerEvents:Y?void 0:"none"},children:[Y&&le.jsx(Mk,{ref:P,onFocusFromOutsideViewport:()=>{const se=Z({tabbingDirection:"forwards"});q2(se)}}),le.jsx(OC.Slot,{scope:s,children:le.jsx(qi.ol,{tabIndex:-1,..._,ref:V})}),Y&&le.jsx(Mk,{ref:O,onFocusFromOutsideViewport:()=>{const se=Z({tabbingDirection:"backwards"});q2(se)}})]})});RB.displayName=MB;var DB="ToastFocusProxy",Mk=X.forwardRef((t,e)=>{const{__scopeToast:s,onFocusFromOutsideViewport:u,...h}=t,_=eS(DB,s);return le.jsx(Q1,{"aria-hidden":!0,tabIndex:0,...h,ref:e,style:{position:"fixed"},onFocus:w=>{var P;const o=w.relatedTarget;!((P=_.viewport)!=null&&P.contains(o))&&u()}})});Mk.displayName=DB;var R0="Toast",wq="toast.swipeStart",bq="toast.swipeMove",Sq="toast.swipeCancel",Tq="toast.swipeEnd",LB=X.forwardRef((t,e)=>{const{forceMount:s,open:u,defaultOpen:h,onOpenChange:_,...w}=t,[o,k]=J1({prop:u,defaultProp:h??!0,onChange:_,caller:R0});return le.jsx(Xg,{present:s||o,children:le.jsx(Aq,{open:o,...w,ref:e,onClose:()=>k(!1),onPause:Xc(t.onPause),onResume:Xc(t.onResume),onSwipeStart:Ei(t.onSwipeStart,P=>{P.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ei(t.onSwipeMove,P=>{const{x:O,y:F}=P.detail.delta;P.currentTarget.setAttribute("data-swipe","move"),P.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${O}px`),P.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${F}px`)}),onSwipeCancel:Ei(t.onSwipeCancel,P=>{P.currentTarget.setAttribute("data-swipe","cancel"),P.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),P.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),P.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),P.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ei(t.onSwipeEnd,P=>{const{x:O,y:F}=P.detail.delta;P.currentTarget.setAttribute("data-swipe","end"),P.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),P.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),P.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${O}px`),P.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${F}px`),k(!1)})})})});LB.displayName=R0;var[Eq,kq]=IB(R0,{onClose(){}}),Aq=X.forwardRef((t,e)=>{const{__scopeToast:s,type:u="foreground",duration:h,open:_,onClose:w,onEscapeKeyDown:o,onPause:k,onResume:P,onSwipeStart:O,onSwipeMove:F,onSwipeCancel:V,onSwipeEnd:$,...Y}=t,Z=eS(R0,s),[se,te]=X.useState(null),ee=Os(e,xt=>te(xt)),oe=X.useRef(null),he=X.useRef(null),Ie=h||Z.duration,Be=X.useRef(0),je=X.useRef(Ie),Je=X.useRef(0),{onToastAdd:ft,onToastRemove:kt}=Z,tr=Xc(()=>{var It;(se==null?void 0:se.contains(document.activeElement))&&((It=Z.viewport)==null||It.focus()),w()}),jt=X.useCallback(xt=>{!xt||xt===1/0||(window.clearTimeout(Je.current),Be.current=new Date().getTime(),Je.current=window.setTimeout(tr,xt))},[tr]);X.useEffect(()=>{const xt=Z.viewport;if(xt){const It=()=>{jt(je.current),P==null||P()},Ot=()=>{const Et=new Date().getTime()-Be.current;je.current=je.current-Et,window.clearTimeout(Je.current),k==null||k()};return xt.addEventListener(Ik,Ot),xt.addEventListener(Pk,It),()=>{xt.removeEventListener(Ik,Ot),xt.removeEventListener(Pk,It)}}},[Z.viewport,Ie,k,P,jt]),X.useEffect(()=>{_&&!Z.isClosePausedRef.current&&jt(Ie)},[_,Ie,Z.isClosePausedRef,jt]),X.useEffect(()=>(ft(),()=>kt()),[ft,kt]);const Qe=X.useMemo(()=>se?VB(se):null,[se]);return Z.viewport?le.jsxs(le.Fragment,{children:[Qe&&le.jsx(Cq,{__scopeToast:s,role:"status","aria-live":u==="foreground"?"assertive":"polite","aria-atomic":!0,children:Qe}),le.jsx(Eq,{scope:s,onClose:tr,children:M0.createPortal(le.jsx(OC.ItemSlot,{scope:s,children:le.jsx(sq,{asChild:!0,onEscapeKeyDown:Ei(o,()=>{Z.isFocusedToastEscapeKeyDownRef.current||tr(),Z.isFocusedToastEscapeKeyDownRef.current=!1}),children:le.jsx(qi.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":_?"open":"closed","data-swipe-direction":Z.swipeDirection,...Y,ref:ee,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ei(t.onKeyDown,xt=>{xt.key==="Escape"&&(o==null||o(xt.nativeEvent),xt.nativeEvent.defaultPrevented||(Z.isFocusedToastEscapeKeyDownRef.current=!0,tr()))}),onPointerDown:Ei(t.onPointerDown,xt=>{xt.button===0&&(oe.current={x:xt.clientX,y:xt.clientY})}),onPointerMove:Ei(t.onPointerMove,xt=>{if(!oe.current)return;const It=xt.clientX-oe.current.x,Ot=xt.clientY-oe.current.y,Et=!!he.current,st=["left","right"].includes(Z.swipeDirection),Pt=["left","up"].includes(Z.swipeDirection)?Math.min:Math.max,qt=st?Pt(0,It):0,_r=st?0:Pt(0,Ot),yr=xt.pointerType==="touch"?10:2,hr={x:qt,y:_r},Gr={originalEvent:xt,delta:hr};Et?(he.current=hr,tb(bq,F,Gr,{discrete:!1})):QL(hr,Z.swipeDirection,yr)?(he.current=hr,tb(wq,O,Gr,{discrete:!1}),xt.target.setPointerCapture(xt.pointerId)):(Math.abs(It)>yr||Math.abs(Ot)>yr)&&(oe.current=null)}),onPointerUp:Ei(t.onPointerUp,xt=>{const It=he.current,Ot=xt.target;if(Ot.hasPointerCapture(xt.pointerId)&&Ot.releasePointerCapture(xt.pointerId),he.current=null,oe.current=null,It){const Et=xt.currentTarget,st={originalEvent:xt,delta:It};QL(It,Z.swipeDirection,Z.swipeThreshold)?tb(Tq,$,st,{discrete:!0}):tb(Sq,V,st,{discrete:!0}),Et.addEventListener("click",Pt=>Pt.preventDefault(),{once:!0})}})})})}),Z.viewport)})]}):null}),Cq=t=>{const{__scopeToast:e,children:s,...u}=t,h=eS(R0,e),[_,w]=X.useState(!1),[o,k]=X.useState(!1);return Mq(()=>w(!0)),X.useEffect(()=>{const P=window.setTimeout(()=>k(!0),1e3);return()=>window.clearTimeout(P)},[]),o?null:le.jsx(DC,{asChild:!0,children:le.jsx(Q1,{...u,children:_&&le.jsxs(le.Fragment,{children:[h.label," ",s]})})})},Iq="ToastTitle",OB=X.forwardRef((t,e)=>{const{__scopeToast:s,...u}=t;return le.jsx(qi.div,{...u,ref:e})});OB.displayName=Iq;var Pq="ToastDescription",zB=X.forwardRef((t,e)=>{const{__scopeToast:s,...u}=t;return le.jsx(qi.div,{...u,ref:e})});zB.displayName=Pq;var FB="ToastAction",BB=X.forwardRef((t,e)=>{const{altText:s,...u}=t;return s.trim()?le.jsx(jB,{altText:s,asChild:!0,children:le.jsx(zC,{...u,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${FB}\`. Expected non-empty \`string\`.`),null)});BB.displayName=FB;var NB="ToastClose",zC=X.forwardRef((t,e)=>{const{__scopeToast:s,...u}=t,h=kq(NB,s);return le.jsx(jB,{asChild:!0,children:le.jsx(qi.button,{type:"button",...u,ref:e,onClick:Ei(t.onClick,h.onClose)})})});zC.displayName=NB;var jB=X.forwardRef((t,e)=>{const{__scopeToast:s,altText:u,...h}=t;return le.jsx(qi.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":u||void 0,...h,ref:e})});function VB(t){const e=[];return Array.from(t.childNodes).forEach(u=>{if(u.nodeType===u.TEXT_NODE&&u.textContent&&e.push(u.textContent),Rq(u)){const h=u.ariaHidden||u.hidden||u.style.display==="none",_=u.dataset.radixToastAnnounceExclude==="";if(!h)if(_){const w=u.dataset.radixToastAnnounceAlt;w&&e.push(w)}else e.push(...VB(u))}}),e}function tb(t,e,s,{discrete:u}){const h=s.originalEvent.currentTarget,_=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:s});e&&h.addEventListener(t,e,{once:!0}),u?EB(h,_):h.dispatchEvent(_)}var QL=(t,e,s=0)=>{const u=Math.abs(t.x),h=Math.abs(t.y),_=u>h;return e==="left"||e==="right"?_&&u>s:!_&&h>s};function Mq(t=()=>{}){const e=Xc(t);Bu(()=>{let s=0,u=0;return s=window.requestAnimationFrame(()=>u=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(u)}},[e])}function Rq(t){return t.nodeType===t.ELEMENT_NODE}function Dq(t){const e=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const h=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||h?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)e.push(s.currentNode);return e}function q2(t){const e=document.activeElement;return t.some(s=>s===e?!0:(s.focus(),document.activeElement!==e))}var Lq=PB,UB=RB,$B=LB,GB=OB,HB=zB,WB=BB,qB=zC;function KB(t){var e,s,u="";if(typeof t=="string"||typeof t=="number")u+=t;else if(typeof t=="object")if(Array.isArray(t)){var h=t.length;for(e=0;e<h;e++)t[e]&&(s=KB(t[e]))&&(u&&(u+=" "),u+=s)}else for(s in t)t[s]&&(u&&(u+=" "),u+=s);return u}function ZB(){for(var t,e,s=0,u="",h=arguments.length;s<h;s++)(t=arguments[s])&&(e=KB(t))&&(u&&(u+=" "),u+=e);return u}const eO=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,tO=ZB,FC=(t,e)=>s=>{var u;if((e==null?void 0:e.variants)==null)return tO(t,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:h,defaultVariants:_}=e,w=Object.keys(h).map(P=>{const O=s==null?void 0:s[P],F=_==null?void 0:_[P];if(O===null)return null;const V=eO(O)||eO(F);return h[P][V]}),o=s&&Object.entries(s).reduce((P,O)=>{let[F,V]=O;return V===void 0||(P[F]=V),P},{}),k=e==null||(u=e.compoundVariants)===null||u===void 0?void 0:u.reduce((P,O)=>{let{class:F,className:V,...$}=O;return Object.entries($).every(Y=>{let[Z,se]=Y;return Array.isArray(se)?se.includes({..._,...o}[Z]):{..._,...o}[Z]===se})?[...P,F,V]:P},[]);return tO(t,w,k,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 Oq=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),XB=(...t)=>t.filter((e,s,u)=>!!e&&e.trim()!==""&&u.indexOf(e)===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 zq={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 Fq=X.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:u,className:h="",children:_,iconNode:w,...o},k)=>X.createElement("svg",{ref:k,...zq,width:e,height:e,stroke:t,strokeWidth:u?Number(s)*24/Number(e):s,className:XB("lucide",h),...o},[...w.map(([P,O])=>X.createElement(P,O)),...Array.isArray(_)?_:[_]]));/**
|
||
* @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 ui=(t,e)=>{const s=X.forwardRef(({className:u,...h},_)=>X.createElement(Fq,{ref:_,iconNode:e,className:XB(`lucide-${Oq(t)}`,u),...h}));return s.displayName=`${t}`,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 Bq=ui("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 rO=ui("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 YB=ui("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 nO=ui("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 Nq=ui("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 jq=ui("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 Vq=ui("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 Om=ui("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 iO=ui("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 Uq=ui("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 Rk=ui("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 JB=ui("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 $q=ui("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 Gq=ui("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 Hq=ui("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 sO=ui("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 Wq=ui("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 qq=ui("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 p1=ui("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 Kq=ui("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 Zq=ui("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 QB=ui("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 Xq=ui("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 m1=ui("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 Dk=ui("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 Lk=ui("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 Yq=ui("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 Jq=ui("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 eN=ui("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 Qq=ui("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 oO=ui("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 e9=ui("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 t9=ui("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 r9=ui("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 Df=ui("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),BC="-",n9=t=>{const e=s9(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:u}=t;return{getClassGroupId:w=>{const o=w.split(BC);return o[0]===""&&o.length!==1&&o.shift(),tN(o,e)||i9(w)},getConflictingClassGroupIds:(w,o)=>{const k=s[w]||[];return o&&u[w]?[...k,...u[w]]:k}}},tN=(t,e)=>{var w;if(t.length===0)return e.classGroupId;const s=t[0],u=e.nextPart.get(s),h=u?tN(t.slice(1),u):void 0;if(h)return h;if(e.validators.length===0)return;const _=t.join(BC);return(w=e.validators.find(({validator:o})=>o(_)))==null?void 0:w.classGroupId},aO=/^\[(.+)\]$/,i9=t=>{if(aO.test(t)){const e=aO.exec(t)[1],s=e==null?void 0:e.substring(0,e.indexOf(":"));if(s)return"arbitrary.."+s}},s9=t=>{const{theme:e,prefix:s}=t,u={nextPart:new Map,validators:[]};return a9(Object.entries(t.classGroups),s).forEach(([_,w])=>{Ok(w,u,_,e)}),u},Ok=(t,e,s,u)=>{t.forEach(h=>{if(typeof h=="string"){const _=h===""?e:lO(e,h);_.classGroupId=s;return}if(typeof h=="function"){if(o9(h)){Ok(h(u),e,s,u);return}e.validators.push({validator:h,classGroupId:s});return}Object.entries(h).forEach(([_,w])=>{Ok(w,lO(e,_),s,u)})})},lO=(t,e)=>{let s=t;return e.split(BC).forEach(u=>{s.nextPart.has(u)||s.nextPart.set(u,{nextPart:new Map,validators:[]}),s=s.nextPart.get(u)}),s},o9=t=>t.isThemeGetter,a9=(t,e)=>e?t.map(([s,u])=>{const h=u.map(_=>typeof _=="string"?e+_:typeof _=="object"?Object.fromEntries(Object.entries(_).map(([w,o])=>[e+w,o])):_);return[s,h]}):t,l9=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,s=new Map,u=new Map;const h=(_,w)=>{s.set(_,w),e++,e>t&&(e=0,u=s,s=new Map)};return{get(_){let w=s.get(_);if(w!==void 0)return w;if((w=u.get(_))!==void 0)return h(_,w),w},set(_,w){s.has(_)?s.set(_,w):h(_,w)}}},rN="!",c9=t=>{const{separator:e,experimentalParseClassName:s}=t,u=e.length===1,h=e[0],_=e.length,w=o=>{const k=[];let P=0,O=0,F;for(let se=0;se<o.length;se++){let te=o[se];if(P===0){if(te===h&&(u||o.slice(se,se+_)===e)){k.push(o.slice(O,se)),O=se+_;continue}if(te==="/"){F=se;continue}}te==="["?P++:te==="]"&&P--}const V=k.length===0?o:o.substring(O),$=V.startsWith(rN),Y=$?V.substring(1):V,Z=F&&F>O?F-O:void 0;return{modifiers:k,hasImportantModifier:$,baseClassName:Y,maybePostfixModifierPosition:Z}};return s?o=>s({className:o,parseClassName:w}):w},u9=t=>{if(t.length<=1)return t;const e=[];let s=[];return t.forEach(u=>{u[0]==="["?(e.push(...s.sort(),u),s=[]):s.push(u)}),e.push(...s.sort()),e},d9=t=>({cache:l9(t.cacheSize),parseClassName:c9(t),...n9(t)}),h9=/\s+/,f9=(t,e)=>{const{parseClassName:s,getClassGroupId:u,getConflictingClassGroupIds:h}=e,_=[],w=t.trim().split(h9);let o="";for(let k=w.length-1;k>=0;k-=1){const P=w[k],{modifiers:O,hasImportantModifier:F,baseClassName:V,maybePostfixModifierPosition:$}=s(P);let Y=!!$,Z=u(Y?V.substring(0,$):V);if(!Z){if(!Y){o=P+(o.length>0?" "+o:o);continue}if(Z=u(V),!Z){o=P+(o.length>0?" "+o:o);continue}Y=!1}const se=u9(O).join(":"),te=F?se+rN:se,ee=te+Z;if(_.includes(ee))continue;_.push(ee);const oe=h(Z,Y);for(let he=0;he<oe.length;++he){const Ie=oe[he];_.push(te+Ie)}o=P+(o.length>0?" "+o:o)}return o};function p9(){let t=0,e,s,u="";for(;t<arguments.length;)(e=arguments[t++])&&(s=nN(e))&&(u&&(u+=" "),u+=s);return u}const nN=t=>{if(typeof t=="string")return t;let e,s="";for(let u=0;u<t.length;u++)t[u]&&(e=nN(t[u]))&&(s&&(s+=" "),s+=e);return s};function m9(t,...e){let s,u,h,_=w;function w(k){const P=e.reduce((O,F)=>F(O),t());return s=d9(P),u=s.cache.get,h=s.cache.set,_=o,o(k)}function o(k){const P=u(k);if(P)return P;const O=f9(k,s);return h(k,O),O}return function(){return _(p9.apply(null,arguments))}}const Qi=t=>{const e=s=>s[t]||[];return e.isThemeGetter=!0,e},iN=/^\[(?:([a-z-]+):)?(.+)\]$/i,g9=/^\d+\/\d+$/,_9=new Set(["px","full","screen"]),y9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,v9=/\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$/,x9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,w9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,b9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tu=t=>wg(t)||_9.has(t)||g9.test(t),Ad=t=>Yg(t,"length",P9),wg=t=>!!t&&!Number.isNaN(Number(t)),K2=t=>Yg(t,"number",wg),uv=t=>!!t&&Number.isInteger(Number(t)),S9=t=>t.endsWith("%")&&wg(t.slice(0,-1)),Hn=t=>iN.test(t),Cd=t=>y9.test(t),T9=new Set(["length","size","percentage"]),E9=t=>Yg(t,T9,sN),k9=t=>Yg(t,"position",sN),A9=new Set(["image","url"]),C9=t=>Yg(t,A9,R9),I9=t=>Yg(t,"",M9),dv=()=>!0,Yg=(t,e,s)=>{const u=iN.exec(t);return u?u[1]?typeof e=="string"?u[1]===e:e.has(u[1]):s(u[2]):!1},P9=t=>v9.test(t)&&!x9.test(t),sN=()=>!1,M9=t=>w9.test(t),R9=t=>b9.test(t),D9=()=>{const t=Qi("colors"),e=Qi("spacing"),s=Qi("blur"),u=Qi("brightness"),h=Qi("borderColor"),_=Qi("borderRadius"),w=Qi("borderSpacing"),o=Qi("borderWidth"),k=Qi("contrast"),P=Qi("grayscale"),O=Qi("hueRotate"),F=Qi("invert"),V=Qi("gap"),$=Qi("gradientColorStops"),Y=Qi("gradientColorStopPositions"),Z=Qi("inset"),se=Qi("margin"),te=Qi("opacity"),ee=Qi("padding"),oe=Qi("saturate"),he=Qi("scale"),Ie=Qi("sepia"),Be=Qi("skew"),je=Qi("space"),Je=Qi("translate"),ft=()=>["auto","contain","none"],kt=()=>["auto","hidden","clip","visible","scroll"],tr=()=>["auto",Hn,e],jt=()=>[Hn,e],Qe=()=>["",Tu,Ad],xt=()=>["auto",wg,Hn],It=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Ot=()=>["solid","dashed","dotted","double","none"],Et=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],st=()=>["start","end","center","between","around","evenly","stretch"],Pt=()=>["","0",Hn],qt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_r=()=>[wg,Hn];return{cacheSize:500,separator:":",theme:{colors:[dv],spacing:[Tu,Ad],blur:["none","",Cd,Hn],brightness:_r(),borderColor:[t],borderRadius:["none","","full",Cd,Hn],borderSpacing:jt(),borderWidth:Qe(),contrast:_r(),grayscale:Pt(),hueRotate:_r(),invert:Pt(),gap:jt(),gradientColorStops:[t],gradientColorStopPositions:[S9,Ad],inset:tr(),margin:tr(),opacity:_r(),padding:jt(),saturate:_r(),scale:_r(),sepia:Pt(),skew:_r(),space:jt(),translate:jt()},classGroups:{aspect:[{aspect:["auto","square","video",Hn]}],container:["container"],columns:[{columns:[Cd]}],"break-after":[{"break-after":qt()}],"break-before":[{"break-before":qt()}],"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:[...It(),Hn]}],overflow:[{overflow:kt()}],"overflow-x":[{"overflow-x":kt()}],"overflow-y":[{"overflow-y":kt()}],overscroll:[{overscroll:ft()}],"overscroll-x":[{"overscroll-x":ft()}],"overscroll-y":[{"overscroll-y":ft()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[Z]}],"inset-x":[{"inset-x":[Z]}],"inset-y":[{"inset-y":[Z]}],start:[{start:[Z]}],end:[{end:[Z]}],top:[{top:[Z]}],right:[{right:[Z]}],bottom:[{bottom:[Z]}],left:[{left:[Z]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uv,Hn]}],basis:[{basis:tr()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Hn]}],grow:[{grow:Pt()}],shrink:[{shrink:Pt()}],order:[{order:["first","last","none",uv,Hn]}],"grid-cols":[{"grid-cols":[dv]}],"col-start-end":[{col:["auto",{span:["full",uv,Hn]},Hn]}],"col-start":[{"col-start":xt()}],"col-end":[{"col-end":xt()}],"grid-rows":[{"grid-rows":[dv]}],"row-start-end":[{row:["auto",{span:[uv,Hn]},Hn]}],"row-start":[{"row-start":xt()}],"row-end":[{"row-end":xt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Hn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Hn]}],gap:[{gap:[V]}],"gap-x":[{"gap-x":[V]}],"gap-y":[{"gap-y":[V]}],"justify-content":[{justify:["normal",...st()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...st(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...st(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[ee]}],px:[{px:[ee]}],py:[{py:[ee]}],ps:[{ps:[ee]}],pe:[{pe:[ee]}],pt:[{pt:[ee]}],pr:[{pr:[ee]}],pb:[{pb:[ee]}],pl:[{pl:[ee]}],m:[{m:[se]}],mx:[{mx:[se]}],my:[{my:[se]}],ms:[{ms:[se]}],me:[{me:[se]}],mt:[{mt:[se]}],mr:[{mr:[se]}],mb:[{mb:[se]}],ml:[{ml:[se]}],"space-x":[{"space-x":[je]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[je]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Hn,e]}],"min-w":[{"min-w":[Hn,e,"min","max","fit"]}],"max-w":[{"max-w":[Hn,e,"none","full","min","max","fit","prose",{screen:[Cd]},Cd]}],h:[{h:[Hn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Hn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Hn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Hn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Cd,Ad]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",K2]}],"font-family":[{font:[dv]}],"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",Hn]}],"line-clamp":[{"line-clamp":["none",wg,K2]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Tu,Hn]}],"list-image":[{"list-image":["none",Hn]}],"list-style-type":[{list:["none","disc","decimal",Hn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[te]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ot(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Tu,Ad]}],"underline-offset":[{"underline-offset":["auto",Tu,Hn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:jt()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Hn]}],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",Hn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[te]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...It(),k9]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",E9]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},C9]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[Y]}],"gradient-via-pos":[{via:[Y]}],"gradient-to-pos":[{to:[Y]}],"gradient-from":[{from:[$]}],"gradient-via":[{via:[$]}],"gradient-to":[{to:[$]}],rounded:[{rounded:[_]}],"rounded-s":[{"rounded-s":[_]}],"rounded-e":[{"rounded-e":[_]}],"rounded-t":[{"rounded-t":[_]}],"rounded-r":[{"rounded-r":[_]}],"rounded-b":[{"rounded-b":[_]}],"rounded-l":[{"rounded-l":[_]}],"rounded-ss":[{"rounded-ss":[_]}],"rounded-se":[{"rounded-se":[_]}],"rounded-ee":[{"rounded-ee":[_]}],"rounded-es":[{"rounded-es":[_]}],"rounded-tl":[{"rounded-tl":[_]}],"rounded-tr":[{"rounded-tr":[_]}],"rounded-br":[{"rounded-br":[_]}],"rounded-bl":[{"rounded-bl":[_]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[te]}],"border-style":[{border:[...Ot(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[te]}],"divide-style":[{divide:Ot()}],"border-color":[{border:[h]}],"border-color-x":[{"border-x":[h]}],"border-color-y":[{"border-y":[h]}],"border-color-s":[{"border-s":[h]}],"border-color-e":[{"border-e":[h]}],"border-color-t":[{"border-t":[h]}],"border-color-r":[{"border-r":[h]}],"border-color-b":[{"border-b":[h]}],"border-color-l":[{"border-l":[h]}],"divide-color":[{divide:[h]}],"outline-style":[{outline:["",...Ot()]}],"outline-offset":[{"outline-offset":[Tu,Hn]}],"outline-w":[{outline:[Tu,Ad]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:Qe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[te]}],"ring-offset-w":[{"ring-offset":[Tu,Ad]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Cd,I9]}],"shadow-color":[{shadow:[dv]}],opacity:[{opacity:[te]}],"mix-blend":[{"mix-blend":[...Et(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Et()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[u]}],contrast:[{contrast:[k]}],"drop-shadow":[{"drop-shadow":["","none",Cd,Hn]}],grayscale:[{grayscale:[P]}],"hue-rotate":[{"hue-rotate":[O]}],invert:[{invert:[F]}],saturate:[{saturate:[oe]}],sepia:[{sepia:[Ie]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[u]}],"backdrop-contrast":[{"backdrop-contrast":[k]}],"backdrop-grayscale":[{"backdrop-grayscale":[P]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[O]}],"backdrop-invert":[{"backdrop-invert":[F]}],"backdrop-opacity":[{"backdrop-opacity":[te]}],"backdrop-saturate":[{"backdrop-saturate":[oe]}],"backdrop-sepia":[{"backdrop-sepia":[Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[w]}],"border-spacing-x":[{"border-spacing-x":[w]}],"border-spacing-y":[{"border-spacing-y":[w]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Hn]}],duration:[{duration:_r()}],ease:[{ease:["linear","in","out","in-out",Hn]}],delay:[{delay:_r()}],animate:[{animate:["none","spin","ping","pulse","bounce",Hn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[he]}],"scale-x":[{"scale-x":[he]}],"scale-y":[{"scale-y":[he]}],rotate:[{rotate:[uv,Hn]}],"translate-x":[{"translate-x":[Je]}],"translate-y":[{"translate-y":[Je]}],"skew-x":[{"skew-x":[Be]}],"skew-y":[{"skew-y":[Be]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Hn]}],accent:[{accent:["auto",t]}],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",Hn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":jt()}],"scroll-mx":[{"scroll-mx":jt()}],"scroll-my":[{"scroll-my":jt()}],"scroll-ms":[{"scroll-ms":jt()}],"scroll-me":[{"scroll-me":jt()}],"scroll-mt":[{"scroll-mt":jt()}],"scroll-mr":[{"scroll-mr":jt()}],"scroll-mb":[{"scroll-mb":jt()}],"scroll-ml":[{"scroll-ml":jt()}],"scroll-p":[{"scroll-p":jt()}],"scroll-px":[{"scroll-px":jt()}],"scroll-py":[{"scroll-py":jt()}],"scroll-ps":[{"scroll-ps":jt()}],"scroll-pe":[{"scroll-pe":jt()}],"scroll-pt":[{"scroll-pt":jt()}],"scroll-pr":[{"scroll-pr":jt()}],"scroll-pb":[{"scroll-pb":jt()}],"scroll-pl":[{"scroll-pl":jt()}],"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",Hn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Tu,Ad,K2]}],stroke:[{stroke:[t,"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"]}}},L9=m9(D9);function ki(...t){return L9(ZB(t))}const O9=Lq,oN=X.forwardRef(({className:t,...e},s)=>le.jsx(UB,{ref:s,className:ki("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]",t),...e}));oN.displayName=UB.displayName;const z9=FC("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"}}),aN=X.forwardRef(({className:t,variant:e,...s},u)=>le.jsx($B,{ref:u,className:ki(z9({variant:e}),t),...s}));aN.displayName=$B.displayName;const F9=X.forwardRef(({className:t,...e},s)=>le.jsx(WB,{ref:s,className:ki("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",t),...e}));F9.displayName=WB.displayName;const lN=X.forwardRef(({className:t,...e},s)=>le.jsx(qB,{ref:s,className:ki("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",t),"toast-close":"",...e,children:le.jsx(Df,{className:"h-4 w-4"})}));lN.displayName=qB.displayName;const cN=X.forwardRef(({className:t,...e},s)=>le.jsx(GB,{ref:s,className:ki("text-sm font-semibold",t),...e}));cN.displayName=GB.displayName;const uN=X.forwardRef(({className:t,...e},s)=>le.jsx(HB,{ref:s,className:ki("text-sm opacity-90",t),...e}));uN.displayName=HB.displayName;function B9(){const{toasts:t}=UW();return le.jsxs(O9,{children:[t.map(function({id:e,title:s,description:u,action:h,..._}){return le.jsxs(aN,{..._,children:[le.jsxs("div",{className:"grid gap-1",children:[s&&le.jsx(cN,{children:s}),u&&le.jsx(uN,{children:u})]}),h,le.jsx(lN,{})]},e)}),le.jsx(oN,{})]})}var cO=["light","dark"],N9="(prefers-color-scheme: dark)",j9=X.createContext(void 0),V9={setTheme:t=>{},themes:[]},U9=()=>{var t;return(t=X.useContext(j9))!=null?t:V9};X.memo(({forcedTheme:t,storageKey:e,attribute:s,enableSystem:u,enableColorScheme:h,defaultTheme:_,value:w,attrs:o,nonce:k})=>{let P=_==="system",O=s==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${o.map(Y=>`'${Y}'`).join(",")})`};`:`var d=document.documentElement,n='${s}',s='setAttribute';`,F=h?cO.includes(_)&&_?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${_}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",V=(Y,Z=!1,se=!0)=>{let te=w?w[Y]:Y,ee=Z?Y+"|| ''":`'${te}'`,oe="";return h&&se&&!Z&&cO.includes(Y)&&(oe+=`d.style.colorScheme = '${Y}';`),s==="class"?Z||te?oe+=`c.add(${ee})`:oe+="null":te&&(oe+=`d[s](n,${ee})`),oe},$=t?`!function(){${O}${V(t)}}()`:u?`!function(){try{${O}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${P})){var t='${N9}',m=window.matchMedia(t);if(m.media!==t||m.matches){${V("dark")}}else{${V("light")}}}else if(e){${w?`var x=${JSON.stringify(w)};`:""}${V(w?"x[e]":"e",!0)}}${P?"":"else{"+V(_,!1,!1)+"}"}${F}}catch(e){}}()`:`!function(){try{${O}var e=localStorage.getItem('${e}');if(e){${w?`var x=${JSON.stringify(w)};`:""}${V(w?"x[e]":"e",!0)}}else{${V(_,!1,!1)};}${F}}catch(t){}}();`;return X.createElement("script",{nonce:k,dangerouslySetInnerHTML:{__html:$}})});var $9=t=>{switch(t){case"success":return W9;case"info":return K9;case"warning":return q9;case"error":return Z9;default:return null}},G9=Array(12).fill(0),H9=({visible:t,className:e})=>dr.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},dr.createElement("div",{className:"sonner-spinner"},G9.map((s,u)=>dr.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${u}`})))),W9=dr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dr.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"})),q9=dr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},dr.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"})),K9=dr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dr.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"})),Z9=dr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dr.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"})),X9=dr.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"},dr.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),dr.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Y9=()=>{let[t,e]=dr.useState(document.hidden);return dr.useEffect(()=>{let s=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),t},zk=1,J9=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:s,...u}=t,h=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:zk++,_=this.toasts.find(o=>o.id===h),w=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(h)&&this.dismissedToasts.delete(h),_?this.toasts=this.toasts.map(o=>o.id===h?(this.publish({...o,...t,id:h,title:s}),{...o,...t,id:h,dismissible:w,title:s}):o):this.addToast({title:s,...u,dismissible:w,id:h}),h},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(s=>s({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let s;e.loading!==void 0&&(s=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let u=t instanceof Promise?t:t(),h=s!==void 0,_,w=u.then(async k=>{if(_=["resolve",k],dr.isValidElement(k))h=!1,this.create({id:s,type:"default",message:k});else if(e7(k)&&!k.ok){h=!1;let P=typeof e.error=="function"?await e.error(`HTTP error! status: ${k.status}`):e.error,O=typeof e.description=="function"?await e.description(`HTTP error! status: ${k.status}`):e.description;this.create({id:s,type:"error",message:P,description:O})}else if(e.success!==void 0){h=!1;let P=typeof e.success=="function"?await e.success(k):e.success,O=typeof e.description=="function"?await e.description(k):e.description;this.create({id:s,type:"success",message:P,description:O})}}).catch(async k=>{if(_=["reject",k],e.error!==void 0){h=!1;let P=typeof e.error=="function"?await e.error(k):e.error,O=typeof e.description=="function"?await e.description(k):e.description;this.create({id:s,type:"error",message:P,description:O})}}).finally(()=>{var k;h&&(this.dismiss(s),s=void 0),(k=e.finally)==null||k.call(e)}),o=()=>new Promise((k,P)=>w.then(()=>_[0]==="reject"?P(_[1]):k(_[1])).catch(P));return typeof s!="string"&&typeof s!="number"?{unwrap:o}:Object.assign(s,{unwrap:o})},this.custom=(t,e)=>{let s=(e==null?void 0:e.id)||zk++;return this.create({jsx:t(s),id:s,...e}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ba=new J9,Q9=(t,e)=>{let s=(e==null?void 0:e.id)||zk++;return ba.addToast({title:t,...e,id:s}),s},e7=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",t7=Q9,r7=()=>ba.toasts,n7=()=>ba.getActiveToasts(),ro=Object.assign(t7,{success:ba.success,info:ba.info,warning:ba.warning,error:ba.error,custom:ba.custom,message:ba.message,promise:ba.promise,dismiss:ba.dismiss,loading:ba.loading},{getHistory:r7,getToasts:n7});function i7(t,{insertAt:e}={}){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css",e==="top"&&s.firstChild?s.insertBefore(u,s.firstChild):s.appendChild(u),u.styleSheet?u.styleSheet.cssText=t:u.appendChild(document.createTextNode(t))}i7(`: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 rb(t){return t.label!==void 0}var s7=3,o7="32px",a7="16px",uO=4e3,l7=356,c7=14,u7=20,d7=200;function Xl(...t){return t.filter(Boolean).join(" ")}function h7(t){let[e,s]=t.split("-"),u=[];return e&&u.push(e),s&&u.push(s),u}var f7=t=>{var e,s,u,h,_,w,o,k,P,O,F;let{invert:V,toast:$,unstyled:Y,interacting:Z,setHeights:se,visibleToasts:te,heights:ee,index:oe,toasts:he,expanded:Ie,removeToast:Be,defaultRichColors:je,closeButton:Je,style:ft,cancelButtonStyle:kt,actionButtonStyle:tr,className:jt="",descriptionClassName:Qe="",duration:xt,position:It,gap:Ot,loadingIcon:Et,expandByDefault:st,classNames:Pt,icons:qt,closeButtonAriaLabel:_r="Close toast",pauseWhenPageIsHidden:yr}=t,[hr,Gr]=dr.useState(null),[mi,Oi]=dr.useState(null),[xn,zs]=dr.useState(!1),[un,Nn]=dr.useState(!1),[gi,Ks]=dr.useState(!1),[Un,io]=dr.useState(!1),[so,Ki]=dr.useState(!1),[Zi,Zn]=dr.useState(0),[Is,ua]=dr.useState(0),Ai=dr.useRef($.duration||xt||uO),us=dr.useRef(null),Fs=dr.useRef(null),rs=oe===0,Ho=oe+1<=te,ds=$.type,bs=$.dismissible!==!1,Wo=$.className||"",At=$.descriptionClassName||"",sr=dr.useMemo(()=>ee.findIndex(on=>on.toastId===$.id)||0,[ee,$.id]),Lr=dr.useMemo(()=>{var on;return(on=$.closeButton)!=null?on:Je},[$.closeButton,Je]),Zr=dr.useMemo(()=>$.duration||xt||uO,[$.duration,xt]),tn=dr.useRef(0),Wr=dr.useRef(0),On=dr.useRef(0),Zs=dr.useRef(null),[qo,yo]=It.split("-"),Do=dr.useMemo(()=>ee.reduce((on,Wn,qn)=>qn>=sr?on:on+Wn.height,0),[ee,sr]),oo=Y9(),vo=$.invert||V,Lo=ds==="loading";Wr.current=dr.useMemo(()=>sr*Ot+Do,[sr,Do]),dr.useEffect(()=>{Ai.current=Zr},[Zr]),dr.useEffect(()=>{zs(!0)},[]),dr.useEffect(()=>{let on=Fs.current;if(on){let Wn=on.getBoundingClientRect().height;return ua(Wn),se(qn=>[{toastId:$.id,height:Wn,position:$.position},...qn]),()=>se(qn=>qn.filter(Bs=>Bs.toastId!==$.id))}},[se,$.id]),dr.useLayoutEffect(()=>{if(!xn)return;let on=Fs.current,Wn=on.style.height;on.style.height="auto";let qn=on.getBoundingClientRect().height;on.style.height=Wn,ua(qn),se(Bs=>Bs.find(it=>it.toastId===$.id)?Bs.map(it=>it.toastId===$.id?{...it,height:qn}:it):[{toastId:$.id,height:qn,position:$.position},...Bs])},[xn,$.title,$.description,se,$.id]);let En=dr.useCallback(()=>{Nn(!0),Zn(Wr.current),se(on=>on.filter(Wn=>Wn.toastId!==$.id)),setTimeout(()=>{Be($)},d7)},[$,Be,se,Wr]);dr.useEffect(()=>{if($.promise&&ds==="loading"||$.duration===1/0||$.type==="loading")return;let on;return Ie||Z||yr&&oo?(()=>{if(On.current<tn.current){let Wn=new Date().getTime()-tn.current;Ai.current=Ai.current-Wn}On.current=new Date().getTime()})():Ai.current!==1/0&&(tn.current=new Date().getTime(),on=setTimeout(()=>{var Wn;(Wn=$.onAutoClose)==null||Wn.call($,$),En()},Ai.current)),()=>clearTimeout(on)},[Ie,Z,$,ds,yr,oo,En]),dr.useEffect(()=>{$.delete&&En()},[En,$.delete]);function zi(){var on,Wn,qn;return qt!=null&&qt.loading?dr.createElement("div",{className:Xl(Pt==null?void 0:Pt.loader,(on=$==null?void 0:$.classNames)==null?void 0:on.loader,"sonner-loader"),"data-visible":ds==="loading"},qt.loading):Et?dr.createElement("div",{className:Xl(Pt==null?void 0:Pt.loader,(Wn=$==null?void 0:$.classNames)==null?void 0:Wn.loader,"sonner-loader"),"data-visible":ds==="loading"},Et):dr.createElement(H9,{className:Xl(Pt==null?void 0:Pt.loader,(qn=$==null?void 0:$.classNames)==null?void 0:qn.loader),visible:ds==="loading"})}return dr.createElement("li",{tabIndex:0,ref:Fs,className:Xl(jt,Wo,Pt==null?void 0:Pt.toast,(e=$==null?void 0:$.classNames)==null?void 0:e.toast,Pt==null?void 0:Pt.default,Pt==null?void 0:Pt[ds],(s=$==null?void 0:$.classNames)==null?void 0:s[ds]),"data-sonner-toast":"","data-rich-colors":(u=$.richColors)!=null?u:je,"data-styled":!($.jsx||$.unstyled||Y),"data-mounted":xn,"data-promise":!!$.promise,"data-swiped":so,"data-removed":un,"data-visible":Ho,"data-y-position":qo,"data-x-position":yo,"data-index":oe,"data-front":rs,"data-swiping":gi,"data-dismissible":bs,"data-type":ds,"data-invert":vo,"data-swipe-out":Un,"data-swipe-direction":mi,"data-expanded":!!(Ie||st&&xn),style:{"--index":oe,"--toasts-before":oe,"--z-index":he.length-oe,"--offset":`${un?Zi:Wr.current}px`,"--initial-height":st?"auto":`${Is}px`,...ft,...$.style},onDragEnd:()=>{Ks(!1),Gr(null),Zs.current=null},onPointerDown:on=>{Lo||!bs||(us.current=new Date,Zn(Wr.current),on.target.setPointerCapture(on.pointerId),on.target.tagName!=="BUTTON"&&(Ks(!0),Zs.current={x:on.clientX,y:on.clientY}))},onPointerUp:()=>{var on,Wn,qn,Bs;if(Un||!bs)return;Zs.current=null;let it=Number(((on=Fs.current)==null?void 0:on.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),hs=Number(((Wn=Fs.current)==null?void 0:Wn.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Xs=new Date().getTime()-((qn=us.current)==null?void 0:qn.getTime()),fs=hr==="x"?it:hs,zr=Math.abs(fs)/Xs;if(Math.abs(fs)>=u7||zr>.11){Zn(Wr.current),(Bs=$.onDismiss)==null||Bs.call($,$),Oi(hr==="x"?it>0?"right":"left":hs>0?"down":"up"),En(),io(!0),Ki(!1);return}Ks(!1),Gr(null)},onPointerMove:on=>{var Wn,qn,Bs,it;if(!Zs.current||!bs||((Wn=window.getSelection())==null?void 0:Wn.toString().length)>0)return;let hs=on.clientY-Zs.current.y,Xs=on.clientX-Zs.current.x,fs=(qn=t.swipeDirections)!=null?qn:h7(It);!hr&&(Math.abs(Xs)>1||Math.abs(hs)>1)&&Gr(Math.abs(Xs)>Math.abs(hs)?"x":"y");let zr={x:0,y:0};hr==="y"?(fs.includes("top")||fs.includes("bottom"))&&(fs.includes("top")&&hs<0||fs.includes("bottom")&&hs>0)&&(zr.y=hs):hr==="x"&&(fs.includes("left")||fs.includes("right"))&&(fs.includes("left")&&Xs<0||fs.includes("right")&&Xs>0)&&(zr.x=Xs),(Math.abs(zr.x)>0||Math.abs(zr.y)>0)&&Ki(!0),(Bs=Fs.current)==null||Bs.style.setProperty("--swipe-amount-x",`${zr.x}px`),(it=Fs.current)==null||it.style.setProperty("--swipe-amount-y",`${zr.y}px`)}},Lr&&!$.jsx?dr.createElement("button",{"aria-label":_r,"data-disabled":Lo,"data-close-button":!0,onClick:Lo||!bs?()=>{}:()=>{var on;En(),(on=$.onDismiss)==null||on.call($,$)},className:Xl(Pt==null?void 0:Pt.closeButton,(h=$==null?void 0:$.classNames)==null?void 0:h.closeButton)},(_=qt==null?void 0:qt.close)!=null?_:X9):null,$.jsx||X.isValidElement($.title)?$.jsx?$.jsx:typeof $.title=="function"?$.title():$.title:dr.createElement(dr.Fragment,null,ds||$.icon||$.promise?dr.createElement("div",{"data-icon":"",className:Xl(Pt==null?void 0:Pt.icon,(w=$==null?void 0:$.classNames)==null?void 0:w.icon)},$.promise||$.type==="loading"&&!$.icon?$.icon||zi():null,$.type!=="loading"?$.icon||(qt==null?void 0:qt[ds])||$9(ds):null):null,dr.createElement("div",{"data-content":"",className:Xl(Pt==null?void 0:Pt.content,(o=$==null?void 0:$.classNames)==null?void 0:o.content)},dr.createElement("div",{"data-title":"",className:Xl(Pt==null?void 0:Pt.title,(k=$==null?void 0:$.classNames)==null?void 0:k.title)},typeof $.title=="function"?$.title():$.title),$.description?dr.createElement("div",{"data-description":"",className:Xl(Qe,At,Pt==null?void 0:Pt.description,(P=$==null?void 0:$.classNames)==null?void 0:P.description)},typeof $.description=="function"?$.description():$.description):null),X.isValidElement($.cancel)?$.cancel:$.cancel&&rb($.cancel)?dr.createElement("button",{"data-button":!0,"data-cancel":!0,style:$.cancelButtonStyle||kt,onClick:on=>{var Wn,qn;rb($.cancel)&&bs&&((qn=(Wn=$.cancel).onClick)==null||qn.call(Wn,on),En())},className:Xl(Pt==null?void 0:Pt.cancelButton,(O=$==null?void 0:$.classNames)==null?void 0:O.cancelButton)},$.cancel.label):null,X.isValidElement($.action)?$.action:$.action&&rb($.action)?dr.createElement("button",{"data-button":!0,"data-action":!0,style:$.actionButtonStyle||tr,onClick:on=>{var Wn,qn;rb($.action)&&((qn=(Wn=$.action).onClick)==null||qn.call(Wn,on),!on.defaultPrevented&&En())},className:Xl(Pt==null?void 0:Pt.actionButton,(F=$==null?void 0:$.classNames)==null?void 0:F.actionButton)},$.action.label):null))};function dO(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function p7(t,e){let s={};return[t,e].forEach((u,h)=>{let _=h===1,w=_?"--mobile-offset":"--offset",o=_?a7:o7;function k(P){["top","right","bottom","left"].forEach(O=>{s[`${w}-${O}`]=typeof P=="number"?`${P}px`:P})}typeof u=="number"||typeof u=="string"?k(u):typeof u=="object"?["top","right","bottom","left"].forEach(P=>{u[P]===void 0?s[`${w}-${P}`]=o:s[`${w}-${P}`]=typeof u[P]=="number"?`${u[P]}px`:u[P]}):k(o)}),s}var m7=X.forwardRef(function(t,e){let{invert:s,position:u="bottom-right",hotkey:h=["altKey","KeyT"],expand:_,closeButton:w,className:o,offset:k,mobileOffset:P,theme:O="light",richColors:F,duration:V,style:$,visibleToasts:Y=s7,toastOptions:Z,dir:se=dO(),gap:te=c7,loadingIcon:ee,icons:oe,containerAriaLabel:he="Notifications",pauseWhenPageIsHidden:Ie}=t,[Be,je]=dr.useState([]),Je=dr.useMemo(()=>Array.from(new Set([u].concat(Be.filter(yr=>yr.position).map(yr=>yr.position)))),[Be,u]),[ft,kt]=dr.useState([]),[tr,jt]=dr.useState(!1),[Qe,xt]=dr.useState(!1),[It,Ot]=dr.useState(O!=="system"?O:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Et=dr.useRef(null),st=h.join("+").replace(/Key/g,"").replace(/Digit/g,""),Pt=dr.useRef(null),qt=dr.useRef(!1),_r=dr.useCallback(yr=>{je(hr=>{var Gr;return(Gr=hr.find(mi=>mi.id===yr.id))!=null&&Gr.delete||ba.dismiss(yr.id),hr.filter(({id:mi})=>mi!==yr.id)})},[]);return dr.useEffect(()=>ba.subscribe(yr=>{if(yr.dismiss){je(hr=>hr.map(Gr=>Gr.id===yr.id?{...Gr,delete:!0}:Gr));return}setTimeout(()=>{xB.flushSync(()=>{je(hr=>{let Gr=hr.findIndex(mi=>mi.id===yr.id);return Gr!==-1?[...hr.slice(0,Gr),{...hr[Gr],...yr},...hr.slice(Gr+1)]:[yr,...hr]})})})}),[]),dr.useEffect(()=>{if(O!=="system"){Ot(O);return}if(O==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Ot("dark"):Ot("light")),typeof window>"u")return;let yr=window.matchMedia("(prefers-color-scheme: dark)");try{yr.addEventListener("change",({matches:hr})=>{Ot(hr?"dark":"light")})}catch{yr.addListener(({matches:Gr})=>{try{Ot(Gr?"dark":"light")}catch(mi){console.error(mi)}})}},[O]),dr.useEffect(()=>{Be.length<=1&&jt(!1)},[Be]),dr.useEffect(()=>{let yr=hr=>{var Gr,mi;h.every(Oi=>hr[Oi]||hr.code===Oi)&&(jt(!0),(Gr=Et.current)==null||Gr.focus()),hr.code==="Escape"&&(document.activeElement===Et.current||(mi=Et.current)!=null&&mi.contains(document.activeElement))&&jt(!1)};return document.addEventListener("keydown",yr),()=>document.removeEventListener("keydown",yr)},[h]),dr.useEffect(()=>{if(Et.current)return()=>{Pt.current&&(Pt.current.focus({preventScroll:!0}),Pt.current=null,qt.current=!1)}},[Et.current]),dr.createElement("section",{ref:e,"aria-label":`${he} ${st}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Je.map((yr,hr)=>{var Gr;let[mi,Oi]=yr.split("-");return Be.length?dr.createElement("ol",{key:yr,dir:se==="auto"?dO():se,tabIndex:-1,ref:Et,className:o,"data-sonner-toaster":!0,"data-theme":It,"data-y-position":mi,"data-lifted":tr&&Be.length>1&&!_,"data-x-position":Oi,style:{"--front-toast-height":`${((Gr=ft[0])==null?void 0:Gr.height)||0}px`,"--width":`${l7}px`,"--gap":`${te}px`,...$,...p7(k,P)},onBlur:xn=>{qt.current&&!xn.currentTarget.contains(xn.relatedTarget)&&(qt.current=!1,Pt.current&&(Pt.current.focus({preventScroll:!0}),Pt.current=null))},onFocus:xn=>{xn.target instanceof HTMLElement&&xn.target.dataset.dismissible==="false"||qt.current||(qt.current=!0,Pt.current=xn.relatedTarget)},onMouseEnter:()=>jt(!0),onMouseMove:()=>jt(!0),onMouseLeave:()=>{Qe||jt(!1)},onDragEnd:()=>jt(!1),onPointerDown:xn=>{xn.target instanceof HTMLElement&&xn.target.dataset.dismissible==="false"||xt(!0)},onPointerUp:()=>xt(!1)},Be.filter(xn=>!xn.position&&hr===0||xn.position===yr).map((xn,zs)=>{var un,Nn;return dr.createElement(f7,{key:xn.id,icons:oe,index:zs,toast:xn,defaultRichColors:F,duration:(un=Z==null?void 0:Z.duration)!=null?un:V,className:Z==null?void 0:Z.className,descriptionClassName:Z==null?void 0:Z.descriptionClassName,invert:s,visibleToasts:Y,closeButton:(Nn=Z==null?void 0:Z.closeButton)!=null?Nn:w,interacting:Qe,position:yr,style:Z==null?void 0:Z.style,unstyled:Z==null?void 0:Z.unstyled,classNames:Z==null?void 0:Z.classNames,cancelButtonStyle:Z==null?void 0:Z.cancelButtonStyle,actionButtonStyle:Z==null?void 0:Z.actionButtonStyle,removeToast:_r,toasts:Be.filter(gi=>gi.position==xn.position),heights:ft.filter(gi=>gi.position==xn.position),setHeights:kt,expandByDefault:_,gap:te,loadingIcon:ee,expanded:tr,pauseWhenPageIsHidden:Ie,swipeDirections:t.swipeDirections})})):null}))});const g7=({...t})=>{const{theme:e="system"}=U9();return le.jsx(m7,{theme:e,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"}},...t})};var _7=UA[" useId ".trim().toString()]||(()=>{}),y7=0;function Lb(t){const[e,s]=X.useState(_7());return Bu(()=>{s(u=>u??String(y7++))},[t]),t||(e?`radix-${e}`:"")}const v7=["top","right","bottom","left"],sh=Math.min,Ga=Math.max,g1=Math.round,nb=Math.floor,qc=t=>({x:t,y:t}),x7={left:"right",right:"left",bottom:"top",top:"bottom"},w7={start:"end",end:"start"};function Fk(t,e,s){return Ga(t,sh(e,s))}function Nu(t,e){return typeof t=="function"?t(e):t}function ju(t){return t.split("-")[0]}function Jg(t){return t.split("-")[1]}function NC(t){return t==="x"?"y":"x"}function jC(t){return t==="y"?"height":"width"}const b7=new Set(["top","bottom"]);function $c(t){return b7.has(ju(t))?"y":"x"}function VC(t){return NC($c(t))}function S7(t,e,s){s===void 0&&(s=!1);const u=Jg(t),h=VC(t),_=jC(h);let w=h==="x"?u===(s?"end":"start")?"right":"left":u==="start"?"bottom":"top";return e.reference[_]>e.floating[_]&&(w=_1(w)),[w,_1(w)]}function T7(t){const e=_1(t);return[Bk(t),e,Bk(e)]}function Bk(t){return t.replace(/start|end/g,e=>w7[e])}const hO=["left","right"],fO=["right","left"],E7=["top","bottom"],k7=["bottom","top"];function A7(t,e,s){switch(t){case"top":case"bottom":return s?e?fO:hO:e?hO:fO;case"left":case"right":return e?E7:k7;default:return[]}}function C7(t,e,s,u){const h=Jg(t);let _=A7(ju(t),s==="start",u);return h&&(_=_.map(w=>w+"-"+h),e&&(_=_.concat(_.map(Bk)))),_}function _1(t){return t.replace(/left|right|bottom|top/g,e=>x7[e])}function I7(t){return{top:0,right:0,bottom:0,left:0,...t}}function dN(t){return typeof t!="number"?I7(t):{top:t,right:t,bottom:t,left:t}}function y1(t){const{x:e,y:s,width:u,height:h}=t;return{width:u,height:h,top:s,left:e,right:e+u,bottom:s+h,x:e,y:s}}function pO(t,e,s){let{reference:u,floating:h}=t;const _=$c(e),w=VC(e),o=jC(w),k=ju(e),P=_==="y",O=u.x+u.width/2-h.width/2,F=u.y+u.height/2-h.height/2,V=u[o]/2-h[o]/2;let $;switch(k){case"top":$={x:O,y:u.y-h.height};break;case"bottom":$={x:O,y:u.y+u.height};break;case"right":$={x:u.x+u.width,y:F};break;case"left":$={x:u.x-h.width,y:F};break;default:$={x:u.x,y:u.y}}switch(Jg(e)){case"start":$[w]-=V*(s&&P?-1:1);break;case"end":$[w]+=V*(s&&P?-1:1);break}return $}const P7=async(t,e,s)=>{const{placement:u="bottom",strategy:h="absolute",middleware:_=[],platform:w}=s,o=_.filter(Boolean),k=await(w.isRTL==null?void 0:w.isRTL(e));let P=await w.getElementRects({reference:t,floating:e,strategy:h}),{x:O,y:F}=pO(P,u,k),V=u,$={},Y=0;for(let Z=0;Z<o.length;Z++){const{name:se,fn:te}=o[Z],{x:ee,y:oe,data:he,reset:Ie}=await te({x:O,y:F,initialPlacement:u,placement:V,strategy:h,middlewareData:$,rects:P,platform:w,elements:{reference:t,floating:e}});O=ee??O,F=oe??F,$={...$,[se]:{...$[se],...he}},Ie&&Y<=50&&(Y++,typeof Ie=="object"&&(Ie.placement&&(V=Ie.placement),Ie.rects&&(P=Ie.rects===!0?await w.getElementRects({reference:t,floating:e,strategy:h}):Ie.rects),{x:O,y:F}=pO(P,V,k)),Z=-1)}return{x:O,y:F,placement:V,strategy:h,middlewareData:$}};async function i0(t,e){var s;e===void 0&&(e={});const{x:u,y:h,platform:_,rects:w,elements:o,strategy:k}=t,{boundary:P="clippingAncestors",rootBoundary:O="viewport",elementContext:F="floating",altBoundary:V=!1,padding:$=0}=Nu(e,t),Y=dN($),se=o[V?F==="floating"?"reference":"floating":F],te=y1(await _.getClippingRect({element:(s=await(_.isElement==null?void 0:_.isElement(se)))==null||s?se:se.contextElement||await(_.getDocumentElement==null?void 0:_.getDocumentElement(o.floating)),boundary:P,rootBoundary:O,strategy:k})),ee=F==="floating"?{x:u,y:h,width:w.floating.width,height:w.floating.height}:w.reference,oe=await(_.getOffsetParent==null?void 0:_.getOffsetParent(o.floating)),he=await(_.isElement==null?void 0:_.isElement(oe))?await(_.getScale==null?void 0:_.getScale(oe))||{x:1,y:1}:{x:1,y:1},Ie=y1(_.convertOffsetParentRelativeRectToViewportRelativeRect?await _.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:ee,offsetParent:oe,strategy:k}):ee);return{top:(te.top-Ie.top+Y.top)/he.y,bottom:(Ie.bottom-te.bottom+Y.bottom)/he.y,left:(te.left-Ie.left+Y.left)/he.x,right:(Ie.right-te.right+Y.right)/he.x}}const M7=t=>({name:"arrow",options:t,async fn(e){const{x:s,y:u,placement:h,rects:_,platform:w,elements:o,middlewareData:k}=e,{element:P,padding:O=0}=Nu(t,e)||{};if(P==null)return{};const F=dN(O),V={x:s,y:u},$=VC(h),Y=jC($),Z=await w.getDimensions(P),se=$==="y",te=se?"top":"left",ee=se?"bottom":"right",oe=se?"clientHeight":"clientWidth",he=_.reference[Y]+_.reference[$]-V[$]-_.floating[Y],Ie=V[$]-_.reference[$],Be=await(w.getOffsetParent==null?void 0:w.getOffsetParent(P));let je=Be?Be[oe]:0;(!je||!await(w.isElement==null?void 0:w.isElement(Be)))&&(je=o.floating[oe]||_.floating[Y]);const Je=he/2-Ie/2,ft=je/2-Z[Y]/2-1,kt=sh(F[te],ft),tr=sh(F[ee],ft),jt=kt,Qe=je-Z[Y]-tr,xt=je/2-Z[Y]/2+Je,It=Fk(jt,xt,Qe),Ot=!k.arrow&&Jg(h)!=null&&xt!==It&&_.reference[Y]/2-(xt<jt?kt:tr)-Z[Y]/2<0,Et=Ot?xt<jt?xt-jt:xt-Qe:0;return{[$]:V[$]+Et,data:{[$]:It,centerOffset:xt-It-Et,...Ot&&{alignmentOffset:Et}},reset:Ot}}}),R7=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var s,u;const{placement:h,middlewareData:_,rects:w,initialPlacement:o,platform:k,elements:P}=e,{mainAxis:O=!0,crossAxis:F=!0,fallbackPlacements:V,fallbackStrategy:$="bestFit",fallbackAxisSideDirection:Y="none",flipAlignment:Z=!0,...se}=Nu(t,e);if((s=_.arrow)!=null&&s.alignmentOffset)return{};const te=ju(h),ee=$c(o),oe=ju(o)===o,he=await(k.isRTL==null?void 0:k.isRTL(P.floating)),Ie=V||(oe||!Z?[_1(o)]:T7(o)),Be=Y!=="none";!V&&Be&&Ie.push(...C7(o,Z,Y,he));const je=[o,...Ie],Je=await i0(e,se),ft=[];let kt=((u=_.flip)==null?void 0:u.overflows)||[];if(O&&ft.push(Je[te]),F){const xt=S7(h,w,he);ft.push(Je[xt[0]],Je[xt[1]])}if(kt=[...kt,{placement:h,overflows:ft}],!ft.every(xt=>xt<=0)){var tr,jt;const xt=(((tr=_.flip)==null?void 0:tr.index)||0)+1,It=je[xt];if(It&&(!(F==="alignment"?ee!==$c(It):!1)||kt.every(st=>st.overflows[0]>0&&$c(st.placement)===ee)))return{data:{index:xt,overflows:kt},reset:{placement:It}};let Ot=(jt=kt.filter(Et=>Et.overflows[0]<=0).sort((Et,st)=>Et.overflows[1]-st.overflows[1])[0])==null?void 0:jt.placement;if(!Ot)switch($){case"bestFit":{var Qe;const Et=(Qe=kt.filter(st=>{if(Be){const Pt=$c(st.placement);return Pt===ee||Pt==="y"}return!0}).map(st=>[st.placement,st.overflows.filter(Pt=>Pt>0).reduce((Pt,qt)=>Pt+qt,0)]).sort((st,Pt)=>st[1]-Pt[1])[0])==null?void 0:Qe[0];Et&&(Ot=Et);break}case"initialPlacement":Ot=o;break}if(h!==Ot)return{reset:{placement:Ot}}}return{}}}};function mO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function gO(t){return v7.some(e=>t[e]>=0)}const D7=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:s}=e,{strategy:u="referenceHidden",...h}=Nu(t,e);switch(u){case"referenceHidden":{const _=await i0(e,{...h,elementContext:"reference"}),w=mO(_,s.reference);return{data:{referenceHiddenOffsets:w,referenceHidden:gO(w)}}}case"escaped":{const _=await i0(e,{...h,altBoundary:!0}),w=mO(_,s.floating);return{data:{escapedOffsets:w,escaped:gO(w)}}}default:return{}}}}},hN=new Set(["left","top"]);async function L7(t,e){const{placement:s,platform:u,elements:h}=t,_=await(u.isRTL==null?void 0:u.isRTL(h.floating)),w=ju(s),o=Jg(s),k=$c(s)==="y",P=hN.has(w)?-1:1,O=_&&k?-1:1,F=Nu(e,t);let{mainAxis:V,crossAxis:$,alignmentAxis:Y}=typeof F=="number"?{mainAxis:F,crossAxis:0,alignmentAxis:null}:{mainAxis:F.mainAxis||0,crossAxis:F.crossAxis||0,alignmentAxis:F.alignmentAxis};return o&&typeof Y=="number"&&($=o==="end"?Y*-1:Y),k?{x:$*O,y:V*P}:{x:V*P,y:$*O}}const O7=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var s,u;const{x:h,y:_,placement:w,middlewareData:o}=e,k=await L7(e,t);return w===((s=o.offset)==null?void 0:s.placement)&&(u=o.arrow)!=null&&u.alignmentOffset?{}:{x:h+k.x,y:_+k.y,data:{...k,placement:w}}}}},z7=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:s,y:u,placement:h}=e,{mainAxis:_=!0,crossAxis:w=!1,limiter:o={fn:se=>{let{x:te,y:ee}=se;return{x:te,y:ee}}},...k}=Nu(t,e),P={x:s,y:u},O=await i0(e,k),F=$c(ju(h)),V=NC(F);let $=P[V],Y=P[F];if(_){const se=V==="y"?"top":"left",te=V==="y"?"bottom":"right",ee=$+O[se],oe=$-O[te];$=Fk(ee,$,oe)}if(w){const se=F==="y"?"top":"left",te=F==="y"?"bottom":"right",ee=Y+O[se],oe=Y-O[te];Y=Fk(ee,Y,oe)}const Z=o.fn({...e,[V]:$,[F]:Y});return{...Z,data:{x:Z.x-s,y:Z.y-u,enabled:{[V]:_,[F]:w}}}}}},F7=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:s,y:u,placement:h,rects:_,middlewareData:w}=e,{offset:o=0,mainAxis:k=!0,crossAxis:P=!0}=Nu(t,e),O={x:s,y:u},F=$c(h),V=NC(F);let $=O[V],Y=O[F];const Z=Nu(o,e),se=typeof Z=="number"?{mainAxis:Z,crossAxis:0}:{mainAxis:0,crossAxis:0,...Z};if(k){const oe=V==="y"?"height":"width",he=_.reference[V]-_.floating[oe]+se.mainAxis,Ie=_.reference[V]+_.reference[oe]-se.mainAxis;$<he?$=he:$>Ie&&($=Ie)}if(P){var te,ee;const oe=V==="y"?"width":"height",he=hN.has(ju(h)),Ie=_.reference[F]-_.floating[oe]+(he&&((te=w.offset)==null?void 0:te[F])||0)+(he?0:se.crossAxis),Be=_.reference[F]+_.reference[oe]+(he?0:((ee=w.offset)==null?void 0:ee[F])||0)-(he?se.crossAxis:0);Y<Ie?Y=Ie:Y>Be&&(Y=Be)}return{[V]:$,[F]:Y}}}},B7=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var s,u;const{placement:h,rects:_,platform:w,elements:o}=e,{apply:k=()=>{},...P}=Nu(t,e),O=await i0(e,P),F=ju(h),V=Jg(h),$=$c(h)==="y",{width:Y,height:Z}=_.floating;let se,te;F==="top"||F==="bottom"?(se=F,te=V===(await(w.isRTL==null?void 0:w.isRTL(o.floating))?"start":"end")?"left":"right"):(te=F,se=V==="end"?"top":"bottom");const ee=Z-O.top-O.bottom,oe=Y-O.left-O.right,he=sh(Z-O[se],ee),Ie=sh(Y-O[te],oe),Be=!e.middlewareData.shift;let je=he,Je=Ie;if((s=e.middlewareData.shift)!=null&&s.enabled.x&&(Je=oe),(u=e.middlewareData.shift)!=null&&u.enabled.y&&(je=ee),Be&&!V){const kt=Ga(O.left,0),tr=Ga(O.right,0),jt=Ga(O.top,0),Qe=Ga(O.bottom,0);$?Je=Y-2*(kt!==0||tr!==0?kt+tr:Ga(O.left,O.right)):je=Z-2*(jt!==0||Qe!==0?jt+Qe:Ga(O.top,O.bottom))}await k({...e,availableWidth:Je,availableHeight:je});const ft=await w.getDimensions(o.floating);return Y!==ft.width||Z!==ft.height?{reset:{rects:!0}}:{}}}};function tS(){return typeof window<"u"}function Qg(t){return fN(t)?(t.nodeName||"").toLowerCase():"#document"}function Za(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Jc(t){var e;return(e=(fN(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function fN(t){return tS()?t instanceof Node||t instanceof Za(t).Node:!1}function dc(t){return tS()?t instanceof Element||t instanceof Za(t).Element:!1}function Yc(t){return tS()?t instanceof HTMLElement||t instanceof Za(t).HTMLElement:!1}function _O(t){return!tS()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Za(t).ShadowRoot}const N7=new Set(["inline","contents"]);function D0(t){const{overflow:e,overflowX:s,overflowY:u,display:h}=hc(t);return/auto|scroll|overlay|hidden|clip/.test(e+u+s)&&!N7.has(h)}const j7=new Set(["table","td","th"]);function V7(t){return j7.has(Qg(t))}const U7=[":popover-open",":modal"];function rS(t){return U7.some(e=>{try{return t.matches(e)}catch{return!1}})}const $7=["transform","translate","scale","rotate","perspective"],G7=["transform","translate","scale","rotate","perspective","filter"],H7=["paint","layout","strict","content"];function UC(t){const e=$C(),s=dc(t)?hc(t):t;return $7.some(u=>s[u]?s[u]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!e&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!e&&(s.filter?s.filter!=="none":!1)||G7.some(u=>(s.willChange||"").includes(u))||H7.some(u=>(s.contain||"").includes(u))}function W7(t){let e=oh(t);for(;Yc(e)&&!Vg(e);){if(UC(e))return e;if(rS(e))return null;e=oh(e)}return null}function $C(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const q7=new Set(["html","body","#document"]);function Vg(t){return q7.has(Qg(t))}function hc(t){return Za(t).getComputedStyle(t)}function nS(t){return dc(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oh(t){if(Qg(t)==="html")return t;const e=t.assignedSlot||t.parentNode||_O(t)&&t.host||Jc(t);return _O(e)?e.host:e}function pN(t){const e=oh(t);return Vg(e)?t.ownerDocument?t.ownerDocument.body:t.body:Yc(e)&&D0(e)?e:pN(e)}function s0(t,e,s){var u;e===void 0&&(e=[]),s===void 0&&(s=!0);const h=pN(t),_=h===((u=t.ownerDocument)==null?void 0:u.body),w=Za(h);if(_){const o=Nk(w);return e.concat(w,w.visualViewport||[],D0(h)?h:[],o&&s?s0(o):[])}return e.concat(h,s0(h,[],s))}function Nk(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function mN(t){const e=hc(t);let s=parseFloat(e.width)||0,u=parseFloat(e.height)||0;const h=Yc(t),_=h?t.offsetWidth:s,w=h?t.offsetHeight:u,o=g1(s)!==_||g1(u)!==w;return o&&(s=_,u=w),{width:s,height:u,$:o}}function GC(t){return dc(t)?t:t.contextElement}function bg(t){const e=GC(t);if(!Yc(e))return qc(1);const s=e.getBoundingClientRect(),{width:u,height:h,$:_}=mN(e);let w=(_?g1(s.width):s.width)/u,o=(_?g1(s.height):s.height)/h;return(!w||!Number.isFinite(w))&&(w=1),(!o||!Number.isFinite(o))&&(o=1),{x:w,y:o}}const K7=qc(0);function gN(t){const e=Za(t);return!$C()||!e.visualViewport?K7:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Z7(t,e,s){return e===void 0&&(e=!1),!s||e&&s!==Za(t)?!1:e}function Vf(t,e,s,u){e===void 0&&(e=!1),s===void 0&&(s=!1);const h=t.getBoundingClientRect(),_=GC(t);let w=qc(1);e&&(u?dc(u)&&(w=bg(u)):w=bg(t));const o=Z7(_,s,u)?gN(_):qc(0);let k=(h.left+o.x)/w.x,P=(h.top+o.y)/w.y,O=h.width/w.x,F=h.height/w.y;if(_){const V=Za(_),$=u&&dc(u)?Za(u):u;let Y=V,Z=Nk(Y);for(;Z&&u&&$!==Y;){const se=bg(Z),te=Z.getBoundingClientRect(),ee=hc(Z),oe=te.left+(Z.clientLeft+parseFloat(ee.paddingLeft))*se.x,he=te.top+(Z.clientTop+parseFloat(ee.paddingTop))*se.y;k*=se.x,P*=se.y,O*=se.x,F*=se.y,k+=oe,P+=he,Y=Za(Z),Z=Nk(Y)}}return y1({width:O,height:F,x:k,y:P})}function HC(t,e){const s=nS(t).scrollLeft;return e?e.left+s:Vf(Jc(t)).left+s}function _N(t,e,s){s===void 0&&(s=!1);const u=t.getBoundingClientRect(),h=u.left+e.scrollLeft-(s?0:HC(t,u)),_=u.top+e.scrollTop;return{x:h,y:_}}function X7(t){let{elements:e,rect:s,offsetParent:u,strategy:h}=t;const _=h==="fixed",w=Jc(u),o=e?rS(e.floating):!1;if(u===w||o&&_)return s;let k={scrollLeft:0,scrollTop:0},P=qc(1);const O=qc(0),F=Yc(u);if((F||!F&&!_)&&((Qg(u)!=="body"||D0(w))&&(k=nS(u)),Yc(u))){const $=Vf(u);P=bg(u),O.x=$.x+u.clientLeft,O.y=$.y+u.clientTop}const V=w&&!F&&!_?_N(w,k,!0):qc(0);return{width:s.width*P.x,height:s.height*P.y,x:s.x*P.x-k.scrollLeft*P.x+O.x+V.x,y:s.y*P.y-k.scrollTop*P.y+O.y+V.y}}function Y7(t){return Array.from(t.getClientRects())}function J7(t){const e=Jc(t),s=nS(t),u=t.ownerDocument.body,h=Ga(e.scrollWidth,e.clientWidth,u.scrollWidth,u.clientWidth),_=Ga(e.scrollHeight,e.clientHeight,u.scrollHeight,u.clientHeight);let w=-s.scrollLeft+HC(t);const o=-s.scrollTop;return hc(u).direction==="rtl"&&(w+=Ga(e.clientWidth,u.clientWidth)-h),{width:h,height:_,x:w,y:o}}function Q7(t,e){const s=Za(t),u=Jc(t),h=s.visualViewport;let _=u.clientWidth,w=u.clientHeight,o=0,k=0;if(h){_=h.width,w=h.height;const P=$C();(!P||P&&e==="fixed")&&(o=h.offsetLeft,k=h.offsetTop)}return{width:_,height:w,x:o,y:k}}const eK=new Set(["absolute","fixed"]);function tK(t,e){const s=Vf(t,!0,e==="fixed"),u=s.top+t.clientTop,h=s.left+t.clientLeft,_=Yc(t)?bg(t):qc(1),w=t.clientWidth*_.x,o=t.clientHeight*_.y,k=h*_.x,P=u*_.y;return{width:w,height:o,x:k,y:P}}function yO(t,e,s){let u;if(e==="viewport")u=Q7(t,s);else if(e==="document")u=J7(Jc(t));else if(dc(e))u=tK(e,s);else{const h=gN(t);u={x:e.x-h.x,y:e.y-h.y,width:e.width,height:e.height}}return y1(u)}function yN(t,e){const s=oh(t);return s===e||!dc(s)||Vg(s)?!1:hc(s).position==="fixed"||yN(s,e)}function rK(t,e){const s=e.get(t);if(s)return s;let u=s0(t,[],!1).filter(o=>dc(o)&&Qg(o)!=="body"),h=null;const _=hc(t).position==="fixed";let w=_?oh(t):t;for(;dc(w)&&!Vg(w);){const o=hc(w),k=UC(w);!k&&o.position==="fixed"&&(h=null),(_?!k&&!h:!k&&o.position==="static"&&!!h&&eK.has(h.position)||D0(w)&&!k&&yN(t,w))?u=u.filter(O=>O!==w):h=o,w=oh(w)}return e.set(t,u),u}function nK(t){let{element:e,boundary:s,rootBoundary:u,strategy:h}=t;const w=[...s==="clippingAncestors"?rS(e)?[]:rK(e,this._c):[].concat(s),u],o=w[0],k=w.reduce((P,O)=>{const F=yO(e,O,h);return P.top=Ga(F.top,P.top),P.right=sh(F.right,P.right),P.bottom=sh(F.bottom,P.bottom),P.left=Ga(F.left,P.left),P},yO(e,o,h));return{width:k.right-k.left,height:k.bottom-k.top,x:k.left,y:k.top}}function iK(t){const{width:e,height:s}=mN(t);return{width:e,height:s}}function sK(t,e,s){const u=Yc(e),h=Jc(e),_=s==="fixed",w=Vf(t,!0,_,e);let o={scrollLeft:0,scrollTop:0};const k=qc(0);function P(){k.x=HC(h)}if(u||!u&&!_)if((Qg(e)!=="body"||D0(h))&&(o=nS(e)),u){const $=Vf(e,!0,_,e);k.x=$.x+e.clientLeft,k.y=$.y+e.clientTop}else h&&P();_&&!u&&h&&P();const O=h&&!u&&!_?_N(h,o):qc(0),F=w.left+o.scrollLeft-k.x-O.x,V=w.top+o.scrollTop-k.y-O.y;return{x:F,y:V,width:w.width,height:w.height}}function Z2(t){return hc(t).position==="static"}function vO(t,e){if(!Yc(t)||hc(t).position==="fixed")return null;if(e)return e(t);let s=t.offsetParent;return Jc(t)===s&&(s=s.ownerDocument.body),s}function vN(t,e){const s=Za(t);if(rS(t))return s;if(!Yc(t)){let h=oh(t);for(;h&&!Vg(h);){if(dc(h)&&!Z2(h))return h;h=oh(h)}return s}let u=vO(t,e);for(;u&&V7(u)&&Z2(u);)u=vO(u,e);return u&&Vg(u)&&Z2(u)&&!UC(u)?s:u||W7(t)||s}const oK=async function(t){const e=this.getOffsetParent||vN,s=this.getDimensions,u=await s(t.floating);return{reference:sK(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:u.width,height:u.height}}};function aK(t){return hc(t).direction==="rtl"}const lK={convertOffsetParentRelativeRectToViewportRelativeRect:X7,getDocumentElement:Jc,getClippingRect:nK,getOffsetParent:vN,getElementRects:oK,getClientRects:Y7,getDimensions:iK,getScale:bg,isElement:dc,isRTL:aK};function xN(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function cK(t,e){let s=null,u;const h=Jc(t);function _(){var o;clearTimeout(u),(o=s)==null||o.disconnect(),s=null}function w(o,k){o===void 0&&(o=!1),k===void 0&&(k=1),_();const P=t.getBoundingClientRect(),{left:O,top:F,width:V,height:$}=P;if(o||e(),!V||!$)return;const Y=nb(F),Z=nb(h.clientWidth-(O+V)),se=nb(h.clientHeight-(F+$)),te=nb(O),oe={rootMargin:-Y+"px "+-Z+"px "+-se+"px "+-te+"px",threshold:Ga(0,sh(1,k))||1};let he=!0;function Ie(Be){const je=Be[0].intersectionRatio;if(je!==k){if(!he)return w();je?w(!1,je):u=setTimeout(()=>{w(!1,1e-7)},1e3)}je===1&&!xN(P,t.getBoundingClientRect())&&w(),he=!1}try{s=new IntersectionObserver(Ie,{...oe,root:h.ownerDocument})}catch{s=new IntersectionObserver(Ie,oe)}s.observe(t)}return w(!0),_}function uK(t,e,s,u){u===void 0&&(u={});const{ancestorScroll:h=!0,ancestorResize:_=!0,elementResize:w=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:k=!1}=u,P=GC(t),O=h||_?[...P?s0(P):[],...s0(e)]:[];O.forEach(te=>{h&&te.addEventListener("scroll",s,{passive:!0}),_&&te.addEventListener("resize",s)});const F=P&&o?cK(P,s):null;let V=-1,$=null;w&&($=new ResizeObserver(te=>{let[ee]=te;ee&&ee.target===P&&$&&($.unobserve(e),cancelAnimationFrame(V),V=requestAnimationFrame(()=>{var oe;(oe=$)==null||oe.observe(e)})),s()}),P&&!k&&$.observe(P),$.observe(e));let Y,Z=k?Vf(t):null;k&&se();function se(){const te=Vf(t);Z&&!xN(Z,te)&&s(),Z=te,Y=requestAnimationFrame(se)}return s(),()=>{var te;O.forEach(ee=>{h&&ee.removeEventListener("scroll",s),_&&ee.removeEventListener("resize",s)}),F==null||F(),(te=$)==null||te.disconnect(),$=null,k&&cancelAnimationFrame(Y)}}const dK=O7,hK=z7,fK=R7,pK=B7,mK=D7,xO=M7,gK=F7,_K=(t,e,s)=>{const u=new Map,h={platform:lK,...s},_={...h.platform,_c:u};return P7(t,e,{...h,platform:_})};var yK=typeof document<"u",vK=function(){},Ob=yK?X.useLayoutEffect:vK;function v1(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let s,u,h;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(s=t.length,s!==e.length)return!1;for(u=s;u--!==0;)if(!v1(t[u],e[u]))return!1;return!0}if(h=Object.keys(t),s=h.length,s!==Object.keys(e).length)return!1;for(u=s;u--!==0;)if(!{}.hasOwnProperty.call(e,h[u]))return!1;for(u=s;u--!==0;){const _=h[u];if(!(_==="_owner"&&t.$$typeof)&&!v1(t[_],e[_]))return!1}return!0}return t!==t&&e!==e}function wN(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function wO(t,e){const s=wN(t);return Math.round(e*s)/s}function X2(t){const e=X.useRef(t);return Ob(()=>{e.current=t}),e}function xK(t){t===void 0&&(t={});const{placement:e="bottom",strategy:s="absolute",middleware:u=[],platform:h,elements:{reference:_,floating:w}={},transform:o=!0,whileElementsMounted:k,open:P}=t,[O,F]=X.useState({x:0,y:0,strategy:s,placement:e,middlewareData:{},isPositioned:!1}),[V,$]=X.useState(u);v1(V,u)||$(u);const[Y,Z]=X.useState(null),[se,te]=X.useState(null),ee=X.useCallback(st=>{st!==Be.current&&(Be.current=st,Z(st))},[]),oe=X.useCallback(st=>{st!==je.current&&(je.current=st,te(st))},[]),he=_||Y,Ie=w||se,Be=X.useRef(null),je=X.useRef(null),Je=X.useRef(O),ft=k!=null,kt=X2(k),tr=X2(h),jt=X2(P),Qe=X.useCallback(()=>{if(!Be.current||!je.current)return;const st={placement:e,strategy:s,middleware:V};tr.current&&(st.platform=tr.current),_K(Be.current,je.current,st).then(Pt=>{const qt={...Pt,isPositioned:jt.current!==!1};xt.current&&!v1(Je.current,qt)&&(Je.current=qt,M0.flushSync(()=>{F(qt)}))})},[V,e,s,tr,jt]);Ob(()=>{P===!1&&Je.current.isPositioned&&(Je.current.isPositioned=!1,F(st=>({...st,isPositioned:!1})))},[P]);const xt=X.useRef(!1);Ob(()=>(xt.current=!0,()=>{xt.current=!1}),[]),Ob(()=>{if(he&&(Be.current=he),Ie&&(je.current=Ie),he&&Ie){if(kt.current)return kt.current(he,Ie,Qe);Qe()}},[he,Ie,Qe,kt,ft]);const It=X.useMemo(()=>({reference:Be,floating:je,setReference:ee,setFloating:oe}),[ee,oe]),Ot=X.useMemo(()=>({reference:he,floating:Ie}),[he,Ie]),Et=X.useMemo(()=>{const st={position:s,left:0,top:0};if(!Ot.floating)return st;const Pt=wO(Ot.floating,O.x),qt=wO(Ot.floating,O.y);return o?{...st,transform:"translate("+Pt+"px, "+qt+"px)",...wN(Ot.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:Pt,top:qt}},[s,o,Ot.floating,O.x,O.y]);return X.useMemo(()=>({...O,update:Qe,refs:It,elements:Ot,floatingStyles:Et}),[O,Qe,It,Ot,Et])}const wK=t=>{function e(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:t,fn(s){const{element:u,padding:h}=typeof t=="function"?t(s):t;return u&&e(u)?u.current!=null?xO({element:u.current,padding:h}).fn(s):{}:u?xO({element:u,padding:h}).fn(s):{}}}},bK=(t,e)=>({...dK(t),options:[t,e]}),SK=(t,e)=>({...hK(t),options:[t,e]}),TK=(t,e)=>({...gK(t),options:[t,e]}),EK=(t,e)=>({...fK(t),options:[t,e]}),kK=(t,e)=>({...pK(t),options:[t,e]}),AK=(t,e)=>({...mK(t),options:[t,e]}),CK=(t,e)=>({...wK(t),options:[t,e]});var IK="Arrow",bN=X.forwardRef((t,e)=>{const{children:s,width:u=10,height:h=5,..._}=t;return le.jsx(qi.svg,{..._,ref:e,width:u,height:h,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?s:le.jsx("polygon",{points:"0,0 30,0 15,10"})})});bN.displayName=IK;var PK=bN;function SN(t){const[e,s]=X.useState(void 0);return Bu(()=>{if(t){s({width:t.offsetWidth,height:t.offsetHeight});const u=new ResizeObserver(h=>{if(!Array.isArray(h)||!h.length)return;const _=h[0];let w,o;if("borderBoxSize"in _){const k=_.borderBoxSize,P=Array.isArray(k)?k[0]:k;w=P.inlineSize,o=P.blockSize}else w=t.offsetWidth,o=t.offsetHeight;s({width:w,height:o})});return u.observe(t,{box:"border-box"}),()=>u.unobserve(t)}else s(void 0)},[t]),e}var WC="Popper",[TN,EN]=Zg(WC),[MK,kN]=TN(WC),AN=t=>{const{__scopePopper:e,children:s}=t,[u,h]=X.useState(null);return le.jsx(MK,{scope:e,anchor:u,onAnchorChange:h,children:s})};AN.displayName=WC;var CN="PopperAnchor",IN=X.forwardRef((t,e)=>{const{__scopePopper:s,virtualRef:u,...h}=t,_=kN(CN,s),w=X.useRef(null),o=Os(e,w);return X.useEffect(()=>{_.onAnchorChange((u==null?void 0:u.current)||w.current)}),u?null:le.jsx(qi.div,{...h,ref:o})});IN.displayName=CN;var qC="PopperContent",[RK,DK]=TN(qC),PN=X.forwardRef((t,e)=>{var xn,zs,un,Nn,gi,Ks;const{__scopePopper:s,side:u="bottom",sideOffset:h=0,align:_="center",alignOffset:w=0,arrowPadding:o=0,avoidCollisions:k=!0,collisionBoundary:P=[],collisionPadding:O=0,sticky:F="partial",hideWhenDetached:V=!1,updatePositionStrategy:$="optimized",onPlaced:Y,...Z}=t,se=kN(qC,s),[te,ee]=X.useState(null),oe=Os(e,Un=>ee(Un)),[he,Ie]=X.useState(null),Be=SN(he),je=(Be==null?void 0:Be.width)??0,Je=(Be==null?void 0:Be.height)??0,ft=u+(_!=="center"?"-"+_:""),kt=typeof O=="number"?O:{top:0,right:0,bottom:0,left:0,...O},tr=Array.isArray(P)?P:[P],jt=tr.length>0,Qe={padding:kt,boundary:tr.filter(OK),altBoundary:jt},{refs:xt,floatingStyles:It,placement:Ot,isPositioned:Et,middlewareData:st}=xK({strategy:"fixed",placement:ft,whileElementsMounted:(...Un)=>uK(...Un,{animationFrame:$==="always"}),elements:{reference:se.anchor},middleware:[bK({mainAxis:h+Je,alignmentAxis:w}),k&&SK({mainAxis:!0,crossAxis:!1,limiter:F==="partial"?TK():void 0,...Qe}),k&&EK({...Qe}),kK({...Qe,apply:({elements:Un,rects:io,availableWidth:so,availableHeight:Ki})=>{const{width:Zi,height:Zn}=io.reference,Is=Un.floating.style;Is.setProperty("--radix-popper-available-width",`${so}px`),Is.setProperty("--radix-popper-available-height",`${Ki}px`),Is.setProperty("--radix-popper-anchor-width",`${Zi}px`),Is.setProperty("--radix-popper-anchor-height",`${Zn}px`)}}),he&&CK({element:he,padding:o}),zK({arrowWidth:je,arrowHeight:Je}),V&&AK({strategy:"referenceHidden",...Qe})]}),[Pt,qt]=DN(Ot),_r=Xc(Y);Bu(()=>{Et&&(_r==null||_r())},[Et,_r]);const yr=(xn=st.arrow)==null?void 0:xn.x,hr=(zs=st.arrow)==null?void 0:zs.y,Gr=((un=st.arrow)==null?void 0:un.centerOffset)!==0,[mi,Oi]=X.useState();return Bu(()=>{te&&Oi(window.getComputedStyle(te).zIndex)},[te]),le.jsx("div",{ref:xt.setFloating,"data-radix-popper-content-wrapper":"",style:{...It,transform:Et?It.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:mi,"--radix-popper-transform-origin":[(Nn=st.transformOrigin)==null?void 0:Nn.x,(gi=st.transformOrigin)==null?void 0:gi.y].join(" "),...((Ks=st.hide)==null?void 0:Ks.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:le.jsx(RK,{scope:s,placedSide:Pt,onArrowChange:Ie,arrowX:yr,arrowY:hr,shouldHideArrow:Gr,children:le.jsx(qi.div,{"data-side":Pt,"data-align":qt,...Z,ref:oe,style:{...Z.style,animation:Et?void 0:"none"}})})})});PN.displayName=qC;var MN="PopperArrow",LK={top:"bottom",right:"left",bottom:"top",left:"right"},RN=X.forwardRef(function(e,s){const{__scopePopper:u,...h}=e,_=DK(MN,u),w=LK[_.placedSide];return le.jsx("span",{ref:_.onArrowChange,style:{position:"absolute",left:_.arrowX,top:_.arrowY,[w]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[_.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[_.placedSide],visibility:_.shouldHideArrow?"hidden":void 0},children:le.jsx(PK,{...h,ref:s,style:{...h.style,display:"block"}})})});RN.displayName=MN;function OK(t){return t!==null}var zK=t=>({name:"transformOrigin",options:t,fn(e){var se,te,ee;const{placement:s,rects:u,middlewareData:h}=e,w=((se=h.arrow)==null?void 0:se.centerOffset)!==0,o=w?0:t.arrowWidth,k=w?0:t.arrowHeight,[P,O]=DN(s),F={start:"0%",center:"50%",end:"100%"}[O],V=(((te=h.arrow)==null?void 0:te.x)??0)+o/2,$=(((ee=h.arrow)==null?void 0:ee.y)??0)+k/2;let Y="",Z="";return P==="bottom"?(Y=w?F:`${V}px`,Z=`${-k}px`):P==="top"?(Y=w?F:`${V}px`,Z=`${u.floating.height+k}px`):P==="right"?(Y=`${-k}px`,Z=w?F:`${$}px`):P==="left"&&(Y=`${u.floating.width+k}px`,Z=w?F:`${$}px`),{data:{x:Y,y:Z}}}});function DN(t){const[e,s="center"]=t.split("-");return[e,s]}var FK=AN,BK=IN,NK=PN,jK=RN,[iS]=Zg("Tooltip",[EN]),sS=EN(),LN="TooltipProvider",VK=700,jk="tooltip.open",[UK,KC]=iS(LN),ON=t=>{const{__scopeTooltip:e,delayDuration:s=VK,skipDelayDuration:u=300,disableHoverableContent:h=!1,children:_}=t,w=X.useRef(!0),o=X.useRef(!1),k=X.useRef(0);return X.useEffect(()=>{const P=k.current;return()=>window.clearTimeout(P)},[]),le.jsx(UK,{scope:e,isOpenDelayedRef:w,delayDuration:s,onOpen:X.useCallback(()=>{window.clearTimeout(k.current),w.current=!1},[]),onClose:X.useCallback(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>w.current=!0,u)},[u]),isPointerInTransitRef:o,onPointerInTransitChange:X.useCallback(P=>{o.current=P},[]),disableHoverableContent:h,children:_})};ON.displayName=LN;var o0="Tooltip",[$K,oS]=iS(o0),zN=t=>{const{__scopeTooltip:e,children:s,open:u,defaultOpen:h,onOpenChange:_,disableHoverableContent:w,delayDuration:o}=t,k=KC(o0,t.__scopeTooltip),P=sS(e),[O,F]=X.useState(null),V=Lb(),$=X.useRef(0),Y=w??k.disableHoverableContent,Z=o??k.delayDuration,se=X.useRef(!1),[te,ee]=J1({prop:u,defaultProp:h??!1,onChange:je=>{je?(k.onOpen(),document.dispatchEvent(new CustomEvent(jk))):k.onClose(),_==null||_(je)},caller:o0}),oe=X.useMemo(()=>te?se.current?"delayed-open":"instant-open":"closed",[te]),he=X.useCallback(()=>{window.clearTimeout($.current),$.current=0,se.current=!1,ee(!0)},[ee]),Ie=X.useCallback(()=>{window.clearTimeout($.current),$.current=0,ee(!1)},[ee]),Be=X.useCallback(()=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>{se.current=!0,ee(!0),$.current=0},Z)},[Z,ee]);return X.useEffect(()=>()=>{$.current&&(window.clearTimeout($.current),$.current=0)},[]),le.jsx(FK,{...P,children:le.jsx($K,{scope:e,contentId:V,open:te,stateAttribute:oe,trigger:O,onTriggerChange:F,onTriggerEnter:X.useCallback(()=>{k.isOpenDelayedRef.current?Be():he()},[k.isOpenDelayedRef,Be,he]),onTriggerLeave:X.useCallback(()=>{Y?Ie():(window.clearTimeout($.current),$.current=0)},[Ie,Y]),onOpen:he,onClose:Ie,disableHoverableContent:Y,children:s})})};zN.displayName=o0;var Vk="TooltipTrigger",FN=X.forwardRef((t,e)=>{const{__scopeTooltip:s,...u}=t,h=oS(Vk,s),_=KC(Vk,s),w=sS(s),o=X.useRef(null),k=Os(e,o,h.onTriggerChange),P=X.useRef(!1),O=X.useRef(!1),F=X.useCallback(()=>P.current=!1,[]);return X.useEffect(()=>()=>document.removeEventListener("pointerup",F),[F]),le.jsx(BK,{asChild:!0,...w,children:le.jsx(qi.button,{"aria-describedby":h.open?h.contentId:void 0,"data-state":h.stateAttribute,...u,ref:k,onPointerMove:Ei(t.onPointerMove,V=>{V.pointerType!=="touch"&&!O.current&&!_.isPointerInTransitRef.current&&(h.onTriggerEnter(),O.current=!0)}),onPointerLeave:Ei(t.onPointerLeave,()=>{h.onTriggerLeave(),O.current=!1}),onPointerDown:Ei(t.onPointerDown,()=>{h.open&&h.onClose(),P.current=!0,document.addEventListener("pointerup",F,{once:!0})}),onFocus:Ei(t.onFocus,()=>{P.current||h.onOpen()}),onBlur:Ei(t.onBlur,h.onClose),onClick:Ei(t.onClick,h.onClose)})})});FN.displayName=Vk;var GK="TooltipPortal",[Due,HK]=iS(GK,{forceMount:void 0}),Ug="TooltipContent",BN=X.forwardRef((t,e)=>{const s=HK(Ug,t.__scopeTooltip),{forceMount:u=s.forceMount,side:h="top",..._}=t,w=oS(Ug,t.__scopeTooltip);return le.jsx(Xg,{present:u||w.open,children:w.disableHoverableContent?le.jsx(NN,{side:h,..._,ref:e}):le.jsx(WK,{side:h,..._,ref:e})})}),WK=X.forwardRef((t,e)=>{const s=oS(Ug,t.__scopeTooltip),u=KC(Ug,t.__scopeTooltip),h=X.useRef(null),_=Os(e,h),[w,o]=X.useState(null),{trigger:k,onClose:P}=s,O=h.current,{onPointerInTransitChange:F}=u,V=X.useCallback(()=>{o(null),F(!1)},[F]),$=X.useCallback((Y,Z)=>{const se=Y.currentTarget,te={x:Y.clientX,y:Y.clientY},ee=YK(te,se.getBoundingClientRect()),oe=JK(te,ee),he=QK(Z.getBoundingClientRect()),Ie=tZ([...oe,...he]);o(Ie),F(!0)},[F]);return X.useEffect(()=>()=>V(),[V]),X.useEffect(()=>{if(k&&O){const Y=se=>$(se,O),Z=se=>$(se,k);return k.addEventListener("pointerleave",Y),O.addEventListener("pointerleave",Z),()=>{k.removeEventListener("pointerleave",Y),O.removeEventListener("pointerleave",Z)}}},[k,O,$,V]),X.useEffect(()=>{if(w){const Y=Z=>{const se=Z.target,te={x:Z.clientX,y:Z.clientY},ee=(k==null?void 0:k.contains(se))||(O==null?void 0:O.contains(se)),oe=!eZ(te,w);ee?V():oe&&(V(),P())};return document.addEventListener("pointermove",Y),()=>document.removeEventListener("pointermove",Y)}},[k,O,w,P,V]),le.jsx(NN,{...t,ref:_})}),[qK,KK]=iS(o0,{isInside:!1}),ZK=qW("TooltipContent"),NN=X.forwardRef((t,e)=>{const{__scopeTooltip:s,children:u,"aria-label":h,onEscapeKeyDown:_,onPointerDownOutside:w,...o}=t,k=oS(Ug,s),P=sS(s),{onClose:O}=k;return X.useEffect(()=>(document.addEventListener(jk,O),()=>document.removeEventListener(jk,O)),[O]),X.useEffect(()=>{if(k.trigger){const F=V=>{const $=V.target;$!=null&&$.contains(k.trigger)&&O()};return window.addEventListener("scroll",F,{capture:!0}),()=>window.removeEventListener("scroll",F,{capture:!0})}},[k.trigger,O]),le.jsx(Y1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:_,onPointerDownOutside:w,onFocusOutside:F=>F.preventDefault(),onDismiss:O,children:le.jsxs(NK,{"data-state":k.stateAttribute,...P,...o,ref:e,style:{...o.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:[le.jsx(ZK,{children:u}),le.jsx(qK,{scope:s,isInside:!0,children:le.jsx(gq,{id:k.contentId,role:"tooltip",children:h||u})})]})})});BN.displayName=Ug;var jN="TooltipArrow",XK=X.forwardRef((t,e)=>{const{__scopeTooltip:s,...u}=t,h=sS(s);return KK(jN,s).isInside?null:le.jsx(jK,{...h,...u,ref:e})});XK.displayName=jN;function YK(t,e){const s=Math.abs(e.top-t.y),u=Math.abs(e.bottom-t.y),h=Math.abs(e.right-t.x),_=Math.abs(e.left-t.x);switch(Math.min(s,u,h,_)){case _:return"left";case h:return"right";case s:return"top";case u:return"bottom";default:throw new Error("unreachable")}}function JK(t,e,s=5){const u=[];switch(e){case"top":u.push({x:t.x-s,y:t.y+s},{x:t.x+s,y:t.y+s});break;case"bottom":u.push({x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s});break;case"left":u.push({x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s});break;case"right":u.push({x:t.x-s,y:t.y-s},{x:t.x-s,y:t.y+s});break}return u}function QK(t){const{top:e,right:s,bottom:u,left:h}=t;return[{x:h,y:e},{x:s,y:e},{x:s,y:u},{x:h,y:u}]}function eZ(t,e){const{x:s,y:u}=t;let h=!1;for(let _=0,w=e.length-1;_<e.length;w=_++){const o=e[_],k=e[w],P=o.x,O=o.y,F=k.x,V=k.y;O>u!=V>u&&s<(F-P)*(u-O)/(V-O)+P&&(h=!h)}return h}function tZ(t){const e=t.slice();return e.sort((s,u)=>s.x<u.x?-1:s.x>u.x?1:s.y<u.y?-1:s.y>u.y?1:0),rZ(e)}function rZ(t){if(t.length<=1)return t.slice();const e=[];for(let u=0;u<t.length;u++){const h=t[u];for(;e.length>=2;){const _=e[e.length-1],w=e[e.length-2];if((_.x-w.x)*(h.y-w.y)>=(_.y-w.y)*(h.x-w.x))e.pop();else break}e.push(h)}e.pop();const s=[];for(let u=t.length-1;u>=0;u--){const h=t[u];for(;s.length>=2;){const _=s[s.length-1],w=s[s.length-2];if((_.x-w.x)*(h.y-w.y)>=(_.y-w.y)*(h.x-w.x))s.pop();else break}s.push(h)}return s.pop(),e.length===1&&s.length===1&&e[0].x===s[0].x&&e[0].y===s[0].y?e:e.concat(s)}var nZ=ON,iZ=zN,sZ=FN,VN=BN;const oZ=nZ,Lue=iZ,Oue=sZ,aZ=X.forwardRef(({className:t,sideOffset:e=4,...s},u)=>le.jsx(VN,{ref:u,sideOffset:e,className:ki("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",t),...s}));aZ.displayName=VN.displayName;var aS=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},lS=typeof window>"u"||"Deno"in globalThis;function tc(){}function lZ(t,e){return typeof t=="function"?t(e):t}function cZ(t){return typeof t=="number"&&t>=0&&t!==1/0}function uZ(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Uk(t,e){return typeof t=="function"?t(e):t}function dZ(t,e){return typeof t=="function"?t(e):t}function bO(t,e){const{type:s="all",exact:u,fetchStatus:h,predicate:_,queryKey:w,stale:o}=t;if(w){if(u){if(e.queryHash!==ZC(w,e.options))return!1}else if(!l0(e.queryKey,w))return!1}if(s!=="all"){const k=e.isActive();if(s==="active"&&!k||s==="inactive"&&k)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||h&&h!==e.state.fetchStatus||_&&!_(e))}function SO(t,e){const{exact:s,status:u,predicate:h,mutationKey:_}=t;if(_){if(!e.options.mutationKey)return!1;if(s){if(a0(e.options.mutationKey)!==a0(_))return!1}else if(!l0(e.options.mutationKey,_))return!1}return!(u&&e.state.status!==u||h&&!h(e))}function ZC(t,e){return((e==null?void 0:e.queryKeyHashFn)||a0)(t)}function a0(t){return JSON.stringify(t,(e,s)=>$k(s)?Object.keys(s).sort().reduce((u,h)=>(u[h]=s[h],u),{}):s)}function l0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>l0(t[s],e[s])):!1}function UN(t,e){if(t===e)return t;const s=TO(t)&&TO(e);if(s||$k(t)&&$k(e)){const u=s?t:Object.keys(t),h=u.length,_=s?e:Object.keys(e),w=_.length,o=s?[]:{},k=new Set(u);let P=0;for(let O=0;O<w;O++){const F=s?O:_[O];(!s&&k.has(F)||s)&&t[F]===void 0&&e[F]===void 0?(o[F]=void 0,P++):(o[F]=UN(t[F],e[F]),o[F]===t[F]&&t[F]!==void 0&&P++)}return h===w&&P===h?t:o}return e}function zue(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function TO(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function $k(t){if(!EO(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!EO(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function EO(t){return Object.prototype.toString.call(t)==="[object Object]"}function hZ(t){return new Promise(e=>{setTimeout(e,t)})}function fZ(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?UN(t,e):e}function pZ(t,e,s=0){const u=[...t,e];return s&&u.length>s?u.slice(1):u}function mZ(t,e,s=0){const u=[e,...t];return s&&u.length>s?u.slice(0,-1):u}var XC=Symbol();function $N(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===XC?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Fue(t,e){return typeof t=="function"?t(...e):!!t}var Ef,Nd,kg,eF,gZ=(eF=class extends aS{constructor(){super();wi(this,Ef);wi(this,Nd);wi(this,kg);Bn(this,kg,e=>{if(!lS&&window.addEventListener){const s=()=>e();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){Gt(this,Nd)||this.setEventListener(Gt(this,kg))}onUnsubscribe(){var e;this.hasListeners()||((e=Gt(this,Nd))==null||e.call(this),Bn(this,Nd,void 0))}setEventListener(e){var s;Bn(this,kg,e),(s=Gt(this,Nd))==null||s.call(this),Bn(this,Nd,e(u=>{typeof u=="boolean"?this.setFocused(u):this.onFocus()}))}setFocused(e){Gt(this,Ef)!==e&&(Bn(this,Ef,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(s=>{s(e)})}isFocused(){var e;return typeof Gt(this,Ef)=="boolean"?Gt(this,Ef):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ef=new WeakMap,Nd=new WeakMap,kg=new WeakMap,eF),GN=new gZ,Ag,jd,Cg,tF,_Z=(tF=class extends aS{constructor(){super();wi(this,Ag,!0);wi(this,jd);wi(this,Cg);Bn(this,Cg,e=>{if(!lS&&window.addEventListener){const s=()=>e(!0),u=()=>e(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",u,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",u)}}})}onSubscribe(){Gt(this,jd)||this.setEventListener(Gt(this,Cg))}onUnsubscribe(){var e;this.hasListeners()||((e=Gt(this,jd))==null||e.call(this),Bn(this,jd,void 0))}setEventListener(e){var s;Bn(this,Cg,e),(s=Gt(this,jd))==null||s.call(this),Bn(this,jd,e(this.setOnline.bind(this)))}setOnline(e){Gt(this,Ag)!==e&&(Bn(this,Ag,e),this.listeners.forEach(u=>{u(e)}))}isOnline(){return Gt(this,Ag)}},Ag=new WeakMap,jd=new WeakMap,Cg=new WeakMap,tF),x1=new _Z;function yZ(){let t,e;const s=new Promise((h,_)=>{t=h,e=_});s.status="pending",s.catch(()=>{});function u(h){Object.assign(s,h),delete s.resolve,delete s.reject}return s.resolve=h=>{u({status:"fulfilled",value:h}),t(h)},s.reject=h=>{u({status:"rejected",reason:h}),e(h)},s}function vZ(t){return Math.min(1e3*2**t,3e4)}function HN(t){return(t??"online")==="online"?x1.isOnline():!0}var WN=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Y2(t){return t instanceof WN}function qN(t){let e=!1,s=0,u=!1,h;const _=yZ(),w=Z=>{var se;u||(V(new WN(Z)),(se=t.abort)==null||se.call(t))},o=()=>{e=!0},k=()=>{e=!1},P=()=>GN.isFocused()&&(t.networkMode==="always"||x1.isOnline())&&t.canRun(),O=()=>HN(t.networkMode)&&t.canRun(),F=Z=>{var se;u||(u=!0,(se=t.onSuccess)==null||se.call(t,Z),h==null||h(),_.resolve(Z))},V=Z=>{var se;u||(u=!0,(se=t.onError)==null||se.call(t,Z),h==null||h(),_.reject(Z))},$=()=>new Promise(Z=>{var se;h=te=>{(u||P())&&Z(te)},(se=t.onPause)==null||se.call(t)}).then(()=>{var Z;h=void 0,u||(Z=t.onContinue)==null||Z.call(t)}),Y=()=>{if(u)return;let Z;const se=s===0?t.initialPromise:void 0;try{Z=se??t.fn()}catch(te){Z=Promise.reject(te)}Promise.resolve(Z).then(F).catch(te=>{var Be;if(u)return;const ee=t.retry??(lS?0:3),oe=t.retryDelay??vZ,he=typeof oe=="function"?oe(s,te):oe,Ie=ee===!0||typeof ee=="number"&&s<ee||typeof ee=="function"&&ee(s,te);if(e||!Ie){V(te);return}s++,(Be=t.onFail)==null||Be.call(t,s,te),hZ(he).then(()=>P()?void 0:$()).then(()=>{e?V(te):Y()})})};return{promise:_,cancel:w,continue:()=>(h==null||h(),_),cancelRetry:o,continueRetry:k,canStart:O,start:()=>(O()?Y():$().then(Y),_)}}var xZ=t=>setTimeout(t,0);function wZ(){let t=[],e=0,s=o=>{o()},u=o=>{o()},h=xZ;const _=o=>{e?t.push(o):h(()=>{s(o)})},w=()=>{const o=t;t=[],o.length&&h(()=>{u(()=>{o.forEach(k=>{s(k)})})})};return{batch:o=>{let k;e++;try{k=o()}finally{e--,e||w()}return k},batchCalls:o=>(...k)=>{_(()=>{o(...k)})},schedule:_,setNotifyFunction:o=>{s=o},setBatchNotifyFunction:o=>{u=o},setScheduler:o=>{h=o}}}var sa=wZ(),kf,rF,KN=(rF=class{constructor(){wi(this,kf)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),cZ(this.gcTime)&&Bn(this,kf,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(lS?1/0:5*60*1e3))}clearGcTimeout(){Gt(this,kf)&&(clearTimeout(Gt(this,kf)),Bn(this,kf,void 0))}},kf=new WeakMap,rF),Ig,Af,gl,Cf,Vo,T0,If,nc,ku,nF,bZ=(nF=class extends KN{constructor(e){super();wi(this,nc);wi(this,Ig);wi(this,Af);wi(this,gl);wi(this,Cf);wi(this,Vo);wi(this,T0);wi(this,If);Bn(this,If,!1),Bn(this,T0,e.defaultOptions),this.setOptions(e.options),this.observers=[],Bn(this,Cf,e.client),Bn(this,gl,Gt(this,Cf).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Bn(this,Ig,TZ(this.options)),this.state=e.state??Gt(this,Ig),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Gt(this,Vo))==null?void 0:e.promise}setOptions(e){this.options={...Gt(this,T0),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Gt(this,gl).remove(this)}setData(e,s){const u=fZ(this.state.data,e,this.options);return Bo(this,nc,ku).call(this,{data:u,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),u}setState(e,s){Bo(this,nc,ku).call(this,{type:"setState",state:e,setStateOptions:s})}cancel(e){var u,h;const s=(u=Gt(this,Vo))==null?void 0:u.promise;return(h=Gt(this,Vo))==null||h.cancel(e),s?s.then(tc).catch(tc):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Gt(this,Ig))}isActive(){return this.observers.some(e=>dZ(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===XC||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Uk(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!uZ(this.state.dataUpdatedAt,e)}onFocus(){var s;const e=this.observers.find(u=>u.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(s=Gt(this,Vo))==null||s.continue()}onOnline(){var s;const e=this.observers.find(u=>u.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(s=Gt(this,Vo))==null||s.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Gt(this,gl).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(s=>s!==e),this.observers.length||(Gt(this,Vo)&&(Gt(this,If)?Gt(this,Vo).cancel({revert:!0}):Gt(this,Vo).cancelRetry()),this.scheduleGc()),Gt(this,gl).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Bo(this,nc,ku).call(this,{type:"invalidate"})}fetch(e,s){var P,O,F;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(Gt(this,Vo))return Gt(this,Vo).continueRetry(),Gt(this,Vo).promise}if(e&&this.setOptions(e),!this.options.queryFn){const V=this.observers.find($=>$.options.queryFn);V&&this.setOptions(V.options)}const u=new AbortController,h=V=>{Object.defineProperty(V,"signal",{enumerable:!0,get:()=>(Bn(this,If,!0),u.signal)})},_=()=>{const V=$N(this.options,s),Y=(()=>{const Z={client:Gt(this,Cf),queryKey:this.queryKey,meta:this.meta};return h(Z),Z})();return Bn(this,If,!1),this.options.persister?this.options.persister(V,Y,this):V(Y)},o=(()=>{const V={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:Gt(this,Cf),state:this.state,fetchFn:_};return h(V),V})();(P=this.options.behavior)==null||P.onFetch(o,this),Bn(this,Af,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((O=o.fetchOptions)==null?void 0:O.meta))&&Bo(this,nc,ku).call(this,{type:"fetch",meta:(F=o.fetchOptions)==null?void 0:F.meta});const k=V=>{var $,Y,Z,se;Y2(V)&&V.silent||Bo(this,nc,ku).call(this,{type:"error",error:V}),Y2(V)||((Y=($=Gt(this,gl).config).onError)==null||Y.call($,V,this),(se=(Z=Gt(this,gl).config).onSettled)==null||se.call(Z,this.state.data,V,this)),this.scheduleGc()};return Bn(this,Vo,qN({initialPromise:s==null?void 0:s.initialPromise,fn:o.fetchFn,abort:u.abort.bind(u),onSuccess:V=>{var $,Y,Z,se;if(V===void 0){k(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(V)}catch(te){k(te);return}(Y=($=Gt(this,gl).config).onSuccess)==null||Y.call($,V,this),(se=(Z=Gt(this,gl).config).onSettled)==null||se.call(Z,V,this.state.error,this),this.scheduleGc()},onError:k,onFail:(V,$)=>{Bo(this,nc,ku).call(this,{type:"failed",failureCount:V,error:$})},onPause:()=>{Bo(this,nc,ku).call(this,{type:"pause"})},onContinue:()=>{Bo(this,nc,ku).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),Gt(this,Vo).start()}},Ig=new WeakMap,Af=new WeakMap,gl=new WeakMap,Cf=new WeakMap,Vo=new WeakMap,T0=new WeakMap,If=new WeakMap,nc=new WeakSet,ku=function(e){const s=u=>{switch(e.type){case"failed":return{...u,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...u,fetchStatus:"paused"};case"continue":return{...u,fetchStatus:"fetching"};case"fetch":return{...u,...SZ(u.data,this.options),fetchMeta:e.meta??null};case"success":return Bn(this,Af,void 0),{...u,data:e.data,dataUpdateCount:u.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const h=e.error;return Y2(h)&&h.revert&&Gt(this,Af)?{...Gt(this,Af),fetchStatus:"idle"}:{...u,error:h,errorUpdateCount:u.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:u.fetchFailureCount+1,fetchFailureReason:h,fetchStatus:"idle",status:"error"};case"invalidate":return{...u,isInvalidated:!0};case"setState":return{...u,...e.state}}};this.state=s(this.state),sa.batch(()=>{this.observers.forEach(u=>{u.onQueryUpdate()}),Gt(this,gl).notify({query:this,type:"updated",action:e})})},nF);function SZ(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:HN(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function TZ(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,u=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?u??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Bc,iF,EZ=(iF=class extends aS{constructor(e={}){super();wi(this,Bc);this.config=e,Bn(this,Bc,new Map)}build(e,s,u){const h=s.queryKey,_=s.queryHash??ZC(h,s);let w=this.get(_);return w||(w=new bZ({client:e,queryKey:h,queryHash:_,options:e.defaultQueryOptions(s),state:u,defaultOptions:e.getQueryDefaults(h)}),this.add(w)),w}add(e){Gt(this,Bc).has(e.queryHash)||(Gt(this,Bc).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const s=Gt(this,Bc).get(e.queryHash);s&&(e.destroy(),s===e&&Gt(this,Bc).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){sa.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Gt(this,Bc).get(e)}getAll(){return[...Gt(this,Bc).values()]}find(e){const s={exact:!0,...e};return this.getAll().find(u=>bO(s,u))}findAll(e={}){const s=this.getAll();return Object.keys(e).length>0?s.filter(u=>bO(e,u)):s}notify(e){sa.batch(()=>{this.listeners.forEach(s=>{s(e)})})}onFocus(){sa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Bc=new WeakMap,iF),Nc,na,Pf,jc,Pd,sF,kZ=(sF=class extends KN{constructor(e){super();wi(this,jc);wi(this,Nc);wi(this,na);wi(this,Pf);this.mutationId=e.mutationId,Bn(this,na,e.mutationCache),Bn(this,Nc,[]),this.state=e.state||AZ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Gt(this,Nc).includes(e)||(Gt(this,Nc).push(e),this.clearGcTimeout(),Gt(this,na).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Bn(this,Nc,Gt(this,Nc).filter(s=>s!==e)),this.scheduleGc(),Gt(this,na).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Gt(this,Nc).length||(this.state.status==="pending"?this.scheduleGc():Gt(this,na).remove(this))}continue(){var e;return((e=Gt(this,Pf))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var _,w,o,k,P,O,F,V,$,Y,Z,se,te,ee,oe,he,Ie,Be,je,Je;const s=()=>{Bo(this,jc,Pd).call(this,{type:"continue"})};Bn(this,Pf,qN({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(ft,kt)=>{Bo(this,jc,Pd).call(this,{type:"failed",failureCount:ft,error:kt})},onPause:()=>{Bo(this,jc,Pd).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Gt(this,na).canRun(this)}));const u=this.state.status==="pending",h=!Gt(this,Pf).canStart();try{if(u)s();else{Bo(this,jc,Pd).call(this,{type:"pending",variables:e,isPaused:h}),await((w=(_=Gt(this,na).config).onMutate)==null?void 0:w.call(_,e,this));const kt=await((k=(o=this.options).onMutate)==null?void 0:k.call(o,e));kt!==this.state.context&&Bo(this,jc,Pd).call(this,{type:"pending",context:kt,variables:e,isPaused:h})}const ft=await Gt(this,Pf).start();return await((O=(P=Gt(this,na).config).onSuccess)==null?void 0:O.call(P,ft,e,this.state.context,this)),await((V=(F=this.options).onSuccess)==null?void 0:V.call(F,ft,e,this.state.context)),await((Y=($=Gt(this,na).config).onSettled)==null?void 0:Y.call($,ft,null,this.state.variables,this.state.context,this)),await((se=(Z=this.options).onSettled)==null?void 0:se.call(Z,ft,null,e,this.state.context)),Bo(this,jc,Pd).call(this,{type:"success",data:ft}),ft}catch(ft){try{throw await((ee=(te=Gt(this,na).config).onError)==null?void 0:ee.call(te,ft,e,this.state.context,this)),await((he=(oe=this.options).onError)==null?void 0:he.call(oe,ft,e,this.state.context)),await((Be=(Ie=Gt(this,na).config).onSettled)==null?void 0:Be.call(Ie,void 0,ft,this.state.variables,this.state.context,this)),await((Je=(je=this.options).onSettled)==null?void 0:Je.call(je,void 0,ft,e,this.state.context)),ft}finally{Bo(this,jc,Pd).call(this,{type:"error",error:ft})}}finally{Gt(this,na).runNext(this)}}},Nc=new WeakMap,na=new WeakMap,Pf=new WeakMap,jc=new WeakSet,Pd=function(e){const s=u=>{switch(e.type){case"failed":return{...u,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...u,isPaused:!0};case"continue":return{...u,isPaused:!1};case"pending":return{...u,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...u,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...u,data:void 0,error:e.error,failureCount:u.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=s(this.state),sa.batch(()=>{Gt(this,Nc).forEach(u=>{u.onMutationUpdate(e)}),Gt(this,na).notify({mutation:this,type:"updated",action:e})})},sF);function AZ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Pu,ic,E0,oF,CZ=(oF=class extends aS{constructor(e={}){super();wi(this,Pu);wi(this,ic);wi(this,E0);this.config=e,Bn(this,Pu,new Set),Bn(this,ic,new Map),Bn(this,E0,0)}build(e,s,u){const h=new kZ({mutationCache:this,mutationId:++zw(this,E0)._,options:e.defaultMutationOptions(s),state:u});return this.add(h),h}add(e){Gt(this,Pu).add(e);const s=ib(e);if(typeof s=="string"){const u=Gt(this,ic).get(s);u?u.push(e):Gt(this,ic).set(s,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Gt(this,Pu).delete(e)){const s=ib(e);if(typeof s=="string"){const u=Gt(this,ic).get(s);if(u)if(u.length>1){const h=u.indexOf(e);h!==-1&&u.splice(h,1)}else u[0]===e&&Gt(this,ic).delete(s)}}this.notify({type:"removed",mutation:e})}canRun(e){const s=ib(e);if(typeof s=="string"){const u=Gt(this,ic).get(s),h=u==null?void 0:u.find(_=>_.state.status==="pending");return!h||h===e}else return!0}runNext(e){var u;const s=ib(e);if(typeof s=="string"){const h=(u=Gt(this,ic).get(s))==null?void 0:u.find(_=>_!==e&&_.state.isPaused);return(h==null?void 0:h.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sa.batch(()=>{Gt(this,Pu).forEach(e=>{this.notify({type:"removed",mutation:e})}),Gt(this,Pu).clear(),Gt(this,ic).clear()})}getAll(){return Array.from(Gt(this,Pu))}find(e){const s={exact:!0,...e};return this.getAll().find(u=>SO(s,u))}findAll(e={}){return this.getAll().filter(s=>SO(e,s))}notify(e){sa.batch(()=>{this.listeners.forEach(s=>{s(e)})})}resumePausedMutations(){const e=this.getAll().filter(s=>s.state.isPaused);return sa.batch(()=>Promise.all(e.map(s=>s.continue().catch(tc))))}},Pu=new WeakMap,ic=new WeakMap,E0=new WeakMap,oF);function ib(t){var e;return(e=t.options.scope)==null?void 0:e.id}function kO(t){return{onFetch:(e,s)=>{var O,F,V,$,Y;const u=e.options,h=(V=(F=(O=e.fetchOptions)==null?void 0:O.meta)==null?void 0:F.fetchMore)==null?void 0:V.direction,_=(($=e.state.data)==null?void 0:$.pages)||[],w=((Y=e.state.data)==null?void 0:Y.pageParams)||[];let o={pages:[],pageParams:[]},k=0;const P=async()=>{let Z=!1;const se=oe=>{Object.defineProperty(oe,"signal",{enumerable:!0,get:()=>(e.signal.aborted?Z=!0:e.signal.addEventListener("abort",()=>{Z=!0}),e.signal)})},te=$N(e.options,e.fetchOptions),ee=async(oe,he,Ie)=>{if(Z)return Promise.reject();if(he==null&&oe.pages.length)return Promise.resolve(oe);const je=(()=>{const tr={client:e.client,queryKey:e.queryKey,pageParam:he,direction:Ie?"backward":"forward",meta:e.options.meta};return se(tr),tr})(),Je=await te(je),{maxPages:ft}=e.options,kt=Ie?mZ:pZ;return{pages:kt(oe.pages,Je,ft),pageParams:kt(oe.pageParams,he,ft)}};if(h&&_.length){const oe=h==="backward",he=oe?IZ:AO,Ie={pages:_,pageParams:w},Be=he(u,Ie);o=await ee(Ie,Be,oe)}else{const oe=t??_.length;do{const he=k===0?w[0]??u.initialPageParam:AO(u,o);if(k>0&&he==null)break;o=await ee(o,he),k++}while(k<oe)}return o};e.options.persister?e.fetchFn=()=>{var Z,se;return(se=(Z=e.options).persister)==null?void 0:se.call(Z,P,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s)}:e.fetchFn=P}}}function AO(t,{pages:e,pageParams:s}){const u=e.length-1;return e.length>0?t.getNextPageParam(e[u],e,s[u],s):void 0}function IZ(t,{pages:e,pageParams:s}){var u;return e.length>0?(u=t.getPreviousPageParam)==null?void 0:u.call(t,e[0],e,s[0],s):void 0}var Es,Vd,Ud,Pg,Mg,$d,Rg,Dg,aF,PZ=(aF=class{constructor(t={}){wi(this,Es);wi(this,Vd);wi(this,Ud);wi(this,Pg);wi(this,Mg);wi(this,$d);wi(this,Rg);wi(this,Dg);Bn(this,Es,t.queryCache||new EZ),Bn(this,Vd,t.mutationCache||new CZ),Bn(this,Ud,t.defaultOptions||{}),Bn(this,Pg,new Map),Bn(this,Mg,new Map),Bn(this,$d,0)}mount(){zw(this,$d)._++,Gt(this,$d)===1&&(Bn(this,Rg,GN.subscribe(async t=>{t&&(await this.resumePausedMutations(),Gt(this,Es).onFocus())})),Bn(this,Dg,x1.subscribe(async t=>{t&&(await this.resumePausedMutations(),Gt(this,Es).onOnline())})))}unmount(){var t,e;zw(this,$d)._--,Gt(this,$d)===0&&((t=Gt(this,Rg))==null||t.call(this),Bn(this,Rg,void 0),(e=Gt(this,Dg))==null||e.call(this),Bn(this,Dg,void 0))}isFetching(t){return Gt(this,Es).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Gt(this,Vd).findAll({...t,status:"pending"}).length}getQueryData(t){var s;const e=this.defaultQueryOptions({queryKey:t});return(s=Gt(this,Es).get(e.queryHash))==null?void 0:s.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=Gt(this,Es).build(this,e),u=s.state.data;return u===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(Uk(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(u))}getQueriesData(t){return Gt(this,Es).findAll(t).map(({queryKey:e,state:s})=>{const u=s.data;return[e,u]})}setQueryData(t,e,s){const u=this.defaultQueryOptions({queryKey:t}),h=Gt(this,Es).get(u.queryHash),_=h==null?void 0:h.state.data,w=lZ(e,_);if(w!==void 0)return Gt(this,Es).build(this,u).setData(w,{...s,manual:!0})}setQueriesData(t,e,s){return sa.batch(()=>Gt(this,Es).findAll(t).map(({queryKey:u})=>[u,this.setQueryData(u,e,s)]))}getQueryState(t){var s;const e=this.defaultQueryOptions({queryKey:t});return(s=Gt(this,Es).get(e.queryHash))==null?void 0:s.state}removeQueries(t){const e=Gt(this,Es);sa.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=Gt(this,Es);return sa.batch(()=>(s.findAll(t).forEach(u=>{u.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},u=sa.batch(()=>Gt(this,Es).findAll(t).map(h=>h.cancel(s)));return Promise.all(u).then(tc).catch(tc)}invalidateQueries(t,e={}){return sa.batch(()=>(Gt(this,Es).findAll(t).forEach(s=>{s.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},u=sa.batch(()=>Gt(this,Es).findAll(t).filter(h=>!h.isDisabled()&&!h.isStatic()).map(h=>{let _=h.fetch(void 0,s);return s.throwOnError||(_=_.catch(tc)),h.state.fetchStatus==="paused"?Promise.resolve():_}));return Promise.all(u).then(tc)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=Gt(this,Es).build(this,e);return s.isStaleByTime(Uk(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(tc).catch(tc)}fetchInfiniteQuery(t){return t.behavior=kO(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tc).catch(tc)}ensureInfiniteQueryData(t){return t.behavior=kO(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return x1.isOnline()?Gt(this,Vd).resumePausedMutations():Promise.resolve()}getQueryCache(){return Gt(this,Es)}getMutationCache(){return Gt(this,Vd)}getDefaultOptions(){return Gt(this,Ud)}setDefaultOptions(t){Bn(this,Ud,t)}setQueryDefaults(t,e){Gt(this,Pg).set(a0(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Gt(this,Pg).values()],s={};return e.forEach(u=>{l0(t,u.queryKey)&&Object.assign(s,u.defaultOptions)}),s}setMutationDefaults(t,e){Gt(this,Mg).set(a0(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Gt(this,Mg).values()],s={};return e.forEach(u=>{l0(t,u.mutationKey)&&Object.assign(s,u.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Gt(this,Ud).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ZC(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===XC&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Gt(this,Ud).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Gt(this,Es).clear(),Gt(this,Vd).clear()}},Es=new WeakMap,Vd=new WeakMap,Ud=new WeakMap,Pg=new WeakMap,Mg=new WeakMap,$d=new WeakMap,Rg=new WeakMap,Dg=new WeakMap,aF),ZN=X.createContext(void 0),Bue=t=>{const e=X.useContext(ZN);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},MZ=({client:t,children:e})=>(X.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),le.jsx(ZN.Provider,{value:t,children:e}));/**
|
||
* @remix-run/router v1.23.0
|
||
*
|
||
* 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 c0(){return c0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(t[u]=s[u])}return t},c0.apply(this,arguments)}var Wd;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Wd||(Wd={}));const CO="popstate";function RZ(t){t===void 0&&(t={});function e(u,h){let{pathname:_,search:w,hash:o}=u.location;return Gk("",{pathname:_,search:w,hash:o},h.state&&h.state.usr||null,h.state&&h.state.key||"default")}function s(u,h){return typeof h=="string"?h:w1(h)}return LZ(e,s,null,t)}function Ls(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function XN(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function DZ(){return Math.random().toString(36).substr(2,8)}function IO(t,e){return{usr:t.state,key:t.key,idx:e}}function Gk(t,e,s,u){return s===void 0&&(s=null),c0({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?e_(e):e,{state:s,key:e&&e.key||u||DZ()})}function w1(t){let{pathname:e="/",search:s="",hash:u=""}=t;return s&&s!=="?"&&(e+=s.charAt(0)==="?"?s:"?"+s),u&&u!=="#"&&(e+=u.charAt(0)==="#"?u:"#"+u),e}function e_(t){let e={};if(t){let s=t.indexOf("#");s>=0&&(e.hash=t.substr(s),t=t.substr(0,s));let u=t.indexOf("?");u>=0&&(e.search=t.substr(u),t=t.substr(0,u)),t&&(e.pathname=t)}return e}function LZ(t,e,s,u){u===void 0&&(u={});let{window:h=document.defaultView,v5Compat:_=!1}=u,w=h.history,o=Wd.Pop,k=null,P=O();P==null&&(P=0,w.replaceState(c0({},w.state,{idx:P}),""));function O(){return(w.state||{idx:null}).idx}function F(){o=Wd.Pop;let se=O(),te=se==null?null:se-P;P=se,k&&k({action:o,location:Z.location,delta:te})}function V(se,te){o=Wd.Push;let ee=Gk(Z.location,se,te);P=O()+1;let oe=IO(ee,P),he=Z.createHref(ee);try{w.pushState(oe,"",he)}catch(Ie){if(Ie instanceof DOMException&&Ie.name==="DataCloneError")throw Ie;h.location.assign(he)}_&&k&&k({action:o,location:Z.location,delta:1})}function $(se,te){o=Wd.Replace;let ee=Gk(Z.location,se,te);P=O();let oe=IO(ee,P),he=Z.createHref(ee);w.replaceState(oe,"",he),_&&k&&k({action:o,location:Z.location,delta:0})}function Y(se){let te=h.location.origin!=="null"?h.location.origin:h.location.href,ee=typeof se=="string"?se:w1(se);return ee=ee.replace(/ $/,"%20"),Ls(te,"No window.location.(origin|href) available to create URL for href: "+ee),new URL(ee,te)}let Z={get action(){return o},get location(){return t(h,w)},listen(se){if(k)throw new Error("A history only accepts one active listener");return h.addEventListener(CO,F),k=se,()=>{h.removeEventListener(CO,F),k=null}},createHref(se){return e(h,se)},createURL:Y,encodeLocation(se){let te=Y(se);return{pathname:te.pathname,search:te.search,hash:te.hash}},push:V,replace:$,go(se){return w.go(se)}};return Z}var PO;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(PO||(PO={}));function OZ(t,e,s){return s===void 0&&(s="/"),zZ(t,e,s)}function zZ(t,e,s,u){let h=typeof e=="string"?e_(e):e,_=YC(h.pathname||"/",s);if(_==null)return null;let w=YN(t);FZ(w);let o=null;for(let k=0;o==null&&k<w.length;++k){let P=ZZ(_);o=WZ(w[k],P)}return o}function YN(t,e,s,u){e===void 0&&(e=[]),s===void 0&&(s=[]),u===void 0&&(u="");let h=(_,w,o)=>{let k={relativePath:o===void 0?_.path||"":o,caseSensitive:_.caseSensitive===!0,childrenIndex:w,route:_};k.relativePath.startsWith("/")&&(Ls(k.relativePath.startsWith(u),'Absolute route path "'+k.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),k.relativePath=k.relativePath.slice(u.length));let P=rh([u,k.relativePath]),O=s.concat(k);_.children&&_.children.length>0&&(Ls(_.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+P+'".')),YN(_.children,e,O,P)),!(_.path==null&&!_.index)&&e.push({path:P,score:GZ(P,_.index),routesMeta:O})};return t.forEach((_,w)=>{var o;if(_.path===""||!((o=_.path)!=null&&o.includes("?")))h(_,w);else for(let k of JN(_.path))h(_,w,k)}),e}function JN(t){let e=t.split("/");if(e.length===0)return[];let[s,...u]=e,h=s.endsWith("?"),_=s.replace(/\?$/,"");if(u.length===0)return h?[_,""]:[_];let w=JN(u.join("/")),o=[];return o.push(...w.map(k=>k===""?_:[_,k].join("/"))),h&&o.push(...w),o.map(k=>t.startsWith("/")&&k===""?"/":k)}function FZ(t){t.sort((e,s)=>e.score!==s.score?s.score-e.score:HZ(e.routesMeta.map(u=>u.childrenIndex),s.routesMeta.map(u=>u.childrenIndex)))}const BZ=/^:[\w-]+$/,NZ=3,jZ=2,VZ=1,UZ=10,$Z=-2,MO=t=>t==="*";function GZ(t,e){let s=t.split("/"),u=s.length;return s.some(MO)&&(u+=$Z),e&&(u+=jZ),s.filter(h=>!MO(h)).reduce((h,_)=>h+(BZ.test(_)?NZ:_===""?VZ:UZ),u)}function HZ(t,e){return t.length===e.length&&t.slice(0,-1).every((u,h)=>u===e[h])?t[t.length-1]-e[e.length-1]:0}function WZ(t,e,s){let{routesMeta:u}=t,h={},_="/",w=[];for(let o=0;o<u.length;++o){let k=u[o],P=o===u.length-1,O=_==="/"?e:e.slice(_.length)||"/",F=qZ({path:k.relativePath,caseSensitive:k.caseSensitive,end:P},O),V=k.route;if(!F)return null;Object.assign(h,F.params),w.push({params:h,pathname:rh([_,F.pathname]),pathnameBase:QZ(rh([_,F.pathnameBase])),route:V}),F.pathnameBase!=="/"&&(_=rh([_,F.pathnameBase]))}return w}function qZ(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[s,u]=KZ(t.path,t.caseSensitive,t.end),h=e.match(s);if(!h)return null;let _=h[0],w=_.replace(/(.)\/+$/,"$1"),o=h.slice(1);return{params:u.reduce((P,O,F)=>{let{paramName:V,isOptional:$}=O;if(V==="*"){let Z=o[F]||"";w=_.slice(0,_.length-Z.length).replace(/(.)\/+$/,"$1")}const Y=o[F];return $&&!Y?P[V]=void 0:P[V]=(Y||"").replace(/%2F/g,"/"),P},{}),pathname:_,pathnameBase:w,pattern:t}}function KZ(t,e,s){e===void 0&&(e=!1),s===void 0&&(s=!0),XN(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let u=[],h="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(w,o,k)=>(u.push({paramName:o,isOptional:k!=null}),k?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(u.push({paramName:"*"}),h+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?h+="\\/*$":t!==""&&t!=="/"&&(h+="(?:(?=\\/|$))"),[new RegExp(h,e?void 0:"i"),u]}function ZZ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return XN(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function YC(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let s=e.endsWith("/")?e.length-1:e.length,u=t.charAt(s);return u&&u!=="/"?null:t.slice(s)||"/"}function XZ(t,e){e===void 0&&(e="/");let{pathname:s,search:u="",hash:h=""}=typeof t=="string"?e_(t):t;return{pathname:s?s.startsWith("/")?s:YZ(s,e):e,search:eX(u),hash:tX(h)}}function YZ(t,e){let s=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(h=>{h===".."?s.length>1&&s.pop():h!=="."&&s.push(h)}),s.length>1?s.join("/"):"/"}function J2(t,e,s,u){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(u)+"]. 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 JZ(t){return t.filter((e,s)=>s===0||e.route.path&&e.route.path.length>0)}function JC(t,e){let s=JZ(t);return e?s.map((u,h)=>h===s.length-1?u.pathname:u.pathnameBase):s.map(u=>u.pathnameBase)}function QC(t,e,s,u){u===void 0&&(u=!1);let h;typeof t=="string"?h=e_(t):(h=c0({},t),Ls(!h.pathname||!h.pathname.includes("?"),J2("?","pathname","search",h)),Ls(!h.pathname||!h.pathname.includes("#"),J2("#","pathname","hash",h)),Ls(!h.search||!h.search.includes("#"),J2("#","search","hash",h)));let _=t===""||h.pathname==="",w=_?"/":h.pathname,o;if(w==null)o=s;else{let F=e.length-1;if(!u&&w.startsWith("..")){let V=w.split("/");for(;V[0]==="..";)V.shift(),F-=1;h.pathname=V.join("/")}o=F>=0?e[F]:"/"}let k=XZ(h,o),P=w&&w!=="/"&&w.endsWith("/"),O=(_||w===".")&&s.endsWith("/");return!k.pathname.endsWith("/")&&(P||O)&&(k.pathname+="/"),k}const rh=t=>t.join("/").replace(/\/\/+/g,"/"),QZ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),eX=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,tX=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function rX(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const QN=["post","put","patch","delete"];new Set(QN);const nX=["get",...QN];new Set(nX);/**
|
||
* React Router v6.30.1
|
||
*
|
||
* 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 u0(){return u0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(t[u]=s[u])}return t},u0.apply(this,arguments)}const eI=X.createContext(null),iX=X.createContext(null),hh=X.createContext(null),cS=X.createContext(null),Gu=X.createContext({outlet:null,matches:[],isDataRoute:!1}),e4=X.createContext(null);function sX(t,e){let{relative:s}=e===void 0?{}:e;t_()||Ls(!1);let{basename:u,navigator:h}=X.useContext(hh),{hash:_,pathname:w,search:o}=r4(t,{relative:s}),k=w;return u!=="/"&&(k=w==="/"?u:rh([u,w])),h.createHref({pathname:k,search:o,hash:_})}function t_(){return X.useContext(cS)!=null}function Wf(){return t_()||Ls(!1),X.useContext(cS).location}function t4(t){X.useContext(hh).static||X.useLayoutEffect(t)}function r_(){let{isDataRoute:t}=X.useContext(Gu);return t?yX():oX()}function oX(){t_()||Ls(!1);let t=X.useContext(eI),{basename:e,future:s,navigator:u}=X.useContext(hh),{matches:h}=X.useContext(Gu),{pathname:_}=Wf(),w=JSON.stringify(JC(h,s.v7_relativeSplatPath)),o=X.useRef(!1);return t4(()=>{o.current=!0}),X.useCallback(function(P,O){if(O===void 0&&(O={}),!o.current)return;if(typeof P=="number"){u.go(P);return}let F=QC(P,JSON.parse(w),_,O.relative==="path");t==null&&e!=="/"&&(F.pathname=F.pathname==="/"?e:rh([e,F.pathname])),(O.replace?u.replace:u.push)(F,O.state,O)},[e,u,w,_,t])}function Nue(){let{matches:t}=X.useContext(Gu),e=t[t.length-1];return e?e.params:{}}function r4(t,e){let{relative:s}=e===void 0?{}:e,{future:u}=X.useContext(hh),{matches:h}=X.useContext(Gu),{pathname:_}=Wf(),w=JSON.stringify(JC(h,u.v7_relativeSplatPath));return X.useMemo(()=>QC(t,JSON.parse(w),_,s==="path"),[t,w,_,s])}function aX(t,e){return lX(t,e)}function lX(t,e,s,u){t_()||Ls(!1);let{navigator:h}=X.useContext(hh),{matches:_}=X.useContext(Gu),w=_[_.length-1],o=w?w.params:{};w&&w.pathname;let k=w?w.pathnameBase:"/";w&&w.route;let P=Wf(),O;if(e){var F;let se=typeof e=="string"?e_(e):e;k==="/"||(F=se.pathname)!=null&&F.startsWith(k)||Ls(!1),O=se}else O=P;let V=O.pathname||"/",$=V;if(k!=="/"){let se=k.replace(/^\//,"").split("/");$="/"+V.replace(/^\//,"").split("/").slice(se.length).join("/")}let Y=OZ(t,{pathname:$}),Z=fX(Y&&Y.map(se=>Object.assign({},se,{params:Object.assign({},o,se.params),pathname:rh([k,h.encodeLocation?h.encodeLocation(se.pathname).pathname:se.pathname]),pathnameBase:se.pathnameBase==="/"?k:rh([k,h.encodeLocation?h.encodeLocation(se.pathnameBase).pathname:se.pathnameBase])})),_,s,u);return e&&Z?X.createElement(cS.Provider,{value:{location:u0({pathname:"/",search:"",hash:"",state:null,key:"default"},O),navigationType:Wd.Pop}},Z):Z}function cX(){let t=_X(),e=rX(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),s=t instanceof Error?t.stack:null,h={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return X.createElement(X.Fragment,null,X.createElement("h2",null,"Unexpected Application Error!"),X.createElement("h3",{style:{fontStyle:"italic"}},e),s?X.createElement("pre",{style:h},s):null,null)}const uX=X.createElement(cX,null);class dX extends X.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,s){return s.location!==e.location||s.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:s.error,location:s.location,revalidation:e.revalidation||s.revalidation}}componentDidCatch(e,s){console.error("React Router caught the following error during render",e,s)}render(){return this.state.error!==void 0?X.createElement(Gu.Provider,{value:this.props.routeContext},X.createElement(e4.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hX(t){let{routeContext:e,match:s,children:u}=t,h=X.useContext(eI);return h&&h.static&&h.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(h.staticContext._deepestRenderedBoundaryId=s.route.id),X.createElement(Gu.Provider,{value:e},u)}function fX(t,e,s,u){var h;if(e===void 0&&(e=[]),s===void 0&&(s=null),u===void 0&&(u=null),t==null){var _;if(!s)return null;if(s.errors)t=s.matches;else if((_=u)!=null&&_.v7_partialHydration&&e.length===0&&!s.initialized&&s.matches.length>0)t=s.matches;else return null}let w=t,o=(h=s)==null?void 0:h.errors;if(o!=null){let O=w.findIndex(F=>F.route.id&&(o==null?void 0:o[F.route.id])!==void 0);O>=0||Ls(!1),w=w.slice(0,Math.min(w.length,O+1))}let k=!1,P=-1;if(s&&u&&u.v7_partialHydration)for(let O=0;O<w.length;O++){let F=w[O];if((F.route.HydrateFallback||F.route.hydrateFallbackElement)&&(P=O),F.route.id){let{loaderData:V,errors:$}=s,Y=F.route.loader&&V[F.route.id]===void 0&&(!$||$[F.route.id]===void 0);if(F.route.lazy||Y){k=!0,P>=0?w=w.slice(0,P+1):w=[w[0]];break}}}return w.reduceRight((O,F,V)=>{let $,Y=!1,Z=null,se=null;s&&($=o&&F.route.id?o[F.route.id]:void 0,Z=F.route.errorElement||uX,k&&(P<0&&V===0?(vX("route-fallback"),Y=!0,se=null):P===V&&(Y=!0,se=F.route.hydrateFallbackElement||null)));let te=e.concat(w.slice(0,V+1)),ee=()=>{let oe;return $?oe=Z:Y?oe=se:F.route.Component?oe=X.createElement(F.route.Component,null):F.route.element?oe=F.route.element:oe=O,X.createElement(hX,{match:F,routeContext:{outlet:O,matches:te,isDataRoute:s!=null},children:oe})};return s&&(F.route.ErrorBoundary||F.route.errorElement||V===0)?X.createElement(dX,{location:s.location,revalidation:s.revalidation,component:Z,error:$,children:ee(),routeContext:{outlet:null,matches:te,isDataRoute:!0}}):ee()},null)}var n4=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(n4||{}),i4=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(i4||{});function pX(t){let e=X.useContext(eI);return e||Ls(!1),e}function mX(t){let e=X.useContext(iX);return e||Ls(!1),e}function gX(t){let e=X.useContext(Gu);return e||Ls(!1),e}function s4(t){let e=gX(),s=e.matches[e.matches.length-1];return s.route.id||Ls(!1),s.route.id}function _X(){var t;let e=X.useContext(e4),s=mX(),u=s4();return e!==void 0?e:(t=s.errors)==null?void 0:t[u]}function yX(){let{router:t}=pX(n4.UseNavigateStable),e=s4(i4.UseNavigateStable),s=X.useRef(!1);return t4(()=>{s.current=!0}),X.useCallback(function(h,_){_===void 0&&(_={}),s.current&&(typeof h=="number"?t.navigate(h):t.navigate(h,u0({fromRouteId:e},_)))},[t,e])}const RO={};function vX(t,e,s){RO[t]||(RO[t]=!0)}function xX(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function jue(t){let{to:e,replace:s,state:u,relative:h}=t;t_()||Ls(!1);let{future:_,static:w}=X.useContext(hh),{matches:o}=X.useContext(Gu),{pathname:k}=Wf(),P=r_(),O=QC(e,JC(o,_.v7_relativeSplatPath),k,h==="path"),F=JSON.stringify(O);return X.useEffect(()=>P(JSON.parse(F),{replace:s,state:u,relative:h}),[P,F,h,s,u]),null}function Gi(t){Ls(!1)}function wX(t){let{basename:e="/",children:s=null,location:u,navigationType:h=Wd.Pop,navigator:_,static:w=!1,future:o}=t;t_()&&Ls(!1);let k=e.replace(/^\/*/,"/"),P=X.useMemo(()=>({basename:k,navigator:_,static:w,future:u0({v7_relativeSplatPath:!1},o)}),[k,o,_,w]);typeof u=="string"&&(u=e_(u));let{pathname:O="/",search:F="",hash:V="",state:$=null,key:Y="default"}=u,Z=X.useMemo(()=>{let se=YC(O,k);return se==null?null:{location:{pathname:se,search:F,hash:V,state:$,key:Y},navigationType:h}},[k,O,F,V,$,Y,h]);return Z==null?null:X.createElement(hh.Provider,{value:P},X.createElement(cS.Provider,{children:s,value:Z}))}function bX(t){let{children:e,location:s}=t;return aX(Hk(e),s)}new Promise(()=>{});function Hk(t,e){e===void 0&&(e=[]);let s=[];return X.Children.forEach(t,(u,h)=>{if(!X.isValidElement(u))return;let _=[...e,h];if(u.type===X.Fragment){s.push.apply(s,Hk(u.props.children,_));return}u.type!==Gi&&Ls(!1),!u.props.index||!u.props.children||Ls(!1);let w={id:u.props.id||_.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(w.children=Hk(u.props.children,_)),s.push(w)}),s}/**
|
||
* React Router DOM v6.30.1
|
||
*
|
||
* 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 Wk(){return Wk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(t[u]=s[u])}return t},Wk.apply(this,arguments)}function SX(t,e){if(t==null)return{};var s={},u=Object.keys(t),h,_;for(_=0;_<u.length;_++)h=u[_],!(e.indexOf(h)>=0)&&(s[h]=t[h]);return s}function TX(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function EX(t,e){return t.button===0&&(!e||e==="_self")&&!TX(t)}function qk(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,s)=>{let u=t[s];return e.concat(Array.isArray(u)?u.map(h=>[s,h]):[[s,u]])},[]))}function kX(t,e){let s=qk(t);return e&&e.forEach((u,h)=>{s.has(h)||e.getAll(h).forEach(_=>{s.append(h,_)})}),s}const AX=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],CX="6";try{window.__reactRouterVersion=CX}catch{}const IX="startTransition",DO=UA[IX];function PX(t){let{basename:e,children:s,future:u,window:h}=t,_=X.useRef();_.current==null&&(_.current=RZ({window:h,v5Compat:!0}));let w=_.current,[o,k]=X.useState({action:w.action,location:w.location}),{v7_startTransition:P}=u||{},O=X.useCallback(F=>{P&&DO?DO(()=>k(F)):k(F)},[k,P]);return X.useLayoutEffect(()=>w.listen(O),[w,O]),X.useEffect(()=>xX(u),[u]),X.createElement(wX,{basename:e,children:s,location:o.location,navigationType:o.action,navigator:w,future:u})}const MX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",RX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vue=X.forwardRef(function(e,s){let{onClick:u,relative:h,reloadDocument:_,replace:w,state:o,target:k,to:P,preventScrollReset:O,viewTransition:F}=e,V=SX(e,AX),{basename:$}=X.useContext(hh),Y,Z=!1;if(typeof P=="string"&&RX.test(P)&&(Y=P,MX))try{let oe=new URL(window.location.href),he=P.startsWith("//")?new URL(oe.protocol+P):new URL(P),Ie=YC(he.pathname,$);he.origin===oe.origin&&Ie!=null?P=Ie+he.search+he.hash:Z=!0}catch{}let se=sX(P,{relative:h}),te=DX(P,{replace:w,state:o,target:k,preventScrollReset:O,relative:h,viewTransition:F});function ee(oe){u&&u(oe),oe.defaultPrevented||te(oe)}return X.createElement("a",Wk({},V,{href:Y||se,onClick:Z||_?u:ee,ref:s,target:k}))});var LO;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(LO||(LO={}));var OO;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(OO||(OO={}));function DX(t,e){let{target:s,replace:u,state:h,preventScrollReset:_,relative:w,viewTransition:o}=e===void 0?{}:e,k=r_(),P=Wf(),O=r4(t,{relative:w});return X.useCallback(F=>{if(EX(F,s)){F.preventDefault();let V=u!==void 0?u:w1(P)===w1(O);k(t,{replace:V,state:h,preventScrollReset:_,relative:w,viewTransition:o})}},[P,k,O,u,h,s,t,_,w,o])}function LX(t){let e=X.useRef(qk(t)),s=X.useRef(!1),u=Wf(),h=X.useMemo(()=>kX(u.search,s.current?null:e.current),[u.search]),_=r_(),w=X.useCallback((o,k)=>{const P=qk(typeof o=="function"?o(h):o);s.current=!0,_("?"+P,k)},[_,h]);return[h,w]}const sb="https://api.quixzoom.com/api/qz",Id="qz_token",Sa={signUp:async(t,e,s)=>{try{const h=await(await fetch(`${sb}/auth/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:e,name:s,role:"zoomer"})})).json();return h.token&&localStorage.setItem(Id,h.token),h}catch{return{error:"Network error",code:"NETWORK_ERROR"}}},signIn:async(t,e)=>{try{const u=await(await fetch(`${sb}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:e})})).json();return u.token&&localStorage.setItem(Id,u.token),u}catch{return{error:"Network error",code:"NETWORK_ERROR"}}},signOut:async()=>{const t=localStorage.getItem(Id);if(t){try{await fetch(`${sb}/auth/logout`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})}catch{}localStorage.removeItem(Id)}},getToken:()=>localStorage.getItem(Id),getUser:async()=>{const t=localStorage.getItem(Id);if(!t)return null;try{const e=await fetch(`${sb}/auth/me`,{headers:{Authorization:`Bearer ${t}`}});return e.ok?(await e.json()).user??null:(localStorage.removeItem(Id),null)}catch{return null}},isAuthenticated:()=>{const t=localStorage.getItem(Id);if(!t)return!1;try{return(JSON.parse(atob(t.split(".")[1])).exp??0)>Math.floor(Date.now()/1e3)}catch{return!1}}},o4=X.createContext(void 0),OX=({children:t})=>{const[e,s]=X.useState(null),[u,h]=X.useState(!0);X.useEffect(()=>{let P=!1;async function O(){try{if(Sa.isAuthenticated()){const F=await Sa.getUser();P||s(F)}}catch{}finally{P||h(!1)}}return O(),()=>{P=!0}},[]);const _=e&&Sa.getToken()?{user:e,access_token:Sa.getToken()}:null,w=async(P,O)=>{try{const F=await Sa.signIn(P,O);return F.error||!F.user?{error:new Error(F.error??"Login failed")}:(s(F.user),{error:null})}catch(F){return{error:F instanceof Error?F:new Error("Login failed")}}},o=async(P,O,F)=>{try{const V=await Sa.signUp(P,O,F);return V.error||!V.user?{error:new Error(V.error??"Sign-up failed")}:(s(V.user),{error:null})}catch(V){return{error:V instanceof Error?V:new Error("Sign-up failed")}}},k=async()=>{await Sa.signOut(),s(null)};return le.jsx(o4.Provider,{value:{user:e,session:_,isLoading:u,signIn:w,signUp:o,signOut:k},children:t})},qf=()=>{const t=X.useContext(o4);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},a4="qz_last_position",zX=5*60*1e3;function FX(){try{const t=localStorage.getItem(a4);if(!t)return null;const{latitude:e,longitude:s,ts:u}=JSON.parse(t);return Date.now()-u>zX?null:{latitude:e,longitude:s}}catch{return null}}function BX(t,e){try{localStorage.setItem(a4,JSON.stringify({latitude:t,longitude:e,ts:Date.now()}))}catch{}}const tI=()=>{const t=FX(),[e,s]=X.useState({latitude:(t==null?void 0:t.latitude)??null,longitude:(t==null?void 0:t.longitude)??null,error:null,loading:t===null}),u=X.useCallback(()=>new Promise(h=>{if(!navigator.geolocation){s(_=>({..._,error:"Geolocation stöds inte i din webbläsare",loading:!1})),h(null);return}navigator.geolocation.getCurrentPosition(_=>{const w={latitude:_.coords.latitude,longitude:_.coords.longitude};s({...w,error:null,loading:!1}),h(w)},_=>{s(w=>({...w,error:_.message,loading:!1})),h(null)},{enableHighAccuracy:!0,timeout:1e4,maximumAge:6e4})}),[]);return X.useEffect(()=>{if(!navigator.geolocation){s(w=>({...w,error:"Geolocation stöds inte i din webbläsare",loading:!1}));return}const h=w=>{const{latitude:o,longitude:k}=w.coords;BX(o,k),s({latitude:o,longitude:k,error:null,loading:!1})},_=w=>{s(o=>({...o,error:w.message,loading:!1}))};navigator.geolocation.getCurrentPosition(h,_,{enableHighAccuracy:!0,timeout:5e3,maximumAge:6e4})},[]),{...e,requestPosition:u}},NX=(t,e,s,u)=>{const _=t*Math.PI/180,w=s*Math.PI/180,o=(s-t)*Math.PI/180,k=(u-e)*Math.PI/180,P=Math.sin(o/2)*Math.sin(o/2)+Math.cos(_)*Math.cos(w)*Math.sin(k/2)*Math.sin(k/2);return 6371e3*(2*Math.atan2(Math.sqrt(P),Math.sqrt(1-P)))},zb=t=>t<1e3?`${Math.round(t)} m`:`${(t/1e3).toFixed(1)} km`,l4=X.createContext(void 0),zO="app-theme";function jX(t,e){if(!t)return e>=5&&e<7?Math.round(20+(e-5)/2*20):e>=7&&e<18?55:e>=18&&e<21?Math.round(55-(e-18)/3*35):e>=21&&e<23?Math.round(20-(e-21)/2*15):5;const{uvIndex:s,isDaytime:u,cloudCover:h,sunrise:_,sunset:w}=t,o=parseInt(_.split(":")[0]),k=parseInt(w.split(":")[0]);if(!u){if(e>=o-2&&e<o){const te=(e-(o-2))/2;return Math.round(5+te*25)}if(e>=k&&e<k+2){const te=(e-k)/2;return Math.round(30-te*25)}return 5}const P=45,O=Math.min(s/6,1)*15,F=h/100*12,V=(o+k)/2,$=k-o,Y=Math.abs(e-V),Z=Math.max(0,8-Y/($/2)*8),se=P+O+Z-F;return Math.round(Math.max(10,Math.min(60,se)))}function VX(t){const e=Math.floor(t/10),u=[{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(e,6)];return{"--background":u.background,"--foreground":u.foreground,"--card":u.card,"--card-foreground":u.cardForeground,"--popover":u.popover,"--popover-foreground":u.cardForeground,"--primary":u.primary,"--primary-foreground":u.primaryForeground,"--secondary":u.secondary,"--secondary-foreground":u.secondaryForeground,"--muted":u.muted,"--muted-foreground":u.mutedForeground,"--accent":u.primary,"--accent-foreground":u.primaryForeground,"--border":u.border,"--input":u.input,"--ring":u.primary}}async function UX(t,e){var s,u,h,_,w,o,k,P,O;try{const F=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${t}&longitude=${e}¤t=uv_index,is_day,cloud_cover&daily=sunrise,sunset&timezone=auto&forecast_days=1`);if(!F.ok)return null;const V=await F.json();return{uvIndex:((s=V.current)==null?void 0:s.uv_index)??0,isDaytime:((u=V.current)==null?void 0:u.is_day)===1,cloudCover:((h=V.current)==null?void 0:h.cloud_cover)??0,sunrise:((o=(w=(_=V.daily)==null?void 0:_.sunrise)==null?void 0:w[0])==null?void 0:o.split("T")[1])??"06:00",sunset:((O=(P=(k=V.daily)==null?void 0:k.sunset)==null?void 0:P[0])==null?void 0:O.split("T")[1])??"20:00"}}catch(F){return console.error("Failed to fetch sunlight data:",F),null}}function $X({children:t}){const[e,s]=X.useState(()=>typeof window<"u"&&localStorage.getItem(zO)||"light"),[u,h]=X.useState("light"),[_,w]=X.useState(0),[o,k]=X.useState(null),{latitude:P,longitude:O}=tI();X.useEffect(()=>{if(e!=="auto"||!P||!O)return;const $=async()=>{const Z=await UX(P,O);k(Z)};$();const Y=setInterval($,10*60*1e3);return()=>clearInterval(Y)},[e,P,O]);const F=X.useCallback(()=>{const $=new Date().getHours();if(e==="auto"){const Y=jX(o,$);w(Y),h(Y>=30?"light":"dark")}else w(e==="light"?60:0),h(e)},[e,o]);X.useEffect(()=>{if(F(),e==="auto"){const $=setInterval(F,6e4);return()=>clearInterval($)}},[e,F]),X.useEffect(()=>{const $=document.documentElement;if(e==="auto"){const Y=VX(_);Object.entries(Y).forEach(([Z,se])=>{$.style.setProperty(Z,se)}),$.classList.remove("light","dark"),$.classList.add(u)}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(Z=>$.style.removeProperty(Z)),$.classList.remove("light","dark"),$.classList.add(e)},[e,_,u]);const V=$=>{s($),localStorage.setItem(zO,$)};return le.jsx(l4.Provider,{value:{theme:e,resolvedTheme:u,lightLevel:_,setTheme:V},children:t})}function GX(){const t=X.useContext(l4);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function ob({className:t,...e}){return le.jsx("div",{className:ki("animate-pulse rounded-md bg-muted",t),...e})}class HX extends X.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,s){console.error("[ErrorBoundary] Caught:",e,s.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:le.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-6 gap-4",children:[le.jsx("p",{className:"text-muted-foreground text-sm",children:"Något gick fel. Försök ladda om sidan."}),le.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 Pn=t=>typeof t=="string",hv=()=>{let t,e;const s=new Promise((u,h)=>{t=u,e=h});return s.resolve=t,s.reject=e,s},FO=t=>t==null?"":""+t,WX=(t,e,s)=>{t.forEach(u=>{e[u]&&(s[u]=e[u])})},qX=/###/g,BO=t=>t&&t.indexOf("###")>-1?t.replace(qX,"."):t,NO=t=>!t||Pn(t),Rv=(t,e,s)=>{const u=Pn(e)?e.split("."):e;let h=0;for(;h<u.length-1;){if(NO(t))return{};const _=BO(u[h]);!t[_]&&s&&(t[_]=new s),Object.prototype.hasOwnProperty.call(t,_)?t=t[_]:t={},++h}return NO(t)?{}:{obj:t,k:BO(u[h])}},jO=(t,e,s)=>{const{obj:u,k:h}=Rv(t,e,Object);if(u!==void 0||e.length===1){u[h]=s;return}let _=e[e.length-1],w=e.slice(0,e.length-1),o=Rv(t,w,Object);for(;o.obj===void 0&&w.length;)_=`${w[w.length-1]}.${_}`,w=w.slice(0,w.length-1),o=Rv(t,w,Object),o!=null&&o.obj&&typeof o.obj[`${o.k}.${_}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${_}`]=s},KX=(t,e,s,u)=>{const{obj:h,k:_}=Rv(t,e,Object);h[_]=h[_]||[],h[_].push(s)},b1=(t,e)=>{const{obj:s,k:u}=Rv(t,e);if(s&&Object.prototype.hasOwnProperty.call(s,u))return s[u]},ZX=(t,e,s)=>{const u=b1(t,s);return u!==void 0?u:b1(e,s)},c4=(t,e,s)=>{for(const u in e)u!=="__proto__"&&u!=="constructor"&&(u in t?Pn(t[u])||t[u]instanceof String||Pn(e[u])||e[u]instanceof String?s&&(t[u]=e[u]):c4(t[u],e[u],s):t[u]=e[u]);return t},zm=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var XX={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const YX=t=>Pn(t)?t.replace(/[&<>"'\/]/g,e=>XX[e]):t;class JX{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const s=this.regExpMap.get(e);if(s!==void 0)return s;const u=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,u),this.regExpQueue.push(e),u}}const QX=[" ",",","?","!",";"],eY=new JX(20),tY=(t,e,s)=>{e=e||"",s=s||"";const u=QX.filter(w=>e.indexOf(w)<0&&s.indexOf(w)<0);if(u.length===0)return!0;const h=eY.getRegExp(`(${u.map(w=>w==="?"?"\\?":w).join("|")})`);let _=!h.test(t);if(!_){const w=t.indexOf(s);w>0&&!h.test(t.substring(0,w))&&(_=!0)}return _},Kk=(t,e,s=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const u=e.split(s);let h=t;for(let _=0;_<u.length;){if(!h||typeof h!="object")return;let w,o="";for(let k=_;k<u.length;++k)if(k!==_&&(o+=s),o+=u[k],w=h[o],w!==void 0){if(["string","number","boolean"].indexOf(typeof w)>-1&&k<u.length-1)continue;_+=k-_+1;break}h=w}return h},d0=t=>t==null?void 0:t.replace("_","-"),rY={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var s,u;(u=(s=console==null?void 0:console[t])==null?void 0:s.apply)==null||u.call(s,console,e)}};class S1{constructor(e,s={}){this.init(e,s)}init(e,s={}){this.prefix=s.prefix||"i18next:",this.logger=e||rY,this.options=s,this.debug=s.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,s,u,h){return h&&!this.debug?null:(Pn(e[0])&&(e[0]=`${u}${this.prefix} ${e[0]}`),this.logger[s](e))}create(e){return new S1(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new S1(this.logger,e)}}var Gc=new S1;class uS{constructor(){this.observers={}}on(e,s){return e.split(" ").forEach(u=>{this.observers[u]||(this.observers[u]=new Map);const h=this.observers[u].get(s)||0;this.observers[u].set(s,h+1)}),this}off(e,s){if(this.observers[e]){if(!s){delete this.observers[e];return}this.observers[e].delete(s)}}emit(e,...s){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([h,_])=>{for(let w=0;w<_;w++)h(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([h,_])=>{for(let w=0;w<_;w++)h.apply(h,[e,...s])})}}class VO extends uS{constructor(e,s={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const s=this.options.ns.indexOf(e);s>-1&&this.options.ns.splice(s,1)}getResource(e,s,u,h={}){var P,O;const _=h.keySeparator!==void 0?h.keySeparator:this.options.keySeparator,w=h.ignoreJSONStructure!==void 0?h.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,s],u&&(Array.isArray(u)?o.push(...u):Pn(u)&&_?o.push(...u.split(_)):o.push(u)));const k=b1(this.data,o);return!k&&!s&&!u&&e.indexOf(".")>-1&&(e=o[0],s=o[1],u=o.slice(2).join(".")),k||!w||!Pn(u)?k:Kk((O=(P=this.data)==null?void 0:P[e])==null?void 0:O[s],u,_)}addResource(e,s,u,h,_={silent:!1}){const w=_.keySeparator!==void 0?_.keySeparator:this.options.keySeparator;let o=[e,s];u&&(o=o.concat(w?u.split(w):u)),e.indexOf(".")>-1&&(o=e.split("."),h=s,s=o[1]),this.addNamespaces(s),jO(this.data,o,h),_.silent||this.emit("added",e,s,u,h)}addResources(e,s,u,h={silent:!1}){for(const _ in u)(Pn(u[_])||Array.isArray(u[_]))&&this.addResource(e,s,_,u[_],{silent:!0});h.silent||this.emit("added",e,s,u)}addResourceBundle(e,s,u,h,_,w={silent:!1,skipCopy:!1}){let o=[e,s];e.indexOf(".")>-1&&(o=e.split("."),h=u,u=s,s=o[1]),this.addNamespaces(s);let k=b1(this.data,o)||{};w.skipCopy||(u=JSON.parse(JSON.stringify(u))),h?c4(k,u,_):k={...k,...u},jO(this.data,o,k),w.silent||this.emit("added",e,s,u)}removeResourceBundle(e,s){this.hasResourceBundle(e,s)&&delete this.data[e][s],this.removeNamespaces(s),this.emit("removed",e,s)}hasResourceBundle(e,s){return this.getResource(e,s)!==void 0}getResourceBundle(e,s){return s||(s=this.options.defaultNS),this.getResource(e,s)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const s=this.getDataByLanguage(e);return!!(s&&Object.keys(s)||[]).find(h=>s[h]&&Object.keys(s[h]).length>0)}toJSON(){return this.data}}var u4={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,s,u,h){return t.forEach(_=>{var w;e=((w=this.processors[_])==null?void 0:w.process(e,s,u,h))??e}),e}};const d4=Symbol("i18next/PATH_KEY");function nY(){const t=[],e=Object.create(null);let s;return e.get=(u,h)=>{var _;return(_=s==null?void 0:s.revoke)==null||_.call(s),h===d4?t:(t.push(h),s=Proxy.revocable(u,e),s.proxy)},Proxy.revocable(Object.create(null),e).proxy}function Zk(t,e){const{[d4]:s}=t(nY());return s.join((e==null?void 0:e.keySeparator)??".")}const UO={},Q2=t=>!Pn(t)&&typeof t!="boolean"&&typeof t!="number";class T1 extends uS{constructor(e,s={}){super(),WX(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Gc.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,s={interpolation:{}}){const u={...s};if(e==null)return!1;const h=this.resolve(e,u);if((h==null?void 0:h.res)===void 0)return!1;const _=Q2(h.res);return!(u.returnObjects===!1&&_)}extractFromKey(e,s){let u=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const h=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let _=s.ns||this.options.defaultNS||[];const w=u&&e.indexOf(u)>-1,o=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!tY(e,u,h);if(w&&!o){const k=e.match(this.interpolator.nestingRegexp);if(k&&k.length>0)return{key:e,namespaces:Pn(_)?[_]:_};const P=e.split(u);(u!==h||u===h&&this.options.ns.indexOf(P[0])>-1)&&(_=P.shift()),e=P.join(h)}return{key:e,namespaces:Pn(_)?[_]:_}}translate(e,s,u){let h=typeof s=="object"?{...s}:s;if(typeof h!="object"&&this.options.overloadTranslationOptionHandler&&(h=this.options.overloadTranslationOptionHandler(arguments)),typeof h=="object"&&(h={...h}),h||(h={}),e==null)return"";typeof e=="function"&&(e=Zk(e,{...this.options,...h})),Array.isArray(e)||(e=[String(e)]);const _=h.returnDetails!==void 0?h.returnDetails:this.options.returnDetails,w=h.keySeparator!==void 0?h.keySeparator:this.options.keySeparator,{key:o,namespaces:k}=this.extractFromKey(e[e.length-1],h),P=k[k.length-1];let O=h.nsSeparator!==void 0?h.nsSeparator:this.options.nsSeparator;O===void 0&&(O=":");const F=h.lng||this.language,V=h.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((F==null?void 0:F.toLowerCase())==="cimode")return V?_?{res:`${P}${O}${o}`,usedKey:o,exactUsedKey:o,usedLng:F,usedNS:P,usedParams:this.getUsedParamsDetails(h)}:`${P}${O}${o}`:_?{res:o,usedKey:o,exactUsedKey:o,usedLng:F,usedNS:P,usedParams:this.getUsedParamsDetails(h)}:o;const $=this.resolve(e,h);let Y=$==null?void 0:$.res;const Z=($==null?void 0:$.usedKey)||o,se=($==null?void 0:$.exactUsedKey)||o,te=["[object Number]","[object Function]","[object RegExp]"],ee=h.joinArrays!==void 0?h.joinArrays:this.options.joinArrays,oe=!this.i18nFormat||this.i18nFormat.handleAsObject,he=h.count!==void 0&&!Pn(h.count),Ie=T1.hasDefaultValue(h),Be=he?this.pluralResolver.getSuffix(F,h.count,h):"",je=h.ordinal&&he?this.pluralResolver.getSuffix(F,h.count,{ordinal:!1}):"",Je=he&&!h.ordinal&&h.count===0,ft=Je&&h[`defaultValue${this.options.pluralSeparator}zero`]||h[`defaultValue${Be}`]||h[`defaultValue${je}`]||h.defaultValue;let kt=Y;oe&&!Y&&Ie&&(kt=ft);const tr=Q2(kt),jt=Object.prototype.toString.apply(kt);if(oe&&kt&&tr&&te.indexOf(jt)<0&&!(Pn(ee)&&Array.isArray(kt))){if(!h.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Qe=this.options.returnedObjectHandler?this.options.returnedObjectHandler(Z,kt,{...h,ns:k}):`key '${o} (${this.language})' returned an object instead of string.`;return _?($.res=Qe,$.usedParams=this.getUsedParamsDetails(h),$):Qe}if(w){const Qe=Array.isArray(kt),xt=Qe?[]:{},It=Qe?se:Z;for(const Ot in kt)if(Object.prototype.hasOwnProperty.call(kt,Ot)){const Et=`${It}${w}${Ot}`;Ie&&!Y?xt[Ot]=this.translate(Et,{...h,defaultValue:Q2(ft)?ft[Ot]:void 0,joinArrays:!1,ns:k}):xt[Ot]=this.translate(Et,{...h,joinArrays:!1,ns:k}),xt[Ot]===Et&&(xt[Ot]=kt[Ot])}Y=xt}}else if(oe&&Pn(ee)&&Array.isArray(Y))Y=Y.join(ee),Y&&(Y=this.extendTranslation(Y,e,h,u));else{let Qe=!1,xt=!1;!this.isValidLookup(Y)&&Ie&&(Qe=!0,Y=ft),this.isValidLookup(Y)||(xt=!0,Y=o);const Ot=(h.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&xt?void 0:Y,Et=Ie&&ft!==Y&&this.options.updateMissing;if(xt||Qe||Et){if(this.logger.log(Et?"updateKey":"missingKey",F,P,o,Et?ft:Y),w){const _r=this.resolve(o,{...h,keySeparator:!1});_r&&_r.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 st=[];const Pt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,h.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Pt&&Pt[0])for(let _r=0;_r<Pt.length;_r++)st.push(Pt[_r]);else this.options.saveMissingTo==="all"?st=this.languageUtils.toResolveHierarchy(h.lng||this.language):st.push(h.lng||this.language);const qt=(_r,yr,hr)=>{var mi;const Gr=Ie&&hr!==Y?hr:Ot;this.options.missingKeyHandler?this.options.missingKeyHandler(_r,P,yr,Gr,Et,h):(mi=this.backendConnector)!=null&&mi.saveMissing&&this.backendConnector.saveMissing(_r,P,yr,Gr,Et,h),this.emit("missingKey",_r,P,yr,Y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&he?st.forEach(_r=>{const yr=this.pluralResolver.getSuffixes(_r,h);Je&&h[`defaultValue${this.options.pluralSeparator}zero`]&&yr.indexOf(`${this.options.pluralSeparator}zero`)<0&&yr.push(`${this.options.pluralSeparator}zero`),yr.forEach(hr=>{qt([_r],o+hr,h[`defaultValue${hr}`]||ft)})}):qt(st,o,ft))}Y=this.extendTranslation(Y,e,h,$,u),xt&&Y===o&&this.options.appendNamespaceToMissingKey&&(Y=`${P}${O}${o}`),(xt||Qe)&&this.options.parseMissingKeyHandler&&(Y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${P}${O}${o}`:o,Qe?Y:void 0,h))}return _?($.res=Y,$.usedParams=this.getUsedParamsDetails(h),$):Y}extendTranslation(e,s,u,h,_){var k,P;if((k=this.i18nFormat)!=null&&k.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...u},u.lng||this.language||h.usedLng,h.usedNS,h.usedKey,{resolved:h});else if(!u.skipInterpolation){u.interpolation&&this.interpolator.init({...u,interpolation:{...this.options.interpolation,...u.interpolation}});const O=Pn(e)&&(((P=u==null?void 0:u.interpolation)==null?void 0:P.skipOnVariables)!==void 0?u.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let F;if(O){const $=e.match(this.interpolator.nestingRegexp);F=$&&$.length}let V=u.replace&&!Pn(u.replace)?u.replace:u;if(this.options.interpolation.defaultVariables&&(V={...this.options.interpolation.defaultVariables,...V}),e=this.interpolator.interpolate(e,V,u.lng||this.language||h.usedLng,u),O){const $=e.match(this.interpolator.nestingRegexp),Y=$&&$.length;F<Y&&(u.nest=!1)}!u.lng&&h&&h.res&&(u.lng=this.language||h.usedLng),u.nest!==!1&&(e=this.interpolator.nest(e,(...$)=>(_==null?void 0:_[0])===$[0]&&!u.context?(this.logger.warn(`It seems you are nesting recursively key: ${$[0]} in key: ${s[0]}`),null):this.translate(...$,s),u)),u.interpolation&&this.interpolator.reset()}const w=u.postProcess||this.options.postProcess,o=Pn(w)?[w]:w;return e!=null&&(o!=null&&o.length)&&u.applyPostProcessor!==!1&&(e=u4.handle(o,e,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...h,usedParams:this.getUsedParamsDetails(u)},...u}:u,this)),e}resolve(e,s={}){let u,h,_,w,o;return Pn(e)&&(e=[e]),e.forEach(k=>{if(this.isValidLookup(u))return;const P=this.extractFromKey(k,s),O=P.key;h=O;let F=P.namespaces;this.options.fallbackNS&&(F=F.concat(this.options.fallbackNS));const V=s.count!==void 0&&!Pn(s.count),$=V&&!s.ordinal&&s.count===0,Y=s.context!==void 0&&(Pn(s.context)||typeof s.context=="number")&&s.context!=="",Z=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);F.forEach(se=>{var te,ee;this.isValidLookup(u)||(o=se,!UO[`${Z[0]}-${se}`]&&((te=this.utils)!=null&&te.hasLoadedNamespace)&&!((ee=this.utils)!=null&&ee.hasLoadedNamespace(o))&&(UO[`${Z[0]}-${se}`]=!0,this.logger.warn(`key "${h}" for languages "${Z.join(", ")}" won't get resolved as namespace "${o}" 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!!!")),Z.forEach(oe=>{var Be;if(this.isValidLookup(u))return;w=oe;const he=[O];if((Be=this.i18nFormat)!=null&&Be.addLookupKeys)this.i18nFormat.addLookupKeys(he,O,oe,se,s);else{let je;V&&(je=this.pluralResolver.getSuffix(oe,s.count,s));const Je=`${this.options.pluralSeparator}zero`,ft=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(V&&(s.ordinal&&je.indexOf(ft)===0&&he.push(O+je.replace(ft,this.options.pluralSeparator)),he.push(O+je),$&&he.push(O+Je)),Y){const kt=`${O}${this.options.contextSeparator||"_"}${s.context}`;he.push(kt),V&&(s.ordinal&&je.indexOf(ft)===0&&he.push(kt+je.replace(ft,this.options.pluralSeparator)),he.push(kt+je),$&&he.push(kt+Je))}}let Ie;for(;Ie=he.pop();)this.isValidLookup(u)||(_=Ie,u=this.getResource(oe,se,Ie,s))}))})}),{res:u,usedKey:h,exactUsedKey:_,usedLng:w,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,s,u,h={}){var _;return(_=this.i18nFormat)!=null&&_.getResource?this.i18nFormat.getResource(e,s,u,h):this.resourceStore.getResource(e,s,u,h)}getUsedParamsDetails(e={}){const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],u=e.replace&&!Pn(e.replace);let h=u?e.replace:e;if(u&&typeof e.count<"u"&&(h.count=e.count),this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),!u){h={...h};for(const _ of s)delete h[_]}return h}static hasDefaultValue(e){const s="defaultValue";for(const u in e)if(Object.prototype.hasOwnProperty.call(e,u)&&s===u.substring(0,s.length)&&e[u]!==void 0)return!0;return!1}}class $O{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gc.create("languageUtils")}getScriptPartFromCode(e){if(e=d0(e),!e||e.indexOf("-")<0)return null;const s=e.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(e){if(e=d0(e),!e||e.indexOf("-")<0)return e;const s=e.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(e){if(Pn(e)&&e.indexOf("-")>-1){let s;try{s=Intl.getCanonicalLocales(e)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let s;return e.forEach(u=>{if(s)return;const h=this.formatLanguageCode(u);(!this.options.supportedLngs||this.isSupportedCode(h))&&(s=h)}),!s&&this.options.supportedLngs&&e.forEach(u=>{if(s)return;const h=this.getScriptPartFromCode(u);if(this.isSupportedCode(h))return s=h;const _=this.getLanguagePartFromCode(u);if(this.isSupportedCode(_))return s=_;s=this.options.supportedLngs.find(w=>{if(w===_)return w;if(!(w.indexOf("-")<0&&_.indexOf("-")<0)&&(w.indexOf("-")>0&&_.indexOf("-")<0&&w.substring(0,w.indexOf("-"))===_||w.indexOf(_)===0&&_.length>1))return w})}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(e,s){if(!e)return[];if(typeof e=="function"&&(e=e(s)),Pn(e)&&(e=[e]),Array.isArray(e))return e;if(!s)return e.default||[];let u=e[s];return u||(u=e[this.getScriptPartFromCode(s)]),u||(u=e[this.formatLanguageCode(s)]),u||(u=e[this.getLanguagePartFromCode(s)]),u||(u=e.default),u||[]}toResolveHierarchy(e,s){const u=this.getFallbackCodes((s===!1?[]:s)||this.options.fallbackLng||[],e),h=[],_=w=>{w&&(this.isSupportedCode(w)?h.push(w):this.logger.warn(`rejecting language code not found in supportedLngs: ${w}`))};return Pn(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&_(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&_(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&_(this.getLanguagePartFromCode(e))):Pn(e)&&_(this.formatLanguageCode(e)),u.forEach(w=>{h.indexOf(w)<0&&_(this.formatLanguageCode(w))}),h}}const GO={zero:0,one:1,two:2,few:3,many:4,other:5},HO={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class iY{constructor(e,s={}){this.languageUtils=e,this.options=s,this.logger=Gc.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,s={}){const u=d0(e==="dev"?"en":e),h=s.ordinal?"ordinal":"cardinal",_=JSON.stringify({cleanedCode:u,type:h});if(_ in this.pluralRulesCache)return this.pluralRulesCache[_];let w;try{w=new Intl.PluralRules(u,{type:h})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),HO;if(!e.match(/-|_/))return HO;const k=this.languageUtils.getLanguagePartFromCode(e);w=this.getRule(k,s)}return this.pluralRulesCache[_]=w,w}needsPlural(e,s={}){let u=this.getRule(e,s);return u||(u=this.getRule("dev",s)),(u==null?void 0:u.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,s,u={}){return this.getSuffixes(e,u).map(h=>`${s}${h}`)}getSuffixes(e,s={}){let u=this.getRule(e,s);return u||(u=this.getRule("dev",s)),u?u.resolvedOptions().pluralCategories.sort((h,_)=>GO[h]-GO[_]).map(h=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${h}`):[]}getSuffix(e,s,u={}){const h=this.getRule(e,u);return h?`${this.options.prepend}${u.ordinal?`ordinal${this.options.prepend}`:""}${h.select(s)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",s,u))}}const WO=(t,e,s,u=".",h=!0)=>{let _=ZX(t,e,s);return!_&&h&&Pn(s)&&(_=Kk(t,s,u),_===void 0&&(_=Kk(e,s,u))),_},eE=t=>t.replace(/\$/g,"$$$$");class qO{constructor(e={}){var s;this.logger=Gc.create("interpolator"),this.options=e,this.format=((s=e==null?void 0:e.interpolation)==null?void 0:s.format)||(u=>u),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:s,escapeValue:u,useRawValueToEscape:h,prefix:_,prefixEscaped:w,suffix:o,suffixEscaped:k,formatSeparator:P,unescapeSuffix:O,unescapePrefix:F,nestingPrefix:V,nestingPrefixEscaped:$,nestingSuffix:Y,nestingSuffixEscaped:Z,nestingOptionsSeparator:se,maxReplaces:te,alwaysFormat:ee}=e.interpolation;this.escape=s!==void 0?s:YX,this.escapeValue=u!==void 0?u:!0,this.useRawValueToEscape=h!==void 0?h:!1,this.prefix=_?zm(_):w||"{{",this.suffix=o?zm(o):k||"}}",this.formatSeparator=P||",",this.unescapePrefix=O?"":F||"-",this.unescapeSuffix=this.unescapePrefix?"":O||"",this.nestingPrefix=V?zm(V):$||zm("$t("),this.nestingSuffix=Y?zm(Y):Z||zm(")"),this.nestingOptionsSeparator=se||",",this.maxReplaces=te||1e3,this.alwaysFormat=ee!==void 0?ee:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(s,u)=>(s==null?void 0:s.source)===u?(s.lastIndex=0,s):new RegExp(u,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,s,u,h){var $;let _,w,o;const k=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},P=Y=>{if(Y.indexOf(this.formatSeparator)<0){const ee=WO(s,k,Y,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ee,void 0,u,{...h,...s,interpolationkey:Y}):ee}const Z=Y.split(this.formatSeparator),se=Z.shift().trim(),te=Z.join(this.formatSeparator).trim();return this.format(WO(s,k,se,this.options.keySeparator,this.options.ignoreJSONStructure),te,u,{...h,...s,interpolationkey:se})};this.resetRegExp();const O=(h==null?void 0:h.missingInterpolationHandler)||this.options.missingInterpolationHandler,F=(($=h==null?void 0:h.interpolation)==null?void 0:$.skipOnVariables)!==void 0?h.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:Y=>eE(Y)},{regex:this.regexp,safeValue:Y=>this.escapeValue?eE(this.escape(Y)):eE(Y)}].forEach(Y=>{for(o=0;_=Y.regex.exec(e);){const Z=_[1].trim();if(w=P(Z),w===void 0)if(typeof O=="function"){const te=O(e,_,h);w=Pn(te)?te:""}else if(h&&Object.prototype.hasOwnProperty.call(h,Z))w="";else if(F){w=_[0];continue}else this.logger.warn(`missed to pass in variable ${Z} for interpolating ${e}`),w="";else!Pn(w)&&!this.useRawValueToEscape&&(w=FO(w));const se=Y.safeValue(w);if(e=e.replace(_[0],se),F?(Y.regex.lastIndex+=w.length,Y.regex.lastIndex-=_[0].length):Y.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,s,u={}){let h,_,w;const o=(k,P)=>{const O=this.nestingOptionsSeparator;if(k.indexOf(O)<0)return k;const F=k.split(new RegExp(`${O}[ ]*{`));let V=`{${F[1]}`;k=F[0],V=this.interpolate(V,w);const $=V.match(/'/g),Y=V.match(/"/g);((($==null?void 0:$.length)??0)%2===0&&!Y||Y.length%2!==0)&&(V=V.replace(/'/g,'"'));try{w=JSON.parse(V),P&&(w={...P,...w})}catch(Z){return this.logger.warn(`failed parsing options string in nesting for key ${k}`,Z),`${k}${O}${V}`}return w.defaultValue&&w.defaultValue.indexOf(this.prefix)>-1&&delete w.defaultValue,k};for(;h=this.nestingRegexp.exec(e);){let k=[];w={...u},w=w.replace&&!Pn(w.replace)?w.replace:w,w.applyPostProcessor=!1,delete w.defaultValue;const P=/{.*}/.test(h[1])?h[1].lastIndexOf("}")+1:h[1].indexOf(this.formatSeparator);if(P!==-1&&(k=h[1].slice(P).split(this.formatSeparator).map(O=>O.trim()).filter(Boolean),h[1]=h[1].slice(0,P)),_=s(o.call(this,h[1].trim(),w),w),_&&h[0]===e&&!Pn(_))return _;Pn(_)||(_=FO(_)),_||(this.logger.warn(`missed to resolve ${h[1]} for nesting ${e}`),_=""),k.length&&(_=k.reduce((O,F)=>this.format(O,F,u.lng,{...u,interpolationkey:h[1].trim()}),_.trim())),e=e.replace(h[0],_),this.regexp.lastIndex=0}return e}}const sY=t=>{let e=t.toLowerCase().trim();const s={};if(t.indexOf("(")>-1){const u=t.split("(");e=u[0].toLowerCase().trim();const h=u[1].substring(0,u[1].length-1);e==="currency"&&h.indexOf(":")<0?s.currency||(s.currency=h.trim()):e==="relativetime"&&h.indexOf(":")<0?s.range||(s.range=h.trim()):h.split(";").forEach(w=>{if(w){const[o,...k]=w.split(":"),P=k.join(":").trim().replace(/^'+|'+$/g,""),O=o.trim();s[O]||(s[O]=P),P==="false"&&(s[O]=!1),P==="true"&&(s[O]=!0),isNaN(P)||(s[O]=parseInt(P,10))}})}return{formatName:e,formatOptions:s}},KO=t=>{const e={};return(s,u,h)=>{let _=h;h&&h.interpolationkey&&h.formatParams&&h.formatParams[h.interpolationkey]&&h[h.interpolationkey]&&(_={..._,[h.interpolationkey]:void 0});const w=u+JSON.stringify(_);let o=e[w];return o||(o=t(d0(u),h),e[w]=o),o(s)}},oY=t=>(e,s,u)=>t(d0(s),u)(e);class aY{constructor(e={}){this.logger=Gc.create("formatter"),this.options=e,this.init(e)}init(e,s={interpolation:{}}){this.formatSeparator=s.interpolation.formatSeparator||",";const u=s.cacheInBuiltFormats?KO:oY;this.formats={number:u((h,_)=>{const w=new Intl.NumberFormat(h,{..._});return o=>w.format(o)}),currency:u((h,_)=>{const w=new Intl.NumberFormat(h,{..._,style:"currency"});return o=>w.format(o)}),datetime:u((h,_)=>{const w=new Intl.DateTimeFormat(h,{..._});return o=>w.format(o)}),relativetime:u((h,_)=>{const w=new Intl.RelativeTimeFormat(h,{..._});return o=>w.format(o,_.range||"day")}),list:u((h,_)=>{const w=new Intl.ListFormat(h,{..._});return o=>w.format(o)})}}add(e,s){this.formats[e.toLowerCase().trim()]=s}addCached(e,s){this.formats[e.toLowerCase().trim()]=KO(s)}format(e,s,u,h={}){const _=s.split(this.formatSeparator);if(_.length>1&&_[0].indexOf("(")>1&&_[0].indexOf(")")<0&&_.find(o=>o.indexOf(")")>-1)){const o=_.findIndex(k=>k.indexOf(")")>-1);_[0]=[_[0],..._.splice(1,o)].join(this.formatSeparator)}return _.reduce((o,k)=>{var F;const{formatName:P,formatOptions:O}=sY(k);if(this.formats[P]){let V=o;try{const $=((F=h==null?void 0:h.formatParams)==null?void 0:F[h.interpolationkey])||{},Y=$.locale||$.lng||h.locale||h.lng||u;V=this.formats[P](o,Y,{...O,...h,...$})}catch($){this.logger.warn($)}return V}else this.logger.warn(`there was no format function for ${P}`);return o},e)}}const lY=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class cY extends uS{constructor(e,s,u,h={}){var _,w;super(),this.backend=e,this.store=s,this.services=u,this.languageUtils=u.languageUtils,this.options=h,this.logger=Gc.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=h.maxParallelReads||10,this.readingCalls=0,this.maxRetries=h.maxRetries>=0?h.maxRetries:5,this.retryTimeout=h.retryTimeout>=1?h.retryTimeout:350,this.state={},this.queue=[],(w=(_=this.backend)==null?void 0:_.init)==null||w.call(_,u,h.backend,h)}queueLoad(e,s,u,h){const _={},w={},o={},k={};return e.forEach(P=>{let O=!0;s.forEach(F=>{const V=`${P}|${F}`;!u.reload&&this.store.hasResourceBundle(P,F)?this.state[V]=2:this.state[V]<0||(this.state[V]===1?w[V]===void 0&&(w[V]=!0):(this.state[V]=1,O=!1,w[V]===void 0&&(w[V]=!0),_[V]===void 0&&(_[V]=!0),k[F]===void 0&&(k[F]=!0)))}),O||(o[P]=!0)}),(Object.keys(_).length||Object.keys(w).length)&&this.queue.push({pending:w,pendingCount:Object.keys(w).length,loaded:{},errors:[],callback:h}),{toLoad:Object.keys(_),pending:Object.keys(w),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(k)}}loaded(e,s,u){const h=e.split("|"),_=h[0],w=h[1];s&&this.emit("failedLoading",_,w,s),!s&&u&&this.store.addResourceBundle(_,w,u,void 0,void 0,{skipCopy:!0}),this.state[e]=s?-1:2,s&&u&&(this.state[e]=0);const o={};this.queue.forEach(k=>{KX(k.loaded,[_],w),lY(k,e),s&&k.errors.push(s),k.pendingCount===0&&!k.done&&(Object.keys(k.loaded).forEach(P=>{o[P]||(o[P]={});const O=k.loaded[P];O.length&&O.forEach(F=>{o[P][F]===void 0&&(o[P][F]=!0)})}),k.done=!0,k.errors.length?k.callback(k.errors):k.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(k=>!k.done)}read(e,s,u,h=0,_=this.retryTimeout,w){if(!e.length)return w(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:s,fcName:u,tried:h,wait:_,callback:w});return}this.readingCalls++;const o=(P,O)=>{if(this.readingCalls--,this.waitingReads.length>0){const F=this.waitingReads.shift();this.read(F.lng,F.ns,F.fcName,F.tried,F.wait,F.callback)}if(P&&O&&h<this.maxRetries){setTimeout(()=>{this.read.call(this,e,s,u,h+1,_*2,w)},_);return}w(P,O)},k=this.backend[u].bind(this.backend);if(k.length===2){try{const P=k(e,s);P&&typeof P.then=="function"?P.then(O=>o(null,O)).catch(o):o(null,P)}catch(P){o(P)}return}return k(e,s,o)}prepareLoading(e,s,u={},h){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),h&&h();Pn(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Pn(s)&&(s=[s]);const _=this.queueLoad(e,s,u,h);if(!_.toLoad.length)return _.pending.length||h(),null;_.toLoad.forEach(w=>{this.loadOne(w)})}load(e,s,u){this.prepareLoading(e,s,{},u)}reload(e,s,u){this.prepareLoading(e,s,{reload:!0},u)}loadOne(e,s=""){const u=e.split("|"),h=u[0],_=u[1];this.read(h,_,"read",void 0,void 0,(w,o)=>{w&&this.logger.warn(`${s}loading namespace ${_} for language ${h} failed`,w),!w&&o&&this.logger.log(`${s}loaded namespace ${_} for language ${h}`,o),this.loaded(e,w,o)})}saveMissing(e,s,u,h,_,w={},o=()=>{}){var k,P,O,F,V;if((P=(k=this.services)==null?void 0:k.utils)!=null&&P.hasLoadedNamespace&&!((F=(O=this.services)==null?void 0:O.utils)!=null&&F.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${u}" 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(!(u==null||u==="")){if((V=this.backend)!=null&&V.create){const $={...w,isUpdate:_},Y=this.backend.create.bind(this.backend);if(Y.length<6)try{let Z;Y.length===5?Z=Y(e,s,u,h,$):Z=Y(e,s,u,h),Z&&typeof Z.then=="function"?Z.then(se=>o(null,se)).catch(o):o(null,Z)}catch(Z){o(Z)}else Y(e,s,u,h,o,$)}!e||!e[0]||this.store.addResource(e[0],s,u,h)}}}const tE=()=>({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:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Pn(t[1])&&(e.defaultValue=t[1]),Pn(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const s=t[3]||t[2];Object.keys(s).forEach(u=>{e[u]=s[u]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ZO=t=>{var e,s;return Pn(t.ns)&&(t.ns=[t.ns]),Pn(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Pn(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((s=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:s.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},ab=()=>{},uY=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(s=>{typeof t[s]=="function"&&(t[s]=t[s].bind(t))})};class Dv extends uS{constructor(e={},s){if(super(),this.options=ZO(e),this.services={},this.logger=Gc,this.modules={external:[]},uY(this),s&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,s),this;setTimeout(()=>{this.init(e,s)},0)}}init(e={},s){this.isInitializing=!0,typeof e=="function"&&(s=e,e={}),e.defaultNS==null&&e.ns&&(Pn(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const u=tE();this.options={...u,...this.options,...ZO(e)},this.options.interpolation={...u.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=u.overloadTranslationOptionHandler);const h=P=>P?typeof P=="function"?new P:P:null;if(!this.options.isClone){this.modules.logger?Gc.init(h(this.modules.logger),this.options):Gc.init(null,this.options);let P;this.modules.formatter?P=this.modules.formatter:P=aY;const O=new $O(this.options);this.store=new VO(this.options.resources,this.options);const F=this.services;F.logger=Gc,F.resourceStore=this.store,F.languageUtils=O,F.pluralResolver=new iY(O,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==u.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),P&&(!this.options.interpolation.format||this.options.interpolation.format===u.interpolation.format)&&(F.formatter=h(P),F.formatter.init&&F.formatter.init(F,this.options),this.options.interpolation.format=F.formatter.format.bind(F.formatter)),F.interpolator=new qO(this.options),F.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},F.backendConnector=new cY(h(this.modules.backend),F.resourceStore,F,this.options),F.backendConnector.on("*",($,...Y)=>{this.emit($,...Y)}),this.modules.languageDetector&&(F.languageDetector=h(this.modules.languageDetector),F.languageDetector.init&&F.languageDetector.init(F,this.options.detection,this.options)),this.modules.i18nFormat&&(F.i18nFormat=h(this.modules.i18nFormat),F.i18nFormat.init&&F.i18nFormat.init(this)),this.translator=new T1(this.services,this.options),this.translator.on("*",($,...Y)=>{this.emit($,...Y)}),this.modules.external.forEach($=>{$.init&&$.init(this)})}if(this.format=this.options.interpolation.format,s||(s=ab),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const P=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);P.length>0&&P[0]!=="dev"&&(this.options.lng=P[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(P=>{this[P]=(...O)=>this.store[P](...O)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(P=>{this[P]=(...O)=>(this.store[P](...O),this)});const o=hv(),k=()=>{const P=(O,F)=>{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),o.resolve(F),s(O,F)};if(this.languages&&!this.isInitialized)return P(null,this.t.bind(this));this.changeLanguage(this.options.lng,P)};return this.options.resources||!this.options.initAsync?k():setTimeout(k,0),o}loadResources(e,s=ab){var _,w;let u=s;const h=Pn(e)?e:this.language;if(typeof e=="function"&&(u=e),!this.options.resources||this.options.partialBundledLanguages){if((h==null?void 0:h.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return u();const o=[],k=P=>{if(!P||P==="cimode")return;this.services.languageUtils.toResolveHierarchy(P).forEach(F=>{F!=="cimode"&&o.indexOf(F)<0&&o.push(F)})};h?k(h):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(O=>k(O)),(w=(_=this.options.preload)==null?void 0:_.forEach)==null||w.call(_,P=>k(P)),this.services.backendConnector.load(o,this.options.ns,P=>{!P&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),u(P)})}else u(null)}reloadResources(e,s,u){const h=hv();return typeof e=="function"&&(u=e,e=void 0),typeof s=="function"&&(u=s,s=void 0),e||(e=this.languages),s||(s=this.options.ns),u||(u=ab),this.services.backendConnector.reload(e,s,_=>{h.resolve(),u(_)}),h}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&u4.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let s=0;s<this.languages.length;s++){const u=this.languages[s];if(!(["cimode","dev"].indexOf(u)>-1)&&this.store.hasLanguageSomeTranslations(u)){this.resolvedLanguage=u;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,s){this.isLanguageChangingTo=e;const u=hv();this.emit("languageChanging",e);const h=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},_=(o,k)=>{k?this.isLanguageChangingTo===e&&(h(k),this.translator.changeLanguage(k),this.isLanguageChangingTo=void 0,this.emit("languageChanged",k),this.logger.log("languageChanged",k)):this.isLanguageChangingTo=void 0,u.resolve((...P)=>this.t(...P)),s&&s(o,(...P)=>this.t(...P))},w=o=>{var O,F;!e&&!o&&this.services.languageDetector&&(o=[]);const k=Pn(o)?o:o&&o[0],P=this.store.hasLanguageSomeTranslations(k)?k:this.services.languageUtils.getBestMatchFromCodes(Pn(o)?[o]:o);P&&(this.language||h(P),this.translator.language||this.translator.changeLanguage(P),(F=(O=this.services.languageDetector)==null?void 0:O.cacheUserLanguage)==null||F.call(O,P)),this.loadResources(P,V=>{_(V,P)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?w(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(w):this.services.languageDetector.detect(w):w(e),u}getFixedT(e,s,u){const h=(_,w,...o)=>{let k;typeof w!="object"?k=this.options.overloadTranslationOptionHandler([_,w].concat(o)):k={...w},k.lng=k.lng||h.lng,k.lngs=k.lngs||h.lngs,k.ns=k.ns||h.ns,k.keyPrefix!==""&&(k.keyPrefix=k.keyPrefix||u||h.keyPrefix);const P=this.options.keySeparator||".";let O;return k.keyPrefix&&Array.isArray(_)?O=_.map(F=>(typeof F=="function"&&(F=Zk(F,{...this.options,...w})),`${k.keyPrefix}${P}${F}`)):(typeof _=="function"&&(_=Zk(_,{...this.options,...w})),O=k.keyPrefix?`${k.keyPrefix}${P}${_}`:_),this.t(O,k)};return Pn(e)?h.lng=e:h.lngs=e,h.ns=s,h.keyPrefix=u,h}t(...e){var s;return(s=this.translator)==null?void 0:s.translate(...e)}exists(...e){var s;return(s=this.translator)==null?void 0:s.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,s={}){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 u=s.lng||this.resolvedLanguage||this.languages[0],h=this.options?this.options.fallbackLng:!1,_=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;const w=(o,k)=>{const P=this.services.backendConnector.state[`${o}|${k}`];return P===-1||P===0||P===2};if(s.precheck){const o=s.precheck(this,w);if(o!==void 0)return o}return!!(this.hasResourceBundle(u,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||w(u,e)&&(!h||w(_,e)))}loadNamespaces(e,s){const u=hv();return this.options.ns?(Pn(e)&&(e=[e]),e.forEach(h=>{this.options.ns.indexOf(h)<0&&this.options.ns.push(h)}),this.loadResources(h=>{u.resolve(),s&&s(h)}),u):(s&&s(),Promise.resolve())}loadLanguages(e,s){const u=hv();Pn(e)&&(e=[e]);const h=this.options.preload||[],_=e.filter(w=>h.indexOf(w)<0&&this.services.languageUtils.isSupportedCode(w));return _.length?(this.options.preload=h.concat(_),this.loadResources(w=>{u.resolve(),s&&s(w)}),u):(s&&s(),Promise.resolve())}dir(e){var h,_;if(e||(e=this.resolvedLanguage||(((h=this.languages)==null?void 0:h.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const w=new Intl.Locale(e);if(w&&w.getTextInfo){const o=w.getTextInfo();if(o&&o.direction)return o.direction}}catch{}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"],u=((_=this.services)==null?void 0:_.languageUtils)||new $O(tE());return e.toLowerCase().indexOf("-latn")>1?"ltr":s.indexOf(u.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},s){const u=new Dv(e,s);return u.createInstance=Dv.createInstance,u}cloneInstance(e={},s=ab){const u=e.forkResourceStore;u&&delete e.forkResourceStore;const h={...this.options,...e,isClone:!0},_=new Dv(h);if((e.debug!==void 0||e.prefix!==void 0)&&(_.logger=_.logger.clone(e)),["store","services","language"].forEach(o=>{_[o]=this[o]}),_.services={...this.services},_.services.utils={hasLoadedNamespace:_.hasLoadedNamespace.bind(_)},u){const o=Object.keys(this.store.data).reduce((k,P)=>(k[P]={...this.store.data[P]},k[P]=Object.keys(k[P]).reduce((O,F)=>(O[F]={...k[P][F]},O),k[P]),k),{});_.store=new VO(o,h),_.services.resourceStore=_.store}if(e.interpolation){const k={...tE().interpolation,...this.options.interpolation,...e.interpolation},P={...h,interpolation:k};_.services.interpolator=new qO(P)}return _.translator=new T1(_.services,h),_.translator.on("*",(o,...k)=>{_.emit(o,...k)}),_.init(h,s),_.translator.options=h,_.translator.backendConnector.services.utils={hasLoadedNamespace:_.hasLoadedNamespace.bind(_)},_}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const _o=Dv.createInstance();_o.createInstance;_o.dir;_o.init;_o.loadResources;_o.reloadResources;_o.use;_o.changeLanguage;_o.getFixedT;_o.t;_o.exists;_o.setDefaultNamespace;_o.hasLoadedNamespace;_o.loadNamespaces;_o.loadLanguages;const dY=(t,e,s,u)=>{var _,w,o,k;const h=[s,{code:e,...u||{}}];if((w=(_=t==null?void 0:t.services)==null?void 0:_.logger)!=null&&w.forward)return t.services.logger.forward(h,"warn","react-i18next::",!0);Uf(h[0])&&(h[0]=`react-i18next:: ${h[0]}`),(k=(o=t==null?void 0:t.services)==null?void 0:o.logger)!=null&&k.warn?t.services.logger.warn(...h):console!=null&&console.warn&&console.warn(...h)},XO={},h4=(t,e,s,u)=>{Uf(s)&&XO[s]||(Uf(s)&&(XO[s]=new Date),dY(t,e,s,u))},f4=(t,e)=>()=>{if(t.isInitialized)e();else{const s=()=>{setTimeout(()=>{t.off("initialized",s)},0),e()};t.on("initialized",s)}},Xk=(t,e,s)=>{t.loadNamespaces(e,f4(t,s))},YO=(t,e,s,u)=>{if(Uf(s)&&(s=[s]),t.options.preload&&t.options.preload.indexOf(e)>-1)return Xk(t,s,u);s.forEach(h=>{t.options.ns.indexOf(h)<0&&t.options.ns.push(h)}),t.loadLanguages(e,f4(t,u))},hY=(t,e,s={})=>!e.languages||!e.languages.length?(h4(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:s.lng,precheck:(u,h)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&u.services.backendConnector.backend&&u.isLanguageChangingTo&&!h(u.isLanguageChangingTo,t))return!1}}),Uf=t=>typeof t=="string",fY=t=>typeof t=="object"&&t!==null,pY=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,mY={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},gY=t=>mY[t],_Y=t=>t.replace(pY,gY);let Yk={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:_Y,transDefaultProps:void 0};const yY=(t={})=>{Yk={...Yk,...t}},vY=()=>Yk;let p4;const xY=t=>{p4=t},wY=()=>p4,bY={type:"3rdParty",init(t){yY(t.options.react),xY(t)}},SY=X.createContext();class TY{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var m4={exports:{}},g4={};/**
|
||
* @license React
|
||
* use-sync-external-store-shim.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var $g=X;function EY(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kY=typeof Object.is=="function"?Object.is:EY,AY=$g.useState,CY=$g.useEffect,IY=$g.useLayoutEffect,PY=$g.useDebugValue;function MY(t,e){var s=e(),u=AY({inst:{value:s,getSnapshot:e}}),h=u[0].inst,_=u[1];return IY(function(){h.value=s,h.getSnapshot=e,rE(h)&&_({inst:h})},[t,s,e]),CY(function(){return rE(h)&&_({inst:h}),t(function(){rE(h)&&_({inst:h})})},[t]),PY(s),s}function rE(t){var e=t.getSnapshot;t=t.value;try{var s=e();return!kY(t,s)}catch{return!0}}function RY(t,e){return e()}var DY=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?RY:MY;g4.useSyncExternalStore=$g.useSyncExternalStore!==void 0?$g.useSyncExternalStore:DY;m4.exports=g4;var LY=m4.exports;const OY=(t,e)=>Uf(e)?e:fY(e)&&Uf(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,zY={t:OY,ready:!1},FY=()=>()=>{},Kf=(t,e={})=>{var ft,kt,tr;const{i18n:s}=e,{i18n:u,defaultNS:h}=X.useContext(SY)||{},_=s||u||wY();_&&!_.reportNamespaces&&(_.reportNamespaces=new TY),_||h4(_,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const w=X.useMemo(()=>{var jt;return{...vY(),...(jt=_==null?void 0:_.options)==null?void 0:jt.react,...e}},[_,e]),{useSuspense:o,keyPrefix:k}=w,P=h||((ft=_==null?void 0:_.options)==null?void 0:ft.defaultNS),O=Uf(P)?[P]:P||["translation"],F=X.useMemo(()=>O,O);(tr=(kt=_==null?void 0:_.reportNamespaces)==null?void 0:kt.addUsedNamespaces)==null||tr.call(kt,F);const V=X.useRef(0),$=X.useCallback(jt=>{if(!_)return FY;const{bindI18n:Qe,bindI18nStore:xt}=w,It=()=>{V.current+=1,jt()};return Qe&&_.on(Qe,It),xt&&_.store.on(xt,It),()=>{Qe&&Qe.split(" ").forEach(Ot=>_.off(Ot,It)),xt&&xt.split(" ").forEach(Ot=>_.store.off(Ot,It))}},[_,w]),Y=X.useRef(),Z=X.useCallback(()=>{if(!_)return zY;const jt=!!(_.isInitialized||_.initializedStoreOnce)&&F.every(st=>hY(st,_,w)),Qe=e.lng||_.language,xt=V.current,It=Y.current;if(It&&It.ready===jt&&It.lng===Qe&&It.keyPrefix===k&&It.revision===xt)return It;const Et={t:_.getFixedT(Qe,w.nsMode==="fallback"?F:F[0],k),ready:jt,lng:Qe,keyPrefix:k,revision:xt};return Y.current=Et,Et},[_,F,k,w,e.lng]),[se,te]=X.useState(0),{t:ee,ready:oe}=LY.useSyncExternalStore($,Z,Z);X.useEffect(()=>{if(_&&!oe&&!o){const jt=()=>te(Qe=>Qe+1);e.lng?YO(_,e.lng,F,jt):Xk(_,F,jt)}},[_,e.lng,F,oe,o,se]);const he=_||{},Ie=X.useRef(null),Be=X.useRef(),je=jt=>{const Qe=Object.getOwnPropertyDescriptors(jt);Qe.__original&&delete Qe.__original;const xt=Object.create(Object.getPrototypeOf(jt),Qe);if(!Object.prototype.hasOwnProperty.call(xt,"__original"))try{Object.defineProperty(xt,"__original",{value:jt,writable:!1,enumerable:!1,configurable:!1})}catch{}return xt},Je=X.useMemo(()=>{const jt=he,Qe=jt==null?void 0:jt.language;let xt=jt;jt&&(Ie.current&&Ie.current.__original===jt?Be.current!==Qe?(xt=je(jt),Ie.current=xt,Be.current=Qe):xt=Ie.current:(xt=je(jt),Ie.current=xt,Be.current=Qe));const It=[ee,xt,oe];return It.t=ee,It.i18n=xt,It.ready=oe,It},[ee,he,oe,he.resolvedLanguage,he.language,he.languages]);if(_&&o&&!oe)throw new Promise(jt=>{const Qe=()=>jt();e.lng?YO(_,e.lng,F,Qe):Xk(_,F,Qe)});return Je};var _4={exports:{}};(function(t,e){(function(s,u){t.exports=u()})(cG,function(){var s,u,h;function _(o,k){if(!s)s=k;else if(!u)u=k;else{var P="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+")(sharedChunk); ("+u+")(sharedChunk); self.onerror = null;",O={};s(O),h=k(O),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(h.workerUrl=window.URL.createObjectURL(new Blob([P],{type:"text/javascript"})))}}_(["exports"],function(o){var k=1e-6,P=typeof Float32Array<"u"?Float32Array:Array;function O(a,r){var i=r[0],c=r[1],d=r[2],m=r[3],g=i*m-d*c;return g?(a[0]=m*(g=1/g),a[1]=-c*g,a[2]=-d*g,a[3]=i*g,a):null}function F(){var a=new P(9);return P!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function V(a,r){var i=r[0],c=r[1],d=r[2],m=r[3],g=r[4],v=r[5],S=r[6],E=r[7],C=r[8];return a[0]=g*C-v*E,a[1]=d*E-c*C,a[2]=c*v-d*g,a[3]=v*S-m*C,a[4]=i*C-d*S,a[5]=d*m-i*v,a[6]=m*E-g*S,a[7]=c*S-i*E,a[8]=i*g-c*m,a}function $(a,r,i){var c=r[0],d=r[1],m=r[2],g=r[3],v=r[4],S=r[5],E=r[6],C=r[7],I=r[8],R=i[0],L=i[1],z=i[2],U=i[3],q=i[4],W=i[5],re=i[6],ie=i[7],ue=i[8];return a[0]=R*c+L*g+z*E,a[1]=R*d+L*v+z*C,a[2]=R*m+L*S+z*I,a[3]=U*c+q*g+W*E,a[4]=U*d+q*v+W*C,a[5]=U*m+q*S+W*I,a[6]=re*c+ie*g+ue*E,a[7]=re*d+ie*v+ue*C,a[8]=re*m+ie*S+ue*I,a}function Y(){var a=new P(16);return P!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a}function Z(a){var r=new P(16);return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],r[9]=a[9],r[10]=a[10],r[11]=a[11],r[12]=a[12],r[13]=a[13],r[14]=a[14],r[15]=a[15],r}function se(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function te(a,r){var i=r[0],c=r[1],d=r[2],m=r[3],g=r[4],v=r[5],S=r[6],E=r[7],C=r[8],I=r[9],R=r[10],L=r[11],z=r[12],U=r[13],q=r[14],W=r[15],re=i*v-c*g,ie=i*S-d*g,ue=i*E-m*g,ve=c*S-d*v,me=c*E-m*v,be=d*E-m*S,ke=C*U-I*z,Pe=C*q-R*z,We=C*W-L*z,Le=I*q-R*U,Xe=I*W-L*U,rt=R*W-L*q,nt=re*rt-ie*Xe+ue*Le+ve*We-me*Pe+be*ke;return nt?(a[0]=(v*rt-S*Xe+E*Le)*(nt=1/nt),a[1]=(d*Xe-c*rt-m*Le)*nt,a[2]=(U*be-q*me+W*ve)*nt,a[3]=(R*me-I*be-L*ve)*nt,a[4]=(S*We-g*rt-E*Pe)*nt,a[5]=(i*rt-d*We+m*Pe)*nt,a[6]=(q*ue-z*be-W*ie)*nt,a[7]=(C*be-R*ue+L*ie)*nt,a[8]=(g*Xe-v*We+E*ke)*nt,a[9]=(c*We-i*Xe-m*ke)*nt,a[10]=(z*me-U*ue+W*re)*nt,a[11]=(I*ue-C*me-L*re)*nt,a[12]=(v*Pe-g*Le-S*ke)*nt,a[13]=(i*Le-c*Pe+d*ke)*nt,a[14]=(U*ie-z*ve-q*re)*nt,a[15]=(C*ve-I*ie+R*re)*nt,a):null}function ee(a,r,i){var c=r[0],d=r[1],m=r[2],g=r[3],v=r[4],S=r[5],E=r[6],C=r[7],I=r[8],R=r[9],L=r[10],z=r[11],U=r[12],q=r[13],W=r[14],re=r[15],ie=i[0],ue=i[1],ve=i[2],me=i[3];return a[0]=ie*c+ue*v+ve*I+me*U,a[1]=ie*d+ue*S+ve*R+me*q,a[2]=ie*m+ue*E+ve*L+me*W,a[3]=ie*g+ue*C+ve*z+me*re,a[4]=(ie=i[4])*c+(ue=i[5])*v+(ve=i[6])*I+(me=i[7])*U,a[5]=ie*d+ue*S+ve*R+me*q,a[6]=ie*m+ue*E+ve*L+me*W,a[7]=ie*g+ue*C+ve*z+me*re,a[8]=(ie=i[8])*c+(ue=i[9])*v+(ve=i[10])*I+(me=i[11])*U,a[9]=ie*d+ue*S+ve*R+me*q,a[10]=ie*m+ue*E+ve*L+me*W,a[11]=ie*g+ue*C+ve*z+me*re,a[12]=(ie=i[12])*c+(ue=i[13])*v+(ve=i[14])*I+(me=i[15])*U,a[13]=ie*d+ue*S+ve*R+me*q,a[14]=ie*m+ue*E+ve*L+me*W,a[15]=ie*g+ue*C+ve*z+me*re,a}function oe(a,r,i){var c,d,m,g,v,S,E,C,I,R,L,z,U=i[0],q=i[1],W=i[2];return r===a?(a[12]=r[0]*U+r[4]*q+r[8]*W+r[12],a[13]=r[1]*U+r[5]*q+r[9]*W+r[13],a[14]=r[2]*U+r[6]*q+r[10]*W+r[14],a[15]=r[3]*U+r[7]*q+r[11]*W+r[15]):(d=r[1],m=r[2],g=r[3],v=r[4],S=r[5],E=r[6],C=r[7],I=r[8],R=r[9],L=r[10],z=r[11],a[0]=c=r[0],a[1]=d,a[2]=m,a[3]=g,a[4]=v,a[5]=S,a[6]=E,a[7]=C,a[8]=I,a[9]=R,a[10]=L,a[11]=z,a[12]=c*U+v*q+I*W+r[12],a[13]=d*U+S*q+R*W+r[13],a[14]=m*U+E*q+L*W+r[14],a[15]=g*U+C*q+z*W+r[15]),a}function he(a,r,i){var c=i[0],d=i[1],m=i[2];return a[0]=r[0]*c,a[1]=r[1]*c,a[2]=r[2]*c,a[3]=r[3]*c,a[4]=r[4]*d,a[5]=r[5]*d,a[6]=r[6]*d,a[7]=r[7]*d,a[8]=r[8]*m,a[9]=r[9]*m,a[10]=r[10]*m,a[11]=r[11]*m,a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15],a}function Ie(a,r,i){var c=Math.sin(i),d=Math.cos(i),m=r[4],g=r[5],v=r[6],S=r[7],E=r[8],C=r[9],I=r[10],R=r[11];return r!==a&&(a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=r[3],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[4]=m*d+E*c,a[5]=g*d+C*c,a[6]=v*d+I*c,a[7]=S*d+R*c,a[8]=E*d-m*c,a[9]=C*d-g*c,a[10]=I*d-v*c,a[11]=R*d-S*c,a}function Be(a,r,i){var c=Math.sin(i),d=Math.cos(i),m=r[0],g=r[1],v=r[2],S=r[3],E=r[8],C=r[9],I=r[10],R=r[11];return r!==a&&(a[4]=r[4],a[5]=r[5],a[6]=r[6],a[7]=r[7],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[0]=m*d-E*c,a[1]=g*d-C*c,a[2]=v*d-I*c,a[3]=S*d-R*c,a[8]=m*c+E*d,a[9]=g*c+C*d,a[10]=v*c+I*d,a[11]=S*c+R*d,a}function je(a,r,i){var c=Math.sin(i),d=Math.cos(i),m=r[0],g=r[1],v=r[2],S=r[3],E=r[4],C=r[5],I=r[6],R=r[7];return r!==a&&(a[8]=r[8],a[9]=r[9],a[10]=r[10],a[11]=r[11],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[0]=m*d+E*c,a[1]=g*d+C*c,a[2]=v*d+I*c,a[3]=S*d+R*c,a[4]=E*d-m*c,a[5]=C*d-g*c,a[6]=I*d-v*c,a[7]=R*d-S*c,a}function Je(a,r){return a[0]=r[0],a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=r[1],a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=r[2],a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function ft(a,r,i){var c,d,m,g=i[0],v=i[1],S=i[2],E=Math.sqrt(g*g+v*v+S*S);return E<k?null:(g*=E=1/E,v*=E,S*=E,c=Math.sin(r),d=Math.cos(r),a[0]=g*g*(m=1-d)+d,a[1]=v*g*m+S*c,a[2]=S*g*m-v*c,a[3]=0,a[4]=g*v*m-S*c,a[5]=v*v*m+d,a[6]=S*v*m+g*c,a[7]=0,a[8]=g*S*m+v*c,a[9]=v*S*m-g*c,a[10]=S*S*m+d,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a)}function kt(a,r){var i=r[0],c=r[1],d=r[2],m=r[4],g=r[5],v=r[6],S=r[8],E=r[9],C=r[10];return a[0]=Math.sqrt(i*i+c*c+d*d),a[1]=Math.sqrt(m*m+g*g+v*v),a[2]=Math.sqrt(S*S+E*E+C*C),a}function tr(a,r){var i=r[0],c=r[1],d=r[2],m=r[3],g=i+i,v=c+c,S=d+d,E=i*g,C=c*g,I=c*v,R=d*g,L=d*v,z=d*S,U=m*g,q=m*v,W=m*S;return a[0]=1-I-z,a[1]=C+W,a[2]=R-q,a[3]=0,a[4]=C-W,a[5]=1-E-z,a[6]=L+U,a[7]=0,a[8]=R+q,a[9]=L-U,a[10]=1-E-I,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}var jt=ee;function Qe(){var a=new P(3);return P!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function xt(a){var r=new P(3);return r[0]=a[0],r[1]=a[1],r[2]=a[2],r}function It(a){var r=a[0],i=a[1],c=a[2];return Math.sqrt(r*r+i*i+c*c)}function Ot(a,r,i){var c=new P(3);return c[0]=a,c[1]=r,c[2]=i,c}function Et(a,r,i,c){return a[0]=r,a[1]=i,a[2]=c,a}function st(a,r,i){return a[0]=r[0]+i[0],a[1]=r[1]+i[1],a[2]=r[2]+i[2],a}function Pt(a,r,i){return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],a}function qt(a,r,i){return a[0]=r[0]*i[0],a[1]=r[1]*i[1],a[2]=r[2]*i[2],a}function _r(a,r,i){return a[0]=Math.min(r[0],i[0]),a[1]=Math.min(r[1],i[1]),a[2]=Math.min(r[2],i[2]),a}function yr(a,r,i){return a[0]=Math.max(r[0],i[0]),a[1]=Math.max(r[1],i[1]),a[2]=Math.max(r[2],i[2]),a}function hr(a,r,i){return a[0]=r[0]*i,a[1]=r[1]*i,a[2]=r[2]*i,a}function Gr(a,r,i,c){return a[0]=r[0]+i[0]*c,a[1]=r[1]+i[1]*c,a[2]=r[2]+i[2]*c,a}function mi(a,r){var i=r[0]-a[0],c=r[1]-a[1],d=r[2]-a[2];return Math.sqrt(i*i+c*c+d*d)}function Oi(a,r){var i=r[0]-a[0],c=r[1]-a[1],d=r[2]-a[2];return i*i+c*c+d*d}function xn(a){var r=a[0],i=a[1],c=a[2];return r*r+i*i+c*c}function zs(a,r){return a[0]=-r[0],a[1]=-r[1],a[2]=-r[2],a}function un(a,r){var i=r[0],c=r[1],d=r[2],m=i*i+c*c+d*d;return m>0&&(m=1/Math.sqrt(m)),a[0]=r[0]*m,a[1]=r[1]*m,a[2]=r[2]*m,a}function Nn(a,r){return a[0]*r[0]+a[1]*r[1]+a[2]*r[2]}function gi(a,r,i){var c=r[0],d=r[1],m=r[2],g=i[0],v=i[1],S=i[2];return a[0]=d*S-m*v,a[1]=m*g-c*S,a[2]=c*v-d*g,a}function Ks(a,r,i,c){var d=r[0],m=r[1],g=r[2];return a[0]=d+c*(i[0]-d),a[1]=m+c*(i[1]-m),a[2]=g+c*(i[2]-g),a}function Un(a,r,i){var c=r[0],d=r[1],m=r[2],g=i[3]*c+i[7]*d+i[11]*m+i[15];return a[0]=(i[0]*c+i[4]*d+i[8]*m+i[12])/(g=g||1),a[1]=(i[1]*c+i[5]*d+i[9]*m+i[13])/g,a[2]=(i[2]*c+i[6]*d+i[10]*m+i[14])/g,a}function io(a,r,i){var c=r[0],d=r[1],m=r[2];return a[0]=c*i[0]+d*i[3]+m*i[6],a[1]=c*i[1]+d*i[4]+m*i[7],a[2]=c*i[2]+d*i[5]+m*i[8],a}function so(a,r,i){var c=i[0],d=i[1],m=i[2],g=i[3],v=r[0],S=r[1],E=r[2],C=d*E-m*S,I=m*v-c*E,R=c*S-d*v;return a[0]=v+g*(C+=C)+d*(R+=R)-m*(I+=I),a[1]=S+g*I+m*C-c*R,a[2]=E+g*R+c*I-d*C,a}function Ki(a){return a[0]=0,a[1]=0,a[2]=0,a}function Zi(a,r){return a[0]===r[0]&&a[1]===r[1]&&a[2]===r[2]}var Zn=Pt,Is=qt,ua=It;function Ai(){var a=new P(4);return P!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0),a}function us(a,r,i){return a[0]=r[0]*i,a[1]=r[1]*i,a[2]=r[2]*i,a[3]=r[3]*i,a}function Fs(a,r){var i=r[0],c=r[1],d=r[2],m=r[3],g=i*i+c*c+d*d+m*m;return g>0&&(g=1/Math.sqrt(g)),a[0]=i*g,a[1]=c*g,a[2]=d*g,a[3]=m*g,a}function rs(a,r,i){var c=r[0],d=r[1],m=r[2],g=r[3];return a[0]=i[0]*c+i[4]*d+i[8]*m+i[12]*g,a[1]=i[1]*c+i[5]*d+i[9]*m+i[13]*g,a[2]=i[2]*c+i[6]*d+i[10]*m+i[14]*g,a[3]=i[3]*c+i[7]*d+i[11]*m+i[15]*g,a}function Ho(){var a=new P(4);return P!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function ds(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a}function bs(a,r,i){i*=.5;var c=r[0],d=r[1],m=r[2],g=r[3],v=Math.sin(i),S=Math.cos(i);return a[0]=c*S+g*v,a[1]=d*S+m*v,a[2]=m*S-d*v,a[3]=g*S-c*v,a}function Wo(a,r,i){i*=.5;var c=r[0],d=r[1],m=r[2],g=r[3],v=Math.sin(i),S=Math.cos(i);return a[0]=c*S-m*v,a[1]=d*S+g*v,a[2]=m*S+c*v,a[3]=g*S-d*v,a}Qe(),Ai();var At,sr,Lr,Zr=Fs,tn=(At=Qe(),sr=Ot(1,0,0),Lr=Ot(0,1,0),function(a,r,i){var c=Nn(r,i);return c<-.999999?(gi(At,sr,r),ua(At)<1e-6&&gi(At,Lr,r),un(At,At),function(d,m,g){g*=.5;var v=Math.sin(g);d[0]=v*m[0],d[1]=v*m[1],d[2]=v*m[2],d[3]=Math.cos(g)}(a,At,Math.PI),a):c>.999999?(a[0]=0,a[1]=0,a[2]=0,a[3]=1,a):(gi(At,r,i),a[0]=At[0],a[1]=At[1],a[2]=At[2],a[3]=1+c,Zr(a,a))});function Wr(){var a=new P(2);return P!=Float32Array&&(a[0]=0,a[1]=0),a}function On(a,r){var i=new P(2);return i[0]=a,i[1]=r,i}function Zs(a,r,i){return a[0]=r,a[1]=i,a}function qo(a,r,i){return a[0]=r[0]+i[0],a[1]=r[1]+i[1],a}function yo(a,r,i){return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a}function Do(a,r,i){return a[0]=r[0]*i,a[1]=r[1]*i,a}function oo(a){var r=a[0],i=a[1];return Math.sqrt(r*r+i*i)}function vo(a,r){var i=r[0],c=r[1],d=i*i+c*c;return d>0&&(d=1/Math.sqrt(d)),a[0]=r[0]*d,a[1]=r[1]*d,a}function Lo(a,r){return a[0]*r[0]+a[1]*r[1]}Ho(),Ho(),F();var En,zi,on=yo;function Wn(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}Wr();var qn=function(){if(zi)return En;function a(r,i,c,d){this.cx=3*r,this.bx=3*(c-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(d-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=i,this.p2x=c,this.p2y=d}return zi=1,En=a,a.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,i){if(i===void 0&&(i=1e-6),r<0)return 0;if(r>1)return 1;for(var c=r,d=0;d<8;d++){var m=this.sampleCurveX(c)-r;if(Math.abs(m)<i)return c;var g=this.sampleCurveDerivativeX(c);if(Math.abs(g)<1e-6)break;c-=m/g}var v=0,S=1;for(c=r,d=0;d<20&&(m=this.sampleCurveX(c),!(Math.abs(m-r)<i));d++)r>m?v=c:S=c,c=.5*(S-v)+v;return c},solve:function(r,i){return this.sampleCurveY(this.solveCurveX(r,i))}},En}(),Bs=Wn(qn);function it(a,r){this.x=a,this.y=r}function hs(a,r){if(Array.isArray(a)){if(!Array.isArray(r)||a.length!==r.length)return!1;for(let i=0;i<a.length;i++)if(!hs(a[i],r[i]))return!1;return!0}if(typeof a=="object"&&a!==null&&r!==null){if(typeof r!="object"||Object.keys(a).length!==Object.keys(r).length)return!1;for(const i in a)if(!hs(a[i],r[i]))return!1;return!0}return a===r}it.prototype={clone(){return new it(this.x,this.y)},add(a){return this.clone()._add(a)},sub(a){return this.clone()._sub(a)},multByPoint(a){return this.clone()._multByPoint(a)},divByPoint(a){return this.clone()._divByPoint(a)},mult(a){return this.clone()._mult(a)},div(a){return this.clone()._div(a)},rotate(a){return this.clone()._rotate(a)},rotateAround(a,r){return this.clone()._rotateAround(a,r)},matMult(a){return this.clone()._matMult(a)},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(a){return this.x===a.x&&this.y===a.y},dist(a){return Math.sqrt(this.distSqr(a))},distSqr(a){const r=a.x-this.x,i=a.y-this.y;return r*r+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith(a){return this.angleWithSep(a.x,a.y)},angleWithSep(a,r){return Math.atan2(this.x*r-this.y*a,this.x*a+this.y*r)},_matMult(a){const r=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=r,this},_add(a){return this.x+=a.x,this.y+=a.y,this},_sub(a){return this.x-=a.x,this.y-=a.y,this},_mult(a){return this.x*=a,this.y*=a,this},_div(a){return this.x/=a,this.y/=a,this},_multByPoint(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint(a){return this.x/=a.x,this.y/=a.y,this},_unit(){return this._div(this.mag()),this},_perp(){const a=this.y;return this.y=this.x,this.x=-a,this},_rotate(a){const r=Math.cos(a),i=Math.sin(a),c=i*this.x+r*this.y;return this.x=r*this.x-i*this.y,this.y=c,this},_rotateAround(a,r){const i=Math.cos(a),c=Math.sin(a),d=r.y+c*(this.x-r.x)+i*(this.y-r.y);return this.x=r.x+i*(this.x-r.x)-c*(this.y-r.y),this.y=d,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:it},it.convert=function(a){if(a instanceof it)return a;if(Array.isArray(a))return new it(+a[0],+a[1]);if(a.x!==void 0&&a.y!==void 0)return new it(+a.x,+a.y);throw new Error("Expected [x, y] or {x, y} point format")};const Xs=Math.PI/180,fs=180/Math.PI;function zr(a){return a*Xs}function Fr(a){return a*fs}const Bi=[[0,0],[1,0],[1,1],[0,1]];function Pi(a){if(a<=0)return 0;if(a>=1)return 1;const r=a*a,i=r*a;return 4*(a<.5?i:3*(a-r)+i-.75)}function Ss(a,r,i,c){const d=new Bs(a,r,i,c);return function(m){return d.solve(m)}}const Fe=Ss(.25,.1,.25,1);function K(a,r,i){return Math.min(i,Math.max(r,a))}function ne(a,r,i){return(i=K((i-a)/(r-a),0,1))*i*(3-2*i)}function fe(a,r,i){const c=i-r,d=((a-r)%c+c)%c+r;return d===r?i:d}function Ae(a,r,i){if(!a.length)return i(null,[]);let c=a.length;const d=new Array(a.length);let m=null;a.forEach((g,v)=>{r(g,(S,E)=>{S&&(m=S),d[v]=E,--c==0&&i(m,d)})})}let Ee=1;function Re(){return Ee++}function $e(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log2(a)))}function Oe(a,r){a.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function Ue(a,r,i){const c={};for(const d in a)c[d]=r.call(this,a[d],d,a);return c}function pt(a,r,i){const c={};for(const d in a)r.call(this,a[d],d,a)&&(c[d]=a[d]);return c}function tt(a){return Array.isArray(a)?a.map(tt):typeof a=="object"&&a?Ue(a,tt):a}function Vt(a,r){for(let i=0;i<a.length;i++)if(r.indexOf(a[i])>=0)return!0;return!1}const rr={};function Ft(a){rr[a]||(typeof console<"u"&&console.warn(a),rr[a]=!0)}function kr(a,r,i){return(i.y-a.y)*(r.x-a.x)>(r.y-a.y)*(i.x-a.x)}function Tr(a){let r=0;for(let i,c,d=0,m=a.length,g=m-1;d<m;g=d++)i=a[d],c=a[g],r+=(c.x-i.x)*(i.y+c.y);return r}function br([a,r,i]){const c=zr(r+90),d=zr(i);return{x:a*Math.cos(c)*Math.sin(d),y:a*Math.sin(c)*Math.sin(d),z:a*Math.cos(d),azimuthal:r,polar:i}}function Yr(a){return(typeof self<"u"||a!==void 0)&&typeof WorkerGlobalScope<"u"&&(a!==void 0?a:self)instanceof WorkerGlobalScope}function di(a){const r={};if(a.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,c,d,m)=>{const g=d||m;return r[c]=!g||g.toLowerCase(),""}),r["max-age"]){const i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let Mi=null;function _i(a,r){return[a[4*r],a[4*r+1],a[4*r+2],a[4*r+3]]}function Fi(a,r,i,c){for(;r<i;){const d=r+i>>1;a[d]<c?r=d+1:i=d}return r}function oi(a,r,i,c){for(;r<i;){const d=r+i>>1;a[d]<=c?r=d+1:i=d}return r}function rn(a){return a>0?1/(1.001-a):1+a}function ai(a){return a>0?1-1/(1.001-a):-a}function zn(a,r,i){return(a-r.min)*(i.max-i.min)/(r.max-r.min)+i.min}const Vr={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Vr.API_URL)return null;try{const a=new URL(Vr.API_URL);return a.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":a.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function yi(a){return Vr.API_URL_REGEX.test(a)}function Ps(a){return Vr.API_SPRITE_REGEX.test(a)}let Ns,xo,Qc,ps,Ko,Ys;function Qa(){return Ns==null&&(Ns=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Ns}const ns={now:()=>ps!==void 0?ps:performance.now(),setNow(a){ps=a},restoreNow(){ps=void 0},frame(a){const r=requestAnimationFrame(a);return{cancel:()=>cancelAnimationFrame(r)}},getImageData(a,r=0){const{width:i,height:c}=a;Ko||(Ko=document.createElement("canvas"));const d=Ko.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return(i>Ko.width||c>Ko.height)&&(Ko.width=i,Ko.height=c),d.clearRect(-r,-r,i+2*r,c+2*r),d.drawImage(a,0,0,i,c),d.getImageData(-r,-r,i+2*r,c+2*r)},resolveURL:a=>(xo||(xo=document.createElement("a")),xo.href=a,xo.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Qc==null&&(Qc=window.matchMedia("(prefers-reduced-motion: reduce)")),Qc.matches)},hasCanvasFingerprintNoise(){if(Ys!==void 0)return Ys;if(!Qa())return Ys=!1,!1;const a=new OffscreenCanvas(85,1),r=a.getContext("2d",{willReadFrequently:!0});let i=0;for(let d=0;d<a.width;++d)r.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,r.fillRect(d,0,1,1);const c=r.getImageData(0,0,a.width,a.height);i=0;for(let d=0;d<c.data.length;++d)if(d%4!=3&&i++!==c.data[d])return Ys=!0,!0;return Ys=!1,!1}};function eu(a,r){const i=a.indexOf("?");if(i<0)return`${a}?${new URLSearchParams(r).toString()}`;const c=new URLSearchParams(a.slice(i));for(const d in r)c.set(d,r[d]);return`${a.slice(0,i)}?${c.toString()}`}function Wu(a,r={persistentParams:[]}){const i=a.indexOf("?");if(i<0)return a;const c=new URLSearchParams,d=new URLSearchParams(a.slice(i));for(const g of r.persistentParams){const v=d.get(g);v&&c.set(g,v)}const m=c.toString();return`${a.slice(0,i)}${m.length>0?`?${m}`:""}`}const Zf="mapbox-tiles";let Xf=500,Yf=50;const ph=["language","worldview","jobid"];let el,wo;function Pa(){try{return caches}catch{}}function Ma(){const a=Pa();a&&el==null&&(el=a.open(Zf))}let da=1/0;const tl={supported:!1,testSupport:function(a){!Jf&&tu&&(ru?N0(a):pc=a)}};let pc,tu,Jf=!1,ru=!1;const Qf=typeof self<"u"?self:{};function N0(a){const r=a.createTexture();a.bindTexture(a.TEXTURE_2D,r);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,tu),a.isContextLost())return;tl.supported=!0}catch{}a.deleteTexture(r),Jf=!0}Qf.document&&(tu=Qf.document.createElement("img"),tu.onload=function(){pc&&N0(pc),pc=null,ru=!0},tu.onerror=function(){Jf=!0,pc=null},tu.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const mh={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(mh);class Oo extends Error{constructor(r,i,c){i===401&&yi(c)&&(r+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(r),this.status=i,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const ep=Yr()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,nu=function(a,r){if(!(/^file:/.test(i=a.url)||/^file:/.test(ep())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(c,d){const m=new AbortController,g=new Request(c.url,{method:c.method||"GET",body:c.body,credentials:c.credentials,headers:c.headers,referrer:ep(),referrerPolicy:c.referrerPolicy,signal:m.signal});let v=!1,S=!1;const E=(C=g.url).indexOf("sku=")>0&&yi(C);var C;c.type==="json"&&g.headers.set("Accept","application/json");const I=(L,z,U)=>{if(S)return;if(L&&L.message!=="SecurityError"&&Ft(L.toString()),z&&U)return R(z);const q=Date.now();fetch(g).then(W=>{if(W.ok){const re=E?W.clone():null;return R(W,re,q)}return d(new Oo(W.statusText,W.status,c.url))}).catch(W=>{W.name!=="AbortError"&&d(new Error(`${W.message} ${c.url}`))})},R=(L,z,U)=>{(c.type==="arrayBuffer"?L.arrayBuffer():c.type==="json"?L.json():L.text()).then(q=>{S||(z&&U&&function(W,re,ie){if(Ma(),el==null)return;const ue=di(re.headers.get("Cache-Control")||"");if(ue["no-store"])return;const ve={status:re.status,statusText:re.statusText,headers:new Headers};re.headers.forEach((ke,Pe)=>ve.headers.set(Pe,ke)),ue["max-age"]&&ve.headers.set("Expires",new Date(ie+1e3*ue["max-age"]).toUTCString());const me=ve.headers.get("Expires");if(!me||new Date(me).getTime()-ie<42e4)return;let be=Wu(W.url,{persistentParams:ph});if(re.status===206){const ke=W.headers.get("Range");if(!ke)return;ve.status=200,be=eu(be,{range:ke})}(function(ke,Pe){if(wo===void 0)try{new Response(new ReadableStream),wo=!0}catch{wo=!1}wo?Pe(ke.body):ke.blob().then(Pe).catch(We=>Ft(We.message))})(re,ke=>{const Pe=new Response((We=re.status)!==200&&We!==404&&[101,103,204,205,304].includes(We)?null:ke,ve);var We;Ma(),el!=null&&el.then(Le=>Le.put(be,Pe)).catch(Le=>Ft(Le.message))})}(g,z,U),v=!0,d(null,q,L.headers))}).catch(q=>{S||d(new Error(q.message))})};return E?function(L,z){if(Ma(),el==null)return z(null);el.then(U=>{let q=Wu(L.url,{persistentParams:ph});const W=L.headers.get("Range");W&&(q=eu(q,{range:W})),U.match(q).then(re=>{const ie=function(ue){if(!ue)return!1;const ve=new Date(ue.headers.get("Expires")||0),me=di(ue.headers.get("Cache-Control")||"");return Number(ve)>Date.now()&&!me["no-cache"]}(re);U.delete(q).catch(z),ie&&U.put(q,re.clone()).catch(z),z(null,re,ie)}).catch(z)}).catch(z)}(g,I):I(null,null),{cancel:()=>{S=!0,v||m.abort()}}}(a,r);if(Yr(self)&&self.worker.actor)return self.worker.actor.send("getResource",a,r,void 0,!0)}var i;return function(c,d){const m=new XMLHttpRequest;m.open(c.method||"GET",c.url,!0),c.type==="arrayBuffer"&&(m.responseType="arraybuffer");for(const g in c.headers)m.setRequestHeader(g,c.headers[g]);return c.type==="json"&&(m.responseType="text",m.setRequestHeader("Accept","application/json")),m.withCredentials=c.credentials==="include",m.onerror=()=>{d(new Error(m.statusText))},m.onload=()=>{if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let g=m.response;if(c.type==="json")try{g=JSON.parse(m.response)}catch(S){return d(S)}const v=new Headers;m.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(S=>{const E=S.split(": "),C=E.shift(),I=E.join(": ");v.append(C,I)}),d(null,g,v)}else d(new Oo(m.statusText,m.status,c.url))},m.send(c.body),{cancel:()=>m.abort()}}(a,r)},El=function(a,r){return nu(Object.assign(a,{type:"arrayBuffer"}),r)};function vS(a){const r=document.createElement("a");return r.href=a,r.protocol===location.protocol&&r.host===location.host}const j0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let gh,nn;gh=[],nn=0;const tp=function(a,r){if(tl.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),nn>=Vr.MAX_PARALLEL_IMAGE_REQUESTS){const m={requestParameters:a,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return gh.push(m),m}nn++;let i=!1;const c=()=>{if(!i)for(i=!0,nn--;gh.length&&nn<Vr.MAX_PARALLEL_IMAGE_REQUESTS;){const m=gh.shift(),{requestParameters:g,callback:v,cancelled:S}=m;S||(m.cancel=tp(g,v).cancel)}},d=El(a,(m,g,v)=>{c(),m?r(m):g&&(self.createImageBitmap?function(S,E){const C=new Blob([new Uint8Array(S)],{type:"image/png"});createImageBitmap(C).then(I=>{E(null,I)}).catch(I=>{E(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.`))})}(g,(S,E)=>r(S,E,v)):function(S,E){const C=new Image;C.onload=()=>{E(null,C),URL.revokeObjectURL(C.src),C.onload=null,requestAnimationFrame(()=>{C.src=j0})},C.onerror=()=>E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const I=new Blob([new Uint8Array(S)],{type:"image/png"});C.src=S.byteLength?URL.createObjectURL(I):j0}(g,(S,E)=>r(S,E,v)))});return{cancel:()=>{d.cancel(),c()}}};var l_,V0,U0,mc={exports:{}},_h={exports:{}},yh={exports:{}},c_=function(){if(U0)return mc.exports;U0=1;var a=(l_||(l_=1,_h.exports=function(i,c){var d,m,g,v,S,E,C,I;for(m=i.length-(d=3&i.length),g=c,S=3432918353,E=461845907,I=0;I<m;)C=255&i.charCodeAt(I)|(255&i.charCodeAt(++I))<<8|(255&i.charCodeAt(++I))<<16|(255&i.charCodeAt(++I))<<24,++I,g=27492+(65535&(v=5*(65535&(g=(g^=C=(65535&(C=(C=(65535&C)*S+(((C>>>16)*S&65535)<<16)&4294967295)<<15|C>>>17))*E+(((C>>>16)*E&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(C=0,d){case 3:C^=(255&i.charCodeAt(I+2))<<16;case 2:C^=(255&i.charCodeAt(I+1))<<8;case 1:g^=C=(65535&(C=(C=(65535&(C^=255&i.charCodeAt(I)))*S+(((C>>>16)*S&65535)<<16)&4294967295)<<15|C>>>17))*E+(((C>>>16)*E&65535)<<16)&4294967295}return g^=i.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0}),_h.exports),r=(V0||(V0=1,yh.exports=function(i,c){for(var d,m=i.length,g=c^m,v=0;m>=4;)d=1540483477*(65535&(d=255&i.charCodeAt(v)|(255&i.charCodeAt(++v))<<8|(255&i.charCodeAt(++v))<<16|(255&i.charCodeAt(++v))<<24))+((1540483477*(d>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(d=1540483477*(65535&(d^=d>>>24))+((1540483477*(d>>>16)&65535)<<16)),m-=4,++v;switch(m){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:g=1540483477*(65535&(g^=255&i.charCodeAt(v)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0}),yh.exports);return mc.exports=a,mc.exports.murmur3=a,mc.exports.murmur2=r,mc.exports}(),rp=Wn(c_);class rl{constructor(r,...i){Object.assign(this,i[0]||{}),this.type=r}}class vh extends rl{constructor(r,i={}){super("error",Object.assign({error:r},i))}}function u_(a,r,i){i[a]&&i[a].indexOf(r)!==-1||(i[a]=i[a]||[],i[a].push(r))}function gc(a,r,i){if(i&&i[a]){const c=i[a].indexOf(r);c!==-1&&i[a].splice(c,1)}}class iu{on(r,i){return this._listeners=this._listeners||{},u_(r,i,this._listeners),this}off(r,i){return gc(r,i,this._listeners),gc(r,i,this._oneTimeListeners),this}once(r,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},u_(r,i,this._oneTimeListeners),this):new Promise(c=>{this.once(r,c)})}fire(r,i){const c=typeof r=="string"?new rl(r,i):r,d=c.type;if(this.listens(d)){c.target=this;const m=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const S of m)S.call(this,c);const g=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const S of g)gc(d,S,this._oneTimeListeners),S.call(this,c);const v=this._eventedParent;if(v){const S=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(c,S),v.fire(c)}}else c instanceof vh&&console.error(c.error);return this}listens(r){return!!(this._listeners&&this._listeners[r]&&this._listeners[r].length>0||this._oneTimeListeners&&this._oneTimeListeners[r]&&this._oneTimeListeners[r].length>0||this._eventedParent&&this._eventedParent.listens(r))}setEventedParent(r,i){return this._eventedParent=r,this._eventedParentData=i,this}}class Js{constructor(r){typeof r=="string"?this.name=r:(this.name=r.name,this.iconsetId=r.iconsetId)}static from(r){return new Js(r)}static toString(r){return r.iconsetId?`${r.name}${r.iconsetId}`:r.name}static parse(r){const[i,c]=r.split("");return new Js({name:i,iconsetId:c})}static isEqual(r,i){return r.name===i.name&&r.iconsetId===i.iconsetId}toString(){return Js.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var np,xh={},ha=function(){if(np)return xh;np=1;var a={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 r(m){return(m=Math.round(m))<0?0:m>255?255:m}function i(m){return r(m[m.length-1]==="%"?parseFloat(m)/100*255:parseInt(m))}function c(m){return(g=m[m.length-1]==="%"?parseFloat(m)/100:parseFloat(m))<0?0:g>1?1:g;var g}function d(m,g,v){return v<0?v+=1:v>1&&(v-=1),6*v<1?m+(g-m)*v*6:2*v<1?g:3*v<2?m+(g-m)*(2/3-v)*6:m}try{xh.parseCSSColor=function(m){var g,v=m.replace(/ /g,"").toLowerCase();if(v in a)return a[v].slice();if(v[0]==="#")return v.length===4?(g=parseInt(v.substr(1),16))>=0&&g<=4095?[(3840&g)>>4|(3840&g)>>8,240&g|(240&g)>>4,15&g|(15&g)<<4,1]:null:v.length===7&&(g=parseInt(v.substr(1),16))>=0&&g<=16777215?[(16711680&g)>>16,(65280&g)>>8,255&g,1]:null;var S=v.indexOf("("),E=v.indexOf(")");if(S!==-1&&E+1===v.length){var C=v.substr(0,S),I=v.substr(S+1,E-(S+1)).split(","),R=1;switch(C){case"rgba":if(I.length!==4)return null;R=c(I.pop());case"rgb":return I.length!==3?null:[i(I[0]),i(I[1]),i(I[2]),R];case"hsla":if(I.length!==4)return null;R=c(I.pop());case"hsl":if(I.length!==3)return null;var L=(parseFloat(I[0])%360+360)%360/360,z=c(I[1]),U=c(I[2]),q=U<=.5?U*(z+1):U+z-U*z,W=2*U-q;return[r(255*d(W,q,L+1/3)),r(255*d(W,q,L)),r(255*d(W,q,L-1/3)),R];default:return null}}return null}}catch{}return xh}();class wn{constructor(r,i,c,d=1){this.r=r,this.g=i,this.b=c,this.a=d}static parse(r){if(!r)return;if(r instanceof wn)return r;if(typeof r!="string")return;const i=ha.parseCSSColor(r);return i?new wn(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[r,i,c,d]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*r)},${Math.round(255*i)},${Math.round(255*c)},${d})`}toNonPremultipliedRenderColor(r){const{r:i,g:c,b:d,a:m}=this;return new G0(r,i,c,d,m)}toPremultipliedRenderColor(r){const{r:i,g:c,b:d,a:m}=this;return new H0(r,i*m,c*m,d*m,m)}clone(){return new wn(this.r,this.g,this.b,this.a)}}class $0{constructor(r,i,c,d,m,g=!1){if(this.premultiplied=!1,this.premultiplied=g,r){const v=r.image.height,S=v*v;this.premultiplied?(i=m===0?0:i/m*(v-1),c=m===0?0:c/m*(v-1),d=m===0?0:d/m*(v-1)):(i*=v-1,c*=v-1,d*=v-1);const E=Math.floor(i),C=Math.floor(c),I=Math.floor(d),R=Math.ceil(i),L=Math.ceil(c),z=Math.ceil(d),U=i-E,q=c-C,W=d-I,re=r.image.data,ie=4*(E+C*S+I*v),ue=4*(E+C*S+z*v),ve=4*(E+L*S+I*v),me=4*(E+L*S+z*v),be=4*(R+C*S+I*v),ke=4*(R+C*S+z*v),Pe=4*(R+L*S+I*v),We=4*(R+L*S+z*v);if(ie<0||We>=re.length)throw new Error("out of range");this.r=ur(ur(ur(re[ie],re[ue],W),ur(re[ve],re[me],W),q),ur(ur(re[be],re[ke],W),ur(re[Pe],re[We],W),q),U)/255*(this.premultiplied?m:1),this.g=ur(ur(ur(re[ie+1],re[ue+1],W),ur(re[ve+1],re[me+1],W),q),ur(ur(re[be+1],re[ke+1],W),ur(re[Pe+1],re[We+1],W),q),U)/255*(this.premultiplied?m:1),this.b=ur(ur(ur(re[ie+2],re[ue+2],W),ur(re[ve+2],re[me+2],W),q),ur(ur(re[be+2],re[ke+2],W),ur(re[Pe+2],re[We+2],W),q),U)/255*(this.premultiplied?m:1),this.a=m}else this.r=i,this.g=c,this.b=d,this.a=m}toArray(){const{r,g:i,b:c,a:d}=this;return[255*r,255*i,255*c,d]}toHslaArray(){let{r,g:i,b:c,a:d}=this;if(this.premultiplied){if(d===0)return[0,0,0,0];const z=1/d;r*=z,i*=z,c*=z}const m=Math.min(Math.max(r,0),1),g=Math.min(Math.max(i,0),1),v=Math.min(Math.max(c,0),1),S=Math.min(m,g,v),E=Math.max(m,g,v),C=E-S,I=.5*(S+E);if(C===0)return[0,0,100*I,d];const R=I>.5?C/(2-E-S):C/(E+S);let L;switch(E){case m:L=60*((g-v)/C+(g<v?6:0));break;case g:L=60*((v-m)/C+2);break;default:L=60*((m-g)/C+4)}return[L,100*R,100*I,d]}toArray01(){const{r,g:i,b:c,a:d}=this;return[r,i,c,d]}toArray01Scaled(r){const{r:i,g:c,b:d}=this;return[i*r,c*r,d*r]}toArray01Linear(){const{r,g:i,b:c,a:d}=this;return[Math.pow(r,2.2),Math.pow(i,2.2),Math.pow(c,2.2),d]}}class G0 extends $0{constructor(r,i,c,d,m){super(r,i,c,d,m,!1)}}class H0 extends $0{constructor(r,i,c,d,m){super(r,i,c,d,m,!0)}}function ur(a,r,i){return a*(1-i)+r*i}function d_(a,r,i){return a.map((c,d)=>ur(c,r[d],i))}wn.black=new wn(0,0,0,1),wn.white=new wn(1,1,1,1),wn.transparent=new wn(0,0,0,0),wn.red=new wn(1,0,0,1),wn.blue=new wn(0,0,1,1);var wh=Object.freeze({__proto__:null,array:d_,color:function(a,r,i){return new wn(ur(a.r,r.r,i),ur(a.g,r.g,i),ur(a.b,r.b,i),ur(a.a,r.a,i))},number:ur});class fa extends Error{constructor(r,i){super(i),this.message=i,this.key=r}}class qu{constructor(r,i=[]){this.parent=r,this.bindings={};for(const[c,d]of i)this.bindings[c]=d}concat(r){return new qu(this,r)}get(r){if(this.bindings[r])return this.bindings[r];if(this.parent)return this.parent.get(r);throw new Error(`${r} not found in scope.`)}has(r){return!!this.bindings[r]||!!this.parent&&this.parent.has(r)}}const Ra={kind:"null"},Qt={kind:"number"},Xr={kind:"string"},kn={kind:"boolean"},bo={kind:"color"},nl={kind:"object"},vn={kind:"value"},ip={kind:"collator"},bh={kind:"formatted"},Sh={kind:"resolvedImage"};function js(a,r){return{kind:"array",itemType:a,N:r}}function Ri(a){if(a.kind==="array"){const r=Ri(a.itemType);return typeof a.N=="number"?`array<${r}, ${a.N}>`:a.itemType.kind==="value"?"array":`array<${r}>`}return a.kind}const xS=[Ra,Qt,Xr,kn,bo,bh,nl,js(vn),Sh];function _c(a,r){if(r.kind==="error")return null;if(a.kind==="array"){if(r.kind==="array"&&(r.N===0&&r.itemType.kind==="value"||!_c(a.itemType,r.itemType))&&(typeof a.N!="number"||a.N===r.N))return null}else{if(a.kind===r.kind)return null;if(a.kind==="value"){for(const i of xS)if(!_c(i,r))return null}}return`Expected ${Ri(a)} but found ${Ri(r)} instead.`}function h_(a,r){return r.some(i=>i.kind===a.kind)}function Th(a,r){return r.some(i=>i==="null"?a===null:i==="array"?Array.isArray(a):i==="object"?a&&!Array.isArray(a)&&typeof a=="object":i===typeof a)}function sp(a,r){return a.kind==="array"&&r.kind==="array"?a.N===r.N&&sp(a.itemType,r.itemType):a.kind===r.kind}class f_{constructor(r,i,c){this.sensitivity=r?i?"variant":"case":i?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(r,i){return this.collator.compare(r,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class op{constructor(r,i,c,d,m){this.text=r.normalize?r.normalize():r,this.image=i,this.scale=c,this.fontStack=d,this.textColor=m}}class ao{constructor(r){this.sections=r}static fromString(r){return new ao([new op(r,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(r=>r.text.length!==0||!!r.image&&r.image.hasPrimary())}static factory(r){return r instanceof ao?r:ao.fromString(r)}toString(){return this.sections.length===0?"":this.sections.map(r=>r.text).join("")}serialize(){const r=["format"];for(const i of this.sections){if(i.image){const d=i.image.getPrimary().id.toString();r.push(["image",d]);continue}r.push(i.text);const c={};i.fontStack&&(c["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(c["font-scale"]=i.scale),i.textColor&&(c["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),r.push(c)}return r}}class kl{constructor(r,i={}){this.id=Js.from(r),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(r){let i,c,d,m;try{({id:i,params:c,sx:d,sy:m}=JSON.parse(r)||{})}catch{return null}return i?new kl(i,{params:c,sx:d,sy:m}):null}scaleSelf(r,i=r){return this.sx*=r,this.sy*=i,this}}class lo{constructor(r,i,c,d,m=!1){this.primaryId=Js.from(r),this.primaryOptions=i,c&&(this.secondaryId=Js.from(c)),this.secondaryOptions=d,this.available=m}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new kl(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new kl(this.secondaryId,this.secondaryOptions):null}static from(r){return typeof r=="string"?lo.build({name:r}):r}static build(r,i,c,d){return!r||typeof r=="object"&&!("name"in r)?null:new lo(r,c,i,d)}}function su(a,r,i,c){return typeof a=="number"&&a>=0&&a<=255&&typeof r=="number"&&r>=0&&r<=255&&typeof i=="number"&&i>=0&&i<=255?c===void 0||typeof c=="number"&&c>=0&&c<=1?null:`Invalid rgba value [${[a,r,i,c].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof c=="number"?[a,r,i,c]:[a,r,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ku(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof wn||a instanceof f_||a instanceof ao||a instanceof lo)return!0;if(Array.isArray(a)){for(const r of a)if(!Ku(r))return!1;return!0}if(typeof a=="object"){for(const r in a)if(!Ku(a[r]))return!1;return!0}return!1}function is(a){if(a===null)return Ra;if(typeof a=="string")return Xr;if(typeof a=="boolean")return kn;if(typeof a=="number")return Qt;if(a instanceof wn)return bo;if(a instanceof f_)return ip;if(a instanceof ao)return bh;if(a instanceof lo)return Sh;if(Array.isArray(a)){const r=a.length;let i;for(const c of a){const d=is(c);if(i){if(i===d)continue;i=vn;break}i=d}return js(i||vn,r)}return nl}function pa(a){const r=typeof a;return a===null?"":r==="string"||r==="number"||r==="boolean"?String(a):a instanceof ao||a instanceof lo||a instanceof wn?a.toString():JSON.stringify(a)}class Al{constructor(r,i){this.type=r,this.value=i}static parse(r,i){if(r.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!Ku(r[1]))return i.error("invalid value");const c=r[1];let d=is(c);const m=i.expectedType;return d.kind!=="array"||d.N!==0||!m||m.kind!=="array"||typeof m.N=="number"&&m.N!==0||(d=m),new Al(d,c)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof wn?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof ao?this.value.serialize():this.value}}class Xi{constructor(r){this.name="ExpressionEvaluationError",this.message=r}toJSON(){return this.message}}const p_={string:Xr,number:Qt,boolean:kn,object:nl};class Da{constructor(r,i){this.type=r,this.args=i}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");let c,d=1;const m=r[0];if(m==="array"){let v,S;if(r.length>2){const E=r[1];if(typeof E!="string"||!(E in p_)||E==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);v=p_[E],d++}else v=vn;if(r.length>3){if(r[2]!==null&&(typeof r[2]!="number"||r[2]<0||r[2]!==Math.floor(r[2])))return i.error('The length argument to "array" must be a positive integer literal',2);S=r[2],d++}c=js(v,S)}else c=p_[m];const g=[];for(;d<r.length;d++){const v=i.parse(r[d],d,vn);if(!v)return null;g.push(v)}return new Da(c,g)}evaluate(r){for(let i=0;i<this.args.length;i++){const c=this.args[i].evaluate(r);if(!_c(this.type,is(c)))return c;if(i===this.args.length-1)throw new Xi(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${Ri(is(c))} but was expected to be of type ${Ri(this.type)}.`)}return null}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){const r=this.type,i=[r.kind];if(r.kind==="array"){const c=r.itemType;if(c.kind==="string"||c.kind==="number"||c.kind==="boolean"){i.push(c.kind);const d=r.N;(typeof d=="number"||this.args.length>1)&&i.push(d)}}return i.concat(this.args.map(c=>c.serialize()))}}class il{constructor(r){this.type=bh,this.sections=r}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");const c=r[1];if(!Array.isArray(c)&&typeof c=="object")return i.error("First argument must be an image or text section.");const d=[];let m=!1;for(let g=1;g<=r.length-1;++g){const v=r[g];if(m&&typeof v=="object"&&!Array.isArray(v)){m=!1;let S=null;if(v["font-scale"]&&(S=i.parseObjectValue(v["font-scale"],g,"font-scale",Qt),!S))return null;let E=null;if(v["text-font"]&&(E=i.parseObjectValue(v["text-font"],g,"text-font",js(Xr)),!E))return null;let C=null;if(v["text-color"]&&(C=i.parseObjectValue(v["text-color"],g,"text-color",bo),!C))return null;const I=d[d.length-1];I.scale=S,I.font=E,I.textColor=C}else{const S=i.parse(r[g],g,vn);if(!S)return null;const E=S.type.kind;if(E!=="string"&&E!=="value"&&E!=="null"&&E!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");m=!0,d.push({content:S,scale:null,font:null,textColor:null})}}return new il(d)}evaluate(r){return new ao(this.sections.map(i=>{const c=i.content.evaluate(r);return sp(is(c),Sh)?new op("",c,null,null,null):new op(pa(c),null,i.scale?i.scale.evaluate(r):null,i.font?i.font.evaluate(r).join(","):null,i.textColor?i.textColor.evaluate(r):null)}))}eachChild(r){for(const i of this.sections)r(i.content),i.scale&&r(i.scale),i.font&&r(i.font),i.textColor&&r(i.textColor)}outputDefined(){return!1}serialize(){const r=["format"];for(const i of this.sections){r.push(i.content.serialize());const c={};i.scale&&(c["font-scale"]=i.scale.serialize()),i.font&&(c["text-font"]=i.font.serialize()),i.textColor&&(c["text-color"]=i.textColor.serialize()),r.push(c)}return r}}class Er{constructor(r,i,c,d){this._imageWarnHistory={},this.type=Sh,this.namePrimary=r,this.nameSecondary=i,c&&(this.paramsPrimary=c.params,this.iconsetIdPrimary=c.iconset?c.iconset.id:void 0),d&&(this.paramsSecondary=d.params,this.iconsetIdSecondary=d.iconset?d.iconset.id:void 0)}static parse(r,i){if(r.length<2)return i.error("Expected two or more arguments.");let c=1;const d=[];function m(){if(c<r.length){const v=i.parse(r[c],c++,Xr);return v?(d.push({image:v,options:{}}),!0):(i.error(d.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function g(){if(c<r.length){const S=r[c];if((v=S)===null||typeof v!="object"||Array.isArray(v))return!0;const E=S.params,C=S.iconset,I=i.concat(c);if(!E&&!C)return c++,!0;if(E){if(typeof E!="object"||E.constructor!==Object)return I.error('Image options "params" should be an object'),!1;const R={},L=I.concat(void 0,"params");for(const z in E){if(!z)return L.error("Image parameter name should be non-empty"),!1;const U=L.concat(void 0,z).parse(E[z],void 0,bo,void 0,{typeAnnotation:"coerce"});if(!U)return!1;R[z]=U}d[d.length-1].options.params=R}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[d.length-1].options.iconset=C}return c++,!0}var v;return!0}for(let v=0;v<2;v++)if(!m()||!g())return;return new Er(d[0].image,d[1]?d[1].image:void 0,d[0].options,d[1]?d[1].options:void 0)}evaluateParams(r,i){const c={};if(i){for(const d in i)if(i[d])try{c[d]=i[d].evaluate(r)}catch{continue}if(Object.keys(c).length!==0)return{params:c}}}evaluate(r){const i={name:this.namePrimary.evaluate(r),iconsetId:this.iconsetIdPrimary},c=this.nameSecondary?{name:this.nameSecondary.evaluate(r),iconsetId:this.iconsetIdSecondary}:void 0,d=lo.build(i,c,this.paramsPrimary?this.evaluateParams(r,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(r,this.paramsSecondary):void 0);if(d&&r.availableImages){const m=d.getPrimary().id;if(d.available=r.availableImages.some(g=>Js.isEqual(g,m)),d.available){const g=d.getSecondary()?d.getSecondary().id:null;g&&(d.available=r.availableImages.some(v=>Js.isEqual(v,g)))}}return d}eachChild(r){if(r(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&r(this.paramsPrimary[i]);if(this.nameSecondary&&(r(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&r(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(r,i){const c={};if(i&&(c.iconset={id:i}),r){c.params={};for(const d in r)r[d]&&(c.params[d]=r[d].serialize())}return Object.keys(c).length>0?c:void 0}serialize(){const r=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&r.push(i)}if(this.nameSecondary&&(r.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&r.push(i)}return r}}function Xt(a){return pr(a)?"string":Zu(a)?"number":lp(a)?"boolean":Array.isArray(a)?"array":a===null?"null":ap(a)?"object":typeof a}function ap(a){return a!=null&&!Array.isArray(a)&&typeof a!="function"&&!(a instanceof String||a instanceof Number||a instanceof Boolean)&&typeof a=="object"}function pr(a){return typeof a=="string"||a instanceof String}function Zu(a){return typeof a=="number"||a instanceof Number}function lp(a){return typeof a=="boolean"||a instanceof Boolean}const fr={"to-boolean":kn,"to-color":bo,"to-number":Qt,"to-string":Xr};class sl{constructor(r,i){this.type=r,this.args=i}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");const c=r[0],d=[];let m=Ra;if(c==="to-array"){if(!Array.isArray(r[1]))return null;const g=r[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);m=js(i.expectedType.itemType,g)}else{if(!(g>0&&Ku(r[1][0])))return null;m=js(is(r[1][0]),g)}for(let v=0;v<g;v++){const S=r[1][v];let E;if(Array.isArray(S))E=i.parse(S,void 0,m.itemType);else{const C=Xt(S);if(C!==m.itemType.kind)return i.error(`Expected ${m.itemType.kind} but found ${C}.`);E=i.registry.literal.parse(["literal",S===void 0?null:S],i)}if(!E)return null;d.push(E)}}else{if((c==="to-boolean"||c==="to-string")&&r.length!==2)return i.error("Expected one argument.");m=fr[c];for(let g=1;g<r.length;g++){const v=i.parse(r[g],g,vn);if(!v)return null;d.push(v)}}return new sl(m,d)}evaluate(r){if(this.type.kind==="boolean")return!!this.args[0].evaluate(r);if(this.type.kind==="color"){let i,c;for(const d of this.args){if(i=d.evaluate(r),c=null,i instanceof wn)return i;if(typeof i=="string"){const m=r.parseColor(i);if(m)return m}else if(Array.isArray(i)&&(c=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:su(i[0],i[1],i[2],i[3]),!c))return new wn(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Xi(c||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const c of this.args){if(i=c.evaluate(r),i===null)return 0;const d=Number(i);if(!isNaN(d))return d}throw new Xi(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?ao.fromString(pa(this.args[0].evaluate(r))):this.type.kind==="resolvedImage"?lo.build(pa(this.args[0].evaluate(r))):this.type.kind==="array"?this.args.map(i=>i.evaluate(r)):pa(this.args[0].evaluate(r))}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){if(this.type.kind==="formatted")return new il([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Er(this.args[0]).serialize();const r=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{r.push(i.serialize())}),r}}const m_=["Unknown","Point","LineString","Polygon"];class cp{constructor(r,i,c){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=r,this.options=i,this.iconImageUseTheme=c}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?m_[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(r){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const r=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:c,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(c*i-r[0])+this.featureDistanceData.bearing[1]*(d*i-r[1])}return 0}parseColor(r){let i=this._parseColorCache[r];return i||(i=this._parseColorCache[r]=wn.parse(r)),i}getConfig(r){return this.options?this.options.get(r):null}}class co{constructor(r,i,c,d,m){this.name=r,this.type=i,this._evaluate=c,this.args=d,this._overloadIndex=m}evaluate(r){if(!this._evaluate){const i=co.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(r,this.args)}eachChild(r){this.args.forEach(r)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(r=>r.serialize()))}static parse(r,i){const c=r[0],d=co.definitions[c];if(!d)return i.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0);const m=Array.isArray(d)?d[0]:d.type,g=Array.isArray(d)?[[d[1],d[2]]]:d.overloads,v=[];let S=null,E=-1;for(const[C,I]of g){if(Array.isArray(C)&&C.length!==r.length-1)continue;v.push(C),E++,S=new wp(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);const R=[];let L=!1;for(let z=1;z<r.length;z++){const U=r[z],q=Array.isArray(C)?C[z-1]:C.type,W=S.parse(U,1+R.length,q);if(!W){L=!0;break}R.push(W)}if(!L)if(Array.isArray(C)&&C.length!==R.length)S.error(`Expected ${C.length} arguments, but found ${R.length} instead.`);else{for(let z=0;z<R.length;z++){const U=Array.isArray(C)?C[z]:C.type,q=R[z];S.concat(z+1).checkSubtype(U,q.type)}if(S.errors.length===0)return new co(c,m,I,R,E)}}if(v.length===1)i.errors.push(...S.errors);else{const C=(v.length?v:g.map(([R])=>R)).map(up).join(" | "),I=[];for(let R=1;R<r.length;R++){const L=i.parse(r[R],1+I.length);if(!L)return null;I.push(Ri(L.type))}i.error(`Expected arguments of type ${C}, but found (${I.join(", ")}) instead.`)}return null}static register(r,i){co.definitions=i;for(const c in i)r[c]=co}}function up(a){return Array.isArray(a)?`(${a.map(Ri).join(", ")})`:`(${Ri(a.type)}...)`}class ms{constructor(r,i,c){this.type=ip,this.locale=c,this.caseSensitive=r,this.diacriticSensitive=i}static parse(r,i){if(r.length!==2)return i.error("Expected one argument.");const c=r[1];if(typeof c!="object"||Array.isArray(c))return i.error("Collator options argument must be an object.");const d=c["case-sensitive"]===void 0?i.parse(!1,1,kn):i.parseObjectValue(c["case-sensitive"],1,"case-sensitive",kn);if(!d)return null;const m=c["diacritic-sensitive"]===void 0?i.parse(!1,1,kn):i.parseObjectValue(c["diacritic-sensitive"],1,"diacritic-sensitive",kn);if(!m)return null;let g=null;return c.locale&&(g=i.parseObjectValue(c.locale,1,"locale",Xr),!g)?null:new ms(d,m,g)}evaluate(r){return new f_(this.caseSensitive.evaluate(r),this.diacriticSensitive.evaluate(r),this.locale?this.locale.evaluate(r):null)}eachChild(r){r(this.caseSensitive),r(this.diacriticSensitive),this.locale&&r(this.locale)}outputDefined(){return!1}serialize(){const r={};return r["case-sensitive"]=this.caseSensitive.serialize(),r["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(r.locale=this.locale.serialize()),["collator",r]}}function dp(a,r,i=0,c=a.length-1,d=g_){for(;c>i;){if(c-i>600){const S=c-i+1,E=r-i+1,C=Math.log(S),I=.5*Math.exp(2*C/3),R=.5*Math.sqrt(C*I*(S-I)/S)*(E-S/2<0?-1:1);dp(a,r,Math.max(i,Math.floor(r-E*I/S+R)),Math.min(c,Math.floor(r+(S-E)*I/S+R)),d)}const m=a[r];let g=i,v=c;for(La(a,i,r),d(a[c],m)>0&&La(a,i,c);g<v;){for(La(a,g,v),g++,v--;d(a[g],m)<0;)g++;for(;d(a[v],m)>0;)v--}d(a[i],m)===0?La(a,i,v):(v++,La(a,v,c)),v<=r&&(i=v+1),r<=v&&(c=v-1)}}function La(a,r,i){const c=a[r];a[r]=a[i],a[i]=c}function g_(a,r){return a<r?-1:a>r?1:0}function yc(a){let r=0;for(let i,c,d=0,m=a.length,g=m-1;d<m;g=d++)i=a[d],c=a[g],r+=(c.x-i.x)*(i.y+c.y);return r}function ma(a,r){a[0]=Math.min(a[0],r[0]),a[1]=Math.min(a[1],r[1]),a[2]=Math.max(a[2],r[0]),a[3]=Math.max(a[3],r[1])}function Eh(a,r){return!(a[0]<=r[0]||a[2]>=r[2]||a[1]<=r[1]||a[3]>=r[3])}function wS(a,r,i){const c=a[0]-r[0],d=a[1]-r[1],m=a[0]-i[0],g=a[1]-i[1];return c*g-m*d==0&&c*m<=0&&d*g<=0}function Xu(a,r,i=!1){let c=!1;for(let v=0,S=r.length;v<S;v++){const E=r[v];for(let C=0,I=E.length,R=I-1;C<I;R=C++){const L=E[R],z=E[C];if(wS(a,L,z))return i;(m=L)[1]>(d=a)[1]!=(g=z)[1]>d[1]&&d[0]<(g[0]-m[0])*(d[1]-m[1])/(g[1]-m[1])+m[0]&&(c=!c)}}var d,m,g;return c}function kh(a,r,i,c){const d=c[0]-i[0],m=c[1]-i[1],g=(a[0]-i[0])*m-d*(a[1]-i[1]),v=(r[0]-i[0])*m-d*(r[1]-i[1]);return g>0&&v<0||g<0&&v>0}function Ah(a,r,i,c){return(d=[c[0]-i[0],c[1]-i[1]])[0]*(m=[r[0]-a[0],r[1]-a[1]])[1]-d[1]*m[0]!=0&&!(!kh(a,r,i,c)||!kh(i,c,a,r));var d,m}function Cl(a){const r=new it(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new it(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const c of a[0])r.x>c.x&&(r.x=c.x),r.y>c.y&&(r.y=c.y),i.x<c.x&&(i.x=c.x),i.y<c.y&&(i.y=c.y);return{min:r,max:i}}const vc=8192;function bS(a,r){const i=(180+a[0])/360,c=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,d=Math.pow(2,r.z);return[Math.round(i*d*vc),Math.round(c*d*vc)]}function __(a,r){for(let i=0;i<r.length;i++)if(Xu(a,r[i]))return!0;return!1}function SS(a,r,i){for(const c of i)for(let d=0,m=c.length,g=m-1;d<m;g=d++)if(Ah(a,r,c[g],c[d]))return!0;return!1}function W0(a,r){for(let i=0;i<a.length;++i)if(!Xu(a[i],r))return!1;for(let i=0;i<a.length-1;++i)if(SS(a[i],a[i+1],r))return!1;return!0}function q0(a,r){for(let i=0;i<r.length;i++)if(W0(a,r[i]))return!0;return!1}function y_(a,r,i){const c=[];for(let d=0;d<a.length;d++){const m=[];for(let g=0;g<a[d].length;g++){const v=bS(a[d][g],i);ma(r,v),m.push(v)}c.push(m)}return c}function xc(a,r,i){const c=[];for(let d=0;d<a.length;d++){const m=y_(a[d],r,i);c.push(m)}return c}function K0(a,r,i,c){if(a[0]<i[0]||a[0]>i[2]){const d=.5*c;let m=a[0]-i[0]>d?-c:i[0]-a[0]>d?c:0;m===0&&(m=a[0]-i[2]>d?-c:i[2]-a[0]>d?c:0),a[0]+=m}ma(r,a)}function Z0(a,r,i,c){const d=Math.pow(2,c.z)*vc,m=[c.x*vc,c.y*vc],g=[];if(!a)return g;for(const v of a)for(const S of v){const E=[S.x+m[0],S.y+m[1]];K0(E,r,i,d),g.push(E)}return g}function hp(a,r,i,c){const d=Math.pow(2,c.z)*vc,m=[c.x*vc,c.y*vc],g=[];if(!a)return g;for(const S of a){const E=[];for(const C of S){const I=[C.x+m[0],C.y+m[1]];ma(r,I),E.push(I)}g.push(E)}if(r[2]-r[0]<=d/2){(v=r)[0]=v[1]=1/0,v[2]=v[3]=-1/0;for(const S of g)for(const E of S)K0(E,r,i,d)}var v;return g}class wc{constructor(r,i){this.type=kn,this.geojson=r,this.geometries=i}static parse(r,i){if(r.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(Ku(r[1])){const c=r[1];if(c.type==="FeatureCollection")for(let d=0;d<c.features.length;++d){const m=c.features[d].geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new wc(c,c.features[d].geometry)}else if(c.type==="Feature"){const d=c.geometry.type;if(d==="Polygon"||d==="MultiPolygon")return new wc(c,c.geometry)}else if(c.type==="Polygon"||c.type==="MultiPolygon")return new wc(c,c)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(r){if(r.geometry()!=null&&r.canonicalID()!=null){if(r.geometryType()==="Point")return function(i,c){const d=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],g=i.canonicalID();if(!g)return!1;if(c.type==="Polygon"){const v=y_(c.coordinates,m,g),S=Z0(i.geometry(),d,m,g);if(!Eh(d,m))return!1;for(const E of S)if(!Xu(E,v))return!1}if(c.type==="MultiPolygon"){const v=xc(c.coordinates,m,g),S=Z0(i.geometry(),d,m,g);if(!Eh(d,m))return!1;for(const E of S)if(!__(E,v))return!1}return!0}(r,this.geometries);if(r.geometryType()==="LineString")return function(i,c){const d=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],g=i.canonicalID();if(!g)return!1;if(c.type==="Polygon"){const v=y_(c.coordinates,m,g),S=hp(i.geometry(),d,m,g);if(!Eh(d,m))return!1;for(const E of S)if(!W0(E,v))return!1}if(c.type==="MultiPolygon"){const v=xc(c.coordinates,m,g),S=hp(i.geometry(),d,m,g);if(!Eh(d,m))return!1;for(const E of S)if(!q0(E,v))return!1}return!0}(r,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Ch={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},ga=1/298.257223563,X0=ga*(2-ga),Yu=Math.PI/180;class Ju{static fromTile(r,i,c){const d=Math.PI*(1-2*(r+.5)/Math.pow(2,i)),m=Math.atan(.5*(Math.exp(d)-Math.exp(-d)))/Yu;return new Ju(m,c)}static get units(){return Ch}constructor(r,i){if(r===void 0)throw new Error("No latitude given.");if(i&&!Ch[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Ch).join(", ")}`);const c=6378.137*Yu*(i?Ch[i]:1),d=Math.cos(r*Yu),m=1/(1-X0*(1-d*d)),g=Math.sqrt(m);this.kx=c*g*d,this.ky=c*g*m*(1-X0)}distance(r,i){const c=Zo(r[0]-i[0])*this.kx,d=(r[1]-i[1])*this.ky;return Math.sqrt(c*c+d*d)}bearing(r,i){const c=Zo(i[0]-r[0])*this.kx;return Math.atan2(c,(i[1]-r[1])*this.ky)/Yu}destination(r,i,c){const d=c*Yu;return this.offset(r,Math.sin(d)*i,Math.cos(d)*i)}offset(r,i,c){return[r[0]+i/this.kx,r[1]+c/this.ky]}lineDistance(r){let i=0;for(let c=0;c<r.length-1;c++)i+=this.distance(r[c],r[c+1]);return i}area(r){let i=0;for(let c=0;c<r.length;c++){const d=r[c];for(let m=0,g=d.length,v=g-1;m<g;v=m++)i+=Zo(d[m][0]-d[v][0])*(d[m][1]+d[v][1])*(c?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(r,i){let c=0;if(i<=0)return r[0];for(let d=0;d<r.length-1;d++){const m=r[d],g=r[d+1],v=this.distance(m,g);if(c+=v,c>i)return fp(m,g,(i-(c-v))/v)}return r[r.length-1]}pointToSegmentDistance(r,i,c){let[d,m]=i,g=Zo(c[0]-d)*this.kx,v=(c[1]-m)*this.ky;if(g!==0||v!==0){const S=(Zo(r[0]-d)*this.kx*g+(r[1]-m)*this.ky*v)/(g*g+v*v);S>1?(d=c[0],m=c[1]):S>0&&(d+=g/this.kx*S,m+=v/this.ky*S)}return g=Zo(r[0]-d)*this.kx,v=(r[1]-m)*this.ky,Math.sqrt(g*g+v*v)}pointOnLine(r,i){let c=1/0,d=r[0][0],m=r[0][1],g=0,v=0;for(let S=0;S<r.length-1;S++){let E=r[S][0],C=r[S][1],I=Zo(r[S+1][0]-E)*this.kx,R=(r[S+1][1]-C)*this.ky,L=0;I===0&&R===0||(L=(Zo(i[0]-E)*this.kx*I+(i[1]-C)*this.ky*R)/(I*I+R*R),L>1?(E=r[S+1][0],C=r[S+1][1]):L>0&&(E+=I/this.kx*L,C+=R/this.ky*L)),I=Zo(i[0]-E)*this.kx,R=(i[1]-C)*this.ky;const z=I*I+R*R;z<c&&(c=z,d=E,m=C,g=S,v=L)}return{point:[d,m],index:g,t:Math.max(0,Math.min(1,v))}}lineSlice(r,i,c){let d=this.pointOnLine(c,r),m=this.pointOnLine(c,i);if(d.index>m.index||d.index===m.index&&d.t>m.t){const E=d;d=m,m=E}const g=[d.point],v=d.index+1,S=m.index;!v_(c[v],g[0])&&v<=S&&g.push(c[v]);for(let E=v+1;E<=S;E++)g.push(c[E]);return v_(c[S],m.point)||g.push(m.point),g}lineSliceAlong(r,i,c){let d=0;const m=[];for(let g=0;g<c.length-1;g++){const v=c[g],S=c[g+1],E=this.distance(v,S);if(d+=E,d>r&&m.length===0&&m.push(fp(v,S,(r-(d-E))/E)),d>=i)return m.push(fp(v,S,(i-(d-E))/E)),m;d>r&&m.push(S)}return m}bufferPoint(r,i){const c=i/this.ky,d=i/this.kx;return[r[0]-d,r[1]-c,r[0]+d,r[1]+c]}bufferBBox(r,i){const c=i/this.ky,d=i/this.kx;return[r[0]-d,r[1]-c,r[2]+d,r[3]+c]}insideBBox(r,i){return Zo(r[0]-i[0])>=0&&Zo(r[0]-i[2])<=0&&r[1]>=i[1]&&r[1]<=i[3]}}function v_(a,r){return a[0]===r[0]&&a[1]===r[1]}function fp(a,r,i){const c=Zo(r[0]-a[0]);return[a[0]+c*i,a[1]+(r[1]-a[1])*i]}function Zo(a){for(;a<-180;)a+=360;for(;a>180;)a-=360;return a}class pp{constructor(r=[],i=(c,d)=>c<d?-1:c>d?1:0){if(this.data=r,this.length=this.data.length,this.compare=i,this.length>0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:i,compare:c}=this,d=i[r];for(;r>0;){const m=r-1>>1,g=i[m];if(c(d,g)>=0)break;i[r]=g,r=m}i[r]=d}_down(r){const{data:i,compare:c}=this,d=this.length>>1,m=i[r];for(;r<d;){let g=1+(r<<1);const v=g+1;if(v<this.length&&c(i[v],i[g])<0&&(g=v),c(i[g],m)>=0)break;i[r]=i[g],r=g}i[r]=m}}var bt=8192;function x_(a,r){return r.dist-a.dist}const mp=100,gp=50;function w_(a){const r=[1/0,1/0,-1/0,-1/0];if(r.length!==a.length)return!1;for(let i=0;i<r.length;i++)if(r[i]!==a[i])return!1;return!0}function Ih(a){return a[1]-a[0]+1}function ol(a,r){const i=a[1]>=a[0]&&a[1]<r;return i||console.warn("Distance Expression: Index is out of range"),i}function b_(a,r){if(a[0]>a[1])return[null,null];const i=Ih(a);if(r){if(i===2)return[a,null];const c=Math.floor(i/2);return[[a[0],a[0]+c],[a[0]+c,a[1]]]}{if(i===1)return[a,null];const c=Math.floor(i/2)-1;return[[a[0],a[0]+c],[a[0]+c+1,a[1]]]}}function ou(a,r){const i=[1/0,1/0,-1/0,-1/0];if(!ol(r,a.length))return i;for(let c=r[0];c<=r[1];++c)ma(i,a[c]);return i}function au(a){const r=[1/0,1/0,-1/0,-1/0];for(let i=0;i<a.length;++i)for(let c=0;c<a[i].length;++c)ma(r,a[i][c]);return r}function bc(a,r,i){if(w_(a)||w_(r))return NaN;let c=0,d=0;return a[2]<r[0]&&(c=r[0]-a[2]),a[0]>r[2]&&(c=a[0]-r[2]),a[1]>r[3]&&(d=a[1]-r[3]),a[3]<r[1]&&(d=r[1]-a[3]),i.distance([0,0],[c,d])}function _p(a){return 360*a-180}function Y0(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function yp(a,r){const i=Math.pow(2,r.z),c=(a.y/bt+r.y)/i;return[_p((a.x/bt+r.x)/i),Y0(c)]}function TS(a,r){const i=[];for(let c=0;c<a.length;++c)i.push(yp(a[c],r));return i}function J0(a,r,i){const c=i.pointOnLine(r,a).point;return i.distance(a,c)}function S_(a,r,i,c,d){const m=i.slice(c[0],c[1]+1);let g=1/0;for(let v=r[0];v<=r[1];++v)if((g=Math.min(g,J0(a[v],m,d)))===0)return 0;return g}function Sc(a,r,i,c,d){const m=Math.min(d.pointToSegmentDistance(a,i,c),d.pointToSegmentDistance(r,i,c)),g=Math.min(d.pointToSegmentDistance(i,a,r),d.pointToSegmentDistance(c,a,r));return Math.min(m,g)}function Jr(a,r,i,c,d){if(!ol(r,a.length)||!ol(c,i.length))return NaN;let m=1/0;for(let g=r[0];g<r[1];++g)for(let v=c[0];v<c[1];++v){if(Ah(a[g],a[g+1],i[v],i[v+1]))return 0;m=Math.min(m,Sc(a[g],a[g+1],i[v],i[v+1],d))}return m}function ES(a,r,i,c,d){if(!ol(r,a.length)||!ol(c,i.length))return NaN;let m=1/0;for(let g=r[0];g<=r[1];++g)for(let v=c[0];v<=c[1];++v)if((m=Math.min(m,d.distance(a[g],i[v])))===0)return m;return m}function kS(a,r,i){if(Xu(a,r,!0))return 0;let c=1/0;for(const d of r){const m=d.length;if(m<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(d[0]!==d[m-1]&&(c=Math.min(c,i.pointToSegmentDistance(a,d[m-1],d[0])))===0||(c=Math.min(c,J0(a,d,i)))===0)return c}return c}function AS(a,r,i,c){if(!ol(r,a.length))return NaN;for(let m=r[0];m<=r[1];++m)if(Xu(a[m],i,!0))return 0;let d=1/0;for(let m=r[0];m<r[1];++m)for(const g of i)for(let v=0,S=g.length,E=S-1;v<S;E=v++){if(Ah(a[m],a[m+1],g[E],g[v]))return 0;d=Math.min(d,Sc(a[m],a[m+1],g[E],g[v],c))}return d}function T_(a,r){for(const i of a)for(let c=0;c<=i.length-1;++c)if(Xu(i[c],r,!0))return!0;return!1}function CS(a,r,i,c=1/0){const d=au(a),m=au(r);if(c!==1/0&&bc(d,m,i)>=c)return c;if(Eh(d,m)){if(T_(a,r))return 0}else if(T_(r,a))return 0;let g=c;for(const v of a)for(let S=0,E=v.length,C=E-1;S<E;C=S++)for(const I of r)for(let R=0,L=I.length,z=L-1;R<L;z=R++){if(Ah(v[C],v[S],I[z],I[R]))return 0;g=Math.min(g,Sc(v[C],v[S],I[z],I[R],i))}return g}function Qn(a,r,i,c,d,m,g){if(m===null||g===null)return;const v=bc(ou(c,m),ou(d,g),i);v<r&&a.push({dist:v,range1:m,range2:g})}function IS(a,r,i,c,d=1/0){let m=Math.min(c.distance(a[0],i[0][0]),d);if(m===0)return m;const g=new pp([{dist:0,range1:[0,a.length-1],range2:[0,0]}],x_),v=r?gp:mp,S=au(i);for(;g.length;){const E=g.pop();if(E.dist>=m)continue;const C=E.range1;if(Ih(C)<=v){if(!ol(C,a.length))return NaN;if(r){const I=AS(a,C,i,c);if((m=Math.min(m,I))===0)return m}else for(let I=C[0];I<=C[1];++I){const R=kS(a[I],i,c);if((m=Math.min(m,R))===0)return m}}else{const I=b_(C,r);if(I[0]!==null){const R=bc(ou(a,I[0]),S,c);R<m&&g.push({dist:R,range1:I[0],range2:[0,0]})}if(I[1]!==null){const R=bc(ou(a,I[1]),S,c);R<m&&g.push({dist:R,range1:I[1],range2:[0,0]})}}}return m}function Q0(a,r,i,c,d,m=1/0){let g=Math.min(m,d.distance(a[0],i[0]));if(g===0)return g;const v=new pp([{dist:0,range1:[0,a.length-1],range2:[0,i.length-1]}],x_),S=r?gp:mp,E=c?gp:mp;for(;v.length;){const C=v.pop();if(C.dist>=g)continue;const I=C.range1,R=C.range2;if(Ih(I)<=S&&Ih(R)<=E){if(!ol(I,a.length)||!ol(R,i.length))return NaN;if(r&&c?g=Math.min(g,Jr(a,I,i,R,d)):r||c?r&&!c?g=Math.min(g,S_(i,R,a,I,d)):!r&&c&&(g=Math.min(g,S_(a,I,i,R,d))):g=Math.min(g,ES(a,I,i,R,d)),g===0)return g}else{const L=b_(I,r),z=b_(R,c);Qn(v,g,d,a,i,L[0],z[0]),Qn(v,g,d,a,i,L[0],z[1]),Qn(v,g,d,a,i,L[1],z[0]),Qn(v,g,d,a,i,L[1],z[1])}}return g}function E_(a,r,i,c,d=1/0){let m=d;const g=ou(a,[0,a.length-1]);for(const v of i)if(!(m!==1/0&&bc(g,ou(v,[0,v.length-1]),c)>=m)&&(m=Math.min(m,Q0(a,r,v,!0,c,m)),m===0))return m;return m}function vp(a,r,i,c,d=1/0){let m=d;const g=ou(a,[0,a.length-1]);for(const v of i){if(m!==1/0&&bc(g,au(v),c)>=m)continue;const S=IS(a,r,v,c,m);if(isNaN(S))return S;if((m=Math.min(m,S))===0)return m}return m}function k_(a){return a==="Point"||a==="MultiPoint"||a==="LineString"||a==="MultiLineString"||a==="Polygon"||a==="MultiPolygon"}class lu{constructor(r,i){this.type=Qt,this.geojson=r,this.geometries=i}static parse(r,i){if(r.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${r.length-1} instead.`);if(Ku(r[1])){const c=r[1];if(c.type==="FeatureCollection"){for(let d=0;d<c.features.length;++d)if(k_(c.features[d].geometry.type))return new lu(c,c.features[d].geometry)}else if(c.type==="Feature"){if(k_(c.geometry.type))return new lu(c,c.geometry)}else if(k_(c.type))return new lu(c,c)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(r){const i=r.geometry(),c=r.canonicalID();if(i!=null&&c!=null){if(r.geometryType()==="Point")return function(d,m,g){const v=[];for(const E of d)for(const C of E)v.push(yp(C,m));const S=new Ju(v[0][1],"meters");return g.type==="Point"||g.type==="MultiPoint"||g.type==="LineString"?Q0(v,!1,g.type==="Point"?[g.coordinates]:g.coordinates,g.type==="LineString",S):g.type==="MultiLineString"?E_(v,!1,g.coordinates,S):g.type==="Polygon"||g.type==="MultiPolygon"?vp(v,!1,g.type==="Polygon"?[g.coordinates]:g.coordinates,S):null}(i,c,this.geometries);if(r.geometryType()==="LineString")return function(d,m,g){const v=[];for(const E of d){const C=[];for(const I of E)C.push(yp(I,m));v.push(C)}const S=new Ju(v[0][0][1],"meters");if(g.type==="Point"||g.type==="MultiPoint"||g.type==="LineString")return E_(g.type==="Point"?[g.coordinates]:g.coordinates,g.type==="LineString",v,S);if(g.type==="MultiLineString"){let E=1/0;for(let C=0;C<g.coordinates.length;C++){const I=E_(g.coordinates[C],!0,v,S,E);if(isNaN(I))return I;if((E=Math.min(E,I))===0)return E}return E}if(g.type==="Polygon"||g.type==="MultiPolygon"){let E=1/0;for(let C=0;C<v.length;C++){const I=vp(v[C],!0,g.type==="Polygon"?[g.coordinates]:g.coordinates,S,E);if(isNaN(I))return I;if((E=Math.min(E,I))===0)return E}return E}return null}(i,c,this.geometries);if(r.geometryType()==="Polygon")return function(d,m,g){const v=[];for(const E of function(C,I){const R=C.length;if(R<=1)return[C];const L=[];let z,U;for(let q=0;q<R;q++){const W=yc(C[q]);W!==0&&(C[q].area=Math.abs(W),U===void 0&&(U=W<0),U===W<0?(z&&L.push(z),z=[C[q]]):z.push(C[q]))}return z&&L.push(z),L}(d)){const C=[];for(let I=0;I<E.length;++I)C.push(TS(E[I],m));v.push(C)}const S=new Ju(v[0][0][0][1],"meters");if(g.type==="Point"||g.type==="MultiPoint"||g.type==="LineString")return vp(g.type==="Point"?[g.coordinates]:g.coordinates,g.type==="LineString",v,S);if(g.type==="MultiLineString"){let E=1/0;for(let C=0;C<g.coordinates.length;C++){const I=vp(g.coordinates[C],!0,v,S,E);if(isNaN(I))return I;if((E=Math.min(E,I))===0)return E}return E}return g.type==="Polygon"||g.type==="MultiPolygon"?function(E,C,I){let R=1/0;for(const L of E)for(const z of C){const U=CS(L,z,I,R);if(isNaN(U))return U;if((R=Math.min(R,U))===0)return R}return R}(g.type==="Polygon"?[g.coordinates]:g.coordinates,v,S):null}(i,c,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Qu(a){if(a instanceof co&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof wc||a instanceof lu)return!1;if(a instanceof td)return a.featureConstant;let r=!0;return a.eachChild(i=>{r&&!Qu(i)&&(r=!1)}),r}function Ph(a){if(a instanceof co&&a.name==="feature-state")return!1;let r=!0;return a.eachChild(i=>{r&&!Ph(i)&&(r=!1)}),r}function ed(a,r){if(a instanceof co&&r.indexOf(a.name)>=0)return!1;let i=!0;return a.eachChild(c=>{i&&!ed(c,r)&&(i=!1)}),i}function ex(a,r,i){return[a,r,i].filter(Boolean).join("")}function A_(a,r){switch(a){case"string":return pa(r);case"number":return+r;case"boolean":return!!r;case"color":return wn.parse(r);case"formatted":return ao.fromString(pa(r));case"resolvedImage":return lo.build(pa(r))}return r}function tx(a,r,i,c){return c!==void 0&&(a=c*Math.round(a/c)),r!==void 0&&a<r&&(a=r),i!==void 0&&a>i&&(a=i),a}class td{constructor(r,i,c,d=!1){this.type=r,this.key=i,this.scope=c,this.featureConstant=d}static parse(r,i){let c=i.expectedType;if(c==null&&(c=vn),r.length<2||r.length>3)return i.error("Invalid number of arguments for 'config' expression.");const d=i.parse(r[1],1);if(!(d instanceof Al))return i.error("Key name of 'config' expression must be a string literal.");let m,g=!0;const v=pa(d.value);if(r.length>=3){const S=i.parse(r[2],2);if(!(S instanceof Al))return i.error("Scope of 'config' expression must be a string literal.");m=pa(S.value)}if(i.options){const S=ex(v,m,i._scope),E=i.options.get(S);E&&(g=Qu(E.value||E.default))}return new td(c,v,m,g)}evaluate(r){const i=ex(this.key,this.scope,r.scope),c=r.getConfig(i);if(!c)return null;const{type:d,value:m,values:g,minValue:v,maxValue:S,stepValue:E}=c,C=c.default.evaluate(r);let I=C;if(m){const R=r.scope;r.scope=(R||"").split("").slice(1).join(""),I=m.evaluate(r),r.scope=R}return d&&(I=A_(d,I)),I===void 0||v===void 0&&S===void 0&&E===void 0||(typeof I=="number"?I=tx(I,v,S,E):Array.isArray(I)&&(I=I.map(R=>typeof R=="number"?tx(R,v,S,E):R))),m!==void 0&&I!==void 0&&g&&!g.includes(I)&&(I=C,d&&(I=A_(d,I))),(d&&d!==this.type||I!==void 0&&!sp(is(I),this.type))&&(I=A_(this.type.kind,I)),I}eachChild(){}outputDefined(){return!1}serialize(){const r=["config",this.key];return this.scope&&r.concat(this.scope),r}}class xp{constructor(r,i){this.type=i.type,this.name=r,this.boundExpression=i}static parse(r,i){if(r.length!==2||typeof r[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const c=r[1];return i.scope.has(c)?new xp(c,i.scope.get(c)):i.error(`Unknown variable "${c}". Make sure "${c}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(r){return this.boundExpression.evaluate(r)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class wp{constructor(r,i=[],c,d=new qu,m=[],g,v,S){this.registry=r,this.path=i,this.key=i.map(E=>typeof E=="string"?`['${E}']`:`[${E}]`).join(""),this.scope=d,this.errors=m,this.expectedType=c,this._scope=g,this.options=v,this.iconImageUseTheme=S}parse(r,i,c,d,m={}){return i||c?this.concat(i,null,c,d)._parse(r,m):this._parse(r,m)}parseObjectValue(r,i,c,d,m,g={}){return this.concat(i,c,d,m)._parse(r,g)}_parse(r,i){function c(d,m,g){return g==="assert"?new Da(m,[d]):g==="coerce"?new sl(m,[d]):d}if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"||(r=["literal",r]),Array.isArray(r)){if(r.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const d=typeof r[0]=="string"?this.registry[r[0]]:void 0;if(d){let m=d.parse(r,this);if(!m)return null;if(this.expectedType){const g=this.expectedType,v=m.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||v.kind!=="value")if(g.kind!=="color"&&g.kind!=="formatted"&&g.kind!=="resolvedImage"||v.kind!=="value"&&v.kind!=="string"){if(this.checkSubtype(g,v))return null}else m=c(m,g,i.typeAnnotation||"coerce");else m=c(m,g,i.typeAnnotation||"assert")}if(!(m instanceof Al)&&m.type.kind!=="resolvedImage"&&C_(m)){const g=new cp(this._scope,this.options,this.iconImageUseTheme);try{m=new Al(m.type,m.evaluate(g))}catch(v){return this.error(v.message),null}}return m}return sl.parse(["to-array",r],this)}return this.error(r===void 0?"'undefined' value invalid. Use null instead.":typeof r=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof r} instead.`)}concat(r,i,c,d){let m=typeof r=="number"?this.path.concat(r):this.path;m=typeof i=="string"?m.concat(i):m;const g=d?this.scope.concat(d):this.scope;return new wp(this.registry,m,c||null,g,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(r,...i){const c=`${this.key}${i.map(d=>`[${d}]`).join("")}`;this.errors.push(new fa(c,r))}checkSubtype(r,i){const c=_c(r,i);return c&&this.error(c),c}}function C_(a){if(a instanceof xp)return C_(a.boundExpression);if(a instanceof co&&a.name==="error"||a instanceof ms||a instanceof wc||a instanceof lu||a instanceof td)return!1;const r=a instanceof sl||a instanceof Da;let i=!0;return a.eachChild(c=>{i=r?i&&C_(c):i&&c instanceof Al}),!!i&&Qu(a)&&ed(a,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function bp(a,r){const i=a.length-1;let c,d,m=0,g=i,v=0;for(;m<=g;)if(v=Math.floor((m+g)/2),c=a[v],d=a[v+1],c<=r){if(v===i||r<d)return v;m=v+1}else{if(!(c>r))throw new Xi("Input is not a number.");g=v-1}return 0}class Mh{constructor(r,i,c){this.type=r,this.input=i,this.labels=[],this.outputs=[];for(const[d,m]of c)this.labels.push(d),this.outputs.push(m)}static parse(r,i){if(r.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return i.error("Expected an even number of arguments.");const c=i.parse(r[1],1,Qt);if(!c)return null;const d=[];let m=null;i.expectedType&&i.expectedType.kind!=="value"&&(m=i.expectedType);for(let g=1;g<r.length;g+=2){const v=g===1?-1/0:r[g],S=r[g+1],E=g,C=g+1;if(typeof v!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(d.length&&d[d.length-1][0]>=v)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',E);const I=i.parse(S,C,m);if(!I)return null;m=m||I.type,d.push([v,I])}return new Mh(m,c,d)}evaluate(r){const i=this.labels,c=this.outputs;if(i.length===1)return c[0].evaluate(r);const d=this.input.evaluate(r);if(d<=i[0])return c[0].evaluate(r);const m=i.length;return d>=i[m-1]?c[m-1].evaluate(r):c[bp(i,d)].evaluate(r)}eachChild(r){r(this.input);for(const i of this.outputs)r(i)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){const r=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&r.push(this.labels[i]),r.push(this.outputs[i].serialize());return r}}const rx=.95047,nx=1.08883,ix=4/29,rd=6/29,sx=3*rd*rd,PS=rd*rd*rd,MS=Math.PI/180,RS=180/Math.PI;function I_(a){return a>PS?Math.pow(a,1/3):a/sx+ix}function P_(a){return a>rd?a*a*a:sx*(a-ix)}function M_(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function R_(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function ox(a){const r=R_(a.r),i=R_(a.g),c=R_(a.b),d=I_((.4124564*r+.3575761*i+.1804375*c)/rx),m=I_((.2126729*r+.7151522*i+.072175*c)/1);return{l:116*m-16,a:500*(d-m),b:200*(m-I_((.0193339*r+.119192*i+.9503041*c)/nx)),alpha:a.a}}function Sp(a){let r=(a.l+16)/116,i=isNaN(a.a)?r:r+a.a/500,c=isNaN(a.b)?r:r-a.b/200;return r=1*P_(r),i=rx*P_(i),c=nx*P_(c),new wn(M_(3.2404542*i-1.5371385*r-.4985314*c),M_(-.969266*i+1.8760108*r+.041556*c),M_(.0556434*i-.2040259*r+1.0572252*c),a.alpha)}function Tp(a,r,i){const c=r-a;return a+i*(c>180||c<-180?c-360*Math.round(c/360):c)}const nd={forward:ox,reverse:Sp,interpolate:function(a,r,i){return{l:ur(a.l,r.l,i),a:ur(a.a,r.a,i),b:ur(a.b,r.b,i),alpha:ur(a.alpha,r.alpha,i)}}},Rh={forward:function(a){const{l:r,a:i,b:c}=ox(a),d=Math.atan2(c,i)*RS;return{h:d<0?d+360:d,c:Math.sqrt(i*i+c*c),l:r,alpha:a.a}},reverse:function(a){const r=a.h*MS,i=a.c;return Sp({l:a.l,a:Math.cos(r)*i,b:Math.sin(r)*i,alpha:a.alpha})},interpolate:function(a,r,i){return{h:Tp(a.h,r.h,i),c:ur(a.c,r.c,i),l:ur(a.l,r.l,i),alpha:ur(a.alpha,r.alpha,i)}}};var ax=Object.freeze({__proto__:null,hcl:Rh,lab:nd});class Xo{constructor(r,i,c,d,m){this.type=r,this.operator=i,this.interpolation=c,this.input=d,this.labels=[],this.outputs=[];for(const[g,v]of m)this.labels.push(g),this.outputs.push(v)}static interpolationFactor(r,i,c,d){let m=0;if(r.name==="exponential")m=Ep(i,r.base,c,d);else if(r.name==="linear")m=Ep(i,1,c,d);else if(r.name==="cubic-bezier"){const g=r.controlPoints;m=new Bs(g[0],g[1],g[2],g[3]).solve(Ep(i,1,c,d))}return m}static parse(r,i){let[c,d,m,...g]=r;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 E=d[1];if(typeof E!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);d={name:"exponential",base:E}}else{if(d[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(d[0])}`,1,0);{const E=d.slice(1);if(E.length!==4||E.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:E}}}if(r.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length-1>3&&(r.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(m=i.parse(m,2,Qt),!m)return null;const v=[];let S=null;c==="interpolate-hcl"||c==="interpolate-lab"?S=bo:i.expectedType&&i.expectedType.kind!=="value"&&(S=i.expectedType);for(let E=0;E<g.length;E+=2){const C=g[E],I=g[E+1],R=E+3,L=E+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.',R);if(v.length&&v[v.length-1][0]>=C)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',R);const z=i.parse(I,L,S);if(!z)return null;S=S||z.type,v.push([C,z])}return S.kind==="number"||S.kind==="color"||S.kind==="array"&&S.itemType.kind==="number"&&typeof S.N=="number"?new Xo(S,c,d,m,v):i.error(`Type ${Ri(S)} is not interpolatable.`)}evaluate(r){const i=this.labels,c=this.outputs;if(i.length===1)return c[0].evaluate(r);const d=this.input.evaluate(r);if(d<=i[0])return c[0].evaluate(r);const m=i.length;if(d>=i[m-1])return c[m-1].evaluate(r);const g=bp(i,d),v=Xo.interpolationFactor(this.interpolation,d,i[g],i[g+1]),S=c[g].evaluate(r),E=c[g+1].evaluate(r);return this.operator==="interpolate"?wh[this.type.kind.toLowerCase()](S,E,v):this.operator==="interpolate-hcl"?Rh.reverse(Rh.interpolate(Rh.forward(S),Rh.forward(E),v)):nd.reverse(nd.interpolate(nd.forward(S),nd.forward(E),v))}eachChild(r){r(this.input);for(const i of this.outputs)r(i)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){let r;r=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,r,this.input.serialize()];for(let c=0;c<this.labels.length;c++)i.push(this.labels[c],this.outputs[c].serialize());return i}}function Ep(a,r,i,c){const d=c-i,m=a-i;return d===0?0:r===1?m/d:(Math.pow(r,m)-1)/(Math.pow(r,d)-1)}class Dh{constructor(r,i){this.type=r,this.args=i}static parse(r,i){if(r.length<2)return i.error("Expectected at least one argument.");let c=null;const d=i.expectedType;d&&d.kind!=="value"&&(c=d);const m=[];for(const v of r.slice(1)){const S=i.parse(v,1+m.length,c,void 0,{typeAnnotation:"omit"});if(!S)return null;c=c||S.type,m.push(S)}const g=d&&m.some(v=>_c(d,v.type));return new Dh(g?vn:c,m)}evaluate(r){let i,c=null,d=0;for(const m of this.args){if(d++,c=m.evaluate(r),c&&c instanceof lo&&!c.available&&(i||(i=c),c=null,d===this.args.length))return i;if(c!==null)break}return c}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){const r=["coalesce"];return this.eachChild(i=>{r.push(i.serialize())}),r}}class Il{constructor(r,i){this.type=i.type,this.bindings=[].concat(r),this.result=i}evaluate(r){return this.result.evaluate(r)}eachChild(r){for(const i of this.bindings)r(i[1]);r(this.result)}static parse(r,i){if(r.length<4)return i.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);const c=[];for(let m=1;m<r.length-1;m+=2){const g=r[m];if(typeof g!="string")return i.error(`Expected string, but found ${typeof g} instead.`,m);if(/[^a-zA-Z0-9_]/.test(g))return i.error("Variable names must contain only alphanumeric characters or '_'.",m);const v=i.parse(r[m+1],m+1);if(!v)return null;c.push([g,v])}const d=i.parse(r[r.length-1],r.length-1,i.expectedType,c);return d?new Il(c,d):null}outputDefined(){return this.result.outputDefined()}serialize(){const r=["let"];for(const[i,c]of this.bindings)r.push(i,c.serialize());return r.push(this.result.serialize()),r}}class kp{constructor(r,i,c){this.type=r,this.index=i,this.input=c}static parse(r,i){if(r.length!==3)return i.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=i.parse(r[1],1,Qt),d=i.parse(r[2],2,js(i.expectedType||vn));return c&&d?new kp(d.type.itemType,c,d):null}evaluate(r){const i=this.index.evaluate(r),c=this.input.evaluate(r);if(i<0)throw new Xi("Array index out of bounds: negative index");if(i>=c.length)throw new Xi("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new Xi("Array index must be an integer. Use at-interpolated for fractional indices");return c[i]}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Ap{constructor(r,i,c){this.type=r,this.index=i,this.input=c}static parse(r,i){if(r.length!==3)return i.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=i.parse(r[1],1,Qt),d=i.parse(r[2],2,js(i.expectedType||vn));return c&&d?new Ap(d.type.itemType,c,d):null}evaluate(r){const i=this.index.evaluate(r),c=this.input.evaluate(r);if(i<0)throw new Xi(`Array index out of bounds: ${i} < 0.`);if(i>c.length-1)throw new Xi(`Array index out of bounds: ${i} > ${c.length-1}.`);if(i===Math.floor(i))return c[i];const d=Math.floor(i),m=Math.ceil(i),g=c[d],v=c[m];if(typeof g!="number"||typeof v!="number")throw new Xi(`Cannot interpolate between non-number values at index ${i}.`);const S=i-d;return g*(1-S)+v*S}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class D_{constructor(r,i){this.type=kn,this.needle=r,this.haystack=i}static parse(r,i){if(r.length!==3)return i.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=i.parse(r[1],1,vn),d=i.parse(r[2],2,vn);return c&&d?h_(c.type,[kn,Xr,Qt,Ra,vn])?new D_(c,d):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ri(c.type)} instead`):null}evaluate(r){const i=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(c==null)return!1;if(!Th(i,["boolean","string","number","null"]))throw new Xi(`Expected first argument to be of type boolean, string, number or null, but found ${Ri(is(i))} instead.`);if(!Th(c,["string","array"]))throw new Xi(`Expected second argument to be of type array or string, but found ${Ri(is(c))} instead.`);return c.indexOf(i)>=0}eachChild(r){r(this.needle),r(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class id{constructor(r,i,c){this.type=Qt,this.needle=r,this.haystack=i,this.fromIndex=c}static parse(r,i){if(r.length<=2||r.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=i.parse(r[1],1,vn),d=i.parse(r[2],2,vn);if(!c||!d)return null;if(!h_(c.type,[kn,Xr,Qt,Ra,vn]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ri(c.type)} instead`);if(r.length===4){const m=i.parse(r[3],3,Qt);return m?new id(c,d,m):null}return new id(c,d)}evaluate(r){const i=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(!Th(i,["boolean","string","number","null"]))throw new Xi(`Expected first argument to be of type boolean, string, number or null, but found ${Ri(is(i))} instead.`);if(!Th(c,["string","array"]))throw new Xi(`Expected second argument to be of type array or string, but found ${Ri(is(c))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(r);return c.indexOf(i,d)}return c.indexOf(i)}eachChild(r){r(this.needle),r(this.haystack),this.fromIndex&&r(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const r=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),r]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Lh{constructor(r,i,c,d,m,g){this.inputType=r,this.type=i,this.input=c,this.cases=d,this.outputs=m,this.otherwise=g}static parse(r,i){if(r.length<5)return i.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return i.error("Expected an even number of arguments.");let c,d;i.expectedType&&i.expectedType.kind!=="value"&&(d=i.expectedType);const m={},g=[];for(let E=2;E<r.length-1;E+=2){let C=r[E];const I=r[E+1];Array.isArray(C)||(C=[C]);const R=i.concat(E);if(C.length===0)return R.error("Expected at least one branch label.");for(const z of C){if(typeof z!="number"&&typeof z!="string")return R.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return R.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return R.error("Numeric branch labels must be integer values.");if(c){if(R.checkSubtype(c,is(z)))return null}else c=is(z);if(m[String(z)]!==void 0)return R.error("Branch labels must be unique.");m[String(z)]=g.length}const L=i.parse(I,E,d);if(!L)return null;d=d||L.type,g.push(L)}const v=i.parse(r[1],1,vn);if(!v)return null;const S=i.parse(r[r.length-1],r.length-1,d);return S?v.type.kind!=="value"&&i.concat(1).checkSubtype(c,v.type)?null:new Lh(c,d,v,m,g,S):null}evaluate(r){const i=this.input.evaluate(r);return(sp(is(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(r)}eachChild(r){r(this.input),this.outputs.forEach(r),r(this.otherwise)}outputDefined(){return this.outputs.every(r=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),c=[],d={};for(const g of i){const v=d[this.cases[g]];v===void 0?(d[this.cases[g]]=c.length,c.push([this.cases[g],[g]])):c[v][1].push(g)}const m=g=>this.inputType.kind==="number"?Number(g):g;for(const[g,v]of c)r.push(v.length===1?m(v[0]):v.map(m)),r.push(this.outputs[g].serialize());return r.push(this.otherwise.serialize()),r}}class Oh{constructor(r,i,c){this.type=r,this.branches=i,this.otherwise=c}static parse(r,i){if(r.length<4)return i.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return i.error("Expected an odd number of arguments.");let c;i.expectedType&&i.expectedType.kind!=="value"&&(c=i.expectedType);const d=[];for(let g=1;g<r.length-1;g+=2){const v=i.parse(r[g],g,kn);if(!v)return null;const S=i.parse(r[g+1],g+1,c);if(!S)return null;d.push([v,S]),c=c||S.type}const m=i.parse(r[r.length-1],r.length-1,c);return m?new Oh(c,d,m):null}evaluate(r){for(const[i,c]of this.branches)if(i.evaluate(r))return c.evaluate(r);return this.otherwise.evaluate(r)}eachChild(r){for(const[i,c]of this.branches)r(i),r(c);r(this.otherwise)}outputDefined(){return this.branches.every(([r,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["case"];return this.eachChild(i=>{r.push(i.serialize())}),r}}class Cp{constructor(r,i,c,d){this.type=r,this.input=i,this.beginIndex=c,this.endIndex=d}static parse(r,i){if(r.length<=2||r.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=i.parse(r[1],1,vn),d=i.parse(r[2],2,Qt);if(!c||!d)return null;if(!h_(c.type,[js(vn),Xr,vn]))return i.error(`Expected first argument to be of type array or string, but found ${Ri(c.type)} instead`);if(r.length===4){const m=i.parse(r[3],3,Qt);return m?new Cp(c.type,c,d,m):null}return new Cp(c.type,c,d)}evaluate(r){const i=this.input.evaluate(r),c=this.beginIndex.evaluate(r);if(!Th(i,["string","array"]))throw new Xi(`Expected first argument to be of type array or string, but found ${Ri(is(i))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(r);return i.slice(c,d)}return i.slice(c)}eachChild(r){r(this.input),r(this.beginIndex),this.endIndex&&r(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const r=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),r]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class L_{constructor(r,i){this.type=js(Xr),this.str=r,this.delimiter=i}static parse(r,i){if(r.length!==3)return i.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=i.parse(r[1],1,Xr),d=i.parse(r[2],2,Xr);return c&&d?new L_(c,d):void 0}evaluate(r){const i=this.str.evaluate(r),c=this.delimiter.evaluate(r);return i.split(c)}eachChild(r){r(this.str),r(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function O_(a,r){return a==="=="||a==="!="?r.kind==="boolean"||r.kind==="string"||r.kind==="number"||r.kind==="null"||r.kind==="value":r.kind==="string"||r.kind==="number"||r.kind==="value"}function z_(a,r,i,c){return c.compare(r,i)===0}function sd(a,r,i){const c=a!=="=="&&a!=="!=";return class y4{constructor(m,g,v){this.type=kn,this.lhs=m,this.rhs=g,this.collator=v,this.hasUntypedArgument=m.type.kind==="value"||g.type.kind==="value"}static parse(m,g){if(m.length!==3&&m.length!==4)return g.error("Expected two or three arguments.");const v=m[0];let S=g.parse(m[1],1,vn);if(!S)return null;if(!O_(v,S.type))return g.concat(1).error(`"${v}" comparisons are not supported for type '${Ri(S.type)}'.`);let E=g.parse(m[2],2,vn);if(!E)return null;if(!O_(v,E.type))return g.concat(2).error(`"${v}" comparisons are not supported for type '${Ri(E.type)}'.`);if(S.type.kind!==E.type.kind&&S.type.kind!=="value"&&E.type.kind!=="value")return g.error(`Cannot compare types '${Ri(S.type)}' and '${Ri(E.type)}'.`);c&&(S.type.kind==="value"&&E.type.kind!=="value"?S=new Da(E.type,[S]):S.type.kind!=="value"&&E.type.kind==="value"&&(E=new Da(S.type,[E])));let C=null;if(m.length===4){if(S.type.kind!=="string"&&E.type.kind!=="string"&&S.type.kind!=="value"&&E.type.kind!=="value")return g.error("Cannot use collator to compare non-string types.");if(C=g.parse(m[3],3,ip),!C)return null}return new y4(S,E,C)}evaluate(m){const g=this.lhs.evaluate(m),v=this.rhs.evaluate(m);if(c&&this.hasUntypedArgument){const S=is(g),E=is(v);if(S.kind!==E.kind||S.kind!=="string"&&S.kind!=="number")throw new Xi(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${S.kind}, ${E.kind}) instead.`)}if(this.collator&&!c&&this.hasUntypedArgument){const S=is(g),E=is(v);if(S.kind!=="string"||E.kind!=="string")return r(m,g,v)}return this.collator?i(m,g,v,this.collator.evaluate(m)):r(m,g,v)}eachChild(m){m(this.lhs),m(this.rhs),this.collator&&m(this.collator)}outputDefined(){return!0}serialize(){const m=[a];return this.eachChild(g=>{m.push(g.serialize())}),m}}}const DS=sd("==",function(a,r,i){return r===i},z_),LS=sd("!=",function(a,r,i){return r!==i},function(a,r,i,c){return!z_(0,r,i,c)}),lx=sd("<",function(a,r,i){return r<i},function(a,r,i,c){return c.compare(r,i)<0}),cx=sd(">",function(a,r,i){return r>i},function(a,r,i,c){return c.compare(r,i)>0}),Ip=sd("<=",function(a,r,i){return r<=i},function(a,r,i,c){return c.compare(r,i)<=0}),OS=sd(">=",function(a,r,i){return r>=i},function(a,r,i,c){return c.compare(r,i)>=0});class Pp{constructor(r,i,c,d,m,g){this.type=Xr,this.number=r,this.locale=i,this.currency=c,this.unit=d,this.minFractionDigits=m,this.maxFractionDigits=g}static parse(r,i){if(r.length!==3)return i.error("Expected two arguments.");const c=i.parse(r[1],1,Qt);if(!c)return null;const d=r[2];if(typeof d!="object"||Array.isArray(d))return i.error("NumberFormat options argument must be an object.");let m=null;if(d.locale&&(m=i.parseObjectValue(d.locale,2,"locale",Xr),!m))return null;let g=null;if(d.currency&&(g=i.parseObjectValue(d.currency,2,"currency",Xr),!g))return null;let v=null;if(d.unit&&(v=i.parseObjectValue(d.unit,2,"unit",Xr),!v))return null;let S=null;if(d["min-fraction-digits"]&&(S=i.parseObjectValue(d["min-fraction-digits"],2,"min-fraction-digits",Qt),!S))return null;let E=null;return d["max-fraction-digits"]&&(E=i.parseObjectValue(d["max-fraction-digits"],2,"max-fraction-digits",Qt),!E)?null:new Pp(c,m,g,v,S,E)}evaluate(r){return new Intl.NumberFormat(this.locale?this.locale.evaluate(r):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(r):void 0,unit:this.unit?this.unit.evaluate(r):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(r):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(r):void 0}).format(this.number.evaluate(r))}eachChild(r){r(this.number),this.locale&&r(this.locale),this.currency&&r(this.currency),this.unit&&r(this.unit),this.minFractionDigits&&r(this.minFractionDigits),this.maxFractionDigits&&r(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const r={};return this.locale&&(r.locale=this.locale.serialize()),this.currency&&(r.currency=this.currency.serialize()),this.unit&&(r.unit=this.unit.serialize()),this.minFractionDigits&&(r["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(r["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),r]}}class F_{constructor(r){this.type=Qt,this.input=r}static parse(r,i){if(r.length!==2)return i.error(`Expected 1 argument, but found ${r.length-1} instead.`);const c=i.parse(r[1],1);return c?c.type.kind!=="array"&&c.type.kind!=="string"&&c.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Ri(c.type)} instead.`):new F_(c):null}evaluate(r){const i=this.input.evaluate(r);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Xi(`Expected value to be of type string or array, but found ${Ri(is(i))} instead.`)}eachChild(r){r(this.input)}outputDefined(){return!1}serialize(){const r=["length"];return this.eachChild(i=>{r.push(i.serialize())}),r}}function ux(a){return function(){a=1831565813+(a|=0)|0;let r=Math.imul(a^a>>>15,1|a);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}const od={"==":DS,"!=":LS,">":cx,"<":lx,">=":OS,"<=":Ip,array:Da,at:kp,"at-interpolated":Ap,boolean:Da,case:Oh,coalesce:Dh,collator:ms,format:il,image:Er,in:D_,"index-of":id,interpolate:Xo,"interpolate-hcl":Xo,"interpolate-lab":Xo,length:F_,let:Il,literal:Al,match:Lh,number:Da,"number-format":Pp,object:Da,slice:Cp,step:Mh,string:Da,"to-boolean":sl,"to-color":sl,"to-number":sl,"to-string":sl,var:xp,within:wc,distance:lu,config:td,split:L_};function B_(a,[r,i,c,d]){r=r.evaluate(a),i=i.evaluate(a),c=c.evaluate(a);const m=d?d.evaluate(a):1,g=su(r,i,c,m);if(g)throw new Xi(g);return new wn(r/255,i/255,c/255,m)}function N_(a,[r,i,c,d]){r=r.evaluate(a),i=i.evaluate(a),c=c.evaluate(a);const m=d?d.evaluate(a):1,g=function(E,C,I,R){return typeof E=="number"&&E>=0&&E<=360?typeof C=="number"&&C>=0&&C<=100&&typeof I=="number"&&I>=0&&I<=100?R===void 0||typeof R=="number"&&R>=0&&R<=1?null:`Invalid hsla value [${[E,C,I,R].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof R=="number"?[E,C,I,R]:[E,C,I]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof R=="number"?[E,C,I,R]:[E,C,I]).join(", ")}]: 'h' must be between 0 and 360.`}(r,i,c,m);if(g)throw new Xi(g);const v=`hsla(${r}, ${i}%, ${c}%, ${m})`,S=wn.parse(v);if(!S)throw new Xi(`Failed to parse HSLA color: ${v}`);return S}function dx(a,r){return a in r}function j_(a,r){const i=r[a];return i===void 0?null:i}function Tc(a){return{type:a}}function cu(a){if(a instanceof td)return new Set([a.key]);let r=new Set;return a.eachChild(i=>{r=new Set([...r,...cu(i)])}),r}function Mp(a){if(a instanceof co&&a.name==="is-active-floor")return!0;let r=!1;return a.eachChild(i=>{!r&&Mp(i)&&(r=!0)}),r}function hx(a){return{result:"success",value:a}}function Ec(a){return{result:"error",value:a}}function V_(a,r){return!!a&&!!a.parameters&&a.parameters.indexOf(r)>-1}function zh(a){return a["property-type"]==="data-driven"}function fx(a){return V_(a.expression,"measure-light")}function px(a){return V_(a.expression,"zoom")}function Rp(a){return!!a.expression&&a.expression.interpolated}function Dp(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function mx(a){return a}function gx(a,r){const i=r.type==="color",c=a.stops&&typeof a.stops[0][0]=="object",d=c||!(c||a.property!==void 0),m=a.type||(Rp(r)?"exponential":"interval");if(i&&((a=Object.assign({},a)).stops&&(a.stops=a.stops.map(E=>[E[0],wn.parse(E[1])])),a.default=wn.parse(a.default?a.default:r.default)),a.colorSpace&&a.colorSpace!=="rgb"&&!ax[a.colorSpace])throw new Error(`Unknown color space: ${a.colorSpace}`);let g,v,S;if(m==="exponential")g=_x;else if(m==="interval")g=FS;else if(m==="categorical"){g=zS,v=Object.create(null);for(const E of a.stops)v[E[0]]=E[1];S=typeof a.stops[0][0]}else{if(m!=="identity")throw new Error(`Unknown function type "${m}"`);g=yx}if(c){const E={},C=[];for(let L=0;L<a.stops.length;L++){const z=a.stops[L],U=z[0].zoom;E[U]===void 0&&(E[U]={zoom:U,type:a.type,property:a.property,default:a.default,stops:[]},C.push(U)),E[U].stops.push([z[0].value,z[1]])}const I=[];for(const L of C)I.push([E[L].zoom,gx(E[L],r)]);const R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:Xo.interpolationFactor.bind(void 0,R),zoomStops:I.map(L=>L[0]),evaluate:({zoom:L},z)=>_x({stops:I,base:a.base},r,L).evaluate(L,z)}}if(d){const E=m==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:Xo.interpolationFactor.bind(void 0,E),zoomStops:a.stops.map(C=>C[0]),evaluate:({zoom:C})=>g(a,r,C,v,S)}}return{kind:"source",evaluate(E,C){const I=C&&C.properties?C.properties[a.property]:void 0;return I===void 0?al(a.default,r.default):g(a,r,I,v,S)}}}function al(a,r,i){return a!==void 0?a:r!==void 0?r:i!==void 0?i:void 0}function zS(a,r,i,c,d){return al(typeof i===d?c[i]:void 0,a.default,r.default)}function FS(a,r,i){if(!Zu(i))return al(a.default,r.default);const c=a.stops.length;if(c===1||i<=a.stops[0][0])return a.stops[0][1];if(i>=a.stops[c-1][0])return a.stops[c-1][1];const d=bp(a.stops.map(m=>m[0]),i);return a.stops[d][1]}function _x(a,r,i){const c=a.base!==void 0?a.base:1;if(!Zu(i))return al(a.default,r.default);const d=a.stops.length;if(d===1||i<=a.stops[0][0])return a.stops[0][1];if(i>=a.stops[d-1][0])return a.stops[d-1][1];const m=bp(a.stops.map(C=>C[0]),i),g=function(C,I,R,L){const z=L-R,U=C-R;return z===0?0:I===1?U/z:(Math.pow(I,U)-1)/(Math.pow(I,z)-1)}(i,c,a.stops[m][0],a.stops[m+1][0]),v=a.stops[m][1],S=a.stops[m+1][1];let E=wh[r.type]||mx;if(a.colorSpace&&a.colorSpace!=="rgb"){const C=ax[a.colorSpace];E=(I,R)=>C.reverse(C.interpolate(C.forward(I),C.forward(R),g))}return typeof v.evaluate=="function"?{evaluate(...C){const I=v.evaluate.apply(void 0,C),R=S.evaluate.apply(void 0,C);if(I!==void 0&&R!==void 0)return E(I,R,g)}}:E(v,S,g)}function yx(a,r,i){return r.type==="color"?i=wn.parse(i):r.type==="formatted"?i=ao.fromString(i.toString()):r.type==="resolvedImage"?i=lo.build(i.toString()):Xt(i)===r.type||r.type==="enum"&&r.values[i]||(i=void 0),al(i,a.default,r.default)}co.register(od,{error:[{kind:"error"},[Xr],(a,[r])=>{throw new Xi(r.evaluate(a))}],typeof:[Xr,[vn],(a,[r])=>Ri(is(r.evaluate(a)))],"to-rgba":[js(Qt,4),[bo],(a,[r])=>r.evaluate(a).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[js(Qt,4),[bo],(a,[r])=>r.evaluate(a).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[bo,[Qt,Qt,Qt],B_],rgba:[bo,[Qt,Qt,Qt,Qt],B_],hsl:[bo,[Qt,Qt,Qt],N_],hsla:[bo,[Qt,Qt,Qt,Qt],N_],has:{type:kn,overloads:[[[Xr],(a,[r])=>dx(r.evaluate(a),a.properties())],[[Xr,nl],(a,[r,i])=>dx(r.evaluate(a),i.evaluate(a))]]},get:{type:vn,overloads:[[[Xr],(a,[r])=>j_(r.evaluate(a),a.properties())],[[Xr,nl],(a,[r,i])=>j_(r.evaluate(a),i.evaluate(a))]]},"feature-state":[vn,[Xr],(a,[r])=>j_(r.evaluate(a),a.featureState||{})],properties:[nl,[],a=>a.properties()],"geometry-type":[Xr,[],a=>a.geometryType()],worldview:[Xr,[],a=>a.globals.worldview||""],"is-active-floor":[kn,Tc(Xr),(a,r)=>{if(!(a.globals.activeFloors&&a.globals.activeFloors.size>0))return!1;const i=a.globals.activeFloors;return r.some(c=>{const d=c.evaluate(a);return i.has(d)})}],id:[vn,[],a=>a.id()],zoom:[Qt,[],a=>a.globals.zoom],pitch:[Qt,[],a=>a.globals.pitch||0],"distance-from-center":[Qt,[],a=>a.distanceFromCenter()],"measure-light":[Qt,[Xr],(a,[r])=>a.measureLight(r.evaluate(a))],"heatmap-density":[Qt,[],a=>a.globals.heatmapDensity||0],"line-progress":[Qt,[],a=>a.globals.lineProgress||0],"raster-value":[Qt,[],a=>a.globals.rasterValue||0],"raster-particle-speed":[Qt,[],a=>a.globals.rasterParticleSpeed||0],"sky-radial-progress":[Qt,[],a=>a.globals.skyRadialProgress||0],accumulated:[vn,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[Qt,Tc(Qt),(a,r)=>{let i=0;for(const c of r)i+=c.evaluate(a);return i}],"*":[Qt,Tc(Qt),(a,r)=>{let i=1;for(const c of r)i*=c.evaluate(a);return i}],"-":{type:Qt,overloads:[[[Qt,Qt],(a,[r,i])=>r.evaluate(a)-i.evaluate(a)],[[Qt],(a,[r])=>-r.evaluate(a)]]},"/":[Qt,[Qt,Qt],(a,[r,i])=>r.evaluate(a)/i.evaluate(a)],"%":[Qt,[Qt,Qt],(a,[r,i])=>r.evaluate(a)%i.evaluate(a)],ln2:[Qt,[],()=>Math.LN2],pi:[Qt,[],()=>Math.PI],e:[Qt,[],()=>Math.E],"^":[Qt,[Qt,Qt],(a,[r,i])=>Math.pow(r.evaluate(a),i.evaluate(a))],sqrt:[Qt,[Qt],(a,[r])=>Math.sqrt(r.evaluate(a))],log10:[Qt,[Qt],(a,[r])=>Math.log(r.evaluate(a))/Math.LN10],ln:[Qt,[Qt],(a,[r])=>Math.log(r.evaluate(a))],log2:[Qt,[Qt],(a,[r])=>Math.log2(r.evaluate(a))],sin:[Qt,[Qt],(a,[r])=>Math.sin(r.evaluate(a))],cos:[Qt,[Qt],(a,[r])=>Math.cos(r.evaluate(a))],tan:[Qt,[Qt],(a,[r])=>Math.tan(r.evaluate(a))],asin:[Qt,[Qt],(a,[r])=>Math.asin(r.evaluate(a))],acos:[Qt,[Qt],(a,[r])=>Math.acos(r.evaluate(a))],atan:[Qt,[Qt],(a,[r])=>Math.atan(r.evaluate(a))],min:[Qt,Tc(Qt),(a,r)=>Math.min(...r.map(i=>i.evaluate(a)))],max:[Qt,Tc(Qt),(a,r)=>Math.max(...r.map(i=>i.evaluate(a)))],abs:[Qt,[Qt],(a,[r])=>Math.abs(r.evaluate(a))],round:[Qt,[Qt],(a,[r])=>{const i=r.evaluate(a);return i<0?-Math.round(-i):Math.round(i)}],floor:[Qt,[Qt],(a,[r])=>Math.floor(r.evaluate(a))],ceil:[Qt,[Qt],(a,[r])=>Math.ceil(r.evaluate(a))],"filter-==":[kn,[Xr,vn],(a,[r,i])=>a.properties()[r.value]===i.value],"filter-id-==":[kn,[vn],(a,[r])=>a.id()===r.value],"filter-type-==":[kn,[Xr],(a,[r])=>a.geometryType()===r.value],"filter-<":[kn,[Xr,vn],(a,[r,i])=>{const c=a.properties()[r.value],d=i.value;return typeof c==typeof d&&c<d}],"filter-id-<":[kn,[vn],(a,[r])=>{const i=a.id(),c=r.value;return typeof i==typeof c&&i<c}],"filter->":[kn,[Xr,vn],(a,[r,i])=>{const c=a.properties()[r.value],d=i.value;return typeof c==typeof d&&c>d}],"filter-id->":[kn,[vn],(a,[r])=>{const i=a.id(),c=r.value;return typeof i==typeof c&&i>c}],"filter-<=":[kn,[Xr,vn],(a,[r,i])=>{const c=a.properties()[r.value],d=i.value;return typeof c==typeof d&&c<=d}],"filter-id-<=":[kn,[vn],(a,[r])=>{const i=a.id(),c=r.value;return typeof i==typeof c&&i<=c}],"filter->=":[kn,[Xr,vn],(a,[r,i])=>{const c=a.properties()[r.value],d=i.value;return typeof c==typeof d&&c>=d}],"filter-id->=":[kn,[vn],(a,[r])=>{const i=a.id(),c=r.value;return typeof i==typeof c&&i>=c}],"filter-has":[kn,[vn],(a,[r])=>r.value in a.properties()],"filter-has-id":[kn,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[kn,[js(Xr)],(a,[r])=>r.value.indexOf(a.geometryType())>=0],"filter-id-in":[kn,[js(vn)],(a,[r])=>r.value.indexOf(a.id())>=0],"filter-in-small":[kn,[Xr,js(vn)],(a,[r,i])=>i.value.indexOf(a.properties()[r.value])>=0],"filter-in-large":[kn,[Xr,js(vn)],(a,[r,i])=>function(c,d,m,g){for(;m<=g;){const v=m+g>>1;if(d[v]===c)return!0;d[v]>c?g=v-1:m=v+1}return!1}(a.properties()[r.value],i.value,0,i.value.length-1)],all:{type:kn,overloads:[[[kn,kn],(a,[r,i])=>r.evaluate(a)&&i.evaluate(a)],[Tc(kn),(a,r)=>{for(const i of r)if(!i.evaluate(a))return!1;return!0}]]},any:{type:kn,overloads:[[[kn,kn],(a,[r,i])=>r.evaluate(a)||i.evaluate(a)],[Tc(kn),(a,r)=>{for(const i of r)if(i.evaluate(a))return!0;return!1}]]},"!":[kn,[kn],(a,[r])=>!r.evaluate(a)],"is-supported-script":[kn,[Xr],(a,[r])=>{const i=a.globals&&a.globals.isSupportedScript;return!i||i(r.evaluate(a))}],upcase:[Xr,[Xr],(a,[r])=>r.evaluate(a).toUpperCase()],downcase:[Xr,[Xr],(a,[r])=>r.evaluate(a).toLowerCase()],concat:[Xr,Tc(vn),(a,r)=>r.map(i=>pa(i.evaluate(a))).join("")],"resolved-locale":[Xr,[ip],(a,[r])=>r.evaluate(a).resolvedLocale()],random:[Qt,[Qt,Qt,vn],(a,r)=>{const[i,c,d]=r.map(g=>g.evaluate(a));if(i>c||i===c)return i;let m;if(typeof d=="string")m=function(g){let v=0;if(g.length===0)return v;for(let S=0;S<g.length;S++)v=(v<<5)-v+g.charCodeAt(S),v|=0;return v}(d);else{if(typeof d!="number")throw new Xi(`Invalid seed input: ${d}`);m=d}return i+ux(m)()*(c-i)}]});class Lp{constructor(r,i,c,d,m){this.expression=r,this._warningHistory={},this._scope=c,this._options=d,this._iconImageUseTheme=m,this._evaluator=new cp(c,d,m),this._defaultValue=i?function(g){return g.type==="color"&&(Dp(g.default)||Array.isArray(g.default))?new wn(0,0,0,0):g.type==="color"?wn.parse(g.default)||null:g.default===void 0?null:g.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=cu(r),this.isIndoorDependent=Mp(r)}evaluateWithoutErrorHandling(r,i,c,d,m,g,v,S){return this._evaluator.globals=r,this._evaluator.feature=i,this._evaluator.featureState=c,this._evaluator.canonical=d||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=g,this._evaluator.featureTileCoord=v||null,this._evaluator.featureDistanceData=S||null,this.expression.evaluate(this._evaluator)}evaluate(r,i,c,d,m,g,v,S,E){this._evaluator||(this._evaluator=new cp(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=r,this._evaluator.feature=i||null,this._evaluator.featureState=c||null,this._evaluator.canonical=d||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=g||null,this._evaluator.featureTileCoord=v||null,this._evaluator.featureDistanceData=S||null,this._evaluator.iconImageUseTheme=E||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 Xi(`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 Fh(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in od}function kc(a,r,i,c,d){const m=new wp(od,[],r?function(v){const S={color:bo,string:Xr,number:Qt,enum:Xr,boolean:kn,formatted:bh,resolvedImage:Sh};return v.type==="array"?js(S[v.value]||vn,v.length):S[v.type]}(r):void 0,void 0,void 0,i,c,d),g=m.parse(a,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return g?hx(new Lp(g,r,i,c,d)):Ec(m.errors)}class ad{constructor(r,i,c,d){this.kind=r,this._styleExpression=i,this.isLightConstant=c,this.isLineProgressConstant=d,this.isStateDependent=r!=="constant"&&!Ph(i.expression),this.configDependencies=cu(i.expression),this.isIndoorDependent=Mp(i.expression)}evaluateWithoutErrorHandling(r,i,c,d,m,g){return this._styleExpression.evaluateWithoutErrorHandling(r,i,c,d,m,g)}evaluate(r,i,c,d,m,g,v){return this._styleExpression.evaluate(r,i,c,d,m,g,void 0,void 0,v)}}class uu{constructor(r,i,c,d,m,g){this.kind=r,this.zoomStops=c,this._styleExpression=i,this.isStateDependent=r!=="camera"&&!Ph(i.expression),this.isIndoorDependent=Mp(i.expression),this.isLightConstant=m,this.isLineProgressConstant=g,this.configDependencies=cu(i.expression),this.interpolationType=d}evaluateWithoutErrorHandling(r,i,c,d,m,g){return this._styleExpression.evaluateWithoutErrorHandling(r,i,c,d,m,g)}evaluate(r,i,c,d,m,g){return this._styleExpression.evaluate(r,i,c,d,m,g)}interpolationFactor(r,i,c){return this.interpolationType?Xo.interpolationFactor(this.interpolationType,r,i,c):0}}function U_(a,r,i,c,d){if((a=kc(a,r,i,c,d)).result==="error")return a;const m=a.value.expression,g=Qu(m);if(!g&&!zh(r))return Ec([new fa("","data expressions not supported")]);const v=ed(m,["zoom","pitch","distance-from-center"]);if(!v&&!px(r))return Ec([new fa("","zoom expressions not supported")]);const S=ed(m,["measure-light"]);if(!S&&!fx(r))return Ec([new fa("","measure-light expression not supported")]);const E=ed(m,["line-progress"]);if(!E&&!function(R){return V_(R.expression,"line-progress")}(r))return Ec([new fa("","line-progress expression not supported")]);const C=r.expression&&r.expression.relaxZoomRestriction,I=Oa(m);return I||v||C?I instanceof fa?Ec([I]):I instanceof Xo&&!Rp(r)?Ec([new fa("",'"interpolate" expressions cannot be used with this property')]):hx(I?new uu(g&&E?"camera":"composite",a.value,I.labels,I instanceof Xo?I.interpolation:void 0,S,E):new ad(g&&E?"constant":"source",a.value,S,E)):Ec([new fa("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Op{constructor(r,i){this._parameters=r,this._specification=i,Object.assign(this,gx(this._parameters,this._specification))}static deserialize(r){return new Op(r._parameters,r._specification)}static serialize(r){return{_parameters:r._parameters,_specification:r._specification}}}function Oa(a){let r=null;if(a instanceof Il)r=Oa(a.result);else if(a instanceof Dh){for(const i of a.args)if(r=Oa(i),r)break}else(a instanceof Mh||a instanceof Xo)&&a.input instanceof co&&a.input.name==="zoom"&&(r=a);return r instanceof fa||a.eachChild(i=>{const c=Oa(i);c instanceof fa?r=c:r&&c&&r!==c&&(r=new fa("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}var $_,vx,xx=function(){if(vx)return $_;vx=1,$_=r;var a=3;function r(i,c,d){var m=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var g=new Int32Array(this.arrayBuffer);i=g[0],this.d=(c=g[1])+2*(d=g[2]);for(var v=0;v<this.d*this.d;v++){var S=g[a+v],E=g[a+v+1];m.push(S===E?null:g.subarray(S,E))}var C=g[a+m.length+1];this.keys=g.subarray(g[a+m.length],C),this.bboxes=g.subarray(C),this.insert=this._insertReadonly}else{this.d=c+2*d;for(var I=0;I<this.d*this.d;I++)m.push([]);this.keys=[],this.bboxes=[]}this.n=c,this.extent=i,this.padding=d,this.scale=c/i,this.uid=0;var R=d/c*i;this.min=-R,this.max=i+R}return r.prototype.insert=function(i,c,d,m,g){this._forEachCell(c,d,m,g,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(m),this.bboxes.push(g)},r.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},r.prototype._insertCell=function(i,c,d,m,g,v){this.cells[g].push(v)},r.prototype.query=function(i,c,d,m,g){var v=this.min,S=this.max;if(i<=v&&c<=v&&S<=d&&S<=m&&!g)return Array.prototype.slice.call(this.keys);var E=[];return this._forEachCell(i,c,d,m,this._queryCell,E,{},g),E},r.prototype._queryCell=function(i,c,d,m,g,v,S,E){var C=this.cells[g];if(C!==null)for(var I=this.keys,R=this.bboxes,L=0;L<C.length;L++){var z=C[L];if(S[z]===void 0){var U=4*z;(E?E(R[U+0],R[U+1],R[U+2],R[U+3]):i<=R[U+2]&&c<=R[U+3]&&d>=R[U+0]&&m>=R[U+1])?(S[z]=!0,v.push(I[z])):S[z]=!1}}},r.prototype._forEachCell=function(i,c,d,m,g,v,S,E){for(var C=this._convertToCellCoord(i),I=this._convertToCellCoord(c),R=this._convertToCellCoord(d),L=this._convertToCellCoord(m),z=C;z<=R;z++)for(var U=I;U<=L;U++){var q=this.d*U+z;if((!E||E(this._convertFromCellCoord(z),this._convertFromCellCoord(U),this._convertFromCellCoord(z+1),this._convertFromCellCoord(U+1)))&&g.call(this,i,c,d,m,q,v,S,E))return}},r.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},r.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,c=a+this.cells.length+1+1,d=0,m=0;m<this.cells.length;m++)d+=this.cells[m].length;var g=new Int32Array(c+d+this.keys.length+this.bboxes.length);g[0]=this.extent,g[1]=this.n,g[2]=this.padding;for(var v=c,S=0;S<i.length;S++){var E=i[S];g[a+S]=v,g.set(E,v),v+=E.length}return g[a+i.length]=v,g.set(this.keys,v),g[a+i.length+1]=v+=this.keys.length,g.set(this.bboxes,v),v+=this.bboxes.length,g.buffer},$_}(),ld=Wn(xx);const du={};function Ut(a,r,i={}){Object.defineProperty(a,"_classRegistryKey",{value:r,writable:!1}),du[r]={klass:a,omit:i.omit||[]}}Ut(Object,"Object"),ld.serialize=function(a,r){const i=a.toArrayBuffer();return r&&r.add(i),{buffer:i}},ld.deserialize=function(a){return new ld(a.buffer)},Object.defineProperty(ld,"name",{value:"Grid"}),Ut(ld,"Grid"),delete it.prototype.constructor,Ut(wn,"Color"),Ut(Error,"Error"),Ut(ao,"Formatted"),Ut(op,"FormattedSection"),Ut(Oo,"AJAXError"),Ut(lo,"ResolvedImage"),Ut(Op,"StylePropertyFunction"),Ut(Lp,"StyleExpression",{omit:["_evaluator"]}),Ut(Js,"ImageId"),Ut(kl,"ImageVariant"),Ut(uu,"ZoomDependentExpression"),Ut(ad,"ZoomConstantExpression"),Ut(co,"CompoundExpression",{omit:["_evaluate"]});for(const a in od)du[od[a]._classRegistryKey]||Ut(od[a],`Expression${a}`);function Bh(a){return a&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function Pl(a,r){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp)return a;if(Bh(a)||a instanceof ImageBitmap)return r&&r.add(a),a;if(ArrayBuffer.isView(a))return r&&r.add(a.buffer),a;if(a instanceof ImageData)return r&&r.add(a.data.buffer),a;if(Array.isArray(a)){const i=[];for(const c of a)i.push(Pl(c,r));return i}if(a instanceof Map){const i={$name:"Map",entries:[]};for(const[c,d]of a.entries())i.entries.push(Pl(c),Pl(d,r));return i}if(a instanceof Set){const i={$name:"Set"};let c=0;for(const d of a.values())i[++c]=Pl(d);return i}if(typeof a=="bigint")return{$name:"BigInt",value:a.toString()};if(typeof a=="object"){const i=a.constructor,c=i._classRegistryKey;if(!c)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const d=i.serialize?i.serialize(a,r):{};if(!i.serialize){for(const m in a)a.hasOwnProperty(m)&&(du[c].omit.indexOf(m)>=0||(d[m]=Pl(a[m],r)));a instanceof Error&&(d.message=a.message)}if(d.$name)throw new Error("$name property is reserved for worker serialization logic.");return c!=="Object"&&(d.$name=c),d}throw new Error("can't serialize object of type "+typeof a)}function Ac(a){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||Bh(a)||a instanceof ImageBitmap||ArrayBuffer.isView(a)||a instanceof ImageData)return a;if(Array.isArray(a))return a.map(Ac);if(typeof a=="object"){const r=a.$name||"Object";if(r==="Map"){const d=a.entries||[],m=new Map;for(let g=0;g<d.length;g+=2)m.set(Ac(d[g]),Ac(d[g+1]));return m}if(r==="Set"){const d=new Set;for(const m of Object.keys(a))m!=="$name"&&d.add(Ac(a[m]));return d}if(r==="BigInt")return BigInt(a.value);const{klass:i}=du[r];if(!i)throw new Error(`Can't deserialize unregistered class "${r}".`);if(i.deserialize)return i.deserialize(a);const c=Object.create(i.prototype);for(const d of Object.keys(a))d!=="$name"&&(c[d]=Ac(a[d]));return c}throw new Error("can't deserialize object of type "+typeof a)}const or={"Latin-1 Supplement":a=>a>=128&&a<=255,Arabic:a=>a>=1536&&a<=1791,"Arabic Supplement":a=>a>=1872&&a<=1919,"Arabic Extended-A":a=>a>=2208&&a<=2303,"Hangul Jamo":a=>a>=4352&&a<=4607,"Unified Canadian Aboriginal Syllabics":a=>a>=5120&&a<=5759,Khmer:a=>a>=6016&&a<=6143,"Unified Canadian Aboriginal Syllabics Extended":a=>a>=6320&&a<=6399,"General Punctuation":a=>a>=8192&&a<=8303,"Letterlike Symbols":a=>a>=8448&&a<=8527,"Number Forms":a=>a>=8528&&a<=8591,"Miscellaneous Technical":a=>a>=8960&&a<=9215,"Control Pictures":a=>a>=9216&&a<=9279,"Optical Character Recognition":a=>a>=9280&&a<=9311,"Enclosed Alphanumerics":a=>a>=9312&&a<=9471,"Geometric Shapes":a=>a>=9632&&a<=9727,"Miscellaneous Symbols":a=>a>=9728&&a<=9983,"Miscellaneous Symbols and Arrows":a=>a>=11008&&a<=11263,"CJK Radicals Supplement":a=>a>=11904&&a<=12031,"Kangxi Radicals":a=>a>=12032&&a<=12255,"Ideographic Description Characters":a=>a>=12272&&a<=12287,"CJK Symbols and Punctuation":a=>a>=12288&&a<=12351,Hiragana:a=>a>=12352&&a<=12447,Katakana:a=>a>=12448&&a<=12543,Bopomofo:a=>a>=12544&&a<=12591,"Hangul Compatibility Jamo":a=>a>=12592&&a<=12687,Kanbun:a=>a>=12688&&a<=12703,"Bopomofo Extended":a=>a>=12704&&a<=12735,"CJK Strokes":a=>a>=12736&&a<=12783,"Katakana Phonetic Extensions":a=>a>=12784&&a<=12799,"Enclosed CJK Letters and Months":a=>a>=12800&&a<=13055,"CJK Compatibility":a=>a>=13056&&a<=13311,"CJK Unified Ideographs Extension A":a=>a>=13312&&a<=19903,"Yijing Hexagram Symbols":a=>a>=19904&&a<=19967,"CJK Unified Ideographs":a=>a>=19968&&a<=40959,"Yi Syllables":a=>a>=40960&&a<=42127,"Yi Radicals":a=>a>=42128&&a<=42191,"Hangul Jamo Extended-A":a=>a>=43360&&a<=43391,"Hangul Syllables":a=>a>=44032&&a<=55215,"Hangul Jamo Extended-B":a=>a>=55216&&a<=55295,"Private Use Area":a=>a>=57344&&a<=63743,"CJK Compatibility Ideographs":a=>a>=63744&&a<=64255,"Arabic Presentation Forms-A":a=>a>=64336&&a<=65023,"Vertical Forms":a=>a>=65040&&a<=65055,"CJK Compatibility Forms":a=>a>=65072&&a<=65103,"Small Form Variants":a=>a>=65104&&a<=65135,"Arabic Presentation Forms-B":a=>a>=65136&&a<=65279,"Halfwidth and Fullwidth Forms":a=>a>=65280&&a<=65519,Osage:a=>a>=66736&&a<=66815,"CJK Unified Ideographs Extension B":a=>a>=131072&&a<=173791};function Nh(a){for(const r of a)if(zp(r.charCodeAt(0)))return!0;return!1}function G_(a){for(const r of a)if(!wx(r.charCodeAt(0)))return!1;return!0}function wx(a){return!(or.Arabic(a)||or["Arabic Supplement"](a)||or["Arabic Extended-A"](a)||or["Arabic Presentation Forms-A"](a)||or["Arabic Presentation Forms-B"](a))}function zp(a){return!(a!==746&&a!==747&&(a<4352||!(or["Bopomofo Extended"](a)||or.Bopomofo(a)||or["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||or["CJK Compatibility Ideographs"](a)||or["CJK Compatibility"](a)||or["CJK Radicals Supplement"](a)||or["CJK Strokes"](a)||!(!or["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||or["CJK Unified Ideographs Extension A"](a)||or["CJK Unified Ideographs"](a)||or["Enclosed CJK Letters and Months"](a)||or["Hangul Compatibility Jamo"](a)||or["Hangul Jamo Extended-A"](a)||or["Hangul Jamo Extended-B"](a)||or["Hangul Jamo"](a)||or["Hangul Syllables"](a)||or.Hiragana(a)||or["Ideographic Description Characters"](a)||or.Kanbun(a)||or["Kangxi Radicals"](a)||or["Katakana Phonetic Extensions"](a)||or.Katakana(a)&&a!==12540||!(!or["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!or["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||or["Unified Canadian Aboriginal Syllabics"](a)||or["Unified Canadian Aboriginal Syllabics Extended"](a)||or["Vertical Forms"](a)||or["Yijing Hexagram Symbols"](a)||or["Yi Syllables"](a)||or["Yi Radicals"](a))))}function Fp(a){return!(zp(a)||function(r){return!!(or["Latin-1 Supplement"](r)&&(r===167||r===169||r===174||r===177||r===188||r===189||r===190||r===215||r===247)||or["General Punctuation"](r)&&(r===8214||r===8224||r===8225||r===8240||r===8241||r===8251||r===8252||r===8258||r===8263||r===8264||r===8265||r===8273)||or["Letterlike Symbols"](r)||or["Number Forms"](r)||or["Miscellaneous Technical"](r)&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||r===9003||r>=9085&&r<=9114||r>=9150&&r<=9165||r===9167||r>=9169&&r<=9179||r>=9186&&r<=9215)||or["Control Pictures"](r)&&r!==9251||or["Optical Character Recognition"](r)||or["Enclosed Alphanumerics"](r)||or["Geometric Shapes"](r)||or["Miscellaneous Symbols"](r)&&!(r>=9754&&r<=9759)||or["Miscellaneous Symbols and Arrows"](r)&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||or["CJK Symbols and Punctuation"](r)||or.Katakana(r)||or["Private Use Area"](r)||or["CJK Compatibility Forms"](r)||or["Small Form Variants"](r)||or["Halfwidth and Fullwidth Forms"](r)||r===8734||r===8756||r===8757||r>=9984&&r<=10087||r>=10102&&r<=10131||r===65532||r===65533)}(a))}function Bp(a){return or.Arabic(a)||or["Arabic Supplement"](a)||or["Arabic Extended-A"](a)||or["Arabic Presentation Forms-A"](a)||or["Arabic Presentation Forms-B"](a)}function H_(a){return a>=1424&&a<=2303||or["Arabic Presentation Forms-A"](a)||or["Arabic Presentation Forms-B"](a)}function Ml(a,r){return!(!r&&H_(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||or.Khmer(a))}function BS(a){for(const r of a)if(H_(r.charCodeAt(0)))return!0;return!1}const zo={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let W_=null,uo=zo.unavailable,Rl=null;const jh=function(a){a&&typeof a=="string"&&a.indexOf("NetworkError")>-1&&(uo=zo.error),W_&&W_(a)};function Np(){jp.fire(new rl("pluginStateChange",{pluginStatus:uo,pluginURL:Rl}))}const jp=new iu,Vh=function(){return uo},bx=function(){if(uo!==zo.deferred||!Rl)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");uo=zo.loading,Np(),Rl&&El({url:Rl},a=>{a?jh(a):(uo=zo.loaded,Np())})},Dl={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>uo===zo.loaded||Dl.applyArabicShaping!=null,isLoading:()=>uo===zo.loading,setState(a){uo=a.pluginStatus,Rl=a.pluginURL},isParsing:()=>uo===zo.parsing,isParsed:()=>uo===zo.parsed,getPluginURL:()=>Rl};class $n{constructor(r,i){this.zoom=r,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(r){return function(i,c){for(const d of i)if(!Ml(d.charCodeAt(0),c))return!1;return!0}(r,Dl.isLoaded())}}class Vp{constructor(r,i,c,d,m){this.property=r,this.value=i,this.expression=function(g,v,S,E,C){if(Dp(g))return new Op(g,v);if(Fh(g)||Array.isArray(g)&&g.length>0){const I=U_(g,v,S,E,C);if(I.result==="error")throw new Error(I.value.map(R=>`${R.key}: ${R.message}`).join(", "));return I.value}{let I=g;return typeof g=="string"&&v.type==="color"&&(I=wn.parse(g)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>I}}}(i===void 0?r.specification.default:i,r.specification,c,d,m)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(r,i,c,d){return this.property.possiblyEvaluate(this,r,i,c,d)}}class q_{constructor(r,i,c,d){this.property=r,this.value=new Vp(r,void 0,i,c,d)}transitioned(r,i){return new Tx(this.property,this.value,i,Object.assign({},r.transition,this.transition),r.now)}untransitioned(){return new Tx(this.property,this.value,null,{},0)}}class Sx{constructor(r,i,c,d){this._properties=r,this._values=Object.create(r.defaultTransitionablePropertyValues),this._scope=i,this._options=c,this._iconImageUseTheme=d,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(r){return tt(this._values[r].value.value)}setValue(r,i){this._values.hasOwnProperty(r)||(this._values[r]=new q_(this._values[r].property,this._scope,this._options,this._iconImageUseTheme)),this._values[r].value=new Vp(this._values[r].property,i===null?void 0:tt(i),this._scope,this._options,this._iconImageUseTheme),this._values[r].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[r].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[r].value.isIndoorDependent())}setTransitionOrValue(r,i){i&&(this._options=i);const c=this._properties.properties;if(r)for(const d in r){const m=r[d];if(d.endsWith("-transition")){const g=d.slice(0,-11);c[g]&&this.setTransition(g,m)}else c.hasOwnProperty(d)&&this.setValue(d,m)}}getTransition(r){return tt(this._values[r].transition)}setTransition(r,i){this._values.hasOwnProperty(r)||(this._values[r]=new q_(this._values[r].property)),this._values[r].transition=tt(i)||void 0}serialize(){const r={};for(const i of Object.keys(this._values)){const c=this.getValue(i);c!==void 0&&(r[i]=c);const d=this.getTransition(i);d!==void 0&&(r[`${i}-transition`]=d)}return r}transitioned(r,i){const c=new Ex(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].transitioned(r,i._values[d]);return c}untransitioned(){const r=new Ex(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].untransitioned();return r}isIndoorDependent(){return this._isIndoorDependent}}class Tx{constructor(r,i,c,d,m){const g=d.delay||0,v=d.duration||0;m=m||0,this.property=r,this.value=i,this.begin=m+g,this.end=this.begin+v,r.specification.transition&&(d.delay||d.duration)&&(this.prior=c)}possiblyEvaluate(r,i,c){const d=r.now||0,m=this.value.possiblyEvaluate(r,i,c),g=this.prior;if(g){if(d>this.end)return this.prior=null,m;if(this.value.isDataDriven())return this.prior=null,m;if(d<this.begin)return g.possiblyEvaluate(r,i,c);{const v=(d-this.begin)/(this.end-this.begin);return this.property.interpolate(g.possiblyEvaluate(r,i,c),m,Pi(v))}}return m}}class Ex{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitioningPropertyValues)}possiblyEvaluate(r,i,c){const d=new fu(this._properties);for(const m of Object.keys(this._values))d._values[m]=this._values[m].possiblyEvaluate(r,i,c);return d}hasTransition(){for(const r of Object.keys(this._values))if(this._values[r].prior)return!0;return!1}}class kx{constructor(r,i,c,d){this._properties=r,this._values=Object.create(r.defaultPropertyValues),this._scope=i,this._options=c,this._iconImageUseTheme=d,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(r){return tt(this._values[r].value)}setValue(r,i){this._values[r]=new Vp(this._values[r].property,i===null?void 0:tt(i),this._scope,this._options,this._iconImageUseTheme),this._values[r].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[r].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[r].isIndoorDependent())}serialize(){const r={};for(const i of Object.keys(this._values)){const c=this.getValue(i);c!==void 0&&(r[i]=c)}return r}possiblyEvaluate(r,i,c,d){const m=new fu(this._properties);for(const g of Object.keys(this._values))m._values[g]=this._values[g].possiblyEvaluate(r,i,c,d);return m}isIndoorDependent(){return this._isIndoorDependent}}class hu{constructor(r,i,c,d){this.property=r,this.value=i,this.parameters=c,this.iconImageUseTheme=d}isConstant(){return this.value.kind==="constant"}constantOr(r){return this.value.kind==="constant"?this.value.value:r}evaluate(r,i,c,d){return this.property.evaluate(this.value,this.parameters,r,i,c,d,this.iconImageUseTheme)}}class fu{constructor(r){this._properties=r,this._values=Object.create(r.defaultPossiblyEvaluatedValues)}get(r){return this._values[r]}}class vt{constructor(r){this.specification=r}possiblyEvaluate(r,i){return r.expression.evaluate(i)}interpolate(r,i,c){const d=wh[this.specification.type];return d?d(r,i,c):r}}class Ct{constructor(r,i){this.specification=r,this.overrides=i}possiblyEvaluate(r,i,c,d,m){return r.expression.kind==="constant"||r.expression.kind==="camera"?new hu(this,{kind:"constant",value:r.expression.evaluate(i,null,{},c,d,void 0,m)},i):new hu(this,r.expression,i,m)}interpolate(r,i,c){if(r.value.kind!=="constant"||i.value.kind!=="constant")return r;if(r.value.value===void 0||i.value.value===void 0)return new hu(this,{kind:"constant",value:void 0},r.parameters);const d=wh[this.specification.type];return d?new hu(this,{kind:"constant",value:d(r.value.value,i.value.value,c)},r.parameters):r}evaluate(r,i,c,d,m,g,v){return r.kind==="constant"?r.value:r.evaluate(i,c,d,m,g,void 0,v)}}class pu{constructor(r){this.specification=r}possiblyEvaluate(r,i,c,d){return!!r.expression.evaluate(i,null,{},c,d)}interpolate(){return!1}}class hi{constructor(r){this.properties=r,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new $n(0,{});for(const c in r){const d=r[c];d.specification.overridable&&this.overridableProperties.push(c);const m=this.defaultPropertyValues[c]=new Vp(d,void 0),g=this.defaultTransitionablePropertyValues[c]=new q_(d);this.defaultTransitioningPropertyValues[c]=g.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate(i)}}}Ut(Ct,"DataDrivenProperty"),Ut(vt,"DataConstantProperty"),Ut(pu,"ColorRampProperty");var ze=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Ax(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function Up(a){if(Array.isArray(a))return a.map(Up);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const r={};for(const i in a)r[i]=Up(a[i]);return r}return Ax(a)}function ll(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const r of a.slice(1))if(!ll(r)&&typeof r!="boolean")return!1;return!0;default:return!0}}function $p(a,r="",i=null,c="fill"){if(a==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};ll(a)||(a=Gp(a));const d=a;let m=!0;try{m=function(C){if(!cd(C))return C;let I=Up(C);return Cx(I),I=mu(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 g=null,v=null;if(c!=="background"&&c!=="sky"&&c!=="slot"){v=ze[`filter_${c}`];const C=kc(m,v,r,i);if(C.result==="error")throw new Error(C.value.map(I=>`${I.key}: ${I.message}`).join(", "));g=(I,R,L)=>C.value.evaluate(I,R,{},L)}let S=null,E=null;if(m!==d){const C=kc(d,v,r,i);if(C.result==="error")throw new Error(C.value.map(I=>`${I.key}: ${I.message}`).join(", "));S=(I,R,L,z,U)=>C.value.evaluate(I,R,{},L,void 0,void 0,z,U),E=!Qu(C.value.expression)}return{filter:g,dynamicFilter:S||void 0,needGeometry:Ix(m),needFeature:!!E}}function mu(a){if(!Array.isArray(a))return a;const r=function(i){if(NS.has(i[0])){for(let c=1;c<i.length;c++)if(cd(i[c]))return!0}return i}(a);return r===!0?r:r.map(i=>mu(i))}function Cx(a){let r=!1;const i=[];if(a[0]==="case"){for(let c=1;c<a.length-1;c+=2)r=r||cd(a[c]),i.push(a[c+1]);i.push(a[a.length-1])}else if(a[0]==="match"){r=r||cd(a[1]);for(let c=2;c<a.length-1;c+=2)i.push(a[c+1]);i.push(a[a.length-1])}else if(a[0]==="step"){r=r||cd(a[1]);for(let c=1;c<a.length-1;c+=2)i.push(a[c+1])}r&&(a.length=0,a.push("any",...i));for(let c=1;c<a.length;c++)Cx(a[c])}function cd(a){if(!Array.isArray(a))return!1;if((r=a[0])==="pitch"||r==="distance-from-center")return!0;var r;for(let i=1;i<a.length;i++)if(cd(a[i]))return!0;return!1}const NS=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function jS(a,r){return a<r?-1:a>r?1:0}function Ix(a){if(!Array.isArray(a))return!1;if(a[0]==="within"||a[0]==="distance")return!0;for(let r=1;r<a.length;r++)if(Ix(a[r]))return!0;return!1}function Gp(a){if(!a)return!0;const r=a[0];return a.length<=1?r!=="any":r==="=="?Hp(a[1],a[2],"=="):r==="!="?Uh(Hp(a[1],a[2],"==")):r==="<"||r===">"||r==="<="||r===">="?Hp(a[1],a[2],r):r==="any"?(i=a.slice(1),["any"].concat(i.map(Gp))):r==="all"?["all"].concat(a.slice(1).map(Gp)):r==="none"?["all"].concat(a.slice(1).map(Gp).map(Uh)):r==="in"?Wp(a[1],a.slice(2)):r==="!in"?Uh(Wp(a[1],a.slice(2))):r==="has"?qp(a[1]):r!=="!has"||Uh(qp(a[1]));var i}function Hp(a,r,i){switch(a){case"$type":return[`filter-type-${i}`,r];case"$id":return[`filter-id-${i}`,r];default:return[`filter-${i}`,a,r]}}function Wp(a,r){if(r.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",a,["literal",r.sort(jS)]]:["filter-in-small",a,["literal",r]]}}function qp(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function Uh(a){return["!",a]}const gu="";function za(a,r){return r?`${a}${gu}${r}`:a}let Px;const Mx=()=>Px||(Px=new hi({"icon-size":new Ct(ze.layout_symbol["icon-size"]),"icon-image":new Ct(ze.layout_symbol["icon-image"]),"icon-rotate":new Ct(ze.layout_symbol["icon-rotate"]),"icon-offset":new Ct(ze.layout_symbol["icon-offset"]),"text-size":new Ct(ze.layout_symbol["text-size"]),"text-rotate":new Ct(ze.layout_symbol["text-rotate"]),"text-offset":new Ct(ze.layout_symbol["text-offset"])}));class Rx{constructor(r,i,c,d,m,g){const v=kc(r,ze.appearance.condition);if(v.result==="success"&&(this.condition=v.value),this.name=i,c){this.properties=new fu(Mx()),this.unevaluatedLayout=new kx(Mx(),d,m,g);for(const S in c)this.unevaluatedLayout.setValue(S,c[S])}}isActive(r){return!(this.condition||!r.isHidden||this.name!=="hidden")||this.condition.evaluate(r.globals,r.feature,r.featureState,r.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(r){return this.properties.get(r)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(r){return this.unevaluatedLayout._values[r]}recalculate(r,i,c){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(r,void 0,i,c))}serialize(){const r={};return r.condition=this.condition.expression.serialize(),this.name&&(r.name=this.name),this.unevaluatedLayout&&(r.properties=this.unevaluatedLayout.serialize()),r}hasIconProperties(){const r=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),c=this.hasProperty("icon-offset"),d=this.hasProperty("icon-rotate");return r||i||c||d}hasTextProperties(){const r=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),c=this.hasProperty("text-rotate");return r||i||c}hasProperty(r){return this.getUnevaluatedProperty(r).value!==void 0}}const Dx="-transition",cl=new Set(["fill","line","background","hillshade","raster"]);class ho extends iu{constructor(r,i,c,d,m,g){if(super(),this.id=r.id,this.fqid=za(this.id,c),this.type=r.type,this.scope=c,this.lut=d,this.options=m,this.iconImageUseTheme=g,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},r.type!=="custom"){if(this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type&&r.type!=="background"&&r.type!=="sky"&&r.type!=="slot"){this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter;const v=kc(this.filter,ze[`filter_${r.type}`]);v.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...v.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||v.value.isIndoorDependent)}if(r.slot&&(this.slot=r.slot),r.appearances&&this.setAppearances(r.appearances),i.layout&&(this._unevaluatedLayout=new kx(i.layout,this.scope,m,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 Sx(i.paint,this.scope,m);for(const v in r.paint)this.setPaintProperty(v,r.paint[v]);for(const v in r.layout)this.setLayoutProperty(v,r.layout[v]);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 fu(i.paint)}}}onAdd(r){}onRemove(r){}isDraped(r){return!this.is3D(!0)&&cl.has(this.type)}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,i){if(this.type==="custom"&&r==="visibility")return void(this.visibility=i);const c=this._unevaluatedLayout;c._properties.properties[r]&&(c.setValue(r,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...c.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||c.isIndoorDependent(),r==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(r){this.appearances=[],r.forEach(i=>{this.appearances.push(new Rx(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(r){return r.endsWith(Dx)?this._transitionablePaint.getTransition(r.slice(0,-11)):this._transitionablePaint.getValue(r)}isPaintProperty(r){return!!this._transitionablePaint._properties.properties[r]}setPaintProperty(r,i){const c=this._transitionablePaint,d=c._properties.properties;if(r.endsWith(Dx)){const I=r.slice(0,-11);return d[I]&&c.setTransition(I,i||void 0),!1}if(!d[r])return!1;const m=c._values[r],g=m.value.isDataDriven(),v=m.value;c.setValue(r,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...c.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||c.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(r);const S=c._values[r].value,E=S.isDataDriven(),C=r.endsWith("pattern")||r==="line-dasharray";return E||g||C||this._handleOverridablePaintPropertyUpdate(r,v,S)}_handleSpecialPaintPropertyUpdate(r){}getProgramIds(){return null}getDefaultProgramParams(r,i,c){return null}_handleOverridablePaintPropertyUpdate(r,i,c){return!1}isHidden(r){return!!(this.minzoom&&r<this.minzoom)||!!(this.maxzoom&&r>=this.maxzoom)||this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,i)}serialize(){const r={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&&(r.appearances=this.appearances.map(i=>i.serialize())),pt(r,(i,c)=>!(i===void 0||c==="layout"&&!Object.keys(i).length||c==="paint"&&!Object.keys(i).length))}is3D(r){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const r in this.paint._values){const i=this.paint.get(r);if(i instanceof hu&&zh(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const r of this.appearances)if(!Ph(r.condition.expression))return!0;return!1}compileFilter(r){this._filterCompiled||(this._featureFilter=$p(this.filter,this.scope,r),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(r){this._stats&&(r.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(r,i,c){return{}}queryRadius(r){}queryIntersectsFeature(r,i,c,d,m,g,v,S,E){}}const Lx={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class $h{constructor(r,i){this._structArray=r,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const VS=new ArrayBuffer(0);class Xn{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(r,i){return r._trim(),i&&r.arrayBuffer&&i.add(r.arrayBuffer),{length:r.length,arrayBuffer:r.arrayBuffer}}static deserialize(r){const i=Object.create(this.prototype);return i.arrayBuffer=r.arrayBuffer,i.length=r.length,r.arrayBuffer?i.capacity=r.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=VS),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(r){this.reserve(r),this.length=r}reserve(r){if(r>this.capacity){this._reallocCount++,this.capacity=Math.max(r,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(r){this.reserve(this.length+r)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...r){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...r){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 Br(a,r=1){let i=0,c=0;return{members:a.map(d=>{const m=Lx[d.type].BYTES_PER_ELEMENT,g=i=Ox(i,Math.max(r,m)),v=d.components||1;return c=Math.max(c,m),i+=m*v,{name:d.name,type:d.type,components:v,offset:g}}),size:Ox(i,Math.max(c,r)),alignment:r}}function Ox(a,r){return Math.ceil(a/r)*r}class Cc extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i){const c=this.length;return this.resize(c+1),this.emplace(c,r,i)}emplace(r,i,c){const d=2*r;return this.int16[d+0]=i,this.int16[d+1]=c,r}}Cc.prototype.bytesPerElement=4,Ut(Cc,"StructArrayLayout2i4");class ud extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c){const d=this.length;return this.resize(d+1),this.emplace(d,r,i,c)}emplace(r,i,c,d){const m=3*r;return this.int16[m+0]=i,this.int16[m+1]=c,this.int16[m+2]=d,r}}ud.prototype.bytesPerElement=6,Ut(ud,"StructArrayLayout3i6");class dd extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c,d){const m=this.length;return this.resize(m+1),this.emplace(m,r,i,c,d)}emplace(r,i,c,d,m){const g=4*r;return this.int16[g+0]=i,this.int16[g+1]=c,this.int16[g+2]=d,this.int16[g+3]=m,r}}dd.prototype.bytesPerElement=8,Ut(dd,"StructArrayLayout4i8");class Ll extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){const i=this.length;return this.resize(i+1),this.emplace(i,r)}emplace(r,i){return this.float32[1*r+0]=i,r}}Ll.prototype.bytesPerElement=4,Ut(Ll,"StructArrayLayout1f4");class K_ extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c){const d=this.length;return this.resize(d+1),this.emplace(d,r,i,c)}emplace(r,i,c,d){const m=4*r,g=2*r;return this.int16[m+0]=i,this.int16[m+1]=c,this.float32[g+1]=d,r}}K_.prototype.bytesPerElement=8,Ut(K_,"StructArrayLayout2i1f8");class Z_ extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c){const d=this.length;return this.resize(d+1),this.emplace(d,r,i,c)}emplace(r,i,c,d){const m=4*r;return this.int16[m+0]=i,this.int16[m+1]=c,this.int16[m+2]=d,r}}Z_.prototype.bytesPerElement=8,Ut(Z_,"StructArrayLayout3i8");class X_ extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,i,c,d,m)}emplace(r,i,c,d,m,g){const v=5*r;return this.int16[v+0]=i,this.int16[v+1]=c,this.int16[v+2]=d,this.int16[v+3]=m,this.int16[v+4]=g,r}}X_.prototype.bytesPerElement=10,Ut(X_,"StructArrayLayout5i10");class Kp extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v){const S=this.length;return this.resize(S+1),this.emplace(S,r,i,c,d,m,g,v)}emplace(r,i,c,d,m,g,v,S){const E=6*r,C=12*r,I=3*r;return this.int16[E+0]=i,this.int16[E+1]=c,this.uint8[C+4]=d,this.uint8[C+5]=m,this.uint8[C+6]=g,this.uint8[C+7]=v,this.float32[I+2]=S,r}}Kp.prototype.bytesPerElement=12,Ut(Kp,"StructArrayLayout2i4ub1f12");class Yo extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c){const d=this.length;return this.resize(d+1),this.emplace(d,r,i,c)}emplace(r,i,c,d){const m=3*r;return this.float32[m+0]=i,this.float32[m+1]=c,this.float32[m+2]=d,r}}Yo.prototype.bytesPerElement=12,Ut(Yo,"StructArrayLayout3f12");class So extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,i,c,d,m)}emplace(r,i,c,d,m,g){const v=6*r,S=3*r;return this.uint16[v+0]=i,this.uint16[v+1]=c,this.uint16[v+2]=d,this.uint16[v+3]=m,this.float32[S+2]=g,r}}So.prototype.bytesPerElement=12,Ut(So,"StructArrayLayout4ui1f12");class _u extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,i,c,d){const m=this.length;return this.resize(m+1),this.emplace(m,r,i,c,d)}emplace(r,i,c,d,m){const g=4*r;return this.uint16[g+0]=i,this.uint16[g+1]=c,this.uint16[g+2]=d,this.uint16[g+3]=m,r}}_u.prototype.bytesPerElement=8,Ut(_u,"StructArrayLayout4ui8");class Zp extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g){const v=this.length;return this.resize(v+1),this.emplace(v,r,i,c,d,m,g)}emplace(r,i,c,d,m,g,v){const S=6*r;return this.int16[S+0]=i,this.int16[S+1]=c,this.int16[S+2]=d,this.int16[S+3]=m,this.int16[S+4]=g,this.int16[S+5]=v,r}}Zp.prototype.bytesPerElement=12,Ut(Zp,"StructArrayLayout6i12");class Y_ extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v,S,E,C,I,R){const L=this.length;return this.resize(L+1),this.emplace(L,r,i,c,d,m,g,v,S,E,C,I,R)}emplace(r,i,c,d,m,g,v,S,E,C,I,R,L){const z=12*r;return this.int16[z+0]=i,this.int16[z+1]=c,this.int16[z+2]=d,this.int16[z+3]=m,this.uint16[z+4]=g,this.uint16[z+5]=v,this.uint16[z+6]=S,this.uint16[z+7]=E,this.int16[z+8]=C,this.int16[z+9]=I,this.int16[z+10]=R,this.int16[z+11]=L,r}}Y_.prototype.bytesPerElement=24,Ut(Y_,"StructArrayLayout4i4ui4i24");class J_ extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g){const v=this.length;return this.resize(v+1),this.emplace(v,r,i,c,d,m,g)}emplace(r,i,c,d,m,g,v){const S=10*r,E=5*r;return this.int16[S+0]=i,this.int16[S+1]=c,this.int16[S+2]=d,this.float32[E+2]=m,this.float32[E+3]=g,this.float32[E+4]=v,r}}J_.prototype.bytesPerElement=20,Ut(J_,"StructArrayLayout3i3f20");class Ic extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d){const m=this.length;return this.resize(m+1),this.emplace(m,r,i,c,d)}emplace(r,i,c,d,m){const g=4*r;return this.float32[g+0]=i,this.float32[g+1]=c,this.float32[g+2]=d,this.float32[g+3]=m,r}}Ic.prototype.bytesPerElement=16,Ut(Ic,"StructArrayLayout4f16");class Xp extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){const i=this.length;return this.resize(i+1),this.emplace(i,r)}emplace(r,i){return this.uint32[1*r+0]=i,r}}Xp.prototype.bytesPerElement=4,Ut(Xp,"StructArrayLayout1ul4");class Jo extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,i){const c=this.length;return this.resize(c+1),this.emplace(c,r,i)}emplace(r,i,c){const d=2*r;return this.uint16[d+0]=i,this.uint16[d+1]=c,r}}Jo.prototype.bytesPerElement=4,Ut(Jo,"StructArrayLayout2ui4");class Yp extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v,S,E,C,I,R,L){const z=this.length;return this.resize(z+1),this.emplace(z,r,i,c,d,m,g,v,S,E,C,I,R,L)}emplace(r,i,c,d,m,g,v,S,E,C,I,R,L,z){const U=20*r,q=10*r;return this.int16[U+0]=i,this.int16[U+1]=c,this.int16[U+2]=d,this.int16[U+3]=m,this.int16[U+4]=g,this.float32[q+3]=v,this.float32[q+4]=S,this.float32[q+5]=E,this.float32[q+6]=C,this.int16[U+14]=I,this.uint32[q+8]=R,this.uint16[U+18]=L,this.uint16[U+19]=z,r}}Yp.prototype.bytesPerElement=40,Ut(Yp,"StructArrayLayout5i4f1i1ul2ui40");class Jp extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v){const S=this.length;return this.resize(S+1),this.emplace(S,r,i,c,d,m,g,v)}emplace(r,i,c,d,m,g,v,S){const E=8*r;return this.int16[E+0]=i,this.int16[E+1]=c,this.int16[E+2]=d,this.int16[E+4]=m,this.int16[E+5]=g,this.int16[E+6]=v,this.int16[E+7]=S,r}}Jp.prototype.bytesPerElement=16,Ut(Jp,"StructArrayLayout3i2i2i16");class Qp extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,i,c,d,m)}emplace(r,i,c,d,m,g){const v=4*r,S=8*r;return this.float32[v+0]=i,this.float32[v+1]=c,this.float32[v+2]=d,this.int16[S+6]=m,this.int16[S+7]=g,r}}Qp.prototype.bytesPerElement=16,Ut(Qp,"StructArrayLayout2f1f2i16");class Q_ extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g){const v=this.length;return this.resize(v+1),this.emplace(v,r,i,c,d,m,g)}emplace(r,i,c,d,m,g,v){const S=20*r,E=5*r;return this.uint8[S+0]=i,this.uint8[S+1]=c,this.float32[E+1]=d,this.float32[E+2]=m,this.float32[E+3]=g,this.float32[E+4]=v,r}}Q_.prototype.bytesPerElement=20,Ut(Q_,"StructArrayLayout2ub4f20");class Ni extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,i,c){const d=this.length;return this.resize(d+1),this.emplace(d,r,i,c)}emplace(r,i,c,d){const m=3*r;return this.uint16[m+0]=i,this.uint16[m+1]=c,this.uint16[m+2]=d,r}}Ni.prototype.bytesPerElement=6,Ut(Ni,"StructArrayLayout3ui6");class hd extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve){const me=this.length;return this.resize(me+1),this.emplace(me,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve)}emplace(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve,me){const be=30*r,ke=15*r,Pe=60*r;return this.int16[be+0]=i,this.int16[be+1]=c,this.int16[be+2]=d,this.float32[ke+2]=m,this.float32[ke+3]=g,this.uint16[be+8]=v,this.uint16[be+9]=S,this.uint32[ke+5]=E,this.uint32[ke+6]=C,this.uint32[ke+7]=I,this.uint16[be+16]=R,this.uint16[be+17]=L,this.uint16[be+18]=z,this.float32[ke+10]=U,this.float32[ke+11]=q,this.uint8[Pe+48]=W,this.uint8[Pe+49]=re,this.uint8[Pe+50]=ie,this.uint32[ke+13]=ue,this.int16[be+28]=ve,this.uint8[Pe+58]=me,r}}hd.prototype.bytesPerElement=60,Ut(hd,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class ey extends Xn{_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(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve,me,be,ke,Pe,We,Le,Xe,rt,nt,ut,ht,at){const lt=this.length;return this.resize(lt+1),this.emplace(lt,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve,me,be,ke,Pe,We,Le,Xe,rt,nt,ut,ht,at)}emplace(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve,me,be,ke,Pe,We,Le,Xe,rt,nt,ut,ht,at,lt){const Ze=20*r,qe=40*r,ct=80*r;return this.float32[Ze+0]=i,this.float32[Ze+1]=c,this.int16[qe+4]=d,this.int16[qe+5]=m,this.int16[qe+6]=g,this.int16[qe+7]=v,this.int16[qe+8]=S,this.int16[qe+9]=E,this.int16[qe+10]=C,this.int16[qe+11]=I,this.int16[qe+12]=R,this.uint16[qe+13]=L,this.uint16[qe+14]=z,this.uint16[qe+15]=U,this.uint16[qe+16]=q,this.uint16[qe+17]=W,this.uint16[qe+18]=re,this.uint16[qe+19]=ie,this.uint16[qe+20]=ue,this.uint16[qe+21]=ve,this.uint16[qe+22]=me,this.uint16[qe+23]=be,this.uint16[qe+24]=ke,this.uint16[qe+25]=Pe,this.uint16[qe+26]=We,this.uint16[qe+27]=Le,this.uint32[Ze+14]=Xe,this.float32[Ze+15]=rt,this.float32[Ze+16]=nt,this.float32[Ze+17]=ut,this.float32[Ze+18]=ht,this.uint8[ct+76]=at,this.uint16[qe+39]=lt,r}}ey.prototype.bytesPerElement=80,Ut(ey,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ty extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g){const v=this.length;return this.resize(v+1),this.emplace(v,r,i,c,d,m,g)}emplace(r,i,c,d,m,g,v){const S=6*r;return this.float32[S+0]=i,this.float32[S+1]=c,this.float32[S+2]=d,this.float32[S+3]=m,this.float32[S+4]=g,this.float32[S+5]=v,r}}ty.prototype.bytesPerElement=24,Ut(ty,"StructArrayLayout6f24");class yu extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,i,c,d,m)}emplace(r,i,c,d,m,g){const v=5*r;return this.float32[v+0]=i,this.float32[v+1]=c,this.float32[v+2]=d,this.float32[v+3]=m,this.float32[v+4]=g,r}}yu.prototype.bytesPerElement=20,Ut(yu,"StructArrayLayout5f20");class ry extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v){const S=this.length;return this.resize(S+1),this.emplace(S,r,i,c,d,m,g,v)}emplace(r,i,c,d,m,g,v,S){const E=7*r;return this.float32[E+0]=i,this.float32[E+1]=c,this.float32[E+2]=d,this.float32[E+3]=m,this.float32[E+4]=g,this.float32[E+5]=v,this.float32[E+6]=S,r}}ry.prototype.bytesPerElement=28,Ut(ry,"StructArrayLayout7f28");class ny extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v,S,E,C,I){const R=this.length;return this.resize(R+1),this.emplace(R,r,i,c,d,m,g,v,S,E,C,I)}emplace(r,i,c,d,m,g,v,S,E,C,I,R){const L=11*r;return this.float32[L+0]=i,this.float32[L+1]=c,this.float32[L+2]=d,this.float32[L+3]=m,this.float32[L+4]=g,this.float32[L+5]=v,this.float32[L+6]=S,this.float32[L+7]=E,this.float32[L+8]=C,this.float32[L+9]=I,this.float32[L+10]=R,r}}ny.prototype.bytesPerElement=44,Ut(ny,"StructArrayLayout11f44");class fd extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v,S,E){const C=this.length;return this.resize(C+1),this.emplace(C,r,i,c,d,m,g,v,S,E)}emplace(r,i,c,d,m,g,v,S,E,C){const I=9*r;return this.float32[I+0]=i,this.float32[I+1]=c,this.float32[I+2]=d,this.float32[I+3]=m,this.float32[I+4]=g,this.float32[I+5]=v,this.float32[I+6]=S,this.float32[I+7]=E,this.float32[I+8]=C,r}}fd.prototype.bytesPerElement=36,Ut(fd,"StructArrayLayout9f36");class ul extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i){const c=this.length;return this.resize(c+1),this.emplace(c,r,i)}emplace(r,i,c){const d=2*r;return this.float32[d+0]=i,this.float32[d+1]=c,r}}ul.prototype.bytesPerElement=8,Ut(ul,"StructArrayLayout2f8");class To extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,i,c,d){const m=this.length;return this.resize(m+1),this.emplace(m,r,i,c,d)}emplace(r,i,c,d,m){const g=6*r;return this.uint32[3*r+0]=i,this.uint16[g+2]=c,this.uint16[g+3]=d,this.uint16[g+4]=m,r}}To.prototype.bytesPerElement=12,Ut(To,"StructArrayLayout1ul3ui12");class Pc extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){const i=this.length;return this.resize(i+1),this.emplace(i,r)}emplace(r,i){return this.uint16[1*r+0]=i,r}}Pc.prototype.bytesPerElement=2,Ut(Pc,"StructArrayLayout1ui2");class iy extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q){const W=this.length;return this.resize(W+1),this.emplace(W,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q)}emplace(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W){const re=16*r;return this.float32[re+0]=i,this.float32[re+1]=c,this.float32[re+2]=d,this.float32[re+3]=m,this.float32[re+4]=g,this.float32[re+5]=v,this.float32[re+6]=S,this.float32[re+7]=E,this.float32[re+8]=C,this.float32[re+9]=I,this.float32[re+10]=R,this.float32[re+11]=L,this.float32[re+12]=z,this.float32[re+13]=U,this.float32[re+14]=q,this.float32[re+15]=W,r}}iy.prototype.bytesPerElement=64,Ut(iy,"StructArrayLayout16f64");class em extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,i,c,d,m,g,v){const S=this.length;return this.resize(S+1),this.emplace(S,r,i,c,d,m,g,v)}emplace(r,i,c,d,m,g,v,S){const E=10*r,C=5*r;return this.uint16[E+0]=i,this.uint16[E+1]=c,this.uint16[E+2]=d,this.uint16[E+3]=m,this.float32[C+2]=g,this.float32[C+3]=v,this.float32[C+4]=S,r}}em.prototype.bytesPerElement=20,Ut(em,"StructArrayLayout4ui3f20");class sy extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r){const i=this.length;return this.resize(i+1),this.emplace(i,r)}emplace(r,i){return this.int16[1*r+0]=i,r}}sy.prototype.bytesPerElement=2,Ut(sy,"StructArrayLayout1i2");class tm extends Xn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(r){const i=this.length;return this.resize(i+1),this.emplace(i,r)}emplace(r,i){return this.uint8[1*r+0]=i,r}}tm.prototype.bytesPerElement=1,Ut(tm,"StructArrayLayout1ub1");class rm extends $h{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]}}rm.prototype.size=40;class zx extends Yp{get(r){return new rm(this,r)}}Ut(zx,"CollisionBoxArray");class nm extends $h{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(r){this._structArray.uint8[this._pos1+49]=r}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(r){this._structArray.uint8[this._pos1+50]=r}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(r){this._structArray.uint32[this._pos4+13]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(r){this._structArray.uint8[this._pos1+58]=r}}nm.prototype.size=60;class Fx extends hd{get(r){return new nm(this,r)}}Ut(Fx,"PlacedSymbolArray");class Bx extends $h{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(r){this._structArray.uint32[this._pos4+14]=r}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(r){this._structArray.float32[this._pos4+18]=r}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Bx.prototype.size=80;class oy extends ey{get(r){return new Bx(this,r)}}Ut(oy,"SymbolInstanceArray");class im extends Ll{getoffsetX(r){return this.float32[1*r+0]}}Ut(im,"GlyphOffsetArray");class Nx extends Cc{getx(r){return this.int16[2*r+0]}gety(r){return this.int16[2*r+1]}}Ut(Nx,"SymbolLineVertexArray");class ay extends $h{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]}}ay.prototype.size=12;class ly extends To{get(r){return new ay(this,r)}}Ut(ly,"FeatureIndexArray");class jx extends Jo{geta_centroid_pos0(r){return this.uint16[2*r+0]}geta_centroid_pos1(r){return this.uint16[2*r+1]}}Ut(jx,"FillExtrusionCentroidArray");class sm extends $h{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]}}sm.prototype.size=6;class Gh extends ud{get(r){return new sm(this,r)}}Ut(Gh,"FillExtrusionWallArray");const Vx=Br([{name:"a_pos",components:2,type:"Int16"}],4),US=Br([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Ux=Br([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class ri{constructor(r=[]){this.segments=r}_prepareSegment(r,i,c,d){let m=this.segments[this.segments.length-1];return r>ri.MAX_VERTEX_ARRAY_LENGTH&&Ft(`Max vertices per segment is ${ri.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}`),(!m||m.vertexLength+r>ri.MAX_VERTEX_ARRAY_LENGTH||m.sortKey!==d)&&(m={vertexOffset:i,primitiveOffset:c,vertexLength:0,primitiveLength:0},d!==void 0&&(m.sortKey=d),this.segments.push(m)),m}prepareSegment(r,i,c,d){return this._prepareSegment(r,i.length,c.length,d)}get(){return this.segments}destroy(){for(const r of this.segments)for(const i in r.vaos)r.vaos[i].destroy()}static simpleSegment(r,i,c,d){return new ri([{vertexOffset:r,primitiveOffset:i,vertexLength:c,primitiveLength:d,vaos:{},sortKey:0}])}}function om(a,r){return 256*(a=K(Math.floor(a),0,255))+K(Math.floor(r),0,255)}ri.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ut(ri,"SegmentVector");const $S=Br([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),GS=Br([{name:"a_pattern_b",components:4,type:"Uint16"}]),HS=Br([{name:"a_dash",components:4,type:"Uint16"}]);class Hh{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(r,i,c,d){this.ids.push(cy(r)),this.positions.push(i,c,d)}eachPosition(r,i){const c=cy(r);let d=0,m=this.ids.length-1;for(;d<m;){const g=d+m>>1;this.ids[g]>=c?m=g:d=g+1}for(;this.ids[d]===c;)i(this.positions[3*d],this.positions[3*d+1],this.positions[3*d+2]),d++}static serialize(r,i){const c=new Float64Array(r.ids),d=new Uint32Array(r.positions);return uy(c,d,0,c.length-1),i&&(i.add(c.buffer),i.add(d.buffer)),{ids:c,positions:d}}static deserialize(r){const i=new Hh;let c;i.ids=r.ids,i.positions=r.positions;for(const d of i.ids)d!==c&&i.uniqueIds.push(d),c=d;return i.indexed=!0,i}}function cy(a){const r=+a;return Number.isSafeInteger(r)?r:rp(String(a))}function uy(a,r,i,c){for(;i<c;){const d=a[i+c>>1];let m=i-1,g=c+1;for(;;){do m++;while(a[m]<d);do g--;while(a[g]>d);if(m>=g)break;am(a,m,g),am(r,3*m,3*g),am(r,3*m+1,3*g+1),am(r,3*m+2,3*g+2)}g-i<c-g?(uy(a,r,i,g),i=g+1):(uy(a,r,g+1,c),c=g)}}function am(a,r,i){const c=a[r];a[r]=a[i],a[i]=c}Ut(Hh,"FeaturePositionMap");class Ol{constructor(r){this.gl=r.gl,this.initialized=!1}fetchUniformLocation(r,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(r,i),this.initialized=!0),!!this.location}set(r,i,c){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class lm extends Ol{constructor(r){super(r),this.current=0}set(r,i,c){this.fetchUniformLocation(r,i)&&this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}}class ji extends Ol{constructor(r){super(r),this.current=0}set(r,i,c){this.fetchUniformLocation(r,i)&&this.current!==c&&(this.current=c,this.gl.uniform1f(this.location,c))}}class dl extends Ol{constructor(r){super(r),this.current=[0,0]}set(r,i,c){this.fetchUniformLocation(r,i)&&(c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1])))}}class Wh extends Ol{constructor(r){super(r),this.current=[0,0,0]}set(r,i,c){this.fetchUniformLocation(r,i)&&(c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2])))}}class cm extends Ol{constructor(r){super(r),this.current=[0,0,0,0]}set(r,i,c){this.fetchUniformLocation(r,i)&&(c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]&&c[3]===this.current[3]||(this.current=c,this.gl.uniform4f(this.location,c[0],c[1],c[2],c[3])))}}class qh extends Ol{constructor(r){super(r),this.current=wn.transparent.toPremultipliedRenderColor(null)}set(r,i,c){this.fetchUniformLocation(r,i)&&(c.r===this.current.r&&c.g===this.current.g&&c.b===this.current.b&&c.a===this.current.a||(this.current=c,this.gl.uniform4f(this.location,c.r,c.g,c.b,c.a)))}}const WS=new Float32Array(16);class Kh extends Ol{constructor(r){super(r),this.current=WS}set(r,i,c){if(this.fetchUniformLocation(r,i)){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let d=1;d<16;d++)if(c[d]!==this.current[d]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}}}const um=new Float32Array(9),qS=new Float32Array(4);class dm extends Ol{constructor(r){super(r),this.current=qS}set(r,i,c){if(this.fetchUniformLocation(r,i)){for(let d=0;d<4;d++)if(c[d]!==this.current[d]){this.current=c,this.gl.uniformMatrix2fv(this.location,!1,c);break}}}}function dy(a){return[om(255*a.r,255*a.g),om(255*a.b,255*a.a)]}function Zh(a,r,i,c,d,m,g,v){return!!a&&(a.kind==="composite"||a.kind==="source"?a.evaluate(new $n(0,{brightness:m,worldview:v}),r,i,d,c,g)==="none":a.value==="none")}class Xh{constructor(r,i,c,d){this.value=r,this.uniformNames=i.map(m=>`u_${m}`),this.type=c,this.context=d}setUniform(r,i,c,d,m){const g=d.constantOr(this.value);i.set(r,m,g instanceof wn?g.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):g)}getBinding(r,i){return this.type==="color"?new qh(r):new ji(r)}}class pd{constructor(r,i){this.uniformNames=i.map(c=>`u_${c}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(r,i){this.pixelRatio=r.pixelRatio||1,this.pattern=r.tl.concat(r.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(r,i,c,d,m){let g=null;m!=="u_pattern"&&m!=="u_dash"||(g=this.pattern),m==="u_pattern_b"&&(g=this.patternTransition),m==="u_pixel_ratio"&&(g=this.pixelRatio),g&&i.set(r,m,g)}getBinding(r,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new cm(r):new ji(r)}}class zl{constructor(r,i,c,d){this.expression=r,this.type=c,this.maxValue=0,this.paintVertexAttributes=i.map(m=>({name:`a_${m}`,type:"Float32",components:c==="color"?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(r,i,c,d,m,g,v,S){const E=this.paintVertexArray.length,C=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new $n(0,{brightness:g,worldview:S}),i,{},m,d,v):this.expression.kind==="constant"&&this.expression.value,I=Zh(this.lutExpression,i,{},d,m,g,v,S);this.paintVertexArray.resize(r),this._setPaintValue(E,r,C,I?null:this.context.lut)}updatePaintArray(r,i,c,d,m,g,v,S){const E=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:v,worldview:S},c,d,void 0,m):this.expression.kind==="constant"&&this.expression.value,C=Zh(this.lutExpression,c,d,m,void 0,v,void 0,S);this._setPaintValue(r,i,E,C?null:this.context.lut)}_setPaintValue(r,i,c,d){if(this.type==="color"){const m=dy(c.toPremultipliedRenderColor(d));for(let g=r;g<i;g++)this.paintVertexArray.emplace(g,m[0],m[1])}else{for(let m=r;m<i;m++)this.paintVertexArray.emplace(m,c);this.maxValue=Math.max(this.maxValue,Math.abs(c))}}upload(r){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=r.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 Fl{constructor(r,i,c,d,m,g){this.expression=r,this.uniformNames=i.map(v=>`u_${v}_t`),this.type=c,this.useIntegerZoom=d,this.context=m,this.maxValue=0,this.paintVertexAttributes=i.map(v=>({name:`a_${v}`,type:"Float32",components:c==="color"?4:2,offset:0})),this.paintVertexArray=new g}populatePaintArray(r,i,c,d,m,g,v,S){const E=this.expression.evaluate(new $n(this.context.zoom,{brightness:g,worldview:S}),i,{},m,d,v),C=this.expression.evaluate(new $n(this.context.zoom+1,{brightness:g,worldview:S}),i,{},m,d,v),I=Zh(this.lutExpression,i,{},d,m,g,v,S),R=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValue(R,r,E,C,I?null:this.context.lut)}updatePaintArray(r,i,c,d,m,g,v,S){const E=this.expression.evaluate({zoom:this.context.zoom,brightness:v,worldview:S},c,d,void 0,m),C=this.expression.evaluate({zoom:this.context.zoom+1,brightness:v,worldview:S},c,d,void 0,m),I=Zh(this.lutExpression,c,d,m,void 0,v,void 0,S);this._setPaintValue(r,i,E,C,I?null:this.context.lut)}_setPaintValue(r,i,c,d,m){if(this.type==="color"){const g=dy(c.toPremultipliedRenderColor(m)),v=dy(c.toPremultipliedRenderColor(m));for(let S=r;S<i;S++)this.paintVertexArray.emplace(S,g[0],g[1],v[0],v[1])}else{for(let g=r;g<i;g++)this.paintVertexArray.emplace(g,c,d);this.maxValue=Math.max(this.maxValue,Math.abs(c),Math.abs(d))}}upload(r){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=r.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(r,i,c,d,m){const g=this.useIntegerZoom?Math.floor(c.zoom):c.zoom,v=K(this.expression.interpolationFactor(g,this.context.zoom,this.context.zoom+1),0,1);i.set(r,m,v)}getBinding(r,i){return new ji(r)}}class Bl{constructor(r,i,c,d,m){this.expression=r,this.layerId=m,this.paintVertexAttributes=(c==="array"?HS:$S).members;for(let g=0;g<i.length;++g);this.paintVertexArray=new d,this.paintTransitionVertexArray=new _u}populatePaintArray(r,i,c,d){const m=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValues(m,r,i.patterns&&i.patterns[this.layerId],c)}updatePaintArray(r,i,c,d,m,g,v){this._setPaintValues(r,i,c.patterns&&c.patterns[this.layerId],g)}_setPaintValues(r,i,c,d){if(!d||!c)return;const m=d[c[0]],g=d[c[1]];if(m){if(m){const{tl:v,br:S,pixelRatio:E}=m;for(let C=r;C<i;C++)this.paintVertexArray.emplace(C,v[0],v[1],S[0],S[1],E)}if(g){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:v,br:S}=g;for(let E=r;E<i;E++)this.paintTransitionVertexArray.emplace(E,v[0],v[1],S[0],S[1])}}}upload(r){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=r.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=r.createVertexBuffer(this.paintTransitionVertexArray,GS.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Mc{constructor(r,i,c=()=>!0){this.binders={},this._buffers=[],this.context=i;const d=[];for(const m in r.paint._values){const g=r.paint.get(m);if(m.endsWith("-use-theme")||!c(m)||!(g instanceof hu&&zh(g.property.specification)))continue;const v=ZS(m,r.type),S=g.value,E=g.property.specification.type,C=!!g.property.useIntegerZoom,I=m==="line-dasharray"||m.endsWith("pattern"),R=r.paint.get(`${m}-use-theme`),L=m==="line-dasharray"&&r.layout.get("line-cap").value.kind!=="constant"||R&&R.value.kind!=="constant";if(S.kind!=="constant"||L)if(S.kind==="source"||L||I){const z=hy(m,E,"source");this.binders[m]=I?new Bl(S,v,E,z,r.id):new zl(S,v,E,z),d.push(`/a_${m}`)}else{const z=hy(m,E,"composite");this.binders[m]=new Fl(S,v,E,C,i,z),d.push(`/z_${m}`)}else this.binders[m]=I?new pd(S.value,v):new Xh(S.value,v,E,i),d.push(`/u_${m}`);R&&(this.binders[m].lutExpression=R.value)}this.cacheKey=d.sort().join("")}getMaxValue(r){const i=this.binders[r];return i instanceof zl||i instanceof Fl?i.maxValue:0}populatePaintArrays(r,i,c,d,m,g,v,S){for(const E in this.binders){const C=this.binders[E];C.context=this.context,(C instanceof zl||C instanceof Fl||C instanceof Bl)&&C.populatePaintArray(r,i,c,d,m,g,v,S)}}setConstantPatternPositions(r,i){for(const c in this.binders){const d=this.binders[c];d instanceof pd&&d.setConstantPatternPositions(r,i)}}getPatternTransitionVertexBuffer(r){const i=this.binders[r];return i instanceof Bl?i.paintTransitionVertexBuffer:null}updatePaintArrays(r,i,c,d,m,g,v,S,E,C){let I=!1;const R=Object.keys(r),L=R.length!==0&&!S,z=L?R:i.uniqueIds;this.context.lut=m.lut;for(const U in this.binders){const q=this.binders[U];if(q.context=this.context,(q instanceof zl||q instanceof Fl||q instanceof Bl)&&q.expression&&q.expression.kind&&q.expression.kind!=="constant"&&(q.expression.isStateDependent===!0||q.expression.isLightConstant===!1)){const W=m.paint.get(U);q.expression=W.value;for(const re of z){const ie=r[re.toString()];i.eachPosition(re,(ue,ve,me)=>{const be=d.feature(ue);q.updatePaintArray(ve,me,be,ie,g,v,E,C)})}if(!L)for(const re of c.uniqueIds){const ie=r[re.toString()];c.eachPosition(re,(ue,ve,me)=>{const be=d.feature(ue);q.updatePaintArray(ve,me,be,ie,g,v,E,C)})}I=!0}}return I}defines(){const r=[];for(const i in this.binders){const c=this.binders[i];(c instanceof Xh||c instanceof pd)&&r.push(...c.uniformNames.map(d=>`#define HAS_UNIFORM_${d}`))}return r}getPaintVertexBuffers(){return this._buffers}getUniforms(r){const i=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof Xh||d instanceof pd||d instanceof Fl)for(const m of d.uniformNames)i.push({name:m,property:c,binding:d.getBinding(r,m)})}return i}setUniforms(r,i,c,d,m){for(const{name:g,property:v,binding:S}of c)this.binders[v].setUniform(r,S,m,d.get(v),g)}updatePaintBuffers(){this._buffers=[];for(const r in this.binders){const i=this.binders[r];(i instanceof zl||i instanceof Fl||i instanceof Bl)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof Bl&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(r){for(const i in this.binders){const c=this.binders[i];(c instanceof zl||c instanceof Fl||c instanceof Bl)&&c.upload(r)}this.updatePaintBuffers()}destroy(){for(const r in this.binders){const i=this.binders[r];(i instanceof zl||i instanceof Fl||i instanceof Bl)&&i.destroy()}}}class Fa{constructor(r,i,c=()=>!0){this.programConfigurations={};for(const d of r)this.programConfigurations[d.id]=new Mc(d,i,c);this.needsUpload=!1,this._featureMap=new Hh,this._featureMapWithoutIds=new Hh,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(r,i,c,d,m,g,v,S,E){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(r,i,d,m,g,v,S,E);i.id!==void 0?this._featureMap.add(i.id,c,this._bufferOffset,r):(this._featureMapWithoutIds.add(this._idlessCounter,c,this._bufferOffset,r),this._idlessCounter+=1),this._bufferOffset=r,this.needsUpload=!0}updatePaintArrays(r,i,c,d,m,g,v,S){for(const E of c)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(r,this._featureMap,this._featureMapWithoutIds,i,E,d,m,g,v||0,S)||this.needsUpload}get(r){return this.programConfigurations[r]}upload(r){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(r);this.needsUpload=!1}}destroy(){for(const r in this.programConfigurations)this.programConfigurations[r].destroy()}}const KS={"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 ZS(a,r){return KS[a]||[a.replace(`${r}-`,"").replace(/-/g,"_")]}const XS={"line-pattern":{source:So,composite:So},"fill-pattern":{source:So,composite:So},"fill-extrusion-pattern":{source:So,composite:So},"line-dasharray":{source:_u,composite:_u}},YS={color:{source:ul,composite:Ic},number:{source:Ll,composite:ul}};function hy(a,r,i){const c=XS[a];return c&&c[i]||YS[r][i]}Ut(Xh,"ConstantBinder"),Ut(pd,"PatternConstantBinder"),Ut(zl,"SourceExpressionBinder"),Ut(Bl,"PatternCompositeBinder"),Ut(Fl,"CompositeExpressionBinder"),Ut(Mc,"ProgramConfiguration",{omit:["_buffers"]}),Ut(Fa,"ProgramConfigurationSet");const Vs=bt/Math.PI/2,_a=5,hm=6,JS=16383,md=64,fy=[md,32,16],ya=-Vs,va=Vs;function vu(a,r,i,c=Vs){return i=zr(i),[a*Math.sin(i)*c,-r*c,a*Math.cos(i)*c]}function gd(a,r,i){return vu(Math.cos(zr(a)),Math.sin(zr(a)),r,i)}const f=63710088e-1,n=2*Math.PI*f;class l{constructor(r,i){if(isNaN(r)||isNaN(i))throw new Error(`Invalid LngLat object: (${r}, ${i})`);if(this.lng=+r,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 l(fe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(r){const i=Math.PI/180,c=this.lat*i,d=r.lat*i,m=Math.sin(c)*Math.sin(d)+Math.cos(c)*Math.cos(d)*Math.cos((r.lng-this.lng)*i);return f*Math.acos(Math.min(m,1))}toBounds(r=0){const i=360*r/40075017,c=i/Math.cos(Math.PI/180*this.lat);return new p({lng:this.lng-c,lat:this.lat-i},{lng:this.lng+c,lat:this.lat+i})}toEcef(r){return gd(this.lat,this.lng,Vs+r*Vs/f)}static convert(r){if(r instanceof l)return r;if(Array.isArray(r)&&(r.length===2||r.length===3))return new l(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&typeof r=="object"&&r!==null)return new l(Number("lng"in r?r.lng:r.lon),Number(r.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class p{constructor(r,i){r&&(i?this.setSouthWest(r).setNorthEast(i):Array.isArray(r)&&r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1]))}setNorthEast(r){return this._ne=r instanceof l?new l(r.lng,r.lat):l.convert(r),this}setSouthWest(r){return this._sw=r instanceof l?new l(r.lng,r.lat):l.convert(r),this}extend(r){const i=this._sw,c=this._ne;let d,m;if(r instanceof l)d=r,m=r;else{if(!(r instanceof p))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(p.convert(r)):this.extend(l.convert(r)):typeof r=="object"&&r!==null&&r.hasOwnProperty("lat")&&(r.hasOwnProperty("lon")||r.hasOwnProperty("lng"))?this.extend(l.convert(r)):this;if(d=r._sw,m=r._ne,!d||!m)return this}return i||c?(i.lng=Math.min(d.lng,i.lng),i.lat=Math.min(d.lat,i.lat),c.lng=Math.max(m.lng,c.lng),c.lat=Math.max(m.lat,c.lat)):(this._sw=new l(d.lng,d.lat),this._ne=new l(m.lng,m.lat)),this}getCenter(){return new l((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 l(this.getWest(),this.getNorth())}getSouthEast(){return new l(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(r){const{lng:i,lat:c}=l.convert(r);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<=c&&c<=this._ne.lat&&d}static convert(r){if(r)return r instanceof p?r:new p(r)}}const y=0,x=25.5;function b(a){return n*Math.cos(a*Math.PI/180)}function T(a){return(180+a)/360}function A(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function M(a,r){return a/b(r)}function D(a){return 360*a-180}function N(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function B(a,r){return a*b(N(r))}const j=85.051129;function H(a){return Math.cos(zr(K(a,-j,j)))}function G(a,r){const i=K(r,y,x),c=Math.pow(2,i);return H(a)*n/(512*c)}function Q(a){return 1/Math.cos(a*Math.PI/180)}function J(a,r=0){const i=Math.exp(Math.PI*(1-(a.y+r/bt)/(1<<a.z)*2));return 80150034*i/(i*i+1)/bt/(1<<a.z)}class ae{constructor(r,i,c=0){this.x=+r,this.y=+i,this.z=+c}static fromLngLat(r,i=0){const c=l.convert(r);return new ae(T(c.lng),A(c.lat),M(i,c.lat))}toLngLat(){return new l(D(this.x),N(this.y))}toAltitude(){return B(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/n*Q(N(this.y))}}function de(a,r,i,c,d,m,g,v,S){const E=(r+c)/2,C=(i+d)/2,I=new it(E,C);v(I),function(R,L,z,U,q,W){const re=z-q,ie=U-W;return Math.abs((U-L)*re-(z-R)*ie)/Math.hypot(re,ie)}(I.x,I.y,m.x,m.y,g.x,g.y)>=S?(de(a,r,i,E,C,m,I,v,S),de(a,E,C,c,d,I,g,v,S)):a.push(g)}function ce(a,r,i){let c=a[0],d=c.x,m=c.y;r(c);const g=[c];for(let v=1;v<a.length;v++){const S=a[v],{x:E,y:C}=S;r(S),de(g,d,m,E,C,c,S,r,i),d=E,m=C,c=S}return g}function Se(a,r,i,c){if(c(r,i)){const d=r.add(i)._mult(.5);Se(a,r,d,c),Se(a,d,i,c)}else a.push(i)}function ye(a,r){let i=a[0];const c=[i];for(let d=1;d<a.length;d++){const m=a[d];Se(c,i,m,r),i=m}return c}const we=Math.pow(2,14)-1,_e=-we-1;function pe(a,r){const i=Math.round(a.x*r),c=Math.round(a.y*r);return a.x=K(i,_e,we),a.y=K(c,_e,we),(i<a.x||i>a.x+1||c<a.y||c>a.y+1)&&Ft("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a}function Te(a,r,i){const c=a.loadGeometry(),d=a.extent,m=bt/d;if(r&&i&&i.projection.isReprojectedInTileSpace){const g=1<<r.z,{scale:v,x:S,y:E,projection:C}=i,I=R=>{const L=D((r.x+R.x/d)/g),z=N((r.y+R.y/d)/g),U=C.project(L,z);R.x=(U.x*v-S)*d,R.y=(U.y*v-E)*d};for(let R=0;R<c.length;R++)if(a.type!==1)c[R]=ce(c[R],I,1);else{const L=[];for(const z of c[R])z.x<0||z.x>=d||z.y<0||z.y>=d||(I(z),L.push(z));c[R]=L}}for(const g of c)for(const v of g)pe(v,m);return c}function De(a,r){return{type:a.type,id:a.id,properties:a.properties,geometry:r?Te(a):[]}}class Me{constructor(r,i,c,d,m){this.properties={},this.extent=c,this.type=0,this.id=void 0,this._pbf=r,this._geometry=-1,this._keys=d,this._values=m,r.readFields(Ge,this,i)}loadGeometry(){const r=this._pbf;r.pos=this._geometry;const i=r.readVarint()+r.pos,c=[];let d,m=1,g=0,v=0,S=0;for(;r.pos<i;){if(g<=0){const E=r.readVarint();m=7&E,g=E>>3}if(g--,m===1||m===2)v+=r.readSVarint(),S+=r.readSVarint(),m===1&&(d&&c.push(d),d=[]),d&&d.push(new it(v,S));else{if(m!==7)throw new Error(`unknown command ${m}`);d&&d.push(d[0].clone())}}return d&&c.push(d),c}bbox(){const r=this._pbf;r.pos=this._geometry;const i=r.readVarint()+r.pos;let c=1,d=0,m=0,g=0,v=1/0,S=-1/0,E=1/0,C=-1/0;for(;r.pos<i;){if(d<=0){const I=r.readVarint();c=7&I,d=I>>3}if(d--,c===1||c===2)m+=r.readSVarint(),g+=r.readSVarint(),m<v&&(v=m),m>S&&(S=m),g<E&&(E=g),g>C&&(C=g);else if(c!==7)throw new Error(`unknown command ${c}`)}return[v,E,S,C]}toGeoJSON(r,i,c){const d=this.extent*Math.pow(2,c),m=this.extent*r,g=this.extent*i,v=this.loadGeometry();function S(R){return[360*(R.x+m)/d-180,360/Math.PI*Math.atan(Math.exp((1-2*(R.y+g)/d)*Math.PI))-90]}function E(R){return R.map(S)}let C;if(this.type===1){const R=[];for(const z of v)R.push(z[0]);const L=E(R);C=R.length===1?{type:"Point",coordinates:L[0]}:{type:"MultiPoint",coordinates:L}}else if(this.type===2){const R=v.map(E);C=R.length===1?{type:"LineString",coordinates:R[0]}:{type:"MultiLineString",coordinates:R}}else{if(this.type!==3)throw new Error("unknown feature type");{const R=function(z){const U=z.length;if(U<=1)return[z];const q=[];let W,re;for(let ie=0;ie<U;ie++){const ue=He(z[ie]);ue!==0&&(re===void 0&&(re=ue<0),re===ue<0?(W&&q.push(W),W=[z[ie]]):W&&W.push(z[ie]))}return W&&q.push(W),q}(v),L=[];for(const z of R)L.push(z.map(E));C=L.length===1?{type:"Polygon",coordinates:L[0]}:{type:"MultiPolygon",coordinates:L}}}const I={type:"Feature",geometry:C,properties:this.properties};return this.id!=null&&(I.id=this.id),I}}function Ge(a,r,i){a===1?r.id=i.readVarint():a===2?function(c,d){const m=c.readVarint()+c.pos;for(;c.pos<m;){const g=d._keys[c.readVarint()],v=d._values[c.readVarint()];d.properties[g]=v}}(i,r):a===3?r.type=i.readVarint():a===4&&(r._geometry=i.pos)}function He(a){let r=0;for(let i,c,d=0,m=a.length,g=m-1;d<m;g=d++)i=a[d],c=a[g],r+=(c.x-i.x)*(i.y+c.y);return r}Me.types=["Unknown","Point","LineString","Polygon"];class et{constructor(r,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(mt,this,i),this.length=this._features.length}feature(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];const i=this._pbf.readVarint()+this._pbf.pos;return new Me(this._pbf,i,this.extent,this._keys,this._values)}}function mt(a,r,i){a===15?r.version=i.readVarint():a===1?r.name=i.readString():a===5?r.extent=i.readVarint():a===2?r._features.push(i.pos):a===3?r._keys.push(i.readString()):a===4&&r._values.push(function(c){let d=null;const m=c.readVarint()+c.pos;for(;c.pos<m;){const g=c.readVarint()>>3;d=g===1?c.readString():g===2?c.readFloat():g===3?c.readDouble():g===4?c.readVarint64():g===5?c.readVarint():g===6?c.readSVarint():g===7?c.readBoolean():null}if(d==null)throw new Error("unknown feature value");return d}(i))}class Ne{constructor(r,i){this.layers=r.readFields(Ce,{},i)}}function Ce(a,r,i){if(a===3){const c=new et(i,i.readVarint()+i.pos);c.length&&(r[c.name]=c)}}const Ke="3d_elevation_id",Ve="level";class ot{constructor(){this._valid=!1}reset(r){return this.feature=r,this._valid=!0,this._geometry=r.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(r,i){return this._valid&&r(i(this._geometry)),this}require(r,i,c){return this.get(r,!0,i,c)}optional(r,i,c){return this.get(r,!1,i,c)}success(){return this._valid}get(r,i,c,d){const m=this.feature.properties.hasOwnProperty(r)?+this.feature.properties[r]:void 0;return this._valid&&m!==void 0&&!Number.isNaN(m)?c(d?d(m):m):i&&(this._valid=!1),this}}class Tt{constructor(r,i){this.featureFunc=r,this.vertexFunc=i}parseFeature(r,i,c){return this.featureFunc(r,i,c)}parseVertex(r,i,c){return this.vertexFunc(r,i,c)}}const zt=new Tt((a,r,i)=>a.reset(r).require(Ke,c=>{i.id=c}).optional("fixed_height_relative",c=>{i.constantHeight=c},gt.decodeRelativeHeight).geometry(c=>{i.bounds=c},Cl).success(),(a,r,i)=>a.reset(r).require(Ke,c=>{i.id=c}).require("elevation_idx",c=>{i.idx=c}).require("extent",c=>{i.extent=c}).require("height_relative",c=>{i.height=c},gt.decodeRelativeHeight).geometry(c=>{i.position=c},gt.getPoint).success()),wt=new Tt((a,r,i)=>a.reset(r).require(Ke,c=>{i.id=c}).optional("fixed_height",c=>{i.constantHeight=c},gt.decodeMetricHeight).geometry(c=>{i.bounds=c},Cl).success(),(a,r,i)=>a.reset(r).require(Ke,c=>{i.id=c}).require("elevation_idx",c=>{i.idx=c}).require("extent",c=>{i.extent=c}).require("height",c=>{i.height=c},gt.decodeMetricHeight).geometry(c=>{i.position=c},gt.getPoint).success());class gt{static getPoint(r){return On(r[0][0].x,r[0][0].y)}static decodeRelativeHeight(r){return 1e-4*r*5}static decodeMetricHeight(r){return 1e-4*r}static getVersionSchema(r){return r?r==="1.0.1"?wt:void 0:zt}static parse(r){const i=[],c=[],d=r.length,m=new ot;for(let g=0;g<d;g++){const v=r.feature(g),S=v.properties.version,E=gt.getVersionSchema(S);if(E===void 0){Ft(`Unknown elevation feature version number ${S||"(unknown)"}`);continue}const C=v.properties.type;if(!C)continue;const I=Me.types[v.type];if(I==="Point"&&C==="curve_point"){const R={};E.parseVertex(m,v,R)&&i.push(R)}else if(I==="Polygon"&&C==="curve_meta"){const R={};E.parseFeature(m,v,R)&&c.push(R)}}return{vertices:i,features:c}}}class Kt{constructor(r,i){this.pos=r,this.dir=i}intersectsPlane(r,i,c){const d=Lo(i,this.dir);if(Math.abs(d)<1e-6)return!1;const m=((r[0]-this.pos[0])*i[0]+(r[1]-this.pos[1])*i[1])/d;return c[0]=this.pos[0]+this.dir[0]*m,c[1]=this.pos[1]+this.dir[1]*m,!0}}class $t{constructor(r,i){this.pos=r,this.dir=i}intersectsPlane(r,i,c){const d=Nn(i,this.dir);if(Math.abs(d)<1e-6)return!1;const m=((r[0]-this.pos[0])*i[0]+(r[1]-this.pos[1])*i[1]+(r[2]-this.pos[2])*i[2])/d;return c[0]=this.pos[0]+this.dir[0]*m,c[1]=this.pos[1]+this.dir[1]*m,c[2]=this.pos[2]+this.dir[2]*m,!0}closestPointOnSphere(r,i,c){if(function(L,z){var U=L[0],q=L[1],W=L[2],re=z[0],ie=z[1],ue=z[2];return Math.abs(U-re)<=k*Math.max(1,Math.abs(U),Math.abs(re))&&Math.abs(q-ie)<=k*Math.max(1,Math.abs(q),Math.abs(ie))&&Math.abs(W-ue)<=k*Math.max(1,Math.abs(W),Math.abs(ue))}(this.pos,r)||i===0)return c[0]=c[1]=c[2]=0,!1;const[d,m,g]=this.dir,v=this.pos[0]-r[0],S=this.pos[1]-r[1],E=this.pos[2]-r[2],C=d*d+m*m+g*g,I=2*(v*d+S*m+E*g),R=I*I-4*C*(v*v+S*S+E*E-i*i);if(R<0){const L=Math.max(-I/2,0),z=v+d*L,U=S+m*L,q=E+g*L,W=Math.hypot(z,U,q);return c[0]=z*i/W,c[1]=U*i/W,c[2]=q*i/W,!1}{const L=(-I-Math.sqrt(R))/(2*C);if(L<0){const z=Math.hypot(v,S,E);return c[0]=v*i/z,c[1]=S*i/z,c[2]=E*i/z,!1}return c[0]=v+d*L,c[1]=S+m*L,c[2]=E+g*L,!0}}}class Dt{constructor(r,i,c,d,m){this.TL=r,this.TR=i,this.BR=c,this.BL=d,this.horizon=m}static fromInvProjectionMatrix(r,i,c){const d=[-1,1,1],m=[1,1,1],g=[1,-1,1],v=[-1,-1,1],S=Un(d,d,r),E=Un(m,m,r),C=Un(g,g,r),I=Un(v,v,r);return new Dt(S,E,C,I,i/c)}}function Bt(a,r,i){let c=1/0,d=-1/0;const m=[];for(const g of a){Zn(m,g,r);const v=Nn(m,i);c=Math.min(c,v),d=Math.max(d,v)}return[c,d]}function nr(a,r){let i=!0;for(let c=0;c<a.planes.length;c++){const d=a.planes[c];let m=0;for(let g=0;g<r.length;g++)m+=+(Nn(d,r[g])+d[3]>=0);if(m===0)return 0;m!==r.length&&(i=!1)}return i?2:1}function xr(a,r){for(const i of a.projections){const c=Bt(r,a.points[0],i.axis);if(i.projection[1]<c[0]||i.projection[0]>c[1])return 0}return 1}function Ur(a,r){let i=0;const c=[0,0,0,0];for(let g=0;g<a.length;g++)c[0]=a[g][0],c[1]=a[g][1],c[2]=a[g][2],c[3]=1,(d=c)[0]*(m=r)[0]+d[1]*m[1]+d[2]*m[2]+d[3]*m[3]>=0&&i++;var d,m;return i}class dn{constructor(r,i){this.points=r||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=Zt.fromPoints(this.points),this.projections=[],this.frustumEdges=[Zn([],this.points[2],this.points[3]),Zn([],this.points[0],this.points[3]),Zn([],this.points[4],this.points[0]),Zn([],this.points[5],this.points[1]),Zn([],this.points[6],this.points[2]),Zn([],this.points[7],this.points[3])];for(const c of this.frustumEdges){const d=[0,-c[2],c[1]],m=[c[2],0,-c[0]];this.projections.push({axis:d,projection:Bt(this.points,this.points[0],d)}),this.projections.push({axis:m,projection:Bt(this.points,this.points[0],m)})}}static fromInvProjectionMatrix(r,i,c,d){const m=Math.pow(2,c),g=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(E=>{const C=rs([],E,r),I=1/C[3]/i*m;return(R=C)[0]=(L=C)[0]*(z=[I,I,d?1/C[3]:I,I])[0],R[1]=L[1]*z[1],R[2]=L[2]*z[2],R[3]=L[3]*z[3],R;var R,L,z}),v=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const C=un([],gi([],Zn([],g[E[0]],g[E[1]]),Zn([],g[E[2]],g[E[1]]))),I=-Nn(C,g[E[1]]);return C.concat(I)}),S=[];for(let E=0;E<g.length;E++)S.push([g[E][0],g[E][1],g[E][2]]);return new dn(S,v)}intersectsPrecise(r,i,c){for(let d=0;d<i.length;d++)if(!Ur(r,i[d]))return 0;for(let d=0;d<this.planes.length;d++)if(!Ur(r,this.planes[d]))return 0;for(const d of c)for(const m of this.frustumEdges){const g=gi([],d,m),v=It(g);if(v===0)continue;hr(g,g,1/v);const S=Bt(this.points,this.points[0],g),E=Bt(r,this.points[0],g);if(S[0]>E[1]||E[0]>S[1])return 0}return 1}containsPoint(r){for(const i of this.planes){const c=i[3];if(Nn([i[0],i[1],i[2]],r)+c<0)return!1}return!0}}class Zt{static fromPoints(r){const i=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];for(const d of r)_r(i,i,d),yr(c,c,d);return new Zt(i,c)}static fromTileIdAndHeight(r,i,c){const d=1<<r.canonical.z,m=r.canonical.x,g=r.canonical.y;return new Zt([m/d,g/d,i],[(m+1)/d,(g+1)/d,c])}static applyTransform(r,i){const c=r.getCorners();for(let d=0;d<c.length;++d)Un(c[d],c[d],i);return Zt.fromPoints(c)}static applyTransformFast(r,i){const c=[i[12],i[13],i[14]],d=[...c];for(let m=0;m<3;m++)for(let g=0;g<3;g++){const v=i[4*g+m],S=v*r.min[g],E=v*r.max[g];c[m]+=Math.min(S,E),d[m]+=Math.max(S,E)}return new Zt(c,d)}static projectAabbCorners(r,i){const c=r.getCorners();for(let d=0;d<c.length;++d)Un(c[d],c[d],i);return c}constructor(r,i){this.min=r,this.max=i,this.center=hr([],st([],this.min,this.max),.5)}quadrant(r){const i=[r%2==0,r<2],c=xt(this.min),d=xt(this.max);for(let m=0;m<i.length;m++)c[m]=i[m]?this.min[m]:this.center[m],d[m]=i[m]?this.center[m]:this.max[m];return d[2]=this.max[2],new Zt(c,d)}distanceX(r){return Math.max(Math.min(this.max[0],r[0]),this.min[0])-r[0]}distanceY(r){return Math.max(Math.min(this.max[1],r[1]),this.min[1])-r[1]}distanceZ(r){return Math.max(Math.min(this.max[2],r[2]),this.min[2])-r[2]}getCorners(){const r=this.min,i=this.max;return[[r[0],r[1],r[2]],[i[0],r[1],r[2]],[i[0],i[1],r[2]],[r[0],i[1],r[2]],[r[0],r[1],i[2]],[i[0],r[1],i[2]],[i[0],i[1],i[2]],[r[0],i[1],i[2]]]}intersects(r){return this.intersectsAabb(r.bounds)?nr(r,this.getCorners()):0}intersectsFlat(r){return this.intersectsAabb(r.bounds)?nr(r,[[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(r,i){return i||this.intersects(r)?xr(r,this.getCorners()):0}intersectsPreciseFlat(r,i){return i||this.intersectsFlat(r)?xr(r,[[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(r){for(let i=0;i<3;++i)if(this.min[i]>r.max[i]||r.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(r){return!(this.min[0]>r.max[0]||r.min[0]>this.max[0]||this.min[1]>r.max[1]||r.min[1]>this.max[1])}encapsulate(r){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],r.min[i]),this.max[i]=Math.max(this.max[i],r.max[i])}encapsulatePoint(r){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],r[i]),this.max[i]=Math.max(this.max[i],r[i])}closestPoint(r){return[Math.max(Math.min(this.max[0],r[0]),this.min[0]),Math.max(Math.min(this.max[1],r[1]),this.min[1]),Math.max(Math.min(this.max[2],r[2]),this.min[2])]}}Ut(Zt,"Aabb");class an{constructor(r,i){this.feature=r,this.metersToTile=i,this.index=0}get(){const r=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,c=i[1],d=-i[0],m=(r.extent+1)*this.metersToTile;return[new it(Math.trunc(r.position[0]+c*m),Math.trunc(r.position[1]+d*m)),new it(Math.trunc(r.position[0]-c*m),Math.trunc(r.position[1]-d*m))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class vr{constructor(r,i,c,d,m,g){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Wr(),Wr(),Wr(),Wr(),Wr(),Wr(),Wr()],this.id=r,this.heightRange={min:c,max:c},this.safeArea=i,this.constantHeight=c,this.constantHeight==null&&(this.constantHeight!=null||d.length!==0)){this.vertices=d,this.edges=m,this.edges=this.edges.filter(v=>{return v.a<this.vertices.length&&v.b<this.vertices.length&&!((S=this.vertices[v.a].position)[0]===(E=this.vertices[v.b].position)[0]&&S[1]===E[1]);var S,E}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const v of this.vertices)this.vertexProps.push({dir:On(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,v.height),this.heightRange.max=Math.max(this.heightRange.max,v.height);for(const v of this.edges){const S=this.vertices[v.a].position,E=this.vertices[v.b].position,C=yo(Wr(),E,S),I=oo(C),R=Do(Wr(),C,1/I);this.edgeProps.push({vec:C,dir:R,len:I});const L=this.vertexProps[v.a].dir,z=this.vertexProps[v.b].dir;qo(L,L,R),qo(z,z,R)}for(const v of this.vertexProps)v.dir[0]===0&&v.dir[1]===0||vo(v.dir,v.dir);this.tessellate(g)}}pointElevation(r){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(r);if(i==null)return 0;const[c,d]=i;return ur(this.vertices[this.edges[c].a].height,this.vertices[this.edges[c].b].height,d)}computeSlopeNormal(r,i){const c=this.getClosestEdge(r);if(!c)return Ot(0,0,1);const d=c[0],m=this.edges[d],g=this.edgeProps[d].vec,v=Ot(g[0],g[1],(this.vertices[m.b].height-this.vertices[m.a].height)*i),S=Ot(v[1],-v[0],0);gi(S,S,v);const E=It(S);return E>0?hr(S,S,1/E):Et(S,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(r){if(this.edges.length===0)return;let i=0,c=Number.POSITIVE_INFINITY,d=0;const[m,g,v,S,E,C,I]=this._tmpVec2;Zs(I,r.x,r.y);const R=new Kt(I,null);for(let L=0;L<this.edges.length;L++){const z=this.edges[L],U=this.edgeProps[L].dir;R.dir=U;const q=this.vertices[z.a].position,W=this.vertices[z.b].position,re=R.intersectsPlane(q,this.vertexProps[z.a].dir,m),ie=R.intersectsPlane(W,this.vertexProps[z.b].dir,g);if(!re||!ie)continue;yo(v,g,m),yo(S,I,m);const ue=Lo(v,v),ve=ue>0?Lo(S,v)/ue:0,me=K(ve,0,1),be=Math.abs((ve-me)*this.edgeProps[L].len);yo(E,I,q),Zs(C,U[1],-U[0]);const ke=be+Math.abs(Lo(E,C));ke<c&&(i=L,c=ke,d=me)}return[i,d]}tessellate(r){const i=Qe(),c=Qe(),d=Qe(),m=Qe();for(let g=this.edges.length-1;g>=0;--g){const v=this.edges[g].a,S=this.edges[g].b,{position:E,height:C,extent:I}=this.vertices[v],{position:R,height:L,extent:z}=this.vertices[S],U=this.vertexProps[v].dir,q=this.vertexProps[S].dir;if(Et(i,E[0]/r,E[1]/r,C),Et(c,R[0]/r,R[1]/r,L),Et(d,U[1],-U[0],0),hr(d,d,I),Et(m,q[1],-q[0],0),hr(m,m,z),this.distSqLines(Ot(i[0]+.5*d[0],i[1]+.5*d[1],i[2]+.5*d[2]),Ot(c[0]-.5*m[0],c[1]-.5*m[1],c[2]-.5*m[2]),Ot(i[0]-.5*d[0],i[1]-.5*d[1],i[2]-.5*d[2]),Ot(c[0]+.5*m[0],c[1]+.5*m[1],c[2]+.5*m[2]))<=.0025000000000000005)continue;const W=this.vertices.length,re=qo(Wr(),E,R);this.vertices.push({position:Do(re,re,.5),height:.5*(C+L),extent:.5*(I+z)});const ie=qo(Wr(),U,q);this.vertexProps.push({dir:vo(ie,ie)}),this.edges.splice(g,1),this.edgeProps.splice(g,1),this.edges.push({a:v,b:W}),this.edges.push({a:W,b:S});const ue=yo(Wr(),this.vertices[W].position,E),ve=oo(ue),me={vec:ue,dir:Do(Wr(),ue,1/ve),len:ve};this.edgeProps.push(me),this.edgeProps.push(me)}}distSqLines(r,i,c,d){const m=Pt(Qe(),i,r),g=Pt(Qe(),d,c),v=Pt(Qe(),r,c),S=Nn(m,m),E=Nn(m,g),C=Nn(m,v),I=Nn(g,g),R=Nn(g,v),L=S*I-E*E;if(L===0)return Oi(Ks(m,c,d,Nn(v,g)/Nn(g,g)),r);const z=(S*R-E*C)/L;return Oi(Ks(m,r,i,(E*R-C*I)/L),Ks(g,c,d,z))}}class pn{static parseFrom(r,i){const c=gt.parse(r);if(!c)return[];let{vertices:d,features:m}=c;const g=1/J(i);m.sort((C,I)=>C.id-I.id),d.sort((C,I)=>C.id-I.id||C.idx-I.idx),d=d.filter((C,I,R)=>I===R.findIndex(L=>L.id===C.id&&L.idx===C.idx));const v=new Array;let S=0;const E=d.length;for(const C of m){if(C.constantHeight){v.push(new vr(C.id,C.bounds,C.constantHeight));continue}for(;S!==E&&d[S].id<C.id;)S++;if(S===E||d[S].id!==C.id)continue;const I=new Array,R=new Array,L=S;for(;S!==E&&d[S].id===C.id;){const z=d[S];if(I.push({position:z.position,height:z.height,extent:z.extent}),S!==L&&d[S-1].idx===z.idx-1){const U=S-L;R.push({a:U-1,b:U})}S++}v.push(new vr(C.id,C.bounds,void 0,I,R,g))}return v}static getElevationFeature(r,i){if(!i)return;const c=+r.properties[Ke];return Number.isNaN(c)?void 0:i.find(d=>d.id===c)}}class An{constructor(r,i){this.zScale=1,this.xOffset=0,this.yOffset=0,r.equals(i)||(this.zScale=Math.pow(2,i.z-r.z),this.xOffset=(r.x*this.zScale-i.x)*bt,this.yOffset=(r.y*this.zScale-i.y)*bt)}constantElevation(r,i){if(r.constantHeight!=null)return this.computeBiasedHeight(r.constantHeight,i)}pointElevation(r,i,c){const d=this.constantElevation(i,c);return d??(r.x=r.x*this.zScale+this.xOffset,r.y=r.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(r),c))}computeBiasedHeight(r,i){return i<=0?r:r+i*ne(0,i,r>=0?r:Math.abs(.5*r))}}Ut(vr,"ElevationFeature");class bn{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=r.index,this.hasPattern=!1,this.projection=r.projection,this.layoutVertexArray=new Cc,this.indexArray=new Ni,this.segments=new ri,this.programConfigurations=new Fa(r.layers,{zoom:r.zoom,lut:r.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Ll),this.worldview=r.worldview,this.hasAppearances=null}updateFootprints(r,i){}updateAppearances(r,i,c,d){}populate(r,i,c,d){const m=this.layers[0],g=[];let v=null;m.type==="circle"&&(v=m.layout.get("circle-sort-key"));for(const{feature:E,id:C,index:I,sourceLayerIndex:R}of r){const L=this.layers[0]._featureFilter.needGeometry,z=De(E,L);if(!this.layers[0]._featureFilter.filter(new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),z,c))continue;const U=v?v.evaluate(z,{},c):void 0,q={id:C,properties:E.properties,type:E.type,sourceLayerIndex:R,index:I,geometry:L?z.geometry:Te(E,c,d),patterns:{},sortKey:U};g.push(q)}v&&g.sort((E,C)=>E.sortKey-C.sortKey);let S=null;d.projection.name==="globe"&&(this.globeExtVertexArray=new Zp,S=d.projection);for(const E of g){const{geometry:C,index:I,sourceLayerIndex:R}=E,L=r[I].feature;this.addFeature(E,C,I,i.availableImages,c,S,i.brightness,i.elevationFeatures),i.featureIndex.insert(L,C,I,R,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(r,i,c,d,m,g,v){this.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,Vx.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,Ux.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=r.createVertexBuffer(this.elevatedLayoutVertexArray,US.members))),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(r,i,c,d,m,g,v,S){let E;this.elevationMode!=="none"&&(E=pn.getElevationFeature(r,S));for(const C of i)for(const I of C){const R=I.x,L=I.y;if(R<0||R>=bt||L<0||L>=bt)continue;if(g){const q=g.projectTilePoint(R,L,m),W=g.upVector(m,R,L);this.addGlobeExtVertex(q,W),this.addGlobeExtVertex(q,W),this.addGlobeExtVertex(q,W),this.addGlobeExtVertex(q,W)}const z=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,r.sortKey),U=z.vertexLength;if(this.addCircleVertex(R,L,-1,-1),this.addCircleVertex(R,L,1,-1),this.addCircleVertex(R,L,1,1),this.addCircleVertex(R,L,-1,1),this.elevationMode!=="none"){const q=E?E.pointElevation(new it(R,L)):0;this.hasElevation=this.hasElevation||q!==0;for(let W=0;W<4;W++)this.elevatedLayoutVertexArray.emplaceBack(q)}this.indexArray.emplaceBack(U,U+1,U+2),this.indexArray.emplaceBack(U,U+2,U+3),z.vertexLength+=4,z.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,{},d,m,v,void 0,this.worldview)}addCircleVertex(r,i,c,d){this.layoutVertexArray.emplaceBack(2*r+(c+1)/2,2*i+(d+1)/2)}addGlobeExtVertex(r,i){this.globeExtVertexArray.emplaceBack(r.x,r.y,r.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function sn(a,r){for(let i=0;i<a.length;i++)if(Rn(r,a[i]))return!0;for(let i=0;i<r.length;i++)if(Rn(a,r[i]))return!0;return!!Yn(a,r)}function Ar(a,r,i){return!!Rn(a,r)||!!Kn(r,a,i)}function fn(a,r){if(a.length===1)return ni(r,a[0]);for(let i=0;i<r.length;i++){const c=r[i];for(let d=0;d<c.length;d++)if(Rn(a,c[d]))return!0}for(let i=0;i<a.length;i++)if(ni(r,a[i]))return!0;for(let i=0;i<r.length;i++)if(Yn(a,r[i]))return!0;return!1}function li(a,r,i){if(a.length>1){if(Yn(a,r))return!0;for(let c=0;c<r.length;c++)if(Kn(r[c],a,i))return!0}for(let c=0;c<a.length;c++)if(Kn(a[c],r,i))return!0;return!1}function Yn(a,r){if(a.length===0||r.length===0)return!1;for(let i=0;i<a.length-1;i++){const c=a[i],d=a[i+1];for(let m=0;m<r.length-1;m++)if(mn(c,d,r[m],r[m+1]))return!0}return!1}function mn(a,r,i,c){return kr(a,i,c)!==kr(r,i,c)&&kr(a,r,i)!==kr(a,r,c)}function Qr(a,r,i){return(a.x-i.x)*(r.y-i.y)-(a.y-i.y)*(r.x-i.x)}function Cr(a,r,i,c){const d=Qr(a,r,c),m=Qr(a,r,i);if(Math.sign(d)===Math.sign(m))return;const g=Qr(i,c,a),v=g+m-d;return Math.sign(g)!==Math.sign(v)?[g/(g-v),m/(m-d)]:void 0}function Kn(a,r,i){const c=i*i;if(r.length===1)return a.distSqr(r[0])<c;for(let d=1;d<r.length;d++)if(vi(a,r[d-1],r[d])<c)return!0;return!1}function vi(a,r,i){const c=r.distSqr(i);if(c===0)return a.distSqr(r);const d=((a.x-r.x)*(i.x-r.x)+(a.y-r.y)*(i.y-r.y))/c;return a.distSqr(d<0?r:d>1?i:i.sub(r)._mult(d)._add(r))}function ni(a,r){let i,c,d,m=!1;for(let g=0;g<a.length;g++){i=a[g];for(let v=0,S=i.length-1;v<i.length;S=v++)c=i[v],d=i[S],c.y>r.y!=d.y>r.y&&r.x<(d.x-c.x)*(r.y-c.y)/(d.y-c.y)+c.x&&(m=!m)}return m}function Rn(a,r){let i=!1;for(let c=0,d=a.length-1;c<a.length;d=c++){const m=a[c],g=a[d];m.y>r.y!=g.y>r.y&&r.x<(g.x-m.x)*(r.y-m.y)/(g.y-m.y)+m.x&&(i=!i)}return i}function fo(a,r,i,c,d){for(const g of a)if(r<=g.x&&i<=g.y&&c>=g.x&&d>=g.y)return!0;const m=[new it(r,i),new it(r,d),new it(c,d),new it(c,i)];if(a.length>2){for(const g of m)if(Rn(a,g))return!0}for(let g=0;g<a.length-1;g++)if(Ms(a[g],a[g+1],m))return!0;return!1}function Ms(a,r,i){const c=i[0],d=i[2];if(a.x<c.x&&r.x<c.x||a.x>d.x&&r.x>d.x||a.y<c.y&&r.y<c.y||a.y>d.y&&r.y>d.y)return!1;const m=kr(a,r,i[0]);return m!==kr(a,r,i[1])||m!==kr(a,r,i[2])||m!==kr(a,r,i[3])}function Vi(a,r,i,c,d,m){let g=r.y-a.y,v=a.x-r.x;if(m=m||0){const S=g*g+v*v;if(S===0)return!0;const E=Math.sqrt(S);g/=E,v/=E}return!((i.x-a.x)*g+(i.y-a.y)*v-m<0||(c.x-a.x)*g+(c.y-a.y)*v-m<0||(d.x-a.x)*g+(d.y-a.y)*v-m<0)}function Us(a,r,i,c,d,m,g){return!(Vi(a,r,c,d,m,g)||Vi(r,i,c,d,m,g)||Vi(i,a,c,d,m,g)||Vi(c,d,a,r,i,g)||Vi(d,m,a,r,i,g)||Vi(m,c,a,r,i,g))}function $s(a,r,i){const c=r.paint.get(a).value;return c.kind==="constant"?c.value:i.programConfigurations.get(r.id).getMaxValue(a)}function Ts(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function Qo(a,r,i,c,d){if(!r[0]&&!r[1])return a;const m=it.convert(r)._mult(d);i==="viewport"&&m._rotate(-c);const g=[];for(let v=0;v<a.length;v++)g.push(a[v].sub(m));return g}function xa(a,r,i,c){const d=it.convert(a)._mult(c);return r==="viewport"&&d._rotate(-i),d}let Eo,fi;function bi(a,r,i){var c=2*Math.PI*6378137/256/Math.pow(2,i);return[a*c-2*Math.PI*6378137/2,r*c-2*Math.PI*6378137/2]}Ut(bn,"CircleBucket",{omit:["layers"]});class Dn{constructor(r,i,c){this.z=r,this.x=i,this.y=c,this.key=ii(0,r,r,i,c)}equals(r){return this.z===r.z&&this.x===r.x&&this.y===r.y}isChildOf(r){const i=this.z-r.z;return r.z===0||r.z<this.z&&r.x===this.x>>i&&r.y===this.y>>i}url(r,i){const c=function(m,g,v){var S=bi(256*m,256*(g=Math.pow(2,v)-g-1),v),E=bi(256*(m+1),256*(g+1),v);return S[0]+","+S[1]+","+E[0]+","+E[1]}(this.x,this.y,this.z),d=function(m,g,v){let S,E="";for(let C=m;C>0;C--)S=1<<C-1,E+=(g&S?1:0)+(v&S?2:0);return E}(this.z,this.x,this.y);return r[(this.x+this.y)%r.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}",c)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ci{constructor(r,i){this.wrap=r,this.canonical=i,this.key=ii(r,i.z,i.z,i.x,i.y)}}class ci{constructor(r,i,c,d,m){this.overscaledZ=r,this.wrap=i,this.canonical=new Dn(c,+d,+m),this.key=i===0&&r===c?this.canonical.key:ii(i,r,c,d,m)}equals(r){return this.overscaledZ===r.overscaledZ&&this.wrap===r.wrap&&this.canonical.equals(r.canonical)}scaledTo(r){const i=this.canonical.z-r;return r>this.canonical.z?new ci(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ci(r,this.wrap,r,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(r,i=!0){if(this.overscaledZ===r&&i)return this.key;if(r>this.canonical.z)return ii(this.wrap*+i,r,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-r;return ii(this.wrap*+i,r,r,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(r){if(r.wrap!==this.wrap)return!1;const i=this.canonical.z-r.canonical.z;return r.overscaledZ===0||r.overscaledZ<this.overscaledZ&&r.canonical.z<this.canonical.z&&r.canonical.x===this.canonical.x>>i&&r.canonical.y===this.canonical.y>>i}children(r){if(this.overscaledZ>=r)return[new ci(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,c=2*this.canonical.x,d=2*this.canonical.y;return[new ci(i,this.wrap,i,c,d),new ci(i,this.wrap,i,c+1,d),new ci(i,this.wrap,i,c,d+1),new ci(i,this.wrap,i,c+1,d+1)]}isLessThan(r){return this.wrap<r.wrap||!(this.wrap>r.wrap)&&(this.overscaledZ<r.overscaledZ||!(this.overscaledZ>r.overscaledZ)&&(this.canonical.x<r.canonical.x||!(this.canonical.x>r.canonical.x)&&this.canonical.y<r.canonical.y))}wrapped(){return new ci(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(r){return new ci(this.overscaledZ,r,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ci(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function ii(a,r,i,c,d){const m=1<<Math.min(i,22);let g=m*(d%m)+c%m;return a&&i<22&&(g+=m*m*((a<0?-2*a-1:2*a)%(1<<2*(22-i)))),16*(32*g+i)+(r-i)}const wa=[a=>{let r=a.canonical.x-1,i=a.wrap;return r<0&&(r=(1<<a.canonical.z)-1,i--),new ci(a.overscaledZ,i,a.canonical.z,r,a.canonical.y)},a=>{let r=a.canonical.x+1,i=a.wrap;return r===1<<a.canonical.z&&(r=0,i++),new ci(a.overscaledZ,i,a.canonical.z,r,a.canonical.y)},a=>new ci(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,(a.canonical.y===0?1<<a.canonical.z:a.canonical.y)-1),a=>new ci(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y===(1<<a.canonical.z)-1?0:a.canonical.y+1)];Ut(Dn,"CanonicalTileID"),Ut(ci,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Yh=Br([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Ba}=Yh,Jh=Br([{name:"a_pos_3",components:3,type:"Int16"}]);var _d=Br([{name:"a_pos",type:"Int16",components:2}]);function hl(a){return a*Vs/f}const Nl=[new Zt([ya,ya,ya],[va,va,va]),new Zt([ya,ya,ya],[0,0,va]),new Zt([0,ya,ya],[va,0,va]),new Zt([ya,0,ya],[0,va,va]),new Zt([0,0,ya],[va,va,va])];function yd(a,r,i,c=!0){const d=hr([],a._camera.position,a.worldSize),m=[r,i,1,1];rs(m,m,a.pixelMatrixInverse),us(m,m,1/m[3]);const g=un([],Zn([],m,d)),v=a.globeMatrix,S=[v[12],v[13],v[14]],E=Zn([],S,d),C=It(E),I=un([],E),R=a.worldSize/(2*Math.PI),L=Nn(I,g),z=Math.asin(R/C);if(z<Math.acos(L)){if(!c)return null;const We=[],Le=[];hr(We,g,C/L),un(Le,Zn(Le,We,E)),un(g,st(g,E,hr(g,Le,Math.tan(z)*C)))}const U=[];new $t(d,g).closestPointOnSphere(S,R,U);const q=un([],_i(v,0)),W=un([],_i(v,1)),re=un([],_i(v,2)),ie=Nn(q,U),ue=Nn(W,U),ve=Nn(re,U),me=Fr(Math.asin(-ue/R));let be=Fr(Math.atan2(ie,ve));be=a.center.lng+function(We,Le){const Xe=(Le-We+180)%360-180;return Xe<-180?Xe+360:Xe}(a.center.lng,be);const ke=T(be),Pe=K(A(me),0,1);return new ae(ke,Pe)}class Rc{constructor(r,i,c){this.a=Zn([],r,c),this.b=Zn([],i,c),this.center=c;const d=un([],this.a),m=un([],this.b);this.angle=Math.acos(Nn(d,m))}}function jl(a,r){if(a.angle===0)return null;let i;return i=a.a[r]===0?1/a.angle*.5*Math.PI:1/a.angle*Math.atan(a.b[r]/a.a[r]/Math.sin(a.angle)-1/Math.tan(a.angle)),i<0||i>1?null:function(c,d,m,g){const v=Math.sin(m);return c*(Math.sin((1-g)*m)/v)+d*(Math.sin(g*m)/v)}(a.a[r],a.b[r],a.angle,K(i,0,1))+a.center[r]}function Na(a){if(a.z<=1)return Nl[a.z+2*a.y+a.x];const r=QS($x(a));return Zt.fromPoints(r)}function Vl(a,r,i){return hr(a,a,1-i),Gr(a,a,r,i)}function UI(a,r,i){for(const c of a)Un(c,c,r),hr(c,c,i)}function $I(a,r,i,c){const d=r/a.worldSize,m=a.globeMatrix;if(i.z<=1){const Pe=Na(i).getCorners();return UI(Pe,m,d),Zt.fromPoints(Pe)}const g=$x(i,c),v=QS(g,Vs+hl(a._tileCoverLift));UI(v,m,d);const S=Number.MAX_VALUE,E=[-S,-S,-S],C=[S,S,S];if(g.contains(a.center)){for(const Le of v)_r(C,C,Le),yr(E,E,Le);E[2]=0;const Pe=a.point,We=[Pe.x*d,Pe.y*d,0];return _r(C,C,We),yr(E,E,We),new Zt(C,E)}if(a._tileCoverLift>0){for(const Pe of v)_r(C,C,Pe),yr(E,E,Pe);return new Zt(C,E)}const I=[m[12]*d,m[13]*d,m[14]*d],R=g.getCenter(),L=K(a.center.lat,-j,j),z=K(R.lat,-j,j),U=T(a.center.lng),q=A(L);let W=U-T(R.lng);const re=q-A(z);W>.5?W-=1:W<-.5&&(W+=1);let ie=0;Math.abs(W)>Math.abs(re)?ie=W>=0?1:3:(ie=re>=0?0:2,Gr(I,I,[m[4]*d,m[5]*d,m[6]*d],-Math.sin(zr(re>=0?g.getSouth():g.getNorth()))*Vs));const ue=v[ie],ve=v[(ie+1)%4],me=new Rc(ue,ve,I),be=[jl(me,0)||ue[0],jl(me,1)||ue[1],jl(me,2)||ue[2]],ke=vd(a.zoom);if(ke>0){const Pe=function({x:Le,y:Xe,z:rt},nt,ut,ht,at){const lt=1/(1<<rt);let Ze=Le*lt,qe=Ze+lt,ct=Xe*lt,St=ct+lt,_t=0;const Yt=(Ze+qe)/2-ht;return Yt>.5?_t=-1:Yt<-.5&&(_t=1),Ze=((Ze+_t)*nt-(ht*=nt))*ut+ht,qe=((qe+_t)*nt-ht)*ut+ht,ct=(ct*nt-(at*=nt))*ut+at,St=(St*nt-at)*ut+at,[[Ze,St,0],[qe,St,0],[qe,ct,0],[Ze,ct,0]]}(i,r,a._pixelsPerMercatorPixel,U,q);for(let Le=0;Le<v.length;Le++)Vl(v[Le],Pe[Le],ke);const We=st([],Pe[ie],Pe[(ie+1)%4]);hr(We,We,.5),Vl(be,We,ke)}for(const Pe of v)_r(C,C,Pe),yr(E,E,Pe);return C[2]=Math.min(ue[2],ve[2]),_r(C,C,be),yr(E,E,be),new Zt(C,E)}function $x({x:a,y:r,z:i},c=!1){const d=1/(1<<i),m=new l(D(a*d),r===(1<<i)-1&&c?-90:N((r+1)*d)),g=new l(D((a+1)*d),r===0&&c?90:N(r*d));return new p(m,g)}function QS(a,r=Vs){const i=zr(a.getNorth()),c=zr(a.getSouth()),d=Math.cos(i),m=Math.cos(c),g=Math.sin(i),v=Math.sin(c),S=a.getWest(),E=a.getEast();return[vu(m,v,S,r),vu(m,v,E,r),vu(d,g,E,r),vu(d,g,S,r)]}function py(a,r,i,c){const d=1<<i.z,m=(a/bt+i.x)/d;return gd(N((r/bt+i.y)/d),D(m),c)}function Gx({min:a,max:r}){return JS/Math.max(r[0]-a[0],r[1]-a[1],r[2]-a[2])}const GI=new Float64Array(16);function Hx(a){const r=Gx(a),i=Je(GI,[r,r,r]);return oe(i,i,zs([],a.min))}function eT(a){const r=(c=a.min,(i=GI)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=c[0],i[13]=c[1],i[14]=c[2],i[15]=1,i);var i,c;const d=1/Gx(a);return he(r,r,[d,d,d])}function tT(a){const r=bt/(2*Math.PI);return a/(2*Math.PI)/r}function HI(a,r){return bt/(512*Math.pow(2,a))*Gx(Na(r))}function WI(a,r,i,c,d){const m=tT(i),g=[a,r,-i/(2*Math.PI)],v=se(new Float64Array(16));return oe(v,v,g),he(v,v,[m,m,m]),Ie(v,v,zr(-d)),Be(v,v,zr(-c)),v}function vd(a){return ne(_a,hm,a)}function qI(a,r){const i=gd(r.lat,r.lng),c=function(z){const U=gd(z._center.lat,z._center.lng);let q=gi([],Ot(0,1,0),U);const W=ft([],-z.angle,U);q=Un(q,q,W),ft(W,-z._pitch,q);const re=un([],U);return hr(re,re,hl(z.cameraToCenterDistance/z.pixelsPerMeter)),Un(re,re,W),st([],U,re)}(a);return g=(d=Pt([],c,i))[0],v=d[1],S=d[2],E=(m=i)[0],C=m[1],I=m[2],L=(R=Math.sqrt((g*g+v*v+S*S)*(E*E+C*C+I*I)))&&Nn(d,m)/R,Math.acos(Math.min(Math.max(L,-1),1));var d,m,g,v,S,E,C,I,R,L}function rT(a,r){return qI(a,r)>Math.PI/2*1.01}const KI=zr(85),TU=Math.cos(KI),EU=Math.sin(KI),kU=Y(),ZI=a=>{const r=[];return a.paint.get("circle-pitch-alignment")==="map"&&r.push("PITCH_WITH_MAP"),a.paint.get("circle-pitch-scale")==="map"&&r.push("SCALE_WITH_MAP"),r};function XI(a,r,i,c,d,m,g,v,S){if(m&&a.queryGeometry.isAboveHorizon)return!1;m&&(S*=a.pixelToTileUnitsFactor);const E=a.tileID.canonical,C=i.projection.upVectorScale(E,i.center.lat,i.worldSize).metersToTile;for(const I of r)for(const R of I){const L=R.add(v),z=d&&i.elevation?i.elevation.exaggeration()*d.getElevationAt(L.x,L.y,!0):0,U=i.projection.projectTilePoint(L.x,L.y,E);if(z>0){const ie=i.projection.upVector(E,L.x,L.y);U.x+=ie[0]*C*z,U.y+=ie[1]*C*z,U.z+=ie[2]*C*z}const q=m?L:AU(U.x,U.y,U.z,c),W=m?a.tilespaceRays.map(ie=>IU(ie,z)):a.queryGeometry.screenGeometry,re=rs([],[U.x,U.y,U.z,1],c);if(!g&&m?S*=re[3]/i.cameraToCenterDistance:g&&!m&&(S*=i.cameraToCenterDistance/re[3]),m){const ie=N((R.y/bt+E.y)/(1<<E.z));S/=i.projection.pixelsPerMeter(ie,1)/M(1,ie)}if(Ar(W,q,S))return!0}return!1}function AU(a,r,i,c){const d=rs([],[a,r,i,1],c);return new it(d[0]/d[3],d[1]/d[3])}const YI=Ot(0,0,0),CU=Ot(0,0,1);function IU(a,r){const i=Qe();return YI[2]=r,a.intersectsPlane(YI,CU,i),new it(i[0],i[1])}class JI extends bn{}let QI,eP,tP,rP;function nP(a,{width:r,height:i},c,d){if(d){if(d instanceof Uint8ClampedArray)d=new Uint8Array(d.buffer);else if(d.length!==r*i*c)throw new RangeError("mismatched image size")}else d=new Uint8Array(r*i*c);return a.width=r,a.height=i,a.data=d,a}function iP(a,r,i){const{width:c,height:d}=r;c===a.width&&d===a.height||(nT(a,r,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,c),height:Math.min(a.height,d)},i,null),a.width=c,a.height=d,a.data=r.data)}function nT(a,r,i,c,d,m,g,v){if(d.width===0||d.height===0)return r;if(d.width>a.width||d.height>a.height||i.x>a.width-d.width||i.y>a.height-d.height)throw new RangeError("out of range source coordinates for image copy");if(d.width>r.width||d.height>r.height||c.x>r.width-d.width||c.y>r.height-d.height)throw new RangeError("out of range destination coordinates for image copy");const S=a.data,E=r.data,C=m===4&&v;for(let I=0;I<d.height;I++){const R=((i.y+I)*a.width+i.x)*m,L=((c.y+I)*r.width+c.x)*m;if(C)for(let z=0;z<d.width;z++){const U=R+z*m+3,q=L+z*m;E[q+0]=255,E[q+1]=255,E[q+2]=255,E[q+3]=S[U]}else if(g)for(let z=0;z<d.width;z++){const U=R+z*m,q=L+z*m,W=new wn(S[U+0]/255,S[U+1]/255,S[U+2]/255,S[U+3]).toNonPremultipliedRenderColor(g).toArray();E[q+0]=W[0],E[q+1]=W[1],E[q+2]=W[2],E[q+3]=W[3]}else for(let z=0;z<d.width*m;z++)E[L+z]=S[R+z]}return r}Ut(JI,"HeatmapBucket",{omit:["layers"]});class xd{constructor(r,i){nP(this,r,1,i)}resize(r){iP(this,new xd(r),1)}clone(){return new xd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(r,i,c,d,m){nT(r,i,c,d,m,1,null)}}class Gs{constructor(r,i){nP(this,r,4,i)}resize(r){iP(this,new Gs(r),4)}replace(r,i){i?this.data.set(r):this.data=r instanceof Uint8ClampedArray?new Uint8Array(r.buffer):r}clone(){return new Gs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(r,i,c,d,m,g,v){nT(r,i,c,d,m,4,g,v)}}class sP{constructor(r,i){this.width=r.width,this.height=r.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function my(a){const r={},i=a.resolution||256,c=a.clips?a.clips.length:1,d=a.image||new Gs({width:i,height:c}),m=(g,v,S)=>{r[a.evaluationKey]=S;const E=a.expression.evaluate(r),C=E?E.toNonPremultipliedRenderColor(null):null;C&&(d.data[g+v+0]=Math.floor(255*C.r),d.data[g+v+1]=Math.floor(255*C.g),d.data[g+v+2]=Math.floor(255*C.b),d.data[g+v+3]=Math.floor(255*C.a))};if(a.clips)for(let g=0,v=0;g<c;++g,v+=4*i)for(let S=0,E=0;S<i;S++,E+=4){const C=S/(i-1),{start:I,end:R}=a.clips[g];m(v,E,I*(1-C)+R*C)}else for(let g=0,v=0;g<i;g++,v+=4)m(0,v,g/(i-1));return d}Ut(xd,"AlphaImage"),Ut(Gs,"RGBAImage");const PU=Br([{name:"a_pos",components:2,type:"Int16"}],4),MU=Br([{name:"a_road_z_offset",components:1,type:"Float32"}],4),RU=Br([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),DU=Br([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function fm(a,r,i=2){const c=r&&r.length,d=c?r[0]*i:a.length;let m=oP(a,0,d,i,!0);const g=[];if(!m||m.next===m.prev)return g;let v,S,E;if(c&&(m=function(C,I,R,L){const z=[];for(let U=0,q=I.length;U<q;U++){const W=oP(C,I[U]*L,U<q-1?I[U+1]*L:C.length,L,!1);W===W.next&&(W.steiner=!0),z.push(VU(W))}z.sort(BU);for(let U=0;U<z.length;U++)R=NU(z[U],R);return R}(a,r,m,i)),a.length>80*i){v=a[0],S=a[1];let C=v,I=S;for(let R=i;R<d;R+=i){const L=a[R],z=a[R+1];L<v&&(v=L),z<S&&(S=z),L>C&&(C=L),z>I&&(I=z)}E=Math.max(C-v,I-S),E=E!==0?32767/E:0}return gy(m,g,i,v,S,E,0),g}function oP(a,r,i,c,d){let m;if(d===function(g,v,S,E){let C=0;for(let I=v,R=S-E;I<S;I+=E)C+=(g[R]-g[I])*(g[I+1]+g[R+1]),R=I;return C}(a,r,i,c)>0)for(let g=r;g<i;g+=c)m=uP(g/c|0,a[g],a[g+1],m);else for(let g=i-c;g>=r;g-=c)m=uP(g/c|0,a[g],a[g+1],m);return m&&pm(m,m.next)&&(vy(m),m=m.next),m}function Qh(a,r){if(!a)return a;r||(r=a);let i,c=a;do if(i=!1,c.steiner||!pm(c,c.next)&&gs(c.prev,c,c.next)!==0)c=c.next;else{if(vy(c),c=r=c.prev,c===c.next)break;i=!0}while(i||c!==r);return r}function gy(a,r,i,c,d,m,g){if(!a)return;!g&&m&&function(S,E,C,I){let R=S;do R.z===0&&(R.z=iT(R.x,R.y,E,C,I)),R.prevZ=R.prev,R.nextZ=R.next,R=R.next;while(R!==S);R.prevZ.nextZ=null,R.prevZ=null,function(L){let z,U=1;do{let q,W=L;L=null;let re=null;for(z=0;W;){z++;let ie=W,ue=0;for(let me=0;me<U&&(ue++,ie=ie.nextZ,ie);me++);let ve=U;for(;ue>0||ve>0&&ie;)ue!==0&&(ve===0||!ie||W.z<=ie.z)?(q=W,W=W.nextZ,ue--):(q=ie,ie=ie.nextZ,ve--),re?re.nextZ=q:L=q,q.prevZ=re,re=q;W=ie}re.nextZ=null,U*=2}while(z>1)}(R)}(a,c,d,m);let v=a;for(;a.prev!==a.next;){const S=a.prev,E=a.next;if(m?OU(a,c,d,m):LU(a))r.push(S.i,a.i,E.i),vy(a),a=E.next,v=E.next;else if((a=E)===v){g?g===1?gy(a=zU(Qh(a),r),r,i,c,d,m,2):g===2&&FU(a,r,i,c,d,m):gy(Qh(a),r,i,c,d,m,1);break}}}function LU(a){const r=a.prev,i=a,c=a.next;if(gs(r,i,c)>=0)return!1;const d=r.x,m=i.x,g=c.x,v=r.y,S=i.y,E=c.y,C=Math.min(d,m,g),I=Math.min(v,S,E),R=Math.max(d,m,g),L=Math.max(v,S,E);let z=c.next;for(;z!==r;){if(z.x>=C&&z.x<=R&&z.y>=I&&z.y<=L&&_y(d,v,m,S,g,E,z.x,z.y)&&gs(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function OU(a,r,i,c){const d=a.prev,m=a,g=a.next;if(gs(d,m,g)>=0)return!1;const v=d.x,S=m.x,E=g.x,C=d.y,I=m.y,R=g.y,L=Math.min(v,S,E),z=Math.min(C,I,R),U=Math.max(v,S,E),q=Math.max(C,I,R),W=iT(L,z,r,i,c),re=iT(U,q,r,i,c);let ie=a.prevZ,ue=a.nextZ;for(;ie&&ie.z>=W&&ue&&ue.z<=re;){if(ie.x>=L&&ie.x<=U&&ie.y>=z&&ie.y<=q&&ie!==d&&ie!==g&&_y(v,C,S,I,E,R,ie.x,ie.y)&&gs(ie.prev,ie,ie.next)>=0||(ie=ie.prevZ,ue.x>=L&&ue.x<=U&&ue.y>=z&&ue.y<=q&&ue!==d&&ue!==g&&_y(v,C,S,I,E,R,ue.x,ue.y)&&gs(ue.prev,ue,ue.next)>=0))return!1;ue=ue.nextZ}for(;ie&&ie.z>=W;){if(ie.x>=L&&ie.x<=U&&ie.y>=z&&ie.y<=q&&ie!==d&&ie!==g&&_y(v,C,S,I,E,R,ie.x,ie.y)&&gs(ie.prev,ie,ie.next)>=0)return!1;ie=ie.prevZ}for(;ue&&ue.z<=re;){if(ue.x>=L&&ue.x<=U&&ue.y>=z&&ue.y<=q&&ue!==d&&ue!==g&&_y(v,C,S,I,E,R,ue.x,ue.y)&&gs(ue.prev,ue,ue.next)>=0)return!1;ue=ue.nextZ}return!0}function zU(a,r){let i=a;do{const c=i.prev,d=i.next.next;!pm(c,d)&&lP(c,i,i.next,d)&&yy(c,d)&&yy(d,c)&&(r.push(c.i,i.i,d.i),vy(i),vy(i.next),i=a=d),i=i.next}while(i!==a);return Qh(i)}function FU(a,r,i,c,d,m){let g=a;do{let v=g.next.next;for(;v!==g.prev;){if(g.i!==v.i&&UU(g,v)){let S=cP(g,v);return g=Qh(g,g.next),S=Qh(S,S.next),gy(g,r,i,c,d,m,0),void gy(S,r,i,c,d,m,0)}v=v.next}g=g.next}while(g!==a)}function BU(a,r){let i=a.x-r.x;return i===0&&(i=a.y-r.y,i===0)&&(i=(a.next.y-a.y)/(a.next.x-a.x)-(r.next.y-r.y)/(r.next.x-r.x)),i}function NU(a,r){const i=function(d,m){let g=m;const v=d.x,S=d.y;let E,C=-1/0;if(pm(d,g))return g;do{if(pm(d,g.next))return g.next;if(S<=g.y&&S>=g.next.y&&g.next.y!==g.y){const U=g.x+(S-g.y)*(g.next.x-g.x)/(g.next.y-g.y);if(U<=v&&U>C&&(C=U,E=g.x<g.next.x?g:g.next,U===v))return E}g=g.next}while(g!==m);if(!E)return null;const I=E,R=E.x,L=E.y;let z=1/0;g=E;do{if(v>=g.x&&g.x>=R&&v!==g.x&&aP(S<L?v:C,S,R,L,S<L?C:v,S,g.x,g.y)){const U=Math.abs(S-g.y)/(v-g.x);yy(g,d)&&(U<z||U===z&&(g.x>E.x||g.x===E.x&&jU(E,g)))&&(E=g,z=U)}g=g.next}while(g!==I);return E}(a,r);if(!i)return r;const c=cP(i,a);return Qh(c,c.next),Qh(i,i.next)}function jU(a,r){return gs(a.prev,a,r.prev)<0&&gs(r.next,a,a.next)<0}function iT(a,r,i,c,d){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-i)*d|0)|a<<8))|a<<4))|a<<2))|a<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-c)*d|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function VU(a){let r=a,i=a;do(r.x<i.x||r.x===i.x&&r.y<i.y)&&(i=r),r=r.next;while(r!==a);return i}function aP(a,r,i,c,d,m,g,v){return(d-g)*(r-v)>=(a-g)*(m-v)&&(a-g)*(c-v)>=(i-g)*(r-v)&&(i-g)*(m-v)>=(d-g)*(c-v)}function _y(a,r,i,c,d,m,g,v){return!(a===g&&r===v)&&aP(a,r,i,c,d,m,g,v)}function UU(a,r){return a.next.i!==r.i&&a.prev.i!==r.i&&!function(i,c){let d=i;do{if(d.i!==i.i&&d.next.i!==i.i&&d.i!==c.i&&d.next.i!==c.i&&lP(d,d.next,i,c))return!0;d=d.next}while(d!==i);return!1}(a,r)&&(yy(a,r)&&yy(r,a)&&function(i,c){let d=i,m=!1;const g=(i.x+c.x)/2,v=(i.y+c.y)/2;do d.y>v!=d.next.y>v&&d.next.y!==d.y&&g<(d.next.x-d.x)*(v-d.y)/(d.next.y-d.y)+d.x&&(m=!m),d=d.next;while(d!==i);return m}(a,r)&&(gs(a.prev,a,r.prev)||gs(a,r.prev,r))||pm(a,r)&&gs(a.prev,a,a.next)>0&&gs(r.prev,r,r.next)>0)}function gs(a,r,i){return(r.y-a.y)*(i.x-r.x)-(r.x-a.x)*(i.y-r.y)}function pm(a,r){return a.x===r.x&&a.y===r.y}function lP(a,r,i,c){const d=qx(gs(a,r,i)),m=qx(gs(a,r,c)),g=qx(gs(i,c,a)),v=qx(gs(i,c,r));return d!==m&&g!==v||!(d!==0||!Wx(a,i,r))||!(m!==0||!Wx(a,c,r))||!(g!==0||!Wx(i,a,c))||!(v!==0||!Wx(i,r,c))}function Wx(a,r,i){return r.x<=Math.max(a.x,i.x)&&r.x>=Math.min(a.x,i.x)&&r.y<=Math.max(a.y,i.y)&&r.y>=Math.min(a.y,i.y)}function qx(a){return a>0?1:a<0?-1:0}function yy(a,r){return gs(a.prev,a,a.next)<0?gs(a,r,a.next)>=0&&gs(a,a.prev,r)>=0:gs(a,r,a.prev)<0||gs(a,a.next,r)<0}function cP(a,r){const i=sT(a.i,a.x,a.y),c=sT(r.i,r.x,r.y),d=a.next,m=r.prev;return a.next=r,r.prev=a,i.next=d,d.prev=i,c.next=i,i.prev=c,m.next=c,c.prev=m,c}function uP(a,r,i,c){const d=sT(a,r,i);return c?(d.next=c.next,d.prev=c,c.next.prev=d,c.next=d):(d.prev=d,d.next=d),d}function vy(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function sT(a,r,i){return{i:a,x:r,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xy(a,r){const i=a.length;if(i<=1)return[a];const c=[];let d,m;for(let g=0;g<i;g++){const v=Tr(a[g]);v!==0&&(a[g].area=Math.abs(v),m===void 0&&(m=v<0),m===v<0?(d&&c.push(d),d=[a[g]]):d.push(a[g]))}if(d&&c.push(d),r>1)for(let g=0;g<c.length;g++)c[g].length<=r||(dp(c[g],r,1,c[g].length-1,$U),c[g]=c[g].slice(0,r));return c}function $U(a,r){return r.area-a.area}function dP(a,r,i=1){if(!a)return null;const c=typeof a=="string"?lo.from(a).getPrimary():a.getPrimary(),d=typeof a=="string"?null:a.getSecondary();for(const m of[c,d]){if(!m)continue;const g=m.id.toString();r.has(g)||r.set(g,[]),m.scaleSelf(i),r.get(g).push(m)}return{primary:c.toString(),secondary:d?d.toString():null}}function oT(a,r,i,c){const d=c.patternDependencies;let m=!1;for(const g of r){const v=g.paint.get(`${a}-pattern`);v.isConstant()||(m=!0),dP(v.constantOr(null),d,i)&&(m=!0)}return m}function aT(a,r,i,c,d,m){const g=m.patternDependencies;for(const v of r){const S=v.paint.get(`${a}-pattern`).value;if(S.kind!=="constant"){let E=S.evaluate({zoom:c},i,{},m.availableImages);E=E&&E.name?E.name:E;const C=dP(E,g,d);if(!C)continue;const{primary:I,secondary:R}=C;I&&(i.patterns[v.id]=[I,R].filter(Boolean))}}return i}class hP{constructor(){this.polygons=new Map}add(r,...i){const c=this.polygons.get(r);c?c.push(...i):this.polygons.set(r,i)}merge(r){for(const[i,c]of r.polygons)this.add(i,...c)}}class xu{constructor(){this.portals=[]}static isOnBorder(r,i){return r<=0&&i<=0||r>=bt&&i>=bt}static evaluate(r){if(r.length===0)return new xu;let i=[];for(const S of r)i.push(...S.portals);if(i.length===0)return new xu;for(const S of i){const E=S.va,C=S.vb;(xu.isOnBorder(E.x,C.x)||xu.isOnBorder(E.y,C.y))&&(S.type="border")}const c=i.filter(S=>S.type!=="unevaluated"),d=i.filter(S=>S.type==="unevaluated");if(d.length===0)return new xu;d.sort((S,E)=>S.hash===E.hash?S.isTunnel===E.isTunnel?0:S.isTunnel?-1:1:S.hash<E.hash?1:-1),i=c.concat(d);let m=c.length,g=m,v=m;do if(g++,g===i.length||i[m].hash!==i[g].hash){if(g-m==2){v<m&&(i[v]=i[m],i[m]=null);const S=i[v],E=i[g-1];S.type=S.isTunnel!==E.isTunnel?"tunnel":"polygon",S.connection={a:S.connection.a,b:E.connection.a},v++}m=g}while(m!==i.length);return i.splice(v),i.sort((S,E)=>S.hash<E.hash?1:-1),{portals:i}}}Ut(xu,"ElevationPortalGraph"),Ut(hP,"ElevationPolygons");class GU{constructor(r,i,c){this.outPositions=r,this.outNormals=i,this.outIndices=c,this.vertexLookup=new Map}addVertex(r,i,c){let d=r[2];c!=null&&(d*=c);const m=`${r[0]},${r[1]},${r[2]},${i[0]},${i[1]},${i[2]}`,g=this.vertexLookup.get(m);if(g!=null)return g;const v=this.outPositions.length;this.vertexLookup.set(m,v);const S=Math.trunc(16384*i[0]),E=Math.trunc(16384*i[1]),C=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(r[0],r[1],d),this.outNormals.emplaceBack(S,E,C),v}addTriangle(r,i,c){this.outIndices.emplaceBack(r,i,c)}addTriangles(r,i,c){if(r.length===0)return;const d=c.length===1,m=Qe(),g=Qe();for(let v=0;v<r.length;v+=3){const S=i[r[v+0]],E=i[r[v+1]],C=i[r[v+2]],I=d?c[0]:c[r[v+1]],R=d?c[0]:c[r[v+2]];Et(m,S.x,S.y,d?c[0]:c[r[v+0]]);const L=this.addVertex(m,g);Et(m,E.x,E.y,I);const z=this.addVertex(m,g);Et(m,C.x,C.y,R);const U=this.addVertex(m,g);this.outIndices.emplaceBack(L,z,U)}}addQuad(r,i,c,d,m,g){const v=this.addVertex(r,m,g),S=this.addVertex(i,m,g),E=this.addVertex(c,m,g),C=this.addVertex(d,m,g);this.addTriangle(v,S,E),this.addTriangle(E,C,v)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class ea{constructor(r,i,c,d){this.unevaluatedPortals=new xu,this.portalPolygons=new hP,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new K_,this.vertexNormals=new Z_,this.indexArray=new Ni,this.tileToMeters=J(r),this.bridgeProgramConfigurations=new Fa(i,{zoom:c,lut:d},m=>m!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Fa(i,{zoom:c,lut:d},m=>m!=="fill-bridge-guard-rail-color")}addVertices(r,i){const c=this.unevalVertices.length;for(let d=0;d<r.length;d++)this.unevalVertices.push(r[d]),this.unevalHeights.push(i[d]);return c}addTriangles(r,i,c){const d=c?this.unevalTunnelTriangles:this.unevalTriangles;for(const m of r)d.push(m+i)}addRenderableRing(r,i,c,d,m,g){const v=[new it(m.min.x,m.min.y),new it(m.max.x,m.min.y),new it(m.max.x,m.max.y),new it(m.min.x,m.max.y)];for(let S=0;S<c-1;S++){const E=i+S,C=E+1,I=this.unevalVertices[E],R=this.unevalVertices[C];if(!(I.x>=m.min.x&&I.x<=m.max.x&&I.y>=m.min.y&&I.y<=m.max.y||R.x>=m.min.x&&R.x<=m.max.x&&R.y>=m.min.y&&R.y<=m.max.y||Ms(I,R,v))||this.isOnBorder(I.x,R.x)||this.isOnBorder(I.y,R.y))continue;const L=ea.computeEdgeHash(this.unevalVertices[E],this.unevalVertices[C]);let z,U=this.vertexHashLookup.get(ea.computePosHash(I));U!=null?z=U.next:(U=this.vertexHashLookup.get(ea.computePosHash(R)),z=U!=null?U.prev:L),this.unevalEdges.push({polygonIdx:r,a:E,b:C,hash:L,portalHash:z,isTunnel:d,type:"unevaluated",featureInfo:g})}}addPortalCandidates(r,i,c,d,m){if(i.length===0)return;this.portalPolygons.add(r,{geometry:i,zLevel:m});const g=i[0];this.vertexHashLookup.clear();let v=ea.computeEdgeHash(g[g.length-2],g[g.length-1]);for(let S=0;S<g.length-1;S++){const E=g[S+0],C=g[S+1],I=On(C.x-E.x,C.y-E.y),R=oo(I);if(R===0)continue;let L="unevaluated";const z=d.pointElevation(E),U=d.pointElevation(C);Math.abs(z)<.01&&Math.abs(U)<.01?L="entrance":(this.isOnBorder(E.x,C.x)||this.isOnBorder(E.y,C.y))&&(L="border");const q=ea.computeEdgeHash(E,C);this.unevaluatedPortals.portals.push({connection:{a:r,b:void 0},va:E,vb:C,vab:I,length:R,hash:q,isTunnel:c,type:L});const W=ea.computePosHash(E);this.vertexHashLookup.set(W,{prev:v,next:q}),v=q}}construct(r){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),c=R=>{R.primitiveLength=this.indexArray.length-R.primitiveOffset},d=new GU(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(r.portals,this.unevalEdges);const m=i(),g=i(),v=i(),S=(R,L)=>{R.sort((U,q)=>U.type===L&&q.type!==L?-1:U.type!==L&&q.type===L?1:0);const z=R.findIndex(U=>U.type!==L);return z>=0?z:R.length};let E=0;this.unevalEdges.length>0&&(E=S(this.unevalEdges,"none"),this.constructBridgeStructures(d,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:E},this.tileToMeters)),c(v);const C=i(),I=i();if(this.unevalEdges.length>0){const R=this.unevalEdges.splice(E),L=S(R,"tunnel")+E;this.unevalEdges.push(...R),this.constructTunnelStructures(d,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:E},{min:E,max:L})}c(C),d.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),c(I),d.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),c(g),d.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),c(m),this.maskSegments=ri.simpleSegment(0,I.primitiveOffset,0,I.primitiveLength),this.depthSegments=ri.simpleSegment(0,g.primitiveOffset,0,g.primitiveLength),this.renderableBridgeSegments=ri.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.renderableTunnelSegments=ri.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength),this.shadowCasterSegments=ri.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength)}update(r,i,c,d,m,g,v,S){this.bridgeProgramConfigurations.updatePaintArrays(r,i,m,c,d,g,v,S),this.tunnelProgramConfigurations.updatePaintArrays(r,i,m,c,d,g,v,S)}upload(r){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=r.createVertexBuffer(this.vertexPositions,RU.members),this.vertexBufferNormal=r.createVertexBuffer(this.vertexNormals,DU.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(r),this.tunnelProgramConfigurations.upload(r))}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(r,i,c,d,m){const g=(v,S)=>{for(let E=0;E<S.length-1;E++){const C=S[E].featureIndex,I=S[E+1].vertexStart,R=r.feature(C);v.populatePaintArrays(I,R,C,{},c,i,d,void 0,m)}};g(this.bridgeProgramConfigurations,this.bridgeFeatureSections),g(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(r,i,c,d,m){const g=new Map;for(let v=d;v<m;v++){const S=c[v],E=S.a,C=S.b,I=ea.computePosHash(r[E]),R=ea.computePosHash(r[C]);let L=g.get(I);L||(L={},g.set(I,L));let z=g.get(R);z||(z={},g.set(R,z)),i[E]<=0&&i[C]<=0||(L.to=C,z.from=E)}return g}isTerminalVertex(r,i){const c=ea.computePosHash(this.unevalVertices[r]),d=i.get(c);return!d||!d.from||!d.to}constructBridgeStructures(r,i,c,d,m,g){r.clearVertexLookup();const v=this.computeVertexConnections(i,c,d,m.min,m.max),S=1/g,E=.5*S,C=(ut,ht)=>Et(ut,i[ht].x,i[ht].y,c[ht]*S),I=Qe(),R=Qe(),L=Qe(),z=Qe(),U=Qe(),q=(ut,ht)=>{const at=v.get(ea.computePosHash(i[ht])),lt=at.from,Ze=at.to;if(!lt||!Ze)return;C(I,lt),C(R,ht),C(L,Ze),Ki(z),Zi(I,R)||(Zn(U,R,I),un(z,U)),Zi(L,R)||(Zn(U,L,R),st(z,z,un(U,U)));const qe=ua(z);return qe>0?hr(ut,z,1/qe):void 0};let W=Number.POSITIVE_INFINITY;this.sortSubarray(d,m.min,m.max,(ut,ht)=>ut.featureInfo.featureIndex-ht.featureInfo.featureIndex);const re=Qe(),ie=Qe(),ue=Qe(),ve=Qe(),me=Qe(),be=Qe(),ke=Qe(),Pe=Qe(),We=Qe(),Le=[Qe(),Qe(),Qe(),Qe()],Xe=[Qe(),Qe(),Qe(),Qe()],rt=[{coord:new it(0,0),height:0},{coord:new it(0,0),height:0}],nt=(ut,ht)=>ut>ht;for(let ut=m.min;ut<m.max;ut++){const ht=d[ut];if(!ht.featureInfo.guardRailEnabled||!this.prepareEdgePoints(rt,i,c,ht,nt))continue;const[at,lt]=rt;if(Et(re,at.coord.x,at.coord.y,S*at.height),Et(ie,lt.coord.x,lt.coord.y,S*lt.height),Zi(re,ie))continue;Zn(ue,ie,re),un(ue,ue);const Ze=q(Pe,ht.a)||ue,qe=q(We,ht.b)||ue;Et(ve,Ze[1],-Ze[0],0),un(ve,ve),Et(me,qe[1],-qe[0],0),un(me,me),gi(Pe,ve,Ze),un(be,Pe),gi(Pe,me,qe),un(ke,Pe),st(Le[0],re,hr(Pe,Zn(Pe,ve,be),E)),st(Le[1],re,hr(Pe,st(Pe,ve,be),E)),st(Le[2],re,hr(Pe,be,E)),Le[3]=re,st(Xe[0],ie,hr(Pe,Zn(Pe,me,ke),E)),st(Xe[1],ie,hr(Pe,st(Pe,me,ke),E)),st(Xe[2],ie,hr(Pe,ke,E)),Xe[3]=ie,W=this.addFeatureSection(ht.featureInfo.featureIndex,W,this.bridgeFeatureSections,r);const ct=r.addVertex(Le[0],ve,g),St=r.addVertex(Le[1],ve,g),_t=r.addVertex(Xe[0],me,g),Yt=r.addVertex(Xe[1],me,g);r.addTriangle(ct,St,_t),r.addTriangle(St,Yt,_t);const Lt=r.addVertex(Le[1],be,g),Nt=r.addVertex(Le[2],be,g),Ht=r.addVertex(Xe[1],ke,g),Rr=r.addVertex(Xe[2],ke,g);r.addTriangle(Lt,Nt,Ht),r.addTriangle(Nt,Rr,Ht),zs(ve,ve),zs(me,me);const yt=r.addVertex(Le[2],ve,g),Wt=r.addVertex(Le[3],ve,g),gr=r.addVertex(Xe[2],me,g),$r=r.addVertex(Xe[3],me,g);r.addTriangle(yt,Wt,gr),r.addTriangle(Wt,$r,gr);const qr=this.isTerminalVertex(ht.a,v),Sr=this.isTerminalVertex(ht.b,v);at.height<.01&&qr&&r.addQuad(Le[3],Le[2],Le[1],Le[0],zs(Ze,Ze),g),lt.height<.01&&Sr&&r.addQuad(Xe[0],Xe[1],Xe[2],Xe[3],qe,g)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:r.getVertexCount()})}constructTunnelStructures(r,i,c,d,m,g){r.clearVertexLookup();let v=Number.POSITIVE_INFINITY;const S=(W,re)=>W.featureInfo.featureIndex-re.featureInfo.featureIndex;this.sortSubarray(d,m.min,m.max,S),this.sortSubarray(d,g.min,g.max,S);const E=W=>un(W,W),C=[{coord:new it(0,0),height:0},{coord:new it(0,0),height:0}],I=(W,re)=>W<re,R=Qe(),L=Qe(),z=Qe(),U=Qe(),q=Qe();for(let W=m.min;W<m.max;W++){if(!this.prepareEdgePoints(C,i,c,d[W],I))continue;const[re,ie]=C,ue=E(Et(q,-(ie.coord.y-re.coord.y),ie.coord.x-re.coord.x,0));v=this.addFeatureSection(d[W].featureInfo.featureIndex,v,this.tunnelFeatureSections,r),r.addQuad(Et(R,re.coord.x,re.coord.y,re.height),Et(L,ie.coord.x,ie.coord.y,ie.height),Et(z,ie.coord.x,ie.coord.y,d[W].isTunnel?-.1:0),Et(U,re.coord.x,re.coord.y,d[W].isTunnel?-.1:0),ue)}for(let W=g.min;W<g.max;W++){const re=d[W];re.isTunnel&&([re.a,re.b]=[re.b,re.a]);const ie=i[re.a],ue=i[re.b],ve=E(Et(q,-(ue.y-ie.y),ue.x-ie.x,0));v=this.addFeatureSection(re.featureInfo.featureIndex,v,this.tunnelFeatureSections,r),r.addQuad(Et(R,ue.x,ue.y,0),Et(L,ie.x,ie.y,0),Et(z,ie.x,ie.y,c[re.a]+4),Et(U,ue.x,ue.y,c[re.b]+4),ve),r.addQuad(Et(R,ie.x,ie.y,0),Et(L,ue.x,ue.y,0),Et(z,ue.x,ue.y,c[re.b]+4),Et(U,ie.x,ie.y,c[re.a]+4),ve)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:r.getVertexCount()})}setElevatedPoint(r,i,c,d){r.coord.x=i,r.coord.y=c,r.height=d}prepareEdgePoints(r,i,c,d,m){let g=i[d.a].x,v=i[d.a].y,S=i[d.b].x,E=i[d.b].y,C=c[d.a],I=c[d.b];const R=m(C,0),L=m(I,0);if(R&&L)return this.setElevatedPoint(r[0],g,v,C),this.setElevatedPoint(r[1],S,E,I),!0;if(!R&&!L)return!1;if(R){if(!L){const z=I/(I-C);S=ur(S,g,z),E=ur(E,v,z),I=ur(I,C,z)}}else{const z=C/(C-I);g=ur(g,S,z),v=ur(v,E,z),C=ur(C,I,z)}return this.setElevatedPoint(r[0],g,v,C),this.setElevatedPoint(r[1],S,E,I),!0}prepareEdges(r,i){if(i.length===0)return;i.sort((v,S)=>v.hash===S.hash?S.polygonIdx-v.polygonIdx:S.hash>v.hash?1:-1);let c=0,d=0,m=0,g=i[c].polygonIdx;do d++,(d===i.length||i[c].hash!==i[d].hash)&&((d-c==1||i[d-1].polygonIdx!==g)&&(m<c&&(i[m]=i[c],i[c]=null),i[m].type="none",m++),c=d,c!==i.length&&(g=i[c].polygonIdx));while(c!==i.length);if(i.splice(m),i.length!==0&&r.length!==0){i.sort((E,C)=>E.portalHash<C.portalHash?1:-1);let v=0,S=0;for(;v!==i.length&&S!==r.length;){const E=i[v],C=r[S];E.portalHash>C.hash?v++:C.hash>E.portalHash?S++:(E.type=C.type,v++)}}}isOnBorder(r,i){return r<=0&&i<=0||r>=bt&&i>=bt}addFeatureSection(r,i,c,d){return r!==i&&(i=r,c.push({featureIndex:r,vertexStart:d.getVertexCount()}),d.clearVertexLookup()),i}sortSubarray(r,i,c,d){const m=r.slice(i,c);m.sort(d),r.splice(i,m.length,...m)}static computeEdgeHash(r,i){return(r.y===i.y&&r.x>i.x||r.y>i.y)&&([r,i]=[i,r]),BigInt(ea.computePosHash(r))<<32n|BigInt(ea.computePosHash(i))}static computePosHash(r){return((65535&r.x)<<16|65535&r.y)>>>0}}var fP,pP={exports:{}},mP=(fP||(fP=1,function(a){function r(ge,xe){return ge>xe?1:ge<xe?-1:0}var i=function(ge,xe){ge===void 0&&(ge=r),xe===void 0&&(xe=!1),this._compare=ge,this._root=null,this._size=0,this._noDuplicates=!!xe},c={size:{configurable:!0}};function d(ge,xe,Ye,dt,Mt){var Rt=Mt-dt;if(Rt>0){var Jt=dt+Math.floor(Rt/2),er={key:xe[Jt],data:Ye[Jt],parent:ge};return er.left=d(er,xe,Ye,dt,Jt),er.right=d(er,xe,Ye,Jt+1,Mt),er}return null}function m(ge,xe,Ye,dt,Mt){if(!(Ye>=dt)){for(var Rt=ge[Ye+dt>>1],Jt=Ye-1,er=dt+1;;){do Jt++;while(Mt(ge[Jt],Rt)<0);do er--;while(Mt(ge[er],Rt)>0);if(Jt>=er)break;var wr=ge[Jt];ge[Jt]=ge[er],ge[er]=wr,wr=xe[Jt],xe[Jt]=xe[er],xe[er]=wr}m(ge,xe,Ye,er,Mt),m(ge,xe,er+1,dt,Mt)}}i.prototype.rotateLeft=function(ge){var xe=ge.right;xe&&(ge.right=xe.left,xe.left&&(xe.left.parent=ge),xe.parent=ge.parent),ge.parent?ge===ge.parent.left?ge.parent.left=xe:ge.parent.right=xe:this._root=xe,xe&&(xe.left=ge),ge.parent=xe},i.prototype.rotateRight=function(ge){var xe=ge.left;xe&&(ge.left=xe.right,xe.right&&(xe.right.parent=ge),xe.parent=ge.parent),ge.parent?ge===ge.parent.left?ge.parent.left=xe:ge.parent.right=xe:this._root=xe,xe&&(xe.right=ge),ge.parent=xe},i.prototype._splay=function(ge){for(;ge.parent;){var xe=ge.parent;xe.parent?xe.left===ge&&xe.parent.left===xe?(this.rotateRight(xe.parent),this.rotateRight(xe)):xe.right===ge&&xe.parent.right===xe?(this.rotateLeft(xe.parent),this.rotateLeft(xe)):xe.left===ge&&xe.parent.right===xe?(this.rotateRight(xe),this.rotateLeft(xe)):(this.rotateLeft(xe),this.rotateRight(xe)):xe.left===ge?this.rotateRight(xe):this.rotateLeft(xe)}},i.prototype.splay=function(ge){for(var xe,Ye,dt,Mt,Rt;ge.parent;)(Ye=(xe=ge.parent).parent)&&Ye.parent?((dt=Ye.parent).left===Ye?dt.left=ge:dt.right=ge,ge.parent=dt):(ge.parent=null,this._root=ge),Mt=ge.left,Rt=ge.right,ge===xe.left?(Ye&&(Ye.left===xe?(xe.right?(Ye.left=xe.right,Ye.left.parent=Ye):Ye.left=null,xe.right=Ye,Ye.parent=xe):(Mt?(Ye.right=Mt,Mt.parent=Ye):Ye.right=null,ge.left=Ye,Ye.parent=ge)),Rt?(xe.left=Rt,Rt.parent=xe):xe.left=null,ge.right=xe,xe.parent=ge):(Ye&&(Ye.right===xe?(xe.left?(Ye.right=xe.left,Ye.right.parent=Ye):Ye.right=null,xe.left=Ye,Ye.parent=xe):(Rt?(Ye.left=Rt,Rt.parent=Ye):Ye.left=null,ge.right=Ye,Ye.parent=ge)),Mt?(xe.right=Mt,Mt.parent=xe):xe.right=null,ge.left=xe,xe.parent=ge)},i.prototype.replace=function(ge,xe){ge.parent?ge===ge.parent.left?ge.parent.left=xe:ge.parent.right=xe:this._root=xe,xe&&(xe.parent=ge.parent)},i.prototype.minNode=function(ge){if(ge===void 0&&(ge=this._root),ge)for(;ge.left;)ge=ge.left;return ge},i.prototype.maxNode=function(ge){if(ge===void 0&&(ge=this._root),ge)for(;ge.right;)ge=ge.right;return ge},i.prototype.insert=function(ge,xe){var Ye=this._root,dt=null,Mt=this._compare;if(this._noDuplicates)for(;Ye;){if(dt=Ye,Mt(Ye.key,ge)===0)return;Ye=Mt(Ye.key,ge)<0?Ye.right:Ye.left}else for(;Ye;)dt=Ye,Ye=Mt(Ye.key,ge)<0?Ye.right:Ye.left;return Ye={key:ge,data:xe,left:null,right:null,parent:dt},dt?Mt(dt.key,Ye.key)<0?dt.right=Ye:dt.left=Ye:this._root=Ye,this.splay(Ye),this._size++,Ye},i.prototype.find=function(ge){for(var xe=this._root,Ye=this._compare;xe;){var dt=Ye(xe.key,ge);if(dt<0)xe=xe.right;else{if(!(dt>0))return xe;xe=xe.left}}return null},i.prototype.contains=function(ge){for(var xe=this._root,Ye=this._compare;xe;){var dt=Ye(ge,xe.key);if(dt===0)return!0;xe=dt<0?xe.left:xe.right}return!1},i.prototype.remove=function(ge){var xe=this.find(ge);if(!xe)return!1;if(this.splay(xe),xe.left)if(xe.right){var Ye=this.minNode(xe.right);Ye.parent!==xe&&(this.replace(Ye,Ye.right),Ye.right=xe.right,Ye.right.parent=Ye),this.replace(xe,Ye),Ye.left=xe.left,Ye.left.parent=Ye}else this.replace(xe,xe.left);else this.replace(xe,xe.right);return this._size--,!0},i.prototype.removeNode=function(ge){if(!ge)return!1;if(this.splay(ge),ge.left)if(ge.right){var xe=this.minNode(ge.right);xe.parent!==ge&&(this.replace(xe,xe.right),xe.right=ge.right,xe.right.parent=xe),this.replace(ge,xe),xe.left=ge.left,xe.left.parent=xe}else this.replace(ge,ge.left);else this.replace(ge,ge.right);return this._size--,!0},i.prototype.erase=function(ge){var xe=this.find(ge);if(xe){this.splay(xe);var Ye=xe.left,dt=xe.right,Mt=null;Ye&&(Ye.parent=null,Mt=this.maxNode(Ye),this.splay(Mt),this._root=Mt),dt&&(Ye?Mt.right=dt:this._root=dt,dt.parent=Mt),this._size--}},i.prototype.pop=function(){var ge=this._root,xe=null;if(ge){for(;ge.left;)ge=ge.left;xe={key:ge.key,data:ge.data},this.remove(ge.key)}return xe},i.prototype.next=function(ge){var xe=ge;if(xe)if(xe.right)for(xe=xe.right;xe&&xe.left;)xe=xe.left;else for(xe=ge.parent;xe&&xe.right===ge;)ge=xe,xe=xe.parent;return xe},i.prototype.prev=function(ge){var xe=ge;if(xe)if(xe.left)for(xe=xe.left;xe&&xe.right;)xe=xe.right;else for(xe=ge.parent;xe&&xe.left===ge;)ge=xe,xe=xe.parent;return xe},i.prototype.forEach=function(ge){for(var xe=this._root,Ye=[],dt=!1,Mt=0;!dt;)xe?(Ye.push(xe),xe=xe.left):Ye.length>0?(ge(xe=Ye.pop(),Mt++),xe=xe.right):dt=!0;return this},i.prototype.range=function(ge,xe,Ye,dt){for(var Mt=[],Rt=this._compare,Jt=this._root;Mt.length!==0||Jt;)if(Jt)Mt.push(Jt),Jt=Jt.left;else{if(Rt((Jt=Mt.pop()).key,xe)>0)break;if(Rt(Jt.key,ge)>=0&&Ye.call(dt,Jt))return this;Jt=Jt.right}return this},i.prototype.keys=function(){for(var ge=this._root,xe=[],Ye=[],dt=!1;!dt;)ge?(xe.push(ge),ge=ge.left):xe.length>0?(ge=xe.pop(),Ye.push(ge.key),ge=ge.right):dt=!0;return Ye},i.prototype.values=function(){for(var ge=this._root,xe=[],Ye=[],dt=!1;!dt;)ge?(xe.push(ge),ge=ge.left):xe.length>0?(ge=xe.pop(),Ye.push(ge.data),ge=ge.right):dt=!0;return Ye},i.prototype.at=function(ge){for(var xe=this._root,Ye=[],dt=!1,Mt=0;!dt;)if(xe)Ye.push(xe),xe=xe.left;else if(Ye.length>0){if(xe=Ye.pop(),Mt===ge)return xe;Mt++,xe=xe.right}else dt=!0;return null},i.prototype.load=function(ge,xe,Ye){if(ge===void 0&&(ge=[]),xe===void 0&&(xe=[]),Ye===void 0&&(Ye=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var dt=ge.length;return Ye&&m(ge,xe,0,dt-1,this._compare),this._root=d(null,ge,xe,0,dt),this._size=dt,this},i.prototype.min=function(){var ge=this.minNode(this._root);return ge?ge.key:null},i.prototype.max=function(){var ge=this.maxNode(this._root);return ge?ge.key:null},i.prototype.isEmpty=function(){return this._root===null},c.size.get=function(){return this._size},i.createTree=function(ge,xe,Ye,dt,Mt){return new i(Ye,Mt).load(ge,xe,dt)},Object.defineProperties(i.prototype,c);var g=0,v=1,S=2,E=3,C=0,I=1,R=2,L=3;function z(ge,xe,Ye){xe===null?(ge.inOut=!1,ge.otherInOut=!0):(ge.isSubject===xe.isSubject?(ge.inOut=!xe.inOut,ge.otherInOut=xe.otherInOut):(ge.inOut=!xe.otherInOut,ge.otherInOut=xe.isVertical()?!xe.inOut:xe.inOut),xe&&(ge.prevInResult=!U(xe,Ye)||xe.isVertical()?xe.prevInResult:xe));var dt=U(ge,Ye);ge.resultTransition=dt?function(Mt,Rt){var Jt,er=!Mt.inOut,wr=!Mt.otherInOut;switch(Rt){case C:Jt=er&≀break;case I:Jt=er||wr;break;case L:Jt=er^wr;break;case R:Jt=Mt.isSubject?er&&!wr:wr&&!er}return Jt?1:-1}(ge,Ye):0}function U(ge,xe){switch(ge.type){case g:switch(xe){case C:return!ge.otherInOut;case I:return ge.otherInOut;case R:return ge.isSubject&&ge.otherInOut||!ge.isSubject&&!ge.otherInOut;case L:return!0}break;case S:return xe===C||xe===I;case E:return xe===R;case v:return!1}return!1}var q=function(ge,xe,Ye,dt,Mt){this.left=xe,this.point=ge,this.otherEvent=Ye,this.isSubject=dt,this.type=Mt||g,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},W={inResult:{configurable:!0}};function re(ge,xe){return ge[0]===xe[0]&&ge[1]===xe[1]}q.prototype.isBelow=function(ge){var xe=this.point,Ye=this.otherEvent.point;return this.left?(xe[0]-ge[0])*(Ye[1]-ge[1])-(Ye[0]-ge[0])*(xe[1]-ge[1])>0:(Ye[0]-ge[0])*(xe[1]-ge[1])-(xe[0]-ge[0])*(Ye[1]-ge[1])>0},q.prototype.isAbove=function(ge){return!this.isBelow(ge)},q.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},W.inResult.get=function(){return this.resultTransition!==0},q.prototype.clone=function(){var ge=new q(this.point,this.left,this.otherEvent,this.isSubject,this.type);return ge.contourId=this.contourId,ge.resultTransition=this.resultTransition,ge.prevInResult=this.prevInResult,ge.isExteriorRing=this.isExteriorRing,ge.inOut=this.inOut,ge.otherInOut=this.otherInOut,ge},Object.defineProperties(q.prototype,W);var ie=11102230246251565e-32,ue=134217729,ve=(3+8*ie)*ie;function me(ge,xe,Ye,dt,Mt){var Rt,Jt,er,wr,Ir=xe[0],Mr=dt[0],Nr=0,cr=0;Mr>Ir==Mr>-Ir?(Rt=Ir,Ir=xe[++Nr]):(Rt=Mr,Mr=dt[++cr]);var mr=0;if(Nr<ge&&cr<Ye)for(Mr>Ir==Mr>-Ir?(er=Rt-((Jt=Ir+Rt)-Ir),Ir=xe[++Nr]):(er=Rt-((Jt=Mr+Rt)-Mr),Mr=dt[++cr]),Rt=Jt,er!==0&&(Mt[mr++]=er);Nr<ge&&cr<Ye;)Mr>Ir==Mr>-Ir?(er=Rt-((Jt=Rt+Ir)-(wr=Jt-Rt))+(Ir-wr),Ir=xe[++Nr]):(er=Rt-((Jt=Rt+Mr)-(wr=Jt-Rt))+(Mr-wr),Mr=dt[++cr]),Rt=Jt,er!==0&&(Mt[mr++]=er);for(;Nr<ge;)er=Rt-((Jt=Rt+Ir)-(wr=Jt-Rt))+(Ir-wr),Ir=xe[++Nr],Rt=Jt,er!==0&&(Mt[mr++]=er);for(;cr<Ye;)er=Rt-((Jt=Rt+Mr)-(wr=Jt-Rt))+(Mr-wr),Mr=dt[++cr],Rt=Jt,er!==0&&(Mt[mr++]=er);return Rt===0&&mr!==0||(Mt[mr++]=Rt),mr}function be(ge){return new Float64Array(ge)}var ke=33306690738754716e-32,Pe=22204460492503146e-32,We=11093356479670487e-47,Le=be(4),Xe=be(8),rt=be(12),nt=be(16),ut=be(4);function ht(ge,xe,Ye){var dt=function(Mt,Rt,Jt,er,wr,Ir){var Mr=(Rt-Ir)*(Jt-wr),Nr=(Mt-wr)*(er-Ir),cr=Mr-Nr;if(Mr===0||Nr===0||Mr>0!=Nr>0)return cr;var mr=Math.abs(Mr+Nr);return Math.abs(cr)>=ke*mr?cr:-function(en,ln,cn,Sn,Ln,In,hn){var gn,Pr,Hr,ei,ar,jr,Mn,Fn,Gn,Si,jn,lr,si,Tn,Jn,Ui,os,Di,Li=en-Ln,Ji=cn-Ln,ko=ln-In,Vn=Sn-In;Le[0]=(Jn=(Fn=Li-(Mn=(jr=ue*Li)-(jr-Li)))*(Si=Vn-(Gn=(jr=ue*Vn)-(jr-Vn)))-((Tn=Li*Vn)-Mn*Gn-Fn*Gn-Mn*Si))-((jn=Jn-(os=(Fn=ko-(Mn=(jr=ue*ko)-(jr-ko)))*(Si=Ji-(Gn=(jr=ue*Ji)-(jr-Ji)))-((Ui=ko*Ji)-Mn*Gn-Fn*Gn-Mn*Si)))+(ar=Jn-jn))+(ar-os),Le[1]=(si=Tn-((lr=Tn+jn)-(ar=lr-Tn))+(jn-ar))-((jn=si-Ui)+(ar=si-jn))+(ar-Ui),Le[2]=lr-((Di=lr+jn)-(ar=Di-lr))+(jn-ar),Le[3]=Di;var xi=function(Oc,Rs){for(var po=Rs[0],ra=1;ra<4;ra++)po+=Rs[ra];return po}(0,Le),Ti=Pe*hn;if(xi>=Ti||-xi>=Ti||(gn=en-(Li+(ar=en-Li))+(ar-Ln),Hr=cn-(Ji+(ar=cn-Ji))+(ar-Ln),Pr=ln-(ko+(ar=ln-ko))+(ar-In),ei=Sn-(Vn+(ar=Sn-Vn))+(ar-In),gn===0&&Pr===0&&Hr===0&&ei===0)||(Ti=We*hn+ve*Math.abs(xi),(xi+=Li*ei+Vn*gn-(ko*Hr+Ji*Pr))>=Ti||-xi>=Ti))return xi;ut[0]=(Jn=(Fn=gn-(Mn=(jr=ue*gn)-(jr-gn)))*(Si=Vn-(Gn=(jr=ue*Vn)-(jr-Vn)))-((Tn=gn*Vn)-Mn*Gn-Fn*Gn-Mn*Si))-((jn=Jn-(os=(Fn=Pr-(Mn=(jr=ue*Pr)-(jr-Pr)))*(Si=Ji-(Gn=(jr=ue*Ji)-(jr-Ji)))-((Ui=Pr*Ji)-Mn*Gn-Fn*Gn-Mn*Si)))+(ar=Jn-jn))+(ar-os),ut[1]=(si=Tn-((lr=Tn+jn)-(ar=lr-Tn))+(jn-ar))-((jn=si-Ui)+(ar=si-jn))+(ar-Ui),ut[2]=lr-((Di=lr+jn)-(ar=Di-lr))+(jn-ar),ut[3]=Di;var Fo=me(4,Le,4,ut,Xe);ut[0]=(Jn=(Fn=Li-(Mn=(jr=ue*Li)-(jr-Li)))*(Si=ei-(Gn=(jr=ue*ei)-(jr-ei)))-((Tn=Li*ei)-Mn*Gn-Fn*Gn-Mn*Si))-((jn=Jn-(os=(Fn=ko-(Mn=(jr=ue*ko)-(jr-ko)))*(Si=Hr-(Gn=(jr=ue*Hr)-(jr-Hr)))-((Ui=ko*Hr)-Mn*Gn-Fn*Gn-Mn*Si)))+(ar=Jn-jn))+(ar-os),ut[1]=(si=Tn-((lr=Tn+jn)-(ar=lr-Tn))+(jn-ar))-((jn=si-Ui)+(ar=si-jn))+(ar-Ui),ut[2]=lr-((Di=lr+jn)-(ar=Di-lr))+(jn-ar),ut[3]=Di;var $i=me(Fo,Xe,4,ut,rt);ut[0]=(Jn=(Fn=gn-(Mn=(jr=ue*gn)-(jr-gn)))*(Si=ei-(Gn=(jr=ue*ei)-(jr-ei)))-((Tn=gn*ei)-Mn*Gn-Fn*Gn-Mn*Si))-((jn=Jn-(os=(Fn=Pr-(Mn=(jr=ue*Pr)-(jr-Pr)))*(Si=Hr-(Gn=(jr=ue*Hr)-(jr-Hr)))-((Ui=Pr*Hr)-Mn*Gn-Fn*Gn-Mn*Si)))+(ar=Jn-jn))+(ar-os),ut[1]=(si=Tn-((lr=Tn+jn)-(ar=lr-Tn))+(jn-ar))-((jn=si-Ui)+(ar=si-jn))+(ar-Ui),ut[2]=lr-((Di=lr+jn)-(ar=Di-lr))+(jn-ar),ut[3]=Di;var pl=me($i,rt,4,ut,nt);return nt[pl-1]}(Mt,Rt,Jt,er,wr,Ir,mr)}(ge[0],ge[1],xe[0],xe[1],Ye[0],Ye[1]);return dt>0?-1:dt<0?1:0}function at(ge,xe){var Ye=ge.point,dt=xe.point;return Ye[0]>dt[0]?1:Ye[0]<dt[0]?-1:Ye[1]!==dt[1]?Ye[1]>dt[1]?1:-1:function(Mt,Rt,Jt,er){return Mt.left!==Rt.left?Mt.left?1:-1:ht(Jt,Mt.otherEvent.point,Rt.otherEvent.point)!==0?Mt.isBelow(Rt.otherEvent.point)?-1:1:!Mt.isSubject&&Rt.isSubject?1:-1}(ge,xe,Ye)}function lt(ge,xe,Ye){var dt=new q(xe,!1,ge,ge.isSubject),Mt=new q(xe,!0,ge.otherEvent,ge.isSubject);return re(ge.point,ge.otherEvent.point)&&console.warn("what is that, a collapsed segment?",ge),dt.contourId=Mt.contourId=ge.contourId,at(Mt,ge.otherEvent)>0&&(ge.otherEvent.left=!0,Mt.left=!1),ge.otherEvent.otherEvent=Mt,ge.otherEvent=dt,Ye.push(Mt),Ye.push(dt),Ye}function Ze(ge,xe){return ge[0]*xe[1]-ge[1]*xe[0]}function qe(ge,xe){return ge[0]*xe[0]+ge[1]*xe[1]}function ct(ge,xe,Ye){var dt=function(wr,Ir,Mr,Nr,cr){var mr=[Ir[0]-wr[0],Ir[1]-wr[1]],en=[Nr[0]-Mr[0],Nr[1]-Mr[1]];function ln(jr,Mn,Fn){return[jr[0]+Mn*Fn[0],jr[1]+Mn*Fn[1]]}var cn=[Mr[0]-wr[0],Mr[1]-wr[1]],Sn=Ze(mr,en),Ln=Sn*Sn,In=qe(mr,mr);if(Ln>0){var hn=Ze(cn,en)/Sn;if(hn<0||hn>1)return null;var gn=Ze(cn,mr)/Sn;return gn<0||gn>1?null:hn===0||hn===1?[ln(wr,hn,mr)]:gn===0||gn===1?[ln(Mr,gn,en)]:[ln(wr,hn,mr)]}if((Ln=(Sn=Ze(cn,mr))*Sn)>0)return null;var Pr=qe(mr,cn)/In,Hr=Pr+qe(mr,en)/In,ei=Math.min(Pr,Hr),ar=Math.max(Pr,Hr);return ei<=1&&ar>=0?ei===1?[ln(wr,ei>0?ei:0,mr)]:ar===0?[ln(wr,ar<1?ar:1,mr)]:[ln(wr,ei>0?ei:0,mr),ln(wr,ar<1?ar:1,mr)]:null}(ge.point,ge.otherEvent.point,xe.point,xe.otherEvent.point),Mt=dt?dt.length:0;if(Mt===0||Mt===1&&(re(ge.point,xe.point)||re(ge.otherEvent.point,xe.otherEvent.point))||Mt===2&&ge.isSubject===xe.isSubject)return 0;if(Mt===1)return re(ge.point,dt[0])||re(ge.otherEvent.point,dt[0])||lt(ge,dt[0],Ye),re(xe.point,dt[0])||re(xe.otherEvent.point,dt[0])||lt(xe,dt[0],Ye),1;var Rt=[],Jt=!1,er=!1;return re(ge.point,xe.point)?Jt=!0:at(ge,xe)===1?Rt.push(xe,ge):Rt.push(ge,xe),re(ge.otherEvent.point,xe.otherEvent.point)?er=!0:at(ge.otherEvent,xe.otherEvent)===1?Rt.push(xe.otherEvent,ge.otherEvent):Rt.push(ge.otherEvent,xe.otherEvent),Jt&&er||Jt?(xe.type=v,ge.type=xe.inOut===ge.inOut?S:E,Jt&&!er&<(Rt[1].otherEvent,Rt[0].point,Ye),2):er?(lt(Rt[0],Rt[1].point,Ye),3):Rt[0]!==Rt[3].otherEvent?(lt(Rt[0],Rt[1].point,Ye),lt(Rt[1],Rt[2].point,Ye),3):(lt(Rt[0],Rt[1].point,Ye),lt(Rt[3].otherEvent,Rt[2].point,Ye),3)}function St(ge,xe){if(ge===xe)return 0;if(ht(ge.point,ge.otherEvent.point,xe.point)!==0||ht(ge.point,ge.otherEvent.point,xe.otherEvent.point)!==0)return re(ge.point,xe.point)?ge.isBelow(xe.otherEvent.point)?-1:1:ge.point[0]===xe.point[0]?ge.point[1]<xe.point[1]?-1:1:at(ge,xe)===1?xe.isAbove(ge.point)?-1:1:ge.isBelow(xe.point)?-1:1;if(ge.isSubject!==xe.isSubject)return ge.isSubject?-1:1;var Ye=ge.point,dt=xe.point;return Ye[0]===dt[0]&&Ye[1]===dt[1]?(Ye=ge.otherEvent.point)[0]===(dt=xe.otherEvent.point)[0]&&Ye[1]===dt[1]?0:ge.contourId>xe.contourId?1:-1:at(ge,xe)===1?1:-1}var _t=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Yt(ge,xe,Ye,dt){var Mt,Rt=ge+1,Jt=xe[ge].point,er=xe.length;for(Rt<er&&(Mt=xe[Rt].point);Rt<er&&Mt[0]===Jt[0]&&Mt[1]===Jt[1];){if(!Ye[Rt])return Rt;++Rt<er&&(Mt=xe[Rt].point)}for(Rt=ge-1;Ye[Rt]&&Rt>dt;)Rt--;return Rt}_t.prototype.isExterior=function(){return this.holeOf==null};var Lt=Ht,Nt=Ht;function Ht(ge,xe){if(!(this instanceof Ht))return new Ht(ge,xe);if(this.data=ge||[],this.length=this.data.length,this.compare=xe||Rr,this.length>0)for(var Ye=(this.length>>1)-1;Ye>=0;Ye--)this._down(Ye)}function Rr(ge,xe){return ge<xe?-1:ge>xe?1:0}Ht.prototype={push:function(ge){this.data.push(ge),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var ge=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),ge}},peek:function(){return this.data[0]},_up:function(ge){for(var xe=this.data,Ye=this.compare,dt=xe[ge];ge>0;){var Mt=ge-1>>1,Rt=xe[Mt];if(Ye(dt,Rt)>=0)break;xe[ge]=Rt,ge=Mt}xe[ge]=dt},_down:function(ge){for(var xe=this.data,Ye=this.compare,dt=this.length>>1,Mt=xe[ge];ge<dt;){var Rt=1+(ge<<1),Jt=Rt+1,er=xe[Rt];if(Jt<this.length&&Ye(xe[Jt],er)<0&&(Rt=Jt,er=xe[Jt]),Ye(er,Mt)>=0)break;xe[ge]=er,ge=Rt}xe[ge]=Mt}},Lt.default=Nt;var yt=Math.max,Wt=Math.min,gr=0;function $r(ge,xe,Ye,dt,Mt,Rt){var Jt,er,wr,Ir,Mr,Nr;for(Jt=0,er=ge.length-1;Jt<er;Jt++)if(Ir=ge[Jt+1],Mr=new q(wr=ge[Jt],!1,void 0,xe),Nr=new q(Ir,!1,Mr,xe),Mr.otherEvent=Nr,wr[0]!==Ir[0]||wr[1]!==Ir[1]){Mr.contourId=Nr.contourId=Ye,Rt||(Mr.isExteriorRing=!1,Nr.isExteriorRing=!1),at(Mr,Nr)>0?Nr.left=!0:Mr.left=!0;var cr=wr[0],mr=wr[1];Mt[0]=Wt(Mt[0],cr),Mt[1]=Wt(Mt[1],mr),Mt[2]=yt(Mt[2],cr),Mt[3]=yt(Mt[3],mr),dt.push(Mr),dt.push(Nr)}}var qr=[];function Sr(ge,xe,Ye){typeof ge[0][0][0]=="number"&&(ge=[ge]),typeof xe[0][0][0]=="number"&&(xe=[xe]);var dt=function(mr,en,ln){var cn=null;return mr.length*en.length==0&&(ln===C?cn=qr:ln===R?cn=mr:ln!==I&&ln!==L||(cn=mr.length===0?en:mr)),cn}(ge,xe,Ye);if(dt)return dt===qr?null:dt;var Mt=[1/0,1/0,-1/0,-1/0],Rt=[1/0,1/0,-1/0,-1/0],Jt=function(mr,en,ln,cn,Sn){var Ln,In,hn,gn,Pr,Hr,ei=new Lt(null,at);for(hn=0,gn=mr.length;hn<gn;hn++)for(Pr=0,Hr=(Ln=mr[hn]).length;Pr<Hr;Pr++)(In=Pr===0)&&gr++,$r(Ln[Pr],!0,gr,ei,ln,In);for(hn=0,gn=en.length;hn<gn;hn++)for(Pr=0,Hr=(Ln=en[hn]).length;Pr<Hr;Pr++)In=Pr===0,Sn===R&&(In=!1),In&&gr++,$r(Ln[Pr],!1,gr,ei,cn,In);return ei}(ge,xe,Mt,Rt,Ye);if(dt=function(mr,en,ln,cn,Sn){var Ln=null;return(ln[0]>cn[2]||cn[0]>ln[2]||ln[1]>cn[3]||cn[1]>ln[3])&&(Sn===C?Ln=qr:Sn===R?Ln=mr:Sn!==I&&Sn!==L||(Ln=mr.concat(en))),Ln}(ge,xe,Mt,Rt,Ye))return dt===qr?null:dt;for(var er=function(mr){var en,ln,cn=function(hn){var gn,Pr,Hr,ei,ar=[];for(Pr=0,Hr=hn.length;Pr<Hr;Pr++)((gn=hn[Pr]).left&&gn.inResult||!gn.left&&gn.otherEvent.inResult)&&ar.push(gn);for(var jr=!1;!jr;)for(jr=!0,Pr=0,Hr=ar.length;Pr<Hr;Pr++)Pr+1<Hr&&at(ar[Pr],ar[Pr+1])===1&&(ei=ar[Pr],ar[Pr]=ar[Pr+1],ar[Pr+1]=ei,jr=!1);for(Pr=0,Hr=ar.length;Pr<Hr;Pr++)(gn=ar[Pr]).otherPos=Pr;for(Pr=0,Hr=ar.length;Pr<Hr;Pr++)(gn=ar[Pr]).left||(ei=gn.otherPos,gn.otherPos=gn.otherEvent.otherPos,gn.otherEvent.otherPos=ei);return ar}(mr),Sn={},Ln=[],In=function(){if(!Sn[en]){var hn=Ln.length,gn=function(ar,jr,Mn){var Fn=new _t;if(ar.prevInResult!=null){var Gn=ar.prevInResult,Si=Gn.outputContourId;if(Gn.resultTransition>0){var jn=jr[Si];if(jn.holeOf!=null){var lr=jn.holeOf;jr[lr].holeIds.push(Mn),Fn.holeOf=lr,Fn.depth=jr[Si].depth}else jr[Si].holeIds.push(Mn),Fn.holeOf=Si,Fn.depth=jr[Si].depth+1}else Fn.holeOf=null,Fn.depth=jr[Si].depth}else Fn.holeOf=null,Fn.depth=0;return Fn}(cn[en],Ln,hn),Pr=function(ar){Sn[ar]=!0,ar<cn.length&&cn[ar]&&(cn[ar].outputContourId=hn)},Hr=en,ei=en;for(gn.points.push(cn[en].point);Pr(Hr),Pr(Hr=cn[Hr].otherPos),gn.points.push(cn[Hr].point),!((Hr=Yt(Hr,cn,Sn,ei))==ei||Hr>=cn.length)&&cn[Hr];);Ln.push(gn)}};for(en=0,ln=cn.length;en<ln;en++)In();return Ln}(function(mr,en,ln,cn,Sn,Ln){for(var In,hn,gn,Pr=new i(St),Hr=[],ei=Math.min(cn[2],Sn[2]);mr.length!==0;){var ar=mr.pop();if(Hr.push(ar),Ln===C&&ar.point[0]>ei||Ln===R&&ar.point[0]>cn[2])break;if(ar.left){hn=In=Pr.insert(ar),In=In!==(gn=Pr.minNode())?Pr.prev(In):null,hn=Pr.next(hn);var jr=In?In.key:null;if(z(ar,jr,Ln),hn&&ct(ar,hn.key,mr)===2&&(z(ar,jr,Ln),z(hn.key,ar,Ln)),In&&ct(In.key,ar,mr)===2){var Mn=In;z(jr,(Mn=Mn!==gn?Pr.prev(Mn):null)?Mn.key:null,Ln),z(ar,jr,Ln)}}else hn=In=Pr.find(ar=ar.otherEvent),In&&hn&&(In=In!==gn?Pr.prev(In):null,hn=Pr.next(hn),Pr.remove(ar),hn&&In&&ct(In.key,hn.key,mr))}return Hr}(Jt,0,0,Mt,Rt,Ye)),wr=[],Ir=0;Ir<er.length;Ir++){var Mr=er[Ir];if(Mr.isExterior()){for(var Nr=[Mr.points],cr=0;cr<Mr.holeIds.length;cr++)Nr.push(er[Mr.holeIds[cr]].points);wr.push(Nr)}}return wr}var Cn={UNION:I,DIFFERENCE:R,INTERSECTION:C,XOR:L};a.diff=function(ge,xe){return Sr(ge,xe,R)},a.intersection=function(ge,xe){return Sr(ge,xe,C)},a.operations=Cn,a.union=function(ge,xe){return Sr(ge,xe,I)},a.xor=function(ge,xe){return Sr(ge,xe,L)},Object.defineProperty(a,"__esModule",{value:!0})}(pP.exports)),pP.exports);/**
|
||
* martinez v0.7.4
|
||
* Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
|
||
*
|
||
* @author Alex Milevski <info@w8r.name>
|
||
* @license MIT
|
||
* @preserve
|
||
*/function Kx(a,r,i,c){const d=[],m=c===0?(g,v,S,E,C,I)=>{g.push(new it(I,S+(I-v)/(E-v)*(C-S)))}:(g,v,S,E,C,I)=>{g.push(new it(v+(I-S)/(C-S)*(E-v),I))};for(const g of a){const v=[];for(const S of g){if(S.length<=2)continue;const E=[];for(let R=0;R<S.length-1;R++){const L=S[R].x,z=S[R].y,U=S[R+1].x,q=S[R+1].y,W=c===0?L:z,re=c===0?U:q;W<r?re>r&&m(E,L,z,U,q,r):W>i?re<i&&m(E,L,z,U,q,i):E.push(S[R]),re<r&&W>=r&&m(E,L,z,U,q,r),re>i&&W<=i&&m(E,L,z,U,q,i)}let C=S[S.length-1];const I=c===0?C.x:C.y;I>=r&&I<=i&&E.push(C),E.length&&(C=E[E.length-1],E[0].x===C.x&&E[0].y===C.y||E.push(E[0]),v.push(E))}v.length&&d.push(v)}return d}function HU(a,r){const i=lT(a),c=lT([r]),d=mP.intersection(i,c);return d==null?[]:gP(d)}function WU(a,r){let c=lT(a,65536);const d=[];for(;r.valid();r.next()){const[m,g]=r.get(),v=m.x*65536,S=m.y*65536,E=g.x*65536,C=g.y*65536,I=E-v,R=C-S,L=Math.hypot(I,R);if(L===0)continue;const z=Math.trunc(R/L*3),U=-Math.trunc(I/L*3);d.push([[[v,S],[E,C],[E+z,C+U],[v+z,S+U],[v,S]]])}return d.length>0&&(c=mP.diff(c,d)),gP(c,1/65536)}function lT(a,r=1){return[a.map(i=>i.map(c=>[c.x*r,c.y*r]))]}function gP(a,r=1){return a.map(i=>i.map((c,d)=>{const m=c.map(g=>new it(g[0]*r,g[1]*r).round());return d>0&&m.reverse(),m}))}class cT{constructor(r,i){this.layoutVertexArray=new Cc,this.indexArray=new Ni,this.lineIndexArray=new Jo,this.triangleSegments=new ri,this.lineSegments=new ri,this.programConfigurations=new Fa(r.layers,{zoom:r.zoom,lut:r.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Ll)}update(r,i,c,d,m,g,v,S){this.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v,S)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,PU.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.lineIndexBuffer=r.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=r.createVertexBuffer(this.elevatedLayoutVertexArray,MU.members))),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(r,i,c,d,m,g,v){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,i,c,d,m,g,void 0,v)}}class uT{constructor(r){this.zoom=r.zoom,this.pixelRatio=r.pixelRatio,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=r.lut,this.bufferData=new cT(r,!1),this.elevationBufferData=new cT(r,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=r.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=r.sourceLayerIndex,this.worldview=r.worldview,this.hasAppearances=null}updateFootprints(r,i){}updateAppearances(r,i,c,d){}populate(r,i,c,d){this.hasPattern=oT("fill",this.layers,this.pixelRatio,i);const m=this.layers[0].layout.get("fill-sort-key"),g=[];for(const{feature:v,id:S,index:E,sourceLayerIndex:C}of r){const I=this.layers[0]._featureFilter.needGeometry,R=De(v,I);if(!this.layers[0]._featureFilter.filter(new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),R,c))continue;const L=m?m.evaluate(R,{},c,i.availableImages):void 0,z={id:S,properties:v.properties,type:v.type,sourceLayerIndex:C,index:E,geometry:I?R.geometry:Te(v,c,d),patterns:{},sortKey:L};g.push(z)}m&&g.sort((v,S)=>v.sortKey-S.sortKey);for(const v of g){const{geometry:S,index:E,sourceLayerIndex:C}=v;if(this.hasPattern){const I=aT("fill",this.layers,v,this.zoom,this.pixelRatio,i);this.patternFeatures.push(I)}else this.addFeature(v,S,E,c,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(r[E].feature,S,E,C,this.index)}}update(r,i,c,d,m,g,v){this.bufferData.update(r,i,c,d,m,g,v,this.worldview),this.elevationBufferData.update(r,i,c,d,m,g,v,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(r,i,c,d,m,g,v,this.worldview)}addFeatures(r,i,c,d,m,g){for(const v of this.patternFeatures)this.addFeature(v,v.geometry,v.index,i,c,d,g,r.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(r){this.bufferData.upload(r),this.elevationBufferData.upload(r),this.elevatedStructures&&this.elevatedStructures.upload(r)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(r,i,c,d,m,g=[],v,S){const E=xy(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(r,E,d,c,S):this.addGeometry(E,this.bufferData),this.bufferData.populatePaintArrays(r,c,m,g,d,v,this.worldview),this.elevationBufferData.populatePaintArrays(r,c,m,g,d,v,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(r,i,c,d,m){this.elevatedStructures&&(this.elevatedStructures.construct(r),this.elevatedStructures.populatePaintArrays(i,c,d,m,this.worldview))}addElevatedRoadFeature(r,i,c,d,m){const g=new Array,v=pn.getElevationFeature(r,m);if(!v)return void this.addGeometry(i,this.bufferData);{const E=this.clipPolygonsToTile(i,1);E.length>0&&g.push({polygons:E,elevationFeature:v,elevationTileID:c})}const S={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(r,{},c),featureIndex:d};for(const E of g)if(E.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new ea(E.elevationTileID,this.layers,this.zoom,this.lut));const I=E.elevationFeature.isTunnel();let R=0;r.properties.hasOwnProperty(Ve)&&(R=+r.properties[Ve]);for(const L of E.polygons)this.elevatedStructures.addPortalCandidates(E.elevationFeature.id,L,I,E.elevationFeature,R)}E.elevationFeature.constantHeight==null&&(E.polygons=this.prepareElevatedPolygons(E.polygons,E.elevationFeature,E.elevationTileID));const C=new An(c,E.elevationTileID);this.addElevatedGeometry(E.polygons,C,E.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,d,S)}}addElevatedGeometry(r,i,c,d,m,g){const v={elevation:c,elevationSampler:i,bias:d,index:m,featureInfo:g},[S,E]=this.addGeometry(r,this.elevationBufferData,v);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:S,max:E}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,S),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,E))}addGeometry(r,i,c){let d=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=null;c&&(g=c.elevationSampler.constantElevation(c.elevation,c.bias),g!=null&&(d=g,m=g));const v=(S,E,C)=>{if(c!=null)if(E.push(S),g!=null)i.elevatedLayoutVertexArray.emplaceBack(g),C.push(g);else{const I=c.elevationSampler.pointElevation(S,c.elevation,c.bias);i.elevatedLayoutVertexArray.emplaceBack(I),C.push(I),d=Math.min(d,I),m=Math.max(m,I)}};for(const S of r){let E=0;for(const ie of S)E+=ie.length;const C=i.triangleSegments.prepareSegment(E,i.layoutVertexArray,i.indexArray),I=C.vertexLength,R=[],L=[],z=[],U=[],q=[],W=i.layoutVertexArray.length;for(const ie of S){if(ie.length===0)continue;ie!==S[0]&&L.push(R.length/2);const ue=i.lineSegments.prepareSegment(ie.length,i.layoutVertexArray,i.lineIndexArray),ve=ue.vertexLength;c&&q.push(i.layoutVertexArray.length-W),v(ie[0],z,U),i.layoutVertexArray.emplaceBack(ie[0].x,ie[0].y),i.lineIndexArray.emplaceBack(ve+ie.length-1,ve),R.push(ie[0].x),R.push(ie[0].y);for(let me=1;me<ie.length;me++)v(ie[me],z,U),i.layoutVertexArray.emplaceBack(ie[me].x,ie[me].y),i.lineIndexArray.emplaceBack(ve+me-1,ve+me),R.push(ie[me].x),R.push(ie[me].y);ue.vertexLength+=ie.length,ue.primitiveLength+=ie.length}const re=fm(R,L);for(let ie=0;ie<re.length;ie+=3)i.indexArray.emplaceBack(I+re[ie],I+re[ie+1],I+re[ie+2]);if(re.length>0&&c&&this.elevationMode==="hd-road-base"){const ie=c.elevation.isTunnel(),ue=c.elevation.safeArea,ve=this.elevatedStructures.addVertices(z,U);this.elevatedStructures.addTriangles(re,ve,ie);const me=q.length;if(me>0){for(let be=0;be<me-1;be++)this.elevatedStructures.addRenderableRing(c.index,q[be]+ve,q[be+1]-q[be],ie,ue,c.featureInfo);this.elevatedStructures.addRenderableRing(c.index,q[me-1]+ve,z.length-q[me-1],ie,ue,c.featureInfo)}}C.vertexLength+=E,C.primitiveLength+=re.length/3}return[d,m]}prepareElevatedPolygons(r,i,c){const d=1/J(c),m=[];for(const g of r){const v=WU(g,new an(i,d));m.push(...v)}return m}clipPolygonsToTile(r,i){const c=-i,d=-i,m=bt+i,g=bt+i;let v=0;const S=[],E=[];for(;v<r.length;v++){const R=r[v],L=Cl(R);(L.min.x>=c&&L.max.x<=m&&L.min.y>=d&&L.max.y<=g?S:E).push(R)}if(S.length===r.length)return r;const C=[new it(c,d),new it(m,d),new it(m,g),new it(c,g),new it(c,d)],I=S;for(const R of E)I.push(...HU(R,C));return I}}let _P,yP,vP,xP;Ut(uT,"FillBucket",{omit:["layers","patternFeatures"]}),Ut(cT,"FillBufferData"),Ut(ea,"ElevatedStructures");class Zx{constructor(r,i,c,d){if(this.triangleCount=i.length/3,this.min=new it(0,0),this.max=new it(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||r.length===0)return;const[m,g]=[r[0].clone(),r[0].clone()];for(let I=1;I<r.length;++I){const R=r[I];m.x=Math.min(m.x,R.x),m.y=Math.min(m.y,R.y),g.x=Math.max(g.x,R.x),g.y=Math.max(g.y,R.y)}if(d){const I=Math.ceil(Math.max(g.x-m.x,g.y-m.y)/d);c=Math.max(c,I)}if(c===0)return;this.min=m,this.max=g;const v=this.max.sub(this.min);v.x=Math.max(v.x,1),v.y=Math.max(v.y,1);const S=Math.max(v.x,v.y)/c;this.cellsX=Math.max(1,Math.ceil(v.x/S)),this.cellsY=Math.max(1,Math.ceil(v.y/S)),this.xScale=1/S,this.yScale=1/S;const E=[];for(let I=0;I<this.triangleCount;I++){const R=r[i[3*I+0]].sub(this.min),L=r[i[3*I+1]].sub(this.min),z=r[i[3*I+2]].sub(this.min),U=Dc(Math.floor(Math.min(R.x,L.x,z.x)),this.xScale,this.cellsX),q=Dc(Math.floor(Math.max(R.x,L.x,z.x)),this.xScale,this.cellsX),W=Dc(Math.floor(Math.min(R.y,L.y,z.y)),this.yScale,this.cellsY),re=Dc(Math.floor(Math.max(R.y,L.y,z.y)),this.yScale,this.cellsY),ie=new it(0,0),ue=new it(0,0),ve=new it(0,0),me=new it(0,0);for(let be=W;be<=re;++be){ie.y=ue.y=be*S,ve.y=me.y=(be+1)*S;for(let ke=U;ke<=q;++ke)ie.x=ve.x=ke*S,ue.x=me.x=(ke+1)*S,(Us(R,L,z,ie,ue,me)||Us(R,L,z,ie,me,ve))&&E.push({cellIdx:be*this.cellsX+ke,triIdx:I})}}if(E.length===0)return;E.sort((I,R)=>I.cellIdx-R.cellIdx||I.triIdx-R.triIdx);let C=0;for(;C<E.length;){const I=E[C].cellIdx,R={start:this.payload.length,len:0};for(;C<E.length&&E[C].cellIdx===I;)++R.len,this.payload.push(E[C++].triIdx);this.cells[I]=R}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(r,i){if(this.triangleCount===0||this.cells.length===0||r.x>this.max.x||this.min.x>r.x||r.y>this.max.y||this.min.y>r.y)return;const c=Dc(r.x-this.min.x,this.xScale,this.cellsX),d=Dc(r.y-this.min.y,this.yScale,this.cellsY),m=this.cells[d*this.cellsX+c];if(m){this._lazyInitLookup();for(let g=0;g<m.len;g++){const v=this.payload[m.start+g],S=Math.floor(v/8),E=1<<v%8;if(!(this.lookup[S]&E)&&(this.lookup[S]|=E,i.push(v),i.length===this.triangleCount))return}}}query(r,i,c){if(this.triangleCount===0||this.cells.length===0||r.x>this.max.x||this.min.x>i.x||r.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const d=Dc(r.x-this.min.x,this.xScale,this.cellsX),m=Dc(i.x-this.min.x,this.xScale,this.cellsX),g=Dc(r.y-this.min.y,this.yScale,this.cellsY),v=Dc(i.y-this.min.y,this.yScale,this.cellsY);for(let S=g;S<=v;S++)for(let E=d;E<=m;E++){const C=this.cells[S*this.cellsX+E];if(C)for(let I=0;I<C.len;I++){const R=this.payload[C.start+I],L=Math.floor(R/8),z=1<<R%8;if(!(this.lookup[L]&z)&&(this.lookup[L]|=z,c.push(R),c.length===this.triangleCount))return}}}}function Dc(a,r,i){return Math.max(0,Math.min(i-1,Math.floor(a*r)))}Ut(Zx,"TriangleGridIndex");class wP{constructor(r){this.zoom=r.zoom,this.layers=r.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=r.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=r.worldview,this.hasAppearances=null}updateFootprints(r,i){for(const c of this.footprints)i.push({footprint:c,id:r})}updateAppearances(r,i,c,d){}populate(r,i,c,d){const m=[];for(const{feature:g,id:v,index:S,sourceLayerIndex:E}of r){const C=this.layers[0]._featureFilter.needGeometry,I=De(g,C);if(!this.layers[0]._featureFilter.filter(new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),I,c))continue;const R={id:v,properties:g.properties,type:g.type,sourceLayerIndex:E,index:S,geometry:C?I.geometry:Te(g,c,d),patterns:{}};m.push(R)}for(const g of m){const{geometry:v,index:S,sourceLayerIndex:E}=g;this.addFeature(g,v,S,c,{},i.availableImages,i.brightness),i.featureIndex.insert(r[S].feature,v,S,E,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(r){}update(r,i,c,d,m,g,v){}destroy(){}addFeature(r,i,c,d,m,g=[],v){for(const S of xy(i,2)){const E=[],C=[],I=[],R=new it(1/0,1/0),L=new it(-1/0,-1/0);for(const q of S)if(q.length!==0){q!==S[0]&&I.push(C.length/2);for(let W=0;W<q.length;W++)C.push(q[W].x),C.push(q[W].y),E.push(q[W]),R.x=Math.min(R.x,q[W].x),R.y=Math.min(R.y,q[W].y),L.x=Math.max(L.x,q[W].x),L.y=Math.max(L.y,q[W].y)}const z=fm(C,I),U=new Zx(E,z,8,256);this.footprints.push({vertices:E,indices:z,grid:U,min:R,max:L})}}}Ut(wP,"ClipBucket",{omit:["layers"]});const qU=Br([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),KU=Br([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),ZU=Br([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),XU=Br([{name:"a_centroid_pos",components:2,type:"Uint16"}]),YU=Br([{name:"a_join_normal_inside",components:3,type:"Int16"}]),JU=Br([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),QU=Br([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:e6}=qU,wy=Number.MAX_SAFE_INTEGER,bP=wy-1;function SP(a,r,i,c){return a.order<r||a.order===wy||!(a.clipMask&i)||function(d,m){return m.length!==0&&m.find(g=>g===d)===void 0}(c,a.clipScope)}function Xx(a,r){return a.x-r.x||a.y-r.y}function TP(a,r){return Xx(a.min,r.min)===0&&Xx(a.max,r.max)===0}function dT(a,r){return!(a.min.x>r.max.x||a.max.x<r.min.x||a.min.y>r.max.y||a.max.y<r.min.y)}function Yx(a,r){if(a.length!==r.length)return!1;for(let i=0;i<a.length;i++)if(a[i].sourceId!==r[i].sourceId||!TP(a[i],r[i])||a[i].order!==r[i].order||a[i].clipMask!==r[i].clipMask||!hs(a[i].clipScope,r[i].clipScope))return!1;return!0}function EP(a,r,i){const c=1/bt,d=1/(1<<i.canonical.z),m=(r.x*c+i.canonical.x)*d+i.wrap,g=(r.y*c+i.canonical.y)*d;return{min:new it((a.x*c+i.canonical.x)*d+i.wrap,(a.y*c+i.canonical.y)*d),max:new it(m,g)}}function t6(a,r,i){const c=1<<i.canonical.z,d=((r.x-i.wrap)*c-i.canonical.x)*bt,m=(r.y*c-i.canonical.y)*bt;return{min:new it(((a.x-i.wrap)*c-i.canonical.x)*bt,(a.y*c-i.canonical.y)*bt),max:new it(d,m)}}function hT(a,r,i,c,d,m,g){const v=a.indices,S=a.vertices,E=[];for(let C=c;C<c+d;C+=3){const I=r[i[C+0]+m],R=r[i[C+1]+m],L=r[i[C+2]+m],z=Math.min(I.x,R.x,L.x),U=Math.max(I.x,R.x,L.x),q=Math.min(I.y,R.y,L.y),W=Math.max(I.y,R.y,L.y);E.length=0,a.grid.query(new it(z,q),new it(U,W),E);for(let re=0;re<E.length;re++){const ie=E[re];if(Us(S[v[3*ie+0]],S[v[3*ie+1]],S[v[3*ie+2]],I,R,L,g))return!0}}return!1}function kP(a,r,i,c){if(!a||!i)return!1;let d=a.vertices;if(!r.canonical.equals(c.canonical)||r.wrap!==c.wrap){if(i.vertices.length<a.vertices.length)return kP(i,c,a,r);const m=r.canonical,g=c.canonical,v=Math.pow(2,g.z-m.z);d=a.vertices.map(S=>new it((S.x+m.x*bt)*v-g.x*bt,(S.y+m.y*bt)*v-g.y*bt))}return hT(i,d,a.indices,0,a.indices.length,0,0)}function AP(a,r,i,c){const d=Math.pow(2,c.z-i.z);return new it((a+i.x*bt)*d-c.x*bt,(r+i.y*bt)*d-c.y*bt)}function CP(a,r){const i=[];r.grid.queryPoint(a,i);const c=r.indices,d=r.vertices;for(let m=0;m<i.length;m++){const g=i[m];if(Rn([d[c[3*g+0]],d[c[3*g+1]],d[c[3*g+2]]],a))return!0}return!1}const fT=[new it(0,0),new it(bt,0),new it(bt,bt),new it(0,bt)];function IP(a,r){const i=[];let c=[];if(!r||a.length<2)return[a];if(a.length===2)return Ms(a[0],a[1],fT)?[a]:[];for(let d=0;d<a.length+2;d++){const m=a[d%a.length],g=a[(d+1)%a.length],v=Ms(d===0?a[a.length-1]:a[(d-1)%a.length],m,fT),S=Ms(m,g,fT),E=v||S;E&&c.push(m),E&&S||c.length>0&&(c.length>1&&i.push(c),c=[])}return c.length>1&&i.push(c),i}const pT=Me.types,r6=["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"],n6=["fill-extrusion-flood-light-ground-radius"],i6=Math.pow(2,13),s6=Math.pow(2,15)-1,PP=new it(0,1),wu=2147483648,MP=7,RP=450;function by(a,r,i,c,d,m,g,v){a.emplaceBack((r<<1)+g,(i<<1)+m,(Math.floor(c*i6)<<1)+d,Math.round(v))}function Sy(a,r,i){a.emplaceBack(r.x*bt,r.y*bt,i?1:0)}function Jx(a,r,i,c,d,m){a.emplaceBack(r.x,r.y,(i.x<<1)+c,(i.y<<1)+d,m)}function Ty(a,r,i){a.emplaceBack(r.x,r.y,r.z,i[0]*16384,i[1]*16384,i[2]*16384)}class DP{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class LP{constructor(){this.centroidXY=new it(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 it(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new it(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new it(this.max.x-this.min.x,this.max.y-this.min.y)}}class OP{constructor(){this.acc=new it(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(r,i){r.min.x===Number.MAX_VALUE&&(r.min.x=r.max.x=i.x,r.min.y=r.max.y=i.y)}appendEdge(r,i,c){this.accCount++,this.acc._add(i);let d=!!this.borders;i.x<r.min.x?(r.min.x=i.x,d=!0):i.x>r.max.x&&(r.max.x=i.x,d=!0),i.y<r.min.y?(r.min.y=i.y,d=!0):i.y>r.max.y&&(r.max.y=i.y,d=!0),((i.x===0||i.x===bt)&&i.x===c.x)!=((i.y===0||i.y===bt)&&i.y===c.y)&&this.processBorderOverlap(i,c),d&&this.checkBorderIntersection(i,c)}checkBorderIntersection(r,i){i.x<0!=r.x<0&&this.addBorderIntersection(0,ur(i.y,r.y,(0-i.x)/(r.x-i.x))),i.x>bt!=r.x>bt&&this.addBorderIntersection(1,ur(i.y,r.y,(bt-i.x)/(r.x-i.x))),i.y<0!=r.y<0&&this.addBorderIntersection(2,ur(i.x,r.x,(0-i.y)/(r.y-i.y))),i.y>bt!=r.y>bt&&this.addBorderIntersection(3,ur(i.x,r.x,(bt-i.y)/(r.y-i.y)))}addBorderIntersection(r,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 c=this.borders[r];i<c[0]&&(c[0]=i),i>c[1]&&(c[1]=i)}processBorderOverlap(r,i){if(r.x===i.x){if(r.y===i.y)return;const c=r.x===0?0:1;this.addBorderIntersection(c,i.y),this.addBorderIntersection(c,r.y)}else{const c=r.y===0?2:3;this.addBorderIntersection(c,i.x),this.addBorderIntersection(c,r.x)}}centroid(){return this.accCount===0?new it(0,0):new it(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((r,i)=>r+ +(i[0]!==Number.MAX_VALUE),0):0}}function zP(a,r){const i=a.add(r)._unit(),c=K(a.x*i.x+a.y*i.y,-1,1);var d,m,g;return d=Math.acos(c),Math.min(4,Math.max(-4,Math.tan(d)))/4*s6*((m=a).x*(g=r).y-m.y*g.x<0?-1:1)}const o6=[a=>a.x<0,a=>a.x>bt,a=>a.y<0,a=>a.y>bt];function a6(a,r,i,c){const d=[4];if(c===0)return d;i._mult(c);const m=a.sub(i),g=r.sub(i),v=[a,r,m,g];for(let S=0;S<4;S++)for(const E of v)if(o6[S](E)){d.push(S);break}return d}class mT{constructor(r){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new X_,this.indexArray=new Ni,this.programConfigurations=new Fa(r.layers,{zoom:r.zoom,lut:r.lut},i=>n6.includes(i)),this._segments=new ri,this.hiddenByLandmarkVertexArray=new tm,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new ri}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(r,i,c,d=!1){const m=r.length;if(m>2){let g=Math.max(0,this._segments.get().length-1);const v=this._segments._prepareSegment(4*m,this.vertexArray.length,2*this._segmentToGroundQuads[g].length);let S;g!==this._segments.get().length-1&&(g++,this._segmentToGroundQuads[g]=[],this._segmentToRegionTriCounts[g]=[0,0,0,0,0]);{const E=r[0],C=r[1];S=zP(E.sub(r[m-1])._perp()._unit(),C.sub(E)._perp()._unit())}for(let E=0;E<m;E++){const C=E===m-1?0:E+1,I=r[E],R=r[C],L=r[C===m-1?0:C+1],z=R.sub(I)._perp()._unit(),U=zP(z,L.sub(R)._perp()._unit()),q=S,W=U;if(gT(I,R,i)||d&&NP(I,i)&&NP(R,i)){S=U;continue}const re=v.vertexLength;Jx(this.vertexArray,I,R,1,1,q),Jx(this.vertexArray,I,R,1,0,q),Jx(this.vertexArray,I,R,0,1,W),Jx(this.vertexArray,I,R,0,0,W),v.vertexLength+=4;const ie=a6(I,R,z,c);for(const ue of ie)this._segmentToGroundQuads[g].push({id:re,region:ue}),this._segmentToRegionTriCounts[g][ue]+=2,v.primitiveLength+=2;S=U}}}prepareBorderSegments(){if(!this.hasData())return;const r=this._segments.get(),i=r.length;for(let c=0;c<i;c++)this._segmentToGroundQuads[c].sort((d,m)=>d.region-m.region);for(let c=0;c<i;c++){const d=this._segmentToGroundQuads[c],m=r[c],g=this._segmentToRegionTriCounts[c];g.reduce((S,E)=>S+E,0);let v=0;for(let S=0;S<=4;S++){const E=g[S];if(E!==0){let C=this.regionSegments[S];C||(C=this.regionSegments[S]=new ri);const I={vertexOffset:m.vertexOffset,primitiveOffset:m.primitiveOffset+v,vertexLength:m.vertexLength,primitiveLength:E};C.get().push(I)}v+=E}for(let S=0;S<d.length;S++){const E=d[S].id;this.indexArray.emplaceBack(E,E+1,E+3),this.indexArray.emplaceBack(E,E+3,E+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(r,i,c,d,m,g,v){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,r,i,c,d,m,g,void 0,v)}upload(r){this.hasData()&&(this.vertexBuffer=r.createVertexBuffer(this.vertexArray,KU.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=r.createVertexBuffer(this.groundRadiusArray,ZU.members)))}uploadPaintProperties(r){this.hasData()&&this.programConfigurations.upload(r)}update(r,i,c,d,m,g,v,S){this.hasData()&&this.programConfigurations.updatePaintArrays(r,i,c,d,m,g,v,S)}updateHiddenByLandmark(r){this.updateHiddenByLandmarkRange(r.groundVertexArrayOffset,r.groundVertexCount,!!(r.flags&wu))}updateHiddenByLandmarkRange(r,i,c){if(!this.hasData())return;const d=i+r;if(i!==0){for(let m=r;m<d;++m)this.hiddenByLandmarkVertexArray.emplace(m,c?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(r){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=r.createVertexBuffer(this.hiddenByLandmarkVertexArray,JU.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 r=0;r<=4;r++){const i=this.regionSegments[r];i&&i.destroy()}}}}class Qx{constructor(r){this.zoom=r.zoom,this.canonical=r.canonical,this.overscaling=r.overscaling,this.layers=r.layers,this.pixelRatio=r.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=r.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=r.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ni,this.footprintVertices=new Cc,this.footprintSegments=[],this.layoutVertexArray=new dd,this.centroidVertexArray=new jx,this.wallVertexArray=new Gh,this.indexArray=new Ni,this.programConfigurations=new Fa(r.layers,{zoom:r.zoom,lut:r.lut},i=>r6.includes(i)),this.segments=new ri,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new mT(r),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=r.worldview,this.hasAppearances=null}updateFootprints(r,i){}updateAppearances(r,i,c,d){}populate(r,i,c,d){this.features=[],this.hasPattern=oT("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=J(c),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:m,id:g,index:v,sourceLayerIndex:S}of r){const E=this.layers[0]._featureFilter.needGeometry,C=De(m,E);if(!this.layers[0]._featureFilter.filter(new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),C,c))continue;const I={id:g,sourceLayerIndex:S,index:v,geometry:E?C.geometry:Te(m,c,d),properties:m.properties,type:m.type,patterns:{}},R=this.layoutVertexArray.length,L=pT[I.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:m.id,feature:aT("fill-extrusion",this.layers,I,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const z of I.geometry)for(const U of IP(z,L))this.addFeature(m.id,I,[U],v,c,{},i.availableImages,d,i.brightness);else this.addFeature(m.id,I,I.geometry,v,c,{},i.availableImages,d,i.brightness);i.featureIndex.insert(m,I.geometry,v,S,this.index,R)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(r,i,c,d,m,g){for(const{featureId:v,feature:S}of this.features){const E=pT[S.type]==="Polygon",{geometry:C}=S;if(this.wallMode)for(const I of C)for(const R of IP(I,E))this.addFeature(v,S,[R],S.index,i,c,d,m,g);else this.addFeature(v,S,C,S.index,i,c,d,m,g)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(r,i,c,d,m,g,v){this.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v,this.worldview),this.groundEffect.update(r,i,m,c,d,g,v,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,e6),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.wallVertexBuffer=r.createVertexBuffer(this.wallVertexArray,YU.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=r.createVertexBuffer(this.layoutVertexExtArray,QU.members,!0)),this.groundEffect.upload(r)),this.groundEffect.uploadPaintProperties(r),this.programConfigurations.upload(r),this.uploaded=!0}uploadCentroid(r){this.groundEffect.uploadHiddenByLandmark(r),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=r.createVertexBuffer(this.centroidVertexArray,XU.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(r,i,c,d,m,g,v,S,E){const C=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,I=[new it(0,0),new it(bt,bt)],R=S.projection,L=R.name==="globe",z=this.wallMode||pT[i.type]==="Polygon",U=new OP;U.centroidDataIndex=this.centroidData.length;const q=new LP;q.buildingId=r,i.properties&&i.properties.hasOwnProperty("building_id")&&(q.buildingId=i.properties.building_id);const W=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},m)<=0,re=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},m);let ie;if(q.height=re,q.vertexArrayOffset=this.layoutVertexArray.length,q.groundVertexArrayOffset=this.groundEffect.vertexArray.length,L&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Zp),this.wallMode){if(L)return void Ft("Non zero fill-extrusion-line-width is not yet supported on globe.");if(c.length!==1)return;ie=function(Le){const Xe=Le[0].x===Le[Le.length-1].x&&Le[0].y===Le[Le.length-1].y;(function(Nt){let Ht=0;const Rr=Nt.length;for(let yt=0;yt<Rr;yt++)Ht+=(Nt[(yt+1)%Rr].x-Nt[yt].x)*(Nt[(yt+1)%Rr].y+Nt[yt].y);return Ht>=0})(Le)||(Le=Le.reverse());const nt={geometry:[],joinNormals:[],indices:[]},ut=[],ht=[],at=[];let lt=Le.length;for(;lt>=2&&Le[lt-1].equals(Le[lt-2]);)lt--;if(lt<(Xe?3:2))return nt;let Ze,qe,ct,St,_t,Yt=0;for(;Yt<lt-1&&Le[Yt].equals(Le[Yt+1]);)Yt++;Xe&&(Ze=Le[lt-2],_t=Le[Yt].sub(Ze)._unit()._perp());for(let Nt=Yt;Nt<lt;Nt++){if(ct=Nt===lt-1?Xe?Le[Yt+1]:void 0:Le[Nt+1],ct&&Le[Nt].equals(ct))continue;_t&&(St=_t),Ze&&(qe=Ze),Ze=Le[Nt],_t=ct?ct.sub(Ze)._unit()._perp():St,St=St||_t;let Ht=St.add(_t);Ht.x===0&&Ht.y===0||Ht._unit();const Rr=Ht.x*_t.x+Ht.y*_t.y,yt=Rr!==0?1/Rr:1/0,Wt=St.x*_t.y-St.y*_t.x>0;let gr="miter";const $r=2;gr==="miter"&&yt>$r&&(gr="bevel"),gr==="bevel"&&(yt>100&&(gr="flipbevel"),yt<$r&&(gr="miter"));const qr=(Sr,Cn,ge,xe)=>{const Ye=new it(Sr.x,Sr.y),dt=new it(Sr.x,Sr.y);Ye.x+=Cn.x*xe,Ye.y+=Cn.y*xe,dt.x-=Cn.x*Math.max(ge,1),dt.y-=Cn.y*Math.max(ge,1),at.push(Cn),ut.push(Ye),ht.push(dt)};if(gr==="miter")Ht._mult(yt),qr(Ze,Ht,0,0);else if(gr==="flipbevel")Ht=_t.mult(-1),qr(Ze,Ht,0,0),qr(Ze,Ht.mult(-1),0,0);else{const Sr=-Math.sqrt(yt*yt-1),Cn=Wt?Sr:0,ge=Wt?0:Sr;qe&&qr(Ze,St,Cn,ge),ct&&qr(Ze,_t,Cn,ge)}}nt.geometry=[...ut,...ht.reverse(),ut[0]],nt.joinNormals=[...at,...at.reverse(),at[at.length-1]];const Lt=nt.geometry.length-1;for(let Nt=0;Nt<Lt/2;Nt++)if(Nt+1<Lt/2){let Ht=Nt,Rr=Nt+1,yt=Lt-1-Nt,Wt=Lt-2-Nt;Ht=Ht===0?Lt-1:Ht-1,Rr=Rr===0?Lt-1:Rr-1,yt=yt===0?Lt-1:yt-1,Wt=Wt===0?Lt-1:Wt-1,nt.indices.push(yt),nt.indices.push(Rr),nt.indices.push(Ht),nt.indices.push(yt),nt.indices.push(Wt),nt.indices.push(Rr)}return nt}(c[0]),c=[ie.geometry]}const ue=(Le,Xe)=>Le<(Xe.length-1)/2||Le===Xe.length-1,ve=this.wallMode?[c]:xy(c,500);for(let Le=ve.length-1;Le>=0;Le--){const Xe=ve[Le];(Xe.length===0||(me=Xe[0]).every(rt=>rt.x<=0)||me.every(rt=>rt.x>=bt)||me.every(rt=>rt.y<=0)||me.every(rt=>rt.y>=bt))&&ve.splice(Le,1)}var me;let be;if(L)be=$P(ve,I,m);else{be=[];for(const Le of ve)be.push({polygon:Le,bounds:I})}const ke=z?this.edgeRadius:0,Pe=ke>0&&this.zoom<17,We=(Le,Xe)=>{if(Le.length===0)return!1;const rt=Le[Le.length-1];return Xe.x===rt.x&&Xe.y===rt.y};for(const{polygon:Le,bounds:Xe}of be){let rt=0,nt=0;for(const lt of Le)z&&!lt[0].equals(lt[lt.length-1])&<.push(lt[0]),nt+=z?lt.length-1:lt.length;const ut=this.segments.prepareSegment((z?5:4)*nt,this.layoutVertexArray,this.indexArray);q.footprintSegIdx<0&&(q.footprintSegIdx=this.footprintSegments.length),q.polygonSegIdx<0&&(q.polygonSegIdx=this.polygonSegments.length);const ht={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},at=new DP;if(at.vertexOffset=this.footprintVertices.length,at.indexOffset=3*this.footprintIndices.length,at.ringIndices=[],z){const lt=[],Ze=[];rt=ut.vertexLength;for(let ct=0;ct<Le.length;ct++){const St=Le[ct];St.length&&ct!==0&&Ze.push(lt.length/2);const _t=[];let Yt,Lt;Yt=St[1].sub(St[0])._perp()._unit(),at.ringIndices.push(St.length-1);for(let Nt=1;Nt<St.length;Nt++){const Ht=St[Nt],Rr=St[Nt===St.length-1?1:Nt+1],yt=Ht.clone();if(ke){Lt=Rr.sub(Ht)._perp()._unit();const Wt=Yt.add(Lt)._unit(),gr=ke*Math.min(4,1/(Yt.x*Wt.x+Yt.y*Wt.y));yt.x+=gr*Wt.x,yt.y+=gr*Wt.y,yt.x=Math.round(yt.x),yt.y=Math.round(yt.y),Yt=Lt}if(!W||ke!==0&&!Pe||We(_t,yt)||_t.push(yt),by(this.layoutVertexArray,yt.x,yt.y,0,0,1,1,0),this.wallMode){const Wt=ue(Nt,St);Sy(this.wallVertexArray,ie.joinNormals[Nt],!Wt)}ut.vertexLength++,this.footprintVertices.emplaceBack(Ht.x,Ht.y),lt.push(Ht.x,Ht.y),L&&Ty(this.layoutVertexExtArray,R.projectTilePoint(yt.x,yt.y,m),R.upVector(m,yt.x,yt.y))}W&&(ke===0||Pe)&&(_t.length!==0&&We(_t,_t[0])&&_t.pop(),this.groundEffect.addData(_t,Xe,C))}const qe=this.wallMode?ie.indices:fm(lt,Ze);for(let ct=0;ct<qe.length;ct+=3)this.footprintIndices.emplaceBack(at.vertexOffset+qe[ct+0],at.vertexOffset+qe[ct+1],at.vertexOffset+qe[ct+2]),this.indexArray.emplaceBack(rt+qe[ct],rt+qe[ct+2],rt+qe[ct+1]),ut.primitiveLength++;at.indexCount+=qe.length,at.vertexCount+=this.footprintVertices.length-at.vertexOffset}for(let lt=0;lt<Le.length;lt++){const Ze=Le[lt];U.startRing(q,Ze[0]);let qe=Ze.length>4&&jP(Ze[Ze.length-2],Ze[0],Ze[1]),ct=ke?l6(Ze[Ze.length-2],Ze[0],Ze[1],ke):0;const St=[];let _t,Yt,Lt;Yt=Ze[1].sub(Ze[0])._perp()._unit();let Nt=!0;for(let Ht=1,Rr=0;Ht<Ze.length;Ht++){let yt=Ze[Ht-1],Wt=Ze[Ht];const gr=Ze[Ht===Ze.length-1?1:Ht+1];if(U.appendEdge(q,Wt,yt),gT(Wt,yt,Xe)){ke&&(Yt=gr.sub(Wt)._perp()._unit(),Nt=!Nt);continue}const $r=Wt.sub(yt)._perp(),qr=$r.x/(Math.abs($r.x)+Math.abs($r.y)),Sr=$r.y>0?1:0,Cn=yt.dist(Wt);if(Rr+Cn>32768&&(Rr=0),ke){Lt=gr.sub(Wt)._perp()._unit();let dt=BP(yt,Wt,gr,FP(Yt,Lt),ke);isNaN(dt)&&(dt=0);const Mt=Wt.sub(yt)._unit();yt=yt.add(Mt.mult(ct))._round(),Wt=Wt.add(Mt.mult(-dt))._round(),ct=dt,Yt=Lt,W&&this.zoom>=17&&(We(St,yt)||St.push(yt),We(St,Wt)||St.push(Wt))}const ge=ut.vertexLength,xe=Ze.length>4&&jP(yt,Wt,gr);let Ye=VP(Rr,qe,Nt);if(by(this.layoutVertexArray,yt.x,yt.y,qr,Sr,0,0,Ye),by(this.layoutVertexArray,yt.x,yt.y,qr,Sr,0,1,Ye),this.wallMode){const dt=ue(Ht-1,Ze),Mt=ie.joinNormals[Ht-1];Sy(this.wallVertexArray,Mt,dt),Sy(this.wallVertexArray,Mt,dt)}if(Rr+=Cn,Ye=VP(Rr,xe,!Nt),qe=xe,by(this.layoutVertexArray,Wt.x,Wt.y,qr,Sr,0,0,Ye),by(this.layoutVertexArray,Wt.x,Wt.y,qr,Sr,0,1,Ye),this.wallMode){const dt=ue(Ht,Ze),Mt=ie.joinNormals[Ht];Sy(this.wallVertexArray,Mt,dt),Sy(this.wallVertexArray,Mt,dt)}if(ut.vertexLength+=4,this.indexArray.emplaceBack(ge+0,ge+1,ge+2),this.indexArray.emplaceBack(ge+1,ge+3,ge+2),ut.primitiveLength+=2,ke){const dt=rt+(Ht===1?Ze.length-2:Ht-2),Mt=Ht===1?rt:dt+1;if(this.indexArray.emplaceBack(ge+1,dt,ge+3),this.indexArray.emplaceBack(dt,Mt,ge+3),ut.primitiveLength+=2,_t===void 0&&(_t=ge),!gT(gr,Ze[Ht],Xe)){const Rt=Ht===Ze.length-1?_t:ut.vertexLength;this.indexArray.emplaceBack(ge+2,ge+3,Rt),this.indexArray.emplaceBack(ge+3,Rt+1,Rt),this.indexArray.emplaceBack(ge+3,Mt,Rt+1),ut.primitiveLength+=3}Nt=!Nt}if(L){const dt=this.layoutVertexExtArray,Mt=R.projectTilePoint(yt.x,yt.y,m),Rt=R.projectTilePoint(Wt.x,Wt.y,m),Jt=R.upVector(m,yt.x,yt.y),er=R.upVector(m,Wt.x,Wt.y);Ty(dt,Mt,Jt),Ty(dt,Mt,Jt),Ty(dt,Rt,er),Ty(dt,Rt,er)}}z&&(rt+=Ze.length-1),W&&ke&&this.zoom>=17&&(St.length!==0&&We(St,St[0])&&St.pop(),this.groundEffect.addData(St,Xe,C,ke>0))}this.footprintSegments.push(at),ht.triangleCount=this.indexArray.length-ht.triangleArrayOffset,this.polygonSegments.push(ht),++q.footprintSegLen,++q.polygonSegLen}if(q.vertexCount=this.layoutVertexArray.length-q.vertexArrayOffset,q.groundVertexCount=this.groundEffect.vertexArray.length-q.groundVertexArrayOffset,q.vertexCount!==0){if(q.centroidXY=U.borders?PP:this.encodeCentroid(U,q),this.centroidData.push(q),U.borders){this.featuresOnBorder.push(U);const Le=this.featuresOnBorder.length-1;for(let Xe=0;Xe<U.borders.length;Xe++)U.borders[Xe][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Xe].push(Le)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,d,g,v,m,E,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,d,g,v,m,E,this.worldview),this.maxHeight=Math.max(this.maxHeight,re)}}sortBorders(){for(let r=0;r<this.borderFeatureIndices.length;r++)this.borderFeatureIndices[r].sort((i,c)=>this.featuresOnBorder[i].borders[r][0]-this.featuresOnBorder[c].borders[r][0])}splitToSubtiles(){const r=[];for(let v=0;v<this.centroidData.length;v++){const S=this.centroidData[v],E=+(S.min.y+S.max.y>bt),C=2*E+(+(S.min.x+S.max.x>bt)^E);for(let I=0;I<S.polygonSegLen;I++){const R=S.polygonSegIdx+I;r.push({centroidIdx:v,subtile:C,polygonSegmentIdx:R,triangleSegmentIdx:this.polygonSegments[R].triangleSegIdx})}}const i=new Ni;r.sort((v,S)=>v.triangleSegmentIdx===S.triangleSegmentIdx?v.subtile-S.subtile:v.triangleSegmentIdx-S.triangleSegmentIdx);let c=0,d=0,m=0;for(const v of r){if(v.triangleSegmentIdx!==c)break;m++}const g=r.length;for(;d!==r.length;){c=r[d].triangleSegmentIdx;let v=0,S=d,E=d;for(let C=S;C<m&&r[C].subtile===v;C++)E++;for(;S!==m;){const C=r[S];v=C.subtile;const I=this.centroidData[C.centroidIdx].min.clone(),R=this.centroidData[C.centroidIdx].max.clone(),L={vertexOffset:this.segments.segments[c].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[c].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let z=S;z<E;z++){const U=r[z],q=this.polygonSegments[U.polygonSegmentIdx],W=this.centroidData[U.centroidIdx].min,re=this.centroidData[U.centroidIdx].max,ie=this.indexArray.uint16;for(let ue=q.triangleArrayOffset;ue<q.triangleArrayOffset+q.triangleCount;ue++)i.emplaceBack(ie[3*ue],ie[3*ue+1],ie[3*ue+2]);L.primitiveLength+=q.triangleCount,I.x=Math.min(I.x,W.x),I.y=Math.min(I.y,W.y),R.x=Math.max(R.x,re.x),R.y=Math.max(R.y,re.y)}L.primitiveLength>0&&this.triangleSubSegments.push({segment:L,min:I,max:R}),S=E;for(let z=S;z<m&&r[z].subtile===r[S].subtile;z++)E++}d=m;for(let C=d;C<g&&r[C].triangleSegmentIdx===r[d].triangleSegmentIdx;C++)m++}i._trim(),this.indexArray=i}getVisibleSegments(r,i,c){const d=new ri;if(this.wallMode){for(const U of this.triangleSubSegments)d.segments.push(U.segment);return d}let m=0,g=0;const v=1<<r.canonical.z;if(i){const U=i.getMinMaxForTile(r);U&&(m=U.min,g=U.max)}g+=this.maxHeight;const S=r.toUnwrapped();let E;const C=[S.canonical.x/v+S.wrap,S.canonical.y/v],I=[(S.canonical.x+1)/v+S.wrap,(S.canonical.y+1)/v],R=(U,q,W)=>[U[0]*(1-W[0])+q[0]*W[0],U[1]*(1-W[1])+q[1]*W[1]],L=[],z=[];for(const U of this.triangleSubSegments){L[0]=U.min.x/bt,L[1]=U.min.y/bt,z[0]=U.max.x/bt,z[1]=U.max.y/bt;const q=R(C,I,L),W=R(C,I,z);if(new Zt([q[0],q[1],m],[W[0],W[1],g]).intersectsPrecise(c)===0){E&&(d.segments.push(E),E=void 0);continue}const re=U.segment;E&&E.vertexOffset!==re.vertexOffset&&(d.segments.push(E),E=void 0),E?(E.vertexLength+=re.vertexLength,E.primitiveLength+=re.primitiveLength):E={vertexOffset:re.vertexOffset,primitiveLength:re.primitiveLength,vertexLength:re.vertexLength,primitiveOffset:re.primitiveOffset,sortKey:void 0,vaos:{}}}return E&&d.segments.push(E),d}encodeCentroid(r,i){const c=r.centroid(),d=i.span(),m=Math.min(7,Math.round(d.x*this.tileToMeter/10)),g=Math.min(7,Math.round(d.y*this.tileToMeter/10));return new it(K(c.x,1,bt-1)<<3|m,K(c.y,1,bt-1)<<3|g)}encodeBorderCentroid(r){if(!r.borders)return new it(0,0);const i=r.borders,c=Number.MAX_VALUE;if(i[0][0]!==c||i[1][0]!==c){const d=i[0][0]!==c?0:1;return new it(6|(i[0][0]!==c?0:65528),(i[d][0]+i[d][1])/2<<3|6)}{const d=i[2][0]!==c?2:3;return new it((i[d][0]+i[d][1])/2<<3|6,6|(i[2][0]!==c?0:65528))}}showCentroid(r){const i=this.centroidData[r.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(r){this.groundEffect.updateHiddenByLandmark(r);const i=r.vertexArrayOffset,c=r.vertexCount+r.vertexArrayOffset,d=r.flags&wu?PP:r.centroidXY,m=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==d.y||m!==d.x){for(let g=i;g<c;++g)this.centroidVertexArray.emplace(g,d.x,d.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const r of this.centroidData)this.writeCentroidToBuffer(r)}updateReplacement(r,i,c){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const d=i.getReplacementRegionsForTile(r.toUnwrapped());if(Yx(this.activeReplacements,d))return;if(this.activeReplacements=d,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const g of this.centroidData)g.flags&=2147483647;const m=[];for(const g of this.activeReplacements){if(g.order<c)continue;const v=Math.max(1,Math.pow(2,g.footprintTileId.canonical.z-r.canonical.z));if(g.footprint.buildingIds)for(const S of this.centroidData)S.flags&wu||g.min.x>S.max.x||S.min.x>g.max.x||g.min.y>S.max.y||S.min.y>g.max.y||g.footprint.buildingIds.has(S.buildingId)&&(S.flags|=wu);else for(const S of this.centroidData)if(!(S.flags&wu||g.min.x>S.max.x||S.min.x>g.max.x||g.min.y>S.max.y||S.min.y>g.max.y))for(let E=0;E<S.footprintSegLen;E++){const C=this.footprintSegments[S.footprintSegIdx+E];if(m.length=0,c6(this.footprintVertices,C.vertexOffset,C.vertexCount,g.footprintTileId.canonical,r.canonical,m),hT(g.footprint,m,this.footprintIndices.uint16,C.indexOffset,C.indexCount,-C.vertexOffset,-v)){S.flags|=wu;break}}}for(const g of this.centroidData)this.writeCentroidToBuffer(g);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(r,i,c){let d=!1;for(let m=0;m<c.footprintSegLen;m++){const g=this.footprintSegments[c.footprintSegIdx+m];let v=0;for(const S of g.ringIndices){for(let E=v,C=S+v-1;E<S+v;C=E++){const I=this.footprintVertices.int16[2*(E+g.vertexOffset)+0],R=this.footprintVertices.int16[2*(E+g.vertexOffset)+1],L=this.footprintVertices.int16[2*(C+g.vertexOffset)+1];R>i!=L>i&&r<(this.footprintVertices.int16[2*(C+g.vertexOffset)+0]-I)*(i-R)/(L-R)+I&&(d=!d)}v=S}}return d}getHeightAtTileCoord(r,i){let c=Number.NEGATIVE_INFINITY,d=!0;const m=4*(r+bt)*bt+(i+bt);if(this.partLookup.hasOwnProperty(m)){const g=this.partLookup[m];return g?{height:g.height,hidden:!!(g.flags&wu)}:void 0}for(const g of this.centroidData)r>g.max.x||g.min.x>r||i>g.max.y||g.min.y>i||g.height<=c||this.footprintContainsPoint(r,i,g)&&(c=g.height,this.partLookup[m]=g,d=!!(g.flags&wu));if(c!==Number.NEGATIVE_INFINITY)return{height:c,hidden:d};this.partLookup[m]=void 0}}function FP(a,r){const i=a.add(r)._unit();return a.x*i.x+a.y*i.y}function l6(a,r,i,c){const d=r.sub(a)._perp()._unit(),m=i.sub(r)._perp()._unit();return BP(a,r,i,FP(d,m),c)}function BP(a,r,i,c,d){const m=Math.sqrt(1-c*c);return Math.min(a.dist(r)/3,r.dist(i)/3,d*m/c)}function gT(a,r,i){return a.x<i[0].x&&r.x<i[0].x||a.x>i[1].x&&r.x>i[1].x||a.y<i[0].y&&r.y<i[0].y||a.y>i[1].y&&r.y>i[1].y}function NP(a,r){return a.x<r[0].x||a.x>r[1].x||a.y<r[0].y||a.y>r[1].y}function jP(a,r,i){if(a.x<0||a.x>=bt||r.x<0||r.x>=bt||i.x<0||i.x>=bt)return!1;const c=i.sub(r),d=c.perp(),m=a.sub(r);return(c.x*m.x+c.y*m.y)/Math.sqrt((c.x*c.x+c.y*c.y)*(m.x*m.x+m.y*m.y))>-.866&&d.x*m.x+d.y*m.y<0}function VP(a,r,i){const c=r?2|a:-3&a;return i?1|c:-2&c}function UP(){const a=Math.PI/32,r=Math.tan(a),i=f;return i*Math.sqrt(1+2*r*r)-i}function $P(a,r,i){const c=1<<i.z,d=D(i.x/c),m=D((i.x+1)/c),g=N(i.y/c),v=N((i.y+1)/c);return function(S,E,C,I,R=0,L){const z=[];if(!S.length||!C||!I)return z;const U=(me,be)=>{for(const ke of me)z.push({polygon:ke,bounds:be})},q=Math.ceil(Math.log2(C)),W=Math.ceil(Math.log2(I)),re=q-W,ie=[];for(let me=0;me<Math.abs(re);me++)ie.push(re>0?0:1);for(let me=0;me<Math.min(q,W);me++)ie.push(0),ie.push(1);let ue=S;if(ue=Kx(ue,E[0].y-R,E[1].y+R,1),ue=Kx(ue,E[0].x-R,E[1].x+R,0),!ue.length)return z;const ve=[];for(ie.length?ve.push({polygons:ue,bounds:E,depth:0}):U(ue,E);ve.length;){const me=ve.pop(),be=me.depth,ke=ie[be],Pe=me.bounds[0],We=me.bounds[1],Le=ke===0?Pe.x:Pe.y,Xe=ke===0?We.x:We.y,rt=L?L(ke,Le,Xe):.5*(Le+Xe),nt=Kx(me.polygons,Le-R,rt+R,ke),ut=Kx(me.polygons,rt-R,Xe+R,ke);if(nt.length){const ht=[Pe,new it(ke===0?rt:We.x,ke===1?rt:We.y)];ie.length>be+1?ve.push({polygons:nt,bounds:ht,depth:be+1}):U(nt,ht)}if(ut.length){const ht=[new it(ke===0?rt:Pe.x,ke===1?rt:Pe.y),We];ie.length>be+1?ve.push({polygons:ut,bounds:ht,depth:be+1}):U(ut,ht)}}return z}(a,r,Math.ceil((m-d)/11.25),Math.ceil((g-v)/11.25),1,(S,E,C)=>{if(S===0)return .5*(E+C);{const I=N((i.y+E/bt)/c);return(A(.5*(N((i.y+C/bt)/c)+I))*c-i.y)*bt}})}function c6(a,r,i,c,d,m){const g=Math.pow(2,c.z-d.z);for(let v=0;v<i;v++){let S=a.int16[2*(v+r)+0],E=a.int16[2*(v+r)+1];S=(S+d.x*bt)*g-c.x*bt,E=(E+d.y*bt)*g-c.y*bt,m.push(new it(S,E))}}let GP,HP;Ut(Qx,"FillExtrusionBucket",{omit:["layers","features"]}),Ut(LP,"PartData"),Ut(DP,"FootprintSegment"),Ut(OP,"BorderCentroidData"),Ut(mT,"GroundEffect");class ef extends it{constructor(r,i,c){super(r,i),this.z=c}}class WP extends ef{constructor(r,i,c,d){super(r,i,c),this.w=d}}function qP(a,r,i,c){const d=i==="x"?"y":"x",m=(c-a[i])/(r[i]-a[i]);a[d]=Math.round(a[d]+(r[d]-a[d])*m),a[i]=c,a.hasOwnProperty("z")&&(a.z=ur(a.z,r.z,m)),a.hasOwnProperty("w")&&(a.w=ur(a.w,r.w,m))}function KP(a,r,i,c){const d=i,m=c;for(const g of["x","y"]){let v=a,S=r;v[g]>=S[g]&&(v=r,S=a),v[g]<d&&S[g]>d&&qP(v,S,g,d),v[g]<m&&S[g]>m&&qP(S,v,g,m)}}function ew(a,r,i,c,d,m){const g=[];for(let v=0;v<a.length;v++){const S=a[v];let E;const C=g.length;let I=0;for(let R=0;R<S.length-1;R++){let L=S[R],z=S[R+1],U=0;const q=I;let W,re;m&&(U=Math.hypot(z.x-L.x,z.y-L.y),I+=U,W=L,re=z),L.x<r&&z.x<r||(L.x<r?L=new it(r,L.y+(r-L.x)/(z.x-L.x)*(z.y-L.y))._round():z.x<r&&(z=new it(r,L.y+(r-L.x)/(z.x-L.x)*(z.y-L.y))._round()),L.y<i&&z.y<i||(L.y<i?L=new it(L.x+(i-L.y)/(z.y-L.y)*(z.x-L.x),i)._round():z.y<i&&(z=new it(L.x+(i-L.y)/(z.y-L.y)*(z.x-L.x),i)._round()),L.x>=c&&z.x>=c||(L.x>=c?L=new it(c,L.y+(c-L.x)/(z.x-L.x)*(z.y-L.y))._round():z.x>=c&&(z=new it(c,L.y+(c-L.x)/(z.x-L.x)*(z.y-L.y))._round()),L.y>=d&&z.y>=d||(L.y>=d?L=new it(L.x+(d-L.y)/(z.y-L.y)*(z.x-L.x),d)._round():z.y>=d&&(z=new it(L.x+(d-L.y)/(z.y-L.y)*(z.x-L.x),d)._round()),E&&L.equals(E[E.length-1])||(E=[L],g.push(E),m&&m.push({progress:{min:q+ZP(W,re,L)*U,max:1},parentIndex:v,prevPoint:W,nextPoint:re})),E.push(z),m&&(m[m.length-1].progress.max=q+ZP(W,re,z)*U,m[m.length-1].nextPoint=re)))))}if(m&&I>0)for(let R=C;R<g.length;R++)m[R].progress.min/=I,m[R].progress.max/=I}return g}function u6(a,r,i,c,d){if(a.length<2)return void c.push(a);const m=[];for(;r.valid();){const[E,C]=r.get();for(let I=0;I<a.length-1;I++){const R=a[I],L=a[I+1],z=Cr(R,L,E,C);if(z){const[U]=z,q=new it(ur(R.x,L.x,U),ur(R.y,L.y,U));m.push({t:I+U,distance:0,point:q})}}r.next()}if(m.length===0)return void c.push(a);m.sort((E,C)=>E.t-C.t);let g=0,v=0,S=[];for(c.push(S);g!==a.length;){if(v===m.length){for(;g!==a.length;)S.length!==0&&S[S.length-1].equals(a[g])||S.push(a[g]),g++;break}m[v].t<=g?(S.length!==0&&S[S.length-1].equals(m[v].point)||S.push(m[v].point),Math.trunc(m[v].t),v++):(S.length!==0&&S[S.length-1].equals(a[g])||S.push(a[g]),g++)}}function ZP(a,r,i){return a.x!==r.x?(i.x-a.x)/(r.x-a.x):a.y!==r.y?(i.y-a.y)/(r.y-a.y):0}function Ey(a,r){return a.x*r.x+a.y*r.y}function XP(a,r){if(a.length===1){let i=0;const c=r[i++];let d;for(;!d||c.equals(d);)if(d=r[i++],!d)return 1/0;for(;i<r.length;i++){const m=r[i],g=a[0],v=d.sub(c),S=m.sub(c),E=g.sub(c),C=Ey(v,v),I=Ey(v,S),R=Ey(S,S),L=Ey(E,v),z=Ey(E,S),U=C*R-I*I,q=(R*L-I*z)/U,W=(C*z-I*L)/U,re=c.z*(1-q-W)+d.z*q+m.z*W;if(isFinite(re))return re}return 1/0}{let i=1/0;for(const c of r)i=Math.min(i,c.z);return i}}function YP(a,r,i){let c=1/0;fn(i,r)&&(c=XP(i,r[0]));for(let d=0;d<r.length;d++){const m=r[d],g=a[d];for(let v=0;v<m.length-1;v++){const S=m[v],E=[S,m[v+1],g[v+1],g[v],S];sn(i,E)&&(c=Math.min(c,XP(i,E)))}}return c!==1/0&&c}function JP(a,r,i,c,d,m,g,v,S,E,C){return a.projection.name==="globe"?function(I,R,L,z,U,q,W,re,ie,ue,ve){const me=[],be=[],ke=I.projection.upVectorScale(ve,I.center.lat,I.worldSize).metersToTile,Pe=[0,0,0,1],We=[0,0,0,1],Le=(rt,nt,ut,ht)=>{rt[0]=nt,rt[1]=ut,rt[2]=ht,rt[3]=1},Xe=UP();L>0&&(L+=Xe),z+=Xe;for(const rt of R){const nt=[],ut=[];for(const ht of rt){const at=ht.x+U.x,lt=ht.y+U.y,Ze=I.projection.projectTilePoint(at,lt,ve),qe=I.projection.upVector(ve,ht.x,ht.y);let ct=L,St=z;if(W){const _t=QP(at,lt,L,z,W,re,ie,ue);ct+=_t.base,St+=_t.top}L!==0?Le(Pe,Ze.x+qe[0]*ke*ct,Ze.y+qe[1]*ke*ct,Ze.z+qe[2]*ke*ct):Le(Pe,Ze.x,Ze.y,Ze.z),Le(We,Ze.x+qe[0]*ke*St,Ze.y+qe[1]*ke*St,Ze.z+qe[2]*ke*St),Un(Pe,Pe,q),Un(We,We,q),nt.push(new ef(Pe[0],Pe[1],Pe[2])),ut.push(new ef(We[0],We[1],We[2]))}me.push(nt),be.push(ut)}return[me,be]}(a,r,i,c,d,m,g,v,S,E,C):g?function(I,R,L,z,U,q,W,re,ie){const ue=[],ve=[],me=[0,0,0,1];for(const be of I){const ke=[],Pe=[];for(const We of be){const Le=We.x+z.x,Xe=We.y+z.y,rt=QP(Le,Xe,R,L,q,W,re,ie);me[0]=Le,me[1]=Xe,me[2]=rt.base,me[3]=1,rs(me,me,U),me[3]=Math.max(me[3],1e-5);const nt=new ef(me[0]/me[3],me[1]/me[3],me[2]/me[3]);me[0]=Le,me[1]=Xe,me[2]=rt.top,me[3]=1,rs(me,me,U),me[3]=Math.max(me[3],1e-5);const ut=new ef(me[0]/me[3],me[1]/me[3],me[2]/me[3]);ke.push(nt),Pe.push(ut)}ue.push(ke),ve.push(Pe)}return[ue,ve]}(r,i,c,d,m,g,v,S,E):function(I,R,L,z,U){const q=[],W=[],re=U[8]*R,ie=U[9]*R,ue=U[10]*R,ve=U[11]*R,me=U[8]*L,be=U[9]*L,ke=U[10]*L,Pe=U[11]*L;for(const We of I){const Le=[],Xe=[];for(const rt of We){const nt=rt.x+z.x,ut=rt.y+z.y,ht=U[0]*nt+U[4]*ut+U[12],at=U[1]*nt+U[5]*ut+U[13],lt=U[2]*nt+U[6]*ut+U[14],Ze=U[3]*nt+U[7]*ut+U[15],qe=ht+re,ct=at+ie,St=lt+ue,_t=Math.max(Ze+ve,1e-5),Yt=ht+me,Lt=at+be,Nt=lt+ke,Ht=Math.max(Ze+Pe,1e-5);Le.push(new ef(qe/_t,ct/_t,St/_t)),Xe.push(new ef(Yt/Ht,Lt/Ht,Nt/Ht))}q.push(Le),W.push(Xe)}return[q,W]}(r,i,c,d,m)}function QP(a,r,i,c,d,m,g,v){const S=g*d.getElevationAt(a,r,!0,!0),E=m[0]!==0,C=E?m[1]===0?g*(m[0]/MP-RP):g*function(I,R,L){const z=Math.floor(R[0]/8),U=Math.floor(R[1]/8),q=10*(R[0]-8*z),W=10*(R[1]-8*U),re=I.getElevationAt(z,U,!0,!0),ie=I.getMeterToDEM(L),ue=Math.floor(.5*(q*ie-1)),ve=Math.floor(.5*(W*ie-1)),me=I.tileCoordToPixel(z,U),be=2*ue+1,ke=2*ve+1,Pe=function(ut,ht,at,lt,Ze){return[ut.getElevationAtPixel(ht,at,!0),ut.getElevationAtPixel(ht+Ze,at,!0),ut.getElevationAtPixel(ht,at+Ze,!0),ut.getElevationAtPixel(ht+lt,at+Ze,!0)]}(I,me.x-ue,me.y-ve,be,ke),We=Math.abs(Pe[0]-Pe[1]),Le=Math.abs(Pe[2]-Pe[3]),Xe=Math.abs(Pe[0]-Pe[2])+Math.abs(Pe[1]-Pe[3]),rt=Math.min(.25,.5*ie*(We+Le)/be),nt=Math.min(.25,.5*ie*Xe/ke);return re+Math.max(rt*q,nt*W)}(d,m,v):S;return{base:S+(i===0?-1:i),top:E?Math.max(C+c,S+i+2):S+c}}class d6{constructor(r){this._callback=r,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class h6{constructor(){this.tasks={},this.taskQueue=[],Oe(["process"],this),this.invoker=new d6(this.process),this.nextId=0}add(r,i){const c=this.nextId++,d=function({type:m,isSymbolTile:g,zoom:v}){return v=v||0,m==="message"?0:m!=="maybePrepare"||g?m!=="parseTile"||g?m==="parseTile"&&g?300-v:m==="maybePrepare"&&g?400-v:500:200-v:100-v}(i);if(d===0){try{r()}finally{}return null}return this.tasks[c]={fn:r,metadata:i,priority:d,id:c},this.taskQueue.push(c),this.invoker.trigger(),{cancel:()=>{delete this.tasks[c]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(c=>!!this.tasks[c]),!this.taskQueue.length)return;const r=this.pick();if(r===null)return;const i=this.tasks[r];if(delete this.tasks[r],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let r=null,i=1/0;for(let d=0;d<this.taskQueue.length;d++){const m=this.tasks[this.taskQueue[d]];m.priority<i&&(i=m.priority,r=d)}if(r===null)return null;const c=this.taskQueue[r];return this.taskQueue.splice(r,1),c}remove(){this.invoker.remove()}}class eM{constructor(r,i,c){this.target=r,this.parent=i,this.mapId=c,this.callbacks={},this.cancelCallbacks={},Oe(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new h6}send(r,i,c,d,m=!1,g){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);c&&(c.metadata=g,this.callbacks[v]=c);const S=new Set;return this.target.postMessage({id:v,type:r,hasCallback:!!c,targetMapId:d,mustQueue:m,sourceMapId:this.mapId,data:Pl(i,S)},S),{cancel:()=>{c&&delete this.callbacks[v],this.target.postMessage({id:v,type:"<cancel>",targetMapId:d,sourceMapId:this.mapId})}}}receive(r){const i=r.data;if(!i)return;const c=i.id;if(c&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const d=this.cancelCallbacks[c];delete this.cancelCallbacks[c],d&&d.cancel()}else if(i.mustQueue||Yr(self)){const d=this.callbacks[c],m=this.scheduler.add(()=>this.processTask(c,i),d&&d.metadata||{type:"message"});m&&(this.cancelCallbacks[c]=m)}else this.processTask(c,i)}processTask(r,i){if(delete this.cancelCallbacks[r],i.type==="<response>"){const c=this.callbacks[r];delete this.callbacks[r],c&&(i.error?c(Ac(i.error)):c(null,Ac(i.data)))}else{const c=new Set,d=i.hasCallback?(g,v)=>{this.target.postMessage({id:r,type:"<response>",sourceMapId:this.mapId,error:g?Pl(g):null,data:Pl(v,c)},c)}:()=>{},m=Ac(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,m,d);else if(this.parent.getWorkerSource){const g=i.type.split("."),{source:v,scope:S}=m;this.parent.getWorkerSource(i.sourceMapId,g[0],v,S)[g[1]](m,d)}else d(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var ky={workerUrl:"",workerClass:null,workerParams:void 0};const _T="mapboxgl_preloaded_worker_pool";class tf{constructor(r){this.active={},this.name=r}acquire(r,i=tf.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;){const d=(c=`${this.name||""}WorkerPool: ${r}-${this.workers.length}`,ky.workerClass!=null?new ky.workerClass:new self.Worker(ky.workerUrl,Object.assign({name:c},ky.workerParams)));this.workers.push(d)}var c;return this.active[r]=!0,this.workers.slice()}release(r){delete this.active[r],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[_T]}numActive(){return Object.keys(this.active).length}}tf.workerCount=2;class mm{constructor(r,i,c="Worker",d=tf.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=Re();const m=this.workerPool.acquire(this.id,d);for(let g=0;g<m.length;g++){const v=new mm.Actor(m[g],i,this.id);v.name=`${c} ${g}`,this.actors.push(v)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,i,c){Ae(this.actors,(d,m)=>{d.send(r,i,m)},c=c||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)}}let Ay,yT;function tw(){return Ay||(Ay=new tf),Ay}mm.Actor=eM;const vT=4096;class f6{constructor(r){this.module=r,this.memoryStack=this.module.malloc(vT),this.memoryStackNextFree=this.memoryStack}createIntArray(r){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=r.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>vT?-1:(new Int32Array(this.module.heap32.buffer,i,r.length).set(r),i)}createFloatArray(r){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=r.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>vT?-1:(new Float32Array(this.module.heapF32.buffer,i,r.length).set(r),i)}readStringBuffer(r){let i="";for(;this.module.heapU8[r]!==0;)i+=String.fromCharCode(this.module.heapU8[r]),++r;return i}setStyle(r){const i=r.normalScale;this.module.setStyle(i[0],i[1],i[2],r.tileToMeters)}setAOOptions(r,i){this.module.setAOOptions(r?1:0,i)}setMetricOptions(r,i){this.module.setMetricOptions(r?1:0,i)}setStructuralOptions(r){this.module.setStructuralOptions(r?1:0)}setFacadeOptions(r,i){this.module.setFacadeOptions(r,i?1:0)}setFauxFacadeOptions(r,i,c){this.module.setFauxFacadeOptions(r?1:0,i?1:0,c)}setFacadeClassifierOptions(r){this.module.setFacadeClassifierOptions(r)}generateMesh(r,i){this.memoryStackNextFree=this.memoryStack;for(const v of r){const S=this.createIntArray(v.ringIndices),E=this.createFloatArray(v.coordinates);if(S===-1||E===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(v.id,v.sourceId,v.minHeight,v.height,v.roofType,E,S,v.ringIndices.length-1)}for(const v of i){let S;S=v.entrances?JSON.parse(v.entrances):[];const E=this.createFloatArray(S),C=this.createFloatArray(v.coordinates);if(E===-1||C===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(v.sourceId,v.crossPerc,v.distanceToRoad,E,S.length,C,v.coordinates.length)}if(!this.module.generateMesh()){const v=this.module.getLastError();return this.readStringBuffer(v)}const c=this.module.getMeshCount(),d=new Array(c);for(let v=0;v<c;v++){const S=this.module.getPositionsPtr(v),E=this.module.getPositionsLength(v),C=new Float32Array(this.module.heapF32.buffer,S,E),I=this.module.getNormalsPtr(v),R=this.module.getNormalsLength(v),L=new Float32Array(this.module.heapF32.buffer,I,R),z=this.module.getAOPtr(v),U=this.module.getAOLength(v),q=new Float32Array(this.module.heapF32.buffer,z,U),W=this.module.getUVPtr(v),re=this.module.getUVLength(v),ie=new Float32Array(this.module.heapF32.buffer,W,re),ue=this.module.getFauxFacadePtr(v),ve=this.module.getFauxFacadeLength(v),me=new Uint8Array(this.module.heapU8.buffer,ue,ve),be=this.module.getIndicesPtr(v),ke=this.module.getIndicesLength(v),Pe=new Int16Array(this.module.heap16.buffer,be,ke),We=this.module.getBuildingPart(v);d[v]={positions:C,normals:L,ao:q,uv:ie,isFauxFacade:me,indices:Pe,buildingPart:We}}const m=this.module.getRingCount(),g=[];for(let v=0;v<m;v++){const S=this.module.getRingPtr(v),E=this.module.getRingLength(v),C=new Float32Array(this.module.heapF32.buffer,S,E);g.push(C)}return{meshes:d,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:g}}}let Cy,xT,Ul,gm,wT,_m=null,ym=null,tM=null,rw=null;function rM(){return Yr(self)&&self.worker.dracoUrl?self.worker.dracoUrl:xT||Vr.DRACO_URL}function nM(){if(Yr(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(gm)return gm;const a=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return gm=WebAssembly.validate(a)?Vr.MESHOPT_SIMD_URL:Vr.MESHOPT_URL,gm}function p6(){return rw}const nw={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},m6={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Iy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function iM(a,r,i){const c=i.json.bufferViews.length,d=i.buffers.length;r.bufferView=c,i.json.bufferViews[c]={buffer:d,byteLength:a.byteLength},i.buffers[d]=a}const bT="KHR_draco_mesh_compression";function g6(a,r){const i=a.extensions&&a.extensions[bT];if(!i)return;const c=new Ul.Decoder,d=lM(r,i.bufferView),m=new Ul.Mesh;if(!c.DecodeArrayToMesh(d,d.byteLength,m))throw new Error("Failed to decode Draco mesh");const g=r.json.accessors[a.indices],v=nw[g.componentType],S=g.count*v.BYTES_PER_ELEMENT,E=Ul._malloc(S);v===Uint16Array?c.GetTrianglesUInt16Array(m,S,E):c.GetTrianglesUInt32Array(m,S,E),iM(Ul.memory.buffer.slice(E,E+S),g,r),Ul._free(E);for(const C of Object.keys(i.attributes)){const I=c.GetAttributeByUniqueId(m,i.attributes[C]),R=r.json.accessors[a.attributes[C]],L=m6[R.componentType],z=R.count*Iy[R.type]*nw[R.componentType].BYTES_PER_ELEMENT,U=Ul._malloc(z);c.GetAttributeDataArrayForAllPoints(m,I,Ul[L],z,U),iM(Ul.memory.buffer.slice(U,U+z),R,r),Ul._free(U)}c.destroy(),m.destroy(),delete a.extensions[bT]}const iw="EXT_meshopt_compression";function _6(a,r){if(!a.extensions||!a.extensions[iw])return;const i=a.extensions[iw],c=new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),d=new Uint8Array(i.count*i.byteStride);wT.decodeGltfBuffer(d,i.count,i.byteStride,c,i.mode,i.filter),a.buffer=r.buffers.length,a.byteOffset=0,r.buffers[a.buffer]=d.buffer,delete a.extensions[iw]}const sM=1179937895,oM=new TextDecoder("utf8");function aM(a,r){return new URL(a,r).href}function y6(a,r,i,c){return fetch(aM(a.uri,c)).then(d=>d.arrayBuffer()).then(d=>{r.buffers[i]=d})}function lM(a,r){const i=a.json.bufferViews[r];return new Uint8Array(a.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function v6(a,r,i,c){if(a.uri){const d=aM(a.uri,c);return fetch(d).then(m=>m.blob()).then(m=>createImageBitmap(m)).then(m=>{r.images[i]=m})}if(a.bufferView!==void 0){const d=lM(r,a.bufferView),m=new Blob([d],{type:a.mimeType});return createImageBitmap(m).then(g=>{r.images[i]=g})}}function cM(a,r=0,i){const c={json:null,images:[],buffers:[]};if(new Uint32Array(a,r,1)[0]===sM){const C=new Uint32Array(a,r);let I=2;const R=(C[I++]>>2)-3,L=C[I++]>>2;if(I++,c.json=JSON.parse(oM.decode(C.subarray(I,I+L))),I+=L,I<R){const z=C[I++];I++;const U=r+(I<<2);c.buffers[0]=a.slice(U,U+z)}}else c.json=JSON.parse(oM.decode(new Uint8Array(a,r)));const{buffers:d,images:m,meshes:g,extensionsUsed:v,bufferViews:S}=c.json;let E=Promise.resolve();if(d){const C=[];for(let I=0;I<d.length;I++){const R=d[I];R.uri?C.push(y6(R,c,I,i)):c.buffers[I]||(c.buffers[I]=null)}E=Promise.all(C)}return E.then(()=>{const C=[],I=v&&v.includes(bT),R=v&&v.includes(iw);if(I&&C.push(function(){if(!Ul)return Cy??(Cy=function(L){let z,U=null;function q(){z=new Uint8Array(U.buffer)}function W(){throw new Error("Unexpected Draco error.")}const re={a:{a:W,d:function(ie,ue,ve){return z.copyWithin(ie,ue,ue+ve)},c:function(ie){const ue=z.length,ve=Math.max(ie>>>0,Math.ceil(1.2*ue)),me=Math.ceil((ve-ue)/65536);try{return U.grow(me),q(),!0}catch{return!1}},b:W}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(L,re):L.then(ie=>ie.arrayBuffer()).then(ie=>WebAssembly.instantiate(ie,re))).then(ie=>{const{Rb:ue,Qb:ve,P:me,T:be,X:ke,Ja:Pe,La:We,Qa:Le,Va:Xe,Wa:rt,eb:nt,jb:ut,f:ht,e:at,yb:lt,zb:Ze,Ab:qe,Bb:ct,Db:St,Gb:_t}=ie.instance.exports;U=at;const Yt=(()=>{let Lt=0,Nt=0,Ht=0,Rr=0;return yt=>{Ht&&(ue(Rr),ue(Lt),Nt+=Ht,Ht=Lt=0),Lt||(Nt+=128,Lt=ve(Nt));const Wt=yt.length+7&-8;let gr=Lt;Wt>=Nt&&(Ht=Wt,gr=Rr=ve(Wt));for(let $r=0;$r<yt.length;$r++)z[gr+$r]=yt[$r];return gr}})();return q(),ht(),{memory:at,_free:ue,_malloc:ve,Mesh:class{constructor(){this.ptr=me()}destroy(){be(this.ptr)}},Decoder:class{constructor(){this.ptr=Pe()}destroy(){ut(this.ptr)}DecodeArrayToMesh(Lt,Nt,Ht){const Rr=Yt(Lt),yt=We(this.ptr,Rr,Nt,Ht.ptr);return!!ke(yt)}GetAttributeByUniqueId(Lt,Nt){return{ptr:Le(this.ptr,Lt.ptr,Nt)}}GetTrianglesUInt16Array(Lt,Nt,Ht){Xe(this.ptr,Lt.ptr,Nt,Ht)}GetTrianglesUInt32Array(Lt,Nt,Ht){rt(this.ptr,Lt.ptr,Nt,Ht)}GetAttributeDataArrayForAllPoints(Lt,Nt,Ht,Rr,yt){nt(this.ptr,Lt.ptr,Nt.ptr,Ht,Rr,yt)}},DT_INT8:lt(),DT_UINT8:Ze(),DT_INT16:qe(),DT_UINT16:ct(),DT_UINT32:St(),DT_FLOAT32:_t()}})}(fetch(rM())),Cy.then(L=>{Ul=L,Cy=void 0}))}()),R&&C.push(function(){if(wT)return;const L=function(z){let U;const q=WebAssembly.instantiateStreaming(z,{}).then(ie=>{U=ie.instance,U.exports.__wasm_call_ctors()}),W={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},re={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:q,supported:!0,decodeGltfBuffer(ie,ue,ve,me,be,ke){(function(Pe,We,Le,Xe,rt,nt,ut){const ht=Pe.exports.sbrk,at=Xe+3&-4,lt=ht(at*rt),Ze=ht(nt.length),qe=new Uint8Array(Pe.exports.memory.buffer);qe.set(nt,Ze);const ct=We(lt,Xe,rt,Ze,nt.length);if(ct===0&&ut&&ut(lt,at,rt),Le.set(qe.subarray(lt,lt+Xe*rt)),ht(lt-ht(0)),ct!==0)throw new Error(`Malformed buffer data: ${ct}`)})(U,U.exports[re[be]],ie,ue,ve,me,U.exports[W[ke]])}}}(fetch(nM()));return L.ready.then(()=>{wT=L})}()),m)for(let L=0;L<m.length;L++)C.push(v6(m[L],c,L,i));return(C.length?Promise.all(C):Promise.resolve()).then(()=>{if(I&&g)for(const{primitives:L}of g)for(const z of L)g6(z,c);if(R&&g&&S)for(const L of S)_6(L,c);return c})})}function uM(a){return fetch(a).then(r=>r.arrayBuffer()).then(r=>cM(r,0,a))}function ST(a){switch(a){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function TT(a){switch(a){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class ET{constructor(r,i,c,d){this.context=r,this.format=c,this.useMipmap=d&&d.useMipmap,this.texture=r.gl.createTexture(),this.update(i,{premultiply:d&&d.premultiply})}update(r,i){const c=r&&r instanceof HTMLVideoElement&&r.width===0?r.videoWidth:r.width,d=r&&r instanceof HTMLVideoElement&&r.height===0?r.videoHeight:r.height,{context:m}=this,{gl:g}=m,{x:v,y:S}=i&&i.position?i.position:{x:0,y:0},E=v+c,C=S+d;!this.size||this.size[0]===E&&this.size[1]===C||(g.bindTexture(g.TEXTURE_2D,null),g.deleteTexture(this.texture),this.texture=g.createTexture(),this.size=null),g.bindTexture(g.TEXTURE_2D,this.texture),m.pixelStoreUnpackFlipY.set(!1),m.pixelStoreUnpack.set(1),m.pixelStoreUnpackPremultiplyAlpha.set(this.format===g.RGBA8&&(!i||i.premultiply!==!1));const I=r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||ImageBitmap&&r instanceof ImageBitmap;if(!this.size&&E>0&&C>0){const R=this.useMipmap?Math.floor(Math.log2(Math.max(E,C)))+1:1;g.texStorage2D(g.TEXTURE_2D,R,this.format,E,C),this.size=[E,C]}this.size&&(I?g.texSubImage2D(g.TEXTURE_2D,0,v,S,ST(this.format),TT(this.format),r):"data"in r&&r.data&&g.texSubImage2D(g.TEXTURE_2D,0,v,S,c,d,ST(this.format),TT(this.format),r.data)),this.useMipmap&&g.generateMipmap(g.TEXTURE_2D)}bind(r,i,c=!1){const{context:d}=this,{gl:m}=d;m.bindTexture(m.TEXTURE_2D,this.texture),r!==this.minFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,r),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,this.useMipmap&&!c?r===m.NEAREST?m.NEAREST_MIPMAP_NEAREST:m.LINEAR_MIPMAP_LINEAR:r),this.minFilter=r),i!==this.wrapS&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,i),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(r,i,c,d,m){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),i!==this.magFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,i),this.magFilter=i),r!==this.minFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,this.useMipmap?r===v.NEAREST?v.NEAREST_MIPMAP_NEAREST:v.LINEAR_MIPMAP_LINEAR:r),this.minFilter=r),c!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,c),this.wrapS=c),d!==this.wrapT&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,d),this.wrapT=d),m!==this.compareMode&&(m?(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_COMPARE_MODE,v.COMPARE_REF_TO_TEXTURE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_COMPARE_FUNC,m)):v.texParameteri(v.TEXTURE_2D,v.TEXTURE_COMPARE_MODE,v.NONE),this.compareMode=m)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}class Py{constructor(r,i){this.context=r,this.texture=i}bind(r,i){const{context:c}=this,{gl:d}=c;d.bindTexture(d.TEXTURE_2D,this.texture),r!==this.minFilter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,r),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,r),this.minFilter=r),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)}}const x6=Br([{name:"a_pos_3f",components:3,type:"Float32"}]),w6=Br([{name:"a_color_3f",components:3,type:"Float32"}]),b6=Br([{name:"a_color_4f",components:4,type:"Float32"}]),S6=Br([{name:"a_uv_2f",components:2,type:"Float32"}]),T6=Br([{name:"a_normal_3f",components:3,type:"Float32"}]),E6=Br([{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"}]),k6=Br([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function dM(a,r){const i=sw(a.projection,a.zoom,a.width,a.height),c=function(m,g,v,S,E){const C=new l(v.lng-180*wd,v.lat),I=new l(v.lng+180*wd,v.lat),R=m.project(C.lng,C.lat),L=m.project(I.lng,I.lat),z=-Math.atan2(L.y-R.y,L.x-R.x),U=ae.fromLngLat(v);U.y=K(U.y,-1+wd,1-wd);const q=U.toLngLat(),W=m.project(q.lng,q.lat),re=ae.fromLngLat(q);re.x+=wd;const ie=re.toLngLat(),ue=m.project(ie.lng,ie.lat),ve=fM(ue.x-W.x,ue.y-W.y,z),me=ae.fromLngLat(q);me.y+=wd;const be=me.toLngLat(),ke=m.project(be.lng,be.lat),Pe=fM(ke.x-W.x,ke.y-W.y,z),We=Math.abs(ve.x)/Math.abs(Pe.y),Le=se([]);je(Le,Le,-z*(1-(E?0:S)));const Xe=se([]);return he(Xe,Xe,[1,1-(1-We)*S,1]),Xe[4]=-Pe.x/Pe.y*S,je(Xe,Xe,z),ee(Xe,Le,Xe),Xe}(a.projection,0,a.center,i,r),d=hM(a);return he(c,c,[d,d,1]),c}function hM(a){const r=a.projection,i=sw(a.projection,a.zoom,a.width,a.height),c=kT(r,a.center),d=kT(r,l.convert(r.center));return Math.pow(2,c*i+(1-i)*d)}function sw(a,r,i,c,d=1/0){const m=a.range;if(!m)return 0;const g=Math.min(d,Math.max(i,c)),v=Math.log2(g/1024);return ne(m[0]+v,m[1]+v,r)}const wd=1/4e4;function kT(a,r){const i=K(r.lat,-j,j),c=new l(r.lng-180*wd,i),d=new l(r.lng+180*wd,i),m=a.project(c.lng,i),g=a.project(d.lng,i),v=ae.fromLngLat(c),S=ae.fromLngLat(d),E=g.x-m.x,C=g.y-m.y,I=S.x-v.x,R=S.y-v.y,L=Math.sqrt((I*I+R*R)/(E*E+C*C));return Math.log2(L)}function fM(a,r,i){const c=Math.cos(i),d=Math.sin(i);return{x:a*c-r*d,y:a*d+r*c}}function pM(a,r,i){se(a),je(a,a,zr(r[2])),Ie(a,a,zr(r[0])),Be(a,a,zr(r[1])),he(a,a,i),ee(a,a,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function ow(a,r,i,c,d,m,g,v){const S=[i[0]-r[0],i[1]-r[1],0],E=[c[0]-r[0],c[1]-r[1],0];if(It(S)<1e-12||It(E)<1e-12)return ds(a);const C=gi([],S,E);un(C,C),Pt(E,c,r),S[2]=(m-d)*v,E[2]=(g-d)*v;const I=S;return gi(I,S,E),un(I,I),tn(a,C,I)}function aw(a,r,i=!1){const c=vd(r.zoom),d=function(m,g,v){const S=g.worldSize,E=[m[12],m[13],m[14]],C=N(E[1]/S),I=D(E[0]/S),R=se([]),L=M(1,C)*S,z=M(1,0)*S*G(C,g.zoom),U=1/tT(S);let q=z*U;if(v){const ue=sw(g.projection,g.zoom,g.width,g.height,1024);q=U*g.projection.pixelSpaceConversion(g.center.lat,S,ue)}const W=gd(C,I);st(W,W,hr([],un([],W),L*q*E[2]));const re=function(ue){const ve=[ue[0],ue[1],ue[2]];let me=[0,1,0];const be=gi([],me,ve);return gi(me,ve,be),xn(me)===0&&(me=[0,1,0],gi(be,ve,me)),un(be,be),un(me,me),un(ve,ve),[be[0],be[1],be[2],0,me[0],me[1],me[2],0,ve[0],ve[1],ve[2],0,ue[0],ue[1],ue[2],1]}(W);he(R,R,[q,q,q*L]),oe(R,R,[-E[0],-E[1],-E[2]]);const ie=ee([],g.globeMatrix,re);return ee(ie,ie,R),ee(ie,ie,m),ie}(a,r,i);if(c>0){const m=function(g,v){const S=v.worldSize,E=M(1,0)*S*G(v.center.lat,v.zoom)/tT(S),C=M(1,v.center.lat)*S,I=se([]);Be(I,I,zr(v.center.lng)),Ie(I,I,zr(v.center.lat)),oe(I,I,[0,0,Vs]),he(I,I,[E,E,E*C]);const R=v.point;return oe(I,I,[-R.x,-R.y,0]),ee(I,I,g),ee(I,v.globeMatrix,I)}(a,r);return function(g,v,S){const E=(z,U,q)=>{const W=It(z),re=It(U),ie=Vl(z,U,q);return hr(ie,ie,1/It(ie)*ur(W,re,q))},C=E([g[0],g[1],g[2]],[v[0],v[1],v[2]],S),I=E([g[4],g[5],g[6]],[v[4],v[5],v[6]],S),R=E([g[8],g[9],g[10]],[v[8],v[9],v[10]],S),L=Vl([g[12],g[13],g[14]],[v[12],v[13],v[14]],S);return[C[0],C[1],C[2],0,I[0],I[1],I[2],0,R[0],R[1],R[2],0,L[0],L[1],L[2],1]}(d,m,c)}return d}function AT(a,r,i,c){const d=Zt.projectAabbCorners(c,i);let m=Number.MAX_VALUE;for(let v=0;v<d.length;++v){const S=d[v];S[0]=(.5*S[0]+.5)*r.width,S[1]=(.5-.5*S[1])*r.height,S[2]<m&&(m=S[2])}const g=function(v){const S=[];let E=0;for(let L=1;L<v.length;L++)(v[L][0]<v[E][0]||v[L][0]===v[E][0]&&v[L][1]<v[E][1])&&(E=L);let C,I=E;const R=new Uint8Array(v.length);do{if(R[I])break;S.push(new it(v[I][0],v[I][1])),R[I]=1,C=(I+1)%v.length;for(let L=0;L<v.length;L++){if(v[L][0]===v[C][0]&&v[L][1]===v[C][1]||v[L][0]===v[I][0]&&v[L][1]===v[I][1])continue;const z=[v[L][0]-v[I][0],v[L][1]-v[I][1]],U=[v[C][0]-v[I][0],v[C][1]-v[I][1]],q=z[0]*U[1]-z[1]*U[0];(q>0||q===0&&z[0]*U[0]+z[1]*U[1]>=0&&z[0]*z[0]+z[1]*z[1]>U[0]*U[0]+U[1]*U[1])&&(C=L)}I=C}while(I!==E);return S.length>0&&S.push(S[0]),S}(d);if(sn(a,g))return m}const rf=64,vm={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function lw(a,r,i,c,d,m,g,v,S,E=!1){const C=i.zoom,I=i.project(c),R=G(c.lat,C),L=1/R;se(a),oe(a,a,[I.x+g[0]*L,I.y+g[1]*L,g[2]]);let z=1,U=1;const q=i.worldSize;if(E){if(i.projection.name==="mercator"){let ue=0;i.elevation&&(ue=i.elevation.getAtPointOrZero(new ae(I.x/q,I.y/q),0));const ve=rs([],[I.x,I.y,ue,1],i.projMatrix)[3]/i.cameraToCenterDistance;z=ve,U=ve*G(i.center.lat,C)}else if(i.projection.name==="globe"){const ue=aw(a,i),ve=[0,0,0,1];rs(ve,ve,ee([],i.projMatrix,ue));const me=ve[3]/i.cameraToCenterDistance,be=vd(C),ke=i.projection.pixelsPerMeter(c.lat,q)*G(c.lat,C),Pe=i.projection.pixelsPerMeter(i.center.lat,q)*G(i.center.lat,C);z=me/ur(ke,H(i.center.lat),be),U=me*R/ke,z*=Pe,U*=Pe}}else z=L;he(a,a,[z,z,U]);const W=[...a],re=r.orientation,ie=[];if(pM(ie,[re[0]+(d?d[0]:0),re[1]+(d?d[1]:0),re[2]+(d?d[2]:0)],m),ee(a,W,ie),v&&i.elevation){let ue=0;const ve=[];if(S&&i.elevation){ue=function(be,ke,Pe,We,Le){const Xe=ke.elevation;if(!Xe)return 0;const rt=Zt.projectAabbCorners(Pe,We),nt=M(1,Le.lat)*ke.worldSize,ut=function(Nt,Ht){const Rr=[0,0,1],yt=[{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 Wt of yt){const gr=Nt[Wt.corners[0]],$r=Nt[Wt.corners[1]],qr=Nt[Wt.corners[2]],Sr=[$r[0]-gr[0],$r[1]-gr[1],Ht*($r[2]-gr[2])],Cn=gi(Sr,Sr,[qr[0]-gr[0],qr[1]-gr[1],Ht*(qr[2]-gr[2])]);un(Cn,Cn),Wt.dotProductWithUp=Nn(Cn,Rr)}return yt.sort((Wt,gr)=>Wt.dotProductWithUp-gr.dotProductWithUp),yt[0].corners}(rt,nt),ht=rt[ut[0]],at=rt[ut[1]],lt=rt[ut[2]],Ze=rt[ut[3]],qe=Xe.getAtPointOrZero(new ae(ht[0]/ke.worldSize,ht[1]/ke.worldSize),0),ct=Xe.getAtPointOrZero(new ae(at[0]/ke.worldSize,at[1]/ke.worldSize),0),St=Xe.getAtPointOrZero(new ae(lt[0]/ke.worldSize,lt[1]/ke.worldSize),0),_t=Xe.getAtPointOrZero(new ae(Ze[0]/ke.worldSize,Ze[1]/ke.worldSize),0),Yt=(qe+_t)/2,Lt=(ct+St)/2;return Yt>Lt?ct<St?ow(be,at,Ze,ht,ct,_t,qe,nt):ow(be,lt,ht,Ze,St,qe,_t,nt):qe<_t?ow(be,ht,at,lt,qe,ct,St,nt):ow(be,Ze,lt,at,_t,St,ct,nt),Math.max(Yt,Lt)}(ve,i,r.aabb,a,c);const me=ee([],tr([],ve),ie);ee(a,W,me)}else ue=i.elevation.getAtPointOrZero(new ae(I.x/q,I.y/q),0);ue!==0&&(a[14]+=ue)}}class mM{constructor(r,i,c,d,m){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=r,this.uri=i,this.position=c!=null?new l(c[0],c[1]):new l(0,0),this.orientation=d??[0,0,0],this.nodes=m,this.uploaded=!1,this.aabb=new Zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,i){ee(r.globalMatrix,i,r.localMatrix);const c=this.nodeOverrides.get(r.name);if(c!==void 0){const g=[];m=c.orientation,se(d=g),Be(d,d,zr(m[1])),je(d,d,zr(m[2])),Ie(d,d,zr(m[0])),ee(r.globalMatrix,r.globalMatrix,g)}var d,m;if(r.meshes)for(const g of r.meshes){const v=Zt.applyTransformFast(g.aabb,r.globalMatrix);this.aabb.encapsulate(v)}if(r.children)for(const g of r.children)this._applyTransformations(g,r.globalMatrix)}computeBoundsAndApplyParent(){const r=se([]);this.aabb=new Zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,r)}computeModelMatrix(r,i,c,d,m,g,v=!1){lw(this.matrix,this,r.transform,this.position,i,c,d,m,g,v)}upload(r){if(!this.uploaded){for(const i of this.nodes)CT(i,r);for(const i of this.nodes)cw(i);this.uploaded=!0}}destroy(){for(const r of this.nodes)IT(r)}}function My(a,r,i=!1){a.uploaded||(a.gfxTexture=new ET(r,a.image,i?r.gl.R8:r.gl.RGBA8,{useMipmap:a.sampler.minFilter>=r.gl.NEAREST_MIPMAP_NEAREST}),a.uploaded=!0,a.image=null)}function A6(a,r,i){a.indexBuffer=r.createIndexBuffer(a.indexArray,!1,!0),a.vertexBuffer=r.createVertexBuffer(a.vertexArray,x6.members,!1,!0),a.normalArray&&(a.normalBuffer=r.createVertexBuffer(a.normalArray,T6.members,!1,!0)),a.texcoordArray&&(a.texcoordBuffer=r.createVertexBuffer(a.texcoordArray,S6.members,!1,!0)),a.colorArray&&(a.colorBuffer=r.createVertexBuffer(a.colorArray,(a.colorArray.bytesPerElement===12?w6:b6).members,!1,!0)),a.featureArray&&(a.pbrBuffer=r.createVertexBuffer(a.featureArray,k6.members,!0)),a.segments=ri.simpleSegment(0,0,a.vertexArray.length,a.indexArray.length);const c=a.material;c.pbrMetallicRoughness.baseColorTexture&&My(c.pbrMetallicRoughness.baseColorTexture,r),c.pbrMetallicRoughness.metallicRoughnessTexture&&My(c.pbrMetallicRoughness.metallicRoughnessTexture,r),c.normalTexture&&My(c.normalTexture,r),c.occlusionTexture&&My(c.occlusionTexture,r,i),c.emissionTexture&&My(c.emissionTexture,r)}function CT(a,r,i){if(a.meshes)for(const c of a.meshes)A6(c,r,i);if(a.children)for(const c of a.children)CT(c,r,i)}function cw(a){if(a.meshes)for(const r of a.meshes)r.indexArray.destroy(),r.vertexArray.destroy(),r.colorArray&&r.colorArray.destroy(),r.normalArray&&r.normalArray.destroy(),r.texcoordArray&&r.texcoordArray.destroy(),r.featureArray&&r.featureArray.destroy();if(a.children)for(const r of a.children)cw(r)}function IT(a){if(a.meshes)for(const i of a.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((r=i.material).pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()));var r;if(a.children)for(const i of a.children)IT(i)}function nf(a,r){const i=a.json.bufferViews[r.bufferView],c=nw[r.componentType];return new c(a.buffers[i.buffer],(r.byteOffset||0)+(i.byteOffset||0),r.count*(i.byteStride&&i.byteStride!==Iy[r.type]*c.BYTES_PER_ELEMENT?i.byteStride/c.BYTES_PER_ELEMENT:Iy[r.type]))}function PT(a,r,i,c){const d=nw[r.componentType],m=function(C){switch(C){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(d),g=a.json.bufferViews[r.bufferView],v=g.byteStride?g.byteStride/d.BYTES_PER_ELEMENT:Iy[r.type],S=i.float32,E=S.length/i.capacity;for(let C=0,I=0;C<r.count*v;C+=v,I+=E)for(let R=0;R<E;R++)S[I+R]=c[C+R]*m;i._trim()}function C6(a,r,i){const c=a.indices,d=a.attributes,m={};m.indexArray=new Ni;const g=r.json.accessors[c],v=g.count/3;m.indexArray.reserve(v);const S=nf(r,g);for(let R=0;R<v;R++)m.indexArray.emplaceBack(S[3*R],S[3*R+1],S[3*R+2]);m.indexArray._trim(),m.vertexArray=new Yo;const E=r.json.accessors[d.POSITION];m.vertexArray.reserve(E.count);const C=nf(r,E);for(let R=0;R<E.count;R++)m.vertexArray.emplaceBack(C[3*R],C[3*R+1],C[3*R+2]);if(m.vertexArray._trim(),m.aabb=new Zt(E.min,E.max),m.centroid=function(R,L){const z=[0,0,0],U=R.length;if(U>0){for(let q=0;q<U;q++){const W=3*R[q];z[0]+=L[W],z[1]+=L[W+1],z[2]+=L[W+2]}z[0]/=U,z[1]/=U,z[2]/=U}return z}(S,C),d.COLOR_0!==void 0){const R=r.json.accessors[d.COLOR_0],L=Iy[R.type],z=nf(r,R);m.colorArray=L===3?new Yo:new Ic,m.colorArray.resize(R.count),PT(r,R,m.colorArray,z)}if(d.NORMAL!==void 0){m.normalArray=new Yo;const R=r.json.accessors[d.NORMAL];m.normalArray.resize(R.count);const L=nf(r,R);PT(r,R,m.normalArray,L)}if(d.TEXCOORD_0!==void 0&&i.length>0){m.texcoordArray=new ul;const R=r.json.accessors[d.TEXCOORD_0];m.texcoordArray.resize(R.count);const L=nf(r,R);PT(r,R,m.texcoordArray,L)}if(d._FEATURE_ID_RGBA4444!==void 0){const R=r.json.accessors[d._FEATURE_ID_RGBA4444];r.json.extensionsUsed&&r.json.extensionsUsed.includes("EXT_meshopt_compression")&&(m.featureData=nf(r,R))}d._FEATURE_RGBA4444!==void 0&&(m.featureData=new Uint32Array(nf(r,r.json.accessors[d._FEATURE_RGBA4444]).buffer));const I=a.material;return m.material=function(R,L){const{emissiveFactor:z=[0,0,0],alphaMode:U="OPAQUE",alphaCutoff:q=.5,normalTexture:W,occlusionTexture:re,emissiveTexture:ie,doubleSided:ue,name:ve}=R,{baseColorFactor:me=[1,1,1,1],metallicFactor:be=1,roughnessFactor:ke=1,baseColorTexture:Pe,metallicRoughnessTexture:We}=R.pbrMetallicRoughness||{},Le=re?L[re.index]:void 0;if(re&&re.extensions&&re.extensions.KHR_texture_transform&&Le){const Xe=re.extensions.KHR_texture_transform;Le.offsetScale=[Xe.offset[0],Xe.offset[1],Xe.scale[0],Xe.scale[1]]}return{name:ve,pbrMetallicRoughness:{baseColorFactor:new wn(...me),metallicFactor:be,roughnessFactor:ke,baseColorTexture:Pe?L[Pe.index]:void 0,metallicRoughnessTexture:We?L[We.index]:void 0},doubleSided:ue,emissiveFactor:new wn(...z),alphaMode:U,alphaCutoff:q,normalTexture:W?L[W.index]:void 0,occlusionTexture:Le,emissionTexture:ie?L[ie.index]:void 0,defined:R.defined===void 0}}(I!==void 0?r.json.materials[I]:{defined:!1},i),m}function gM(a,r,i){const{matrix:c,rotation:d,translation:m,scale:g,mesh:v,extras:S,children:E,name:C}=a,I={};if(I.name=C,I.localMatrix=c||function(R,L,z,U){var q=L[0],W=L[1],re=L[2],ie=L[3],ue=q+q,ve=W+W,me=re+re,be=q*ue,ke=q*ve,Pe=q*me,We=W*ve,Le=W*me,Xe=re*me,rt=ie*ue,nt=ie*ve,ut=ie*me,ht=U[0],at=U[1],lt=U[2];return R[0]=(1-(We+Xe))*ht,R[1]=(ke+ut)*ht,R[2]=(Pe-nt)*ht,R[3]=0,R[4]=(ke-ut)*at,R[5]=(1-(be+Xe))*at,R[6]=(Le+rt)*at,R[7]=0,R[8]=(Pe+nt)*lt,R[9]=(Le-rt)*lt,R[10]=(1-(be+We))*lt,R[11]=0,R[12]=z[0],R[13]=z[1],R[14]=z[2],R[15]=1,R}([],d||[0,0,0,1],m||[0,0,0],g||[1,1,1]),I.globalMatrix=Z(I.localMatrix),v!==void 0){I.meshes=i[v];const R=I.anchor=[0,0];for(const L of I.meshes){const{min:z,max:U}=L.aabb;R[0]+=z[0]+U[0],R[1]+=z[1]+U[1]}R[0]=Math.floor(R[0]/I.meshes.length/2),R[1]=Math.floor(R[1]/I.meshes.length/2)}if(S&&(S.id&&(I.id=S.id),S.lights&&(I.lights=function(R){if(!R.length)return[];const L=function(re){const ie=atob(re),ue=new Uint8Array(ie.length);for(let ve=0;ve<ie.length;ve++)ue[ve]=ie.codePointAt(ve);return ue}(R),z=[],U=L.length/24,q=new Uint16Array(L.buffer),W=new Float32Array(L.buffer);for(let re=0;re<U;re++){const ie=q[2*re*6]/30,ue=q[2*re*6+1]/30,ve=q[2*re*6+10]/100,me=W[6*re+1],be=W[6*re+2],ke=W[6*re+3],Pe=W[6*re+4],We=ke-me,Le=Pe-be,Xe=Math.hypot(We,Le);z.push({pos:[me+.5*We,be+.5*Le,ue],normal:[Le/Xe,-We/Xe,0],width:Xe,height:ie,depth:ve,points:[me,be,ke,Pe]})}return z}(S.lights)),S.MAPBOX_geometry_bloom&&(I.isGeometryBloom=S.MAPBOX_geometry_bloom)),E){const R=[];for(const L of E)R.push(gM(r.json.nodes[L],r,i));I.children=R}return I}function I6(a){if(a.vertices.length===0||a.indices.length===0)return null;const r=new Zx(a.vertices,a.indices,8,256),[i,c]=[r.min.clone(),r.max.clone()];return{vertices:a.vertices,indices:a.indices,grid:r,min:i,max:c}}function P6(a){if(!a.extras||!a.extras.ground)return null;const r=a.extras.ground;if(!r||!Array.isArray(r)||r.length===0)return null;const i=r[0];if(!i||!Array.isArray(i)||i.length===0)return null;const c=[];for(const g of i){if(!Array.isArray(g)||g.length!==2)continue;const v=g[0],S=g[1];typeof v=="number"&&typeof S=="number"&&c.push(new it(v,S))}if(c.length<3)return null;c.length>1&&c[c.length-1].equals(c[0])&&c.pop();let d=0;for(let g=0;g<c.length;g++){const v=c[g],S=c[(g+1)%c.length],E=c[(g+2)%c.length];d+=(v.x-S.x)*(E.y-S.y)-(E.x-S.x)*(v.y-S.y)}d>0&&c.reverse();const m=fm(c.flatMap(g=>[g.x,g.y]),[]);return m.length===0?null:{vertices:c,indices:m}}function M6(a,r){const i=[],c=[];let d=0;const m=[];for(const g of a){d=i.length;const v=g.vertexArray.float32,S=g.indexArray.uint16;for(let E=0;E<g.vertexArray.length;E++)m[0]=v[3*E+0],m[1]=v[3*E+1],m[2]=v[3*E+2],Un(m,m,r),i.push(new it(m[0],m[1]));for(let E=0;E<3*g.indexArray.length;E++)c.push(S[E]+d)}if(c.length%3!=0)return null;for(let g=0;g<c.length;g+=3){const v=i[c[g+0]],S=i[c[g+1]],E=i[c[g+2]];(v.x-S.x)*(E.y-S.y)-(E.x-S.x)*(v.y-S.y)>0&&([c[g+1],c[g+2]]=[c[g+2],c[g+1]])}return{vertices:i,indices:c}}function MT(a){const r=function(S,E){const C=[],I=WebGL2RenderingContext;if(S.json.textures)for(const R of S.json.textures){const L={magFilter:I.LINEAR,minFilter:I.NEAREST,wrapS:I.REPEAT,wrapT:I.REPEAT};R.sampler!==void 0&&Object.assign(L,S.json.samplers[R.sampler]),C.push({image:E[R.source],sampler:L,uploaded:!1})}return C}(a,a.images),i=function(S,E){const C=[];for(const I of S.json.meshes){const R=[];for(const L of I.primitives)R.push(C6(L,S,E));C.push(R)}return C}(a,r),{scenes:c,scene:d,nodes:m}=a.json,g=c?c[d||0].nodes:[...m.keys()],v=[];for(const S of g)v.push(gM(m[S],a,i));return function(S,E,C){const I={},R=new Set;for(let L=0;L<S.length;L++){const z=C[E[L]];if(!z.extras)continue;const U=z.extras["mapbox:footprint:version"],q=z.extras["mapbox:footprint:id"];(U||q)&&R.add(L),U==="1.0.0"&&q&&(I[q]=L)}for(let L=0;L<S.length;L++){if(R.has(L))continue;const z=S[L],U=C[E[L]];if(!U.extras)continue;let q=null;z.id in I&&(q=M6(S[I[z.id]].meshes,z.localMatrix)),q||(q=P6(U)),q&&(z.footprint=I6(q))}if(R.size>0){const L=Array.from(R.values()).sort((z,U)=>z-U);for(let z=L.length-1;z>=0;z--)S.splice(L[z],1)}}(v,g,a.json.nodes),v}function R6(a){a.heightmap=new Float32Array(4096),a.heightmap.fill(-1);const r=a.vertexArray.float32,i=a.aabb.min[0]-1,c=a.aabb.min[1]-1,d=rf/(a.aabb.max[0]-i+2),m=rf/(a.aabb.max[1]-c+2);for(let g=0;g<r.length;g+=3){const v=r[g+2],S=(r[g+0]-i)*d|0,E=(r[g+1]-c)*m|0;v>a.heightmap[E*rf+S]&&(a.heightmap[E*rf+S]=v)}}function _M(a,r,i,c,d){i.reserve(i.length+4*a.length),c.reserve(c.length+10*a.length),d.reserve(d.length+10*a.length);let m=c.length;for(const g of a){const v=Math.min(10,Math.max(4,1.3*g.height))*r,S=[-g.normal[1],g.normal[0],0],E=Math.min(.29,.1*g.width/g.depth),C=g.width-2*g.depth*r*(E+.01),I=Gr([],g.pos,S,C/2),R=Gr([],g.pos,S,-C/2),L=[I[0],I[1],I[2]+g.height],z=[R[0],R[1],R[2]+g.height],U=Gr([],g.normal,S,E);hr(U,U,v);const q=Gr([],g.normal,S,-E);hr(q,q,v),st(U,I,U),st(q,R,q),I[2]+=.1,R[2]+=.1,c.emplaceBack(U[0],U[1],U[2]),c.emplaceBack(q[0],q[1],q[2]),c.emplaceBack(I[0],I[1],I[2]),c.emplaceBack(R[0],R[1],R[2]),c.emplaceBack(L[0],L[1],L[2]),c.emplaceBack(z[0],z[1],z[2]),c.emplaceBack(I[0],I[1],I[2]),c.emplaceBack(R[0],R[1],R[2]),c.emplaceBack(U[0],U[1],U[2]),c.emplaceBack(q[0],q[1],q[2]);const W=C/v/2;d.emplaceBack(-W-E,-1,W,.8),d.emplaceBack(W+E,-1,W,.8),d.emplaceBack(-W,0,W,1.3),d.emplaceBack(W,0,W,1.3),d.emplaceBack(W+E,-.8,W,.7),d.emplaceBack(W+E,-.8,W,.7),d.emplaceBack(0,0,W,1.3),d.emplaceBack(0,0,W,1.3),d.emplaceBack(W+E,-1.2,W,.8),d.emplaceBack(W+E,-1.2,W,.8),i.emplaceBack(6+m,4+m,8+m),i.emplaceBack(7+m,9+m,5+m),i.emplaceBack(0+m,1+m,2+m),i.emplaceBack(1+m,3+m,2+m),m+=10}}function D6(a,r){const i={};i.indexArray=new Ni,i.vertexArray=new Yo,i.colorArray=new Ic,_M(a,r,i.indexArray,i.vertexArray,i.colorArray);const c={defined:!0};c.emissiveFactor=wn.black;const d={};return d.baseColorFactor=wn.white,c.pbrMetallicRoughness=d,i.material=c,i.aabb=new Zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const yM=Br([{name:"a_pos_3f",components:3,type:"Float32"}]),L6=Br([{name:"a_normal_3",components:3,type:"Int16"}]),O6=Br([{name:"a_centroid_3",components:3,type:"Int16"}]),vM=Br([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),z6=Br([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),F6=Br([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),B6=Br([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),N6=Br([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),j6=Br([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),xM=Me.types,uw=32767;function V6(a,r){const i=bt+r;for(const c of a)for(const d of c)if(d.x<-r||d.x>i||d.y<-r||d.y>i)return!1;return!0}function U6(a){switch(a){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: ${a}`)}}class RT{constructor(){this.layoutVertexArray=new Yo,this.layoutAttenuationArray=new Ic,this.layoutColorArray=new Jo,this.indexArray=new Ni,this.indexArrayForConflation=new Ni,this.segmentsBucket=new ri}}class DT{constructor(r){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new ri,this.entranceBloom=new RT;const i=66560;this.layoutVertexArray=new Yo,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new ud,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new ud,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new Jo,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new Pc,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new tm,this.layoutAOArray.reserve(i),this.indexArray=new Ni,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ni,this.segmentsBucket=new ri,this.entranceBloom=new RT,r&&(this.layoutFacadePaintArray=new Jo,this.layoutFacadeDataArray=new _u,this.layoutFacadeVerticalRangeArray=new Jo)}reserve(r,i,c){this.layoutVertexArray.reserveForAdditional(r),this.layoutCentroidArray.reserveForAdditional(r),this.layoutFloodLightDataArray.reserveForAdditional(r),this.layoutNormalArray.reserveForAdditional(r),this.layoutAOArray.reserveForAdditional(r),this.layoutColorArray.reserveForAdditional(r),this.indexArray.reserveForAdditional(i),c&&(this.layoutFacadePaintArray.reserveForAdditional(r),this.layoutFacadeDataArray.reserveForAdditional(r),this.layoutFacadeVerticalRangeArray.reserveForAdditional(r))}}class wM{constructor(r){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new ul,this.footprintsIndices=new Pc,this.footprintsMin=new it(1/0,1/0),this.footprintsMax=new it(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new DT(!1),this.buildingWithFacade=new DT(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=r.zoom,this.canonical=r.canonical,this.layers=r.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=r.index,this.hasPattern=!1,this.worldview=r.worldview,this.lut=r.lut,this.programConfigurations=new Fa(r.layers,{zoom:r.zoom,lut:r.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=r.projection,this.groundEffect=new mT(r),this.groundEffect.groundRadiusArray=new Ll,this.hasAppearances=null}updateFootprints(r,i){const c=new Zx([],[],1),d={vertices:[],indices:new Uint32Array(0),grid:c,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:d,id:r})}updateAppearances(r,i,c,d){}prepare(){return function(){if(rw!=null||tM!=null)return null;if(ym!=null)return ym;const r=fetch(Vr.BUILDING_GEN_URL);return ym=function(i){let c,d,m,g,v;function S(){c=new Uint8Array(v.buffer),d=new Int16Array(v.buffer),m=new Int32Array(v.buffer),g=new Float32Array(v.buffer)}function E(){throw new Error("Unexpected BuildingGen error.")}const C=()=>{},I={a:{a:E,f:function(R){const L=c.length,z=Math.max(R>>>0,Math.ceil(1.2*L)),U=Math.ceil((z-L)/65536);try{return v.grow(U),S(),!0}catch{return!1}},g:E,b:C,c:C,d:C,e:C}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,I):i.then(R=>R.arrayBuffer()).then(R=>WebAssembly.instantiate(R,I))).then(R=>{const L=R.instance.exports;return(0,L.g)(),v=L.f,S(),new f6({setStyle:L.h,setAOOptions:L.i,setMetricOptions:L.j,setStructuralOptions:L.k,setFacadeOptions:L.l,setFauxFacadeOptions:L.m,setFacadeClassifierOptions:L.n,addFeature:L.o,addFacade:L.p,generateMesh:L.q,getLastError:L.r,getOuterRingLength:L.s,getMeshCount:L.t,getPositionsPtr:L.u,getPositionsLength:L.v,getNormalsPtr:L.w,getNormalsLength:L.x,getAOPtr:L.y,getAOLength:L.z,getUVPtr:L.A,getUVLength:L.B,getFauxFacadePtr:L.C,getFauxFacadeLength:L.D,getIndicesPtr:L.E,getIndicesLength:L.F,getBuildingPart:L.G,getRingCount:L.H,getRingPtr:L.I,getRingLength:L.J,malloc:L.K,free:L.L,heapU8:c,heap16:d,heap32:m,heapF32:g})})}(r).then(i=>(ym=null,rw=i,rw)).catch(i=>{Ft("Could not load building-gen"),ym=null,tM=i}),ym}()}populate(r,i,c,d){const m=p6();if(!m)return;const g=J(c);this.tileToMeter=g,this.brightness=i.brightness,m.setStyle({normalScale:[1,-1,g],tileToMeters:g}),m.setAOOptions(!1,.3),m.setMetricOptions(!1,16),m.setStructuralOptions(!0),m.setFacadeClassifierOptions(3);const v=new Map,S=new Map;let E=0;for(const{feature:W}of r){if(xM[W.type]!=="LineString"){v.set(W.id,W.properties.source_id);continue}const re=this.layers[0]._featureFilter.needGeometry;if(re&&!this.layers[0]._featureFilter.filter(new $n(this.zoom),W,c))continue;const ie=De(W,re);if(!re&&!this.layers[0]._featureFilter.filter(new $n(this.zoom),ie,c))continue;const ue=re?ie.geometry:Te(W,c,d),ve=[];for(const Pe of ue)for(const We of Pe)ve.push(We.x),ve.push(We.y);const me={coordinates:ve,crossPerc:W.properties.cross_perc,distanceToRoad:W.properties.distance_to_road,entrances:W.properties.entrances,sourceId:0},be=W.properties.source_id;let ke=S.get(be);ke||(ke=[],S.set(be,ke)),ke.push(me),++E}this.maxHeight=0;const C=new Array,I=new Set,R=W=>{W!=null&&I.add(W)},L=(W,re)=>{W!=null&&C.push({buildingId:W,footprintIndex:re})},z=64*(r.length-E),U=z/2;this.buildingWithFacade.reserve(z,U,!0),this.buildingWithoutFacade.reserve(2*z,2*U,!1),this.footprintsIndices.reserve(16*(r.length-E)),this.footprintsVertices.reserve(8*(r.length-E));for(const{feature:W,id:re,index:ie,sourceLayerIndex:ue}of r){if(xM[W.type]==="LineString")continue;const ve=this.layers[0]._featureFilter.needGeometry;if(ve&&!this.layers[0]._featureFilter.filter(new $n(this.zoom),W,c))continue;let me=null;if(W.properties&&W.properties.hasOwnProperty("building_id")&&(me=W.properties.building_id,I.has(me)))continue;const be=De(W,ve);if(!ve&&!this.layers[0]._featureFilter.filter(new $n(this.zoom),be,c))continue;const ke=ve?be.geometry:Te(W,c,d),Pe=xy(ke,500);let We=!1;for(const lr of Pe)if(lr.length!==1){We=!0;break}if(We){R(me);continue}if(!V6(ke,163)){R(me);continue}const Le=this.layers[0],Xe=U6(Le.layout.get("building-roof-shape").evaluate(W,{},c)),rt=Le.layout.get("building-base").evaluate(W,{},c),nt=Le.layout.get("building-height").evaluate(W,{},c),ut=Le.layout.get("building-flood-light-ground-radius").evaluate(W,{},c),ht=Le.paint.get("building-ambient-occlusion-intensity"),at=ut/this.tileToMeter;W.properties["building-part"]="roof";const lt=Le.paint.get("building-color").evaluate(W,{},this.canonical).toPremultipliedRenderColor(this.lut),Ze=Le.paint.get("building-emissive-strength").evaluate(W,{},this.canonical);W.properties["building-part"]="wall";const qe=Le.paint.get("building-color").evaluate(W,{},this.canonical).toPremultipliedRenderColor(this.lut),ct=Le.paint.get("building-emissive-strength").evaluate(W,{},this.canonical);W.properties["building-part"]="window";const St=Le.paint.get("building-color").evaluate(W,{},this.canonical).toPremultipliedRenderColor(this.lut),_t=Le.paint.get("building-emissive-strength").evaluate(W,{},this.canonical);W.properties["building-part"]="door";const Yt=Le.paint.get("building-color").evaluate(W,{},this.canonical).toPremultipliedRenderColor(this.lut),Lt=Le.paint.get("building-emissive-strength").evaluate(W,{},this.canonical);let Nt=Le.layout.get("building-flood-light-wall-radius").evaluate(W,{},c);Nt=K(Nt,0,2048);const Ht=Nt/2048*uw,Rr=v.get(re),yt=S.get(Rr)||[],Wt=yt.length!==0&&Le.layout.get("building-facade").evaluate(W,{},c);m.setFacadeOptions(4,!0),m.setFauxFacadeOptions(Wt,!1,1);let gr=0,$r=0,qr=0,Sr=0,Cn=0,ge=0,xe=0,Ye=0,dt=0,Mt=0,Rt=0;if(Wt){let lr=Math.round(Le.layout.get("building-facade-floors").evaluate(W,{},c));if(rt===0){lr=Math.max(1,lr-(yt.length>0?1:0));let Tn=4;if(nt>100){const Jn=[10,13,15];Tn=Jn[W.id?W.id%Jn.length:0]}else nt<=10&&(Tn=3);m.setFacadeOptions(Tn,!0),Cn=(nt<15?1.3:1.61803)*Tn/g}else Cn=rt/g;ge=nt/g,Cn=Math.min(Cn,ge),qr=Le.layout.get("building-facade-unit-width").evaluate(W,{},c)/g,Sr=(ge-Cn)/lr,m.setFauxFacadeOptions(!0,!0,qr);const si=Le.layout.get("building-facade-window").evaluate(W,{},c);gr=si[0],$r=si[1],xe=Math.floor(65535*Math.min(1,Cn/bt)),Ye=Math.floor(65535*Math.min(1,ge/bt)),dt=Math.floor(255*gr)<<8|Math.floor(255*$r),Mt=Math.floor(65535*Math.min(1,qr/bt)),Rt=Math.floor(65535*Math.min(1,Sr/bt))}const Jt=Array(Pe.length),er={x:1/0,y:1/0},wr={x:-1/0,y:-1/0},Ir={x:0,y:0};let Mr=0;for(let lr=0;lr<Pe.length;lr++){const si=Pe[lr];if(si.length>0){const Tn=[],Jn=Array(si.length+1);Jn[0]=0;for(let Ui=0;Ui<si.length;Ui++){const os=si[Ui];for(let Di=0;Di<os.length;Di++){const Li=os[os.length-Di-1];er.x=Math.min(er.x,Li.x),er.y=Math.min(er.y,Li.y),wr.x=Math.max(wr.x,Li.x),wr.y=Math.max(wr.y,Li.y),Ir.x+=Li.x,Ir.y+=Li.y,Mr++,Tn.push(Li.x),Tn.push(Li.y)}Jn[Ui+1]=Tn.length}Jt[lr]={id:W.id?W.id:0,height:nt,minHeight:rt,sourceId:0,roofType:Xe,coordinates:Tn,ringIndices:Jn}}}Ir.x/=Mr||1,Ir.y/=Mr||1;const Nr=m.generateMesh(Jt,yt);if(typeof Nr=="string"){Ft(`Unable to generate building ${W.id}: ${Nr}`),R(me);continue}if(Nr.meshes.length===0||Nr.modifiedPolygonRings.length===0){R(me);continue}const cr=Wt?this.buildingWithFacade:this.buildingWithoutFacade;let mr=0;for(const lr of Nr.meshes)mr+=lr.positions.length/3;const en=cr.segmentsBucket.prepareSegment(mr,cr.layoutVertexArray,cr.indexArray),ln=[];let cn=null,Sn=0,Ln=-1;const In=cr.layoutVertexArray.length,hn=In+mr;cr.layoutVertexArray.resize(hn),cr.layoutCentroidArray.resize(hn),cr.layoutNormalArray.resize(hn),cr.layoutAOArray.resize(hn),cr.layoutColorArray.resize(hn),cr.layoutFloodLightDataArray.resize(hn),Wt&&(cr.layoutFacadePaintArray.resize(hn),cr.layoutFacadeDataArray.resize(hn),cr.layoutFacadeVerticalRangeArray.resize(hn));const gn=cr.indexArray.length;let Pr=0,Hr=In;for(const lr of Nr.meshes){let si,Tn;if(lr.buildingPart===1)si=lt,Tn=Ze;else if(lr.buildingPart===0)si=qe,Tn=ct;else if(lr.buildingPart===2)si=St,Tn=_t;else{if(lr.buildingPart!==3)continue;si=Yt,Tn=Lt}if(Tn=K(Tn,0,1),lr.buildingPart===3){const Vn=new Array;for(let $i=0;$i<lr.positions.length;$i+=12){const pl=lr.positions[$i+0],Oc=lr.positions[$i+1],Rs=lr.positions[$i+3],po=lr.positions[$i+4],ra=lr.positions[$i+2],Ed=lr.positions[$i+8]-ra,Rm=1,ql=Rs-pl,Kl=po-Oc,tv=Math.hypot(ql,Kl);Vn.push({pos:[pl+.5*ql,Oc+.5*Kl,ra],normal:[Kl/tv,-ql/tv,0],width:tv,height:Ed,depth:Rm,points:[pl,Oc,Rs,po]})}const xi=cr.entranceBloom.segmentsBucket.prepareSegment(10*Vn.length,cr.entranceBloom.layoutVertexArray,cr.entranceBloom.indexArray),Ti=cr.entranceBloom.layoutVertexArray.length;Sn=cr.entranceBloom.indexArray.length,_M(Vn,.5/this.tileToMeter,cr.entranceBloom.indexArray,cr.entranceBloom.layoutVertexArray,cr.entranceBloom.layoutAttenuationArray);const Fo=cr.entranceBloom.layoutVertexArray.length-Ti;Ln=cr.entranceBloom.indexArray.length-Sn;for(let $i=0;$i<Fo;$i++)cr.entranceBloom.layoutColorArray.emplaceBack(255*Yt.r<<8|255*Yt.g,255*Yt.b<<8|51*Lt);xi.vertexLength+=Fo,xi.primitiveLength+=Ln,cn={part:lr.buildingPart,vertexOffset:Ti,vertexLength:Fo}}cr.layoutVertexArray.float32.set(lr.positions,3*Hr);const Jn=lr.positions.length/3;for(let Vn=0;Vn<Jn;++Vn){const xi=3*Vn;Pr=Math.max(Pr,lr.positions[xi+2]);const Ti=lr.normals[xi+1]*uw,Fo=lr.normals[xi+2]*uw,$i=3*(Hr+Vn);cr.layoutNormalArray.int16[$i]=lr.normals[xi]*uw,cr.layoutNormalArray.int16[$i+1]=Ti,cr.layoutNormalArray.int16[$i+2]=Fo;const pl=lr.ao[Vn];cr.layoutAOArray.uint8[Hr+Vn]=255*pl;const Oc=1+(pl-1)*ht,Rs=255*si.b*Oc<<8|255*Tn;cr.layoutColorArray.uint16[2*(Hr+Vn)]=255*si.r*Oc<<8|255*si.g*Oc,cr.layoutColorArray.uint16[2*(Hr+Vn)+1]=Rs}const Ui=Math.floor(Ir.x),os=Math.floor(Ir.y),Di=Math.floor(nt);for(let Vn=0;Vn<Jn;++Vn){const xi=3*(Hr+Vn);cr.layoutCentroidArray.int16[xi]=Ui,cr.layoutCentroidArray.int16[xi+1]=os,cr.layoutCentroidArray.int16[xi+2]=Di}if(cr.layoutFloodLightDataArray.uint16.fill(lr.buildingPart===0?Ht:0,Hr,Hr+Jn),Wt){const Vn=255*St.r<<8|255*St.g,xi=255*St.b<<8|255*_t;for(let Ti=0;Ti<Jn;++Ti){const Fo=2*(Hr+Ti);cr.layoutFacadePaintArray.uint16[Fo]=Vn,cr.layoutFacadePaintArray.uint16[Fo+1]=xi}for(let Ti=0;Ti<Jn;++Ti)if(lr.isFauxFacade[Ti]){const Fo=Math.min(65535,Math.floor(lr.uv[2*Ti]*Nr.outerRingLength));cr.layoutFacadeDataArray.emplace(Hr+Ti,1|Fo,dt,Mt,Rt),cr.layoutFacadeVerticalRangeArray.emplace(Hr+Ti,xe,Ye)}else cr.layoutFacadeDataArray.emplace(Hr+Ti,0,0,0,0),cr.layoutFacadeVerticalRangeArray.emplace(Hr+Ti,0,0)}const Li=en.vertexLength,Ji=lr.indices.length/3,ko=cr.indexArray.length;cr.indexArray.resize(ko+Ji);for(let Vn=0;Vn<Ji;++Vn){const xi=3*Vn,Ti=3*ko+xi;cr.indexArray.uint16[Ti]=Li+lr.indices[xi],cr.indexArray.uint16[Ti+1]=Li+lr.indices[xi+1],cr.indexArray.uint16[Ti+2]=Li+lr.indices[xi+2]}lr.buildingPart!==1&&lr.buildingPart!==0&&lr.buildingPart!==2&&lr.buildingPart!==3||ln.push({part:lr.buildingPart,vertexOffset:Hr,vertexLength:lr.positions.length/3}),Hr+=Jn,en.vertexLength+=Jn,en.primitiveLength+=lr.indices.length/3}this.maxHeight=Math.max(this.maxHeight,Pr);const ei=cr.indexArray.length-gn,ar=this.footprintsIndices.length,jr=this.footprintsVertices.length,Mn=[],Fn=new it(1/0,1/0),Gn=new it(-1/0,-1/0),Si=this.groundEffect.vertexArray.length;for(const lr of Nr.modifiedPolygonRings){const si=[],Tn=new it(1/0,1/0),Jn=new it(-1/0,-1/0);for(let Ui=0;Ui<lr.length;Ui+=2){const os=lr.length-Ui-2;Tn.x=Math.min(Tn.x,lr[os]),Tn.y=Math.min(Tn.y,lr[os+1]),Jn.x=Math.max(Jn.x,lr[os]),Jn.y=Math.max(Jn.y,lr[os+1]);const Di=new it(lr[os],lr[os+1]);si.push(Di),Mn.push(Di.x,Di.y),this.footprintsVertices.emplaceBack(Di.x,Di.y)}Fn.x=Math.min(Fn.x,Tn.x),Fn.y=Math.min(Fn.y,Tn.y),Gn.x=Math.max(Gn.x,Jn.x),Gn.y=Math.max(Gn.y,Jn.y),this.groundEffect.addData(si,[Tn,Jn],at)}const jn=this.groundEffect.vertexArray.length-Si;this.groundEffect.groundRadiusArray.reserveForAdditional(jn);for(let lr=0;lr<jn;lr++)this.groundEffect.groundRadiusArray.emplaceBack(ut);(er.x<0||wr.x>bt||er.y<0||wr.y>bt)&&this.featuresOnBorder.push({featureId:W.id,footprintIndex:this.footprints.length});{const lr=fm(Mn,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+lr.length),this.footprintsIndices.uint16.set(lr,ar),this.buildingIds.add(me??W.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Fn.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Fn.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Gn.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Gn.y);const si={footprintVertexOffset:jr,footprintVertexLength:this.footprintsVertices.length-jr,footprintIndexOffset:ar,footprintIndexLength:this.footprintsIndices.length-ar,min:Fn,max:Gn,hiddenFlags:0,indicesOffset:gn,indicesLength:ei,bloomIndicesOffset:Sn,bloomIndicesLength:Ln,groundEffectVertexOffset:Si,groundEffectVertexLength:jn,hasFauxFacade:Wt,height:Pr,promoteId:re,feature:be,parts:ln,buildingBloom:cn},Tn=this.footprints.length;W.id!==void 0&&this.featureFootprintLookup.set(W.id,Tn),L(me,Tn),this.footprints.push(si)}this.programConfigurations.populatePaintArrays(cr.layoutVertexArray.length,W,ie,{},i.availableImages,c,i.brightness),this.groundEffect.addPaintPropertiesData(W,ie,{},i.availableImages,c,i.brightness),i.featureIndex.insert(W,ke,ie,ue,this.index,In)}C.forEach(({buildingId:W,footprintIndex:re})=>{I.has(W)&&(this.footprints[re].hiddenFlags|=4)});const q=new Set;this.buildingIds.forEach((W,re,ie)=>{I.has(W)||q.add(W)}),this.buildingIds=q,this.groundEffect.prepareBorderSegments()}update(r,i,c,d,m,g,v){this.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v),this.groundEffect.update(r,i,m,c,d,g,v),this.evaluate(this.layers[0],r),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(r){const i=c=>{c.layoutVertexBuffer=r.createVertexBuffer(c.layoutVertexArray,yM.members),c.layoutNormalBuffer=r.createVertexBuffer(c.layoutNormalArray,L6.members),c.layoutCentroidBuffer=r.createVertexBuffer(c.layoutCentroidArray,O6.members),c.layoutFloodLightDataBuffer=r.createVertexBuffer(c.layoutFloodLightDataArray,j6.members),c.layoutFacadeDataArray&&c.layoutFacadeDataArray.length&&(c.layoutFacadeDataBuffer=r.createVertexBuffer(c.layoutFacadeDataArray,F6.members)),c.layoutFacadeVerticalRangeArray&&c.layoutFacadeVerticalRangeArray.length&&(c.layoutFacadeVerticalRangeBuffer=r.createVertexBuffer(c.layoutFacadeVerticalRangeArray,B6.members)),c.entranceBloom.layoutVertexArray.length&&(c.entranceBloom.layoutVertexBuffer=r.createVertexBuffer(c.entranceBloom.layoutVertexArray,yM.members),c.entranceBloom.layoutAttenuationBuffer=r.createVertexBuffer(c.entranceBloom.layoutAttenuationArray,N6.members)),this.uploadUpdatedColorBuffer(r),this.uploadUpdatedIndexBuffer(r)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(r)),this.groundEffect.uploadPaintProperties(r),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){const r=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()))};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(r,i,c=!0){let d=!1;const m=c?i:0,g=0|(c?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const v of r){const S=this.footprints[v],E=S.hiddenFlags&g|m;S.hiddenFlags!==E&&(S.hiddenFlags=E,d=!0,this.groundEffect.updateHiddenByLandmarkRange(S.groundEffectVertexOffset,S.groundEffectVertexLength,S.hiddenFlags!==0))}return d&&(this.indexArrayForConflationUploaded=!1),d}uploadUpdatedIndexBuffer(r){if(this.groundEffect.uploadHiddenByLandmark(r),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 m=d.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,g=d.indicesOffset+d.indicesLength;if(d.hiddenFlags!==0){for(let S=d.indicesOffset;S<g;S++)m.indexArrayForConflation.uint16[3*S+0]=0,m.indexArrayForConflation.uint16[3*S+1]=0,m.indexArrayForConflation.uint16[3*S+2]=0;const v=d.bloomIndicesOffset+d.bloomIndicesLength;for(let S=d.bloomIndicesOffset;S<v;S++)m.entranceBloom.indexArrayForConflation.uint16[3*S+0]=0,m.entranceBloom.indexArrayForConflation.uint16[3*S+1]=0,m.entranceBloom.indexArrayForConflation.uint16[3*S+2]=0}}const c=d=>{d.indexArray.length!==0&&(d.indexBuffer?d.indexBuffer.updateData(d.indexArrayForConflation):d.indexBuffer=r.createIndexBuffer(d.indexArrayForConflation,!0),d.entranceBloom.indexBuffer?d.entranceBloom.indexBuffer.updateData(d.entranceBloom.indexArrayForConflation):d.entranceBloom.indexBuffer=r.createIndexBuffer(d.entranceBloom.indexArrayForConflation,!0))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(r){const i=c=>{c.layoutColorBuffer?c.layoutColorBuffer.updateData(c.layoutColorArray):c.layoutColorBuffer=r.createVertexBuffer(c.layoutColorArray,vM.members,!0),c.layoutFacadePaintArray&&(c.layoutFacadePaintBuffer?c.layoutFacadePaintBuffer.updateData(c.layoutFacadePaintArray):c.layoutFacadePaintBuffer=r.createVertexBuffer(c.layoutFacadePaintArray,z6.members,!0)),c.entranceBloom.layoutColorBuffer?c.entranceBloom.layoutColorBuffer.updateData(c.entranceBloom.layoutColorArray):c.entranceBloom.layoutColorBuffer=r.createVertexBuffer(c.entranceBloom.layoutColorArray,vM.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(r,i){const c=r.paint.get("building-ambient-occlusion-intensity");for(const d of this.footprints){if(4&d.hiddenFlags)continue;const m=i[d.promoteId],g=d.feature;g.properties["building-part"]="roof";const v=r.paint.get("building-color").evaluate(g,m,this.canonical).toPremultipliedRenderColor(this.lut),S=r.paint.get("building-emissive-strength").evaluate(g,m,this.canonical);g.properties["building-part"]="wall";const E=r.paint.get("building-color").evaluate(g,m,this.canonical).toPremultipliedRenderColor(this.lut),C=r.paint.get("building-emissive-strength").evaluate(g,m,this.canonical);g.properties["building-part"]="window";const I=r.paint.get("building-color").evaluate(g,m,this.canonical).toPremultipliedRenderColor(this.lut),R=r.paint.get("building-emissive-strength").evaluate(g,m,this.canonical);g.properties["building-part"]="door";const L=r.paint.get("building-color").evaluate(g,m,this.canonical).toPremultipliedRenderColor(this.lut),z=r.paint.get("building-emissive-strength").evaluate(g,m,this.canonical),U=d.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const W of d.parts){let re,ie=v;W.part===1?(ie=v,re=S):W.part===0?(ie=E,re=C):W.part===2?(ie=I,re=R):W.part===3&&(ie=L,re=z),re=K(re,0,1);for(let ue=0;ue<W.vertexLength;ue++){const ve=W.vertexOffset+ue,me=1+(U.layoutAOArray.uint8[ve]/255-1)*c;U.layoutColorArray.emplace(ve,ie.r*me*255<<8|ie.g*me*255,ie.b*me*255<<8|255*re),d.hasFauxFacade&&U.layoutFacadePaintArray.emplace(ve,255*I.r<<8|255*I.g,255*I.b<<8|255*R)}}const q=d.buildingBloom;if(q)for(let W=0;W<q.vertexLength;W++)U.entranceBloom.layoutColorArray.emplace(q.vertexOffset+W,255*L.r<<8|255*L.g,255*L.b<<8|51*z)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(r,i,c){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const d=i.getReplacementRegionsForTile(r.toUnwrapped());if(Yx(this.activeReplacements,d))return;this.activeReplacements=d;for(const g of this.footprints)g.hiddenFlags&=-2;const m=[];for(const g of this.activeReplacements){if(g.order<=bP)continue;const v=Math.max(1,Math.pow(2,g.footprintTileId.canonical.z-r.canonical.z));for(const S of this.footprints)S.min.x>g.max.x||S.max.x<g.min.x||S.min.y>g.max.y||S.max.y<g.min.y||(m.length=0,G6(this.footprintsVertices,S.footprintVertexOffset,S.footprintVertexLength,g.footprintTileId.canonical,r.canonical,m),hT(g.footprint,m,this.footprintsIndices.uint16,S.footprintIndexOffset,S.footprintIndexLength,0,-v)&&(S.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const g of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(g.groundEffectVertexOffset,g.groundEffectVertexLength,g.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(r){if(r.id!==void 0){const i=this.featureFootprintLookup.get(r.id);return this.footprints[i]}return null}getHeightAtTileCoord(r,i){let c=Number.NEGATIVE_INFINITY,d=!0;const m=4*(r+bt)*bt+(i+bt);if(this.footprintLookup.hasOwnProperty(m)){const v=this.footprintLookup[m];return v?{height:v.height,hidden:v.hiddenFlags!==0}:void 0}const g=new it(r,i);for(const v of this.footprints)r>v.max.x||v.min.x>r||i>v.max.y||v.min.y>i||v.height<=c||$6(g,this.footprintsVertices.float32.subarray(2*v.footprintVertexOffset,2*(v.footprintVertexOffset+v.footprintVertexLength)),this.footprintsIndices.uint16.subarray(v.footprintIndexOffset,v.footprintIndexOffset+v.footprintIndexLength))&&(c=v.height,this.footprintLookup[m]=v,d=v.hiddenFlags!==0);if(c!==Number.NEGATIVE_INFINITY)return{height:c,hidden:d};this.footprintLookup[m]=void 0}}function $6(a,r,i){for(let c=0;c<i.length;c+=3){const d=i[c],m=i[c+1],g=i[c+2],v=r[2*d+0],S=r[2*d+1],E=r[2*m+0],C=r[2*m+1],I=r[2*g+0],R=r[2*g+1],L=(v-I)*(a.y-R)-(S-R)*(a.x-I),z=(E-v)*(a.y-S)-(C-S)*(a.x-v);if(L<0!=z<0&&L!==0&&z!==0)continue;const U=(I-E)*(a.y-C)-(R-C)*(a.x-E);if(U===0||U<0==L+z<=0)return!0}return!1}function G6(a,r,i,c,d,m){const g=Math.pow(2,c.z-d.z);for(let v=0;v<i;v++){let S=a.float32[2*(v+r)+0],E=a.float32[2*(v+r)+1];S=(S+d.x*bt)*g-c.x*bt,E=(E+d.y*bt)*g-c.y*bt,m.push(new it(S,E))}}let bM,SM;Ut(wM,"BuildingBucket",{omit:["layers"]}),Ut(DT,"BuildingGeometry"),Ut(RT,"BuildingBloomGeometry");const H6=Br([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),W6=Br([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:q6}=H6,K6=Br([{name:"a_packed",components:3,type:"Float32"}]),{members:Z6}=K6,X6=Br([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Y6}=X6;class TM{constructor(r,i){this.width=r,this.height=i,this.nextRow=0,this.image=new xd({width:r,height:i}),this.positions={},this.uploaded=!1}getDash(r,i){const c=this.getKey(r,i);return this.positions[c]}trim(){const r=this.width,i=this.height=$e(this.nextRow);this.image.resize({width:r,height:i})}getKey(r,i){return r.join(",")+i}getDashRanges(r,i,c){const d=[];let m=r.length%2==1?-r[r.length-1]*c:0,g=r[0]*c,v=!0;d.push({left:m,right:g,isDash:v,zeroLength:r[0]===0});let S=r[0];for(let E=1;E<r.length;E++){v=!v;const C=r[E];m=S*c,S+=C,g=S*c,d.push({left:m,right:g,isDash:v,zeroLength:C===0})}return d}addRoundDash(r,i,c){const d=i/2;for(let m=-c;m<=c;m++){const g=this.width*(this.nextRow+c+m);let v=0,S=r[v];for(let E=0;E<this.width;E++){E/S.right>1&&(S=r[++v]);const C=Math.abs(E-S.left),I=Math.abs(E-S.right),R=Math.min(C,I);let L;const z=m/c*(d+1);if(S.isDash){const U=d-Math.abs(z);L=Math.sqrt(R*R+U*U)}else L=d-Math.sqrt(R*R+z*z);this.image.data[g+E]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(r,i){for(let S=r.length-1;S>=0;--S){const E=r[S],C=r[S+1];E.zeroLength?r.splice(S,1):C&&C.isDash===E.isDash&&(C.left=E.left,r.splice(S,1))}const c=r[0],d=r[r.length-1];c.isDash===d.isDash&&(c.left=d.left-this.width,d.right=c.right+this.width);const m=this.width*this.nextRow;let g=0,v=r[g];for(let S=0;S<this.width;S++){S/v.right>1&&(v=r[++g]);const E=Math.abs(S-v.left),C=Math.abs(S-v.right),I=Math.min(E,C);this.image.data[m+S]=Math.max(0,Math.min(255,(v.isDash?I:-I)+i+128))}}addDash(r,i){const c=this.getKey(r,i);if(this.positions[c])return this.positions[c];const d=i==="round",m=d?7:0,g=2*m+1;if(this.nextRow+g>this.height)return Ft("LineAtlas out of space"),null;r.length===0&&r.push(1);let v=0;for(let C=0;C<r.length;C++)r[C]<0&&(Ft("Negative value is found in line dasharray, replacing values with 0"),r[C]=0),v+=r[C];if(v!==0){const C=this.width/v,I=this.getDashRanges(r,this.width,C);d?this.addRoundDash(I,C,m):this.addRegularDash(I,i==="square"?.5*C:0)}const S=this.nextRow+m;this.nextRow+=g;const E={tl:[S,m],br:[v,0]};return this.positions[c]=E,E}}Ut(TM,"LineAtlas");const J6=Me.types,Q6=Math.cos(Math.PI/180*37.5),e8=Math.cos(Math.PI/180*5);class LT{constructor(r){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=r.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=r.overscaling,this.pixelRatio=r.pixelRatio,this.layers=r.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=r.index,this.projection=r.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Kp,this.layoutVertexArray2=new Yo,this.patternVertexArray=new Yo,this.indexArray=new Ni,this.programConfigurations=new Fa(r.layers,{zoom:r.zoom,lut:r.lut}),this.segments=new ri,this.maxLineLength=0,this.zOffsetVertexArray=new Yo,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=r.tessellationStep?r.tessellationStep:bt/64,this.worldview=r.worldview,this.hasAppearances=null}updateFootprints(r,i){}updateAppearances(r,i,c,d){}populate(r,i,c,d){this.hasPattern=oT("line",this.layers,this.pixelRatio,i);const m=this.layers[0].layout.get("line-sort-key");this.tileToMeter=J(c);const g=this.layers[0].layout.get("line-elevation-reference");if(g==="hd-road-markup")this.elevationType="road";else{const R=this.layers[0].layout.get("line-z-offset"),L=R.isConstant()&&!R.constantOr(0);this.elevationType=g!=="sea"&&g!=="ground"&&L?"none":"offset",this.elevationType==="offset"&&g==="none"&&Ft(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const v=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&v!==void 0;const S=[];for(const{feature:R,id:L,index:z,sourceLayerIndex:U}of r){const q=this.layers[0]._featureFilter.needGeometry,W=De(R,q);if(!this.layers[0]._featureFilter.filter(new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),W,c))continue;const re=m?m.evaluate(W,{},c):void 0,ie={id:L,properties:R.properties,type:R.type,sourceLayerIndex:U,index:z,geometry:q?W.geometry:Te(R,c,d),patterns:{},sortKey:re};S.push(ie)}m&&S.sort((R,L)=>R.sortKey-L.sortKey);const{lineAtlas:E,featureIndex:C}=i,I=this.addConstantDashes(E);for(const R of S){const{geometry:L,index:z,sourceLayerIndex:U}=R;if(I&&this.addFeatureDashes(R,E),this.hasPattern){const q=aT("line",this.layers,R,this.zoom,this.pixelRatio,i);this.patternFeatures.push(q)}else this.addFeature(R,L,z,c,E.positions,i.availableImages,i.brightness,i.elevationFeatures);C.insert(r[z].feature,L,z,U,this.index)}}addConstantDashes(r){let i=!1;for(const c of this.layers){const d=c.paint.get("line-dasharray").value,m=c.layout.get("line-cap").value;if(d.kind!=="constant"||m.kind!=="constant")i=!0;else{const g=m.value,v=d.value;if(!v)continue;r.addDash(v,g)}}return i}addFeatureDashes(r,i){const c=this.zoom;for(const d of this.layers){const m=d.paint.get("line-dasharray").value,g=d.layout.get("line-cap").value;if(m.kind==="constant"&&g.kind==="constant")continue;let v,S;if(m.kind==="constant"){if(v=m.value,!v)continue}else v=m.evaluate({zoom:c},r);S=g.kind==="constant"?g.value:g.evaluate({zoom:c},r),i.addDash(v,S),r.patterns[d.id]=[i.getKey(v,S)]}}update(r,i,c,d,m,g,v,S){this.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v,S)}addFeatures(r,i,c,d,m,g){for(const v of this.patternFeatures)this.addFeature(v,v.geometry,v.index,i,c,d,g,r.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=r.createVertexBuffer(this.layoutVertexArray2,Z6)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=r.createVertexBuffer(this.patternVertexArray,Y6)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=r.createVertexBuffer(this.zOffsetVertexArray,W6.members,!0)),this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,q6),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(r,i){let c,d;if(i&&i>0?(c=`mapbox_clip_start_${i}`,d=`mapbox_clip_end_${i}`):(c="mapbox_clip_start",d="mapbox_clip_end"),r.properties&&r.properties.hasOwnProperty(c)&&r.properties.hasOwnProperty(d))return{start:+r.properties[c],end:+r.properties[d]}}addFeature(r,i,c,d,m,g,v,S){const E=this.layers[0].layout,C=E.get("line-join").evaluate(r,{}),I=E.get("line-cap").evaluate(r,{}),R=E.get("line-miter-limit"),L=E.get("line-round-limit");this.lineClips=this.lineFeatureClips(r),this.lineFeature=r;const z=!(!r.properties||!r.properties.hasOwnProperty("mapbox_line_metrics"))&&r.properties.mapbox_line_metrics;this.zOffsetValue=E.get("line-z-offset").value;const U=this.layers[0].paint.get("line-width").value;if(U.kind!=="constant"&&U.isLineProgressConstant===!1&&(this.variableWidthValue=U),this.elevationType==="road"){const q=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(r,i,d,S,C,I,R,L)){const[W,re]=this.clipRuntimeLinesToTile(i,1);for(let ie=0;ie<W.length;ie++){const ue=W[ie],ve=re[ie],me={progress:{min:ve.progress.min,max:ve.progress.max},nextDir:this.computeSegNextDir(ve,ue),prevDir:this.computeSegPrevDir(ve,ue)};this.addLine(ue,r,d,C,I,R,L,me,z&&ve.parentIndex>0?ve.parentIndex:null)}this.fillNonElevatedRoadSegment(q)}}else for(let q=0;q<i.length;q++)this.addLine(i[q],r,d,C,I,R,L,void 0,z&&q>0?q:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,m,g,d,v,void 0,this.worldview)}computeSegNextDir(r,i){return r.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(r,i){return i[1].sub(r.prevPoint).unit()}clipLinesToTile(r,i){return ew(r,-i,-i,bt+i,bt+i)}clipRuntimeLinesToTile(r,i){const c=[];return[ew(r,-i,-i,bt+i,bt+i,c),c]}addElevatedRoadFeature(r,i,c,d,m,g,v,S){const E=[],C=pn.getElevationFeature(r,d);if(C){const I=this.clipLinesToTile(i,1),R=this.prepareElevatedLines(I,C,c);for(const L of R)E.push({geometry:L,elevation:C,elevationTileID:c,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(E.length===0)return!1;for(const I of E){const R=this.layoutVertexArray.length;this.addLine(I.geometry,r,c,m,g,v,S);const L=new An(c,I.elevationTileID);if(I.elevation)for(let z=R;z<this.layoutVertexArray.length;z++){const U=new it(this.layoutVertexArray.int16[6*z]>>1,this.layoutVertexArray.int16[6*z+1]>>1),q=L.pointElevation(U,I.elevation,.05);this.updateHeightRange(q),this.zOffsetVertexArray.emplaceBack(q,0,0)}else this.fillNonElevatedRoadSegment(R)}return!0}prepareElevatedLines(r,i,c){if(i.constantHeight!=null)return r;const d=[],m=1/J(c);for(const g of r)u6(g,new an(i,m),0,d);return d}fillNonElevatedRoadSegment(r){for(let i=r;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(r){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,r),this.heightRange.max=Math.max(this.heightRange.max,r)):this.heightRange={min:r,max:r}}addLine(r,i,c,d,m,g,v,S,E){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=E?this.lineFeatureClips(i,E):this.lineClips;const C=d==="none";this.patternJoinNone=this.hasPattern&&C,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const I=S&&S.progress.min>0,R=S&&S.progress.max<1;if(this.lineClips){let Pe={min:this.lineClips.start,max:this.lineClips.end},We=1;if(S){const rt=this.lineClips.end-this.lineClips.start;Pe=function(nt,ut,ht){return{min:zn(nt.min,ut,ht),max:zn(nt.max,ut,ht)}}(S.progress,{min:0,max:1},Pe),rt>0&&(We=(Pe.max-Pe.min)/rt)}const Le=+i.properties.mapbox_clip_feature_len,Xe=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(Le)||Number.isNaN(Xe)){for(let nt=0;nt<r.length-1;nt++)this.totalDistance+=r[nt].dist(r[nt+1]);const rt=this.totalDistance/(Pe.max-Pe.min);this.totalFeatureLength=Number.isFinite(rt)?rt:0,this.lineClips.start=Pe.min,this.lineClips.end=Pe.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=Le,this.distance=Xe*We,this.lineClips.start=Pe.min,this.lineClips.end=Pe.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const L=J6[i.type]==="Polygon";let z=r.length;for(;z>=2&&r[z-1].equals(r[z-2]);)z--;let U=0;for(;U<z-1&&r[U].equals(r[U+1]);)U++;if(z<(L?3:2))return;d==="bevel"&&(g=1.05);const q=this.segments.prepareSegment(10*z,this.layoutVertexArray,this.indexArray);let W,re,ie,ue,ve,me,be,ke;S&&S.prevDir&&(me=S.prevDir.perp()),S&&S.nextDir&&(be=S.nextDir.perp()),this.e1=this.e2=-1,L&&(W=r[z-2],ve=r[U].sub(W)._unit()._perp());for(let Pe=U;Pe<z;Pe++){if(ie=Pe===z-1?L?r[U+1]:void 0:r[Pe+1],ie&&r[Pe].equals(ie))continue;ve&&(ue=ve),W&&(re=W),W=r[Pe],ke=this.evaluateLineProgressFeatures(re?re.dist(W):0),ve=ie?ie.sub(W)._unit()._perp():ue,ue=ue||ve;const We=re&&ie;let Le=We?d:L||C?"butt":m;const Xe=ue.x*ve.x+ue.y*ve.y;if(C){const qe=function(ct){if(ct.patternJoinNone){const St=ct.segmentPoints.length/2,_t=ct.lineSoFar-ct.segmentStart;for(let Yt=0;Yt<St;++Yt){const Lt=ct.segmentPoints[2*Yt+1],Nt=Math.round(ct.segmentPoints[2*Yt])+.5+.25*Lt;ct.patternVertexArray.emplaceBack(Nt,_t,ct.segmentStart),ct.patternVertexArray.emplaceBack(Nt,_t,ct.segmentStart)}ct.segmentPoints.length=0}ct.e1=ct.e2=-1};if(We&&Xe<e8){this.updateDistance(re,W),this.addCurrentVertex(W,ue,1,1,q,ke),qe(this),this.addCurrentVertex(W,ve,-1,-1,q,ke);continue}if(re){if(!ie){this.updateDistance(re,W),this.addCurrentVertex(W,ue,1,1,q,ke),qe(this);continue}Le="miter"}}let rt=ue.add(ve);rt.x===0&&rt.y===0||rt._unit();const nt=rt.x*ve.x+rt.y*ve.y,ut=nt!==0?1/nt:1/0,ht=2*Math.sqrt(2-2*nt),at=nt<Q6&&re&&ie,lt=ue.x*ve.y-ue.y*ve.x>0,Ze=this.overscaling<=16?15*bt/(512*this.overscaling):0;if(We&&Le==="round"){if(ut<v)Le="miter";else if(ut<=2){const qe=OT(W,-10,bt+10);Le=this.elevationType==="offset"&&(qe||this.hasCrossSlope)?"miter":"fakeround"}}if(Le==="miter"&&ut>g&&(Le="bevel"),Le==="bevel"&&(ut>2&&(Le="flipbevel"),ut<g&&(Le="miter")),re&&!(Le==="miter"&&at)&&this.updateDistance(re,W),Le==="miter")if(at){const qe=W.dist(re);if(qe>2*Ze){const St=W.sub(W.sub(re)._mult(Ze/qe)._round());this.updateDistance(re,St),this.addCurrentVertex(St,ue,0,0,q,ke),re=St}this.updateDistance(re,W),rt._mult(ut),this.addCurrentVertex(W,rt,0,0,q,ke);const ct=W.dist(ie);if(ct>2*Ze){const St=W.add(ie.sub(W)._mult(Ze/ct)._round());this.updateDistance(W,St),this.addCurrentVertex(St,ve,0,0,q,ke),W=St}}else rt._mult(ut),this.addCurrentVertex(W,rt,0,0,q,ke);else if(Le==="flipbevel"){if(ut>100)rt=ve.mult(-1);else{const qe=ut*ue.add(ve).mag()/ue.sub(ve).mag();rt._perp()._mult(qe*(lt?-1:1))}this.addCurrentVertex(W,rt,0,0,q,ke),this.addCurrentVertex(W,rt.mult(-1),0,0,q,ke)}else if(Le==="bevel"||Le==="fakeround"){ke!=null&&re&&this.addCurrentVertex(W,be||ue,-1,-1,q,ke);const qe=W.dist(re)<=2*Ze&&Le!=="bevel",ct=rt.mult(lt?1:-1);ct._mult(ut);const St=ve.mult(lt?-1:1),_t=ue.mult(lt?-1:1),Yt=this.evaluateLineProgressFeatures(this.distance);if(ke==null&&(this.addHalfVertex(W,ct.x,ct.y,!1,!lt,0,q,Yt),qe||this.addHalfVertex(W,ct.x+2*_t.x,ct.y+2*_t.y,!1,lt,0,q,Yt)),Le==="fakeround"){const Lt=Math.round(180*ht/Math.PI/20);this.addHalfVertex(W,_t.x,_t.y,!1,lt,0,q,Yt);for(let Nt=0;Nt<Lt;Nt++){let Ht=Nt/Lt;if(Ht!==.5){const yt=Ht-.5;Ht+=Ht*yt*(Ht-1)*((1.0904+Xe*(Xe*(3.55645-1.43519*Xe)-3.2452))*yt*yt+(.848013+Xe*(.215638*Xe-1.06021)))}const Rr=St.sub(_t)._mult(Ht)._add(_t)._unit();this.addHalfVertex(W,Rr.x,Rr.y,!1,lt,0,q,Yt)}this.addHalfVertex(W,St.x,St.y,!1,lt,0,q,Yt)}qe||ke!=null||this.addHalfVertex(W,ct.x+2*St.x,ct.y+2*St.y,!1,lt,0,q,Yt),ke!=null&&ie&&this.addCurrentVertex(W,me||ve,1,1,q,ke)}else if(Le==="butt")this.addCurrentVertex(W,rt,0,0,q,ke);else if(Le==="square"){if(!re){const qe=I?0:-1;this.addCurrentVertex(W,rt,qe,qe,q,ke)}if(this.addCurrentVertex(W,rt,0,0,q,ke),re){const qe=R?0:1;this.addCurrentVertex(W,rt,qe,qe,q,ke)}}else if(Le==="round"){if(re){const qe=!We&&be?be:ue;this.addCurrentVertex(W,qe,0,0,q,ke),!We&&R||this.addCurrentVertex(W,qe,1,1,q,ke,!0)}if(ie){const qe=!We&&me?me:ve;!We&&I||this.addCurrentVertex(W,qe,-1,-1,q,ke,!0),this.addCurrentVertex(W,qe,0,0,q,ke)}}}}addVerticesTo(r,i,c,d,m,g,v,S,E,C){const I=(i.w-r.w)/this.tessellationStep|0;let R=0;const L=this.scaledDistance;if(I>1){this.lineSoFar=r.w;const U=(i.x-r.x)/I,q=(i.y-r.y)/I,W=(i.z-r.z)/I,re=(i.w-r.w)/I;for(let ie=1;ie<I;++ie){r.x+=U,r.y+=q,r.z+=W,this.lineSoFar+=re,R+=re;const ue=this.evaluateLineProgressFeatures(this.prevDistance+R);this.scaledDistance=(this.prevDistance+R)/this.totalDistance,this.addHalfVertex(r,c,d,C,!1,v,E,ue),this.addHalfVertex(r,m,g,C,!0,-S,E,ue)}}this.lineSoFar=i.w,this.scaledDistance=L;const z=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,c,d,C,!1,v,E,z),this.addHalfVertex(i,m,g,C,!0,-S,E,z)}evaluateLineProgressFeatures(r){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+r)/this.totalFeatureLength):Ft(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(r,i,c,d,m,g,v=!1){const S=i.x+i.y*c,E=i.y-i.x*c,C=i.y*d-i.x,I=-i.y-i.x*d;if(g!=null){const R=this.elevationType==="offset",L=-10,z=bt+10,U=g.zOffset,q=new WP(r.x,r.y,U,this.lineSoFar),W=!!R&&OT(r,L,z),re=this.lineSoFar,ie=this.distance;if(this.currentVertex)if(W){const ue=this.currentVertexIsOutside,ve=this.currentVertex,me=new WP(r.x,r.y,U,this.lineSoFar);if(KP(ve,me,L,z),!OT(me,L,z)){if(ue){this.e1=this.e2=-1,this.distance-=ve.dist(q),this.lineSoFar=ve.w;const be=this.evaluateLineProgressFeatures(ve.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(ve,S,E,v,!1,c,m,be),this.addHalfVertex(ve,C,I,v,!0,-d,m,be),this.prevDistance=this.distance}this.distance=this.prevDistance+ve.dist(me),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(ve,me,S,E,C,I,c,d,m,v),this.distance=ie,this.scaledDistance=this.distance/this.totalDistance}}else{const ue=this.currentVertex;if(this.currentVertexIsOutside){KP(ue,q,L,z),this.e1=this.e2=-1,this.distance-=ue.dist(q),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=ue.w;const ve=this.evaluateLineProgressFeatures(ue.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(ue,S,E,v,!1,c,m,ve),this.addHalfVertex(ue,C,I,v,!0,-d,m,ve),this.prevDistance=this.distance,this.distance=ie,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(ue,q,S,E,C,I,c,d,m,v)}else W||(this.addHalfVertex(r,S,E,v,!1,c,m,g),this.addHalfVertex(r,C,I,v,!0,-d,m,g));this.currentVertex=q,this.currentVertexIsOutside=W,this.lineSoFar=re}else this.addHalfVertex(r,S,E,v,!1,c,m,g),this.addHalfVertex(r,C,I,v,!0,-d,m,g)}addHalfVertex({x:r,y:i},c,d,m,g,v,S,E){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),g||this.segmentPoints.push(this.lineSoFar-this.segmentStart,v)),this.layoutVertexArray.emplaceBack((r<<1)+(m?1:0),(i<<1)+(g?1:0),Math.round(63*c)+128,Math.round(63*d)+128,1+(v===0?0:v<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const I=ur(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,I)}const C=S.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,C),S.primitiveLength++),g?this.e2=C:this.e1=C,E!=null&&this.zOffsetVertexArray.emplaceBack(E.zOffset,E.variableWidth,E.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(r,i){this.prevDistance=this.distance,this.distance+=r.dist(i),this.updateScaledDistance()}}function OT(a,r,i){return a.x<r||a.x>i||a.y<r||a.y>i}let EM,kM;function AM(a,r,i){return r*(bt/(a.tileSize*Math.pow(2,i-a.tileID.overscaledZ)))}Ut(LT,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const CM=(a,r,i)=>(1-i)*a+i*r;function IM(a,r){return 1/AM(a,1,r.tileZoom)}function PM(a,r,i,c){return a.translatePosMatrix(c||r.tileID.projMatrix,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const MM=a=>{const r=[];RM(a)&&r.push("RENDER_LINE_DASH"),a.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");const i=a.paint.get("line-trim-offset");i[0]===0&&i[1]===0||r.push("RENDER_LINE_TRIM_OFFSET"),a.paint.get("line-border-width").constantOr(1)!==0&&r.push("RENDER_LINE_BORDER");const c=a.layout.get("line-join").constantOr("miter")==="none",d=!!a.paint.get("line-pattern").constantOr(1);return c&&d&&r.push("LINE_JOIN_NONE"),r};function RM(a){const r=a.paint.get("line-dasharray").value;return r.kind!=="constant"||r.value}let zT;const DM=()=>zT||(zT={layout:EM||(EM=new hi({"line-cap":new Ct(ze.layout_line["line-cap"]),"line-join":new Ct(ze.layout_line["line-join"]),"line-miter-limit":new vt(ze.layout_line["line-miter-limit"]),"line-round-limit":new vt(ze.layout_line["line-round-limit"]),"line-sort-key":new Ct(ze.layout_line["line-sort-key"]),"line-z-offset":new Ct(ze.layout_line["line-z-offset"]),"line-elevation-reference":new vt(ze.layout_line["line-elevation-reference"]),"line-cross-slope":new vt(ze.layout_line["line-cross-slope"]),visibility:new vt(ze.layout_line.visibility),"line-width-unit":new vt(ze.layout_line["line-width-unit"])})),paint:kM||(kM=new hi({"line-opacity":new Ct(ze.paint_line["line-opacity"]),"line-color":new Ct(ze.paint_line["line-color"]),"line-translate":new vt(ze.paint_line["line-translate"]),"line-translate-anchor":new vt(ze.paint_line["line-translate-anchor"]),"line-width":new Ct(ze.paint_line["line-width"]),"line-gap-width":new Ct(ze.paint_line["line-gap-width"]),"line-offset":new Ct(ze.paint_line["line-offset"]),"line-blur":new Ct(ze.paint_line["line-blur"]),"line-dasharray":new Ct(ze.paint_line["line-dasharray"]),"line-pattern":new Ct(ze.paint_line["line-pattern"]),"line-pattern-cross-fade":new vt(ze.paint_line["line-pattern-cross-fade"]),"line-gradient":new pu(ze.paint_line["line-gradient"]),"line-trim-offset":new vt(ze.paint_line["line-trim-offset"]),"line-trim-fade-range":new vt(ze.paint_line["line-trim-fade-range"]),"line-trim-color":new vt(ze.paint_line["line-trim-color"]),"line-emissive-strength":new Ct(ze.paint_line["line-emissive-strength"]),"line-border-width":new Ct(ze.paint_line["line-border-width"]),"line-border-color":new Ct(ze.paint_line["line-border-color"]),"line-occlusion-opacity":new vt(ze.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},zT);class t8 extends Ct{possiblyEvaluate(r,i){return i=new $n(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(r,i)}evaluate(r,i,c,d){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(r,i,c,d)}}let Ry;function LM(a,r){return r>0?r+2*a:a}const r8=Br([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),n8=Br([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),i8=Br([{name:"a_projected_pos",components:4,type:"Float32"}],4);Br([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const s8=Br([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),o8=Br([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),a8=Br([{name:"a_texb",components:2,type:"Uint16"}]),l8=Br([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),c8=Br([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Br([{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 OM=Br([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),u8=Br([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Br([{name:"triangle",components:3,type:"Uint16"}]),Br([{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"}]),Br([{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"}]),Br([{type:"Float32",name:"offsetX"}]),Br([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var ss=24;function d8(a,r,i){return a.sections.forEach(c=>{c.text=function(d,m,g){const v=m.layout.get("text-transform").evaluate(g,{});return v==="uppercase"?d=d.toLocaleUpperCase():v==="lowercase"&&(d=d.toLocaleLowerCase()),Dl.applyArabicShaping&&(d=Dl.applyArabicShaping(d)),d}(c.text,r,i)}),a}const Dy={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function h8(a){return a==="︶"||a==="﹈"||a==="︸"||a==="﹄"||a==="﹂"||a==="︾"||a==="︼"||a==="︺"||a==="︘"||a==="﹀"||a==="︐"||a==="︓"||a==="︔"||a==="`"||a===" ̄"||a==="︑"||a==="︒"}function f8(a){return a==="︵"||a==="﹇"||a==="︷"||a==="﹃"||a==="﹁"||a==="︽"||a==="︻"||a==="︹"||a==="︗"||a==="︿"}const FT=4294967296,zM=1/FT,FM=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let dw=class{constructor(a=new Uint8Array(16)){this.buf=ArrayBuffer.isView(a)?a:new Uint8Array(a),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(a,r,i=this.length){for(;this.pos<i;){const c=this.readVarint(),d=c>>3,m=this.pos;this.type=7&c,a(d,r,this),this.pos===m&&this.skip(c)}return r}readMessage(a,r){return this.readFields(a,r,this.readVarint()+this.pos)}readFixed32(){const a=this.dataView.getUint32(this.pos,!0);return this.pos+=4,a}readSFixed32(){const a=this.dataView.getInt32(this.pos,!0);return this.pos+=4,a}readFixed64(){const a=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*FT;return this.pos+=8,a}readSFixed64(){const a=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*FT;return this.pos+=8,a}readFloat(){const a=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,a}readDouble(){const a=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,a}readVarint(a){const r=this.buf;let i,c;return c=r[this.pos++],i=127&c,c<128?i:(c=r[this.pos++],i|=(127&c)<<7,c<128?i:(c=r[this.pos++],i|=(127&c)<<14,c<128?i:(c=r[this.pos++],i|=(127&c)<<21,c<128?i:(c=r[this.pos],i|=(15&c)<<28,function(d,m,g){const v=g.buf;let S,E;if(E=v[g.pos++],S=(112&E)>>4,E<128||(E=v[g.pos++],S|=(127&E)<<3,E<128)||(E=v[g.pos++],S|=(127&E)<<10,E<128)||(E=v[g.pos++],S|=(127&E)<<17,E<128)||(E=v[g.pos++],S|=(127&E)<<24,E<128)||(E=v[g.pos++],S|=(1&E)<<31,E<128))return xm(d,S,m);throw new Error("Expected varint not more than 10 bytes")}(i,a,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const a=this.readVarint();return a%2==1?(a+1)/-2:a/2}readBoolean(){return!!this.readVarint()}readString(){const a=this.readVarint()+this.pos,r=this.pos;return this.pos=a,a-r>=12&&FM?FM.decode(this.buf.subarray(r,a)):function(i,c,d){let m="",g=c;for(;g<d;){const v=i[g];let S,E,C,I=null,R=v>239?4:v>223?3:v>191?2:1;if(g+R>d)break;R===1?v<128&&(I=v):R===2?(S=i[g+1],(192&S)==128&&(I=(31&v)<<6|63&S,I<=127&&(I=null))):R===3?(S=i[g+1],E=i[g+2],(192&S)==128&&(192&E)==128&&(I=(15&v)<<12|(63&S)<<6|63&E,(I<=2047||I>=55296&&I<=57343)&&(I=null))):R===4&&(S=i[g+1],E=i[g+2],C=i[g+3],(192&S)==128&&(192&E)==128&&(192&C)==128&&(I=(15&v)<<18|(63&S)<<12|(63&E)<<6|63&C,(I<=65535||I>=1114112)&&(I=null))),I===null?(I=65533,R=1):I>65535&&(I-=65536,m+=String.fromCharCode(I>>>10&1023|55296),I=56320|1023&I),m+=String.fromCharCode(I),g+=R}return m}(this.buf,r,a)}readBytes(){const a=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,a);return this.pos=a,r}readPackedVarint(a=[],r){const i=this.readPackedEnd();for(;this.pos<i;)a.push(this.readVarint(r));return a}readPackedSVarint(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readSVarint());return a}readPackedBoolean(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readBoolean());return a}readPackedFloat(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readFloat());return a}readPackedDouble(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readDouble());return a}readPackedFixed32(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readFixed32());return a}readPackedSFixed32(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readSFixed32());return a}readPackedFixed64(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readFixed64());return a}readPackedSFixed64(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readSFixed64());return a}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(a){const r=7&a;if(r===0)for(;this.buf[this.pos++]>127;);else if(r===2)this.pos=this.readVarint()+this.pos;else if(r===5)this.pos+=4;else{if(r!==1)throw new Error(`Unimplemented type: ${r}`);this.pos+=8}}writeTag(a,r){this.writeVarint(a<<3|r)}realloc(a){let r=this.length||16;for(;r<this.pos+a;)r*=2;if(r!==this.length){const i=new Uint8Array(r);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(a){this.realloc(4),this.dataView.setInt32(this.pos,a,!0),this.pos+=4}writeSFixed32(a){this.realloc(4),this.dataView.setInt32(this.pos,a,!0),this.pos+=4}writeFixed64(a){this.realloc(8),this.dataView.setInt32(this.pos,-1&a,!0),this.dataView.setInt32(this.pos+4,Math.floor(a*zM),!0),this.pos+=8}writeSFixed64(a){this.realloc(8),this.dataView.setInt32(this.pos,-1&a,!0),this.dataView.setInt32(this.pos+4,Math.floor(a*zM),!0),this.pos+=8}writeVarint(a){(a=+a||0)>268435455||a<0?function(r,i){let c,d;if(r>=0?(c=r%4294967296|0,d=r/4294967296|0):(c=~(-r%4294967296),d=~(-r/4294967296),4294967295^c?c=c+1|0:(c=0,d=d+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(m,g,v){v.buf[v.pos++]=127&m|128,m>>>=7,v.buf[v.pos++]=127&m|128,m>>>=7,v.buf[v.pos++]=127&m|128,m>>>=7,v.buf[v.pos++]=127&m|128,v.buf[v.pos]=127&(m>>>=7)}(c,0,i),function(m,g){const v=(7&m)<<4;g.buf[g.pos++]|=v|((m>>>=3)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m)))))}(d,i)}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))}writeSVarint(a){this.writeVarint(a<0?2*-a-1:2*a)}writeBoolean(a){this.writeVarint(+a)}writeString(a){a=String(a),this.realloc(4*a.length),this.pos++;const r=this.pos;this.pos=function(c,d,m){for(let g,v,S=0;S<d.length;S++){if(g=d.charCodeAt(S),g>55295&&g<57344){if(!v){g>56319||S+1===d.length?(c[m++]=239,c[m++]=191,c[m++]=189):v=g;continue}if(g<56320){c[m++]=239,c[m++]=191,c[m++]=189,v=g;continue}g=v-55296<<10|g-56320|65536,v=null}else v&&(c[m++]=239,c[m++]=191,c[m++]=189,v=null);g<128?c[m++]=g:(g<2048?c[m++]=g>>6|192:(g<65536?c[m++]=g>>12|224:(c[m++]=g>>18|240,c[m++]=g>>12&63|128),c[m++]=g>>6&63|128),c[m++]=63&g|128)}return m}(this.buf,a,this.pos);const i=this.pos-r;i>=128&&BM(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeFloat(a){this.realloc(4),this.dataView.setFloat32(this.pos,a,!0),this.pos+=4}writeDouble(a){this.realloc(8),this.dataView.setFloat64(this.pos,a,!0),this.pos+=8}writeBytes(a){const r=a.length;this.writeVarint(r),this.realloc(r);for(let i=0;i<r;i++)this.buf[this.pos++]=a[i]}writeRawMessage(a,r){this.pos++;const i=this.pos;a(r,this);const c=this.pos-i;c>=128&&BM(i,c,this),this.pos=i-1,this.writeVarint(c),this.pos+=c}writeMessage(a,r,i){this.writeTag(a,2),this.writeRawMessage(r,i)}writePackedVarint(a,r){r.length&&this.writeMessage(a,p8,r)}writePackedSVarint(a,r){r.length&&this.writeMessage(a,m8,r)}writePackedBoolean(a,r){r.length&&this.writeMessage(a,y8,r)}writePackedFloat(a,r){r.length&&this.writeMessage(a,g8,r)}writePackedDouble(a,r){r.length&&this.writeMessage(a,_8,r)}writePackedFixed32(a,r){r.length&&this.writeMessage(a,v8,r)}writePackedSFixed32(a,r){r.length&&this.writeMessage(a,x8,r)}writePackedFixed64(a,r){r.length&&this.writeMessage(a,w8,r)}writePackedSFixed64(a,r){r.length&&this.writeMessage(a,b8,r)}writeBytesField(a,r){this.writeTag(a,2),this.writeBytes(r)}writeFixed32Field(a,r){this.writeTag(a,5),this.writeFixed32(r)}writeSFixed32Field(a,r){this.writeTag(a,5),this.writeSFixed32(r)}writeFixed64Field(a,r){this.writeTag(a,1),this.writeFixed64(r)}writeSFixed64Field(a,r){this.writeTag(a,1),this.writeSFixed64(r)}writeVarintField(a,r){this.writeTag(a,0),this.writeVarint(r)}writeSVarintField(a,r){this.writeTag(a,0),this.writeSVarint(r)}writeStringField(a,r){this.writeTag(a,2),this.writeString(r)}writeFloatField(a,r){this.writeTag(a,5),this.writeFloat(r)}writeDoubleField(a,r){this.writeTag(a,1),this.writeDouble(r)}writeBooleanField(a,r){this.writeVarintField(a,+r)}};function xm(a,r,i){return i?4294967296*r+(a>>>0):4294967296*(r>>>0)+(a>>>0)}function BM(a,r,i){const c=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));i.realloc(c);for(let d=i.pos-1;d>=a;d--)i.buf[d+c]=i.buf[d]}function p8(a,r){for(let i=0;i<a.length;i++)r.writeVarint(a[i])}function m8(a,r){for(let i=0;i<a.length;i++)r.writeSVarint(a[i])}function g8(a,r){for(let i=0;i<a.length;i++)r.writeFloat(a[i])}function _8(a,r){for(let i=0;i<a.length;i++)r.writeDouble(a[i])}function y8(a,r){for(let i=0;i<a.length;i++)r.writeBoolean(a[i])}function v8(a,r){for(let i=0;i<a.length;i++)r.writeFixed32(a[i])}function x8(a,r){for(let i=0;i<a.length;i++)r.writeSFixed32(a[i])}function w8(a,r){for(let i=0;i<a.length;i++)r.writeFixed64(a[i])}function b8(a,r){for(let i=0;i<a.length;i++)r.writeSFixed64(a[i])}const BT=3;function S8(a,r,i){r.glyphs=[],a===1&&i.readMessage(T8,r)}function T8(a,r,i){if(a===3){const{id:c,bitmap:d,width:m,height:g,left:v,top:S,advance:E}=i.readMessage(E8,{});r.glyphs.push({id:c,bitmap:new xd({width:m+2*BT,height:g+2*BT},d),metrics:{width:m,height:g,left:v,top:S,advance:E}})}else a===4?r.ascender=i.readSVarint():a===5&&(r.descender=i.readSVarint())}function E8(a,r,i){a===1?r.id=i.readVarint():a===2?r.bitmap=i.readBytes():a===3?r.width=i.readVarint():a===4?r.height=i.readVarint():a===5?r.left=i.readSVarint():a===6?r.top=i.readSVarint():a===7&&(r.advance=i.readVarint())}const NM=BT,ta={horizontal:1,vertical:2,horizontalOnly:3};class Ly{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(r,i){const c=new Ly;return c.scale=r||1,c.fontStack=i,c}static forImage(r){const i=new Ly;return i.image=r,i}}class wm{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(r,i,c){const d=new wm;for(let m=0;m<r.sections.length;m++){const g=r.sections[m];g.image?d.addImageSection(g,c):d.addTextSection(g,i)}return d}length(){return this.text.length}getSection(r){return this.sections[this.sectionIndex[r]]}getSections(){return this.sections}getSectionIndex(r){return this.sectionIndex[r]}getCodePoint(r){return this.text.codePointAt(r)}verticalizePunctuation(r){this.text=function(i,c){let d="";for(let m=0;m<i.length;m++){const g=i.charCodeAt(m+1)||null,v=i.charCodeAt(m-1)||null;d+=!c&&(g&&Fp(g)&&!Dy[i[m+1]]||v&&Fp(v)&&!Dy[i[m-1]])||!Dy[i[m]]?i[m]:Dy[i[m]]}return d}(this.text,r)}trim(){let r=0;for(let c=0;c<this.text.length&&hw[this.text.charCodeAt(c)];c++)r++;let i=this.text.length;for(let c=this.text.length-1;c>=0&&c>=r&&hw[this.text.charCodeAt(c)];c--)i--;this.text=this.text.substring(r,i),this.sectionIndex=this.sectionIndex.slice(r,i)}substring(r,i){const c=new wm;return c.text=this.text.substring(r,i),c.sectionIndex=this.sectionIndex.slice(r,i),c.sections=this.sections,c}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((r,i)=>Math.max(r,this.sections[i].scale),0)}addTextSection(r,i){this.text+=r.text,this.sections.push(Ly.forText(r.scale,r.fontStack||i));const c=this.sections.length-1;for(let d=0;d<r.text.length;++d)this.sectionIndex.push(c)}addImageSection(r,i){const c=r.image?r.image.getPrimary():null;if(!c)return void Ft("Can't add FormattedSection with an empty image.");c.scaleSelf(i);const d=this.getNextImageSectionCharCode();d?(this.text+=String.fromCodePoint(d),this.sections.push(Ly.forImage(c)),this.sectionIndex.push(this.sections.length-1)):Ft("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function NT(a,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U=1){const q=wm.fromFeature(a,d,U);I===ta.vertical&&q.verticalizePunctuation(R);let W=[];const re=function(be,ke,Pe,We,Le,Xe){if(!be)return[];const rt=[],nt=function(lt,Ze,qe,ct,St,_t){let Yt=0;for(let Lt=0;Lt<lt.length();Lt++){const Nt=lt.getSection(Lt);Yt+=jM(lt.getCodePoint(Lt),Nt,ct,St,Ze,_t)}return Yt/Math.max(1,Math.ceil(Yt/qe))}(be,ke,Pe,We,Le,Xe),ut=be.text.indexOf("")>=0;let ht=0;for(let lt=0;lt<be.length();lt++){const Ze=be.getSection(lt),qe=be.getCodePoint(lt);if(hw[qe]||(ht+=jM(qe,Ze,We,Le,ke,Xe)),lt<be.length()-1){const ct=!((at=qe)<11904||!(or["Bopomofo Extended"](at)||or.Bopomofo(at)||or["CJK Compatibility Forms"](at)||or["CJK Compatibility Ideographs"](at)||or["CJK Compatibility"](at)||or["CJK Radicals Supplement"](at)||or["CJK Strokes"](at)||or["CJK Symbols and Punctuation"](at)||or["CJK Unified Ideographs Extension A"](at)||or["CJK Unified Ideographs"](at)||or["Enclosed CJK Letters and Months"](at)||or["Halfwidth and Fullwidth Forms"](at)||or.Hiragana(at)||or["Ideographic Description Characters"](at)||or["Kangxi Radicals"](at)||or["Katakana Phonetic Extensions"](at)||or.Katakana(at)||or["Vertical Forms"](at)||or["Yi Radicals"](at)||or["Yi Syllables"](at)));(k8[qe]||ct||Ze.image)&&rt.push(UM(lt+1,ht,nt,rt,A8(qe,be.getCodePoint(lt+1),ct&&ut),!1))}}var at;return $M(UM(be.length(),ht,nt,rt,0,!0))}(q,E,m,r,c,L),{processBidirectionalText:ie,processStyledBidirectionalText:ue}=Dl;if(ie&&q.sections.length===1){const be=ie(q.toString(),re);for(const ke of be){const Pe=new wm;Pe.text=ke,Pe.sections=q.sections;for(let We=0;We<ke.length;We++)Pe.sectionIndex.push(0);W.push(Pe)}}else if(ue){const be=ue(q.text,q.sectionIndex,re);for(const ke of be){const Pe=new wm;Pe.text=ke[0],Pe.sectionIndex=ke[1],Pe.sections=q.sections,W.push(Pe)}}else W=function(be,ke){const Pe=[],We=be.text;let Le=0;for(const Xe of ke)Pe.push(be.substring(Le,Xe)),Le=Xe;return Le<We.length&&Pe.push(be.substring(Le,We.length)),Pe}(q,re);const ve=[],me={positionedLines:ve,text:q.toString(),top:C[1],bottom:C[1],left:C[0],right:C[0],writingMode:I,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(be,ke,Pe,We,Le,Xe,rt,nt,ut,ht,at,lt){let Ze=0,qe=0,ct=0;const St=nt==="right"?1:nt==="left"?0:.5;let _t=!1;for(const yt of Le){const Wt=yt.getSections();for(const gr of Wt){if(gr.image)continue;const $r=ke[gr.fontStack];if($r&&(_t=$r.ascender!==void 0&&$r.descender!==void 0,!_t))break}if(!_t)break}let Yt=0;for(const yt of Le){yt.trim();const Wt=yt.getMaxScale(),gr=(Wt-1)*ss,$r={positionedGlyphs:[],lineOffset:0};be.positionedLines[Yt]=$r;const qr=$r.positionedGlyphs;let Sr=0;if(!yt.length()){qe+=Xe,++Yt;continue}let Cn=0,ge=0;for(let Ye=0;Ye<yt.length();Ye++){const dt=yt.getSection(Ye),Mt=yt.getSectionIndex(Ye),Rt=yt.getCodePoint(Ye);let Jt=dt.scale,er=null,wr=null,Ir=null,Mr=ss,Nr=0,cr=ut;cr===ta.vertical&&((Lt=Rt)===12312||Lt===12313||Lt===12316||Lt===12540||Lt===12448)&&(cr=ta.horizontal);const mr=!(cr===ta.horizontal||!at&&!zp(Rt)||at&&(hw[Rt]||Bp(Rt)));if(dt.image){const en=We.get(dt.image.toString());if(!en)continue;Ir=dt.image,be.iconsInText=be.iconsInText||!0,wr=en.paddedRect;const ln=en.displaySize;Jt=Jt*ss/lt,er={width:ln[0],height:ln[1],left:0,top:-NM,advance:mr?ln[1]:ln[0],localGlyph:!1},Nr=_t?-er.height*Jt:Wt*ss-17-ln[1]*Jt,Mr=er.advance;const cn=(mr?ln[0]:ln[1])*Jt-ss*Wt;cn>0&&cn>Sr&&(Sr=cn)}else{const en=Pe[dt.fontStack];if(!en)continue;en[Rt]&&(wr=en[Rt]);const ln=ke[dt.fontStack];if(!ln)continue;const cn=ln.glyphs[Rt];if(!cn)continue;if(er=cn.metrics,Mr=Rt!==8203?ss:0,_t){const Sn=ln.ascender!==void 0?Math.abs(ln.ascender):0,Ln=ln.descender!==void 0?Math.abs(ln.descender):0,In=(Sn+Ln)*Jt;Cn<In&&(Cn=In,ge=(Sn-Ln)/2*Jt),Nr=-Sn*Jt}else Nr=(Wt-Jt)*ss-17}mr?(be.verticalizable=!0,qr.push({glyph:Rt,image:Ir,x:Ze,y:qe+Nr,vertical:mr,scale:Jt,localGlyph:er.localGlyph,fontStack:dt.fontStack,sectionIndex:Mt,metrics:er,rect:wr}),Ze+=Mr*Jt+ht):(qr.push({glyph:Rt,image:Ir,x:Ze,y:qe+Nr,vertical:mr,scale:Jt,localGlyph:er.localGlyph,fontStack:dt.fontStack,sectionIndex:Mt,metrics:er,rect:wr}),Ze+=er.advance*Jt+ht)}qr.length!==0&&(ct=Math.max(Ze-ht,ct),_t?GM(qr,St,Sr,ge,Xe*Wt/2):GM(qr,St,Sr,0,Xe/2)),Ze=0;const xe=Xe*Wt+Sr;$r.lineOffset=Math.max(Sr,gr),qe+=xe,++Yt}var Lt;const Nt=qe,{horizontalAlign:Ht,verticalAlign:Rr}=jT(rt);(function(yt,Wt,gr,$r,qr,Sr){const Cn=(Wt-gr)*qr,ge=-Sr*$r;for(const xe of yt)for(const Ye of xe.positionedGlyphs)Ye.x+=Cn,Ye.y+=ge})(be.positionedLines,St,Ht,Rr,ct,Nt),be.top+=-Rr*Nt,be.bottom=be.top+Nt,be.left+=-Ht*ct,be.right=be.left+ct,be.hasBaseline=_t}(me,r,i,c,W,g,v,S,I,E,R,z),!function(be){for(const ke of be)if(ke.positionedGlyphs.length!==0)return!1;return!0}(ve))return me}const hw={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},k8={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 jM(a,r,i,c,d,m){if(r.image){const g=c.get(r.image.toString());return g?g.displaySize[0]*r.scale*ss/m+d:0}{const g=i[r.fontStack],v=g&&g.glyphs[a];return v?v.metrics.advance*r.scale+d:0}}function VM(a,r,i,c){const d=Math.pow(a-r,2);return c?a<r?d/2:2*d:d+Math.abs(i)*i}function A8(a,r,i){let c=0;return a===10&&(c-=1e4),i&&(c+=150),a!==40&&a!==65288||(c+=50),r!==41&&r!==65289||(c+=50),c}function UM(a,r,i,c,d,m){let g=null,v=VM(r,i,d,m);for(const S of c){const E=VM(r-S.x,i,d,m)+S.badness;E<=v&&(g=S,v=E)}return{index:a,x:r,priorBreak:g,badness:v}}function $M(a){return a?$M(a.priorBreak).concat(a.index):[]}function jT(a){let r=.5,i=.5;switch(a){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(a){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:r,verticalAlign:i}}function GM(a,r,i,c,d){if(!(r||i||c||d))return;const m=a.length-1,g=a[m],v=(g.x+g.metrics.advance*g.scale)*r;for(let S=0;S<=m;S++)a[S].x-=v,a[S].y+=i+c+d}function VT(a){return a.imagePrimary!==void 0&&a.top!==void 0&&a.bottom!==void 0&&a.left!==void 0&&a.right!==void 0}function fw(a,r,i,c){const{horizontalAlign:d,verticalAlign:m}=jT(c),g=i[0]-a.displaySize[0]*d,v=i[1]-a.displaySize[1]*m;return{imagePrimary:a,imageSecondary:r,top:v,bottom:v+a.displaySize[1],left:g,right:g+a.displaySize[0]}}function UT(a,r,i,c,d,m){const g=a.imagePrimary;let v;if(g.content){const q=g.content,W=g.pixelRatio||1;v=[q[0]/W,q[1]/W,g.displaySize[0]-q[2]/W,g.displaySize[1]-q[3]/W]}const S=r.left*m,E=r.right*m;let C,I,R,L;i==="width"||i==="both"?(L=d[0]+S-c[3],I=d[0]+E+c[1]):(L=d[0]+(S+E-g.displaySize[0])/2,I=L+g.displaySize[0]);const z=r.top*m,U=r.bottom*m;return i==="height"||i==="both"?(C=d[1]+z-c[0],R=d[1]+U+c[2]):(C=d[1]+(z+U-g.displaySize[1])/2,R=C+g.displaySize[1]),{imagePrimary:g,imageSecondary:void 0,top:C,right:I,bottom:R,left:L,collisionPadding:v}}function HM(a){return!a.imagePrimary.stretchX}function WM(a){return!a.imagePrimary.stretchY}function qM(a){return{width:a.right-a.left,height:a.bottom-a.top}}const $l=128;function bm(a,r,i){const{expression:c}=r;if(c.kind==="constant")return{kind:"constant",layoutSize:c.evaluate(new $n(a+1,{worldview:i}))};if(c.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:m}=c;let g=0;for(;g<d.length&&d[g]<=a;)g++;g=Math.max(0,g-1);let v=g;for(;v<d.length&&d[v]<a+1;)v++;v=Math.min(d.length-1,v);const S=d[g],E=d[v];return c.kind==="composite"?{kind:"composite",minZoom:S,maxZoom:E,interpolationType:m}:{kind:"camera",minZoom:S,maxZoom:E,minSize:c.evaluate(new $n(S,{worldview:i})),maxSize:c.evaluate(new $n(E,{worldview:i})),interpolationType:m}}}function $T(a,{uSize:r,uSizeT:i},{lowerSize:c,upperSize:d}){return a.kind==="source"?c/$l:a.kind==="composite"?ur(c/$l,d/$l,i):r}function Sm(a,r,i=1){let c=0,d=0;if(a.kind==="constant")d=a.layoutSize*i;else if(a.kind!=="source"){const{interpolationType:m,minZoom:g,maxZoom:v}=a,S=m?K(Xo.interpolationFactor(m,r,g,v),0,1):0;a.kind==="camera"?d=ur(a.minSize,a.maxSize,S)*i:c=S*i}return{uSizeT:c,uSize:d}}class bu extends it{constructor(r,i,c,d,m){super(r,i),this.angle=d,this.z=c,m!==void 0&&(this.segment=m)}clone(){return new bu(this.x,this.y,this.z,this.angle,this.segment)}}function KM(a,r,i,c,d){if(r.segment===void 0)return!0;let m=r,g=r.segment+1,v=0;for(;v>-i/2;){if(g--,g<0)return!1;v-=a[g].dist(m),m=a[g]}v+=a[g].dist(a[g+1]),g++;const S=[];let E=0;for(;v<i/2;){const C=a[g],I=a[g+1];if(!I)return!1;let R=a[g-1].angleTo(C)-C.angleTo(I);for(R=Math.abs((R+3*Math.PI)%(2*Math.PI)-Math.PI),S.push({distance:v,angleDelta:R}),E+=R;v-S[0].distance>c;)E-=S.shift().angleDelta;if(E>d)return!1;g++,v+=C.dist(I)}return!0}function ZM(a){let r=0;for(let i=0;i<a.length-1;i++)r+=a[i].dist(a[i+1]);return r}function XM(a,r,i){return a?.6*r*i:0}function YM(a,r){return Math.max(a?a.right-a.left:0,r?r.right-r.left:0)}function C8(a,r,i,c,d,m){const g=XM(i,d,m),v=YM(i,c)*m;let S=0;const E=ZM(a)/2;for(let C=0;C<a.length-1;C++){const I=a[C],R=a[C+1],L=I.dist(R);if(S+L>E){const z=(E-S)/L,U=ur(I.x,R.x,z),q=ur(I.y,R.y,z),W=new bu(U,q,0,R.angleTo(I),C);return!g||KM(a,W,v,g,r)?W:void 0}S+=L}}function I8(a,r,i,c,d,m,g,v,S){const E=XM(c,m,g),C=YM(c,d),I=C*g,R=a[0].x===0||a[0].x===S||a[0].y===0||a[0].y===S;return r-I<r/4&&(r=I+r/4),JM(a,R?r/2*v%r:(C/2+2*m)*g*v%r,r,E,i,I,R,!1,S)}function JM(a,r,i,c,d,m,g,v,S){const E=m/2,C=ZM(a);let I=0,R=r-i,L=[];for(let z=0;z<a.length-1;z++){const U=a[z],q=a[z+1],W=U.dist(q),re=q.angleTo(U);for(;R+i<I+W;){R+=i;const ie=(R-I)/W,ue=ur(U.x,q.x,ie),ve=ur(U.y,q.y,ie);if(ue>=0&&ue<S&&ve>=0&&ve<S&&R-E>=0&&R+E<=C){const me=new bu(ue,ve,0,re,z);c&&!KM(a,me,m,c,d)||L.push(me)}}I+=W}return v||L.length||g||(L=JM(a,I/2,i,c,d,m,g,!0,S)),L}function QM(a){let r=0,i=0;for(const g of a)r+=g.w*g.h,i=Math.max(i,g.w);a.sort((g,v)=>v.h-g.h);const c=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),i),h:1/0}];let d=0,m=0;for(const g of a)for(let v=c.length-1;v>=0;v--){const S=c[v];if(!(g.w>S.w||g.h>S.h)){if(g.x=S.x,g.y=S.y,m=Math.max(m,g.y+g.h),d=Math.max(d,g.x+g.w),g.w===S.w&&g.h===S.h){const E=c.pop();E&&v<c.length&&(c[v]=E)}else g.h===S.h?(S.x+=g.w,S.w-=g.w):g.w===S.w?(S.y+=g.h,S.h-=g.h):(c.push({x:S.x+g.w,y:S.y,w:S.w-g.w,h:g.h}),S.y+=g.h,S.h-=g.h);break}}return{w:d,h:m,fill:r/(d*m)||0}}Ut(bu,"Anchor");const sf=1;class Oy{static getImagePositionScale(r,i,c){if(i&&r){const{sx:d,sy:m}=r;return{x:d,y:m}}return{x:c,y:c}}constructor(r,i,c,d){this.paddedRect=r;const{pixelRatio:m,version:g,stretchX:v,stretchY:S,content:E,sdf:C,usvg:I}=i;this.pixelRatio=m,this.stretchX=v,this.stretchY=S,this.content=E,this.version=g,this.padding=c,this.sdf=C,this.usvg=I,this.scale=Oy.getImagePositionScale(d,I,m)}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 GT(a,r,i){const c=kl.parse(a),d=function(m,g,v=[1,1]){return{x:0,y:0,w:(m.data?m.data.width:m.width*v[0])+2*g,h:(m.data?m.data.height:m.height*v[1])+2*g}}(r,i,[c.sx,c.sy]);return{bin:d,imagePosition:new Oy(d,r,i,c),imageVariant:c}}class eR{constructor(r,i,c){const d=new Map,m=new Map;this.haveRenderCallbacks=[];const g=[];this.addImages(r,d,sf,g),this.addImages(i,m,2,g);const{w:v,h:S}=QM(g),E=new Gs({width:v||1,height:S||1});for(const[C,I]of r.entries()){const R=d.get(C).paddedRect;Gs.copy(I.data,E,{x:0,y:0},{x:R.x+sf,y:R.y+sf},I.data,null,I.sdf)}for(const[C,I]of i.entries()){const R=m.get(C),L=R.paddedRect;let z=R.padding;const U=L.x+z,q=L.y+z,W=I.data.width,re=I.data.height;z=z>1?z-1:z,Gs.copy(I.data,E,{x:0,y:0},{x:U,y:q},I.data,c),Gs.copy(I.data,E,{x:0,y:re-z},{x:U,y:q-z},{width:W,height:z},c),Gs.copy(I.data,E,{x:0,y:0},{x:U,y:q+re},{width:W,height:z},c),Gs.copy(I.data,E,{x:W-z,y:0},{x:U-z,y:q},{width:z,height:re},c),Gs.copy(I.data,E,{x:0,y:0},{x:U+W,y:q},{width:z,height:re},c),Gs.copy(I.data,E,{x:W-z,y:re-z},{x:U-z,y:q-z},{width:z,height:z},c),Gs.copy(I.data,E,{x:0,y:re-z},{x:U+W,y:q-z},{width:z,height:z},c),Gs.copy(I.data,E,{x:0,y:0},{x:U+W,y:q+re},{width:z,height:z},c),Gs.copy(I.data,E,{x:W-z,y:0},{x:U-z,y:q+re},{width:z,height:z},c)}this.lut=c,this.image=E,this.iconPositions=d,this.patternPositions=m}addImages(r,i,c,d){for(const[m,g]of r.entries()){const{bin:v,imagePosition:S,imageVariant:E}=GT(m,g,c);i.set(m,S),d.push(v),g.hasRenderCallback&&this.haveRenderCallbacks.push(E.id)}}patchUpdatedImages(r,i,c){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(d=>r.hasImage(d,c)),r.dispatchRenderCallbacks(this.haveRenderCallbacks,c);for(const d of r.getUpdatedImages(c)){for(const m of this.iconPositions.keys()){const g=kl.parse(m);if(Js.isEqual(g.id,d)){const v=r.getImage(d,c);this.patchUpdatedImage(this.iconPositions.get(m),v,i,null)}}for(const m of this.patternPositions.keys()){const g=kl.parse(m);if(Js.isEqual(g.id,d)){const v=r.getImage(d,c);this.patchUpdatedImage(this.patternPositions.get(m),v,i,this.lut)}}}}patchUpdatedImage(r,i,c,d=null){if(!r||!i||r.version===i.version)return;r.version=i.version;const[m,g]=r.tl,v=r.sdf;if(this.lut||v){const S={width:i.data.width,height:i.data.height},E=new Gs(S);Gs.copy(i.data,E,{x:0,y:0},{x:0,y:0},S,d,v),c.update(E,{position:{x:m,y:g}})}else c.update(i.data,{position:{x:m,y:g}})}}Ut(Oy,"ImagePosition"),Ut(eR,"ImageAtlas");const zy=1e20;function tR(a,r,i,c,d,m,g,v,S){for(let E=r;E<r+c;E++)rR(a,i*m+E,m,d,g,v,S);for(let E=i;E<i+d;E++)rR(a,E*m+r,1,c,g,v,S)}function rR(a,r,i,c,d,m,g){m[0]=0,g[0]=-zy,g[1]=zy,d[0]=a[r];for(let v=1,S=0,E=0;v<c;v++){d[v]=a[r+v*i];const C=v*v;do{const I=m[S];E=(d[v]-d[I]+C-I*I)/(v-I)/2}while(E<=g[S]&&--S>-1);S++,m[S]=v,g[S]=E,g[S+1]=zy}for(let v=0,S=0;v<c;v++){for(;g[S+1]<v;)S++;const E=m[S],C=v-E;a[r+v*i]=d[E]+C*C}}const Gl=2,HT={none:0,ideographs:1,all:2};class Tm{constructor(r,i,c){this.requestManager=r,this.localGlyphMode=i,this.localFontFamily=c,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(r){this.url=r}getGlyphs(r,i){const c=[],d=this.url||Vr.GLYPHS_URL;for(const m in r)for(const g of r[m])c.push({stack:m,id:g});Ae(c,({stack:m,id:g},v)=>{let S=this.entries[m];S||(S=this.entries[m]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let E=S.glyphs[g];if(E!==void 0)return void v(null,{stack:m,id:g,glyph:E});if(E=this._tinySDF(S,m,g),E)return S.glyphs[g]=E,void v(null,{stack:m,id:g,glyph:E});const C=Math.floor(g/256);if(256*C>65535)return Ft("glyphs > 65535 not supported"),void v(null,{stack:m,id:g,glyph:E});if(S.ranges[C])return void v(null,{stack:m,id:g,glyph:E});let I=S.requests[C];I||(I=S.requests[C]=[],Tm.loadGlyphRange(m,C,d,this.requestManager,(R,L)=>{if(L){S.ascender=L.ascender,S.descender=L.descender;for(const z in L.glyphs)this._doesCharSupportLocalGlyph(+z)||(S.glyphs[+z]=L.glyphs[+z]);S.ranges[C]=!0}for(const z of I)z(R,L);delete S.requests[C]})),I.push((R,L)=>{R?v(R):L&&v(null,{stack:m,id:g,glyph:L.glyphs[g]||null})})},(m,g)=>{if(m)i(m);else if(g){const v={};for(const{stack:S,id:E,glyph:C}of g)v[S]===void 0&&(v[S]={}),v[S].glyphs===void 0&&(v[S].glyphs={}),v[S].glyphs[E]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics},v[S].ascender=this.entries[S].ascender,v[S].descender=this.entries[S].descender;i(null,v)}})}_doesCharSupportLocalGlyph(r){return this.localGlyphMode!==HT.none&&(this.localGlyphMode===HT.all?!!this.localFontFamily:!!this.localFontFamily&&(or["CJK Unified Ideographs"](r)||or["Hangul Syllables"](r)||or.Hiragana(r)||or.Katakana(r)||or["CJK Symbols and Punctuation"](r)||or["CJK Unified Ideographs Extension A"](r)||or["CJK Unified Ideographs Extension B"](r)||or.Osage(r)))}_tinySDF(r,i,c){const d=this.localFontFamily;if(!d||!this._doesCharSupportLocalGlyph(c))return;let m=r.tinySDF;if(!m){let U="400";/bold/i.test(i)?U="900":/medium/i.test(i)?U="500":/light/i.test(i)&&(U="200"),m=r.tinySDF=new Tm.TinySDF({fontFamily:d,fontWeight:U,fontSize:24*Gl,buffer:3*Gl,radius:8*Gl}),m.fontWeight=U}if(this.localGlyphs[m.fontWeight][c])return this.localGlyphs[m.fontWeight][c];const g=String.fromCodePoint(c),{data:v,width:S,height:E,glyphWidth:C,glyphHeight:I,glyphLeft:R,glyphTop:L,glyphAdvance:z}=m.draw(g);return this.localGlyphs[m.fontWeight][c]={id:c,bitmap:new xd({width:S,height:E},v),metrics:{width:C/Gl,height:I/Gl,left:R/Gl,top:L/Gl-27,advance:z/Gl,localGlyph:!0}}}}Tm.loadGlyphRange=function(a,r,i,c,d){const m=256*r,g=m+255,v=c.transformRequest(c.normalizeGlyphsURL(i).replace("{fontstack}",a).replace("{range}",`${m}-${g}`),mh.Glyphs);El(v,(S,E)=>{if(S)d(S);else if(E){const C={},I=function(R){return new dw(R).readFields(S8,{})}(E);for(const R of I.glyphs)C[R.id]=R;d(null,{glyphs:C,ascender:I.ascender,descender:I.descender})}})},Tm.TinySDF=class{constructor({fontSize:a=24,buffer:r=3,radius:i=8,cutoff:c=.25,fontFamily:d="sans-serif",fontWeight:m="normal",fontStyle:g="normal",lang:v=null}={}){this.buffer=r,this.cutoff=c,this.radius=i,this.lang=v;const S=this.size=a+4*r,E=this._createCanvas(S),C=this.ctx=E.getContext("2d",{willReadFrequently:!0});C.font=`${g} ${m} ${a}px ${d}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(S*S),this.gridInner=new Float64Array(S*S),this.f=new Float64Array(S),this.z=new Float64Array(S+1),this.v=new Uint16Array(S)}_createCanvas(a){const r=document.createElement("canvas");return r.width=r.height=a,r}draw(a){const{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:c,actualBoundingBoxLeft:d,actualBoundingBoxRight:m}=this.ctx.measureText(a),g=Math.ceil(i),v=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-d))),S=Math.min(this.size-this.buffer,g+Math.ceil(c)),E=v+2*this.buffer,C=S+2*this.buffer,I=Math.max(E*C,0),R=new Uint8ClampedArray(I),L={data:R,width:E,height:C,glyphWidth:v,glyphHeight:S,glyphTop:g,glyphLeft:0,glyphAdvance:r};if(v===0||S===0)return L;const{ctx:z,buffer:U,gridInner:q,gridOuter:W}=this;this.lang&&(z.lang=this.lang),z.clearRect(U,U,v,S),z.fillText(a,U,U+g);const re=z.getImageData(U,U,v,S);W.fill(zy,0,I),q.fill(0,0,I);for(let ie=0;ie<S;ie++)for(let ue=0;ue<v;ue++){const ve=re.data[4*(ie*v+ue)+3]/255;if(ve===0)continue;const me=(ie+U)*E+ue+U;if(ve===1)W[me]=0,q[me]=zy;else{const be=.5-ve;W[me]=be>0?be*be:0,q[me]=be<0?be*be:0}}tR(W,0,0,E,C,E,this.f,this.v,this.z),tR(q,U,U,v,S,E,this.f,this.v,this.z);for(let ie=0;ie<I;ie++){const ue=Math.sqrt(W[ie])-Math.sqrt(q[ie]);R[ie]=Math.round(255-255*(ue/this.radius+this.cutoff))}return L}};const Lc=sf;function nR(a,r){return a+r[1]-r[0]}function WT(a,r,i,c,d=1){const m=[],g=a.imagePrimary,v=g.pixelRatio,S=g.paddedRect.w-2*Lc,E=g.paddedRect.h-2*Lc,C=(a.right-a.left)*d,I=(a.bottom-a.top)*d,R=g.stretchX||[[0,S]],L=g.stretchY||[[0,E]],z=R.reduce(nR,0),U=L.reduce(nR,0),q=S-z,W=E-U;let re=0,ie=z,ue=0,ve=U,me=0,be=q,ke=0,Pe=W;if(g.content&&c){const Le=g.content;re=pw(R,0,Le[0]),ue=pw(L,0,Le[1]),ie=pw(R,Le[0],Le[2]),ve=pw(L,Le[1],Le[3]),me=Le[0]-re,ke=Le[1]-ue,be=Le[2]-Le[0]-ie,Pe=Le[3]-Le[1]-ve}const We=(Le,Xe,rt,nt)=>{const ut=mw(Le.stretch-re,ie,C,a.left*d),ht=gw(Le.fixed-me,be,Le.stretch,z),at=mw(Xe.stretch-ue,ve,I,a.top*d),lt=gw(Xe.fixed-ke,Pe,Xe.stretch,U),Ze=mw(rt.stretch-re,ie,C,a.left*d),qe=gw(rt.fixed-me,be,rt.stretch,z),ct=mw(nt.stretch-ue,ve,I,a.top*d),St=gw(nt.fixed-ke,Pe,nt.stretch,U),_t=new it(ut,at),Yt=new it(Ze,at),Lt=new it(Ze,ct),Nt=new it(ut,ct),Ht=new it(ht/v,lt/v),Rr=new it(qe/v,St/v),yt=r*Math.PI/180;if(yt){const Cn=Math.sin(yt),ge=Math.cos(yt),xe=[ge,-Cn,Cn,ge];_t._matMult(xe),Yt._matMult(xe),Nt._matMult(xe),Lt._matMult(xe)}const Wt=Le.stretch+Le.fixed,gr=rt.stretch+rt.fixed,$r=Xe.stretch+Xe.fixed,qr=nt.stretch+nt.fixed,Sr=a.imageSecondary;return{tl:_t,tr:Yt,bl:Nt,br:Lt,texPrimary:{x:g.paddedRect.x+Lc+Wt,y:g.paddedRect.y+Lc+$r,w:gr-Wt,h:qr-$r},texSecondary:Sr?{x:Sr.paddedRect.x+Lc+Wt,y:Sr.paddedRect.y+Lc+$r,w:gr-Wt,h:qr-$r}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ht,pixelOffsetBR:Rr,minFontScaleX:be/v/C,minFontScaleY:Pe/v/I,isSDF:i}};if(c&&(g.stretchX||g.stretchY)){const Le=iR(R,q,z),Xe=iR(L,W,U);for(let rt=0;rt<Le.length-1;rt++){const nt=Le[rt],ut=Le[rt+1];for(let ht=0;ht<Xe.length-1;ht++)m.push(We(nt,Xe[ht],ut,Xe[ht+1]))}}else m.push(We({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:S+1},{fixed:0,stretch:E+1}));return m}function P8(a,r){const i=a.stretchY||[[0,a.paddedRect.h-2*Lc]];return r&&(a.stretchX||a.stretchY)?sR(a.stretchX||[[0,a.paddedRect.w-2*Lc]])*sR(i):1}function pw(a,r,i){let c=0;for(const d of a)c+=Math.max(r,Math.min(i,d[1]))-Math.max(r,Math.min(i,d[0]));return c}function iR(a,r,i){const c=[{fixed:-Lc,stretch:0}];for(const[d,m]of a){const g=c[c.length-1];c.push({fixed:d-g.stretch,stretch:g.stretch}),c.push({fixed:d-g.stretch,stretch:g.stretch+(m-d)})}return c.push({fixed:r+Lc,stretch:i}),c}function sR(a){return 2*a.length+1}function mw(a,r,i,c){return a/r*i+c}function gw(a,r,i,c){return a-r*i/c}function M8(a,r,i,c){const d=r+a.positionedLines[c].lineOffset;return c===0?i+d/2:i+(d+(r+a.positionedLines[c-1].lineOffset))/2}function R8(a,r=1,i=!1){let c=1/0,d=1/0,m=-1/0,g=-1/0;const v=a[0];for(let L=0;L<v.length;L++){const z=v[L];(!L||z.x<c)&&(c=z.x),(!L||z.y<d)&&(d=z.y),(!L||z.x>m)&&(m=z.x),(!L||z.y>g)&&(g=z.y)}const S=Math.min(m-c,g-d);let E=S/2;const C=new pp([],D8);if(S===0)return new it(c,d);for(let L=c;L<m;L+=S)for(let z=d;z<g;z+=S)C.push(new Em(L+E,z+E,E,a));let I=function(L){let z=0,U=0,q=0;const W=L[0];for(let re=0,ie=W.length,ue=ie-1;re<ie;ue=re++){const ve=W[re],me=W[ue],be=ve.x*me.y-me.x*ve.y;U+=(ve.x+me.x)*be,q+=(ve.y+me.y)*be,z+=3*be}return new Em(U/z,q/z,0,L)}(a),R=C.length;for(;C.length;){const L=C.pop();(L.d>I.d||!I.d)&&(I=L,i&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,R)),L.max-I.d<=r||(E=L.h/2,C.push(new Em(L.p.x-E,L.p.y-E,E,a)),C.push(new Em(L.p.x+E,L.p.y-E,E,a)),C.push(new Em(L.p.x-E,L.p.y+E,E,a)),C.push(new Em(L.p.x+E,L.p.y+E,E,a)),R+=4)}return i&&(console.log(`num probes: ${R}`),console.log(`best distance: ${I.d}`)),I.p}function D8(a,r){return r.max-a.max}class Em{constructor(r,i,c,d){this.p=new it(r,i),this.h=c,this.d=function(m,g){let v=!1,S=1/0;for(let E=0;E<g.length;E++){const C=g[E];for(let I=0,R=C.length,L=R-1;I<R;L=I++){const z=C[I],U=C[L];z.y>m.y!=U.y>m.y&&m.x<(U.x-z.x)*(m.y-z.y)/(U.y-z.y)+z.x&&(v=!v),S=Math.min(S,vi(m,z,U))}}return(v?1:-1)*Math.sqrt(S)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}}const L8=Object.keys,qT=Number.POSITIVE_INFINITY,O8=Math.sqrt(2);function bd(a,r,i,c,d){const m=VT(a)&&a.collisionPadding?a.collisionPadding:[0,0,0,0],g={top:a.top-m[1],bottom:a.bottom+m[3],left:a.left-m[0],right:a.right+m[2],scaled:!1};return c!==void 0&&function(v,S){v.top*=S,v.bottom*=S,v.left*=S,v.right*=S,v.scaled=!0}(g,c),i&&function(v,S){if(!S)return;const E=zr(S),C=new it(v.left,v.top),I=new it(v.right,v.top),R=new it(v.left,v.bottom),L=new it(v.right,v.bottom),z=new it(0,0);C._rotateAround(E,z),I._rotateAround(E,z),R._rotateAround(E,z),L._rotateAround(E,z),v.left=Math.min(C.x,I.x,R.x,L.x),v.right=Math.max(C.x,I.x,R.x,L.x),v.top=Math.min(C.y,I.y,R.y,L.y),v.bottom=Math.max(C.y,I.y,R.y,L.y)}(g,i),d&&(g.left+=d[0],g.right+=d[0],g.top+=d[1],g.bottom+=d[1]),r?{top:Math.min(r.top,g.top),bottom:Math.max(r.bottom,g.bottom),left:Math.min(r.left,g.left),right:Math.max(r.right,g.right),scaled:r.scaled||g.scaled}:g}function oR(a,[r,i]){let c=0,d=0;if(i===qT){r<0&&(r=0);const m=r/O8;switch(a){case"top-right":case"top-left":d=m-7;break;case"bottom-right":case"bottom-left":d=7-m;break;case"bottom":d=7-r;break;case"top":d=r-7}switch(a){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=r;break;case"right":c=-r}}else{switch(r=Math.abs(r),i=Math.abs(i),a){case"top-right":case"top-left":case"top":d=i-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-i}switch(a){case"top-right":case"bottom-right":case"right":c=-r;break;case"top-left":case"bottom-left":case"left":c=r}}return[c,d]}function z8(a,r,i,c,d,m,g,v,S,E,C,I,R,L){const z=a.layers[0],U=z.appearances;if(U.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const q={iconBBox:null,iconVerticalBBox:null},W={textBBox:null,textVerticalBBox:null},{baseIconRotate:re,baseTextRotate:ie,iconScaleFactor:ue}=function(me,be,ke){const Pe=me.get("icon-rotate").evaluate(be,{},ke),We=me.get("text-rotate").evaluate(be,{},ke),[Le,Xe]=me.get("icon-size-scale-range");return{baseIconRotate:Pe,baseTextRotate:We,iconScaleFactor:K(1,Le,Xe)}}(c,d,m);r&&(q.iconBBox=bd(r,q.iconBBox,re,g),i)&&(q.iconVerticalBBox=bd(i,q.iconVerticalBBox,re+90,g));const ve=yw(I.horizontal);ve&&(W.textBBox=bd(ve,W.textBBox,ie,1,L)),I.vertical&&(W.textVerticalBBox=bd(I.vertical,W.textVerticalBBox,ie+90,1,L));for(const me of U)me.hasIconProperties()&&F8(q,a,z,me,d,m,v,re,g,S,r,E,ue,C),me.hasTextProperties()&&B8(W,z,me,d,m,L,ie,R,ve,I.vertical);return{iconBBox:q.iconBBox,iconVerticalBBox:q.iconVerticalBBox,textBBox:W.textBBox,textVerticalBBox:W.textVerticalBBox}}function F8(a,r,i,c,d,m,g,v,S,E,C,I,R,L){const{appearanceIconOffset:z,appearanceIconRotate:U,appearanceIconSize:q}=function(ue,ve,me,be,ke,Pe,We,Le){const Xe=ue.hasProperty("icon-offset")?ve.getAppearanceValueAndResolveTokens(ue,"icon-offset",me,be,[]):null,rt=Xe&&Array.isArray(Xe)?Xe:ke,nt=ue.hasProperty("icon-rotate")?ve.getAppearanceValueAndResolveTokens(ue,"icon-rotate",me,be,[]):null,ut=typeof nt=="number"?nt:Pe,ht=ue.hasProperty("icon-size")?ve.getAppearanceValueAndResolveTokens(ue,"icon-size",me,be,[]):null;return{appearanceIconOffset:rt,appearanceIconRotate:ut,appearanceIconSize:typeof ht=="number"?ht*Le.iconScaleFactor:We}}(c,i,d,m,g,v,S,E);let W=null,re=null,ie=null;c.hasProperty("icon-image")?ie=function(ue,ve,me,be,ke,Pe,We){let Le=null;const Xe=ve.getAppearanceValueAndResolveTokens(me,"icon-image",be,ke,[]);if(Xe){const rt=ue.getResolvedImageFromTokens(Xe),nt=me.getUnevaluatedProperty("icon-size"),ut=Fy(rt,bm(ue.zoom,nt,ue.worldview),nt,ke,ue.zoom,be,ue.pixelRatio,We,ue.worldview);Le=Pe.get(ut.iconPrimary.toString())}return Le}(r,i,c,d,m,I,R):C&&(ie=C.imagePrimary),ie&&(W=fw(ie,null,z,L),r.allowVerticalPlacement&&(re=fw(ie,null,z,L))),W&&(a.iconBBox=bd(W,a.iconBBox,U,q)),re&&(a.iconVerticalBBox=bd(re,a.iconVerticalBBox,U+90,q))}function B8(a,r,i,c,d,m,g,v,S,E){const{appearanceTextOffset:C,appearanceTextRotate:I,appearanceTextSize:R}=function(z,U,q,W,re,ie,ue){const ve=z.hasProperty("text-offset")?U.getAppearanceValueAndResolveTokens(z,"text-offset",q,W,[]):null,me=ve&&Array.isArray(ve)?[ve[0]*ss,ve[1]*ss]:re,be=z.hasProperty("text-rotate")?U.getAppearanceValueAndResolveTokens(z,"text-rotate",q,W,[]):null,ke=typeof be=="number"?be:ie,Pe=z.hasProperty("text-size")?U.getAppearanceValueAndResolveTokens(z,"text-size",q,W,[]):null;return{appearanceTextOffset:me,appearanceTextRotate:ke,appearanceTextSize:typeof Pe=="number"?Pe:ue}}(i,r,c,d,m,g,v),L=R/v;S&&(a.textBBox=bd(S,a.textBBox,I,L,C)),E&&(a.textVerticalBBox=bd(E,a.textVerticalBBox,I+90,L,C))}function _w(a,r,i,c,d,m,g,v,S){if(!r||!r.usvg)return;const E=qM(c),C=qM(d),I=m!=="both"&&m!=="width"||!HM(c)?1:C.width/E.width,R=m!=="both"&&m!=="height"||!WM(c)?1:C.height/E.height;i.scaleSelf(I,R);const L=i.toString();g.set(L,i),v.set(L,r);const{imagePosition:z}=GT(L,r,sf);S.set(L,z)}function aR(a,r,i,c,d,m,g,v,S){if(!a)return;const E=function(C,I,R,L,z,U){if(C.kind==="camera")return C.maxSize;if(C.kind==="composite"){const q=I.possiblyEvaluate(new $n(C.maxZoom,{worldview:U}),R).evaluate(z,{},R),W=I.possiblyEvaluate(new $n(C.minZoom,{worldview:U}),R).evaluate(z,{},R);return Math.max(q,W)}return I.possiblyEvaluate(new $n(L,{worldview:U})).evaluate(z,{},R)}(r,i,c,d,m,S);return a.scaleSelf(E*v*g)}function Fy(a,r,i,c,d,m,g,v,S){return{iconPrimary:aR(a.getPrimary(),r,i,c,d,m,g,v,S),iconSecondary:aR(a.getSecondary(),r,i,c,d,m,g,v,S)}}function N8(a,r,i){if(!r)return;const c=i.get(a.toString()),d=i.get(r.toString());c&&d&&(c.paddedRect.w===d.paddedRect.w&&c.paddedRect.h===d.paddedRect.h||Ft(`Mismatch in icon variant sizes: ${a.toString()} and ${r.toString()}`),c.usvg!==d.usvg&&Ft(`Mismatch in icon variant image types: ${a.id} and ${r.id}`))}function lR(a,r,i,c){if(!a)return;const d=r.get(i.toString());if(a.imagePrimary=d,c){const m=r.get(c.toString());a.imageSecondary=m}}function j8(a,r){for(const i in a.horizontal)cR(a.horizontal[i],r);cR(a.vertical,r)}function cR(a,r){if(a){for(const i of a.positionedLines)for(const c of i.positionedGlyphs)if(c.image!==null){const d=c.image.toString();c.rect=r.get(d).paddedRect}}}function KT(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function V8(a,r,i,c,d,m,g,v,S){const E=yw(m.horizontal)||m.vertical,C=i.get("icon-text-fit-padding").evaluate(c,{},d);let I,R=r;return r&&S!=="none"&&(a.allowVerticalPlacement&&m.vertical&&(I=UT(r,m.vertical,S,C,v,g)),E&&(R=UT(r,E,S,C,v,g))),{defaultShapedIcon:R,verticallyShapedIcon:I}}function U8(a,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re,ie,ue,ve,me,be){let ke=g.textMaxSize.evaluate(r,{},R);ke===void 0?ke=v*g.textScaleFactor:ke*=g.textScaleFactor;const Pe=a.layers[0].layout,We=ss,Le=v*g.textScaleFactor/We,Xe=yw(i.horizontal)||i.vertical;if(q!=="none"&&a.appearanceFeatureData&&r.index<a.appearanceFeatureData.length){const Lt=a.appearanceFeatureData[r.index];Lt&&(Lt.textShaping=Xe,Lt.iconTextFitPadding=Pe.get("icon-text-fit-padding").evaluate(r,{},R),Lt.fontScale=Le)}const rt=L.name==="globe",nt=a.tilePixelRatio*ke/We,ut=(ct=a.overscaling,a.zoom>18&&ct>2&&(ct>>=1),Math.max(bt/(512*ct),1)*Pe.get("symbol-spacing")),ht=Pe.get("text-padding")*a.tilePixelRatio,at=Pe.get("icon-padding")*a.tilePixelRatio,lt=zr(Pe.get("text-max-angle")),Ze=Pe.get("icon-rotation-alignment")==="map"&&ie!=="point",qe=ut/2;var ct;a.hasAnyIconTextFit===!1&&q!=="none"&&(a.hasAnyIconTextFit=!0);const St=r.properties?+r.properties[Ke]:null,_t=St&&a.elevationFeatureIdToIndex?a.elevationFeatureIdToIndex.get(St):65535,Yt=(Lt,Nt,Ht)=>{if(Nt.x<0||Nt.x>=bt||Nt.y<0||Nt.y>=bt)return;let Rr=null;if(rt){const{x:yt,y:Wt,z:gr}=L.projectTilePoint(Nt.x,Nt.y,Ht);Rr={anchor:new bu(yt,Wt,gr,0,void 0),up:L.upVector(Ht,Nt.x,Nt.y)}}(function(yt,Wt,gr,$r,qr,Sr,Cn,ge,xe,Ye,dt,Mt,Rt,Jt,er,wr,Ir,Mr,Nr,cr,mr,en,ln,cn,Sn,Ln,In,hn,gn,Pr,Hr,ei,ar){const jr=yt.addToLineVertexArray(Wt,$r);let Mn,Fn,Gn,Si,jn,lr,si,Tn=0,Jn=0,Ui=0,os=0,Di=-1,Li=-1;const Ji={};let ko=rp("");const Vn=gr?gr.anchor:Wt,xi=hn!=="none";let Ti=0,Fo=0;if(xe._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Rs=xe.layout.get("text-offset").evaluate(mr,{},Sn);Ti=Rs[0]*ss,Fo=Rs[1]*ss}else Ti=xe.layout.get("text-radial-offset").evaluate(mr,{},Sn)*ss,Fo=qT;if(yt.allowVerticalPlacement&&qr.vertical){const Rs=qr.vertical;if(er)lr=ZT(Rs),ge&&(si=ZT(ge));else{const po=xe.layout.get("text-rotate").evaluate(mr,{},Sn)+90;Gn=vw(Ye,Vn,Wt,dt,Mt,Rt,Rs,Jt,po,wr,ei),ge&&(Si=vw(Ye,Vn,Wt,dt,Mt,Rt,ge,Mr,po,null,Hr))}}if(Sr){const Rs=yt.iconSizeData,po=xe.layout.get("icon-rotate").evaluate(mr,{},Sn),ra=WT(Sr,po,ln,xi,en.iconScaleFactor),Ed=ge?WT(ge,po,ln,xi,en.iconScaleFactor):void 0;Fn=vw(Ye,Vn,Wt,dt,Mt,Rt,Sr,Mr,po,null,Pr);const Rm=function(Kl,tv,CD,eG,ID,PD,tG,rG){const MD=Kl.layers[0],RD=MD.appearances;let Dm=tv.length;if(CD&&(Dm=Math.max(Dm,CD.length)),RD.length===0)return Dm;const[nG,iG]=eG.get("icon-size-scale-range"),sG=K(1,nG,iG);for(const DD of RD){const LD=DD.getUnevaluatedProperties();if(LD._values["icon-image"].value!==void 0){const OD=MD.getAppearanceValueAndResolveTokens(DD,"icon-image",ID,PD,[]);if(OD){const zD=Kl.getResolvedImageFromTokens(OD);if(zD){const FD=LD._values["icon-size"],oG=Fy(zD,bm(Kl.zoom,FD,Kl.worldview),FD,PD,Kl.zoom,ID,Kl.pixelRatio,sG,Kl.worldview),aG=tG.get(oG.iconPrimary.toString());Dm=Math.max(Dm,P8(aG,rG))}}}}return Dm}(yt,ra,Ed,xe.layout,mr,Sn,yt.iconAtlasPositions,xi);Tn=4*Rm;let ql=null;Rs.kind==="source"?(ql=[$l*xe.layout.get("icon-size").evaluate(mr,{},Sn)*en.iconScaleFactor],ql[0]>Su&&Ft(`${yt.layerIds[0]}: Value for "icon-size" is >= ${By}. Reduce your "icon-size".`)):Rs.kind==="composite"&&(ql=[$l*en.compositeIconSizes[0].evaluate(mr,{},Sn)*en.iconScaleFactor,$l*en.compositeIconSizes[1].evaluate(mr,{},Sn)*en.iconScaleFactor],(ql[0]>Su||ql[1]>Su)&&Ft(`${yt.layerIds[0]}: Value for "icon-size" is >= ${By}. Reduce your "icon-size".`)),yt.addSymbols(yt.icon,ra,ql,cr,Nr,mr,void 0,gr,Wt,jr.lineStartIndex,jr.lineLength,-1,cn,Sn,Ln,In,yt.symbolInstances.length,Rm),Di=yt.icon.placedSymbolArray.length-1,Ed&&(Jn=4*Rm,yt.addSymbols(yt.icon,Ed,ql,cr,Nr,mr,ta.vertical,gr,Wt,jr.lineStartIndex,jr.lineLength,-1,cn,Sn,Ln,In,yt.symbolInstances.length,Rm),Li=yt.icon.placedSymbolArray.length-1)}for(const Rs in qr.horizontal){const po=Rs,ra=qr.horizontal[po];Mn||(ko=rp(ra.text),er?jn=ZT(ra):Mn=vw(Ye,Vn,Wt,dt,Mt,Rt,ra,Jt,xe.layout.get("text-rotate").evaluate(mr,{},Sn),wr,ei));const Ed=ra.positionedLines.length===1;if(Ui+=uR(yt,gr,Wt,ra,Cn,xe,er,mr,wr,jr,qr.vertical?ta.horizontal:ta.horizontalOnly,Ed?L8(qr.horizontal):[po],Ji,Di,en,cn,Sn,yt.symbolInstances.length,Ln),Ed)break}qr.vertical&&(os+=uR(yt,gr,Wt,qr.vertical,Cn,xe,er,mr,wr,jr,ta.vertical,["vertical"],Ji,Li,en,cn,Sn,yt.symbolInstances.length,Ln));let $i=-1;const pl=(Rs,po)=>Rs?Math.max(Rs,po):po;$i=pl(jn,$i),$i=pl(lr,$i),$i=pl(si,$i);const Oc=$i>-1?1:0;yt.glyphOffsetArray.length>=65535&&Ft("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),mr.sortKey!==void 0&&yt.addToSortKeyRanges(yt.symbolInstances.length,mr.sortKey),yt.symbolInstances.emplaceBack(Wt.x,Wt.y,Vn.x,Vn.y,Vn.z,Ji.right>=0?Ji.right:-1,Ji.center>=0?Ji.center:-1,Ji.left>=0?Ji.left:-1,Ji.vertical>=0?Ji.vertical:-1,Di,Li,ko,Mn!==void 0?Mn:yt.collisionBoxArray.length,Mn!==void 0?Mn+1:yt.collisionBoxArray.length,Gn!==void 0?Gn:yt.collisionBoxArray.length,Gn!==void 0?Gn+1:yt.collisionBoxArray.length,Fn!==void 0?Fn:yt.collisionBoxArray.length,Fn!==void 0?Fn+1:yt.collisionBoxArray.length,Si||yt.collisionBoxArray.length,Si?Si+1:yt.collisionBoxArray.length,dt,Ui,os,Tn,Jn,Oc,0,Ti,Fo,$i,0,xi?1:0,gn)})(a,Nt,Rr,Lt,i,c,m,d,a.layers[0],a.collisionBoxArray,r.index,r.sourceLayerIndex,a.index,ht,re,E,0,at,Ze,W,r,g,C,I,R,z,U,q,_t,ue,ve,me)};if(ie==="line")for(const Lt of ew(r.geometry,0,0,bt,bt)){const Nt=I8(Lt,ut,lt,i.vertical||Xe,c,We,nt,a.overscaling,bt);for(const Ht of Nt)Xe&&$8(a,Xe.text,qe,Ht)||Yt(Lt,Ht,R)}else if(ie==="line-center"){for(const Lt of r.geometry)if(Lt.length>1){const Nt=C8(Lt,lt,i.vertical||Xe,c,We,nt);Nt&&Yt(Lt,Nt,R)}}else if(r.type==="Polygon")for(const Lt of xy(r.geometry,0)){const Nt=R8(Lt,16);Yt(Lt[0],new bu(Nt.x,Nt.y,0,0,void 0),R)}else if(r.type==="LineString")for(const Lt of r.geometry)Yt(Lt,new bu(Lt[0].x,Lt[0].y,0,0,void 0),R);else if(r.type==="Point")for(const Lt of r.geometry)for(const Nt of Lt)Yt([Nt],new bu(Nt.x,Nt.y,0,0,void 0),R)}const By=255,Su=By*$l;function uR(a,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re){const ie=function(me,be,ke,Pe,We,Le,Xe,rt){const nt=[];if(be.positionedLines.length===0)return nt;const ut=Pe.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,ht=function(ct){const St=ct[0],_t=ct[1],Yt=St*_t;return Yt>0?[St,-_t]:Yt<0?[-St,_t]:St===0?[_t,St]:[_t,-St]}(ke);let at=Math.abs(be.top-be.bottom);for(const ct of be.positionedLines)at-=ct.lineOffset;const lt=be.positionedLines.length,Ze=at/lt;let qe=be.top-ke[1];for(let ct=0;ct<lt;++ct){const St=be.positionedLines[ct];qe=M8(be,Ze,qe,ct);for(const _t of St.positionedGlyphs){if(!_t.rect)continue;const Yt=_t.rect||{};let Lt=NM+1,Nt=!0,Ht=1,Rr=0;if(_t.image){const Ir=Xe.get(_t.image.toString());if(!Ir)continue;if(Ir.sdf){Ft("SDF images are not supported in formatted text and will be ignored.");continue}Nt=!1,Ht=Ir.pixelRatio,Lt=sf/Ht}const yt=(We||rt)&&_t.vertical,Wt=_t.metrics.advance*_t.scale/2,gr=_t.metrics,$r=_t.rect;if($r===null)continue;rt&&be.verticalizable&&(Rr=_t.image?Wt-_t.metrics.width*_t.scale/2:0);const qr=We?[_t.x+Wt,_t.y]:[0,0];let Sr=[0,0],Cn=[0,0],ge=!1;We||(yt?(Cn=[_t.x+Wt+ht[0],_t.y+ht[1]-Rr],ge=!0):Sr=[_t.x+Wt+ke[0],_t.y+ke[1]-Rr]);const xe=$r.w*_t.scale/(Ht*(_t.localGlyph?Gl:1)),Ye=$r.h*_t.scale/(Ht*(_t.localGlyph?Gl:1));let dt,Mt,Rt,Jt;if(yt){const Ir=_t.y-qe,Mr=new it(-Wt,Wt-Ir),Nr=-Math.PI/2,cr=new it(...Cn);dt=new it(-Wt+Sr[0],Sr[1]),dt._rotateAround(Nr,Mr)._add(cr),dt.x+=-Ir+Wt,dt.y-=(gr.left-Lt)*_t.scale;const mr=_t.image?gr.advance*_t.scale:ss*_t.scale,en=String.fromCodePoint(_t.glyph);h8(en)?dt.x+=(1-Lt)*_t.scale:f8(en)?dt.x+=mr-gr.height*_t.scale+(-Lt-1)*_t.scale:dt.x+=_t.image||gr.width+2*Lt===$r.w&&gr.height+2*Lt===$r.h?(mr-Ye)/2:(mr-(gr.height+2*Lt)*_t.scale)/2,Mt=new it(dt.x,dt.y-xe),Rt=new it(dt.x+Ye,dt.y),Jt=new it(dt.x+Ye,dt.y-xe)}else{const Ir=(gr.left-Lt)*_t.scale-Wt+Sr[0],Mr=(-gr.top-Lt)*_t.scale+Sr[1],Nr=Ir+xe,cr=Mr+Ye;dt=new it(Ir,Mr),Mt=new it(Nr,Mr),Rt=new it(Ir,cr),Jt=new it(Nr,cr)}if(ut){let Ir;Ir=We?new it(0,0):ge?new it(ht[0],ht[1]):new it(ke[0],ke[1]),dt._rotateAround(ut,Ir),Mt._rotateAround(ut,Ir),Rt._rotateAround(ut,Ir),Jt._rotateAround(ut,Ir)}const er=new it(0,0),wr=new it(0,0);nt.push({tl:dt,tr:Mt,bl:Rt,br:Jt,texPrimary:Yt,texSecondary:void 0,writingMode:be.writingMode,glyphOffset:qr,sectionIndex:_t.sectionIndex,isSDF:Nt,pixelOffsetTL:er,pixelOffsetBR:wr,minFontScaleX:0,minFontScaleY:0})}}return nt}(0,c,S,m,g,v,d,a.allowVerticalPlacement),ue=a.textSizeData;let ve=null;ue.kind==="source"?(ve=[$l*m.layout.get("text-size").evaluate(v,{},q)*z.textScaleFactor],ve[0]>Su&&Ft(`${a.layerIds[0]}: Value for "text-size" is >= ${By}. Reduce your "text-size".`)):ue.kind==="composite"&&(ve=[$l*z.compositeTextSizes[0].evaluate(v,{},q)*z.textScaleFactor,$l*z.compositeTextSizes[1].evaluate(v,{},q)*z.textScaleFactor],(ve[0]>Su||ve[1]>Su)&&Ft(`${a.layerIds[0]}: Value for "text-size" is >= ${By}. Reduce your "text-size".`)),a.addSymbols(a.text,ie,ve,S,g,v,C,r,i,E.lineStartIndex,E.lineLength,L,U,q,re,!1,W,ie.length);for(const me of I)R[me]=a.text.placedSymbolArray.length-1;return 4*ie.length}function yw(a){for(const r in a)return a[r];return null}function vw(a,r,i,c,d,m,g,v,S,E,C){let I,R,L,z;if(I=C?C.top:g.top,R=C?C.bottom:g.bottom,L=C?C.left:g.left,z=C?C.right:g.right,VT(g)&&g.collisionPadding){const U=g.collisionPadding;L-=U[0],I-=U[1],z+=U[2],R+=U[3]}if(S){const U=new it(L,I),q=new it(z,I),W=new it(L,R),re=new it(z,R),ie=zr(S);let ue=new it(0,0);E&&(ue=new it(E[0],E[1])),U._rotateAround(ie,ue),q._rotateAround(ie,ue),W._rotateAround(ie,ue),re._rotateAround(ie,ue),L=Math.min(U.x,q.x,W.x,re.x),z=Math.max(U.x,q.x,W.x,re.x),I=Math.min(U.y,q.y,W.y,re.y),R=Math.max(U.y,q.y,W.y,re.y)}return a.emplaceBack(r.x,r.y,r.z,i.x,i.y,L,I,z,R,v,c,d,m),a.length-1}function ZT(a){VT(a)&&a.collisionPadding&&(a.top-=a.collisionPadding[1],a.bottom+=a.collisionPadding[3]);const r=a.bottom-a.top;return r>0?Math.max(10,r):null}function $8(a,r,i,c){const d=a.compareText;if(r in d){const m=d[r];for(let g=m.length-1;g>=0;g--)if(c.dist(m[g])<i)return!0}else d[r]=[];return d[r].push(c),!1}function dR(a,r){const i=a.fovAboveCenter,c=a.elevation?a.elevation.getMinElevationBelowMSL()*r:0,d=(a._camera.position[2]*a.worldSize-c)/Math.cos(a._pitch),m=Math.sin(i)*d/Math.sin(Math.max(Math.PI/2-a._pitch-i,.01));let g=Math.sin(a._pitch)*m+d;const v=d*(1/a._horizonShift);if(!a.elevation||a.elevation.exaggeration()===0){let S=Math.max(a.zoom-17,0);a.isOrthographic&&(S/=10),g*=1+S}return Math.min(1.01*g,v)}function Ny(a,r){if(!r.isReprojectedInTileSpace)return{scale:1<<a.z,x:a.x,y:a.y,x2:a.x+1,y2:a.y+1,projection:r};const i=Math.pow(2,-a.z),c=a.x*i,d=(a.x+1)*i,m=a.y*i,g=(a.y+1)*i,v=D(c),S=D(d),E=N(m),C=N(g),I=r.project(v,E),R=r.project(S,E),L=r.project(S,C),z=r.project(v,C);let U=Math.min(I.x,R.x,L.x,z.x),q=Math.min(I.y,R.y,L.y,z.y),W=Math.max(I.x,R.x,L.x,z.x),re=Math.max(I.y,R.y,L.y,z.y);const ie=i/16;function ue(me,be,ke,Pe,We,Le){const Xe=(ke+We)/2,rt=(Pe+Le)/2,nt=r.project(D(Xe),N(rt)),ut=Math.max(0,U-nt.x,q-nt.y,nt.x-W,nt.y-re);U=Math.min(U,nt.x),W=Math.max(W,nt.x),q=Math.min(q,nt.y),re=Math.max(re,nt.y),ut>ie&&(ue(me,nt,ke,Pe,Xe,rt),ue(nt,be,Xe,rt,We,Le))}ue(I,R,c,m,d,m),ue(R,L,d,m,d,g),ue(L,z,d,g,c,g),ue(z,I,c,g,c,m),U-=ie,q-=ie,W+=ie,re+=ie;const ve=1/Math.max(W-U,re-q);return{scale:ve,x:U*ve,y:q*ve,x2:W*ve,y2:re*ve,projection:r}}function hR(a,{x:r,y:i},c=0){return new it(((r-c)*a.scale-a.x)*bt,(i*a.scale-a.y)*bt)}const G8=se(new Float32Array(16));class Sd{constructor(r){this.spec=r,this.name=r.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(r,i){return{x:0,y:0,z:0}}unproject(r,i){return new l(0,0)}projectTilePoint(r,i,c){return{x:r,y:i,z:0}}locationPoint(r,i,c,d=!0){return r._coordinatePoint(r.locationCoordinate(i,c),d)}pixelsPerMeter(r,i){return M(1,r)*i}pixelSpaceConversion(r,i,c){return 1}farthestPixelDistance(r){return dR(r,r.pixelsPerMeter)}pointCoordinate(r,i,c,d){const m=r.horizonLineFromTop(!1),g=new it(i,Math.max(m,c));return r.rayIntersectionCoordinate(r.pointRayIntersection(g,d))}pointCoordinate3D(r,i,c){const d=new it(i,c);if(r.elevation)return r.elevation.pointCoordinate(d);{const m=this.pointCoordinate(r,d.x,d.y,0);return[m.x,m.y,m.z]}}isPointAboveHorizon(r,i){if(r.elevation&&r.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(r,i.x,i.y);const c=r.horizonLineFromTop();return i.y<c}createInversionMatrix(r,i){return G8}createTileMatrix(r,i,c){let d,m,g;const v=c.canonical,S=se(new Float64Array(16));if(this.isReprojectedInTileSpace){const E=Ny(v,this);d=1,m=E.x+c.wrap*E.scale,g=E.y,he(S,S,[d/E.scale,d/E.scale,r.pixelsPerMeter/i])}else d=i/r.zoomScale(v.z),m=(v.x+Math.pow(2,v.z)*c.wrap)*d,g=v.y*d;return oe(S,S,[m,g,0]),he(S,S,[d/bt,d/bt,1]),S}upVector(r,i,c){return[0,0,1]}upVectorScale(r,i,c){return{metersToTile:1}}}class H8 extends Sd{constructor(r){super(r),this.range=[4,7],this.center=r.center||[-96,37.5];const[i,c]=this.parallels=r.parallels||[29.5,45.5],d=Math.sin(zr(i));this.n=(d+Math.sin(zr(c)))/2,this.c=1+d*(2*this.n-d),this.r0=Math.sqrt(this.c)/this.n}project(r,i){const{n:c,c:d,r0:m}=this,g=zr(r-this.center[0]),v=zr(i),S=Math.sqrt(d-2*c*Math.sin(v))/c;return{x:S*Math.sin(g*c),y:S*Math.cos(g*c)-m,z:0}}unproject(r,i){const{n:c,c:d,r0:m}=this,g=m+i;let v=Math.atan2(r,Math.abs(g))*Math.sign(g);g*c<0&&(v-=Math.PI*Math.sign(r)*Math.sign(g));const S=zr(this.center[0])*c;v=fe(v,-Math.PI-S,Math.PI-S);const E=K(Fr(v/c)+this.center[0],-180,180),C=Math.asin(K((d-(r*r+g*g)*c*c)/(2*c),-1,1)),I=K(Fr(C),-j,j);return new l(E,I)}}const jy=1.340264,Vy=-.081106,Uy=893e-6,$y=.003796,xw=Math.sqrt(3)/2;class W8 extends Sd{project(r,i){i=i/180*Math.PI,r=r/180*Math.PI;const c=Math.asin(xw*Math.sin(i)),d=c*c,m=d*d*d;return{x:.5*(r*Math.cos(c)/(xw*(jy+3*Vy*d+m*(7*Uy+9*$y*d)))/Math.PI+.5),y:1-.5*(c*(jy+Vy*d+m*(Uy+$y*d))/Math.PI+1),z:0}}unproject(r,i){r=(2*r-.5)*Math.PI;let c=i=(2*(1-i)-1)*Math.PI,d=c*c,m=d*d*d;for(let C,I,R,L=0;L<12&&(I=c*(jy+Vy*d+m*(Uy+$y*d))-i,R=jy+3*Vy*d+m*(7*Uy+9*$y*d),C=I/R,c=K(c-C,-Math.PI/3,Math.PI/3),d=c*c,m=d*d*d,!(Math.abs(C)<1e-12));++L);const g=xw*r*(jy+3*Vy*d+m*(7*Uy+9*$y*d))/Math.cos(c),v=Math.asin(Math.sin(c)/xw),S=K(180*g/Math.PI,-180,180),E=K(180*v/Math.PI,-j,j);return new l(S,E)}}class q8 extends Sd{constructor(r){super(r),this.wrap=!0,this.supportsWorldCopies=!0}project(r,i){return{x:.5+r/360,y:.5-i/360,z:0}}unproject(r,i){const c=360*(r-.5),d=K(360*(.5-i),-j,j);return new l(c,d)}}const km=Math.PI/2;function ww(a){return Math.tan((km+a)/2)}class K8 extends Sd{constructor(r){super(r),this.center=r.center||[0,30];const[i,c]=this.parallels=r.parallels||[30,30];let d=zr(i),m=zr(c);this.southernCenter=d+m<0,this.southernCenter&&(d=-d,m=-m);const g=Math.cos(d),v=ww(d);this.n=d===m?Math.sin(d):Math.log(g/Math.cos(m))/Math.log(ww(m)/v),this.f=g*Math.pow(ww(d),this.n)/this.n}project(r,i){i=zr(i),this.southernCenter&&(i=-i),r=zr(r-this.center[0]);const c=1e-6,{n:d,f:m}=this;m>0?i<-km+c&&(i=-km+c):i>km-c&&(i=km-c);const g=m/Math.pow(ww(i),d);let v=g*Math.sin(d*r),S=m-g*Math.cos(d*r);return v=.5*(v/Math.PI+.5),S=.5*(S/Math.PI+.5),{x:v,y:this.southernCenter?S:1-S,z:0}}unproject(r,i){r=(2*r-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:c,f:d}=this,m=d-i,g=Math.sign(m),v=Math.sign(c)*Math.sqrt(r*r+m*m);let S=Math.atan2(r,Math.abs(m))*g;m*c<0&&(S-=Math.PI*Math.sign(r)*g);const E=K(Fr(S/c)+this.center[0],-180,180),C=K(Fr(2*Math.atan(Math.pow(d/v,1/c))-km),-j,j);return new l(E,this.southernCenter?-C:C)}}class fR extends Sd{constructor(r){super(r),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(r,i){return{x:T(r),y:A(i),z:0}}unproject(r,i){const c=D(r),d=N(i);return new l(c,d)}}const pR=zr(j);class Z8 extends Sd{project(r,i){const c=(i=zr(i))*i,d=c*c;return{x:.5*((r=zr(r))*(.8707-.131979*c+d*(d*(.003971*c-.001529*d)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+c*(.015085+d*(.028874*c-.044475-.005916*d)))/Math.PI+1),z:0}}unproject(r,i){r=(2*r-.5)*Math.PI;let c=i=(2*(1-i)-1)*Math.PI,d=25,m=0,g=c*c;do{g=c*c;const E=g*g;m=(c*(1.007226+g*(.015085+E*(.028874*g-.044475-.005916*E)))-i)/(1.007226+g*(.045255+E*(.259866*g-.311325-.005916*11*E))),c=K(c-m,-pR,pR)}while(Math.abs(m)>1e-6&&--d>0);g=c*c;const v=K(Fr(r/(.8707+g*(g*(g*g*g*(.003971-.001529*g)-.013791)-.131979))),-180,180),S=Fr(c);return new l(v,S)}}const mR=zr(j);class X8 extends Sd{project(r,i){i=zr(i),r=zr(r);const c=Math.cos(i),d=2/Math.PI,m=Math.acos(c*Math.cos(r/2)),g=Math.sin(m)/m,v=.5*(r*d+2*c*Math.sin(r/2)/g)||0,S=.5*(i+Math.sin(i)/g)||0;return{x:.5*(v/Math.PI+.5),y:1-.5*(S/Math.PI+1),z:0}}unproject(r,i){let c=r=(2*r-.5)*Math.PI,d=i=(2*(1-i)-1)*Math.PI,m=25;const g=1e-6;let v=0,S=0;do{const E=Math.cos(d),C=Math.sin(d),I=2*C*E,R=C*C,L=E*E,z=Math.cos(c/2),U=Math.sin(c/2),q=2*z*U,W=U*U,re=1-L*z*z,ie=re?1/re:0,ue=re?Math.acos(E*z)*Math.sqrt(1/re):0,ve=.5*(2*ue*E*U+2*c/Math.PI)-r,me=.5*(ue*C+d)-i,be=.5*ie*(L*W+ue*E*z*R)+1/Math.PI,ke=ie*(q*I/4-ue*C*U),Pe=.125*ie*(I*U-ue*C*L*q),We=.5*ie*(R*z+ue*W*E)+.5,Le=ke*Pe-We*be;v=(me*ke-ve*We)/Le,S=(ve*Pe-me*be)/Le,c=K(c-v,-Math.PI,Math.PI),d=K(d-S,-mR,mR)}while((Math.abs(v)>g||Math.abs(S)>g)&&--m>0);return new l(Fr(c),Fr(d))}}class gR extends Sd{constructor(r){super(r),this.center=r.center||[0,0],this.parallels=r.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(zr(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(r,i){const{scale:c,cosPhi:d}=this;return{x:zr(r)*d*c+.5,y:-Math.sin(zr(i))/d*c+.5,z:0}}unproject(r,i){const{scale:c,cosPhi:d}=this,m=-(i-.5)/c,g=K(Fr((r-.5)/c)/d,-180,180),v=Math.asin(K(m*d,-1,1)),S=K(Fr(v),-j,j);return new l(g,S)}}class Y8 extends fR{constructor(r){super(r),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(r,i,c){const d=py(r,i,c);return Un(d,d,Hx(Na(c))),{x:d[0],y:d[1],z:d[2]}}locationPoint(r,i,c){const d=gd(i.lat,i.lng),m=un([],d),g=c?r._centerAltitude+c:r.elevation?r.elevation.getAtPointOrZero(r.locationCoordinate(i),r._centerAltitude):r._centerAltitude;Gr(d,d,m,M(1,0)*bt*g);const v=se(new Float64Array(16));return ee(v,r.pixelMatrix,r.globeMatrix),Un(d,d,v),new it(d[0],d[1])}pixelsPerMeter(r,i){return M(1,0)*i}pixelSpaceConversion(r,i,c){const d=M(1,r)*i,m=ur(M(1,45)*i,d,c);return this.pixelsPerMeter(r,i)/m}createTileMatrix(r,i,c){const d=eT(Na(c.canonical));return ee(new Float64Array(16),r.globeMatrix,d)}createInversionMatrix(r,i){const{center:c}=r,d=Hx(Na(i));return Be(d,d,zr(c.lng)),Ie(d,d,zr(c.lat)),he(d,d,[r._pixelsPerMercatorPixel,r._pixelsPerMercatorPixel,1]),Float32Array.from(d)}pointCoordinate(r,i,c,d){return yd(r,i,c,!0)||new ae(0,0)}pointCoordinate3D(r,i,c){const d=this.pointCoordinate(r,i,c,0);return[d.x,d.y,d.z]}isPointAboveHorizon(r,i){return!yd(r,i.x,i.y,!1)}farthestPixelDistance(r){const i=function(d,m){const g=d.cameraToCenterDistance,v=d._centerAltitude*m,S=d._camera,E=d._camera.forward(),C=st([],hr([],E,-g),[0,0,v]),I=d.worldSize/(2*Math.PI),R=[0,0,-I],L=d.width/d.height,z=Math.tan(d.fovAboveCenter),U=hr([],S.up(),z),q=hr([],S.right(),z*L),W=un([],st([],st([],E,U),q)),re=[];let ie;if(new $t(C,W).closestPointOnSphere(R,I,re)){const ue=st([],re,R),ve=Zn([],ue,C);ie=Math.cos(d.fovAboveCenter)*It(ve)}else{const ue=Zn([],C,R),ve=Zn([],R,C);un(ve,ve);const me=It(ue)-I;ie=Math.sqrt(me*(me+2*I));const be=Math.acos(ie/(I+me))-Math.acos(Nn(E,ve));ie*=Math.cos(be)}return 1.01*ie}(r,this.pixelsPerMeter(r.center.lat,r.worldSize)),c=vd(r.zoom);if(c>0){const d=dR(r,M(1,r.center.lat)*r.worldSize),m=r.worldSize/(2*Math.PI),g=Math.max(r.width,r.height)/r.worldSize*Math.PI;return ur(i,d+m*(1-Math.cos(g)),Math.pow(c,10))}return i}upVector(r,i,c){return py(i,c,r,1)}upVectorScale(r){return{metersToTile:hl(Gx(Na(r)))}}}function _R(a){const r=a.parallels,i=!!r&&Math.abs(r[0]+r[1])<.01;switch(a.name){case"mercator":return new fR(a);case"equirectangular":return new q8(a);case"naturalEarth":return new Z8(a);case"equalEarth":return new W8(a);case"winkelTripel":return new X8(a);case"albers":return i?new gR(a):new H8(a);case"lambertConformalConic":return i?new gR(a):new K8(a);case"globe":return new Y8(a)}throw new Error(`Invalid projection name: ${a.name}`)}const J8=Me.types,Q8=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gy(a,r,i,c,d,m,g,v,S,E,C,I,R){const L=v?Math.min(Su,Math.round(v[0])):0,z=v?Math.min(Su,Math.round(v[1])):0;a.emplaceBack(r,i,Math.round(32*c),Math.round(32*d),m,g,(L<<1)+(S?1:0),0+(z<<1),16*E,16*C,256*I,256*R)}function Hy(a,r,i){a.emplaceBack(r,i)}function Wy(a,r,i,c,d,m,g){a.emplaceBack(r,i,c,d,m,g)}const bw=(a,r,i,c)=>{for(let d=0;d<r;d++)a.emplaceBack(i[0],i[1],i[2],c[0],c[1],c[2])};function Am(a,r,i,c,d){a.emplaceBack(r,i,c,d),a.emplaceBack(r,i,c,d),a.emplaceBack(r,i,c,d),a.emplaceBack(r,i,c,d)}function e$(a){for(const r of a.sections)if(BS(r.text))return!0;return!1}class XT{constructor(r){this.layoutVertexArray=new Y_,this.indexArray=new Ni,this.programConfigurations=r,this.segments=new ri,this.dynamicLayoutVertexArray=new Ic,this.opacityVertexArray=new Xp,this.placedSymbolArray=new Fx,this.iconTransitioningVertexArray=new Jo,this.globeExtVertexArray=new J_,this.zOffsetVertexArray=new Ll,this.orientationVertexArray=new ty,this.symbolInstanceIndices=[]}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getIconVertexData(r,i){const c=[],d=this.layoutVertexArray.uint16;for(let m=0;m<i;++m){const g=12*(r+m);c.push(...d.slice(g,g+12))}return c}updateIconVertexData(r,i,c,d,m,g,v,S,E,C,I,R,L){const z=this.layoutVertexArray.uint16,U=12*r;z[U]=i,z[U+1]=c,z[U+2]=d,z[U+3]=m,z[U+4]=g,z[U+5]=v,z[U+6]=S,z[U+7]=E,z[U+8]=C,z[U+9]=I,z[U+10]=R,z[U+11]=L}upload(r,i,c,d,m,g){this.isEmpty()||(c&&(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,r8.members,!!g),this.indexBuffer=r.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=r.createVertexBuffer(this.dynamicLayoutVertexArray,i8.members,!0),this.opacityVertexBuffer=r.createVertexBuffer(this.opacityVertexArray,Q8,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=r.createVertexBuffer(this.iconTransitioningVertexArray,a8.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,n8.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||m)&&(this.zOffsetVertexBuffer=r.createVertexBuffer(this.zOffsetVertexArray,s8.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=r.createVertexBuffer(this.orientationVertexArray,o8.members,!0)),this.opacityVertexBuffer.itemSize=1),(c||d)&&this.programConfigurations.upload(r))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Ut(XT,"SymbolBuffers");class YT{constructor(r,i,c){this.layoutVertexArray=new r,this.layoutAttributes=i,this.indexArray=new c,this.segments=new ri,this.collisionVertexArray=new Q_,this.collisionVertexArrayExt=new Ic}upload(r){this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=r.createVertexBuffer(this.collisionVertexArray,l8.members,!0),this.collisionVertexBufferExt=r.createVertexBuffer(this.collisionVertexArrayExt,c8.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Ut(YT,"CollisionBuffers");class Sw{constructor(r){this.collisionBoxArray=r.collisionBoxArray,this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(g=>g.fqid),this.index=r.index,this.pixelRatio=r.pixelRatio,this.sourceLayerIndex=r.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=se([]),this.placementViewportMatrix=se([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=r.worldview,this.localizable=r.localizable,this.textSizeData=bm(this.zoom,i["text-size"],this.worldview),this.iconSizeData=bm(this.zoom,i["icon-size"],this.worldview);const c=this.layers[0].layout,d=c.get("symbol-sort-key"),m=c.get("symbol-z-order");this.lut=r.lut,this.canOverlap=c.get("text-allow-overlap")||c.get("icon-allow-overlap")||c.get("text-ignore-placement")||c.get("icon-ignore-placement"),this.sortFeaturesByKey=m!=="viewport-y"&&d.constantOr(1)!==void 0,this.sortFeaturesByY=(m==="viewport-y"||m==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=c.get("text-writing-mode").map(g=>ta[g]),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.sourceID=r.sourceID,this.projection=r.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(r){const i=this.layers[0].getAppearances();return!(!i||i.length===0)&&i.some(c=>c.getProperty(r)!=null)}createArrays(){this.text=new XT(new Fa(this.layers,{zoom:this.zoom,lut:this.lut},r=>r.startsWith("text")||r.startsWith("symbol"))),this.icon=new XT(new Fa(this.layers,{zoom:this.zoom,lut:this.lut},r=>r.startsWith("icon")||r.startsWith("symbol"))),this.glyphOffsetArray=new im,this.lineVertexArray=new Nx,this.symbolInstances=new oy}calculateGlyphDependencies(r,i,c,d,m){for(const g of r){const v=g.codePointAt(0);if(v===void 0)break;if(i[v]=!0,d&&m&&v<=65535){const S=Dy[g];S&&(i[S.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(r,i,c,d,m,g){let v=1;const S=r.getUnevaluatedProperties()._values["icon-size"],E=bm(this.zoom,S,this.worldview),C=Sm(E,i);if(E.kind!=="constant"&&E.kind!=="camera"||(v=C.uSize),E.kind==="composite"){const{minZoom:I,maxZoom:R}=E,L=S.possiblyEvaluate(new $n(I,{worldview:this.worldview}),d),z=S.possiblyEvaluate(new $n(R,{worldview:this.worldview}),d),U=L.evaluate(c,{},d,m);v=U+(z.evaluate(c,{},d,m)-U)*C.uSizeT}return E.kind==="source"&&(v=S.possiblyEvaluate(new $n(this.zoom,{worldview:this.worldview}),d).evaluate(c,{},d,m)),v*g}updateFootprints(r,i){}updateReplacement(r,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const c=i.getReplacementRegionsForTile(r.toUnwrapped(),!0);return!Yx(this.activeReplacements,c)&&(this.activeReplacements=c,!0)}getResolvedImageFromTokens(r){return typeof r=="string"?lo.build(r):r}populate(r,i,c,d){const m=this.layers[0],g=m.layout,v=this.projection.name==="globe",S=g.get("text-font"),E=g.get("text-field"),C=g.get("icon-image"),[I,R]=g.get("icon-size-scale-range"),L=K(i.scaleFactor||1,I,R),z=(E.value.kind!=="constant"||E.value.value instanceof ao&&!E.value.value.isEmpty()||E.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),U=C.value.kind!=="constant"||!!C.value.value||Object.keys(C.parameters).length>0,q=this.hasAnyAppearanceProperty("icon-image"),W=g.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!z&&!U&&!q)return;const re=i.iconDependencies,ie=i.glyphDependencies,ue=i.availableImages,ve=new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),me=be=>{const ke=be.id.toString();re.has(ke)?re.get(ke).push(be):re.set(ke,[be])};for(const be of r){const{feature:ke,id:Pe,index:We,sourceLayerIndex:Le}=be,Xe=m._featureFilter.needGeometry,rt=De(ke,Xe);if(!m._featureFilter.filter(ve,rt,c))continue;if(Xe||(rt.geometry=Te(ke,c,d)),v&&ke.type!==1&&c.z<=5){const ct=rt.geometry,St=.98078528056,_t=(Yt,Lt)=>Nn(py(Yt.x,Yt.y,c,1),py(Lt.x,Lt.y,c,1))<St;for(let Yt=0;Yt<ct.length;Yt++)ct[Yt]=ye(ct[Yt],_t)}let nt,ut;if(z){const ct=m.getValueAndResolveTokens("text-field",rt,c,ue),St=ao.factory(ct);e$(St)&&(this.hasRTLText=!0),(!this.hasRTLText||Vh()==="unavailable"||this.hasRTLText&&Dl.isParsed())&&(nt=d8(St,m,rt))}if(U){const ct=m.getValueAndResolveTokens("icon-image",rt,c,ue);ut=this.getResolvedImageFromTokens(ct)}const ht=this.layers[0];let at=!1;if(!ut&&q){const ct=ht.getAppearances();for(const St of ct)if(St.getProperty("icon-image")){const _t=ht.getAppearanceValueAndResolveTokens(St,"icon-image",rt,c,ue);if(_t){ut=this.getResolvedImageFromTokens(_t),at=!0;break}}}if(!nt&&!ut)continue;const lt=this.sortFeaturesByKey?W.evaluate(rt,{},c):void 0,Ze={id:Pe,text:nt,icon:ut,index:We,sourceLayerIndex:Le,geometry:rt.geometry,properties:ke.properties,type:J8[ke.type],sortKey:lt};if(this.features.push(Ze),this.featureToAppearanceIndex[We]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:Pe,properties:ke.properties,usesAppearanceIconAsPlaceholder:at,isUsingAppearanceVertexData:!1,layoutBasedVertexData:[],activeAppearance:null}),ut){const ct=ht._unevaluatedLayout._values,{iconPrimary:St,iconSecondary:_t}=Fy(ut,this.iconSizeData,ct["icon-size"],c,this.zoom,Ze,this.pixelRatio,L,this.worldview);me(St),_t&&(this.hasAnySecondaryIcon=!0,me(_t))}const qe=ht.getAppearances();if(qe.length!==0&&qe.forEach(ct=>{if(!ct.getProperty("icon-image"))return;const St=this.getCombinedIconPrimary(ct,ht,rt,c,ue,Ze,L);St&&me(St)}),nt){const ct=S.evaluate(rt,{},c).join(","),St=g.get("text-rotation-alignment")==="map"&&g.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ta.vertical)>=0;for(const _t of nt.sections)if(_t.image){const Yt=_t.image.getPrimary().scaleSelf(this.pixelRatio),Lt=Yt.id.toString(),Nt=re.get(Lt)||[];Nt.push(Yt),re.set(Lt,Nt)}else{const Yt=Nh(nt.toString()),Lt=_t.fontStack||ct,Nt=ie[Lt]=ie[Lt]||{};this.calculateGlyphDependencies(_t.text,Nt,St,this.allowVerticalPlacement,Yt)}}}if(g.get("symbol-placement")==="line"&&(this.features=function(be){const ke={},Pe={},We=[];let Le=0;function Xe(ht){We.push(be[ht]),Le++}function rt(ht,at,lt){const Ze=Pe[ht];return delete Pe[ht],Pe[at]=Ze,We[Ze].geometry[0].pop(),We[Ze].geometry[0]=We[Ze].geometry[0].concat(lt[0]),Ze}function nt(ht,at,lt){const Ze=ke[at];return delete ke[at],ke[ht]=Ze,We[Ze].geometry[0].shift(),We[Ze].geometry[0]=lt[0].concat(We[Ze].geometry[0]),Ze}function ut(ht,at,lt){const Ze=lt?at[0][at[0].length-1]:at[0][0];return`${ht}:${Ze.x}:${Ze.y}`}for(let ht=0;ht<be.length;ht++){const at=be[ht],lt=at.geometry,Ze=at.text?at.text.toString():null;if(!Ze){Xe(ht);continue}const qe=ut(Ze,lt),ct=ut(Ze,lt,!0);if(qe in Pe&&ct in ke&&Pe[qe]!==ke[ct]){const St=nt(qe,ct,lt),_t=rt(qe,ct,We[St].geometry);delete ke[qe],delete Pe[ct],Pe[ut(Ze,We[_t].geometry,!0)]=_t,We[St].geometry=null}else qe in Pe?rt(qe,ct,lt):ct in ke?nt(qe,ct,lt):(Xe(ht),ke[qe]=Le-1,Pe[ct]=Le-1)}return We.filter(ht=>ht.geometry)}(this.features)),g.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const be of i.elevationFeatures)this.elevationFeatureIdToIndex.set(be.id,this.elevationFeatures.length),this.elevationFeatures.push(be)}}else g.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((be,ke)=>be.sortKey-ke.sortKey)}getCombinedIconPrimary(r,i,c,d,m,g,v){let S,E;const C=r.getUnevaluatedProperties();if(C._values["icon-image"].value!==void 0){const I=i.getAppearanceValueAndResolveTokens(r,"icon-image",c,d,m);S=this.getResolvedImageFromTokens(I)}else{const I=i.getValueAndResolveTokens("icon-image",c,d,m);S=this.getResolvedImageFromTokens(I)}if(S){const I=C._values["icon-size"]||i._unevaluatedLayout._values["icon-size"];E=Fy(S,bm(this.zoom,I,this.worldview),I,d,this.zoom,g,this.pixelRatio,v,this.worldview).iconPrimary}return E}updateAppearanceBasedIconTextures(r,i,c,d){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const m=this.layers[0];let g=!1,v=0;const S=m.layout,[E,C]=S.get("icon-size-scale-range"),I=K(1,E,C);for(let R=0;R<this.symbolInstances.length;R++){const L=this.symbolInstances.get(R),z=this.featureToAppearanceIndex[L.featureIndex],U=z!==void 0?this.appearanceFeatureData[z]:void 0;if(U&&L.placedIconSymbolIndex>=0){const q=U.id,W=i&&q!==void 0?i[String(q)]:void 0,re={type:"Point",id:U.id,properties:U.properties,geometry:[]},ie=this.layers[0].appearances&&this.layers[0].appearances.find(ue=>ue.isActive({globals:d,feature:re,canonical:r,featureState:W}));if(U.activeAppearance===ie){v+=L.numIconVertices;continue}if(ie){U.activeAppearance=ie;const ue=this.getCombinedIconPrimary(ie,m,re,r,c,{sortKey:void 0,text:void 0,icon:null,index:L.featureIndex,sourceLayerIndex:L.featureIndex,geometry:[],properties:U.properties,type:"Point",id:U.id},I);if(!ue)continue;const ve=ue.toString(),me=this.iconAtlasPositions&&this.iconAtlasPositions.get(ve);if(me){const be=m.getAppearanceValueAndResolveTokens(ie,"icon-offset",re,r,c),ke=be&&Array.isArray(be)?be:[0,0];let Pe=fw(me,void 0,ke,m.layout.get("icon-anchor").evaluate(re,{},r));const We=m.getAppearanceValueAndResolveTokens(ie,"icon-rotate",re,r,c),Le=typeof We=="number"?We:0,Xe=me.sdf,rt=m.layout.get("icon-text-fit").constantOr("none");rt!=="none"&&U.textShaping&&U.iconTextFitPadding&&U.fontScale&&(Pe=UT(Pe,U.textShaping,rt,U.iconTextFitPadding,ke,U.fontScale));const nt=this.calculateEffectiveAppearanceIconSize(ie,d.zoom,re,r,c,I),ut=0,ht=1+(Math.min(Su,Math.round(nt*$l))<<1),at=WT(Pe,Le,Xe,rt!=="none",I);U.isUsingAppearanceVertexData||(U.isUsingAppearanceVertexData=!0,U.layoutBasedVertexData=this.icon.getIconVertexData(v,L.numIconVertices));for(let Ze=0;Ze<at.length;++Ze){const qe=at[Ze],ct=U.layoutBasedVertexData[0]||L.tileAnchorX,St=U.layoutBasedVertexData[1]||L.tileAnchorY,_t=16*qe.pixelOffsetTL.x,Yt=16*qe.pixelOffsetTL.y,Lt=16*qe.pixelOffsetBR.x,Nt=16*qe.pixelOffsetBR.y,Ht=16*qe.minFontScaleX,Rr=16*qe.minFontScaleY;this.icon.updateIconVertexData(v,ct,St,Math.round(32*qe.tl.x),Math.round(32*qe.tl.y),qe.texPrimary.x,qe.texPrimary.y,ut,ht,_t,Yt,Ht,Rr),this.icon.updateIconVertexData(v+1,ct,St,Math.round(32*qe.tr.x),Math.round(32*qe.tr.y),qe.texPrimary.x+qe.texPrimary.w,qe.texPrimary.y,ut,ht,Lt,Yt,Ht,Rr),this.icon.updateIconVertexData(v+2,ct,St,Math.round(32*qe.bl.x),Math.round(32*qe.bl.y),qe.texPrimary.x,qe.texPrimary.y+qe.texPrimary.h,ut,ht,_t,Nt,Ht,Rr),this.icon.updateIconVertexData(v+3,ct,St,Math.round(32*qe.br.x),Math.round(32*qe.br.y),qe.texPrimary.x+qe.texPrimary.w,qe.texPrimary.y+qe.texPrimary.h,ut,ht,Lt,Nt,Ht,Rr),v+=4}const lt=L.numIconVertices-4*at.length;for(let Ze=0;Ze<lt;++Ze)this.icon.updateIconVertexData(v+Ze,0,0,0,0,0,0,0,0,0,0,0,0);g=!0}else v+=L.numIconVertices}else if(U.usesAppearanceIconAsPlaceholder)this.layers[0].appearances&&this.layers[0].appearances.length>0&&(this.icon.updateIconVertexData(v,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(v+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(v+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(v+3,0,0,0,0,0,0,0,0,0,0,0,0),g=!0),v+=L.numIconVertices,U.activeAppearance=null;else if(U.isUsingAppearanceVertexData){const ve=U.layoutBasedVertexData.length/12;for(let me=0;me<ve;++me){const be=me*12;this.icon.updateIconVertexData(v+me,U.layoutBasedVertexData[be+0],U.layoutBasedVertexData[be+1],U.layoutBasedVertexData[be+2],U.layoutBasedVertexData[be+3],U.layoutBasedVertexData[be+4],U.layoutBasedVertexData[be+5],U.layoutBasedVertexData[be+6],U.layoutBasedVertexData[be+7],U.layoutBasedVertexData[be+8],U.layoutBasedVertexData[be+9],U.layoutBasedVertexData[be+10],U.layoutBasedVertexData[be+11])}v+=ve,U.isUsingAppearanceVertexData=!1,U.activeAppearance=null,g=!0}else v+=L.numIconVertices,U.activeAppearance=null}}return g}update(r,i,c,d,m,g,v){this.text.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v,this.worldview),this.icon.programConfigurations.updatePaintArrays(r,i,m,c,d,g,v,this.worldview)}updateRoadElevation(r){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const c=J(r),d=1/c;let m=!1,g=!1;for(let v=0;v<this.symbolInstances.length;v++){const S=this.symbolInstances.get(v),E=Ot(1,0,0),C=Ot(0,1,0),{numHorizontalGlyphVertices:I,numVerticalGlyphVertices:R,numIconVertices:L,numVerticalIconVertices:z}=S,U=I>0||R>0,q=L>0,W=this.elevationFeatures[S.elevationFeatureIndex];if(W){const re=new it(S.tileAnchorX,S.tileAnchorY),ie=.075+W.pointElevation(re);S.zOffset!==ie&&(i=!0,S.zOffset=ie),ie!==0&&(this.hasAnyZOffset=!0);const ue=W.computeSlopeNormal(re,d),ve=tn(Ho(),Ot(0,0,1),ue);so(E,E,ve),so(C,C,ve),E[2]*=c,C[2]*=c,E[0]===1&&E[1]===0&&E[2]===0&&C[0]===0&&C[1]===1&&C[2]===0||(m=m||U,g=g||q)}if(U&&(bw(this.text.orientationVertexArray,I,E,C),bw(this.text.orientationVertexArray,R,E,C)),q){const{placedIconSymbolIndex:re,verticalPlacedIconSymbolIndex:ie}=S;re>=0&&bw(this.icon.orientationVertexArray,L,E,C),ie>=0&&bw(this.icon.orientationVertexArray,z,E,C)}}m||(this.text.orientationVertexArray=void 0),g||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const r=(m,g,v)=>{c+=g,c>m.length&&m.resize(c);for(let S=-g;S<0;S++)m.emplace(S+c,v)},i=(m,g,v)=>{d+=g,d>m.length&&m.resize(d);for(let S=-g;S<0;S++)m.emplace(S+d,v)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let c=0,d=0;for(let m=0;m<this.symbolInstances.length;m++){const g=this.symbolInstances.get(m),{numHorizontalGlyphVertices:v,numVerticalGlyphVertices:S,numIconVertices:E}=g,C=g.zOffset,I=E>0;if((v>0||S>0)&&(r(this.text.zOffsetVertexArray,v,C),r(this.text.zOffsetVertexArray,S,C)),I){const{placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:L}=g;R>=0&&i(this.icon.zOffsetVertexArray,E,C),L>=0&&i(this.icon.zOffsetVertexArray,g.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(r,i,c,d,m){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(r),this.iconCollisionBox.upload(r)),this.text.upload(r,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(g=>g.appearances&&g.appearances.length>0)),this.icon.upload(r,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(r,i,c,d){return!!(r&&i&&c)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(r,i,c,d)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=_R(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(r,i){const c=this.lineVertexArray.length;if(r.segment!==void 0)for(const{x:d,y:m}of i)this.lineVertexArray.emplaceBack(d,m);return{lineStartIndex:c,lineLength:this.lineVertexArray.length-c}}addSymbols(r,i,c,d,m,g,v,S,E,C,I,R,L,z,U,q,W,re){const ie=r.indexArray,ue=r.layoutVertexArray,ve=r.globeExtVertexArray,me=r.segments.prepareSegment(4*re,ue,ie,this.canOverlap?g.sortKey:void 0),be=this.glyphOffsetArray.length,ke=me.vertexLength,Pe=this.allowVerticalPlacement&&v===ta.vertical?Math.PI/2:0,We=g.text&&g.text.sections;for(let rt=0;rt<i.length;rt++){const{tl:nt,tr:ut,bl:ht,br:at,texPrimary:lt,texSecondary:Ze,pixelOffsetTL:qe,pixelOffsetBR:ct,minFontScaleX:St,minFontScaleY:_t,glyphOffset:Yt,isSDF:Lt,sectionIndex:Nt}=i[rt],Ht=me.vertexLength,Rr=Yt[1];if(Gy(ue,E.x,E.y,nt.x,Rr+nt.y,lt.x,lt.y,c,Lt,qe.x,qe.y,St,_t),Gy(ue,E.x,E.y,ut.x,Rr+ut.y,lt.x+lt.w,lt.y,c,Lt,ct.x,qe.y,St,_t),Gy(ue,E.x,E.y,ht.x,Rr+ht.y,lt.x,lt.y+lt.h,c,Lt,qe.x,ct.y,St,_t),Gy(ue,E.x,E.y,at.x,Rr+at.y,lt.x+lt.w,lt.y+lt.h,c,Lt,ct.x,ct.y,St,_t),S){const{x:yt,y:Wt,z:gr}=S.anchor,[$r,qr,Sr]=S.up;Wy(ve,yt,Wt,gr,$r,qr,Sr),Wy(ve,yt,Wt,gr,$r,qr,Sr),Wy(ve,yt,Wt,gr,$r,qr,Sr),Wy(ve,yt,Wt,gr,$r,qr,Sr),Am(r.dynamicLayoutVertexArray,yt,Wt,gr,Pe)}else Am(r.dynamicLayoutVertexArray,E.x,E.y,E.z,Pe);if(q){const yt=Ze||lt;Hy(r.iconTransitioningVertexArray,yt.x,yt.y),Hy(r.iconTransitioningVertexArray,yt.x+yt.w,yt.y),Hy(r.iconTransitioningVertexArray,yt.x,yt.y+yt.h),Hy(r.iconTransitioningVertexArray,yt.x+yt.w,yt.y+yt.h)}ie.emplaceBack(Ht,Ht+1,Ht+2),ie.emplaceBack(Ht+1,Ht+2,Ht+3),me.vertexLength+=4,me.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Yt[0]),rt!==i.length-1&&Nt===i[rt+1].sectionIndex||r.programConfigurations.populatePaintArrays(ue.length,g,g.index,{},L,z,U,We&&We[Nt],this.worldview)}const Le=re-i.length;Le!==0&&this._addNullVertices(Le,ue,c,S,ve,r,q,me,ie);const Xe=S?S.anchor:E;r.placedSymbolArray.emplaceBack(Xe.x,Xe.y,Xe.z,E.x,E.y,be,this.glyphOffsetArray.length-be,ke,C,I,E.segment,c?c[0]:0,c?c[1]:0,d[0],d[1],v,0,0,0,R,0),r.symbolInstanceIndices.push(W)}_addNullVertices(r,i,c,d,m,g,v,S,E){for(let C=0;C<r;C++){for(let R=0;R<4;R++)Gy(i,0,0,0,0,0,0,c,!1,0,0,0,0),d&&Wy(m,0,0,0,0,0,0),Am(g.dynamicLayoutVertexArray,0,0,0,0),v&&Hy(g.iconTransitioningVertexArray,0,0);const I=S.vertexLength;E.emplaceBack(I,I+1,I+2),E.emplaceBack(I+1,I+2,I+3),S.vertexLength+=4,S.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(r,i,c,d,m,g,v){r.emplaceBack(i,c,d,m,g,Math.round(v.x),Math.round(v.y))}_addCollisionDebugVertices(r,i,c,d,m,g,v){const S=c.segments.prepareSegment(4,c.layoutVertexArray,c.indexArray),E=S.vertexLength,C=v.tileAnchorX,I=v.tileAnchorY;for(let L=0;L<4;L++)c.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(c.collisionVertexArrayExt,i,r.padding,v.zOffset),this._commitLayoutVertex(c.layoutVertexArray,d,m,g,C,I,new it(r.x1,r.y1)),this._commitLayoutVertex(c.layoutVertexArray,d,m,g,C,I,new it(r.x2,r.y1)),this._commitLayoutVertex(c.layoutVertexArray,d,m,g,C,I,new it(r.x2,r.y2)),this._commitLayoutVertex(c.layoutVertexArray,d,m,g,C,I,new it(r.x1,r.y2)),S.vertexLength+=4;const R=c.indexArray;R.emplaceBack(E,E+1),R.emplaceBack(E+1,E+2),R.emplaceBack(E+2,E+3),R.emplaceBack(E+3,E),S.primitiveLength+=4}_addTextDebugCollisionBoxes(r,i,c,d,m,g){for(let v=d;v<m;v++){const S=c.get(v),E=this.getSymbolInstanceTextSize(r,g,i,v);this._addCollisionDebugVertices(S,E,this.textCollisionBox,S.projectedAnchorX,S.projectedAnchorY,S.projectedAnchorZ,g)}}_addIconDebugCollisionBoxes(r,i,c,d,m,g){for(let v=d;v<m;v++){const S=c.get(v),E=this.getSymbolInstanceIconSize(r,i,g.placedIconSymbolIndex);this._addCollisionDebugVertices(S,E,this.iconCollisionBox,S.projectedAnchorX,S.projectedAnchorY,S.projectedAnchorZ,g)}}generateCollisionDebugBuffers(r,i,c){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new YT(Jp,OM.members,Jo),this.iconCollisionBox=new YT(Jp,OM.members,Jo);const d=Sm(this.iconSizeData,r),m=Sm(this.textSizeData,r,c);for(let g=0;g<this.symbolInstances.length;g++){const v=this.symbolInstances.get(g);this._addTextDebugCollisionBoxes(m,r,i,v.textBoxStartIndex,v.textBoxEndIndex,v),this._addTextDebugCollisionBoxes(m,r,i,v.verticalTextBoxStartIndex,v.verticalTextBoxEndIndex,v),this._addIconDebugCollisionBoxes(d,r,i,v.iconBoxStartIndex,v.iconBoxEndIndex,v),this._addIconDebugCollisionBoxes(d,r,i,v.verticalIconBoxStartIndex,v.verticalIconBoxEndIndex,v)}}getSymbolInstanceTextSize(r,i,c,d){const m=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),g=$T(this.textSizeData,r,m)/ss;return this.tilePixelRatio*g}getSymbolInstanceIconSize(r,i,c){const d=this.icon.placedSymbolArray.get(c),m=$T(this.iconSizeData,r,d);return this.tilePixelRatio*m}_commitDebugCollisionVertexUpdate(r,i,c,d){r.emplaceBack(i,-c,-c,d),r.emplaceBack(i,c,-c,d),r.emplaceBack(i,c,c,d),r.emplaceBack(i,-c,c,d)}_updateTextDebugCollisionBoxes(r,i,c,d,m,g,v){for(let S=d;S<m;S++){const E=c.get(S),C=this.getSymbolInstanceTextSize(r,g,i,S);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,C,E.padding,g.zOffset)}}_updateIconDebugCollisionBoxes(r,i,c,d,m,g,v){for(let S=d;S<m;S++){const E=c.get(S),C=this.getSymbolInstanceIconSize(r,i,g.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,C,E.padding,g.zOffset)}}updateCollisionDebugBuffers(r,i,c,d){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const m=Sm(this.iconSizeData,r,d),g=Sm(this.textSizeData,r,c);for(let v=0;v<this.symbolInstances.length;v++){const S=this.symbolInstances.get(v);this._updateTextDebugCollisionBoxes(g,r,i,S.textBoxStartIndex,S.textBoxEndIndex,S,c),this._updateTextDebugCollisionBoxes(g,r,i,S.verticalTextBoxStartIndex,S.verticalTextBoxEndIndex,S,c),this._updateIconDebugCollisionBoxes(m,r,i,S.iconBoxStartIndex,S.iconBoxEndIndex,S,d),this._updateIconDebugCollisionBoxes(m,r,i,S.verticalIconBoxStartIndex,S.verticalIconBoxEndIndex,S,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(r,i,c,d,m,g,v,S,E){const C={};if(i<c){const{x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue,featureIndex:ve}=r.get(i);C.textBox={x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue},C.textFeatureIndex=ve}if(d<m){const{x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue,featureIndex:ve}=r.get(d);C.verticalTextBox={x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue},C.verticalTextFeatureIndex=ve}if(g<v){const{x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue,featureIndex:ve}=r.get(g);C.iconBox={x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue},C.iconFeatureIndex=ve}if(S<E){const{x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue,featureIndex:ve}=r.get(S);C.verticalIconBox={x1:I,y1:R,x2:L,y2:z,padding:U,projectedAnchorX:q,projectedAnchorY:W,projectedAnchorZ:re,tileAnchorX:ie,tileAnchorY:ue},C.verticalIconFeatureIndex=ve}return C}deserializeCollisionBoxes(r){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const c=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(r,c.textBoxStartIndex,c.textBoxEndIndex,c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c.iconBoxStartIndex,c.iconBoxEndIndex,c.verticalIconBoxStartIndex,c.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(r,i){const c=r.placedSymbolArray.get(i),d=c.vertexStartIndex+4*c.numGlyphs;for(let m=c.vertexStartIndex;m<d;m+=4)r.indexArray.emplaceBack(m,m+1,m+2),r.indexArray.emplaceBack(m+1,m+2,m+3)}getSortedSymbolIndexes(r){if(this.sortedAngle===r&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(r),c=Math.cos(r),d=[],m=[],g=[];for(let v=0;v<this.symbolInstances.length;++v){g.push(v);const S=this.symbolInstances.get(v);d.push(0|Math.round(i*S.tileAnchorX+c*S.tileAnchorY)),m.push(S.featureIndex)}return g.sort((v,S)=>d[v]-d[S]||m[S]-m[v]),g}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let r=0;r<this.symbolInstances.length;++r)this.symbolInstanceIndexesSortedZOffset.push(r)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((r,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(r).zOffset)}addToSortKeyRanges(r,i){const c=this.sortKeyRanges[this.sortKeyRanges.length-1];c&&c.sortKey===i?c.symbolInstanceEnd=r+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:r+1})}sortFeatures(r){if(this.sortFeaturesByY&&this.sortedAngle!==r&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(r),this.sortedAngle=r,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const c=this.symbolInstances.get(i);this.featureSortOrder.push(c.featureIndex);const{rightJustifiedTextSymbolIndex:d,centerJustifiedTextSymbolIndex:m,leftJustifiedTextSymbolIndex:g,verticalPlacedTextSymbolIndex:v,placedIconSymbolIndex:S,verticalPlacedIconSymbolIndex:E}=c;d>=0&&this.addIndicesForPlacedSymbol(this.text,d),m>=0&&m!==d&&this.addIndicesForPlacedSymbol(this.text,m),g>=0&&g!==m&&g!==d&&this.addIndicesForPlacedSymbol(this.text,g),v>=0&&this.addIndicesForPlacedSymbol(this.text,v),S>=0&&this.addIndicesForPlacedSymbol(this.icon,S),E>=0&&this.addIndicesForPlacedSymbol(this.icon,E)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(r){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[r]).elevationFeatureIndex;let c;return this.elevationFeatures&&i<this.elevationFeatures.length&&(c=this.elevationFeatures[i]),c}}function yR(a,r){return r.replace(/{([^{}]+)}/g,(i,c)=>c in a?String(a[c]):"")}let vR,xR,JT;Ut(Sw,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Sw.addDynamicAttributes=Am;class wR{constructor(r){this.type=r.property.overrides?r.property.overrides.runtimeType:Ra,this.defaultValue=r}evaluate(r){if(r.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(r.formattedSection))return i.getOverride(r.formattedSection)}return r.feature&&r.featureState?this.defaultValue.evaluate(r.feature,r.featureState):this.defaultValue.property.specification.default}eachChild(r){this.defaultValue.isConstant()||r(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ut(wR,"FormatSectionOverride",{omit:["defaultValue"]});const QT=()=>JT||(JT={layout:vR||(vR=new hi({"symbol-placement":new vt(ze.layout_symbol["symbol-placement"]),"symbol-spacing":new vt(ze.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new vt(ze.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ct(ze.layout_symbol["symbol-sort-key"]),"symbol-z-order":new vt(ze.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new vt(ze.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new vt(ze.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new vt(ze.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new vt(ze.layout_symbol["icon-ignore-placement"]),"icon-optional":new vt(ze.layout_symbol["icon-optional"]),"icon-rotation-alignment":new vt(ze.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ct(ze.layout_symbol["icon-size"]),"icon-size-scale-range":new vt(ze.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ct(ze.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ct(ze.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ct(ze.layout_symbol["icon-image"]),"icon-image-use-theme":new vt({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ct(ze.layout_symbol["icon-rotate"]),"icon-padding":new vt(ze.layout_symbol["icon-padding"]),"icon-keep-upright":new vt(ze.layout_symbol["icon-keep-upright"]),"icon-offset":new Ct(ze.layout_symbol["icon-offset"]),"icon-anchor":new Ct(ze.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new vt(ze.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new vt(ze.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new vt(ze.layout_symbol["text-rotation-alignment"]),"text-field":new Ct(ze.layout_symbol["text-field"]),"text-font":new Ct(ze.layout_symbol["text-font"]),"text-size":new Ct(ze.layout_symbol["text-size"]),"text-size-scale-range":new vt(ze.layout_symbol["text-size-scale-range"]),"text-max-width":new Ct(ze.layout_symbol["text-max-width"]),"text-line-height":new Ct(ze.layout_symbol["text-line-height"]),"text-letter-spacing":new Ct(ze.layout_symbol["text-letter-spacing"]),"text-justify":new Ct(ze.layout_symbol["text-justify"]),"text-radial-offset":new Ct(ze.layout_symbol["text-radial-offset"]),"text-variable-anchor":new vt(ze.layout_symbol["text-variable-anchor"]),"text-anchor":new Ct(ze.layout_symbol["text-anchor"]),"text-max-angle":new vt(ze.layout_symbol["text-max-angle"]),"text-writing-mode":new vt(ze.layout_symbol["text-writing-mode"]),"text-rotate":new Ct(ze.layout_symbol["text-rotate"]),"text-padding":new vt(ze.layout_symbol["text-padding"]),"text-keep-upright":new vt(ze.layout_symbol["text-keep-upright"]),"text-transform":new Ct(ze.layout_symbol["text-transform"]),"text-offset":new Ct(ze.layout_symbol["text-offset"]),"text-allow-overlap":new vt(ze.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new vt(ze.layout_symbol["text-ignore-placement"]),"text-optional":new vt(ze.layout_symbol["text-optional"]),visibility:new vt(ze.layout_symbol.visibility)})),paint:xR||(xR=new hi({"icon-opacity":new Ct(ze.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ct(ze.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ct(ze.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ct(ze.paint_symbol["text-emissive-strength"]),"icon-color":new Ct(ze.paint_symbol["icon-color"]),"icon-halo-color":new Ct(ze.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ct(ze.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ct(ze.paint_symbol["icon-halo-blur"]),"icon-translate":new vt(ze.paint_symbol["icon-translate"]),"icon-translate-anchor":new vt(ze.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new vt(ze.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ct(ze.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ct(ze.paint_symbol["text-occlusion-opacity"]),"text-color":new Ct(ze.paint_symbol["text-color"],{runtimeType:bo,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new Ct(ze.paint_symbol["text-halo-color"]),"text-halo-width":new Ct(ze.paint_symbol["text-halo-width"]),"text-halo-blur":new Ct(ze.paint_symbol["text-halo-blur"]),"text-translate":new vt(ze.paint_symbol["text-translate"]),"text-translate-anchor":new vt(ze.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new vt(ze.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new vt(ze.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new vt(ze.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new vt(ze.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ct(ze.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},JT);class Tw extends ho{constructor(r,i,c,d){super(r,QT(),i,c,d,r.layout?r.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=se([]),this.hasOcclusionOpacityProperties=r.paint!==void 0&&("icon-occlusion-opacity"in r.paint||"text-occlusion-opacity"in r.paint)}_handleSpecialPaintPropertyUpdate(r){r!=="icon-occlusion-opacity"&&r!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(r,i){super.recalculate(r,i),this.appearances&&this.appearances.forEach(d=>{d.recalculate(r,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 c=this.layout.get("text-writing-mode");if(c){const d=[];for(const m of c)d.indexOf(m)<0&&d.push(m);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(r,i,c,d){return this._saturation===r&&this._contrast===i&&this._brightnessMin===c&&this._brightnessMax===d||(this._colorAdjustmentMatrix=function(m,g,v,S){m=ai(m),g=rn(g);const E=Y(),C=m/3,I=1-2*C,R=[I,C,C,0,C,I,C,0,C,C,I,0,0,0,0,1],L=.5-.5*g,z=S-v;return ee(E,[z,0,0,0,0,z,0,0,0,0,z,0,v,v,v,1],[g,0,0,0,0,g,0,0,0,0,g,0,L,L,L,1]),ee(E,E,R),E}(r,i,c,d),this._saturation=r,this._contrast=i,this._brightnessMin=c,this._brightnessMax=d),this._colorAdjustmentMatrix}getValueAndResolveTokens(r,i,c,d){const m=this.layout.get(r).evaluate(i,{},c,d),g=this._unevaluatedLayout._values[r];return g.isDataDriven()||Fh(g.value)||!m?m:yR(i.properties,m)}getAppearanceValueAndResolveTokens(r,i,c,d,m){const g=r.getProperty(i);if(!g)return;const v=g.evaluate(c,{},d,m),S=r.getUnevaluatedProperties()._values[i];return S.isDataDriven()||Fh(S.value)||!v||typeof v!="string"?v:yR(c.properties,v)}createBucket(r){return new Sw(r)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const r of QT().paint.overridableProperties){if(!Tw.hasPaintOverride(this.layout,r))continue;const i=this.paint.get(r),c=new wR(i),d=new Lp(c,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let m=null;m=i.value.kind==="constant"||i.value.kind==="source"?new ad("source",d):new uu("composite",d,i.value.zoomStops,i.value.interpolationType),this.paint._values[r]=new hu(i.property,m,i.parameters)}}_handleOverridablePaintPropertyUpdate(r,i,c){return!(!this.layout||i.isDataDriven()||c.isDataDriven())&&Tw.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,i){const c=r.get("text-field"),d=QT().paint.properties[i];let m=!1;const g=v=>{for(const S of v)if(d.overrides&&d.overrides.hasOverride(S))return void(m=!0)};if(c.value.kind==="constant"&&c.value.value instanceof ao)g(c.value.value.sections);else if(c.value.kind==="source"){const v=E=>{m||(E instanceof Al&&is(E.value)===bh?g(E.value.sections):E instanceof il?g(E.sections):E.eachChild(v))},S=c.value;S._styleExpression&&v(S._styleExpression.expression)}return m}getProgramIds(){return["symbol"]}getDefaultProgramParams(r,i,c){return{config:new Mc(this,{zoom:i,lut:c}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let bR,SR,TR,ER;var e2=Br([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function Ew(a,r,i,c,d,m,g,v){const S=[a,r,1,i,c,1,d,m,1],E=[g,v,1],C=V([],S),[I,R,L]=io(E,E,C);return $(S,S,[I,0,0,0,R,0,0,0,L])}function kR(a,r,i,c,d,m,g,v){const S=function(E,C,I,R,L,z,U,q){const W=Ew(0,0,1,0,1,1,0,1),re=Ew(E,C,I,R,L,z,U,q);return $(re,re,V([],W))}(a,r,i,c,d,m,g,v);return[S[2]/S[8]/bt,S[5]/S[8]/bt]}function kw(a){return[a[0],Math.min(Math.max(a[1],-j),j)]}class AR extends iu{constructor(r,i,c,d){super(),this.id=r,this.dispatcher=c,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(r,i){if(this._loaded=i||!1,this.fire(new rl("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return r&&(this.coordinates=r),this._loaded=!0,void this._finishLoading();this._imageRequest=tp(this.map._requestManager.transformRequest(this.url,mh.Image),(c,d)=>{this._imageRequest=null,this._loaded=!0,c?this.fire(new vh(c)):d&&(this.image=d instanceof HTMLImageElement?ns.getImageData(d):d,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),this._finishLoading())})}loaded(){return this._loaded}updateImage(r){return r.url?(this._imageRequest&&r.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=r.url,this.load(r.coordinates,this._loaded),this):this}setTexture(r){if(!(r.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Py(this.map.painter.context,r.handle),this.width=r.dimensions[0],this.height=r.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new rl("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(r){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Py||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(r){if(this.coordinates=r,this._boundsArray=void 0,this._unsupportedCoords=!1,!r.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=r[0][1],c=r[0][1];for(const m of r)m[1]>c&&(c=m[1]),m[1]<i&&(i=m[1]);const d=(c+i)/2;if(d>j?this.onNorthPole=!0:d<-j&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const m=r.map(ae.fromLngLat);this.tileID=function(g){let v=1/0,S=1/0,E=-1/0,C=-1/0;for(const U of g)v=Math.min(v,U.x),S=Math.min(S,U.y),E=Math.max(E,U.x),C=Math.max(C,U.y);const I=Math.max(E-v,C-S),R=Math.max(0,Math.floor(-Math.log2(I))),L=Math.pow(2,R);let z=Math.floor((v+E)/2*L);return z>1&&(z-=1),new Dn(R,z,Math.floor((S+C)/2*L))}(m),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new rl("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Py||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(r){for(const W in this.tiles){const re=this.tiles[W];re.state!=="loaded"&&(re.state="loaded",re.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Ny(new Dn(0,0,0),this.map.transform.projection),c=[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(W){const re=W[1].x-W[0].x,ie=W[1].y-W[0].y,ue=W[2].x-W[1].x,ve=W[2].y-W[1].y,me=W[3].x-W[2].x,be=W[3].y-W[2].y,ke=W[0].x-W[3].x,Pe=W[0].y-W[3].y,We=re*ve-ue*ie,Le=ue*be-me*ve,Xe=me*Pe-ke*be,rt=ke*ie-re*Pe;return We>0&&Le>0&&Xe>0&&rt>0||We<0&&Le<0&&Xe<0&&rt<0}(c))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const d=Ny(this.tileID,this.map.transform.projection),[m,g,v,S]=this.coordinates.map(W=>{const re=d.projection.project(W[0],W[1]);return hR(d,re)._round()});this.perspectiveTransform=kR(m.x,m.y,g.x,g.y,v.x,v.y,S.x,S.y);const E=this._boundsArray=new dd;E.emplaceBack(m.x,m.y,0,0),E.emplaceBack(g.x,g.y,bt,0),E.emplaceBack(S.x,S.y,0,bt),E.emplaceBack(v.x,v.y,bt,bt),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=r.createVertexBuffer(E,e2.members),this.boundsSegments=ri.simpleSegment(0,0,4,2);const C=[],I=[kw((R=this.coordinates)[0]),kw(R[1]),kw(R[2]),kw(R[3])];var R;const[L,z,U,q]=function(W){let re=W[0][0],ie=re,ue=W[0][1],ve=ue;for(let me=1;me<W.length;me++)W[me][0]<re?re=W[me][0]:W[me][0]>ie&&(ie=W[me][0]),W[me][1]<ue?ue=W[me][1]:W[me][1]>ve&&(ve=W[me][1]);return[re,ue,ie-re,ve-ue]}(I);{const W=new dd,[re,ie,ue,ve]=function(at){let lt=at[0].x,Ze=lt,qe=at[0].y,ct=qe;for(let St=1;St<at.length;St++)at[St].x<lt?lt=at[St].x:at[St].x>Ze&&(Ze=at[St].x),at[St].y<qe?qe=at[St].y:at[St].y>ct&&(ct=at[St].y);return[lt,qe,Ze-lt,ct-qe]}(c),me=at=>[(at.x-re)/ue,(at.y-ie)/ve],[be,ke,Pe,We]=c.map(me),Le=function(at,lt,Ze,qe,ct,St,_t,Yt){const Lt=Ew(0,0,1,0,1,1,0,1);return $(Lt,Lt,V([],Ew(at,lt,Ze,qe,ct,St,_t,Yt)))}(be[0],be[1],ke[0],ke[1],Pe[0],Pe[1],We[0],We[1]);this.elevatedGlobePerspectiveTransform=kR(be[0],be[1],ke[0],ke[1],Pe[0],Pe[1],We[0],We[1]);const Xe=(at,lt)=>{C.push(at.lng);const Ze=Math.round((at.lng-L)/U*bt),qe=Math.round((at.lat-z)/q*bt),ct=me(lt),St=io([],[ct[0],ct[1],1],Le),_t=Math.round(St[0]/St[2]*bt),Yt=Math.round(St[1]/St[2]*bt);W.emplaceBack(Ze,qe,_t,Yt)},rt=c[3].x-c[0].x,nt=c[3].y-c[0].y,ut=c[2].x-c[1].x,ht=c[2].y-c[1].y;for(let at=0;at<65;at++){const lt=at/64,Ze=[c[0].x+lt*rt,c[0].y+lt*nt],qe=[c[1].x+lt*ut,c[1].y+lt*ht],ct=qe[0]-Ze[0],St=qe[1]-Ze[1];for(let _t=0;_t<65;_t++){const Yt=_t/64,Lt={x:Ze[0]+ct*Yt,y:Ze[1]+St*Yt};Xe(i.projection.unproject(Lt.x,Lt.y),Lt)}}this.elevatedGlobeVertexBuffer=r.createVertexBuffer(W,e2.members)}{this.maxLongitudeTriangleSize=0;let W=[],re=new Ni;const ie=(ue,ve,me)=>{re.emplaceBack(ue,ve,me);const be=C[ue],ke=C[ve],Pe=C[me],We=Math.min(Math.min(be,ke),Pe),Le=Math.max(Math.max(be,ke),Pe)-We;Le>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Le),W.push(We+Le/2)};for(let ue=0;ue<64;ue++)for(let ve=0;ve<64;ve++){const me=65*ue+ve,be=me+1,ke=me+65,Pe=ke+1;ie(me,ke,be),ie(be,ke,Pe)}[W,re]=function(ue,ve){const me=Array.from({length:ue.length},(Pe,We)=>We);me.sort((Pe,We)=>ue[Pe]-ue[We]);const be=[],ke=new Ni;for(let Pe=0;Pe<me.length;Pe++){const We=me[Pe];be.push(ue[We]);const Le=3*We,Xe=Le+1;ke.emplaceBack(ve.uint16[Le],ve.uint16[Xe],ve.uint16[Xe+1])}return[be,ke]}(W,re),this.elevatedGlobeTrianglesCenterLongitudes=W,this.elevatedGlobeIndexBuffer=r.createIndexBuffer(re)}this.elevatedGlobeSegments=ri.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,U/bt,0,q/bt,0,0,z,L,0])}prepare(){const r=Object.keys(this.tiles).length!==0;if(this.tileID&&!r)return;const i=this.map.painter.context,c=i.gl;!this._dirty||this.texture instanceof Py||(this.texture?this.texture.update(this.image):(this.texture=new ET(i,this.image,c.RGBA8),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this._dirty=!1),r&&this._prepareData(i)}loadTile(r,i){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={},i(null)):(r.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(r){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const c=this.elevatedGlobeTrianglesCenterLongitudes;let d=(m=r+180)+360*Math.round((c[0]-m)/360);var m;const g=new ri,v=(I,R)=>{g.segments.push({vertexOffset:0,primitiveOffset:I,vertexLength:i.segments[0].vertexLength,primitiveLength:R,sortKey:void 0,vaos:{}})},S=.51*this.maxLongitudeTriangleSize;if(Math.abs(c[0]-d)<=S){const I=oi(c,0,c.length,d+S);return I===c.length||v(I,Fi(c,I+1,c.length,d+360-S)-I),g}d<c[0]&&(d+=360);const E=Fi(c,0,c.length,d-S);if(E===c.length)return v(0,c.length),g;v(0,E-0);const C=oi(c,E+1,c.length,d+S);return C!==c.length&&v(C,c.length-C),g}}const t$=(Math.pow(256,2)-1)/16907520;class CR extends ho{constructor(r,i,c,d){super(r,{layout:TR||(TR=new hi({visibility:new vt(ze.layout_raster.visibility)})),paint:ER||(ER=new hi({"raster-opacity":new vt(ze.paint_raster["raster-opacity"]),"raster-color":new pu(ze.paint_raster["raster-color"]),"raster-color-mix":new vt(ze.paint_raster["raster-color-mix"]),"raster-color-range":new vt(ze.paint_raster["raster-color-range"]),"raster-hue-rotate":new vt(ze.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new vt(ze.paint_raster["raster-brightness-min"]),"raster-brightness-max":new vt(ze.paint_raster["raster-brightness-max"]),"raster-saturation":new vt(ze.paint_raster["raster-saturation"]),"raster-contrast":new vt(ze.paint_raster["raster-contrast"]),"raster-resampling":new vt(ze.paint_raster["raster-resampling"]),"raster-fade-duration":new vt(ze.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new vt(ze.paint_raster["raster-emissive-strength"]),"raster-array-band":new vt(ze.paint_raster["raster-array-band"]),"raster-elevation":new vt(ze.paint_raster["raster-elevation"]),"raster-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},i,c,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(r){return!(r&&r._source instanceof AR&&(r._source.onNorthPole||r._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(r){r!=="raster-color"&&r!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(r){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[c,d]=r||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(c)&&isNaN(d)||c===this._curRampRange[0]&&d===this._curRampRange[1]||(this.colorRamp=my({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:c,end:d}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[c,d])}}let IR,PR,MR,RR,DR;class LR extends ho{constructor(r,i,c,d){super(r,{layout:IR||(IR=new hi({visibility:new vt(ze["layout_raster-particle"].visibility)})),paint:PR||(PR=new hi({"raster-particle-array-band":new vt(ze["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new vt(ze["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new pu(ze["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new vt(ze["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new vt(ze["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new vt(ze["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new vt(ze["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new vt(ze["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},i,c,d),this._updateColorRamp(),this.lastInvalidatedAt=ns.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(r){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(r){return!1}_handleSpecialPaintPropertyUpdate(r){r!=="raster-particle-color"&&r!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),r==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const r=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=my({expression:r,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=ns.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class r$ extends ho{constructor(r,i){super(r,{},i,null),this.implementation=r,r.slot&&(this.slot=r.slot)}is3D(r){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(r){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(r){this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)}onRemove(r){this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)}}function t2(a,r,i){const c=[0,0,1],d=ds([]);return Wo(d,d,i?-zr(a)+Math.PI:zr(a)),bs(d,d,-zr(r)),so(c,c,d),un(c,c)}const OR={None:0,Model:1,Symbol:2,FillExtrusion:4};class Aw{constructor(r,i,c,d){this.message=(r?`${r}: `:"")+c,d&&(this.identifier=d),i!=null&&i.__line__&&(this.line=i.__line__)}}function r2(a,r){const i=a.indexOf("://")===-1;try{return new URL(a,i&&r?"http://example.com":void 0),!0}catch{return!1}}class zR{constructor(r,i){this.feature=r,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class FR{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new iy,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(r){const i=16*r,c=this.instancedDataArray.float32;let d=Math.floor(c[i+2]);const m=1.05*(c[i+2]-d);return d/=100,[c[i]%1*1.05,c[i+1]%1*1.05,m,d]}tileCoordinatesForInstance(r){const i=16*r,c=this.instancedDataArray.float32;let d=c[i+0];return d=d>bt?d-bt:d,new it(Math.trunc(d),Math.trunc(c[i+1]))}translationForInstance(r){const i=16*r,c=this.instancedDataArray.float32;return[c[i+4],c[i+5],c[i+6]]}rotationScaleForInstance(r){const i=16*r,c=this.instancedDataArray.float32;return[c[i+7],c[i+8],c[i+9],c[i+10],c[i+11],c[i+12],c[i+13],c[i+14],c[i+15]]}transformForInstance(r){const i=16*r,c=this.instancedDataArray.float32;return[c[i+7],c[i+8],c[i+9],c[i+4],c[i+10],c[i+11],c[i+12],c[i+5],c[i+13],c[i+14],c[i+15],c[i+6],0,0,0,1]}}class n2{constructor(r){this.zoom=r.zoom,this.canonical=r.canonical,this.overscaledZ=this.canonical.z+Math.log2(r.overscaling),this.layers=r.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=r.projection,this.index=r.index,this.worldview=r.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=r.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(r,i){}updateAppearances(r,i,c,d){}populate(r,i,c,d){this.tileToMeter=J(c);const m=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:g,id:v,index:S,sourceLayerIndex:E}of r){const C=v??(g.properties&&g.properties.hasOwnProperty("id")?g.properties.id:void 0),I=De(g,m);if(!this.layers[0]._featureFilter.filter(new $n(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),I,c))continue;const R={id:C,sourceLayerIndex:E,index:S,geometry:m?I.geometry:Te(g,c,d),properties:g.properties,type:g.type,patterns:{}},L=this.addFeature(R,R.geometry,I);L&&i.featureIndex.insert(g,R.geometry,S,E,this.index,this.instancesPerModel[L].instancedDataArray.length,bt/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const r=this.layers[0].modelManager,i=this.layers[0].scope;let c=0;for(const d of this.modelUris){const m=r.getModel(d,i);if(!m)continue;const g=this.instancesPerModel[d];if(g){const v=.5*mi(m.aabb.max,m.aabb.min)*g.maxScale+g.maxXYTranslationDistance,S=Math.min(bt,Math.max(v/this.tileToMeter,bt/32));c=Math.max(S,c)}}return c}update(r,i,c,d){for(const m in this.instancesPerModel){const g=this.instancesPerModel[m];for(const v in r)g.idToFeaturesIndex.hasOwnProperty(v)&&(this.evaluate(g.features[g.idToFeaturesIndex[v]],r[v],g,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let r=!1;for(const i in this.instancesPerModel){const c=this.instancesPerModel[i];for(const d of c.features){const m=this.layers[0],g=d.feature,v=this.canonical,S=m.paint.get("model-rotation").evaluate(g,{},v),E=m.paint.get("model-scale").evaluate(g,{},v),C=m.paint.get("model-translation").evaluate(g,{},v);Zi(d.rotation,S)&&Zi(d.scale,E)&&Zi(d.translation,C)||(this.evaluate(d,d.featureStates,c,!0),r=!0)}}return r}updateReplacement(r,i,c,d){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const m=i.getReplacementRegionsForTile(r.toUnwrapped(),!0);if(Yx(this.activeReplacements,m))return!1;this.activeReplacements=m;let g=!1;for(const v in this.instancesPerModel){const S=this.instancesPerModel[v],E=S.instancedDataArray;for(const C of S.features){const I=C.instancedDataOffset,R=C.instancedDataCount;for(let L=0;L<R;L++){const z=16*(L+I);let U=E.float32[z+0];const q=U>bt;U=q?U-bt:U;const W=Math.floor(U),re=Math.floor(E.float32[z+1]);let ie=!1;for(const ue of this.activeReplacements)if(!SP(ue,c,OR.Model,d)&&!(ue.min.x>W||W>ue.max.x||ue.min.y>re||re>ue.max.y)&&(ie=CP(AP(W,re,r.canonical,ue.footprintTileId.canonical),ue.footprint),ie))break;E.float32[z]=ie?U+bt:U,g=g||ie!==q}}}return g}isEmpty(){for(const r in this.instancesPerModel)if(this.instancesPerModel[r].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(r){if(!this.uploaded)for(const i in this.instancesPerModel){const c=this.instancesPerModel[i];c.instancedDataArray.length<0||c.instancedDataArray.length===0||(c.instancedDataBuffer?c.instancedDataBuffer.updateData(c.instancedDataArray):c.instancedDataBuffer=r.createVertexBuffer(c.instancedDataArray,E6.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(r){for(const c in this.instancesPerModel){const d=this.instancesPerModel[c];d.instancedDataArray.length!==0&&d.instancedDataBuffer&&d.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(r&&i&&this.modelUris&&this.modelsRequested)for(const c of this.modelUris)i.removeModel(c,"",!0)}addFeature(r,i,c){const d=this.layers[0],m=d.layout.get("model-id").evaluate(c,{},this.canonical);if(!m)return Ft(`modelId is not evaluated for layer ${d.id} and it is not going to get rendered.`),m;(r2(m,!1)||this.styleDefinedModelURLs[m]!==void 0)&&(this.modelUris.includes(m)||this.modelUris.push(m)),this.instancesPerModel[m]||(this.instancesPerModel[m]=new FR);const g=this.instancesPerModel[m],v=g.instancedDataArray,S=new zR(c,v.length);for(const E of i)for(const C of E){if(C.x<0||C.x>=bt||C.y<0||C.y>=bt)continue;if(this.lookupDim!==0){const R=(this.lookupDim-1)/bt,L=this.lookupDim*(C.y*R|0)+C.x*R|0;if(this.lookup){if(this.lookup[L]!==0)continue;this.lookup[L]=1}}this.instanceCount++;const I=v.length;v.resize(I+1),g.instancesEvaluatedElevation.push(0),v.float32[16*I]=C.x,v.float32[16*I+1]=C.y}return S.instancedDataCount=g.instancedDataArray.length-S.instancedDataOffset,S.instancedDataCount>0&&(r.id&&(g.idToFeaturesIndex[r.id]=g.features.length),g.features.push(S),this.evaluate(S,{},g,!1)),m}getModelUris(){return this.modelUris}evaluate(r,i,c,d){const m=this.layers[0],g=r.feature,v=this.canonical,S=r.rotation=m.paint.get("model-rotation").evaluate(g,i,v),E=r.scale=m.paint.get("model-scale").evaluate(g,i,v),C=r.translation=m.paint.get("model-translation").evaluate(g,i,v),I=Object.assign({},m.paint.get("model-color").evaluate(g,i,v));I.a=m.paint.get("model-color-mix-intensity").evaluate(g,i,v);const R=[];this.maxVerticalOffset<C[2]&&(this.maxVerticalOffset=C[2]);const L=C[0]*C[0]+C[1]*C[1],z=L>0?Math.sqrt(L):0;c.maxScale=Math.max(Math.max(c.maxScale,E[0]),Math.max(E[1],E[2])),c.maxXYTranslationDistance=Math.max(c.maxXYTranslationDistance,z),this.maxScale=Math.max(Math.max(this.maxScale,E[0]),Math.max(E[1],E[2])),pM(R,S,E);const U=Math.round(100*I.a)+I.b/1.05;for(let q=0;q<r.instancedDataCount;++q){const W=r.instancedDataOffset+q,re=16*W,ie=c.instancedDataArray.float32;let ue=0;d&&(ue=ie[re+6]-c.instancesEvaluatedElevation[W]);const ve=0|ie[re+1];ie[re]=(0|ie[re])+I.r/1.05,ie[re+1]=ve+I.g/1.05,ie[re+2]=U,ie[re+3]=1/(v.z>10?this.tileToMeter:J(v,ve)),ie[re+4]=C[0],ie[re+5]=C[1],ie[re+6]=C[2]+ue,ie[re+7]=R[0],ie[re+8]=R[1],ie[re+9]=R[2],ie[re+10]=R[4],ie[re+11]=R[5],ie[re+12]=R[6],ie[re+13]=R[8],ie[re+14]=R[9],ie[re+15]=R[10],c.instancesEvaluatedElevation[W]=C[2]}}}let BR,NR;Ut(n2,"ModelBucket",{omit:["layers"]}),Ut(FR,"PerModelAttributes"),Ut(zR,"ModelFeature");class Cm{constructor(r,i,c){this._demTile=r,this._dem=this._demTile.dem,this._scale=i,this._offset=c}static create(r,i,c){const d=c||r.findDEMTileFor(i);if(!d||!d.dem)return;const m=d.dem,g=d.tileID,v=1<<i.canonical.z-g.canonical.z;return new Cm(d,m.dim/bt/v,[(i.canonical.x/v-g.canonical.x)*m.dim,(i.canonical.y/v-g.canonical.y)*m.dim])}tileCoordToPixel(r,i){const c=i*this._scale+this._offset[1];return new it(Math.floor(r*this._scale+this._offset[0]),Math.floor(c))}getElevationAt(r,i,c,d){const m=r*this._scale+this._offset[0],g=i*this._scale+this._offset[1],v=Math.floor(m),S=Math.floor(g),E=this._dem;return d=!!d,c?ur(ur(E.get(v,S,d),E.get(v,S+1,d),g-S),ur(E.get(v+1,S,d),E.get(v+1,S+1,d),g-S),m-v):E.get(v,S,d)}getElevationAtPixel(r,i,c){return this._dem.get(r,i,!!c)}getMeterToDEM(r){return(1<<this._demTile.tileID.canonical.z)*M(1,r)*this._dem.stride}}const i2=new Float32Array(262144),of=new Uint8Array(262144);function jR(a){let r=0;if(a.meshes)for(const i of a.meshes)r=Math.max(r,i.aabb.max[2]);if(a.children)for(const i of a.children)r=Math.max(r,jR(i));return r}function VR(a,r,i){if(a.meshes)for(const c of a.meshes){if(c.aabb.min[0]===1/0)continue;const d=Zt.applyTransform(c.aabb,a.globalMatrix);i.insert(r,d.min[0],d.min[1],d.max[0],d.max[1])}if(a.children)for(const c of a.children)VR(c,r,i)}const UR=["","wall","door","roof","window","lamp","logo"];class $R{constructor(r){this.node=r,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:r.id,geometry:[],properties:{height:jR(r)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let r=0;const i=new Zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const c of this.node.meshes)this.node.lightMeshIndex!==r&&(c.transformedAabb=Zt.applyTransformFast(c.aabb,this.node.globalMatrix),i.encapsulate(c.transformedAabb)),r++;this.aabb=i}return this.aabb}}class Cw{constructor(r,i,c,d,m,g,v,S){this.id=c,this.layers=r,this.layerIds=this.layers.map(E=>E.fqid),this.stateDependentLayerIds=this.layers.filter(E=>E.isStateDependent()).map(E=>E.id),this.modelTraits|=vm.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,d&&(this.modelTraits|=vm.HasMapboxMeshFeatures),m&&(this.modelTraits|=vm.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=g,this.worldview=S,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const E of i)this.nodesInfo.push(new $R(E)),VR(E,v.featureIndexArray.length,v.grid),v.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,v.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(r,i){for(const c of this.getNodesInfo()){const d=c.node;d.footprint&&i.push({footprint:d.footprint,id:r})}}updateAppearances(r,i,c,d){}update(r){const i=Object.keys(r).length!==0;if(i&&!this.stateDependentLayers.length)return;const c=i?this.stateDependentLayers:this.layers;if(!hs(r,this.states))for(const d of c)this.evaluate(d,r);this.states=structuredClone(r)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(r){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const c of i){const d=c.node;this.uploaded?this.updatePbrBuffer(d):CT(d,r,!0)}for(const c of i)cw(c.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(r){let i=!1;if(!r.meshes)return i;for(const c of r.meshes)c.pbrBuffer&&(c.pbrBuffer.updateData(c.featureArray),i=!0);return i}needsReEvaluation(r,i,c){const d=r.transform.projectionOptions,m=r.style.getBrightness(),g=this.brightness!==m;if(!this.uploaded||this.dirty||d.name!==this.projection.name||qy(c.paint.get("model-color").value,g)||qy(c.paint.get("model-color-mix-intensity").value,g)||qy(c.paint.get("model-roughness").value,g)||qy(c.paint.get("model-emissive-strength").value,g)||qy(c.paint.get("model-height-based-emissive-strength-multiplier").value,g)){this.projection=d,this.brightness=m;const v=this.getNodesInfo();for(const S of v)S.state=null;return!0}return!1}evaluateTransform(r,i){if(r.transform.zoom===this.zoom)return;this.zoom=r.transform.zoom;const c=this.getNodesInfo(),d=this.id.canonical;for(const m of c){const g=m.feature;m.evaluatedTranslation=i.paint.get("model-translation").evaluate(g,{},d),m.evaluatedScale=i.paint.get("model-scale").evaluate(g,{},d)}}evaluate(r,i){const c=this.getNodesInfo();for(const d of c){if(!d.node.meshes)continue;const m=d.feature,g=i&&i[m.id];if(hs(g,d.state))continue;d.state=structuredClone(g);const v=d.node.meshes&&d.node.meshes[0].featureData,S=d.evaluatedColor[2],E=d.evaluatedRMEA[2],C=this.id.canonical;if(d.hasTranslucentParts=!1,v){for(let I=0;I<UR.length;I++){const R=UR[I];R.length&&(m.properties.part=R);const L=r.paint.get("model-color").evaluate(m,g,C).toPremultipliedRenderColor(null),z=r.paint.get("model-color-mix-intensity").evaluate(m,g,C);d.evaluatedColor[I]=[L.r,L.g,L.b,z],d.evaluatedRMEA[I][0]=r.paint.get("model-roughness").evaluate(m,g,C),d.evaluatedRMEA[I][2]=r.paint.get("model-emissive-strength").evaluate(m,g,C),d.evaluatedRMEA[I][3]=L.a,d.emissionHeightBasedParams[I]=r.paint.get("model-height-based-emissive-strength-multiplier").evaluate(m,g,C),!d.hasTranslucentParts&&L.a<1&&(d.hasTranslucentParts=!0)}delete m.properties.part,i$(d,S!==d.evaluatedColor[2]||E!==d.evaluatedRMEA[2],this.modelTraits)}else d.evaluatedRMEA[0][2]=r.paint.get("model-emissive-strength").evaluate(m,g,C);d.evaluatedTranslation=r.paint.get("model-translation").evaluate(m,g,C),d.evaluatedScale=r.paint.get("model-scale").evaluate(m,g,C),this.updatePbrBuffer(d.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(r,i,c,d){const m=r.findDEMTileFor(c);if(m&&(m.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(m.dem&&m.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=m.tileID.overscaledZ;const g=Cm.create(r,c,m);if(!g)return;this.modelTraits&vm.HasMapboxMeshFeatures&&this.updateDEM(r,g,c,d);for(const v of this.getNodesInfo()){const S=v.node;if(!S.footprint||!S.footprint.vertices||!S.footprint.vertices.length)continue;const E=S.footprint.vertices;let C=g.getElevationAt(E[0].x,E[0].y,!0,!0);for(let I=1;I<E.length;I++)C=Math.min(C,g.getElevationAt(E[I].x,E[I].y,!0,!0));S.elevation=C}}this.terrainTile=m.tileID.canonical,this.terrainExaggeration=i}}updateDEM(r,i,c,d){let m=i._dem._modifiedForSources[d];if(m===void 0&&(i._dem._modifiedForSources[d]=[],m=i._dem._modifiedForSources[d]),m.includes(c.canonical))return;const g=i._dem.dim;m.push(c.canonical);let v=!1;for(const S of this.getNodesInfo()){const E=S.node;if(!E.footprint||!E.footprint.grid)continue;const C=E.footprint.grid,I=i.tileCoordToPixel(C.min.x,C.min.y),R=i.tileCoordToPixel(C.max.x,C.max.y),L=Math.min(Math.min(g-R.y,I.x),Math.min(I.y,g-R.x));if(L<0)continue;const z=K(L,2,5);let U=Math.max(0,I.x-z),q=Math.max(0,I.y-z),W=Math.min(R.x+z,g-1),re=Math.min(R.y+z,g-1);for(let me=q;me<=re;++me)for(let be=U;be<=W;++be)of[me*g+be]=255;let ie=0,ue=0;for(let me=0;me<C.cellsY;++me)for(let be=0;be<C.cellsX;++be){if(!C.cells[me*C.cellsX+be])continue;const ke=i.tileCoordToPixel(C.min.x+be/C.xScale,C.min.y+me/C.yScale),Pe=i.tileCoordToPixel(C.min.x+(be+1)/C.xScale,C.min.y+(me+1)/C.yScale);for(let We=ke.y;We<=Math.min(Pe.y+1,g-1);++We)for(let Le=ke.x;Le<=Math.min(Pe.x+1,g-1);++Le)of[We*g+Le]===255&&(of[We*g+Le]=0,ie+=i.getElevationAtPixel(Le,We),ue++)}const ve=ie/ue;U=Math.max(1,I.x-z),q=Math.max(1,I.y-z),W=Math.min(R.x+z,g-2),re=Math.min(R.y+z,g-2),v=!0;for(let me=q;me<=re;++me)for(let be=U;be<=W;++be)of[me*g+be]===0&&(i2[me*g+be]=i._dem.set(be,me,ve));for(let me=1;me<z;++me){U=Math.max(1,I.x-me),q=Math.max(1,I.y-me),W=Math.min(R.x+me,g-2),re=Math.min(R.y+me,g-2);for(let be=q;be<=re;++be)for(let ke=U;ke<=W;++ke){const Pe=be*g+ke;if(of[Pe]===255){let We=0,Le=0,Xe=-1,rt=-1;for(let nt=-1;nt<=1;++nt)for(let ut=-1;ut<=1;++ut){const ht=(be+nt)*g+ke+ut;if(of[ht]>=me)continue;const at=i2[ht],lt=Math.abs(at);lt>Le&&(We=at,Le=lt,Xe=ut,rt=nt)}if(Le>.1){const nt=1-(me+.5*Math.abs(Xe*rt))/z;let ut=i._dem.get(ke,be)+We*nt;const ht=i._dem.get(ke+Xe,be+rt),at=i._dem.get(ke-Xe,be-rt,!0);(ut-ht)*(ut-at)>0&&(ut=(ht+at)/2),i2[Pe]=i._dem.set(ke,be,ut),of[Pe]=me}}}}}v&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=ns.now())}setFilter(r){this.filter=r?$p(r):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(r=>this.filter.filter(new $n(this.id.overscaledZ,{worldview:this.worldview}),r.feature,this.id.canonical)):this.nodesInfo}destroy(){const r=this.getNodesInfo();for(const i of r)cw(i.node),IT(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(r,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const c=i.getReplacementRegionsForTile(r.toUnwrapped());for(const d of this.getNodesInfo()){const m=d.node.footprint;d.hiddenByReplacement=!!m&&!c.find(g=>g.footprint===m)}}getHeightAtTileCoord(r,i){const c=[],d=[0,0,0],m=se([]);for(const g of this.getNodesInfo()){const v=g.node.meshes[0],S=v.transformedAabb;if(r<S.min[0]||i<S.min[1]||r>S.max[0]||i>S.max[1])continue;if(g.node.hidden===!0)return{height:1/0,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};te(m,g.node.globalMatrix),d[0]=r,d[1]=i,Un(d,d,m);const E=(d[0]-v.aabb.min[0])/(v.aabb.max[0]-v.aabb.min[0])*rf|0,C=Math.min(63,(d[1]-v.aabb.min[1])/(v.aabb.max[1]-v.aabb.min[1])*rf|0)*rf+Math.min(63,E),I=v.heightmap[C];if(!(I<0&&g.node.footprint))return g.hiddenByReplacement?void 0:{height:I,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};if(g.node.footprint.grid.query(new it(r,i),new it(r,i),c),c.length>0)return{height:void 0,maxHeight:g.feature.properties.height,hidden:g.hiddenByReplacement,verticalScale:g.evaluatedScale[2]}}}}function qy(a,r){return a instanceof ad&&!a.isLightConstant&&r}function n$(a,r,i,c,d,m,g,v){let S=(61440&r|(61440&r)>>4)>>8,E=(3840&r|(3840&r)>>4)>>4,C=240&r|(240&r)>>4;i[3]>0&&(S=ur(S,255*i[0],i[3]),E=ur(E,255*i[1],i[3]),C=ur(C,255*i[2],i[3]));const I=S<<8|E,R=C<<8|Math.floor(255*c[3]),L=function(me){const be=K(me,0,2);return Math.min(Math.round(.5*be*255),255)}(c[2])<<8|15*c[0]<<4|15*c[1],z=K(d[0],0,1),U=K(d[1],0,1),q=K(d[2],0,1),W=K(d[3],0,1);let re,ie,ue,ve;if(z!==U&&g!==m&&U!==z){const me=g-m;ie=1/(me*(U-z)),ue=-(m+me*z)/(me*(U-z));const be=K(d[4],-1,1);ve=Math.pow(10,be),re=255*q<<8|255*W}else re=65535,ie=0,ue=1,ve=1;if(a.emplaceBack(I,R,L,re,ie,ue,ve),v){const me=v.length;v.clear();for(let be=0;be<me;be++)v.emplaceBack(I,R,L,re,ie,ue,ve)}}function i$(a,r,i){const c=a.node;let d=0;const m=i&vm.HasMeshoptCompression;for(const g of c.meshes){if(c.lights&&c.lightMeshIndex===d||!g.featureData)continue;g.featureArray=new em,g.featureArray.reserve(g.featureData.length);let v=r;for(const S of g.featureData){const E=m?65535&S:S>>16&65535,C=m?S>>16&65535:65535&S,I=(15&C)<8?15&C:0,R=a.evaluatedRMEA[I],L=a.evaluatedColor[I],z=a.emissionHeightBasedParams[I];let U;if(v&&I===2&&c.lights&&(U=new em,U.resize(10*c.lights.length)),n$(g.featureArray,E,L,R,z,g.aabb.min[2],g.aabb.max[2],U),U&&v){v=!1;const q=c.meshes[c.lightMeshIndex];q.featureArray=U,q.featureArray._trim()}}g.featureArray._trim(),d++}}Ut(Cw,"Tiled3dModelBucket",{omit:["layers"]}),Ut($R,"Tiled3dModelFeature");const s$=["id","tile","layer","source","sourceLayer","state"];class af{constructor(r,i,c,d,m){this.type="Feature",this._vectorTileFeature=r,this._z=i,this._x=c,this._y=d,this.properties=r?r.properties:{},this.id=m}clone(){const r=new af(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(r.state=Object.assign({},this.state)),this.layer&&(r.layer=Object.assign({},this.layer)),this.source&&(r.source=this.source),this.sourceLayer&&(r.sourceLayer=this.sourceLayer),r}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(r){this._geometry=r}toJSON(){const r={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of s$)this[i]!==void 0&&(r[i]=this[i]);return r}}class lf extends iu{constructor(r,i,c,d){super(),this.id=r,this.type="model",this.models=[],this._loaded=!1,this._options=i,this._modelsInfo=new Map}load(){const r=[];for(const i in this._options.models){const c=this._options.models[i],d=this._modelsInfo.get(i);if(d){const m=d.model;m.position=c.position!=null?new l(c.position[0],c.position[1]):new l(0,0),m.orientation=c.orientation!=null?c.orientation:[0,0,0],d.modelSpec=c,lf.applyModelSpecification(m,c),m.computeBoundsAndApplyParent(),this.models.push(m)}else{const m=uM(this.map._requestManager.transformRequest(c.uri,mh.Model).url).then(g=>{if(!g)return;const v=MT(g),S=new mM(i,c.uri,c.position,c.orientation,v);lf.applyModelSpecification(S,c),S.computeBoundsAndApplyParent(),this.models.push(S),this._modelsInfo.set(i,{modelSpec:c,model:S})}).catch(g=>{this.fire(new vh(new Error(`Could not load model ${i} from ${c.uri}: ${g.message}`)))});r.push(m)}}Promise.allSettled(r).then(()=>{this._loaded=!0,this.fire(new rl("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this._loaded=!0,this.fire(new vh(new Error(`Could not load models: ${i.message}`)))})}static applyModelSpecification(r,i){i.nodeOverrides&&lf.convertNodeOverrides(r,i.nodeOverrides),i.materialOverrides&&lf.convertMaterialOverrides(r,i.materialOverrides),i.nodeOverrideNames&&(r.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(r.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(r.featureProperties=i.featureProperties)}static convertNodeOverrides(r,i){if(Array.isArray(i)&&i.every(c=>typeof c=="string")){r.nodeOverrideNames=[];for(const c of i)r.nodeOverrideNames.push(c)}else Object.entries(i).forEach(([c,d])=>{const m={orientation:[0,0,0]};if(d.hasOwnProperty("orientation")){const g=d.orientation;g&&(m.orientation=g)}r.nodeOverrides.set(c,m)})}static convertMaterialOverrides(r,i){if(Array.isArray(i)&&i.every(c=>typeof c=="string")){r.materialOverrideNames=[];for(const c of i)r.materialOverrideNames.push(c)}else Object.entries(i).forEach(([c,d])=>{const m={color:new wn(1,1,1),colorMix:0,emissionStrength:0,opacity:1},g=d["model-color"];g!==void 0&&(m.color.r=g[0],m.color.g=g[1],m.color.b=g[2]);const v=d["model-color-mix-intensity"];v!==void 0&&(m.colorMix=v);const S=d["model-emissive-strength"];S!==void 0&&(m.emissionStrength=S);const E=d["model-opacity"];E!==void 0&&(m.opacity=E),r.materialOverrides.set(c,m)})}onAdd(r){this.map=r,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(r,i){}serialize(){return this._options}setProperty(r,i){return!1}reload(){const r=za(this.id,this.scope);this.map.style.clearSource(r),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(r){this.models=[];const i=new Map;for(const c in r){const d=r[c];if(this._modelsInfo.has(c)){const m=this._modelsInfo.get(c);m&&m.modelSpec.uri===d.uri&&i.set(c,m)}}this._modelsInfo=i,this._options.models=r,this._loaded=!1,this.load()}}function s2(a,r,i,c){const d=1<<a.z;r.lat=N((c/bt+a.y)/d),r.lng=D((i/bt+a.x)/d)}function o$(a,r,i,c){const d=a.getNodesInfo()[r];if(!d||d.hiddenByReplacement||!d.node.meshes)return;let m=Number.MAX_VALUE;const g=d.node,v=i.tile,S=c.calculatePosMatrix(v.tileID.toUnwrapped(),c.worldSize),E=d.evaluatedScale;let C=0;c.elevation&&g.elevation&&(C=g.elevation*c.elevation.exaggeration()),oe(S,S,[(g.anchor?g.anchor[0]:0)*(E[0]-1),(g.anchor?g.anchor[1]:0)*(E[1]-1),C]),he(S,S,E);const I=i.queryGeometry,R=I.isPointQuery()?I.screenBounds:I.screenGeometry,L=function(U){const q=ee([],S,U.globalMatrix);ee(q,c.expandedFarZProjMatrix,q);for(let W=0;W<U.meshes.length;++W){const re=U.meshes[W];if(W===U.lightMeshIndex)continue;const ie=AT(R,c,q,re.aabb);ie!=null&&(m=Math.min(ie,m))}if(U.children)for(const W of U.children)L(W)};if(L(g),m===Number.MAX_VALUE)return;const z=new l(0,0);return s2(v.tileID.canonical,z,d.node.anchor[0],d.node.anchor[1]),{intersectionZ:m,position:z,feature:d.feature}}const a$={circle:class extends ho{constructor(a,r,i,c){super(a,{layout:Eo||(Eo=new hi({"circle-sort-key":new Ct(ze.layout_circle["circle-sort-key"]),"circle-elevation-reference":new vt(ze.layout_circle["circle-elevation-reference"]),visibility:new vt(ze.layout_circle.visibility)})),paint:fi||(fi=new hi({"circle-radius":new Ct(ze.paint_circle["circle-radius"]),"circle-color":new Ct(ze.paint_circle["circle-color"]),"circle-blur":new Ct(ze.paint_circle["circle-blur"]),"circle-opacity":new Ct(ze.paint_circle["circle-opacity"]),"circle-translate":new vt(ze.paint_circle["circle-translate"]),"circle-translate-anchor":new vt(ze.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new vt(ze.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new vt(ze.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ct(ze.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ct(ze.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ct(ze.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new vt(ze.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c)}createBucket(a){return new bn(a)}queryRadius(a){const r=a;return $s("circle-radius",this,r)+$s("circle-stroke-width",this,r)+Ts(this.paint.get("circle-translate"))}queryIntersectsFeature(a,r,i,c,d,m,g,v){const S=xa(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),E=this.paint.get("circle-radius").evaluate(r,i)+this.paint.get("circle-stroke-width").evaluate(r,i);return XI(a,c,m,g,v,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",S,E)}getProgramIds(){return["circle"]}getDefaultProgramParams(a,r,i){const c=ZI(this);return{config:new Mc(this,{zoom:r,lut:i}),defines:c,overrideFog:!1}}is3D(a){return!a&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends ho{createBucket(a){return new JI(a)}constructor(a,r,i,c){super(a,{layout:QI||(QI=new hi({visibility:new vt(ze.layout_heatmap.visibility)})),paint:eP||(eP=new hi({"heatmap-radius":new Ct(ze.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ct(ze.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new vt(ze.paint_heatmap["heatmap-intensity"]),"heatmap-color":new pu(ze.paint_heatmap["heatmap-color"]),"heatmap-opacity":new vt(ze.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(a){a==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=my({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(a){return $s("heatmap-radius",this,a)}queryIntersectsFeature(a,r,i,c,d,m,g,v){const S=this.paint.get("heatmap-radius").evaluate(r,i);return XI(a,c,m,g,v,!0,!0,new it(0,0),S)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(a,r,i){return a==="heatmap"?{config:new Mc(this,{zoom:r,lut:i}),overrideFog:!1}:{}}},hillshade:class extends ho{constructor(a,r,i,c){super(a,{layout:tP||(tP=new hi({visibility:new vt(ze.layout_hillshade.visibility)})),paint:rP||(rP=new hi({"hillshade-illumination-direction":new vt(ze.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new vt(ze.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new vt(ze.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new vt(ze.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new vt(ze.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new vt(ze.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new vt(ze.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c)}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(a,r,i){return{overrideFog:!1}}},fill:class extends ho{constructor(a,r,i,c){super(a,{layout:_P||(_P=new hi({"fill-sort-key":new Ct(ze.layout_fill["fill-sort-key"]),visibility:new vt(ze.layout_fill.visibility),"fill-elevation-reference":new vt(ze.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Ct(ze.layout_fill["fill-construct-bridge-guard-rail"])})),paint:yP||(yP=new hi({"fill-antialias":new vt(ze.paint_fill["fill-antialias"]),"fill-opacity":new Ct(ze.paint_fill["fill-opacity"]),"fill-color":new Ct(ze.paint_fill["fill-color"]),"fill-outline-color":new Ct(ze.paint_fill["fill-outline-color"]),"fill-translate":new vt(ze.paint_fill["fill-translate"]),"fill-translate-anchor":new vt(ze.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ct(ze.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new vt(ze.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new vt(ze.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Ct(ze.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Ct(ze.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Ct(ze.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c)}getProgramIds(){const a=this.paint.get("fill-pattern"),r=a&&a.constantOr(1),i=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(a,r,i){return{config:new Mc(this,{zoom:r,lut:i}),overrideFog:!1}}recalculate(a,r){super.recalculate(a,r);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(a){return new uT(a)}queryRadius(){return Ts(this.paint.get("fill-translate"))}queryIntersectsFeature(a,r,i,c,d,m){return!a.queryGeometry.isAboveHorizon&&fn(Qo(a.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),c)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(a){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const r=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return a!=null?r&&!a:r}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends ho{constructor(a,r,i,c){super(a,{layout:GP||(GP=new hi({visibility:new vt(ze["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new vt(ze["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:HP||(HP=new hi({"fill-extrusion-opacity":new vt(ze["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new vt(ze["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new vt(ze["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new vt(ze["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new vt(ze["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new vt(ze["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new vt(ze["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new vt(ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new vt(ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new vt(ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new vt(ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new vt(ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new vt(ze["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new vt(ze["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new vt(ze["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new vt(ze["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new vt(ze["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new vt(ze["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Ct(ze["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new vt(ze["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(a){return new Qx(a)}queryRadius(){return Ts(this.paint.get("fill-extrusion-translate"))}is3D(a){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(a,r,i,c,d,m,g,v,S){const E=xa(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),C=this.paint.get("fill-extrusion-height").evaluate(r,i),I=this.paint.get("fill-extrusion-base").evaluate(r,i),R=[0,0],L=v&&m.elevation,z=m.elevation?m.elevation.exaggeration():1,U=a.tile.getBucket(this);if(L&&U instanceof Qx){const ue=U.centroidVertexArray,ve=S+1;ve<ue.length&&(R[0]=ue.geta_centroid_pos0(ve),R[1]=ue.geta_centroid_pos1(ve))}if(R[0]===0&&R[1]===1)return!1;m.projection.name==="globe"&&(c=$P([c],[new it(0,0),new it(bt,bt)],a.tileID.canonical).map(ue=>ue.polygon).flat());const q=L?v:null,[W,re]=JP(m,c,I,C,E,g,q,R,z,m.center.lat,a.tileID.canonical),ie=a.queryGeometry;return YP(W,re,ie.isPointQuery()?ie.screenBounds:ie.screenGeometry)}},building:class extends ho{constructor(a,r,i,c){super(a,{layout:bM||(bM=new hi({visibility:new vt(ze.layout_building.visibility),"building-facade":new Ct(ze.layout_building["building-facade"]),"building-facade-floors":new Ct(ze.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ct(ze.layout_building["building-facade-unit-width"]),"building-facade-window":new Ct(ze.layout_building["building-facade-window"]),"building-roof-shape":new Ct(ze.layout_building["building-roof-shape"]),"building-height":new Ct(ze.layout_building["building-height"]),"building-base":new Ct(ze.layout_building["building-base"]),"building-flood-light-wall-radius":new Ct(ze.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ct(ze.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ct(ze.layout_building["building-flip-roof-orientation"])})),paint:SM||(SM=new hi({"building-opacity":new vt(ze.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new vt(ze.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new vt(ze.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new vt(ze.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new vt(ze.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new vt(ze.paint_building["building-vertical-scale"]),"building-cast-shadows":new vt(ze.paint_building["building-cast-shadows"]),"building-color":new Ct(ze.paint_building["building-color"]),"building-emissive-strength":new Ct(ze.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new vt(ze.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new vt(ze.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new vt(ze.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new vt(ze.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new vt(ze.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(a){return new wM(a)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(a){return!0}queryRadius(a){return 0}queryIntersectsFeature(a,r,i,c,d,m,g,v,S){let E=this.layout.get("building-height").evaluate(r,i);const C=this.layout.get("building-base").evaluate(r,i),I=a.tile.getBucket(this).getFootprint(r);if(I){if(I.hiddenFlags!==0)return!1;E=I.height}const[R,L]=JP(m,c,C,E,new it(0,0),g,null,[0,0],1,m.center.lat,a.tileID.canonical),z=a.queryGeometry;return YP(R,L,z.isPointQuery()?z.screenBounds:z.screenGeometry)}},line:class extends ho{constructor(a,r,i,c){const d=DM();super(a,d,r,i,c),d.layout&&(this.layout=new fu(d.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(a){if(a==="line-gradient"){const r=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=r._styleExpression&&r._styleExpression.expression instanceof Mh,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(a,r){super.recalculate(a,r),this.paint._values["line-floorwidth"]=(()=>{if(Ry)return Ry;const i=DM();return Ry=new t8(i.paint.properties["line-width"].specification),Ry.useIntegerZoom=!0,Ry})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,a)}createBucket(a){return new LT(a)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(a,r,i){const c=MM(this);return{config:new Mc(this,{zoom:r,lut:i}),defines:c,overrideFog:!1}}queryRadius(a){const r=a,i=LM($s("line-width",this,r),$s("line-gap-width",this,r)),c=$s("line-offset",this,r);return i/2+Math.abs(c)+Ts(this.paint.get("line-translate"))}queryIntersectsFeature(a,r,i,c,d,m){if(a.queryGeometry.isAboveHorizon)return!1;const g=Qo(a.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),v=a.pixelToTileUnitsFactor/2*LM(this.paint.get("line-width").evaluate(r,i),this.paint.get("line-gap-width").evaluate(r,i)),S=this.paint.get("line-offset").evaluate(r,i);return S&&(c=function(E,C){const I=[],R=new it(0,0);for(let L=0;L<E.length;L++){const z=E[L],U=[];for(let q=0;q<z.length;q++){const W=z[q],re=z[q+1],ie=q===0?R:W.sub(z[q-1])._unit()._perp(),ue=q===z.length-1?R:re.sub(W)._unit()._perp(),ve=ie._add(ue)._unit();ve._mult(1/(ve.x*ue.x+ve.y*ue.y)),U.push(ve._mult(C)._add(W))}I.push(U)}return I}(c,S*a.pixelToTileUnitsFactor)),function(E,C,I){for(let R=0;R<C.length;R++){const L=C[R];if(E.length>=3){for(let z=0;z<L.length;z++)if(Rn(E,L[z]))return!0}if(li(E,L,I))return!0}return!1}(g,c,v)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(a){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:Tw,background:class extends ho{constructor(a,r,i,c){super(a,{layout:bR||(bR=new hi({visibility:new vt(ze.layout_background.visibility)})),paint:SR||(SR=new hi({"background-pitch-alignment":new vt(ze.paint_background["background-pitch-alignment"]),"background-color":new vt(ze.paint_background["background-color"]),"background-pattern":new vt(ze.paint_background["background-pattern"]),"background-opacity":new vt(ze.paint_background["background-opacity"]),"background-emissive-strength":new vt(ze.paint_background["background-emissive-strength"]),"background-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(a,r,i){return{overrideFog:!1}}is3D(a){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:CR,"raster-particle":LR,sky:class extends ho{constructor(a,r,i,c){super(a,{layout:MR||(MR=new hi({visibility:new vt(ze.layout_sky.visibility)})),paint:RR||(RR=new hi({"sky-type":new vt(ze.paint_sky["sky-type"]),"sky-atmosphere-sun":new vt(ze.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new vt(ze.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new vt(ze.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new vt(ze.paint_sky["sky-gradient-radius"]),"sky-gradient":new pu(ze.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new vt(ze.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new vt(ze.paint_sky["sky-atmosphere-color"]),"sky-opacity":new vt(ze.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(a){a==="sky-gradient"?this._updateColorRamp():a!=="sky-atmosphere-sun"&&a!=="sky-atmosphere-halo-color"&&a!=="sky-atmosphere-color"&&a!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=my({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(a){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const r=a.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(a,r){if(this.paint.get("sky-type")==="atmosphere"){const c=this.paint.get("sky-atmosphere-sun"),d=!c,m=a.style.light,g=m.properties.get("position");return d&&m.properties.get("anchor")==="viewport"&&Ft("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),d?t2(g.azimuthal,90-g.polar,r):t2(c[0],90-c[1],r)}const i=this.paint.get("sky-gradient-center");return t2(i[0],90-i[1],r)}isSky(){return!0}markSkyboxValid(a){this._skyboxInvalidated=!1,this._lightPosition=a.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const a=this.paint.get("sky-type");return a==="atmosphere"?["skyboxCapture","skybox"]:a==="gradient"?["skyboxGradient"]:null}},slot:class extends ho{constructor(a,r,i,c){super(a,{paint:DR||(DR=new hi({}))},r,null)}},model:class extends ho{constructor(a,r,i,c){super(a,{layout:BR||(BR=new hi({visibility:new vt(ze.layout_model.visibility),"model-id":new Ct(ze.layout_model["model-id"])})),paint:NR||(NR=new hi({"model-opacity":new Ct(ze.paint_model["model-opacity"]),"model-rotation":new Ct(ze.paint_model["model-rotation"]),"model-scale":new Ct(ze.paint_model["model-scale"]),"model-translation":new Ct(ze.paint_model["model-translation"]),"model-color":new Ct(ze.paint_model["model-color"]),"model-color-mix-intensity":new Ct(ze.paint_model["model-color-mix-intensity"]),"model-type":new vt(ze.paint_model["model-type"]),"model-cast-shadows":new vt(ze.paint_model["model-cast-shadows"]),"model-receive-shadows":new vt(ze.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new vt(ze.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Ct(ze.paint_model["model-emissive-strength"]),"model-roughness":new Ct(ze.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Ct(ze.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new vt(ze.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new vt(ze.paint_model["model-front-cutoff"]),"model-elevation-reference":new vt(ze.paint_model["model-elevation-reference"]),"model-color-use-theme":new Ct({type:"string",default:"default","property-type":"data-driven"})}))},r,i,c),this.layer=a,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(a){return new n2(a)}getProgramIds(){return["model"]}is3D(a){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(a){return a instanceof Cw?bt-1:0}queryRenderedFeatures(a,r,i){const c=r.getSource();if(!(c&&c instanceof lf))return{};const d=c,m={};m[this.id]=[];const g=m[this.id];let v=0;for(const S of d.models){const E=r.getFeatureState(this.sourceLayer,S.id),C={type:"Unknown",id:S.id,properties:S.featureProperties},I=this.paint.get("model-rotation").evaluate(C,E),R=this.paint.get("model-scale").evaluate(C,E),L=this.paint.get("model-translation").evaluate(C,E),z=this.paint.get("model-elevation-reference");let U=[];lw(U,S,i,S.position,I,R,L,z==="ground",z==="ground",!1),i.projection.name==="globe"&&(U=aw(U,i));const q=ee([],i.projMatrix,U),W=AT(a.isPointQuery()?a.screenBounds:a.screenGeometry,i,q,S.aabb);if(W!=null){const re=new af(void 0,0,0,0,S.id);re.layer=this.layer,re.properties=structuredClone(S.featureProperties),re.properties.layer=this.id,re.properties.uri=S.uri,re.properties.orientation=S.orientation,re.sourceLayer=this.sourceLayer,re.geometry={type:"Point",coordinates:[S.position.lng,S.position.lat]},re.state=E,re.source=this.source,g.push({featureIndex:v,feature:re,intersectionZ:W})}++v}return m}queryIntersectsFeature(a,r,i,c,d,m){if(!this.modelManager)return!1;const g=this.modelManager,v=a.tile.getBucket(this);if(!(v&&v instanceof n2))return!1;for(const S in v.instancesPerModel){const E=v.instancesPerModel[S],C=r.id!==void 0?r.id:r.properties&&r.properties.hasOwnProperty("id")?r.properties.id:void 0;if(E.idToFeaturesIndex.hasOwnProperty(C)){const I=E.features[E.idToFeaturesIndex[C]],R=g.getModel(S,this.scope);if(!R)return!1;let L=[];const z=new l(0,0),U=v.canonical;let q=Number.MAX_VALUE;for(let W=0;W<I.instancedDataCount;++W){const re=16*(I.instancedDataOffset+W),ie=E.instancedDataArray.float32,ue=[ie[re+4],ie[re+5],ie[re+6]];s2(U,z,Math.floor(ie[re]),Math.floor(ie[re+1])),lw(L,R,m,z,I.rotation,I.scale,ue,!1,!1,!1),m.projection.name==="globe"&&(L=aw(L,m));const ve=ee([],m.projMatrix,L),me=a.queryGeometry,be=AT(me.isPointQuery()?me.screenBounds:me.screenGeometry,m,ve,R.aabb);be!=null&&(q=Math.min(be,q))}return q!==Number.MAX_VALUE&&q}}return!1}_handleOverridablePaintPropertyUpdate(a,r,i){return!(!this.layout||r.isDataDriven()||i.isDataDriven()||a!=="model-color"&&a!=="model-color-mix-intensity"&&a!=="model-rotation"&&a!=="model-scale"&&a!=="model-translation"&&a!=="model-emissive-strength")}_isPropertyZoomDependent(a){const r=this._transitionablePaint._values[a];return r!=null&&r.value!=null&&r.value.expression!=null&&r.value.expression instanceof uu}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends ho{constructor(a,r,i,c){super(a,{layout:vP||(vP=new hi({"clip-layer-types":new vt(ze.layout_clip["clip-layer-types"]),"clip-layer-scope":new vt(ze.layout_clip["clip-layer-scope"])})),paint:xP||(xP=new hi({}))},r,i,c)}recalculate(a,r){super.recalculate(a,r)}createBucket(a){return new wP(a)}is3D(a){return!0}}},o2=new wn(0,0,0),a2={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},l2={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},Iw={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},l$={PAINT_ORDER_FILL_AND_STROKE:1},Ky={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},GR={MASK_TYPE_LUMINANCE:1};function c$(a,r,i){a===1&&r.icons.push(function(c,d){return function(m){if(m.usvg_tree.height||(m.usvg_tree.height=m.usvg_tree.width),!m.metadata)return m;const{metadata:g}=m;if(g.content_area){const{content_area:v}=g;v.left==null&&(v.left=0),v.top==null&&(v.top=v.left),v.width==null&&(v.width=m.usvg_tree.width),v.height==null&&(v.height=v.width)}if(g.text_placeholder){const{text_placeholder:v}=g;v.top==null&&(v.top=v.left),v.height==null&&(v.height=v.width)}return g.stretch_x&&g.stretch_x.length&&HR(g,"x"),g.stretch_y&&g.stretch_y.length&&HR(g,"y"),m}(c.readFields(u$,{name:void 0},d))}(i,i.readVarint()+i.pos))}function HR(a,r){const i=[],c=a[`stretch_${r}`];let d=null;for(let m=0;m<c.length;m++)d===null?d=i.length===0?c[0]:i[i.length-1][1]+c[m]:(i.push([d,d+c[m]]),d=null);a[`stretch_${r}_areas`]=i}function u$(a,r,i){a===1?r.name=i.readString():a===2?r.metadata=function(c,d){return c.readFields(d$,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},d)}(i,i.readVarint()+i.pos):a===3&&(r.usvg_tree=function(c,d){return c.readFields(p$,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},d)}(i,i.readVarint()+i.pos),r.data="usvg_tree")}function d$(a,r,i){a===1?r.stretch_x=i.readPackedVarint():a===2?r.stretch_y=i.readPackedVarint():a===3?r.content_area=WR(i,i.readVarint()+i.pos):a===4?r.variables.push(function(c,d){return c.readFields(f$,{name:void 0},d)}(i,i.readVarint()+i.pos)):a===5&&(r.text_placeholder=WR(i,i.readVarint()+i.pos))}function WR(a,r){return a.readFields(h$,{},r)}function h$(a,r,i){a===1?r.left=i.readVarint():a===2?r.width=i.readVarint():a===3?r.top=i.readVarint():a===4&&(r.height=i.readVarint())}function f$(a,r,i){a===1?r.name=i.readString():a===2&&(r.rgb_color=Rw(i.readVarint()),r.value="rgb_color")}function p$(a,r,i){a===1?r.width=r.height=i.readVarint():a===2?r.height=i.readVarint():a===3?r.children.push(Pw(i,i.readVarint()+i.pos)):a===4?r.linear_gradients.push(function(c,d){return c.readFields(w$,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},d)}(i,i.readVarint()+i.pos)):a===5?r.radial_gradients.push(function(c,d){return c.readFields(S$,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},d)}(i,i.readVarint()+i.pos)):a===7?r.clip_paths.push(function(c,d){return c.readFields(T$,{children:[]},d)}(i,i.readVarint()+i.pos)):a===8&&r.masks.push(function(c,d){const m=c.readFields(E$,{left:0,width:20,mask_type:GR.MASK_TYPE_LUMINANCE,children:[]},d);return m.height==null&&(m.height=m.width),m.top==null&&(m.top=m.left),m}(i,i.readVarint()+i.pos))}function Pw(a,r){return a.readFields(m$,{},r)}function m$(a,r,i){a===1?(r.group=function(c,d){return c.readFields(g$,{opacity:255,children:[]},d)}(i,i.readVarint()+i.pos),r.node="group"):a===2&&(r.path=function(c,d){return c.readFields(y$,{paint_order:1,commands:[],step:1,diffs:[],rule:a2.PATH_RULE_NON_ZERO},d)}(i,i.readVarint()+i.pos),r.node="path")}function g$(a,r,i){a===1?r.transform=Mw(i,i.readVarint()+i.pos):a===2?r.opacity=i.readVarint():a===5?r.clip_path_idx=i.readVarint():a===6?r.mask_idx=i.readVarint():a===7&&r.children.push(Pw(i,i.readVarint()+i.pos))}function Mw(a,r){return a.readFields(_$,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},r)}function _$(a,r,i){a===1?r.sx=i.readFloat():a===2?r.ky=i.readFloat():a===3?r.kx=i.readFloat():a===4?r.sy=i.readFloat():a===5?r.tx=i.readFloat():a===6&&(r.ty=i.readFloat())}function y$(a,r,i){a===1?r.fill=function(c,d){return c.readFields(v$,{rgb_color:o2,paint:"rgb_color",opacity:255},d)}(i,i.readVarint()+i.pos):a===2?r.stroke=function(c,d){return c.readFields(x$,{rgb_color:o2,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},d)}(i,i.readVarint()+i.pos):a===3?r.paint_order=i.readVarint():a===5?i.readPackedVarint(r.commands):a===6?r.step=i.readFloat():a===7?i.readPackedSVarint(r.diffs):a===8&&(r.rule=i.readVarint())}function v$(a,r,i){a===1?(r.rgb_color=Rw(i.readVarint()),r.paint="rgb_color"):a===2?(r.linear_gradient_idx=i.readVarint(),r.paint="linear_gradient_idx"):a===3?(r.radial_gradient_idx=i.readVarint(),r.paint="radial_gradient_idx"):a===5&&(r.opacity=i.readVarint())}function Rw(a){return new wn((a>>16&255)/255,(a>>8&255)/255,(255&a)/255,1)}function x$(a,r,i){a===1?(r.rgb_color=Rw(i.readVarint()),r.paint="rgb_color"):a===2?(r.linear_gradient_idx=i.readVarint(),r.paint="linear_gradient_idx"):a===3?(r.radial_gradient_idx=i.readVarint(),r.paint="radial_gradient_idx"):a===5?i.readPackedFloat(r.dasharray):a===6?r.dashoffset=i.readFloat():a===7?r.miterlimit=i.readFloat():a===8?r.opacity=i.readVarint():a===9?r.width=i.readFloat():a===10?r.linecap=i.readVarint():a===11&&(r.linejoin=i.readVarint())}function w$(a,r,i){a===1?r.transform=Mw(i,i.readVarint()+i.pos):a===2?r.spread_method=i.readVarint():a===3?r.stops.push(qR(i,i.readVarint()+i.pos)):a===4?r.x1=i.readFloat():a===5?r.y1=i.readFloat():a===6?r.x2=i.readFloat():a===7&&(r.y2=i.readFloat())}function qR(a,r){return a.readFields(b$,{offset:0,opacity:255,rgb_color:o2},r)}function b$(a,r,i){a===1?r.offset=i.readFloat():a===2?r.opacity=i.readVarint():a===3&&(r.rgb_color=Rw(i.readVarint()))}function S$(a,r,i){a===1?r.transform=Mw(i,i.readVarint()+i.pos):a===2?r.spread_method=i.readVarint():a===3?r.stops.push(qR(i,i.readVarint()+i.pos)):a===4?r.cx=i.readFloat():a===5?r.cy=i.readFloat():a===6?r.r=i.readFloat():a===7?r.fx=i.readFloat():a===8?r.fy=i.readFloat():a===9&&(r.fr=i.readFloat())}function T$(a,r,i){a===1?r.transform=Mw(i,i.readVarint()+i.pos):a===2?r.clip_path_idx=i.readVarint():a===3&&r.children.push(Pw(i,i.readVarint()+i.pos))}function E$(a,r,i){a===1?r.left=r.top=i.readFloat():a===2?r.width=r.height=i.readFloat():a===3?r.top=i.readFloat():a===4?r.height=i.readFloat():a===5?r.mask_type=i.readVarint():a===6?r.mask_idx=i.readVarint():a===7&&r.children.push(Pw(i,i.readVarint()+i.pos))}class k${static calculate(r={},i=[]){const c=new Map,d=new Map;if(Object.keys(r).length===0)return c;i.forEach(m=>{d.set(m.name,m.rgb_color||new wn(0,0,0))});for(const[m,g]of Object.entries(r))d.has(m)?c.set(d.get(m).toString(),g):console.warn(`Ignoring unknown image variable "${m}"`);return c}}function Im(a,r=255,i){const c=r/255,d=a.toString(),m=i.has(d)?i.get(d).clone():a.clone();return m.a*=c,m.toString()}function Zy(a,r){if(!Qa()){const i=document.createElement("canvas");return i.width=a,i.height=r,i}return new OffscreenCanvas(a,r)}let c2,Xy=null;function u2(a,r,i,c,d){for(const m of c.children)KR(a,r,i,m,d)}function KR(a,r,i,c,d){c.group?(a.save(),function(m,g,v,S,E){const C=S.mask_idx!=null?v.masks[S.mask_idx]:null,I=S.clip_path_idx!=null?v.clip_paths[S.clip_path_idx]:null;if(S.transform&&(g=Pm(S.transform).preMultiplySelf(g)),!function(z,U,q){return z.opacity!==255||U||q}(S,I!=null,C!=null))return void u2(m,g,v,S,E);const R=Zy(m.canvas.width,m.canvas.height),L=R.getContext("2d");u2(L,g,v,S,E),I&&tD(L,g,v,I),C&&rD(L,g,v,C,E),m.globalAlpha=S.opacity/255,m.drawImage(R,0,0)}(a,r,i,c.group,d),a.restore()):c.path&&(a.save(),function(m,g,v,S,E){m.setTransform(g),S.paint_order===l$.PAINT_ORDER_FILL_AND_STROKE?(ZR(m,v,S,E),YR(m,v,S,E)):(YR(m,v,S,E),ZR(m,v,S,E))}(a,r,i,c.path,d),a.restore())}function ZR(a,r,i,c){const d=i.fill;if(!d)return;const m=d.opacity/255;switch(a.save(),a.beginPath(),nD(i,a),d.paint){case"rgb_color":a.fillStyle=Im(d.rgb_color,d.opacity,c);break;case"linear_gradient_idx":{const g=r.linear_gradients[d.linear_gradient_idx];g.transform&&a.setTransform(Pm(g.transform).preMultiplySelf(a.getTransform())),a.fillStyle=JR(a,g,m,c);break}case"radial_gradient_idx":{const g=r.radial_gradients[d.radial_gradient_idx];g.transform&&a.setTransform(Pm(g.transform).preMultiplySelf(a.getTransform())),a.fillStyle=QR(a,g,m,c)}}a.fill(XR(i)),a.restore()}function XR(a){return a.rule===a2.PATH_RULE_NON_ZERO?"nonzero":a.rule===a2.PATH_RULE_EVEN_ODD?"evenodd":void 0}function YR(a,r,i,c){const d=i.stroke;if(!d)return;const m=iD(i);a.lineWidth=d.width,a.miterLimit=d.miterlimit,a.setLineDash(d.dasharray),a.lineDashOffset=d.dashoffset;const g=d.opacity/255;switch(d.paint){case"rgb_color":a.strokeStyle=Im(d.rgb_color,d.opacity,c);break;case"linear_gradient_idx":a.strokeStyle=JR(a,r.linear_gradients[d.linear_gradient_idx],g,c,!0);break;case"radial_gradient_idx":a.strokeStyle=QR(a,r.radial_gradients[d.radial_gradient_idx],g,c,!0)}switch(d.linejoin){case Iw.LINE_JOIN_MITER_CLIP:case Iw.LINE_JOIN_MITER:a.lineJoin="miter";break;case Iw.LINE_JOIN_ROUND:a.lineJoin="round";break;case Iw.LINE_JOIN_BEVEL:a.lineJoin="bevel"}switch(d.linecap){case l2.LINE_CAP_BUTT:a.lineCap="butt";break;case l2.LINE_CAP_ROUND:a.lineCap="round";break;case l2.LINE_CAP_SQUARE:a.lineCap="square"}a.stroke(m)}function JR(a,r,i,c,d=!1){if(r.stops.length===1){const R=r.stops[0];return Im(R.rgb_color,R.opacity*i,c)}const{x1:m,y1:g,x2:v,y2:S}=r;let E=new DOMPoint(m,g),C=new DOMPoint(v,S);if(d){const R=Pm(r.transform);E=R.transformPoint(E),C=R.transformPoint(C)}const I=a.createLinearGradient(E.x,E.y,C.x,C.y);for(const R of r.stops)I.addColorStop(R.offset,Im(R.rgb_color,R.opacity*i,c));return I}function QR(a,r,i,c,d=!1){if(r.stops.length===1){const W=r.stops[0];return Im(W.rgb_color,W.opacity*i,c)}const m=Pm(r.transform),{fx:g,fy:v,fr:S,cx:E,cy:C,r:I}=r;let R=new DOMPoint(g,v),L=new DOMPoint(E,C),z=S,U=I;if(d){R=m.transformPoint(R),L=m.transformPoint(L);const W=(m.a+m.d)/2;z=S*W,U=r.r*W}const q=a.createRadialGradient(R.x,R.y,z,L.x,L.y,U);for(const W of r.stops)q.addColorStop(W.offset,Im(W.rgb_color,W.opacity*i,c));return q}function eD(a,r,i,c){const d=c.transform?Pm(c.transform).preMultiplySelf(r):r,m=Zy(a.canvas.width,a.canvas.height),g=m.getContext("2d");for(const S of c.children)if(S.group)eD(g,d,i,S.group);else if(S.path){const E=S.path,C=new Path2D;C.addPath(iD(E),d),g.fill(C,XR(E))}const v=c.clip_path_idx!=null?i.clip_paths[c.clip_path_idx]:null;v&&tD(g,d,i,v),a.globalCompositeOperation="source-over",a.drawImage(m,0,0)}function tD(a,r,i,c){const d=Zy(a.canvas.width,a.canvas.height);eD(d.getContext("2d"),r,i,c),a.globalCompositeOperation="destination-in",a.drawImage(d,0,0)}function rD(a,r,i,c,d){if(c.children.length===0)return;const m=c.mask_idx!=null?i.masks[c.mask_idx]:null;m&&rD(a,r,i,m,d);const g=a.canvas.width,v=a.canvas.height,S=Zy(g,v),E=S.getContext("2d"),C=c.width,I=c.height,R=c.left,L=c.top,z=new Path2D,U=new Path2D;U.rect(R,L,C,I),z.addPath(U,r),E.clip(z);for(const re of c.children)KR(E,r,i,re,d);const q=E.getImageData(0,0,g,v),W=q.data;if(c.mask_type===GR.MASK_TYPE_LUMINANCE)for(let re=0;re<W.length;re+=4)W[re+3]=W[re+3]/255*(.2126*W[re]+.7152*W[re+1]+.0722*W[re+2]);E.putImageData(q,0,0),a.globalCompositeOperation="destination-in",a.drawImage(S,0,0)}function Pm(a){return a?new DOMMatrix([a.sx,a.ky,a.kx,a.sy,a.tx,a.ty]):new DOMMatrix}function nD(a,r){const i=a.step;let c=a.diffs[0]*i,d=a.diffs[1]*i;r.moveTo(c,d);for(let m=0,g=2;m<a.commands.length;m++)switch(a.commands[m]){case Ky.PATH_COMMAND_MOVE:c+=a.diffs[g++]*i,d+=a.diffs[g++]*i,r.moveTo(c,d);break;case Ky.PATH_COMMAND_LINE:c+=a.diffs[g++]*i,d+=a.diffs[g++]*i,r.lineTo(c,d);break;case Ky.PATH_COMMAND_QUAD:{const v=c+a.diffs[g++]*i,S=d+a.diffs[g++]*i;c=v+a.diffs[g++]*i,d=S+a.diffs[g++]*i,r.quadraticCurveTo(v,S,c,d);break}case Ky.PATH_COMMAND_CUBIC:{const v=c+a.diffs[g++]*i,S=d+a.diffs[g++]*i,E=v+a.diffs[g++]*i,C=S+a.diffs[g++]*i;c=E+a.diffs[g++]*i,d=C+a.diffs[g++]*i,r.bezierCurveTo(v,S,E,C,c,d);break}case Ky.PATH_COMMAND_CLOSE:r.closePath()}return r}function iD(a){return nD(a,new Path2D)}class Dw{constructor(r){this.capacity=r,this.cache=new Map}get(r){if(!this.cache.has(r))return;const i=this.cache.get(r);return this.cache.delete(r),this.cache.set(r,i),i}put(r,i){this.cache.has(r)?this.cache.delete(r):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(r,i)}delete(r){this.cache.delete(r)}}Ut(Dw,"LRUCache");class d2{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new Gs(r,r.data)}getFromCache(r,i,c){return this.cacheMap.has(c)||this.cacheMap.set(c,new Dw(150)),this.cacheMap.get(c).get(za(r.toString(),i))}setInCache(r,i,c,d){this.cacheDependenciesMap.has(d)||this.cacheDependenciesMap.set(d,new Map),this.cacheMap.has(d)||this.cacheMap.set(d,new Dw(150));const m=this.cacheDependenciesMap.get(d),g=za(r.id.toString(),c);m.get(g)||m.set(g,new Set);const v=this.cacheMap.get(d),S=r.toString();m.get(g).add(S),v.put(za(r.toString(),c),i)}removeImagesFromCacheByIds(r,i,c=0){if(!this.cacheMap.has(c)||!this.cacheDependenciesMap.has(c))return;const d=this.cacheMap.get(c),m=this.cacheDependenciesMap.get(c);for(const g of r){const v=za(g.toString(),i);if(m.has(v)){for(const S of m.get(v))d.delete(S);m.delete(v)}}}rasterize(r,i,c,d){const m=this.getFromCache(r,c,d);if(m)return m.clone();const g=function(S,E){const C=k$.calculate(E.params,S.metadata?S.metadata.variables:[]),I=S.usvg_tree,R=I.width,L=I.height,z=Math.max(1,Math.round(R*E.sx)),U=Math.max(1,Math.round(L*E.sy)),q=new DOMMatrix([z/R,0,0,U/L,0,0]);return Xy===null&&(Xy=Zy(10,10),c2=Xy.getContext("2d",{willReadFrequently:!0})),Xy.width=z,Xy.height=U,u2(c2,q,I,I,C),c2.getImageData(0,0,z,U)}(i.icon,r),v=d2._getImage(g);return this.setInCache(r,v,c,d),v.clone()}}class sD{constructor(r){this.size=r,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(r,i){const c=this.toIdx(r,i);return{min:this.minimums[c],max:this.maximums[c]}}isLeaf(r,i){return this.leaves[this.toIdx(r,i)]}toIdx(r,i){return i*this.size+r}}function oD(a,r,i,c){let d=0,m=Number.MAX_VALUE;for(let g=0;g<3;g++)if(Math.abs(c[g])<1e-15){if(i[g]<a[g]||i[g]>r[g])return null}else{const v=1/c[g];let S=(a[g]-i[g])*v,E=(r[g]-i[g])*v;if(S>E){const C=S;S=E,E=C}if(S>d&&(d=S),E<m&&(m=E),d>m)return null}return d}function aD(a,r,i,c,d,m,g,v,S,E,C){const I=c-a,R=d-r,L=m-i,z=g-a,U=v-r,q=S-i,W=C[1]*q-C[2]*U,re=C[2]*z-C[0]*q,ie=C[0]*U-C[1]*z,ue=I*W+R*re+L*ie;if(Math.abs(ue)<1e-15)return null;const ve=1/ue,me=E[0]-a,be=E[1]-r,ke=E[2]-i,Pe=(me*W+be*re+ke*ie)*ve;if(Pe<0||Pe>1)return null;const We=be*L-ke*R,Le=ke*I-me*L,Xe=me*R-be*I,rt=(C[0]*We+C[1]*Le+C[2]*Xe)*ve;return rt<0||Pe+rt>1?null:(z*We+U*Le+q*Xe)*ve}function lD(a,r,i){return(a-r)/(i-r)}function cD(a,r,i,c,d,m,g,v,S){const E=1<<i,C=m-c,I=g-d,R=(a+1)/E*C+c,L=(r+0)/E*I+d,z=(r+1)/E*I+d;v[0]=(a+0)/E*C+c,v[1]=L,S[0]=R,S[1]=z}class uD{constructor(r){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=r,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(m){const g=Math.ceil(Math.log2(m.dim/8)),v=[];let S=Math.ceil(Math.pow(2,g));const E=1/S,C=(L,z,U,q,W)=>{const re=q?1:0,ie=(L+1)*U-re,ue=z*U,ve=(z+1)*U-re;W[0]=L*U,W[1]=ue,W[2]=ie,W[3]=ve};let I=new sD(S);const R=[];for(let L=0;L<S*S;L++){C(L%S,Math.floor(L/S),E,!1,R);const z=Td(R[0],R[1],m),U=Td(R[2],R[1],m),q=Td(R[2],R[3],m),W=Td(R[0],R[3],m);I.minimums.push(Math.min(z,U,q,W)),I.maximums.push(Math.max(z,U,q,W)),I.leaves.push(1)}for(v.push(I),S/=2;S>=1;S/=2){const L=v[v.length-1];I=new sD(S);for(let z=0;z<S*S;z++){C(z%S,Math.floor(z/S),2,!0,R);const U=L.getElevation(R[0],R[1]),q=L.getElevation(R[2],R[1]),W=L.getElevation(R[2],R[3]),re=L.getElevation(R[0],R[3]),ie=L.isLeaf(R[0],R[1]),ue=L.isLeaf(R[2],R[1]),ve=L.isLeaf(R[2],R[3]),me=L.isLeaf(R[0],R[3]),be=Math.min(U.min,q.min,W.min,re.min),ke=Math.max(U.max,q.max,W.max,re.max),Pe=ie&&ue&&ve&&me;I.maximums.push(ke),I.minimums.push(be),I.leaves.push(ke-be<=5&&Pe?1:0)}v.push(I)}return v}(this.dem),c=i.length-1,d=i[c];this._addNode(d.minimums[0],d.maximums[0],d.leaves[0]),this._construct(i,0,0,c,0)}raycastRoot(r,i,c,d,m,g,v=1){return oD([r,i,-100],[c,d,this.maximums[0]*v],m,g)}raycast(r,i,c,d,m,g,v=1){if(!this.nodeCount)return null;const S=this.raycastRoot(r,i,c,d,m,g,v);if(S==null)return null;const E=[],C=[],I=[],R=[],L=[{idx:0,t:S,nodex:0,nodey:0,depth:0}];for(;L.length>0;){const{idx:z,t:U,nodex:q,nodey:W,depth:re}=L.pop();if(this.leaves[z]){cD(q,W,re,r,i,c,d,I,R);const ue=1<<re,ve=(q+0)/ue,me=(q+1)/ue,be=(W+0)/ue,ke=(W+1)/ue,Pe=Td(ve,be,this.dem)*v,We=Td(me,be,this.dem)*v,Le=Td(me,ke,this.dem)*v,Xe=Td(ve,ke,this.dem)*v,rt=aD(I[0],I[1],Pe,R[0],I[1],We,R[0],R[1],Le,m,g),nt=aD(R[0],R[1],Le,I[0],R[1],Xe,I[0],I[1],Pe,m,g),ut=Math.min(rt!==null?rt:Number.MAX_VALUE,nt!==null?nt:Number.MAX_VALUE);if(ut!==Number.MAX_VALUE)return ut;{const ht=Gr([],m,g,U);if(dD(Pe,We,Xe,Le,lD(ht[0],I[0],R[0]),lD(ht[1],I[1],R[1]))>=ht[2])return U}continue}let ie=0;for(let ue=0;ue<this._siblingOffset.length;ue++){cD((q<<1)+this._siblingOffset[ue][0],(W<<1)+this._siblingOffset[ue][1],re+1,r,i,c,d,I,R),I[2]=-100,R[2]=this.maximums[this.childOffsets[z]+ue]*v;const ve=oD(I,R,m,g);if(ve!=null){const me=ve;E[ue]=me;let be=!1;for(let ke=0;ke<ie&&!be;ke++)me>=E[C[ke]]&&(C.splice(ke,0,ue),be=!0);be||(C[ie]=ue),ie++}}for(let ue=0;ue<ie;ue++){const ve=C[ue];L.push({idx:this.childOffsets[z]+ve,t:E[ve],nodex:(q<<1)+this._siblingOffset[ve][0],nodey:(W<<1)+this._siblingOffset[ve][1],depth:re+1})}}return null}_addNode(r,i,c){return this.minimums.push(r),this.maximums.push(i),this.leaves.push(c),this.childOffsets.push(0),this.nodeCount++}_construct(r,i,c,d,m){if(r[d].isLeaf(i,c)===1)return;this.childOffsets[m]||(this.childOffsets[m]=this.nodeCount);const g=d-1,v=r[g];let S=0,E=0;for(let C=0;C<this._siblingOffset.length;C++){const I=2*i+this._siblingOffset[C][0],R=2*c+this._siblingOffset[C][1],L=v.getElevation(I,R),z=v.isLeaf(I,R),U=this._addNode(L.min,L.max,z);z&&(S|=1<<C),E||(E=U)}for(let C=0;C<this._siblingOffset.length;C++)S&1<<C||this._construct(r,2*i+this._siblingOffset[C][0],2*c+this._siblingOffset[C][1],g,E+C)}}function dD(a,r,i,c,d,m){return ur(ur(a,i,m),ur(r,c,m),d)}function Td(a,r,i){const c=i.dim,d=K(a*c-.5,0,c-1),m=K(r*c-.5,0,c-1),g=Math.floor(d),v=Math.floor(m),S=Math.min(g+1,c-1),E=Math.min(v+1,c-1);return dD(i.get(g,v),i.get(S,v),i.get(g,E),i.get(S,E),d-g,m-v)}const A$={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function C$(a,r,i){return(256*a*256+256*r+i)/10-1e4}function I$(a,r,i){return 256*a+r+i/256-32768}class Lw{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(r,i,c,d=!1){if(this.uid=r,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(c&&c!=="mapbox"&&c!=="terrarium")return void Ft(`"${c}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const m=this.dim=i.height-2,g=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 S=0;S<m;S++)g[this._idx(-1,S)]=g[this._idx(0,S)],g[this._idx(m,S)]=g[this._idx(m-1,S)],g[this._idx(S,-1)]=g[this._idx(S,0)],g[this._idx(S,m)]=g[this._idx(S,m-1)];g[this._idx(-1,-1)]=g[this._idx(0,0)],g[this._idx(m,-1)]=g[this._idx(m-1,0)],g[this._idx(-1,m)]=g[this._idx(0,m-1)],g[this._idx(m,m)]=g[this._idx(m-1,m-1)]}const v=c==="terrarium"?I$:C$;for(let S=0;S<g.length;++S){const E=4*S;this.floatView[S]=v(this.pixels[E],this.pixels[E+1],this.pixels[E+2])}this._timestamp=ns.now()}_buildQuadTree(){this._tree=new uD(this)}get(r,i,c=!1){c&&(r=K(r,-1,this.dim),i=K(i,-1,this.dim));const d=this._idx(r,i);return this.floatView[d]}set(r,i,c){const d=this._idx(r,i),m=this.floatView[d];return this.floatView[d]=c,c-m}static getUnpackVector(r){return A$[r]}_idx(r,i){if(r<-1||r>=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+(r+1)}static pack(r,i){const c=[0,0,0,0],d=Lw.getUnpackVector(i);let m=Math.floor((r+d[3])/d[2]);return c[2]=m%256,m=Math.floor(m/256),c[1]=m%256,m=Math.floor(m/256),c[0]=m,c}getPixels(){return new sP({width:this.stride,height:this.stride},this.pixels)}backfillBorder(r,i,c){if(this.dim!==r.dim)throw new Error("dem dimension mismatch");let d=i*this.dim,m=i*this.dim+this.dim,g=c*this.dim,v=c*this.dim+this.dim;switch(i){case-1:d=m-1;break;case 1:m=d+1}switch(c){case-1:g=v-1;break;case 1:v=g+1}const S=-i*this.dim,E=-c*this.dim;for(let C=g;C<v;C++)for(let I=d;I<m;I++){const R=4*this._idx(I,C),L=4*this._idx(I+S,C+E);this.pixels[R+0]=r.pixels[L+0],this.pixels[R+1]=r.pixels[L+1],this.pixels[R+2]=r.pixels[L+2],this.pixels[R+3]=r.pixels[L+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function P$(a,r,i){a===1?r.headerLength=i.readFixed32():a===2?r.x=i.readVarint():a===3?r.y=i.readVarint():a===4?r.z=i.readVarint():a===5&&r.layers.push(function(c,d){return c.readFields(O$,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},d)}(i,i.readVarint()+i.pos))}function M$(a,r,i){a===1?(r.delta_filter=function(c,d){return c.readFields(R$,{blockSize:0},d)}(i,i.readVarint()+i.pos),r.filter="delta_filter"):a===2?(i.readVarint(),r.filter="zigzag_filter"):a===3?(i.readVarint(),r.filter="bitshuffle_filter"):a===4&&(i.readVarint(),r.filter="byteshuffle_filter")}function R$(a,r,i){a===1&&(r.blockSize=i.readVarint())}function D$(a,r,i){a===1?(i.readVarint(),r.codec="gzip_data"):a===2?(i.readVarint(),r.codec="jpeg_image"):a===3?(i.readVarint(),r.codec="webp_image"):a===4&&(i.readVarint(),r.codec="png_image")}function L$(a,r,i){let c=0,d=0;a===1?r.firstByte=i.readFixed64():a===2?r.lastByte=i.readFixed64():a===3?r.filters.push(function(m,g){return m.readFields(M$,{},g)}(i,i.readVarint()+i.pos)):a===4?r.codec=function(m,g){return m.readFields(D$,{},g)}(i,i.readVarint()+i.pos):a===5?d=i.readFloat():a===6?c=i.readFloat():a===7?r.bands.push(i.readString()):a===8?r.offset=i.readDouble():a===9&&(r.scale=i.readDouble()),r.offset===0&&(r.offset=d),r.scale===0&&(r.scale=c)}function O$(a,r,i){a===1?r.version=i.readVarint():a===2?r.name=i.readString():a===3?r.units=i.readString():a===4?r.tileSize=i.readVarint():a===5?r.buffer=i.readVarint():a===6?r.pixelFormat=i.readVarint():a===7&&r.dataIndex.push(function(c,d){return c.readFields(L$,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},d)}(i,i.readVarint()+i.pos))}function z$(a,r,i){if(a===2)(function(c,d,m){c.readFields(F$,m,d)})(i,i.readVarint()+i.pos,r);else if(a===3)throw new Error("Not implemented")}function F$(a,r,i){if(a===1){let c=0;const d=i.readVarint()+i.pos;for(;i.pos<d;)r[c++]=i.readVarint()}}function B$(a,r){if(r.length!==4)throw new Error(`Expected data of dimension 4 but got ${r.length}.`);let i=r[3];for(let c=2;c>=1;c--){const d=c===1?1:0,m=c===2?1:0;for(let g=0;g<r[0];g++){const v=r[1]*g;for(let S=d;S<r[1];S++){const E=r[2]*(S+v);for(let C=m;C<r[2];C++){const I=r[3]*(C+E);for(let R=0;R<r[3];R++){const L=I+R;a[L]+=a[L-i]}}}}i*=r[c]}return a}function N$(a){for(let r=0,i=a.length;r<i;r++)a[r]=a[r]>>>1^-(1&a[r]);return a}function j$(a,r){switch(r){case"uint32":return a;case"uint16":for(let i=0;i<a.length;i+=2){const c=a[i],d=a[i+1];a[i]=(240&c)>>4|(61440&c)>>8|(240&d)<<4|61440&d,a[i+1]=15&c|(3840&c)>>4|(15&d)<<8|(3840&d)<<4}return a;case"uint8":for(let i=0;i<a.length;i+=4){const c=a[i],d=a[i+1],m=a[i+2],g=a[i+3];a[i+0]=(192&c)>>6|(192&d)>>4|(192&m)>>2|192&g,a[i+1]=(48&c)>>4|(48&d)>>2|48&m|(48&g)<<2,a[i+2]=(12&c)>>2|12&d|(12&m)<<2|(12&g)<<4,a[i+3]=3&c|(3&d)<<2|(3&m)<<4|(3&g)<<6}return a;default:throw new Error(`Invalid pixel format, "${r}"`)}}Ut(Lw,"DEMData"),Ut(uD,"DemMinMaxQuadTree",{omit:["dem"]});var ja=Uint8Array,Yy=Uint16Array,V$=Int32Array,hD=new ja([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]),fD=new ja([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]),U$=new ja([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pD=function(a,r){for(var i=new Yy(31),c=0;c<31;++c)i[c]=r+=1<<a[c-1];var d=new V$(i[30]);for(c=1;c<30;++c)for(var m=i[c];m<i[c+1];++m)d[m]=m-i[c]<<5|c;return{b:i,r:d}},mD=pD(hD,2),gD=mD.b,$$=mD.r;gD[28]=258,$$[258]=28;for(var G$=pD(fD,0).b,_D=new Yy(32768),Yi=0;Yi<32768;++Yi){var Mm=(43690&Yi)>>1|(21845&Yi)<<1;_D[Yi]=((65280&(Mm=(61680&(Mm=(52428&Mm)>>2|(13107&Mm)<<2))>>4|(3855&Mm)<<4))>>8|(255&Mm)<<8)>>1}var Jy=function(a,r,i){for(var c=a.length,d=0,m=new Yy(r);d<c;++d)a[d]&&++m[a[d]-1];var g,v=new Yy(r);for(d=1;d<r;++d)v[d]=v[d-1]+m[d-1]<<1;g=new Yy(1<<r);var S=15-r;for(d=0;d<c;++d)if(a[d])for(var E=d<<4|a[d],C=r-a[d],I=v[a[d]-1]++<<C,R=I|(1<<C)-1;I<=R;++I)g[_D[I]>>S]=E;return g},Qy=new ja(288);for(Yi=0;Yi<144;++Yi)Qy[Yi]=8;for(Yi=144;Yi<256;++Yi)Qy[Yi]=9;for(Yi=256;Yi<280;++Yi)Qy[Yi]=7;for(Yi=280;Yi<288;++Yi)Qy[Yi]=8;var yD=new ja(32);for(Yi=0;Yi<32;++Yi)yD[Yi]=5;var H$=Jy(Qy,9),W$=Jy(yD,5),h2=function(a){for(var r=a[0],i=1;i<a.length;++i)a[i]>r&&(r=a[i]);return r},Hl=function(a,r,i){var c=r/8|0;return(a[c]|a[c+1]<<8)>>(7&r)&i},f2=function(a,r){var i=r/8|0;return(a[i]|a[i+1]<<8|a[i+2]<<16)>>(7&r)},q$=["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"],Wl=function(a,r,i){var c=new Error(r||q$[a]);if(c.code=a,Error.captureStackTrace&&Error.captureStackTrace(c,Wl),!i)throw c;return c},K$=new ja(0),Z$=typeof TextDecoder<"u"&&new TextDecoder;try{Z$.decode(K$,{stream:!0})}catch{}const X$={gzip_data:"gzip"};class fl extends Error{constructor(r){super(r),this.name="MRTError"}}const Y$={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},vD={uint32:1,uint16:2,uint8:4},J$={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let p2;class Ow{constructor(r=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=r}getLayer(r){const i=this.layers[r];if(!i)throw new fl(`Layer '${r}' not found`);return i}getHeaderLength(r){const i=new Uint8Array(r),c=new DataView(r);if(i[0]!==13)throw new fl("File is not a valid MRT.");return c.getUint32(1,!0)}parseHeader(r){const i=new Uint8Array(r),c=this.getHeaderLength(r);if(i.length<c)throw new fl(`Expected header with length >= ${c} but got buffer of length ${i.length}`);const d=new p2(i.subarray(0,c)).readFields(P$,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==d.x||this.y!==d.y||this.z!==d.z))throw new fl(`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 m of d.layers)this.layers[m.name]=new xD(m,{cacheSize:this._cacheSize});return this}createDecodingTask(r){const i=[],c=this.getLayer(r.layerName);for(let d of r.blockIndices){const m=c.dataIndex[d],g=m.firstByte-r.firstByte,v=m.lastByte-r.firstByte;if(c._blocksInProgress.has(d))continue;const S={layerName:c.name,firstByte:g,lastByte:v,pixelFormat:c.pixelFormat,blockIndex:d,blockShape:[m.bands.length].concat(c.bandShape),buffer:c.buffer,codec:m.codec.codec,filters:m.filters.map(E=>E.filter)};c._blocksInProgress.add(d),i.push(S)}return new wD(i,()=>{i.forEach(d=>c._blocksInProgress.delete(d.blockIndex))},(d,m)=>{if(i.forEach(g=>c._blocksInProgress.delete(g.blockIndex)),d)throw d;m.forEach(g=>{this.getLayer(g.layerName).processDecodedData(g)})})}}class xD{constructor({version:r,name:i,units:c,tileSize:d,pixelFormat:m,buffer:g,dataIndex:v},S){if(this.version=r,this.version!==1)throw new fl(`Cannot parse raster layer encoded with MRT version ${r}`);this.name=i,this.units=c,this.tileSize=d,this.buffer=g,this.pixelFormat=Y$[m],this.dataIndex=v,this.bandShape=[d+2*g,d+2*g,vD[this.pixelFormat]],this._decodedBlocks=new Dw(S?S.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return vD[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:r})=>r).flat()}processDecodedData(r){const i=r.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,r.data)}getBlockForBand(r){let i=0;switch(typeof r){case"string":for(const[c,d]of this.dataIndex.entries()){for(const[m,g]of d.bands.entries())if(g===r)return{bandIndex:i+m,blockIndex:c,blockBandIndex:m};i+=d.bands.length}break;case"number":for(const[c,d]of this.dataIndex.entries()){if(r>=i&&r<i+d.bands.length)return{bandIndex:r,blockIndex:c,blockBandIndex:r-i};i+=d.bands.length}break;default:throw new fl(`Invalid band \`${JSON.stringify(r)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(r){let i=1/0,c=-1/0;const d=[],m=new Set;for(const g of r){const{blockIndex:v}=this.getBlockForBand(g);if(v<0)throw new fl(`Invalid band: ${JSON.stringify(g)}`);const S=this.dataIndex[v];d.includes(v)||d.push(v),m.add(v),i=Math.min(i,S.firstByte),c=Math.max(c,S.lastByte)}if(m.size>this.cacheSize)throw new fl(`Number of blocks to decode (${m.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:c,blockIndices:d}}hasBand(r){const{blockIndex:i}=this.getBlockForBand(r);return i>=0}hasDataForBand(r){const{blockIndex:i}=this.getBlockForBand(r);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(r){const{blockIndex:i,blockBandIndex:c}=this.getBlockForBand(r);if(i<0)throw new fl(`Band not found: ${JSON.stringify(r)}`);const d=this._decodedBlocks.get(i.toString());if(!d)throw new fl(`Data for band ${JSON.stringify(r)} of layer "${this.name}" not decoded.`);const m=this.dataIndex[i],g=this.bandShape.reduce((E,C)=>E*C,1),v=c*g,S=d.subarray(v,v+g);return{data:S,bytes:new Uint8Array(S.buffer).subarray(S.byteOffset,S.byteOffset+S.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:m.offset,scale:m.scale}}}Ow.setPbf=function(a){p2=a};class wD{constructor(r,i,c){this.tasks=r,this._onCancel=i,this._onComplete=c,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(r,i){this._finalized||(this._onComplete(r,i),this._finalized=!0)}}Ow.performDecoding=function(a,r){const i=new Uint8Array(a);return Promise.all(r.tasks.map(c=>{const{layerName:d,firstByte:m,lastByte:g,pixelFormat:v,blockShape:S,blockIndex:E,filters:C,codec:I}=c,R=i.subarray(m,g+1),L=new Uint32Array(S[0]*S[1]*S[2]);let z;if(I!=="gzip_data")throw new fl(`Unhandled codec: ${I}`);return z=function(U,q){if(!globalThis.DecompressionStream&&q==="gzip_data")return Promise.resolve(((ue=function(be){be[0]==31&&be[1]==139&&be[2]==8||Wl(6,"invalid gzip data");var ke=be[3],Pe=10;4&ke&&(Pe+=2+(be[10]|be[11]<<8));for(var We=(ke>>3&1)+(ke>>4&1);We>0;We-=!be[Pe++]);return Pe+(2&ke)}(ie=U))+8>ie.length&&Wl(6,"invalid gzip data"),function(be,ke,Pe,We){var Le=be.length;if(!Le||ke.f&&!ke.l)return Pe||new ja(0);var Xe=!Pe,rt=Xe||ke.i!=2,nt=ke.i;Xe&&(Pe=new ja(3*Le));var ut,ht,at=function(In){var hn=Pe.length;if(In>hn){var gn=new ja(Math.max(2*hn,In));gn.set(Pe),Pe=gn}},lt=ke.f||0,Ze=ke.p||0,qe=ke.b||0,ct=ke.l,St=ke.d,_t=ke.m,Yt=ke.n,Lt=8*Le;do{if(!ct){lt=Hl(be,Ze,1);var Nt=Hl(be,Ze+1,3);if(Ze+=3,!Nt){var Ht=be[(Ye=4+((Ze+7)/8|0))-4]|be[Ye-3]<<8,Rr=Ye+Ht;if(Rr>Le){nt&&Wl(0);break}rt&&at(qe+Ht),Pe.set(be.subarray(Ye,Rr),qe),ke.b=qe+=Ht,ke.p=Ze=8*Rr,ke.f=lt;continue}if(Nt==1)ct=H$,St=W$,_t=9,Yt=5;else if(Nt==2){var yt=Hl(be,Ze,31)+257,Wt=Hl(be,Ze+10,15)+4,gr=yt+Hl(be,Ze+5,31)+1;Ze+=14;for(var $r=new ja(gr),qr=new ja(19),Sr=0;Sr<Wt;++Sr)qr[U$[Sr]]=Hl(be,Ze+3*Sr,7);Ze+=3*Wt;var Cn=h2(qr),ge=(1<<Cn)-1,xe=Jy(qr,Cn);for(Sr=0;Sr<gr;){var Ye,dt=xe[Hl(be,Ze,ge)];if(Ze+=15&dt,(Ye=dt>>4)<16)$r[Sr++]=Ye;else{var Mt=0,Rt=0;for(Ye==16?(Rt=3+Hl(be,Ze,3),Ze+=2,Mt=$r[Sr-1]):Ye==17?(Rt=3+Hl(be,Ze,7),Ze+=3):Ye==18&&(Rt=11+Hl(be,Ze,127),Ze+=7);Rt--;)$r[Sr++]=Mt}}var Jt=$r.subarray(0,yt),er=$r.subarray(yt);_t=h2(Jt),Yt=h2(er),ct=Jy(Jt,_t),St=Jy(er,Yt)}else Wl(1);if(Ze>Lt){nt&&Wl(0);break}}rt&&at(qe+131072);for(var wr=(1<<_t)-1,Ir=(1<<Yt)-1,Mr=Ze;;Mr=Ze){var Nr=(Mt=ct[f2(be,Ze)&wr])>>4;if((Ze+=15&Mt)>Lt){nt&&Wl(0);break}if(Mt||Wl(2),Nr<256)Pe[qe++]=Nr;else{if(Nr==256){Mr=Ze,ct=null;break}var cr=Nr-254;Nr>264&&(cr=Hl(be,Ze,(1<<(ln=hD[Sr=Nr-257]))-1)+gD[Sr],Ze+=ln);var mr=St[f2(be,Ze)&Ir],en=mr>>4;if(mr||Wl(3),Ze+=15&mr,er=G$[en],en>3){var ln=fD[en];er+=f2(be,Ze)&(1<<ln)-1,Ze+=ln}if(Ze>Lt){nt&&Wl(0);break}rt&&at(qe+131072);var cn=qe+cr;if(qe<er){var Sn=0-er,Ln=Math.min(er,cn);for(Sn+qe<0&&Wl(3);qe<Ln;++qe)Pe[qe]=(void 0)[Sn+qe]}for(;qe<cn;++qe)Pe[qe]=Pe[qe-er]}}ke.l=ct,ke.p=Mr,ke.b=qe,ke.f=lt,ct&&(lt=1,ke.m=_t,ke.d=St,ke.n=Yt)}while(!lt);return qe!=Pe.length&&Xe?(ut=Pe,((ht=qe)==null||ht>ut.length)&&(ht=ut.length),new ja(ut.subarray(0,ht))):Pe.subarray(0,qe)}(ie.subarray(ue,-8),{i:2},new ja(((W=ie)[(re=W.length)-4]|W[re-3]<<8|W[re-2]<<16|W[re-1]<<24)>>>0))));var W,re,ie,ue;const ve=X$[q];if(!ve)throw new Error(`Unhandled codec: ${q}`);const me=new globalThis.DecompressionStream(ve);return new Response(new Blob([U]).stream().pipeThrough(me)).arrayBuffer().then(be=>new Uint8Array(be))}(R,I).then(U=>(function(q,W){q.readFields(z$,W)}(new p2(U),L),new J$[v](L.buffer))),z.then(U=>{for(let q=C.length-1;q>=0;q--)switch(C[q]){case"delta_filter":B$(U,S);break;case"zigzag_filter":N$(U);break;case"bitshuffle_filter":j$(U,v);break;default:throw new fl(`Unhandled filter "${C[q]}"`)}return{layerName:d,blockIndex:E,data:U}}).catch(U=>{throw U})}))},Ut(wD,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Ut(Ow,"MapboxRasterTile"),Ut(xD,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class bD{constructor(r){this._stringToNumber={},this._numberToString=[];for(let i=0;i<r.length;i++){const c=r[i];this._stringToNumber[c]=i,this._numberToString[i]=c}}encode(r){return this._stringToNumber[r]}decode(r){return this._numberToString[r]}}class SD{constructor(r,i){this.tileID=r,this.x=r.canonical.x,this.y=r.canonical.y,this.z=r.canonical.z,this.grid=new ld(bt,16,0),this.featureIndexArray=new ly,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(r,i,c,d,m,g=0,v=0){const S=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(c,d,m,g);const E=this.grid;for(let C=0;C<i.length;C++){const I=i[C],R=[1/0,1/0,-1/0,-1/0];for(let L=0;L<I.length;L++){const z=I[L];R[0]=Math.min(R[0],z.x),R[1]=Math.min(R[1],z.y),R[2]=Math.max(R[2],z.x),R[3]=Math.max(R[3],z.y)}v!==0&&(R[0]-=v,R[1]-=v,R[2]+=v,R[3]+=v),R[0]<bt&&R[1]<bt&&R[2]>=0&&R[3]>=0&&E.insert(S,R[0],R[1],R[2],R[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Ne(new dw(this.rawTileData)).layers,this.sourceLayerCoder=new bD(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const r in this.vtLayers)this.vtFeatures[r]=[]}return this.vtLayers}query(r,i){const{tilespaceGeometry:c,transform:d,tileTransform:m,pixelPosMatrix:g,availableImages:v,worldview:S}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const E=i.queryRadius?i.queryRadius:0,C=c.bufferedTilespaceBounds,I=this.grid.query(C.min.x,C.min.y,C.max.x,C.max.y,(U,q,W,re)=>fo(c.bufferedTilespaceGeometry,U-E,q-E,W+E,re+E));I.sort(Q$);let R=null;d.elevation&&I.length>0&&(R=Cm.create(d.elevation,this.tileID));const L={};let z;for(let U=0;U<I.length;U++){const q=I[U];if(q===z)continue;z=q;const W=this.featureIndexArray.get(q);let re=null;this.is3DTile?this.loadMatchingModelFeature(L,W,r,c,d,S):this.loadMatchingFeature(L,W,r,v,S,(ie,ue,ve,me=0)=>(re||(re=Te(ie,this.tileID.canonical,m)),ue.queryIntersectsFeature(c,ie,ve,re,this.z,d,g,R,me)))}return L}loadMatchingFeature(r,i,c,d,m,g){const{featureIndex:v,bucketIndex:S,sourceLayerIndex:E,layoutVertexArrayOffset:C}=i,I=this.bucketLayerIDs[S],R=c.layers,L=Object.keys(R);if(L.length&&!Vt(L,I))return;const z=c.sourceCache,U=this.sourceLayerCoder.decode(E),q=this.vtLayers[U].feature(v),W=this.getId(q,U);for(let re=0;re<I.length;re++){const ie=I[re];if(!R[ie])continue;const{styleLayer:ue,targets:ve}=R[ie];let me={};W!==void 0&&(me=z.getFeatureState(ue.sourceLayer,W));const be=!g||g(q,ue,me,C);if(!be)continue;const ke=new af(q,this.z,this.x,this.y,W);ke.tile=this.tileID.canonical,ke.state=me;let Pe=this.serializedLayersCache.get(ie);Pe||(Pe=ue.serialize(),Pe.id=ie,this.serializedLayersCache.set(ie,Pe)),ke.source=Pe.source,ke.sourceLayer=Pe["source-layer"],ke.layer=Object.assign({},Pe),ke.layer.paint=TD(Pe.paint,ue.paint,q,me,d),ke.layer.layout=TD(Pe.layout,ue.layout,q,me,d);let We=!1;for(const Le of ve){this.updateFeatureProperties(ke,Le);const{filter:Xe}=Le;if(Xe){if(q.properties=ke.properties,Xe.needGeometry){const rt=De(q,!0);if(!Xe.filter(new $n(this.tileID.overscaledZ,{worldview:m}),rt,this.tileID.canonical))continue}else if(!Xe.filter(new $n(this.tileID.overscaledZ,{worldview:m}),q))continue}We=!0,Le.targetId&&this.addFeatureVariant(ke,Le)}We&&this.appendToResult(r,ie,v,ke,be)}}loadMatchingModelFeature(r,i,c,d,m,g){const{featureIndex:v,bucketIndex:S}=i,E=this.bucketLayerIDs[S],C=c.layers,I=Object.keys(C);if(!I.length||Vt(I,E))for(let R=0;R<E.length;R++){const L=E[R],{styleLayer:z,targets:U}=C[L];if(z.type!=="model")continue;const q=d.tile,W=q.getBucket(z);if(!(W&&W instanceof Cw))continue;const re=o$(W,v,d,m);if(!re)continue;const{z:ie,x:ue,y:ve}=q.tileID.canonical,{feature:me,intersectionZ:be,position:ke}=re;let Pe={};me.id!==void 0&&(Pe=c.sourceCache.getFeatureState(z.sourceLayer,me.id));const We=new af({},ie,ue,ve,me.id);We.tile=this.tileID.canonical,We.state=Pe,We.properties=me.properties,We.geometry={type:"Point",coordinates:[ke.lng,ke.lat]};let Le=this.serializedLayersCache.get(L);Le||(Le=z.serialize(),Le.id=L,this.serializedLayersCache.set(L,Le)),We.source=Le.source,We.sourceLayer=Le["source-layer"],We.layer=Object.assign({},Le);let Xe=!1;for(const rt of U){this.updateFeatureProperties(We,rt);const{filter:nt}=rt;if(nt){if(me.properties=We.properties,nt.needGeometry){if(!nt.filter(new $n(this.tileID.overscaledZ,{worldview:g}),me,this.tileID.canonical))continue}else if(!nt.filter(new $n(this.tileID.overscaledZ,{worldview:g}),me))continue}Xe=!0,rt.targetId&&this.addFeatureVariant(We,rt)}Xe&&this.appendToResult(r,L,v,We,be)}}updateFeatureProperties(r,i,c){if(i.properties){const d={};for(const m in i.properties){const g=i.properties[m].evaluate({zoom:this.z},r._vectorTileFeature,r.state,r.tile,c);g!=null&&(d[m]=g)}r.properties=d}}addFeatureVariant(r,i,c){const d={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(d.properties=r.properties),r.variants=r.variants||{},r.variants[i.targetId]=r.variants[i.targetId]||[],r.variants[i.targetId].push(d)}appendToResult(r,i,c,d,m){let g=r[i];g===void 0&&(g=r[i]=[]),g.push({featureIndex:c,feature:d,intersectionZ:m})}lookupSymbolFeatures(r,i,c,d,m,g){const v={};this.loadVTLayers();for(const S of r)this.loadMatchingFeature(v,{bucketIndex:i,sourceLayerIndex:c,featureIndex:S,layoutVertexArrayOffset:0},d,m,g);return v}loadFeature(r){const{featureIndex:i,sourceLayerIndex:c}=r;this.loadVTLayers();const d=this.sourceLayerCoder.decode(c),m=this.vtFeatures[d];if(m[i])return m[i];const g=this.vtLayers[d].feature(i);return m[i]=g,g}hasLayer(r){for(const i of this.bucketLayerIDs)for(const c of i)if(r===c)return!0;return!1}getId(r,i){let c=r.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 m=kc(d);if(m.result!=="success"){const g=m.value.map(v=>`${v.key}: ${v.message}`).join(", ");return void Ft(`Failed to create expression for promoteId: ${g}`)}this.promoteIdExpression=m.value}c=this.promoteIdExpression.evaluate({zoom:0},r)}else c=r.properties[d];typeof c=="boolean"&&(c=Number(c))}return c}}function TD(a,r,i,c,d){return Ue(a,(m,g)=>{const v=r instanceof fu?r.get(g):null;return v&&v.evaluate?v.evaluate(i,c,void 0,d):v})}function Q$(a,r){return r-a}Ut(SD,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const ED=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class m2{static from(r){if(!(r instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,c]=new Uint8Array(r,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const d=c>>4;if(d!==1)throw new Error(`Got v${d} data when expected v1.`);const m=ED[15&c];if(!m)throw new Error("Unrecognized array type.");const[g]=new Uint16Array(r,2,1),[v]=new Uint32Array(r,4,1);return new m2(v,g,m,r)}constructor(r,i=64,c=Float64Array,d){if(isNaN(r)||r<0)throw new Error(`Unpexpected numItems value: ${r}.`);this.numItems=+r,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=c,this.IndexArrayType=r<65536?Uint16Array:Uint32Array;const m=ED.indexOf(this.ArrayType),g=2*r*this.ArrayType.BYTES_PER_ELEMENT,v=r*this.IndexArrayType.BYTES_PER_ELEMENT,S=(8-v%8)%8;if(m<0)throw new Error(`Unexpected typed array class: ${c}.`);d&&d instanceof ArrayBuffer?(this.data=d,this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+v+S,2*r),this._pos=2*r,this._finished=!0):(this.data=new ArrayBuffer(8+g+v+S),this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+v+S,2*r),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+m]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=r)}add(r,i){const c=this._pos>>1;return this.ids[c]=c,this.coords[this._pos++]=r,this.coords[this._pos++]=i,c}finish(){const r=this._pos>>1;if(r!==this.numItems)throw new Error(`Added ${r} items when expected ${this.numItems}.`);return g2(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(r,i,c,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:g,nodeSize:v}=this,S=[0,m.length-1,0],E=[];for(;S.length;){const C=S.pop()||0,I=S.pop()||0,R=S.pop()||0;if(I-R<=v){for(let q=R;q<=I;q++){const W=g[2*q],re=g[2*q+1];W>=r&&W<=c&&re>=i&&re<=d&&E.push(m[q])}continue}const L=R+I>>1,z=g[2*L],U=g[2*L+1];z>=r&&z<=c&&U>=i&&U<=d&&E.push(m[L]),(C===0?r<=z:i<=U)&&(S.push(R),S.push(L-1),S.push(1-C)),(C===0?c>=z:d>=U)&&(S.push(L+1),S.push(I),S.push(1-C))}return E}within(r,i,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:m,nodeSize:g}=this,v=[0,d.length-1,0],S=[],E=c*c;for(;v.length;){const C=v.pop()||0,I=v.pop()||0,R=v.pop()||0;if(I-R<=g){for(let q=R;q<=I;q++)AD(m[2*q],m[2*q+1],r,i)<=E&&S.push(d[q]);continue}const L=R+I>>1,z=m[2*L],U=m[2*L+1];AD(z,U,r,i)<=E&&S.push(d[L]),(C===0?r-c<=z:i-c<=U)&&(v.push(R),v.push(L-1),v.push(1-C)),(C===0?r+c>=z:i+c>=U)&&(v.push(L+1),v.push(I),v.push(1-C))}return S}}function g2(a,r,i,c,d,m){if(d-c<=i)return;const g=c+d>>1;kD(a,r,g,c,d,m),g2(a,r,i,c,g-1,1-m),g2(a,r,i,g+1,d,1-m)}function kD(a,r,i,c,d,m){for(;d>c;){if(d-c>600){const E=d-c+1,C=i-c+1,I=Math.log(E),R=.5*Math.exp(2*I/3),L=.5*Math.sqrt(I*R*(E-R)/E)*(C-E/2<0?-1:1);kD(a,r,i,Math.max(c,Math.floor(i-C*R/E+L)),Math.min(d,Math.floor(i+(E-C)*R/E+L)),m)}const g=r[2*i+m];let v=c,S=d;for(ev(a,r,c,i),r[2*d+m]>g&&ev(a,r,c,d);v<S;){for(ev(a,r,v,S),v++,S--;r[2*v+m]<g;)v++;for(;r[2*S+m]>g;)S--}r[2*c+m]===g?ev(a,r,c,S):(S++,ev(a,r,S,d)),S<=i&&(c=S+1),i<=S&&(d=S-1)}}function ev(a,r,i,c){_2(a,i,c),_2(r,2*i,2*c),_2(r,2*i+1,2*c+1)}function _2(a,r,i){const c=a[r];a[r]=a[i],a[i]=c}function AD(a,r,i,c){const d=a-i,m=r-c;return d*d+m*m}o.$=lp,o.A=kl,o.B=za,o.C=2,o.D=mm,o.E=iu,o.F=Oy,o.G=QM,o.H=ap,o.I=Js,o.J=Ax,o.K=Xt,o.L=Zu,o.M=Rp,o.N=zh,o.O=px,o.P=it,o.Q=Fh,o.R=mh,o.S=Up,o.T=ET,o.U=kc,o.V=Aw,o.W=U_,o.X=ed,o.Y=Qu,o.Z=Ph,o._=co,o.a=function(a){return Vr.API_CDN_URL_REGEX.test(a)},o.a$=N,o.a0=pr,o.a1=ha,o.a2=ll,o.a3=class extends Aw{},o.a4=Dp,o.a5=fx,o.a6=ze,o.a7=function(a){const r=a.value;return r?pr(r)?r2(r,!0)?[]:[new Aw(a.key,r,`invalid url "${r}"`)]:[new Aw(a.key,r,`string expected, "${Xt(r)}" found`)]:[]},o.a8=Sx,o.a9=hi,o.aA=K,o.aB=ee,o.aC=rs,o.aD=Vs,o.aE=Rn,o.aF=T,o.aG=ce,o.aH=function(a,r){const i={};for(let c=0;c<r.length;c++){const d=r[c];d in a&&(i[d]=a[d])}return i},o.aI=p,o.aJ=A,o.aK=class{constructor(a){this.entries={},this.scheduler=a}request(a,r,i,c){const d=this.entries[a]=this.entries[a]||{callbacks:[]};if(d.result){const[m,g]=d.result;return this.scheduler?this.scheduler.add(()=>{c(m,g)},r):c(m,g),()=>{}}return d.callbacks.push(c),d.cancel||(d.cancel=i((m,g)=>{d.result=[m,g];for(const v of d.callbacks)this.scheduler?this.scheduler.add(()=>{v(m,g)},r):v(m,g);setTimeout(()=>delete this.entries[a],3e3)})),()=>{d.result||(d.callbacks=d.callbacks.filter(m=>m!==c),d.callbacks.length||(d.cancel(),delete this.entries[a]))}}},o.aL=function(a,r,i){const c=JSON.stringify(a.request);return a.data&&(this.deduped.entries[c]={result:[null,a.data]}),this.deduped.request(c,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom},d=>{const m=El(a.request,(g,v,S)=>{g?d(g):v&&d(null,{rawData:v,vectorTile:i?void 0:new Ne(new dw(v)),responseHeaders:new Map(S.entries())})});return()=>{m.cancel(),d()}},r)},o.aM=function(a){return a?{cacheControl:a.get("Cache-Control"),expires:a.get("Expires")}:{cacheControl:void 0,expires:void 0}},o.aN=Oo,o.aO=function(a){da++,da>Yf&&(a.getActor().send("enforceCacheSizeLimit",Xf),da=0)},o.aP=function(a){return a<=1?1:Math.pow(2,Math.floor(Math.log2(a)))},o.aQ=ci,o.aR=CR,o.aS=LR,o.aT=l,o.aU=AR,o.aV=function(a,r){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){r(null,i)};for(let c=0;c<a.length;c++){const d=document.createElement("source");vS(a[c])||(i.crossOrigin="Anonymous"),d.src=a[c],i.appendChild(d)}return{cancel:()=>{}}},o.aW=Py,o.aX=lf,o.aY=Oe,o.aZ=Ny,o.a_=D,o.aa=vt,o.ab=class{constructor(a){this.specification=a}possiblyEvaluate(a,r){return br(a.expression.evaluate(r))}interpolate(a,r,i){return{x:ur(a.x,r.x,i),y:ur(a.y,r.y,i),z:ur(a.z,r.z,i),azimuthal:ur(a.azimuthal,r.azimuthal,i),polar:ur(a.polar,r.polar,i)}}},o.ac=$n,o.ad=uu,o.ae=ae,o.af=Un,o.ag=It,o.ah=ne,o.ai=fu,o.aj=vd,o.ak=ur,o.al=bt,o.am=d_,o.an=zr,o.ao=wn,o.ap=class{constructor(a){this.specification=a}possiblyEvaluate(a,r){return function([i,c]){const d=br([1,i,c]);return{x:d.x,y:d.y,z:d.z}}(a.expression.evaluate(r))}interpolate(a,r,i){return{x:ur(a.x,r.x,i),y:ur(a.y,r.y,i),z:ur(a.z,r.z,i)}}},o.aq=function(a,r,i=0,c=!0){const d=new it(i,i),m=a.sub(d),g=r.add(d),v=[m,new it(g.x,m.y),g,new it(m.x,g.y)];return c&&v.push(m.clone()),v},o.ar=function(a,r){const i=[];for(let c=0;c<a.length;c++){const d=fe(c-1,-1,a.length-1),m=fe(c+1,-1,a.length-1),g=a[c],v=a[m],S=a[d].sub(g).unit(),E=v.sub(g).unit(),C=E.angleWithSep(S.x,S.y),I=S.add(E).unit().mult(-1*r/Math.sin(C/2));i.push(g.add(I))}return i},o.as=hR,o.at=fo,o.au=function(a,r,i=0){return Ot(((r.x-i)*a.scale-a.x)*bt,(r.y*a.scale-a.y)*bt,B(r.z,r.y))},o.av=Zn,o.aw=un,o.ax=$t,o.ay=AM,o.az=function(a){let r=1/0,i=1/0,c=-1/0,d=-1/0;for(const m of a)r=Math.min(r,m.x),i=Math.min(i,m.y),c=Math.max(c,m.x),d=Math.max(d,m.y);return{min:new it(r,i),max:new it(c,d)}},o.b=function(a){return Vr.API_FONTS_REGEX.test(a)},o.b$=AP,o.b0=Ni,o.b1=dd,o.b2=Re,o.b3=zx,o.b4=Sw,o.b5=function(){Dl.isLoading()||Dl.isLoaded()||Vh()!=="deferred"||bx()},o.b6=$p,o.b7=De,o.b8=af,o.b9=di,o.bA=se,o.bB=je,o.bC=Y,o.bD=function(a,r){const{x:i,y:c}=a.point,d=WI(i,c,a.worldSize/a._pixelsPerMercatorPixel,0,0);return ee(d,d,eT(Na(r)))},o.bE=O,o.bF=Ki,o.bG=mi,o.bH=Gr,o.bI=gi,o.bJ=Nn,o.bK=Sm,o.bL=ta,o.bM=$T,o.bN=function(a,r,i,c,d){const m=5*r+2;a.float32[m+0]=i,a.float32[m+1]=c,a.float32[m+2]=d},o.bO=Am,o.bP=On,o.bQ=Do,o.bR=qo,o.bS=on,o.bT=fe,o.bU=function(a,r,i,c){var d=new P(4);return d[0]=a,d[1]=r,d[2]=i,d[3]=c,d},o.bV=class{isDataAvailableAtPoint(a){const r=this._source();if(this.isUsingMockSource()||!r||a.y<0||a.y>1)return!1;const i=r.getSource().maxzoom,c=1<<i,d=Math.floor(a.x),m=Math.floor((a.x-d)*c),g=Math.floor(a.y*c),v=this.findDEMTileFor(new ci(i,d,i,m,g));return!(!v||!v.dem)}getAtPointOrZero(a,r=0){return this.getAtPoint(a,r)||0}getAtPoint(a,r,i=!0){if(this.isUsingMockSource())return null;r==null&&(r=null);const c=this._source();if(!c||a.y<0||a.y>1)return r;const d=c.getSource().maxzoom,m=1<<d,g=Math.floor(a.x),v=a.x-g,S=new ci(d,g,d,Math.floor(v*m),Math.floor(a.y*m)),E=this.findDEMTileFor(S);if(!E||!E.dem)return r;const C=E.dem,I=1<<E.tileID.canonical.z,R=(v*I-E.tileID.canonical.x)*C.dim,L=(a.y*I-E.tileID.canonical.y)*C.dim,z=Math.floor(R),U=Math.floor(L);return(i?this.exaggeration():1)*ur(ur(C.get(z,U),C.get(z,U+1),L-U),ur(C.get(z+1,U),C.get(z+1,U+1),L-U),R-z)}static getAtTileOffset(a,r,i,c){const d=1<<a.canonical.z;return c?c.pointElevation(r):i?i.getAtPointOrZero(new ae(a.wrap+(a.canonical.x+r.x/bt)/d,(a.canonical.y+r.y/bt)/d)):0}static getAtTileOffsetFunc(a,r,i,c){return(d,m,g)=>{const v=this.getAtTileOffset(a,d,m,g),S=c.upVector(a.canonical,d.x,d.y);return hr(S,S,v*c.upVectorScale(a.canonical,r,i).metersToTile),S}}getForTilePoints(a,r,i,c){if(this.isUsingMockSource())return!1;const d=Cm.create(this,a,c);return!!d&&(r.forEach(m=>{m[2]=this.exaggeration()*d.getElevationAt(m[0],m[1],i)}),!0)}getMinMaxForTile(a){if(this.isUsingMockSource())return null;const r=this.findDEMTileFor(a);if(!r||!r.dem)return null;const i=r.dem.tree,c=r.tileID,d=1<<a.canonical.z-c.canonical.z;let m=a.canonical.x/d-c.canonical.x,g=a.canonical.y/d-c.canonical.y,v=0;for(let S=0;S<a.canonical.z-c.canonical.z&&!i.leaves[v];S++){m*=2,g*=2;const E=2*Math.floor(g)+Math.floor(m);v=i.childOffsets[v]+E,m%=1,g%=1}return{min:this.exaggeration()*i.minimums[v],max:this.exaggeration()*i.maximums[v]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(a,r,i){throw new Error("Pure virtual method called.")}pointCoordinate(a){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(a){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const a=this.visibleDemTiles;if(a.length===0)return null;let r=!1,i=Number.MAX_VALUE,c=Number.MIN_VALUE;for(const d of a){const m=this.getMinMaxForTile(d.tileID);m&&(i=Math.min(i,m.min),c=Math.max(c,m.max),r=!0)}return r?{min:i,max:c}:null}},o.bW=ew,o.bX=sn,o.bY=ss,o.bZ=SP,o.b_=OR,o.ba=LT,o.bb=uT,o.bc=Te,o.bd=Cc,o.be=Pc,o.bf=_d,o.bg=ri,o.bh=fm,o.bi=e2,o.bj=function(a,r){const i=vd(r.zoom);if(i===0)return Na(a);const c=$x(a),d=QS(c),m=T(c.getWest())*r.worldSize,g=T(c.getEast())*r.worldSize,v=A(c.getNorth())*r.worldSize,S=A(c.getSouth())*r.worldSize,E=[m,v,0],C=[g,v,0],I=[m,S,0],R=[g,S,0],L=te([],r.globeMatrix);return Un(E,E,L),Un(C,C,L),Un(I,I,L),Un(R,R,L),d[0]=Vl(d[0],I,i),d[1]=Vl(d[1],R,i),d[2]=Vl(d[2],C,i),d[3]=Vl(d[3],E,i),Zt.fromPoints(d)},o.bk=Hx,o.bl=te,o.bm=py,o.bn=Vl,o.bo=ud,o.bp=Jh,o.bq=Je,o.br=oe,o.bs=Ow,o.bt=dw,o.bu=El,o.bv=function(a,r){const i=[];for(const c in a)c in r||i.push(c);return i},o.bw=Ae,o.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.by=hs,o.bz=Z,o.c=Ps,o.c$=function(a,r,i){let c=0;for(let d=0;d<2;++d)a[d]>0&&(c+=(a[d]-0)*(a[d]-0)),r[d]<0&&(c+=(0-r[d])*(0-r[d]));return c},o.c0=CP,o.c1=jT,o.c2=oR,o.c3=KT,o.c4=m2,o.c5=hr,o.c6=ua,o.c7=ds,o.c8=function(a,r,i){i*=.5;var c=r[0],d=r[1],m=r[2],g=r[3],v=Math.sin(i),S=Math.cos(i);return a[0]=c*S+d*v,a[1]=d*S-c*v,a[2]=m*S+g*v,a[3]=g*S-m*v,a},o.c9=bs,o.cA=Qe,o.cB=dn,o.cC=hM,o.cD=Dn,o.cE=$I,o.cF=function(a,r,i,c,d,m,g,v,S){if(S.name==="globe")return $I(a,r,new Dn(i,c,d),!1);const E=Ny({z:i,x:c,y:d},S);return new Zt([(m+E.x/E.scale)*r,r*(E.y/E.scale),g],[(m+E.x2/E.scale)*r,r*(E.y2/E.scale),v])},o.cG=function(a,r,i){return a[0]=Math.min(r[0],i[0]),a[1]=Math.min(r[1],i[1]),a[2]=Math.min(r[2],i[2]),a[3]=Math.min(r[3],i[3]),a},o.cH=function(a,r,i){return a[0]=Math.max(r[0],i[0]),a[1]=Math.max(r[1],i[1]),a[2]=Math.max(r[2],i[2]),a[3]=Math.max(r[3],i[3]),a},o.cI=function(a){const r=Math.round((a+45+360)%360/90)%4;return Bi[r]},o.cJ=j,o.cK=us,o.cL=hm,o.cM=function(a){const r=se(new Float64Array(16));ee(r,a.pixelMatrix,a.globeMatrix);const i=[0,ya,0],c=[0,va,0];return Un(i,i,r),Un(c,c,r),[i[0]>0&&i[0]<=a.width&&i[1]>0&&i[1]<=a.height&&!rT(a,new l(a.center.lat,90)),c[0]>0&&c[0]<=a.width&&c[1]>0&&c[1]<=a.height&&!rT(a,new l(a.center.lat,-90))]},o.cN=function(a,r){const{scale:i}=a.tileTransform,c=i*bt/(a.tileSize*Math.pow(2,r.zoom-a.tileID.overscaledZ+a.tileID.canonical.z));return function(d,m,g){var v=m[1],S=m[2],E=m[3],C=g[0],I=g[1];return d[0]=m[0]*C,d[1]=v*C,d[2]=S*I,d[3]=E*I,d}(new Float32Array(4),r.inverseAdjustmentMatrix,[c,c])},o.cO=sw,o.cP=jt,o.cQ=dM,o.cR=function(a){const r=dM(a,!0);return O([],[r[0],r[1],r[4],r[5]])},o.cS=he,o.cT=Dt,o.cU=Ie,o.cV=function(a){const{x:r,y:i}=a.point,{lng:c,lat:d}=a._center;return WI(r,i,a.worldSize,c,d)},o.cW=qt,o.cX=Fr,o.cY=ii,o.cZ=Ms,o.c_=_a,o.ca=_i,o.cb=function(a,r){return a[0]=-r[0],a[1]=-r[1],a[2]=-r[2],a[3]=r[3],a},o.cc=tr,o.cd=function(a,r,i,c,d){var m=1/Math.tan(r/2);if(a[0]=m/i,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=m,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,d!=null&&d!==1/0){var g=1/(c-d);a[10]=(d+c)*g,a[14]=2*d*c*g}else a[10]=-1,a[14]=-2*c;return a},o.ce=function(a,r,i,c,d,m,g){var v=1/(r-i),S=1/(c-d),E=1/(m-g);return a[0]=-2*v,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*S,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*E,a[11]=0,a[12]=(r+i)*v,a[13]=(d+c)*S,a[14]=(g+m)*E,a[15]=1,a},o.cf=M,o.cg=function(a,r,i){a[4*r+0]=i[0],a[4*r+1]=i[1],a[4*r+2]=i[2],a[4*r+3]=i[3]},o.ch=lm,o.ci=Wh,o.cj=ji,o.ck=dl,o.cl=Kh,o.cm=_R,o.cn=function(){var a=new P(4);return P!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a},o.co=function(a,r,i){var c=r[0],d=r[1],m=r[2],g=r[3],v=Math.sin(i),S=Math.cos(i);return a[0]=c*S+m*v,a[1]=d*S+g*v,a[2]=c*-v+m*S,a[3]=d*-v+g*S,a},o.cp=function(a,r){return a[0]===r[0]&&a[1]===r[1]&&a[2]===r[2]&&a[3]===r[3]},o.cq=Zi,o.cr=function(a){var r=a[0],i=a[1],c=a[2],d=a[3];return Math.sqrt(r*r+i*i+c*c+d*d)},o.cs=Zr,o.ct=so,o.cu=Ci,o.cv=3,o.cw=2,o.cx=7,o.cy=6,o.cz=Ks,o.d=function(a){return Vr.API_TILEJSON_REGEX.test(a)},o.d$=class{constructor(a,r,i,c){this.context=a,this.format=c,this.size=i,this.texture=a.gl.createTexture();const[d,m,g]=this.size,{gl:v}=a;v.bindTexture(v.TEXTURE_3D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in r&&r.data&&v.texImage3D(v.TEXTURE_3D,0,this.format,d,m,g,0,ST(this.format),TT(this.format),r.data)}bind(a,r){const{context:i}=this,{gl:c}=i;c.bindTexture(c.TEXTURE_3D,this.texture),a!==this.minFilter&&(c.texParameteri(c.TEXTURE_3D,c.TEXTURE_MAG_FILTER,a),c.texParameteri(c.TEXTURE_3D,c.TEXTURE_MIN_FILTER,a),this.minFilter=a),r!==this.wrapS&&(c.texParameteri(c.TEXTURE_3D,c.TEXTURE_WRAP_S,r),c.texParameteri(c.TEXTURE_3D,c.TEXTURE_WRAP_T,r),this.wrapS=r)}destroy(){const{gl:a}=this.context;a.deleteTexture(this.texture),this.texture=null}},o.d0=function(a){return a*a*a*a*a},o.d1=b,o.d2=45,o.d3=cm,o.d4=function(a,r,i){const c=Math.sqrt(a*a+r*r+i*i),d=c>0?Math.acos(i/c)*fs:0;let m=a!==0||r!==0?Math.atan2(-r,-a)*fs+90:0;return m<0&&(m+=360),[c,m,d]},o.d5=Ot,o.d6=br,o.d7=J,o.d8=st,o.d9=Zt,o.dA=function(a){return a({pluginStatus:uo,pluginURL:Rl}),jp.on("pluginStateChange",a),a},o.dB=qh,o.dC=class extends Ol{constructor(a){super(a),this.current=um}set(a,r,i){if(this.fetchUniformLocation(a,r)){for(let c=0;c<9;c++)if(i[c]!==this.current[c]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.dD=Pi,o.dE=function(a,r,i){const c=vd(i.zoom),d=a.style.map._antialias,m=a.terrain&&a.terrain.exaggeration()>0;return c===0&&!d&&!m},o.dF=function(a){const r=a.pixelsPerMeter,i=r/M(1,a.center.lat),c=se(new Float64Array(16));return oe(c,c,[a.point.x,a.point.y,0]),he(c,c,[i,i,r]),Float32Array.from(c)},o.dG=$x,o.dH=function(a){const r=j-5;a=K(a,-r,r)/r*90;const i=Math.pow(Math.abs(Math.sin(zr(a))),3);return Math.round(i*(fy.length-1))},o.dI=function(a,r,i,c){const d=r.getNorth(),m=r.getSouth(),g=r.getWest(),v=r.getEast(),S=1<<a.z,E=v-g,C=d-m,I=E/md,R=-C/fy[i],L=[0,I,0,R,0,0,d,g,0];if(a.z>0){const z=180/c;$(L,L,[z/E+1,0,0,0,z/C+1,0,-.5*z/I,.5*z/R,1])}return L[2]=S,L[5]=a.x,L[8]=a.y,L},o.dJ=Na,o.dK=function(a,r,i){const c=se(new Float64Array(16)),d=(r/(1<<a)-.5)*Math.PI*2;return Be(c,i.globeMatrix,d),Float32Array.from(c)},o.dL=sP,o.dM=hl,o.dN=function(a,r){return[Math.pow(a[0],2.2)*r,Math.pow(a[1],2.2)*r,Math.pow(a[2],2.2)*r]},o.dO=F,o.dP=function(a,r){var i=Math.sin(r),c=Math.cos(r);return a[0]=c,a[1]=i,a[2]=0,a[3]=-i,a[4]=c,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},o.dQ=io,o.dR=HI,o.dS=rn,o.dT=ai,o.dU=256,o.dV=function(a,r){const i=[0,0,0];return Un(i,i,Hx(Na(r.canonical))),Un(i,i,a),i},o.dW=a=>({u_matrix:new Kh(a),u_texsize:new dl(a),u_pixels_to_tile_units:new dm(a),u_device_pixel_ratio:new ji(a),u_width_scale:new ji(a),u_floor_width_scale:new ji(a),u_image:new lm(a),u_units_to_pixels:new dl(a),u_tile_units_to_pixels:new ji(a),u_alpha_discard_threshold:new ji(a),u_trim_offset:new dl(a),u_trim_fade_range:new dl(a),u_trim_color:new cm(a),u_zbias_factor:new ji(a),u_tile_to_meter:new ji(a),u_ground_shadow_factor:new Wh(a),u_pattern_transition:new ji(a)}),o.dX=a=>({u_matrix:new Kh(a),u_pixels_to_tile_units:new dm(a),u_device_pixel_ratio:new ji(a),u_width_scale:new ji(a),u_floor_width_scale:new ji(a),u_units_to_pixels:new dl(a),u_dash_image:new lm(a),u_gradient_image:new lm(a),u_image_height:new ji(a),u_texsize:new dl(a),u_tile_units_to_pixels:new ji(a),u_alpha_discard_threshold:new ji(a),u_trim_offset:new dl(a),u_trim_fade_range:new dl(a),u_trim_color:new cm(a),u_zbias_factor:new ji(a),u_tile_to_meter:new ji(a),u_ground_shadow_factor:new Wh(a)}),o.dY=a=>({u_camera_to_center_distance:new ji(a),u_extrude_scale:new dm(a),u_device_pixel_ratio:new ji(a),u_matrix:new Kh(a),u_inv_rot_matrix:new Kh(a),u_merc_center:new dl(a),u_tile_id:new Wh(a),u_zoom_transition:new ji(a),u_up_dir:new Wh(a),u_emissive_strength:new ji(a)}),o.dZ=Qp,o.d_=u8,o.da=Pt,o.db=function(a){return[Math.pow(a[0],1/2.2),Math.pow(a[1],1/2.2),Math.pow(a[2],1/2.2)]},o.dc=uM,o.dd=MT,o.de=mM,o.df=r2,o.dg=function(a,r){return a.readFields(c$,{icons:[]},r)},o.dh=tw,o.di=Tm,o.dj=HT,o.dk=ep,o.dl=jh,o.dm=Wu,o.dn=rp,o.dp=tt,o.dq=function(a){const r=a.indexOf(gu);return r>=0?a.slice(0,r):a},o.dr=function(a){return a.indexOf(gu)>=0},o.ds=function(a){const r=a.lastIndexOf(gu);return r>=0?a.slice(r+1):""},o.dt=function(a){const r=[],i=a.id;return i===void 0&&r.push({message:`layers.${i}: missing required property "id"`}),a.render===void 0&&r.push({message:`layers.${i}: missing required method "render"`}),a.renderingMode&&a.renderingMode!=="2d"&&a.renderingMode!=="3d"&&r.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),r},o.du=function(a,r,i,c){return a.type==="custom"?new r$(a,r):new a$[a.type](a,r,i,c)},o.dv=pt,o.dw=function(a){const r=a.indexOf(gu);return r>=0?a.slice(r+1):""},o.dx=class extends af{constructor(a,r){super(a._vectorTileFeature,a._z,a._x,a._y,a.id),a.state&&(this.state=Object.assign({},a.state)),this.target=r.target,this.namespace=r.namespace,r.properties&&(this.properties=r.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=a.source,this.sourceLayer=a.sourceLayer,this.layer=a.layer)}toJSON(){const a=super.toJSON();return a.target=this.target,a.namespace=this.namespace,a}},o.dy=jp,o.dz=nu,o.e=Vr,o.e$=Et,o.e0=ZI,o.e1=(a,r,i,c,d,m)=>{const g=a.transform,v=g.projection.name==="globe";let S;if(m.paint.get("circle-pitch-alignment")==="map")if(v){const C=HI(g.zoom,r.canonical)*g._pixelsPerMercatorPixel;S=Float32Array.from([C,0,0,C])}else S=g.calculatePixelsToTileUnitsMatrix(i);else S=new Float32Array([g.pixelsToGLUnits[0],0,0,g.pixelsToGLUnits[1]]);const E={u_camera_to_center_distance:a.transform.getCameraToCenterDistance(g.projection),u_matrix:a.translatePosMatrix(r.projMatrix,i,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ns.devicePixelRatio,u_extrude_scale:S,u_inv_rot_matrix:kU,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:m.paint.get("circle-emissive-strength")};if(v){E.u_inv_rot_matrix=c,E.u_merc_center=d,E.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],E.u_zoom_transition=vd(g.zoom);const C=d[0]*bt,I=d[1]*bt;E.u_up_dir=g.projection.upVector(new Dn(0,0,0),C,I)}return E},o.e2=MM,o.e3=lo,o.e4=(a,r,i,c,d,m,g,v,S,E)=>{const C=a.transform,I=C.pitch<15?CM(.07,.7,K((14-C.zoom)/5,0,1)):.07,R=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:PM(a,r,i,c),u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:C.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:d,u_width_scale:m,u_floor_width_scale:g,u_image:0,u_tile_units_to_pixels:IM(r,C),u_units_to_pixels:[1/C.pixelsToGLUnits[0],1/C.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:v,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(R?null:i.lut).toArray01(),u_zbias_factor:I,u_tile_to_meter:J(r.tileID.canonical,0),u_ground_shadow_factor:S,u_pattern_transition:E}},o.e5=(a,r,i,c,d,m,g,v,S,E)=>{const C=a.transform,I=C.calculatePixelsToTileUnitsMatrix(r),R=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",L=C.pitch<15?CM(.07,.7,K((14-C.zoom)/5,0,1)):.07;return{u_matrix:PM(a,r,i,c),u_pixels_to_tile_units:I,u_device_pixel_ratio:m,u_width_scale:g,u_floor_width_scale:v,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:RM(i)&&r.lineAtlasTexture?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:IM(r,a.transform),u_alpha_discard_threshold:0,u_trim_offset:S,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(R?null:i.lut).toArray01(),u_zbias_factor:L,u_tile_to_meter:J(r.tileID.canonical,0),u_ground_shadow_factor:E}},o.e6=$e,o.e7=my,o.e8=B,o.e9=wa,o.eA=function(a,r){var i=2*Math.acos(r[3]),c=Math.sin(i/2);return c>k?(a[0]=r[0]/c,a[1]=r[1]/c,a[2]=r[2]/c):(a[0]=1,a[1]=0,a[2]=0),i},o.eB=s2,o.eC=lw,o.eD=aw,o.eE=[1,1,1],o.eF=Cm,o.eG=Ai,o.eH=function(a,r,i,c){var d=r[0],m=r[1],g=r[2],v=r[3];return a[0]=d+c*(i[0]-d),a[1]=m+c*(i[1]-m),a[2]=g+c*(i[2]-g),a[3]=v+c*(i[3]-v),a},o.eI=vm,o.eJ=Jo,o.eK=ul,o.eL=function(a,r,i,c,d,m,g,v,S,E,C,I,R,L,z,U){var q=new P(16);return q[0]=a,q[1]=r,q[2]=i,q[3]=c,q[4]=d,q[5]=m,q[6]=g,q[7]=v,q[8]=S,q[9]=E,q[10]=C,q[11]=I,q[12]=R,q[13]=L,q[14]=z,q[15]=U,q},o.eM=f,o.eN=fd,o.eO=ny,o.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new it(1/0,1/0),max:new it(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(a,r=!1){const i=EP(new it(0,0),new it(bt,bt),a),c=[];if(r&&!dT(i,this._globalClipBounds))return c;for(const d of this._activeRegions){if(d.hiddenByOverlap||!dT(i,d))continue;const m=t6(d.min,d.max,a);c.push({min:m.min,max:m.max,sourceId:this._sourceIds[d.priority],footprint:d.footprint,footprintTileId:d.tileId,order:d.order,clipMask:d.clipMask,clipScope:d.clipScope})}return c}setSources(a){this._setSources(a.map(r=>({getSourceId:()=>r.cache.id,getFootprints:()=>{const i=[];for(const c of r.cache.getVisibleCoordinates()){const d=r.cache.getTile(c).buckets[r.layer];d&&d.updateFootprints(c.toUnwrapped(),i)}return i},getOrder:()=>r.order,getClipMask:()=>r.clipMask,getClipScope:()=>r.clipScope})))}_addSource(a){const r=a.getFootprints();if(r.length===0)return;const i=a.getOrder(),c=a.getClipMask(),d=a.getClipScope();for(const m of r){if(!m.footprint)continue;const g=EP(m.footprint.min,m.footprint.max,m.id);this._activeRegions.push({min:g.min,max:g.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:m.id,footprint:m.footprint,order:i,clipMask:c,clipScope:d})}this._sourceIds.push(a.getSourceId())}_computeReplacement(){this._activeRegions.sort((r,i)=>r.priority-i.priority||Xx(r.min,i.min)||Xx(r.max,i.max)||r.order-i.order||r.clipMask-i.clipMask||function(c,d){const m=(g,v)=>g+v;return c.length-d.length||c.reduce(m,"").localeCompare(d.reduce(m,""))}(r.clipScope,i.clipScope));let a=this._activeRegions.length!==this._prevRegions.length;if(!a){let r=0;for(;!a&&r!==this._activeRegions.length;){const i=this._activeRegions[r],c=this._prevRegions[r];a=i.priority!==c.priority||!TP(i,c)||i.order!==c.order||i.clipMask!==c.clipMask||!hs(i.clipScope,c.clipScope),this._activeRegions[r].hiddenByOverlap=c.hiddenByOverlap,++r}}if(a){++this._updateTime;for(const i of this._activeRegions)i.order!==wy&&(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 r=i=>{const c=this._activeRegions;if(i>=c.length)return i;const d=c[i].priority;for(;i<c.length&&c[i].priority===d;)++i;return i};if(this._sourceIds.length>1){let i=0,c=r(i);for(;i!==c;){let d=i;const m=i;for(;d!==c;){const g=this._activeRegions[d];g.hiddenByOverlap=!1;for(let v=0;v<m;v++){const S=this._activeRegions[v];if(!S.hiddenByOverlap&&g.order===wy&&dT(g,S)&&(g.hiddenByOverlap=kP(g.footprint,g.tileId,S.footprint,S.tileId),g.hiddenByOverlap))break}++d}i=c,c=r(i)}}}}_setSources(a){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let r=a.length-1;r>=0;r--)this._addSource(a[r]);this._computeReplacement()}},o.eQ=wy,o.eR=class{constructor(a){this._createGrid(a),this._createPoles(a)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const a of this._poleSegments)a.destroy();for(const a of this._gridSegments)a.withSkirts.destroy(),a.withoutSkirts.destroy()}_fillGridMeshWithLods(a,r){const i=new Cc,c=new Ni,d=[],m=a+1+2,g=r[0]+1,v=r[0]+1+(1+r.length),S=(E,C,I)=>{let R=E===m-1?E-2:E===0?E:E-1;return R+=I?24575:0,[R,C]};for(let E=0;E<m;++E)i.emplaceBack(...S(E,0,!0));for(let E=0;E<g;++E)for(let C=0;C<m;++C)i.emplaceBack(...S(C,E,(C===0||C===m-1)&&!0));for(let E=0;E<r.length;++E){const C=r[E];for(let I=0;I<m;++I)i.emplaceBack(...S(I,C,!0))}for(let E=0;E<r.length;++E){const C=c.length,I=r[E]+1+2,R=new Ni;for(let U=0;U<I-1;U++){const q=U===I-2,W=q?m*(v-r.length+E-U):m;for(let re=0;re<m-1;re++){const ie=U*m+re;U===0||q||re===0||re===m-2?(R.emplaceBack(ie+1,ie,ie+W),R.emplaceBack(ie+W,ie+W+1,ie+1)):(c.emplaceBack(ie+1,ie,ie+W),c.emplaceBack(ie+W,ie+W+1,ie+1))}}const L=ri.simpleSegment(0,C,i.length,c.length-C);for(let U=0;U<R.uint16.length;U+=3)c.emplaceBack(R.uint16[U],R.uint16[U+1],R.uint16[U+2]);const z=ri.simpleSegment(0,C,i.length,c.length-C);d.push({withoutSkirts:L,withSkirts:z})}return{vertices:i,indices:c,segments:d}}_createGrid(a){const r=this._fillGridMeshWithLods(md,fy);this._gridSegments=r.segments,this._gridBuffer=a.createVertexBuffer(r.vertices,_d.members),this._gridIndexBuffer=a.createIndexBuffer(r.indices,!0)}_createPoles(a){const r=new Ni;for(let g=0;g<=md;g++)r.emplaceBack(0,g+1,g+2);this._poleIndexBuffer=a.createIndexBuffer(r,!0);const i=new yu,c=new yu,d=new yu,m=new yu;this._poleSegments=[];for(let g=0,v=0;g<_a;g++){const S=360/(1<<g);i.emplaceBack(0,-Vs,0,.5,0),c.emplaceBack(0,-Vs,0,.5,1),d.emplaceBack(0,-Vs,0,.5,.5),m.emplaceBack(0,-Vs,0,.5,.5);for(let E=0;E<=md;E++){let C=E/md,I=0;const R=ur(0,S,C),[L,z,U]=vu(TU,EU,R,Vs);i.emplaceBack(L,z,U,C,I),c.emplaceBack(L,z,U,C,1-I);const q=zr(R);C=.5+.5*Math.sin(q),I=.5+.5*Math.cos(q),d.emplaceBack(L,z,U,C,I),m.emplaceBack(L,z,U,C,1-I)}this._poleSegments.push(ri.simpleSegment(v,0,66,64)),v+=66}this._poleNorthVertexBuffer=a.createVertexBuffer(i,Ba,!1),this._poleSouthVertexBuffer=a.createVertexBuffer(c,Ba,!1),this._texturedPoleNorthVertexBuffer=a.createVertexBuffer(d,Ba,!1),this._texturedPoleSouthVertexBuffer=a.createVertexBuffer(m,Ba,!1)}getGridBuffers(a,r){return[this._gridBuffer,this._gridIndexBuffer,r?this._gridSegments[a].withSkirts:this._gridSegments[a].withoutSkirts]}getPoleBuffers(a,r){return[r?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,r?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[a]]}},o.eS=bP,o.eT=Ss,o.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.eV=Fe,o.eW=Q,o.eX=function(a,r,i){return a[0]=r[0]/i[0],a[1]=r[1]/i[1],a[2]=r[2]/i[2],a},o.eY=Is,o.eZ=gd,o.e_=xn,o.ea=Qx,o.eb=UP,o.ec=wu,o.ed=RP,o.ee=MP,o.ef=G,o.eg=function(a,r){if(a===r){var i=r[1],c=r[2],d=r[3],m=r[6],g=r[7],v=r[11];a[1]=r[4],a[2]=r[8],a[3]=r[12],a[4]=i,a[6]=r[9],a[7]=r[13],a[8]=c,a[9]=m,a[11]=r[14],a[12]=d,a[13]=g,a[14]=v}else a[0]=r[0],a[1]=r[4],a[2]=r[8],a[3]=r[12],a[4]=r[1],a[5]=r[5],a[6]=r[9],a[7]=r[13],a[8]=r[2],a[9]=r[6],a[10]=r[10],a[11]=r[14],a[12]=r[3],a[13]=r[7],a[14]=r[11],a[15]=r[15];return a},o.eh=t$,o.ei=Br,o.ej=sy,o.ek=256,o.el=eT,o.em=Yo,o.en=Be,o.eo=function(a,r){return a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=r[4],a[4]=r[5],a[5]=r[6],a[6]=r[8],a[7]=r[9],a[8]=r[10],a},o.ep=yu,o.eq=ux,o.er=ry,o.es=function(a,r,i,c,d){return K((a-r)/(i-r)*(d-c)+c,c,d)},o.et=Wo,o.eu=function(a,r){var i=r[0],c=r[1],d=r[2],m=r[3],g=r[4],v=r[5],S=r[6],E=r[7],C=r[8],I=C*g-v*E,R=-C*m+v*S,L=E*m-g*S,z=i*I+c*R+d*L;return z?(a[0]=I*(z=1/z),a[1]=(-C*c+d*E)*z,a[2]=(v*c-d*g)*z,a[3]=R*z,a[4]=(C*i-d*S)*z,a[5]=(-v*i+d*m)*z,a[6]=L*z,a[7]=(-E*i+c*S)*z,a[8]=(g*i-c*m)*z,a):null},o.ev=2,o.ew=zs,o.ex=Ho,o.ey=kt,o.ez=function(a,r){var i=new P(3);kt(i,r);var c=1/i[0],d=1/i[1],m=1/i[2],g=r[0]*c,v=r[1]*d,S=r[2]*m,E=r[4]*c,C=r[5]*d,I=r[6]*m,R=r[8]*c,L=r[9]*d,z=r[10]*m,U=g+C+z,q=0;return U>0?(q=2*Math.sqrt(U+1),a[3]=.25*q,a[0]=(I-L)/q,a[1]=(R-S)/q,a[2]=(v-E)/q):g>C&&g>z?(q=2*Math.sqrt(1+g-C-z),a[3]=(I-L)/q,a[0]=.25*q,a[1]=(v+E)/q,a[2]=(R+S)/q):C>z?(q=2*Math.sqrt(1+C-g-z),a[3]=(R-S)/q,a[0]=(v+E)/q,a[1]=.25*q,a[2]=(I+L)/q):(q=2*Math.sqrt(1+z-g-C),a[3]=(v-E)/q,a[0]=(R+S)/q,a[1]=(I+L)/q,a[2]=.25*q),a},o.f=function(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(r,i)=>String.fromCharCode(+("0x"+i))))},o.f0=function([a,r,i]){const c=Math.hypot(a,r,i),d=Math.atan2(a,i),m=.5*Math.PI-Math.acos(-r/c);return new l(Fr(d),Fr(m))},o.f1=Fs,o.f2=kT,o.f3=function(a){const r=a.navigator?a.navigator.userAgent:null;return!!function(i){if(Mi==null){const c=i.navigator?i.navigator.userAgent:null;Mi=!!i.safari||!(!c||!(/\b(iPad|iPhone|iPod)\b/.test(c)||c.match("Safari")&&!c.match("Chrome")))}return Mi}(a)&&!(!r||!(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},o.f4=function(a,r){Xf=a,Yf=r},o.f5=rT,o.f6=qI,o.f7=function(a){const r=[0,0,0],i=se(new Float64Array(16));return ee(i,a.pixelMatrix,a.globeMatrix),Un(r,r,i),new it(r[0],r[1])},o.f8=function(){const a=Ay;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(_T),Ay=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()"))},o.f9=function(){tw().acquire(_T)},o.fA=Lw,o.fB=Me,o.fC=function(a){let r=0;if(new Uint32Array(a,0,1)[0]!==sM){const i=new Uint32Array(a,0,7),[,,c,d,m,g]=i;r=i.byteLength+d+m+g+m,(c!==a.byteLength||r>=a.byteLength)&&Ft("Invalid b3dm header information.")}return cM(a,r)},o.fD=function(a,r){const i=MT(a);for(const c of i){for(const d of c.meshes)R6(d);c.lights&&(c.lightMeshIndex=c.meshes.length,c.meshes.push(D6(c.lights,r)))}return i},o.fE=Cw,o.fF=Yr,o.fG=eM,o.fH=Dl,o.fI=zo,o.fJ=function(a){Ma(),el!=null&&el.then(r=>{r.keys().then(i=>{for(let c=0;c<i.length-a;c++)r.delete(i[c]).catch(d=>Ft(d.message))}).catch(i=>Ft(i.message))}).catch(r=>Ft(r.message))},o.fa=Vh,o.fb=function(a,r,i=!1){if(uo===zo.deferred||uo===zo.loading||uo===zo.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rl=ns.resolveURL(a),uo=zo.deferred,W_=r,Np(),i||bx()},o.fc=function(a){gm=ns.resolveURL(a),_m||(_m=new mm(tw(),new iu)),_m.broadcast("setMeshoptUrl",gm)},o.fd=nM,o.fe=function(a){xT=ns.resolveURL(a),_m||(_m=new mm(tw(),new iu)),_m.broadcast("setDracoUrl",xT)},o.ff=rM,o.fg=ky,o.fh=function(a){const r=Pa();if(!r)return;const i=r.delete(Zf);a&&i.then(()=>a()).catch(a)},o.fi=tf,o.fj=Ut,o.fk=xd,o.fl=Gl,o.fm=bD,o.fn=SD,o.fo=TM,o.fp=Ke,o.fq="hd_road_elevation",o.fr=pn,o.fs=Ue,o.ft=xu,o.fu=GT,o.fv=sf,o.fw=function(a,r,i,c,d,m,g,v=1,S,E,C){a.createArrays(),a.tilePixelRatio=bt/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;const I=a.layers[0].layout,R=a.layers[0]._unevaluatedLayout._values,L={};L.scaleFactor=v,L.textSizeScaleRange=I.get("text-size-scale-range"),L.iconSizeScaleRange=I.get("icon-size-scale-range");const[z,U]=L.textSizeScaleRange,[q,W]=L.iconSizeScaleRange;L.textScaleFactor=K(L.scaleFactor,z,U),L.iconScaleFactor=K(L.scaleFactor,q,W);const re=R["text-size"],ie=R["icon-size"];if(a.textSizeData.kind==="composite"){const{minZoom:Pe,maxZoom:We}=a.textSizeData;L.compositeTextSizes=[re.possiblyEvaluate(new $n(Pe,{worldview:C}),m),re.possiblyEvaluate(new $n(We,{worldview:C}),m)]}if(a.iconSizeData.kind==="composite"){const{minZoom:Pe,maxZoom:We}=a.iconSizeData;L.compositeIconSizes=[ie.possiblyEvaluate(new $n(Pe,{worldview:C}),m),ie.possiblyEvaluate(new $n(We,{worldview:C}),m)]}L.layoutTextSize=re.possiblyEvaluate(new $n(g+1,{worldview:C}),m),L.layoutIconSize=ie.possiblyEvaluate(new $n(g+1,{worldview:C}),m),L.textMaxSize=re.possiblyEvaluate(new $n(18,{worldview:C}),m);const ue=I.get("symbol-placement"),ve=I.get("text-rotation-alignment")==="map"&&ue!=="point",me=I.get("text-size");let be=!1;const ke=[];for(const Pe of a.features){const We=I.get("text-font").evaluate(Pe,{},m).join(","),Le=me.evaluate(Pe,{},m)*L.textScaleFactor,Xe=L.layoutTextSize.evaluate(Pe,{},m)*L.textScaleFactor,rt=L.layoutIconSize.evaluate(Pe,{},m)*L.iconScaleFactor,nt={horizontal:{},vertical:void 0},ut=Pe.text;let ht,at=[0,0];if(ut){const Sr=ut.toString(),Cn=I.get("text-letter-spacing").evaluate(Pe,{},m)*ss,ge=I.get("text-line-height").evaluate(Pe,{},m)*ss,xe=G_(Sr)?Cn:0,Ye=I.get("text-anchor").evaluate(Pe,{},m),dt=I.get("text-variable-anchor");if(!dt){const wr=I.get("text-radial-offset").evaluate(Pe,{},m);if(wr)at=oR(Ye,[wr*ss,qT]);else{const Ir=I.get("text-offset").evaluate(Pe,{},m);at=[Ir[0]*ss,Ir[1]*ss]}}let Mt=ve?"center":I.get("text-justify").evaluate(Pe,{},m);const Rt=ue==="point",Jt=Rt?I.get("text-max-width").evaluate(Pe,{},m)*ss:1/0,er=wr=>{a.allowVerticalPlacement&&Nh(Sr)&&(nt.vertical=NT(ut,r,i,d,We,Jt,ge,Ye,wr,xe,at,ta.vertical,!0,Xe,Le,S))};if(!ve&&dt){const wr=Mt==="auto"?dt.map(Mr=>KT(Mr)):[Mt];let Ir=!1;for(let Mr=0;Mr<wr.length;Mr++){const Nr=wr[Mr];if(!nt.horizontal[Nr])if(Ir)nt.horizontal[Nr]=nt.horizontal[0];else{const cr=NT(ut,r,i,d,We,Jt,ge,"center",Nr,xe,at,ta.horizontal,!1,Xe,Le,S);cr&&(nt.horizontal[Nr]=cr,Ir=cr.positionedLines.length===1)}}er("left")}else{if(Mt==="auto"&&(Mt=KT(Ye)),Rt||I.get("text-writing-mode").indexOf("horizontal")>=0||!Nh(Sr)){const wr=NT(ut,r,i,d,We,Jt,ge,Ye,Mt,xe,at,ta.horizontal,!1,Xe,Le,S);wr&&(nt.horizontal[Mt]=wr)}er(Rt?"left":Mt)}}let lt,Ze,qe,ct,St,_t,Yt=!1;const Lt=I.get("icon-text-fit").evaluate(Pe,{},m);if(Pe.icon&&Pe.icon.hasPrimary()){const Sr=Fy(Pe.icon,a.iconSizeData,R["icon-size"],m,a.zoom,Pe,S,L.iconScaleFactor,C);lt=Sr.iconPrimary,qe=Sr.iconSecondary;const Cn=lt.toString();if(Ze=c.get(Cn),Ze&&(St=I.get("icon-offset").evaluate(Pe,{},m),_t=I.get("icon-anchor").evaluate(Pe,{},m),ht=fw(d.get(Cn),qe?d.get(qe.toString()):void 0,St,_t),Yt=Ze.sdf,a.sdfIcons===void 0?a.sdfIcons=Ze.sdf:a.sdfIcons!==Ze.sdf&&Ft("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Ze.pixelRatio!==a.pixelRatio||I.get("icon-rotate").constantOr(1)!==0)&&(a.iconsNeedLinear=!0)),qe){const ge=qe.toString();ct=c.get(ge)}}be=be||!(!Pe.icon||!Pe.icon.hasSecondary());const Nt=yw(nt.horizontal)||nt.vertical;a.iconsInText||(a.iconsInText=!!Nt&&Nt.iconsInText);const Ht=Xe*L.textScaleFactor/ss,{defaultShapedIcon:Rr,verticallyShapedIcon:yt}=V8(a,ht,I,Pe,m,nt,Ht,St,Lt);Lt!=="none"&&ht&&(HM(ht)||WM(ht))&&(_w(0,Ze,lt,ht,Rr,Lt,E,c,d),_w(0,ct,qe,ht,Rr,Lt,E,c,d),yt&&(_w(0,Ze,lt,ht,yt,Lt,E,c,d),_w(0,ct,qe,ht,yt,Lt,E,c,d))),ht=Rr;const{iconBBox:Wt,iconVerticalBBox:gr,textBBox:$r,textVerticalBBox:qr}=z8(a,ht,yt,I,Pe,m,rt,St,L,d,_t,nt,Xe,at);ke.push({feature:Pe,shapedTextOrientations:nt,shapedText:Nt,shapedIcon:ht,iconPrimary:lt,iconSecondary:qe,iconOffset:St,iconAnchor:_t,verticallyShapedIcon:yt,layoutTextSize:Xe,layoutIconSize:rt,textOffset:at,isSDFIcon:Yt,iconTextFit:Lt,iconCollisionBounds:Wt,iconVerticalCollisionBounds:gr,textCollisionBounds:$r,textVerticalCollisionBounds:qr})}return{featureData:ke,sizes:L,hasAnySecondaryIcon:be,textAlongLine:ve,symbolPlacement:ue}},o.fx=eR,o.fy=function(a,r,i,c,d,m,g,v,S,E){a.iconAtlasPositions=E.iconPositions;const{featureData:C,hasAnySecondaryIcon:I,sizes:R,textAlongLine:L,symbolPlacement:z}=r;for(const U of C){const{shapedIcon:q,verticallyShapedIcon:W,feature:re,shapedTextOrientations:ie,shapedText:ue,layoutTextSize:ve,textOffset:me,isSDFIcon:be,iconPrimary:ke,iconSecondary:Pe,iconTextFit:We,iconOffset:Le,iconCollisionBounds:Xe,iconVerticalCollisionBounds:rt,textCollisionBounds:nt}=U;lR(q,E.iconPositions,ke,Pe),lR(W,E.iconPositions,ke,Pe),j8(ie,E.iconPositions),N8(ke,Pe,E.iconPositions),(ue||q)&&U8(a,re,ie,q,W,S,R,ve,0,me,be,c,d,g,v,I,We,Le,L,z,Xe,rt,nt)}i&&a.generateCollisionDebugBuffers(m,a.collisionBoxArray,R.textScaleFactor)},o.fz=Ne,o.g=function(a,r){return nu(Object.assign(a,{method:"GET"}),r)},o.h=function(a){return a.indexOf("mapbox:")===0},o.i=function(a){return Vr.API_STYLE_REGEX.test(a)&&!Ps(a)},o.j=yi,o.k=tl,o.l=function(a){return decodeURIComponent(atob(a).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""))},o.m=function(a,r){return nu(Object.assign(a,{type:"json"}),r)},o.n=tp,o.o=ns,o.p=function(a,r){return nu(Object.assign(a,{method:"POST"}),r)},o.q=Gs,o.r=Qa,o.s=function(a){try{const r=self[a];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=function(){return yT||(yT=new tf("ImageRasterizer")),yT},o.u=function(){return function a(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,a)}()},o.v=function(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)},o.w=Ft,o.x=d2,o.y=vh,o.z=rl}),_(["./shared"],function(o){function k(Fe){const K=Fe?Fe.url.toString():void 0;return K?performance.getEntriesByName(K):[]}function P(Fe){if(typeof Fe=="number"||typeof Fe=="boolean"||typeof Fe=="string"||Fe==null)return JSON.stringify(Fe);if(Array.isArray(Fe)){let ne="[";for(const fe of Fe)ne+=`${P(fe)},`;return`${ne}]`}let K="{";for(const ne of Object.keys(Fe).sort())K+=`${ne}:${P(Fe[ne])},`;return`${K}}`}function O(Fe){let K="";for(const ne of o.bx)K+=`/${P(Fe[ne])}`;return K}class F{constructor(K){this.keyCache={},this._layers={},this._layerConfigs={},K&&this.replace(K)}replace(K,ne){this._layerConfigs={},this._layers={},this.update(K,[],ne)}update(K,ne,fe){this._options=fe;for(const Ee of K)this._layerConfigs[Ee.id]=Ee,(this._layers[Ee.id]=o.du(Ee,this.scope,null,this._options)).compileFilter(fe),this.keyCache[Ee.id]&&delete this.keyCache[Ee.id];for(const Ee of ne)delete this.keyCache[Ee],delete this._layerConfigs[Ee],delete this._layers[Ee];this.familiesBySource={};const Ae=function(Ee,Re){const $e={};for(let Ue=0;Ue<Ee.length;Ue++){const pt=Ee[Ue];let tt=Re&&Re[pt.id];tt||(pt.type==="symbol"?tt=pt.id:(tt=O(pt),pt.type==="line"&&pt.paint&&function rr(Ft){return typeof Ft=="string"&&Ft==="line-progress"||(Array.isArray(Ft)?Ft.some(rr):!(!Ft||typeof Ft!="object")&&Object.values(Ft).some(rr))}(pt.paint["line-width"])&&(tt+=`/${P(pt.paint["line-width"])}`))),Re&&(Re[pt.id]=tt);let Vt=$e[tt];Vt||(Vt=$e[tt]=[]),Vt.push(pt)}const Oe=[];for(const Ue in $e)Oe.push($e[Ue]);return Oe}(Object.values(this._layerConfigs),this.keyCache);for(const Ee of Ae){const Re=Ee.map(Vt=>this._layers[Vt.id]),$e=Re[0];if($e.visibility==="none")continue;const Oe=$e.source||"";let Ue=this.familiesBySource[Oe];Ue||(Ue=this.familiesBySource[Oe]={});const pt=$e.sourceLayer||"_geojsonTileLayer";let tt=Ue[pt];tt||(tt=Ue[pt]=[]),tt.push(Re)}}}const V=1*o.fl;class ${constructor(K){const ne={},fe=[];for(const $e in K){const Oe=K[$e],Ue=ne[$e]={};for(const pt in Oe.glyphs){const tt=Oe.glyphs[+pt];if(!tt||tt.bitmap.width===0||tt.bitmap.height===0)continue;const Vt=tt.metrics.localGlyph?V:1,rr={x:0,y:0,w:tt.bitmap.width+2*Vt,h:tt.bitmap.height+2*Vt};fe.push(rr),Ue[pt]=rr}}const{w:Ae,h:Ee}=o.G(fe),Re=new o.fk({width:Ae||1,height:Ee||1});for(const $e in K){const Oe=K[$e];for(const Ue in Oe.glyphs){const pt=Oe.glyphs[+Ue];if(!pt||pt.bitmap.width===0||pt.bitmap.height===0)continue;const tt=ne[$e][Ue],Vt=pt.metrics.localGlyph?V:1;o.fk.copy(pt.bitmap,Re,{x:0,y:0},{x:tt.x+Vt,y:tt.y+Vt},pt.bitmap)}}this.image=Re,this.positions=ne}}function Y(Fe,K,ne){Fe[K]?ne&&(Fe[K].center=ne):Fe[K]={floorIds:new Set,center:ne||[0,0],floors:{}}}function Z(Fe,K,ne,fe){for(const Ae of K)Y(Fe,Ae),Fe[Ae].floors[ne]=fe,Fe[Ae].floorIds.add(ne)}function se(Fe){return{id:Fe.properties.id.toString(),center:Fe.properties.center.toString().split(";").map(Number)}}function te(Fe){return{id:Fe.properties.id.toString(),isDefault:!!Fe.properties.is_default&&Fe.properties.is_default,connections:Fe.properties.connected_floor_ids?new Set(Fe.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:Fe.properties.conflicted_floor_ids?new Set(Fe.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:Fe.properties.building_ids?new Set(Fe.properties.building_ids.toString().split(";")):new Set,name:Fe.properties.name.toString(),zIndex:Fe.properties.z_index}}function ee(Fe,K){return K.every(ne=>Fe.properties&&Fe.properties[ne]!=null)}function oe(Fe){return ee(Fe,["type","id","name"])&&Fe.properties.type==="building"}function he(Fe){return ee(Fe,["type","id","name","z_index"])&&Fe.properties.type==="floor"}o.fj($,"GlyphAtlas");class Ie{constructor(K){this.tileID=new o.aQ(K.tileID.overscaledZ,K.tileID.wrap,K.tileID.canonical.z,K.tileID.canonical.x,K.tileID.canonical.y),this.tileZoom=K.tileZoom,this.uid=K.uid,this.zoom=K.zoom,this.lut=K.lut,this.canonical=K.tileID.canonical,this.pixelRatio=K.pixelRatio,this.tileSize=K.tileSize,this.source=K.source,this.scope=K.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=K.showCollisionBoxes,this.collectResourceTiming=!!K.request&&K.request.collectResourceTiming,this.promoteId=K.promoteId,this.isSymbolTile=K.isSymbolTile,this.tileTransform=o.aZ(K.tileID.canonical,K.projection),this.projection=K.projection,this.worldview=K.worldview,this.localizableLayerIds=K.localizableLayerIds,this.brightness=K.brightness,this.extraShadowCaster=!!K.extraShadowCaster,this.tessellationStep=K.tessellationStep,this.scaleFactor=K.scaleFactor,this.worldview=K.worldview,this.indoor=K.indoor}parse(K,ne,fe,Ae,Ee,Re){this.status="parsing",this.data=K,this.collisionBoxArray=new o.b3;const $e=new o.fm(Object.keys(K.layers).sort()),Oe=new o.fn(this.tileID,this.promoteId);Oe.bucketLayerIDs=[];const Ue={},pt=new o.fo(256,256),tt={featureIndex:Oe,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:pt,availableImages:fe,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const kr=this.indoor.indoorState.activeFloorsVisible,Tr=function(br,Yr,di){const Mi=function(oi,rn){if(!oi)return o.w("No source layers defined in indoor specification"),rn;if(oi.size===0)return rn;const ai=oi.difference(rn);for(const zn of ai)o.w(`Missing source layer required in indoor specification: ${zn}`);return rn.intersection(rn)}(Yr.sourceLayers,new Set(Object.keys(br.layers))),_i=Yr.indoorState,Fi=function(oi,rn,ai,zn){const Vr=new Set,yi=new Set,Ps=new Set,Ns=new Map,xo={},Qc=ps=>{const Ko=Ns.get(ps)||new Set;for(const Ys of Vr)if((Ns.get(Ys)||new Set).has(ps)||Ko.has(Ys))return!0;return!1};for(const ps of rn){const Ko=oi.layers[ps];if(Ko)for(let Ys=0;Ys<Ko.length;Ys++){const Qa=Ko.feature(Ys);if(oe(Qa)){const{id:ns,center:eu}=se(Qa);Y(xo,ns,eu),Vr.add(ns)}else if(he(Qa)){const{id:ns,isDefault:eu,connections:Wu,conflicts:Zf,buildings:Xf,name:Yf,zIndex:ph}=te(Qa);Z(xo,Xf,ns,{name:Yf,zIndex:ph}),Ns.set(ns,Zf),(ns===zn||Wu.has(zn))&&Vr.add(ns),yi.add(ns),eu&&Ps.add(ns)}}else o.w(`indoor source layer not found: ${ps}`)}if(ai)for(const ps of ai)yi.has(ps)&&(Qc(ps)||Vr.add(ps));for(const ps of Ps)Vr.has(ps)||Qc(ps)||Vr.add(ps);return{buildings:xo,activeFloors:Vr}}(br,Mi,_i.lastActiveFloors,_i.selectedFloorId);return di.send("setIndoorData",Fi),Fi}(K,this.indoor,Ee);tt.activeFloors=kr?Tr.activeFloors:void 0}const Vt=[],rr=ne.familiesBySource[this.source];for(const kr in rr){const Tr=K.layers[kr];if(!Tr)continue;let br=!1,Yr=!1,di=!1;for(const rn of rr[kr])rn[0].type==="symbol"?br=!0:Yr=!0,rn[0].is3D()&&rn[0].type!=="model"&&(di=!0);if(this.extraShadowCaster&&!di||this.isSymbolTile===!0&&!br||this.isSymbolTile===!1&&!Yr)continue;Tr.version===1&&o.w(`Vector tile source "${this.source}" layer "${kr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Mi=$e.encode(kr),_i=[],Fi=this.localizableLayerIds&&this.localizableLayerIds.has(kr);let oi=!1;for(let rn=0,ai=0;rn<Tr.length;rn++){const zn=Tr.feature(rn),Vr=Oe.getId(zn,kr),yi=zn.properties?zn.properties.worldview:null;if(Fi&&this.worldview&&typeof yi=="string")if(yi==="all")zn.properties.$localized=!0;else{if(!yi.split(",").includes(this.worldview))continue;zn.properties.$localized=!0,zn.properties.worldview=this.worldview}!oi&&zn.properties&&zn.properties.hasOwnProperty(o.fp)&&(oi=!0),_i.push({feature:zn,id:Vr,index:ai,sourceLayerIndex:Mi}),ai++}oi&&!tt.elevationFeatures&&K.layers.hasOwnProperty(o.fq)&&(tt.elevationFeatures=o.fr.parseFrom(K.layers[o.fq],this.canonical));for(const rn of rr[kr]){const ai=rn[0];if(this.extraShadowCaster&&(!ai.is3D()||ai.type==="model")||this.isSymbolTile!==void 0&&ai.type==="symbol"!==this.isSymbolTile||ai.minzoom&&this.zoom<Math.floor(ai.minzoom)||ai.maxzoom&&this.zoom>=ai.maxzoom||ai.visibility==="none")continue;Be(rn,this.zoom,tt.brightness,fe,this.worldview);const zn=Ue[ai.id]=ai.createBucket({index:Oe.bucketLayerIDs.length,layers:rn,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Mi,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:Ae,worldview:this.worldview,localizable:Fi});Oe.bucketLayerIDs.push(rn.map(yi=>o.B(yi.id,yi.scope)));let Vr=zn.prepare?zn.prepare():null;Vr!=null?(Vr=Vr.then(()=>zn.populate(_i,tt,this.tileID.canonical,this.tileTransform)),Vt.push(Vr)):zn.populate(_i,tt,this.tileID.canonical,this.tileTransform)}}const Ft=()=>{let kr,Tr,br,Yr,di,Mi;pt.trim();const _i={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Fi=()=>{if(kr)return this.status="done",Re(kr);if(this.extraShadowCaster)this.status="done",Re(null,{buckets:Object.values(Ue).filter(rn=>!rn.isEmpty()),featureIndex:Oe,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:tt.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Tr&&br&&Yr){const rn=new $(Tr),ai=new Map;for(const[yi,Ps]of br.entries()){const{imagePosition:Ns}=o.fu(yi,Ps,o.fv);ai.set(yi,Ns)}const zn={};for(const yi in Ue){const Ps=Ue[yi];Ps instanceof o.b4&&(Be(Ps.layers,this.zoom,tt.brightness,fe,this.worldview),zn[yi]=o.fw(Ps,Tr,rn.positions,br,ai,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,di,this.worldview))}const Vr={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(Ee,br,di,()=>{Vr.iconsPending=!1,oi(zn,rn,Vr)}),this.rasterizeIfNeeded(Ee,Yr,Mi,()=>{Vr.patternsPending=!1,oi(zn,rn,Vr)})}},oi=(rn,ai,zn,Vr)=>{if(zn.iconsPending||zn.patternsPending)return;const yi=new o.fx(br,Yr,this.lut);for(const Ps in Ue){const Ns=Ue[Ps];if(Ps in rn)o.fy(Ns,rn[Ps],this.showCollisionBoxes,fe,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,br,yi);else if(Ns.hasPattern&&(Ns instanceof o.ba||Ns instanceof o.bb||Ns instanceof o.ea)){Be(Ns.layers,this.zoom,tt.brightness,fe,this.worldview);const xo=Object.fromEntries(yi.patternPositions);Ns.addFeatures(tt,this.tileID.canonical,xo,fe,this.tileTransform,this.brightness)}}this.status="done",Re(null,{buckets:Object.values(Ue).filter(Ps=>!Ps.isEmpty()),featureIndex:Oe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ai.image,lineAtlas:pt,imageAtlas:yi,brightness:tt.brightness})};if(!this.extraShadowCaster){const rn=o.fs(tt.glyphDependencies,Vr=>Object.keys(Vr).map(Number));Object.keys(rn).length?Ee.send("getGlyphs",{uid:this.uid,stacks:rn},(Vr,yi)=>{kr||(kr=Vr,Tr=yi,Fi())},void 0,!1,_i):Tr={};const ai=Array.from(tt.iconDependencies.keys()).map(Vr=>o.I.parse(Vr));ai.length?Ee.send("getImages",{images:ai,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Vr,yi)=>{kr||(kr=Vr,br=new Map,di=this.updateImageMapAndGetImageTaskQueue(br,yi,tt.iconDependencies),Fi())},void 0,!1,_i):(br=new Map,di=new Map);const zn=Array.from(tt.patternDependencies.keys()).map(Vr=>o.I.parse(Vr));zn.length?Ee.send("getImages",{images:zn,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Vr,yi)=>{kr||(kr=Vr,Yr=new Map,Mi=this.updateImageMapAndGetImageTaskQueue(Yr,yi,tt.patternDependencies),Fi())},void 0,!1,_i):(Yr=new Map,Mi=new Map)}if(tt.elevationFeatures&&tt.elevationFeatures.length>0){const rn=[];for(const zn of Object.values(Ue))if(zn instanceof o.bb){const Vr=zn.getUnevaluatedPortalGraph();Vr&&rn.push(Vr)}const ai=o.ft.evaluate(rn);for(const zn of Object.values(Ue))if(zn instanceof o.bb){const Vr=K.layers[$e.decode(zn.sourceLayerIndex)];zn.setEvaluatedPortalGraph(ai,Vr,this.tileID.canonical,tt.availableImages,tt.brightness)}}Fi()};Vt.length>0?Promise.allSettled(Vt).then(Ft).catch(Re):Ft()}updateParameters(K){this.scaleFactor=K.scaleFactor,this.showCollisionBoxes=K.showCollisionBoxes,this.projection=K.projection,this.brightness=K.brightness,this.tileTransform=o.aZ(K.tileID.canonical,K.projection),this.extraShadowCaster=K.extraShadowCaster,this.lut=K.lut,this.worldview=K.worldview,this.indoor=K.indoor}rasterizeIfNeeded(K,ne,fe,Ae){Array.from(ne.values()).some(Ee=>Ee.usvg)?this.rasterize(K,ne,fe,Ae):Ae()}updateImageMapAndGetImageTaskQueue(K,ne,fe){const Ae=new Map;for(const Ee of ne.keys()){const Re=fe.get(Ee)||[];for(const $e of Re){const Oe=$e.toString(),Ue=ne.get($e.id.toString());Ue.usvg?Ae.has(Oe)||(Ae.set(Oe,$e),K.set(Oe,Object.assign({},Ue))):K.set(Oe,Ue)}}return Ae}rasterize(K,ne,fe,Ae){this.rasterizeTask=K.send("rasterizeImages",{scope:this.scope,tasks:fe},(Ee,Re)=>{if(!Ee)for(const[$e,Oe]of Re.entries()){const Ue=Object.assign(ne.get($e),{data:Oe});ne.set($e,Ue)}Ae()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Be(Fe,K,ne,fe,Ae){const Ee=new o.ac(K,{brightness:ne,worldview:Ae});for(const Re of Fe)Re.recalculate(Ee,fe)}class je extends o.E{constructor(K,ne,fe,Ae,Ee,Re,$e){super(),this.actor=K,this.layerIndex=ne,this.availableImages=fe,this.availableModels=Ae,this.loadVectorData=Re||o.aL,this.loading={},this.loaded={},this.deduped=new o.aK(K.scheduler),this.isSpriteLoaded=Ee,this.scheduler=K.scheduler,this.brightness=$e}loadTile(K,ne){const fe=K.uid,Ae=K&&K.request,Ee=Ae&&Ae.collectResourceTiming,Re=this.loading[fe]=new Ie(K);Re.abort=this.loadVectorData(K,($e,Oe)=>{const Ue=!this.loading[fe];if(delete this.loading[fe],Re.cancelRasterize(),Ue||$e||!Oe)return Re.status="done",Ue||(this.loaded[fe]=Re),ne($e);const pt=Oe.rawData,tt={},Vt=o.aM(Oe.responseHeaders);Vt&&Vt.expires&&(tt.expires=Vt.expires),Vt&&Vt.cacheControl&&(tt.cacheControl=Vt.cacheControl),Re.vectorTile=Oe.vectorTile||new o.fz(new o.bt(pt));const rr=()=>{Re.parse(Re.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Ft,kr)=>{if(Ft||!kr)return ne(Ft);const Tr={};if(Ee){const br=k(Ae);br.length>0&&(Tr.resourceTiming=JSON.parse(JSON.stringify(br)))}ne(null,Object.assign({rawTileData:pt.slice(0),responseHeaders:Oe.responseHeaders},kr,tt,Tr))})};this.isSpriteLoaded?rr():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(rr,{type:"parseTile",isSymbolTile:K.isSymbolTile,zoom:K.tileZoom}):rr()}),this.loaded=this.loaded||{},this.loaded[fe]=Re})}reloadTile(K,ne){const fe=this.loaded,Ae=K.uid;if(fe&&fe[Ae]){const Ee=fe[Ae];Ee.updateParameters(K);const Re=($e,Oe)=>{const Ue=Ee.reloadCallback;Ue&&(delete Ee.reloadCallback,Ee.parse(Ee.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ue)),ne($e,Oe)};Ee.status==="parsing"?Ee.reloadCallback=Re:Ee.status==="done"&&(Ee.vectorTile?Ee.parse(Ee.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Re):Re())}else ne(null,void 0)}abortTile(K,ne){const fe=K.uid,Ae=this.loading[fe];Ae&&(Ae.abort&&Ae.abort(),delete this.loading[fe]),ne()}removeTile(K,ne){const fe=this.loaded,Ae=K.uid;fe&&fe[Ae]&&delete fe[Ae],ne()}}class Je{loadTile(K,ne){const{uid:fe,encoding:Ae,rawImageData:Ee,padding:Re}=K,$e=ImageBitmap&&Ee instanceof ImageBitmap?this.getImageData(Ee,Re):Ee;ne(null,new o.fA(fe,$e,Ae,Re<1))}reloadTile(K,ne){ne(null,null)}abortTile(K,ne){ne()}removeTile(K,ne){ne()}getImageData(K,ne){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(K.width,K.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=K.width,this.offscreenCanvas.height=K.height,this.offscreenCanvasContext.drawImage(K,0,0,K.width,K.height);const fe=this.offscreenCanvasContext.getImageData(-ne,-ne,K.width+2*ne,K.height+2*ne);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),fe}}o.bs.setPbf(o.bt);class ft{constructor(K){this._mrt=new o.bs(K.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=K.uid,this.tileID=K.tileID,this.source=K.source}parse(K,ne){const fe=this._mrt;this.status="parsing",this._entireBuffer=K;try{fe.parseHeader(K),this._isHeaderLoaded=!0;const Ae=[];for(const Ee in fe.layers){const Re=fe.getLayer(Ee),$e=Re.getDataRange(Re.getBandList()),Oe=fe.createDecodingTask($e),Ue=K.slice($e.firstByte,$e.lastByte+1),pt=o.bs.performDecoding(Ue,Oe).then(tt=>Oe.complete(null,tt)).catch(tt=>Oe.complete(tt,null));Ae.push(pt)}Promise.allSettled(Ae).then(()=>ne(null,fe)).catch(Ee=>ne(Ee))}catch(Ae){ne(Ae)}}}class kt{constructor(K){this.actor=K,this.loading={},this.loaded={}}loadTile(K,ne){const fe=K.uid,Ae=K.request,Ee=this.loading[fe]=new ft(K),{cancel:Re}=o.bu(Ae,($e,Oe,Ue)=>{const pt=!this.loading[fe];if(delete this.loading[fe],pt||$e||!Oe)return Ee.status="done",pt||(this.loaded[fe]=Ee),ne($e);Ee.parse(Oe,(tt,Vt)=>{if(tt||!Vt)return ne(tt);ne(null,Vt,Ue)}),this.loaded[fe]=Ee});Ee.abort=Re}reloadTile(K,ne){ne(null,void 0)}abortTile(K,ne){const fe=K.uid,Ae=this.loading[fe];Ae&&(Ae.abort&&Ae.abort(),delete this.loading[fe]),ne()}removeTile(K,ne){const fe=K.uid;this.loaded[fe]&&delete this.loaded[fe],ne()}decodeRasterArray(K,ne){o.bs.performDecoding(K.buffer,K.task).then(fe=>ne(null,fe)).catch(fe=>ne(fe))}}const tr=o.fB.prototype.toGeoJSON;class jt{constructor(K){this._feature=K,this.extent=o.al,this.type=K.type,this.properties=K.tags,"id"in K&&!isNaN(K.id)&&(this.id=parseInt(K.id,10))}loadGeometry(){if(this._feature.type===1){const K=[];for(const ne of this._feature.geometry)K.push([new o.P(ne[0],ne[1])]);return K}{const K=[];for(const ne of this._feature.geometry){const fe=[];for(const Ae of ne)fe.push(new o.P(Ae[0],Ae[1]));K.push(fe)}return K}}toGeoJSON(K,ne,fe){return tr.call(this,K,ne,fe)}}class Qe{constructor(K,ne){this.name=K,this.extent=o.al,this.length=ne.length,this._jsonFeatures=ne}feature(K){return new jt(this._jsonFeatures[K])}}class xt{constructor(K){this.layers={},this.extent=o.al;for(const ne of Object.keys(K))this.layers[ne]=new Qe(ne,K[ne])}}const It=64/4096,Ot=128;class Et{constructor(){this.features=new Map}clear(){this.features.clear()}load(K=[],ne){for(const fe of K){const Ae=fe.id;if(Ae==null)continue;let Ee=this.features.get(Ae);Ee&&this.updateCache(Ee,ne),fe.geometry?(Ee=Pt(fe),this.updateCache(Ee,ne),this.features.set(Ae,Ee)):this.features.delete(Ae),this.updateCache(Ee,ne)}}updateCache(K,ne){for(const{canonical:fe,uid:Ae}of Object.values(ne)){const{z:Ee,x:Re,y:$e}=fe;st(K,Math.pow(2,Ee),Re,$e)&&delete ne[Ae]}}getTile(K,ne,fe){const Ae=Math.pow(2,K),Ee=[];for(const Re of this.features.values())st(Re,Ae,ne,fe)&&Ee.push(hr(Re,Ae,ne,fe));return{features:Ee}}getFeatures(){return[...this.features.values()]}}function st({minX:Fe,minY:K,maxX:ne,maxY:fe},Ae,Ee,Re){return Fe<(Ee+1+It)/Ae&&K<(Re+1+It)/Ae&&ne>(Ee-It)/Ae&&fe>(Re-It)/Ae}function Pt(Fe){const{id:K,geometry:ne,properties:fe}=Fe;if(!ne)return;if(ne.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:Ae,coordinates:Ee}=ne,Re={id:K,type:1,geometry:[],tags:fe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},$e=Re.geometry;if(Ae==="Point")qt(Ee,$e,Re);else if(Ae==="MultiPoint")for(const Oe of Ee)qt(Oe,$e,Re);else if(Ae==="LineString")Re.type=2,_r(Ee,$e,Re);else if(Ae==="MultiLineString")Re.type=2,yr(Ee,$e,Re);else if(Ae==="Polygon")Re.type=3,yr(Ee,$e,Re,!0);else{if(Ae!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Re.type=3;for(const Oe of Ee)yr(Oe,$e,Re,!0)}return Re}function qt([Fe,K],ne,fe){const Ae=o.aF(Fe);let Ee=o.aJ(K);Ee=Ee<0?0:Ee>1?1:Ee,ne.push(Ae,Ee),fe.minX=Math.min(fe.minX,Ae),fe.minY=Math.min(fe.minY,Ee),fe.maxX=Math.max(fe.maxX,Ae),fe.maxY=Math.max(fe.maxY,Ee)}function _r(Fe,K,ne,fe=!1,Ae=!1){const Ee=[];for(const Re of Fe)qt(Re,Ee,ne);K.push(Ee),fe&&function(Re,$e){let Oe=0;for(let Ue=0,pt=Re.length,tt=pt-2;Ue<pt;tt=Ue,Ue+=2)Oe+=(Re[Ue]-Re[tt])*(Re[Ue+1]+Re[tt+1]);if(Oe>0===$e)for(let Ue=0,pt=Re.length;Ue<pt/2;Ue+=2){const tt=Re[Ue],Vt=Re[Ue+1];Re[Ue]=Re[pt-2-Ue],Re[Ue+1]=Re[pt-1-Ue],Re[pt-2-Ue]=tt,Re[pt-1-Ue]=Vt}}(Ee,Ae)}function yr(Fe,K,ne,fe=!1){for(let Ae=0;Ae<Fe.length;Ae++)_r(Fe[Ae],K,ne,fe,Ae===0)}function hr(Fe,K,ne,fe){const{id:Ae,type:Ee,geometry:Re,tags:$e}=Fe,Oe=[];if(Ee===1)(function(Ue,pt,tt,Vt,rr){for(let Ft=0;Ft<Ue.length;Ft+=2){const kr=Math.round(o.al*(Ue[Ft+0]*pt-tt)),Tr=Math.round(o.al*(Ue[Ft+1]*pt-Vt));rr.push([kr,Tr])}})(Re,K,ne,fe,Oe);else if(Ee===2)for(const Ue of Re)Gr(Ue,K,ne,fe,Oe);else if(Ee===3)for(const Ue of Re)mi(Ue,K,ne,fe,Oe);return{id:Ae,type:Ee,geometry:Oe,tags:$e}}function Gr(Fe,K,ne,fe,Ae){const Ee=-Ot,Re=o.al+Ot;let $e;for(let Oe=0;Oe<Fe.length-2;Oe+=2){let Ue=Math.round(o.al*(Fe[Oe+0]*K-ne)),pt=Math.round(o.al*(Fe[Oe+1]*K-fe)),tt=Math.round(o.al*(Fe[Oe+2]*K-ne)),Vt=Math.round(o.al*(Fe[Oe+3]*K-fe));const rr=tt-Ue,Ft=Vt-pt;Ue<Ee&&tt<Ee||(Ue<Ee?(pt+=Math.round(Ft*((Ee-Ue)/rr)),Ue=Ee):tt<Ee&&(Vt=pt+Math.round(Ft*((Ee-Ue)/rr)),tt=Ee),pt<Ee&&Vt<Ee||(pt<Ee?(Ue+=Math.round(rr*((Ee-pt)/Ft)),pt=Ee):Vt<Ee&&(tt=Ue+Math.round(rr*((Ee-pt)/Ft)),Vt=Ee),Ue>=Re&&tt>=Re||(Ue>=Re?(pt+=Math.round(Ft*((Re-Ue)/rr)),Ue=Re):tt>=Re&&(Vt=pt+Math.round(Ft*((Re-Ue)/rr)),tt=Re),pt>=Re&&Vt>=Re||(pt>=Re?(Ue+=Math.round(rr*((Re-pt)/Ft)),pt=Re):Vt>=Re&&(tt=Ue+Math.round(rr*((Re-pt)/Ft)),Vt=Re),$e&&Ue===$e[$e.length-1][0]&&pt===$e[$e.length-1][1]||($e=[[Ue,pt]],Ae.push($e)),$e.push([tt,Vt])))))}}function mi(Fe,K,ne,fe,Ae){const Ee=(ne-It)/K,Re=(fe-It)/K,$e=(ne+1+It)/K,Oe=(fe+1+It)/K;function Ue(Vt,rr){let Ft=0;return Vt<Ee?Ft|=1:Vt>$e&&(Ft|=2),rr<Re?Ft|=4:rr>Oe&&(Ft|=8),Ft}let pt=[];for(let Vt=1;Vt<=8;Vt*=2){let rr=Fe[Fe.length-2],Ft=Fe[Fe.length-1],kr=!(Ue(rr,Ft)&Vt);for(let Tr=0;Tr<Fe.length;Tr+=2){const br=Fe[Tr],Yr=Fe[Tr+1],di=!(Ue(br,Yr)&Vt);di!==kr&&(8&Vt?pt.push(rr+(br-rr)*(Oe-Ft)/(Yr-Ft),Oe):4&Vt?pt.push(rr+(br-rr)*(Re-Ft)/(Yr-Ft),Re):2&Vt?pt.push($e,Ft+(Yr-Ft)*($e-rr)/(br-rr)):1&Vt&&pt.push(Ee,Ft+(Yr-Ft)*(Ee-rr)/(br-rr))),di&&pt.push(br,Yr),rr=br,Ft=Yr,kr=di}if(!(Fe=pt).length||Vt===8)break;pt=[]}const tt=[];for(let Vt=0;Vt<pt.length;Vt+=2)tt.push([Math.round(o.al*(pt[Vt]*K-ne)),Math.round(o.al*(pt[Vt+1]*K-fe))]);Ae.push(tt)}function Oi({name:Fe,features:K},ne){ne.writeStringField(1,Fe),ne.writeVarintField(5,o.al);const fe=new Map,Ae=new Map,Ee={keys:fe,values:Ae,feature:null};for(const Re of K)Ee.feature=Re,ne.writeMessage(2,xn,Ee);for(const Re of fe.keys())ne.writeStringField(3,Re);for(const Re of Ae.keys())ne.writeMessage(4,Ks,Re)}function xn(Fe,K){const ne=Fe.feature;ne.id!==void 0&&Number.isSafeInteger(+ne.id)&&K.writeVarintField(1,+ne.id),ne.tags&&K.writeMessage(2,zs,Fe),K.writeVarintField(3,ne.type),K.writeMessage(4,gi,ne)}function zs({keys:Fe,values:K,feature:ne},fe){for(const Ae of Object.keys(ne.tags)){let Ee=ne.tags[Ae];if(Ee===null)continue;let Re=Fe.get(Ae);Re===void 0&&(Re=Fe.size,Fe.set(Ae,Re)),fe.writeVarint(Re);const $e=typeof Ee;$e!=="string"&&$e!=="boolean"&&$e!=="number"&&(Ee=JSON.stringify(Ee));let Oe=K.get(Ee);Oe===void 0&&(Oe=K.size,K.set(Ee,Oe)),fe.writeVarint(Oe)}}function un(Fe,K){return(K<<3)+(7&Fe)}function Nn(Fe){return Fe<<1^Fe>>31}function gi(Fe,K){const{geometry:ne,type:fe}=Fe;let Ae=0,Ee=0;if(fe===1){K.writeVarint(un(1,ne.length));for(const Re of ne){const $e=Re[0]-Ae,Oe=Re[1]-Ee;K.writeVarint(Nn($e)),K.writeVarint(Nn(Oe)),Ae+=$e,Ee+=Oe}}else for(const Re of ne){K.writeVarint(un(1,1));const $e=Re.length-(fe===3?1:0);for(let Oe=0;Oe<$e;Oe++){Oe===1&&K.writeVarint(un(2,$e-1));const Ue=Re[Oe][0]-Ae,pt=Re[Oe][1]-Ee;K.writeVarint(Nn(Ue)),K.writeVarint(Nn(pt)),Ae+=Ue,Ee+=pt}fe===3&&K.writeVarint(un(7,1))}}function Ks(Fe,K){const ne=typeof Fe;ne==="string"?K.writeStringField(1,Fe):ne==="boolean"?K.writeBooleanField(7,Fe):ne==="number"&&(Fe%1!=0?K.writeDoubleField(3,Fe):Fe<0?K.writeSVarintField(6,Fe):K.writeVarintField(5,Fe))}const Un={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Fe=>Fe},io=Math.fround||(so=new Float32Array(1),Fe=>(so[0]=+Fe,so[0]));var so;const Ki=3,Zi=5,Zn=6;class Is{constructor(K){this.options=Object.assign(Object.create(Un),K),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(K){const{log:ne,minZoom:fe,maxZoom:Ae}=this.options;ne&&console.time("total time");const Ee=`prepare ${K.length} points`;ne&&console.time(Ee),this.points=K;const Re=[];for(let Oe=0;Oe<K.length;Oe++){const Ue=K[Oe];if(!Ue.geometry)continue;const[pt,tt]=Ue.geometry.coordinates,Vt=io(us(pt)),rr=io(Fs(tt));Re.push(Vt,rr,1/0,Oe,-1,1),this.options.reduce&&Re.push(0)}let $e=this.trees[Ae+1]=this._createTree(Re);ne&&console.timeEnd(Ee);for(let Oe=Ae;Oe>=fe;Oe--){const Ue=+Date.now();$e=this.trees[Oe]=this._createTree(this._cluster($e,Oe)),ne&&console.log("z%d: %d clusters in %dms",Oe,$e.numItems,+Date.now()-Ue)}return ne&&console.timeEnd("total time"),this}getClusters(K,ne){let fe=((K[0]+180)%360+360)%360-180;const Ae=Math.max(-90,Math.min(90,K[1]));let Ee=K[2]===180?180:((K[2]+180)%360+360)%360-180;const Re=Math.max(-90,Math.min(90,K[3]));if(K[2]-K[0]>=360)fe=-180,Ee=180;else if(fe>Ee){const tt=this.getClusters([fe,Ae,180,Re],ne),Vt=this.getClusters([-180,Ae,Ee,Re],ne);return tt.concat(Vt)}const $e=this.trees[this._limitZoom(ne)],Oe=$e.range(us(fe),Fs(Re),us(Ee),Fs(Ae)),Ue=$e.data,pt=[];for(const tt of Oe){const Vt=this.stride*tt;pt.push(Ue[Vt+Zi]>1?ua(Ue,Vt,this.clusterProps):this.points[Ue[Vt+Ki]])}return pt}getChildren(K){const ne=this._getOriginId(K),fe=this._getOriginZoom(K),Ae="No cluster with the specified id.",Ee=this.trees[fe];if(!Ee)throw new Error(Ae);const Re=Ee.data;if(ne*this.stride>=Re.length)throw new Error(Ae);const $e=this.options.radius/(this.options.extent*Math.pow(2,fe-1)),Oe=Ee.within(Re[ne*this.stride],Re[ne*this.stride+1],$e),Ue=[];for(const pt of Oe){const tt=pt*this.stride;Re[tt+4]===K&&Ue.push(Re[tt+Zi]>1?ua(Re,tt,this.clusterProps):this.points[Re[tt+Ki]])}if(Ue.length===0)throw new Error(Ae);return Ue}getLeaves(K,ne,fe){const Ae=[];return this._appendLeaves(Ae,K,ne=ne||10,fe=fe||0,0),Ae}getTile(K,ne,fe){const Ae=this.trees[this._limitZoom(K)],Ee=Math.pow(2,K),{extent:Re,radius:$e}=this.options,Oe=$e/Re,Ue=(fe-Oe)/Ee,pt=(fe+1+Oe)/Ee,tt={features:[]};return this._addTileFeatures(Ae.range((ne-Oe)/Ee,Ue,(ne+1+Oe)/Ee,pt),Ae.data,ne,fe,Ee,tt),ne===0&&this._addTileFeatures(Ae.range(1-Oe/Ee,Ue,1,pt),Ae.data,Ee,fe,Ee,tt),ne===Ee-1&&this._addTileFeatures(Ae.range(0,Ue,Oe/Ee,pt),Ae.data,-1,fe,Ee,tt),tt.features.length?tt:null}getClusterExpansionZoom(K){let ne=this._getOriginZoom(K)-1;for(;ne<=this.options.maxZoom;){const fe=this.getChildren(K);if(ne++,fe.length!==1)break;K=fe[0].properties.cluster_id}return ne}_appendLeaves(K,ne,fe,Ae,Ee){const Re=this.getChildren(ne);for(const $e of Re){const Oe=$e.properties;if(Oe&&Oe.cluster?Ee+Oe.point_count<=Ae?Ee+=Oe.point_count:Ee=this._appendLeaves(K,Oe.cluster_id,fe,Ae,Ee):Ee<Ae?Ee++:K.push($e),K.length===fe)break}return Ee}_createTree(K){const ne=new o.c4(K.length/this.stride|0,this.options.nodeSize,Float32Array);for(let fe=0;fe<K.length;fe+=this.stride)ne.add(K[fe],K[fe+1]);return ne.finish(),ne.data=K,ne}_addTileFeatures(K,ne,fe,Ae,Ee,Re){for(const $e of K){const Oe=$e*this.stride,Ue=ne[Oe+Zi]>1;let pt,tt,Vt;if(Ue)pt=Ai(ne,Oe,this.clusterProps),tt=ne[Oe],Vt=ne[Oe+1];else{const kr=this.points[ne[Oe+Ki]];pt=kr.properties;const[Tr,br]=kr.geometry.coordinates;tt=us(Tr),Vt=Fs(br)}const rr={type:1,geometry:[[Math.round(this.options.extent*(tt*Ee-fe)),Math.round(this.options.extent*(Vt*Ee-Ae))]],tags:pt};let Ft;Ft=Ue||this.options.generateId?ne[Oe+Ki]:this.points[ne[Oe+Ki]].id,Ft!==void 0&&(rr.id=Ft),Re.features.push(rr)}}_limitZoom(K){return Math.max(this.options.minZoom,Math.min(Math.floor(+K),this.options.maxZoom+1))}_cluster(K,ne){const{radius:fe,extent:Ae,reduce:Ee,minPoints:Re}=this.options,$e=fe/(Ae*Math.pow(2,ne)),Oe=K.data,Ue=[],pt=this.stride;for(let tt=0;tt<Oe.length;tt+=pt){if(Oe[tt+2]<=ne)continue;Oe[tt+2]=ne;const Vt=Oe[tt],rr=Oe[tt+1],Ft=K.within(Oe[tt],Oe[tt+1],$e),kr=Oe[tt+Zi];let Tr=kr;for(const br of Ft){const Yr=br*pt;Oe[Yr+2]>ne&&(Tr+=Oe[Yr+Zi])}if(Tr>kr&&Tr>=Re){let br,Yr=Vt*kr,di=rr*kr,Mi=-1;const _i=(tt/pt<<5)+(ne+1)+this.points.length;for(const Fi of Ft){const oi=Fi*pt;if(Oe[oi+2]<=ne)continue;Oe[oi+2]=ne;const rn=Oe[oi+Zi];Yr+=Oe[oi]*rn,di+=Oe[oi+1]*rn,Oe[oi+4]=_i,Ee&&(br||(br=this._map(Oe,tt,!0),Mi=this.clusterProps.length,this.clusterProps.push(br)),Ee(br,this._map(Oe,oi)))}Oe[tt+4]=_i,Ue.push(Yr/Tr,di/Tr,1/0,_i,-1,Tr),Ee&&Ue.push(Mi)}else{for(let br=0;br<pt;br++)Ue.push(Oe[tt+br]);if(Tr>1)for(const br of Ft){const Yr=br*pt;if(!(Oe[Yr+2]<=ne)){Oe[Yr+2]=ne;for(let di=0;di<pt;di++)Ue.push(Oe[Yr+di])}}}}return Ue}_getOriginId(K){return K-this.points.length>>5}_getOriginZoom(K){return(K-this.points.length)%32}_map(K,ne,fe){if(K[ne+Zi]>1){const Re=this.clusterProps[K[ne+Zn]];return fe?Object.assign({},Re):Re}const Ae=this.points[K[ne+Ki]].properties,Ee=this.options.map(Ae);return fe&&Ee===Ae?Object.assign({},Ee):Ee}}function ua(Fe,K,ne){return{type:"Feature",id:Fe[K+Ki],properties:Ai(Fe,K,ne),geometry:{type:"Point",coordinates:[(fe=Fe[K],360*(fe-.5)),rs(Fe[K+1])]}};var fe}function Ai(Fe,K,ne){const fe=Fe[K+Zi],Ae=fe>=1e4?`${Math.round(fe/1e3)}k`:fe>=1e3?Math.round(fe/100)/10+"k":fe,Ee=Fe[K+Zn],Re=Ee===-1?{}:Object.assign({},ne[Ee]);return Object.assign(Re,{cluster:!0,cluster_id:Fe[K+Ki],point_count:fe,point_count_abbreviated:Ae})}function us(Fe){return Fe/360+.5}function Fs(Fe){const K=Math.sin(Fe*Math.PI/180),ne=.5-.25*Math.log((1+K)/(1-K))/Math.PI;return ne<0?0:ne>1?1:ne}function rs(Fe){const K=(180-360*Fe)*Math.PI/180;return 360*Math.atan(Math.exp(K))/Math.PI-90}function Ho(Fe,K,ne,fe){let Ae=fe;const Ee=K+(ne-K>>1);let Re,$e=ne-K;const Oe=Fe[K],Ue=Fe[K+1],pt=Fe[ne],tt=Fe[ne+1];for(let Vt=K+3;Vt<ne;Vt+=3){const rr=ds(Fe[Vt],Fe[Vt+1],Oe,Ue,pt,tt);if(rr>Ae)Re=Vt,Ae=rr;else if(rr===Ae){const Ft=Math.abs(Vt-Ee);Ft<$e&&(Re=Vt,$e=Ft)}}Ae>fe&&(Re-K>3&&Ho(Fe,K,Re,fe),Fe[Re+2]=Ae,ne-Re>3&&Ho(Fe,Re,ne,fe))}function ds(Fe,K,ne,fe,Ae,Ee){let Re=Ae-ne,$e=Ee-fe;if(Re!==0||$e!==0){const Oe=((Fe-ne)*Re+(K-fe)*$e)/(Re*Re+$e*$e);Oe>1?(ne=Ae,fe=Ee):Oe>0&&(ne+=Re*Oe,fe+=$e*Oe)}return Re=Fe-ne,$e=K-fe,Re*Re+$e*$e}function bs(Fe,K,ne,fe){const Ae={id:Fe??null,type:K,geometry:ne,tags:fe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(K==="Point"||K==="MultiPoint"||K==="LineString")Wo(Ae,ne);else if(K==="Polygon")Wo(Ae,ne[0]);else if(K==="MultiLineString")for(const Ee of ne)Wo(Ae,Ee);else if(K==="MultiPolygon")for(const Ee of ne)Wo(Ae,Ee[0]);return Ae}function Wo(Fe,K){for(let ne=0;ne<K.length;ne+=3)Fe.minX=Math.min(Fe.minX,K[ne]),Fe.minY=Math.min(Fe.minY,K[ne+1]),Fe.maxX=Math.max(Fe.maxX,K[ne]),Fe.maxY=Math.max(Fe.maxY,K[ne+1])}function At(Fe,K,ne,fe){if(!K.geometry)return;const Ae=K.geometry.coordinates;if(Ae&&Ae.length===0)return;const Ee=K.geometry.type,Re=Math.pow(ne.tolerance/((1<<ne.maxZoom)*ne.extent),2);let $e=[],Oe=K.id;if(ne.promoteId?Oe=K.properties[ne.promoteId]:ne.generateId&&(Oe=fe||0),Ee==="Point")sr(Ae,$e);else if(Ee==="MultiPoint")for(const Ue of Ae)sr(Ue,$e);else if(Ee==="LineString")Lr(Ae,$e,Re,!1);else if(Ee==="MultiLineString"){if(ne.lineMetrics){for(const Ue of Ae)$e=[],Lr(Ue,$e,Re,!1),Fe.push(bs(Oe,"LineString",$e,K.properties));return}Zr(Ae,$e,Re,!1)}else if(Ee==="Polygon")Zr(Ae,$e,Re,!0);else{if(Ee!=="MultiPolygon"){if(Ee==="GeometryCollection"){for(const Ue of K.geometry.geometries)At(Fe,{id:Oe,geometry:Ue,properties:K.properties},ne,fe);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Ue of Ae){const pt=[];Zr(Ue,pt,Re,!0),$e.push(pt)}}Fe.push(bs(Oe,Ee,$e,K.properties))}function sr(Fe,K){K.push(tn(Fe[0]),Wr(Fe[1]),0)}function Lr(Fe,K,ne,fe){let Ae,Ee,Re=0;for(let Oe=0;Oe<Fe.length;Oe++){const Ue=tn(Fe[Oe][0]),pt=Wr(Fe[Oe][1]);K.push(Ue,pt,0),Oe>0&&(Re+=fe?(Ae*pt-Ue*Ee)/2:Math.sqrt(Math.pow(Ue-Ae,2)+Math.pow(pt-Ee,2))),Ae=Ue,Ee=pt}const $e=K.length-3;K[2]=1,Ho(K,0,$e,ne),K[$e+2]=1,K.size=Math.abs(Re),K.start=0,K.end=K.size}function Zr(Fe,K,ne,fe){for(let Ae=0;Ae<Fe.length;Ae++){const Ee=[];Lr(Fe[Ae],Ee,ne,fe),K.push(Ee)}}function tn(Fe){return Fe/360+.5}function Wr(Fe){const K=Math.sin(Fe*Math.PI/180),ne=.5-.25*Math.log((1+K)/(1-K))/Math.PI;return ne<0?0:ne>1?1:ne}function On(Fe,K,ne,fe,Ae,Ee,Re,$e){if(fe/=K,Ee>=(ne/=K)&&Re<fe)return Fe;if(Re<ne||Ee>=fe)return null;const Oe=[];for(const Ue of Fe){const pt=Ue.geometry;let tt=Ue.type;const Vt=Ae===0?Ue.minX:Ue.minY,rr=Ae===0?Ue.maxX:Ue.maxY;if(Vt>=ne&&rr<fe){Oe.push(Ue);continue}if(rr<ne||Vt>=fe)continue;let Ft=[];if(tt==="Point"||tt==="MultiPoint")Zs(pt,Ft,ne,fe,Ae);else if(tt==="LineString")qo(pt,Ft,ne,fe,Ae,!1,$e.lineMetrics);else if(tt==="MultiLineString")Do(pt,Ft,ne,fe,Ae,!1);else if(tt==="Polygon")Do(pt,Ft,ne,fe,Ae,!0);else if(tt==="MultiPolygon")for(const kr of pt){const Tr=[];Do(kr,Tr,ne,fe,Ae,!0),Tr.length&&Ft.push(Tr)}if(Ft.length){if($e.lineMetrics&&tt==="LineString"){for(const kr of Ft)Oe.push(bs(Ue.id,tt,kr,Ue.tags));continue}tt!=="LineString"&&tt!=="MultiLineString"||(Ft.length===1?(tt="LineString",Ft=Ft[0]):tt="MultiLineString"),tt!=="Point"&&tt!=="MultiPoint"||(tt=Ft.length===3?"Point":"MultiPoint"),Oe.push(bs(Ue.id,tt,Ft,Ue.tags))}}return Oe.length?Oe:null}function Zs(Fe,K,ne,fe,Ae){for(let Ee=0;Ee<Fe.length;Ee+=3){const Re=Fe[Ee+Ae];Re>=ne&&Re<=fe&&oo(K,Fe[Ee],Fe[Ee+1],Fe[Ee+2])}}function qo(Fe,K,ne,fe,Ae,Ee,Re){let $e=yo(Fe);const Oe=Ae===0?vo:Lo;let Ue,pt,tt=Fe.start;for(let Tr=0;Tr<Fe.length-3;Tr+=3){const br=Fe[Tr],Yr=Fe[Tr+1],di=Fe[Tr+2],Mi=Fe[Tr+3],_i=Fe[Tr+4],Fi=Ae===0?br:Yr,oi=Ae===0?Mi:_i;let rn=!1;Re&&(Ue=Math.sqrt(Math.pow(br-Mi,2)+Math.pow(Yr-_i,2))),Fi<ne?oi>ne&&(pt=Oe($e,br,Yr,Mi,_i,ne),Re&&($e.start=tt+Ue*pt)):Fi>fe?oi<fe&&(pt=Oe($e,br,Yr,Mi,_i,fe),Re&&($e.start=tt+Ue*pt)):oo($e,br,Yr,di),oi<ne&&Fi>=ne&&(pt=Oe($e,br,Yr,Mi,_i,ne),rn=!0),oi>fe&&Fi<=fe&&(pt=Oe($e,br,Yr,Mi,_i,fe),rn=!0),!Ee&&rn&&(Re&&($e.end=tt+Ue*pt),K.push($e),$e=yo(Fe)),Re&&(tt+=Ue)}let Vt=Fe.length-3;const rr=Fe[Vt],Ft=Fe[Vt+1],kr=Ae===0?rr:Ft;kr>=ne&&kr<=fe&&oo($e,rr,Ft,Fe[Vt+2]),Vt=$e.length-3,Ee&&Vt>=3&&($e[Vt]!==$e[0]||$e[Vt+1]!==$e[1])&&oo($e,$e[0],$e[1],$e[2]),$e.length&&K.push($e)}function yo(Fe){const K=[];return K.size=Fe.size,K.start=Fe.start,K.end=Fe.end,K}function Do(Fe,K,ne,fe,Ae,Ee){for(const Re of Fe)qo(Re,K,ne,fe,Ae,Ee,!1)}function oo(Fe,K,ne,fe){Fe.push(K,ne,fe)}function vo(Fe,K,ne,fe,Ae,Ee){const Re=(Ee-K)/(fe-K);return oo(Fe,Ee,ne+(Ae-ne)*Re,1),Re}function Lo(Fe,K,ne,fe,Ae,Ee){const Re=(Ee-ne)/(Ae-ne);return oo(Fe,K+(fe-K)*Re,Ee,1),Re}function En(Fe,K){const ne=[];for(let fe=0;fe<Fe.length;fe++){const Ae=Fe[fe],Ee=Ae.type;let Re;if(Ee==="Point"||Ee==="MultiPoint"||Ee==="LineString")Re=zi(Ae.geometry,K);else if(Ee==="MultiLineString"||Ee==="Polygon"){Re=[];for(const $e of Ae.geometry)Re.push(zi($e,K))}else if(Ee==="MultiPolygon"){Re=[];for(const $e of Ae.geometry){const Oe=[];for(const Ue of $e)Oe.push(zi(Ue,K));Re.push(Oe)}}ne.push(bs(Ae.id,Ee,Re,Ae.tags))}return ne}function zi(Fe,K){const ne=[];ne.size=Fe.size,Fe.start!==void 0&&(ne.start=Fe.start,ne.end=Fe.end);for(let fe=0;fe<Fe.length;fe+=3)ne.push(Fe[fe]+K,Fe[fe+1],Fe[fe+2]);return ne}function on(Fe,K){if(Fe.transformed)return Fe;const ne=1<<Fe.z,fe=Fe.x,Ae=Fe.y;for(const Ee of Fe.features){const Re=Ee.geometry,$e=Ee.type;if(Ee.geometry=[],$e===1)for(let Oe=0;Oe<Re.length;Oe+=2)Ee.geometry.push(Wn(Re[Oe],Re[Oe+1],K,ne,fe,Ae));else for(let Oe=0;Oe<Re.length;Oe++){const Ue=[];for(let pt=0;pt<Re[Oe].length;pt+=2)Ue.push(Wn(Re[Oe][pt],Re[Oe][pt+1],K,ne,fe,Ae));Ee.geometry.push(Ue)}}return Fe.transformed=!0,Fe}function Wn(Fe,K,ne,fe,Ae,Ee){return[Math.round(ne*(Fe*fe-Ae)),Math.round(ne*(K*fe-Ee))]}function qn(Fe,K,ne,fe,Ae){const Ee=K===Ae.maxZoom?0:Ae.tolerance/((1<<K)*Ae.extent),Re={features:[],numPoints:0,numSimplified:0,numFeatures:Fe.length,source:null,x:ne,y:fe,z:K,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const $e of Fe)Bs(Re,$e,Ee,Ae);return Re}function Bs(Fe,K,ne,fe){const Ae=K.geometry,Ee=K.type,Re=[];if(Fe.minX=Math.min(Fe.minX,K.minX),Fe.minY=Math.min(Fe.minY,K.minY),Fe.maxX=Math.max(Fe.maxX,K.maxX),Fe.maxY=Math.max(Fe.maxY,K.maxY),Ee==="Point"||Ee==="MultiPoint")for(let $e=0;$e<Ae.length;$e+=3)Re.push(Ae[$e],Ae[$e+1]),Fe.numPoints++,Fe.numSimplified++;else if(Ee==="LineString")it(Re,Ae,Fe,ne,!1,!1);else if(Ee==="MultiLineString"||Ee==="Polygon")for(let $e=0;$e<Ae.length;$e++)it(Re,Ae[$e],Fe,ne,Ee==="Polygon",$e===0);else if(Ee==="MultiPolygon")for(let $e=0;$e<Ae.length;$e++){const Oe=Ae[$e];for(let Ue=0;Ue<Oe.length;Ue++)it(Re,Oe[Ue],Fe,ne,!0,Ue===0)}if(Re.length){let $e=K.tags||null;if(Ee==="LineString"&&fe.lineMetrics){$e={};for(const Ue in K.tags)$e[Ue]=K.tags[Ue];$e.mapbox_clip_start=Ae.start/Ae.size,$e.mapbox_clip_end=Ae.end/Ae.size}const Oe={geometry:Re,type:Ee==="Polygon"||Ee==="MultiPolygon"?3:Ee==="LineString"||Ee==="MultiLineString"?2:1,tags:$e};K.id!==null&&(Oe.id=K.id),Fe.features.push(Oe)}}function it(Fe,K,ne,fe,Ae,Ee){const Re=fe*fe;if(fe>0&&K.size<(Ae?Re:fe))return void(ne.numPoints+=K.length/3);const $e=[];for(let Oe=0;Oe<K.length;Oe+=3)(fe===0||K[Oe+2]>Re)&&(ne.numSimplified++,$e.push(K[Oe],K[Oe+1])),ne.numPoints++;Ae&&function(Oe,Ue){let pt=0;for(let tt=0,Vt=Oe.length,rr=Vt-2;tt<Vt;rr=tt,tt+=2)pt+=(Oe[tt]-Oe[rr])*(Oe[tt+1]+Oe[rr+1]);if(pt>0===Ue)for(let tt=0,Vt=Oe.length;tt<Vt/2;tt+=2){const rr=Oe[tt],Ft=Oe[tt+1];Oe[tt]=Oe[Vt-2-tt],Oe[tt+1]=Oe[Vt-1-tt],Oe[Vt-2-tt]=rr,Oe[Vt-1-tt]=Ft}}($e,Ee),Fe.push($e)}const hs={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Xs{constructor(K,ne){const fe=(ne=this.options=function(Ee,Re){for(const $e in Re)Ee[$e]=Re[$e];return Ee}(Object.create(hs),ne)).debug;if(fe&&console.time("preprocess data"),ne.maxZoom<0||ne.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ne.promoteId&&ne.generateId)throw new Error("promoteId and generateId cannot be used together.");let Ae=function(Ee,Re){const $e=[];if(Ee.type==="FeatureCollection")for(let Oe=0;Oe<Ee.features.length;Oe++)At($e,Ee.features[Oe],Re,Oe);else At($e,Ee.type==="Feature"?Ee:{geometry:Ee},Re);return $e}(K,ne);this.tiles={},this.tileCoords=[],fe&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ne.indexMaxZoom,ne.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Ae=function(Ee,Re){const $e=Re.buffer/Re.extent;let Oe=Ee;const Ue=On(Ee,1,-1-$e,$e,0,-1,2,Re),pt=On(Ee,1,1-$e,2+$e,0,-1,2,Re);return(Ue||pt)&&(Oe=On(Ee,1,-$e,1+$e,0,-1,2,Re)||[],Ue&&(Oe=En(Ue,1).concat(Oe)),pt&&(Oe=Oe.concat(En(pt,-1)))),Oe}(Ae,ne),Ae.length&&this.splitTile(Ae,0,0,0),fe&&(Ae.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(K,ne,fe,Ae,Ee,Re,$e){const Oe=[K,ne,fe,Ae],Ue=this.options,pt=Ue.debug;for(;Oe.length;){Ae=Oe.pop(),fe=Oe.pop(),ne=Oe.pop(),K=Oe.pop();const tt=1<<ne,Vt=fs(ne,fe,Ae);let rr=this.tiles[Vt];if(!rr&&(pt>1&&console.time("creation"),rr=this.tiles[Vt]=qn(K,ne,fe,Ae,Ue),this.tileCoords.push({z:ne,x:fe,y:Ae}),pt)){pt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ne,fe,Ae,rr.numFeatures,rr.numPoints,rr.numSimplified),console.timeEnd("creation"));const rn=`z${ne}`;this.stats[rn]=(this.stats[rn]||0)+1,this.total++}if(rr.source=K,Ee==null){if(ne===Ue.indexMaxZoom||rr.numPoints<=Ue.indexMaxPoints)continue}else{if(ne===Ue.maxZoom||ne===Ee)continue;if(Ee!=null){const rn=Ee-ne;if(fe!==Re>>rn||Ae!==$e>>rn)continue}}if(rr.source=null,K.length===0)continue;pt>1&&console.time("clipping");const Ft=.5*Ue.buffer/Ue.extent,kr=.5-Ft,Tr=.5+Ft,br=1+Ft;let Yr=null,di=null,Mi=null,_i=null,Fi=On(K,tt,fe-Ft,fe+Tr,0,rr.minX,rr.maxX,Ue),oi=On(K,tt,fe+kr,fe+br,0,rr.minX,rr.maxX,Ue);K=null,Fi&&(Yr=On(Fi,tt,Ae-Ft,Ae+Tr,1,rr.minY,rr.maxY,Ue),di=On(Fi,tt,Ae+kr,Ae+br,1,rr.minY,rr.maxY,Ue),Fi=null),oi&&(Mi=On(oi,tt,Ae-Ft,Ae+Tr,1,rr.minY,rr.maxY,Ue),_i=On(oi,tt,Ae+kr,Ae+br,1,rr.minY,rr.maxY,Ue),oi=null),pt>1&&console.timeEnd("clipping"),Oe.push(Yr||[],ne+1,2*fe,2*Ae),Oe.push(di||[],ne+1,2*fe,2*Ae+1),Oe.push(Mi||[],ne+1,2*fe+1,2*Ae),Oe.push(_i||[],ne+1,2*fe+1,2*Ae+1)}}getTile(K,ne,fe){K=+K,ne=+ne,fe=+fe;const Ae=this.options,{extent:Ee,debug:Re}=Ae;if(K<0||K>24)return null;const $e=1<<K,Oe=fs(K,ne=ne+$e&$e-1,fe);if(this.tiles[Oe])return on(this.tiles[Oe],Ee);Re>1&&console.log("drilling down to z%d-%d-%d",K,ne,fe);let Ue,pt=K,tt=ne,Vt=fe;for(;!Ue&&pt>0;)pt--,tt>>=1,Vt>>=1,Ue=this.tiles[fs(pt,tt,Vt)];return Ue&&Ue.source?(Re>1&&(console.log("found parent tile z%d-%d-%d",pt,tt,Vt),console.time("drilling down")),this.splitTile(Ue.source,pt,tt,Vt,K,ne,fe),Re>1&&console.timeEnd("drilling down"),this.tiles[Oe]?on(this.tiles[Oe],Ee):null):null}}function fs(Fe,K,ne){return 32*((1<<Fe)*ne+K)+Fe}function zr(Fe,K){const ne=Fe.tileID.canonical;if(!this._geoJSONIndex)return void K(null,null);const fe=this._geoJSONIndex.getTile(ne.z,ne.x,ne.y);if(!fe)return void K(null,null);const Ae=Ue=>Ue.tags&&"3d_elevation_id"in Ue.tags&&"source"in Ue.tags&&Ue.tags.source==="elevation",Ee=fe.features.filter(Ue=>Ae(Ue));let Re={_geojsonTileLayer:fe.features};Ee.length>0&&(Re={_geojsonTileLayer:fe.features.filter(Ue=>!Ae(Ue)),hd_road_elevation:Ee});const $e=new xt(Re),Oe=function(Ue){const pt=new o.bt;for(const tt of Object.keys(Ue))pt.writeMessage(3,Oi,{name:tt,features:Ue[tt]});return pt.finish()}(Re).buffer;K(null,{vectorTile:$e,rawData:Oe})}class Fr extends je{constructor(K,ne,fe,Ae,Ee,Re,$e){super(K,ne,fe,Ae,Ee,zr,$e),Re&&(this.loadGeoJSON=Re),this._dynamicIndex=new Et}loadData(K,ne){const fe=K&&K.request,Ae=fe&&fe.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(K,(Ee,Re)=>{if(Ee||!Re)return ne(Ee);if(typeof Re!="object")return ne(new Error(`Input data given to '${K.source}' is not a valid GeoJSON object.`));{try{if(K.filter){const Oe=o.U(K.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Oe.result==="error")throw new Error(Oe.value.map(Ue=>`${Ue.key}: ${Ue.message}`).join(", "));Re.features=Re.features.filter(Ue=>Oe.value.evaluate({zoom:0},Ue))}K.dynamic?(Re.type==="Feature"&&(Re={type:"FeatureCollection",features:[Re]}),K.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Re.features,this.loaded),K.cluster&&(Re.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=K.cluster?new Is(function({superclusterOptions:Oe,clusterProperties:Ue}){if(!Ue||!Oe)return Oe;const pt={},tt={},Vt={accumulated:null,zoom:0},rr={properties:null},Ft=Object.keys(Ue);for(const kr of Ft){const[Tr,br]=Ue[kr],Yr=o.U(br),di=o.U(typeof Tr=="string"?[Tr,["accumulated"],["get",kr]]:Tr);pt[kr]=Yr.value,tt[kr]=di.value}return Oe.map=kr=>{rr.properties=kr;const Tr={};for(const br of Ft)Tr[br]=pt[br].evaluate(Vt,rr);return Tr},Oe.reduce=(kr,Tr)=>{rr.properties=Tr;for(const br of Ft)Vt.accumulated=kr[br],kr[br]=tt[br].evaluate(Vt,rr)},Oe}(K)).load(Re.features):K.dynamic?this._dynamicIndex:function(Oe,Ue){return new Xs(Oe,Ue)}(Re,K.geojsonVtOptions)}catch(Oe){return ne(Oe)}const $e={};if(Ae){const Oe=k(fe);Oe&&($e.resourceTiming={},$e.resourceTiming[K.source]=JSON.parse(JSON.stringify(Oe)))}ne(null,$e)}})}reloadTile(K,ne){const fe=this.loaded;return fe&&fe[K.uid]?K.partial?ne(null,void 0):super.reloadTile(K,ne):this.loadTile(K,ne)}loadGeoJSON(K,ne){if(K.request)o.m(K.request,ne);else{if(typeof K.data!="string")return ne(new Error(`Input data given to '${K.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return ne(null,JSON.parse(K.data))}catch{return ne(new Error(`Input data given to '${K.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(K,ne){try{ne(null,this._geoJSONIndex.getClusterExpansionZoom(K.clusterId))}catch(fe){ne(fe)}}getClusterChildren(K,ne){try{ne(null,this._geoJSONIndex.getChildren(K.clusterId))}catch(fe){ne(fe)}}getClusterLeaves(K,ne){try{ne(null,this._geoJSONIndex.getLeaves(K.clusterId,K.limit,K.offset))}catch(fe){ne(fe)}}}class Bi{constructor(K,ne,fe){this.tileID=new o.aQ(K.tileID.overscaledZ,K.tileID.wrap,K.tileID.canonical.z,K.tileID.canonical.x,K.tileID.canonical.y),this.tileZoom=K.tileZoom,this.uid=K.uid,this.zoom=K.zoom,this.canonical=K.tileID.canonical,this.pixelRatio=K.pixelRatio,this.tileSize=K.tileSize,this.source=K.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=K.projection,this.brightness=ne,this.worldview=fe}parse(K,ne,fe,Ae){this.status="parsing";const Ee=new o.aQ(fe.tileID.overscaledZ,fe.tileID.wrap,fe.tileID.canonical.z,fe.tileID.canonical.x,fe.tileID.canonical.y),Re=[],$e=ne.familiesBySource[fe.source],Oe=new o.fn(Ee,fe.promoteId);Oe.bucketLayerIDs=[],Oe.is3DTile=!0,o.fC(K).then(Ue=>{if(!Ue)return Ae(new Error("Could not parse tile"));const pt=Ue.json.extensionsUsed&&Ue.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ue.json.asset.extras&&Ue.json.asset.extras.MAPBOX_mesh_features,tt=Ue.json.extensionsUsed&&Ue.json.extensionsUsed.includes("EXT_meshopt_compression"),Vt=new o.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const rr in $e)for(const Ft of $e[rr]){const kr=Ft[0];Oe.bucketLayerIDs.push(Ft.map(Yr=>o.B(Yr.id,Yr.scope))),kr.recalculate(Vt,[]);const Tr=o.fD(Ue,1/o.d7(fe.tileID.canonical)),br=new o.fE(Ft,Tr,Ee,pt,tt,this.brightness,Oe,this.worldview);pt||(br.needsUpload=!0),Re.push(br),br.evaluate(kr)}this.status="done",Ae(null,{buckets:Re,featureIndex:Oe,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ue=>Ae(new Error(Ue.message)))}}class Pi{constructor(K,ne,fe,Ae,Ee,Re,$e,Oe){this.actor=K,this.layerIndex=ne,this.availableImages=fe,this.availableModels=Ae,this.brightness=$e,this.loading={},this.loaded={},this.worldview=Oe}loadTile(K,ne){const fe=K.uid,Ae=this.loading[fe]=new Bi(K,this.brightness,this.worldview);o.bu(K.request,(Ee,Re)=>{const $e=!this.loading[fe];return delete this.loading[fe],$e||Ee?(Ae.status="done",$e||(this.loaded[fe]=Ae),ne(Ee)):Re&&Re.byteLength!==0?void Ae.parse(Re,this.layerIndex,K,(Oe,Ue)=>{Ae.status="done",this.loaded=this.loaded||{},this.loaded[fe]=Ae,Oe||!Ue?ne(Oe):ne(null,Ue)}):(Ae.status="done",this.loaded[fe]=Ae,ne())})}reloadTile(K,ne){const fe=this.loaded,Ae=K.uid;if(fe&&fe[Ae]){const Ee=fe[Ae];Ee.projection=K.projection,Ee.brightness=K.brightness;const Re=($e,Oe)=>{Ee.reloadCallback&&(delete Ee.reloadCallback,this.loadTile(K,ne)),ne($e,Oe)};Ee.status==="parsing"?Ee.reloadCallback=Re:Ee.status==="done"&&this.loadTile(K,ne)}}abortTile(K,ne){const fe=K.uid;this.loading[fe]&&delete this.loading[fe],ne()}removeTile(K,ne){const fe=this.loaded,Ae=K.uid;fe&&fe[Ae]&&delete fe[Ae],ne()}}class Ss{constructor(K){this.self=K,this.actor=new o.fG(K,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new o.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=o.cm({name:"mercator"}),this.workerSourceTypes={vector:je,geojson:Fr,"raster-dem":Je,"raster-array":kt,"batched-model":Pi},this.workerSources={},this.self.registerWorkerSource=(ne,fe)=>{if(this.workerSourceTypes[ne])throw new Error(`Worker source with name "${ne}" already registered.`);this.workerSourceTypes[ne]=fe},this.self.registerRTLTextPlugin=ne=>{if(o.fH.isParsed())throw new Error("RTL text plugin already registered.");o.fH.setState({pluginStatus:o.fI.parsed,pluginURL:o.fH.getPluginURL()}),o.fH.applyArabicShaping=ne.applyArabicShaping,o.fH.processBidirectionalText=ne.processBidirectionalText,o.fH.processStyledBidirectionalText=ne.processStyledBidirectionalText;for(const fe of this.rtlPluginParsingListeners)fe(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(K,ne,fe){delete this.layerIndexes[K],delete this.availableImages[K],delete this.availableModels[K],delete this.workerSources[K],fe()}checkIfReady(K,ne,fe){fe()}setReferrer(K,ne){this.referrer=ne}spriteLoaded(K,ne){this.isSpriteLoaded[K]||(this.isSpriteLoaded[K]={});const{scope:fe,isLoaded:Ae}=ne;if(this.isSpriteLoaded[K][fe]=Ae,this.workerSources[K]&&this.workerSources[K][fe])for(const Ee in this.workerSources[K][fe]){const Re=this.workerSources[K][fe][Ee];for(const $e in Re){const Oe=Re[$e];Oe instanceof je&&(Oe.isSpriteLoaded=Ae,Oe.fire(new o.z("isSpriteLoaded")))}}}setImages(K,ne,fe){this.availableImages[K]||(this.availableImages[K]={});const{scope:Ae,images:Ee}=ne;if(this.availableImages[K][Ae]=Ee,this.workerSources[K]&&this.workerSources[K][Ae]){for(const Re in this.workerSources[K][Ae]){const $e=this.workerSources[K][Ae][Re];for(const Oe in $e)$e[Oe].availableImages=Ee}fe()}else fe()}setModels(K,{scope:ne,models:fe},Ae){if(this.availableModels[K]||(this.availableModels[K]={}),this.availableModels[K][ne]=fe,this.workerSources[K]&&this.workerSources[K][ne]){for(const Ee in this.workerSources[K][ne]){const Re=this.workerSources[K][ne][Ee];for(const $e in Re)Re[$e].availableModels=fe}Ae()}else Ae()}setProjection(K,ne){this.projections[K]=o.cm(ne)}setBrightness(K,ne,fe){this.brightness=ne,fe()}setWorldview(K,ne,fe){this.worldview=ne,fe()}setLayers(K,ne,fe){this.getLayerIndex(K,ne.scope).replace(ne.layers,ne.options),fe()}updateLayers(K,ne,fe){this.getLayerIndex(K,ne.scope).update(ne.layers,ne.removedIds,ne.options),fe()}loadTile(K,ne,fe){ne.projection=this.projections[K]||this.defaultProjection,this.getWorkerSource(K,ne.type,ne.source,ne.scope).loadTile(ne,fe)}decodeRasterArray(K,ne,fe){this.getWorkerSource(K,ne.type,ne.source,ne.scope).decodeRasterArray(ne,fe)}reloadTile(K,ne,fe){ne.projection=this.projections[K]||this.defaultProjection,this.getWorkerSource(K,ne.type,ne.source,ne.scope).reloadTile(ne,fe)}abortTile(K,ne,fe){this.getWorkerSource(K,ne.type,ne.source,ne.scope).abortTile(ne,fe)}removeTile(K,ne,fe){this.getWorkerSource(K,ne.type,ne.source,ne.scope).removeTile(ne,fe)}removeSource(K,ne,fe){if(!(this.workerSources[K]&&this.workerSources[K][ne.scope]&&this.workerSources[K][ne.scope][ne.type]&&this.workerSources[K][ne.scope][ne.type][ne.source]))return;const Ae=this.workerSources[K][ne.scope][ne.type][ne.source];delete this.workerSources[K][ne.scope][ne.type][ne.source],Ae.removeSource!==void 0?Ae.removeSource(ne,fe):fe()}loadWorkerSource(K,ne,fe){try{this.self.importScripts(ne.url),fe()}catch(Ae){fe(Ae)}}syncRTLPluginState(K,ne,fe){if(o.fH.isParsed())fe(null,!0);else if(o.fH.isParsing())this.rtlPluginParsingListeners.push(fe);else try{o.fH.setState(ne);const Ae=o.fH.getPluginURL();!o.fH.isLoaded()||o.fH.isParsed()||o.fH.isParsing()||Ae==null||(o.fH.setState({pluginStatus:o.fI.parsing,pluginURL:o.fH.getPluginURL()}),this.self.importScripts(Ae),o.fH.isParsed()?fe(null,!0):this.rtlPluginParsingListeners.push(fe))}catch(Ae){fe(Ae)}}setDracoUrl(K,ne){this.dracoUrl=ne}getAvailableImages(K,ne){this.availableImages[K]||(this.availableImages[K]={});let fe=this.availableImages[K][ne];return fe||(fe=[]),fe}getAvailableModels(K,ne){this.availableModels[K]||(this.availableModels[K]={});let fe=this.availableModels[K][ne];return fe||(fe={}),fe}getLayerIndex(K,ne){this.layerIndexes[K]||(this.layerIndexes[K]={});let fe=this.layerIndexes[K][ne];return fe||(fe=this.layerIndexes[K][ne]=new F,fe.scope=ne),fe}getWorkerSource(K,ne,fe,Ae){const Ee=this.workerSources;return Ee[K]||(Ee[K]={}),Ee[K][Ae]||(Ee[K][Ae]={}),Ee[K][Ae][ne]||(Ee[K][Ae][ne]={}),this.isSpriteLoaded[K]||(this.isSpriteLoaded[K]={}),Ee[K][Ae][ne][fe]||(Ee[K][Ae][ne][fe]=new this.workerSourceTypes[ne]({send:(Re,$e,Oe,Ue,pt,tt)=>this.actor.send(Re,$e,Oe,K,pt,tt),scheduler:this.actor.scheduler},this.getLayerIndex(K,Ae),this.getAvailableImages(K,Ae),this.getAvailableModels(K,Ae),this.isSpriteLoaded[K][Ae],void 0,this.brightness,this.worldview)),Ee[K][Ae][ne][fe]}rasterizeImagesWorker(K,ne,fe){const Ae=new Map;for(const[Ee,{image:Re,imageVariant:$e}]of ne.tasks.entries()){const Oe=this.imageRasterizer.rasterize($e,Re,ne.scope,K);Ae.set(Ee,Oe)}fe(void 0,Ae)}removeRasterizedImages(K,ne,fe){this.imageRasterizer.removeImagesFromCacheByIds(ne.imageIds,ne.scope,K),fe()}enforceCacheSizeLimit(K,ne){o.fJ(ne)}getWorkerPerformanceMetrics(K,ne,fe){fe(void 0,void 0)}}return o.fF(self)&&(self.worker=new Ss(self)),Ss}),_(["./shared"],function(o){var k="3.17.0";const P={create:"create",load:"load",fullLoad:"fullLoad"},O={mark(f){performance.mark(f)},measure(f,n,l){performance.measure(f,n,l)}};function F(f){const n=f.name.split("?")[0];return o.a(n)&&n.includes("mapbox-gl.js")?"javascript":o.a(n)&&n.includes("mapbox-gl.css")?"css":o.b(n)?"fontRange":o.c(n)?"sprite":o.i(n)?"style":o.d(n)?"tilejson":"other"}var V,$={},Y=function(){if(V)return $;function f(p){return!n(p)}function n(p){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var x,b,T=new Blob([""],{type:"text/javascript"}),A=URL.createObjectURL(T);try{b=new Worker(A),x=!0}catch{x=!1}return b&&b.terminate(),URL.revokeObjectURL(A),x}()?function(){var x=document.createElement("canvas");x.width=x.height=1;var b=x.getContext("2d");if(!b)return!1;var T=b.getImageData(0,0,1,1);return T&&T.width===x.width}()?(l[y=p&&p.failIfMajorPerformanceCaveat]===void 0&&(l[y]=function(x){var b,T=function(A){var M=document.createElement("canvas"),D=Object.create(f.webGLContextAttributes);return D.failIfMajorPerformanceCaveat=A,M.getContext("webgl2",D)}(x);if(!T)return!1;try{b=T.createShader(T.VERTEX_SHADER)}catch{return!1}return!(!b||T.isContextLost())&&(T.shaderSource(b,"void main() {}"),T.compileShader(b),T.getShaderParameter(b,T.COMPILE_STATUS)===!0)}(y)),l[y]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var y}V=1,$.supported=f,$.notSupportedReason=n;var l={};return f.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},$}();function Z(f,n,l){const p=document.createElement(f);return n!=null&&(p.className=n),l&&l.appendChild(p),p}function se(f,n,l){const p=document.createElementNS("http://www.w3.org/2000/svg",f);for(const y of Object.keys(n))p.setAttributeNS(null,y,String(n[y]));return l&&l.appendChild(p),p}const te=typeof document<"u"?document.documentElement&&document.documentElement.style:null,ee=te&&te.userSelect!==void 0?"userSelect":"WebkitUserSelect";let oe;function he(){te&&ee&&(oe=te[ee],te[ee]="none")}function Ie(){te&&ee&&(te[ee]=oe)}function Be(f){f.preventDefault(),f.stopPropagation(),window.removeEventListener("click",Be,!0)}function je(){window.addEventListener("click",Be,!0),window.setTimeout(()=>{window.removeEventListener("click",Be,!0)},0)}function Je(f,n){const l=f.getBoundingClientRect();return tr(f,l,n)}function ft(f,n){const l=f.getBoundingClientRect(),p=[];for(let y=0;y<n.length;y++)p.push(tr(f,l,n[y]));return p}function kt(f){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&f.button===2&&f.ctrlKey?0:f.button}function tr(f,n,l){const p=f.offsetWidth===n.width?1:f.offsetWidth/n.width;return new o.P((l.clientX-n.left)*p,(l.clientY-n.top)*p)}const jt="01",Qe="NO_ACCESS_TOKEN";class xt{constructor(n,l,p){this._transformRequestFn=n,this._customAccessToken=l,this._silenceAuthErrors=!!p,this._createSkuToken()}_createSkuToken(){const n=function(){let l="";for(let p=0;p<10;p++)l+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",jt,l].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=n.token,this._skuTokenExpiresAt=n.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(n,l){return this._transformRequestFn&&this._transformRequestFn(n,l)||{url:n}}normalizeStyleURL(n,l){if(!o.h(n))return n;const p=Ot(n);return p.params.push(`sdk=js-${k}`),p.path=`/styles/v1${p.path}`,this._makeAPIURL(p,this._customAccessToken||l)}normalizeGlyphsURL(n,l){if(!o.h(n))return n;const p=Ot(n);return p.path=`/fonts/v1${p.path}`,this._makeAPIURL(p,this._customAccessToken||l)}normalizeModelURL(n,l){if(!o.h(n))return n;const p=Ot(n);return p.path=`/models/v1${p.path}`,this._makeAPIURL(p,this._customAccessToken||l)}normalizeSourceURL(n,l,p,y){if(!o.h(n))return n;const x=Ot(n);return x.path=`/v4/${x.authority}.json`,x.params.push("secure"),p&&x.params.push(`language=${p}`),y&&x.params.push(`worldview=${y}`),this._makeAPIURL(x,this._customAccessToken||l)}normalizeIconsetURL(n,l){const p=Ot(n);return o.h(n)?(p.path=`/styles/v1${p.path}/iconset.pbf`,this._makeAPIURL(p,this._customAccessToken||l)):Et(p)}normalizeSpriteURL(n,l,p,y){const x=Ot(n);return o.h(n)?(x.path=`/styles/v1${x.path}/sprite${l}${p}`,this._makeAPIURL(x,this._customAccessToken||y)):(x.path+=`${l}${p}`,Et(x))}normalizeTileURL(n,l,p){if(this._isSkuTokenExpired()&&this._createSkuToken(),n&&!o.h(n))return n;const y=Ot(n);y.path=y.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${l||p&&y.authority!=="raster"&&p===512?"@2x":""}${o.k.supported?".webp":"$1"}`),y.authority==="raster"?y.path=`/${o.e.RASTER_URL_PREFIX}${y.path}`:y.authority==="rasterarrays"?y.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${y.path}`:y.authority==="3dtiles"?y.path=`/${o.e.TILES3D_URL_PREFIX}${y.path}`:(y.path=y.path.replace(/^.+\/v4\//,"/"),y.path=`/${o.e.TILE_URL_VERSION}${y.path}`);const x=this._customAccessToken||function(b){for(const T of b){const A=T.match(/^access_token=(.*)$/);if(A)return A[1]}return null}(y.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&x&&this._skuToken&&y.params.push(`sku=${this._skuToken}`),this._makeAPIURL(y,x)}canonicalizeTileURL(n,l){const p=Ot(n);if(!p.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!p.path.match(/\.[\w]+$/))return n;let y="mapbox://";p.path.match(/^\/raster\/v1\//)?y+=`raster/${p.path.replace(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:p.path.match(/^\/rasterarrays\/v1\//)?y+=`rasterarrays/${p.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:y+=`tiles/${p.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let x=p.params;return l&&(x=x.filter(b=>!b.match(/^access_token=/))),x.length&&(y+=`?${x.join("&")}`),y}canonicalizeTileset(n,l){const p=!!l&&o.h(l),y=[];for(const x of n.tiles||[])o.j(x)?y.push(this.canonicalizeTileURL(x,p)):y.push(x);return y}_makeAPIURL(n,l){const p="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",y=Ot(o.e.API_URL);if(n.protocol=y.protocol,n.authority=y.authority,n.protocol==="http"){const x=n.params.indexOf("secure");x>=0&&n.params.splice(x,1)}if(y.path!=="/"&&(n.path=`${y.path}${n.path}`),!o.e.REQUIRE_ACCESS_TOKEN)return Et(n);if(l=l||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!l)throw new Error(`An API access token is required to use Mapbox GL. ${p}`);if(l[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${p}`)}return n.params=n.params.filter(x=>x.indexOf("access_token")===-1),n.params.push(`access_token=${l||""}`),Et(n)}}const It=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ot(f){const n=f.match(It);if(!n)throw new Error("Unable to parse URL object");return{protocol:n[1],authority:n[2],path:n[3]||"/",params:n[4]?n[4].split("&"):[]}}function Et(f){const n=f.params.length?`?${f.params.join("&")}`:"";return`${f.protocol}://${f.authority}${f.path}${n}`}const st="mapbox.eventData";function Pt(f){if(!f)return null;const n=f.split(".");if(!n||n.length!==3)return null;try{return JSON.parse(o.l(n[1]))}catch{return null}}class qt{constructor(n){this.type=n,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(n){const l=Pt(o.e.ACCESS_TOKEN);let p="";return p=l&&l.u?o.f(l.u):o.e.ACCESS_TOKEN||"",n?`${st}.${n}:${p}`:`${st}:${p}`}fetchEventData(){const n=o.s("localStorage"),l=this.getStorageKey(),p=this.getStorageKey("uuid"),y=this.getStorageKey("uuidTimestamp");if(n)try{const x=localStorage.getItem(l);x&&(this.eventData=JSON.parse(x));const b=localStorage.getItem(p);b&&(this.anonId=b);const T=localStorage.getItem(y);T&&(this.anonIdTimestamp=Number(T));const A=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<A)&&this.refreshUUID()}catch{o.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=o.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const n=o.s("localStorage"),l=this.getStorageKey(),p=this.getStorageKey("uuid"),y=this.getStorageKey("uuidTimestamp"),x=this.anonId,b=this.anonIdTimestamp;if(n&&x)try{localStorage.setItem(p,x),Object.keys(this.eventData).length>=1&&localStorage.setItem(l,JSON.stringify(this.eventData)),b&&localStorage.setItem(y,b.toString())}catch{o.w("Unable to write to LocalStorage")}}processRequests(n){}postEvent(n,l,p,y){if(!o.e.EVENTS_URL)return;const x=Ot(o.e.EVENTS_URL);x.params.push(`access_token=${y||o.e.ACCESS_TOKEN||""}`);const b={event:this.type,created:new Date(n).toISOString()},T=l?Object.assign(b,l):b,A={url:Et(x),headers:{"Content-Type":"text/plain"},body:JSON.stringify([T])};this.pendingRequest=o.p(A,M=>{this.pendingRequest=null,p(M),this.saveEventData(),this.processRequests(y)})}queueRequest(n,l){this.queue.push(n),this.processRequests(l)}}class _r extends qt{constructor(n){super("metrics"),n&&(this.data=n)}postMetricsEvent(n){if(!o.e.EVENTS_URL||!n&&!o.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),o.v(this.anonId)||this.refreshUUID();const l=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:l},n)}processRequests(n){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:l,payload:p}=this.queue.shift();this.postEvent(l,p,()=>{},n)}}const yr=new class extends qt{constructor(f){super("appUserTurnstile"),this._customAccessToken=f}postTurnstileEvent(f,n){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(f)&&f.some(l=>o.h(l)||o.j(l))&&this.queueRequest(Date.now(),n)}processRequests(f){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const n=Pt(o.e.ACCESS_TOKEN),l=n?n.u:o.e.ACCESS_TOKEN;let p=l!==this.eventData.tokenU;o.v(this.anonId)||(this.refreshUUID(),p=!0);const y=this.queue.shift();if(this.eventData.lastSuccess){const x=new Date(this.eventData.lastSuccess),b=new Date(y),T=(y-this.eventData.lastSuccess)/864e5;p=p||T>=1||T<-1||x.getDate()!==b.getDate()}else p=!0;p?this.postEvent(y,{sdkIdentifier:"mapbox-gl-js",sdkVersion:k,skuId:jt,"enabled.telemetry":!1,userId:this.anonId},x=>{x||(this.eventData.lastSuccess=y,this.eventData.tokenU=l)},f):this.processRequests()}},hr=yr.postTurnstileEvent.bind(yr),Gr=new class extends qt{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(f,n,l,p){this.skuToken=n,this.errorCb=p,o.e.EVENTS_URL&&(l||o.e.ACCESS_TOKEN?this.queueRequest({id:f,timestamp:Date.now()},l):this.errorCb(new Error(Qe)))}processRequests(f){if(this.pendingRequest||this.queue.length===0)return;const{id:n,timestamp:l}=this.queue.shift();n&&this.success[n]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),o.v(this.anonId)||this.refreshUUID(),this.postEvent(l,{sdkIdentifier:"mapbox-gl-js",sdkVersion:k,skuId:jt,skuToken:this.skuToken,userId:this.anonId},p=>{p?this.errorCb(p):n&&(this.success[n]=!0)},f))}remove(){this.errorCb=null}},mi=Gr.postMapLoadEvent.bind(Gr),Oi=new class extends qt{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(f){let n=this.mapInstanceIdMap.get(f);return n||(n=o.u(),this.mapInstanceIdMap.set(f,n)),n}getEventId(f){const n=this.eventIdPerMapInstanceMap.get(f)||0;return this.eventIdPerMapInstanceMap.set(f,n+1),n}postStyleLoadEvent(f,n){const{map:l,style:p,importedStyles:y}=n;if(!o.e.EVENTS_URL||!f&&!o.e.ACCESS_TOKEN)return;const x=this.getMapInstanceId(l),b={mapInstanceId:x,eventId:this.getEventId(x),style:p};y.length&&(b.importedStyles=y),this.queueRequest({timestamp:Date.now(),payload:b},f)}processRequests(f){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:n,payload:l}=this.queue.shift();this.postEvent(n,l,()=>{},f)}},xn=Oi.postStyleLoadEvent.bind(Oi),zs=new _r({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),un=zs.postMetricsEvent.bind(zs),Nn=new _r({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),gi=Nn.postMetricsEvent.bind(Nn),Ks=new class extends qt{constructor(){super("gljs.performance")}postPerformanceEvent(f,n){o.e.EVENTS_URL&&(f||o.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:n},f)}processRequests(f){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:n,performanceData:l}=this.queue.shift(),p=function(y){const x=performance.getEntriesByType("resource"),b=performance.getEntriesByType("mark"),T=function(j){const H={};if(j){for(const G in j)if(G!=="other")for(const Q of j[G]){const J=`${G}ResolveRangeMin`,ae=`${G}ResolveRangeMax`,de=`${G}RequestCount`,ce=`${G}RequestCachedCount`;H[J]=Math.min(H[J]||1/0,Q.startTime),H[ae]=Math.max(H[ae]||-1/0,Q.responseEnd);const Se=ye=>{H[ye]===void 0&&(H[ye]=0),++H[ye]};Q.transferSize!==void 0&&Q.transferSize===0&&Se(ce),Se(de)}}return H}(function(j,H){const G={};if(j)for(const Q of j){const J=H(Q);G[J]===void 0&&(G[J]=[]),G[J].push(Q)}return G}(x,F)),A=window.devicePixelRatio,M=navigator.connection||navigator.mozConnection||navigator.webkitConnection,D=M?M.effectiveType:void 0,N={counters:[],metadata:[],attributes:[]},B=(j,H,G)=>{G!=null&&j.push({name:H,value:G.toString()})};for(const j in T)B(N.counters,j,T[j]);if(y.interactionRange[0]!==1/0&&y.interactionRange[1]!==-1/0&&(B(N.counters,"interactionRangeMin",y.interactionRange[0]),B(N.counters,"interactionRangeMax",y.interactionRange[1])),b)for(const j of Object.values(P)){const H=b.find(G=>G.name===j);H&&B(N.counters,j,H.startTime)}return B(N.counters,"visibilityHidden",y.visibilityHidden),B(N.attributes,"style",function(j){if(j)for(const H of j){const G=H.name.split("?")[0];if(o.i(G)){const Q=G.split("/").slice(-2);if(Q.length===2)return`mapbox://styles/${Q[0]}/${Q[1]}`}}}(x)),B(N.attributes,"terrainEnabled",y.terrainEnabled?"true":"false"),B(N.attributes,"fogEnabled",y.fogEnabled?"true":"false"),B(N.attributes,"projection",y.projection),B(N.attributes,"zoom",y.zoom),B(N.metadata,"devicePixelRatio",A),B(N.metadata,"connectionEffectiveType",D),B(N.metadata,"navigatorUserAgent",navigator.userAgent),B(N.metadata,"screenWidth",window.screen.width),B(N.metadata,"screenHeight",window.screen.height),B(N.metadata,"windowWidth",window.innerWidth),B(N.metadata,"windowHeight",window.innerHeight),B(N.metadata,"mapWidth",y.width/A),B(N.metadata,"mapHeight",y.height/A),B(N.metadata,"webglRenderer",y.renderer),B(N.metadata,"webglVendor",y.vendor),B(N.metadata,"sdkVersion",k),B(N.metadata,"sdkIdentifier","mapbox-gl-js"),N}(l);for(const y of p.metadata);for(const y of p.counters);for(const y of p.attributes);this.postEvent(n,p,()=>{},f)}},Un=Ks.postPerformanceEvent.bind(Ks),io=new class extends qt{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(f,n,l,p){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const y=Ot(o.e.API_URL+o.e.SESSION_PATH);y.params.push(`sku=${n||""}`),y.params.push(`access_token=${p||o.e.ACCESS_TOKEN||""}`);const x={url:Et(y),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(x,b=>{this.pendingRequest=null,l(b),this.saveEventData(),this.processRequests(p)})}getSessionAPI(f,n,l,p){this.skuToken=n,this.errorCb=p,o.e.SESSION_PATH&&o.e.API_URL&&(l||o.e.ACCESS_TOKEN?this.queueRequest({id:f,timestamp:Date.now()},l):this.errorCb(new Error(Qe)))}processRequests(f){if(this.pendingRequest||this.queue.length===0)return;const{id:n,timestamp:l}=this.queue.shift();n&&this.success[n]||this.getSession(l,this.skuToken,p=>{p?this.errorCb(p):n&&(this.success[n]=!0)},f)}remove(){this.errorCb=null}},so=io.getSessionAPI.bind(io),Ki=new Set;function Zi(f,n){n?Ki.add(f):Ki.delete(f)}class Zn{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(n,l){this._updatedSourceCaches[n]=l,this.setDirty()}discardSourceCacheUpdate(n){delete this._updatedSourceCaches[n]}updateLayer(n){const l=n.scope;this._updatedLayers[l]=this._updatedLayers[l]||new Set,this._updatedLayers[l].add(n.id),this.setDirty()}removeLayer(n){const l=n.scope;this._removedLayers[l]=this._removedLayers[l]||{},this._updatedLayers[l]=this._updatedLayers[l]||new Set,this._removedLayers[l][n.id]=n,this._updatedLayers[l].delete(n.id),this._updatedPaintProps.delete(n.fqid),this.setDirty()}getRemovedLayer(n){return this._removedLayers[n.scope]?this._removedLayers[n.scope][n.id]:null}discardLayerRemoval(n){this._removedLayers[n.scope]&&delete this._removedLayers[n.scope][n.id]}getLayerUpdatesByScope(){const n={};for(const l in this._updatedLayers)n[l]=n[l]||{},n[l].updatedIds=Array.from(this._updatedLayers[l].values());for(const l in this._removedLayers)n[l]=n[l]||{},n[l].removedIds=Object.keys(this._removedLayers[l]);return n}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(n){this._updatedPaintProps.add(n.fqid),this.setDirty()}getUpdatedImages(n){return this._updatedImages[n]?Array.from(this._updatedImages[n].values()):[]}updateImage(n,l){this._updatedImages[l]=this._updatedImages[l]||new Set,this._updatedImages[l].add(o.I.toString(n)),this.setDirty()}resetUpdatedImages(n){this._updatedImages[n]&&this._updatedImages[n].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function Is(f){const{userImage:n}=f;return!!(n&&n.render&&n.render())&&(f.data.replace(new Uint8Array(n.data.buffer)),!0)}class ua extends o.E{constructor(n){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=n,n!=="raster"&&o.r()&&(this.imageRasterizerDispatcher=new o.D(o.t(),this,"Image Rasterizer Worker",1))}addScope(n){this.loaded.set(n,!1),this.imageProviders.set(n,new Map),this.images.set(n,new Map),this.updatedImages.set(n,new Set),this.callbackDispatchedThisFrame.set(n,new Set),this.patterns.set(n,new Map),this.atlasImage.set(n,new o.q({width:1,height:1}))}removeScope(n){this.loaded.delete(n),this.imageProviders.delete(n),this.images.delete(n),this.updatedImages.delete(n),this.callbackDispatchedThisFrame.delete(n),this.patterns.delete(n),this.atlasImage.delete(n);const l=this.atlasTexture.get(n);l&&(l.destroy(),this.atlasTexture.delete(n))}addImageProvider(n,l){this.imageProviders.has(l)||this.imageProviders.set(l,new Map),this.imageProviders.get(l).set(n.id,n)}removeImageProvider(n,l){this.imageProviders.has(l)&&this.imageProviders.get(l).delete(n)}getPendingImageProviders(){const n=[];for(const l of this.imageProviders.values())for(const p of l.values())p.hasPendingRequests()&&n.push(p);return n}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.x),this._imageRasterizer}isLoaded(){for(const n of this.loaded.keys())if(!this.loaded.get(n))return!1;return!0}setLoaded(n,l){if(this.loaded.get(l)!==n&&(this.loaded.set(l,n),n)){for(const{ids:p,callback:y}of this.requestors)this._notify(p,l,y);this.requestors=[]}}hasImage(n,l){return!!this.getImage(n,l)}getImage(n,l){return this.images.get(l).get(n.toString())}addImage(n,l,p){this._validate(n,p)&&this.images.get(l).set(n.toString(),p)}_validate(n,l){let p=!0;return this._validateStretch(l.stretchX,l.data&&l.data.width)||(this.fire(new o.y(new Error(`Image "${n.name}" has invalid "stretchX" value`))),p=!1),this._validateStretch(l.stretchY,l.data&&l.data.height)||(this.fire(new o.y(new Error(`Image "${n.name}" has invalid "stretchY" value`))),p=!1),this._validateContent(l.content,l)||(this.fire(new o.y(new Error(`Image "${n.name}" has invalid "content" value`))),p=!1),p}_validateStretch(n,l){if(!n)return!0;let p=0;for(const y of n){if(y[0]<p||y[1]<y[0]||l<y[1])return!1;p=y[1]}return!0}_validateContent(n,l){return n?n.length!==4||!l.usvg&&(n[0]<0||l.data.width<n[0]||n[1]<0||l.data.height<n[1]||n[2]<0||l.data.width<n[2]||n[3]<0||l.data.height<n[3])?!1:!(n[2]<n[0]||n[3]<n[1]):!0}updateImage(n,l,p){const y=this.images.get(l).get(n.toString());p.version=y.version+1,this.images.get(l).set(n.toString(),p),this.updatedImages.get(l).add(n),this.removeFromImageRasterizerCache(n,l)}clearUpdatedImages(n){this.updatedImages.get(n).clear()}removeFromImageRasterizerCache(n,l){this.spriteFormat!=="raster"&&(o.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[n],scope:l}):this.imageRasterizer.removeImagesFromCacheByIds([n],l))}removeImage(n,l){const p=this.images.get(l),y=p.get(n.toString());p.delete(n.toString()),this.patterns.get(l).delete(n.toString()),this.removeFromImageRasterizerCache(n,l),y.userImage&&y.userImage.onRemove&&y.userImage.onRemove()}listImages(n){return Array.from(this.images.get(n).keys()).map(l=>o.I.from(l))}getImages(n,l,p){const y=[],x=[],b=this.imageProviders.get(l);for(const D of n){if(!D.iconsetId){y.push(D);continue}const N=b.get(D.iconsetId);N&&(this.getImage(D,l)?x.push(D):N.addPendingRequest(D))}if(y.length===0)return void this._notify(x,l,p);let T=!0;const A=!!this.loaded.get(l),M=this.images.get(l);if(!A)for(const D of y)M.has(D.toString())||(T=!1);A||T?this._notify(y,l,p):this.requestors.push({ids:y,scope:l,callback:p})}rasterizeImages(n,l){const p=new Map,{tasks:y,scope:x}=n;for(const[b,T]of y.entries()){const A=this.getImage(T.id,x);A&&p.set(b,{image:A,imageVariant:T})}this._rasterizeImages(x,p,l)}_rasterizeImages(n,l,p){if(o.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:l,scope:n},p);else{const y=new Map;for(const[x,{image:b,imageVariant:T}]of l.entries())y.set(x,this.imageRasterizer.rasterize(T,b,n,0));p(void 0,y)}}getUpdatedImages(n){return this.updatedImages.get(n)||new Set}_notify(n,l,p){const y=this.images.get(l),x=new Map;for(const b of n){if(!y.get(b.toString())){if(b.iconsetId)continue;this.fire(new o.z("styleimagemissing",{id:b.name}))}const T=y.get(b.toString());if(!T){o.w(`Image "${b.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:T.usvg?null:T.data.clone(),pixelRatio:T.pixelRatio,sdf:T.sdf,usvg:T.usvg,version:T.version,stretchX:T.stretchX,stretchY:T.stretchY,content:T.content,hasRenderCallback:!!(T.userImage&&T.userImage.render)};T.usvg&&Object.assign(A,{width:T.icon.usvg_tree.width,height:T.icon.usvg_tree.height}),x.set(o.I.toString(b),A)}p(null,x)}getPixelSize(n){const{width:l,height:p}=this.atlasImage.get(n);return{width:l,height:p}}getPattern(n,l,p){const y=n.toString(),x=this.patterns.get(l),b=x.get(y),T=this.getImage(n,l);if(!T)return null;if(b){if(b.position.version===T.version)return b.position;b.position.version=T.version}else{if(T.usvg&&!T.data){const A=this.getPatternInFlightId(y,l);if(this.patternsInFlight.has(A))return null;this.patternsInFlight.add(A);const M=new o.A(n).scaleSelf(o.o.devicePixelRatio),D=new Map([[M.toString(),{image:T,imageVariant:M}]]);return this._rasterizeImages(l,D,(N,B)=>this.storePatternImage(M,l,T,p,B)),null}this.storePattern(n,l,T)}return this._updatePatternAtlas(l,p),x.get(y).position}getPatternInFlightId(n,l){return o.B(n,l)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(n,l,p,y,x){const b=n.toString(),T=x?x.get(b):void 0;T&&(p.data=T,this.storePattern(n.id,l,p),this._updatePatternAtlas(l,y),this.patternsInFlight.delete(this.getPatternInFlightId(n.id.toString(),l)))}storePattern(n,l,p){const y={w:p.data.width+2*o.C,h:p.data.height+2*o.C,x:0,y:0},x=new o.F(y,p,o.C);this.patterns.get(l).set(n.toString(),{bin:y,position:x})}destroyAtlasTextures(){for(const n of this.atlasTexture.values())n&&n.destroy();this.atlasTexture.clear()}bind(n,l){const p=n.gl;let y=this.atlasTexture.get(l);y?this.dirty&&(y.update(this.atlasImage.get(l)),this.dirty=!1):(y=new o.T(n,this.atlasImage.get(l),p.RGBA8),this.atlasTexture.set(l,y)),y.bind(p.LINEAR,p.CLAMP_TO_EDGE)}_updatePatternAtlas(n,l){const p=this.patterns.get(n),y=Array.from(p.values()).map(({bin:M})=>M),{w:x,h:b}=o.G(y),T=this.atlasImage.get(n);T.resize({width:x||1,height:b||1});const A=this.images.get(n);for(const[M,{bin:D,position:N}]of p.entries()){let B=N.padding;const j=D.x+B,H=D.y+B,G=A.get(M).data,Q=G.width,J=G.height;B=B>1?B-1:B,o.q.copy(G,T,{x:0,y:0},{x:j,y:H},{width:Q,height:J},l),o.q.copy(G,T,{x:0,y:J-B},{x:j,y:H-B},{width:Q,height:B},l),o.q.copy(G,T,{x:0,y:0},{x:j,y:H+J},{width:Q,height:B},l),o.q.copy(G,T,{x:Q-B,y:0},{x:j-B,y:H},{width:B,height:J},l),o.q.copy(G,T,{x:0,y:0},{x:j+Q,y:H},{width:B,height:J},l),o.q.copy(G,T,{x:Q-B,y:J-B},{x:j-B,y:H-B},{width:B,height:B},l),o.q.copy(G,T,{x:0,y:J-B},{x:j+Q,y:H-B},{width:B,height:B},l),o.q.copy(G,T,{x:0,y:0},{x:j+Q,y:H+J},{width:B,height:B},l),o.q.copy(G,T,{x:Q-B,y:0},{x:j-B,y:H+J},{width:B,height:B},l)}this.dirty=!0}beginFrame(){for(const n of this.images.keys())this.callbackDispatchedThisFrame.set(n,new Set)}dispatchRenderCallbacks(n,l){const p=this.images.get(l);for(const y of n){if(this.callbackDispatchedThisFrame.get(l).has(y.toString()))continue;this.callbackDispatchedThisFrame.get(l).add(y.toString());const x=p.get(y.toString());Is(x)&&this.updateImage(y,l,x)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ai(f){const n=f.value,l=f.valueSpec,p=f.style,y=f.styleSpec,x=f.key,b=f.arrayElementValidator||En;if(!Array.isArray(n))return[new o.V(x,n,`array expected, ${o.K(n)} found`)];if(l.length&&n.length!==l.length)return[new o.V(x,n,`array length ${l.length} expected, length ${n.length} found`)];if(l["min-length"]&&n.length<l["min-length"])return[new o.V(x,n,`array length at least ${l["min-length"]} expected, length ${n.length} found`)];let T={type:l.value,values:l.values,minimum:l.minimum,maximum:l.maximum,function:void 0};y.$version<7&&(T.function=l.function),o.H(l.value)&&(T=l.value);let A=[];for(let M=0;M<n.length;M++)A=A.concat(b({array:n,arrayIndex:M,value:n[M],valueSpec:T,style:p,styleSpec:y,key:`${x}[${M}]`},!0));return A}function us(f){const n=f.key,l=f.value,p=f.valueSpec;if(!o.L(l))return[new o.V(n,l,`number expected, ${o.K(l)} found`)];if(l!=l)return[new o.V(n,l,"number expected, NaN found")];if("minimum"in p){let y=p.minimum;if(Array.isArray(p.minimum)&&(y=p.minimum[f.arrayIndex]),l<y)return[new o.V(n,l,`${l} is less than the minimum value ${y}`)]}if("maximum"in p){let y=p.maximum;if(Array.isArray(p.maximum)&&(y=p.maximum[f.arrayIndex]),l>y)return[new o.V(n,l,`${l} is greater than the maximum value ${y}`)]}return[]}function Fs(f){const n=f.key,l=f.value;if(!o.H(l))return[new o.V(n,l,`object expected, ${o.K(l)} found`)];const p=f.valueSpec,y=o.J(l.type);let x,b,T,A={};const M=y!=="categorical"&&l.property===void 0,D=!M,N=function(G){const Q=G.stops;return Array.isArray(Q)&&Array.isArray(Q[0])&&o.H(Q[0][0])}(l),B=zi({key:f.key,value:f.value,valueSpec:f.styleSpec.function,style:f.style,styleSpec:f.styleSpec,objectElementValidators:{stops:function(G){if(y==="identity")return[new o.V(G.key,G.value,'identity function may not have a "stops" property')];let Q=[];const J=G.value;return Q=Q.concat(Ai({key:G.key,value:J,valueSpec:G.valueSpec,style:G.style,styleSpec:G.styleSpec,arrayElementValidator:j})),Array.isArray(J)&&J.length===0&&Q.push(new o.V(G.key,J,"array must have at least one stop")),Q},default:function(G){return En({key:G.key,value:G.value,valueSpec:p,style:G.style,styleSpec:G.styleSpec})}}});return y==="identity"&&M&&B.push(new o.V(f.key,f.value,'missing required property "property"')),y==="identity"||l.stops||B.push(new o.V(f.key,f.value,'missing required property "stops"')),y==="exponential"&&p.expression&&!o.M(p)&&B.push(new o.V(f.key,f.value,"exponential functions not supported")),f.styleSpec.$version>=8&&(D&&!o.N(p)?B.push(new o.V(f.key,f.value,"property functions not supported")):M&&!o.O(p)&&B.push(new o.V(f.key,f.value,"zoom functions not supported"))),y!=="categorical"&&!N||l.property!==void 0||B.push(new o.V(f.key,f.value,'"property" property is required')),B;function j(G){let Q=[];const J=G.value,ae=G.key;if(!Array.isArray(J))return[new o.V(ae,J,`array expected, ${o.K(J)} found`)];if(J.length!==2)return[new o.V(ae,J,`array length 2 expected, length ${J.length} found`)];if(N){if(!o.H(J[0]))return[new o.V(ae,J,`object expected, ${o.K(J[0])} found`)];const de=J[0];if(de.zoom===void 0)return[new o.V(ae,J,"object stop key must have zoom")];if(de.value===void 0)return[new o.V(ae,J,"object stop key must have value")];const ce=o.J(de.zoom);if(typeof ce!="number")return[new o.V(ae,de.zoom,"stop zoom values must be numbers")];if(T&&T>ce)return[new o.V(ae,de.zoom,"stop zoom values must appear in ascending order")];ce!==T&&(T=ce,b=void 0,A={}),Q=Q.concat(zi({key:`${ae}[0]`,value:J[0],valueSpec:{zoom:{}},style:G.style,styleSpec:G.styleSpec,objectElementValidators:{zoom:us,value:H}}))}else Q=Q.concat(H({key:`${ae}[0]`,value:J[0],style:G.style,styleSpec:G.styleSpec},J));return o.Q(o.S(J[1]))?Q.concat([new o.V(`${ae}[1]`,J[1],"expressions are not allowed in function stops.")]):Q.concat(En({key:`${ae}[1]`,value:J[1],valueSpec:p,style:G.style,styleSpec:G.styleSpec}))}function H(G,Q){const J=o.K(G.value),ae=o.J(G.value),de=G.value!==null?G.value:Q;if(x){if(J!==x)return[new o.V(G.key,de,`${J} stop domain type must match previous stop domain type ${x}`)]}else x=J;if(J!=="number"&&J!=="string"&&J!=="boolean"&&typeof ae!="number"&&typeof ae!="string"&&typeof ae!="boolean")return[new o.V(G.key,de,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&y!=="categorical"){let ce=`number expected, ${J} found`;return o.N(p)&&y===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(G.key,de,ce)]}return y!=="categorical"||J!=="number"||typeof ae=="number"&&isFinite(ae)&&Math.floor(ae)===ae?y!=="categorical"&&J==="number"&&typeof ae=="number"&&typeof b=="number"&&b!==void 0&&ae<b?[new o.V(G.key,de,"stop domain values must appear in ascending order")]:(b=ae,y==="categorical"&&ae in A?[new o.V(G.key,de,"stop domain values must be unique")]:(A[ae]=!0,[])):[new o.V(G.key,de,`integer expected, found ${String(ae)}`)]}}function rs(f){const n=(f.expressionContext==="property"?o.W:o.U)(o.S(f.value),f.valueSpec);if(n.result==="error")return n.value.map(p=>new o.V(`${f.key}${p.key}`,f.value,p.message));const l=n.value.expression||n.value._styleExpression.expression;if(f.expressionContext==="property"&&f.propertyKey==="text-font"&&!l.outputDefined())return[new o.V(f.key,f.value,`Invalid data expression for "${f.propertyKey}". Output values must be contained as literals within the expression.`)];if(f.expressionContext==="property"&&f.propertyType==="layout"&&!o.Z(l))return[new o.V(f.key,f.value,'"feature-state" data expressions are not supported with layout properties.')];if(f.expressionContext==="filter")return Ho(l,f);if(f.expressionContext==="appearance")return ds(l,f);if(f.expressionContext&&f.expressionContext.indexOf("cluster")===0){if(!o.X(l,["zoom","feature-state"]))return[new o.V(f.key,f.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(f.expressionContext==="cluster-initial"&&!o.Y(l))return[new o.V(f.key,f.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ho(f,n){const l=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(const y of n.valueSpec.expression.parameters)l.delete(y);if(l.size===0)return[];const p=[];return f instanceof o._&&l.has(f.name)?[new o.V(n.key,n.value,`["${f.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(f.eachChild(y=>{p.push(...Ho(y,n))}),p)}function ds(f,n){const l=new Set;if(n.valueSpec&&n.valueSpec.expression)for(const y of n.valueSpec.expression.parameters)l.add(y);if(l.size===0)return[];const p=[];return f instanceof o._&&!l.has(f.name)?[new o.V(n.key,n.value,`["${f.name}"] is not an allowed parameter`)]:(f.eachChild(y=>{p.push(...ds(y,n))}),p)}function bs(f){const n=f.key,l=f.value,p=f.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(o.J(l))===-1&&y.push(new o.V(n,l,`expected one of [${p.values.join(", ")}], ${JSON.stringify(l)} found`)):Object.keys(p.values).indexOf(o.J(l))===-1&&y.push(new o.V(n,l,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(l)} found`)),y}function Wo(f){return o.a2(o.S(f.value))?rs(Object.assign({},f,{expressionContext:"filter",valueSpec:f.styleSpec[`filter_${f.layerType||"fill"}`]})):At(f)}function At(f){const n=f.value,l=f.key;if(!Array.isArray(n))return[new o.V(l,n,`array expected, ${o.K(n)} found`)];if(n.length<1)return[new o.V(l,n,"filter array must have at least 1 element")];const p=f.styleSpec;let y=bs({key:`${l}[0]`,value:n[0],valueSpec:p.filter_operator});const x=()=>{n.length>=2&&(o.a0(n[1])||y.push(new o.V(`${l}[1]`,n[1],`string expected, ${o.K(n[1])} found`)));for(let b=2;b<n.length;b++)o.J(n[1])==="$type"?y=y.concat(bs({key:`${l}[${b}]`,value:n[b],valueSpec:p.geometry_type})):o.a0(n[b])||o.L(n[b])||o.$(n[b])||y.push(new o.V(`${l}[${b}]`,n[b],`string, number, or boolean expected, ${o.K(n[b])} found.`))};switch(o.J(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&o.J(n[1])==="$type"&&y.push(new o.V(l,n,`"$type" cannot be use with operator "${n[0]}"`)),n.length!==3&&y.push(new o.V(l,n,`filter array for operator "${n[0]}" must have 3 elements`)),x();break;case"==":case"!=":n.length!==3&&y.push(new o.V(l,n,`filter array for operator "${n[0]}" must have 3 elements`)),x();break;case"in":case"!in":x();break;case"any":case"all":case"none":for(let b=1;b<n.length;b++)y=y.concat(At({key:`${l}[${b}]`,value:n[b],style:f.style,styleSpec:f.styleSpec}));break;case"has":case"!has":n.length!==2?y.push(new o.V(l,n,`filter array for "${n[0]}" operator must have 2 elements`)):o.a0(n[1])||y.push(new o.V(`${l}[1]`,n[1],`string expected, ${o.K(n[1])} found`))}return y}function sr(f,n){const l=f.key,p=f.style,y=f.layer,x=f.styleSpec,b=f.value,T=f.objectKey,A=x[`${n}_${f.layerType}`];if(!A)return[];const M=T.match(/^(.*)-use-theme$/);if(M&&A[M[1]])return o.Q(o.S(b))?[].concat(En({key:l,value:b,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:p,styleSpec:x,expressionContext:"property",propertyType:n,propertyKey:T})):En({key:l,value:b,valueSpec:{type:"string"},style:p,styleSpec:x});const D=T.match(/^(.*)-transition$/);if(n==="paint"&&D&&A[D[1]]&&A[D[1]].transition)return En({key:l,value:b,valueSpec:x.transition,style:p,styleSpec:x});const N=f.valueSpec||A[T];if(!N)return[new o.a3(l,b,`unknown property "${T}"`)];let B;if(o.a0(b)&&o.N(N)&&!N.tokens&&(B=/^{([^}]+)}$/.exec(b))){const H=`\`{ "type": "identity", "property": ${B?JSON.stringify(B[1]):'"_"'} }\``;return[new o.V(l,b,`"${T}" does not support interpolation syntax
|
||
Use an identity property function instead: ${H}.`)]}const j=[];if(f.layerType==="symbol")T!=="text-field"||!p||p.glyphs||p.imports||j.push(new o.V(l,b,'use of "text-field" requires a style "glyphs" property')),T==="text-font"&&o.a4(o.S(b))&&o.J(b.type)==="identity"&&j.push(new o.V(l,b,'"text-font" does not support identity functions'));else if(f.layerType==="model"&&n==="paint"&&y&&y.layout&&y.layout.hasOwnProperty("model-id")&&o.N(N)&&(o.a5(N)||o.O(N))){const H=o.W(o.S(b),N).value,G="expression"in H&&H.expression||"_styleExpression"in H&&H._styleExpression&&H._styleExpression.expression;G&&!o.X(G,["measure-light"])&&(T==="model-emissive-strength"&&o.Y(G)&&o.Z(G)||j.push(new o.V(l,b,`${T} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return j.concat(En({key:f.key,value:b,valueSpec:N,style:p,styleSpec:x,expressionContext:"property",propertyType:n,propertyKey:T}))}function Lr(f){return sr(f,"paint")}function Zr(f){return sr(f,"layout")}function tn(f){let n=[];const l=f.value,p=f.key,y=f.style,x=f.styleSpec;if(!o.H(l))return[new o.V(p,l,"object expected")];l.type||l.ref||n.push(new o.V(p,l,'either "type" or "ref" is required'));let b=o.J(l.type);const T=o.J(l.ref);if(l.id){const A=o.J(l.id);for(let M=0;M<f.arrayIndex;M++){const D=y.layers[M];o.J(D.id)===A&&n.push(new o.V(p,l.id,`duplicate layer id "${A}", previously used at line ${D.id.__line__}`))}}if("ref"in l){let A;["type","source","source-layer","filter","layout"].forEach(M=>{M in l&&n.push(new o.V(p,l[M],`"${M}" is prohibited for ref layers`))}),y.layers.forEach(M=>{o.J(M.id)===T&&(A=M)}),A?A.ref?n.push(new o.V(p,l.ref,"ref cannot reference another ref layer")):b=o.J(A.type):typeof T=="string"&&n.push(new o.V(p,l.ref,`ref layer "${T}" not found`))}else if(b!=="background"&&b!=="sky"&&b!=="slot")if(l.source)if(o.a0(l.source)){const A=y.sources&&y.sources[l.source],M=A&&o.J(A.type);A?M==="vector"&&b==="raster"?n.push(new o.V(p,l.source,`layer "${l.id}" requires a raster source`)):M==="raster"&&b!=="raster"?n.push(new o.V(p,l.source,`layer "${l.id}" requires a vector source`)):M!=="vector"||l["source-layer"]?M==="raster-dem"&&b!=="hillshade"?n.push(new o.V(p,l.source,"raster-dem source can only be used with layer type 'hillshade'.")):M!=="raster-array"||["raster","raster-particle"].includes(b)?b==="line"&&l.paint&&(l.paint["line-gradient"]||l.paint["line-trim-offset"])&&M==="geojson"&&!A.lineMetrics?n.push(new o.V(p,l,`layer "${l.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):b==="raster-particle"&&M!=="raster-array"&&n.push(new o.V(p,l.source,`layer "${l.id}" requires a 'raster-array' source.`)):n.push(new o.V(p,l.source,"raster-array source can only be used with layer type 'raster'.")):n.push(new o.V(p,l,`layer "${l.id}" must specify a "source-layer"`)):n.push(new o.V(p,l.source,`source "${l.source}" not found`))}else n.push(new o.V(`${p}.source`,l.source,'"source" must be a string'));else n.push(new o.V(p,l,'missing required property "source"'));return n=n.concat(zi({key:p,value:l,valueSpec:x.layer,style:f.style,styleSpec:f.styleSpec,objectElementValidators:{"*":()=>[],type:()=>En({key:`${p}.type`,value:l.type,valueSpec:x.layer.type,style:f.style,styleSpec:f.styleSpec,object:l,objectKey:"type"}),filter:A=>Wo(Object.assign({layerType:b},A)),layout:A=>zi({layer:l,key:A.key,value:A.value,valueSpec:{},style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":M=>Zr(Object.assign({layerType:b},M))}}),paint:A=>zi({layer:l,key:A.key,value:A.value,valueSpec:{},style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":M=>Lr(Object.assign({layerType:b,layer:l},M))}}),appearances(A){const M=Ai({key:A.key,value:A.value,valueSpec:A.valueSpec,style:A.style,styleSpec:A.styleSpec,arrayElementValidator:B=>function(j){const{key:H,layer:G,layerType:Q}=j,J=o.J(j.value),ae=o.J(J.name),de=o.J(J.condition),ce=zi({key:H,value:J,valueSpec:j.styleSpec.appearance,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{condition:Se=>function(ye){const we=[];return we.push(...rs({key:ye.key,value:ye.object.condition,valueSpec:o.a6.appearance.condition,expressionContext:"appearance"})),we}(Object.assign({layer:G,layerType:Q},Se)),properties:Se=>function(ye){const we=[],{styleSpec:_e,layer:pe,layerType:Te}=ye,De=_e[`paint_${Te}`],Me=_e[`layout_${Te}`],Ge=ye.object[ye.objectKey];for(const He in Ge){const et=He in De?"paint":He in Me?"layout":void 0;if(!et){we.push(new o.V(ye.key,He,`unknown property "${He}" for layer type "${Te}"`));continue}const mt=Object.assign({},ye,{key:`${ye.key}.${He}`,object:Ge,objectKey:He,layer:pe,layerType:Te,value:Ge[He],valueSpec:et==="paint"?De[He]:Me[He]});we.push(...sr(mt,et))}return we}(Object.assign({layer:G,layerType:Q},Se))}});return ae!=="hidden"&&de===void 0&&ce.push(new o.V(j.key,"name",'Appearance with name different than "hidden" must have a condition')),ce}(Object.assign({layerType:b,layer:l},B))}),D=Array.isArray(A.value)?A.value:[],N=new Set;return D.forEach((B,j)=>{const H=o.J(B.name);if(H)if(N.has(H)){const G=o.J(l.id);M.push(new o.V(A.key,H,`Duplicated appearance name "${H}" for layer "${G}"`))}else N.add(H)}),M}}})),n}function Wr({key:f,value:n}){return o.a0(n)?[]:[new o.V(f,n,`string expected, ${o.K(n)} found`)]}const On={promoteId:function f({key:n,value:l}){if(o.a0(l))return Wr({key:n,value:l});if(Array.isArray(l)){const y=[],x=o.S(l),b=o.U(x);return b.result==="error"&&b.value.forEach(T=>{y.push(new o.V(`${n}${T.key}`,null,`${T.message}`))}),o.X(b.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"])||y.push(new o.V(`${n}`,null,"promoteId expression should be only feature dependent")),y}if(!o.H(l))return[new o.V(n,l,`string, expression or object expected, "${o.K(l)}" found`)];const p=[];for(const y in l)p.push(...f({key:`${n}.${y}`,value:l[y]}));return p}};function Zs(f){const n=f.value,l=f.key,p=f.styleSpec,y=f.style;if(!o.H(n))return[new o.V(l,n,`object expected, ${o.K(n)} found`)];if(!("type"in n))return[new o.V(l,n,'"type" is required')];const x=o.J(n.type);let b=[];switch(["vector","raster","raster-dem","raster-array"].includes(x)&&("url"in n||"tiles"in n||b.push(new o.a3(l,n,'Either "url" or "tiles" is required.'))),x){case"vector":case"raster":case"raster-dem":case"raster-array":return b=b.concat(zi({key:l,value:n,valueSpec:p[`source_${x.replace("-","_")}`],style:f.style,styleSpec:p,objectElementValidators:On})),b;case"geojson":if(b=zi({key:l,value:n,valueSpec:p.source_geojson,style:y,styleSpec:p,objectElementValidators:On}),"cluster"in n&&"clusterProperties"in n){if(!o.H(n.clusterProperties))return[new o.V(`${l}.clusterProperties`,n,`object expected, ${o.K(n)} found`)];for(const T in n.clusterProperties){const A=n.clusterProperties[T];if(!Array.isArray(A))return[new o.V(`${l}.clusterProperties.${T}`,A,"array expected")];const[M,D]=A,N=typeof M=="string"?[M,["accumulated"],["get",T]]:M;b.push(...rs({key:`${l}.${T}.map`,value:D,expressionContext:"cluster-map"})),b.push(...rs({key:`${l}.${T}.reduce`,value:N,expressionContext:"cluster-reduce"}))}}return b;case"video":return zi({key:l,value:n,valueSpec:p.source_video,style:y,styleSpec:p});case"image":return zi({key:l,value:n,valueSpec:p.source_image,style:y,styleSpec:p});case"canvas":return[new o.V(l,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return bs({key:`${l}.type`,value:n.type,valueSpec:{values:qo(p)}})}}function qo(f){return f.source.reduce((n,l)=>{const p=f[l];return p.type.type==="enum"&&(n=n.concat(Object.keys(p.type.values||{}))),n},[])}function yo(f){const n=f.value,l=f.styleSpec,p=l.light,y=f.style;if(n===void 0)return[];if(!o.H(n))return[new o.V("light",n,`object expected, ${o.K(n)} found`)];let x=[];for(const b in n){const T=b.match(/^(.*)-transition$/),A=b.match(/^(.*)-use-theme$/);x=x.concat(A&&p[A[1]]?En({key:b,value:n[b],valueSpec:{type:"string"},style:y,styleSpec:l}):T&&p[T[1]]&&p[T[1]].transition?En({key:b,value:n[b],valueSpec:l.transition,style:y,styleSpec:l}):p[b]?En({key:b,value:n[b],valueSpec:p[b],style:y,styleSpec:l}):[new o.V(b,n[b],`unknown property "${b}"`)])}return x}function Do(f){const n=f.value;if(!n)return[];const l=f.key;if(!o.H(n))return[new o.V(l,n,`object expected, ${o.K(n)} found`)];let p=[];const y=f.styleSpec,x=y["light-3d"],b=f.style,T=f.style.lights;for(const D of["type","id"])if(!(D in n))return p=p.concat([new o.V(l,n,`missing property "${D}"`)]),p;if(!o.a0(n.type))return p=p.concat([new o.V(`${l}.type`,n.type,"string expected")]),p;if(T)for(let D=0;D<f.arrayIndex;D++){const N=o.J(n.type),B=T[D];o.J(B.type)===N&&p.push(new o.V(l,n.id,`duplicate light type "${n.type}", previously defined at line ${B.id.__line__}`))}const A=`properties_light_${n.type}`;if(!(A in y))return p=p.concat([new o.V(`${l}.type`,n,`Invalid light type ${n.type}`)]),p;const M=y[A];for(const D in n)if(D==="properties"){const N=n[D];if(!o.H(N))return p=p.concat([new o.V("properties",N,`object expected, ${o.K(N)} found`)]),p;for(const B in N){const j=B.match(/^(.*)-transition$/),H=B.match(/^(.*)-use-theme$/);p=p.concat(H&&M[H[1]]?En({key:D,value:N[B],valueSpec:{type:"string"},style:b,styleSpec:y}):j&&M[j[1]]&&M[j[1]].transition?En({key:D,value:n[D],valueSpec:y.transition,style:b,styleSpec:y}):M[B]?En({key:B,value:N[B],valueSpec:M[B],style:b,styleSpec:y}):[new o.a3(f.key,N[B],`unknown property "${B}"`)])}}else p=p.concat(x[D]?En({key:D,value:n[D],valueSpec:x[D],style:b,styleSpec:y}):[new o.a3(D,n[D],`unknown property "${D}"`)]);return p}function oo(f){const n=f.value,l=f.key,p=f.style,y=f.styleSpec,x=y.terrain;if(n==null)return[];if(!o.H(n))return[new o.V("terrain",n,`object expected, ${o.K(n)} found`)];let b=[];for(const T in n){const A=T.match(/^(.*)-transition$/),M=T.match(/^(.*)-use-theme$/);b=b.concat(M&&x[M[1]]?En({key:T,value:n[T],valueSpec:{type:"string"},style:p,styleSpec:y}):A&&x[A[1]]&&x[A[1]].transition?En({key:T,value:n[T],valueSpec:y.transition,style:p,styleSpec:y}):x[T]?En({key:T,value:n[T],valueSpec:x[T],style:p,styleSpec:y}):[new o.a3(T,n[T],`unknown property "${T}"`)])}if(n.source)if(o.a0(n.source)){const T=p.sources&&p.sources[n.source],A=T&&o.J(T.type);T?A!=="raster-dem"&&b.push(new o.V(`${l}.source`,n.source,`terrain cannot be used with a source of type ${A}, it only be used with a "raster-dem" source type`)):b.push(new o.V(`${l}.source`,n.source,`source "${n.source}" not found`))}else b.push(new o.V(`${l}.source`,n.source,"source must be a string"));else b.push(new o.V(l,n,'terrain is missing required property "source"'));return b}function vo(f){const n=f.value,l=f.style,p=f.styleSpec,y=p.fog;if(n===void 0)return[];if(!o.H(n))return[new o.V("fog",n,`object expected, ${o.K(n)} found`)];let x=[];for(const b in n){const T=b.match(/^(.*)-transition$/),A=b.match(/^(.*)-use-theme$/);x=x.concat(A&&y[A[1]]?En({key:b,value:n[b],valueSpec:{type:"string"},style:l,styleSpec:p}):T&&y[T[1]]&&y[T[1]].transition?En({key:b,value:n[b],valueSpec:p.transition,style:l,styleSpec:p}):y[b]?En({key:b,value:n[b],valueSpec:y[b],style:l,styleSpec:p}):[new o.a3(b,n[b],`unknown property "${b}"`)])}return x}const Lo={"*":()=>[],array:Ai,boolean:function(f){const n=f.value,l=f.key;return o.$(n)?[]:[new o.V(l,n,`boolean expected, ${o.K(n)} found`)]},number:us,color:function({key:f,value:n}){return o.a0(n)?o.a1.parseCSSColor(n)===null?[new o.V(f,n,`color expected, "${n}" found`)]:[]:[new o.V(f,n,`color expected, ${o.K(n)} found`)]},enum:bs,filter:Wo,function:Fs,layer:tn,object:zi,source:Zs,model:o.a7,light:yo,"light-3d":Do,terrain:oo,fog:vo,string:Wr,formatted:function(f){return Wr(f).length===0?[]:rs(f)},resolvedImage:function(f){return Wr(f).length===0?[]:rs(f)},projection:function(f){const n=f.value,l=f.styleSpec,p=l.projection,y=f.style;if(o.H(n)){let x=[];for(const b in n)x=x.concat(En({key:b,value:n[b],valueSpec:p[b],style:y,styleSpec:l}));return x}return o.a0(n)?[]:[new o.V("projection",n,`object or string expected, ${o.K(n)} found`)]},import:function(f){const n=f.key,{value:l,styleSpec:p}=f;if(!o.H(l))return[new o.V(n,l,"import must be an object")];const{data:y,...x}=l;Object.defineProperty(x,"__line__",{value:l.__line__,enumerable:!1});let b=zi(Object.assign({},f,{value:x,valueSpec:p.import}));return o.J(x.id)===""&&b.push(new o.V(`${f.key}.id`,x,"import id can't be an empty string")),y&&(b=b.concat(Wn(y,p,{key:`${f.key}.data`}))),b},iconset:function(f){const n=f.value,l=f.key,p=f.styleSpec,y=f.style;if(!o.H(n))return[new o.V(l,n,"object expected")];if(!n.type)return[new o.V(l,n,'"type" is required')];const x=o.J(n.type);let b=[];if(b=b.concat(zi({key:l,value:n,valueSpec:p[`iconset_${x}`],style:y,styleSpec:p})),function(T,A){return!(T!=="source"||!A.source)}(x,n)){const T=y.sources&&y.sources[n.source],A=T&&o.J(T.type);T?A!=="raster-array"&&b.push(new o.V(l,n.source,`iconset cannot be used with a source of type ${String(A)}, it only be used with a "raster-array" source type`)):b.push(new o.V(l,n.source,`source "${n.source}" not found`))}return b}};function En(f,n=!1){const l=f.value,p=f.valueSpec,y=f.styleSpec;if(p.expression){if(o.a4(o.J(l)))return Fs(f);if(o.Q(o.S(l)))return rs(f)}if(p.type&&Lo[p.type]){const x=Lo[p.type](f);return n===!0&&x.length>0&&Array.isArray(f.value)?rs(f):x}return zi(Object.assign({},f,{valueSpec:p.type?y[p.type]:p}))}function zi(f){const n=f.key,l=f.value,p=f.valueSpec||{},y=f.objectElementValidators||{},x=f.style,b=f.styleSpec;if(!o.H(l))return[new o.V(n,l,`object expected, ${o.K(l)} found`)];let T=[];for(const A in l){const M=A.split(".")[0];let D;y[M]?D=y[M]:p[M]?D=En:y["*"]?D=y["*"]:p["*"]&&(D=En),D?T=T.concat(D({key:(n&&`${n}.`)+A,value:l[A],valueSpec:p[M]||p["*"],style:x,styleSpec:b,object:l,objectKey:A},l)):T.push(new o.a3(n,l[A],`unknown property "${A}"`))}for(const A in p){if(y[A])continue;const M=p[A];M.required&&M.default===void 0&&l[A]===void 0&&T.push(new o.V(n,l,`missing required property "${A}"`))}return T}function on({key:f,value:n}){const l=Wr({key:f,value:n});if(l.length)return l;const p=n;return p.indexOf("{fontstack}")===-1&&l.push(new o.V(f,n,'"glyphs" url must include a "{fontstack}" token')),p.indexOf("{range}")===-1&&l.push(new o.V(f,n,'"glyphs" url must include a "{range}" token')),l}function Wn(f,n=o.a6,l={}){return zi({key:l.key||"",value:f,valueSpec:Object.assign(n.$root,{"*":{type:"*"}}),styleSpec:n,style:f,objectElementValidators:{glyphs:on}})}function qn(f,n=o.a6){return ne(Wn(f,n))}const Bs=f=>ne(Zs(f)),it=f=>ne(yo(f)),hs=f=>ne(Do(f)),Xs=f=>ne(oo(f)),fs=f=>ne(vo(f)),zr=f=>ne(function(n){const l=n.value,p=n.style,y=n.styleSpec,x=y.snow;if(l===void 0)return[];if(!o.H(l))return[new o.V("snow",l,`object expected, ${o.K(l)} found`)];let b=[];for(const T in l){const A=T.match(/^(.*)-transition$/);b=b.concat(A&&x[A[1]]&&x[A[1]].transition?En({key:T,value:l[T],valueSpec:y.transition,style:p,styleSpec:y}):x[T]?En({key:T,value:l[T],valueSpec:x[T],style:p,styleSpec:y}):[new o.a3(T,l[T],`unknown property "${T}"`)])}return b}(f)),Fr=f=>ne(function(n){const l=n.value,p=n.style,y=n.styleSpec,x=y.rain;if(l===void 0)return[];if(!o.H(l))return[new o.V("rain",l,`object expected, ${o.K(l)} found`)];let b=[];for(const T in l){const A=T.match(/^(.*)-transition$/);b=b.concat(A&&x[A[1]]&&x[A[1]].transition?En({key:T,value:l[T],valueSpec:y.transition,style:p,styleSpec:y}):x[T]?En({key:T,value:l[T],valueSpec:x[T],style:p,styleSpec:y}):[new o.a3(T,l[T],`unknown property "${T}"`)])}return b}(f)),Bi=f=>ne(tn(f)),Pi=f=>ne(Wo(f)),Ss=f=>ne(Lr(f)),Fe=f=>ne(Zr(f)),K=f=>ne(o.a7(f));function ne(f){return f.slice().sort((n,l)=>n.line&&l.line?n.line-l.line:0)}function fe(f,n){let l=!1;if(n&&n.length)for(const p of n)p instanceof o.a3?o.w(p.message):(f.fire(new o.y(new Error(p.message))),l=!0);return l}const Ae=o.a6.light;let Ee;class Re extends o.E{constructor(n,l="flat"){super(),this._transitionable=new o.a8(Ee||(Ee=new o.a9({anchor:new o.aa(Ae.anchor),position:new o.ab(Ae.position),color:new o.aa(Ae.color),intensity:new o.aa(Ae.intensity)}))),this.setLight(n,l),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(n,l,p={}){this._validate(it,n,p)||(this._transitionable.setTransitionOrValue(n),this.id=l)}updateTransitions(n){this._transitioning=this._transitionable.transitioned(n,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(n){this.properties=this._transitioning.possiblyEvaluate(n)}_validate(n,l,p){return(!p||p.validate!==!1)&&fe(this,n.call(qn,Object.assign({value:l,style:{glyphs:!0,sprite:!0},styleSpec:o.a6})))}}const $e=o.a6.terrain;let Oe=class extends o.E{constructor(f,n,l,p,y){super(),this.scope=l,this._transitionable=new o.a8(new o.a9({source:new o.aa($e.source),exaggeration:new o.aa($e.exaggeration)}),l,p),this._transitionable.setTransitionOrValue(f,p),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=n,this.worldview=y}get(){return this._transitionable.serialize()}set(f,n){this._transitionable.setTransitionOrValue(f,n)}updateTransitions(f){this._transitioning=this._transitionable.transitioned(f,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(f){this.properties=this._transitioning.possiblyEvaluate(f)}getExaggeration(f){return this._transitioning.possiblyEvaluate(new o.ac(f,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const f=this._transitionable._values.exaggeration;if(!f)return null;const n=f.value.expression;if(!n)return null;let l=-1,p=-1,y=1;for(const x of n.zoomStops)y=n.evaluate(new o.ac(x,{worldview:this.worldview})),y>.01?(l=x,p=-1):p=x;return y<.01&&l>0&&p>l?[l,p]:null}isZoomDependent(){const f=this._transitionable._values.exaggeration;return f!=null&&f.value!=null&&f.value.expression!=null&&f.value.expression instanceof o.ad}};const Ue=45,pt=65,tt=.05;function Vt(f,n,l,p){const y=o.ah(Ue,pt,l),[x,b]=rr(f,p);let T=1-Math.min(1,Math.exp((n-x)/(b-x)*-6));return T*=T*T,T=Math.min(1,1.00747*T),T*y*f.alpha}function rr(f,n){const l=.5/Math.tan(.5*n);return[f.range[0]+l,f.range[1]+l]}function Ft(f,n,l,p,y){const x=o.af([],[n,l,p],y.mercatorFogMatrix);return Vt(f,o.ag(x),y.pitch,y._fov)}function kr(f,n,l,p,y,x,b){const T=[[l,p,0],[y,p,0],[y,x,0],[l,x,0]];let A=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(const D of T){const N=o.af([],D,n),B=o.ag(N);A=Math.min(A,B),M=Math.max(M,B)}return[Vt(f,A,b.pitch,b._fov),Vt(f,M,b.pitch,b._fov)]}const Tr=o.a6.fog;class br extends o.E{constructor(n,l,p,y){super();const x=new o.a9({range:new o.aa(Tr.range),color:new o.aa(Tr.color),"color-use-theme":new o.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new o.aa(Tr["high-color"]),"high-color-use-theme":new o.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new o.aa(Tr["space-color"]),"space-color-use-theme":new o.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new o.aa(Tr["horizon-blend"]),"star-intensity":new o.aa(Tr["star-intensity"]),"vertical-range":new o.aa(Tr["vertical-range"])});this._transitionable=new o.a8(x,p,new Map(y)),this.set(n,y),this._transitioning=this._transitionable.untransitioned(),this._transform=l,this.properties=new o.ai(x),this.scope=p}get state(){const n=this._transform,l=n.projection.name==="globe",p=o.aj(n.zoom),y=this.properties.get("range"),x=[.5,3];return{range:l?[o.ak(x[0],y[0],p),o.ak(x[1],y[1],p)]:y,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(n,l,p={}){if(this._validate(fs,n,p))return;const y=Object.assign({},n);for(const x of Object.keys(Tr))y[x]===void 0&&(y[x]=Tr[x].default);this._options=y,this._transitionable.setTransitionOrValue(this._options,l)}getOpacity(n){if(!this._transform.projection.supportsFog)return 0;const l=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:o.ah(Ue,pt,n))*l.a}getOpacityAtLatLng(n,l){return this._transform.projection.supportsFog?function(p,y,x){const b=o.ae.fromLngLat(y),T=x.elevation?x.elevation.getAtPointOrZero(b):0;return Ft(p,b.x,b.y,T,x)}(this.state,n,l):0}getOpacityForTile(n){if(!this._transform.projection.supportsFog)return[1,1];const l=this._transform.calculateFogTileMatrix(n.toUnwrapped());return kr(this.state,l,0,0,o.al,o.al,this._transform)}getOpacityForBounds(n,l,p,y,x){return this._transform.projection.supportsFog?kr(this.state,n,l,p,y,x,this._transform):[1,1]}getFovAdjustedRange(n){return this._transform.projection.supportsFog?rr(this.state,n):[0,1]}isVisibleOnFrustum(n){if(!this._transform.projection.supportsFog)return!1;const l=[4,5,6,7];for(const p of l){const y=n.points[p];let x;if(y[2]>=0)x=y;else{const b=n.points[p-4];x=o.am(b,y,b[2]/(b[2]-y[2]))}if(Ft(this.state,x[0],x[1],0,this._transform)>=tt)return!0}return!1}updateConfig(n){this._transitionable.setTransitionOrValue(this._options,new Map(n))}updateTransitions(n){this._transitioning=this._transitionable.transitioned(n,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(n){this.properties=this._transitioning.possiblyEvaluate(n)}_validate(n,l,p){return(!p||p.validate!==!1)&&fe(this,n.call(qn,Object.assign({value:l,style:{glyphs:!0,sprite:!0},styleSpec:o.a6})))}}let Yr,di,Mi,_i,Fi=class extends o.E{constructor(f,n,l,p){super();const y=Yr||(Yr=new o.a9({density:new o.aa(o.a6.snow.density),intensity:new o.aa(o.a6.snow.intensity),color:new o.aa(o.a6.snow.color),opacity:new o.aa(o.a6.snow.opacity),vignette:new o.aa(o.a6.snow.vignette),"vignette-color":new o.aa(o.a6.snow["vignette-color"]),"center-thinning":new o.aa(o.a6.snow["center-thinning"]),direction:new o.aa(o.a6.snow.direction),"flake-size":new o.aa(o.a6.snow["flake-size"])}));this._transitionable=new o.a8(y,l,new Map(p)),this.set(f,p),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ai(y),this.scope=l}get state(){const f=this.properties.get("opacity"),n=this.properties.get("color"),l=this.properties.get("direction"),p=o.an(l[0]),y=-Math.max(o.an(l[1]),.01),x=[Math.cos(p)*Math.cos(y),Math.sin(p)*Math.cos(y),Math.sin(y)],b=this.properties.get("vignette"),T=this.properties.get("vignette-color");return T.a=b,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.ao(n.r,n.g,n.b,n.a*f),direction:x,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:T}}get(){return this._transitionable.serialize()}set(f,n,l={}){if(this._validate(zr,f,l))return;const p=Object.assign({},f),y=o.a6.snow;for(const x of Object.keys(y))p[x]===void 0&&(p[x]=y[x].default);this._options=p,this._transitionable.setTransitionOrValue(this._options,n)}updateConfig(f){this._transitionable.setTransitionOrValue(this._options,new Map(f))}updateTransitions(f){this._transitioning=this._transitionable.transitioned(f,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(f){this.properties=this._transitioning.possiblyEvaluate(f)}_validate(f,n,l){return(!l||l.validate!==!1)&&fe(this,f.call(qn,Object.assign({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a6})))}},oi=class extends o.E{constructor(f,n,l,p){super();const y=di||(di=new o.a9({density:new o.aa(o.a6.rain.density),intensity:new o.aa(o.a6.rain.intensity),color:new o.aa(o.a6.rain.color),opacity:new o.aa(o.a6.rain.opacity),vignette:new o.aa(o.a6.rain.vignette),"vignette-color":new o.aa(o.a6.rain["vignette-color"]),"center-thinning":new o.aa(o.a6.rain["center-thinning"]),direction:new o.aa(o.a6.rain.direction),"droplet-size":new o.aa(o.a6.rain["droplet-size"]),"distortion-strength":new o.aa(o.a6.rain["distortion-strength"])}));this._transitionable=new o.a8(y,l,new Map(p)),this.set(f,p),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ai(y),this.scope=l}get state(){const f=this.properties.get("opacity"),n=this.properties.get("color"),l=this.properties.get("direction"),p=o.an(l[0]),y=-Math.max(o.an(l[1]),.01),x=[Math.cos(p)*Math.cos(y),Math.sin(p)*Math.cos(y),Math.sin(y)],b=this.properties.get("vignette-color");return b.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.ao(n.r,n.g,n.b,n.a*f),direction:x,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:b}}get(){return this._transitionable.serialize()}set(f,n,l={}){if(this._validate(Fr,f,l))return;const p=Object.assign({},f),y=o.a6.rain;for(const x of Object.keys(y))p[x]===void 0&&(p[x]=y[x].default);this._options=p,this._transitionable.setTransitionOrValue(this._options,n)}updateConfig(f){this._transitionable.setTransitionOrValue(this._options,new Map(f))}updateTransitions(f){this._transitioning=this._transitionable.transitioned(f,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(f){this.properties=this._transitioning.possiblyEvaluate(f)}_validate(f,n,l){return(!l||l.validate!==!1)&&fe(this,f.call(qn,Object.assign({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a6})))}};class rn extends o.E{constructor(n,l,p,y){super(),this.scope=p,this._options=n,this.properties=new o.ai(l),this._transitionable=new o.a8(l,p,new Map(y)),this._transitionable.setTransitionOrValue(n.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(n){this._transitionable.setTransitionOrValue(this._options.properties,new Map(n))}updateTransitions(n){this._transitioning=this._transitionable.transitioned(n,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(n){this.properties=this._transitioning.possiblyEvaluate(n)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(n,l){this._options=n,this._transitionable.setTransitionOrValue(n.properties,l)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ai{constructor(n,l,p){this.screenBounds=n,this.cameraPoint=p.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=l,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,p)}static createFromScreenPoints(n,l){let p,y;if(n instanceof o.P||typeof n[0]=="number"){const x=o.P.convert(n);p=[x],y=l.isPointAboveHorizon(x)}else{const x=o.P.convert(n[0]),b=o.P.convert(n[1]),T=x.add(b)._div(2);p=[x,b],y=o.aq(x,b).every(A=>l.isPointAboveHorizon(A))&&l.isPointAboveHorizon(T)}return new ai(p,y,l)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(n){return o.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],n)}bufferedCameraGeometry(n){const l=this.screenBounds[0],p=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],y=o.aq(l,p,0,!1);return this.cameraPoint.y>p.y&&(this.cameraPoint.x>l.x&&this.cameraPoint.x<p.x?y.splice(3,0,this.cameraPoint):this.cameraPoint.x>=p.x?y[2]=this.cameraPoint:this.cameraPoint.x<=l.x&&(y[3]=this.cameraPoint)),o.ar(y,n)}bufferedCameraGeometryGlobe(n){const l=this.screenBounds[0],p=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],y=o.aq(l,p,n),x=this.cameraPoint.clone();switch(3*((x.y>l.y)+(x.y>p.y))+((x.x>l.x)+(x.x>p.x))){case 0:y[0]=x,y[4]=x.clone();break;case 1:y.splice(1,0,x);break;case 2:y[1]=x;break;case 3:y.splice(4,0,x);break;case 5:y.splice(2,0,x);break;case 6:y[3]=x;break;case 7:y.splice(3,0,x);break;case 8:y[2]=x}return y}containsTile(n,l,p,y=0){const x=Math.max(n.queryPadding,n.evaluateQueryRenderedFeaturePadding())/l._pixelsPerMercatorPixel+1,b=p?this._bufferedCameraMercator(x,l):this._bufferedScreenMercator(x,l);let T=n.tileID.wrap+(b.unwrapped?y:0);const A=b.polygon.map(Q=>o.as(n.tileTransform,Q,T));if(!o.at(A,0,0,o.al,o.al))return;T=n.tileID.wrap+(this.screenGeometryMercator.unwrapped?y:0);const M=this.screenGeometryMercator.polygon.map(Q=>o.au(n.tileTransform,Q,T)),D=M.map(Q=>new o.P(Q[0],Q[1])),N=l.getFreeCameraOptions().position||new o.ae(0,0,0),B=o.au(n.tileTransform,N,T),j=M.map(Q=>{const J=o.av(Q,Q,B);return o.aw(J,J),new o.ax(B,J)}),H=o.ay(n,1,l.zoom)*l._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:D,tilespaceRays:j,bufferedTilespaceGeometry:A,bufferedTilespaceBounds:(G=o.az(A),G.min.x=o.aA(G.min.x,0,o.al),G.min.y=o.aA(G.min.y,0,o.al),G.max.x=o.aA(G.max.x,0,o.al),G.max.y=o.aA(G.max.y,0,o.al),G),tile:n,tileID:n.tileID,pixelToTileUnitsFactor:H};var G}_bufferedScreenMercator(n,l){const p=yi(n);if(this._screenRaycastCache[p])return this._screenRaycastCache[p];{let y;return y=l.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(n),l):{polygon:this.bufferedScreenGeometry(n).map(x=>l.pointCoordinate3D(x)),unwrapped:!0},this._screenRaycastCache[p]=y,y}}_bufferedCameraMercator(n,l){const p=yi(n);if(this._cameraRaycastCache[p])return this._cameraRaycastCache[p];{let y;return y=l.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(n),l):{polygon:this.bufferedCameraGeometry(n).map(x=>l.pointCoordinate3D(x)),unwrapped:!0},this._cameraRaycastCache[p]=y,y}}_projectAndResample(n,l){const p=function(x,b){const T=o.aB([],b.pixelMatrix,b.globeMatrix),A=[0,-o.aD,0,1],M=[0,o.aD,0,1],D=[0,0,0,1];o.aC(A,A,T),o.aC(M,M,T),o.aC(D,D,T);const N=new o.P(A[0]/A[3],A[1]/A[3]),B=new o.P(M[0]/M[3],M[1]/M[3]),j=o.aE(x,N)&&A[3]<D[3],H=o.aE(x,B)&&M[3]<D[3];if(!j&&!H)return null;const G=function(we,_e,pe){for(let Te=1;Te<we.length;Te++){const De=Vr(_e.pointCoordinate3D(we[Te-1]).x),Me=Vr(_e.pointCoordinate3D(we[Te]).x);if(pe<0){if(De<Me)return{idx:Te,t:-De/(Me-1-De)}}else if(Me<De)return{idx:Te,t:(1-De)/(Me+1-De)}}return null}(x,b,j?-1:1);if(!G)return null;const{idx:Q,t:J}=G;let ae=Q>1?zn(x.slice(0,Q),b):[],de=Q<x.length?zn(x.slice(Q),b):[];ae=ae.map(we=>new o.P(Vr(we.x),we.y)),de=de.map(we=>new o.P(Vr(we.x),we.y));const ce=[...ae];ce.length===0&&ce.push(de[de.length-1]);const Se=o.ak(ce[ce.length-1].y,(de.length===0?ae[0]:de[0]).y,J);let ye;return ye=j?[new o.P(0,Se),new o.P(0,0),new o.P(1,0),new o.P(1,Se)]:[new o.P(1,Se),new o.P(1,1),new o.P(0,1),new o.P(0,Se)],ce.push(...ye),de.length===0?ce.push(ae[0]):ce.push(...de),{polygon:ce.map(we=>new o.ae(we.x,we.y)),unwrapped:!1}}(n,l);if(p)return p;const y=function(x,b){let T=!1,A=-1/0,M=0;for(let N=0;N<x.length-1;N++)x[N].x>A&&(A=x[N].x,M=N);for(let N=0;N<x.length-1;N++){const B=(M+N)%(x.length-1),j=x[B],H=x[B+1];Math.abs(j.x-H.x)>.5&&(j.x<H.x?(j.x+=1,B===0&&(x[x.length-1].x+=1)):(H.x+=1,B+1===x.length-1&&(x[0].x+=1)),T=!0)}const D=o.aF(b.center.lng);return T&&D<Math.abs(D-1)&&x.forEach(N=>{N.x-=1}),{polygon:x,unwrapped:T}}(zn(n,l).map(x=>new o.P(Vr(x.x),x.y)),l);return{polygon:y.polygon.map(x=>new o.ae(x.x,x.y)),unwrapped:y.unwrapped}}}function zn(f,n){return o.aG(f,l=>{const p=n.pointCoordinate3D(l);l.x=p.x,l.y=p.y},1/256)}function Vr(f){return f<0?1+f%1:f%1}function yi(f){return 100*f|0}function Ps(f,n,l,p,y){const x=function(T,A){if(T)return y(T);if(A){if(f.url&&A.tiles&&f.tiles&&delete f.tiles,A.variants){if(!Array.isArray(A.variants))return y(new Error("variants must be an array"));for(const D of A.variants){if(D==null||typeof D!="object"||D.constructor!==Object)return y(new Error("variant must be an object"));if(!Array.isArray(D.capabilities))return y(new Error("capabilities must be an array"));if(D.capabilities.length===1&&D.capabilities[0]==="meshopt"){A=Object.assign(A,D);break}}}const M=o.aH(Object.assign({},A,f),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);M.tiles=n.canonicalizeTileset(M,f.url),y(null,M)}},b=function(T,A,M){if(!T)return null;if(!A&&!M)return T;M=M||T.worldview_default;const D=Object.values(T.language||{});if(D.length===0)return null;const N=Object.values(T.worldview||{});if(N.length===0)return null;const B=D.every(H=>H===A),j=N.every(H=>H===M);return B&&j?T:A in(T.language_options||{})||M in(T.worldview_options||{})?null:T.language_options&&T.worldview_options?T:null}(f.data,l,p);return b?o.o.frame(()=>x(null,b)):f.url?o.m(n.transformRequest(n.normalizeSourceURL(f.url,null,l,p),o.R.Source),x):o.o.frame(()=>{const{data:T,...A}=f;x(null,A)})}function Ns(f,n){const l=Math.pow(2,n.z),p=Math.floor(o.aF(f.getWest())*l),y=Math.floor(o.aJ(f.getNorth())*l),x=Math.ceil(o.aF(f.getEast())*l),b=Math.ceil(o.aJ(f.getSouth())*l);return n.x>=p&&n.x<x&&n.y>=y&&n.y<b}class xo{constructor(n,l,p){this.bounds=n?o.aI.convert(this.validateBounds(n)):null,this.minzoom=l||0,this.maxzoom=p||24}validateBounds(n){return Array.isArray(n)&&n.length===4?[Math.max(-180,n[0]),Math.max(-90,n[1]),Math.min(180,n[2]),Math.min(90,n[3])]:[-180,-90,180,90]}addExtraBounds(n){if(n){this.extraBounds||(this.extraBounds=[]);for(const l of n)this.extraBounds.push(o.aI.convert(this.validateBounds(l)))}}contains(n){if(n.z>this.maxzoom||n.z<this.minzoom||this.bounds&&!Ns(this.bounds,n))return!1;if(!this.extraBounds)return!0;for(const l of this.extraBounds)if(Ns(l,n))return!0;return!1}static fromTileJSON(n){if(!n.bounds&&!n.extra_bounds)return null;const l=new xo(n.bounds,n.minzoom,n.maxzoom);return l.addExtraBounds(n.extra_bounds),l}}class Qc extends o.E{constructor(n,l,p,y){if(super(),this.id=n,this.dispatcher=p,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,o.aH(l,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},l),this._collectResourceTiming=!!l.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(y),this._tileWorkers={},this._deduped=new o.aK}load(n){this._loaded=!1,this.fire(new o.z("dataloading",{dataType:"source"}));const l=Array.isArray(this.map._language)?this.map._language.join():this.map._language,p=this.map.getWorldview();this._tileJSONRequest=Ps(this._options,this.map._requestManager,l,p,(y,x)=>{if(this._tileJSONRequest=null,this._loaded=!0,y)l&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${l}`),p&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${p}`),this.fire(new o.y(y));else if(x){if(Object.assign(this,x),this.hasWorldviews=!!x.worldview_options,x.worldview_default&&(this.worldviewDefault=x.worldview_default),x.vector_layers){this.vectorLayers=x.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const b of x.vector_layers)this.vectorLayerIds.push(b.id),x.worldview&&x.worldview[b.source]&&this.localizableLayerIds.add(b.id)}this.tileBounds=xo.fromTileJSON(x),hr(x.tiles,this.map._requestManager._customAccessToken),this.fire(new o.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.z("data",{dataType:"source",sourceDataType:"content"}))}n&&n(y)})}loaded(){return this._loaded}hasTile(n){return!this.tileBounds||this.tileBounds.contains(n.canonical)}onAdd(n){this.map=n,this.load()}reload(){this.cancelTileJSONRequest();const n=o.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(n))}setTiles(n){return this._options.tiles=n,this.reload(),this}setUrl(n){return this.url=n,this._options.url=n,this.reload(),this}onRemove(n){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(n,l){const p=n.tileID.canonical.url(this.tiles,this.scheme),y=this.map._requestManager.normalizeTileURL(p),x=this.map._requestManager.transformRequest(y,o.R.Tile),b=this.map.style?this.map.style.getLut(this.scope):null,T=b?{image:b.image.clone()}:null,A={request:x,data:void 0,uid:n.uid,tileID:n.tileID,tileZoom:n.tileZoom,zoom:n.tileID.overscaledZ,maxZoom:this.maxzoom,lut:T,tileSize:this.tileSize*n.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:o.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:n.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:n.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&o.h(p)&&(A.localizableLayerIds=this.localizableLayerIds),A.request.collectResourceTiming=this._collectResourceTiming,n.actor&&n.state!=="expired")n.state==="loading"?n.reloadCallback=l:n.request=n.actor.send("reloadTile",A,M.bind(this));else if(n.actor=this._tileWorkers[y]=this._tileWorkers[y]||this.dispatcher.getActor(),this.dispatcher.ready)n.request=n.actor.send("loadTile",A,M.bind(this),void 0,!0);else{const D=o.aL.call({deduped:this._deduped},A,(N,B)=>{if(N||!B)M.call(this,N);else{const j=o.aM(B.responseHeaders);A.data={rawData:B.rawData.slice(0),expires:j.expires,cacheControl:j.cacheControl},n.actor&&n.actor.send("loadTile",A,M.bind(this),void 0,!0)}},!0);n.request={cancel:D}}function M(D,N){return delete n.request,n.aborted?l(null):D&&D instanceof o.aN&&D.status!==404?l(D):(N&&N.resourceTiming&&(n.resourceTiming=N.resourceTiming),this.map._refreshExpiredTiles&&N&&n.setExpiryData(N),n.loadVectorData(N,this.map.painter),o.aO(this.dispatcher),l(null,N),void(n.reloadCallback&&(this.loadTile(n,n.reloadCallback),n.reloadCallback=null)))}}abortTile(n){n.request&&(n.request.cancel(),delete n.request),n.actor&&n.actor.send("abortTile",{uid:n.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(n,l){n.actor&&n.actor.send("removeTile",{uid:n.uid,type:this.type,source:this.id,scope:this.scope}),n.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ps extends o.E{constructor(n,l,p,y){super(),this.id=n,this.dispatcher=p,this.setEventedParent(y),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"},l),Object.assign(this,o.aH(l,["url","scheme","tileSize"]))}load(n){this._loaded=!1,this.fire(new o.z("dataloading",{dataType:"source"}));const l=this.map.getWorldview();this._tileJSONRequest=Ps(this._options,this.map._requestManager,null,l,(p,y)=>{this._tileJSONRequest=null,this._loaded=!0,p?this.fire(new o.y(p)):y&&(Object.assign(this,y),y.raster_layers&&(this.rasterLayers=y.raster_layers,this.rasterLayerIds=this.rasterLayers.map(x=>x.id)),this.tileBounds=xo.fromTileJSON(y),hr(y.tiles),this.fire(new o.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.z("data",{dataType:"source",sourceDataType:"content"}))),n&&n(p)})}loaded(){return this._loaded}onAdd(n){this.map=n,this.load()}reload(){this.cancelTileJSONRequest();const n=o.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(n))}setTiles(n){return this._options.tiles=n,this.reload(),this}setUrl(n){return this.url=n,this._options.url=n,this.reload(),this}onRemove(n){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(n){return!this.tileBounds||this.tileBounds.contains(n.canonical)}loadTile(n,l){const p=o.o.devicePixelRatio>=2,y=this.map._requestManager.normalizeTileURL(n.tileID.canonical.url(this.tiles,this.scheme),p,this.tileSize);n.request=o.n(this.map._requestManager.transformRequest(y,o.R.Tile),(x,b,T)=>{if(delete n.request,n.aborted)return n.state="unloaded",l(null);if(x)return n.state="errored",l(x);if(!b)return l(null);const A=o.aM(T);this.map._refreshExpiredTiles&&n.setExpiryData(A),n.setTexture(b,this.map.painter),n.state="loaded",o.aO(this.dispatcher),l(null)})}abortTile(n,l){n.request&&(n.request.cancel(),delete n.request),l&&l()}unloadTile(n,l){n.texture&&n.texture instanceof o.T?(n.destroy(!1),n.texture&&n.texture instanceof o.T&&this.map.painter.saveTileTexture(n.texture)):n.destroy(),l&&l()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Ko([f,n],l,p,{scaled:y=!0}={}){const{tileSize:x,buffer:b}=p,{x:T,y:A,z:M}=l;if(!isFinite(T)||!isFinite(A)||!isFinite(M))throw new Error("Invalid MRT header");const D=2**M,N=D*o.aF(f),B=D*o.aJ(n);return function([j,H],G,{scaled:Q=!0}={}){if(!G)throw new Error("bandView is undefined");const{data:J,tileSize:ae,buffer:de,offset:ce,scale:Se,dimension:ye}=G;if(j<-de||j>ae+de||H<-de||H>ae+de)throw new Error(`Point (${j}, ${H}) out of bounds for tileSize=${ae}, buffer=${de}`);const we=(H+de)*(ae+2*de)+(j+de);if(new Uint32Array(J.buffer)[we]===4294967295)return null;let _e=[];_e=Q?[]:new G.data.constructor(ye);for(let pe=0;pe<ye;pe++)_e[pe]=Math.round(1e12*(J[ye*we+pe]*Se+ce))/1e12;return _e}([Math.min(Math.max(-b,Math.floor((N-T)*x)),x-1+b),Math.min(Math.max(-b,Math.floor((B-A)*x)),x-1+b)],p,{scaled:y})}class Ys extends ps{constructor(n,l,p,y){super(n,l,p,y),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},l)}triggerRepaint(n){const l=this.map.painter._terrain,p=this.map.style.getSourceCache(this.id);l&&l.enabled&&p&&l._clearRenderCacheForTile(p.id,n.tileID),this.map.triggerRepaint()}loadTile(n,l){const p=this.map._requestManager.normalizeTileURL(n.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),y=this.map._requestManager.transformRequest(p,o.R.Tile),x={request:y,uid:n.uid,tileID:n.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};n.source=this.id,n.scope=this.scope,n.requestParams=y,n.actor||(n.actor=this.dispatcher.getActor());const b=(T,A,M)=>{if(delete n.request,n.aborted)return n.state="unloaded",l(null);if(T)return T.name==="AbortError"?void 0:(n.state="errored",l(T));if(this.map._refreshExpiredTiles&&A){const D=o.aM(M);n.setExpiryData(D)}if(this.partial&&n.state!=="expired")n.state="empty";else if(!this.partial){if(!A)return l(null);n.state="loaded",n._isHeaderLoaded=!0,n._mrt=A}l(null)};n.request=this.partial?n.fetchHeader(void 0,b.bind(this)):n.actor.send("loadTile",x,b.bind(this),void 0,!0)}abortTile(n){n.request&&(n.request.cancel(),delete n.request),n.actor&&n.actor.send("abortTile",{uid:n.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(n,l){const p=n.texturePerLayer;if(n.flushAllQueues(),p.size){n.destroy(!1);for(const y of p.values())this.map.painter.saveTileTexture(y)}else n.destroy()}prepareTile(n,l,p,y){n._isHeaderLoaded&&(n.state!=="empty"&&(n.state="reloading"),n.fetchBandForRender(l,p,y,(x,b)=>{if(x)return n.state="errored",this.fire(new o.y(x)),void this.triggerRepaint(n);b&&(n._isHeaderLoaded=!0,n.setTexturePerLayer(p,b,this.map.painter),n.state="loaded",this.triggerRepaint(n))}))}getInitialBand(n){if(!this.rasterLayers)return 0;const l=this.rasterLayers.find(({id:x})=>x===n),p=l&&l.fields,y=p&&p.bands&&p.bands;return y?y[0]:0}getTextureDescriptor(n,l,p){if(!n)return;const y=l.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!y)return;let x=null;l instanceof o.aR?x=l.paint.get("raster-array-band"):l instanceof o.aS&&(x=l.paint.get("raster-particle-array-band"));const b=x||this.getInitialBand(y);if(b==null)return;if(!n.textureDescriptorPerLayer.get(l.id))return void this.prepareTile(n,y,l.id,b);if(n.updateNeeded(l.id,b)&&!p)return;const T=n.textureDescriptorPerLayer.get(l.id);return Object.assign({},T,{texture:n.texturePerLayer.get(l.id)})}getImages(n,l){const p=new Map;for(const y of n)for(const x of l){const[b,T]=x.split("/"),A=y.getLayer(b);if(!A||!A.hasBand(T)||!A.hasDataForBand(T))continue;const{bytes:M,tileSize:D,buffer:N}=A.getBandView(T),B=D+2*N,j={data:new o.q({width:B,height:B},M),pixelRatio:2,sdf:!1,usvg:!1,version:0};p.set(x,j)}return p}queryRasterArrayValueByBandId(n,l,p){const y=l._mrt;return new Promise(x=>{const b={},T=new Set;for(const[A,M]of Object.entries(y.layers)){if(p.layerName&&A!==p.layerName)continue;const D={};b[A]=D;for(const{bands:N}of M.dataIndex)for(const B of N)p.bands&&!p.bands.includes(B)||(T.add(o.B(A,B)),l.fetchBand(A,null,B,j=>{o.o.frame(()=>{D[B]=j?null:Ko([n.lng,n.lat],y,M.getBandView(B)),T.delete(o.B(A,B)),T.size===0&&x(b)})},!1))}T.size===0&&x(b)})}_loadTileForQuery(n,l){if(this._loadTileLoaded[n.uid])return void l(null,n._mrt);if(this._loadTilePending[n.uid])return void this._loadTilePending[n.uid].push(l);this._loadTilePending[n.uid]=[l];const p=this.map._requestManager.normalizeTileURL(n.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),y=this.map._requestManager.transformRequest(p,o.R.Tile);n.actor.send("loadTile",{request:y,uid:n.uid,tileID:n.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(x,b,T)=>{if(x)return this._loadTilePending[n.uid].forEach(A=>A(x,null)),void delete this._loadTilePending[n.uid];if(!b)return this._loadTilePending[n.uid].forEach(A=>A(null,null)),void delete this._loadTilePending[n.uid];if(this.map._refreshExpiredTiles&&b){const A=o.aM(T);n.setExpiryData(A)}n._mrt=b,n._isHeaderLoaded=!0,n.state="loaded",this._loadTilePending[n.uid].forEach(A=>A(null,b)),this._loadTileLoaded[n.uid]=!0,delete this._loadTilePending[n.uid]},void 0,!0)}queryRasterArrayValueByAllBands(n,l,p){return new Promise((y,x)=>{this._loadTileForQuery(l,(b,T)=>{b?x(b):y(T?this.queryRasterArrayValueByBandId(n,l,p):null)})})}queryRasterArrayValue(n,l){const p=o.aT.convert(n),y=this.findLoadedParent(p);return y&&y._mrt?l.bands||!this.partial?this.queryRasterArrayValueByBandId(p,y,l):this.queryRasterArrayValueByAllBands(p,y,l):Promise.resolve(null)}findLoadedParent(n){const l=o.ae.fromLngLat(n,this.map.transform.tileSize),p=this.maxzoom+1,y=1<<p,x=Math.floor(l.x),b=Math.floor((l.x-x)*y),T=Math.floor(l.y*y),A=this.map.style.getSourceCache(this.id),M=new o.aQ(p,x,p,b,T);return A.findLoadedParent(M,this.minzoom)}}const Qa={vector:Qc,raster:ps,"raster-dem":class extends ps{constructor(f,n,l,p){super(f,n,l,p),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(f,n){const l=this.map._requestManager.normalizeTileURL(f.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function p(y,x){y&&(f.state="errored",n(y)),x&&(f.dem=x,f.dem.onDeserialize(),f.needsHillshadePrepare=!0,f.needsDEMTextureUpload=!0,f.state="loaded",n(null))}f.request=o.n(this.map._requestManager.transformRequest(l,o.R.Tile),(function(y,x,b){if(delete f.request,f.aborted)f.state="unloaded",n(null);else if(y)f.state="errored",n(y);else if(x){const T=o.aM(b);this.map._refreshExpiredTiles&&f.setExpiryData(T);const A=ImageBitmap&&x instanceof ImageBitmap&&o.r(),M=1-(x.width-o.aP(x.width))/2;M<1||f.neighboringTiles||(f.neighboringTiles=this._getNeighboringTiles(f.tileID));const D=A?x:o.o.getImageData(x,M),N={uid:f.uid,tileID:f.tileID,source:this.id,type:this.type,scope:this.scope,rawImageData:D,encoding:this.encoding,padding:M};f.actor&&f.state!=="expired"||(f.actor=this.dispatcher.getActor(),f.actor.send("loadTile",N,p.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(f){const n=f.canonical,l=Math.pow(2,n.z),p=(n.x-1+l)%l,y=n.x===0?f.wrap-1:f.wrap,x=(n.x+1+l)%l,b=n.x+1===l?f.wrap+1:f.wrap,T={};return T[new o.aQ(f.overscaledZ,y,n.z,p,n.y).key]={backfilled:!1},T[new o.aQ(f.overscaledZ,b,n.z,x,n.y).key]={backfilled:!1},n.y>0&&(T[new o.aQ(f.overscaledZ,y,n.z,p,n.y-1).key]={backfilled:!1},T[new o.aQ(f.overscaledZ,f.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},T[new o.aQ(f.overscaledZ,b,n.z,x,n.y-1).key]={backfilled:!1}),n.y+1<l&&(T[new o.aQ(f.overscaledZ,y,n.z,p,n.y+1).key]={backfilled:!1},T[new o.aQ(f.overscaledZ,f.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},T[new o.aQ(f.overscaledZ,b,n.z,x,n.y+1).key]={backfilled:!1}),T}},"raster-array":Ys,geojson:class extends o.E{constructor(f,n,l,p){super(),this.id=f,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=l.getActor(),this.setEventedParent(p),this._data=n.data,this._options=Object.assign({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.minzoom!==void 0&&(this.minzoom=n.minzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const y=o.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*y,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*y,extent:o.al,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:o.al,radius:(n.clusterRadius!==void 0?n.clusterRadius:50)*y,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter,dynamic:n.dynamic},n.workerOptions)}onAdd(f){this.map=f,this.setData(this._data)}setData(f){return this._data=f,this._updateWorkerData(),this}updateData(f){if(!this._options.dynamic)return this.fire(new o.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof f!="string"&&(f.type==="Feature"&&(f={type:"FeatureCollection",features:[f]}),f.type!=="FeatureCollection"))return this.fire(new o.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof f!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const n=new Map;for(const l of this._data.features)n.set(l.id,l);for(const l of f.features)n.set(l.id,l);this._data.features=[...n.values()]}else this._data=f;return this._updateWorkerData(!0),this}getClusterExpansionZoom(f,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:f,source:this.id,scope:this.scope},n),this}getClusterChildren(f,n){return this.actor.send("geojson.getClusterChildren",{clusterId:f,source:this.id,scope:this.scope},n),this}getClusterLeaves(f,n,l,p){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:f,limit:n,offset:l},p),this}_updateWorkerData(f=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.z("dataloading",{dataType:"source"})),this._loaded=!1;const n=Object.assign({append:f},this.workerOptions);n.scope=this.scope;const l=this._data;typeof l=="string"?(n.request=this.map._requestManager.transformRequest(o.o.resolveURL(l),o.R.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(l),this._pendingLoad=this.actor.send(`${this.type}.loadData`,n,(p,y)=>{if(this._loaded=!0,this._pendingLoad=null,p)this.fire(new o.y(p));else{const x={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&y&&y.resourceTiming&&y.resourceTiming[this.id]&&(x.resourceTiming=y.resourceTiming[this.id]),f&&(this._partialReload=!0),this.fire(new o.z("data",x)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(f),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const f=o.B(this.id,this.scope);this.map.style.clearSource(f),this._updateWorkerData()}loadTile(f,n){const l=f.actor?"reloadTile":"loadTile";f.actor=this.actor;const p=this.map.style?this.map.style.getLut(this.scope):null,y=p?{image:p.image.clone()}:null,x=this._partialReload,b={type:this.type,uid:f.uid,tileID:f.tileID,tileZoom:f.tileZoom,zoom:f.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:y,scope:this.scope,pixelRatio:o.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:f.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:x,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};f.request=this.actor.send(l,b,(T,A)=>x&&!A?(f.state="loaded",n(null)):(delete f.request,f.destroy(!1),f.aborted?n(null):T?n(T):(f.loadVectorData(A,this.map.painter,l==="reloadTile"),n(null))),void 0,l==="loadTile")}abortTile(f){f.request&&(f.request.cancel(),delete f.request),f.aborted=!0}unloadTile(f,n){this.actor.send("removeTile",{uid:f.uid,type:this.type,source:this.id,scope:this.scope}),f.destroy()}onRemove(f){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.aU{constructor(f,n,l,p){super(f,n,l,p),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const f=this.options;this.urls=[];for(const n of f.urls)this.urls.push(this.map._requestManager.transformRequest(n,o.R.Source).url);o.aV(this.urls,(n,l)=>{this._loaded=!0,n?this.fire(new o.y(n)):l&&(this.video=l,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(f){if(this.video){const n=this.video.seekable;f<n.start(0)||f>n.end(0)?this.fire(new o.y(new o.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=f}}getVideo(){return this.video}onAdd(f){this.map||(this.map=f,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const f=this.map.painter.context,n=f.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(f,this.video,n.RGBA8),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(f)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:o.aU,model:o.aX,"batched-model":class extends o.E{constructor(f,n,l,p){super(),this.type="batched-model",this.id=f,this.tileSize=512,this._options=n,this.tiles=this._options.tiles,this.maxzoom=n.maxzoom||19,this.minzoom=n.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=l,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(p)}onAdd(f){this.map=f,this.load()}reload(){this.cancelTileJSONRequest();const f=o.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(f))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(f){this._loaded=!1,this.fire(new o.z("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,l=this.map.getWorldview();this._tileJSONRequest=Ps(this._options,this.map._requestManager,n,l,(p,y)=>{this._tileJSONRequest=null,this._loaded=!0,p?(n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),l&&l.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${l}`),this.fire(new o.y(p))):y&&(Object.assign(this,y),y.bounds&&(this.tileBounds=new xo(y.bounds,this.minzoom,this.maxzoom)),hr(y.tiles,this.map._requestManager._customAccessToken),this.fire(new o.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.z("data",{dataType:"source",sourceDataType:"content"}))),f&&f(p)})}hasTransition(){return!1}hasTile(f){return!this.tileBounds||this.tileBounds.contains(f.canonical)}loaded(){return this._loaded}loadTile(f,n){const l=this.map._requestManager.normalizeTileURL(f.tileID.canonical.url(this.tiles,this.scheme)),p={request:this.map._requestManager.transformRequest(l,o.R.Tile),data:void 0,uid:f.uid,tileID:f.tileID,tileZoom:f.tileZoom,zoom:f.tileID.overscaledZ,tileSize:this.tileSize*f.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:f.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:o.o.devicePixelRatio,promoteId:this.promoteId};if(f.actor&&f.state!=="expired")if(f.state==="loading")f.reloadCallback=n;else{if(f.buckets){const x=Object.values(f.buckets);for(const b of x)b.dirty=!0;return void(f.state="loaded")}f.request=f.actor.send("reloadTile",p,y.bind(this))}else f.actor=this.dispatcher.getActor(),f.request=f.actor.send("loadTile",p,y.bind(this),void 0,!0);function y(x,b){return f.aborted?n(null):x&&x.status!==404?n(x):(this.map._refreshExpiredTiles&&b&&f.setExpiryData(b),f.loadModelData(b,this.map.painter),f.state="loaded",void n(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends o.aU{constructor(f,n,l,p){super(f,n,l,p),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(x=>typeof x!="number"))||this.fire(new o.y(new o.V(`sources.${f}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.y(new o.V(`sources.${f}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new o.y(new o.V(`sources.${f}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new o.y(new o.V(`sources.${f}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.y(new o.V(`sources.${f}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.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 o.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(f){this.map=f,this.load(),this.canvas&&this.animate&&this.play()}onRemove(f){this.pause()}prepare(){let f=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,f=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,f=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context;this.texture?!f&&!this._playing||this.texture instanceof o.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(n,this.canvas,n.gl.RGBA8,{premultiply:!0}),this._prepareData(n)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const f of[this.canvas.width,this.canvas.height])if(isNaN(f)||f<=0)return!0;return!1}},custom:class extends o.E{constructor(f,n,l,p){super(),this.id=f,this.type="custom",this._dataType="raster",this._dispatcher=l,this._implementation=n,this.setEventedParent(p),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new o.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new xo(this._implementation.bounds,this.minzoom,this.maxzoom)),n.update=this._update.bind(this),n.clearTiles=this._clearTiles.bind(this),n.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,o.aH(n,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(f){this.map=f,this._loaded=!1,this.fire(new o.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(f),this.load()}onRemove(f){this._implementation.onRemove&&this._implementation.onRemove(f)}hasTile(f){if(this._implementation.hasTile){const{x:n,y:l,z:p}=f.canonical;return this._implementation.hasTile({x:n,y:l,z:p})}return!this.tileBounds||this.tileBounds.contains(f.canonical)}loadTile(f,n){const{x:l,y:p,z:y}=f.tileID.canonical,x=new AbortController;f.request=Promise.resolve(this._implementation.loadTile({x:l,y:p,z:y},{signal:x.signal})).then((function(b){return delete f.request,f.aborted?(f.state="unloaded",n(null)):b===void 0?(f.state="errored",n(null)):b===null?(this.loadTileData(f,{width:this.tileSize,height:this.tileSize,data:null}),f.state="loaded",n(null)):function(T){return T instanceof ImageData||T instanceof HTMLCanvasElement||T instanceof ImageBitmap||T instanceof HTMLImageElement}(b)?(this.loadTileData(f,b),f.state="loaded",void n(null)):(f.state="errored",n(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(b=>{b.name!=="AbortError"&&(f.state="errored",n(b))}),f.request.cancel=()=>x.abort()}loadTileData(f,n){f.setTexture(n,this.map.painter)}unloadTile(f,n){if(f.texture&&f.texture instanceof o.T?(f.destroy(!1),f.texture&&f.texture instanceof o.T&&this.map.painter.saveTileTexture(f.texture)):f.destroy(),this._implementation.unloadTile){const{x:l,y:p,z:y}=f.tileID.canonical;this._implementation.unloadTile({x:l,y:p,z:y})}n&&n()}abortTile(f,n){f.request&&f.request.cancel&&(f.request.cancel(),delete f.request),n&&n()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(f=>({x:f.canonical.x,y:f.canonical.y,z:f.canonical.z}))}_clearTiles(){const f=o.B(this.id,this.scope);this.map.style.clearSource(f)}_update(){this.fire(new o.z("data",{dataType:"source",sourceDataType:"content"}))}}},ns=function(f,n,l,p){const y=new Qa[n.type](f,n,l,p);if(y.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${y.id}`);return o.aY(["load","abort","unload","serialize","prepare"],y),y};function eu(f,n,l=""){return`${l}:${n.id||""}:${n.layer.id}:${function(p){if("layerId"in p)return`layer:${p.layerId}`;{const{featuresetId:y,importId:x}=p;return`featureset:${y}${x?`:import:${x}`:""}`}}(f.target)}`}function Wu(f,n,l,p=""){if(f.uniqueFeatureID){const y=eu(f,n,p);if(l.has(y))return!0;l.add(y)}return!1}function Zf(f,n,l,p,y=!1){const x=n.sourceCache.transform,b=n.sourceCache.tilesIn(f,n.has3DLayers,y);b.sort(ph);const T=[];for(const A of b){const M=A.tile.queryRenderedFeatures(n,A,l,p,x,y);Object.keys(M).length&&T.push({wrappedTileID:A.tile.tileID.wrapped().key,queryResults:M})}for(const A in n.layers){const M=n.layers[A];if(M.styleLayer){const D=M.styleLayer.queryRenderedFeatures(f,n.sourceCache,p);Object.keys(D).length&&T.push({wrappedTileID:0,queryResults:D})}}return T.length===0?{}:function(A){const M={},D={};for(const N of A){const B=N.queryResults,j=N.wrappedTileID,H=D[j]=D[j]||{};for(const G in B){const Q=B[G],J=H[G]=H[G]||{},ae=M[G]=M[G]||[];for(const de of Q)J[de.featureIndex]||(J[de.featureIndex]=!0,ae.push(de))}}return M}(T)}function Xf(f,n,l,p,y,x){const b={},T=p.queryRenderedSymbols(f),A=[];for(const M of Object.keys(T).map(Number))A.push(y[M]);A.sort(ph);for(const M of A){const D=M.featureIndex.lookupSymbolFeatures(T[M.bucketInstanceId],M.bucketIndex,M.sourceLayerIndex,n,l,x);for(const N in D){const B=b[N]=b[N]||[],j=D[N];j.sort((H,G)=>{const Q=M.featureSortOrder;if(Q){const J=Q.indexOf(H.featureIndex);return Q.indexOf(G.featureIndex)-J}return G.featureIndex-H.featureIndex});for(const H of j)B.push(H)}}return b}function Yf(f,n){const l=f.getRenderableIds().map(x=>f.getTileByID(x)),p=[],y={};for(let x=0;x<l.length;x++){const b=l[x],T=b.tileID.canonical.key;y[T]||(y[T]=!0,b.querySourceFeatures(p,n))}return p}function ph(f,n){const l=f.tileID,p=n.tileID;return l.overscaledZ-p.overscaledZ||l.canonical.y-p.canonical.y||l.wrap-p.wrap||l.canonical.x-p.canonical.x}function el(f,n){const l={};if(!n)return l;for(const p of f){const y=p.layerIds.map(x=>n.getLayer(x)).filter(Boolean);if(y.length!==0){p.layers=y,p.stateDependentLayerIds&&(p.stateDependentLayers=p.stateDependentLayerIds.map(x=>y.filter(b=>b.id===x)[0]));for(const x of y)l[x.fqid]=p}}return l}const wo=32,Pa=33,Ma=new Uint16Array(8184);for(let f=0;f<2046;f++){let n=f+2,l=0,p=0,y=0,x=0,b=0,T=0;for(1&n?y=x=b=wo:l=p=T=wo;(n>>=1)>1;){const M=l+y>>1,D=p+x>>1;1&n?(y=l,x=p,l=b,p=T):(l=y,p=x,y=b,x=T),b=M,T=D}const A=4*f;Ma[A+0]=l,Ma[A+1]=p,Ma[A+2]=y,Ma[A+3]=x}const da=new Uint16Array(2178),tl=new Uint8Array(1089),pc=new Uint16Array(1089);function tu(f){return f===0?-.03125:f===32?.03125:0}const Jf={type:2,extent:o.al,loadGeometry:()=>[[new o.P(0,0),new o.P(o.al+1,0),new o.P(o.al+1,o.al+1),new o.P(0,o.al+1),new o.P(0,0)]]};class ru{constructor(n,l,p,y,x,b){this.tileID=n,this.uid=o.b2(),this.uses=0,this.tileSize=l,this.tileZoom=p,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=x,y&&y.style&&(this._lastUpdatedBrightness=y.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",y&&y.transform&&(this.projection=y.transform.projection),this.worldview=b,this._hasAppearances=null}registerFadeDuration(n){const l=n+this.timeAdded;l<o.o.now()||this.fadeEndTime&&l<this.fadeEndTime||(this.fadeEndTime=l)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.aZ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(n,l,p){if(this.unloadVectorData(),this.state="loaded",n){n.featureIndex&&(this.latestFeatureIndex=n.featureIndex,n.rawTileData?(this.latestRawTileData=n.rawTileData,this.latestFeatureIndex.rawTileData=n.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=n.collisionBoxArray,this.buckets=el(n.buckets,l.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof o.b4){if(this.hasSymbolBuckets=!0,!p)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof o.b4&&x.hasRTLText){this.hasRTLText=!0,o.b5();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y],b=l.style.getOwnLayer(y);if(!b)continue;const T=b.queryRadius(x);this.queryPadding=Math.max(this.queryPadding,T)}n.imageAtlas&&(this.imageAtlas=n.imageAtlas),n.glyphAtlasImage&&(this.glyphAtlasImage=n.glyphAtlasImage),n.lineAtlas&&(this.lineAtlas=n.lineAtlas),this._lastUpdatedBrightness=n.brightness}else this.collisionBoxArray=new o.b3}unloadVectorData(){if(this.hasData()){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(n,l,p){n&&(n.resourceTiming&&(this.resourceTiming=n.resourceTiming),this.buckets=Object.assign({},this.buckets,el(n.buckets,l.style)),n.featureIndex&&(this.latestFeatureIndex=n.featureIndex))}getBucket(n){return this.buckets[n.fqid]}upload(n,l){for(const x in this.buckets){const b=this.buckets[x];if(b.uploadPending()){let T={},A=[],M={zoom:0,pitch:0,brightness:0,worldview:""};if(l){if(l.style){A=l.style.listImages();const D=b.layers[0],N=D.sourceLayer||"_geojsonTileLayer",B=l.style.getLayerSourceCache(D);B&&(T=B._state.getState(N,void 0))}M={zoom:l.transform.zoom||0,pitch:l.transform.pitch||0,brightness:l.style.getBrightness()||0,worldview:l.worldview||""}}b.upload(n,this.tileID.canonical,T,A,M)}}const p=n.gl,y=this.imageAtlas;y&&!y.uploaded&&(this.imageAtlasTexture=new o.T(n,y.image,p.RGBA8,{useMipmap:!!y.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(n,this.glyphAtlasImage,p.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(n,this.lineAtlas.image,p.R8),this.lineAtlas.uploaded=!0)}prepare(n,l,p){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(n,this.imageAtlasTexture,p),!l||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const y=l.style.getBrightness();this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(l)),(this._lastUpdatedBrightness||y||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&y&&Math.abs(this._lastUpdatedBrightness-y)<.001||(this.updateBuckets(l,this._lastUpdatedBrightness!==y),this._lastUpdatedBrightness=y))}evaluateQueryRenderedFeaturePadding(){let n=0;for(const l in this.buckets){const p=this.buckets[l];p.evaluateQueryRenderedFeaturePadding&&(n=Math.max(n,p.evaluateQueryRenderedFeaturePadding()))}return n}queryRenderedFeatures(n,l,p,y,x,b){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const T=this.evaluateQueryRenderedFeaturePadding(),A=function(M,D){const N=o.bq([],[.5*M.width,.5*-M.height,1]);return o.br(N,N,[1,-1,0]),o.aB(N,N,M.calculateProjMatrix(D.toUnwrapped())),Float32Array.from(N)}(x,this.tileID);return this.latestFeatureIndex.query(n,{tilespaceGeometry:l,pixelPosMatrix:A,transform:y,availableImages:p,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:T})}querySourceFeatures(n,l){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const y=p.loadVTLayers(),x=l?l.sourceLayer:"",b=y._geojsonTileLayer||y[x];if(!b)return;const T=o.b6(l&&l.filter),{z:A,x:M,y:D}=this.tileID.canonical,N={z:A,x:M,y:D};for(let B=0;B<b.length;B++){const j=b.feature(B);if(T.needGeometry){const Q=o.b7(j,!0);if(!T.filter(new o.ac(this.tileID.overscaledZ,{worldview:this.worldview}),Q,this.tileID.canonical))continue}else if(!T.filter(new o.ac(this.tileID.overscaledZ,{worldview:this.worldview}),j))continue;const H=p.getId(j,x),G=new o.b8(j,A,M,D,H);G.tile=N,n.push(G)}}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(n){const l=this.expirationTime;if(n.cacheControl){const p=o.b9(n.cacheControl);p["max-age"]&&(this.expirationTime=Date.now()+1e3*p["max-age"])}else n.expires&&(this.expirationTime=new Date(n.expires).getTime());if(this.expirationTime){const p=Date.now();let y=!1;if(this.expirationTime>p)y=!1;else if(l)if(this.expirationTime<l)y=!0;else{const x=this.expirationTime-l;x?this.expirationTime=p+Math.max(x,3e4):y=!0}else y=!0;y?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(n){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&n&&this.updateBuckets(n)}hasAppearances(n){for(const l in this.buckets)if(n.style.hasLayer(l)&&this.buckets[l].layers.some(p=>p.appearances&&p.appearances.length>0))return!0;return!1}updateBuckets(n,l){if(!this.latestFeatureIndex||!n.style)return;const p=n.style.listImages(),y=n.style.getBrightness();for(const x in this.buckets){if(!n.style.hasLayer(x))continue;const b=this.buckets[x],T=b.layers[0],A=T.sourceLayer||"_geojsonTileLayer",M=n.style.getLayerSourceCache(T);let D={};M&&(D=M._state.getState(A,void 0));const N=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},B=Object.keys(D).length>0&&!l;b.hasAppearances=b.layers.some(G=>G.appearances&&G.appearances.length>0);const j=B?b.stateDependentLayers:b.layers;if(B&&b.stateDependentLayers.length!==0||l){const G=this.latestFeatureIndex.loadVTLayers();b.update(D,G[A],p,N,j,l,y)}if(B&&b.stateDependentLayers.length!==0||l||b.hasAppearances){const G={zoom:n.transform.zoom,pitch:n.transform.pitch,brightness:n.style.getBrightness()||0,worldview:n.worldview};b.updateAppearances(this.tileID.canonical,D,p,G)}(b instanceof o.ba||b instanceof o.bb)&&n._terrain&&n._terrain.enabled&&M&&b.uploadPending()&&n._terrain._clearRenderCacheForTile(M.id,this.tileID);const H=n&&n.style&&n.style.getOwnLayer(x);H&&(this.queryPadding=Math.max(this.queryPadding,H.queryRadius(b)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(n){this.symbolFadeHoldUntil=o.o.now()+n}setTexture(n,l){const p=l.context,y=p.gl;this.texture=this.texture||l.getTileTexture(n.width),this.texture&&this.texture instanceof o.T?this.texture.update(n):(this.texture=new o.T(p,n,y.RGBA8,{useMipmap:!0}),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE))}setDependencies(n,l){const p={};for(const y of l)p[y]=!0;this.dependencies[n]=p}hasDependency(n,l){for(const p of n){const y=this.dependencies[p];if(y){for(const x of l)if(y[x])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(n,l){if(!l||l.name==="mercator"||this._tileDebugBuffer)return;const p=o.bc(Jf,this.tileID.canonical,this.tileTransform)[0],y=new o.bd,x=new o.be;for(let b=0;b<p.length;b++){const{x:T,y:A}=p[b];y.emplaceBack(T,A),x.emplaceBack(b)}x.emplaceBack(0),this._tileDebugIndexBuffer=n.createIndexBuffer(x),this._tileDebugBuffer=n.createVertexBuffer(y,o.bf.members),this._tileDebugSegments=o.bg.simpleSegment(0,0,y.length,x.length)}_makeTileBoundsBuffers(n,l){if(this._tileBoundsBuffer||!l||l.name==="mercator")return;const p=o.bc(Jf,this.tileID.canonical,this.tileTransform)[0];let y,x;if(this.isRaster){const b=function(T,A){const M=o.aZ(T,A),D=Math.pow(2,T.z);for(let Q=0;Q<Pa;Q++)for(let J=0;J<Pa;J++){const ae=o.a_((T.x+(J+tu(J))/wo)/D),de=o.a$((T.y+(Q+tu(Q))/wo)/D),ce=A.project(ae,de),Se=Q*Pa+J;da[2*Se+0]=Math.round((ce.x*M.scale-M.x)*o.al),da[2*Se+1]=Math.round((ce.y*M.scale-M.y)*o.al)}tl.fill(0),pc.fill(0);for(let Q=2045;Q>=0;Q--){const J=4*Q,ae=Ma[J+0],de=Ma[J+1],ce=Ma[J+2],Se=Ma[J+3],ye=ae+ce>>1,we=de+Se>>1,_e=ye+we-de,pe=we+ae-ye,Te=de*Pa+ae,De=Se*Pa+ce,Me=we*Pa+ye,Ge=Math.hypot((da[2*Te+0]+da[2*De+0])/2-da[2*Me+0],(da[2*Te+1]+da[2*De+1])/2-da[2*Me+1])>=16;tl[Me]=tl[Me]||(Ge?1:0),Q<1022&&(tl[Me]=tl[Me]||tl[(de+pe>>1)*Pa+(ae+_e>>1)]||tl[(Se+pe>>1)*Pa+(ce+_e>>1)])}const N=new o.b1,B=new o.b0;let j=0;function H(Q,J){const ae=J*Pa+Q;return pc[ae]===0&&(N.emplaceBack(da[2*ae+0],da[2*ae+1],Q*o.al/wo,J*o.al/wo),pc[ae]=++j),pc[ae]-1}function G(Q,J,ae,de,ce,Se){const ye=Q+ae>>1,we=J+de>>1;if(Math.abs(Q-ce)+Math.abs(J-Se)>1&&tl[we*Pa+ye])G(ce,Se,Q,J,ye,we),G(ae,de,ce,Se,ye,we);else{const _e=H(Q,J),pe=H(ae,de),Te=H(ce,Se);B.emplaceBack(_e,pe,Te)}}return G(0,0,wo,wo,wo,0),G(wo,wo,0,0,0,wo),{vertices:N,indices:B}}(this.tileID.canonical,l);y=b.vertices,x=b.indices}else{y=new o.b1,x=new o.b0;for(const{x:T,y:A}of p)y.emplaceBack(T,A,0,0);const b=o.bh(y.int16.subarray(0,4*y.length),void 0,4);for(let T=0;T<b.length;T+=3)x.emplaceBack(b[T],b[T+1],b[T+2])}this._tileBoundsBuffer=n.createVertexBuffer(y,o.bi.members),this._tileBoundsIndexBuffer=n.createIndexBuffer(x),this._tileBoundsSegments=o.bg.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugBuffers(n,l){const p=l.projection;if(!p||p.name!=="globe"||l.freezeTileCoverage)return;const y=this.tileID.canonical,x=o.bj(y,l),b=o.bk(x),T=o.aj(l.zoom);let A;T>0&&(A=o.bl(new Float64Array(16),l.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(n,y,l,b,A,T),this._makeGlobeTileDebugTextBuffer(n,y,l,b,A,T)}_globePoint(n,l,p,y,x,b,T){let A=o.bm(n,l,p);if(b){const M=1<<p.z,D=o.aF(y.center.lng),N=o.aJ(y.center.lat),B=(p.x+.5)/M-D;let j=0;B>.5?j=-1:B<-.5&&(j=1);let H=(n/o.al+p.x)/M+j,G=(l/o.al+p.y)/M;H=(H-D)*y._pixelsPerMercatorPixel+D,G=(G-N)*y._pixelsPerMercatorPixel+N;const Q=[H*y.worldSize,G*y.worldSize,0];o.af(Q,Q,b),A=o.bn(A,Q,T)}return o.af(A,A,x)}_makeGlobeTileDebugBorderBuffer(n,l,p,y,x,b){const T=new o.bd,A=new o.be,M=new o.bo,D=(B,j,H,G,Q)=>{const J=(H-B)/(Q-1),ae=(G-j)/(Q-1),de=T.length;for(let ce=0;ce<Q;ce++){const Se=B+ce*J,ye=j+ce*ae;T.emplaceBack(Se,ye);const we=this._globePoint(Se,ye,l,p,y,x,b);M.emplaceBack(we[0],we[1],we[2]),A.emplaceBack(de+ce)}},N=o.al;D(0,0,N,0,16),D(N,0,N,N,16),D(N,N,0,N,16),D(0,N,0,0,16),this._tileDebugIndexBuffer=n.createIndexBuffer(A),this._tileDebugBuffer=n.createVertexBuffer(T,o.bf.members),this._globeTileDebugBorderBuffer=n.createVertexBuffer(M,o.bp.members),this._tileDebugSegments=o.bg.simpleSegment(0,0,T.length,A.length)}_makeGlobeTileDebugTextBuffer(n,l,p,y,x,b){const T=o.al/4,A=new o.bd,M=new o.b0,D=new o.bo,N=25;M.reserve(32),A.reserve(N),D.reserve(N);const B=(j,H)=>N*j+H;for(let j=0;j<N;j++){const H=j*T;for(let G=0;G<N;G++){const Q=G*T;A.emplaceBack(Q,H);const J=this._globePoint(Q,H,l,p,y,x,b);D.emplaceBack(J[0],J[1],J[2])}}for(let j=0;j<4;j++)for(let H=0;H<4;H++){const G=B(j,H),Q=B(j,H+1),J=B(j+1,H),ae=B(j+1,H+1);M.emplaceBack(G,Q,J),M.emplaceBack(J,Q,ae)}this._tileDebugTextIndexBuffer=n.createIndexBuffer(M),this._tileDebugTextBuffer=n.createVertexBuffer(A,o.bf.members),this._globeTileDebugTextBuffer=n.createVertexBuffer(D,o.bp.members),this._tileDebugTextSegments=o.bg.simpleSegment(0,0,N,32)}destroy(n=!0){for(const l in this.buckets)this.buckets[l].destroy(n);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),n&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof o.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}o.bs.setPbf(o.bt);class Qf extends ru{constructor(n,l,p,y,x){super(n,l,p,y,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(n){return this._mrt&&this._mrt.getLayer(n)}setTexturePerLayer(n,l,p){const y=p.context,x=y.gl;let b=this.texturePerLayer.get(n)||p.getTileTexture(l.width);b&&b instanceof o.T?b.update(l,{premultiply:!1}):b=new o.T(y,l,x.RGBA8,{premultiply:!1}),this.texturePerLayer.has(n)||this.texturePerLayer.set(n,b)}flushQueues(n){const l=this._workQueuePerLayer.get(n)||[],p=this._fetchQueuePerLayer.get(n)||[];for(;l.length;)l.pop()();for(;p.length;)p.pop()()}flushAllQueues(){for(const n of this._workQueuePerLayer.keys()){const l=this._workQueuePerLayer.get(n)||[];for(;l.length;)l.pop()()}for(const n of this._fetchQueuePerLayer.keys()){const l=this._fetchQueuePerLayer.get(n)||[];for(;l.length;)l.pop()()}}fetchHeader(n=16384,l){const p=this._mrt=new o.bs(30),y=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(n-1)}});return this.entireBuffer=null,this.request=o.bu(y,(x,b,T)=>{if(x)l(x);else try{const A=p.getHeaderLength(b);if(A>n)return void(this.request=this.fetchHeader(A,l));p.parseHeader(b),this._isHeaderLoaded=!0;let M=0;for(const D of Object.values(p.layers))M=Math.max(M,D.dataIndex[D.dataIndex.length-1].lastByte);b.byteLength>=M&&(this.entireBuffer=b),l(null,this.entireBuffer||b,T)}catch(A){l(A)}}),this.request}fetchBandForRender(n,l,p,y){this.fetchBand(n,l,p,x=>{if(x)return void y(x);this.updateTextureDescriptor(n,l,p);const b=this.textureDescriptorPerLayer.get(l);y(null,b?b.img:null)})}fetchBand(n,l,p,y,x=!0){const b=this._mrt;if(!this._isHeaderLoaded||!b)return void y(new Error("Tile header is not ready"));const T=this.actor;if(!T)return void y(new Error("Can't fetch tile band without an actor"));let A;const M=o.B(String(p),o.B(this.tileID.key,n));let D=this._taskQueue.get(M);D?D.add(y):(D=new Set,D.add(y),this._taskQueue.set(M,D));const N=(G,Q)=>{A.complete(G,Q),G?y(G):(D.forEach(J=>J(null,Q)),this._taskQueue.delete(M))},B=(G,Q)=>{if(G)return y(G);const J=T.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Q,task:A},N,void 0,!0);if(l!==null){const ae=this._workQueuePerLayer.get(l)||[];ae.push(()=>{J&&J.cancel(),A.cancel()}),this._workQueuePerLayer.has(l)||this._workQueuePerLayer.set(l,ae)}};let j;try{j=b.getLayer(n)}catch(G){if(this.state==="reloading")return;throw G}if(!j)return void y(new Error(`Unknown sourceLayer "${n}"`));if(j.hasDataForBand(p))return D.forEach(G=>G(null,null)),void this._taskQueue.delete(M);const H=j.getDataRange([p]);if(A=b.createDecodingTask(H),!A||A.tasks.length)if(l!==null&&this.flushQueues(l),this.entireBuffer)B(null,this.entireBuffer.slice(H.firstByte,H.lastByte+1));else{const G=Object.assign({},this.requestParams,{headers:{Range:`bytes=${H.firstByte}-${H.lastByte}`}}),Q=o.bu(G,B);if(l!==null){const J=this._fetchQueuePerLayer.get(l)||[];J.push(()=>{Q.cancel(),A.cancel()}),this._fetchQueuePerLayer.has(l)||this._fetchQueuePerLayer.set(l,J)}}}updateNeeded(n,l){return(!this.textureDescriptorPerLayer.get(n)||this.textureDescriptorPerLayer.get(n).band!==l||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(n,l,p){if(!this._mrt)return;const y=this._mrt.getLayer(n);if(!y||!y.hasBand(p)||!y.hasDataForBand(p))return;const{bytes:x,tileSize:b,buffer:T,offset:A,scale:M}=y.getBandView(p),D=b+2*T,N=new o.q({width:D,height:D},x),B=this.texturePerLayer.get(l);B&&B instanceof o.T&&B.update(N,{premultiply:!1}),this.textureDescriptorPerLayer.set(l,{layer:n,band:p,img:N,buffer:T,offset:A,tileSize:b,format:y.pixelFormat,mix:[M,256*M,65536*M,16777216*M]})}destroy(n=!1){if(super.destroy(n),delete this._mrt,!n)for(const l of this.texturePerLayer.values())l&&l instanceof o.T&&l.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class N0{constructor(n,l){this.max=n,this.onRemove=l,this.reset()}reset(){for(const n in this.data)for(const l of this.data[n])l.timeout&&clearTimeout(l.timeout),this.onRemove(l.value);return this.data={},this.order=[],this}add(n,l,p){const y=n.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);const x={value:l,timeout:void 0};if(p!==void 0&&(x.timeout=setTimeout(()=>{this.remove(n,x)},p)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const b=this._getAndRemoveByKey(this.order[0]);b&&this.onRemove(b)}return this}has(n){return n.wrapped().key in this.data}getAndRemove(n){return this.has(n)?this._getAndRemoveByKey(n.wrapped().key):null}_getAndRemoveByKey(n){const l=this.data[n].shift();return l.timeout&&clearTimeout(l.timeout),this.data[n].length===0&&delete this.data[n],this.order.splice(this.order.indexOf(n),1),l.value}getByKey(n){const l=this.data[n];return l?l[0].value:null}get(n){return this.has(n)?this.data[n.wrapped().key][0].value:null}remove(n,l){if(!this.has(n))return this;const p=n.wrapped().key,y=l===void 0?0:this.data[p].indexOf(l),x=this.data[p][y];return this.data[p].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(x.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(n){for(this.max=n;this.order.length>this.max;){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}filter(n){const l=[];for(const p in this.data)for(const y of this.data[p])n(y.value)||l.push(y);for(const p of l)this.remove(p.value.tileID,p)}}class mh{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(n,l,p){const y=String(l);if(this.stateChanges[n]=this.stateChanges[n]||{},this.stateChanges[n][y]=this.stateChanges[n][y]||{},Object.assign(this.stateChanges[n][y],p),this.deletedStates[n]===null){this.deletedStates[n]={};for(const x in this.state[n])x!==y&&(this.deletedStates[n][x]=null)}else if(this.deletedStates[n]&&this.deletedStates[n][y]===null){this.deletedStates[n][y]={};for(const x in this.state[n][y])p[x]||(this.deletedStates[n][y][x]=null)}else for(const x in p)this.deletedStates[n]&&this.deletedStates[n][y]&&this.deletedStates[n][y][x]===null&&delete this.deletedStates[n][y][x]}removeFeatureState(n,l,p){if(this.deletedStates[n]===null)return;const y=String(l);if(this.deletedStates[n]=this.deletedStates[n]||{},p&&l!==void 0)this.deletedStates[n][y]!==null&&(this.deletedStates[n][y]=this.deletedStates[n][y]||{},this.deletedStates[n][y][p]=null);else if(l!==void 0)if(this.stateChanges[n]&&this.stateChanges[n][y])for(p in this.deletedStates[n][y]={},this.stateChanges[n][y])this.deletedStates[n][y][p]=null;else this.deletedStates[n][y]=null;else this.deletedStates[n]=null}getState(n,l){const p=this.state[n]||{},y=this.stateChanges[n]||{},x=this.deletedStates[n];if(x===null)return{};if(l!==void 0){const T=String(l),A=Object.assign({},p[T],y[T]);if(x){const M=x[l];if(M===null)return{};for(const D in M)delete A[D]}return A}const b=Object.assign({},p,y);if(x)for(const T in x)delete b[T];return b}initializeTileState(n,l){n.refreshFeatureState(l)}coalesceChanges(n,l){const p={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const b in this.stateChanges[y])this.state[y][b]||(this.state[y][b]={}),Object.assign(this.state[y][b],this.stateChanges[y][b]),x[b]=this.state[y][b];p[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const b in this.state[y])x[b]={},this.state[y][b]={};else for(const b in this.deletedStates[y]){if(this.deletedStates[y][b]===null)this.state[y][b]={};else if(this.state[y][b])for(const T of Object.keys(this.deletedStates[y][b]))delete this.state[y][b][T];x[b]=this.state[y][b]}p[y]=p[y]||{},Object.assign(p[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const y in n)n[y].refreshFeatureState(l)}}class Oo extends o.E{constructor(n,l,p){super(),this.id=n,this._onlySymbols=p,l.on("data",y=>{y.dataType==="source"&&y.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&y.dataType==="source"&&y.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),l.on("error",()=>{this._sourceErrored=!0}),this._source=l,this._tiles={},this._cache=new N0(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new mh,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(n){this.map=n,this._minTileCacheSize=this._minTileCacheSize===void 0&&n?n._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&n?n._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const n in this._tiles)if(!this._tiles[n].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const n=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,n&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(n,l){return n.isSymbolTile=this._onlySymbols,n.isExtraShadowCaster=this._shadowCasterTiles[n.tileID.key],this._source.loadTile(n,l)}_unloadTile(n){if(this._source.unloadTile)return this._source.unloadTile(n)}_abortTile(n){if(this._source.abortTile)return this._source.abortTile(n)}serialize(){return this._source.serialize()}prepare(n){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const l in this._tiles){const p=this._tiles[l];p.upload(n,this.map?this.map.painter:void 0),p.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(n=>n.tileID).sort(ep).map(n=>n.key)}getRenderableIds(n,l){const p=[];for(const y in this._tiles)this._isIdRenderable(+y,n,l)&&p.push(this._tiles[y]);return n?p.sort((y,x)=>{const b=y.tileID,T=x.tileID,A=new o.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),M=new o.P(T.canonical.x,T.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-T.overscaledZ||M.y-A.y||M.x-A.x}).map(y=>y.tileID.key):p.map(y=>y.tileID).sort(ep).map(y=>y.key)}hasRenderableParent(n){const l=this.findLoadedParent(n,0);return!!l&&this._isIdRenderable(l.tileID.key)}_isIdRenderable(n,l,p){return this._tiles[n]&&this._tiles[n].hasData()&&!this._coveredTiles[n]&&(l||!this._tiles[n].holdingForFade())&&(p||!this._shadowCasterTiles[n])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const n in this._tiles)this._tiles[n].state!=="errored"&&this._reloadTile(+n,"reloading")}}_reloadTile(n,l){const p=this._tiles[n];p&&(p.state!=="loading"&&(p.state=l),this._loadTile(p,this._tileLoaded.bind(this,p,n,l)))}_tileLoaded(n,l,p,y,x){if(y){if(n.state="errored",y.status!==404)this._source.fire(new o.y(y,{tile:n}));else{if(this._source.fire(new o.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:n})),!(n.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const T=this.map.painter.terrain;this.update(this.transform,T.getScaledDemTileSize(),!0),T.resetTileLookupCache(this.id)}else this.update(this.transform)}return}n.timeAdded=o.o.now(),p==="expired"&&(n.refreshedUponExpiration=!0),this._setTileReloadTimer(l,n),this._source.type==="raster-dem"&&n.dem&&this._backfillDEM(n),this._state.initializeTileState(n,this.map?this.map.painter:null);let b=new Map;x&&x.responseHeaders&&(b=x.responseHeaders),this._source.fire(new o.z("data",{dataType:"source",tile:n,coord:n.tileID,sourceCacheId:this.id,responseHeaders:b}))}_backfillDEM(n){const l=this.getRenderableIds();for(let y=0;y<l.length;y++){const x=l[y];if(n.neighboringTiles&&n.neighboringTiles[x]){const b=this.getTileByID(x);p(n,b),p(b,n)}}function p(y,x){if(!y.dem||y.dem.borderReady)return;y.needsHillshadePrepare=!0,y.needsDEMTextureUpload=!0;let b=x.tileID.canonical.x-y.tileID.canonical.x;const T=x.tileID.canonical.y-y.tileID.canonical.y,A=Math.pow(2,y.tileID.canonical.z),M=x.tileID.key;b===0&&T===0||Math.abs(T)>1||(Math.abs(b)>1&&(Math.abs(b+A)===1?b+=A:Math.abs(b-A)===1&&(b-=A)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,b,T),y.neighboringTiles&&y.neighboringTiles[M]&&(y.neighboringTiles[M].backfilled=!0)))}}getTile(n){return this.getTileByID(n.key)}getTileByID(n){return this._tiles[n]}_retainLoadedChildren(n,l,p,y){for(const x in this._tiles){let b=this._tiles[x];if(y[x]||!b.hasData()||b.tileID.overscaledZ<=l||b.tileID.overscaledZ>p)continue;let T=b.tileID;for(;b&&b.tileID.overscaledZ>l+1;){const M=b.tileID.scaledTo(b.tileID.overscaledZ-1);b=this._tiles[M.key],b&&b.hasData()&&(T=M)}let A=T;for(;A.overscaledZ>l;)if(A=A.scaledTo(A.overscaledZ-1),n[A.key]){y[T.key]=T;break}}}findLoadedParent(n,l){if(n.key in this._loadedParentTiles){const p=this._loadedParentTiles[n.key];return p&&p.tileID.overscaledZ>=l?p:null}for(let p=n.overscaledZ-1;p>=l;p--){const y=n.scaledTo(p),x=this._getLoadedTile(y);if(x)return x}}_getLoadedTile(n){const l=this._tiles[n.key];return l&&l.hasData()?l:this._cache.getByKey(this._source.reparseOverscaled?n.wrapped().key:n.canonical.key)}updateCacheSize(n,l){l=l||this._source.tileSize;const p=Math.ceil(n.width/l)+1,y=Math.ceil(n.height/l)+1,x=Math.floor(p*y*5),b=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,x):x,T=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,b):b;this._cache.setMaxSize(T)}handleWrapJump(n){const l=Math.round((n-(this._prevLng===void 0?n:this._prevLng))/360);if(this._prevLng=n,l){const p={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+l),p[x.tileID.key]=x}this._tiles=p;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(+y,this._tiles[y])}}update(n,l,p,y,x){if(this.transform=n,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!p)return;this.updateCacheSize(n,l),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const b=this._source.type==="batched-model";let T,A=this._source.maxzoom;const M=this.map&&this.map.painter?this.map.painter._terrain:null;if(M&&M.sourceCache===this&&M.attenuationRange()){const B=M.attenuationRange()[0],j=Math.floor(B)-Math.log2(M.getDemUpscale());A>j&&(A=j)}if(this.used||this.usedForTerrain){if(this._source.tileID)T=n.getVisibleUnwrappedCoordinates(this._source.tileID).map(B=>new o.aQ(B.canonical.z,B.wrap,B.canonical.z,B.canonical.x,B.canonical.y));else if(this.tileCoverLift!==0){const B=n.clone();B.tileCoverLift=this.tileCoverLift,T=B.coveringTiles({tileSize:l||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:A,roundZoom:this._source.roundZoom&&!p,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:b}),this._source.minzoom<=1&&n.projection.name==="globe"&&(T.push(new o.aQ(1,0,1,0,0)),T.push(new o.aQ(1,0,1,1,0)),T.push(new o.aQ(1,0,1,0,1)),T.push(new o.aQ(1,0,1,1,1)))}else if(T=n.coveringTiles({tileSize:l||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:A,roundZoom:this._source.roundZoom&&!p,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:b}),this._source.hasTile){const B=this._source.hasTile.bind(this._source);T=T.filter(j=>B(j))}}else T=[];if(T.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!nu(this._source.type)){const B=n.coveringZoomLevel({tileSize:l||this._source.tileSize,roundZoom:this._source.roundZoom&&!p}),j=Math.min(B,this._source.maxzoom);if(b){const H=n.extendTileCover(T,j);for(const G of H)T.push(G)}else if(x){const H=n.extendTileCoverToNearPlane(T,this.transform.getFrustum(j),j);for(const G of H)T.push(G)}else if(this.castsShadows&&y){const H=n.extendTileCover(T,j,y,16);for(const G of H)this._shadowCasterTiles[G.key]=!0,T.push(G)}}const D=this._updateRetainedTiles(T);if(nu(this._source.type)&&T.length!==0){const B={},j={},H=Object.keys(D);for(const Q of H){const J=D[Q],ae=this._tiles[Q];if(!ae||ae.fadeEndTime&&ae.fadeEndTime<=o.o.now())continue;const de=this.findLoadedParent(J,Math.max(J.overscaledZ-Oo.maxOverzooming,this._source.minzoom));de&&(this._addTile(de.tileID),B[de.tileID.key]=de.tileID),j[Q]=J}const G=T[T.length-1].overscaledZ;for(const Q in this._tiles){const J=this._tiles[Q];if(D[Q]||!J.hasData())continue;let ae=J.tileID;for(;ae.overscaledZ>G;){ae=ae.scaledTo(ae.overscaledZ-1);const de=this._tiles[ae.key];if(de&&de.hasData()&&j[ae.key]){D[Q]=J.tileID;break}}}for(const Q in B)D[Q]||(this._coveredTiles[Q]=!0,D[Q]=B[Q])}for(const B in D)this._tiles[B].clearFadeHold();const N=o.bv(this._tiles,D);for(const B of N){const j=this._tiles[B];j.hasSymbolBuckets&&!j.holdingForFade()?j.setHoldDuration(this.map._fadeDuration):j.hasSymbolBuckets&&!j.symbolFadeFinished()||this._removeTile(+B)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const n in this._tiles)this._tiles[n].holdingForFade()&&this._removeTile(+n)}_updateRetainedTiles(n){const l={};if(n.length===0)return l;const p={},y=n.reduce((M,D)=>Math.min(M,D.overscaledZ),1/0),x=n[0].overscaledZ,b=Math.max(x-Oo.maxOverzooming,this._source.minzoom),T=Math.max(x+Oo.maxUnderzooming,this._source.minzoom),A={};for(const M of n){const D=this._addTile(M);l[M.key]=M,D.hasData()||y<this._source.maxzoom&&(A[M.key]=M)}this._retainLoadedChildren(A,y,T,l);for(const M of n){let D=this._tiles[M.key];if(D.hasData())continue;if(M.canonical.z>=this._source.maxzoom){const B=M.children(this._source.maxzoom)[0],j=this.getTile(B);if(j&&j.hasData()){l[B.key]=B;continue}}else{const B=M.children(this._source.maxzoom);if(l[B[0].key]&&l[B[1].key]&&l[B[2].key]&&l[B[3].key])continue}let N=D.wasRequested();for(let B=M.overscaledZ-1;B>=b;--B){const j=M.scaledTo(B);if(p[j.key]||(p[j.key]=!0,D=this.getTile(j),!D&&N&&(D=this._addTile(j)),D&&(l[j.key]=j,N=D.wasRequested(),D.hasData())))break}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const n in this._tiles){const l=[];let p,y=this._tiles[n].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){p=this._loadedParentTiles[y.key];break}l.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(p=this._getLoadedTile(x),p)break;y=x}for(const x of l)this._loadedParentTiles[x]=p}}_addTile(n){let l=this._tiles[n.key];if(l)return l.isExtraShadowCaster!==!0||this._shadowCasterTiles[n.key]||this._reloadTile(n.key,"reloading"),l;l=this._cache.getAndRemove(n),l&&(this._setTileReloadTimer(n.key,l),l.tileID=n,this._state.initializeTileState(l,this.map?this.map.painter:null),this._cacheTimers[n.key]&&(clearTimeout(this._cacheTimers[n.key]),delete this._cacheTimers[n.key],this._setTileReloadTimer(n.key,l)));const p=!!l;if(!p){const y=this.map?this.map.painter:null,x=this._source.tileSize*n.overscaleFactor();l=this._source.type==="raster-array"?new Qf(n,x,this.transform.tileZoom,y,this._isRaster):new ru(n,x,this.transform.tileZoom,y,this._isRaster,this._source.worldview),this._loadTile(l,this._tileLoaded.bind(this,l,n.key,l.state))}return l.uses++,this._tiles[n.key]=l,p||this._source.fire(new o.z("dataloading",{tile:l,coord:l.tileID,dataType:"source"})),l}_setTileReloadTimer(n,l){n in this._timers&&(clearTimeout(this._timers[n]),delete this._timers[n]);const p=l.getExpiryTimeout();p&&(this._timers[n]=setTimeout(()=>{this._reloadTile(n,"expired"),delete this._timers[n]},p))}_removeTile(n){const l=this._tiles[n];l&&(l.uses--,delete this._tiles[n],this._timers[n]&&(clearTimeout(this._timers[n]),delete this._timers[n]),l.uses>0||(l.hasData()&&l.state!=="reloading"||l.state==="empty"?this._cache.add(l.tileID,l,l.getExpiryTimeout()):(l.aborted=!0,this._abortTile(l),this._unloadTile(l))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const n in this._tiles)this._removeTile(+n);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(n,l,p){const y=[],x=this.transform;if(!x)return y;const b=x.projection.name==="globe",T=o.aF(x.center.lng);for(const A in this._tiles){const M=this._tiles[A];if(p&&M.clearQueryDebugViz(),M.holdingForFade())continue;let D;if(b){const N=M.tileID.canonical;if(N.z===0){const B=[Math.abs(o.aA(T,...El(N,-1))-T),Math.abs(o.aA(T,...El(N,1))-T)];D=[0,2*B.indexOf(Math.min(...B))-1]}else{const B=[Math.abs(o.aA(T,...El(N,-1))-T),Math.abs(o.aA(T,...El(N,0))-T),Math.abs(o.aA(T,...El(N,1))-T)];D=[B.indexOf(Math.min(...B))-1]}}else D=[0];for(const N of D){const B=n.containsTile(M,x,l,N);B&&y.push(B)}}return y}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(n){return this._getRenderableCoordinates(n)}_getRenderableCoordinates(n,l){const p=this.getRenderableIds(n,l).map(x=>this._tiles[x].tileID),y=this.transform.projection.name==="globe";for(const x of p)x.projMatrix=this.transform.calculateProjMatrix(x.toUnwrapped()),x.expandedProjMatrix=y?this.transform.calculateProjMatrix(x.toUnwrapped(),!1,!0):x.projMatrix;return p}sortCoordinatesByDistance(n){const l=n.slice(),p=this.transform._camera.position,y=this.transform._camera.forward(),x={};for(const b of l){const T=1/(1<<b.canonical.z);x[b.key]=((b.canonical.x+.5)*T+b.wrap-p[0])*y[0]+((b.canonical.y+.5)*T-p[1])*y[1]-p[2]*y[2]}return l.sort((b,T)=>x[b.key]-x[T.key]),l}hasTransition(){if(this._source.hasTransition())return!0;if(nu(this._source.type))for(const n in this._tiles){const l=this._tiles[n];if(l.fadeEndTime!==void 0&&l.fadeEndTime>=o.o.now())return!0}return!1}setFeatureState(n,l,p){this._state.updateState(n=n||"_geojsonTileLayer",l,p)}removeFeatureState(n,l,p){this._state.removeFeatureState(n=n||"_geojsonTileLayer",l,p)}getFeatureState(n,l){return this._state.getState(n=n||"_geojsonTileLayer",l)}setDependencies(n,l,p){const y=this._tiles[n];y&&y.setDependencies(l,p)}reloadTilesForDependencies(n,l){for(const p in this._tiles)this._tiles[p].hasDependency(n,l)&&this._reloadTile(+p,"reloading");this._cache.filter(p=>!p.hasDependency(n,l))}_preloadTiles(n,l){if(!this._sourceLoaded){const A=()=>{this._sourceLoaded&&(this._source.off("data",A),this._preloadTiles(n,l))};return void this._source.on("data",A)}const p=new Map,y=Array.isArray(n)?n:[n],x=this.map.painter.terrain,b=this.usedForTerrain&&x?x.getScaledDemTileSize():this._source.tileSize;for(const A of y){const M=A.coveringTiles({tileSize:b,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 M)p.set(D.key,D);this.usedForTerrain&&A.updateElevation(!1)}const T=Array.from(p.values());o.bw(T,(A,M)=>{const D=new ru(A,this._source.tileSize*A.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(D,N=>{this._source.type==="raster-dem"&&D.dem&&this._backfillDEM(D),M(N,D)})},l)}}function ep(f,n){const l=Math.abs(2*f.wrap)-+(f.wrap<0),p=Math.abs(2*n.wrap)-+(n.wrap<0);return f.overscaledZ-n.overscaledZ||p-l||n.canonical.y-f.canonical.y||n.canonical.x-f.canonical.x}function nu(f){return f==="raster"||f==="image"||f==="video"||f==="custom"}function El(f,n){const l=1<<f.z;return[f.x/l+n,(f.x+1)/l+n]}Oo.maxOverzooming=10,Oo.maxUnderzooming=3;class vS{constructor(n){this.style=n,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const n=!1,l=!1;for(const p in this.style._mergedLayers){const y=this.style._mergedLayers[p];if(y.type==="fill-extrusion"||y.type==="building")this.layers.push({layer:y,visible:n,visibilityChanged:l});else if(y.type==="model"){const x=this.style.getLayerSource(y);x&&x.type==="batched-model"&&this.layers.push({layer:y,visible:n,visibilityChanged:l})}}}onNewFrame(n){this.layersGotHidden=!1;for(const l of this.layers){const p=l.layer;let y=!1;p.type==="fill-extrusion"?y=!p.isHidden(n)&&p.paint.get("fill-extrusion-opacity")>0:p.type==="building"?y=!p.isHidden(n)&&p.paint.get("building-opacity")>0:p.type==="model"&&(y=!p.isHidden(n)&&p.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!y&&l.visible,l.visible=y}}updateZOffset(n,l){this.currentBuildingBuckets=[];for(const y of this.layers){const x=y.layer,b=this.style.getLayerSourceCache(x);let T=1;x.type==="fill-extrusion"?T=y.visible?x.paint.get("fill-extrusion-vertical-scale"):0:x.type==="building"&&(T=y.visible?x.paint.get("building-vertical-scale"):0);let A=b?b.getTile(l):null;if(!A&&b)for(const M in b._tiles){const D=b._tiles[M];if(l.canonical.isChildOf(D.tileID.canonical)){A=D;break}}this.currentBuildingBuckets.push({bucket:A?A.getBucket(x):null,tileID:A?A.tileID:l,verticalScale:T})}n.hasAnyZOffset=!1;let p=!1;for(let y=0;y<n.symbolInstances.length;y++){const x=n.symbolInstances.get(y),b=x.zOffset,T=this._getHeightAtTileOffset(l,x.tileAnchorX,x.tileAnchorY);x.zOffset=T!==Number.NEGATIVE_INFINITY?T:b,p||b===x.zOffset||(p=!0),n.hasAnyZOffset||x.zOffset===0||(n.hasAnyZOffset=!0)}p&&(n.zOffsetBuffersNeedUpload=!0,n.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(n,l,p,y){let x=l,b=p;if(n.canonical.z!==y.canonical.z){const T=y.canonical,A=1/(1<<n.canonical.z-T.z);x=(l+n.canonical.x*o.al)*A-T.x*o.al|0,b=(p+n.canonical.y*o.al)*A-T.y*o.al|0}return{tileX:x,tileY:b}}_getHeightAtTileOffset(n,l,p){let y,x;for(let b=0;b<this.layers.length;++b){const T=this.layers[b].layer;if(T.type!=="fill-extrusion"&&T.type!=="building")continue;const{bucket:A,tileID:M,verticalScale:D}=this.currentBuildingBuckets[b];if(!A)continue;const{tileX:N,tileY:B}=this._mapCoordToOverlappingTile(n,l,p,M),j=A.getHeightAtTileCoord(N,B);j&&j.height!==void 0&&(j.hidden?y=j.height:x=Math.max(j.height*D,x||0))}if(x!==void 0)return x;for(let b=0;b<this.layers.length;++b){const T=this.layers[b];if(T.layer.type!=="model"||!T.visible)continue;const{bucket:A,tileID:M}=this.currentBuildingBuckets[b];if(!A)continue;const{tileX:D,tileY:N}=this._mapCoordToOverlappingTile(n,l,p,M),B=A.getHeightAtTileCoord(D,N);if(B&&!B.hidden)return B.height===void 0&&y!==void 0?Math.min(B.maxHeight,y)*B.verticalScale:B.height?B.height*B.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function j0(f,n){const l={};for(const p in f)p!=="ref"&&(l[p]=f[p]);return o.bx.forEach(p=>{p in n&&(l[p]=n[p])}),l}function gh(f){f=f.slice();const n=Object.create(null);for(let l=0;l<f.length;l++)n[f[l].id]=f[l];for(let l=0;l<f.length;l++)"ref"in f[l]&&(f[l]=j0(f[l],n[f[l].ref]));return f}const nn={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 tp(f,n,l){l.push({command:nn.addSource,args:[f,n[f]]})}function l_(f,n,l){n.push({command:nn.removeSource,args:[f]}),l[f]=!0}function V0(f,n,l,p){l_(f,l,p),tp(f,n,l)}function U0(f,n,l){let p;for(p in f[l])if(f[l].hasOwnProperty(p)&&p!=="data"&&!o.by(f[l][p],n[l][p]))return!1;for(p in n[l])if(n[l].hasOwnProperty(p)&&p!=="data"&&!o.by(f[l][p],n[l][p]))return!1;return!0}function mc(f,n,l,p,y,x){let b;for(b in n=n||{},f=f||{})f.hasOwnProperty(b)&&(o.by(f[b],n[b])||l.push({command:x,args:[p,b,n[b],y]}));for(b in n)n.hasOwnProperty(b)&&!f.hasOwnProperty(b)&&(o.by(f[b],n[b])||l.push({command:x,args:[p,b,n[b],y]}))}function _h(f){return f.id}function yh(f,n){return f[n.id]=n,f}function c_(f,n,l){const p=n.createTileMatrix(f,f.worldSize,l.toUnwrapped());return o.aB(new Float32Array(16),f.projMatrix,p)}function rp(f,n,l){if(n.projection.name===l.projection.name)return f.projMatrix;const p=l.clone();return p.setProjection(n.projection),c_(p,n.getProjection(),f)}function rl(f,n,l){return n.name===l.projection.name?f.projMatrix:c_(l,n,f)}class vh{constructor(n,l){this.reset(n,l)}reset(n,l){this.points=n||[],this._distances=[0];for(let p=1;p<this.points.length;p++)this._distances[p]=this._distances[p-1]+this.points[p].dist(this.points[p-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(l||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(n){if(this.points.length===1)return this.points[0];n=o.aA(n,0,1);let l=1,p=this._distances[l];const y=n*this.paddedLength+this.padding;for(;p<y&&l<this._distances.length;)p=this._distances[++l];const x=l-1,b=this._distances[x],T=p-b,A=T>0?(y-b)/T:0;return this.points[x].mult(1-A).add(this.points[l].mult(A))}}class u_{constructor(n,l,p){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(n/p),this.yCellCount=Math.ceil(l/p);for(let b=0;b<this.xCellCount*this.yCellCount;b++)y.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=n,this.height=l,this.xScale=this.xCellCount/n,this.yScale=this.yCellCount/l,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(n,l,p,y,x){this._forEachCell(l,p,y,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(n),this.bboxes.push(l),this.bboxes.push(p),this.bboxes.push(y),this.bboxes.push(x)}insertCircle(n,l,p,y){this._forEachCell(l-y,p-y,l+y,p+y,this._insertCircleCell,this.circleUid++),this.circleKeys.push(n),this.circles.push(l),this.circles.push(p),this.circles.push(y)}_insertBoxCell(n,l,p,y,x,b){this.boxCells[x].push(b)}_insertCircleCell(n,l,p,y,x,b){this.circleCells[x].push(b)}_query(n,l,p,y,x,b){if(p<0||n>this.width||y<0||l>this.height)return!x&&[];const T=[];if(n<=0&&l<=0&&this.width<=p&&this.height<=y){if(x)return!0;for(let A=0;A<this.boxKeys.length;A++)T.push({key:this.boxKeys[A],x1:this.bboxes[4*A],y1:this.bboxes[4*A+1],x2:this.bboxes[4*A+2],y2:this.bboxes[4*A+3]});for(let A=0;A<this.circleKeys.length;A++){const M=this.circles[3*A],D=this.circles[3*A+1],N=this.circles[3*A+2];T.push({key:this.circleKeys[A],x1:M-N,y1:D-N,x2:M+N,y2:D+N})}return b?T.filter(b):T}return this._forEachCell(n,l,p,y,this._queryCell,T,{hitTest:x,seenUids:{box:{},circle:{}}},b),x?T.length>0:T}_queryCircle(n,l,p,y,x){const b=n-p,T=n+p,A=l-p,M=l+p;if(T<0||b>this.width||M<0||A>this.height)return!y&&[];const D=[];return this._forEachCell(b,A,T,M,this._queryCellCircle,D,{hitTest:y,circle:{x:n,y:l,radius:p},seenUids:{box:{},circle:{}}},x),y?D.length>0:D}query(n,l,p,y,x){return this._query(n,l,p,y,!1,x)}hitTest(n,l,p,y,x){return this._query(n,l,p,y,!0,x)}hitTestCircle(n,l,p,y){return this._queryCircle(n,l,p,!0,y)}_queryCell(n,l,p,y,x,b,T,A){const M=T.seenUids,D=this.boxCells[x];if(D!==null){const B=this.bboxes;for(const j of D)if(!M.box[j]){M.box[j]=!0;const H=4*j;if(n<=B[H+2]&&l<=B[H+3]&&p>=B[H+0]&&y>=B[H+1]&&(!A||A(this.boxKeys[j]))){if(T.hitTest)return b.push(!0),!0;b.push({key:this.boxKeys[j],x1:B[H],y1:B[H+1],x2:B[H+2],y2:B[H+3]})}}}const N=this.circleCells[x];if(N!==null){const B=this.circles;for(const j of N)if(!M.circle[j]){M.circle[j]=!0;const H=3*j;if(this._circleAndRectCollide(B[H],B[H+1],B[H+2],n,l,p,y)&&(!A||A(this.circleKeys[j]))){if(T.hitTest)return b.push(!0),!0;{const G=B[H],Q=B[H+1],J=B[H+2];b.push({key:this.circleKeys[j],x1:G-J,y1:Q-J,x2:G+J,y2:Q+J})}}}}}_queryCellCircle(n,l,p,y,x,b,T,A){const M=T.circle,D=T.seenUids,N=this.boxCells[x];if(N!==null){const j=this.bboxes;for(const H of N)if(!D.box[H]){D.box[H]=!0;const G=4*H;if(this._circleAndRectCollide(M.x,M.y,M.radius,j[G+0],j[G+1],j[G+2],j[G+3])&&(!A||A(this.boxKeys[H])))return b.push(!0),!0}}const B=this.circleCells[x];if(B!==null){const j=this.circles;for(const H of B)if(!D.circle[H]){D.circle[H]=!0;const G=3*H;if(this._circlesCollide(j[G],j[G+1],j[G+2],M.x,M.y,M.radius)&&(!A||A(this.circleKeys[H])))return b.push(!0),!0}}}_forEachCell(n,l,p,y,x,b,T,A){const M=this._convertToXCellCoord(n),D=this._convertToYCellCoord(l),N=this._convertToXCellCoord(p),B=this._convertToYCellCoord(y);for(let j=M;j<=N;j++)for(let H=D;H<=B;H++)if(x.call(this,n,l,p,y,this.xCellCount*H+j,b,T,A))return}_convertToXCellCoord(n){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(n*this.xScale)))}_convertToYCellCoord(n){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(n*this.yScale)))}_circlesCollide(n,l,p,y,x,b){const T=y-n,A=x-l,M=p+b;return M*M>T*T+A*A}_circleAndRectCollide(n,l,p,y,x,b,T){const A=(b-y)/2,M=Math.abs(n-(y+A));if(M>A+p)return!1;const D=(T-x)/2,N=Math.abs(l-(x+D));if(N>D+p)return!1;if(M<=A||N<=D)return!0;const B=M-A,j=N-D;return B*B+j*j<=p*p}}const gc={unknown:0,flipRequired:1,flipNotRequired:2},iu=Math.tan(85*Math.PI/180);function Js(f,n,l,p,y,x,b){const T=o.bC();if(l)if(x.name==="globe"){const A=o.bD(y,n);o.aB(T,T,A)}else{const A=o.bE([],b);T[0]=A[0],T[1]=A[1],T[4]=A[2],T[5]=A[3],p||o.bB(T,T,y.angle)}else o.aB(T,y.labelPlaneMatrix,f);return T}function np(f,n,l,p,y,x,b){const T=Js(f,n,l,p,y,x,b);return x.name==="globe"&&l||(T[2]=T[6]=T[10]=T[14]=0),T}function xh(f,n,l,p,y,x,b){if(l){if(x.name==="globe"){const T=Js(f,n,l,p,y,x,b);return o.bl(T,T),o.aB(T,f,T),T}{const T=o.bz(f),A=o.bA([]);return A[0]=b[0],A[1]=b[1],A[4]=b[2],A[5]=b[3],o.aB(T,T,A),p||o.bB(T,T,-y.angle),T}}return y.glCoordMatrix}function ha(f,n,l,p){const y=[f,n,l,1];l?o.aC(y,y,p):Qt(y,y,p);const x=y[3];return y[0]/=x,y[1]/=x,y[2]/=x,y}function wn(f,n){return Math.min(.5+f/n*.5,1.5)}function $0(f,n){const l=f[0]/f[3],p=f[1]/f[3];return l>=-n[0]&&l<=n[0]&&p>=-n[1]&&p<=n[1]}function G0(f,n,l,p,y,x,b,T,A,M,D=1){const N=l.transform,B=p?f.textSizeData:f.iconSizeData,j=o.bK(B,l.transform.zoom,D),H=N.projection.name==="globe",G=[256/l.width*2+1,256/l.height*2+1],Q=p?f.text.dynamicLayoutVertexArray:f.icon.dynamicLayoutVertexArray;Q.clear();let J=null;H&&(J=p?f.text.globeExtVertexArray:f.icon.globeExtVertexArray);const ae=f.lineVertexArray,de=p?f.text.placedSymbolArray:f.icon.placedSymbolArray,ce=l.transform.width/l.transform.height;let Se,ye=!1;for(let we=0;we<de.length;we++){const _e=de.get(we),{numGlyphs:pe,writingMode:Te}=_e;if(Te!==o.bL.vertical||ye||Se===o.bL.horizontal||(ye=!0),Se=Te,(_e.hidden||Te===o.bL.vertical)&&!ye){Ra(pe,Q);continue}ye=!1;const De=new o.P(_e.tileAnchorX,_e.tileAnchorY),Me=f.elevationType==="road",Ge=!!N.elevation||Me;let{x:He,y:et,z:mt}=N.projection.projectTilePoint(De.x,De.y,M.canonical),Ne=null;if(Ge){const Bt=Me?f.getElevationFeatureForText(we):null;Ne={getElevation:A,elevation:N.elevation,elevationFeature:Bt};const[nr,xr,Ur]=A(De,N.elevation,Bt);He+=nr,et+=xr,mt+=Ur}const Ce=[He,et,mt,1];if(o.aC(Ce,Ce,n),!$0(Ce,G)){Ra(pe,Q);continue}const Ke=Ce[3],Ve=wn(l.transform.getCameraToCenterDistance(N.projection),Ke),ot=o.bM(B,j,_e),Tt=b?ot/Ve:ot*Ve,zt=ha(He,et,mt,y);if(zt[3]<=0){Ra(pe,Q);continue}let wt={};const gt=o.an(f.layers[0].layout.get("text-max-angle")),Kt=Math.cos(gt),$t=b?null:Ne,Dt=d_(_e,Tt,!1,T,n,y,x,f.glyphOffsetArray,ae,Q,J,zt,De,wt,ce,$t,N.projection,M,b,Kt);ye=Dt.useVertical,$t&&Dt.needsFlipping&&(wt={}),(Dt.notEnoughRoom||ye||Dt.needsFlipping&&d_(_e,Tt,!0,T,n,y,x,f.glyphOffsetArray,ae,Q,J,zt,De,wt,ce,$t,N.projection,M,b,Kt).notEnoughRoom)&&Ra(pe,Q)}p?(f.text.dynamicLayoutVertexBuffer.updateData(Q),J&&f.text.globeExtVertexBuffer&&f.text.globeExtVertexBuffer.updateData(J)):(f.icon.dynamicLayoutVertexBuffer.updateData(Q),J&&f.icon.globeExtVertexBuffer&&f.icon.globeExtVertexBuffer.updateData(J))}function H0(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q){const{lineStartIndex:J,glyphStartIndex:ae,segment:de}=T,ce=ae+T.numGlyphs,Se=J+T.lineLength,ye=n.getoffsetX(ae),we=n.getoffsetX(ce-1),_e=qu(f*ye,l,p,y,x,b,de,J,Se,A,M,D,N,B,!0,j,H,G,Q);if(!_e)return null;const pe=qu(f*we,l,p,y,x,b,de,J,Se,A,M,D,N,B,!0,j,H,G,Q);return pe?{first:_e,last:pe}:null}function ur(f,n,l,p){return f===o.bL.horizontal&&Math.abs(p)>Math.abs(l)?{useVertical:!0}:f===o.bL.vertical?p>0?{needsFlipping:!0}:null:n!==gc.unknown&&function(y,x){return y===0||Math.abs(x/y)>iu}(l,p)?n===gc.flipRequired?{needsFlipping:!0}:null:l<0?{needsFlipping:!0}:null}function d_(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J,ae,de){const ce=n/24,Se=f.lineOffsetX*ce,ye=f.lineOffsetY*ce,{lineStartIndex:we,glyphStartIndex:_e,numGlyphs:pe,segment:Te,writingMode:De,flipState:Me}=f,Ge=we+f.lineLength,He=et=>{if(D){const[Ke,Ve,ot]=et.up,Tt=M.length;o.bN(D,Tt+0,Ke,Ve,ot),o.bN(D,Tt+1,Ke,Ve,ot),o.bN(D,Tt+2,Ke,Ve,ot),o.bN(D,Tt+3,Ke,Ve,ot)}const[mt,Ne,Ce]=et.point;o.bO(M,mt,Ne,Ce,et.angle)};if(pe>1){const et=H0(ce,T,Se,ye,l,N,B,f,A,x,j,G,!1,Q,J,ae,de);if(!et)return{notEnoughRoom:!0};if(p&&!l){let[mt,Ne,Ce]=et.first.point,[Ke,Ve,ot]=et.last.point;[mt,Ne]=ha(mt,Ne,Ce,b),[Ke,Ve]=ha(Ke,Ve,ot,b);const Tt=ur(De,Me,(Ke-mt)*H,Ve-Ne);if(f.flipState=Tt&&Tt.needsFlipping?gc.flipRequired:gc.flipNotRequired,Tt)return Tt}He(et.first);for(let mt=_e+1;mt<_e+pe-1;mt++){const Ne=qu(ce*T.getoffsetX(mt),Se,ye,l,N,B,Te,we,Ge,A,x,j,G,!1,!1,Q,J,ae,de);if(!Ne)return M.length-=4*(mt-_e),{notEnoughRoom:!0};He(Ne)}He(et.last)}else{if(p&&!l){const mt=ha(B.x,B.y,0,y),Ne=we+Te+1,Ce=new o.P(A.getx(Ne),A.gety(Ne)),Ke=ha(Ce.x,Ce.y,0,y),Ve=Ke[3]>0?Ke:fa(B,Ce,mt,1,y,void 0,Q,J.canonical),ot=ur(De,Me,(Ve[0]-mt[0])*H,Ve[1]-mt[1]);if(f.flipState=ot&&ot.needsFlipping?gc.flipRequired:gc.flipNotRequired,ot)return ot}const et=qu(ce*T.getoffsetX(_e),Se,ye,l,N,B,Te,we,Ge,A,x,j,G,!1,!1,Q,J,ae,de);if(!et)return{notEnoughRoom:!0};He(et)}return{}}function wh(f,n,l,p,y){const{x,y:b,z:T}=p.projectTilePoint(f.x,f.y,n);if(!y)return ha(x,b,T,l);const[A,M,D]=y.getElevation(f,y.elevation,y.elevationFeature);return ha(x+A,b+M,T+D,l)}function fa(f,n,l,p,y,x,b,T){const A=wh(f.sub(n)._unit()._add(f),T,y,b,x);return o.av(A,l,A),o.aw(A,A),o.bH(A,l,A,p)}function qu(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J,ae){const de=p?f-n:f+n;let ce=de>0?1:-1,Se=0;p&&(ce*=-1,Se=Math.PI),ce<0&&(Se+=Math.PI);let ye=T+b+(ce>0?0:1)|0,we=y,_e=y,pe=0,Te=0;const De=Math.abs(de),Me=[],Ge=[];let He=x,et=He,mt=o.bF([]);const Ne=()=>fa(et,He,_e,De-pe+1,D,B,G,Q.canonical);for(;pe+Te<=De;){if(ye+=ce,ye<T||ye>=A)return null;if(_e=we,et=He,Me.push(_e),j&&Ge.push(et),He=new o.P(M.getx(ye),M.gety(ye)),we=N[ye],!we){const $t=wh(He,Q.canonical,D,G,B);we=$t[3]>0?N[ye]=$t:Ne()}pe+=Te;const gt=o.av([],we,_e),Kt=o.bG(_e,we);if(l&&Kt>0&&Te>0&&o.bJ(mt,gt)/(Te*Kt)<ae)return null;Te=Kt,mt=gt}H&&B&&(N[ye]&&(we=Ne(),Te=o.bG(_e,we),mt=o.av([],we,_e)),N[ye]=we);const Ce=(De-pe)/Te,Ke=He.sub(et)._mult(Ce)._add(et),Ve=o.bH([],_e,mt,Ce);let ot=[0,0,1],Tt=mt[0],zt=mt[1];if(J&&(ot=G.upVector(Q.canonical,Ke.x,Ke.y),ot[0]!==0||ot[1]!==0||ot[2]!==1)){const gt=[ot[2],0,-ot[0]],Kt=o.bI([],ot,gt);o.aw(gt,gt),o.aw(Kt,Kt),Tt=o.bJ(mt,gt),zt=o.bJ(mt,Kt)}if(l){const gt=o.bI([],ot,mt);o.aw(gt,gt),o.bH(Ve,Ve,gt,l*ce)}const wt=Se+Math.atan2(zt,Tt);return Me.push(Ve),j&&Ge.push(Ke),{point:Ve,angle:wt,path:Me,tilePath:Ge,up:ot}}function Ra(f,n){const l=n.length,p=l+4*f;n.resize(p),n.float32.fill(-1/0,4*l,4*p)}function Qt(f,n,l){const p=n[0],y=n[1];return f[0]=l[0]*p+l[4]*y+l[12],f[1]=l[1]*p+l[5]*y+l[13],f[3]=l[3]*p+l[7]*y+l[15],f}const Xr=100;class kn{constructor(n,l,p=new u_(n.width+200,n.height+200,25),y=new u_(n.width+200,n.height+200,25)){this.transform=n,this.grid=p,this.ignoredGrid=y,this.pitchfactor=Math.cos(n._pitch)*n.cameraToCenterDistance,this.screenRightBoundary=n.width+Xr,this.screenBottomBoundary=n.height+Xr,this.gridRightBoundary=n.width+200,this.gridBottomBoundary=n.height+200,this.fogState=l}placeCollisionBox(n,l,p,y,x,b,T,A,M,D,N){let B=p.projectedAnchorX,j=p.projectedAnchorY,H=p.projectedAnchorZ;const G=p.tileAnchorX,Q=p.tileAnchorY,J=p.elevation,ae=p.tileID,de=n.getProjection();if(J&&ae){const[Ge,He,et]=de.upVector(ae.canonical,p.tileAnchorX,p.tileAnchorY),mt=de.upVectorScale(ae.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;B+=Ge*J*mt,j+=He*J*mt,H+=et*J*mt}const ce=n.projection.name==="globe",Se=n.projection.name==="globe"?o.aj(this.transform.zoom):0;if(ae&&ce&&Se<1&&!b){const Ge=1<<ae.canonical.z,He=o.bP(G,Q);o.bQ(He,He,1/o.al),o.bR(He,He,o.bP(ae.canonical.x,ae.canonical.y)),o.bQ(He,He,1/Ge),o.bS(He,He,o.bP(y[0],y[1])),He[0]=o.bT(He[0],-.5,.5),o.bQ(He,He,o.al);const et=o.bU(He[0],He[1],o.al/(2*Math.PI),1);o.aC(et,et,x),B=o.ak(B,et[0],Se),j=o.ak(j,et[1],Se),H=o.ak(H,et[2],Se)}const ye=this.projectAndGetPerspectiveRatio(D,B,j,H,p.tileID,de.name==="globe"||!!J||this.transform.pitch>0,de),we=M*ye.perspectiveRatio,_e=(p.x1*l+T.x-p.padding)*we+ye.point.x,pe=(p.y1*l+T.y-p.padding)*we+ye.point.y,Te=(p.x2*l+T.x+p.padding)*we+ye.point.x,De=(p.y2*l+T.y+p.padding)*we+ye.point.y,Me=ye.perspectiveRatio<=.55||ye.occluded;return!this.isInsideGrid(_e,pe,Te,De)||!A&&this.grid.hitTest(_e,pe,Te,De,N)||Me?{box:[],offscreen:!1,occluded:ye.occluded}:{box:[_e,pe,Te,De],offscreen:this.isOffscreen(_e,pe,Te,De),occluded:!1}}placeCollisionCircles(n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q){const J=[],ae=this.transform.elevation,de=n.getProjection(),ce=n.elevationType==="road",Se=!!ae||ce,ye=o.bV.getAtTileOffsetFunc(Q,this.transform.center.lat,this.transform.worldSize,de),we=new o.P(p.tileAnchorX,p.tileAnchorY),_e=new o.P(p.tileAnchorX,p.tileAnchorY);let{x:pe,y:Te,z:De}=de.projectTilePoint(_e.x,_e.y,Q.canonical),Me=null;if(Se){const Kt=ce?n.getElevationFeatureForText(y):null;Me={getElevation:ye,elevation:ae,elevationFeature:Kt};const[$t,Dt,Bt]=ye(we,ae,Kt);pe+=$t,Te+=Dt,De+=Bt}const Ge=de.name==="globe",He=this.projectAndGetPerspectiveRatio(A,pe,Te,De,Q,Ge||!!ae||this.transform.pitch>0,de),{perspectiveRatio:et}=He,mt=(B?T/et:T*et)/o.bY,Ne=ha(pe,Te,De,M),Ce=p.lineOffsetX*mt,Ke=p.lineOffsetY*mt,Ve=o.an(n.layers[0].layout.get("text-max-angle")),ot=Math.cos(Ve),Tt=He.signedDistanceFromCamera>0?H0(mt,b,Ce,Ke,ce&&p.flipState===1,Ne,_e,p,x,M,{},Se&&!B?Me:null,B&&Se,de,Q,B,ot):null;let zt=!1,wt=!1,gt=!0;if(Tt&&!He.occluded){const Kt=.5*H*et+G,$t=new o.P(-100,-100),Dt=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Bt=new vh,{first:nr,last:xr}=Tt,Ur=nr.path.length;let dn=[];for(let vr=Ur-1;vr>=1;vr--)dn.push(nr.path[vr]);for(let vr=1;vr<xr.path.length;vr++)dn.push(xr.path[vr]);const Zt=2.5*Kt;D&&(dn=dn.map(([vr,pn,An],bn)=>(Se&&!Ge&&(An=ye(bn<Ur-1?nr.tilePath[Ur-1-bn]:xr.tilePath[bn-Ur+2],ae,Me.elevationFeature)[2]),ha(vr,pn,An,D))),dn.some(vr=>vr[3]<=0)&&(dn=[]));let an=[];if(dn.length>0){let vr=1/0,pn=-1/0,An=1/0,bn=-1/0;for(const sn of dn)vr=Math.min(vr,sn[0]),An=Math.min(An,sn[1]),pn=Math.max(pn,sn[0]),bn=Math.max(bn,sn[1]);pn>=$t.x&&vr<=Dt.x&&bn>=$t.y&&An<=Dt.y&&(an=[dn.map(sn=>new o.P(sn[0],sn[1]))],(vr<$t.x||pn>Dt.x||An<$t.y||bn>Dt.y)&&(an=o.bW(an,$t.x,$t.y,Dt.x,Dt.y)))}for(const vr of an){Bt.reset(vr,.25*Kt);let pn=0;pn=Bt.length<=.5*Kt?1:Math.ceil(Bt.paddedLength/Zt)+1;for(let An=0;An<pn;An++){const bn=An/Math.max(pn-1,1),sn=Bt.lerp(bn),Ar=sn.x+Xr,fn=sn.y+Xr;J.push(Ar,fn,Kt,0);const li=Ar-Kt,Yn=fn-Kt,mn=Ar+Kt,Qr=fn+Kt;if(gt=gt&&this.isOffscreen(li,Yn,mn,Qr),wt=wt||this.isInsideGrid(li,Yn,mn,Qr),!l&&this.grid.hitTestCircle(Ar,fn,Kt,j)&&(zt=!0,!N))return{circles:[],offscreen:!1,collisionDetected:zt,occluded:!1}}}}return{circles:!N&&zt||!wt?[]:J,offscreen:gt,collisionDetected:zt,occluded:He.occluded}}queryRenderedSymbols(n){if(n.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const l=[];let p=1/0,y=1/0,x=-1/0,b=-1/0;for(const D of n){const N=new o.P(D.x+Xr,D.y+Xr);p=Math.min(p,N.x),y=Math.min(y,N.y),x=Math.max(x,N.x),b=Math.max(b,N.y),l.push(N)}const T=this.grid.query(p,y,x,b).concat(this.ignoredGrid.query(p,y,x,b)),A={},M={};for(const D of T){const N=D.key;if(A[N.bucketInstanceId]===void 0&&(A[N.bucketInstanceId]={}),A[N.bucketInstanceId][N.featureIndex])continue;const B=[new o.P(D.x1,D.y1),new o.P(D.x2,D.y1),new o.P(D.x2,D.y2),new o.P(D.x1,D.y2)];o.bX(l,B)&&(A[N.bucketInstanceId][N.featureIndex]=!0,M[N.bucketInstanceId]===void 0&&(M[N.bucketInstanceId]=[]),M[N.bucketInstanceId].push(N.featureIndex))}return M}insertCollisionBox(n,l,p,y,x){(l?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:y,collisionGroupID:x},n[0],n[1],n[2],n[3])}insertCollisionCircles(n,l,p,y,x){const b=l?this.ignoredGrid:this.grid,T={bucketInstanceId:p,featureIndex:y,collisionGroupID:x};for(let A=0;A<n.length;A+=4)b.insertCircle(T,n[A],n[A+1],n[A+2])}projectAndGetPerspectiveRatio(n,l,p,y,x,b,T){const A=[l,p,y,1];let M=!1;y||this.transform.pitch>0?(o.aC(A,A,n),this.fogState&&x&&T.name!=="globe"&&(M=function(B,j,H,G,Q,J){const ae=J.calculateFogTileMatrix(Q),de=[j,H,G];return o.af(de,de,ae),Vt(B,o.ag(de),J.pitch,J._fov)}(this.fogState,l,p,y,x.toUnwrapped(),this.transform)>.9)):Qt(A,A,n);const D=A[3];return{point:new o.P((A[0]/D+1)/2*this.transform.width+Xr,(-A[1]/D+1)/2*this.transform.height+Xr),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(T)/D*.5,1.5),signedDistanceFromCamera:D,occluded:b&&A[2]>D||M}}isOffscreen(n,l,p,y){return p<Xr||n>=this.screenRightBoundary||y<Xr||l>this.screenBottomBoundary}isInsideGrid(n,l,p,y){return p>=0&&n<this.gridRightBoundary&&y>=0&&l<this.gridBottomBoundary}getViewportMatrix(){const n=o.bA([]);return o.br(n,n,[-100,-100,0]),n}}class bo{constructor(n,l,p,y){this.opacity=n?Math.max(0,Math.min(1,n.opacity+(n.placed?l:-l))):y&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class nl{constructor(n,l,p,y,x,b=!1){this.text=new bo(n?n.text:null,l,p,x),this.icon=new bo(n?n.icon:null,l,y,x),this.clipped=b}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class vn{constructor(n,l,p,y=!1){this.text=n,this.icon=l,this.skipFade=p,this.clipped=y}}class ip{constructor(){this.invProjMatrix=o.bC(),this.viewportMatrix=o.bC(),this.circles=[]}}class bh{constructor(n,l,p,y,x){this.bucketInstanceId=n,this.featureIndex=l,this.sourceLayerIndex=p,this.bucketIndex=y,this.tileID=x}}class Sh{constructor(n){this.crossSourceCollisions=n,this.maxGroupID=0,this.collisionGroups={}}get(n){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[n]){const l=++this.maxGroupID;this.collisionGroups[n]={ID:l,predicate:p=>p.collisionGroupID===l}}return this.collisionGroups[n]}}function js(f,n,l,p,y){const{horizontalAlign:x,verticalAlign:b}=o.c1(f),T=-(x-.5)*n,A=-(b-.5)*l,M=o.c2(f,p);return new o.P(T+M[0]*y,A+M[1]*y)}function Ri(f,n,l,p,y){const x=new o.P(f,n);return l&&x._rotate(p?y:-y),x}class xS{constructor(n,l,p,y,x,b){this.transform=n.clone(),this.projection=n.projection.name,this.collisionIndex=new kn(this.transform,x),this.buildingIndex=b,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=l,this.retainedQueryData={},this.collisionGroups=new Sh(p),this.collisionCircleArrays={},this.prevPlacement=y,y&&(y.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(n,l,p,y,x=1){const b=p.getBucket(l),T=p.latestFeatureIndex;if(!b||!T||l.fqid!==b.layerIds[0])return;const A=b.layers[0].layout,M=b.layers[0].paint,D=p.collisionBoxArray,N=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),B=p.tileSize/o.al,j=p.tileID.toUnwrapped();this.transform.setProjection(b.projection);const H=(G=p.tileID,Q=b.getProjection(),J=this.transform,Q.name===this.projection?J.calculateProjMatrix(G.toUnwrapped()):c_(J,Q,G));var G,Q,J;const ae=A.get("text-pitch-alignment")==="map",de=A.get("text-rotation-alignment")==="map";l.compileFilter(l.options);const ce=l.dynamicFilter(),Se=l.dynamicFilterNeedsFeature(),ye=this.transform.calculatePixelsToTileUnitsMatrix(p),we=np(H,p.tileID.canonical,ae,de,this.transform,b.getProjection(),ye);let _e=null;const pe=b.getProjection().createInversionMatrix(this.transform,p.tileID.canonical);if(ae){const Ce=xh(H,p.tileID.canonical,ae,de,this.transform,b.getProjection(),ye);_e=o.aB([],this.transform.labelPlaneMatrix,Ce)}let Te=null;ce&&p.latestFeatureIndex&&(Te={unwrappedTileID:j,dynamicFilter:ce,dynamicFilterNeedsFeature:Se}),this.retainedQueryData[b.bucketInstanceId]=new bh(b.bucketInstanceId,T,b.sourceLayerIndex,b.index,p.tileID);const[De,Me]=b.layers[0].layout.get("text-size-scale-range"),Ge=o.aA(x,De,Me),[He,et]=A.get("icon-size-scale-range"),mt=o.aA(x,He,et),Ne={bucket:b,layout:A,paint:M,posMatrix:H,invMatrix:pe,mercatorCenter:[o.aF(this.transform.center.lng),o.aJ(this.transform.center.lat)],textLabelPlaneMatrix:we,labelToScreenMatrix:_e,clippingData:Te,scale:N,textPixelRatio:B,holdingForFade:p.holdingForFade(),collisionBoxArray:D,partiallyEvaluatedTextSize:o.bK(b.textSizeData,this.transform.zoom,Ge),partiallyEvaluatedIconSize:o.bK(b.iconSizeData,this.transform.zoom,mt),collisionGroup:this.collisionGroups.get(b.sourceID),latestFeatureIndex:p.latestFeatureIndex};if(y)for(const Ce of b.sortKeyRanges){const{sortKey:Ke,symbolInstanceStart:Ve,symbolInstanceEnd:ot}=Ce;n.push({sortKey:Ke,symbolInstanceStart:Ve,symbolInstanceEnd:ot,parameters:Ne})}else n.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Ne})}attemptAnchorPlacement(n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J,ae,de,ce,Se){const{textOffset0:ye,textOffset1:we,crossTileID:_e}=G,pe=[ye,we],Te=js(n,b,T,pe,A),De=this.collisionIndex.placeCollisionBox(J,A,l,p,y,x,Ri(Te.x,Te.y,M,D,this.transform.angle),H,N,B,j.predicate);if(de){const Me=J.getSymbolInstanceIconSize(Se,this.transform.zoom,G.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(J,Me,de,p,y,x,Ri(Te.x,Te.y,M,D,this.transform.angle),H,N,B,j.predicate).box.length===0)return}if(De.box.length>0){let Me;return this.prevPlacement&&this.prevPlacement.variableOffsets[_e]&&this.prevPlacement.placements[_e]&&this.prevPlacement.placements[_e].text&&(Me=this.prevPlacement.variableOffsets[_e].anchor),this.variableOffsets[_e]={textOffset:pe,width:b,height:T,anchor:n,textScale:A,prevAnchor:Me},this.markUsedJustification(J,n,G,ae),J.allowVerticalPlacement&&(this.markUsedOrientation(J,ae,G),this.placedOrientations[_e]=ae),{shift:Te,placedGlyphBoxes:De}}}placeLayerBucketPart(n,l,p,y,x=1){const{bucket:b,layout:T,paint:A,posMatrix:M,textLabelPlaneMatrix:D,labelToScreenMatrix:N,clippingData:B,textPixelRatio:j,mercatorCenter:H,invMatrix:G,holdingForFade:Q,collisionBoxArray:J,partiallyEvaluatedTextSize:ae,partiallyEvaluatedIconSize:de,collisionGroup:ce,latestFeatureIndex:Se}=n.parameters,ye=T.get("text-optional"),we=T.get("icon-optional"),_e=T.get("text-allow-overlap"),pe=T.get("icon-allow-overlap"),Te=T.get("text-rotation-alignment")==="map",De=T.get("icon-rotation-alignment")==="map",Me=T.get("text-pitch-alignment")==="map",Ge=A.get("symbol-z-offset"),He=T.get("symbol-elevation-reference")==="sea",et=T.get("symbol-placement"),[mt,Ne]=T.get("text-size-scale-range"),[Ce,Ke]=T.get("icon-size-scale-range"),Ve=o.aA(x,mt,Ne),ot=o.aA(x,Ce,Ke),Tt=T.get("text-variable-anchor"),zt=Te&&et!=="point",wt=De&&et!=="point",gt=Tt&&b.hasTextData(),Kt=b.hasIconTextFit()&>&&b.hasIconData();this.transform.setProjection(b.projection);const $t=gt||zt,Dt=wt||Kt;let Bt=_e&&(pe||!b.hasIconData()||we),nr=pe&&(_e||!b.hasTextData()||ye);const xr=!Ge.isConstant();!b.collisionArrays&&J&&b.deserializeCollisionBoxes(J),p&&y&&b.updateCollisionDebugBuffers(this.transform.zoom,J,Ve,ot);const Ur=(Zt,an,vr)=>{const{crossTileID:pn,numVerticalGlyphVertices:An}=Zt;let bn=null;if(B&&B.dynamicFilterNeedsFeature||xr){const fi=this.retainedQueryData[b.bucketInstanceId];bn=Se.loadFeature({featureIndex:Zt.featureIndex,bucketIndex:fi.bucketIndex,sourceLayerIndex:fi.sourceLayerIndex,layoutVertexArrayOffset:0});const bi=bn.properties?bn.properties.worldview:null;if(b.localizable&&b.worldview&&typeof bi=="string")if(bi==="all")bn.properties.$localized=!0;else{if(!bi.split(",").includes(b.worldview))return;bn.properties.$localized=!0,bn.properties.worldview=b.worldview}}if(B&&!(0,B.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:b.worldview},bn,this.retainedQueryData[b.bucketInstanceId].tileID.canonical,new o.P(Zt.tileAnchorX,Zt.tileAnchorY),this.transform.calculateDistanceTileData(B.unwrappedTileID)))return this.placements[pn]=new vn(!1,!1,!1,!0),void l.add(pn);const sn=Ge.evaluate(bn,{});if(l.has(pn))return;if(Q)return void(this.placements[pn]=new vn(!1,!1,!1));let Ar=!1,fn=!1,li=!0,Yn=!1,mn=!1,Qr=null,Cr={box:null,offscreen:null,occluded:null},Kn={box:null},vi=null,ni=null,Rn=null,fo=0,Ms=0,Vi=0;vr.textFeatureIndex?fo=vr.textFeatureIndex:Zt.useRuntimeCollisionCircles&&(fo=Zt.featureIndex),vr.verticalTextFeatureIndex&&(Ms=vr.verticalTextFeatureIndex);const Us=b.elevationFeatures?b.elevationFeatures[Zt.elevationFeatureIndex]:void 0,$s=fi=>{fi.tileID=this.retainedQueryData[b.bucketInstanceId].tileID;const bi=this.transform.elevation;fi.elevation=He?sn:sn+o.bV.getAtTileOffset(fi.tileID,new o.P(fi.tileAnchorX,fi.tileAnchorY),bi,Us),fi.elevation+=Zt.zOffset},Ts=vr.textBox;if(Ts){$s(Ts);const fi=Dn=>{let Ci=o.bL.horizontal;if(b.allowVerticalPlacement&&!Dn&&this.prevPlacement){const ci=this.prevPlacement.placedOrientations[pn];ci&&(this.placedOrientations[pn]=ci,Ci=ci,this.markUsedOrientation(b,Ci,Zt))}return Ci},bi=(Dn,Ci)=>{if(b.allowVerticalPlacement&&An>0&&vr.verticalTextBox){for(const ci of b.writingModes)if(ci===o.bL.vertical?(Cr=Ci(),Kn=Cr):Cr=Dn(),Cr&&Cr.box&&Cr.box.length)break}else Cr=Dn()};if(Tt){let Dn=Tt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[pn]){const ii=this.prevPlacement.variableOffsets[pn];Dn.indexOf(ii.anchor)>0&&(Dn=Dn.filter(wa=>wa!==ii.anchor),Dn.unshift(ii.anchor))}const Ci=(ii,wa,Yh)=>{const Ba=b.getSymbolInstanceTextSize(ae,Zt,this.transform.zoom,an),Jh=(ii.x2-ii.x1)*Ba+2*ii.padding,_d=(ii.y2-ii.y1)*Ba+2*ii.padding,hl=Zt.hasIconTextFit&&!pe?wa:null;hl&&$s(hl);let Nl={box:[],offscreen:!1,occluded:!1};const yd=_e?2*Dn.length:Dn.length;for(let Rc=0;Rc<yd;++Rc){const jl=this.attemptAnchorPlacement(Dn[Rc%Dn.length],ii,H,G,$t,Jh,_d,Ba,Te,Me,j,M,ce,Rc>=Dn.length,Zt,an,b,Yh,hl,ae,de);if(jl&&(Nl=jl.placedGlyphBoxes,Nl&&Nl.box&&Nl.box.length)){Ar=!0,Qr=jl.shift;break}}return Nl};bi(()=>Ci(Ts,vr.iconBox,o.bL.horizontal),()=>{const ii=vr.verticalTextBox;return ii&&$s(ii),b.allowVerticalPlacement&&!(Cr&&Cr.box&&Cr.box.length)&&An>0&&ii?Ci(ii,vr.verticalIconBox,o.bL.vertical):{box:null,offscreen:null,occluded:null}}),Cr&&(Ar=Cr.box,li=Cr.offscreen,Yn=Cr.occluded);const ci=fi(!(!Cr||!Cr.box));if(!Ar&&this.prevPlacement){const ii=this.prevPlacement.variableOffsets[pn];ii&&(this.variableOffsets[pn]=ii,this.markUsedJustification(b,ii.anchor,Zt,ci))}}else{const Dn=(Ci,ci)=>{const ii=b.getSymbolInstanceTextSize(ae,Zt,this.transform.zoom,an),wa=this.collisionIndex.placeCollisionBox(b,ii,Ci,H,G,$t,new o.P(0,0),_e,j,M,ce.predicate);return wa&&wa.box&&wa.box.length&&(this.markUsedOrientation(b,ci,Zt),this.placedOrientations[pn]=ci),wa};bi(()=>Dn(Ts,o.bL.horizontal),()=>{const Ci=vr.verticalTextBox;return b.allowVerticalPlacement&&An>0&&Ci?($s(Ci),Dn(Ci,o.bL.vertical)):{box:null,offscreen:null,occluded:null}}),fi(!!(Cr&&Cr.box&&Cr.box.length))}}if(vi=Cr,Ar=vi&&vi.box&&vi.box.length>0,li=vi&&vi.offscreen,Yn=vi&&vi.occluded,Zt.useRuntimeCollisionCircles){const fi=Zt.centerJustifiedTextSymbolIndex>=0?Zt.centerJustifiedTextSymbolIndex:Zt.verticalPlacedTextSymbolIndex,bi=b.text.placedSymbolArray.get(fi),Dn=o.bM(b.textSizeData,ae,bi),Ci=T.get("text-padding");ni=this.collisionIndex.placeCollisionCircles(b,_e,bi,fi,b.lineVertexArray,b.glyphOffsetArray,Dn,M,D,N,p,Me,ce.predicate,Zt.collisionCircleDiameter*Dn/o.bY,Ci,this.retainedQueryData[b.bucketInstanceId].tileID),Ar=_e||ni.circles.length>0&&!ni.collisionDetected,li=li&&ni.offscreen,Yn=ni.occluded}if(vr.iconFeatureIndex&&(Vi=vr.iconFeatureIndex),vr.iconBox){const fi=bi=>{$s(bi);const Dn=Zt.hasIconTextFit&&Qr?Ri(Qr.x,Qr.y,Te,Me,this.transform.angle):new o.P(0,0),Ci=b.getSymbolInstanceIconSize(de,this.transform.zoom,Zt.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(b,Ci,bi,H,G,Dt,Dn,pe,j,M,ce.predicate)};Kn&&Kn.box&&Kn.box.length&&vr.verticalIconBox?(Rn=fi(vr.verticalIconBox),fn=Rn.box.length>0):(Rn=fi(vr.iconBox),fn=Rn.box.length>0),li=li&&Rn.offscreen,mn=Rn.occluded}const Qo=ye||Zt.numHorizontalGlyphVertices===0&&An===0,xa=we||Zt.numIconVertices===0;if(Qo||xa?xa?Qo||(fn=fn&&Ar):Ar=fn&&Ar:fn=Ar=fn&&Ar,Ar&&vi&&vi.box&&this.collisionIndex.insertCollisionBox(vi.box,T.get("text-ignore-placement"),b.bucketInstanceId,Kn&&Kn.box&&Ms?Ms:fo,ce.ID),fn&&Rn&&this.collisionIndex.insertCollisionBox(Rn.box,T.get("icon-ignore-placement"),b.bucketInstanceId,Vi,ce.ID),ni&&(Ar&&this.collisionIndex.insertCollisionCircles(ni.circles,T.get("text-ignore-placement"),b.bucketInstanceId,fo,ce.ID),p)){const fi=b.bucketInstanceId;let bi=this.collisionCircleArrays[fi];bi===void 0&&(bi=this.collisionCircleArrays[fi]=new ip);for(let Dn=0;Dn<ni.circles.length;Dn+=4)bi.circles.push(ni.circles[Dn+0]),bi.circles.push(ni.circles[Dn+1]),bi.circles.push(ni.circles[Dn+2]),bi.circles.push(ni.collisionDetected?1:0)}const Eo=b.projection.name!=="globe";Bt=Bt&&(Eo||!Yn),nr=nr&&(Eo||!mn),this.placements[pn]=new vn(Ar||Bt,fn||nr,li||b.justReloaded),l.add(pn)},dn=this.retainedQueryData[b.bucketInstanceId].tileID;if(b.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(b,dn),b.elevationType==="road"&&b.updateRoadElevation(dn.canonical),b.updateZOffset(),b.sortFeaturesByY){const Zt=b.getSortedSymbolIndexes(this.transform.angle);for(let an=Zt.length-1;an>=0;--an){const vr=Zt[an];Ur(b.symbolInstances.get(vr),vr,b.collisionArrays[vr])}b.hasAnyZOffset&&o.w(`${b.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(b.hasAnyZOffset){const Zt=b.getSortedIndexesByZOffset();for(let an=0;an<Zt.length;++an){const vr=Zt[an];Ur(b.symbolInstances.get(vr),vr,b.collisionArrays[vr])}}else for(let Zt=n.symbolInstanceStart;Zt<n.symbolInstanceEnd;Zt++)Ur(b.symbolInstances.get(Zt),Zt,b.collisionArrays[Zt]);if(p&&b.bucketInstanceId in this.collisionCircleArrays){const Zt=this.collisionCircleArrays[b.bucketInstanceId];o.bl(Zt.invProjMatrix,M),Zt.viewportMatrix=this.collisionIndex.getViewportMatrix()}b.justReloaded=!1}markUsedJustification(n,l,p,y){const{leftJustifiedTextSymbolIndex:x,centerJustifiedTextSymbolIndex:b,rightJustifiedTextSymbolIndex:T,verticalPlacedTextSymbolIndex:A,crossTileID:M}=p,D=o.c3(l),N=y===o.bL.vertical?A:D==="left"?x:D==="center"?b:D==="right"?T:-1;x>=0&&(n.text.placedSymbolArray.get(x).crossTileID=N>=0&&x!==N?0:M),b>=0&&(n.text.placedSymbolArray.get(b).crossTileID=N>=0&&b!==N?0:M),T>=0&&(n.text.placedSymbolArray.get(T).crossTileID=N>=0&&T!==N?0:M),A>=0&&(n.text.placedSymbolArray.get(A).crossTileID=N>=0&&A!==N?0:M)}markUsedOrientation(n,l,p){const y=l===o.bL.horizontal||l===o.bL.horizontalOnly?l:0,x=l===o.bL.vertical?l:0,{leftJustifiedTextSymbolIndex:b,centerJustifiedTextSymbolIndex:T,rightJustifiedTextSymbolIndex:A,verticalPlacedTextSymbolIndex:M}=p,D=n.text.placedSymbolArray;b>=0&&(D.get(b).placedOrientation=y),T>=0&&(D.get(T).placedOrientation=y),A>=0&&(D.get(A).placedOrientation=y),M>=0&&(D.get(M).placedOrientation=x)}commit(n){this.commitTime=n,this.zoomAtLastRecencyCheck=this.transform.zoom;const l=this.prevPlacement;let p=!1;this.prevZoomAdjustment=l?l.zoomAdjustment(this.transform.zoom):0;const y=l?l.symbolFadeChange(n):1,x=l?l.opacities:{},b=l?l.variableOffsets:{},T=l?l.placedOrientations:{};for(const A in this.placements){const M=this.placements[A],D=x[A];D?(this.opacities[A]=new nl(D,y,M.text,M.icon,null,M.clipped),p=p||M.text!==D.text.placed||M.icon!==D.icon.placed):(this.opacities[A]=new nl(null,y,M.text,M.icon,M.skipFade,M.clipped),p=p||M.text||M.icon)}for(const A in x){const M=x[A];if(!this.opacities[A]){const D=new nl(M,y,!1,!1);D.isHidden()||(this.opacities[A]=D,p=p||M.text.placed||M.icon.placed)}}for(const A in b)this.variableOffsets[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.variableOffsets[A]=b[A]);for(const A in T)this.placedOrientations[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.placedOrientations[A]=T[A]);p?this.lastPlacementChangeTime=n:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=l?l.lastPlacementChangeTime:n)}updateLayerOpacities(n,l,p,y){y&&(this.lastReplacementSourceUpdateTime=y.updateTime);const x=new Set;for(const b of l){const T=b.getBucket(n);T&&b.latestFeatureIndex&&n.fqid===T.layerIds[0]&&(this.updateBucketOpacities(T,x,b,b.collisionBoxArray,p,y,b.tileID,n.scope),T.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(T,b.tileID),T.elevationType==="road"&&T.updateRoadElevation(b.tileID.canonical),T.updateZOffset())}}updateBucketOpacities(n,l,p,y,x,b,T,A){n.hasTextData()&&n.text.opacityVertexArray.clear(),n.hasIconData()&&n.icon.opacityVertexArray.clear(),n.hasIconCollisionBoxData()&&n.iconCollisionBox.collisionVertexArray.clear(),n.hasTextCollisionBoxData()&&n.textCollisionBox.collisionVertexArray.clear();const M=n.layers[0].layout,D=n.layers[0].paint,N=!!n.layers[0].dynamicFilter(),B=new nl(null,0,!1,!1,!0),j=M.get("text-allow-overlap"),H=M.get("icon-allow-overlap"),G=M.get("text-variable-anchor"),Q=M.get("text-rotation-alignment")==="map",J=M.get("text-pitch-alignment")==="map",ae=D.get("symbol-z-offset"),de=M.get("symbol-elevation-reference")==="sea",ce=!ae.isConstant(),Se=new nl(null,0,j&&(H||!n.hasIconData()||M.get("icon-optional")),H&&(j||!n.hasTextData()||M.get("text-optional")),!0);!n.collisionArrays&&y&&(n.hasIconCollisionBoxData()||n.hasTextCollisionBoxData())&&n.deserializeCollisionBoxes(y);const ye=(_e,pe,Te)=>{for(let De=0;De<pe/4;De++)_e.opacityVertexArray.emplaceBack(Te)};let we=0;b&&n.updateReplacement(T,b);for(let _e=0;_e<n.symbolInstances.length;_e++){const pe=n.symbolInstances.get(_e),{numHorizontalGlyphVertices:Te,numVerticalGlyphVertices:De,crossTileID:Me,numIconVertices:Ge,tileAnchorX:He,tileAnchorY:et}=pe;let mt=null;const Ne=this.retainedQueryData[n.bucketInstanceId];ce&&pe&&Ne&&(mt=p.latestFeatureIndex.loadFeature({featureIndex:pe.featureIndex,bucketIndex:Ne.bucketIndex,sourceLayerIndex:Ne.sourceLayerIndex,layoutVertexArrayOffset:0}));const Ce=ae.evaluate(mt,{}),Ke=l.has(Me);let Ve=this.opacities[Me];Ke?Ve=B:Ve||(Ve=Se,this.opacities[Me]=Ve),l.add(Me);const ot=Te>0||De>0,Tt=Ge>0,zt=this.placedOrientations[Me],wt=zt===o.bL.vertical,gt=zt===o.bL.horizontal||zt===o.bL.horizontalOnly;!ot&&!Tt||Ve.isHidden()||we++;let Kt=!1;if((ot||Tt)&&b)for(const $t of n.activeReplacements){if(o.bZ($t,x,o.b_.Symbol,A)||$t.min.x>He||He>$t.max.x||$t.min.y>et||et>$t.max.y)continue;const Dt=o.b$(He,et,T.canonical,$t.footprintTileId.canonical);if(Kt=o.c0(Dt,$t.footprint),Kt)break}if(ot){const $t=Kt?su:lo(Ve.text);ye(n.text,Te,wt?su:$t),ye(n.text,De,gt?su:$t);const Dt=Ve.text.isHidden(),{leftJustifiedTextSymbolIndex:Bt,centerJustifiedTextSymbolIndex:nr,rightJustifiedTextSymbolIndex:xr,verticalPlacedTextSymbolIndex:Ur}=pe,dn=n.text.placedSymbolArray,Zt=Dt||wt?1:0;Bt>=0&&(dn.get(Bt).hidden=Zt),nr>=0&&(dn.get(nr).hidden=Zt),xr>=0&&(dn.get(xr).hidden=Zt),Ur>=0&&(dn.get(Ur).hidden=Dt||gt?1:0);const an=this.variableOffsets[Me];an&&this.markUsedJustification(n,an.anchor,pe,zt);const vr=this.placedOrientations[Me];vr&&(this.markUsedJustification(n,"left",pe,vr),this.markUsedOrientation(n,vr,pe))}if(Tt){const $t=Kt?su:lo(Ve.icon),{placedIconSymbolIndex:Dt,verticalPlacedIconSymbolIndex:Bt}=pe,nr=n.icon.placedSymbolArray,xr=Ve.icon.isHidden()?1:0;Dt>=0&&(ye(n.icon,Ge,wt?su:$t),nr.get(Dt).hidden=xr),Bt>=0&&(ye(n.icon,pe.numVerticalIconVertices,gt?su:$t),nr.get(Bt).hidden=xr)}if(n.hasIconCollisionBoxData()||n.hasTextCollisionBoxData()){const $t=n.collisionArrays[_e];if($t){let Dt=new o.P(0,0),Bt=!0;if($t.textBox||$t.verticalTextBox){if(G){const xr=this.variableOffsets[Me];xr?(Dt=js(xr.anchor,xr.width,xr.height,xr.textOffset,xr.textScale),Q&&Dt._rotate(J?this.transform.angle:-this.transform.angle)):Bt=!1}N&&(Bt=!Ve.clipped),$t.textBox&&_c(n.textCollisionBox.collisionVertexArray,Ve.text.placed,!Bt||wt,Ce,de,Dt.x,Dt.y),$t.verticalTextBox&&_c(n.textCollisionBox.collisionVertexArray,Ve.text.placed,!Bt||gt,Ce,de,Dt.x,Dt.y)}const nr=Bt&&!!(!gt&&$t.verticalIconBox);$t.iconBox&&_c(n.iconCollisionBox.collisionVertexArray,Ve.icon.placed,nr,Ce,de,pe.hasIconTextFit?Dt.x:0,pe.hasIconTextFit?Dt.y:0),$t.verticalIconBox&&_c(n.iconCollisionBox.collisionVertexArray,Ve.icon.placed,!nr,Ce,de,pe.hasIconTextFit?Dt.x:0,pe.hasIconTextFit?Dt.y:0)}}}if(n.fullyClipped=we===0,n.sortFeatures(this.transform.angle),this.retainedQueryData[n.bucketInstanceId]&&(this.retainedQueryData[n.bucketInstanceId].featureSortOrder=n.featureSortOrder),n.hasTextData()&&n.text.opacityVertexBuffer&&n.text.opacityVertexBuffer.updateData(n.text.opacityVertexArray),n.hasIconData()&&n.icon.opacityVertexBuffer&&n.icon.opacityVertexBuffer.updateData(n.icon.opacityVertexArray),n.hasIconCollisionBoxData()&&n.iconCollisionBox.collisionVertexBuffer&&n.iconCollisionBox.collisionVertexBuffer.updateData(n.iconCollisionBox.collisionVertexArray),n.hasTextCollisionBoxData()&&n.textCollisionBox.collisionVertexBuffer&&n.textCollisionBox.collisionVertexBuffer.updateData(n.textCollisionBox.collisionVertexArray),n.bucketInstanceId in this.collisionCircleArrays){const _e=this.collisionCircleArrays[n.bucketInstanceId];n.placementInvProjMatrix=_e.invProjMatrix,n.placementViewportMatrix=_e.viewportMatrix,n.collisionCircleArray=_e.circles,delete this.collisionCircleArrays[n.bucketInstanceId]}}symbolFadeChange(n){return this.fadeDuration===0?1:(n-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(n){return Math.max(0,(this.transform.zoom-n)/1.5)}hasTransitions(n){return this.stale||n-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(n,l){const p=this.zoomAtLastRecencyCheck===l?1-this.zoomAdjustment(l):1;return this.zoomAtLastRecencyCheck=l,this.commitTime+this.fadeDuration*p>n}isStale(){return this.stale}setStale(){this.stale=!0}}function _c(f,n,l,p,y,x,b){f.emplaceBack(n?1:0,l?1:0,x||0,b||0,p,y?1:0),f.emplaceBack(n?1:0,l?1:0,x||0,b||0,p,y?1:0),f.emplaceBack(n?1:0,l?1:0,x||0,b||0,p,y?1:0),f.emplaceBack(n?1:0,l?1:0,x||0,b||0,p,y?1:0)}const h_=Math.pow(2,25),Th=Math.pow(2,24),sp=Math.pow(2,17),f_=Math.pow(2,16),op=Math.pow(2,9),ao=Math.pow(2,8),kl=Math.pow(2,1);function lo(f){if(f.opacity===0&&!f.placed)return 0;if(f.opacity===1&&f.placed)return 4294967295;const n=f.placed?1:0,l=Math.floor(127*f.opacity);return l*h_+n*Th+l*sp+n*f_+l*op+n*ao+l*kl+n}const su=0;class Ku{constructor(n){this._sortAcrossTiles=n.layout.get("symbol-z-order")!=="viewport-y"&&n.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(n,l,p,y,x,b){const T=this._bucketParts;for(;this._currentTileIndex<n.length;)if(l.getBucketParts(T,y,n[this._currentTileIndex],this._sortAcrossTiles,b),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,T.sort((A,M)=>A.sortKey-M.sortKey));this._currentPartIndex<T.length;){const A=T[this._currentPartIndex];if(l.placeLayerBucketPart(A,this._seenCrossTileIDs,p,A.symbolInstanceStart===0,b),this._currentPartIndex++,x())return!0}return!1}}class is{constructor(n,l,p,y,x,b,T,A,M){this.placement=new xS(n,x,b,T,A,M),this._currentPlacementIndex=l.length-1,this._forceFullPlacement=p,this._showCollisionBoxes=y,this._done=!1}isDone(){return this._done}continuePlacement(n,l,p,y,x){const b=o.o.now(),T=()=>{const A=o.o.now()-b;return!this._forceFullPlacement&&A>2};for(;this._currentPlacementIndex>=0;){const A=l[n[this._currentPlacementIndex]],M=this.placement.collisionIndex.transform.zoom;if(A.type==="symbol"&&A.visibility!=="none"&&(!A.minzoom||A.minzoom<=M)&&(!A.maxzoom||A.maxzoom>M)){const D=A,N=D.layout.get("symbol-z-elevate"),B=D.layout.get("symbol-sort-key").constantOr(1)!==void 0,j=D.layout.get("symbol-z-order"),H=j==="viewport-y"||j==="auto"&&!(j!=="viewport-y"&&B),G=D.layout.get("text-allow-overlap")||D.layout.get("icon-allow-overlap")||D.layout.get("text-ignore-placement")||D.layout.get("icon-ignore-placement"),Q=H&&G,J=this._inProgressLayer=this._inProgressLayer||new Ku(D),ae=o.B(A.source,A.scope);if(J.continuePlacement(N||Q?y[ae]:p[ae],this.placement,this._showCollisionBoxes,A,T,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(n){return this.placement.commit(n),this.placement}}const pa=512/o.al/2;class Al{constructor(n,l,p){this.tileID=n,this.bucketInstanceId=p,this.index=new o.c4(l.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const y=n.canonical.x*o.al,x=n.canonical.y*o.al;for(let b=0;b<l.length;b++){const{key:T,crossTileID:A,tileAnchorX:M,tileAnchorY:D}=l.get(b),N=Math.floor((y+M)*pa),B=Math.floor((x+D)*pa);this.index.add(N,B),this.keys.push(T),this.crossTileIDs.push(A)}this.index.finish()}findMatches(n,l,p){const y=this.tileID.canonical.z<l.canonical.z?1:Math.pow(2,this.tileID.canonical.z-l.canonical.z),x=pa/Math.pow(2,l.canonical.z-this.tileID.canonical.z),b=l.canonical.x*o.al,T=l.canonical.y*o.al;for(let A=0;A<n.length;A++){const M=n.get(A);if(M.crossTileID)continue;const{key:D,tileAnchorX:N,tileAnchorY:B}=M,j=Math.floor((b+N)*x),H=Math.floor((T+B)*x),G=this.index.range(j-y,H-y,j+y,H+y).sort((Q,J)=>Q-J);for(const Q of G){const J=this.crossTileIDs[Q];if(this.keys[Q]===D&&!p.has(J)){p.add(J),M.crossTileID=J;break}}}}}class Xi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class p_{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(n){const l=Math.round((n-this.lng)/360);if(l!==0)for(const p in this.indexes){const y=this.indexes[p],x={};for(const b in y){const T=y[b];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+l),x[T.tileID.key]=T}this.indexes[p]=x}this.lng=n}addBucket(n,l,p){if(this.indexes[n.overscaledZ]&&this.indexes[n.overscaledZ][n.key]){if(this.indexes[n.overscaledZ][n.key].bucketInstanceId===l.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(n.overscaledZ,this.indexes[n.overscaledZ][n.key])}for(let x=0;x<l.symbolInstances.length;x++)l.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[n.overscaledZ]||(this.usedCrossTileIDs[n.overscaledZ]=new Set);const y=this.usedCrossTileIDs[n.overscaledZ];for(const x in this.indexes){const b=this.indexes[x];if(Number(x)>n.overscaledZ)for(const T in b){const A=b[T];A.tileID.isChildOf(n)&&A.findMatches(l.symbolInstances,n,y)}else{const T=b[n.scaledTo(Number(x)).key];T&&T.findMatches(l.symbolInstances,n,y)}}for(let x=0;x<l.symbolInstances.length;x++){const b=l.symbolInstances.get(x);b.crossTileID||(b.crossTileID=p.generate(),y.add(b.crossTileID))}return this.indexes[n.overscaledZ]===void 0&&(this.indexes[n.overscaledZ]={}),this.indexes[n.overscaledZ][n.key]=new Al(n,l.symbolInstances,l.bucketInstanceId),!0}removeBucketCrossTileIDs(n,l){for(const p of l.crossTileIDs)this.usedCrossTileIDs[n].delete(p)}removeStaleBuckets(n){let l=!1;for(const p in this.indexes){const y=this.indexes[p];for(const x in y)n[y[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(p,y[x]),delete y[x],l=!0)}return l}}class Da{constructor(){this.layerIndexes={},this.crossTileIDs=new Xi,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(n,l,p,y){let x=this.layerIndexes[n.fqid];x===void 0&&(x=this.layerIndexes[n.fqid]=new p_);let b=!1;const T={};y.name!=="globe"&&x.handleWrapJump(p);for(const A of l){const M=A.getBucket(n);M&&n.fqid===M.layerIds[0]&&(M.bucketInstanceId||(M.bucketInstanceId=++this.maxBucketInstanceId),x.addBucket(A.tileID,M,this.crossTileIDs)&&(b=!0),T[M.bucketInstanceId]=!0)}return x.removeStaleBuckets(T)&&(b=!0),b}pruneUnusedLayers(n){const l={};n.forEach(p=>{l[p]=!0});for(const p in this.layerIndexes)l[p]||delete this.layerIndexes[p]}}const il=771;class Er{constructor(n,l,p,y){this.blendFunction=n,this.blendColor=l.toNonPremultipliedRenderColor(null),this.mask=p,this.blendEquation=y}}Er.Replace=[1,0,1,0],Er.disabled=new Er(Er.Replace,o.ao.transparent,[!1,!1,!1,!1]),Er.unblended=new Er(Er.Replace,o.ao.transparent,[!0,!0,!0,!0]),Er.alphaBlended=new Er([1,il,1,il],o.ao.transparent,[!0,!0,!0,!0]),Er.alphaBlendedNonPremultiplied=new Er([770,il,770,il],o.ao.transparent,[!0,!0,!0,!0]),Er.multiply=new Er([774,0,774,0],o.ao.transparent,[!0,!0,!0,!0]),Er.additive=new Er([1,1,1,1],o.ao.transparent,[!0,!0,!0,!0]);class Xt{constructor(n,l,p){this.func=n,this.mask=l,this.range=p}}Xt.ReadOnly=!1,Xt.ReadWrite=!0,Xt.disabled=new Xt(519,Xt.ReadOnly,[0,1]);const ap=7680;class pr{constructor(n,l,p,y,x,b){this.test=n,this.ref=l,this.mask=p,this.fail=y,this.depthFail=x,this.pass=b}}pr.disabled=new pr({func:519,mask:0},0,0,ap,ap,ap);const Zu=1029,lp=2305;class fr{constructor(n,l,p){this.enable=n,this.mode=l,this.frontFace=p}}function sl(f,n){const l=o.ca(f,3);o.cc(f,n),o.cg(f,3,l)}function m_(f,n){const l=o.c7([]);return o.c8(l,l,-n),o.c9(l,l,-f),l}function cp(f,n){const l=[f[0],f[1],0],p=[n[0],n[1],0];if(o.ag(l)>=1e-15){const b=o.aw([],l);o.c5(p,b,o.bJ(p,b)),n[0]=p[0],n[1]=p[1]}const y=o.bI([],n,f);if(o.c6(y)<1e-15)return null;const x=Math.atan2(-y[1],y[0]);return m_(Math.atan2(Math.sqrt(f[0]*f[0]+f[1]*f[1]),-f[2]),x)}fr.disabled=new fr(!1,Zu,lp),fr.backCCW=new fr(!0,Zu,lp),fr.backCW=new fr(!0,Zu,2304),fr.frontCW=new fr(!0,1028,2304),fr.frontCCW=new fr(!0,1028,lp);class co{constructor(n,l){this.position=n,this.orientation=l}get position(){return this._position}set position(n){if(n){const l=n instanceof o.ae?n:new o.ae(n[0],n[1],n[2]);this._renderWorldCopies&&(l.x=o.bT(l.x,0,1)),this._position=l}else this._position=null}lookAtPoint(n,l,p){if(this.orientation=null,!this.position)return;const y=this.position,x=p||(this._elevation?this._elevation.getAtPointOrZero(o.ae.fromLngLat(n)):0),b=o.ae.fromLngLat(n,x),T=[b.x-y.x,b.y-y.y,b.z-y.z];l||(l=[0,0,1]),l[2]=Math.abs(l[2]),this.orientation=cp(T,l)}setPitchBearing(n,l){this.orientation=m_(o.an(n),o.an(-l))}}class up{constructor(n,l){this._transform=o.bA([]),this.orientation=l,this.position=n}get mercatorPosition(){const n=this.position;return new o.ae(n[0],n[1],n[2])}get position(){const n=o.ca(this._transform,3);return[n[0],n[1],n[2]]}set position(n){var l;n&&o.cg(this._transform,3,[(l=n)[0],l[1],l[2],1])}get orientation(){return this._orientation}set orientation(n){this._orientation=n||o.c7([]),n&&sl(this._transform,this._orientation)}getPitchBearing(){const n=this.forward(),l=this.right();return{bearing:Math.atan2(-l[1],l[0]),pitch:Math.atan2(Math.sqrt(n[0]*n[0]+n[1]*n[1]),-n[2])}}setPitchBearing(n,l){this._orientation=m_(n,l),sl(this._transform,this._orientation)}forward(){const n=o.ca(this._transform,2);return[-n[0],-n[1],-n[2]]}up(){const n=o.ca(this._transform,1);return[-n[0],-n[1],-n[2]]}right(){const n=o.ca(this._transform,0);return[n[0],n[1],n[2]]}getCameraToWorld(n,l){const p=new Float64Array(16);return o.bl(p,this.getWorldToCamera(n,l)),p}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(n,l,p){const y=this.position;o.c5(y,y,-n);const x=new Float64Array(16);return o.bq(x,[p,p,p]),o.br(x,x,y),x[10]*=l,x}getWorldToCamera(n,l){const p=new Float64Array(16),y=new Float64Array(4),x=this.position;return o.cb(y,this._orientation),o.c5(x,x,-n),o.cc(p,y),o.br(p,p,x),p[1]*=-1,p[5]*=-1,p[9]*=-1,p[13]*=-1,p[8]*=l,p[9]*=l,p[10]*=l,p[11]*=l,p}getCameraToClipPerspective(n,l,p,y){const x=new Float64Array(16);return o.cd(x,n,l,p,y),x}getCameraToClipOrthographic(n,l,p,y,x,b){const T=new Float64Array(16);return o.ce(T,n,l,p,y,x,b),T}getDistanceToElevation(n,l=!1){const p=n===0?0:o.cf(n,l?o.a$(this.position[1]):this.position[1]),y=this.forward();return(p-this.position[2])/y[2]}clone(){return new up([...this.position],[...this.orientation])}}const ms={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class dp{constructor(n=0,l=0,p=0,y=0){if(isNaN(n)||n<0||isNaN(l)||l<0||isNaN(p)||p<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=n,this.bottom=l,this.left=p,this.right=y}interpolate(n,l,p){return l.top!=null&&n.top!=null&&(this.top=o.ak(n.top,l.top,p)),l.bottom!=null&&n.bottom!=null&&(this.bottom=o.ak(n.bottom,l.bottom,p)),l.left!=null&&n.left!=null&&(this.left=o.ak(n.left,l.left,p)),l.right!=null&&n.right!=null&&(this.right=o.ak(n.right,l.right,p)),this}getCenter(n,l){const p=o.aA((this.left+n-this.right)/2,0,n),y=o.aA((this.top+l-this.bottom)/2,0,l);return new o.P(p,y)}equals(n){return this.top===n.top&&this.bottom===n.bottom&&this.left===n.left&&this.right===n.right}clone(){return new dp(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const La=15;class g_{constructor(n,l,p,y,x,b,T){this.tileSize=512,this._renderWorldCopies=x===void 0||x,this._minZoom=n||0,this._maxZoom=l||22,this._minPitch=p??0,this._maxPitch=y??60,this.setProjection(b),this.setMaxBounds(T),this.width=0,this.height=0,this._center=new o.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new dp,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new up,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const n=new g_(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return n._elevation=this._elevation,n._centerAltitude=this._centerAltitude,n._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,n.tileSize=this.tileSize,n.mercatorFromTransition=this.mercatorFromTransition,n.width=this.width,n.height=this.height,n.cameraElevationReference=this.cameraElevationReference,n._center=this._center,n._setZoom(this.zoom),n._seaLevelZoom=this._seaLevelZoom,n.angle=this.angle,n._fov=this._fov,n._pitch=this._pitch,n._nearZ=this._nearZ,n._farZ=this._farZ,n._averageElevation=this._averageElevation,n._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,n._unmodified=this._unmodified,n._edgeInsets=this._edgeInsets.clone(),n._camera=this._camera.clone(),n._calcMatrices(),n.freezeTileCoverage=this.freezeTileCoverage,n.frustumCorners=this.frustumCorners,n._allowWorldUnderZoom=this._allowWorldUnderZoom,n}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<La}get elevation(){return this._elevation}set elevation(n){this._elevation!==n&&(this._elevation=n,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(n,l=!1){const p=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||p)&&this._updateCameraOnTerrain(),(n||p)&&this._constrainCamera(l),this._calcMatrices()}getProjection(){return o.aH(this.projection,["name","center","parallels"])}setProjection(n){this.projectionOptions=n||{name:"mercator"};const l=this.projection?this.getProjection():void 0;this.projection=o.cm(this.projectionOptions);const p=this.getProjection(),y=!o.by(l,p);return y&&this._calcMatrices(),this.mercatorFromTransition=!1,y}setOrthographicProjectionAtLowPitch(n){return this._orthographicProjectionAtLowPitch!==n&&(this._orthographicProjectionAtLowPitch=n,this._calcMatrices(),!0)}setMercatorFromTransition(){const n=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=o.cm({name:"mercator"});const l=n!==this.projection.name;return l&&this._calcMatrices(),l}get minZoom(){return this._minZoom}set minZoom(n){this._minZoom!==n&&(this._minZoom=n,this.zoom=Math.max(this.zoom,n))}get maxZoom(){return this._maxZoom}set maxZoom(n){this._maxZoom!==n&&(this._maxZoom=n,this.zoom=Math.min(this.zoom,n))}get minPitch(){return this._minPitch}set minPitch(n){this._minPitch!==n&&(this._minPitch=n,this.pitch=Math.max(this.pitch,n))}get maxPitch(){return this._maxPitch}set maxPitch(n){this._maxPitch!==n&&(this._maxPitch=n,this.pitch=Math.min(this.pitch,n))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(n){n===void 0?n=!0:n===null&&(n=!1),this._renderWorldCopies=n}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const n=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(n))}get cameraWorldSize(){const n=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(n))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bT(this.rotation,-180,180)}set bearing(n){this.rotation=n}get rotation(){return-this.angle/Math.PI*180}set rotation(n){const l=-n*Math.PI/180;this.angle!==l&&(this._unmodified=!1,this.angle=l,this._calcMatrices(),this.rotationMatrix=o.cn(),o.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(n){const l=o.aA(n,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==l&&(this._unmodified=!1,this._pitch=l,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(n){n=Math.max(.01,Math.min(60,n)),this._fov!==n&&(this._unmodified=!1,this._fov=o.an(n),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const n=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/n)}get averageElevation(){return this._averageElevation}set averageElevation(n){this._averageElevation=n,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(n){const l=Math.min(Math.max(n,this.minZoom),this.maxZoom);this._zoom!==l&&(this._unmodified=!1,this._setZoom(l),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(n){this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(n){this._tileCoverLift!==n&&(this._tileCoverLift=n)}_updateCameraOnTerrain(){const n=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,l=this.elevation&&n===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||n===Number.NEGATIVE_INFINITY&&(!l||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const p=this._elevation;l||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&p.exaggeration()&&this._centerAltitudeValidForExaggeration!==p.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*p.exaggeration(),this._centerAltitudeValidForExaggeration=p.exaggeration()):(this._centerAltitude=n||0,this._centerAltitudeValidForExaggeration=p.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const n=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(n)}sampleAverageElevation(){if(!this._elevation)return 0;const n=this._elevation,l=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],p=this.horizonLineFromTop();let y=0,x=0;for(let b=0;b<l.length;b++){const T=new o.P(l[b][0]*this.width,p+l[b][1]*(this.height-p)),A=n.pointCoordinate(T);if(!A)continue;const M=1/Math.hypot(A[0]-this._camera.position[0],A[1]-this._camera.position[1]);y+=A[3]*M,x+=M}return x===0?NaN:y/x}get center(){return this._center}set center(n){n.lat===this._center.lat&&n.lng===this._center.lng||(this._unmodified=!1,this._center=n,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const n=this._seaLevelZoom,l=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),p=this.pixelsPerMeter/this.worldSize*l,y=this._mercatorZfromZoom(n),x=this._mercatorZfromZoom(this._maxZoom),b=Math.max(y-p,x);this._setZoom(this._zoomFromMercatorZ(b))}get padding(){return this._edgeInsets.toJSON()}set padding(n){this._edgeInsets.equals(n)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,n,1),this._calcMatrices())}equals(n){const l=this.elevation,p=n.elevation,y=l!=null!=(p!=null)||l&&p&&l.exaggeration()!==p.exaggeration();return this.width===n.width&&this.height===n.height&&this.center.lng===n.center.lng&&this.center.lat===n.center.lat&&this.zoom===n.zoom&&this.bearing===n.bearing&&this.pitch===n.pitch&&this.fov===n.fov&&this.projection.name===n.projection.name&&this._edgeInsets.equals(n.padding)&&!y}computeZoomRelativeTo(n){const l=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,n.toAltitude()));let p;p=n.z<this._camera.position[2]?[l.x,l.y,l.z]:[n.x,n.y,n.z];const y=o.ag(o.av([],this._camera.position,p));return o.aA(this._zoomFromMercatorZ(y),this._minZoom,this._maxZoom)}setFreeCameraOptions(n){if(!this.height||!n.position&&!n.orientation)return;this._updateCameraState();let l=!1;if(n.orientation&&!o.cp(n.orientation,this._camera.orientation)&&(l=this._setCameraOrientation(n.orientation)),n.position){const p=[n.position.x,n.position.y,n.position.z];o.cq(p,this._camera.position)||(this._setCameraPosition(p),l=!0)}l&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const n=this._camera.position,l=new co;return l.position=new o.ae(n[0],n[1],n[2]),l.orientation=this._camera.orientation,l._elevation=this.elevation,l._renderWorldCopies=this.renderWorldCopies,l}_setCameraOrientation(n){if(!o.cr(n))return!1;o.cs(n,n);const l=o.ct([],[0,0,-1],n),p=o.ct([],[0,-1,0],n);if(p[2]<0)return!1;const y=cp(l,p);return!!y&&(this._camera.orientation=y,!0)}_setCameraPosition(n){const l=this.zoomScale(this.minZoom)*this.tileSize,p=this.zoomScale(this.maxZoom)*this.tileSize,y=this.cameraToCenterDistance;n[2]=o.aA(n[2],y/p,y/l),this._camera.position=n}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(n){return this._edgeInsets.equals(n)}interpolatePadding(n,l,p){this._unmodified=!1,this._edgeInsets.interpolate(n,l,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(n){const l=(n.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/n.tileSize));return Math.max(0,l)}getVisibleUnwrappedCoordinates(n){const l=[new o.cu(0,n)];if(this.renderWorldCopies){const p=this.pointCoordinate(new o.P(0,0)),y=this.pointCoordinate(new o.P(this.width,0)),x=this.pointCoordinate(new o.P(this.width,this.height)),b=this.pointCoordinate(new o.P(0,this.height)),T=Math.floor(Math.min(p.x,y.x,x.x,b.x)),A=Math.floor(Math.max(p.x,y.x,x.x,b.x)),M=1;for(let D=T-M;D<=A+M;D++)D!==0&&l.push(new o.cu(D,n))}return l}isLODDisabled(n){return(!n||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(n,l,p,y){let x=[];const b=p!=null,T=!b;if(T&&this.zoom<l||b&&p[0]===0&&p[1]===0)return x;const A=new Set,M=(N,B,j,H,G)=>{const Q=o.cY(B,N,j,H,G);A.has(Q)||(x.push(new o.aQ(N,B,j,H,G)),A.add(Q))};for(let N=0;N<n.length;N++){const B=n[N];if(T&&B.canonical.z!==l||b&&y!==void 0&&y>B.canonical.z)continue;const j=B.canonical,H=B.overscaledZ,G=B.wrap,Q=1<<j.z,J=j.x+1<Q,ae=j.x>0,de=j.y+1<Q,ce=j.y>0,Se=B.wrap-(ae?0:1),ye=B.wrap+(J?0:1),we=ae?j.x-1:Q-1,_e=J?j.x+1:0;if(b)p[0]<0?(M(H,ye,j.z,_e,j.y),p[1]<0&&de&&(M(H,G,j.z,j.x,j.y+1),M(H,ye,j.z,_e,j.y+1)),p[1]>0&&ce&&(M(H,G,j.z,j.x,j.y-1),M(H,ye,j.z,_e,j.y-1))):p[0]>0?(M(H,Se,j.z,we,j.y),p[1]<0&&de&&(M(H,G,j.z,j.x,j.y+1),M(H,Se,j.z,we,j.y+1)),p[1]>0&&ce&&(M(H,G,j.z,j.x,j.y-1),M(H,Se,j.z,we,j.y-1))):p[1]<0&&de?M(H,G,j.z,j.x,j.y+1):ce&&M(H,G,j.z,j.x,j.y-1);else{const pe=B.visibleQuadrants;1&pe&&(M(H,Se,j.z,we,j.y),ce&&(M(H,G,j.z,j.x,j.y-1),M(H,Se,j.z,we,j.y-1))),2&pe&&(M(H,ye,j.z,_e,j.y),ce&&(M(H,G,j.z,j.x,j.y-1),M(H,ye,j.z,_e,j.y-1))),4&pe&&(M(H,Se,j.z,we,j.y),de&&(M(H,G,j.z,j.x,j.y+1),M(H,Se,j.z,we,j.y+1))),8&pe&&(M(H,ye,j.z,_e,j.y),de&&(M(H,G,j.z,j.x,j.y+1),M(H,ye,j.z,_e,j.y+1)))}}const D=[];for(const N of x)x.some(B=>N.isChildOf(B))||D.push(N);if(x=D.filter(N=>!n.some(B=>!!(N.overscaledZ<l&&B.isChildOf(N))||N.equals(B)||N.isChildOf(B))),T){const N=1<<l,B=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),j=[N*B.x,N*B.y],H=4,G=H*H;x=x.filter(Q=>{const J=Q.canonical.x+.5-j[0],ae=Q.canonical.y+.5-j[1];return J*J+ae*ae<G})}return x}extendTileCoverToNearPlane(n,l,p){const y=[],x=new Set;for(const ae of n)x.add(ae.key);const b=(ae,de,ce,Se,ye)=>{const we=o.cY(de,ae,ce,Se,ye);x.has(we)||(y.push(new o.aQ(ae,de,ce,Se,ye)),x.add(we))},T=n.reduce((ae,de)=>Math.max(ae,de.overscaledZ),p),A=1<<p,M=[new o.P(0,0),new o.P(o.al,0),new o.P(o.al,o.al),new o.P(0,o.al)],D=new o.P(0,0),N=new o.P(0,0),B=(ae,de)=>{const ce=Math.floor(ae[0]),Se=Math.floor(ae[1]),ye=(ae[0]-ce)*o.al,we=(ae[1]-Se)*o.al,_e=Math.floor(de[0]),pe=Math.floor(de[1]),Te=(de[0]-_e)*o.al,De=(de[1]-pe)*o.al;for(let Me=-1;Me<=1;Me++){const Ge=ce+Me;if(!(Ge<0||Ge>=A)){D.x=ye-Me*o.al,N.x=Te-(Ge-_e)*o.al;for(let He=-1;He<=1;He++){const et=Se+He;D.y=we-He*o.al,N.y=De-(et-pe)*o.al,o.cZ(D,N,M)&&b(T,0,p,Ge,et)}}}},j=l.points,H=j[o.cv],G=j[o.cw],Q=this._projectToGround(H,j[o.cx]),J=this._projectToGround(G,j[o.cy]);return B(H,Q),B(G,J),y}_projectToGround(n,l){return o.cz(o.cA(),n,l,n[2]/(n[2]-l[2]))}coveringTiles(n){let l=this.coveringZoomLevel(n);const p=l,y=this.elevation&&this.elevation.exaggeration(),x=y&&!n.isTerrainDEM,b=this.projection.name==="mercator";if(n.minzoom!==void 0&&l<n.minzoom)return[];n.maxzoom!==void 0&&l>n.maxzoom&&(l=n.maxzoom);const T=this.locationCoordinate(this.center),A=this.center.lat,M=1<<l,D=[M*T.x,M*T.y,0],N=this.projection.name==="globe",B=!N,j=o.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,l,B),H=N?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),G=M*o.cf(1,this.center.lat),Q=this._camera.position[2]/o.cf(1,this.center.lat),J=[M*H.x,M*H.y,Q*(B?1:G)],ae=N||y,de=this.cameraToCenterDistance/n.tileSize*(n.roundZoom?1:.502),ce=this.isLODDisabled(!0)?l:0;let Se;if(this._elevation&&n.isTerrainDEM)Se=1e4*this._elevation.exaggeration();else if(this._elevation){const Ce=this._elevation.getMinMaxForVisibleTiles();Se=Ce?Ce.max:this._centerAltitude}else Se=this._centerAltitude;const ye=n.isTerrainDEM?-Se:this._elevation?this._elevation.getMinElevationBelowMSL():0,we=this.projection.isReprojectedInTileSpace?o.cC(this):1,_e=Ce=>{const Ve=new o.ae(Ce.x+25e-6,Ce.y,Ce.z),ot=new o.ae(Ce.x,Ce.y+25e-6,Ce.z),Tt=Ce.toLngLat(),zt=Ve.toLngLat(),wt=ot.toLngLat(),gt=this.locationCoordinate(Tt),Kt=this.locationCoordinate(zt),$t=this.locationCoordinate(wt),Dt=Math.hypot(Kt.x-gt.x,Kt.y-gt.y),Bt=Math.hypot($t.x-gt.x,$t.y-gt.y);return Math.sqrt(Dt*Bt)*we/25e-6},pe=Ce=>{const Ke=Se,Ve=ye;return{aabb:o.cF(this,M,0,0,0,Ce,Ve,Ke,this.projection),zoom:0,x:0,y:0,minZ:Ve,maxZ:Ke,wrap:Ce,fullyVisible:!1}},Te=[];let De=[];const Me=l,Ge=n.reparseOverscaled?p:l,He=(Q-this._centerAltitude)*G,et=Ce=>{if(!this._elevation||!Ce.tileID||!b)return;const Ke=this._elevation.getMinMaxForTile(Ce.tileID),Ve=Ce.aabb;Ke?(Ve.min[2]=Ke.min,Ve.max[2]=Ke.max,Ve.center[2]=(Ve.min[2]+Ve.max[2])/2):(Ce.shouldSplit=Ne(Ce),Ce.shouldSplit||(Ve.min[2]=Ve.max[2]=Ve.center[2]=this._centerAltitude))},mt=(Ce,Ke)=>{if(.707*Ke<Ce)return 1;const Ve=Ke/Ce;return Ve/(1.4144271570014144+(Math.pow(1.1,Ve-1.4144271570014144+1)-1)/(1.1-1)-1)},Ne=Ce=>{if(Ce.zoom<ce)return!0;if(Ce.zoom===Me)return!1;if(Ce.shouldSplit!=null)return Ce.shouldSplit;const Ke=Ce.aabb.distanceX(J),Ve=Ce.aabb.distanceY(J);let ot=He,Tt=1;if(N){ot=Ce.aabb.distanceZ(J);const Bt=Math.pow(2,Ce.zoom),nr=o.a$((Ce.y+1)/Bt),xr=o.a$(Ce.y/Bt),Ur=Math.min(Math.max(A,nr),xr),dn=o.d1(Ur)/o.d1(A);if(Tt=Ur===A?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,dn/this._mercatorScaleRatio),this.zoom<=o.c_&&Ce.zoom===Me-1&&dn>=.9)return!0}else if(x&&(ot=Ce.aabb.distanceZ(J)*G),this.projection.isReprojectedInTileSpace&&p<=5){const Bt=Math.pow(2,Ce.zoom),nr=_e(new o.ae((Ce.x+.5)/Bt,(Ce.y+.5)/Bt));Tt=nr>.85?1:nr}if(!b&&!N){const Bt=Math.sqrt(Ke*Ke+Ve*Ve+ot*ot);let nr=(1<<Me-Ce.zoom)*de*Tt;return nr*=mt(Math.max(ot,He),Bt),Bt<nr}let zt=Number.MAX_VALUE,wt=0;const gt=Ce.aabb.getCorners(),Kt=[];for(const Bt of gt){o.av(Kt,Bt,J),N||(x?Kt[2]*=G:Kt[2]=He);const nr=o.bJ(Kt,this._camera.forward());nr<zt&&(zt=nr,wt=Math.abs(Kt[2]))}let $t=(1<<Me-Ce.zoom)*de*Tt;if($t*=mt(Math.max(wt,He),zt),zt<$t)return!0;const Dt=Ce.aabb.closestPoint(D);return Dt[0]===D[0]&&Dt[1]===D[1]};if(this.renderWorldCopies)for(let Ce=1;Ce<=3;Ce++)Te.push(pe(-Ce)),Te.push(pe(Ce));for(Te.push(pe(0));Te.length>0;){const Ce=Te.pop(),Ke=Ce.x,Ve=Ce.y;let ot=Ce.fullyVisible;const Tt=()=>this.projection.name==="globe"&&(Ce.y===0||Ce.y===(1<<Ce.zoom)-1);if(!ot){let zt=ae?Ce.aabb.intersects(j):Ce.aabb.intersectsFlat(j);if(zt===0&&Tt()){const wt=new o.cD(Ce.zoom,Ke,Ve);zt=o.cE(this,M,wt,!0).intersects(j)}if(zt===0)continue;ot=zt===2}if(Ce.zoom!==Me&&Ne(Ce))for(let zt=0;zt<4;zt++){const wt=(Ke<<1)+zt%2,gt=(Ve<<1)+(zt>>1),Kt={aabb:b?Ce.aabb.quadrant(zt):o.cF(this,M,Ce.zoom+1,wt,gt,Ce.wrap,Ce.minZ,Ce.maxZ,this.projection),zoom:Ce.zoom+1,x:wt,y:gt,wrap:Ce.wrap,fullyVisible:ot,tileID:void 0,shouldSplit:void 0,minZ:Ce.minZ,maxZ:Ce.maxZ};x&&!N&&(Kt.tileID=new o.aQ(Ce.zoom+1===Me?Ge:Ce.zoom+1,Ce.wrap,Ce.zoom+1,wt,gt),et(Kt)),Te.push(Kt)}else{const zt=Ce.zoom===Me?Ge:Ce.zoom;if(n.minzoom&&n.minzoom>zt)continue;let wt=0;if(!ot){let Dt=ae?Ce.aabb.intersectsPrecise(j):Ce.aabb.intersectsPreciseFlat(j);if(Dt===0&&Tt()){const Bt=new o.cD(Ce.zoom,Ke,Ve);Dt=o.cE(this,M,Bt,!0).intersectsPrecise(j)}if(Dt===0)continue;if(n.calculateQuadrantVisibility)if(j.containsPoint(Ce.aabb.center))wt=15;else for(let Bt=0;Bt<4;Bt++)Ce.aabb.quadrant(Bt).intersects(j)!==0&&(wt|=1<<Bt)}const gt=D[0]-(.5+Ke+(Ce.wrap<<Ce.zoom))*(1<<l-Ce.zoom),Kt=D[1]-.5-Ve,$t=Ce.tileID?Ce.tileID:new o.aQ(zt,Ce.wrap,Ce.zoom,Ke,Ve);n.calculateQuadrantVisibility&&($t.visibleQuadrants=wt),De.push({tileID:$t,distanceSq:gt*gt+Kt*Kt})}}if(this.fogCullDistSq){const Ce=this.fogCullDistSq,Ke=this.horizonLineFromTop();De=De.filter(Ve=>{const ot=[0,0,0,1],Tt=[o.al,o.al,0,1],zt=this.calculateFogTileMatrix(Ve.tileID.toUnwrapped());o.aC(ot,ot,zt),o.aC(Tt,Tt,zt);const wt=o.cG([],ot,Tt),gt=o.cH([],ot,Tt),Kt=o.c$(wt,gt);if(Kt===0)return!0;let $t=!1;const Dt=this._elevation;if(Dt&&Kt>Ce&&Ke!==0){const Bt=this.calculateProjMatrix(Ve.tileID.toUnwrapped());let nr;n.isTerrainDEM||(nr=Dt.getMinMaxForTile(Ve.tileID)),nr||(nr={min:ye,max:Se});const xr=o.cI(this.rotation),Ur=[xr[0]*o.al,xr[1]*o.al,nr.max];o.af(Ur,Ur,Bt),$t=(1-Ur[1])*this.height*.5<Ke}return Kt<Ce||$t})}return De.sort((Ce,Ke)=>Ce.distanceSq-Ke.distanceSq).map(Ce=>Ce.tileID)}resize(n,l){this.width=n,this.height=l,this.pixelsToGLUnits=[2/n,-2/l],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(n){return Math.pow(2,n)}scaleZoom(n){return Math.log2(n)}project(n){const l=o.aA(n.lat,-o.cJ,o.cJ),p=this.projection.project(n.lng,l);return new o.P(p.x*this.worldSize,p.y*this.worldSize)}unproject(n){return this.projection.unproject(n.x/this.worldSize,n.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(n,l){let p,y;const x=this.centerPoint;if(this.projection.name==="globe"){const T=this.worldSize;p=(l.x-x.x)/T,y=(l.y-x.y)/T}else{const T=this.pointCoordinate(l),A=this.pointCoordinate(x);p=T.x-A.x,y=T.y-A.y}const b=this.locationCoordinate(n);this.setLocation(new o.ae(b.x-p,b.y-y))}setLocation(n){this.center=this.coordinateLocation(n),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(n,l){return this.projection.locationPoint(this,n,l)}locationPoint3D(n,l){return this.projection.locationPoint(this,n,l,!0)}pointLocation(n){return this.coordinateLocation(this.pointCoordinate(n))}pointLocation3D(n,l){return this.coordinateLocation(this.pointCoordinate3D(n,l))}locationCoordinate(n,l){const p=l?o.cf(l,n.lat):void 0,y=this.projection.project(n.lng,n.lat);return new o.ae(y.x,y.y,p)}coordinateLocation(n){return this.projection.unproject(n.x,n.y)}pointRayIntersection(n,l){const p=l??this._centerAltitude,y=[n.x,n.y,0,1],x=[n.x,n.y,1,1];o.aC(y,y,this.pixelMatrixInverse),o.aC(x,x,this.pixelMatrixInverse);const b=x[3];o.cK(y,y,1/y[3]),o.cK(x,x,1/b);const T=y[2],A=x[2];return{p0:y,p1:x,t:T===A?0:(p-T)/(A-T)}}screenPointToMercatorRay(n){const l=[n.x,n.y,0,1],p=[n.x,n.y,1,1];return o.aC(l,l,this.pixelMatrixInverse),o.aC(p,p,this.pixelMatrixInverse),o.cK(l,l,1/l[3]),o.cK(p,p,1/p[3]),l[2]=o.cf(l[2],this._center.lat)*this.worldSize,p[2]=o.cf(p[2],this._center.lat)*this.worldSize,o.cK(l,l,1/this.worldSize),o.cK(p,p,1/this.worldSize),new o.ax([l[0],l[1],l[2]],o.aw([],o.av([],p,l)))}rayIntersectionCoordinate(n){const{p0:l,p1:p,t:y}=n,x=o.cf(l[2],this._center.lat),b=o.cf(p[2],this._center.lat);return new o.ae(o.ak(l[0],p[0],y)/this.worldSize,o.ak(l[1],p[1],y)/this.worldSize,o.ak(x,b,y))}pointCoordinate(n,l=this._centerAltitude){return this.projection.pointCoordinate(this,n.x,n.y,l)}pointCoordinate3D(n,l){if(!this.elevation)return this.pointCoordinate(n,l);let p=this.projection.pointCoordinate3D(this,n.x,n.y);if(p)return new o.ae(p[0],p[1],p[2]);let y=0,x=this.horizonLineFromTop();if(n.y>x)return this.pointCoordinate(n,l);const b=.02*x,T=n.clone();for(let A=0;A<10&&x-y>b;A++){T.y=o.ak(y,x,.66);const M=this.projection.pointCoordinate3D(this,T.x,T.y);M?(x=T.y,p=M):y=T.y}return p?new o.ae(p[0],p[1],p[2]):this.pointCoordinate(n)}isPointAboveHorizon(n){return this.projection.isPointAboveHorizon(this,n)}isPointOnSurface(n){if(n.y<0||n.y>this.height||n.x<0||n.x>this.width)return!1;if(this.elevation||this.zoom>=o.cL)return!this.isPointAboveHorizon(n);const l=this.pointCoordinate(n);return l.y>=0&&l.y<=1}_coordinatePoint(n,l){const p=l&&this.elevation?this.elevation.getAtPointOrZero(n,this._centerAltitude):this._centerAltitude,y=[n.x*this.worldSize,n.y*this.worldSize,p+n.toAltitude(),1];return o.aC(y,y,this.pixelMatrix),y[3]>0?new o.P(y[0]/y[3],y[1]/y[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:n,left:l}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,y=this.width-this._edgeInsets.right,x=this.pointLocation3D(new o.P(l,n)),b=this.pointLocation3D(new o.P(y,n)),T=this.pointLocation3D(new o.P(y,p)),A=this.pointLocation3D(new o.P(l,p));let M=Math.min(x.lng,b.lng,T.lng,A.lng),D=Math.max(x.lng,b.lng,T.lng,A.lng),N=Math.min(x.lat,b.lat,T.lat,A.lat),B=Math.max(x.lat,b.lat,T.lat,A.lat);const j=Math.pow(2,-this.zoom)/16*270,H=this.projection.name==="globe"?1:4,G=(Q,J,ae,de,ce)=>{const Se=(Q+ae)/2,ye=(J+de)/2,we=new o.P(Se,ye),{lng:_e,lat:pe}=this.pointLocation3D(we),Te=Math.max(0,M-_e,N-pe,_e-D,pe-B);M=Math.min(M,_e),D=Math.max(D,_e),N=Math.min(N,pe),B=Math.max(B,pe),(ce<H||Te>j)&&(G(Q,J,Se,ye,ce+1),G(Se,ye,ae,de,ce+1))};if(G(l,n,y,n,1),G(y,n,y,p,1),G(y,p,l,p,1),G(l,p,l,n,1),this.projection.name==="globe"){const[Q,J]=o.cM(this);Q?(B=90,D=180,M=-180):J&&(N=-90,D=180,M=-180)}return new o.aI(new o.aT(M,N),new o.aT(D,B))}_getBoundsRectangular(n,l){const{top:p,left:y}=this._edgeInsets,x=this.height-this._edgeInsets.bottom,b=this.width-this._edgeInsets.right,T=new o.P(y,p),A=new o.P(b,p),M=new o.P(b,x),D=new o.P(y,x);let N=this.pointCoordinate(T,n),B=this.pointCoordinate(A,n);const j=this.pointCoordinate(M,l),H=this.pointCoordinate(D,l),G=(Q,J)=>(J.y-Q.y)/(J.x-Q.x);return N.y>1&&B.y>=0?N=new o.ae((1-H.y)/G(H,N)+H.x,1):N.y<0&&B.y<=1&&(N=new o.ae(-H.y/G(H,N)+H.x,0)),B.y>1&&N.y>=0?B=new o.ae((1-j.y)/G(j,B)+j.x,1):B.y<0&&N.y<=1&&(B=new o.ae(-j.y/G(j,B)+j.x,0)),new o.aI().extend(this.coordinateLocation(N)).extend(this.coordinateLocation(B)).extend(this.coordinateLocation(H)).extend(this.coordinateLocation(j))}_getBoundsRectangularTerrain(){const n=this.elevation;if(!n.visibleDemTiles.length||n.isUsingMockSource())return this._getBoundsRectangular(0,0);const l=n.visibleDemTiles.reduce((p,y)=>{if(y.dem){const x=y.dem.tree;p.min=Math.min(p.min,x.minimums[0]),p.max=Math.max(p.max,x.maximums[0])}return p},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(l.min*n.exaggeration(),l.max*n.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(n=!0){const l=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,p=this.height/2-l*(1-this._horizonShift);return n?Math.max(0,p):p}getMaxBounds(){return this.maxBounds}setMaxBounds(n){this.maxBounds=n,this.minLat=-o.cJ,this.maxLat=o.cJ,this.minLng=-180,this.maxLng=180,n&&(this.minLat=n.getSouth(),this.maxLat=n.getNorth(),this.minLng=n.getWest(),this.maxLng=n.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=o.aF(this.minLng)*this.tileSize,this.worldMaxX=o.aF(this.maxLng)*this.tileSize,this.worldMinY=o.aJ(this.maxLat)*this.tileSize,this.worldMaxY=o.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(n,l){return this.projection.createTileMatrix(this,l,n)}calculateDistanceTileData(n){const l=n.key,p=this._distanceTileDataCache;if(p[l])return p[l];const y=n.canonical,x=1/this.height,b=this.cameraWorldSize,T=b/this.zoomScale(y.z),A=(y.x+Math.pow(2,y.z)*n.wrap)*T,M=y.y*T,D=this.point;D.x*=b/this.worldSize,D.y*=b/this.worldSize;const N=this.angle,B=Math.sin(-N),j=-Math.cos(-N);return p[l]={bearing:[B,j],center:[(D.x-A)*x,(D.y-M)*x],scale:T/o.al*x},p[l]}calculateFogTileMatrix(n){const l=n.key,p=this._fogTileMatrixCache;if(p[l])return p[l];const y=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,n);return o.aB(y,this.worldToFogMatrix,y),p[l]=new Float32Array(y),p[l]}calculateProjMatrix(n,l=!1,p=!1){const y=n.key;let x;if(x=p?this._expandedProjMatrixCache:l?this._alignedProjMatrixCache:this._projMatrixCache,x[y])return x[y];const b=this.calculatePosMatrix(n,this.worldSize);let T;return T=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:p?this.expandedFarZProjMatrix:l?this.alignedProjMatrix:this.projMatrix,o.aB(b,T,b),x[y]=new Float32Array(b),x[y]}calculatePixelsToTileUnitsMatrix(n){const l=n.tileID.key,p=this._pixelsToTileUnitsCache;if(p[l])return p[l];const y=o.cN(n,this);return p[l]=y,p[l]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const n=1/this.worldSize,l=o.bq([],[n,n,n]);return o.aB(l,l,this.globeMatrix),l}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const n=this._elevation;this._updateCameraState();const l=o.cf(1,this._center.lat)*this.worldSize,p=this._computeCameraPosition(l),y=this._camera.forward(),x=o.cf(1,this._center.lat);p[2]/=x,y[2]/=x,o.aw(y,y);const b=n.raycast(p,y,n.exaggeration());if(b){const T=o.bH([],p,y,b),A=new o.ae(T[0],T[1],o.cf(T[2],o.a$(T[1]))),M=(A.z+o.ag([A.x-p[0],A.y-p[1],A.z-p[2]*x]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(M),this._centerAltitude=A.toAltitude(),this._center=this.coordinateLocation(A),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(n=!1){if(!this._elevation)return;const l=this._elevation,p=o.cf(1,this._center.lat)*this.worldSize,y=this._computeCameraPosition(p),x=l.getAtPointOrZero(new o.ae(...y)),b=this.pixelsPerMeter/this.worldSize*x,T=this._minimumHeightOverTerrain(),A=y[2]-b;if(A<=T)if(A<0||n){const M=this.locationCoordinate(this._center,this._centerAltitude),D=[y[0],y[1],M.z-y[2]],N=o.ag(D);D[2]-=(T-A)/this._pixelsPerMercatorPixel;const B=o.ag(D);if(B===0)return;o.c5(D,D,N/B*this._pixelsPerMercatorPixel),this._camera.position=[y[0],y[1],M.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 n=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||n){const B=this.center;return B.lat=o.aA(B.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!n)&&(B.lng=o.aA(B.lng,this.minLng,this.maxLng)),this.center=B,void(this._constraining=!1)}const l=this._unmodified,{x:p,y}=this.point;let x=0,b=p,T=y;const A=this.width/2,M=this.height/2,D=this.worldMinY*this.scale,N=this.worldMaxY*this.scale;if(y-M<D&&(T=D+M),y+M>N&&(T=N-M),N-D<this.height&&(x=Math.max(x,this.height/(N-D)),T=(N+D)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const B=this.worldMinX*this.scale,j=this.worldMaxX*this.scale,H=this.worldSize/2-(B+j)/2;b=(p+H+this.worldSize)%this.worldSize-H,b-A<B&&(b=B+A),b+A>j&&(b=j-A),j-B<this.width&&(x=Math.max(x,this.width/(j-B)),b=(j+B)/2)}b===p&&T===y||this._allowWorldUnderZoom||(this.center=this.unproject(new o.P(b,T))),x&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(x)),this._constrainCamera(),this._unmodified=l,this._constraining=!1}_minZoomForBounds(){let n=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(n=Math.max(n,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),n}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const n=this.centerOffset,l=this.projection.name==="globe",p=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.cf(1,this.center.lat)/o.cf(1,o.d2));const y=o.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,y),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"?p:1,b=this._camera.getWorldToCamera(this.worldSize,x);let T;const A=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(A[8]=2*-n.x/this.width,A[9]=2*n.y/this.height,this.isOrthographic){let pe=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),Te=pe*this.aspect,De=-Te,Me=-pe;Te-=n.x,De-=n.x,pe+=n.y,Me+=n.y,T=this._camera.getCameraToClipOrthographic(De,Te,Me,pe,this._nearZ,this._farZ),((Ge,He,et,mt)=>{for(let Ne=0;Ne<16;Ne++)Ge[Ne]=o.ak(He[Ne],et[Ne],mt)})(T,T,A,o.d0(this.pitch>=La?1:this.pitch/La))}else T=A;const M=o.cP([],A,b);let D=o.cP([],T,b);if(this.projection.isReprojectedInTileSpace){const pe=this.locationCoordinate(this.center),Te=o.bA([]);o.br(Te,Te,[pe.x*this.worldSize,pe.y*this.worldSize,0]),o.aB(Te,Te,o.cQ(this)),o.br(Te,Te,[-pe.x*this.worldSize,-pe.y*this.worldSize,0]),o.aB(D,D,Te),o.aB(M,M,Te),this.inverseAdjustmentMatrix=o.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.cS([],D,[this.worldSize,this.worldSize,this.worldSize/x,1]),this.projMatrix=D,this.invProjMatrix=o.bl(new Float64Array(16),this.projMatrix),l){const pe=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);pe[8]=2*-n.x/this.width,pe[9]=2*n.y/this.height,this.expandedFarZProjMatrix=o.cP([],pe,b)}else this.expandedFarZProjMatrix=this.projMatrix;const N=o.bl([],T);this.frustumCorners=o.cT.fromInvProjectionMatrix(N,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!l);const B=new Float32Array(16);o.bA(B),o.cS(B,B,[1,-1,1]),o.cU(B,B,this._pitch),o.bB(B,B,this.angle);const j=o.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.bz(j);const H=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;j[8]=2*-n.x/this.width,j[9]=2*(n.y+H)/this.height,this.skyboxMatrix=o.aB(B,j,B);const G=this.point,Q=G.x,J=G.y,ae=this.width%2/2,de=this.height%2/2,ce=Math.cos(this.angle),Se=Math.sin(this.angle),ye=Q-Math.round(Q)+ce*ae+Se*de,we=J-Math.round(J)+ce*de+Se*ae,_e=new Float64Array(D);if(o.br(_e,_e,[ye>.5?ye-1:ye,we>.5?we-1:we,0]),this.alignedProjMatrix=_e,D=o.bC(),o.cS(D,D,[this.width/2,-this.height/2,1]),o.br(D,D,[1,-1,0]),this.labelPlaneMatrix=D,D=o.bC(),o.cS(D,D,[1,-1,1]),o.br(D,D,[-1,-1,0]),o.cS(D,D,[2/this.width,2/this.height,1]),this.glCoordMatrix=D,this.pixelMatrix=o.aB(new Float64Array(16),this.labelPlaneMatrix,M),this._calcFogMatrices(),this._distanceTileDataCache={},D=o.bl(new Float64Array(16),this.pixelMatrix),!D)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=D,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.cV(this);const pe=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.af(pe,pe,b),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=D;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const n=this.cameraWorldSizeForFog,l=this.cameraPixelsPerMeter,p=this._camera.position,y=1/this.height/this._pixelsPerMercatorPixel,x=[n,n,l];o.c5(x,x,y),o.c5(p,p,-1),o.cW(p,p,x);const b=o.bC();o.br(b,b,p),o.cS(b,b,x),this.mercatorFogMatrix=b,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(n,l,y)}_computeCameraPosition(n){const l=(n=n||this.pixelsPerMeter)/this.pixelsPerMeter,p=this._camera.forward(),y=this.point,x=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*l-n/this.worldSize*this._centerAltitude;return[y.x/this.worldSize-p[0]*x,y.y/this.worldSize-p[1]*x,n/this.worldSize*this._centerAltitude-p[2]*x]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(n){const l=this._maxCameraBoundsDistance()*Math.cos(this._pitch),p=this._camera.position[2],y=n[2];let x=1;this.projection.wrap&&(this.center=this.center.wrap()),y>0&&(x=Math.min((l-p)/y,1)),this._camera.position=o.bH([],this._camera.position,n,x),this._updateStateFromCamera()}_updateStateFromCamera(){const n=this._camera.position,l=this._camera.forward(),{pitch:p,bearing:y}=this._camera.getPitchBearing(),x=o.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,b=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.an(this._maxPitch)),T=Math.max((n[2]-x)/Math.cos(p),b),A=this._zoomFromMercatorZ(T);o.bH(n,n,l,T),this._pitch=o.aA(p,o.an(this.minPitch),o.an(this.maxPitch)),this.angle=o.bT(y,-Math.PI,Math.PI),this._setZoom(o.aA(A,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.ae(n[0],n[1],n[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(n){return Math.pow(2,n)*this.tileSize}_mercatorZfromZoom(n){return this.cameraToCenterDistance/this._worldSizeFromZoom(n)}_minimumHeightOverTerrain(){const n=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(n)}_zoomFromMercatorZ(n){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,n)*this.tileSize))}zoomFromMercatorZAdjusted(n){let l=0,p=o.cL,y=0,x=1/0;for(;p-l>1e-6&&p>l;){const b=l+.5*(p-l),T=this.tileSize*Math.pow(2,b),A=this.getCameraToCenterDistance(this.projection,b,T),M=this.scaleZoom(A/(Math.max(0,n)*this.tileSize)),D=Math.abs(b-M);D<x&&(x=D,y=b),b<M?l=b:p=b}return y}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(n,l){const p=Math.min(n.x,l.x),y=Math.max(n.x,l.x),x=Math.min(n.y,l.y),b=Math.max(n.y,l.y);if(x<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const T=[new o.P(p,x),new o.P(y,b),new o.P(p,b),new o.P(y,x)],A=this.renderWorldCopies?-3:0,M=this.renderWorldCopies?4:1;for(const D of T){const N=this.pointRayIntersection(D);if(N.t<0)return!0;const B=this.rayIntersectionCoordinate(N);if(B.x<A||B.y<0||B.x>M||B.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(n,l){const p=o.ag(o.av([],this._camera.position,n)),y=this._zoomFromMercatorZ(p)+l;return p-this._mercatorZfromZoom(y)}getCameraPoint(){if(this.projection.name==="globe"){const n=function([l,p,y],x){const b=[l,p,y,1];o.aC(b,b,x);const T=b[3]=Math.max(b[3],1e-6);return b[0]/=T,b[1]/=T,b[2]/=T,b}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new o.P(n[0],n[1])}{const n=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,n))}}getCameraToCenterDistance(n,l=this.zoom,p=this.worldSize){const y=o.cO(n,l,this.width,this.height,1024),x=n.pixelSpaceConversion(this.center.lat,p,y);let b=.5/Math.tan(.5*this._fov)*this.height*x;return this.isOrthographic&&(b=o.ak(1,b,o.d0(this.pitch>=La?1:this.pitch/La))),b}getWorldToCameraMatrix(){const n=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.aB(n,n,this.globeMatrix),n}getFrustum(n){return o.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,this.projection.zAxisUnit==="meters")}}const yc=(f,n)=>{if(n>0&&f.terrain&&o.w("Cutoff is currently disabled on terrain"),n<=0||f.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const l=f.transform,p=Math.max(Math.abs(l._zoom-(f.minCutoffZoom-1)),1),y=l.isLODDisabled(!1)?o.ah(60,45,l.pitch):o.ah(30,15,l.pitch),x=l._farZ-l._nearZ,b=n*l.height,T=((1-(A=y))*l.cameraToCenterDistance+A*(l._farZ+b))*p;var A;return{shouldRenderCutoff:y<1,uniformValues:{u_cutoff_params:[l._nearZ,l._farZ,(T-l._nearZ)/x,(T-b-l._nearZ)/x]}}},ma=2048;class Eh{constructor(n,l){this.aabb=n,this.lastCascade=l}}class wS{add(n,l){const p=this.receivers[n.key];p!==void 0?(p.aabb.min[0]=Math.min(p.aabb.min[0],l.min[0]),p.aabb.min[1]=Math.min(p.aabb.min[1],l.min[1]),p.aabb.min[2]=Math.min(p.aabb.min[2],l.min[2]),p.aabb.max[0]=Math.max(p.aabb.max[0],l.max[0]),p.aabb.max[1]=Math.max(p.aabb.max[1],l.max[1]),p.aabb.max[2]=Math.max(p.aabb.max[2],l.max[2])):this.receivers[n.key]=new Eh(l,null)}clear(){this.receivers={}}get(n){return this.receivers[n.key]}computeRequiredCascades(n,l,p){const y=o.d9.fromPoints(n.points);let x=0;for(const b in this.receivers){const T=this.receivers[b];if(!T||!y.intersectsAabb(T.aabb))continue;T.aabb.min=y.closestPoint(T.aabb.min),T.aabb.max=y.closestPoint(T.aabb.max);const A=T.aabb.getCorners();for(let M=0;M<p.length;M++){let D=!0;for(const N of A){const B=[N[0]*l,N[1]*l,N[2]];if(o.af(B,B,p[M].matrix),B[0]<-1||B[0]>1||B[1]<-1||B[1]>1){D=!1;break}}if(T.lastCascade=M,x=Math.max(x,M),D)break}}return x+1}}class Xu{constructor(n){this.painter=n,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new wS,this._depthMode=new Xt(n.context.gl.LEQUAL,Xt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const n of this._cascades)n.texture.destroy(),n.framebuffer.destroy();this._cascades=[]}updateShadowParameters(n,l){const p=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!l||!l.properties)return;const y=l.properties.get("shadow-intensity");if(!l.shadowsEnabled()||y<=0||(this._shadowLayerCount=p.style.order.reduce((H,G)=>{const Q=p.style._mergedLayers[G];return H+(Q.hasShadowPass()&&!Q.isHidden(n.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const x=p.context,b=ma,T=ma;if(this._cascades.length===0||ma!==this._cascades[0].texture.size[0]){this._cascades=[];for(let H=0;H<2;++H){const G=p._shadowMapDebug,Q=x.gl,J=x.createFramebuffer(b,T,G?1:0,"texture"),ae=new o.T(x,{width:b,height:T,data:null},Q.DEPTH_COMPONENT16);if(J.depthAttachment.set(ae.texture),G){const de=new o.T(x,{width:b,height:T,data:null},Q.RGBA8);J.colorAttachment0.set(de.texture)}this._cascades.push({framebuffer:J,texture:ae,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.cB,scale:0})}}this.shadowDirection=Ah(l);let A=0;if(n.elevation){const H=n.elevation,G=[1e4,-1e4];H.visibleDemTiles.filter(Q=>Q.dem).forEach(Q=>{const J=Q.dem.tree;G[0]=Math.min(G[0],J.minimums[0]),G[1]=Math.max(G[1],J.maximums[0])}),G[0]!==1e4&&(A=(G[1]-G[0])*H.exaggeration())}const M=1.5*n.cameraToCenterDistance,D=3*M,N=new Float64Array(16);for(let H=0;H<this._cascades.length;++H){const G=this._cascades[H];let Q=n.height/50,J=1;H===0?J=M:(Q=M,J=D);const[ae,de]=vc(n,this.shadowDirection,Q,J,ma,A);G.scale=n.scale,G.matrix=ae,G.boundingSphereRadius=de,o.bl(N,G.matrix),G.frustum=o.cB.fromInvProjectionMatrix(N,1,0,!0),G.far=J}const B=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[B].far,this._cascades[B].far],this._uniformValues.u_shadow_intensity=y,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=ma,this._uniformValues.u_shadowmap_0=ms.ShadowMap0,this._uniformValues.u_shadowmap_1=ms.ShadowMap0+1,this._groundShadowTiles=p.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const j=p.transform.elevation;for(const H of this._groundShadowTiles){let G={min:0,max:0};if(j){const Q=j.getMinMaxForTile(H);Q&&(G=Q)}this.addShadowReceiver(H.toUnwrapped(),G.min,G.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(n){this._enabled=n}drawShadowPass(n,l){if(!this.enabled)return;const p=this.painter,y=p.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(p.transform.getFrustum(0),p.transform.worldSize,this._cascades),y.viewport.set([0,0,ma,ma]);for(let x=0;x<this._numCascadesToRender;++x){p.currentShadowCascade=x,y.bindFramebuffer.set(this._cascades[x].framebuffer.framebuffer),y.clear({color:o.ao.white,depth:1});for(const b of n.order){const T=n._mergedLayers[b];if(!T.hasShadowPass()||T.isHidden(p.transform.zoom))continue;const A=n.getLayerSourceCache(T),M=A?l[A.id]:void 0;(T.type==="model"||M&&M.length)&&p.renderLayer(p,A,T,M)}}p.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const n=this.painter,l=n.style,p=n.context,y=p.gl,x=l.directionalLight,b=l.ambientLight;if(!x||!b)return;const T=[],A=yc(n,n.longestCutoffRange);A.shouldRenderCutoff&&T.push("RENDER_CUTOFF"),T.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&T.push("NORMAL_OFFSET");const M=Cl(l,x,b),D=new Xt(y.LEQUAL,Xt.ReadOnly,n.depthRangeFor3D),N=new pr({func:y.EQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.KEEP);for(const B of this._groundShadowTiles){const j=B.toUnwrapped(),H=n.isTileAffectedByFog(B),G=n.getOrCreateProgram("groundShadow",{defines:T,overrideFog:H});this.setupShadows(j,G),n.uploadCommonUniforms(p,G,j,null,A);const Q={u_matrix:n.transform.calculateProjMatrix(j),u_ground_shadow_factor:M};G.draw(n,y.TRIANGLES,D,N,Er.multiply,fr.disabled,Q,"ground_shadow",n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.tileExtentSegments,null,n.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Er.unblended:Er.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(n){const l=this.painter.transform,p=l.calculatePosMatrix(n,l.worldSize);return o.aB(p,this._cascades[this.painter.currentShadowCascade].matrix,p),Float32Array.from(p)}calculateShadowPassMatrixFromMatrix(n){const l=o.bz(n);return o.aB(l,this._cascades[this.painter.currentShadowCascade].matrix,n),l}setupShadows(n,l,p){if(!this.enabled)return;const y=this.painter.transform,x=this.painter.context,b=x.gl,T=this._uniformValues,A=new Float64Array(16),M=y.calculatePosMatrix(n,y.worldSize);for(let D=0;D<this._cascades.length;D++)o.aB(A,this._cascades[D].matrix,M),T[D===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(A),x.activeTexture.set(b.TEXTURE0+ms.ShadowMap0+D),this._cascades[D].texture.bindExtraParam(b.LINEAR,b.LINEAR,b.CLAMP_TO_EDGE,b.CLAMP_TO_EDGE,b.GREATER);if(this.useNormalOffset=!!p,this.useNormalOffset){const D=o.d7(n.canonical),N=2/y.tileSize*o.al/ma,B=N*this._cascades[0].boundingSphereRadius,j=N*this._cascades[this._cascades.length-1].boundingSphereRadius,H=(p==="vector-tile"?1:3)*function(G,Q,J,ae,de){const ce=o.aA((G-22)/-22,0,1);return .125*(1-ce)+4*ce}(y.zoom);T.u_shadow_normal_offset=[D,B*H,j*H],T.u_shadow_bias=[1e-4,.0012,.012]}else T.u_shadow_bias=[36e-5,.0012,.012];l.setShadowUniformValues(x,T)}setupShadowsFromMatrix(n,l,p=!1){if(!this.enabled)return;const y=this.painter.context,x=y.gl,b=this._uniformValues,T=new Float64Array(16);for(let A=0;A<2;A++)o.aB(T,this._cascades[A].matrix,n),b[A===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),y.activeTexture.set(x.TEXTURE0+ms.ShadowMap0+A),this._cascades[A].texture.bindExtraParam(x.LINEAR,x.LINEAR,x.CLAMP_TO_EDGE,x.CLAMP_TO_EDGE,x.GREATER);this.useNormalOffset=p,p?(b.u_shadow_normal_offset=[1,3,3],b.u_shadow_bias=[6e-5,.0012,.012]):b.u_shadow_bias=[36e-5,.0012,.012],l.setShadowUniformValues(y,b)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(n,l,p,y){if(y[2]>=0)return{};const x=function(A,M,D){const N=D/(1<<A.canonical.z);return new o.d9([A.canonical.x*N+A.wrap*D,A.canonical.y*N+A.wrap*D,0],[(A.canonical.x+1)*N+A.wrap*D,(A.canonical.y+1)*N+A.wrap*D,M])}(n,l,p).getCorners(),b=l/-y[2];y[0]<0?(o.d8(x[0],x[0],[y[0]*b,0,0]),o.d8(x[3],x[3],[y[0]*b,0,0])):y[0]>0&&(o.d8(x[1],x[1],[y[0]*b,0,0]),o.d8(x[2],x[2],[y[0]*b,0,0])),y[1]<0?(o.d8(x[0],x[0],[0,y[1]*b,0]),o.d8(x[1],x[1],[0,y[1]*b,0])):y[1]>0&&(o.d8(x[2],x[2],[0,y[1]*b,0]),o.d8(x[3],x[3],[0,y[1]*b,0]));const T={};return T.vertices=x,T.planes=[kh(x[1],x[0],x[4]),kh(x[2],x[1],x[5]),kh(x[3],x[2],x[6]),kh(x[0],x[3],x[7])],T}addShadowReceiver(n,l,p){this._receivers.add(n,o.d9.fromTileIdAndHeight(n,l,p))}getMaxCascadeForTile(n){const l=this._receivers.get(n);return l&&l.lastCascade?l.lastCascade:0}}function kh(f,n,l){const p=o.av([],l,n),y=o.av([],f,n),x=o.bI([],p,y),b=o.ag(x);return b===0?[0,0,1,0]:(o.c5(x,x,1/b),[x[0],x[1],x[2],-o.bJ(x,n)])}function Ah(f){const n=f.properties.get("direction"),l=o.d4(n.x,n.y,n.z);l[2]=o.aA(l[2],0,75);const p=o.d6([l[0],l[1],l[2]]);return o.d5(p.x,p.y,p.z)}function Cl(f,n,l){const p=n.properties.get("color-use-theme")==="none",y=n.properties.get("color"),x=n.properties.get("intensity"),b=n.properties.get("direction"),T=[b.x,b.y,b.z],A=l.properties.get("color-use-theme")==="none",M=l.properties.get("color"),D=l.properties.get("intensity"),N=Math.max(o.bJ([0,0,1],T),0),B=[0,0,0];o.c5(B,M.toPremultipliedRenderColor(A?null:f.getLut(n.scope)).toArray01Linear().slice(0,3),D);const j=[0,0,0];return o.c5(j,y.toPremultipliedRenderColor(p?null:f.getLut(l.scope)).toArray01Linear().slice(0,3),N*x),o.db([B[0]>0?B[0]/(B[0]+j[0]):0,B[1]>0?B[1]/(B[1]+j[1]):0,B[2]>0?B[2]/(B[2]+j[2]):0])}function vc(f,n,l,p,y,x){const b=f.zoom,T=f.scale,A=f.worldSize,M=1/A,D=f.aspect,N=Math.sqrt(1+D*D)*Math.tan(.5*f.fovX),B=N*N,j=p-l,H=p+l;let G,Q;B>j/H?(G=p,Q=p*N):(G=.5*H*(1+B),Q=.5*Math.sqrt(j*j+2*(p*p+l*l)*B+H*H*B*B));const J=f.projection.pixelsPerMeter(f.center.lat,A),ae=f._camera.getCameraToWorldMercator(),de=[0,0,-G*M];o.af(de,de,ae);let ce=Q*M;const Se=f._edgeInsets;if(!(Se.left===0&&Se.top===0&&Se.right===0&&Se.bottom===0||Se.left===Se.right&&Se.top===Se.bottom)){const ot=f._camera.getWorldToCamera(f.worldSize,f.projection.zAxisUnit==="meters"?J:1),Tt=f._camera.getCameraToClipPerspective(f._fov,f.width/f.height,l,p);Tt[8]=2*-f.centerOffset.x/f.width,Tt[9]=2*f.centerOffset.y/f.height;const zt=new Float64Array(16);o.cP(zt,Tt,ot);const wt=new Float64Array(16);o.bl(wt,zt);const gt=o.cB.fromInvProjectionMatrix(wt,A,b,!0);for(const Kt of gt.points){const $t=((ye=Kt)[0]/=T,ye[1]/=T,ye[2]=o.cf(ye[2],f._center.lat),ye);ce=Math.max(ce,o.c6(o.da([],de,$t)))}}var ye;ce*=y/(y-1);const we=Math.acos(n[2]),_e=Math.atan2(-n[0],-n[1]),pe=new up;pe.position=de,pe.setPitchBearing(we,_e);const Te=pe.getWorldToCamera(A,J),De=ce*A,Me=Math.min(f._mercatorZfromZoom(17)*A*-2,-2*De),Ge=pe.getCameraToClipOrthographic(-De,De,-De,De,Me,(De+x*J)/n[2]),He=new Float64Array(16);o.aB(He,Ge,Te);const et=o.d5(Math.floor(1e6*de[0])/1e6*A,Math.floor(1e6*de[1])/1e6*A,0),mt=.5*y,Ne=[0,0,0];o.af(Ne,et,He),o.c5(Ne,Ne,mt);const Ce=[Math.floor(Ne[0]),Math.floor(Ne[1]),Math.floor(Ne[2])],Ke=[0,0,0];o.av(Ke,Ne,Ce),o.c5(Ke,Ke,-1/mt);const Ve=new Float64Array(16);return o.bA(Ve),o.br(Ve,Ve,Ke),o.aB(He,Ve,He),[He,De]}class bS extends o.E{constructor(n){super(),this.requestManager=n,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(n,l){return o.dc(this.requestManager.transformRequest(l,o.R.Model).url).then(p=>{if(!p)return;const y=o.dd(p),x=new o.de(n,l,void 0,void 0,y);return x.computeBoundsAndApplyParent(),x}).catch(p=>{if(p&&p.status===404)return null;this.fire(new o.y(new Error(`Could not load model ${n} from ${l}: ${p.message}`)))})}load(n,l,p={forceReload:!1}){this.models[l]||(this.models[l]={});const y=Object.keys(n),x=[],b=[];for(const T of y){const A=n[T];this.hasURLBeenRequested(A)&&!p.forceReload||(this.modelByURL[A]={modelId:T,scope:l},x.push(this.loadModel(T,A)),b.push(T)),this.models[l][T]||(this.models[l][T]={model:null,numReferences:1})}this.numModelsLoading[l]=(this.numModelsLoading[l]||0)+b.length,Promise.allSettled(x).then(T=>{for(let A=0;A<T.length;A++){const{status:M}=T[A];if(M==="rejected")continue;const{value:D}=T[A];this.models[l][b[A]]||(this.models[l][b[A]]={model:null,numReferences:1}),this.models[l][b[A]].model=D}this.numModelsLoading[l]-=b.length,this.fire(new o.z("data",{dataType:"style"}))}).catch(T=>{this.fire(new o.y(new Error(`Could not load models: ${T.message}`)))})}isLoaded(){for(const n in this.numModelsLoading)if(this.numModelsLoading[n]>0)return!1;return!0}hasModel(n,l,p={exactIdMatch:!1}){return!!(p.exactIdMatch?this.getModel(n,l):this.getModelByURL(this.modelUris[l][n]))}getModel(n,l){return this.models[l]||(this.models[l]={}),this.models[l][n]?this.models[l][n].model:void 0}getModelByURL(n){if(!n)return null;const l=this.modelByURL[n];return l?this.models[l.scope][l.modelId].model:null}hasModelBeenAdded(n,l){return this.models[l]&&this.models[l][n]!==void 0}getModelURIs(n){return this.modelUris[n]||{}}addModel(n,l,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const y=this.requestManager.normalizeModelURL(l);if((this.hasModel(n,p,{exactIdMatch:!0})||this.hasModelBeenAdded(n,p))&&this.modelUris[p][n]===y)this.models[p][n].numReferences++;else if(this.hasURLBeenRequested(y)){const{scope:x,modelId:b}=this.modelByURL[y];this.models[x][b].numReferences++}else this.modelUris[p][n]=y,this.load({[n]:this.modelUris[p][n]},p)}addModelURLs(n,l){this.models[l]||(this.models[l]={}),this.modelUris[l]||(this.modelUris[l]={});const p=this.modelUris[l];for(const y in n)p[y]=this.requestManager.normalizeModelURL(n[y])}reloadModels(n){this.load(this.modelUris[n],n,{forceReload:!0})}addModelsFromBucket(n,l){this.models[l]||(this.models[l]={}),this.modelUris[l]||(this.modelUris[l]={});const p={};for(const y of n)this.hasModel(y,l,{exactIdMatch:!0})||this.hasURLBeenRequested(y)?this.models[l][y].numReferences++:this.modelUris[l][y]&&!this.hasURLBeenRequested(y)?p[y]=this.modelUris[l][y]:!this.hasURLBeenRequested(y)&&o.df(y,!1)&&(this.modelUris[l][y]=this.requestManager.normalizeModelURL(y),p[y]=this.modelUris[l][y]);this.load(p,l)}hasURLBeenRequested(n){return this.modelByURL[n]!==void 0}removeModel(n,l,p=!1,y=!1){if(this.models[l]&&this.models[l][n]&&(this.models[l][n].numReferences--,this.models[l][n].numReferences===0||y)){const x=this.modelUris[l][n];p||delete this.modelUris[l][n],delete this.modelByURL[x];const b=this.models[l][n].model;if(!b)return;delete this.models[l][n],b.destroy()}}destroy(){for(const n of Object.keys(this.models))for(const l of Object.keys(this.models[n])){const p=this.models[n][l].model;delete this.models[n][l],p&&p.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(n){return this.models[n]||(this.models[n]={}),Object.keys(this.models[n])}upload(n,l){this.models[l]||(this.models[l]={});for(const p in this.models[l])this.models[l][p].model&&this.models[l][p].model.upload(n.context)}}const __=o.a6.colorTheme,SS=new o.a9({data:new o.aa(__.data)});function W0(f){if(!f.metadata||!f.metadata.content_area)return;const n=o.o.devicePixelRatio,{left:l,top:p,width:y,height:x}=f.metadata.content_area,b=l*n,T=p*n;return[b,T,b+y*n,T+x*n]}function q0(f){if(f)return f.map(([n,l])=>[n*o.o.devicePixelRatio,l*o.o.devicePixelRatio])}class y_{constructor(n,l,p){this.id=n,this.scope=l,this.sourceCache=p,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(n){this.missingRequests.has(n.name)||this.pendingRequests.has(n.name)||this.pendingRequests.add(n.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const n=new Map;if(!this.sourceCache.loaded())return n;const l=this.sourceCache.getVisibleCoordinates();if(l.length===0)return n;const p=this.sourceCache.getSource();if(!(p instanceof Ys))return n;const y=l.map(b=>this.sourceCache.getTile(b)),x=p.getImages(y,Array.from(this.pendingRequests));for(const[b,T]of x)n.set(o.I.from({name:b,iconsetId:this.id}),T),this.pendingRequests.delete(b);for(const b of this.pendingRequests)this.missingRequests.add(b);return this.pendingRequests.clear(),n}}const xc=(f,n)=>fe(f,n&&n.filter(l=>l.identifier!=="source.canvas")),K0=o.aH(nn,["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"]),Z0=o.aH(nn,["setCenter","setZoom","setBearing","setPitch"]),hp=new Set(["background","sky","slot","custom"]),wc={version:8,layers:[],sources:{}},Ch={duration:300,delay:0};class ga extends o.E{constructor(n,l={}){super(),this.map=n,this.scope=l.scope||"",this.globalId=null,this.fragments=[],this.importDepth=l.importDepth||0,this.importsCache=l.importsCache||new Map,this.resolvedImports=l.resolvedImports||new Set,this.transition=Object.assign({},Ch),this._buildingIndex=new vS(this),this.crossTileSymbolIndex=new Da,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=l.styleChanges||new Zn,this._hasDataDrivenEmissive=!1,this.dispatcher=l.dispatcher?l.dispatcher:new o.D(o.dh(),this),l.imageManager?this.imageManager=l.imageManager:(this.imageManager=new ua(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=l.glyphManager?l.glyphManager:new o.di(n._requestManager,l.localFontFamily?o.dj.all:l.localIdeographFontFamily?o.dj.ideographs:o.dj.none,l.localFontFamily||l.localIdeographFontFamily),l.modelManager?this.modelManager=l.modelManager:(this.modelManager=new bS(n._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=l.configOptions?l.configOptions:new Map,this._configDependentLayers=l.configDependentLayers?l.configDependentLayers:new Set,this._indoorDependentLayers=l.indoorDependentLayers?l.indoorDependentLayers:new Set,this._config=l.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:l.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=l.initialConfig,this.dispatcher.broadcast("setReferrer",o.dk());const p=this;this._rtlTextPluginCallback=ga.registerForPluginStateChange(y=>{p.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:y.pluginStatus,pluginURL:y.pluginURL},(x,b)=>{if(o.dl(x),b&&b.every(T=>T))for(const T in p._sourceCaches){const A=p._sourceCaches[T],M=A.getSource().type;M!=="vector"&&M!=="geojson"||A.reload()}})}),this.on("data",y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const x=this.getOwnSource(y.sourceId);if(x&&x.vectorLayerIds)for(const b in this._layers){const T=this._layers[b];T.source===x.id&&this._validateLayer(T)}})}load(n){return n?(typeof n=="string"?this.loadURL(n):this.loadJSON(n),this):this}_getGlobalId(n){if(!n)return null;if(typeof n=="string"){if(o.h(n))return n;const l=o.dm(n);if(!l.startsWith("http"))try{return new URL(l,location.href).toString()}catch{return l}return l}return`json://${o.dn(JSON.stringify(n))}`}_diffStyle(n,l,p){this.globalId=this._getGlobalId(n);const y=(x,b)=>{try{b(null,this.setState(x,p))}catch(T){b(T,!1)}};if(typeof n=="string"){const x=this.map._requestManager.normalizeStyleURL(n),b=this.map._requestManager.transformRequest(x,o.R.Style);o.m(b,(T,A)=>{T?this.fire(new o.y(T)):A&&y(A,l)})}else typeof n=="object"&&y(n,l)}loadURL(n,l={}){this.fire(new o.z("dataloading",{dataType:"style"}));const p=typeof l.validate=="boolean"?l.validate:!o.h(n);this.globalId=this._getGlobalId(n),n=this.map._requestManager.normalizeStyleURL(n,l.accessToken),this.resolvedImports.add(n);const y=this.importsCache.get(n);if(y)return this._load(y,p);const x=this.map._requestManager.transformRequest(n,o.R.Style);this._request=o.m(x,(b,T)=>{if(this._request=null,b)this.fire(new o.y(b));else if(T)return this.importsCache.set(n,T),this._load(T,p)})}loadJSON(n,l={}){this.fire(new o.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(n),this._request=o.o.frame(()=>{this._request=null,this._load(n,l.validate!==!1)})}loadEmpty(){this.fire(new o.z("dataloading",{dataType:"style"})),this._load(wc,!1)}_loadImports(n,l,p){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const y=[];for(const x of n){const b=this._createFragmentStyle(x),T=new Promise(D=>{b.once("style.import.load",D),b.once("error",D)}).then(()=>this.mergeAll());if(y.push(T),this.resolvedImports.has(x.url)){b.loadEmpty();continue}const A=x.data||this.importsCache.get(x.url);A?(b.loadJSON(A,{validate:l}),this._isInternalStyle(A)&&(b.globalId=null)):x.url?b.loadURL(x.url,{validate:l}):b.loadEmpty();const M={style:b,id:x.id,config:x.config};if(p){const D=this.fragments.findIndex(({id:N})=>N===p);this.fragments=this.fragments.slice(0,D).concat(M).concat(this.fragments.slice(D))}else this.fragments.push(M)}return Promise.allSettled(y)}getImportGlobalIds(n=this,l=new Set){for(const p of n.fragments)p.style.globalId&&l.add(p.style.globalId),this.getImportGlobalIds(p.style,l);return[...l.values()]}_createFragmentStyle(n){const l=this.scope?o.B(n.id,this.scope):n.id;let p;const y=this._initialConfig&&this._initialConfig[l];(n.config||y)&&(p=Object.assign({},n.config,y));const x=new ga(this.map,{scope:l,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:p,configOptions:this.options,colorThemeOverride:n["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return x.setEventedParent(this.map,{style:x}),x}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(n){return this.isRootStyle()&&(n.fragment||!!n.schema&&n.fragment!==!1)}_load(n,l){if(this._isInternalStyle(n)){const x=Object.assign({},wc,{imports:[{id:"basemap",data:n,url:""}]},n.center?{center:n.center}:{},n.bearing?{bearing:n.bearing}:{},n.pitch?{pitch:n.pitch}:{},n.zoom?{zoom:n.zoom}:{},n.light?{light:n.light}:{});return this._importedAsBasemap=!0,void this._load(x,l)}if(this.updateConfig(this._config,n.schema),l&&xc(this,qn(n)))return;this._loaded=!0,this.stylesheet=o.dp(n);const p=()=>{for(const A in n.sources)this.addSource(A,n.sources[A],{validate:!1,isInitialLoad:!0});if(n.iconsets)for(const A in n.iconsets)this.addIconset(A,n.iconsets[A]);n.sprite?this._loadIconset(n.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&n.glyphs&&this.glyphManager.setURL(n.glyphs);const x=gh(this.stylesheet.layers);if(this._order=x.map(A=>A.id),this.stylesheet.light&&o.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const A=this.stylesheet.lights[0];this.light=new Re(A.properties,A.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Re(this.stylesheet.light)),this._layers={};for(const A of x){const M=o.du(A,this.scope,this._styleColorTheme.lut,this.options);M.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(M.fqid),M.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(M.fqid),this._hasAppearances=this._hasAppearances||M.getAppearances().length!==0,M.setEventedParent(this,{layer:{id:M.id}}),this._layers[M.id]=M;const D=this.getOwnLayerSourceCache(M),N=!!this.directionalLight&&this.directionalLight.shadowsEnabled();D&&M.canCastShadows()&&N&&(D.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const b=this.stylesheet.terrain;b&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(b,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 o.z("data",{dataType:"style"}));const T=this.isRootStyle();n.imports?this._loadImports(n.imports,l).then(()=>{this._reloadImports(),this.fire(new o.z(T?"style.load":"style.import.load"))}).catch(A=>{this.fire(new o.y(new Error("Failed to load imports",A))),this.fire(new o.z(T?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new o.z(T?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const y=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(y){const x=this._evaluateColorThemeData(y);this._loadColorTheme(x).then(()=>{p()}).catch(b=>{o.w(`Couldn't load color theme from the stylesheet: ${b}`),p()})}else this._styleColorTheme.lut=null,p()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(n=>n.style.hasAppearances())}mergeAll(){let n,l,p,y,x,b,T,A,M,D;const N={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(B=>{if(B.stylesheet){if(B.light!=null&&(n=B.light),B.stylesheet.lights)for(const j of B.stylesheet.lights)j.type==="ambient"&&B.ambientLight!=null&&(l=B.ambientLight),j.type==="directional"&&B.directionalLight!=null&&(p=B.directionalLight);y=this._prioritizeTerrain(y,B.terrain,B.stylesheet.terrain),B.stylesheet.fog&&B.fog!=null&&(x=B.fog),B.stylesheet.snow&&B.snow!=null&&(b=B.snow),B.stylesheet.rain&&B.rain!=null&&(T=B.rain),B.stylesheet.camera!=null&&(D=B.stylesheet.camera),B.stylesheet.projection!=null&&(A=B.stylesheet.projection),B.stylesheet.transition!=null&&(M=B.stylesheet.transition),N[B.scope]=B._styleColorTheme}}),this.light=n,this.ambientLight=l,this.directionalLight=p,this.fog=x,this.snow=b,this.rain=T,this._styleColorThemeForScope=N,y===null?delete this.terrain:this.terrain=y,this.camera=D||{"camera-projection":"perspective"},this.projection=A||{name:"mercator"},this.transition=Object.assign({},Ch,M),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(n){const l=p=>{for(const y of p.fragments)l(y.style);n(p)};l(this)}_prioritizeTerrain(n,l,p){const y=n&&n.drapeRenderMode===0;return p===null?l&&l.drapeRenderMode===0?l:y?n:null:l!=null&&(!n||y||l&&l.drapeRenderMode===1)?l:n}mergeTerrain(){let n;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(l=>{n=this._prioritizeTerrain(n,l.terrain,l.stylesheet.terrain)}),n===null?delete this.terrain:this.terrain=n}mergeProjection(){let n;this.forEachFragmentStyle(l=>{l.stylesheet.projection!=null&&(n=l.stylesheet.projection)}),this.projection=n||{name:"mercator"}}mergeSources(){const n={},l={},p={};this.forEachFragmentStyle(y=>{for(const x in y._sourceCaches){const b=o.B(x,y.scope);n[b]=y._sourceCaches[x]}for(const x in y._otherSourceCaches){const b=o.B(x,y.scope);l[b]=y._otherSourceCaches[x]}for(const x in y._symbolSourceCaches){const b=o.B(x,y.scope);p[b]=y._symbolSourceCaches[x]}}),this._mergedSourceCaches=n,this._mergedOtherSourceCaches=l,this._mergedSymbolSourceCaches=p}mergeIndoor(){this.forEachFragmentStyle(n=>{if(n.stylesheet&&n.stylesheet.indoor)for(const l of Object.values(n.stylesheet.indoor)){const p=l,y=o.B(p.sourceId,n.scope);this._mergedIndoor[y]=new Set(p.sourceLayers||[])}})}mergeLayers(){const n={},l=[],p={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(b=>{for(const T of b._order){const A=b._layers[T];if(A.type==="slot"){const M=o.dq(T);if(n[M])continue;n[M]=[]}A.slot&&n[A.slot]?n[A.slot].push(A):l.push(A)}}),this._mergedOrder=[];let y=-1;const x=(b=[])=>{for(const T of b)if(T.type==="slot"){const A=o.dq(T.id);n[A]&&x(n[A]),this._mergedSlots.push(A)}else{const A=o.B(T.id,T.scope);this._mergedOrder.push(A),p[A]=T,T.is3D(!!this.terrain)&&(this._has3DLayers=!0,y=this._mergedOrder.length-1),T.type==="circle"&&(this._hasCircleLayers=!0),T.type==="symbol"&&(this._hasSymbolLayers=!0),T.type==="clip"&&(this._clipLayerPresent=!0)}};if(x(l),this._has3DLayers){const b={};for(let T=0;T<this._mergedOrder.length;++T){const A=this._mergedOrder[T];b[A]=T===y?1:T<y?p[A].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((T,A)=>b[T]-b[A])}this._mergedLayers=p,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(n){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,n),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(n){return n.data?function(l,p,y,x){const b=Object.assign({},p);for(const A of Object.keys(__))b[A]===void 0&&(b[A]=__[A].default);const T=new o.a8(SS,l,new Map(y));return T.setTransitionOrValue(b,y),T.untransitioned().possiblyEvaluate(new o.ac(0,{worldview:void 0}))}(this.scope,n,this.options).get("data"):null}_loadColorTheme(n){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const l=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((p,y)=>{const x="data:image/png;base64,";if(!n||n.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void p();let b=n;b.startsWith(x)||(b=x+b);const T=o.I.from("mapbox-reserved-lut"),A=new Image;A.src=b,A.onerror=()=>{this._styleColorTheme.lutLoading=!1,y(new Error("Failed to load image data"))},A.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==l)return void p();this._styleColorTheme.lutLoading=!1;const{width:M,height:D,data:N}=o.o.getImageData(A);if(D>32)return void y(new Error("The height of the image must be less than or equal to 32 pixels."));if(M!==D*D)return void y(new Error("The width of the image must be equal to the height squared."));this.getImage(T)&&this.removeImage(T),this.addImage(T,{data:new o.q({width:M,height:D},N),pixelRatio:1,sdf:!1,usvg:!1,version:0});const B=this.imageManager.getImage(T,this.scope);B?(this._styleColorTheme.lut={image:B.data,data:n},p()):y(new Error("Missing LUT image."))}})}getLut(n){const l=this._styleColorThemeForScope[n];return l?l.lut:null}setProjection(n){n?this.stylesheet.projection=n: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(n){this._spriteRequest=function(l,p,y){let x,b,T;const A=o.o.devicePixelRatio>1?"@2x":"";let M=o.m(p.transformRequest(p.normalizeSpriteURL(l,A,".json"),o.R.SpriteJSON),(B,j)=>{M=null,T||(T=B,x=j,N())}),D=o.n(p.transformRequest(p.normalizeSpriteURL(l,A,".png"),o.R.SpriteImage),(B,j)=>{D=null,T||(T=B,b=j,N())});function N(){if(T)y(T);else if(x&&b){const B=o.o.getImageData(b),j={};for(const H in x){const{width:G,height:Q,x:J,y:ae,sdf:de,pixelRatio:ce,stretchX:Se,stretchY:ye,content:we}=x[H],_e=new o.q({width:G,height:Q});o.q.copy(B,_e,{x:J,y:ae},{x:0,y:0},{width:G,height:Q},null),j[H]={data:_e,pixelRatio:ce!==void 0?ce:1,sdf:de!==void 0&&de,stretchX:Se,stretchY:ye,content:we,usvg:!1,version:0}}y(null,j)}}return{cancel(){M&&(M.cancel(),M=null),D&&(D.cancel(),D=null)}}}(n,this.map._requestManager,(l,p)=>{if(this._spriteRequest=null,l)this.fire(new o.y(l));else if(p){const y=new Map;for(const x in p)y.set(o.I.from(x),p[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.z("data",{dataType:"style"}))})}addIconset(n,l){if(l.type==="sprite")return void this._loadSprite(l.url);const p=this.getOwnSourceCache(l.source);if(!p)return void this.fire(new o.y(new Error(`Source "${l.source}" as specified by iconset "${n}" does not exist and cannot be used as an iconset source`)));const y=p.getSource();if(y.type!=="raster-array")return void this.fire(new o.y(new Error(`Source "${l.source}" as specified by iconset "${n}" is not a "raster-array" source and cannot be used as an iconset source`)));y.partial=!1;const x=new y_(n,this.scope,p);this.imageManager.addImageProvider(x,this.scope)}removeIconset(n){this.imageManager.removeImageProvider(n,this.scope)}_loadIconset(n){if(!o.h(n)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(n);const l=this.map._spriteFormat==="auto";var p,y;this._spriteRequest=(y=(x,b)=>{if(this._spriteRequest=null,x)l?this._loadSprite(n):this.fire(new o.y(x));else if(b){const T=new Map;for(const A in b)T.set(o.I.from(A),b[A]);this.addImages(T)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.z("data",{dataType:"style"}))},o.bu((p=this.map._requestManager).transformRequest(p.normalizeIconsetURL(n),o.R.Iconset),(x,b)=>{if(x)return void y(x);const T={},A=o.dg(new o.bt(b));for(const M of A.icons){const D={version:1,pixelRatio:o.o.devicePixelRatio,content:W0(M),stretchX:M.metadata?q0(M.metadata.stretch_x_areas):void 0,stretchY:M.metadata?q0(M.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:M};T[M.name]=D}y(null,T)}))}_validateLayer(n){const l=this.getOwnSource(n.source);if(!l)return;const p=n.sourceLayer;p&&(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(p)===-1)&&this.fire(new o.y(new Error(`Source layer "${p}" does not exist on source "${l.id}" as specified by style layer "${n.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const n in this._sourceCaches)if(!this._sourceCaches[n].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:n}of this.fragments)if(!n.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((n,l)=>{const p=this.fragments[l];return p&&p.style&&(n.data=p.style.serialize()),n})}_serializeSources(){const n={};for(const l in this._sourceCaches){const p=this._sourceCaches[l].getSource();n[p.id]||(n[p.id]=p.serialize())}return n}_serializeLayers(n){const l=[];for(const p of n){const y=this._layers[p];y&&y.type!=="custom"&&l.push(y.serialize())}return l}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 n in this._sourceCaches)if(this._sourceCaches[n].hasTransition())return!0;for(const n in this._layers)if(this._layers[n].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const n in this._mergedLayers){const l=this._mergedLayers[n];if(l._transitionablePaint&&l._transitionablePaint._values){const p=l._transitionablePaint._values["line-emissive-strength"];if(p&&p.value&&p.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(n){return n?this.order:this._mergedOrder}isLayerDraped(n){return!!this.terrain&&n.isDraped(this.getLayerSourceCache(n))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(n){const l=this.getOwnLayer(n);if(l)return l;this.fire(new o.y(new Error(`The layer '${n}' does not exist in the map's style.`)))}_checkSource(n){const l=this.getOwnSource(n);if(l)return l;this.fire(new o.y(new Error(`The source '${n}' does not exist in the map's style.`)))}precompilePrograms(n,l){const p=this.map.painter;if(p)for(let y=n.minzoom||0;y<(n.maxzoom||25.5);y++){const x=n.getProgramIds();if(x)for(const b of x){const T=n.getDefaultProgramParams(b,l.zoom,this._styleColorTheme.lut);T&&(p.style=this,this.fog&&(p._fogVisible=!0,T.overrideFog=!0,p.getOrCreateProgram(b,T)),p._fogVisible=!1,T.overrideFog=!1,p.getOrCreateProgram(b,T),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(T.overrideRtt=!0,p.getOrCreateProgram(b,T)))}}}update(n){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(n),this.directionalLight&&this.directionalLight.recalculate(n);const l=this.calculateLightsBrightness();n.brightness=l||0,l!==this._brightness&&(this._brightness=l,this.dispatcher.broadcast("setBrightness",l)),n.worldview!==this._worldview&&(this._worldview=n.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const p=this._changes.isDirty();let y=!1;if(this._changes.isDirty()){const T=this._changes.getLayerUpdatesByScope();for(const A in T){const{updatedIds:M,removedIds:D}=T[A];(M||D)&&(this._updateWorkerLayers(A,M,D),y=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(n),this.light&&this.light.updateTransitions(n),this.ambientLight&&this.ambientLight.updateTransitions(n),this.directionalLight&&this.directionalLight.updateTransitions(n),this.fog&&this.fog.updateTransitions(n),this.snow&&this.snow.updateTransitions(n),this.rain&&this.rain.updateTransitions(n),this._changes.reset()}const x={};for(const T in this._mergedSourceCaches){const A=this._mergedSourceCaches[T];x[T]=A.used,A.used=!1,A.tileCoverLift=0}for(const T of this._mergedOrder){const A=this._mergedLayers[T];if(A.visibility!=="none"&&A.recalculate(n,this._availableImages),!A.isHidden(n.zoom)){const M=this.getLayerSourceCache(A);M&&(M.used=!0,M.tileCoverLift=Math.max(M.tileCoverLift,A.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(A,n)}):this.precompilePrograms(A,n))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&y&&this.mergeLayers();const b=this.imageManager.getPendingImageProviders();for(const T of b)T.sourceCache.used=!0;for(const T in x){const A=this._mergedSourceCaches[T];x[T]!==A.used&&A.getSource().fire(new o.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:A.getSource().id}))}this.light&&this.light.recalculate(n),this.terrain&&this.terrain.recalculate(n),this.fog&&this.fog.recalculate(n),this.snow&&this.snow.recalculate(n),this.rain&&this.rain.recalculate(n),this.z=n.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),p&&this.fire(new o.z("data",{dataType:"style"}))}updateImageProviders(){const n=this.imageManager.getPendingImageProviders();for(const l of n){const p=l.resolvePendingRequests(),y=this.getFragmentStyle(l.scope);y&&y.addImages(p)}}_updateTilesForChangedImages(){const n={};for(const l in this._mergedSourceCaches){const p=this._mergedSourceCaches[l].getSource().scope;n[p]=n[p]||this._changes.getUpdatedImages(p),n[p].length!==0&&this._mergedSourceCaches[l].reloadTilesForDependencies(["icons","patterns"],n[p])}for(const l in n)this._changes.resetUpdatedImages(l)}_updateWorkerLayers(n,l,p){const y=this.getFragmentStyle(n);y&&this.dispatcher.broadcast("updateLayers",{layers:l?y._serializeLayers(l):[],scope:n,removedIds:p||[],options:y.options})}setState(n,l){if(this._checkLoaded(),xc(this,qn(n)))return!1;(n=o.dp(n)).layers=gh(n.layers);const p=function(b,T){if(!b)return[{command:nn.setStyle,args:[T]}];let A=[];try{if(!o.by(b.version,T.version))return[{command:nn.setStyle,args:[T]}];if(o.by(b.center,T.center)||A.push({command:nn.setCenter,args:[T.center]}),o.by(b.zoom,T.zoom)||A.push({command:nn.setZoom,args:[T.zoom]}),o.by(b.bearing,T.bearing)||A.push({command:nn.setBearing,args:[T.bearing]}),o.by(b.pitch,T.pitch)||A.push({command:nn.setPitch,args:[T.pitch]}),o.by(b.sprite,T.sprite)||A.push({command:nn.setSprite,args:[T.sprite]}),o.by(b.glyphs,T.glyphs)||A.push({command:nn.setGlyphs,args:[T.glyphs]}),o.by(b.imports,T.imports)||function(j=[],H=[],G){H=H||[];const Q=(j=j||[]).map(_h),J=H.map(_h),ae=j.reduce(yh,{}),de=H.reduce(yh,{}),ce=Q.slice();let Se,ye,we,_e;for(Se=0,ye=0;Se<Q.length;Se++)we=Q[Se],de.hasOwnProperty(we)?ye++:(G.push({command:nn.removeImport,args:[we]}),ce.splice(ce.indexOf(we,ye),1));for(Se=0,ye=0;Se<J.length;Se++)we=J[J.length-1-Se],ce[ce.length-1-Se]!==we&&(ae.hasOwnProperty(we)?(G.push({command:nn.removeImport,args:[we]}),ce.splice(ce.lastIndexOf(we,ce.length-ye),1)):ye++,_e=ce[ce.length-Se],G.push({command:nn.addImport,args:[de[we],_e]}),ce.splice(ce.length-Se,0,we));for(const pe of H){const Te=ae[pe.id];Te&&(delete Te.data,o.by(Te,pe)||G.push({command:nn.updateImport,args:[pe.id,pe]}))}}(b.imports,T.imports,A),o.by(b.transition,T.transition)||A.push({command:nn.setTransition,args:[T.transition]}),o.by(b.light,T.light)||A.push({command:nn.setLight,args:[T.light]}),o.by(b.fog,T.fog)||A.push({command:nn.setFog,args:[T.fog]}),o.by(b.snow,T.snow)||A.push({command:nn.setSnow,args:[T.snow]}),o.by(b.rain,T.rain)||A.push({command:nn.setRain,args:[T.rain]}),o.by(b.projection,T.projection)||A.push({command:nn.setProjection,args:[T.projection]}),o.by(b.lights,T.lights)||A.push({command:nn.setLights,args:[T.lights]}),o.by(b.camera,T.camera)||A.push({command:nn.setCamera,args:[T.camera]}),o.by(b.iconsets,T.iconsets)||function(j,H,G){let Q;for(Q in H=H||{},j=j||{})j.hasOwnProperty(Q)&&(H.hasOwnProperty(Q)||G.push({command:nn.removeIconset,args:[Q]}));for(Q in H){if(!H.hasOwnProperty(Q))continue;const J=H[Q];j.hasOwnProperty(Q)?o.by(j[Q],J)||(G.push({command:nn.removeIconset,args:[Q]}),G.push({command:nn.addIconset,args:[Q,J]})):G.push({command:nn.addIconset,args:[Q,J]})}}(b.iconsets,T.iconsets,A),!o.by(b["color-theme"],T["color-theme"]))return[{command:nn.setStyle,args:[T]}];const M={},D=[];(function(j,H,G,Q){let J;for(J in H=H||{},j=j||{})j.hasOwnProperty(J)&&(H.hasOwnProperty(J)||l_(J,G,Q));for(J in H){if(!H.hasOwnProperty(J))continue;const ae=H[J];j.hasOwnProperty(J)?o.by(j[J],ae)||(j[J].type==="geojson"&&ae.type==="geojson"&&U0(j,H,J)?G.push({command:nn.setGeoJSONSourceData,args:[J,ae.data]}):V0(J,H,G,Q)):tp(J,H,G)}})(b.sources,T.sources,D,M);const N=[];b.layers&&b.layers.forEach(j=>{j.source&&M[j.source]?A.push({command:nn.removeLayer,args:[j.id]}):N.push(j)});let B=b.terrain;B&&M[B.source]&&(A.push({command:nn.setTerrain,args:[void 0]}),B=void 0),A=A.concat(D),o.by(B,T.terrain)||A.push({command:nn.setTerrain,args:[T.terrain]}),function(j,H,G){H=H||[];const Q=(j=j||[]).map(_h),J=H.map(_h),ae=j.reduce(yh,{}),de=H.reduce(yh,{}),ce=Q.slice(),Se=Object.create(null);let ye,we,_e,pe,Te,De,Me;for(ye=0,we=0;ye<Q.length;ye++)_e=Q[ye],de.hasOwnProperty(_e)?we++:(G.push({command:nn.removeLayer,args:[_e]}),ce.splice(ce.indexOf(_e,we),1));for(ye=0,we=0;ye<J.length;ye++)_e=J[J.length-1-ye],ce[ce.length-1-ye]!==_e&&(ae.hasOwnProperty(_e)?(G.push({command:nn.removeLayer,args:[_e]}),ce.splice(ce.lastIndexOf(_e,ce.length-we),1)):we++,De=ce[ce.length-ye],G.push({command:nn.addLayer,args:[de[_e],De]}),ce.splice(ce.length-ye,0,_e),Se[_e]=!0);for(ye=0;ye<J.length;ye++)if(_e=J[ye],pe=ae[_e],Te=de[_e],!Se[_e]&&!o.by(pe,Te))if(o.by(pe.source,Te.source)&&o.by(pe["source-layer"],Te["source-layer"])&&o.by(pe.type,Te.type)){for(Me in mc(pe.layout,Te.layout,G,_e,null,nn.setLayoutProperty),mc(pe.paint,Te.paint,G,_e,null,nn.setPaintProperty),o.by(pe.slot,Te.slot)||G.push({command:nn.setSlot,args:[_e,Te.slot]}),o.by(pe.filter,Te.filter)||G.push({command:nn.setFilter,args:[_e,Te.filter]}),o.by(pe.minzoom,Te.minzoom)&&o.by(pe.maxzoom,Te.maxzoom)||G.push({command:nn.setLayerZoomRange,args:[_e,Te.minzoom,Te.maxzoom]}),pe)pe.hasOwnProperty(Me)&&Me!=="layout"&&Me!=="paint"&&Me!=="filter"&&Me!=="metadata"&&Me!=="minzoom"&&Me!=="maxzoom"&&Me!=="slot"&&(Me.indexOf("paint.")===0?mc(pe[Me],Te[Me],G,_e,Me.slice(6),nn.setPaintProperty):o.by(pe[Me],Te[Me])||G.push({command:nn.setLayerProperty,args:[_e,Me,Te[Me]]}));for(Me in Te)Te.hasOwnProperty(Me)&&!pe.hasOwnProperty(Me)&&Me!=="layout"&&Me!=="paint"&&Me!=="filter"&&Me!=="metadata"&&Me!=="minzoom"&&Me!=="maxzoom"&&Me!=="slot"&&(Me.indexOf("paint.")===0?mc(pe[Me],Te[Me],G,_e,Me.slice(6),nn.setPaintProperty):o.by(pe[Me],Te[Me])||G.push({command:nn.setLayerProperty,args:[_e,Me,Te[Me]]}))}else G.push({command:nn.removeLayer,args:[_e]}),De=ce[ce.lastIndexOf(_e)+1],G.push({command:nn.addLayer,args:[Te,De]})}(N,T.layers,A)}catch(M){console.warn("Unable to compute style diff:",M),A=[{command:nn.setStyle,args:[T]}]}return A}(this.serialize(),n).filter(b=>!(b.command in Z0));if(p.length===0)return!1;const y=p.filter(b=>!(b.command in K0));if(y.length>0)throw new Error(`Unimplemented: ${y.map(b=>b.command).join(", ")}.`);const x=[];return p.forEach(b=>{x.push(this[b.command](...b.args))}),l&&Promise.all(x).then(l).catch(l),this.stylesheet=n,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(n){if(n.size===0)return this;for(const[l,p]of n.entries()){if(this.getImage(l))return this.fire(new o.y(new Error(`An image with the name "${l.name}" already exists.`)));this.imageManager.addImage(l,this.scope,p),this._changes.updateImage(l,this.scope)}return this._updateWorkerImages(),this.fire(new o.z("data",{dataType:"style"})),this}addImage(n,l){return this.getImage(n)?this.fire(new o.y(new Error(`An image with the name "${n.name}" already exists.`))):(this.imageManager.addImage(n,this.scope,l),this._changes.updateImage(n,this.scope),this._updateWorkerImages(),this.fire(new o.z("data",{dataType:"style"})),this)}updateImage(n,l,p=!1){this.imageManager.updateImage(n,this.scope,l),p&&(this._changes.updateImage(n,this.scope),this._updateWorkerImages(),this.fire(new o.z("data",{dataType:"style"})))}getImage(n){return this.imageManager.getImage(n,this.scope)}removeImage(n){return this.getImage(n)?(this.imageManager.removeImage(n,this.scope),this._changes.updateImage(n,this.scope),this._updateWorkerImages(),this.fire(new o.z("data",{dataType:"style"})),this):this.fire(new o.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(n){return this.modelManager.addModelURLs(n,this.getActualScope()),this._updateWorkerModels(),this.fire(new o.z("data",{dataType:"style"})),this}addModel(n,l,p={}){return this._checkLoaded(),this._validate(K,`models.${n}`,l,null,p)||(this.modelManager.addModel(n,l,this.getActualScope()),this.fire(new o.z("data",{dataType:"style"}))),this}hasModel(n){return this.modelManager.hasModel(n,this.getActualScope())}removeModel(n){return this.hasModel(n)?(this.modelManager.removeModel(n,this.getActualScope(),!1,!0),this.fire(new o.z("data",{dataType:"style"})),this):this.fire(new o.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(n,l,p={}){if(this._checkLoaded(),this.getOwnSource(n)!==void 0)throw new Error(`There is already a source with ID "${n}".`);if(!l.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(l).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(l.type)>=0&&this._validate(Bs,`sources.${n}`,l,null,p))return;this.map&&this.map._collectResourceTiming&&(l.collectResourceTiming=!0);const y=ns(n,l,this.dispatcher,this);y.scope=this.scope,y.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(y.id),source:y.serialize(),sourceId:y.id}));const x=b=>{const T=(b?"symbol:":"other:")+y.id,A=o.B(T,this.scope),M=this._sourceCaches[T]=new Oo(A,y,b);(b?this._symbolSourceCaches:this._otherSourceCaches)[y.id]=M,M.onAdd(this.map)};x(!1),l.type!=="vector"&&l.type!=="geojson"||x(!0),y.onAdd&&y.onAdd(this.map),p.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(n){this._checkLoaded();const l=this.getOwnSource(n);if(!l)throw new Error("There is no source with this ID");for(const y in this._layers)if(this._layers[y].source===n)return this.fire(new o.y(new Error(`Source "${n}" cannot be removed while layer "${y}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===n)return this.fire(new o.y(new Error(`Source "${n}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const y=Object.entries(this.stylesheet.iconsets).find(([x,b])=>b.type==="source"&&b.source===n);if(y)return this.fire(new o.y(new Error(`Source "${n}" cannot be removed while iconset "${y[0]}" is using it.`)))}const p=this.getOwnSourceCaches(n);for(const y of p){const x=o.dq(y.id);delete this._sourceCaches[x],this._changes.discardSourceCacheUpdate(y.id),y.fire(new o.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:y.getSource().id})),y.setEventedParent(null),y.clearTiles()}return delete this._otherSourceCaches[n],delete this._symbolSourceCaches[n],this.mergeSources(),l.setEventedParent(null),l.onRemove&&l.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(n,l){this._checkLoaded(),this.getOwnSource(n).setData(l),this._changes.setDirty()}getOwnSource(n){const l=this.getOwnSourceCache(n);return l&&l.getSource()}getOwnSources(){const n=[];for(const l in this._otherSourceCaches){const p=this.getOwnSourceCache(l);p&&n.push(p.getSource())}return n}areTilesLoaded(){const n=this._mergedSourceCaches;for(const l in n){const p=n[l]._tiles;for(const y in p){const x=p[y];if(x.state!=="loaded"&&x.state!=="errored")return!1}}return!0}setLights(n){if(this._checkLoaded(),!n)return delete this.ambientLight,void delete this.directionalLight;const l=this._getTransitionParameters();for(const x of n){if(this._validate(hs,"lights",x))return;switch(x.type){case"ambient":if(this.ambientLight){const b=this.ambientLight;b.set(x),b.updateTransitions(l)}else this.ambientLight=new rn(x,Mi||(Mi=new o.a9({color:new o.aa(o.a6.properties_light_ambient.color),"color-use-theme":new o.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.aa(o.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const b=this.directionalLight;b.set(x),b.updateTransitions(l)}else this.directionalLight=new rn(x,_i||(_i=new o.a9({direction:new o.ap(o.a6.properties_light_directional.direction),color:new o.aa(o.a6.properties_light_directional.color),"color-use-theme":new o.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.aa(o.a6.properties_light_directional.intensity),"cast-shadows":new o.aa(o.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new o.aa(o.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new o.aa(o.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const p=Object.assign(l,{worldview:this.map.getWorldview()}),y=new o.ac(this.z||0,p);this.ambientLight&&this.ambientLight.recalculate(y),this.directionalLight&&this.directionalLight.recalculate(y),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const n=this.directionalLight,l=this.ambientLight;if(!n||!l)return;const p=B=>.2126*(B[0]<=.03928?B[0]/12.92:Math.pow((B[0]+.055)/1.055,2.4))+.7152*(B[1]<=.03928?B[1]/12.92:Math.pow((B[1]+.055)/1.055,2.4))+.0722*(B[2]<=.03928?B[2]/12.92:Math.pow((B[2]+.055)/1.055,2.4)),y=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),x=n.properties.get("intensity"),b=n.properties.get("direction"),T=1-o.d4(b.x,b.y,b.z)[2]/90,A=p(y)*x*T,M=l.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),D=l.properties.get("intensity"),N=p(M)*D;return Number(((A+N)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const n=[];return this.directionalLight&&n.push(this.directionalLight.get()),this.ambientLight&&n.push(this.ambientLight.get()),n}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(n){if(n==null||n===""&&this.isRootStyle())return this;if(o.dr(n)){const l=o.ds(n),p=this.fragments.find(({id:x})=>x===l);if(!p)return;const y=o.dq(n);return p.style.getFragmentStyle(y)}{const l=this.fragments.find(({id:p})=>p===n);return l?l.style:void 0}}setFeaturesetSelectors(n){if(!n)return;const l={},p=(y,x="")=>`${y}::${x}`;this._featuresetSelectors={};for(const y in n){const x=this._featuresetSelectors[y]=[];for(const b of n[y].selectors){if(b.featureNamespace){const A=this.getOwnLayer(b.layer);if(!A){o.w(`Layer is undefined for selector: ${b.layer}`);continue}const M=p(A.source,A.sourceLayer);if(M in l&&l[M]!==b.featureNamespace){o.w(`"featureNamespace ${b.featureNamespace} of featureset ${y}'s selector is not associated to the same source, skip this selector`);continue}l[M]=b.featureNamespace}let T;if(b.properties)for(const A in b.properties){const M=o.U(b.properties[A]);M.result==="success"&&(T=T||{},T[A]=M.value)}x.push({layerId:b.layer,namespace:b.featureNamespace,properties:T,uniqueFeatureID:b._uniqueFeatureID})}}}getFeaturesetDescriptors(n){const l=this.getFragmentStyle(n);if(!l||!l.stylesheet.featuresets)return[];const p=[];for(const y in l.stylesheet.featuresets)p.push({featuresetId:y,importId:l.scope?l.scope:void 0});return p}getFeaturesetLayers(n,l){const p=this.getFragmentStyle(l),y=p.stylesheet.featuresets;if(!y||!y[n])return this.fire(new o.y(new Error(`The featureset '${n}' does not exist in the map's style and cannot be queried.`))),[];const x=[];for(const b of y[n].selectors){const T=p.getOwnLayer(b.layer);T&&x.push(T)}return x}getConfigProperty(n,l){const p=this.getFragmentStyle(n);if(!p)return null;const y=o.B(l,p.scope),x=p.options.get(y),b=x?x.value||x.default:null;return b?b.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(n,l){const p=o.B(n,l);return this._mergedIndoor[p]}setIndoorData(n,l){this.map.indoor.setIndoorData(l)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(n,l,p){const y=this.getFragmentStyle(n);if(!y)return;const x=y.stylesheet.schema;if(!x||!x[l])return;const b=o.U(p);if(b.result!=="success")return void xc(this,b.value);const T=b.value.expression,A=o.B(l,y.scope),M=y.options.get(A);if(!M)return;let D;const{minValue:N,maxValue:B,stepValue:j,type:H,values:G}=x[l],Q=o.U(x[l].default);Q.result==="success"&&(D=Q.value.expression),D?(this.options.set(A,Object.assign({},M,{value:T,default:D,minValue:N,maxValue:B,stepValue:j,type:H,values:G})),this.updateConfigDependencies(l)):this.fire(new o.y(new Error(`No schema defined for the config option "${l}" in the "${n}" fragment.`)))}getConfig(n){const l=this.getFragmentStyle(n);if(!l)return null;const p=l.stylesheet.schema;if(!p)return null;const y={};for(const x in p){const b=o.B(x,l.scope),T=l.options.get(b),A=T?T.value||T.default:null;y[x]=A?A.serialize():null}return y}setConfig(n,l){const p=this.getFragmentStyle(n);p&&(p.updateConfig(l,p.stylesheet.schema),this.updateConfigDependencies())}getSchema(n){const l=this.getFragmentStyle(n);return l?l.stylesheet.schema:null}setSchema(n,l){const p=this.getFragmentStyle(n);p&&(p.stylesheet.schema=l,p.updateConfig(p._config,l),this.updateConfigDependencies())}updateConfig(n,l){if(this._config=n,n||l)if(l)for(const p in l){let y,x;const b=o.U(l[p].default);if(b.result==="success"&&(y=b.value.expression),n&&n[p]!==void 0){const B=o.U(n[p]);B.result==="success"&&(x=B.value.expression)}const{minValue:T,maxValue:A,stepValue:M,type:D,values:N}=l[p];if(y){const B=o.B(p,this.scope);this.options.set(B,{default:y,value:x,minValue:T,maxValue:A,stepValue:M,type:D,values:N})}else this.fire(new o.y(new Error(`No schema defined for config option "${p}".`)))}else this.fire(new o.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(n,l=()=>!0){for(const p of n){const y=this.getLayer(p);y&&l(y)&&(y.possiblyEvaluateVisibility(),this._updateLayer(y),this._changes.setDirty())}}updateConfigDependencies(n){this._updateLayers(this._configDependentLayers,l=>!n||l.expressionDependencies.configDependencies.has(n)),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(l=>{const p=l._styleColorTheme.colorThemeOverride?l._styleColorTheme.colorThemeOverride:l._styleColorTheme.colorTheme;if(p){const y=l._evaluateColorThemeData(p);(!l._styleColorTheme.lut&&y!==""||l._styleColorTheme.lut&&y!==l._styleColorTheme.lut.data)&&l.setColorTheme(p)}}),this._changes.setDirty()}addLayer(n,l,p={}){this._checkLoaded();const y=n.id;if(this._layers[y])return void this.fire(new o.y(new Error(`Layer with id "${y}" already exists on this map`)));let x;if(n.type==="custom"){if(xc(this,o.dt(n)))return;x=o.du(n,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof n.source=="object"&&(this.addSource(y,n.source),n=o.dp(n),n=Object.assign(n,{source:y})),this._validate(Bi,`layers.${y}`,n,{arrayIndex:-1},p))return;x=o.du(n,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}})}const b=o.B(x.source,x.scope);x.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(b),x.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(b);let T=this._order.length;if(l){const N=this._order.indexOf(l);if(N===-1)return void this.fire(new o.y(new Error(`Layer with id "${l}" does not exist on this map.`)));x.slot===this._layers[l].slot?T=N:o.w(`Layer with id "${l}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(T,0,y),this._layerOrderChanged=!0,this._layers[y]=x;const A=this.getOwnLayerSourceCache(x),M=!!this.directionalLight&&this.directionalLight.shadowsEnabled();A&&x.canCastShadows()&&M&&(A.castsShadows=!0);const D=this._changes.getRemovedLayer(x);if(D&&x.source&&A&&x.type!=="custom"){this._changes.discardLayerRemoval(x);const N=o.B(x.source,x.scope);D.type!==x.type?this._changes.updateSourceCache(N,"clear"):(this._changes.updateSourceCache(N,"reload"),A.pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map),x.scope=this.scope,this.mergeLayers()}moveLayer(n,l){this._checkLoaded();const p=this._checkLayer(n);if(!p||n===l)return;const y=this._order.indexOf(n);this._order.splice(y,1);let x=this._order.length;if(l){const b=this._order.indexOf(l);if(b===-1)return void this.fire(new o.y(new Error(`Layer with id "${l}" does not exist on this map.`)));p.slot===this._layers[l].slot?x=b:o.w(`Layer with id "${l}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(x,0,n),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(n){this._checkLoaded();const l=this._checkLayer(n);if(!l)return;l.setEventedParent(null);const p=this._order.indexOf(n);this._order.splice(p,1),delete this._layers[n],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(l.fqid),this._indoorDependentLayers.delete(l.fqid),this._changes.removeLayer(l);const y=this.getOwnLayerSourceCache(l);if(y&&y.castsShadows){let x=!1;for(const b in this._layers)if(this._layers[b].source===l.source&&this._layers[b].canCastShadows()){x=!0;break}y.castsShadows=x}l.onRemove&&l.onRemove(this.map),this.mergeLayers()}getOwnLayer(n){return this._layers[n]}hasLayer(n){return n in this._mergedLayers}hasLayerType(n){for(const l in this._layers)if(this._layers[l].type===n)return!0;return!1}setLayerZoomRange(n,l,p){this._checkLoaded();const y=this._checkLayer(n);y&&(y.minzoom===l&&y.maxzoom===p||(l!=null&&(y.minzoom=l),p!=null&&(y.maxzoom=p),this._updateLayer(y)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(n,l){this._checkLoaded();const p=this._checkLayer(n);p&&p.slot!==l&&(p.slot=l,this._updateLayer(p))}setFilter(n,l,p={}){this._checkLoaded();const y=this._checkLayer(n);if(y&&!o.by(y.filter,l))return l==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(Pi,`layers.${y.id}.filter`,l,{layerType:y.type},p)||(y.filter=o.dp(l),this._updateLayer(y)))}getFilter(n){const l=this._checkLayer(n);if(l)return o.dp(l.filter)}setLayoutProperty(n,l,p,y={}){this._checkLoaded();const x=this._checkLayer(n);if(x&&!o.by(x.getLayoutProperty(l),p)){if(p!=null&&(!y||y.validate!==!1)&&xc(x,Fe.call(qn,{key:`layers.${n}.layout.${l}`,layerType:x.type,objectKey:l,value:p,styleSpec:o.a6,style:{glyphs:!0,sprite:!0}})))return;x.setLayoutProperty(l,p),x.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(x.fqid),x.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(x.fqid),this._updateLayer(x)}}setLayerProperty(n,l,p,y={}){this._checkLoaded();const x=this._checkLayer(n);x&&(l==="appearances"?(x.setAppearances(p),this._changes.setDirty()):x.isPaintProperty(l)?this.setPaintProperty(n,l,p,y):this.setLayoutProperty(n,l,p,y))}getLayoutProperty(n,l){const p=this._checkLayer(n);if(p)return p.getLayoutProperty(l)}setPaintProperty(n,l,p,y={}){this._checkLoaded();const x=this._checkLayer(n);if(!x||o.by(x.getPaintProperty(l),p)||p!=null&&(!y||y.validate!==!1)&&xc(x,Ss.call(qn,{key:`layers.${n}.paint.${l}`,layerType:x.type,objectKey:l,value:p,styleSpec:o.a6})))return;const b=x.setPaintProperty(l,p);x.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(x.fqid),x.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(x.fqid),b&&this._updateLayer(x),this._changes.updatePaintProperties(x)}getPaintProperty(n,l){const p=this._checkLayer(n);if(p)return p.getPaintProperty(l)}setFeatureState(n,l){if(this._checkLoaded(),"target"in n){if("featuresetId"in n.target){const{featuresetId:A,importId:M}=n.target,D=this.getFragmentStyle(M),N=D.getFeaturesetLayers(A);for(const{source:B,sourceLayer:j}of N)D.setFeatureState({id:n.id,source:B,sourceLayer:j},l)}else if("layerId"in n.target){const{layerId:A}=n.target,M=this.getLayer(A);this.setFeatureState({id:n.id,source:M.source,sourceLayer:M.sourceLayer},l)}return}const p=n.source,y=n.sourceLayer,x=this._checkSource(p);if(!x)return;const b=x.type;if(b==="geojson"&&y)return void this.fire(new o.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(b==="vector"&&!y)return void this.fire(new o.y(new Error("The sourceLayer parameter must be provided for vector source types.")));n.id===void 0&&this.fire(new o.y(new Error("The feature id parameter must be provided.")));const T=this.getOwnSourceCaches(p);for(const A of T)A.setFeatureState(y,n.id,l)}removeFeatureState(n,l){if(this._checkLoaded(),"target"in n){if("featuresetId"in n.target){const{featuresetId:A,importId:M}=n.target,D=this.getFragmentStyle(M),N=D.getFeaturesetLayers(A);for(const{source:B,sourceLayer:j}of N)D.removeFeatureState({id:n.id,source:B,sourceLayer:j},l)}else if("layerId"in n.target){const{layerId:A}=n.target,M=this.getLayer(A);this.removeFeatureState({id:n.id,source:M.source,sourceLayer:M.sourceLayer},l)}return}const p=n.source,y=this._checkSource(p);if(!y)return;const x=y.type,b=x==="vector"?n.sourceLayer:void 0;if(x==="vector"&&!b)return void this.fire(new o.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(l&&typeof n.id!="string"&&typeof n.id!="number")return void this.fire(new o.y(new Error("A feature id is required to remove its specific state property.")));const T=this.getOwnSourceCaches(p);for(const A of T)A.removeFeatureState(b,n.id,l)}getFeatureState(n){if(this._checkLoaded(),"target"in n){let x;if("featuresetId"in n.target){const{featuresetId:b,importId:T}=n.target,A=this.getFragmentStyle(T),M=A.getFeaturesetLayers(b);for(const{source:D,sourceLayer:N}of M){const B=A.getFeatureState({id:n.id,source:D,sourceLayer:N});if(B&&!x)x=B;else if(!o.by(x,B))return void this.fire(new o.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in n.target){const{layerId:b}=n.target,T=this.getLayer(b);x=this.getFeatureState({id:n.id,source:T.source,sourceLayer:T.sourceLayer})}return x}const l=n.source,p=n.sourceLayer,y=this._checkSource(l);if(y){if(y.type!=="vector"||p)return n.id===void 0&&this.fire(new o.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(l)[0].getFeatureState(p,n.id);this.fire(new o.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(n){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,n),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const n=this.getTerrain(),l=n&&this.terrain&&this.terrain.scope===this.scope?n:this.stylesheet.terrain;return o.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:l,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,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)},p=>p!==void 0)}_updateFilteredLayers(n){for(const l of Object.values(this._mergedLayers))n(l)&&this._updateLayer(l)}_updateLayer(n){this._changes.updateLayer(n);const l=this.getLayerSourceCache(n),p=o.B(n.source,n.scope),y=this._changes.getUpdatedSourceCaches();n.source&&!y[p]&&l&&l.getSource().type!=="raster"&&(this._changes.updateSourceCache(p,"reload"),l.pause()),n.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(n){const l=T=>this._mergedLayers[T].is3D(!!this.terrain),p=this.order,y={},x=[];for(let T=p.length-1;T>=0;T--){const A=p[T];if(l(A)){y[A]=T;for(const M of n){const D=M[A];if(D)for(const N of D)x.push(N)}}}x.sort((T,A)=>A.intersectionZ-T.intersectionZ);const b=[];for(let T=p.length-1;T>=0;T--){const A=p[T];if(l(A))for(let M=x.length-1;M>=0;M--){const D=x[M].feature;if(D.layer&&y[D.layer.id]<T)break;b.push(D),x.pop()}else for(const M of n){const D=M[A];if(D)for(const N of D)b.push(N.feature)}}return b}queryRasterValue(n,l,p){const y=this.getOwnSource(n);return y?y.type!=="raster-array"?(this.fire(new o.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):y.queryRasterArrayValue(l,p):(this.fire(new o.y(new Error(`Source with id "${n}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(n,l,p){let y;l&&!Array.isArray(l)&&l.filter&&(this._validate(Pi,"queryRenderedFeatures.filter",l.filter,null,l),y=o.b6(l.filter));const x={},b=D=>{if(hp.has(D.type))return;const N=this.getOwnLayerSourceCache(D),B=x[N.id]=x[N.id]||{sourceCache:N,layers:{},has3DLayers:!1};D.is3D(!!this.terrain)&&(B.has3DLayers=!0),B.layers[D.fqid]=B.layers[D.fqid]||{styleLayer:D,targets:[]},B.layers[D.fqid].targets.push({filter:y})};if(l&&l.layers){if(!Array.isArray(l.layers))return this.fire(new o.y(new Error("parameters.layers must be an Array."))),[];for(const D of l.layers){const N=this._layers[D];if(!N)return this.fire(new o.y(new Error(`The layer '${D}' does not exist in the map's style and cannot be queried for features.`))),[];b(N)}}else for(const D in this._layers)b(this._layers[D]);const T=this._queryRenderedFeatures(n,x,p),A=this._flattenAndSortRenderedFeatures(T),M=[];for(const D of A)o.dw(D.layer.id)===this.scope&&M.push(D);return M}queryRenderedFeatureset(n,l,p){let y;l&&!Array.isArray(l)&&l.filter&&(this._validate(Pi,"queryRenderedFeatures.filter",l.filter,null,l),y=o.b6(l.filter));const x="mock",b=[];if(l&&l.target)b.push(Object.assign({},l,{targetId:x,filter:y}));else{const D=this.getFeaturesetDescriptors();for(const N of D)b.push({targetId:x,filter:y,target:N});for(const{style:N}of this.fragments){const B=N.getFeaturesetDescriptors();for(const j of B)b.push({targetId:x,filter:y,target:j})}}const T=this.queryRenderedTargets(n,b,p),A=[],M=new Set;for(const D of T)for(const N of D.variants[x])Wu(N,D,M)||A.push(new o.dx(D,N));return A}queryRenderedTargets(n,l,p){const y={},x=(T,A,M,D)=>{const N=y[A.id]=y[A.id]||{sourceCache:A,layers:{},has3DLayers:!1};if(N.layers[T.fqid]=N.layers[T.fqid]||{styleLayer:T,targets:[]},T.is3D(!!this.terrain)&&(N.has3DLayers=!0),!D)return M.uniqueFeatureID=!1,void N.layers[T.fqid].targets.push(M);N.layers[T.fqid].targets.push(Object.assign({},M,{namespace:D.namespace,properties:D.properties,uniqueFeatureID:D.uniqueFeatureID}))};for(const T of l)if("featuresetId"in T.target){const{featuresetId:A,importId:M}=T.target,D=this.getFragmentStyle(M);if(!D||!D._featuresetSelectors)continue;const N=D._featuresetSelectors[A];if(!N){this.fire(new o.y(new Error(`The featureset '${A}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const B of N){const j=D.getOwnLayer(B.layerId);j&&!hp.has(j.type)&&x(j,D.getOwnLayerSourceCache(j),T,B)}}else if("layerId"in T.target){const{layerId:A}=T.target,M=this.getLayer(A);if(!M||hp.has(M.type))continue;x(M,this.getLayerSourceCache(M),T)}const b=this._queryRenderedFeatures(n,y,p);return this._flattenAndSortRenderedFeatures(b)}_queryRenderedFeatures(n,l,p){const y=[],x=!!this.map._showQueryGeometry,b=ai.createFromScreenPoints(n,p);for(const T in l){const A=Zf(b,l[T],this._availableImages,p,x);Object.keys(A).length&&y.push(A)}if(this.placement)for(const T in l){if(!l[T].sourceCache._onlySymbols)continue;const A=Xf(b.screenGeometry,l[T],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(A).length&&y.push(A)}return y}querySourceFeatures(n,l){const p=l&&l.filter;p&&this._validate(Pi,"querySourceFeatures.filter",p,null,l);let y=[];const x=this.getOwnSourceCaches(n);for(const b of x)y=y.concat(Yf(b,l));return y}addSourceType(n,l,p){return ga.getSourceType(n)?p(new Error(`A source type called "${n}" already exists.`)):(ga.setSourceType(n,l),l.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:n,url:l.workerSourceURL},p):p(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(n,l,p={}){this._checkLoaded();const y=this.light.getLight();let x=!1;for(const T in n)if(!o.by(n[T],y[T])){x=!0;break}if(!x)return;const b=this._getTransitionParameters();this.light.setLight(n,l,p),this.light.updateTransitions(b)}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=o.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(n,l=1){if(this._checkLoaded(),!n)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),l===0&&delete this.terrain,n===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let p=n;const y=!("source"in n)||n.source==null;if(l===1){if(this.disableElevatedTerrain)return;if("source"in p&&typeof p.source=="object"){const T="terrain-dem-src";this.addSource(T,p.source),p=o.dp(p),p=Object.assign(p,{source:T})}const x=Object.assign({},p),b={};if(this.terrain&&y){x.source=this.terrain.get().source;const T=this.terrain?this.getFragmentStyle(this.terrain.scope):null;T&&(b.style=T.serialize())}if(this._validate(Xs,"terrain",x,b))return}if(!this.terrain||this.terrain.scope!==this.scope&&!y||this.terrain&&l!==this.terrain.drapeRenderMode){if(!p)return;this._createTerrain(p,l),this.fire(new o.z("data",{dataType:"style"}))}else{const x=this.terrain,b=x.get();for(const T of Object.keys(o.a6.terrain))!p.hasOwnProperty(T)&&o.a6.terrain[T].default&&(p[T]=o.a6.terrain[T].default);for(const T in n)if(!o.by(n[T],b[T])){x.set(n,this.options),this.stylesheet.terrain=n;const A=this._getTransitionParameters({duration:0});x.updateTransitions(A),this.fire(new o.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(n){const l=this.fog=new br(n,this.map.transform,this.scope,this.options);this.stylesheet.fog=l.get();const p=this._getTransitionParameters({duration:0});l.updateTransitions(p)}_createSnow(n){const l=this.snow=new Fi(n,this.map.transform,this.scope,this.options);this.stylesheet.snow=l.get();const p=this._getTransitionParameters({duration:0});l.updateTransitions(p)}_createRain(n){const l=this.rain=new oi(n,this.map.transform,this.scope,this.options);this.stylesheet.rain=l.get();const p=this._getTransitionParameters({duration:0});l.updateTransitions(p)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const n of this.map._markers)n._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(n){if(this._checkLoaded(),!n)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const l=this.fog;if(!o.by(l.get(),n)){l.set(n,this.options),this.stylesheet.fog=l.get();const p=this._getTransitionParameters({duration:0});l.updateTransitions(p)}}else this._createFog(n);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(n){if(this._checkLoaded(),!n)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const l=this.snow;if(!o.by(l.get(),n)){l.set(n,this.options),this.stylesheet.snow=l.get();const p=this._getTransitionParameters({duration:0});l.updateTransitions(p)}}else this._createSnow(n);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(n){if(this._checkLoaded(),!n)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const l=this.rain;if(!o.by(l.get(),n)){l.set(n,this.options),this.stylesheet.rain=l.get();const p=this._getTransitionParameters({duration:0});l.updateTransitions(p)}}else this._createRain(n);this._markersNeedUpdate=!0}_reloadColorTheme(){const n=()=>{for(const y in this._layers)this._layers[y].lut=this._styleColorTheme.lut;for(const y in this._sourceCaches)this._sourceCaches[y].clearTiles()},l=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!l)return this._styleColorTheme.lut=null,void n();const p=this._evaluateColorThemeData(l);this._loadColorTheme(p).then(()=>{this.fire(new o.z("colorthemeset")),n()}).catch(y=>{o.w(`Couldn't set color theme: ${y}`)})}setColorTheme(n){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&o.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=n,this._reloadColorTheme()}setImportColorTheme(n,l){const p=this.getFragmentStyle(n);p&&(p._styleColorTheme.colorThemeOverride=l,p._reloadColorTheme())}_getTransitionParameters(n){return{now:o.o.now(),transition:Object.assign(this.transition,n)}}updateDrapeFirstLayers(){if(!this.terrain)return;const n=[],l=[];for(const p of this._mergedOrder)this.isLayerDraped(this._mergedLayers[p])?n.push(p):l.push(p);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...n),this._drapedFirstOrder.push(...l)}_createTerrain(n,l){const p=this.terrain=new Oe(n,l,this.scope,this.options,this.map.getWorldview());l===1&&(this.stylesheet.terrain=n),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const y=this._getTransitionParameters({duration:0});p.updateTransitions(y)}_force3DLayerUpdate(){for(const n in this._layers){const l=this._layers[n];l.type==="fill-extrusion"&&this._updateLayer(l)}}_forceSymbolLayerUpdate(){for(const n in this._layers){const l=this._layers[n];l.type==="symbol"&&this._updateLayer(l)}}_validate(n,l,p,y,x={}){if(x&&x.validate===!1)return!1;const b=Object.assign({},this.serialize());return xc(this,n.call(qn,Object.assign({key:l,style:b,value:p,styleSpec:o.a6},y)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._mergedLayers)this._mergedLayers[n].setEventedParent(null);for(const n in this._mergedSourceCaches)this._mergedSourceCaches[n].clearTiles(),this._mergedSourceCaches[n].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(n){const l=this.getSourceCaches(n);for(const p of l)p.clearTiles()}clearSources(){for(const n in this._mergedSourceCaches)this._mergedSourceCaches[n].clearTiles()}clearLayers(){for(const n in this._mergedLayers){const l=this._mergedLayers[n];l._clear&&l._clear()}}reloadSource(n){const l=this.getSourceCaches(n);for(const p of l)p.resume(),p.reload()}reloadSources(){for(const n of this.getSources())n.reload&&n.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(n=>{n.modelManager.reloadModels(n.scope)})}updateSources(n){let l;this.directionalLight&&(l=Ah(this.directionalLight));const p=new Set,y=new Set;for(const x in this._mergedLayers){const b=this._mergedLayers[x];b.type==="building"&&p.add(b.source),b.hasElevation()&&!y.has(b.source)&&y.add(b.source)}for(const x in this._mergedSourceCaches){const b=this._mergedSourceCaches[x],T=y.has(b._source.id);p.has(b._source.id)&&(b._source.reparseOverscaled=!1),b.update(n,void 0,void 0,l,T)}}_generateCollisionBoxes(){for(const n in this._sourceCaches){const l=this._sourceCaches[n];l.resume(),l.reload()}}_updatePlacement(n,l,p,y,x,b,T=!1){let A=!1,M=!1;const D={},N={};for(const G of this._mergedOrder){const Q=this._mergedLayers[G];if(Q.type!=="symbol")continue;const J=o.B(Q.source,Q.scope);let ae=D[J];if(!ae){const ce=this.getLayerSourceCache(Q);if(!ce)continue;const Se=ce.getRenderableIds(!0).map(ye=>ce.getTileByID(ye));N[J]=Se.slice(),ae=D[J]=Se.sort((ye,we)=>we.tileID.overscaledZ-ye.tileID.overscaledZ||(ye.tileID.isLessThan(we.tileID)?-1:1))}const de=this.crossTileSymbolIndex.addLayer(Q,ae,l.center.lng,l.projection);A=A||de}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),T=T||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new o.z("neworder"));const B=!!(this.placement&&!l.equals(this.placement.transform)),j=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!b||this.placement.lastReplacementSourceUpdateTime!==b.updateTime)),H=(B||j||A||this.placement&&this.placement.isStale())&&y===0;if((T||!this.pauseablePlacement||H||y!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.o.now(),l.zoom))&&(this.pauseablePlacement=new is(l,this._mergedOrder,T||y===0,p,y,x,this.placement,this.fog&&l.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,D,N,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.o.now()),M=!0),A&&this.pauseablePlacement.placement.setStale()),M||A){this._buildingIndex.onNewFrame(l.zoom);for(let G=0;G<this._mergedOrder.length;G++){const Q=this._mergedLayers[this._mergedOrder[G]];if(Q.type!=="symbol"||Q.visibility==="none")continue;const J=this.isLayerClipped(Q);this.placement.updateLayerOpacities(Q,D[o.B(Q.source,Q.scope)],G,J?b:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.o.now())}}_releaseSymbolFadeTiles(){for(const n in this._sourceCaches)this._sourceCaches[n].releaseSymbolFadeTiles()}addImport(n,l){this._checkLoaded();const p=this.stylesheet.imports=this.stylesheet.imports||[];if(p.findIndex(({id:x})=>x===n.id)!==-1)return void this.fire(new o.y(new Error(`Import with id '${n.id}' already exists in the map's style.`)));if(!l)return p.push(n),this._loadImports([n],!0);const y=p.findIndex(({id:x})=>x===l);return y===-1&&this.fire(new o.y(new Error(`Import with id "${l}" does not exist on this map.`))),this.stylesheet.imports=p.slice(0,y).concat(n).concat(p.slice(y)),this._loadImports([n],!0,l)}updateImport(n,l){this._checkLoaded();const p=this.stylesheet.imports||[],y=this.getImportIndex(n);return y===-1?this:typeof l=="string"?(this.setImportUrl(n,l),this):(l.url&&l.url!==p[y].url&&this.setImportUrl(n,l.url),o.by(l.config,p[y].config)||this.setImportConfig(n,l.config,l.data.schema),o.by(l.data,p[y].data)||this.setImportData(n,l.data),this)}moveImport(n,l){this._checkLoaded();let p=this.stylesheet.imports||[];const y=this.getImportIndex(n);if(y===-1)return this;const x=this.getImportIndex(l);if(x===-1)return this;const b=p[y],T=this.fragments[y];return p=p.filter(({id:A})=>A!==n),this.fragments=this.fragments.filter(({id:A})=>A!==n),this.stylesheet.imports=p.slice(0,x).concat(b).concat(p.slice(x)),this.fragments=this.fragments.slice(0,x).concat(T).concat(this.fragments.slice(x)),this.mergeLayers(),this}setImportUrl(n,l){this._checkLoaded();const p=this.stylesheet.imports||[],y=this.getImportIndex(n);if(y===-1)return this;p[y].url=l;const x=this.fragments[y];return x.style=this._createFragmentStyle(p[y]),x.style.on("style.import.load",()=>this.mergeAll()),x.style.loadURL(l),this}setImportData(n,l){this._checkLoaded();const p=this.getImportIndex(n),y=this.stylesheet.imports||[];return p===-1?this:l?(this.fragments[p].style.setState(l),this._reloadImports(),this):(delete y[p].data,this.setImportUrl(n,y[p].url))}setImportConfig(n,l,p){this._checkLoaded();const y=this.getImportIndex(n),x=this.stylesheet.imports||[];if(y===-1)return this;l?x[y].config=l:delete x[y].config;const b=this.fragments[y];p&&b.style.stylesheet&&(b.style.stylesheet.schema=p);const T=b.style.stylesheet&&b.style.stylesheet.schema;return b.config=l,b.style.updateConfig(l,T),this.updateConfigDependencies(),this}removeImport(n){this._checkLoaded();const l=this.stylesheet.imports||[],p=this.getImportIndex(n);p!==-1&&(l.splice(p,1),this.fragments[p].style._remove(),this.fragments.splice(p,1),this._reloadImports())}getImportIndex(n){const l=(this.stylesheet.imports||[]).findIndex(p=>p.id===n);return l===-1&&this.fire(new o.y(new Error(`Import '${n}' does not exist in the map's style and cannot be updated.`))),l}getLayer(n){return this._mergedLayers[n]}getSources(){const n=[];for(const l in this._mergedOtherSourceCaches){const p=this._mergedOtherSourceCaches[l];p&&n.push(p.getSource())}return n}getSource(n,l){const p=this.getSourceCache(n,l);return p&&p.getSource()}getLayerSource(n){const l=this.getLayerSourceCache(n);return l&&l.getSource()}getSourceCache(n,l){const p=o.B(n,l);return this._mergedOtherSourceCaches[p]}getLayerSourceCache(n){const l=o.B(n.source,n.scope);return n.type==="symbol"?this._mergedSymbolSourceCaches[l]:this._mergedOtherSourceCaches[l]}getSourceCaches(n){if(n==null)return Object.values(this._mergedSourceCaches);const l=[];return this._mergedOtherSourceCaches[n]&&l.push(this._mergedOtherSourceCaches[n]),this._mergedSymbolSourceCaches[n]&&l.push(this._mergedSymbolSourceCaches[n]),l}updateSourceCaches(){const n=this._changes.getUpdatedSourceCaches();for(const l in n){const p=n[l];p==="reload"?this.reloadSource(l):p==="clear"&&this.clearSource(l)}}updateLayers(n){const l=this._changes.getUpdatedPaintProperties();for(const p of l){const y=this.getLayer(p);y&&y.updateTransitions(n)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(n){this.stylesheet.glyphs=n,this.glyphManager.setURL(n)}getImages(n,l,p){this.imageManager.getImages(l.images,l.scope,p),this._updateTilesForChangedImages();const y=b=>{if(b){const T=l.images.map(A=>o.I.toString(A));b.setDependencies(l.tileID.key,l.type,T)}},x=o.B(l.source,l.scope);y(this._mergedOtherSourceCaches[x]),y(this._mergedSymbolSourceCaches[x]),l.images.some(b=>b.iconsetId)&&this.fire(new o.z("data",{dataType:"style"}))}rasterizeImages(n,l,p){this.imageManager.rasterizeImages(l,p)}getGlyphs(n,l,p){this.glyphManager.getGlyphs(l.stacks,p)}getResource(n,l,p){return o.dz(l,p)}getOwnSourceCache(n){return this._otherSourceCaches[n]}getOwnLayerSourceCache(n){return n.type==="symbol"?this._symbolSourceCaches[n.source]:this._otherSourceCaches[n.source]}getOwnSourceCaches(n){const l=[];return this._otherSourceCaches[n]&&l.push(this._otherSourceCaches[n]),this._symbolSourceCaches[n]&&l.push(this._symbolSourceCaches[n]),l}_isSourceCacheLoaded(n){const l=this.getOwnSourceCaches(n);return l.length===0?(this.fire(new o.y(new Error(`There is no source with ID '${n}'`))),!1):l.every(p=>p.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(n,l){if(!this._clipLayerPresent&&n.type!=="fill-extrusion"&&n.type!=="building")return!1;const p=n.type==="fill-extrusion"&&(n.sourceLayer==="building"||n.sourceLayer==="procedural_buildings"),y=n.type==="building";if(n.is3D(!!this.terrain)){if(p||y||l&&l.type==="batched-model"||n.type==="model")return!0}else if(n.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(n=>{n.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}ga.getSourceType=function(f){return Qa[f]},ga.setSourceType=function(f,n){Qa[f]=n},ga.registerForPluginStateChange=o.dA;class X0 extends o.E{constructor(n){super(),this._style=n,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},o.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(n){n===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=n,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(n){this._activeFloorsVisible=n,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(n){for(const[l,p]of Object.entries(n.buildings))if(this._buildings[l])for(const y of p.floorIds)this._buildings[l].floors[y]||(this._buildings[l].floors[y]=p.floors[y]);else this._buildings[l]=p;for(const l of n.activeFloors)this._activeFloors.add(l);this._updateIndoorSelector()}getIndoorTileOptions(n,l){const p=this._style.getIndoorSourceLayers(n,l);return p&&this._indoorState?{sourceLayers:p,indoorState:this._indoorState}:null}_updateUI(n,l,p){const y=function(x,b,T,A){let M=null,D=Number.MAX_SAFE_INTEGER;if(A<16)return null;for(const[N,B]of Object.entries(x)){const j=B.center;if(j){const H=b.distanceTo(o.aT.convert(j));H<D&&T.contains(j)&&(D=H,M=N)}}return M}(this._buildings,l,p,n);y!==this._closestBuildingId&&(this._closestBuildingId=y,this._updateIndoorSelector())}_updateIndoorSelector(){const n=this._buildings,l=this._closestBuildingId,p=l&&n?n[l]:void 0;if(!p)return void this.fire(new o.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));let y=null;for(const b of p.floorIds)if(this._activeFloors&&this._activeFloors.has(b)){y=b;break}const x=Array.from(p.floorIds).map(b=>({id:b,name:p.floors[b].name,zIndex:p.floors[b].zIndex})).sort((b,T)=>T.zIndex-b.zIndex);this.fire(new o.z("selector-update",{selectedFloorId:y,activeFloorsVisible:this._activeFloorsVisible,floors:x}))}_updateActiveFloors(){const n=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:n,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var Yu=`
|
||
#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`,Ju=`
|
||
#ifdef DUAL_SOURCE_BLENDING
|
||
layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
|
||
#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
|
||
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
|
||
}
|
||
#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 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,v_=`
|
||
#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);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
|
||
unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
||
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const 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(vec2 posWithComposedSkirt)
|
||
{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=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`,fp="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;}",Zo=`
|
||
#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`,pp=`#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`,bt=`#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`,x_=`#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`,mp=`#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;}`,gp=`#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`,w_=`#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 Ih=/#include\s+"([^"]+)"/g,ol=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,b_=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,ou=new Set(["ifdef","ifndef","elif","if","defined"]),au=new Set;Sc(Yu,au),Sc(v_,au),Sc(Ju,au);const bc={"_prelude_fog.vertex.glsl":pp,"_prelude_terrain.vertex.glsl":Zo,"_prelude_shadow.vertex.glsl":gp,"_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":bt,"_prelude_shadow.fragment.glsl":w_,"_prelude_lighting.glsl":`
|
||
#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`,"_prelude_raster_array.glsl":x_,"_prelude_raster_particle.glsl":mp},_p={};Jr("",Zo),Jr(bt,pp),Jr(w_,gp),Jr(x_,""),Jr(mp,"");const Y0=Jr(Ju,v_),yp=Yu,TS=[`
|
||
#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
|
||
#extension GL_EXT_blend_func_extended : require
|
||
#endif`,"precision mediump float;",yp,Y0.fragmentSource].join(`
|
||
`),J0=["precision highp float;",yp,Y0.vertexSource].join(`
|
||
`);var S_={background:Jr(`#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 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
|
||
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 vec2 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);
|
||
#ifdef LIGHTING_3D_MODE
|
||
v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(a_pos);
|
||
#endif
|
||
}`),backgroundPattern:Jr(`#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 vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(a_pos);
|
||
#endif
|
||
}`),building:Jr(`#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 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
|
||
float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
|
||
#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) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
|
||
#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=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
|
||
color=applyCutout(color,v_pos.z);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
color=apply_feature_cutout(color,gl_FragCoord);
|
||
#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 vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
|
||
#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 vec2 part_color_emissive
|
||
#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
|
||
void main() {
|
||
#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
|
||
#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
|
||
#ifdef FLOOD_LIGHT
|
||
v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);
|
||
#endif
|
||
vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;
|
||
#ifdef BUILDING_FAUX_FACADE
|
||
v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;}
|
||
#endif
|
||
v_pos=a_pos_3f;
|
||
#ifdef RENDER_CUTOFF
|
||
vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
|
||
#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
|
||
gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Jr(`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 vec2 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 vec2 part_color_emissive
|
||
#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
|
||
#ifdef HAS_ATTRIBUTE_a_part_color_emissive
|
||
vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
|
||
#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:Jr(`in highp float v_depth;void main() {
|
||
#ifndef DEPTH_TEXTURE
|
||
glFragColor=pack_depth(v_depth);
|
||
#endif
|
||
}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Jr(`#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 vec2 a_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
|
||
#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,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
|
||
#if defined(TERRAIN)
|
||
return elevation(pos)+ELEVATION_BIAS;
|
||
#else
|
||
return 0.0;
|
||
#endif
|
||
}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
|
||
#ifdef PITCH_WITH_MAP
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
|
||
#else
|
||
return u_matrix*( world_center+vec4(sample_offset,0,0) );
|
||
#endif
|
||
#else
|
||
return projected_center+vec4(sample_offset,0,0);
|
||
#endif
|
||
}float get_sample_step() {
|
||
#ifdef PITCH_WITH_MAP
|
||
return 2.0*PI/float(NUM_SAMPLES_PER_RING);
|
||
#else
|
||
return PI/float(NUM_SAMPLES_PER_RING);
|
||
#endif
|
||
}void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize mediump float radius
|
||
#pragma mapbox: initialize lowp float blur
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize highp vec4 stroke_color
|
||
#pragma mapbox: initialize mediump float stroke_width
|
||
#pragma mapbox: initialize lowp float stroke_opacity
|
||
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
|
||
#else
|
||
surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
|
||
#endif
|
||
#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:Jr("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Jr(`#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 vec2 a_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
|
||
#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(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
#else
|
||
pos=vec3(tilePos+extrude,elevation(tilePos));
|
||
#endif
|
||
gl_Position=u_matrix*vec4(pos,1);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
}`),heatmapTexture:Jr(`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 vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Jr("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 vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
|
||
#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() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
#ifndef PROJECTED_POS_ON_VIEWPORT
|
||
vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
|
||
#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+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Jr("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
|
||
mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
|
||
0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Jr("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 vec2 a_pos;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in vec3 a_pos_3;
|
||
#endif
|
||
out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
|
||
#else
|
||
gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
|
||
#endif
|
||
}`),elevatedStructuresDepth:Jr(`void main() {
|
||
#ifndef DEPTH_TEXTURE
|
||
glFragColor=vec4(0.);
|
||
#endif
|
||
}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Jr(`#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);
|
||
#endif
|
||
#endif
|
||
glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
|
||
#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;}`),elevatedStructures:Jr(`#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;
|
||
#pragma mapbox: define highp vec4 structure_color
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 structure_color
|
||
vec3 color=structure_color.xyz;
|
||
#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 shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
|
||
#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);
|
||
#endif
|
||
glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
#include "_prelude_shadow.vertex.glsl"
|
||
in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
|
||
#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=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(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(a_pos);
|
||
#endif
|
||
}`),fill:Jr(`#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;
|
||
#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
|
||
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);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;
|
||
#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);
|
||
#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 vec2 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;
|
||
#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(a_pos);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=z_offset;
|
||
#endif
|
||
}`),fillOutline:Jr(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
in highp vec2 v_pos;uniform float u_emissive_strength;
|
||
#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;
|
||
#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);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);
|
||
#endif
|
||
glFragColor=out_color*(alpha*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_shadow.vertex.glsl"
|
||
in vec2 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;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(a_pos);
|
||
#endif
|
||
}`),fillOutlinePattern:Jr(`#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;
|
||
#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 vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 pattern_b
|
||
#endif
|
||
void main() {
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 pattern_b
|
||
#endif
|
||
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
|
||
#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
|
||
#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);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);
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
glFragColor=out_color*(alpha*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_shadow.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 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 vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 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 vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize lowp float pixel_ratio
|
||
#pragma mapbox: initialize highp float z_offset
|
||
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
|
||
#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);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
|
||
#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(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(a_pos);
|
||
#endif
|
||
}`),fillPattern:Jr(`#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;
|
||
#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 vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 pattern_b
|
||
#endif
|
||
void main() {
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 pattern_b
|
||
#endif
|
||
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
|
||
#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
|
||
#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);
|
||
#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);
|
||
#endif
|
||
#ifdef FOG
|
||
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
#endif
|
||
glFragColor=out_color*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_shadow.vertex.glsl"
|
||
uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
|
||
#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 vec4 pattern
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 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 vec4 pattern
|
||
#pragma mapbox: initialize lowp float pixel_ratio
|
||
#pragma mapbox: initialize highp float z_offset
|
||
#ifdef FILL_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 pattern_b
|
||
#endif
|
||
vec2 pattern_tl=pattern.xy;vec2 pattern_br=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);gl_Position=mix(u_matrix*vec4(a_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,a_pos);
|
||
#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(a_pos);
|
||
#endif
|
||
}`),fillExtrusion:Jr(`#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 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
|
||
color=applyCutout(color,h);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
color=apply_feature_cutout(color,gl_FragCoord);
|
||
#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 vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
|
||
#ifdef RENDER_WALL_MODE
|
||
in vec3 a_join_normal_inside;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
|
||
#endif
|
||
#ifdef TERRAIN
|
||
uniform int u_height_type;uniform int u_base_type;
|
||
#endif
|
||
uniform highp float u_vertical_scale;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;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 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
|
||
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
v_normal=normal;
|
||
#endif
|
||
base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
centroid_pos=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);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
|
||
#else
|
||
h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
#endif
|
||
float cutoff=1.0;vec3 scaled_pos=pos;
|
||
#ifdef RENDER_CUTOFF
|
||
vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
|
||
#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 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_WALL_MODE
|
||
vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
|
||
#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.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.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
|
||
}`),fillExtrusionDepth:Jr(`in highp float v_depth;void main() {
|
||
#ifndef DEPTH_TEXTURE
|
||
glFragColor=pack_depth(v_depth);
|
||
#endif
|
||
}`,`#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 vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
|
||
#ifdef RENDER_WALL_MODE
|
||
in vec3 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
|
||
out highp float v_depth;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 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
centroid_pos=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);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
|
||
#else
|
||
pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
|
||
#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);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Jr(`#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 vec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 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 vec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize highp float pixel_ratio
|
||
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
out_color=applyLUT(u_lutTexture,out_color);
|
||
#endif
|
||
#ifdef FILL_EXTRUSION_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
|
||
#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 vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
|
||
#ifdef RENDER_WALL_MODE
|
||
in vec3 a_join_normal_inside;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
|
||
#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 vec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 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 vec4 pattern
|
||
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 pattern_b
|
||
#endif
|
||
#pragma mapbox: initialize highp float pixel_ratio
|
||
#pragma mapbox: initialize highp float line_width
|
||
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
|
||
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
centroid_pos=a_centroid_pos;
|
||
#endif
|
||
float ele=0.0;float h=z;vec3 p;float c_ele;
|
||
#ifdef TERRAIN
|
||
bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
|
||
#else
|
||
p=vec3(pos_nx.xy,z);
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
#endif
|
||
#ifdef RENDER_WALL_MODE
|
||
vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
|
||
#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.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:Jr(`#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
|
||
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 vec2 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(a_pos);v_fog_opacity=fog(v_fog_pos);
|
||
#endif
|
||
}`),fillExtrusionGroundEffect:Jr(`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 vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float 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
|
||
vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
|
||
#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=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:Jr(`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 vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Jr(`#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 vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(a_pos);
|
||
#endif
|
||
}`),line:Jr(`#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 highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
|
||
#ifdef ELEVATED_ROADS
|
||
in highp float v_road_z_offset;
|
||
#endif
|
||
#ifdef RENDER_LINE_DASH
|
||
uniform sampler2D u_dash_image;in vec2 v_tex;
|
||
#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 lowp vec4 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 lowp vec4 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.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);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;
|
||
#ifdef RENDER_LINE_DASH
|
||
float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
|
||
#endif
|
||
highp vec4 out_color;
|
||
#ifdef RENDER_LINE_GRADIENT
|
||
out_color=texture(u_gradient_image,v_uv.xy);
|
||
#ifdef MULTIPLY_LINE_GRADIENT_COLOR
|
||
out_color*=color;
|
||
#endif
|
||
#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);out_color=mix(out_color,u_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
|
||
float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
|
||
#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);
|
||
#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*opacity);
|
||
#ifdef INDICATOR_CUTOUT
|
||
out_color=applyCutout(out_color,v_z_offset);
|
||
#endif
|
||
#ifdef FEATURE_CUTOUT
|
||
out_color=apply_feature_cutout(out_color,gl_FragCoord);
|
||
#endif
|
||
glFragColor=out_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 EXTRUDE_SCALE 0.015873016
|
||
in vec2 a_pos_normal;in vec4 a_data;
|
||
#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
|
||
in vec3 a_z_offset_width;
|
||
#endif
|
||
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
|
||
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 highp 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 float v_gamma_scale;out highp vec3 v_uv;
|
||
#ifdef ELEVATED_ROADS
|
||
out highp float v_road_z_offset;
|
||
#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 lowp vec4 dash
|
||
#pragma mapbox: define lowp float blur
|
||
#pragma mapbox: define lowp float opacity
|
||
#pragma mapbox: define mediump float gapwidth
|
||
#pragma mapbox: define lowp float offset
|
||
#pragma mapbox: define mediump float width
|
||
#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
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 color
|
||
#pragma mapbox: initialize lowp float floorwidth
|
||
#pragma mapbox: initialize lowp vec4 dash
|
||
#pragma mapbox: initialize lowp float blur
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize mediump float gapwidth
|
||
#pragma mapbox: initialize lowp float offset
|
||
#pragma mapbox: initialize mediump float width
|
||
#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 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=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth;
|
||
#ifdef VARIABLE_LINE_WIDTH
|
||
bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal;
|
||
#else
|
||
halfwidth=(u_width_scale*width)/2.0;
|
||
#endif
|
||
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);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;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;
|
||
#ifdef CROSS_SLOPE_VERTICAL
|
||
float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
|
||
#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+a_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+a_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 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];highp float line_progress=a_packed[2];
|
||
#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
|
||
float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
|
||
#endif
|
||
v_width2=vec2(outset,inset);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=a_z_offset;
|
||
#endif
|
||
}`),linePattern:Jr(`#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 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 vec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 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 vec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 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=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
|
||
#ifdef APPLY_LUT_ON_GPU
|
||
color=applyLUT(u_lutTexture,color);
|
||
#endif
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
|
||
#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);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 vec2 a_pos_normal;in vec4 a_data;
|
||
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
in vec3 a_z_offset_width;
|
||
#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 vec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: define mediump vec4 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 vec4 pattern
|
||
#ifdef LINE_PATTERN_TRANSITION
|
||
#pragma mapbox: initialize mediump vec4 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=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;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;
|
||
#ifdef CROSS_SLOPE_VERTICAL
|
||
float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
|
||
#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+a_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+a_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/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
|
||
#endif
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(pos);
|
||
#endif
|
||
#ifdef INDICATOR_CUTOUT
|
||
v_z_offset=a_z_offset;
|
||
#endif
|
||
}`),raster:Jr(`#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"
|
||
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;
|
||
#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
|
||
#ifdef GLOBE_POLES
|
||
in vec3 a_globe_pos;in vec2 a_uv;
|
||
#else
|
||
in vec2 a_pos;in vec2 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;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
|
||
#endif
|
||
#else
|
||
float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
|
||
#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);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);
|
||
v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];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);}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
|
||
gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(a_pos);
|
||
#endif
|
||
#endif
|
||
#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 RENDER_CUTOFF
|
||
v_depth=gl_Position.z;
|
||
#endif
|
||
}`),rasterParticle:Jr(`#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 vec2 a_pos;in vec2 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=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
|
||
#ifdef FOG
|
||
v_fog_pos=fog_position(a_pos);
|
||
#endif
|
||
#endif
|
||
v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Jr("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 float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
|
||
mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Jr("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Jr(`#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 vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Jr(`#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;
|
||
#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
|
||
#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
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 fill_color
|
||
#pragma mapbox: initialize highp vec4 halo_color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize lowp float halo_width
|
||
#pragma mapbox: initialize lowp float halo_blur
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
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;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
|
||
#ifdef OVERDRAW_INSPECTOR
|
||
glFragColor=vec4(1.0);
|
||
#endif
|
||
return;}
|
||
#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;
|
||
#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);
|
||
#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);
|
||
#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 APPEARANCE_ICON 1.0
|
||
in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
|
||
#ifdef Z_OFFSET
|
||
in float a_auto_z_offset;
|
||
#endif
|
||
#ifdef PROJECTION_GLOBE_VIEW
|
||
in vec3 a_globe_anchor;in vec3 a_globe_normal;
|
||
#endif
|
||
#ifdef ICON_TRANSITION
|
||
in vec2 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
|
||
#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 lowp float z_offset
|
||
void main() {
|
||
#pragma mapbox: initialize highp vec4 fill_color
|
||
#pragma mapbox: initialize highp vec4 halo_color
|
||
#pragma mapbox: initialize lowp float opacity
|
||
#pragma mapbox: initialize lowp float halo_width
|
||
#pragma mapbox: initialize lowp float halo_blur
|
||
#pragma mapbox: initialize lowp float emissive_strength
|
||
#pragma mapbox: initialize lowp float occlusion_opacity
|
||
#pragma mapbox: initialize lowp float z_offset
|
||
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {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=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(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);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=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:Jr(`#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 vec2 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:Jr("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
|
||
uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Jr(`#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
|
||
}`,fp),skyboxGradient:Jr(`#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
|
||
}`,fp),skyboxCapture:Jr(`
|
||
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:Jr(`#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 vec2 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:Jr(`#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);}`),model:Jr(`#include "_prelude_fog.fragment.glsl"
|
||
#include "_prelude_shadow.fragment.glsl"
|
||
#include "_prelude_lighting.glsl"
|
||
uniform float u_opacity;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 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
|
||
if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=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 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
|
||
finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
|
||
#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 vec4 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 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 vec4 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
|
||
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;
|
||
#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(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
|
||
#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:Jr(`in highp float v_depth;void main() {
|
||
#ifndef DEPTH_TEXTURE
|
||
glFragColor=pack_depth(v_depth);
|
||
#endif
|
||
}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
|
||
#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
|
||
v_depth=gl_Position.z/gl_Position.w;}`),stars:Jr(`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_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Jr("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:Jr("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:Jr("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Jr("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 Sc(f,n){const l=f.split(`
|
||
`);for(let p of l){if(p=p.trimStart(),p[0]!=="#"||!p.includes("if")||p.startsWith("#endif"))continue;const y=p.match(b_);if(y)for(const x of y)ou.has(x)||n.add(x)}}function Jr(f,n){const l=new Set,p=[],y=[];f=f.replace(Ih,(b,T)=>(y.push(T),"")),n=n.replace(Ih,(b,T)=>(p.push(T),""));let x=new Set(au);Sc(f,x),Sc(n,x);for(const b of[...p,...y])_p[b]||(_p[b]=new Set,Sc(bc[b],_p[b])),x=new Set([...x,..._p[b]]);return{fragmentSource:f=f.replace(ol,(b,T,A,M,D)=>(l.add(D),T==="define"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
in ${A} ${M} ${D};
|
||
#else
|
||
uniform ${A} ${M} u_${D};
|
||
#endif
|
||
`:T==="initialize"?`
|
||
#ifdef HAS_UNIFORM_u_${D}
|
||
${A} ${M} ${D} = u_${D};
|
||
#endif
|
||
`:T==="define-attribute"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
in ${A} ${M} ${D};
|
||
#endif
|
||
`:T==="initialize-attribute"?"":void 0)),vertexSource:n=n.replace(ol,(b,T,A,M,D)=>{const N=`MATERIAL_ATTRIBUTE_OFFSET_${D}`,B=M==="float"?"vec2":M,j=`GET_ATTRIBUTE_${B}(a_${D}, materialInfo, ${N})`,H=D.match(/color/)?"color":B;return T==="define-attribute-vertex-shader-only"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
in ${A} ${M} a_${D};
|
||
#endif
|
||
`:l.has(D)?T==="define"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
uniform lowp float u_${D}_t;
|
||
#if !defined(${N})
|
||
in ${A} ${B} a_${D};
|
||
#endif
|
||
out ${A} ${M} ${D};
|
||
#else
|
||
uniform ${A} ${M} u_${D};
|
||
#endif
|
||
`:T==="initialize"?H==="vec4"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
${D} = a_${D};
|
||
#else
|
||
${A} ${M} ${D} = u_${D};
|
||
#endif
|
||
`:`
|
||
#if !defined(HAS_UNIFORM_u_${D})
|
||
#ifdef ${N}
|
||
${D} = unpack_mix_${H}(${j}, u_${D}_t);
|
||
#else
|
||
${D} = unpack_mix_${H}(a_${D}, u_${D}_t);
|
||
#endif
|
||
#else
|
||
${A} ${M} ${D} = u_${D};
|
||
#endif
|
||
`:T==="define-attribute"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
in ${A} ${M} a_${D};
|
||
out ${A} ${M} ${D};
|
||
#endif
|
||
`:T==="initialize-attribute"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
${D} = a_${D};
|
||
#endif
|
||
`:void 0:T==="define"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
uniform lowp float u_${D}_t;
|
||
#if !defined(${N})
|
||
in ${A} ${B} a_${D};
|
||
#endif
|
||
#else
|
||
uniform ${A} ${M} u_${D};
|
||
#endif
|
||
`:T==="define-instanced"?H==="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} ${M} u_${D};
|
||
#endif
|
||
`:`
|
||
#ifdef INSTANCED_ARRAYS
|
||
in ${A} ${B} a_${D};
|
||
#else
|
||
uniform ${A} ${M} u_${D};
|
||
#endif
|
||
`:T==="initialize-attribute-custom"?`
|
||
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
${A} ${M} ${D} = a_${D};
|
||
#endif
|
||
`:H==="vec4"?`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
#ifdef ${N}
|
||
${A} ${M} ${D} = ${j};
|
||
#else
|
||
${A} ${M} ${D} = a_${D};
|
||
#endif
|
||
#else
|
||
${A} ${M} ${D} = u_${D};
|
||
#endif
|
||
`:`
|
||
#ifndef HAS_UNIFORM_u_${D}
|
||
#ifdef ${N}
|
||
${A} ${M} ${D} = unpack_mix_${H}(${j}, u_${D}_t);
|
||
#else
|
||
${A} ${M} ${D} = unpack_mix_${H}(a_${D}, u_${D}_t);
|
||
#endif
|
||
#else
|
||
${A} ${M} ${D} = u_${D};
|
||
#endif
|
||
`}),usedDefines:x,vertexIncludes:p,fragmentIncludes:y}}class ES{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(n,l,p,y,x,b,T,A){this.context=n;let M=this.boundPaintVertexBuffers.length!==y.length;for(let N=0;!M&&N<y.length;N++)this.boundPaintVertexBuffers[N]!==y[N]&&(M=!0);let D=this.boundDynamicVertexBuffers.length!==T.length;for(let N=0;!D&&N<T.length;N++)this.boundDynamicVertexBuffers[N]!==T[N]&&(D=!0);if(!this.vao||this.boundProgram!==l||this.boundLayoutVertexBuffer!==p||M||D||this.boundIndexBuffer!==x||this.boundVertexOffset!==b)this.freshBind(l,p,y,x,b,T,A);else{n.bindVertexArrayOES.set(this.vao);for(const N of T)N&&(N.bind(),A&&N.instanceCount&&N.setVertexAttribDivisor(n.gl,l,A));x&&x.dynamicDraw&&x.bind()}}freshBind(n,l,p,y,x,b,T){const A=this.context,M=A.gl;this.vao&&this.destroy(),this.vao=A.gl.createVertexArray(),A.bindVertexArrayOES.set(this.vao),this.boundProgram=n,this.boundLayoutVertexBuffer=l,this.boundPaintVertexBuffers=p,this.boundIndexBuffer=y,this.boundVertexOffset=x,this.boundDynamicVertexBuffers=b,l.enableAttributes(M,n),l.bind(),l.setVertexAttribPointers(M,n,x);for(const D of p)D.enableAttributes(M,n),D.bind(),D.setVertexAttribPointers(M,n,x);for(const D of b)D&&(D.enableAttributes(M,n),D.bind(),D.setVertexAttribPointers(M,n,x),T&&D.instanceCount&&D.setVertexAttribDivisor(M,n,T));y&&y.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function kS(f,n){const l=Math.pow(2,n.canonical.z),p=n.canonical.y;return[new o.ae(0,p/l).toLngLat().lat,new o.ae(0,(p+1)/l).toLngLat().lat]}function AS(f,n,l,p,y,x,b){const T=f.context,A=T.gl,M=l.hillshadeFBO;if(!M)return;f.prepareDrawTile();const D=f.isTileAffectedByFog(n),N=[];f.terrain&&f.terrain.renderingToTexture&&f.emissiveMode==="mrt-fallback"&&N.push("USE_MRT1");const B=f.getOrCreateProgram("hillshade",{overrideFog:D,defines:N});T.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,M.colorAttachment0.get());const j=((J,ae,de,ce)=>{const Se=de.paint.get("hillshade-shadow-color"),ye=de.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",we=de.paint.get("hillshade-highlight-color"),_e=de.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",pe=de.paint.get("hillshade-accent-color"),Te=de.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",De=de.paint.get("hillshade-emissive-strength");let Me=o.an(de.paint.get("hillshade-illumination-direction"));if(de.paint.get("hillshade-illumination-anchor")==="viewport")Me-=J.transform.angle;else if(J.style&&J.style.enable3dLights()&&J.style.directionalLight){const He=J.style.directionalLight.properties.get("direction"),et=o.d4(He.x,He.y,He.z);Me=o.an(et[1])}const Ge=!J.options.moving;return{u_matrix:ce||J.transform.calculateProjMatrix(ae.tileID.toUnwrapped(),Ge),u_image:0,u_latrange:kS(0,ae.tileID),u_light:[de.paint.get("hillshade-exaggeration"),Me],u_shadow:Se.toPremultipliedRenderColor(ye?null:de.lut),u_highlight:we.toPremultipliedRenderColor(_e?null:de.lut),u_emissive_strength:De,u_accent:pe.toPremultipliedRenderColor(Te?null:de.lut)}})(f,l,p,f.terrain?n.projMatrix:null);f.uploadCommonUniforms(T,B,n.toUnwrapped());const{tileBoundsBuffer:H,tileBoundsIndexBuffer:G,tileBoundsSegments:Q}=f.getTileBoundsBuffers(l);B.draw(f,A.TRIANGLES,y,x,b,fr.disabled,j,p.id,H,G,Q)}function T_(f,n,l){if(!n.needsDEMTextureUpload)return;const p=f.context,y=p.gl;p.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||f.getTileTexture(l.stride);const x=l.getPixels();n.demTexture?n.demTexture.update(x,{premultiply:!1}):n.demTexture=new o.T(p,x,y.R32F,{premultiply:!1}),n.needsDEMTextureUpload=!1}function CS(f,n,l){const p=f.context,y=p.gl;if(!n.dem)return;const x=n.dem;if(p.activeTexture.set(y.TEXTURE1),T_(f,n,x),!n.demTexture)return;n.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);const b=x.dim;p.activeTexture.set(y.TEXTURE0);let T=n.hillshadeFBO;if(!T){const B=new o.T(p,{width:b,height:b,data:null},y.RGBA8);B.bind(y.LINEAR,y.CLAMP_TO_EDGE),T=n.hillshadeFBO=p.createFramebuffer(b,b,1,"renderbuffer"),T.colorAttachment0.set(B.texture)}p.bindFramebuffer.set(T.framebuffer),p.viewport.set([0,0,b,b]);const{tileBoundsBuffer:A,tileBoundsIndexBuffer:M,tileBoundsSegments:D}=f.getMercatorTileBoundsBuffers(),N=[];f.linearFloatFilteringSupported()&&N.push("TERRAIN_DEM_FLOAT_FORMAT"),f.terrain&&f.terrain.renderingToTexture&&f.emissiveMode==="mrt-fallback"&&N.push("USE_MRT1"),f.getOrCreateProgram("hillshadePrepare",{defines:N}).draw(f,y.TRIANGLES,Xt.disabled,pr.disabled,Er.unblended,fr.disabled,((B,j)=>{const H=j.stride,G=o.bC();return o.ce(G,0,o.al,-o.al,0,0,1),o.br(G,G,[0,-o.al,0]),{u_matrix:G,u_image:1,u_dimension:[H,H],u_zoom:B.overscaledZ}})(n.tileID,x),l.id,A,M,D),n.needsHillshadePrepare=!1}class Qn{constructor(n){this.gl=n.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(n){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class IS extends Qn{getDefault(){return o.ao.transparent.toNonPremultipliedRenderColor(null)}set(n){const l=this.current;(n.r!==l.r||n.g!==l.g||n.b!==l.b||n.a!==l.a||this.dirty)&&(this.gl.clearColor(n.r,n.g,n.b,n.a),this.current=n,this.dirty=!1)}}class Q0 extends Qn{getDefault(){return 1}set(n){(n!==this.current||this.dirty)&&(this.gl.clearDepth(n),this.current=n,this.dirty=!1)}}class E_ extends Qn{getDefault(){return 0}set(n){(n!==this.current||this.dirty)&&(this.gl.clearStencil(n),this.current=n,this.dirty=!1)}}class vp extends Qn{getDefault(){return[!0,!0,!0,!0]}set(n){const l=this.current;(n[0]!==l[0]||n[1]!==l[1]||n[2]!==l[2]||n[3]!==l[3]||this.dirty)&&(this.gl.colorMask(n[0],n[1],n[2],n[3]),this.current=n,this.dirty=!1)}}class k_ extends Qn{getDefault(){return!0}set(n){(n!==this.current||this.dirty)&&(this.gl.depthMask(n),this.current=n,this.dirty=!1)}}class lu extends Qn{getDefault(){return 255}set(n){(n!==this.current||this.dirty)&&(this.gl.stencilMask(n),this.current=n,this.dirty=!1)}}class Qu extends Qn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(n){const l=this.current;(n.func!==l.func||n.ref!==l.ref||n.mask!==l.mask||this.dirty)&&(this.gl.stencilFunc(n.func,n.ref,n.mask),this.current=n,this.dirty=!1)}}class Ph extends Qn{getDefault(){const n=this.gl;return[n.KEEP,n.KEEP,n.KEEP]}set(n){const l=this.current;(n[0]!==l[0]||n[1]!==l[1]||n[2]!==l[2]||this.dirty)&&(this.gl.stencilOp(n[0],n[1],n[2]),this.current=n,this.dirty=!1)}}class ed extends Qn{getDefault(){return!1}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;n?l.enable(l.STENCIL_TEST):l.disable(l.STENCIL_TEST),this.current=n,this.dirty=!1}}class ex extends Qn{getDefault(){return[0,1]}set(n){const l=this.current;(n[0]!==l[0]||n[1]!==l[1]||this.dirty)&&(this.gl.depthRange(n[0],n[1]),this.current=n,this.dirty=!1)}}class A_ extends Qn{getDefault(){return!1}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;n?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),this.current=n,this.dirty=!1}}class tx extends Qn{getDefault(){return this.gl.LESS}set(n){(n!==this.current||this.dirty)&&(this.gl.depthFunc(n),this.current=n,this.dirty=!1)}}class td extends Qn{getDefault(){return!1}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;n?l.enable(l.BLEND):l.disable(l.BLEND),this.current=n,this.dirty=!1}}class xp extends Qn{getDefault(){const n=this.gl;return[n.ONE,n.ZERO,n.ONE,n.ZERO]}set(n){const l=this.current;(n[0]!==l[0]||n[1]!==l[1]||n[2]!==l[2]||n[3]!==l[3]||this.dirty)&&(this.gl.blendFuncSeparate(n[0],n[1],n[2],n[3]),this.current=n,this.dirty=!1)}}class wp extends Qn{getDefault(){return o.ao.transparent.toNonPremultipliedRenderColor(null)}set(n){const l=this.current;(n.r!==l.r||n.g!==l.g||n.b!==l.b||n.a!==l.a||this.dirty)&&(this.gl.blendColor(n.r,n.g,n.b,n.a),this.current=n,this.dirty=!1)}}class C_ extends Qn{getDefault(){return this.gl.FUNC_ADD}set(n){(n!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(n,n),this.current=n,this.dirty=!1)}}class bp extends Qn{getDefault(){return!1}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;n?l.enable(l.CULL_FACE):l.disable(l.CULL_FACE),this.current=n,this.dirty=!1}}class Mh extends Qn{getDefault(){return this.gl.BACK}set(n){(n!==this.current||this.dirty)&&(this.gl.cullFace(n),this.current=n,this.dirty=!1)}}class rx extends Qn{getDefault(){return this.gl.CCW}set(n){(n!==this.current||this.dirty)&&(this.gl.frontFace(n),this.current=n,this.dirty=!1)}}let nx=class extends Qn{getDefault(){return null}set(f){(f!==this.current||this.dirty)&&(this.gl.useProgram(f),this.current=f,this.dirty=!1)}};class ix extends Qn{getDefault(){return this.gl.TEXTURE0}set(n){(n!==this.current||this.dirty)&&(this.gl.activeTexture(n),this.current=n,this.dirty=!1)}}class rd extends Qn{getDefault(){const n=this.gl;return[0,0,n.drawingBufferWidth,n.drawingBufferHeight]}set(n){const l=this.current;(n[0]!==l[0]||n[1]!==l[1]||n[2]!==l[2]||n[3]!==l[3]||this.dirty)&&(this.gl.viewport(n[0],n[1],n[2],n[3]),this.current=n,this.dirty=!1)}}class sx extends Qn{getDefault(){return null}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.bindFramebuffer(l.FRAMEBUFFER,n),this.current=n,this.dirty=!1}}class PS extends Qn{getDefault(){return null}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.bindRenderbuffer(l.RENDERBUFFER,n),this.current=n,this.dirty=!1}}class MS extends Qn{getDefault(){return null}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.bindTexture(l.TEXTURE_2D,n),this.current=n,this.dirty=!1}}class RS extends Qn{getDefault(){return null}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.bindBuffer(l.ARRAY_BUFFER,n),this.current=n,this.dirty=!1}}class I_ extends Qn{getDefault(){return null}set(n){const l=this.gl;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,n),this.current=n,this.dirty=!1}}class P_ extends Qn{getDefault(){return null}set(n){this.gl&&(n!==this.current||this.dirty)&&(this.gl.bindVertexArray(n),this.current=n,this.dirty=!1)}}class M_ extends Qn{getDefault(){return 4}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.pixelStorei(l.UNPACK_ALIGNMENT,n),this.current=n,this.dirty=!1}}class R_ extends Qn{getDefault(){return!1}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n),this.current=n,this.dirty=!1}}class ox extends Qn{getDefault(){return!1}set(n){if(n===this.current&&!this.dirty)return;const l=this.gl;l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,n),this.current=n,this.dirty=!1}}class Sp extends Qn{constructor(n,l){super(n),this.context=n,this.parent=l}getDefault(){return null}}class Tp extends Sp{constructor(n,l,p=0){super(n,l),this.attachmentPoint=n.gl.COLOR_ATTACHMENT0+p}setDirty(){this.dirty=!0}set(n){if(n===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const l=this.gl;l.framebufferTexture2D(l.FRAMEBUFFER,this.attachmentPoint,l.TEXTURE_2D,n,0),this.current=n,this.dirty=!1}}class nd extends Sp{attachment(){return this.gl.DEPTH_ATTACHMENT}set(n){if(n===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const l=this.gl;l.framebufferRenderbuffer(l.FRAMEBUFFER,this.attachment(),l.RENDERBUFFER,n),this.current=n,this.dirty=!1}}class Rh extends Sp{attachment(){return this.gl.DEPTH_ATTACHMENT}set(n){if(n===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const l=this.gl;l.framebufferTexture2D(l.FRAMEBUFFER,this.attachment(),l.TEXTURE_2D,n,0),this.current=n,this.dirty=!1}}class ax extends nd{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Xo=(f,n,l,p)=>({u_matrix:f,u_image0:0,u_image1:1,u_skirt_height:n,u_ground_shadow_factor:l,u_emissive_texture_available:p}),Ep=(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q)=>({u_proj_matrix:Float32Array.from(f),u_globe_matrix:n,u_normalize_matrix:Float32Array.from(p),u_merc_matrix:l,u_zoom_transition:y,u_merc_center:x,u_image0:0,u_image1:1,u_frustum_tl:b,u_frustum_tr:T,u_frustum_br:A,u_frustum_bl:M,u_globe_pos:D,u_globe_radius:N,u_viewport:B,u_grid_matrix:Q?Float32Array.from(Q):new Float32Array(9),u_skirt_height:j,u_far_z_cutoff:H,u_emissive_texture_available:G});function Dh(f,n){return f!=null&&n!=null&&!(!f.hasData()||!n.hasData())&&f.demTexture!=null&&n.demTexture!=null&&f.tileID.key!==n.tileID.key}const Il=new class{constructor(){this.operations={}}newMorphing(f,n,l,p,y){if(f in this.operations){const x=this.operations[f];x.to.tileID.key!==l.tileID.key&&(x.queued=l)}else this.operations[f]={startTime:p,phase:0,duration:y,from:n,to:l,queued:null}}getMorphValuesForProxy(f){if(!(f in this.operations))return null;const n=this.operations[f];return{from:n.from,to:n.to,phase:n.phase}}update(f){for(const n in this.operations){const l=this.operations[n];for(l.phase=(f-l.startTime)/l.duration;l.phase>=1||!this._validOp(l);)if(!this._nextOp(l,f)){delete this.operations[n];break}}}_nextOp(f,n){return!!f.queued&&(f.from=f.to,f.to=f.queued,f.queued=null,f.phase=0,f.startTime=n,!0)}_validOp(f){return f.from.hasData()&&f.to.hasData()}},kp={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Ap(f,n,l){if(n===0)return 0;const p=n<1&&l===514?.25/n:1;return 6*Math.pow(1.5,22-f)*Math.max(n,1)*p}function D_(f,n){const l=1<<f.z;return!n&&(f.x===0||f.x===l-1)||f.y===0||f.y===l-1}function id(f,n){if(!f.style||!f.style.enable3dLights())return;const l=f.context,p=l.gl;l.activeTexture.set(p.TEXTURE1),n?n.bind(p.LINEAR,p.CLAMP_TO_EDGE):f.emptyTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE)}const Lh=f=>({u_matrix:f});function Oh(f,n,l,p,y){if(y>0){const x=o.o.now(),b=(x-f.timeAdded)/y,T=n?(x-n.timeAdded)/y:-1,A=l.getSource(),M=p.coveringZoomLevel({tileSize:A.tileSize,roundZoom:A.roundZoom}),D=!n||Math.abs(n.tileID.overscaledZ-M)>Math.abs(f.tileID.overscaledZ-M),N=D&&f.refreshedUponExpiration?1:o.aA(D?b:1-T,0,1);return n?{opacity:1,mix:1-N,isFading:b<1}:{opacity:N,mix:0,isFading:b<1}}return{opacity:1,mix:0,isFading:!1}}class Cp extends Oo{constructor(n){const l=ns("mock-dem",{type:"raster-dem",maxzoom:n.transform.maxZoom},n.style.dispatcher,n.style);super("mock-dem",l,!1),l.setEventedParent(this),this._sourceLoaded=!0}_loadTile(n,l){n.state="loaded",l(null)}}class L_ extends Oo{constructor(n){const l=ns("proxy",{type:"geojson",maxzoom:n.transform.maxZoom},n.style.dispatcher,n.style);super("proxy",l,!1),l.setEventedParent(this),this.map=this.getSource().map=n,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(n,l,p){if(n.freezeTileCoverage)return;this.transform=n;const y=n.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((x,b)=>{if(x[b.key]="",!this._tiles[b.key]){const T=new ru(b,this._source.tileSize*b.overscaleFactor(),n.tileZoom,void 0,void 0,this._source.worldview);T.state="loaded",this._tiles[b.key]=T}return x},{});for(const x in this._tiles)x in y||(this.freeFBO(x),this._tiles[x].unloadVectorData(),delete this._tiles[x])}freeFBO(n){const l=this.proxyCachedFBO[n];if(l!==void 0){const p=Object.values(l);this.renderCachePool.push(...p),delete this.proxyCachedFBO[n]}}deallocRenderCache(){this.renderCache.forEach(n=>n.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class O_ extends o.aQ{constructor(n,l,p){super(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,n.canonical.y),this.proxyTileKey=l,this.projMatrix=p}}class z_ extends o.bV{constructor(n,l){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=n,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[p,y,x]=function(A){const M=new o.bd,D=new o.b0,N=131;M.reserve(17161),D.reserve(33800);const B=o.al/128,j=o.al+B/2,H=j+B;for(let Q=-B;Q<H;Q+=B)for(let J=-B;J<H;J+=B){const ae=J<0||J>j||Q<0||Q>j?24575:0,de=o.aA(Math.round(J),0,o.al),ce=o.aA(Math.round(Q),0,o.al);M.emplaceBack(de+ae,ce)}const G=(Q,J)=>{const ae=J*N+Q;D.emplaceBack(ae+1,ae,ae+N),D.emplaceBack(ae+N,ae+N+1,ae+1)};for(let Q=1;Q<129;Q++)for(let J=1;J<129;J++)G(J,Q);return[0,129].forEach(Q=>{for(let J=0;J<130;J++)G(J,Q),G(Q,J)}),[M,D,32768]}(),b=n.context;this.gridBuffer=b.createVertexBuffer(p,o.bf.members),this.gridIndexBuffer=b.createIndexBuffer(y),this.gridSegments=o.bg.simpleSegment(0,0,p.length,y.length),this.gridNoSkirtSegments=o.bg.simpleSegment(0,0,p.length,x),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new L_(l.map),this.orthoMatrix=o.bC(),o.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,o.al,0,o.al,0,1);const T=b.gl;this._overlapStencilMode=new pr({func:T.GEQUAL,mask:255},0,255,T.KEEP,T.KEEP,T.REPLACE),this._previousZoom=n.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=l,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Cp(l.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(n){n.on("data",this._onStyleDataEvent.bind(this)),this._style=n,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(n,l,p){if(n&&n.terrain){this._style!==n&&(this.style=n,this._evaluationZoom=void 0);const y=n.terrain.properties,x=n.terrain.drapeRenderMode===0,b=n.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=o.o.now();const T=n.terrain&&n.terrain.scope,A=y.get("source"),M=x?this._mockSourceCache:n.getSourceCache(A,T);if(!M)return void o.w(`Couldn't find terrain source "${A}".`);if(this.sourceCache=M,this._attenuationRange=n.terrain.getAttenuationRange(),this._exaggeration=b?this.calculateExaggeration(l):y.get("exaggeration"),!l.projection.requiresDraping&&b&&this._exaggeration===0)return void this._disable();this.enabled=!0;const D=()=>{this.sourceCache.used&&o.w(`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 N=this.getScaledDemTileSize();this.sourceCache.update(l,N,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,D(),this._initializing=!0),D(),l.updateElevation(!0,p),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(l),this._emptyDEMTextureDirty=!0,this._previousZoom=l.zoom}else this._disable()}calculateExaggeration(n){if(this._attenuationRange&&n.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(n.zoom);const l=this._previousCameraAltitude,p=n.getFreeCameraOptions().position.z/n.pixelsPerMeter*n.worldSize;this._previousCameraAltitude=p;const y=l!=null?p-l:Number.MAX_VALUE;if(Math.abs(y)<2)return this._exaggeration;const x=n.zoom,b=this._style.terrain;if(!this._previousUpdateTimestamp)return b.getExaggeration(x);let T=x-this._previousZoom;const A=this._previousUpdateTimestamp;let M=x;this._evaluationZoom!=null&&(M=this._evaluationZoom,Math.abs(x-M)>.5&&(T=.5*(x-M+T)),T*y<0&&(M+=T)),this._evaluationZoom=M;const D=b.getExaggeration(M),N=D===b.getExaggeration(Math.max(0,M-.1));if(N&&Math.abs(D-this._exaggeration)<.01)return D;let B=Math.min(.1,.00375*(this._updateTimestamp-A));return(N||D<.1||Math.abs(T)<1e-4)&&(B=Math.min(.2,4*B)),o.ak(this._exaggeration,D,B)}resetTileLookupCache(n){this._findCoveringTileCache[n]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(n){n.dataType==="source"&&n.coord?this._clearRenderCacheForTile(n.sourceCacheId,n.coord):n.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 n in this._style._mergedSourceCaches)this._style._mergedSourceCaches[n].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(n=>n.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 n=2*this.proxySourceCache.getSource().tileSize;return[n,n]}set useVertexMorphing(n){this._useVertexMorphing=n}updateTileBinding(n){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const l=this.proxySourceCache,p=this.painter.transform;this._initializing&&(this._initializing=p._centerAltitude===0&&this.getAtPointOrZero(o.ae.fromLngLat(p.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const y=this.proxyCoords=l.getIds().map(A=>{const M=l.getTileByID(A).tileID;return M.projMatrix=p.calculateProjMatrix(M.toUnwrapped()),M});(function(A,M){const D=M.transform.pointCoordinate(M.transform.getCameraPoint()),N=new o.P(D.x,D.y);A.sort((B,j)=>{if(j.overscaledZ-B.overscaledZ)return j.overscaledZ-B.overscaledZ;const H=new o.P(B.canonical.x+(1<<B.canonical.z)*B.wrap,B.canonical.y),G=new o.P(j.canonical.x+(1<<j.canonical.z)*j.wrap,j.canonical.y),Q=N.mult(1<<B.canonical.z);return Q.x-=.5,Q.y-=.5,Q.distSqr(H)-Q.distSqr(G)})})(y,this.painter);const x=this.proxyToSource||{};this.proxyToSource={},y.forEach(A=>{this.proxyToSource[A.key]={}}),this.terrainTileForTile={};const b=this._style._mergedSourceCaches;for(const A in b){const M=b[A];if(!M.used||(M!==this.sourceCache&&this.resetTileLookupCache(M.id),this._setupProxiedCoordsForOrtho(M,n[A],x),M.usedForTerrain))continue;const D=n[A];M.getSource().reparseOverscaled&&this._assignTerrainTiles(D)}this.proxiedCoords[l.id]=y.map(A=>new O_(A,A.key,this.orthoMatrix)),this._assignTerrainTiles(y),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(x),this.renderingToTexture=!1;const T={};this._visibleDemTiles=[];for(const A of this.proxyCoords){const M=this.terrainTileForTile[A.key];if(!M)continue;const D=M.tileID.key;D in T||(this._visibleDemTiles.push(M),T[D]=D)}}_assignTerrainTiles(n){this._initializing||n.forEach(l=>{if(this.terrainTileForTile[l.key])return;const p=this._findTileCoveringTileID(l,this.sourceCache);p&&(this.terrainTileForTile[l.key]=p)})}_prepareDEMTextures(){const n=this.painter.context,l=n.gl;for(const p in this.terrainTileForTile){const y=this.terrainTileForTile[p],x=y.dem;!x||y.demTexture&&!y.needsDEMTextureUpload||(n.activeTexture.set(l.TEXTURE1),T_(this.painter,y,x))}}_prepareDemTileUniforms(n,l,p,y){if(!l||l.demTexture==null)return!1;const x=n.tileID.canonical,b=Math.pow(2,l.tileID.canonical.z-x.z),T=y||"";return p[`u_dem_tl${T}`]=[x.x*b%1,x.y*b%1],p[`u_dem_scale${T}`]=b,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let n=0;const l=this._visibleDemTiles.reduce((p,y)=>{if(!y.dem)return p;const x=y.dem.tree.minimums[0];return x>0&&n++,p+x},0);return n?l/n:0}_updateEmptyDEMTexture(){const n=this.painter.context,l=n.gl;n.activeTexture.set(l.TEXTURE2);const p=this._getLoadedAreaMinimum(),y=new o.dL({width:1,height:1},new Float32Array([p]));this._emptyDEMTextureDirty=!1;let x=this._emptyDEMTexture;return x?x.update(y,{premultiply:!1}):x=this._emptyDEMTexture=new o.T(n,y,l.R32F,{premultiply:!1}),x}setupElevationDraw(n,l,p){const y=this.painter.context,x=y.gl,b={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};b.u_exaggeration=this.exaggeration();let T=null,A=null,M=1;if(p&&p.morphing&&this._useVertexMorphing){const j=p.morphing.srcDemTile,H=p.morphing.dstDemTile;M=p.morphing.phase,j&&H&&(this._prepareDemTileUniforms(n,j,b,"_prev")&&(A=j),this._prepareDemTileUniforms(n,H,b)&&(T=H))}const D=j=>j&&j.demTexture&&this.painter.linearFloatFilteringSupported()?x.LINEAR:x.NEAREST;let N=null;var B;if(this.enabled?A&&T?(N=T.demTexture,y.activeTexture.set(x.TEXTURE4),A.demTexture.bind(D(A),x.CLAMP_TO_EDGE),b.u_dem_lerp=M):(T=this.terrainTileForTile[n.tileID.key],N=this._prepareDemTileUniforms(n,T,b)?T.demTexture:this.emptyDEMTexture):N=this.emptyDEMTexture,y.activeTexture.set(x.TEXTURE2),N&&(b.u_dem_size=(B=N).size[0]===1?1:B.size[0]-2,N.bind(D(T),x.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(p&&p.useDepthForOcclusion,l,b),p&&p.useMeterToDem&&T){const j=(1<<T.tileID.canonical.z)*o.cf(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;b.u_meter_to_dem=j}if(p&&p.labelPlaneMatrixInv&&(b.u_label_plane_matrix_inv=p.labelPlaneMatrixInv),l.setTerrainUniformValues(y,b),this.painter.transform.projection.name==="globe"){const j=this.globeUniformValues(this.painter.transform,n.tileID.canonical,p&&p.useDenormalizedUpVectorScale);l.setGlobeUniformValues(y,j)}}globeUniformValues(n,l,p){const y=n.projection;return{u_tile_tl_up:y.upVector(l,0,0),u_tile_tr_up:y.upVector(l,o.al,0),u_tile_br_up:y.upVector(l,o.al,o.al),u_tile_bl_up:y.upVector(l,0,o.al),u_tile_up_scale:p?o.dM(1):y.upVectorScale(l,n.center.lat,n.worldSize).metersToTile}}renderToBackBuffer(n){const l=this.painter,p=this.painter.context;n.length!==0&&(p.bindFramebuffer.set(null),p.viewport.set([0,0,l.width,l.height]),l.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(y,x,b,T,A){if(y.transform.projection.name==="globe")(function(M,D,N,B,j){const H=M.context,G=H.gl;let Q,J;const ae=M.transform,de=o.dE(M,H,ae),ce=(Ge,He)=>{if(J===He)return;const et=[kp[He],"PROJECTION_GLOBE_VIEW"];de&&et.push("CUSTOM_ANTIALIASING");const mt=M.isTileAffectedByFog(Ge);Q=M.getOrCreateProgram("globeRaster",{defines:et,overrideFog:mt}),J=He},Se=M.colorModeForRenderPass(),ye=new Xt(G.LEQUAL,Xt.ReadWrite,M.depthRangeFor3D);Il.update(j);const we=o.dF(ae),_e=[o.aF(ae.center.lng),o.aJ(ae.center.lat)],pe=M.globeSharedBuffers,Te=[ae.width*o.o.devicePixelRatio,ae.height*o.o.devicePixelRatio],De=Float32Array.from(ae.globeMatrix),Me={useDenormalizedUpVectorScale:!0};{const Ge=M.transform,He=Ap(Ge.zoom,D.exaggeration(),D.sourceCache._source.tileSize);J=-1;const et=G.TRIANGLES;for(const mt of B){const Ne=N.getTile(mt),Ce=pr.disabled,Ke=D.prevTerrainTileForTile[mt.key],Ve=D.terrainTileForTile[mt.key];Dh(Ke,Ve)&&Il.newMorphing(mt.key,Ke,Ve,j,250),id(M,Ne.emissiveTexture),H.activeTexture.set(G.TEXTURE0),Ne.texture&&Ne.texture.bind(G.LINEAR,G.CLAMP_TO_EDGE);const ot=Il.getMorphValuesForProxy(mt.key),Tt=ot?1:0;ot&&Object.assign(Me,{morphing:{srcDemTile:ot.from,dstDemTile:ot.to,phase:o.dD(ot.phase)}});const zt=o.dG(mt.canonical),wt=o.dH(zt.getCenter().lat),gt=o.dI(mt.canonical,zt,wt,Ge.worldSize/Ge._pixelsPerMercatorPixel),Kt=o.bk(o.dJ(mt.canonical)),$t=M.emissiveMode==="mrt-fallback"?1:0,Dt=Ep(Ge.expandedFarZProjMatrix,De,we,Kt,o.aj(Ge.zoom),_e,Ge.frustumCorners.TL,Ge.frustumCorners.TR,Ge.frustumCorners.BR,Ge.frustumCorners.BL,Ge.globeCenterInViewSpace,Ge.globeRadius,Te,He,Ge._farZ,$t,gt);if(ce(mt,Tt),Q&&(D.setupElevationDraw(Ne,Q,Me),M.uploadCommonUniforms(H,Q,mt.toUnwrapped()),pe)){const[Bt,nr,xr]=pe.getGridBuffers(wt,He!==0);Q.draw(M,et,ye,Ce,Se,fr.backCCW,Dt,"globe_raster",Bt,nr,xr)}}}if(pe&&(M.renderDefaultNorthPole||M.renderDefaultSouthPole)){const Ge=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];de&&Ge.push("CUSTOM_ANTIALIASING"),Q=M.getOrCreateProgram("globeRaster",{defines:Ge});for(const He of B){const{x:et,y:mt,z:Ne}=He.canonical,Ce=mt===0,Ke=mt===(1<<Ne)-1,[Ve,ot,Tt,zt]=pe.getPoleBuffers(Ne,!1);if(zt&&(Ce||Ke)){const wt=N.getTile(He);id(M,wt.emissiveTexture),H.activeTexture.set(G.TEXTURE0),wt.texture&&wt.texture.bind(G.LINEAR,G.CLAMP_TO_EDGE);let gt=o.dK(Ne,et,ae);const Kt=o.bk(o.dJ(He.canonical)),$t=M.emissiveMode==="mrt-fallback"?1:0,Dt=(Bt,nr)=>Bt.draw(M,G.TRIANGLES,ye,pr.disabled,Se,fr.disabled,Ep(ae.expandedFarZProjMatrix,gt,gt,Kt,0,_e,ae.frustumCorners.TL,ae.frustumCorners.TR,ae.frustumCorners.BR,ae.frustumCorners.BL,ae.globeCenterInViewSpace,ae.globeRadius,Te,0,ae._farZ,$t),"globe_pole_raster",nr,Tt,zt);D.setupElevationDraw(wt,Q,Me),M.uploadCommonUniforms(H,Q,He.toUnwrapped()),Ce&&M.renderDefaultNorthPole&&Dt(Q,Ve),Ke&&M.renderDefaultSouthPole&&(gt=o.cS(o.bC(),gt,[1,-1,1]),Dt(Q,ot))}}}})(y,x,b,T,A);else{const M=y.context,D=M.gl;let N,B;const j=y.shadowRenderer,H=yc(y,y.longestCutoffRange),G=Se=>{if(B===Se)return;const ye=[];ye.push(kp[Se]),H.shouldRenderCutoff&&ye.push("RENDER_CUTOFF"),j&&(ye.push("RENDER_SHADOWS","DEPTH_TEXTURE"),j.useNormalOffset&&ye.push("NORMAL_OFFSET")),N=y.getOrCreateProgram("terrainRaster",{defines:ye}),B=Se},Q=y.colorModeForRenderPass(),J=new Xt(D.LEQUAL,Xt.ReadWrite,y.depthRangeFor3D);Il.update(A);const ae=y.transform,de=Ap(ae.zoom,x.exaggeration(),x.sourceCache._source.tileSize);let ce=[0,0,0];if(j){const Se=y.style.directionalLight,ye=y.style.ambientLight;Se&&ye&&(ce=Cl(y.style,Se,ye))}{B=-1;const Se=D.TRIANGLES,[ye,we]=[x.gridIndexBuffer,x.gridSegments];for(const _e of T){const pe=b.getTile(_e),Te=pr.disabled,De=x.prevTerrainTileForTile[_e.key],Me=x.terrainTileForTile[_e.key];Dh(De,Me)&&Il.newMorphing(_e.key,De,Me,A,250),id(y,pe.emissiveTexture),M.activeTexture.set(D.TEXTURE0),pe.texture&&pe.texture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const Ge=Il.getMorphValuesForProxy(_e.key),He=Ge?1:0;let et;Ge&&(et={morphing:{srcDemTile:Ge.from,dstDemTile:Ge.to,phase:o.dD(Ge.phase)}});const mt=y.emissiveMode==="mrt-fallback"?1:0,Ne=Xo(_e.projMatrix,D_(_e.canonical,ae.renderWorldCopies)?de/10:de,ce,mt);if(G(He),!N)continue;x.setupElevationDraw(pe,N,et);const Ce=_e.toUnwrapped();j&&j.setupShadows(Ce,N),y.uploadCommonUniforms(M,N,Ce,null,H),N.draw(y,Se,J,Te,Q,fr.backCCW,Ne,"terrain_raster",x.gridBuffer,ye,we)}}}}(l,this,this.proxySourceCache,n,this._updateTimestamp),this.renderingToTexture=!0,l.gpuTimingDeferredRenderEnd(),n.splice(0,n.length))}renderBatch(n){if(this._drapedRenderBatches.length===0)return n+1;this.renderingToTexture=!0;const l=this.painter,p=this.painter.context,y=this.proxySourceCache,x=this.proxiedCoords[y.id],b=this._drapedRenderBatches.shift(),T=l.style.order,A=[];this._updateFBOs(l.emissiveMode==="mrt-fallback");let M=0;for(const D of x){const N=y.getTileByID(D.proxyTileKey),B=y.proxyCachedFBO[D.key]?y.proxyCachedFBO[D.key][n]:void 0,j=B!==void 0?y.renderCache[B]:this.pool[M++],H=B!==void 0;if(N.texture=j.tex,N.emissiveTexture=j.emissiveTex,H&&!j.dirty){A.push(N.tileID);continue}p.bindFramebuffer.set(j.fb.framebuffer);const G=p.gl;let Q;G.drawBuffers(l.emissiveMode==="mrt-fallback"?[G.COLOR_ATTACHMENT0,G.COLOR_ATTACHMENT1]:[G.COLOR_ATTACHMENT0]),this.renderedToTile=!1,j.dirty&&(p.clear({color:o.ao.transparent,stencil:0}),j.dirty=!1);for(let J=b.start;J<=b.end;++J){const ae=l.style._mergedLayers[T[J]];if(ae.isHidden(l.transform.zoom))continue;const de=l.style.getLayerSourceCache(ae),ce=de?this.proxyToSource[D.key][de.id]:[D];if(!ce)continue;const Se=ce;p.viewport.set([0,0,j.fb.width,j.fb.height]),Q!==(de?de.id:null)&&(this._setupStencil(j,ce,ae,de),Q=de?de.id:null),l.renderLayer(l,de,ae,Se)}if(G.drawBuffers([G.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const J of this._pendingGroundEffectLayers){const ae=l.style._mergedLayers[T[J]];if(ae.isHidden(l.transform.zoom))continue;const de=l.style.getLayerSourceCache(ae),ce=de?this.proxyToSource[D.key][de.id]:[D];if(!ce)continue;const Se=ce;p.viewport.set([0,0,j.fb.width,j.fb.height]),Q!==(de?de.id:null)&&(this._setupStencil(j,ce,ae,de),Q=de?de.id:null),l.renderLayer(l,de,ae,Se)}this.renderedToTile?(j.dirty=!0,A.push(N.tileID)):H||--M,M===5&&(M=0,this.renderToBackBuffer(A))}return this.renderToBackBuffer(A),this.renderingToTexture=!1,p.bindFramebuffer.set(null),p.viewport.set([0,0,l.width,l.height]),b.end+1}postRender(){}isLayerOrderingCorrect(n){const l=n.order.length;let p=-1,y=l;for(let x=0;x<l;++x)this._style.isLayerDraped(n._mergedLayers[n.order[x]])?p=Math.max(p,x):y=Math.min(y,x);return y>p}getMinElevationBelowMSL(){let n=0;return this._visibleDemTiles.filter(l=>l.dem).forEach(l=>{n=Math.min(n,l.dem.tree.minimums[0])}),n===0?n:(n-30)*this._exaggeration}raycast(n,l,p){if(!this._visibleDemTiles)return null;const y=this._visibleDemTiles.filter(x=>x.dem).map(x=>{const b=x.tileID,T=1<<b.overscaledZ,{x:A,y:M}=b.canonical,D=A/T,N=(A+1)/T,B=M/T,j=(M+1)/T;return{minx:D,miny:B,maxx:N,maxy:j,t:x.dem.tree.raycastRoot(D,B,N,j,n,l,p),tile:x}});y.sort((x,b)=>(x.t!==null?x.t:Number.MAX_VALUE)-(b.t!==null?b.t:Number.MAX_VALUE));for(const x of y){if(x.t==null)return null;const b=x.tile.dem.tree.raycast(x.minx,x.miny,x.maxx,x.maxy,n,l,p);if(b!=null)return b}return null}_createFBO(){const n=this.painter.context,l=n.gl,p=this.drapeBufferSize;n.activeTexture.set(l.TEXTURE0);const y=new o.T(n,{width:p[0],height:p[1],data:null},l.RGBA8);y.bind(l.LINEAR,l.CLAMP_TO_EDGE);const x=n.createFramebuffer(p[0],p[1],1,null);let b;return x.colorAttachment0.set(y.texture),this._emissiveTexture&&(b=new o.T(n,{width:p[0],height:p[1],data:null},l.R8),b.bind(l.LINEAR,l.CLAMP_TO_EDGE),x.createColorAttachment(n,1),x.colorAttachment1.set(b.texture)),x.depthAttachment=new ax(n,x.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=n.createRenderbuffer(n.gl.DEPTH_STENCIL,p[0],p[1]),this._stencilRef=0,x.depthAttachment.set(this._sharedDepthStencil),n.clear({stencil:0})):x.depthAttachment.set(this._sharedDepthStencil),n.extTextureFilterAnisotropic&&l.texParameterf(l.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax),{fb:x,tex:y,emissiveTex:b,dirty:!1}}_updateFBOs(n){if(this._emissiveTexture!==n){for(const l of this.pool)this._updateFBO(l,n);for(const l of this.proxySourceCache.renderCache)this._updateFBO(l,n);this._emissiveTexture=n}}_updateFBO(n,l){const p=n.fb,y=this.painter.context,x=y.gl,b=this.drapeBufferSize;if(l){const T=new o.T(y,{width:b[0],height:b[1],data:null},x.R8);T.bind(x.LINEAR,x.CLAMP_TO_EDGE),n.emissiveTex=T,p.createColorAttachment(y,1),p.colorAttachment1.set(T.texture)}else n.emissiveTex=void 0,p.removeColorAttachment(y,1);n.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const n in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[n].hasTransition())return!0;return this._style.order.some(n=>{const l=this._style._mergedLayers[n],p=l.isHidden(this.painter.transform.zoom);return l.type==="hillshade"||l.type==="custom"?!p&&l.shouldRedrape():!p&&l.hasTransition()})}_clearLineLayersFromRenderCache(){let n=!1;for(const p of this._style.getSources())if(p instanceof Qc){n=!0;break}if(!n)return;const l={};for(let p=0;p<this._style.order.length;++p){const y=this._style._mergedLayers[this._style.order[p]],x=this._style.getLayerSourceCache(y);if(!x||l[x.id]||y.isHidden(this.painter.transform.zoom)||y.type!=="line")continue;const b=y.widthExpression(),T=y.emissiveStrengthExpression();if(b instanceof o.ad||T instanceof o.ad){l[x.id]=!0;for(const A of this.proxyCoords){const M=this.proxyToSource[A.key][x.id];if(M)for(const D of M)this._clearRenderCacheForTile(x.id,D)}}}}_clearRasterLayersFromRenderCache(){let n=!1;for(const p in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[p]._source instanceof ps){n=!0;break}if(!n)return;const l={};for(let p=0;p<this._style.order.length;++p){const y=this._style._mergedLayers[this._style.order[p]],x=this._style.getLayerSourceCache(y);if(!x||l[x.id]||y.isHidden(this.painter.transform.zoom)||y.type!=="raster")continue;const b=y.paint.get("raster-fade-duration");for(const T of this.proxyCoords){const A=this.proxyToSource[T.key][x.id];if(A)for(const M of A){const D=Oh(x.getTile(M),x.findLoadedParent(M,0),x,this.painter.transform,b);(D.opacity!==1||D.mix!==0)&&this._clearRenderCacheForTile(x.id,M)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const n=this._style.order,l=n.length;if(l===0)return;const p=[];this._pendingGroundEffectLayers=[];let y,x=0,b=this._style._mergedLayers[n[x]];for(;!this._style.isLayerDraped(b)&&b.isHidden(this.painter.transform.zoom)&&++x<l;)b=this._style._mergedLayers[n[x]];for(;x<l;++x){const T=this._style._mergedLayers[n[x]];T.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(T)?y===void 0&&(y=x):(T.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(x),y!==void 0&&(p.push({start:y,end:x-1}),y=void 0)))}if(y!==void 0&&p.push({start:y,end:x-1}),p.length!==0){const T=p[p.length-1];this._pendingGroundEffectLayers.every(A=>A>T.end)||o.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=p}_setupRenderCache(n){const l=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,l.renderCache.length>l.renderCachePool.length){const b=Object.values(l.proxyCachedFBO);l.proxyCachedFBO={};for(let T=0;T<b.length;++T){const A=Object.values(b[T]);l.renderCachePool.push(...A)}}return}this._clearRasterLayersFromRenderCache();const p=this.proxyCoords,y=this._tilesDirty;for(let b=p.length-1;b>=0;b--){const T=p[b];if(l.getTileByID(T.key),l.proxyCachedFBO[T.key]!==void 0){const A=n[T.key],M=this.proxyToSource[T.key];let D=0;for(const N in M){const B=M[N],j=A[N];if(!j||j.length!==B.length||B.some((H,G)=>H!==j[G]||y[N]&&y[N].hasOwnProperty(H.key))){D=-1;break}++D}for(const N in l.proxyCachedFBO[T.key])l.renderCache[l.proxyCachedFBO[T.key][N]].dirty=D<0||D!==Object.values(A).length}}const x=[...this._drapedRenderBatches];x.sort((b,T)=>T.end-T.start-(b.end-b.start));for(const b of x)for(const T of p){if(l.proxyCachedFBO[T.key])continue;let A=l.renderCachePool.pop();A===void 0&&l.renderCache.length<50&&(A=l.renderCache.length,l.renderCache.push(this._createFBO())),A!==void 0&&(l.proxyCachedFBO[T.key]={},l.proxyCachedFBO[T.key][b.start]=A,l.renderCache[A].dirty=!0)}this._tilesDirty={}}_setupStencil(n,l,p,y){if(!y||!this._sourceTilesOverlap[y.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const x=this.painter.context,b=x.gl;if(l.length<=1)return void(this._overlapStencilType=!1);let T;if(p.isTileClipped())T=l.length,this._overlapStencilMode.test={func:b.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(l[0].overscaledZ>l[l.length-1].overscaledZ))return void(this._overlapStencilType=!1);T=1,this._overlapStencilMode.test={func:b.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+T>255&&(x.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=T,this._overlapStencilMode.ref=this._stencilRef,p.isTileClipped()&&this._renderTileClippingMasks(l,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(n){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[n.key]),this._overlapStencilMode):pr.disabled}_renderTileClippingMasks(n,l){const p=this.painter,y=this.painter.context,x=y.gl;p._tileClippingMaskIDs={},y.setColorMode(Er.disabled),y.setDepthMode(Xt.disabled);const b=p.getOrCreateProgram("clippingMask");for(const T of n){const A=p._tileClippingMaskIDs[T.key]=--l;b.draw(p,x.TRIANGLES,Xt.disabled,new pr({func:x.ALWAYS,mask:0},A,255,x.KEEP,x.KEEP,x.REPLACE),Er.disabled,fr.disabled,Lh(T.projMatrix),"$clipping",p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}}pointCoordinate(n){const l=this.painter.transform;if(n.x<0||n.x>l.width||n.y<0||n.y>l.height)return null;const p=[n.x,n.y,1,1];o.aC(p,p,l.pixelMatrixInverse),o.cK(p,p,1/p[3]),p[0]/=l.worldSize,p[1]/=l.worldSize;const y=l._camera.position,x=o.cf(1,l.center.lat),b=[y[0],y[1],y[2]/x,0],T=o.da([],p.slice(0,3),b);o.aw(T,T);const A=this.raycast(b,T,this._exaggeration);return A!==null&&A?(o.bH(b,b,T,A),b[3]=b[2],b[2]*=x,b):null}_setupProxiedCoordsForOrtho(n,l,p){if(n.getSource()instanceof o.aU)return this._setupProxiedCoordsForImageSource(n,l,p);this._findCoveringTileCache[n.id]=this._findCoveringTileCache[n.id]||{};const y=this.proxiedCoords[n.id]=[],x=this.proxyCoords;for(let A=0;A<x.length;A++){const M=x[A],D=this._findTileCoveringTileID(M,n);if(D){const N=this._createProxiedId(M,D,p[M.key]&&p[M.key][n.id]);y.push(N),this.proxyToSource[M.key][n.id]=[N]}}let b=!1;const T=new Set;for(let A=0;A<l.length;A++){const M=n.getTile(l[A]);if(!M||!M.hasData())continue;const D=this._findTileCoveringTileID(M.tileID,this.proxySourceCache);if(D&&D.tileID.canonical.z!==M.tileID.canonical.z){const N=this.proxyToSource[D.tileID.key][n.id],B=this._createProxiedId(D.tileID,M,p[D.tileID.key]&&p[D.tileID.key][n.id]);N?N.splice(N.length-1,0,B):this.proxyToSource[D.tileID.key][n.id]=[B];const j=this.proxyToSource[D.tileID.key][n.id];T.has(j)||T.add(j),y.push(B),b=!0}}if(this._sourceTilesOverlap[n.id]=b,b&&this._debugParams.sortTilesHiZFirst)for(const A of T)A.sort((M,D)=>D.overscaledZ-M.overscaledZ)}_setupProxiedCoordsForImageSource(n,l,p){if(!n.getSource().loaded())return;const y=this.proxiedCoords[n.id]=[],x=this.proxyCoords,b=n.getSource(),T=b.tileID;if(!T)return;const A=new o.P(T.x,T.y)._div(1<<T.z),M=b.coordinates.map(o.ae.fromLngLat).reduce((N,B)=>(N.min.x=Math.min(N.min.x,B.x-A.x),N.min.y=Math.min(N.min.y,B.y-A.y),N.max.x=Math.max(N.max.x,B.x-A.x),N.max.y=Math.max(N.max.y,B.y-A.y),N),{min:new o.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),D=(N,B)=>{const j=N.wrap+N.canonical.x/(1<<N.canonical.z),H=N.canonical.y/(1<<N.canonical.z),G=o.al/(1<<N.canonical.z),Q=B.wrap+B.canonical.x/(1<<B.canonical.z),J=B.canonical.y/(1<<B.canonical.z);return j+G<Q+M.min.x||j>Q+M.max.x||H+G<J+M.min.y||H>J+M.max.y};for(let N=0;N<x.length;N++){const B=x[N];for(let j=0;j<l.length;j++){const H=n.getTile(l[j]);if(!H||!H.hasData()||D(B,H.tileID))continue;const G=this._createProxiedId(B,H,p[B.key]&&p[B.key][n.id]),Q=this.proxyToSource[B.key][n.id];Q?Q.push(G):this.proxyToSource[B.key][n.id]=[G],y.push(G)}}}_createProxiedId(n,l,p){let y=this.orthoMatrix;if(p){const x=p.find(b=>b.key===l.tileID.key);if(x)return x}if(l.tileID.key!==n.key){const x=n.canonical.z-l.tileID.canonical.z;let b,T,A;y=o.bC();const M=l.tileID.wrap-n.wrap<<n.overscaledZ;x>0?(b=o.al>>x,T=b*((l.tileID.canonical.x<<x)-n.canonical.x+M),A=b*((l.tileID.canonical.y<<x)-n.canonical.y)):(b=o.al<<-x,T=o.al*(l.tileID.canonical.x-(n.canonical.x+M<<-x)),A=o.al*(l.tileID.canonical.y-(n.canonical.y<<-x))),o.ce(y,0,b,0,b,0,1),o.br(y,y,[T,A,0])}return new O_(l.tileID,n.key,y)}_findTileCoveringTileID(n,l){let p=l.getTile(n);if(p&&p.hasData())return p;const y=this._findCoveringTileCache[l.id],x=y[n.key];if(p=x?l.getTileByID(x):null,p&&p.hasData()||x===null)return p;let b=p?p.tileID:n,T=b.overscaledZ;const A=l.getSource().minzoom,M=[];if(!x){const N=l.getSource().maxzoom;if(n.canonical.z>=N){const B=n.canonical.z-N;l.getSource().reparseOverscaled?(T=Math.max(n.canonical.z+2,l.transform.tileZoom),b=new o.aQ(T,n.wrap,N,n.canonical.x>>B,n.canonical.y>>B)):B!==0&&(T=N,b=new o.aQ(T,n.wrap,N,n.canonical.x>>B,n.canonical.y>>B))}b.key!==n.key&&(M.push(b.key),p=l.getTile(b))}const D=N=>{M.forEach(B=>{y[B]=N}),M.length=0};for(T-=1;T>=A&&(!p||!p.hasData());T--){p&&D(p.tileID.key);const N=b.calculateScaledKey(T);if(p=l.getTileByID(N),p&&p.hasData())break;const B=y[N];if(B===null)break;B===void 0?M.push(N):p=l.getTileByID(B)}return D(p?p.tileID.key:null),p&&p.hasData()?p:null}findDEMTileFor(n){return this.enabled?this._findTileCoveringTileID(n,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(n,l){let p=this._tilesDirty[n];p||(p=this._tilesDirty[n]={}),p[l.key]=!0}}function sd(f,n,l){const p=function(T,A,M){const D=o.bJ(A,T),N=o.bJ(M,[.2126,.7152,.0722]),B=(H,G,Q)=>(1-Q)*H+Q*G,j=B(1-.3*Math.min(N,1),1,Math.min(D+1,1));return B(.92,1,Math.asin(o.aA(A[2],-1,1))/Math.PI+.5)*j}(f,[0,0,1],n),y=[0,0,0];o.c5(y,l.slice(0,3),p);const x=[0,0,0];o.c5(x,n.slice(0,3),f[2]);const b=[0,0,0];return o.d8(b,y,x),o.db(b)}const DS=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],LS=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class lx{static cacheKey(n,l,p,y){const x=[l];y&&x.push(y.cacheKey);for(const b of p)n.usedDefines.has(b)&&x.push(b);return x.join("/")}constructor(n,l,p,y,x,b){const T=n.gl;this.program=T.createProgram(),this.configuration=y,this.name=l,this.fixedDefines=[...b];const A=`#version 300 es
|
||
${(y?y.defines():[]).concat(b.map(G=>`#define ${G}`)).join(`
|
||
`)}`,M=[A,TS];for(const G of p.fragmentIncludes)M.push(bc[G]);M.push(p.fragmentSource);const D=M.join(`
|
||
`),N=[A,J0];for(const G of p.vertexIncludes)N.push(bc[G]);this.forceManualRenderingForInstanceIDShaders=n.forceManualRenderingForInstanceIDShaders&&p.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&N.push("uniform int u_instanceID;"),N.push(p.vertexSource);let B=N.join(`
|
||
`);this.forceManualRenderingForInstanceIDShaders&&(B=B.replaceAll("gl_InstanceID","u_instanceID"));const j=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);T.shaderSource(j,D),T.compileShader(j),T.attachShader(this.program,j);const H=T.createShader(T.VERTEX_SHADER);T.isContextLost()?this.failedToCreate=!0:(T.shaderSource(H,B),T.compileShader(H),T.attachShader(this.program,H),this.attributes={},T.linkProgram(this.program),T.deleteShader(H),T.deleteShader(j),this.fixedUniforms=x(n),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=y?y.getUniforms(n):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(G=>({u_instanceID:new o.ch(G)}))(n)),(b.includes("TERRAIN")||l.includes("symbol")||l.includes("circle"))&&(this.terrainUniforms=(G=>({u_dem:new o.ch(G),u_dem_prev:new o.ch(G),u_dem_tl:new o.ck(G),u_dem_scale:new o.cj(G),u_dem_tl_prev:new o.ck(G),u_dem_scale_prev:new o.cj(G),u_dem_size:new o.cj(G),u_dem_lerp:new o.cj(G),u_exaggeration:new o.cj(G),u_depth:new o.ch(G),u_depth_size_inv:new o.ck(G),u_depth_range_unpack:new o.ck(G),u_occluder_half_size:new o.cj(G),u_occlusion_depth_offset:new o.cj(G),u_meter_to_dem:new o.cj(G),u_label_plane_matrix_inv:new o.cl(G)}))(n)),b.includes("GLOBE")&&(this.globeUniforms=(G=>({u_tile_tl_up:new o.ci(G),u_tile_tr_up:new o.ci(G),u_tile_br_up:new o.ci(G),u_tile_bl_up:new o.ci(G),u_tile_up_scale:new o.cj(G)}))(n)),b.includes("FOG")&&(this.fogUniforms=(G=>({u_fog_matrix:new o.cl(G),u_fog_range:new o.ck(G),u_fog_color:new o.d3(G),u_fog_horizon_blend:new o.cj(G),u_fog_vertical_limit:new o.ck(G),u_fog_temporal_offset:new o.cj(G),u_frustum_tl:new o.ci(G),u_frustum_tr:new o.ci(G),u_frustum_br:new o.ci(G),u_frustum_bl:new o.ci(G),u_globe_pos:new o.ci(G),u_globe_radius:new o.cj(G),u_globe_transition:new o.cj(G),u_is_globe:new o.ch(G),u_viewport:new o.ck(G)}))(n)),b.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(G=>({u_cutoff_params:new o.d3(G)}))(n)),b.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(G=>({u_lighting_ambient_color:new o.ci(G),u_lighting_directional_dir:new o.ci(G),u_lighting_directional_color:new o.ci(G),u_ground_radiance:new o.ci(G)}))(n)),b.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(G=>({u_light_matrix_0:new o.cl(G),u_light_matrix_1:new o.cl(G),u_fade_range:new o.ck(G),u_shadow_normal_offset:new o.ci(G),u_shadow_intensity:new o.cj(G),u_shadow_texel_size:new o.cj(G),u_shadow_map_resolution:new o.cj(G),u_shadow_direction:new o.ci(G),u_shadow_bias:new o.ci(G),u_shadowmap_0:new o.ch(G),u_shadowmap_1:new o.ch(G)}))(n)))}getAttributeLocation(n,l){let p=this.attributes[l];return p===void 0&&(p=this.attributes[l]=n.getAttribLocation(this.program,l)),p}setTerrainUniformValues(n,l){if(!this.terrainUniforms)return;const p=this.terrainUniforms;if(!this.failedToCreate){n.program.set(this.program);for(const y in l)p[y]&&p[y].set(this.program,y,l[y])}}setGlobeUniformValues(n,l){if(!this.globeUniforms)return;const p=this.globeUniforms;if(!this.failedToCreate){n.program.set(this.program);for(const y in l)p[y]&&p[y].set(this.program,y,l[y])}}setFogUniformValues(n,l){if(!this.fogUniforms)return;const p=this.fogUniforms;if(!this.failedToCreate){n.program.set(this.program);for(const y in l)p[y].set(this.program,y,l[y])}}setCutoffUniformValues(n,l){if(!this.cutoffUniforms)return;const p=this.cutoffUniforms;if(!this.failedToCreate){n.program.set(this.program);for(const y in l)p[y].set(this.program,y,l[y])}}setLightsUniformValues(n,l){if(!this.lightsUniforms)return;const p=this.lightsUniforms;if(!this.failedToCreate){n.program.set(this.program);for(const y in l)p[y].set(this.program,y,l[y])}}setShadowUniformValues(n,l){if(this.failedToCreate||!this.shadowUniforms)return;const p=this.shadowUniforms;n.program.set(this.program);for(const y in l)p[y].set(this.program,y,l[y])}_drawDebugWireframe(n,l,p,y,x,b,T,A,M,D){const N=n.options.wireframe;if(N.terrain===!1&&N.layers2D===!1&&N.layers3D===!1)return;const B=n.context;if(!(!(!N.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!N.layers2D||n._terrain&&n._terrain.renderingToTexture||!DS.includes(this.name))||!(!N.layers3D||!LS.includes(this.name))))return;const j=B.gl,H=n.wireframeDebugCache.getLinesFromTrianglesBuffer(n.frameCounter,x,B);if(!H)return;const G=[...this.fixedDefines,"DEBUG_WIREFRAME"],Q=n.getOrCreateProgram(this.name,{config:this.configuration,defines:G});B.program.set(Q.program);const J=(ce,Se,ye)=>{if(Se[ce]&&ye[ce])for(const we in Se[ce])ye[ce][we]&&ye[ce][we].set(ye.program,we,Se[ce][we].current)};M&&M.setUniforms(Q.program,B,Q.binderUniforms,T,{zoom:A}),J("fixedUniforms",this,Q),J("terrainUniforms",this,Q),J("globeUniforms",this,Q),J("fogUniforms",this,Q),J("lightsUniforms",this,Q),J("shadowUniforms",this,Q),H.bind(),B.setColorMode(new Er([j.ONE,j.ONE_MINUS_SRC_ALPHA,j.ZERO,j.ONE],o.ao.transparent,[!0,!0,!0,!1])),B.setDepthMode(new Xt(l.func===j.LESS?j.LEQUAL:l.func,Xt.ReadOnly,l.range)),B.setStencilMode(pr.disabled);const ae=3*b.primitiveLength*2,de=3*b.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const ce=D||1;for(let Se=0;Se<ce;++Se)Q.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Se),j.drawElements(j.LINES,ae,j.UNSIGNED_SHORT,de)}else D&&D>1?j.drawElementsInstanced(j.LINES,ae,j.UNSIGNED_SHORT,de,D):j.drawElements(j.LINES,ae,j.UNSIGNED_SHORT,de);x.bind(),B.program.set(this.program),B.setDepthMode(l),B.setStencilMode(p),B.setColorMode(y)}checkUniforms(n,l,p){if(this.fixedDefines.includes(l)){for(const y of Object.keys(p))if(!p[y].initialized)throw new Error(`Program '${this.name}', from draw '${n}': uniform ${y} not set but required by ${l} being defined`)}}draw(n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q){const J=n.context,ae=J.gl;if(this.failedToCreate)return;J.program.set(this.program),J.setDepthMode(p),J.setStencilMode(y),J.setColorMode(x),J.setCullFace(b);for(const[_e,pe]of this.fixedUniformsEntries)pe.set(this.program,_e,T[_e]);H&&H.setUniforms(this.program,J,this.binderUniforms,B,{zoom:j});const de={[ae.POINTS]:1,[ae.LINES]:2,[ae.TRIANGLES]:3,[ae.LINE_STRIP]:1}[l];this.checkUniforms(A,"RENDER_SHADOWS",this.shadowUniforms);const ce=G||[],Se=H?H.getPaintVertexBuffers():[],ye=l===ae.TRIANGLES&&D,we=Q&&Q>0?1:void 0;for(const _e of N.get()){const pe=_e.vaos||(_e.vaos={});if((pe[A]||(pe[A]=new ES)).bind(J,this,M,Se,D,_e.vertexOffset,ce,we),this.forceManualRenderingForInstanceIDShaders){const Te=Q||1;for(let De=0;De<Te;++De)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",De),D?ae.drawElements(l,_e.primitiveLength*de,ae.UNSIGNED_SHORT,_e.primitiveOffset*de*2):ae.drawArrays(l,_e.vertexOffset,_e.vertexLength)}else Q&&Q>1?ae.drawElementsInstanced(l,_e.primitiveLength*de,ae.UNSIGNED_SHORT,_e.primitiveOffset*de*2,Q):D?ae.drawElements(l,_e.primitiveLength*de,ae.UNSIGNED_SHORT,_e.primitiveOffset*de*2):ae.drawArrays(l,_e.vertexOffset,_e.vertexLength);ye&&this._drawDebugWireframe(n,p,y,x,D,_e,B,j,H,Q)}}}function cx(f,n,l=0){const p=Math.pow(2,n.tileID.overscaledZ),y=n.tileSize*Math.pow(2,f.transform.tileZoom)/p,x=y*(n.tileID.canonical.x+n.tileID.wrap*p),b=y*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/o.ay(n,1,f.transform.tileZoom),u_pixel_coord_upper:[x>>16,b>>16],u_pixel_coord_lower:[65535&x,65535&b],u_pattern_transition:l}}const Ip={terrain:0,flat:1},OS=o.bC(),Pp=(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J)=>{const ae=n.style.light,de=ae.properties.get("position"),ce=[de.x,de.y,de.z],Se=o.dO();ae.properties.get("anchor")==="viewport"&&(o.dP(Se,-n.transform.angle),o.dQ(ce,ce,Se));const ye=ae.properties.get("color").toPremultipliedRenderColor(null),we=n.transform,_e={u_matrix:f,u_lightpos:ce,u_lightintensity:ae.properties.get("intensity"),u_lightcolor:[ye.r,ye.g,ye.b],u_vertical_gradient:+l,u_opacity:p,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:OS,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ip[M],u_base_type:Ip[D],u_ao:y,u_edge_radius:x,u_width_scale:b,u_flood_light_color:H,u_vertical_scale:G,u_flood_light_intensity:Q,u_ground_shadow_factor:J};return we.projection.name==="globe"&&(_e.u_tile_id=[T.canonical.x,T.canonical.y,1<<T.canonical.z],_e.u_zoom_transition=N,_e.u_inv_rot_matrix=j,_e.u_merc_center=B,_e.u_up_dir=we.projection.upVector(new o.cD(0,0,0),B[0]*o.al,B[1]*o.al),_e.u_height_lift=A),_e},F_=(f,n,l,p,y,x)=>({u_matrix:f,u_edge_radius:n,u_width_scale:l,u_vertical_scale:p,u_height_type:Ip[y],u_base_type:Ip[x]}),ux=(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J)=>{const ae=Pp(f,n,l,p,y,x,b,T,M,D,N,B,j,H,G,Q,1,[0,0,0]),de={u_height_factor:-Math.pow(2,T.overscaledZ)/A.tileSize/8};return Object.assign(ae,cx(n,A,J),de)},od=(f,n,l,p,y,x,b,T,A,M,D)=>({u_matrix:n,u_opacity:l,u_ao_pass:p?1:0,u_meter_to_tile:y,u_ao:x,u_flood_light_intensity:b,u_flood_light_color:T,u_attenuation:A,u_edge_radius:M,u_fb:0,u_fb_size:D,u_dynamic_offset:1}),B_=(f,n,l)=>({u_matrix:f,u_emissive_strength:n,u_ground_shadow_factor:l}),N_=(f,n,l,p,y,x=0)=>Object.assign(B_(f,n,y),cx(l,p,x)),dx=(f,n,l,p)=>({u_matrix:f,u_world:l,u_emissive_strength:n,u_ground_shadow_factor:p}),j_=(f,n,l,p,y,x,b=0)=>Object.assign(N_(f,n,l,p,x,b),{u_world:y}),Tc=(f,n)=>({u_matrix:f,u_ground_shadow_factor:n}),cu=(f,n,l,p,y)=>({u_matrix:f,u_camera_pos:[n[0],n[1],n[2]],u_depth_bias:l,u_height_scale:p,u_reset_depth:y}),Mp=(f,n,l,p,y,x,b,T,A)=>({u_matrix:f,u_normal_matrix:n,u_opacity:l,u_faux_facade_ao_intensity:p,u_camera_pos:y,u_tile_to_meter:x,u_facade_emissive_chance:b,u_flood_light_color:T,u_flood_light_intensity:A}),hx=f=>({u_matrix:f}),Ec=f=>({u_matrix:f}),V_=(f,n,l,p,y,x,b,T)=>{const A=o.al/x.tileSize;return{u_matrix:f,u_inv_rot_matrix:n,u_camera_to_center_distance:l.getCameraToCenterDistance(T),u_extrude_scale:[l.pixelsToGLUnits[0]/A,l.pixelsToGLUnits[1]/A],u_zoom_transition:p,u_tile_id:b,u_merc_center:y}},zh=(f,n,l=1)=>({u_matrix:f,u_color:n,u_overlay:0,u_overlay_scale:l}),fx=o.bC(),px=(f,n,l,p,y,x,b)=>{const T=f.transform,A=T.projection.name==="globe",M=A?o.dR(T.zoom,n.canonical)*T._pixelsPerMercatorPixel:o.ay(l,1,x),D={u_matrix:n.projMatrix,u_extrude_scale:M,u_intensity:b,u_inv_rot_matrix:fx,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=p,D.u_merc_center=y,D.u_tile_id=[n.canonical.x,n.canonical.y,1<<n.canonical.z],D.u_zoom_transition=o.aj(T.zoom);const N=y[0]*o.al,B=y[1]*o.al;D.u_up_dir=T.projection.upVector(new o.cD(0,0,0),N,B)}return D};function Rp(f,[n,l,p,y],[x,b]){if(x===b)return[0,0,0,0];const T=255*(f-1)/(f*(b-x));return[n*T,l*T,p*T,y*T]}function Dp(f,n,[l,p]){return l===p?0:.5/f+(n-l)*(f-1)/(f*(p-l))}const mx=(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J,ae,de,ce)=>({u_matrix:f,u_normalize_matrix:n,u_globe_matrix:l,u_merc_matrix:p,u_grid_matrix:y,u_tl_parent:x,u_scale_parent:M,u_fade_t:D.mix,u_opacity:D.opacity*N.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:N.paint.get("raster-brightness-min"),u_brightness_high:N.paint.get("raster-brightness-max"),u_saturation_factor:o.dT(N.paint.get("raster-saturation")),u_contrast_factor:o.dS(N.paint.get("raster-contrast")),u_spin_weights:gx(N.paint.get("raster-hue-rotate")),u_perspective_transform:B,u_raster_elevation:j,u_zoom_transition:b,u_merc_center:T,u_cutoff_params:A,u_colorization_mix:Rp(o.dU,G,J),u_colorization_offset:Dp(o.dU,Q,J),u_color_ramp:H,u_texture_offset:[de/(ae+2*de),ae/(ae+2*de)],u_texture_res:[ae+2*de,ae+2*de],u_emissive_strength:ce});function gx(f){f*=Math.PI/180;const n=Math.sin(f),l=Math.cos(f);return[(2*l+1)/3,(-Math.sqrt(3)*n-l+1)/3,(Math.sqrt(3)*n-l+1)/3]}const al=.05,zS=(f,n,l,p,y,x,b,T,A,M,D,N)=>({u_matrix:f,u_normalize_matrix:n,u_globe_matrix:l,u_merc_matrix:p,u_grid_matrix:y,u_tl_parent:x,u_scale_parent:M,u_fade_t:D.mix,u_opacity:D.opacity,u_image0:0,u_image1:1,u_raster_elevation:N,u_zoom_transition:b,u_merc_center:T,u_cutoff_params:A}),FS=(f,n,l,p,y,x,b,T,A,M)=>({u_particle_texture:f,u_particle_texture_side_len:n,u_tile_offset:l,u_velocity:p,u_color_ramp:x,u_velocity_res:y,u_max_speed:b,u_uv_offset:T,u_data_scale:[255*A[0],255*A[1]],u_data_offset:M,u_particle_pos_scale:1.1,u_particle_pos_offset:[al,al]}),_x=(f,n,l,p,y,x,b,T,A,M)=>({u_particle_texture:f,u_particle_texture_side_len:n,u_velocity:l,u_velocity_res:p,u_max_speed:y,u_speed_factor:x,u_reset_rate:b,u_rand_seed:Math.random(),u_uv_offset:T,u_data_scale:[255*A[0],255*A[1]],u_data_offset:M,u_particle_pos_scale:1.1,u_particle_pos_offset:[al,al]}),yx=o.bC(),Lp=(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J,ae,de,ce,Se,ye,we)=>{const _e=y.transform,pe={u_is_size_zoom_constant:+(f==="constant"||f==="source"),u_is_size_feature_constant:+(f==="constant"||f==="camera"),u_size_t:n?n.uSizeT:0,u_size:n?n.uSize:0,u_camera_to_center_distance:_e.getCameraToCenterDistance(ae),u_rotate_symbol:+l,u_aspect_ratio:_e.width/_e.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_matrix:x,u_label_plane_matrix:b,u_coord_matrix:T,u_is_text:+M,u_elevation_from_sea:A?1:0,u_pitch_with_map:+p,u_texsize:D,u_texsize_icon:N,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:yx,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:yx,u_up_vector:[0,-1,0],u_color_adj_mat:Se,u_icon_transition:ye||0,u_gamma_scale:p?y.transform.getCameraToCenterDistance(ae)*Math.cos(y.terrain?0:y.transform._pitch):1,u_device_pixel_ratio:o.o.devicePixelRatio,u_is_halo:1,u_scale_factor:we||1,u_ground_shadow_factor:de,u_inv_matrix:o.bl(o.bC(),b),u_normal_scale:ce,u_lutTexture:ms.LUT};return ae.name==="globe"&&(pe.u_tile_id=[j.canonical.x,j.canonical.y,1<<j.canonical.z],pe.u_zoom_transition=H,pe.u_inv_rot_matrix=Q,pe.u_merc_center=G,pe.u_camera_forward=_e._camera.forward(),pe.u_ecef_origin=o.dV(_e.globeMatrix,j.toUnwrapped()),pe.u_tile_matrix=Float32Array.from(_e.globeMatrix),pe.u_up_vector=J),pe},Fh=(f,n,l,p)=>({u_matrix:f,u_emissive_strength:n,u_opacity:l,u_color:p}),kc=(f,n,l,p,y,x,b,T,A)=>Object.assign(function(M,D,N,B,j,H){const{width:G,height:Q}=B.imageManager.getPixelSize(D),J=Math.pow(2,H.tileID.overscaledZ),ae=H.tileSize*Math.pow(2,B.transform.tileZoom)/J,de=ae*(H.tileID.canonical.x+H.tileID.wrap*J),ce=ae*H.tileID.canonical.y;return{u_image:0,u_pattern_tl:N.tl,u_pattern_br:N.br,u_texsize:[G,Q],u_pattern_size:N.displaySize,u_pattern_units_to_pixels:j?[B.transform.width,-1*B.transform.height]:[1/o.ay(H,1,B.transform.tileZoom),1/o.ay(H,1,B.transform.tileZoom)],u_pixel_coord_upper:[de>>16,ce>>16],u_pixel_coord_lower:[65535&de,65535&ce]}}(0,x,b,p,T,A),{u_matrix:f,u_emissive_strength:n,u_opacity:l}),ad=new Float32Array(o.bA([])),uu=(f,n,l,p,y,x,b,T,A,M,D,N,B,j=[0,0,0],H,G,Q)=>{const J=y.style.light,ae=J.properties.get("position"),de=[-ae.x,-ae.y,ae.z],ce=o.dO();J.properties.get("anchor")==="viewport"&&(o.dP(ce,-y.transform.angle),o.dQ(de,de,ce));const Se=D.alphaMode==="MASK",ye=J.properties.get("color").toNonPremultipliedRenderColor(null),we=B.paint.get("model-ambient-occlusion-intensity"),_e=B.paint.get("model-color").constantOr(o.ao.white).toNonPremultipliedRenderColor(null);return _e.a=B.paint.get("model-color-mix-intensity").constantOr(0),Q&&(_e.r=Q[0],_e.g=Q[1],_e.b=Q[2],_e.a=Q[3]),G&&(_e.r=G.color.r,_e.g=G.color.g,_e.b=G.color.b,_e.a=G.colorMix,N=G.emissionStrength,x*=G.opacity),{u_matrix:f,u_lighting_matrix:n,u_normal_matrix:l,u_node_matrix:p||ad,u_lightpos:de,u_lightintensity:J.properties.get("intensity"),u_lightcolor:[ye.r,ye.g,ye.b],u_camera_pos:j,u_opacity:x,u_baseTextureIsAlpha:0,u_alphaMask:+Se,u_alphaCutoff:D.alphaCutoff,u_baseColorFactor:b.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:T.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:A,u_roughnessFactor:M,u_baseColorTexture:ms.BaseColor,u_metallicRoughnessTexture:ms.MetallicRoughness,u_normalTexture:ms.Normal,u_occlusionTexture:ms.Occlusion,u_emissionTexture:ms.Emission,u_lutTexture:ms.LUT,u_color_mix:_e.toArray01(),u_aoIntensity:we,u_emissive_strength:N,u_occlusionTextureTransform:H||[0,0,0,0]}},U_=(f,n=ad,l=ad)=>({u_matrix:f,u_instance:n,u_node_matrix:l}),Op={fillExtrusion:f=>({u_matrix:new o.cl(f),u_lightpos:new o.ci(f),u_lightintensity:new o.cj(f),u_lightcolor:new o.ci(f),u_vertical_gradient:new o.cj(f),u_opacity:new o.cj(f),u_edge_radius:new o.cj(f),u_width_scale:new o.cj(f),u_ao:new o.ck(f),u_height_type:new o.ch(f),u_base_type:new o.ch(f),u_tile_id:new o.ci(f),u_zoom_transition:new o.cj(f),u_inv_rot_matrix:new o.cl(f),u_merc_center:new o.ck(f),u_up_dir:new o.ci(f),u_height_lift:new o.cj(f),u_flood_light_color:new o.ci(f),u_vertical_scale:new o.cj(f),u_flood_light_intensity:new o.cj(f),u_ground_shadow_factor:new o.ci(f)}),fillExtrusionDepth:f=>({u_matrix:new o.cl(f),u_edge_radius:new o.cj(f),u_width_scale:new o.cj(f),u_vertical_scale:new o.cj(f),u_height_type:new o.ch(f),u_base_type:new o.ch(f)}),fillExtrusionPattern:f=>({u_matrix:new o.cl(f),u_lightpos:new o.ci(f),u_lightintensity:new o.cj(f),u_lightcolor:new o.ci(f),u_vertical_gradient:new o.cj(f),u_height_factor:new o.cj(f),u_edge_radius:new o.cj(f),u_width_scale:new o.cj(f),u_ao:new o.ck(f),u_height_type:new o.ch(f),u_base_type:new o.ch(f),u_tile_id:new o.ci(f),u_zoom_transition:new o.cj(f),u_inv_rot_matrix:new o.cl(f),u_merc_center:new o.ck(f),u_up_dir:new o.ci(f),u_height_lift:new o.cj(f),u_image:new o.ch(f),u_texsize:new o.ck(f),u_pixel_coord_upper:new o.ck(f),u_pixel_coord_lower:new o.ck(f),u_tile_units_to_pixels:new o.cj(f),u_opacity:new o.cj(f),u_pattern_transition:new o.cj(f)}),fillExtrusionGroundEffect:f=>({u_matrix:new o.cl(f),u_opacity:new o.cj(f),u_ao_pass:new o.cj(f),u_meter_to_tile:new o.cj(f),u_ao:new o.ck(f),u_flood_light_intensity:new o.cj(f),u_flood_light_color:new o.ci(f),u_attenuation:new o.cj(f),u_edge_radius:new o.cj(f),u_fb:new o.ch(f),u_fb_size:new o.cj(f),u_dynamic_offset:new o.cj(f)}),fill:f=>({u_matrix:new o.cl(f),u_emissive_strength:new o.cj(f),u_ground_shadow_factor:new o.ci(f)}),fillPattern:f=>({u_matrix:new o.cl(f),u_emissive_strength:new o.cj(f),u_image:new o.ch(f),u_texsize:new o.ck(f),u_pixel_coord_upper:new o.ck(f),u_pixel_coord_lower:new o.ck(f),u_tile_units_to_pixels:new o.cj(f),u_ground_shadow_factor:new o.ci(f),u_pattern_transition:new o.cj(f)}),fillOutline:f=>({u_matrix:new o.cl(f),u_emissive_strength:new o.cj(f),u_world:new o.ck(f),u_ground_shadow_factor:new o.ci(f)}),fillOutlinePattern:f=>({u_matrix:new o.cl(f),u_emissive_strength:new o.cj(f),u_world:new o.ck(f),u_image:new o.ch(f),u_texsize:new o.ck(f),u_pixel_coord_upper:new o.ck(f),u_pixel_coord_lower:new o.ck(f),u_tile_units_to_pixels:new o.cj(f),u_ground_shadow_factor:new o.ci(f),u_pattern_transition:new o.cj(f)}),building:f=>({u_matrix:new o.cl(f),u_normal_matrix:new o.cl(f),u_opacity:new o.cj(f),u_faux_facade_ao_intensity:new o.cj(f),u_camera_pos:new o.ci(f),u_tile_to_meter:new o.cj(f),u_facade_emissive_chance:new o.cj(f),u_flood_light_color:new o.ci(f),u_flood_light_intensity:new o.cj(f)}),buildingBloom:f=>({u_matrix:new o.cl(f)}),buildingDepth:f=>({u_matrix:new o.cl(f)}),elevatedStructuresDepth:f=>({u_matrix:new o.cl(f),u_depth_bias:new o.cj(f)}),elevatedStructures:f=>({u_matrix:new o.cl(f),u_ground_shadow_factor:new o.ci(f)}),elevatedStructuresDepthReconstruct:f=>({u_matrix:new o.cl(f),u_camera_pos:new o.ci(f),u_depth_bias:new o.cj(f),u_height_scale:new o.cj(f),u_reset_depth:new o.cj(f)}),circle:o.dY,collisionBox:f=>({u_matrix:new o.cl(f),u_inv_rot_matrix:new o.cl(f),u_camera_to_center_distance:new o.cj(f),u_extrude_scale:new o.ck(f),u_zoom_transition:new o.cj(f),u_merc_center:new o.ck(f),u_tile_id:new o.ci(f)}),collisionCircle:f=>({u_matrix:new o.cl(f),u_inv_matrix:new o.cl(f),u_camera_to_center_distance:new o.cj(f),u_viewport_size:new o.ck(f)}),debug:f=>({u_color:new o.dB(f),u_matrix:new o.cl(f),u_overlay:new o.ch(f),u_overlay_scale:new o.cj(f)}),clippingMask:f=>({u_matrix:new o.cl(f)}),heatmap:f=>({u_extrude_scale:new o.cj(f),u_intensity:new o.cj(f),u_matrix:new o.cl(f),u_inv_rot_matrix:new o.cl(f),u_merc_center:new o.ck(f),u_tile_id:new o.ci(f),u_zoom_transition:new o.cj(f),u_up_dir:new o.ci(f)}),heatmapTexture:f=>({u_image:new o.ch(f),u_color_ramp:new o.ch(f),u_opacity:new o.cj(f)}),hillshade:f=>({u_matrix:new o.cl(f),u_image:new o.ch(f),u_latrange:new o.ck(f),u_light:new o.ck(f),u_shadow:new o.dB(f),u_highlight:new o.dB(f),u_emissive_strength:new o.cj(f),u_accent:new o.dB(f)}),hillshadePrepare:f=>({u_matrix:new o.cl(f),u_image:new o.ch(f),u_dimension:new o.ck(f),u_zoom:new o.cj(f)}),line:o.dX,linePattern:o.dW,raster:f=>({u_matrix:new o.cl(f),u_normalize_matrix:new o.cl(f),u_globe_matrix:new o.cl(f),u_merc_matrix:new o.cl(f),u_grid_matrix:new o.dC(f),u_tl_parent:new o.ck(f),u_scale_parent:new o.cj(f),u_fade_t:new o.cj(f),u_opacity:new o.cj(f),u_image0:new o.ch(f),u_image1:new o.ch(f),u_brightness_low:new o.cj(f),u_brightness_high:new o.cj(f),u_saturation_factor:new o.cj(f),u_contrast_factor:new o.cj(f),u_spin_weights:new o.ci(f),u_perspective_transform:new o.ck(f),u_raster_elevation:new o.cj(f),u_zoom_transition:new o.cj(f),u_merc_center:new o.ck(f),u_cutoff_params:new o.d3(f),u_colorization_mix:new o.d3(f),u_colorization_offset:new o.cj(f),u_color_ramp:new o.ch(f),u_texture_offset:new o.ck(f),u_texture_res:new o.ck(f),u_emissive_strength:new o.cj(f)}),rasterParticle:f=>({u_matrix:new o.cl(f),u_normalize_matrix:new o.cl(f),u_globe_matrix:new o.cl(f),u_merc_matrix:new o.cl(f),u_grid_matrix:new o.dC(f),u_tl_parent:new o.ck(f),u_scale_parent:new o.cj(f),u_fade_t:new o.cj(f),u_opacity:new o.cj(f),u_image0:new o.ch(f),u_image1:new o.ch(f),u_raster_elevation:new o.cj(f),u_zoom_transition:new o.cj(f),u_merc_center:new o.ck(f),u_cutoff_params:new o.d3(f)}),rasterParticleTexture:f=>({u_texture:new o.ch(f),u_opacity:new o.cj(f)}),rasterParticleDraw:f=>({u_particle_texture:new o.ch(f),u_particle_texture_side_len:new o.cj(f),u_tile_offset:new o.ck(f),u_velocity:new o.ch(f),u_color_ramp:new o.ch(f),u_velocity_res:new o.ck(f),u_max_speed:new o.cj(f),u_uv_offset:new o.ck(f),u_data_scale:new o.ck(f),u_data_offset:new o.cj(f),u_particle_pos_scale:new o.cj(f),u_particle_pos_offset:new o.ck(f)}),rasterParticleUpdate:f=>({u_particle_texture:new o.ch(f),u_particle_texture_side_len:new o.cj(f),u_velocity:new o.ch(f),u_velocity_res:new o.ck(f),u_max_speed:new o.cj(f),u_speed_factor:new o.cj(f),u_reset_rate:new o.cj(f),u_rand_seed:new o.cj(f),u_uv_offset:new o.ck(f),u_data_scale:new o.ck(f),u_data_offset:new o.cj(f),u_particle_pos_scale:new o.cj(f),u_particle_pos_offset:new o.ck(f)}),symbol:f=>({u_is_size_zoom_constant:new o.ch(f),u_is_size_feature_constant:new o.ch(f),u_size_t:new o.cj(f),u_size:new o.cj(f),u_camera_to_center_distance:new o.cj(f),u_rotate_symbol:new o.ch(f),u_aspect_ratio:new o.cj(f),u_fade_change:new o.cj(f),u_matrix:new o.cl(f),u_label_plane_matrix:new o.cl(f),u_coord_matrix:new o.cl(f),u_is_text:new o.ch(f),u_elevation_from_sea:new o.ch(f),u_pitch_with_map:new o.ch(f),u_texsize:new o.ck(f),u_texsize_icon:new o.ck(f),u_texture:new o.ch(f),u_texture_icon:new o.ch(f),u_gamma_scale:new o.cj(f),u_device_pixel_ratio:new o.cj(f),u_tile_id:new o.ci(f),u_zoom_transition:new o.cj(f),u_inv_rot_matrix:new o.cl(f),u_merc_center:new o.ck(f),u_camera_forward:new o.ci(f),u_tile_matrix:new o.cl(f),u_up_vector:new o.ci(f),u_ecef_origin:new o.ci(f),u_is_halo:new o.ch(f),u_icon_transition:new o.cj(f),u_color_adj_mat:new o.cl(f),u_scale_factor:new o.cj(f),u_ground_shadow_factor:new o.ci(f),u_inv_matrix:new o.cl(f),u_normal_scale:new o.cj(f),u_lutTexture:new o.ch(f)}),background:f=>({u_matrix:new o.cl(f),u_emissive_strength:new o.cj(f),u_opacity:new o.cj(f),u_color:new o.dB(f)}),backgroundPattern:f=>({u_matrix:new o.cl(f),u_emissive_strength:new o.cj(f),u_opacity:new o.cj(f),u_image:new o.ch(f),u_pattern_tl:new o.ck(f),u_pattern_br:new o.ck(f),u_texsize:new o.ck(f),u_pattern_size:new o.ck(f),u_pixel_coord_upper:new o.ck(f),u_pixel_coord_lower:new o.ck(f),u_pattern_units_to_pixels:new o.ck(f)}),terrainRaster:f=>({u_matrix:new o.cl(f),u_image0:new o.ch(f),u_image1:new o.ch(f),u_skirt_height:new o.cj(f),u_ground_shadow_factor:new o.ci(f),u_emissive_texture_available:new o.cj(f)}),skybox:f=>({u_matrix:new o.cl(f),u_sun_direction:new o.ci(f),u_cubemap:new o.ch(f),u_opacity:new o.cj(f),u_temporal_offset:new o.cj(f)}),skyboxGradient:f=>({u_matrix:new o.cl(f),u_color_ramp:new o.ch(f),u_center_direction:new o.ci(f),u_radius:new o.cj(f),u_opacity:new o.cj(f),u_temporal_offset:new o.cj(f)}),skyboxCapture:f=>({u_matrix_3f:new o.dC(f),u_sun_direction:new o.ci(f),u_sun_intensity:new o.cj(f),u_color_tint_r:new o.d3(f),u_color_tint_m:new o.d3(f),u_luminance:new o.cj(f)}),globeRaster:f=>({u_proj_matrix:new o.cl(f),u_globe_matrix:new o.cl(f),u_normalize_matrix:new o.cl(f),u_merc_matrix:new o.cl(f),u_zoom_transition:new o.cj(f),u_merc_center:new o.ck(f),u_image0:new o.ch(f),u_image1:new o.ch(f),u_grid_matrix:new o.dC(f),u_skirt_height:new o.cj(f),u_far_z_cutoff:new o.cj(f),u_frustum_tl:new o.ci(f),u_frustum_tr:new o.ci(f),u_frustum_br:new o.ci(f),u_frustum_bl:new o.ci(f),u_globe_pos:new o.ci(f),u_globe_radius:new o.cj(f),u_viewport:new o.ck(f),u_emissive_texture_available:new o.cj(f)}),globeAtmosphere:f=>({u_frustum_tl:new o.ci(f),u_frustum_tr:new o.ci(f),u_frustum_br:new o.ci(f),u_frustum_bl:new o.ci(f),u_horizon:new o.cj(f),u_transition:new o.cj(f),u_fadeout_range:new o.cj(f),u_atmosphere_fog_color:new o.d3(f),u_high_color:new o.d3(f),u_space_color:new o.d3(f),u_temporal_offset:new o.cj(f),u_horizon_angle:new o.cj(f)}),model:f=>({u_matrix:new o.cl(f),u_lighting_matrix:new o.cl(f),u_normal_matrix:new o.cl(f),u_node_matrix:new o.cl(f),u_lightpos:new o.ci(f),u_lightintensity:new o.cj(f),u_lightcolor:new o.ci(f),u_camera_pos:new o.ci(f),u_opacity:new o.cj(f),u_baseColorFactor:new o.d3(f),u_emissiveFactor:new o.d3(f),u_metallicFactor:new o.cj(f),u_roughnessFactor:new o.cj(f),u_baseTextureIsAlpha:new o.ch(f),u_alphaMask:new o.ch(f),u_alphaCutoff:new o.cj(f),u_baseColorTexture:new o.ch(f),u_metallicRoughnessTexture:new o.ch(f),u_normalTexture:new o.ch(f),u_occlusionTexture:new o.ch(f),u_emissionTexture:new o.ch(f),u_lutTexture:new o.ch(f),u_color_mix:new o.d3(f),u_aoIntensity:new o.cj(f),u_emissive_strength:new o.cj(f),u_occlusionTextureTransform:new o.d3(f)}),modelDepth:f=>({u_matrix:new o.cl(f),u_instance:new o.cl(f),u_node_matrix:new o.cl(f)}),groundShadow:f=>({u_matrix:new o.cl(f),u_ground_shadow_factor:new o.ci(f)}),stars:f=>({u_matrix:new o.cl(f),u_up:new o.ci(f),u_right:new o.ci(f),u_intensity_multiplier:new o.cj(f)}),snowParticle:f=>({u_modelview:new o.cl(f),u_projection:new o.cl(f),u_time:new o.cj(f),u_cam_pos:new o.ci(f),u_velocityConeAperture:new o.cj(f),u_velocity:new o.cj(f),u_horizontalOscillationRadius:new o.cj(f),u_horizontalOscillationRate:new o.cj(f),u_boxSize:new o.cj(f),u_billboardSize:new o.cj(f),u_simpleShapeParameters:new o.ck(f),u_screenSize:new o.ck(f),u_thinningCenterPos:new o.ck(f),u_thinningShape:new o.ci(f),u_thinningAffectedRatio:new o.cj(f),u_thinningParticleOffset:new o.cj(f),u_particleColor:new o.d3(f),u_direction:new o.ci(f)}),rainParticle:f=>({u_modelview:new o.cl(f),u_projection:new o.cl(f),u_time:new o.cj(f),u_cam_pos:new o.ci(f),u_texScreen:new o.ch(f),u_velocityConeAperture:new o.cj(f),u_velocity:new o.cj(f),u_boxSize:new o.cj(f),u_rainDropletSize:new o.ck(f),u_distortionStrength:new o.cj(f),u_rainDirection:new o.ci(f),u_color:new o.d3(f),u_screenSize:new o.ck(f),u_thinningCenterPos:new o.ck(f),u_thinningShape:new o.ci(f),u_thinningAffectedRatio:new o.cj(f),u_thinningParticleOffset:new o.cj(f),u_shapeDirectionalPower:new o.cj(f),u_shapeNormalPower:new o.cj(f),u_mode:new o.cj(f)}),vignette:f=>({u_vignetteShape:new o.ci(f),u_vignetteColor:new o.d3(f)}),occlusion:f=>({u_matrix:new o.cl(f),u_anchorPos:new o.ci(f),u_screenSizePx:new o.ck(f),u_occluderSizePx:new o.ck(f),u_color:new o.d3(f)})};class Oa{constructor(n,l,p,y){this.id=Oa.uniqueIdxCounter,Oa.uniqueIdxCounter++,this.context=n;const x=n.gl;this.buffer=x.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),n.bindElementBuffer.set(this.buffer),x.bufferData(x.ELEMENT_ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||y||l.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(n){this.id=Oa.uniqueIdxCounter,Oa.uniqueIdxCounter++;const l=this.context.gl;this.context.unbindVAO(),this.bind(),l.bufferSubData(l.ELEMENT_ARRAY_BUFFER,0,n.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Oa.uniqueIdxCounter=0;const $_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class vx{constructor(n,l,p,y,x,b){this.length=l.length,this.attributes=p,this.itemSize=l.bytesPerElement,this.dynamicDraw=y,this.instanceCount=b,this.context=n;const T=n.gl;this.buffer=T.createBuffer(),n.bindVertexBuffer.set(this.buffer),T.bufferData(T.ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?T.DYNAMIC_DRAW:T.STATIC_DRAW),this.dynamicDraw||x||l.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(n){const l=this.context.gl;this.bind(),l.bufferSubData(l.ARRAY_BUFFER,0,n.arrayBuffer)}enableAttributes(n,l){for(let p=0;p<this.attributes.length;p++){const y=l.getAttributeLocation(n,this.attributes[p].name);y!==-1&&n.enableVertexAttribArray(y)}}setVertexAttribPointers(n,l,p){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],b=l.getAttributeLocation(n,x.name);b!==-1&&n.vertexAttribPointer(b,x.components,n[$_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(p||0))}}setVertexAttribDivisor(n,l,p){for(let y=0;y<this.attributes.length;y++){const x=l.getAttributeLocation(n,this.attributes[y].name);x!==-1&&this.instanceCount&&this.instanceCount>0&&n.vertexAttribDivisor(x,p)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class xx{constructor(n,l,p,y,x){this.context=n,this.width=l,this.height=p;const b=this.framebuffer=n.gl.createFramebuffer();y>0&&(this.colorAttachment0=new Tp(n,b,0)),y>1&&(this.colorAttachment1=new Tp(n,b,1)),x&&(this.depthAttachmentType=x,this.depthAttachment=x==="renderbuffer"?new nd(n,b):new Rh(n,b))}createColorAttachment(n,l){l===0?this.colorAttachment0=new Tp(n,this.framebuffer,0):l===1&&(this.colorAttachment1=new Tp(n,this.framebuffer,1))}removeColorAttachment(n,l){const p=this.context.gl;let y;l===0?(y=this.colorAttachment0.get(),this.colorAttachment0=void 0):l===1&&(y=this.colorAttachment1.get(),this.colorAttachment1=void 0),y&&p.deleteTexture(y)}destroy(){const n=this.context.gl;if(this.colorAttachment0){const l=this.colorAttachment0.get();l&&n.deleteTexture(l)}if(this.colorAttachment1){const l=this.colorAttachment1.get();l&&n.deleteTexture(l)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const l=this.depthAttachment.get();l&&n.deleteRenderbuffer(l)}else{const l=this.depthAttachment.get();l&&n.deleteTexture(l)}n.deleteFramebuffer(this.framebuffer)}}class ld{constructor(n,l){this.gl=n,this.clearColor=new IS(this),this.clearDepth=new Q0(this),this.clearStencil=new E_(this),this.colorMask=new vp(this),this.depthMask=new k_(this),this.stencilMask=new lu(this),this.stencilFunc=new Qu(this),this.stencilOp=new Ph(this),this.stencilTest=new ed(this),this.depthRange=new ex(this),this.depthTest=new A_(this),this.depthFunc=new tx(this),this.blend=new td(this),this.blendFunc=new xp(this),this.blendColor=new wp(this),this.blendEquation=new C_(this),this.cullFace=new bp(this),this.cullFaceSide=new Mh(this),this.frontFace=new rx(this),this.program=new nx(this),this.activeTexture=new ix(this),this.viewport=new rd(this),this.bindFramebuffer=new sx(this),this.bindRenderbuffer=new PS(this),this.bindTexture=new MS(this),this.bindVertexBuffer=new RS(this),this.bindElementBuffer=new I_(this),this.bindVertexArrayOES=new P_(this),this.pixelStoreUnpack=new M_(this),this.pixelStoreUnpackPremultiplyAlpha=new R_(this),this.pixelStoreUnpackFlipY=new ox(this),this.options=l?Object.assign({},l):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=n.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=n.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=n.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=n.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=l&&!!l.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=n.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=n.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=n.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=n.getParameter(n.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=n.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(n,l,p){return new Oa(this,n,l,p)}createVertexBuffer(n,l,p,y,x){return new vx(this,n,l,p,y,x)}createRenderbuffer(n,l,p){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,n,l,p),this.bindRenderbuffer.set(null),x}createFramebuffer(n,l,p,y){return new xx(this,n,l,p,y)}clear({color:n,depth:l,stencil:p,colorMask:y}){const x=this.gl;let b=0;n&&(b|=x.COLOR_BUFFER_BIT,this.clearColor.set(n.toNonPremultipliedRenderColor(null)),this.colorMask.set(y||[!0,!0,!0,!0])),l!==void 0&&(b|=x.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(l),this.depthMask.set(!0)),p!==void 0&&(b|=x.STENCIL_BUFFER_BIT,this.clearStencil.set(p),this.stencilMask.set(255)),x.clear(b)}setCullFace(n){n.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(n.mode),this.frontFace.set(n.frontFace))}setDepthMode(n){n.func!==this.gl.ALWAYS||n.mask?(this.depthTest.set(!0),this.depthFunc.set(n.func),this.depthMask.set(n.mask),this.depthRange.set(n.range)):this.depthTest.set(!1)}setStencilMode(n){n.test.func!==this.gl.ALWAYS||n.mask?(this.stencilTest.set(!0),this.stencilMask.set(n.mask),this.stencilOp.set([n.fail,n.depthFail,n.pass]),this.stencilFunc.set({func:n.test.func,ref:n.ref,mask:n.test.mask})):this.stencilTest.set(!1)}setColorMode(n){o.by(n.blendFunction,Er.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(n.blendFunction),this.blendColor.set(n.blendColor),n.blendEquation?this.blendEquation.set(n.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(n.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let du;function Ut(f,n,l,p,y,x,b){const T=f.context,A=T.gl,M=f.transform,D=[o.aF(M.center.lng),o.aJ(M.center.lat)],N=l.layout.get("symbol-placement"),B=l.layout.get("text-variable-anchor"),j=l.layout.get("icon-rotation-alignment")==="map",H=l.layout.get("text-rotation-alignment")==="map",G=N!=="point",Q=[];let J=0,ae=0;for(let pe=0;pe<p.length;pe++){const Te=p[pe],De=n.getTile(Te),Me=De.getBucket(l);if(!Me)continue;const Ge=Me.getProjection().createInversionMatrix(M,Te.canonical),He=[],et=rp(Te,Me,M),mt=!b&&j&&G,Ne=b&&H&&G,Ce=B&&Me.hasTextData(),Ke=Me.hasIconTextFit()&&Ce&&Me.hasIconData(),Ve=mt||Ne||b&&Ce||Ke,ot=Me.projection.name==="globe",Tt=ot?o.aj(M.zoom):0;ot&&(He.push("PROJECTION_GLOBE_VIEW"),Ve&&He.push("PROJECTED_POS_ON_VIEWPORT"));const zt=f.getOrCreateProgram("collisionBox",{defines:He});let wt=et;y[0]===0&&y[1]===0||(wt=f.translatePosMatrix(et,De,y,x));const gt=b?Me.textCollisionBox:Me.iconCollisionBox,Kt=Me.collisionCircleArray;if(Kt.length>0){const Dt=o.bC(),Bt=wt;o.cP(Dt,Me.placementInvProjMatrix,M.glCoordMatrix),o.cP(Dt,Dt,Me.placementViewportMatrix),Q.push({circleArray:Kt,circleOffset:ae,transform:Bt,invTransform:Dt,projection:Me.getProjection()}),J+=Kt.length/4,ae=J}if(!gt)continue;f.terrain&&f.terrain.setupElevationDraw(De,zt);const $t=ot?[Te.canonical.x,Te.canonical.y,1<<Te.canonical.z]:[0,0,0];zt.draw(f,A.LINES,Xt.disabled,pr.disabled,f.colorModeForRenderPass(),fr.disabled,V_(wt,Ge,M,Tt,D,De,$t,Me.getProjection()),l.id,gt.layoutVertexBuffer,gt.indexBuffer,gt.segments,null,M.zoom,null,[gt.collisionVertexBuffer,gt.collisionVertexBufferExt])}if(!b||!Q.length)return;const de=f.getOrCreateProgram("collisionCircle"),ce=new o.dZ;ce.resize(4*J),ce._trim();let Se=0;for(const pe of Q)for(let Te=0;Te<pe.circleArray.length/4;Te++){const De=4*Te,Me=pe.circleArray[De+0],Ge=pe.circleArray[De+1],He=pe.circleArray[De+2],et=pe.circleArray[De+3];ce.emplace(Se++,Me,Ge,He,et,0),ce.emplace(Se++,Me,Ge,He,et,1),ce.emplace(Se++,Me,Ge,He,et,2),ce.emplace(Se++,Me,Ge,He,et,3)}(!du||du.length<2*J)&&(du=function(pe){const Te=2*pe,De=new o.b0;De.resize(Te),De._trim();for(let Me=0;Me<Te;Me++){const Ge=6*Me;De.uint16[Ge+0]=4*Me+0,De.uint16[Ge+1]=4*Me+1,De.uint16[Ge+2]=4*Me+2,De.uint16[Ge+3]=4*Me+2,De.uint16[Ge+4]=4*Me+3,De.uint16[Ge+5]=4*Me+0}return De}(J));const ye=T.createIndexBuffer(du,!0),we=T.createVertexBuffer(ce,o.d_.members,!0);for(const pe of Q){const Te={u_matrix:pe.transform,u_inv_matrix:pe.invTransform,u_camera_to_center_distance:(_e=M).getCameraToCenterDistance(pe.projection),u_viewport_size:[_e.width,_e.height]};de.draw(f,A.TRIANGLES,Xt.disabled,pr.disabled,f.colorModeForRenderPass(),fr.disabled,Te,l.id,we,ye,o.bg.simpleSegment(0,2*pe.circleOffset,pe.circleArray.length,pe.circleArray.length/2),null,M.zoom)}var _e;we.destroy(),ye.destroy()}const Bh=o.bC();function Pl(f){const n=f._camera.getWorldToCamera(f.worldSize,1),l=o.aB([],n,f.globeMatrix);o.bl(l,l);const p=[0,0,0],y=[0,1,0,0];return o.aC(y,y,l),p[0]=y[0],p[1]=y[1],p[2]=y[2],o.aw(p,p),p}function Ac({width:f,height:n,anchor:l,textOffset:p,textScale:y},x){const{horizontalAlign:b,verticalAlign:T}=o.c1(l),A=-(b-.5)*f,M=-(T-.5)*n,D=o.c2(l,p);return new o.P((A/y+D[0])*x,(M/y+D[1])*x)}function or(f,n,l,p,y,x,b,T,A,M){const D=f.text.placedSymbolArray,N=f.text.dynamicLayoutVertexArray,B=f.icon.dynamicLayoutVertexArray,j={},H=f.getProjection(),G=rl(b,H,y),Q=y.elevation,J=H.upVectorScale(b.canonical,y.center.lat,y.worldSize).metersToTile;N.clear();for(let ae=0;ae<D.length;ae++){const de=D.get(ae),{tileAnchorX:ce,tileAnchorY:Se,numGlyphs:ye}=de,we=de.hidden||!de.crossTileID||f.allowVerticalPlacement&&!de.placedOrientation?null:p[de.crossTileID];if(we){let _e=0,pe=0,Te=0;const De=f.elevationType==="road";if(Q||De){const Ve=De?f.getElevationFeatureForText(ae):null,ot=o.bV.getAtTileOffset(b,new o.P(ce,Se),Q,Ve),[Tt,zt,wt]=H.upVector(b.canonical,ce,Se);_e=ot*Tt*J,pe=ot*zt*J,Te=ot*wt*J}let[Me,Ge,He,et]=ha(de.projectedAnchorX+_e,de.projectedAnchorY+pe,de.projectedAnchorZ+Te,l?G:x);const mt=wn(y.getCameraToCenterDistance(H),et);let Ne=o.bM(f.textSizeData,A,de)*mt/o.bY;l&&(Ne*=f.tilePixelRatio/T);const Ce=Ac(we,Ne);l?({x:Me,y:Ge,z:He}=H.projectTilePoint(ce+Ce.x,Se+Ce.y,b.canonical),[Me,Ge,He]=ha(Me+_e,Ge+pe,He+Te,x)):(n&&Ce._rotate(-y.angle),Me+=Ce.x,Ge+=Ce.y,He=0);const Ke=f.allowVerticalPlacement&&de.placedOrientation===o.bL.vertical?Math.PI/2:0;for(let Ve=0;Ve<ye;Ve++)o.bO(N,Me,Ge,He,Ke);M&&de.associatedIconIndex>=0&&(j[de.associatedIconIndex]={x:Me,y:Ge,z:He,angle:Ke})}else Ra(ye,N)}if(M){B.clear();const ae=f.icon.placedSymbolArray;for(let de=0;de<ae.length;de++){const ce=ae.get(de),{numGlyphs:Se}=ce,ye=j[de];if(ce.hidden||!ye)Ra(Se,B);else{const{x:we,y:_e,z:pe,angle:Te}=ye;for(let De=0;De<Se;De++)o.bO(B,we,_e,pe,Te)}}f.icon.dynamicLayoutVertexBuffer.updateData(B)}f.text.dynamicLayoutVertexBuffer.updateData(N)}function Nh(f,n,l,p,y,x,b={}){const T=l.paint.get("icon-translate"),A=l.paint.get("text-translate"),M=l.paint.get("icon-translate-anchor"),D=l.paint.get("text-translate-anchor"),N=l.layout.get("icon-rotation-alignment"),B=l.layout.get("text-rotation-alignment"),j=l.layout.get("icon-pitch-alignment"),H=l.layout.get("text-pitch-alignment"),G=l.layout.get("icon-keep-upright"),Q=l.layout.get("text-keep-upright"),J=l.paint.get("icon-color-saturation"),ae=l.paint.get("icon-color-contrast"),de=l.paint.get("icon-color-brightness-min"),ce=l.paint.get("icon-color-brightness-max"),Se=l.layout.get("symbol-elevation-reference")==="sea",ye=l.layout.get("icon-image-use-theme")==="none",we=f.context,_e=we.gl,pe=f.transform,Te=N==="map",De=B==="map",Me=j==="map",Ge=H==="map",He=l.layout.get("symbol-sort-key").constantOr(1)!==void 0;let et=!1;const mt=f.depthModeForSublayer(0,Xt.ReadOnly),Ne=new Xt(f.context.gl.LEQUAL,Xt.ReadOnly,f.depthRangeFor3D),Ce=[o.aF(pe.center.lng),o.aJ(pe.center.lat)],Ke=l.layout.get("text-variable-anchor"),Ve=pe.projection.name==="globe",ot=[],Tt=[0,-1,0];for(const zt of p){const wt=n.getTile(zt),gt=wt.getBucket(l);if(!gt||gt.projection.name==="mercator"&&Ve||gt.fullyClipped)continue;const Kt=gt.projection.name==="globe",$t=Kt?o.aj(pe.zoom):0,Dt=rl(zt,gt.getProjection(),pe),Bt=pe.calculatePixelsToTileUnitsMatrix(wt),nr=Ke&>.hasTextData(),xr=gt.hasIconTextFit()&&nr&>.hasIconData(),Ur=gt.getProjection().createInversionMatrix(pe,zt.canonical),dn=(1<<wt.tileID.canonical.z)*o.al/f.transform.worldSize,Zt=mn=>{let Qr=[0,0,0];if(mn){const Cr=f.style.directionalLight,Kn=f.style.ambientLight;Cr&&Kn&&(Qr=Cl(f.style,Cr,Kn))}return Qr},an=mn=>{pe.depthOcclusionForSymbolsAndCircles&&(l.hasOcclusionOpacityProperties||f.terrain)&&(mn.push("DEPTH_D24"),mn.push("DEPTH_OCCLUSION"))},vr=mn=>{l.lut&&!ye&&(l.lut.texture||(l.lut.texture=new o.d$(f.context,l.lut.image,[l.lut.image.height,l.lut.image.height,l.lut.image.height],we.gl.RGBA8)),we.activeTexture.set(we.gl.TEXTURE0+ms.LUT),l.lut.texture&&l.lut.texture.bind(we.gl.LINEAR,we.gl.CLAMP_TO_EDGE),mn.push("APPLY_LUT_ON_GPU"))},pn=()=>{const mn=Te&&l.layout.get("symbol-placement")!=="point",Qr=[];an(Qr),vr(Qr);const Cr=mn||xr,Kn=gt.elevationType==="road",vi=f.shadowRenderer,ni=Kn&&Me&&!!vi&&vi.enabled,Rn=Zt(ni),fo=Kn&&Me&&!f.terrain?Ne:mt,Ms=l.paint.get("icon-image-cross-fade");f.terrainRenderModeElevated()&&Me&&Qr.push("PITCH_WITH_MAP_TERRAIN"),Kt&&(Qr.push("PROJECTION_GLOBE_VIEW"),Cr&&Qr.push("PROJECTED_POS_ON_VIEWPORT")),Ms>0&>.hasAnySecondaryIcon&&Qr.push("ICON_TRANSITION"),!gt.icon.zOffsetVertexBuffer||Kn&&f.terrain||Qr.push("Z_OFFSET"),J===0&&ae===0&&de===0&&ce===1||Qr.push("COLOR_ADJUSTMENT"),gt.sdfIcons&&Qr.push("RENDER_SDF"),ni&&Qr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Kn&&Me&&!f.terrain&>.icon.orientationVertexBuffer&&Qr.push("ELEVATED_ROADS");const Vi=gt.icon.programConfigurations.get(l.id),Us=f.getOrCreateProgram("symbol",{config:Vi,defines:Qr}),$s=wt.imageAtlasTexture?wt.imageAtlasTexture.size:[0,0],Ts=gt.iconSizeData,Qo=o.bK(Ts,pe.zoom),xa=Me||!pe.isOrthographic,Eo=Js(Dt,wt.tileID.canonical,Me,Te,pe,gt.getProjection(),Bt),fi=xh(Dt,wt.tileID.canonical,Me,Te,pe,gt.getProjection(),Bt),bi=f.translatePosMatrix(fi,wt,T,M,!0),Dn=f.translatePosMatrix(Dt,wt,T,M),Ci=Cr?Bh:Eo,ci=Te&&!Me&&!mn;let ii=Tt;!Ve&&!pe.mercatorFromTransition||Te||(ii=Pl(pe));const wa=Kt?ii:Tt,Yh=l.getColorAdjustmentMatrix(J,ae,de,ce),Ba=Lp(Ts.kind,Qo,ci,Me,f,Dn,Ci,bi,Se,!1,$s,[0,0],0,zt,$t,Ce,Ur,wa,gt.getProjection(),Rn,dn,Yh,Ms,null),Jh=wt.imageAtlasTexture?wt.imageAtlasTexture:null,_d=l.layout.get("icon-size").constantOr(0)!==1||gt.iconsNeedLinear,hl=gt.sdfIcons||f.options.rotating||f.options.zooming||_d||xa?_e.LINEAR:_e.NEAREST,Nl=gt.sdfIcons&&l.paint.get("icon-halo-width").constantOr(1)!==0,yd=f.terrain&&Me&&mn?o.bl(o.bC(),Eo):Bh;if(mn&>.icon){const Rc=o.bV.getAtTileOffsetFunc(zt,pe.center.lat,pe.worldSize,gt.getProjection()),jl=np(Dt,wt.tileID.canonical,Me,Te,pe,gt.getProjection(),Bt),Na=l.layout.get("icon-size-scale-range"),Vl=o.aA(f.scaleFactor,Na[0],Na[1]);G0(gt,Dt,f,!1,jl,fi,Me,G,Rc,zt,Vl)}return{program:Us,buffers:gt.icon,uniformValues:Ba,atlasTexture:Jh,atlasTextureIcon:null,atlasInterpolation:hl,atlasInterpolationIcon:null,isSDF:gt.sdfIcons,hasHalo:Nl,depthMode:fo,tile:wt,renderWithShadows:ni,labelPlaneMatrixInv:yd}},An=()=>{const mn=De&&l.layout.get("symbol-placement")!=="point",Qr=[],Cr=mn||Ke||xr,Kn=gt.elevationType==="road",vi=f.shadowRenderer,ni=Kn&&Ge&&!!vi&&vi.enabled,Rn=Zt(ni),fo=Kn&&Ge&&!f.terrain?Ne:mt;f.terrainRenderModeElevated()&&Ge&&Qr.push("PITCH_WITH_MAP_TERRAIN"),Kt&&(Qr.push("PROJECTION_GLOBE_VIEW"),Cr&&Qr.push("PROJECTED_POS_ON_VIEWPORT")),!gt.text.zOffsetVertexBuffer||Kn&&f.terrain||Qr.push("Z_OFFSET"),gt.iconsInText&&Qr.push("RENDER_TEXT_AND_SYMBOL"),Qr.push("RENDER_SDF"),ni&&Qr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Kn&&Ge&&!f.terrain&>.text.orientationVertexBuffer&&Qr.push("ELEVATED_ROADS"),an(Qr);const Ms=gt.text.programConfigurations.get(l.id),Vi=f.getOrCreateProgram("symbol",{config:Ms,defines:Qr});let Us,$s=[0,0],Ts=null;const Qo=gt.textSizeData;gt.iconsInText&&($s=wt.imageAtlasTexture?wt.imageAtlasTexture.size:[0,0],Ts=wt.imageAtlasTexture?wt.imageAtlasTexture:null,Us=Ge||!pe.isOrthographic||f.options.rotating||f.options.zooming||Qo.kind==="composite"||Qo.kind==="camera"?_e.LINEAR:_e.NEAREST);const xa=wt.glyphAtlasTexture?wt.glyphAtlasTexture.size:[0,0],Eo=l.layout.get("text-size-scale-range"),fi=o.aA(f.scaleFactor,Eo[0],Eo[1]),bi=o.bK(Qo,pe.zoom,fi),Dn=Js(Dt,wt.tileID.canonical,Ge,De,pe,gt.getProjection(),Bt),Ci=xh(Dt,wt.tileID.canonical,Ge,De,pe,gt.getProjection(),Bt),ci=f.translatePosMatrix(Ci,wt,A,D,!0),ii=f.translatePosMatrix(Dt,wt,A,D),wa=Cr?Bh:Dn,Yh=De&&!Ge&&!mn;let Ba=Tt;!Ve&&!pe.mercatorFromTransition||De||(Ba=Pl(pe));const Jh=Lp(Qo.kind,bi,Yh,Ge,f,ii,wa,ci,Se,!0,xa,$s,0,zt,$t,Ce,Ur,Kt?Ba:Tt,gt.getProjection(),Rn,dn,null,null,fi),_d=wt.glyphAtlasTexture?wt.glyphAtlasTexture:null,hl=_e.LINEAR,Nl=l.paint.get("text-halo-width").constantOr(1)!==0,yd=f.terrain&&Ge&&mn?o.bl(o.bC(),Dn):Bh;if(mn&>.text){const Rc=o.bV.getAtTileOffsetFunc(zt,pe.center.lat,pe.worldSize,gt.getProjection()),jl=np(Dt,wt.tileID.canonical,Ge,De,pe,gt.getProjection(),Bt);G0(gt,Dt,f,!0,jl,Ci,Ge,Q,Rc,zt,fi)}return{program:Vi,buffers:gt.text,uniformValues:Jh,atlasTexture:_d,atlasTextureIcon:Ts,atlasInterpolation:hl,atlasInterpolationIcon:Us,isSDF:!0,hasHalo:Nl,depthMode:fo,tile:wt,renderWithShadows:ni,labelPlaneMatrixInv:yd}},bn=gt.icon.segments.get().length,sn=gt.text.segments.get().length,Ar=bn&&!b.onlyText?pn():null,fn=sn&&!b.onlyIcons?An():null,li=l.paint.get("icon-opacity").constantOr(1),Yn=l.paint.get("text-opacity").constantOr(1);if(He&>.canOverlap){et=!0;const mn=li&&!b.onlyText?gt.icon.segments.get():[],Qr=Yn&&!b.onlyIcons?gt.text.segments.get():[];for(const Cr of mn)ot.push({segments:new o.bg([Cr]),sortKey:Cr.sortKey,state:Ar});for(const Cr of Qr)ot.push({segments:new o.bg([Cr]),sortKey:Cr.sortKey,state:fn})}else b.onlyText||ot.push({segments:li?gt.icon.segments:new o.bg([]),sortKey:0,state:Ar}),b.onlyIcons||ot.push({segments:Yn?gt.text.segments:new o.bg([]),sortKey:0,state:fn})}et&&ot.sort((zt,wt)=>zt.sortKey-wt.sortKey);for(const zt of ot){const wt=zt.state;if(wt)if(f.terrain?f.terrain.setupElevationDraw(wt.tile,wt.program,{useDepthForOcclusion:pe.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:wt.labelPlaneMatrixInv}):f.setupDepthForOcclusion(pe.depthOcclusionForSymbolsAndCircles,wt.program),we.activeTexture.set(_e.TEXTURE0),wt.atlasTexture&&wt.atlasTexture.bind(wt.atlasInterpolation,_e.CLAMP_TO_EDGE,!0),wt.atlasTextureIcon&&(we.activeTexture.set(_e.TEXTURE1),wt.atlasTextureIcon&&wt.atlasTextureIcon.bind(wt.atlasInterpolationIcon,_e.CLAMP_TO_EDGE,!0)),wt.renderWithShadows&&f.shadowRenderer.setupShadows(wt.tile.tileID.toUnwrapped(),wt.program,"vector-tile"),f.uploadCommonLightUniforms(f.context,wt.program),wt.hasHalo){const gt=wt.uniformValues;gt.u_is_halo=1,G_(wt.buffers,zt.segments,l,f,wt.program,wt.depthMode,y,x,gt,2),gt.u_is_halo=0}else{if(wt.isSDF){const gt=wt.uniformValues;wt.hasHalo&&(gt.u_is_halo=1,G_(wt.buffers,zt.segments,l,f,wt.program,wt.depthMode,y,x,gt,1)),gt.u_is_halo=0}G_(wt.buffers,zt.segments,l,f,wt.program,wt.depthMode,y,x,wt.uniformValues,1)}}}function G_(f,n,l,p,y,x,b,T,A,M){const D=[f.dynamicLayoutVertexBuffer,f.opacityVertexBuffer,f.iconTransitioningVertexBuffer,f.globeExtVertexBuffer,f.zOffsetVertexBuffer,f.orientationVertexBuffer];y.draw(p,p.context.gl.TRIANGLES,x,b,T,fr.disabled,A,l.id,f.layoutVertexBuffer,f.indexBuffer,n,l.paint,p.transform.zoom,f.programConfigurations.get(l.id),D,M)}function wx(f,n){const l=1<<f.canonical.z,p=(n.x*l-f.canonical.x-f.wrap*l)*o.al,y=(n.y*l-f.canonical.y)*o.al,x=o.e8(n.z,n.y);return o.d5(p,y,x)}function zp(f,n,l,p,y){if(!l.layout||l.layout.get("fill-elevation-reference")==="none"||l.paint.get("fill-opacity").constantOr(1)===0)return;const x=f.context.gl,b=new Xt(f.context.gl.LEQUAL,Xt.ReadWrite,f.depthRangeFor3D),T=new Xt(f.context.gl.GREATER,Xt.ReadWrite,f.depthRangeFor3D),A=function(j){let H=.01;return j.isOrthographic&&(H=o.ak(1e-4,H,o.d0(j.pitch>=La?1:j.pitch/La))),2*H}(f.transform),M=f.transform.getFreeCameraOptions().position,D="elevatedStructuresDepthReconstruct",N=f.getOrCreateProgram(D,{defines:["DEPTH_RECONSTRUCTION"]}),B=f.getOrCreateProgram(D);for(const j of p){const H=n.getTile(j),G=H.getBucket(l);if(!G)continue;const Q=G.elevatedStructures;if(!Q)continue;const J=G.elevationBufferData.heightRange,ae=wx(j.toUnwrapped(),M),de=f.translatePosMatrix(j.projMatrix,H,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor"));let ce,Se,ye,we;if(y==="initialize"){if(!J||J.min>=1||Q.depthSegments.segments[0].primitiveLength===0)continue;ce=cu(de,ae,A,1,0),Se=b,ye=Q.depthSegments,we=N}else if(y==="reset"){if(!J||J.min>=0||Q.maskSegments.segments[0].primitiveLength===0)continue;ce=cu(de,ae,0,0,1),Se=T,ye=Q.maskSegments,we=N}else if(y==="geometry"){if(Q.depthSegments.segments[0].primitiveLength===0)continue;ce=cu(de,ae,A,1,0),Se=b,ye=Q.depthSegments,we=B}we.draw(f,x.TRIANGLES,Se,pr.disabled,Er.disabled,fr.disabled,ce,l.id,Q.vertexBuffer,Q.indexBuffer,ye,l.paint,f.transform.zoom)}}function Fp(f,n,l,p){const{painter:y,sourceCache:x,layer:b,coords:T,colorMode:A,elevationType:M,terrainEnabled:D,pass:N}=f,B=y.context.gl,j=b.paint.get("fill-pattern"),H=b.paint.get("fill-pattern-cross-fade"),G=j.constantOr(null);let Q=M;M!=="road"||n&&!D||(Q="none");const J=Q==="road",ae=f.painter.shadowRenderer,de=J&&!!ae&&ae.enabled,ce=new Xt(y.context.gl.LEQUAL,Xt.ReadOnly,y.depthRangeFor3D);let Se=[0,0,0];if(de){const pe=y.style.directionalLight,Te=y.style.ambientLight;pe&&Te&&(Se=Cl(y.style,pe,Te))}const ye=j&&j.constantOr(1),we=y.terrain&&y.terrain.renderingToTexture,_e=(pe,Te)=>{let De,Me,Ge,He,et;Te?(De=ye&&!b.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ge=B.LINES):(De=ye?"fillPattern":"fill",Ge=B.TRIANGLES);for(const mt of T){const Ne=x.getTile(mt);if(ye&&!Ne.patternsLoaded())continue;const Ce=Ne.getBucket(b);if(!Ce)continue;const Ke=n?Ce.elevationBufferData:Ce.bufferData;if(Ke.isEmpty())continue;y.prepareDrawTile();const Ve=Ke.programConfigurations.get(b.id),ot=y.isTileAffectedByFog(mt),Tt=[],zt=[];J&&(Tt.push("ELEVATED_ROADS"),zt.push(Ke.elevatedLayoutVertexBuffer)),de&&Tt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),we&&l&&Tt.push("USE_MRT1"),ye&&(y.context.activeTexture.set(B.TEXTURE0),Ne.imageAtlasTexture&&Ne.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),Ve.updatePaintBuffers());let wt=!1;if(G&&Ne.imageAtlas){const Bt=Ne.imageAtlas,nr=o.e3.from(G),xr=nr.getPrimary().scaleSelf(o.o.devicePixelRatio).toString(),Ur=nr.getSecondary(),dn=Bt.patternPositions.get(xr),Zt=Ur?Bt.patternPositions.get(Ur.scaleSelf(o.o.devicePixelRatio).toString()):null;wt=!!dn&&!!Zt,dn&&Ve.setConstantPatternPositions(dn,Zt)}H>0&&(wt||Ve.getPatternTransitionVertexBuffer("fill-pattern"))&&Tt.push("FILL_PATTERN_TRANSITION");const gt=y.getOrCreateProgram(De,{config:Ve,overrideFog:ot,defines:Tt}),Kt=y.translatePosMatrix(mt.projMatrix,Ne,b.paint.get("fill-translate"),b.paint.get("fill-translate-anchor"));de&&ae.setupShadows(Ne.tileID.toUnwrapped(),gt,"vector-tile");const $t=b.paint.get("fill-emissive-strength");if(Te){He=Ke.lineIndexBuffer,et=Ke.lineSegments;const Bt=y.terrain&&y.terrain.renderingToTexture?y.terrain.drapeBufferSize:[B.drawingBufferWidth,B.drawingBufferHeight];Me=De==="fillOutlinePattern"&&ye?j_(Kt,$t,y,Ne,Bt,Se,H):dx(Kt,$t,Bt,Se)}else He=Ke.indexBuffer,et=Ke.triangleSegments,Me=ye?N_(Kt,$t,y,Ne,Se,H):B_(Kt,$t,Se);y.uploadCommonUniforms(y.context,gt,mt.toUnwrapped());let Dt=pe;(M==="road"&&!D||M==="offset")&&(Dt=ce),gt.draw(y,Ge,Dt,p||y.stencilModeForClipping(mt),A,fr.disabled,Me,b.id,Ke.layoutVertexBuffer,He,et,b.paint,y.transform.zoom,Ve,zt)}};y.renderPass===N&&_e(y.depthModeForSublayer(1,y.renderPass==="opaque"?Xt.ReadWrite:Xt.ReadOnly),!1),Q==="none"&&y.renderPass==="translucent"&&b.paint.get("fill-antialias")&&_e(y.depthModeForSublayer(b.getPaintProperty("fill-outline-color")?2:0,Xt.ReadOnly),!0)}function Bp(f,n,l,p,y,x,b,T){l.resetLayerRenderingStats(f);const A=f.context,M=A.gl,D=f.transform,N=l.paint.get("fill-extrusion-pattern"),B=l.paint.get("fill-extrusion-pattern-cross-fade"),j=N.constantOr(null),H=N.constantOr(1),G=l.paint.get("fill-extrusion-opacity"),Q=f.style.enable3dLights(),J=l.paint.get(Q&&!H?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),ae=[l.paint.get("fill-extrusion-ambient-occlusion-intensity"),J],de=l.layout.get("fill-extrusion-edge-radius"),ce=de>0&&!l.paint.get("fill-extrusion-rounded-roof"),Se=ce?0:de,ye=D.projection.name==="globe"?o.eb():0,we=D.projection.name==="globe",_e=we?o.aj(D.zoom):0,pe=[o.aF(D.center.lng),o.aJ(D.center.lat)],Te=l.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",De=l.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Te?null:l.lut).toArray01().slice(0,3),Me=l.paint.get("fill-extrusion-flood-light-intensity"),Ge=l.paint.get("fill-extrusion-vertical-scale"),He=l.paint.get("fill-extrusion-line-width").constantOr(1)!==0,et=l.paint.get("fill-extrusion-height-alignment"),mt=l.paint.get("fill-extrusion-base-alignment"),Ne=yc(f,l.paint.get("fill-extrusion-cutoff-fade-range")),Ce=[];let Ke;we&&Ce.push("PROJECTION_GLOBE_VIEW"),ae[0]>0&&Ce.push("FAUX_AO"),ce&&Ce.push("ZERO_ROOF_RADIUS"),T&&Ce.push("HAS_CENTROID"),Me>0&&Ce.push("FLOOD_LIGHT"),Ne.shouldRenderCutoff&&Ce.push("RENDER_CUTOFF"),He&&Ce.push("RENDER_WALL_MODE");const Ve=f.renderPass==="shadow",ot=f.shadowRenderer,Tt=Ve&&!!ot,zt=Ve?fr.disabled:fr.backCCW;f.shadowRenderer&&(f.shadowRenderer.useNormalOffset=!0);let wt=[0,0,0];if(ot){const $t=f.style.directionalLight,Dt=f.style.ambientLight;$t&&Dt&&(wt=Cl(f.style,$t,Dt)),Ve||(Ce.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ot.useNormalOffset&&Ce.push("NORMAL_OFFSET")),Ke=Ce.concat(["SHADOWS_SINGLE_CASCADE"])}const gt=Tt?"fillExtrusionDepth":H?"fillExtrusionPattern":"fillExtrusion",Kt=l.getLayerRenderingStats();for(const $t of p){const Dt=n.getTile($t),Bt=Dt.getBucket(l);if(!Bt||Bt.projection.name!==D.projection.name)continue;let nr=!1;ot&&(nr=ot.getMaxCascadeForTile($t.toUnwrapped())===0);const xr=f.isTileAffectedByFog($t),Ur=Bt.programConfigurations.get(l.id);let dn=!1;if(j&&Dt.imageAtlas){const sn=Dt.imageAtlas,Ar=o.e3.from(j),fn=Ar.getPrimary().scaleSelf(o.o.devicePixelRatio).toString(),li=Ar.getSecondary(),Yn=sn.patternPositions.get(fn),mn=li?sn.patternPositions.get(li.scaleSelf(o.o.devicePixelRatio).toString()):null;dn=!!Yn&&!!mn,Yn&&Ur.setConstantPatternPositions(Yn,mn)}B>0&&(dn||Ur.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Ce.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Zt=f.getOrCreateProgram(gt,{config:Ur,defines:nr?Ke:Ce,overrideFog:xr});if(f.terrain&&f.terrain.setupElevationDraw(Dt,Zt,{useMeterToDem:!0}),!Bt.centroidVertexBuffer){const sn=Zt.getAttributeLocation(M,"a_centroid_pos");sn!==-1&&M.vertexAttrib2f(sn,0,0)}!Ve&&ot&&ot.setupShadows(Dt.tileID.toUnwrapped(),Zt,"vector-tile"),H&&(f.context.activeTexture.set(M.TEXTURE0),Dt.imageAtlasTexture&&Dt.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Ur.updatePaintBuffers());const an=l.paint.get("fill-extrusion-vertical-gradient"),vr=1/Bt.tileToMeter;let pn;if(Ve&&ot){if(Rl(Dt.tileID,Bt.maxHeight,f))continue;const sn=ot.calculateShadowPassMatrixFromTile(Dt.tileID.toUnwrapped());pn=F_(sn,Se,vr,Ge,et,mt)}else{const sn=f.translatePosMatrix($t.expandedProjMatrix,Dt,l.paint.get("fill-extrusion-translate"),l.paint.get("fill-extrusion-translate-anchor")),Ar=D.projection.createInversionMatrix(D,$t.canonical);pn=H?ux(sn,f,an,G,ae,Se,vr,$t,Dt,ye,et,mt,_e,pe,Ar,De,Ge,B):Pp(sn,f,an,G,ae,Se,vr,$t,ye,et,mt,_e,pe,Ar,De,Ge,Me,wt)}f.uploadCommonUniforms(A,Zt,$t.toUnwrapped(),null,Ne);let An=Bt.segments;if(D.projection.name==="mercator"&&!Ve&&(An=Bt.getVisibleSegments(Dt.tileID,f.terrain,f.transform.getFrustum(0)),!An.get().length))continue;if(Kt)if(Ve)for(const sn of An.get())Kt.numRenderedVerticesInShadowPass+=sn.primitiveLength;else for(const sn of An.get())Kt.numRenderedVerticesInTransparentPass+=sn.primitiveLength;const bn=[];(f.terrain||T)&&bn.push(Bt.centroidVertexBuffer),we&&bn.push(Bt.layoutVertexExtBuffer),He&&bn.push(Bt.wallVertexBuffer),Zt.draw(f,A.gl.TRIANGLES,y,x,b,zt,pn,l.id,Bt.layoutVertexBuffer,Bt.indexBuffer,An,l.paint,f.transform.zoom,Ur,bn)}f.shadowRenderer&&(f.shadowRenderer.useNormalOffset=!1)}class H_{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Ml(f,n,l,p,y,x,b,T,A,M,D,N,B,j,H,G,Q,J,ae,de){const ce=n.context,Se=ce.gl,ye=n.transform,we=n.transform.zoom,_e=[],pe=f.translate,Te=f.translateAnchor,De=f.edgeRadius,Me=yc(n,f.cutoffFadeRange);D==="clear"?(_e.push("CLEAR_SUBPASS"),de&&(_e.push("CLEAR_FROM_TEXTURE"),ce.activeTexture.set(Se.TEXTURE0),de.bind(Se.LINEAR,Se.CLAMP_TO_EDGE))):D==="sdf"?_e.push("SDF_SUBPASS"):D==="emissive"&&(_e.push("USE_MRT1"),ce.activeTexture.set(Se.TEXTURE0),de.bind(Se.LINEAR,Se.CLAMP_TO_EDGE)),J&&_e.push("HAS_CENTROID"),Me.shouldRenderCutoff&&_e.push("RENDER_CUTOFF");const Ge=(He,et,mt,Ne,Ce)=>{let Ke=_e;et.groundRadiusBuffer!=null&&(Ke=_e.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Ve=et.programConfigurations.get(p.id),ot=n.isTileAffectedByFog(He),Tt=n.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ve,defines:Ke,overrideFog:ot}),zt=od(n,Ne,N,M,Ce,[B,j*Ce],H,G,Q,we>=17?0:De*Ce,de?de.size[0]:0),wt=[];J&&wt.push(et.hiddenByLandmarkVertexBuffer),et.groundRadiusBuffer!=null&&wt.push(et.groundRadiusBuffer),n.uploadCommonUniforms(ce,Tt,He.toUnwrapped(),null,Me),Tt.draw(n,ce.gl.TRIANGLES,x,b,T,A,zt,p.id,et.vertexBuffer,et.indexBuffer,mt,p.paint,we,Ve,wt)};for(const He of y){const et=l.getTile(He),mt=et.getBucket(p);if(!mt||mt.projection.name!==ye.projection.name||!mt.groundEffect||mt.groundEffect&&!mt.groundEffect.hasData())continue;const Ne=mt.groundEffect,Ce=1/mt.tileToMeter;{const Ke=n.translatePosMatrix(He.projMatrix,et,pe,Te),Ve=Ne.getDefaultSegment();Ge(He,Ne,Ve,Ke,Ce)}if(ae)for(let Ke=0;Ke<4;Ke++){const Ve=o.e9[Ke](He),ot=l.getTile(Ve);if(!ot)continue;const Tt=ot.getBucket(p);if(!Tt||Tt.projection.name!==ye.projection.name||!Tt.groundEffect||Tt.groundEffect&&!Tt.groundEffect.hasData())continue;const zt=Tt.groundEffect;let wt,gt;Ke===0?(wt=[-o.al,0,0],gt=1):Ke===1?(wt=[o.al,0,0],gt=0):Ke===2?(wt=[0,-o.al,0],gt=3):(wt=[0,o.al,0],gt=2);const Kt=zt.regionSegments[gt];if(!Kt)continue;const $t=new Float32Array(16);o.br($t,He.projMatrix,wt),Ge(He,zt,Kt,n.translatePosMatrix($t,et,pe,Te),Ce)}}}function BS(f,n,l,p,y,x,b){p.centroidVertexArray.length===0&&p.createCentroidsBuffer();const T=x?x.findDEMTileFor(l):null;if(!(T&&T.dem||b))return;x&&T&&T.dem&&p.selfDEMTileTimestamp!==T.dem._timestamp&&(p.borderDoneWithNeighborZ=[-1,-1,-1,-1],p.selfDEMTileTimestamp=T.dem._timestamp);const A=J=>new o.P(Math.ceil((J+o.ed)*o.ee),0),M=J=>{const ae=n.getSource().minzoom,de=Se=>{const ye=n.getTileByID(Se);if(ye&&ye.hasData())return ye.getBucket(y)},ce=[0,-1,1];for(const Se of ce){if(J.overscaledZ+Se<ae)continue;const ye=de(J.calculateScaledKey(J.overscaledZ+Se));if(ye)return ye}},D=[0,0,0],N=(J,ae)=>(D[0]=Math.min(J.min.y,ae.min.y),D[1]=Math.max(J.max.y,ae.max.y),D[2]=o.al-ae.min.x>J.max.x?ae.min.x-o.al:J.max.x,D),B=(J,ae)=>(D[0]=Math.min(J.min.x,ae.min.x),D[1]=Math.max(J.max.x,ae.max.x),D[2]=o.al-ae.min.y>J.max.y?ae.min.y-o.al:J.max.y,D),j=[(J,ae)=>N(J,ae),(J,ae)=>N(ae,J),(J,ae)=>B(J,ae),(J,ae)=>B(ae,J)],H=(J,ae,de,ce,Se,ye,we)=>{if(!x)return 0;const _e=[[ye?de:J,ye?J:de,0],[ye?de:ae,ye?ae:de,0]],pe=we<0?o.al+we:we,Te=[ye?pe:(J+ae)/2,ye?(J+ae)/2:pe,0];return de===0&&we<0||de!==0&&we>0?x.getForTilePoints(Se,[Te],!0,ce):_e.push(Te),x.getForTilePoints(l,_e,!0,T),Math.max(_e[0][2],_e[1][2],Te[2])/x.exaggeration()};for(let J=0;J<4;J++){const ae=p.borderFeatureIndices[J];if(ae.length===0)continue;const de=o.e9[J](l),ce=M(de);if(!(ce&&ce instanceof o.ea))continue;const Se=x?x.findDEMTileFor(de):null;if(!(Se&&Se.dem||b)||(x&&Se&&Se.dem&&p.borderDEMTileTimestamp[J]!==Se.dem._timestamp&&(p.borderDoneWithNeighborZ[J]=-1,p.borderDEMTileTimestamp[J]=Se.dem._timestamp),p.borderDoneWithNeighborZ[J]===ce.canonical.z))continue;ce.centroidVertexArray.length===0&&ce.createCentroidsBuffer();const ye=(J<2?1:5)-J,we=ce.borderDoneWithNeighborZ[ye]!==p.canonical.z,_e=ce.borderFeatureIndices[ye];let pe=0;if(p.canonical.z!==ce.canonical.z){for(const Te of ae)p.showCentroid(p.featuresOnBorder[Te]);if(we)for(const Te of _e)ce.showCentroid(ce.featuresOnBorder[Te]);p.borderDoneWithNeighborZ[J]=ce.canonical.z,ce.borderDoneWithNeighborZ[ye]=p.canonical.z}for(const Te of ae){const De=p.featuresOnBorder[Te],Me=p.centroidData[De.centroidDataIndex],Ge=De.borders[J];let He;for(;pe<_e.length;){He=ce.featuresOnBorder[_e[pe]];const et=He.borders[ye];if(et[1]>Ge[0]+3||et[0]>Ge[0]-3)break;ce.showCentroid(He),pe++}if(He&&pe<_e.length){const et=pe;let mt=0;for(;!(He.borders[ye][0]>Ge[1]-3)&&(mt++,++pe!==_e.length);)He=ce.featuresOnBorder[_e[pe]];He=ce.featuresOnBorder[_e[et]];let Ne=!1;if(mt>=1){const Ve=He.borders[ye];Math.abs(Ge[0]-Ve[0])<3&&Math.abs(Ge[1]-Ve[1])<3&&(mt=1,Ne=!0,pe=et+1)}else if(mt===0){p.showCentroid(De);continue}const Ce=ce.centroidData[He.centroidDataIndex];b&&Ne&&(((G=Me).flags|(Q=Ce).flags)&o.ec?(G.flags|=o.ec,Q.flags|=o.ec):(G.flags&=~o.ec,Q.flags&=~o.ec));const Ke=De.intersectsCount()>1||He.intersectsCount()>1;if(mt>1)pe=et,Me.centroidXY=Ce.centroidXY=new o.P(0,0);else if(Se&&Se.dem&&!Ke){const Ve=j[J](Me,Ce),ot=J%2?o.al-1:0,Tt=H(Ve[0],Math.min(o.al-1,Ve[1]),ot,Se,de,J<2,Ve[2]);Me.centroidXY=Ce.centroidXY=A(Tt)}else Ke?Me.centroidXY=Ce.centroidXY=new o.P(0,0):(Me.centroidXY=p.encodeBorderCentroid(De),Ce.centroidXY=ce.encodeBorderCentroid(He));p.writeCentroidToBuffer(Me),ce.writeCentroidToBuffer(Ce)}else p.showCentroid(De)}p.borderDoneWithNeighborZ[J]=ce.canonical.z,ce.borderDoneWithNeighborZ[ye]=p.canonical.z}var G,Q;(p.needsCentroidUpdate||!p.centroidVertexBuffer&&p.centroidVertexArray.length!==0)&&p.uploadCentroid(f)}const zo=[1,0,0],W_=[0,1,0],uo=[0,0,1];function Rl(f,n,l){const p=l.transform,y=l.shadowRenderer;if(!y)return!0;const x=f.toUnwrapped(),b=p.tileSize*y._cascades[l.currentShadowCascade].scale;let T=n;if(p.elevation){const G=p.elevation.getMinMaxForTile(f);G&&(T+=G.max)}const A=[...y.shadowDirection];A[2]=-A[2];const M=y.computeSimplifiedTileShadowVolume(x,T,b,A);if(!M)return!1;const D=[zo,W_,uo,A,[A[0],0,A[2]],[0,A[1],A[2]]],N=p.projection.name==="globe",B=p.scaleZoom(b),j=o.cB.fromInvProjectionMatrix(p.invProjMatrix,p.worldSize,B,!N),H=y.getCurrentCascadeFrustum();return j.intersectsPrecise(M.vertices,M.planes,D)===0||H.intersectsPrecise(M.vertices,M.planes,D)===0}function jh(f){const{painter:n,source:l,layer:p,coords:y}=f;let x=f.defines;const b=n.context,T=n.renderPass==="shadow",A=n.renderPass==="light-beam",M=n.shadowRenderer,D=o.ef(n.transform.center.lat,n.transform.zoom),N=yc(n,p.paint.get("building-cutoff-fade-range"));N.shouldRenderCutoff&&(x=x.concat("RENDER_CUTOFF")),f.floodLightIntensity>0&&(x=x.concat("FLOOD_LIGHT"));for(const B of y){const j=l.getTile(B),H=j.getBucket(p);if(!H)continue;M&&M.getMaxCascadeForTile(B.toUnwrapped())===0&&(x=x.concat("SHADOWS_SINGLE_CASCADE"));const G=H.programConfigurations.get(p.id);let Q,J,ae,de=n.translatePosMatrix(B.expandedProjMatrix,j,[0,0],"map");if(de=o.cS(o.bC(),de,[1,1,f.verticalScale]),T&&M){if(Rl(j.tileID,H.maxHeight*D,n))continue;let Se=M.calculateShadowPassMatrixFromTile(j.tileID.toUnwrapped());Se=o.cS(o.bC(),Se,[1,1,f.verticalScale]),ae=Ec(Se),Q=J=n.getOrCreateProgram("buildingDepth",{config:G,defines:x,overrideFog:!1})}else if(A)Q=J=n.getOrCreateProgram("buildingBloom",{config:G,defines:x,overrideFog:!1}),ae=hx(de);else{const Se=n.transform.calculatePosMatrix(B.toUnwrapped(),n.transform.worldSize);o.cS(Se,Se,[1,1,f.verticalScale]);const ye=o.bC();o.cS(ye,Se,[1,-1,1/D]),o.bl(ye,ye),o.eg(ye,ye);const we=n.transform.getFreeCameraOptions().position,_e=1<<B.canonical.z;if(ae=Mp(de,ye,f.opacity,f.facadeAOIntensity,[((we.x-B.wrap)*_e-B.canonical.x)*o.al,(we.y*_e-B.canonical.y)*o.al,we.z*_e*o.al],H.tileToMeter,f.facadeEmissiveChance,f.floodLightColor,f.floodLightIntensity),J=n.getOrCreateProgram("building",{config:G,defines:x,overrideFog:!1}),f.depthOnly===!0)Q=J;else{const pe=x.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);Q=n.getOrCreateProgram("building",{config:G,defines:pe,overrideFog:!1})}M&&(M.setupShadowsFromMatrix(Se,J,!0),Q!==J&&M.setupShadowsFromMatrix(Se,Q,!0))}const ce=(Se,ye)=>{if(A){const we=Se.entranceBloom;ye.draw(n,b.gl.TRIANGLES,f.depthMode,pr.disabled,f.blendMode,fr.disabled,ae,p.id,we.layoutVertexBuffer,we.indexBuffer,we.segmentsBucket,p.paint,n.transform.zoom,G,[we.layoutAttenuationBuffer,we.layoutColorBuffer])}else{const we=Se.segmentsBucket;let _e=[Se.layoutNormalBuffer,Se.layoutCentroidBuffer,Se.layoutColorBuffer,Se.layoutFloodLightDataBuffer];Se.layoutFacadePaintBuffer&&(_e=_e.concat([Se.layoutFacadeDataBuffer,Se.layoutFacadeVerticalRangeBuffer,Se.layoutFacadePaintBuffer])),ye.draw(n,b.gl.TRIANGLES,f.depthMode,pr.disabled,f.blendMode,T?fr.disabled:fr.backCW,ae,p.id,Se.layoutVertexBuffer,Se.indexBuffer,we,p.paint,n.transform.zoom,G,_e)}};n.uploadCommonUniforms(b,J,B.toUnwrapped(),null,N),H.buildingWithoutFacade&&ce(H.buildingWithoutFacade,J),H.buildingWithFacade&&(Q!==J&&n.uploadCommonUniforms(b,Q,B.toUnwrapped(),null,N),ce(H.buildingWithFacade,Q))}}function Np(f,n,l,p,y,x,b,T,A,M,D,N,B){const j=f.context.gl,H=f.depthModeForSublayer(1,Xt.ReadOnly,j.LEQUAL,!0),G=.1*(1-(Q=D))+3*Q;var Q;const J=f._showOverdrawInspector,ae=N,de=new H_;J||Ml(de,f,n,l,p,H,new pr({func:j.ALWAYS,mask:255},255,255,j.KEEP,j.KEEP,j.REPLACE),new Er([j.ONE,j.ONE,j.ONE,j.ONE],o.ao.transparent,[!1,!1,!1,!0],j.MIN),fr.disabled,y,"sdf",x,b,T,A,M,G,ae,!1);{const ce=J?pr.disabled:new pr({func:j.EQUAL,mask:255},255,255,j.KEEP,j.DECR,j.DECR),Se=J?f.colorModeForRenderPass():new Er([j.ONE_MINUS_DST_ALPHA,j.DST_ALPHA,j.ONE,j.ONE],o.ao.transparent,[!0,!0,!0,!0]);Ml(de,f,n,l,p,H,ce,Se,fr.disabled,y,"color",x,b,T,A,M,G,ae,!1)}}function jp(f){return[f[0]*o.eh,f[1]*o.eh,f[2]*o.eh,0]}function Vh(f,n,l,p,y,x,b,T,A){const M=p.getSource(),D=l.globeSharedBuffers;if(!D)return;let N,B,j;if(n&&(N=p.getTile(n)),M instanceof o.aU?(B=M.texture,j=o.dK(0,0,l.transform)):N&&n&&(B=N.texture,j=o.dK(n.canonical.z,n.canonical.x,l.transform)),!B||!j)return;f||(j=o.cS(o.bC(),j,[1,-1,1]));const H=l.context,G=H.gl,Q=y.paint.get("raster-resampling")==="nearest"?G.NEAREST:G.LINEAR,J=l.colorModeForDrapableLayerRenderPass(x),ae=b.defines;ae.push("GLOBE_POLES");const de=new Xt(G.LEQUAL,Xt.ReadWrite,l.depthRangeFor3D),ce=Float32Array.from(l.transform.expandedFarZProjMatrix),Se=Float32Array.from(o.bk(o.dJ(new o.cD(0,0,0))));l.terrain&&l.terrain.prepareDrawTile(),H.activeTexture.set(G.TEXTURE0),B.bind(Q,G.CLAMP_TO_EDGE),H.activeTexture.set(G.TEXTURE1),B.bind(Q,G.CLAMP_TO_EDGE),"useMipmap"in B&&H.extTextureFilterAnisotropic&&l.transform.pitch>20&&G.texParameterf(G.TEXTURE_2D,H.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,H.extTextureFilterAnisotropicMax);const[ye,we,_e,pe]=n?D.getPoleBuffers(n.canonical.z,!1):D.getPoleBuffers(0,!0),Te=y.paint.get("raster-elevation");let De;f?(De=ye,l.renderDefaultNorthPole=Te!==0):(De=we,l.renderDefaultSouthPole=Te!==0);const Me=jp(b.mix),Ge=((et,mt,Ne,Ce,Ke,Ve,ot,Tt,zt,wt,gt,Kt,$t)=>mx(et,mt,Ne,new Float32Array(16),new Float32Array(9),[0,0],Ce,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ve,[0,0],Tt,2,wt,gt,Kt,1,0,$t))(ce,Se,j,o.aj(l.transform.zoom),0,y,0,Te,0,Me,b.offset,b.range,x),He=l.getOrCreateProgram("raster",{defines:ae});l.uploadCommonUniforms(H,He,null),He.draw(l,G.TRIANGLES,de,A,J,T,Ge,y.id,De,_e,pe)}function bx(f){const n=f._nearZ,l=f.projection.farthestPixelDistance(f),p=l-n,y=.2*f.height,x=n+y;return[n,l,(x-y-n)/p,(x-n)/p]}function Dl(f,n,l,p){if(f)return n instanceof Ys&&f instanceof Qf?n.getTextureDescriptor(f,l,!0):{texture:f.texture,mix:jp(p.mix),offset:p.offset,buffer:0,tileSize:1}}var $n=o.ei([{name:"a_index",type:"Int16",components:1}]);class Vp{constructor(n,l,p,y){const x={width:p[0],height:p[1],data:null},b=n.gl;this.targetColorTexture=new o.T(n,x,b.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new o.T(n,x,b.RGBA8,{useMipmap:!1}),this.context=n,this.updateParticleTexture(l,y),this.lastInvalidatedAt=0}updateParticleTexture(n,l){if(this.particleTextureDimension===l.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const p=this.context.gl,y=l.width*l.height;this.particleTexture0=new o.T(this.context,l,p.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new o.T(this.context,l,p.RGBA8,{premultiply:!1,useMipmap:!1});const x=new o.ej;x.reserve(y);for(let b=0;b<y;b++)x.emplaceBack(b);this.particleIndexBuffer=this.context.createVertexBuffer(x,$n.members,!0),this.particleSegment=o.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=l.width}update(n){return!(this.lastInvalidatedAt<n&&(this.lastInvalidatedAt=o.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function q_(f,n,l){if(!f)return null;const p=n.getTextureDescriptor(f,l,!0);if(!p)return null;let{texture:y,mix:x,offset:b,tileSize:T,buffer:A,format:M}=p;if(!y||!M)return null;let D=!1;return M==="uint32"&&(D=!0,x[3]=0,x=Rp(o.ek,x,[0,l.paint.get("raster-particle-max-speed")]),b=Dp(o.ek,b,[0,l.paint.get("raster-particle-max-speed")])),{texture:y,textureOffset:[A/(T+2*A),T/(T+2*A)],tileSize:T,scalarData:D,scale:x,offset:b,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[M]]}}function Sx(f){const n=f._nearZ,l=f.projection.farthestPixelDistance(f),p=l-n,y=.2*f.height,x=n+y;return[n,l,(x-y-n)/p,(x-n)/p]}const Tx=new o.ao(1,0,0,1),Ex=new o.ao(0,1,0,1),kx=new o.ao(0,0,1,1),hu=new o.ao(1,0,1,1),fu=new o.ao(0,1,1,1);function vt(f,n,l,p,y,x){for(let b=0;b<l.length;b++)if(y){const M=new o.ao(p.r*.8,p.g*.8,p.b*.8,1);Ct(f,n,l[b],p,-1,-1,x),Ct(f,n,l[b],p,-1,1,x),Ct(f,n,l[b],p,1,1,x),Ct(f,n,l[b],p,1,-1,x),Ct(f,n,l[b],M,0,0,x)}else Ct(f,n,l[b],p,0,0,x)}function Ct(f,n,l,p,y,x,b){const T=f.context,A=f.transform,M=T.gl,D=A.projection.name==="globe",N=D?["PROJECTION_GLOBE_VIEW"]:[];let B=o.bz(l.projMatrix);if(D&&o.aj(A.zoom)>0){const Me=o.bj(l.canonical,A),Ge=o.el(Me);B=o.aB(new Float32Array(16),A.globeMatrix,Ge),o.aB(B,A.projMatrix,B)}const j=o.bC();j[12]+=2*y/(o.o.devicePixelRatio*A.width),j[13]+=2*x/(o.o.devicePixelRatio*A.height),o.aB(B,j,B);const H=f.getOrCreateProgram("debug",{defines:N}),G=n.getTileByID(l.key);f.terrain&&f.terrain.setupElevationDraw(G,H);const Q=Xt.disabled,J=pr.disabled,ae=f.colorModeForRenderPass(),de="$debug";T.activeTexture.set(M.TEXTURE0),f.emptyTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),D?G._makeGlobeTileDebugBuffers(f.context,A):G._makeDebugTileBoundsBuffers(f.context,A.projection);const ce=G._tileDebugBuffer||f.debugBuffer,Se=G._tileDebugIndexBuffer||f.debugIndexBuffer,ye=G._tileDebugSegments||f.debugSegments;if(H.draw(f,M.LINE_STRIP,Q,J,ae,fr.disabled,zh(B,p.toPremultipliedRenderColor(null)),de,ce,Se,ye,null,null,null,[G._globeTileDebugBorderBuffer]),b){const Me=G.latestRawTileData,Ge=Math.floor((Me&&Me.byteLength||0)/1024);let He=l.canonical.toString();l.overscaledZ!==l.canonical.z&&(He+=` => ${l.overscaledZ}`),He+=` ${G.state}`,He+=` ${Ge}kb`,function(et,mt){et.initDebugOverlayCanvas();const Ne=et.debugOverlayCanvas,Ce=et.context.gl,Ke=et.debugOverlayCanvas.getContext("2d");Ke.clearRect(0,0,Ne.width,Ne.height),Ke.shadowColor="white",Ke.shadowBlur=2,Ke.lineWidth=1.5,Ke.strokeStyle="white",Ke.textBaseline="top",Ke.font="bold 36px Open Sans, sans-serif",Ke.fillText(mt,5,5),Ke.strokeText(mt,5,5),et.debugOverlayTexture.update(Ne),et.debugOverlayTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE)}(f,He)}const we=n.getTile(l).tileSize,_e=512/Math.min(we,512)*(l.overscaledZ/A.zoom)*.5,pe=G._tileDebugTextBuffer||f.debugBuffer,Te=G._tileDebugTextIndexBuffer||f.quadTriangleIndexBuffer,De=G._tileDebugTextSegments||f.debugSegments;H.draw(f,M.TRIANGLES,Q,J,Er.alphaBlended,fr.disabled,zh(B,o.ao.transparent.toPremultipliedRenderColor(null),_e),de,pe,Te,De,null,null,null,[G._globeTileDebugTextBuffer])}function pu(f,n,l,p){ze(f,0,n+l/2,f.transform.width,l,p)}function hi(f,n,l,p){ze(f,n-l/2,0,l,f.transform.height,p)}function ze(f,n,l,p,y,x){const b=f.context,T=b.gl;T.enable(T.SCISSOR_TEST),T.scissor(n*o.o.devicePixelRatio,l*o.o.devicePixelRatio,p*o.o.devicePixelRatio,y*o.o.devicePixelRatio),b.clear({color:x}),T.disable(T.SCISSOR_TEST)}const Ax=o.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Up}=Ax;function ll(f,n,l,p){f.emplaceBack(n,l,p)}class $p{constructor(n){this.vertexArray=new o.em,this.indices=new o.b0,ll(this.vertexArray,-1,-1,1),ll(this.vertexArray,1,-1,1),ll(this.vertexArray,-1,1,1),ll(this.vertexArray,1,1,1),ll(this.vertexArray,-1,-1,-1),ll(this.vertexArray,1,-1,-1),ll(this.vertexArray,-1,1,-1),ll(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=n.createVertexBuffer(this.vertexArray,Up),this.indexBuffer=n.createIndexBuffer(this.indices),this.segment=o.bg.simpleSegment(0,0,36,12)}}function mu(f,n,l,p,y,x){const b=f.context.gl,T=n.paint.get("sky-atmosphere-color"),A=n.paint.get("sky-atmosphere-halo-color"),M=n.paint.get("sky-atmosphere-sun-intensity"),D=((N,B,j,H,G)=>({u_matrix_3f:N,u_sun_direction:B,u_sun_intensity:j,u_color_tint_r:[H.r,H.g,H.b,H.a],u_color_tint_m:[G.r,G.g,G.b,G.a],u_luminance:5e-5}))(o.eo(o.dO(),p),y,M,T.toPremultipliedRenderColor(null),A.toPremultipliedRenderColor(null));b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+x,n.skyboxTexture,0),l.draw(f,b.TRIANGLES,Xt.disabled,pr.disabled,Er.unblended,fr.frontCW,D,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const Cx=o.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class cd{constructor(n){const l=new o.ep;l.emplaceBack(-1,1,1,0,0),l.emplaceBack(1,1,1,1,0),l.emplaceBack(1,-1,1,1,1),l.emplaceBack(-1,-1,1,0,1);const p=new o.b0;p.emplaceBack(0,1,2),p.emplaceBack(2,3,0),this.vertexBuffer=n.createVertexBuffer(l,Cx.members),this.indexBuffer=n.createIndexBuffer(p),this.segments=o.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const NS=o.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class jS{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Ix{constructor(n){this.colorModeAlphaBlendedWriteRGB=new Er([1,il,1,il],o.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Er([1,0,1,0],o.ao.transparent,[!1,!1,!1,!0]),this.params=new jS,this.updateNeeded=!0}update(n){const l=n.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new cd(l);const p=this.params.sizeRange,y=this.params.intensityRange,x=function(D){const N=o.eq(30),B=[];for(let j=0;j<D;++j){const H=2*Math.PI*N(),G=Math.acos(1-2*N())-.5*Math.PI;B.push(o.d5(Math.cos(G)*Math.cos(H),Math.cos(G)*Math.sin(H),Math.sin(G)))}return B}(this.params.starsCount),b=o.eq(300),T=new o.er,A=new o.b0;let M=0;for(let D=0;D<x.length;++D){const N=o.c5([],x[D],200),B=Math.max(0,1+.01*p*(1*b()-.5)),j=Math.max(0,1+.01*y*(1*b()-.5));T.emplaceBack(N[0],N[1],N[2],-1,-1,B,j),T.emplaceBack(N[0],N[1],N[2],1,-1,B,j),T.emplaceBack(N[0],N[1],N[2],1,1,B,j),T.emplaceBack(N[0],N[1],N[2],-1,1,B,j),A.emplaceBack(M+0,M+1,M+2),A.emplaceBack(M+0,M+2,M+3),M+=4}this.starsVx=l.createVertexBuffer(T,NS.members),this.starsIdx=l.createIndexBuffer(A),this.starsSegments=o.bg.simpleSegment(0,0,T.length,A.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(n,l){const p=n.context,y=p.gl,x=n.transform,b=new Xt(y.LEQUAL,Xt.ReadOnly,[0,1]),T=o.aj(x.zoom),A=n.style.getLut(l.scope),M=l.properties.get("color-use-theme")==="none",D=l.properties.get("color").toNonPremultipliedRenderColor(M?null:A),N=l.properties.get("high-color-use-theme")==="none",B=l.properties.get("high-color").toNonPremultipliedRenderColor(N?null:A),j=l.properties.get("space-color-use-theme")==="none",H=l.properties.get("space-color").toNonPremultipliedRenderColor(j?null:A),G=5e-4,Q=o.es(l.properties.get("horizon-blend"),0,1,G,.25),J=o.dE(n,p,x)&&Q===G?x.worldSize/(2*Math.PI*1.025)-1:x.globeRadius,ae=n.frameCounter/1e3%1,de=o.ag(x.globeCenterInViewSpace),ce=Math.sqrt(Math.pow(de,2)-Math.pow(J,2)),Se=Math.acos(ce/de),ye=we=>{const _e=x.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];we&&_e.push("ALPHA_PASS");const pe=n.getOrCreateProgram("globeAtmosphere",{defines:_e}),Te=((Me,Ge,He,et,mt,Ne,Ce,Ke,Ve,ot,Tt,zt)=>({u_frustum_tl:Me,u_frustum_tr:Ge,u_frustum_br:He,u_frustum_bl:et,u_horizon:mt,u_transition:Ne,u_fadeout_range:Ce,u_atmosphere_fog_color:Ke.toArray01(),u_high_color:Ve.toArray01(),u_space_color:ot.toArray01(),u_temporal_offset:Tt,u_horizon_angle:zt}))(x.frustumCorners.TL,x.frustumCorners.TR,x.frustumCorners.BR,x.frustumCorners.BL,x.frustumCorners.horizon,T,Q,D,B,H,ae,Se);n.uploadCommonUniforms(p,pe);const De=this.atmosphereBuffer;De&&pe.draw(n,y.TRIANGLES,b,pr.disabled,we?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,fr.backCW,Te,we?"atmosphere_glow_alpha":"atmosphere_glow",De.vertexBuffer,De.indexBuffer,De.segments)};ye(!1),ye(!0)}drawStars(n,l){const p=o.aA(l.properties.get("star-intensity"),0,1);if(p===0)return;const y=n.context,x=y.gl,b=n.transform,T=n.getOrCreateProgram("stars"),A=o.c7([]);o.c9(A,A,-b._pitch),o.c8(A,A,-b.angle),o.c9(A,A,o.an(b._center.lat)),o.et(A,A,-o.an(b._center.lng));const M=o.cc(new Float32Array(16),A),D=o.aB([],b.starsProjMatrix,M),N=o.eo([],M),B=o.eu([],N),j=[0,1,0];o.dQ(j,j,B),o.c5(j,j,this.params.sizeMultiplier);const H=[1,0,0];o.dQ(H,H,B),o.c5(H,H,this.params.sizeMultiplier);const G=(Q=j,J=H,ae=p,{u_matrix:Float32Array.from(D),u_up:Q,u_right:J,u_intensity_multiplier:ae});var Q,J,ae;n.uploadCommonUniforms(y,T),this.starsVx&&this.starsIdx&&T.draw(n,x.TRIANGLES,Xt.disabled,pr.disabled,this.colorModeAlphaBlendedWriteRGB,fr.disabled,G,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Gp{constructor(){this.visibleTiles=[]}updateBorders(n,l){const p=[],y=[],x=n._getRenderableCoordinates(!1,!0);for(const A of x){const M=n.getTile(A);if(!M.hasData())continue;const D=M.getBucket(l);D&&(D.isEmpty()||(p.push(A.key),y.push({bucket:D,tileID:A.canonical})))}let b=p.length!==this.visibleTiles.length;if(!b){p.sort();for(let A=0;A<p.length;A++)if(p[A]!==this.visibleTiles[A]){b=!0;break}}if(!b)return;const T=new Set;this.visibleTiles=p,y.sort((A,M)=>A.tileID.z-M.tileID.z||A.tileID.x-M.tileID.x||A.tileID.y-M.tileID.y);for(const A of y){const M=new Array,D=new Array,N=A.bucket;for(const B of N.featuresOnBorder)T.has(B.featureId)?D.push(B.footprintIndex):(T.add(B.featureId),M.push(B.footprintIndex));N.updateFootprintHiddenFlags(M,o.ev,!1),N.updateFootprintHiddenFlags(D,o.ev,!0)}}}function Hp(f,n){const l=[...f],p=n.cameraWorldSizeForFog/n.worldSize,y=o.bA([]);return o.cS(y,y,[p,p,1]),o.aB(l,y,l),o.aB(l,n.worldToFogMatrix,l),l}function Wp(f,n,l,p,y){const x=l.material,b=p.context,{baseColorTexture:T,metallicRoughnessTexture:A}=x.pbrMetallicRoughness,{normalTexture:M,occlusionTexture:D,emissionTexture:N}=x;function B(H,G,Q){if(H&&(f.push(G),b.activeTexture.set(b.gl.TEXTURE0+Q),H.gfxTexture)){const{minFilter:J,magFilter:ae,wrapS:de,wrapT:ce}=H.sampler;H.gfxTexture.bindExtraParam(J,ae,de,ce)}}B(T,"HAS_TEXTURE_u_baseColorTexture",ms.BaseColor),B(A,"HAS_TEXTURE_u_metallicRoughnessTexture",ms.MetallicRoughness),B(M,"HAS_TEXTURE_u_normalTexture",ms.Normal),B(D,"HAS_TEXTURE_u_occlusionTexture",ms.Occlusion),B(N,"HAS_TEXTURE_u_emissionTexture",ms.Emission),y&&(y.texture||(y.texture=new o.d$(p.context,y.image,[y.image.height,y.image.height,y.image.height],b.gl.RGBA8)),b.activeTexture.set(b.gl.TEXTURE0+ms.LUT),y.texture&&y.texture.bind(b.gl.LINEAR,b.gl.CLAMP_TO_EDGE),f.push("APPLY_LUT_ON_GPU")),l.texcoordBuffer&&(f.push("HAS_ATTRIBUTE_a_uv_2f"),n.push(l.texcoordBuffer)),l.colorBuffer&&(f.push(l.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),n.push(l.colorBuffer)),l.normalBuffer&&(f.push("HAS_ATTRIBUTE_a_normal_3f"),n.push(l.normalBuffer)),l.pbrBuffer&&(f.push("HAS_ATTRIBUTE_a_pbr"),f.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),n.push(l.pbrBuffer)),x.alphaMode!=="OPAQUE"&&x.alphaMode!=="MASK"||f.push("UNPREMULT_TEXTURE_IN_SHADER"),x.defined||f.push("DIFFUSE_SHADED");const j=p.shadowRenderer;j&&(f.push("RENDER_SHADOWS","DEPTH_TEXTURE"),j.useNormalOffset&&f.push("NORMAL_OFFSET"))}function qp(f,n,l,p,y,x){const b=f.modelOpacity,T=n.context,A=new Xt(n.context.gl.LEQUAL,f.isLightMesh?Xt.ReadOnly:Xt.ReadWrite,n.depthRangeFor3D),M=n.transform,D=f.mesh,N=D.material,B=N.pbrMetallicRoughness,j=n.style.fog;let H;H=n.transform.projection.zAxisUnit==="pixels"?[...f.nodeModelMatrix]:o.aB([],p.zScaleMatrix,f.nodeModelMatrix),o.aB(H,p.negCameraPosMatrix,H);const G=o.bl([],H);o.eg(G,G);const Q=l.paint.get("model-color-use-theme").constantOr("default")==="none",J=l.paint.get("model-emissive-strength").constantOr(0),ae=uu(new Float32Array(f.worldViewProjection),new Float32Array(H),new Float32Array(G),null,n,b,B.baseColorFactor,N.emissiveFactor,B.metallicFactor,B.roughnessFactor,N,J,l,void 0,void 0,f.materialOverride,f.modelColor),de={defines:[]},ce=[],Se=n.shadowRenderer;Se&&(Se.useNormalOffset=!1),Wp(de.defines,ce,D,n,Q?null:l.lut);let ye=null;if(j){const pe=Hp(f.nodeModelMatrix,n.transform);if(ye=new Float32Array(pe),M.projection.name!=="globe"){const Te=D.aabb.min,De=D.aabb.max,[Me,Ge]=j.getOpacityForBounds(pe,Te[0],Te[1],De[0],De[1]);de.overrideFog=Me>=tt||Ge>=tt}}const we=yc(n,l.paint.get("model-cutoff-fade-range"));we.shouldRenderCutoff&&de.defines.push("RENDER_CUTOFF");const _e=n.getOrCreateProgram("model",de);n.uploadCommonUniforms(T,_e,null,ye,we),n.renderPass!=="shadow"&&Se&&Se.setupShadowsFromMatrix(f.nodeModelMatrix,_e),_e.draw(n,T.gl.TRIANGLES,A,y,x,D.material.doubleSided?fr.disabled:fr.backCCW,ae,l.id,D.vertexBuffer,D.indexBuffer,D.segments,l.paint,n.transform.zoom,void 0,ce)}function Uh(f,n){return f.style._importedAsBasemap?"basemap":n.scope}function gu(f,n,l,p,y,x,b,T,A,M){const D=f.transform,N=!!n.isGeometryBloom&&n.isGeometryBloom;if(N&&f.renderPass==="shadow")return;const B=D.projection.name==="globe"?o.eD(l,D):[...l];o.aB(B,B,n.globalMatrix);const j=o.aB([],p,B);if(n.meshes)for(const H of n.meshes){const G=T.get(H.material.name);if(G&&G.opacity<=0)continue;if(H.material.alphaMode!=="BLEND"){b.push({mesh:H,depth:0,modelIndex:y,worldViewProjection:j,nodeModelMatrix:B,isLightMesh:N,materialOverride:G,modelOpacity:A,modelColor:M});continue}const Q=o.af([],H.centroid,j);!D.isOrthographic&&Q[2]<=0||x.push({mesh:H,depth:Q[2],modelIndex:y,worldViewProjection:j,nodeModelMatrix:B,isLightMesh:N,materialOverride:G,modelOpacity:A,modelColor:M})}if(n.children)for(const H of n.children)gu(f,H,l,p,y,x,b,T,A,M)}function za(f,n,l,p){const y=l.shadowRenderer;if(!y)return;const x=y.getShadowPassDepthMode(),b=y.getShadowPassColorMode(),T=y.calculateShadowPassMatrixFromMatrix(n),A=U_(T);l.getOrCreateProgram("modelDepth",{defines:l._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(l,l.context.gl.TRIANGLES,x,pr.disabled,b,fr.disabled,A,p.id,f.vertexBuffer,f.indexBuffer,f.segments,p.paint,l.transform.zoom,void 0,void 0)}function Px(f,n,l,p,y,x){for(const b of y){const T=Object.assign({},p);T.part=b;const A={type:"Unknown",id:n,properties:T},M={orientation:f.paint.get("model-rotation").evaluate(A,l)};x.set(b,M)}}function Mx(f,n,l,p,y,x){for(const b of y){const T=Object.assign({},p);T.part=b;const A={type:"Unknown",id:n,properties:T},M={color:f.paint.get("model-color").evaluate(A,l),colorMix:f.paint.get("model-color-mix-intensity").evaluate(A,l),opacity:f.paint.get("model-opacity").evaluate(A,l),emissionStrength:f.paint.get("model-emissive-strength").evaluate(A,l)};x.set(b,M)}}function Rx(f,n,l,p,y){let x=!1;for(const T of p)T.modelOpacity!==1&&(qp(T,f,n,y[T.modelIndex],pr.disabled,Er.disabled),x=!0);for(const T of p)qp(T,f,n,y[T.modelIndex],T.modelOpacity!==1?f.stencilModeFor3D():pr.disabled,f.colorModeForRenderPass());x&&f.resetStencilClippingMasks();const b=Er.additive;for(const T of l)qp(T,f,n,y[T.modelIndex],pr.disabled,T.isLightMesh?b:f.colorModeForRenderPass())}function Dx(f,n,l){const p=n.updateZoomBasedPaintProperties(),y=function(x,b,T){let A,M,D,N=x.terrain?x.terrain.exaggeration():0;if(x.terrain&&N>0){const B=x.terrain,j=B.findDEMTileFor(T);j&&j.dem?A=o.eF.create(B,T,j):N=0}if(N===0&&(b.terrainElevationMin=0,b.terrainElevationMax=0),N===b.validForExaggeration&&(N===0||A&&A._demTile&&A._demTile.tileID===b.validForDEMTile.id&&A._dem._timestamp===b.validForDEMTile.timestamp))return!1;for(const B in b.instancesPerModel){const j=b.instancesPerModel[B];for(let H=0;H<j.instancedDataArray.length;++H){const G=(A?N*A.getElevationAt(0|j.instancedDataArray.float32[16*H],0|j.instancedDataArray.float32[16*H+1],!0,!0):0)+j.instancesEvaluatedElevation[H];j.instancedDataArray.float32[16*H+6]=G,M=M?Math.min(b.terrainElevationMin,G):G,D=D?Math.max(b.terrainElevationMax,G):G}}return b.terrainElevationMin=M||0,b.terrainElevationMax=D||0,b.validForExaggeration=N,b.validForDEMTile=A&&A._demTile?{id:A._demTile.tileID,timestamp:A._dem._timestamp}:{id:void 0,timestamp:0},!0}(f,n,l);(p||y)&&(n.uploaded=!1,n.upload(f.context))}const cl={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new o.d9([0,0,0],[o.al,o.al,0])};function ho(f,n){const l=1<<f.canonical.z,p=n.getFreeCameraOptions().position,y=n.elevation,x=f.canonical.x/l,b=(f.canonical.x+1)/l,T=f.canonical.y/l,A=(f.canonical.y+1)/l;let M=n._centerAltitude;if(y){const j=y.getMinMaxForTile(f);j&&j.max>M&&(M=j.max)}const D=o.aA(p.x,x,b)-p.x,N=o.aA(p.y,T,A)-p.y,B=o.cf(M,n.center.lat)-p.z;return n._zoomFromMercatorZ(Math.sqrt(D*D+N*N+B*B))}function Lx(f,n,l,p,y,x,b){const T=f.context,A=f.renderPass==="shadow",M=f.shadowRenderer,D=A&&M?M.getShadowPassDepthMode():new Xt(T.gl.LEQUAL,Xt.ReadWrite,f.depthRangeFor3D),N=f.isTileAffectedByFog(x),B=f.transform.projection.name==="globe";if(l.meshes)for(const j of l.meshes){const H=B?[]:["MODEL_POSITION_ON_GPU"],G=[];let Q,J,ae;const de=!B&&p.instancedDataArray.length>20;de&&H.push("INSTANCED_ARRAYS");const ce=yc(f,n.paint.get("model-cutoff-fade-range"));if(ce.shouldRenderCutoff&&H.push("RENDER_CUTOFF"),A&&M)Q=f.getOrCreateProgram("modelDepth",{defines:H}),J=U_(b.shadowTileMatrix,b.shadowTileMatrix,Float32Array.from(l.globalMatrix)),ae=M.getShadowPassColorMode();else{Wp(H,G,j,f,n.paint.get("model-color-use-theme").constantOr("default")==="none"?null:n.lut),Q=f.getOrCreateProgram("model",{defines:H,overrideFog:N});const ye=j.material,we=ye.pbrMetallicRoughness,_e=n.paint.get("model-opacity").constantOr(1),pe=n.paint.get("model-emissive-strength").constantOr(0);J=uu(x.expandedProjMatrix,Float32Array.from(l.globalMatrix),new Float32Array(16),null,f,_e,we.baseColorFactor,ye.emissiveFactor,we.metallicFactor,we.roughnessFactor,ye,pe,n,y),M&&(b.shadowUniformsInitialized?Q.setShadowUniformValues(T,M.getShadowUniformValues()):(M.setupShadows(x.toUnwrapped(),Q,"model-tile"),b.shadowUniformsInitialized=!0)),ae=ce.shouldRenderCutoff||_e<1||ye.alphaMode!=="OPAQUE"?Er.alphaBlended:Er.unblended}f.uploadCommonUniforms(T,Q,x.toUnwrapped(),null,ce);const Se=j.material.doubleSided?fr.disabled:fr.backCCW;if(de)G.push(p.instancedDataBuffer),Q.draw(f,T.gl.TRIANGLES,D,pr.disabled,ae,Se,J,n.id,j.vertexBuffer,j.indexBuffer,j.segments,n.paint,f.transform.zoom,void 0,G,p.instancedDataArray.length);else{const ye=A?"u_instance":"u_normal_matrix";for(let we=0;we<p.instancedDataArray.length;++we)J[ye]=new Float32Array(p.instancedDataArray.arrayBuffer,64*we,16),Q.draw(f,T.gl.TRIANGLES,D,pr.disabled,ae,Se,J,n.id,j.vertexBuffer,j.indexBuffer,j.segments,n.paint,f.transform.zoom,void 0,G)}}if(l.children)for(const j of l.children)Lx(f,n,j,p,y,x,b)}const $h=[1,-1,1];function VS(f,n,l,p){if(!l.modelManager)return!0;const y=l.modelManager;if(!l.shadowRenderer)return!0;const x=l.shadowRenderer,b=n.aabb;let T=!0,A=f.maxHeight;if(A===0){let D=0;for(const N in f.instancesPerModel){const B=y.getModel(N,p);B?D=Math.max(D,Math.max(Math.max(B.aabb.max[0],B.aabb.max[1]),B.aabb.max[2])):T=!1}A=f.maxScale*D*1.41+f.maxVerticalOffset,T&&(f.maxHeight=A)}b.max[2]=A,b.min[2]+=f.terrainElevationMin,b.max[2]+=f.terrainElevationMax,o.af(b.min,b.min,n.tileMatrix),o.af(b.max,b.max,n.tileMatrix);const M=b.intersects(x.getCurrentCascadeFrustum());return l.currentShadowCascade===0&&(f.isInsideFirstShadowMapFrustum=M===2),M===0}function Xn(f,n){const l=f.uniformValues.u_cutoff_params[0],p=f.uniformValues.u_cutoff_params[1],y=f.uniformValues.u_cutoff_params[2],x=f.uniformValues.u_cutoff_params[3];return p===l||x===y?1:o.aA(((n-l)/(p-l)-y)/(x-y),0,1)}function Br(f,n,l,p){if(n.pitch<20)return 1;const y=n.getWorldToCameraMatrix();o.aB(y,y,f);const x=o.bU(l.min[0],l.min[1],l.min[2],1);let b=o.aC(o.eG(),x,y),T=b,A=b;x[1]=l.max[1],b=o.aC(o.eG(),x,y),T=b[1]<T[1]?b:T,A=b[1]>A[1]?b:A,x[0]=l.max[0],b=o.aC(o.eG(),x,y),T=b[1]<T[1]?b:T,A=b[1]>A[1]?b:A,x[1]=l.min[1],b=o.aC(o.eG(),x,y),T=b[1]<T[1]?b:T,A=b[1]>A[1]?b:A;const M=o.aA(p[0],0,1),D=100*n.pixelsPerMeter*o.aA(p[1],0,1),N=o.aA(p[2],0,1),B=o.eH(o.eG(),T,A,M),j=Math.tan(.5*n.fovX),H=-B[2]*j;if(D===0)return B[1]<-Math.abs(H)?N:1;const G=(-Math.abs(H)-B[1])/D,Q=(ae,de,ce)=>(1-ce)*ae+ce*de,J=o.aA(Q(1,N,G),N,1);return Q(1,J,o.aA((n.pitch-20)/20,0,1))}class Ox{}class Cc{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(n,l,p){{const N=this._storage.get(l.id);if(N)return N.lastUsedFrameIdx=n,N.buf}const y=p.gl,x=y.getBufferParameter(y.ELEMENT_ARRAY_BUFFER,y.BUFFER_SIZE),b=new ArrayBuffer(x),T=new Int16Array(b);y.getBufferSubData(y.ELEMENT_ARRAY_BUFFER,0,new Int16Array(b));const A=new o.eJ;for(let N=0;N<x/2;N+=3){const B=T[N],j=T[N+1],H=T[N+2];A.emplaceBack(B,j),A.emplaceBack(j,H),A.emplaceBack(H,B)}const M=p.bindVertexArrayOES.current,D=new Ox;return D.buf=new Oa(p,A),D.lastUsedFrameIdx=n,this._storage.set(l.id,D),p.bindVertexArrayOES.set(M),D.buf}update(n){for(const[l,p]of this._storage)n-p.lastUsedFrameIdx>30&&(p.buf.destroy(),this._storage.delete(l))}destroy(){for(const[n,l]of this._storage)l.buf.destroy(),this._storage.delete(n)}}class ud{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const dd=o.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Ll{constructor(n){this.revealStart=11,this.revealRange=2}}const K_=o.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class Z_{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(n,l){const p=n.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const b=new o.eK,T=new o.b0;b.emplaceBack(-1,-1),b.emplaceBack(1,-1),b.emplaceBack(1,1),b.emplaceBack(-1,1),T.emplaceBack(0,1,2),T.emplaceBack(0,2,3),this.vignetteVx=n.context.createVertexBuffer(b,K_.members),this.vignetteIdx=n.context.createIndexBuffer(T)}const y=o.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){n.uploadCommonUniforms(n.context,p);const b={u_vignetteShape:(x={vignetteShape:[l.start,l.range,Math.pow(10,l.fadePower)],vignetteColor:[l.color.r,l.color.g,l.color.b,l.color.a*l.strength]}).vignetteShape,u_vignetteColor:x.vignetteColor};p.draw(n,n.context.gl.TRIANGLES,Xt.disabled,pr.disabled,Er.alphaBlended,fr.disabled,b,"vignette",this.vignetteVx,this.vignetteIdx,y)}var x}}class X_{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(n,l){const p=n.getFreeCameraOptions().position,y=p.toAltitude(),x=p.toLngLat(),b=o.an(x.lng),T=o.an(x.lat),A=n.pixelsPerMeter/l,M=b*o.eM,D=o.eM*Math.log(Math.tan(Math.PI/4+T/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 N=-this._offsetYPrev+D,B=-this._elevationPrev+y;this._accumulatedOffsetX+=(-this._offsetXPrev+M)*A,this._accumulatedOffsetY+=N*A,this._accumulatedElevation+=B*A,this._offsetXPrev=M,this._offsetYPrev=D,this._elevationPrev=y}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Kp(f,n){return[-(f[0]-Math.floor(f[0]/n)*n),-(f[1]-Math.floor(f[1]/n)*n),-(f[2]-Math.floor(f[2]/n)*n)]}function Yo(f){const n=o.eq(1323123451230),l=[];for(let p=0;p<f;++p){const y=2*n()-1,x=2*n()-1,b=2*n()-1;l.push(o.d5(y,x,b))}return l}function So(f,n,l,p,y){const x=o.aA((y-l)/(p-l),0,1);return(1-x)*f+x*n}class _u{constructor(n){this._movement=new X_,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Z_,this._ppmScaleFactor=n}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(n,l){const p=n.transform;this._movement.update(p,this._ppmScaleFactor);const y=p.starsProjMatrix,x=o.c7([]);o.c9(x,x,o.an(90)-p._pitch),o.c8(x,x,-p.angle);const b=o.cc(new Float32Array(16),x),T=o.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),A=o.eg([],T),M=o.aB([],A,b),D=Date.now()/1e3;return this._accumulatedTimeFromStart+=(D-this._prevTime)*l,this._prevTime=D,{projectionMatrix:y,modelviewMatrix:M}}}class Zp extends _u{constructor(n){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new Ll("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(n){const l=n.context;if(!this.particlesVx){const p=Yo(this.particlesCount),y=new o.eN,x=new o.b0;let b=0;const T=o.eq(1323123451230);for(let A=0;A<p.length;++A){const M=p[A],D=[2*T()-1,T(),T(),T()];y.emplaceBack(M[0],M[1],M[2],-1,-1,...D),y.emplaceBack(M[0],M[1],M[2],1,-1,...D),y.emplaceBack(M[0],M[1],M[2],1,1,...D),y.emplaceBack(M[0],M[1],M[2],-1,1,...D),x.emplaceBack(b+0,b+1,b+2),x.emplaceBack(b+0,b+2,b+3),b+=4}this.particlesVx=l.createVertexBuffer(y,dd.members),this.particlesIdx=l.createIndexBuffer(x)}}draw(n){if(!this._params.overrideStyleParameters&&!n.style.rain)return;const l=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},p=n.transform.zoom;if(l.revealStart>p)return;const y=So(0,1,l.revealStart,l.revealStart+l.revealRange,p);if(!this.particlesVx||!this.particlesIdx)return;const x=structuredClone(this._params);let b=[-x.direction.x,x.direction.y,-100];o.aw(b,b);const T=structuredClone(this._vignetteParams);T.strength*=y,x.overrideStyleParameters||(x.intensity=n.style.rain.state.density,x.timeFactor=n.style.rain.state.intensity,x.color=structuredClone(n.style.rain.state.color),b=structuredClone(n.style.rain.state.direction),x.screenThinning.intensity=n.style.rain.state.centerThinning,x.dropletSizeX=n.style.rain.state.dropletSize[0],x.dropletSizeYScale=n.style.rain.state.dropletSize[1]/n.style.rain.state.dropletSize[0],x.distortionStrength=100*n.style.rain.state.distortionStrength,T.strength=1,T.color=structuredClone(n.style.rain.state.vignetteColor));const A=this.updateOnRender(n,x.timeFactor),M=n.context,D=M.gl,N=n.transform;this.screenTexture&&this.screenTexture.size[0]===n.width&&this.screenTexture.size[1]===n.height||(this.screenTexture=new o.T(M,{width:n.width,height:n.height,data:null},D.RGBA8)),x.distortionStrength>0&&(M.activeTexture.set(D.TEXTURE0),this.screenTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,n.width,n.height));const B=n.getOrCreateProgram("rainParticle");n.uploadCommonUniforms(M,B),M.activeTexture.set(D.TEXTURE0),this.screenTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const j=[x.color.r,x.color.g,x.color.b,x.color.a],H=(G,Q)=>{const J=Kp(this._movement.getPosition(),G),ae=x.dropletSizeX,de=x.dropletSizeX*x.dropletSizeYScale,ce=n.width/2,Se=n.height/2,ye=So(0,x.screenThinning.start,0,1,x.screenThinning.intensity),we=So(.001,x.screenThinning.range,0,1,x.screenThinning.intensity),_e=So(0,x.screenThinning.particleOffset,0,1,x.screenThinning.intensity),pe=(Te={modelview:A.modelviewMatrix,projection:A.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:J,velocityConeAperture:x.velocityConeAperture,velocity:x.velocity,boxSize:G,rainDropletSize:[ae,de],distortionStrength:x.distortionStrength,rainDirection:b,color:j,screenSize:[N.width,N.height],thinningCenterPos:[ce,Se],thinningShape:[ye,we,Math.pow(10,x.screenThinning.fadePower)],thinningAffectedRatio:x.screenThinning.affectedRatio,thinningParticleOffset:_e,shapeDirectionalPower:x.shapeDirPower,shapeNormalPower:x.shapeNormalPower,mode:Q?0:1},{u_modelview:Float32Array.from(Te.modelview),u_projection:Float32Array.from(Te.projection),u_time:Te.time,u_cam_pos:Te.camPos,u_texScreen:0,u_velocityConeAperture:Te.velocityConeAperture,u_velocity:Te.velocity,u_boxSize:Te.boxSize,u_rainDropletSize:Te.rainDropletSize,u_distortionStrength:Te.distortionStrength,u_rainDirection:Te.rainDirection,u_color:Te.color,u_screenSize:Te.screenSize,u_thinningCenterPos:Te.thinningCenterPos,u_thinningShape:Te.thinningShape,u_thinningAffectedRatio:Te.thinningAffectedRatio,u_thinningParticleOffset:Te.thinningParticleOffset,u_shapeDirectionalPower:Te.shapeDirectionalPower,u_shapeNormalPower:Te.shapeNormalPower,u_mode:Te.mode});var Te;const De=Math.round(x.intensity*this.particlesCount),Me=o.bg.simpleSegment(0,0,4*De,2*De);B.draw(n,D.TRIANGLES,Xt.disabled,pr.disabled,Er.alphaBlended,fr.disabled,pe,"rain_particles",this.particlesVx,this.particlesIdx,Me)};x.distortionStrength>0&&H(x.boxSize,!0),H(x.boxSize,!1),this._vignette.draw(n,T)}}const Y_=o.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class J_ extends _u{constructor(n){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Ll("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(n){const l=n.context;if(!this.particlesVx){const p=Yo(this.particlesCount),y=new o.eO,x=new o.b0;let b=0;const T=o.eq(1323123451230);for(let A=0;A<p.length;++A){const M=p[A],D=T(),N=T(),B=T(),j=[A/p.length,D,N,B],H=[T(),T()];y.emplaceBack(M[0],M[1],M[2],-1,-1,...j,...H),y.emplaceBack(M[0],M[1],M[2],1,-1,...j,...H),y.emplaceBack(M[0],M[1],M[2],1,1,...j,...H),y.emplaceBack(M[0],M[1],M[2],-1,1,...j,...H),x.emplaceBack(b+0,b+1,b+2),x.emplaceBack(b+0,b+2,b+3),b+=4}this.particlesVx=l.createVertexBuffer(y,Y_.members),this.particlesIdx=l.createIndexBuffer(x)}}draw(n){if(!this._params.overrideStyleParameters&&!n.style.snow)return;const l=structuredClone(this._params);let p=[-l.direction.x,l.direction.y,-100];o.aw(p,p);const y=structuredClone(this._vignetteParams),x=l.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},b=n.transform.zoom;if(x.revealStart>b)return;const T=So(0,1,x.revealStart,x.revealStart+x.revealRange,b);y.strength*=T,l.overrideStyleParameters||(l.intensity=n.style.snow.state.density,l.timeFactor=n.style.snow.state.intensity,l.color=structuredClone(n.style.snow.state.color),p=structuredClone(n.style.snow.state.direction),l.screenThinning.intensity=n.style.snow.state.centerThinning,l.billboardSize=2.79*n.style.snow.state.flakeSize,y.strength=1,y.color=structuredClone(n.style.snow.state.vignetteColor));const A=this.updateOnRender(n,l.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const M=n.context,D=M.gl,N=n.transform,B=n.getOrCreateProgram("snowParticle");n.uploadCommonUniforms(M,B),((j,H,G)=>{const Q=Kp(this._movement.getPosition(),j),J=N.width/2,ae=N.height/2,de=So(0,G.screenThinning.start,0,1,G.screenThinning.intensity),ce=So(.001,G.screenThinning.range,0,1,G.screenThinning.intensity),Se=So(0,G.screenThinning.particleOffset,0,1,G.screenThinning.intensity),ye=(we={modelview:A.modelviewMatrix,projection:A.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Q,velocityConeAperture:G.velocityConeAperture,velocity:G.velocity,horizontalOscillationRadius:G.horizontalOscillationRadius,horizontalOscillationRate:G.horizontalOscillationRate,boxSize:j,billboardSize:1*G.billboardSize,simpleShapeParameters:[G.shapeFadeStart,G.shapeFadePower],screenSize:[N.width,N.height],thinningCenterPos:[J,ae],thinningShape:[de,ce,Math.pow(10,G.screenThinning.fadePower)],thinningAffectedRatio:G.screenThinning.affectedRatio,thinningParticleOffset:Se,color:[G.color.r,G.color.g,G.color.b,G.color.a],direction:p},{u_modelview:Float32Array.from(we.modelview),u_projection:Float32Array.from(we.projection),u_time:we.time,u_cam_pos:we.camPos,u_velocityConeAperture:we.velocityConeAperture,u_velocity:we.velocity,u_horizontalOscillationRadius:we.horizontalOscillationRadius,u_horizontalOscillationRate:we.horizontalOscillationRate,u_boxSize:we.boxSize,u_billboardSize:we.billboardSize,u_simpleShapeParameters:we.simpleShapeParameters,u_screenSize:we.screenSize,u_thinningCenterPos:we.thinningCenterPos,u_thinningShape:we.thinningShape,u_thinningAffectedRatio:we.thinningAffectedRatio,u_thinningParticleOffset:we.thinningParticleOffset,u_particleColor:we.color,u_direction:we.direction});var we;const _e=Math.round(G.intensity*this.particlesCount),pe=o.bg.simpleSegment(0,0,4*_e,2*_e);this.particlesVx&&this.particlesIdx&&B.draw(n,D.TRIANGLES,Xt.disabled,pr.disabled,Er.alphaBlended,fr.disabled,ye,"snow_particles",this.particlesVx,this.particlesIdx,pe)})(l.boxSize,0,l),this._vignette.draw(n,y)}}const Ic={symbol:function(f,n,l,p,y){if(f.renderPass!=="translucent")return;const x=pr.disabled,b=f.colorModeForRenderPass(),T=l.layout.get("text-variable-anchor"),A=l.layout.get("text-size-scale-range"),M=o.aA(f.scaleFactor,A[0],A[1]);T&&function(B,j,H,G,Q,J,ae,de){const ce=j.transform,Se=Q==="map",ye=J==="map";for(const we of B){const _e=G.getTile(we),pe=_e.getBucket(H);if(!pe||!pe.text||!pe.text.segments.get().length)continue;const Te=o.bK(pe.textSizeData,ce.zoom,de),De=rl(we,pe.getProjection(),ce),Me=ce.calculatePixelsToTileUnitsMatrix(_e),Ge=Js(De,_e.tileID.canonical,ye,Se,ce,pe.getProjection(),Me),He=pe.hasIconTextFit()&&pe.hasIconData();Te&&or(pe,Se,ye,ae,ce,Ge,we,Math.pow(2,ce.zoom-_e.tileID.overscaledZ),Te,He)}}(p,f,l,n,l.layout.get("text-rotation-alignment"),l.layout.get("text-pitch-alignment"),y,M);const D=l.paint.get("icon-opacity").constantOr(1)!==0,N=l.paint.get("text-opacity").constantOr(1)!==0;l.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(D||N)?Nh(f,n,l,p,x,b):(D&&Nh(f,n,l,p,x,b,{onlyIcons:!0}),N&&Nh(f,n,l,p,x,b,{onlyText:!0})),n.map.showCollisionBoxes&&(Ut(f,n,l,p,l.paint.get("text-translate"),l.paint.get("text-translate-anchor"),!0),Ut(f,n,l,p,l.paint.get("icon-translate"),l.paint.get("icon-translate-anchor"),!1))},circle:function(f,n,l,p){if(f.renderPass!=="translucent")return;const y=l.paint.get("circle-opacity"),x=l.paint.get("circle-stroke-width"),b=l.paint.get("circle-stroke-opacity"),T=l.layout.get("circle-sort-key").constantOr(1)!==void 0,A=l.paint.get("circle-emissive-strength");if(y.constantOr(1)===0&&(x.constantOr(1)===0||b.constantOr(1)===0))return;const M=f.context,D=M.gl,N=f.transform,B=!(!f.terrain||!f.terrain.enabled),j=l.layout.get("circle-elevation-reference"),H=f.depthModeForSublayer(0,Xt.ReadOnly),G=new Xt(f.context.gl.LEQUAL,Xt.ReadOnly,f.depthRangeFor3D),Q=j==="none"||B?H:G,J=pr.disabled,ae=f.colorModeForDrapableLayerRenderPass(A),de=N.projection.name==="globe",ce=[o.aF(N.center.lng),o.aJ(N.center.lat)],Se=[];for(let we=0;we<p.length;we++){const _e=p[we],pe=n.getTile(_e),Te=pe.getBucket(l);if(!Te||Te.projection.name!==N.projection.name)continue;const De=Te.programConfigurations.get(l.id),Me=Te.layoutVertexBuffer,Ge=Te.globeExtVertexBuffer,He=Te.indexBuffer,et=o.e0(l),mt=[Ge],Ne=f.isTileAffectedByFog(_e);de&&et.push("PROJECTION_GLOBE_VIEW"),et.push("DEPTH_D24"),f.terrain&&N.depthOcclusionForSymbolsAndCircles&&et.push("DEPTH_OCCLUSION"),Te.hasElevation&&!f.terrain&&(et.push("ELEVATED_ROADS"),mt.push(Te.elevatedLayoutVertexBuffer));const Ce=f.getOrCreateProgram("circle",{config:De,defines:et,overrideFog:Ne}),Ke=N.projection.createInversionMatrix(N,_e.canonical),Ve={programConfiguration:De,program:Ce,layoutVertexBuffer:Me,dynamicBuffers:mt,indexBuffer:He,uniformValues:o.e1(f,_e,pe,Ke,ce,l),tile:pe};if(T){const ot=Te.segments.get();for(const Tt of ot)Se.push({segments:new o.bg([Tt]),sortKey:Tt.sortKey,state:Ve})}else Se.push({segments:Te.segments,sortKey:0,state:Ve})}T&&Se.sort((we,_e)=>we.sortKey-_e.sortKey);const ye={useDepthForOcclusion:N.depthOcclusionForSymbolsAndCircles};for(const we of Se){const{programConfiguration:_e,program:pe,layoutVertexBuffer:Te,dynamicBuffers:De,indexBuffer:Me,uniformValues:Ge,tile:He}=we.state,et=we.segments;f.terrain&&f.terrain.setupElevationDraw(He,pe,ye),f.uploadCommonUniforms(M,pe,He.tileID.toUnwrapped()),pe.draw(f,D.TRIANGLES,Q,J,ae,fr.disabled,Ge,l.id,Te,Me,et,l.paint,N.zoom,_e,De)}},heatmap:function(f,n,l,p){if(l.paint.get("heatmap-opacity")!==0)if(f.renderPass==="offscreen"){const y=f.context,x=y.gl,b=pr.disabled,T=new Er([x.ONE,x.ONE,x.ONE,x.ONE],o.ao.transparent,[!0,!0,!0,!0]);(function(j,H,G,Q){const J=j.gl,ae=H.width*Q,de=H.height*Q;j.activeTexture.set(J.TEXTURE1),j.viewport.set([0,0,ae,de]);let ce=G.heatmapFbo;if(!ce||ce&&(ce.width!==ae||ce.height!==de)){ce&&ce.destroy();const Se=J.createTexture();J.bindTexture(J.TEXTURE_2D,Se),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_S,J.CLAMP_TO_EDGE),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_T,J.CLAMP_TO_EDGE),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_MIN_FILTER,J.LINEAR),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_MAG_FILTER,J.LINEAR),ce=G.heatmapFbo=j.createFramebuffer(ae,de,1,null),function(ye,we,_e,pe,Te,De){const Me=ye.gl;Me.texImage2D(Me.TEXTURE_2D,0,ye.extRenderToTextureHalfFloat?Me.RGBA16F:Me.RGBA,Te,De,0,Me.RGBA,ye.extRenderToTextureHalfFloat?Me.HALF_FLOAT:Me.UNSIGNED_BYTE,null),pe.colorAttachment0.set(_e)}(j,0,Se,ce,ae,de)}else J.bindTexture(J.TEXTURE_2D,ce.colorAttachment0.get()),j.bindFramebuffer.set(ce.framebuffer)})(y,f,l,f.transform.projection.name==="globe"?.5:.25),y.clear({color:o.ao.transparent});const A=f.transform,M=A.projection.name==="globe",D=M?["PROJECTION_GLOBE_VIEW"]:[],N=M?fr.frontCCW:fr.disabled,B=[o.aF(A.center.lng),o.aJ(A.center.lat)];for(let j=0;j<p.length;j++){const H=p[j];if(n.hasRenderableParent(H))continue;const G=n.getTile(H),Q=G.getBucket(l);if(!Q||Q.projection.name!==A.projection.name)continue;const J=f.isTileAffectedByFog(H),ae=Q.programConfigurations.get(l.id),de=f.getOrCreateProgram("heatmap",{config:ae,defines:D,overrideFog:J}),{zoom:ce}=f.transform;f.terrain&&f.terrain.setupElevationDraw(G,de),f.uploadCommonUniforms(y,de,H.toUnwrapped());const Se=A.projection.createInversionMatrix(A,H.canonical);de.draw(f,x.TRIANGLES,Xt.disabled,b,T,N,px(f,H,G,Se,B,ce,l.paint.get("heatmap-intensity")),l.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,l.paint,f.transform.zoom,ae,M?[Q.globeExtVertexBuffer]:null)}y.viewport.set([0,0,f.width,f.height])}else f.renderPass==="translucent"&&(f.context.setColorMode(f.colorModeForRenderPass()),function(y,x){const b=y.context,T=b.gl,A=x.heatmapFbo;if(!A)return;b.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,A.colorAttachment0.get()),b.activeTexture.set(T.TEXTURE1);let M=x.colorRampTexture;M||(M=x.colorRampTexture=new o.T(b,x.colorRamp,T.RGBA8)),M.bind(T.LINEAR,T.CLAMP_TO_EDGE),y.getOrCreateProgram("heatmapTexture").draw(y,T.TRIANGLES,Xt.disabled,pr.disabled,y.colorModeForRenderPass(),fr.disabled,((D,N,B,j)=>({u_image:0,u_color_ramp:1,u_opacity:N.paint.get("heatmap-opacity")}))(0,x),x.id,y.viewportBuffer,y.quadTriangleIndexBuffer,y.viewportSegments,x.paint,y.transform.zoom)}(f,l))},line:function(f,n,l,p){if(f.renderPass!=="translucent")return;const y=l.paint.get("line-opacity"),x=l.paint.get("line-width");if(y.constantOr(1)===0||x.constantOr(1)===0)return;const b=l.paint.get("line-emissive-strength").isConstant(),T=l.paint.get("line-emissive-strength").constantOr(0),A=l.paint.get("line-occlusion-opacity"),M=l.layout.get("line-elevation-reference"),D=l.layout.get("line-width-unit")==="meters",N=M==="sea",B=!(!f.terrain||!f.terrain.enabled),j=f.context,H=j.gl;if(l.hasElevatedBuckets&&f.transform.projection.name==="globe")return;const G=l.layout.get("line-cross-slope"),Q=G!==void 0,J=G<1,ae=f.colorModeForDrapableLayerRenderPass(b?T:null),de=f.terrain&&f.terrain.renderingToTexture,ce=de?1:o.o.devicePixelRatio,Se=l.paint.get("line-dasharray"),ye=Se.constantOr(1),we=l.layout.get("line-cap"),_e=Se.constantOr(null),pe=we.constantOr(null),Te=l.paint.get("line-pattern"),De=Te.constantOr(1),Me=l.paint.get("line-pattern-cross-fade"),Ge=Te.constantOr(null),He=l.paint.get("line-opacity").constantOr(1);let et=!De&&He!==1||f.depthOcclusion&&A>0&&A<1;const mt=l.paint.get("line-gradient"),Ne=De?"linePattern":"line",Ce=o.e2(l);let Ke;if(de&&f.terrain&&f.terrain.clipOrMaskOverlapStencilType()&&(et=!1),A!==0&&f.depthOcclusion){const zt=l.paint._values["line-opacity"];zt&&zt.value&&zt.value.kind==="constant"?Ke=zt.value:o.w(`Occlusion opacity for layer ${l.id} is supported only when line-opacity isn't data-driven.`)}x.value.kind!=="constant"&&x.value.isLineProgressConstant===!1&&Ce.push("VARIABLE_LINE_WIDTH"),de&&(f.emissiveMode!=="dual-source-blending"||b?f.emissiveMode==="mrt-fallback"&&Ce.push("USE_MRT1"):Ce.push("DUAL_SOURCE_BLENDING"));const Ve=(zt,wt,gt,Kt,$t,Dt)=>{for(const Bt of zt){const nr=n.getTile(Bt);if(De&&!nr.patternsLoaded())continue;const xr=nr.getBucket(l);if(!xr||xr.elevationType!=="none"&&!$t||xr.elevationType==="none"&&$t)continue;f.prepareDrawTile();const Ur=[...wt],dn=f.shadowRenderer,Zt=xr.elevationType==="road"&&!!dn&&dn.enabled;let an=[0,0,0];if(Zt){const Cr=f.style.directionalLight,Kn=f.style.ambientLight;Cr&&Kn&&(an=Cl(f.style,Cr,Kn)),Ur.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const vr=xr.programConfigurations.get(l.id);let pn=!1;if(Ge&&nr.imageAtlas){const Cr=o.e3.from(Ge),Kn=Cr.getPrimary().scaleSelf(ce).toString(),vi=nr.imageAtlas.patternPositions.get(Kn),ni=Cr.getSecondary(),Rn=ni?nr.imageAtlas.patternPositions.get(ni.scaleSelf(ce).toString()):null;pn=!!vi&&!!Rn,vi&&vr.setConstantPatternPositions(vi,Rn)}Me>0&&(pn||vr.getPatternTransitionVertexBuffer("line-pattern"))&&Ur.push("LINE_PATTERN_TRANSITION");const An=f.isTileAffectedByFog(Bt),bn=f.getOrCreateProgram(Ne,{config:vr,defines:Ur,overrideFog:An});if(!De&&_e&&pe&&nr.lineAtlas){const Cr=nr.lineAtlas.getDash(_e,pe);Cr&&vr.setConstantPatternPositions(Cr)}Zt&&dn.setupShadows(nr.tileID.toUnwrapped(),bn,"vector-tile");let[sn,Ar]=l.paint.get("line-trim-offset");(pe==="round"||pe==="square")&&sn!==Ar&&(sn===0&&(sn-=1),Ar===1&&(Ar+=1));const fn=de?Bt.projMatrix:null,li=D?1/xr.tileToMeter/o.ay(nr,1,f.transform.zoom):1,Yn=D?1/xr.tileToMeter/o.ay(nr,1,Math.floor(f.transform.zoom)):1,mn=De?o.e4(f,nr,l,fn,ce,li,Yn,[sn,Ar],an,Me):o.e5(f,nr,l,fn,xr.lineClipsArray.length,ce,li,Yn,[sn,Ar],an);if(mt){const Cr=xr.gradients[l.id];let Kn=Cr.texture;if(l.gradientVersion!==Cr.version){let vi=256;if(l.stepInterpolant){const ni=n.getSource().maxzoom,Rn=Bt.canonical.z===ni?Math.ceil(1<<f.transform.maxZoom-Bt.canonical.z):1;vi=o.aA(o.e6(xr.maxLineLength/o.al*1024*Rn),256,j.maxTextureSize)}Cr.gradient=o.e7({expression:l.gradientExpression(),evaluationKey:"lineProgress",resolution:vi,image:Cr.gradient||void 0,clips:xr.lineClipsArray}),Cr.texture?Cr.texture.update(Cr.gradient):Cr.texture=new o.T(j,Cr.gradient,H.RGBA8),Cr.version=l.gradientVersion,Kn=Cr.texture}j.activeTexture.set(H.TEXTURE1),Kn.bind(l.stepInterpolant?H.NEAREST:H.LINEAR,H.CLAMP_TO_EDGE)}ye&&(j.activeTexture.set(H.TEXTURE0),nr.lineAtlasTexture&&nr.lineAtlasTexture.bind(H.LINEAR,H.REPEAT),vr.updatePaintBuffers()),De&&(j.activeTexture.set(H.TEXTURE0),nr.imageAtlasTexture&&nr.imageAtlasTexture.bind(H.LINEAR,H.CLAMP_TO_EDGE),vr.updatePaintBuffers()),$t&&!N&&f.terrain.setupElevationDraw(nr,bn),f.uploadCommonUniforms(j,bn,Bt.toUnwrapped());const Qr=Cr=>{Ke!=null&&(Ke.value=He*A),bn.draw(f,H.TRIANGLES,gt,Cr,ae,fr.disabled,mn,l.id,xr.layoutVertexBuffer,xr.indexBuffer,xr.segments,l.paint,f.transform.zoom,vr,[xr.layoutVertexBuffer2,xr.patternVertexBuffer,xr.zOffsetVertexBuffer]),Ke!=null&&(Ke.value=He)};if(et&&!$t){const Cr=f.stencilModeForClipping(Bt).ref;Cr===0&&de&&j.clear({stencil:0});const Kn={func:H.EQUAL,mask:255};mn.u_alpha_discard_threshold=.8,Qr(new pr(Kn,Cr,255,H.KEEP,H.KEEP,H.INVERT)),mn.u_alpha_discard_threshold=0,Qr(new pr(Kn,Cr,255,H.KEEP,H.KEEP,H.KEEP))}else mn.u_alpha_discard_threshold=et&&$t&&Dt?.8:0,Qr($t?Kt:f.stencilModeForClipping(Bt))}};let ot=f.depthModeForSublayer(0,Xt.ReadOnly);const Tt=new Xt(f.depthOcclusion?H.GREATER:H.LEQUAL,Xt.ReadOnly,f.depthRangeFor3D);if(l.hasNonElevatedBuckets){const zt=!de&&f.terrain;A!==0&&zt?o.w(`Occlusion opacity for layer ${l.id} is supported on terrain only if the layer has line-z-offset enabled.`):zt?o.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${l.id}.`):Ve(p,Ce,ot,pr.disabled,!1,!0)}if(l.hasElevatedBuckets){M==="hd-road-markup"?B||(ot=Tt,Ce.push("ELEVATED_ROADS")):(Ce.push("ELEVATED"),ot=Tt,Q&&Ce.push(J?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),N&&Ce.push("ELEVATION_REFERENCE_SEA"));const zt=et?f.stencilModeFor3D():pr.disabled;f.forceTerrainMode=!0,Ve(p,Ce,ot,zt,!0,!0),et&&Ve(p,Ce,ot,zt,!0,!1),f.forceTerrainMode=!1}et&&(f.resetStencilClippingMasks(),de&&j.clear({stencil:0})),A===0||f.depthOcclusion||de||f.layersWithOcclusionOpacity.push(f.currentLayer)},fill:function(f,n,l,p){const y=l.paint.get("fill-color"),x=l.paint.get("fill-opacity");if(x.constantOr(1)===0)return;const b=l.paint.get("fill-emissive-strength"),T=f.colorModeForDrapableLayerRenderPass(b),A=l.paint.get("fill-pattern"),M=f.opaquePassEnabledForLayer()&&!A.constantOr(1)&&y.constantOr(o.ao.transparent).a===1&&x.constantOr(0)===1?"opaque":"translucent";let D="none";l.layout.get("fill-elevation-reference")!=="none"?D="road":l.paint.get("fill-z-offset").constantOr(1)!==0&&(D="offset");const N=!(!f.terrain||!f.terrain.enabled),B={painter:f,sourceCache:n,layer:l,coords:p,colorMode:T,elevationType:D,terrainEnabled:N,pass:M};if(f.renderPass==="shadow")return void(f.shadowRenderer&&D==="road"&&!N&&function(H){const{painter:G,sourceCache:Q,layer:J,coords:ae}=H,de=G.context.gl,ce=H.painter.shadowRenderer;for(const Se of ae){const ye=Q.getTile(Se),we=ye.getBucket(J);if(!we)continue;const _e=we.elevatedStructures;if(!_e||!_e.shadowCasterSegments||_e.shadowCasterSegments.segments[0].primitiveLength===0)continue;G.prepareDrawTile();const pe=we.bufferData.programConfigurations.get(J.id),Te=G.isTileAffectedByFog(Se),De=G.getOrCreateProgram("elevatedStructuresDepth",{config:pe,overrideFog:Te}),Me=ce.calculateShadowPassMatrixFromTile(ye.tileID.toUnwrapped());G.uploadCommonUniforms(G.context,De,Se.toUnwrapped());const Ge={u_matrix:Me,u_depth_bias:0};De.draw(G,de.TRIANGLES,ce.getShadowPassDepthMode(),pr.disabled,ce.getShadowPassColorMode(),fr.disabled,Ge,J.id,_e.vertexBuffer,_e.indexBuffer,_e.shadowCasterSegments,J.paint,G.transform.zoom,pe)}}(B));const j=f.emissiveMode==="mrt-fallback";if(D!=="offset"){if(Fp(B,!1,j),D==="road"){const H=!N&&f.renderPass==="translucent";H&&zp(f,n,l,p,"geometry"),Fp(B,!0,j,pr.disabled),H&&function(G){const{painter:Q,sourceCache:J,layer:ae,coords:de,colorMode:ce}=G,Se=Q.context.gl,ye=G.painter.shadowRenderer,we=!!ye&&ye.enabled,_e=new Xt(Q.context.gl.LEQUAL,Xt.ReadOnly,Q.depthRangeFor3D);let pe=[0,0,0];if(we){const De=Q.style.directionalLight,Me=Q.style.ambientLight;De&&Me&&(pe=Cl(Q.style,De,Me))}const Te=De=>{for(const Me of de){const Ge=J.getTile(Me),He=Ge.getBucket(ae);if(!He)continue;const et=He.elevatedStructures;if(!et)continue;let mt,Ne;if(De?(mt=et.renderableBridgeSegments,Ne=et.bridgeProgramConfigurations.get(ae.id)):(mt=et.renderableTunnelSegments,Ne=et.tunnelProgramConfigurations.get(ae.id)),!mt||mt.segments[0].primitiveLength===0)continue;Ne.updatePaintBuffers(),Q.prepareDrawTile();const Ce=Q.isTileAffectedByFog(Me),Ke=[];we&&Ke.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Ve=Q.getOrCreateProgram("elevatedStructures",{config:Ne,overrideFog:Ce,defines:Ke}),ot=Q.translatePosMatrix(Me.projMatrix,Ge,ae.paint.get("fill-translate"),ae.paint.get("fill-translate-anchor"));we&&ye.setupShadows(Ge.tileID.toUnwrapped(),Ve,"vector-tile");const Tt=Tc(ot,pe);Q.uploadCommonUniforms(Q.context,Ve,Me.toUnwrapped()),Ve.draw(Q,Se.TRIANGLES,_e,pr.disabled,ce,fr.backCCW,Tt,ae.id,et.vertexBuffer,et.indexBuffer,mt,ae.paint,Q.transform.zoom,Ne,[et.vertexBufferNormal])}};Te(!0),Te(!1)}(B)}}else Fp(B,!1,j,f.stencilModeFor3D())},"fill-extrusion":function(f,n,l,p){const y=l.paint.get("fill-extrusion-opacity"),x=f.context,b=x.gl,T=f.terrain,A=T&&T.renderingToTexture;if(y===0)return;const M=f.emissiveMode==="mrt-fallback",D=f.conflationActive&&f.style.isLayerClipped(l,n.getSource()),N=f.style.order.indexOf(l.fqid);if(D&&function(B,j,H,G,Q){for(const J of G){const ae=j.getTile(J).getBucket(H);ae&&(ae.updateReplacement(J,B.replacementSource,Q),ae.uploadCentroid(B.context))}}(f,n,l,p,N),T||D)for(const B of p){const j=n.getTile(B).getBucket(l);j&&BS(f.context,n,B,j,l,T,D)}if(f.renderPass==="shadow"&&f.shadowRenderer){const B=f.shadowRenderer;if(T&&y<.65&&l._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof o.ad)return;const j=B.getShadowPassDepthMode(),H=B.getShadowPassColorMode();Bp(f,n,l,p,j,pr.disabled,H,D)}else if(f.renderPass==="translucent"){const B=!l.paint.get("fill-extrusion-pattern").constantOr(1),j=l.paint.get("fill-extrusion-color").constantOr(o.ao.white);if(!A&&j.a!==0){const H=new Xt(f.context.gl.LEQUAL,Xt.ReadWrite,f.depthRangeFor3D);y===1&&B?Bp(f,n,l,p,H,pr.disabled,Er.unblended,D):(Bp(f,n,l,p,H,pr.disabled,Er.disabled,D),Bp(f,n,l,p,H,f.stencilModeFor3D(),f.colorModeForRenderPass(),D),f.resetStencilClippingMasks())}if(f.style.enable3dLights()&&B&&(!T&&f.transform.projection.name!=="globe"||A)){const H=l.paint.get("fill-extrusion-opacity"),G=l.paint.get("fill-extrusion-ambient-occlusion-intensity"),Q=l.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),J=l.paint.get("fill-extrusion-flood-light-intensity"),ae=l.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",de=l.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ae?null:l.lut).toArray01().slice(0,3),ce=G>0&&Q>0,Se=J>0,ye=(pe,Te,De)=>(1-De)*pe+De*Te,we=new H_;we.translate=l.paint.get("fill-extrusion-translate"),we.translateAnchor=l.paint.get("fill-extrusion-translate-anchor"),we.edgeRadius=l.layout.get("fill-extrusion-edge-radius"),we.cutoffFadeRange=l.paint.get("fill-extrusion-cutoff-fade-range");const _e=pe=>{const Te=f.depthModeForSublayer(1,Xt.ReadOnly,b.LEQUAL,!0),De=l.paint.get(pe?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Me=ye(.1,3,De),Ge=f._showOverdrawInspector;if(!Ge){const He=new pr({func:b.ALWAYS,mask:255},255,255,b.KEEP,b.KEEP,b.REPLACE),et=new Er([b.ONE,b.ONE,b.ONE,b.ONE],o.ao.transparent,[!1,!1,!1,!0],b.MIN);Ml(we,f,n,l,p,Te,He,et,fr.disabled,pe,"sdf",H,G,Q,J,de,Me,D,!1)}{const He=Ge?pr.disabled:new pr({func:b.EQUAL,mask:255},255,255,b.KEEP,b.DECR,b.DECR),et=Ge?f.colorModeForRenderPass():new Er([b.ONE_MINUS_DST_ALPHA,b.DST_ALPHA,b.ONE,b.ONE],o.ao.transparent,[!0,!0,!0,!0]);Ml(we,f,n,l,p,Te,He,et,fr.disabled,pe,"color",H,G,Q,J,de,Me,D,!1)}};if(A){const pe=()=>{const De=T.drapeBufferSize[0],Me=T.drapeBufferSize[1];let Ge=T.framebufferCopyTexture;return Ge&&(!Ge||Ge.size[0]===De&&Ge.size[1]===Me)||(Ge&&Ge.destroy(),Ge=T.framebufferCopyTexture=new o.T(x,new o.q({width:De,height:Me}),b.RGBA8)),Ge.bind(b.LINEAR,b.CLAMP_TO_EDGE),b.copyTexSubImage2D(b.TEXTURE_2D,0,0,0,0,0,De,Me),Ge},Te=(De,Me,Ge)=>{const He=f.depthModeForSublayer(1,Xt.ReadOnly,b.LEQUAL,!1),et=l.paint.get(De?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),mt=ye(.1,3,et);{const Ne=new Er([b.ONE,b.ONE,b.ONE,b.ONE],o.ao.transparent,[!1,!1,!1,!0]);Ml(we,f,n,l,p,He,pr.disabled,Ne,fr.disabled,De,"clear",H,G,Q,J,de,mt,D,Me)}{const Ne=new pr({func:b.ALWAYS,mask:255},255,255,b.KEEP,b.KEEP,b.REPLACE),Ce=new Er([b.ONE,b.ONE,b.ONE,b.ONE],o.ao.transparent,[!1,!1,!1,!0],b.MIN);Ml(we,f,n,l,p,He,Ne,Ce,fr.disabled,De,"sdf",H,G,Q,J,de,mt,D,Me)}M&&!De&&(Ge=pe());{const Ne=De?b.ZERO:b.ONE_MINUS_DST_ALPHA,Ce=new pr({func:b.EQUAL,mask:255},255,255,b.KEEP,b.DECR,b.DECR),Ke=new Er([Ne,b.DST_ALPHA,b.ONE_MINUS_DST_ALPHA,b.ZERO],o.ao.transparent,[!0,!0,!0,!0]);Ml(we,f,n,l,p,He,Ce,Ke,fr.disabled,De,"color",H,G,Q,J,de,mt,D,Me)}if(!M||De){const Ne=new Er([b.ONE,b.ONE,b.ONE,De?b.ZERO:b.ONE],o.ao.transparent,[!1,!1,!1,!0],De?b.FUNC_ADD:b.MAX);Ml(we,f,n,l,p,He,pr.disabled,Ne,fr.disabled,De,"clear",H,G,Q,J,de,mt,D,Me,Ge)}else{b.drawBuffers([b.NONE,b.COLOR_ATTACHMENT1]);const Ne=new pr({func:b.EQUAL,mask:255},254,255,b.KEEP,b.DECR,b.DECR),Ce=new Er([b.ONE,b.ONE,b.ONE,b.ONE],o.ao.transparent,[!0,!1,!1,!1],b.MAX);Ml(we,f,n,l,p,He,Ne,Ce,fr.disabled,De,"emissive",H,G,Q,J,de,mt,D,Me,Ge),b.drawBuffers([b.COLOR_ATTACHMENT0])}};if(ce||Se){let De;f.prepareDrawTile(),M&&!ce||(De=pe()),ce&&Te(!0,!1,De),Se&&Te(!1,!0,De)}}else ce&&_e(!0),Se&&_e(!1),(ce||Se)&&f.resetStencilClippingMasks()}}},building:function(f,n,l,p){f.currentLayer<f.firstLightBeamLayer&&(f.firstLightBeamLayer=f.currentLayer);const y=l.paint.get("building-ambient-occlusion-ground-intensity"),x=l.paint.get("building-ambient-occlusion-ground-radius"),b=l.paint.get("building-ambient-occlusion-ground-attenuation"),T=l.paint.get("building-opacity");if(T<=0)return;let A=y>0&&x>0,M=!0;const D=l.paint.get("building-vertical-scale");if(D<=0)return;f.shadowRenderer||(M=!1);const N=f.conflationActive&&f.style.isLayerClipped(l,n.getSource()),B=f.style.order.indexOf(l.fqid);if(function(j,H,G,Q,J,ae){for(const de of ae){const ce=H.getTile(de).getBucket(G);ce&&(J&&ce.updateReplacement(de,j.replacementSource,Q),ce.uploadUpdatedIndexBuffer(j.context))}}(f,n,l,B,N,p),function(j,H,G,Q){for(const J of Q){const ae=H.getTile(J).getBucket(G);ae&&ae.needsEvaluation()&&ae.uploadUpdatedColorBuffer(j.context)}}(f,n,l,p),l.resetLayerRenderingStats(f),f.shadowRenderer&&(f.shadowRenderer.useNormalOffset=!0),f.renderPass==="shadow"&&f.shadowRenderer){const j=f.shadowRenderer,H=[],G=j.getShadowPassDepthMode();jh({painter:f,source:n,layer:l,coords:p,defines:H,blendMode:j.getShadowPassColorMode(),depthMode:G,opacity:T,verticalScale:D,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(f.renderPass==="translucent"){let j=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];M&&(j=j.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),f.shadowRenderer&&f.shadowRenderer.useNormalOffset&&(j=j.concat("NORMAL_OFFSET"));const H=l.paint.get("building-facade-emissive-chance"),G=l.paint.get("building-ambient-occlusion-intensity"),Q=l.paint.get("building-flood-light-intensity"),J=l.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",ae=l.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(J?null:l.lut).toArray01().slice(0,3),de=l.paint.get("building-flood-light-ground-attenuation"),ce=Q>0,Se=new Xt(f.context.gl.LEQUAL,Xt.ReadWrite,f.depthRangeFor3D);T<1&&jh({painter:f,source:n,layer:l,coords:p,defines:j,blendMode:Er.disabled,depthMode:Se,opacity:T,verticalScale:D,facadeEmissiveChance:H,facadeAOIntensity:G,floodLightIntensity:Q,floodLightColor:ae,depthOnly:!0});const ye=f.colorModeForRenderPass();jh({painter:f,source:n,layer:l,coords:p,defines:j,blendMode:ye,depthMode:Se,opacity:T,verticalScale:D,facadeEmissiveChance:H,facadeAOIntensity:G,floodLightIntensity:Q,floodLightColor:ae}),A&&Np(f,n,l,p,!0,T,y,x,Q,ae,b,N),ce&&Np(f,n,l,p,!1,T,y,x,Q,ae,de,N)}else if(f.renderPass==="light-beam"){const j=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],H=new Xt(f.context.gl.LEQUAL,Xt.ReadOnly,f.depthRangeFor3D);jh({painter:f,source:n,layer:l,coords:p,defines:j,blendMode:Er.alphaBlended,depthMode:H,opacity:T,verticalScale:D,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}f.shadowRenderer&&(f.shadowRenderer.useNormalOffset=!1),f.resetStencilClippingMasks()},hillshade:function(f,n,l,p){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent"||f.style.disableElevatedTerrain)return;const y=f.context,x=f.terrain&&f.terrain.renderingToTexture,[b,T]=f.renderPass!=="translucent"||x?[{},p]:f.stencilConfigForOverlap(p);for(const A of T){const M=n.getTile(A);if(M.needsHillshadePrepare&&f.renderPass==="offscreen")CS(f,M,l);else if(f.renderPass==="translucent"){const D=f.depthModeForSublayer(0,Xt.ReadOnly),N=l.paint.get("hillshade-emissive-strength"),B=f.colorModeForDrapableLayerRenderPass(N),j=x&&f.terrain?f.terrain.stencilModeForRTTOverlap(A):b[A.overscaledZ];AS(f,A,M,l,D,j,B)}}y.viewport.set([0,0,f.width,f.height]),f.resetStencilClippingMasks()},raster:function(f,n,l,p,y,x){if(f.renderPass!=="translucent"||l.paint.get("raster-opacity")===0)return;const b=f.transform.projection.name==="globe",T=l.paint.get("raster-elevation")!==0,A=T&&b;if(f.renderElevatedRasterBackface&&!A)return;const M=f.context,D=M.gl,N=n.getSource(),B=function(ye,we,_e,pe,Te){const De=we.paint.get("raster-color"),Me=ye.type==="raster-array",Ge=[],He=we.paint.get("raster-resampling"),et=we.paint.get("raster-color-mix");let mt=we.paint.get("raster-color-range");const Ne=[et[0],et[1],et[2],0],Ce=et[3];let Ke=He==="nearest"?pe.NEAREST:pe.LINEAR;if(Me&&(Ge.push("RASTER_ARRAY"),De||Ge.push("RASTER_COLOR"),He==="linear"&&Ge.push("RASTER_ARRAY_LINEAR"),Ke=pe.NEAREST,!mt&&ye.rasterLayers)){const Ve=ye.rasterLayers.find(({id:ot})=>ot===we.sourceLayer);Ve&&Ve.fields&&Ve.fields.range&&(mt=Ve.fields.range)}if(mt=mt||[0,1],De){Ge.push("RASTER_COLOR"),_e.activeTexture.set(pe.TEXTURE2),we.updateColorRamp(mt);let Ve=we.colorRampTexture;Ve||(Ve=we.colorRampTexture=new o.T(_e,we.colorRamp,pe.RGBA8)),Ve.bind(pe.LINEAR,pe.CLAMP_TO_EDGE)}return Te&&Ge.push("USE_MRT1"),{mix:Ne,range:mt,offset:Ce,defines:Ge,resampling:Ke}}(N,l,M,D,f.terrain&&f.terrain.renderingToTexture&&f.emissiveMode==="mrt-fallback");if(N instanceof o.aU&&!p.length&&!b)return;const j=l.paint.get("raster-emissive-strength"),H=f.colorModeForDrapableLayerRenderPass(j),G=f.terrain&&f.terrain.renderingToTexture,Q=!f.options.moving,J=l.paint.get("raster-resampling")==="nearest"?D.NEAREST:D.LINEAR;if(N instanceof o.aU&&!p.length&&(N.onNorthPole||N.onSouthPole)){const ye=T?f.stencilModeFor3D():pr.disabled;return void Vh(!!N.onNorthPole,null,f,n,l,j,B,fr.disabled,ye)}if(!p.length)return;const[ae,de]=N instanceof o.aU||G?[{},p]:f.stencilConfigForOverlap(p),ce=de[de.length-1].overscaledZ;A&&B.defines.push("PROJECTION_GLOBE_VIEW"),T&&B.defines.push("RENDER_CUTOFF");const Se=(ye,we,_e)=>{for(const pe of ye){const Te=pe.toUnwrapped(),De=n.getTile(pe);if(G&&(!De||!De.hasData()))continue;M.activeTexture.set(D.TEXTURE0);const Me=Dl(De,N,l,B);if(!Me||!Me.texture)continue;const{texture:Ge,mix:He,offset:et,tileSize:mt,buffer:Ne}=Me;let Ce,Ke;G?(Ce=Xt.disabled,Ke=pe.projMatrix):T?(Ce=new Xt(D.LEQUAL,Xt.ReadWrite,f.depthRangeFor3D),Ke=b?Float32Array.from(f.transform.expandedFarZProjMatrix):f.transform.calculateProjMatrix(Te,Q)):(Ce=f.depthModeForSublayer(pe.overscaledZ-ce,l.paint.get("raster-opacity")===1?Xt.ReadWrite:Xt.ReadOnly,D.LESS),Ke=f.transform.calculateProjMatrix(Te,Q));const Ve=f.terrain&&G?f.terrain.stencilModeForRTTOverlap(pe):ae[pe.overscaledZ],ot=x?0:l.paint.get("raster-fade-duration");De.registerFadeDuration(ot);const Tt=n.findLoadedParent(pe,0),zt=Oh(De,Tt,n,f.transform,ot);let wt,gt;!zt.isFading&&De.refreshedUponExpiration&&(De.refreshedUponExpiration=!1),f.terrain&&f.terrain.prepareDrawTile(),M.activeTexture.set(D.TEXTURE0),Ge.bind(J,D.CLAMP_TO_EDGE),M.activeTexture.set(D.TEXTURE1),Tt?(Tt.texture&&Tt.texture.bind(J,D.CLAMP_TO_EDGE),wt=Math.pow(2,Tt.tileID.overscaledZ-De.tileID.overscaledZ),gt=[De.tileID.canonical.x*wt%1,De.tileID.canonical.y*wt%1]):Ge.bind(J,D.CLAMP_TO_EDGE),"useMipmap"in Ge&&M.extTextureFilterAnisotropic&&f.transform.pitch>20&&D.texParameterf(D.TEXTURE_2D,M.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,M.extTextureFilterAnisotropicMax);const Kt=f.transform;let $t;const Dt=T?bx(Kt):[0,0,0,0];let Bt,nr,xr,Ur,dn,Zt=0;if(A&&N instanceof o.aU&&N.coordinates.length>3)Bt=Float32Array.from(o.bk(o.dJ(new o.cD(0,0,0)))),nr=Float32Array.from(Kt.globeMatrix),xr=Float32Array.from(o.dF(Kt)),Ur=[o.aF(Kt.center.lng),o.aJ(Kt.center.lat)],$t=N.elevatedGlobePerspectiveTransform,dn=N.elevatedGlobeGridMatrix||new Float32Array(9);else if(A){const An=o.dG(pe.canonical);Zt=o.dH(An.getCenter().lat),Bt=Float32Array.from(o.bk(o.dJ(pe.canonical))),nr=Float32Array.from(Kt.globeMatrix),xr=Float32Array.from(o.dF(Kt)),Ur=[o.aF(Kt.center.lng),o.aJ(Kt.center.lat)],$t=[0,0],dn=Float32Array.from(o.dI(pe.canonical,An,Zt,Kt.worldSize/Kt._pixelsPerMercatorPixel))}else $t=N instanceof o.aU?N.perspectiveTransform:[0,0],Bt=new Float32Array(16),nr=new Float32Array(9),xr=new Float32Array(16),Ur=[0,0],dn=new Float32Array(9);const an=mx(Ke,Bt,nr,xr,dn,gt||[0,0],o.aj(f.transform.zoom),Ur,Dt,wt||1,zt,l,$t,T?l.paint.get("raster-elevation"):0,2,He,et,B.range,mt,Ne,j),vr=f.isTileAffectedByFog(pe),pn=f.getOrCreateProgram("raster",{defines:B.defines,overrideFog:vr});if(f.uploadCommonUniforms(M,pn,Te),N instanceof o.aU){const An=N.elevatedGlobeVertexBuffer,bn=N.elevatedGlobeIndexBuffer;if(G||!b)N.boundsBuffer&&N.boundsSegments&&pn.draw(f,D.TRIANGLES,Ce,pr.disabled,H,fr.disabled,an,l.id,N.boundsBuffer,f.quadTriangleIndexBuffer,N.boundsSegments);else if(An&&bn){const sn=Kt.zoom<=o.c_?N.elevatedGlobeSegments:N.getSegmentsForLongitude(Kt.center.lng);sn&&pn.draw(f,D.TRIANGLES,Ce,pr.disabled,H,we,an,l.id,An,bn,sn)}}else if(A){Ce=new Xt(D.LEQUAL,Xt.ReadOnly,f.depthRangeFor3D);const An=f.globeSharedBuffers;if(An){const[bn,sn,Ar]=An.getGridBuffers(Zt,!1);pn.draw(f,D.TRIANGLES,Ce,_e||Ve,f.colorModeForRenderPass(),we,an,l.id,bn,sn,Ar)}}else{const{tileBoundsBuffer:An,tileBoundsIndexBuffer:bn,tileBoundsSegments:sn}=f.getTileBoundsBuffers(De);pn.draw(f,D.TRIANGLES,Ce,Ve,H,fr.disabled,an,l.id,An,bn,sn)}}if(!(N instanceof o.aU)&&A)for(const pe of ye){const Te=pe.canonical.y===(1<<pe.canonical.z)-1;pe.canonical.y===0&&Vh(!0,pe,f,n,l,j,B,we,_e||pr.disabled),Te&&Vh(!1,pe,f,n,l,j,B,we===fr.frontCW?fr.backCW:fr.frontCW,_e||pr.disabled)}};A?Se(de,f.renderElevatedRasterBackface?fr.backCW:fr.frontCW,f.stencilModeFor3D()):Se(de,fr.disabled,void 0),f.resetStencilClippingMasks()},"raster-particle":function(f,n,l,p,y,x){f.renderPass==="offscreen"&&function(b,T,A,M){if(!M.length)return;const D=b.context,N=D.gl,B=T.getSource();if(!(B instanceof Ys))return;const j=Math.ceil(Math.sqrt(A.paint.get("raster-particle-count")));let H=A.particlePositionRGBAImage;if(!H||H.width!==j){const de=function(ce){const Se=ce*ce,ye=new Uint8Array(4*Se),we=function(pe){return pe|=0,pe=Math.imul(2747636419^pe,2654435769),pe=Math.imul(pe^pe>>>16,2654435769),((pe=Math.imul(pe^pe>>>16,2654435769))>>>0)/4294967296},_e=1/1.1;for(let pe=0;pe<Se;pe++){const Te=_e*(we(2*pe+0)+al),De=_e*(we(2*pe+1)+al),Me=255*Te%1,Ge=255*De%1,He=Me,et=De-Ge/255,mt=Ge;ye[4*pe+0]=255*(Te-Me/255),ye[4*pe+1]=255*He,ye[4*pe+2]=255*et,ye[4*pe+3]=255*mt}return ye}(j);H=A.particlePositionRGBAImage=new o.q({width:j,height:j},de)}let G=A.particleFramebuffer;G?G.width!==j&&(G.destroy(),G=A.particleFramebuffer=D.createFramebuffer(j,j,1,null)):G=A.particleFramebuffer=D.createFramebuffer(j,j,1,null);const Q=[];for(const de of M){const ce=T.getTile(de);if(!(ce instanceof Qf))continue;const Se=q_(ce,B,A);if(!Se)continue;const ye=[ce.tileSize,ce.tileSize];let we=A.tileFramebuffer;we||(we=A.tileFramebuffer=D.createFramebuffer(ye[0],ye[1],1,null));let _e=ce.rasterParticleState;_e||(_e=ce.rasterParticleState=new Vp(D,de,ye,H));const pe=_e.update(A.lastInvalidatedAt);_e.particleTextureDimension!==j&&_e.updateParticleTexture(de,H);const Te=_e.targetColorTexture;_e.targetColorTexture=_e.backgroundColorTexture,_e.backgroundColorTexture=Te;const De=_e.particleTexture0;_e.particleTexture0=_e.particleTexture1,_e.particleTexture1=De,Q.push([de,Se,_e,pe])}if(Q.length===0)return;const J=o.o.now(),ae=A.previousDrawTimestamp?.001*(J-A.previousDrawTimestamp):.0167;if(A.previousDrawTimestamp=J,A.hasColorMap()){D.activeTexture.set(N.TEXTURE0+2);let de=A.colorRampTexture;de||(de=A.colorRampTexture=new o.T(D,A.colorRamp,N.RGBA8)),de.bind(N.LINEAR,N.CLAMP_TO_EDGE)}D.bindFramebuffer.set(A.tileFramebuffer.framebuffer),function(de,ce,Se){const ye=de.context,we=ye.gl,_e=ce.tileFramebuffer;ye.activeTexture.set(we.TEXTURE0);const pe={u_texture:0,u_opacity:1.05*(De=ce.paint.get("raster-particle-fade-opacity-factor"))/(De+.05)},Te=de.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var De;for(const Me of Se){const[,,Ge,He]=Me;_e.colorAttachment0.set(Ge.targetColorTexture.texture),ye.viewport.set([0,0,_e.width,_e.height]),ye.clear({color:o.ao.transparent}),He&&(Ge.backgroundColorTexture.bind(we.NEAREST,we.CLAMP_TO_EDGE),Te.draw(de,we.TRIANGLES,Xt.disabled,pr.disabled,Er.alphaBlended,fr.disabled,pe,ce.id,de.viewportBuffer,de.quadTriangleIndexBuffer,de.viewportSegments))}}(b,A,Q),function(de,ce,Se,ye){const we=de.context,_e=we.gl,pe=Se.tileFramebuffer,Te=de.transform.projection.name==="globe",De=Se.paint.get("raster-particle-max-speed");for(const Me of ye){const[Ge,He,et]=Me;we.activeTexture.set(_e.TEXTURE0+0),He.texture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE),pe.colorAttachment0.set(et.targetColorTexture.texture);const mt=de.getOrCreateProgram("rasterParticleDraw",{defines:He.defines,overrideFog:!1});we.activeTexture.set(_e.TEXTURE0+1);const Ne=He.scalarData?[]:[0,1,2,3].map(Ve=>o.e9[Ve](Ge));Ne.push(Ge);const Ce=Ge.canonical.x,Ke=Ge.canonical.y;for(const Ve of Ne){const ot=ce.getTile(Te?Ve.wrapped():Ve);if(!ot)continue;const Tt=ot.rasterParticleState;if(!Tt)continue;const zt=Ve.canonical.x+(1<<Ve.canonical.z)*(Ve.wrap-Ge.wrap),wt=Ve.canonical.y;Tt.particleTexture0.bind(_e.NEAREST,_e.CLAMP_TO_EDGE);const gt=FS(1,Tt.particleTexture0.size[0],[zt-Ce,wt-Ke],0,He.texture.size,2,De,He.textureOffset,He.scale,He.offset);mt.draw(de,_e.POINTS,Xt.disabled,pr.disabled,Er.alphaBlended,fr.disabled,gt,Se.id,Tt.particleIndexBuffer,void 0,Tt.particleSegment)}}}(b,T,A,Q),D.bindFramebuffer.set(A.particleFramebuffer.framebuffer),function(de,ce,Se,ye){const we=de.context,_e=we.gl,pe=ce.paint.get("raster-particle-max-speed"),Te=ye*ce.paint.get("raster-particle-speed-factor")*.15,De=function(Ge){return Math.pow(Ge,6)}(.01+1*ce.paint.get("raster-particle-reset-rate-factor")),Me=ce.particleFramebuffer;we.viewport.set([0,0,Me.width,Me.height]);for(const Ge of Se){const[,He,et]=Ge;we.activeTexture.set(_e.TEXTURE0+0),He.texture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE),we.activeTexture.set(_e.TEXTURE0+1);const mt=et.particleTexture0;mt.bind(_e.NEAREST,_e.CLAMP_TO_EDGE);const Ne=_x(1,mt.size[0],0,He.texture.size,pe,Te,De,He.textureOffset,He.scale,He.offset);Me.colorAttachment0.set(et.particleTexture1.texture),we.clear({color:o.ao.transparent}),de.getOrCreateProgram("rasterParticleUpdate",{defines:He.defines}).draw(de,_e.TRIANGLES,Xt.disabled,pr.disabled,Er.unblended,fr.disabled,Ne,ce.id,de.viewportBuffer,de.quadTriangleIndexBuffer,de.viewportSegments)}}(b,A,Q,ae)}(f,n,l,p),f.renderPass==="translucent"&&(function(b,T,A,M,D){const N=b.context,B=N.gl,j=T.getSource().tileSize,H=5*(1-o.ah(o.cL,o.cL+1,b.transform.zoom))*j+A.paint.get("raster-particle-elevation"),G=!b.options.moving,Q=b.transform.projection.name==="globe";if(!M.length)return;const[J,ae]=b.stencilConfigForOverlap(M),de=[];Q&&de.push("PROJECTION_GLOBE_VIEW");const ce=b.stencilModeFor3D();for(const Se of ae){const ye=Se.toUnwrapped(),we=T.getTile(Se);if(!we.rasterParticleState)continue;const _e=we.rasterParticleState,pe=100;we.registerFadeDuration(pe);const Te=T.findLoadedParent(Se,0),De=Oh(we,Te,T,b.transform,pe);let Me,Ge;b.terrain&&b.terrain.prepareDrawTile(),N.activeTexture.set(B.TEXTURE0),_e.targetColorTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),N.activeTexture.set(B.TEXTURE1),Te&&Te.rasterParticleState?(Te.rasterParticleState.targetColorTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),Me=Math.pow(2,Te.tileID.overscaledZ-we.tileID.overscaledZ),Ge=[we.tileID.canonical.x*Me%1,we.tileID.canonical.y*Me%1]):_e.targetColorTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE);const He=Q?Float32Array.from(b.transform.expandedFarZProjMatrix):b.transform.calculateProjMatrix(ye,G),et=b.transform,mt=Sx(et),Ne=o.dG(Se.canonical),Ce=o.dH(Ne.getCenter().lat);let Ke,Ve,ot,Tt,zt;Q?(Ke=Float32Array.from(o.bk(o.dJ(Se.canonical))),Ve=Float32Array.from(et.globeMatrix),ot=Float32Array.from(o.dF(et)),Tt=[o.aF(et.center.lng),o.aJ(et.center.lat)],zt=Float32Array.from(o.dI(Se.canonical,Ne,Ce,et.worldSize/et._pixelsPerMercatorPixel))):(Ke=new Float32Array(16),Ve=new Float32Array(9),ot=new Float32Array(16),Tt=[0,0],zt=new Float32Array(9));const wt=zS(He,Ke,Ve,ot,zt,Ge||[0,0],o.aj(b.transform.zoom),Tt,mt,Me||1,De,H),gt=b.isTileAffectedByFog(Se),Kt=b.getOrCreateProgram("rasterParticle",{defines:de,overrideFog:gt});if(b.uploadCommonUniforms(N,Kt,ye),Q){const $t=new Xt(B.LEQUAL,Xt.ReadOnly,b.depthRangeFor3D),Dt=0,Bt=b.globeSharedBuffers;if(Bt){const[nr,xr,Ur]=Bt.getGridBuffers(Ce,Dt!==0);Kt.draw(b,B.TRIANGLES,$t,ce,Er.alphaBlended,b.renderElevatedRasterBackface?fr.frontCCW:fr.backCCW,wt,A.id,nr,xr,Ur)}}else{const $t=b.depthModeForSublayer(0,Xt.ReadOnly),Dt=J[Se.overscaledZ],{tileBoundsBuffer:Bt,tileBoundsIndexBuffer:nr,tileBoundsSegments:xr}=b.getTileBoundsBuffers(we);Kt.draw(b,B.TRIANGLES,$t,Dt,Er.alphaBlended,fr.disabled,wt,A.id,Bt,nr,xr)}}b.resetStencilClippingMasks()}(f,n,l,p),f.style.map.triggerRepaint())},background:function(f,n,l,p){const y=l.paint.get("background-color"),x=l.paint.get("background-color-use-theme").constantOr("default")==="none",b=l.paint.get("background-opacity"),T=l.paint.get("background-emissive-strength"),A=l.paint.get("background-pitch-alignment")==="viewport";if(b===0)return;const M=f.context,D=M.gl,N=f.transform,B=N.tileSize,j=l.paint.get("background-pattern");let H;if(j!==void 0&&(j===null||(H=f.imageManager.getPattern(o.I.from(j.toString()),l.scope,f.style.getLut(l.scope)),!H)))return;const G=!j&&y.a===1&&b===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==G)return;const Q=pr.disabled,J=f.depthModeForSublayer(0,G==="opaque"?Xt.ReadWrite:Xt.ReadOnly),ae=f.colorModeForDrapableLayerRenderPass(T),de=j?"backgroundPattern":"background";let ce,Se=p;Se||(ce=f.getBackgroundTiles(),Se=Object.values(ce).map(we=>we.tileID)),j&&(M.activeTexture.set(D.TEXTURE0),f.imageManager.bind(f.context,l.scope));const ye=[];if(f.terrain&&f.terrain.renderingToTexture&&f.emissiveMode==="mrt-fallback"&&ye.push("USE_MRT1"),A){const we=f.getOrCreateProgram(de,{overrideFog:!1,overrideRtt:!0,defines:ye}),_e=new Float32Array(o.bA([])),pe=new o.aQ(0,0,0,0,0),Te=j?kc(_e,T,b,f,0,l.scope,H,A,{tileID:pe,tileSize:B}):Fh(_e,T,b,y.toPremultipliedRenderColor(x?null:l.lut));we.draw(f,D.TRIANGLES,J,Q,ae,fr.disabled,Te,l.id,f.viewportBuffer,f.quadTriangleIndexBuffer,f.viewportSegments)}else for(const we of Se){const _e=f.isTileAffectedByFog(we),pe=f.getOrCreateProgram(de,{overrideFog:_e,defines:ye}),Te=we.toUnwrapped(),De=p?we.projMatrix:f.transform.calculateProjMatrix(Te);f.prepareDrawTile();const Me=n?n.getTile(we):ce?ce[we.key]:new ru(we,B,N.zoom,f),Ge=j?kc(De,T,b,f,0,l.scope,H,A,{tileID:we,tileSize:B}):Fh(De,T,b,y.toPremultipliedRenderColor(x?null:l.lut));f.uploadCommonUniforms(M,pe,Te);const{tileBoundsBuffer:He,tileBoundsIndexBuffer:et,tileBoundsSegments:mt}=f.getTileBoundsBuffers(Me);pe.draw(f,D.TRIANGLES,J,Q,ae,fr.disabled,Ge,l.id,He,et,mt)}},sky:function(f,n,l){const p=f._atmosphere?o.aj(f.transform.zoom):1,y=l.paint.get("sky-opacity")*p;if(y===0)return;const x=f.context,b=l.paint.get("sky-type"),T=new Xt(x.gl.LEQUAL,Xt.ReadOnly,[0,1]),A=f.frameCounter/1e3%1;b==="atmosphere"?f.renderPass==="offscreen"?l.needsSkyboxCapture(f)&&(function(M,D,N,B){const j=M.context,H=j.gl;let G=D.skyboxFbo;if(!G){G=D.skyboxFbo=j.createFramebuffer(32,32,1,null),D.skyboxGeometry=new $p(j),D.skyboxTexture=j.gl.createTexture(),H.bindTexture(H.TEXTURE_CUBE_MAP,D.skyboxTexture),H.texParameteri(H.TEXTURE_CUBE_MAP,H.TEXTURE_WRAP_S,H.CLAMP_TO_EDGE),H.texParameteri(H.TEXTURE_CUBE_MAP,H.TEXTURE_WRAP_T,H.CLAMP_TO_EDGE),H.texParameteri(H.TEXTURE_CUBE_MAP,H.TEXTURE_MIN_FILTER,H.LINEAR),H.texParameteri(H.TEXTURE_CUBE_MAP,H.TEXTURE_MAG_FILTER,H.LINEAR);for(let de=0;de<6;++de)H.texImage2D(H.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,H.RGBA,32,32,0,H.RGBA,H.UNSIGNED_BYTE,null)}j.bindFramebuffer.set(G.framebuffer),j.viewport.set([0,0,32,32]);const Q=D.getCenter(M,!0),J=M.getOrCreateProgram("skyboxCapture"),ae=new Float64Array(16);o.bA(ae),o.en(ae,ae,.5*-Math.PI),mu(M,D,J,ae,Q,0),o.bA(ae),o.en(ae,ae,.5*Math.PI),mu(M,D,J,ae,Q,1),o.bA(ae),o.cU(ae,ae,.5*-Math.PI),mu(M,D,J,ae,Q,2),o.bA(ae),o.cU(ae,ae,.5*Math.PI),mu(M,D,J,ae,Q,3),o.bA(ae),mu(M,D,J,ae,Q,4),o.bA(ae),o.en(ae,ae,Math.PI),mu(M,D,J,ae,Q,5),j.viewport.set([0,0,M.width,M.height])}(f,l),l.markSkyboxValid(f)):f.renderPass==="sky"&&function(M,D,N,B,j){const H=M.context,G=H.gl,Q=M.transform,J=M.getOrCreateProgram("skybox");H.activeTexture.set(G.TEXTURE0),G.bindTexture(G.TEXTURE_CUBE_MAP,D.skyboxTexture);const ae=((de,ce,Se,ye,we)=>({u_matrix:de,u_sun_direction:ce,u_cubemap:0,u_opacity:ye,u_temporal_offset:we}))(Q.skyboxMatrix,D.getCenter(M,!1),0,B,j);M.uploadCommonUniforms(H,J),J.draw(M,G.TRIANGLES,N,pr.disabled,M.colorModeForRenderPass(),fr.backCW,ae,"skybox",D.skyboxGeometry.vertexBuffer,D.skyboxGeometry.indexBuffer,D.skyboxGeometry.segment)}(f,l,T,y,A):b==="gradient"&&f.renderPass==="sky"&&function(M,D,N,B,j){const H=M.context,G=H.gl,Q=M.transform,J=M.getOrCreateProgram("skyboxGradient");D.skyboxGeometry||(D.skyboxGeometry=new $p(H)),H.activeTexture.set(G.TEXTURE0);let ae=D.colorRampTexture;ae||(ae=D.colorRampTexture=new o.T(H,D.colorRamp,G.RGBA8)),ae.bind(G.LINEAR,G.CLAMP_TO_EDGE);const de=((ce,Se,ye,we,_e)=>({u_matrix:ce,u_color_ramp:0,u_center_direction:Se,u_radius:o.an(ye),u_opacity:we,u_temporal_offset:_e}))(Q.skyboxMatrix,D.getCenter(M,!1),D.paint.get("sky-gradient-radius"),B,j);M.uploadCommonUniforms(H,J),J.draw(M,G.TRIANGLES,N,pr.disabled,M.colorModeForRenderPass(),fr.backCW,de,"skyboxGradient",D.skyboxGeometry.vertexBuffer,D.skyboxGeometry.indexBuffer,D.skyboxGeometry.segment)}(f,l,T,y,A)},custom:function(f,n,l,p){const y=f.context,x=l.implementation;if(!f.transform.projection.unsupportedLayers||!f.transform.projection.unsupportedLayers.includes("custom")||f.terrain&&(f.terrain.renderingToTexture||f.renderPass==="offscreen")&&l.isDraped(n)){if(f.renderPass==="offscreen"){const b=x.prerender;if(b){if(f.setCustomLayerDefaults(),y.setColorMode(f.colorModeForRenderPass()),f.transform.projection.name==="globe"){const T=f.transform.pointMerc;b.call(x,y.gl,f.transform.customLayerMatrix(),f.transform.getProjection(),f.transform.globeToMercatorMatrix(),o.aj(f.transform.zoom),[T.x,T.y],f.transform.pixelsPerMeterRatio)}else b.call(x,y.gl,f.transform.customLayerMatrix());y.setDirty(),f.setBaseState()}}else if(f.renderPass==="translucent"){if(f.terrain&&f.terrain.renderingToTexture){const T=x.renderToTile;if(T){const A=p[0].canonical,M={x:A.x+p[0].wrap*(x.wrapTileId?0:1<<A.z),y:A.y,z:A.z};y.setDepthMode(Xt.disabled),y.setStencilMode(pr.disabled),y.setColorMode(f.colorModeForRenderPass()),f.setCustomLayerDefaults(),T.call(x,y.gl,M),y.setDirty(),f.setBaseState()}return}f.setCustomLayerDefaults(),y.setColorMode(f.colorModeForRenderPass()),y.setStencilMode(pr.disabled);const b=x.renderingMode==="3d"?new Xt(f.context.gl.LEQUAL,Xt.ReadWrite,f.depthRangeFor3D):f.depthModeForSublayer(0,Xt.ReadOnly);if(y.setDepthMode(b),f.transform.projection.name==="globe"){const T=f.transform.pointMerc;x.render(y.gl,f.transform.customLayerMatrix(),f.transform.getProjection(),f.transform.globeToMercatorMatrix(),o.aj(f.transform.zoom),[T.x,T.y],f.transform.pixelsPerMeterRatio)}else x.render(y.gl,f.transform.customLayerMatrix());y.setDirty(),f.setBaseState(),y.bindFramebuffer.set(null)}}else o.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(f,n,l,p){if(f.renderPass==="opaque")return;const y=l.paint.get("model-opacity").constantOr(1),x=l.paint.get("model-elevation-reference"),b=x==="ground",T=x==="ground";if(y===0)return;const A=l.paint.get("model-cast-shadows");if(f.renderPass==="shadow"&&(!A||f.terrain&&y<.65&&l._transitionablePaint._values["model-opacity"].value.expression instanceof o.ad))return;const M=f.shadowRenderer,D=l.paint.get("model-receive-shadows");M&&(M.useNormalOffset=!0,D||(M.enabled=!1));const N=()=>{M&&(M.useNormalOffset=!0,D||(M.enabled=!0))},B=n.getSource();if(f.renderPass==="light-beam"&&B.type!=="batched-model")return;if(B.type==="vector"||B.type==="geojson")return function(ce,Se,ye,we,_e){const pe=ce.transform,Te=pe.projection.name==="globe",De=pe.getFreeCameraOptions().position;if(!ce.modelManager)return;const Me=ce.modelManager;ye.modelManager=Me;const Ge=ce.shadowRenderer;if(!ye._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const He=ye._unevaluatedLayout._values["model-id"],et=Object.assign({},ye.layout.get("model-id").parameters),mt=ce.style.order.indexOf(ye.fqid),Ne=ye.paint.get("model-opacity").constantOr(1);for(const Ce of we){const Ke=Se.getTile(Ce).getBucket(ye);if(!Ke||Ke.projection.name!==pe.projection.name)continue;const Ve=Ke.getModelUris();if(Ve&&!Ke.modelsRequested&&(Me.addModelsFromBucket(Ve,_e),Ke.modelsRequested=!0),Te)et.zoom=Ce.overscaledZ;else{const Dt=ho(Ce,pe);et.zoom=Dt}const ot=He.possiblyEvaluate(et);if(Dx(ce,Ke,Ce),cl.shadowUniformsInitialized=!1,cl.useSingleShadowCascade=!!Ge&&Ge.getMaxCascadeForTile(Ce.toUnwrapped())===0,ce.renderPass==="shadow"&&Ge){if(ce.currentShadowCascade===1&&Ke.isInsideFirstShadowMapFrustum)continue;const Dt=pe.calculatePosMatrix(Ce.toUnwrapped(),pe.worldSize);if(cl.tileMatrix.set(Dt),cl.shadowTileMatrix=Float32Array.from(Ge.calculateShadowPassMatrixFromMatrix(Dt)),cl.aabb.min=[0,0,0],cl.aabb.max[0]=cl.aabb.max[1]=o.al,cl.aabb.max[2]=0,VS(Ke,cl,ce,ye.scope))continue}const Tt=1<<Ce.canonical.z,zt=[((De.x-Ce.wrap)*Tt-Ce.canonical.x)*o.al,(De.y*Tt-Ce.canonical.y)*o.al,De.z*Tt*o.al];ce.conflationActive&&Object.keys(Ke.instancesPerModel).length>0&&ce.style.isLayerClipped(ye,Se.getSource())&&Ke.updateReplacement(Ce,ce.replacementSource,mt,ye.scope)&&(Ke.uploaded=!1,Ke.upload(ce.context));let wt=0;const gt=new Array,Kt=new Array,$t=new Array;for(let Dt in Ke.instancesPerModel){const Bt=Ke.instancesPerModel[Dt];Bt.features.length>0&&!Te&&(Dt=ot.evaluate(Bt.features[0].feature,{}));const nr=Me.getModel(Dt,_e);if(nr||Me.hasURLBeenRequested(Dt)||Ke.modelUris.includes(Dt)||(Ke.modelUris.push(Dt),Ke.modelsRequested=!1),nr&&nr.uploaded)if(Te){const xr=o.c5([],[De.x,De.y,De.z],ce.transform.worldSize);o.ew(xr,xr);for(let Ur=0;Ur<Bt.instancedDataArray.length;++Ur){const dn=[0,0,0],Zt=[1,1,1],an=o.ex(),vr=Bt.tileCoordinatesForInstance(Ur),pn=Bt.transformForInstance(Ur);o.ey(Zt,pn),o.ez(an,pn),o.eA(dn,an);const An=Bt.translationForInstance(Ur),bn=new o.aT(0,0);o.eB(Ke.canonical,bn,vr.x,vr.y);const sn=o.bC();o.eC(sn,nr,ce.transform,bn,dn,Zt,An,!0,!1,!1);const Ar=Bt.colorForInstance(Ur),fn=o.bA([]),li=o.ef(bn.lat,ce.transform.zoom),Yn=o.bq([],[1,1,1/li]);o.br(fn,fn,xr),$t.push({zScaleMatrix:Yn,negCameraPosMatrix:fn});for(const mn of nr.nodes)gu(ce,mn,sn,ce.transform.expandedFarZProjMatrix,wt,gt,Kt,nr.materialOverrides,Ne,Ar);++wt}}else for(const xr of nr.nodes)Lx(ce,ye,xr,Bt,zt,Ce,cl)}if(Te)if(ce.renderPass==="shadow"){for(const Dt of Kt)za(Dt.mesh,Dt.nodeModelMatrix,ce,ye);for(const Dt of gt)za(Dt.mesh,Dt.nodeModelMatrix,ce,ye)}else Rx(ce,ye,gt,Kt,$t)}}(f,n,l,p,Uh(f,l)),void N();if(!B.loaded())return;if(B.type==="batched-model")return function(ce,Se,ye,we){ye.resetLayerRenderingStats(ce);const _e=ce.context,pe=ce.transform,Te=ce.style.fog,De=ce.shadowRenderer;if(pe.projection.name!=="mercator")return void o.w(`Drawing 3D landmark models for ${pe.projection.name} projection is not yet implemented`);const Me=ce.transform.getFreeCameraOptions().position,Ge=o.c5([],[Me.x,Me.y,Me.z],ce.transform.worldSize),He=o.ew([],Ge),et=o.bA([]),mt=o.ef(pe.center.lat,pe.zoom),Ne=o.bq([],[1,1,1/mt]);o.br(et,et,He);const Ce=ye.paint.get("model-opacity").constantOr(1),Ke=new Xt(_e.gl.LEQUAL,Xt.ReadWrite,ce.depthRangeFor3D),Ve=new Xt(_e.gl.LEQUAL,Xt.ReadOnly,ce.depthRangeFor3D),ot=new o.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Tt=ce.renderPass==="shadow",zt=Tt&&De?De.getCurrentCascadeFrustum():pe.getFrustum(pe.scaleZoom(pe.worldSize)),wt=ye.paint.get("model-front-cutoff"),gt=wt[2]<1,Kt=yc(ce,ye.paint.get("model-cutoff-fade-range")),$t=ye.getLayerRenderingStats();(function(Dt,Bt,nr,xr){const Ur=Dt.terrain?Dt.terrain.exaggeration():0,dn=Dt.transform.zoom;for(const Zt of xr){const an=Bt.getTile(Zt).getBucket(nr);an&&(an.setFilter(nr.filter),Dt.conflationActive&&an.updateReplacement(Zt,Dt.replacementSource),an.evaluateTransform(Dt,nr),Dt.terrain&&Ur>0&&an.elevationUpdate(Dt.terrain,Ur,Zt,nr.source),an.needsReEvaluation(Dt,dn,nr)&&an.evaluate(nr))}})(ce,Se,ye,we),function(){let Dt,Bt,nr;gt?(Dt=we.length-1,Bt=-1,nr=-1):(Dt=0,Bt=we.length,nr=1);const xr=new Float64Array(16),Ur=o.cA(),dn=new o.P(0,0);for(let Zt=Dt;Zt!==Bt;Zt+=nr){const an=we[Zt],vr=Se.getTile(an).getBucket(ye);if(!vr||!vr.uploaded)continue;let pn=!1;De&&(pn=De.getMaxCascadeForTile(an.toUnwrapped())===0);const An=pe.calculatePosMatrix(an.toUnwrapped(),pe.worldSize),bn=vr.modelTraits;!Tt&>&&(o.bl(xr,An),o.af(Ur,Ge,xr),dn.x=Ur[0],dn.y=Ur[1]);const sn=[];vr.setFilter(ye.filter);for(const Ar of vr.getNodesInfo()){if(Ar.hiddenByReplacement||!Ar.node.meshes)continue;const fn=Ar.node;let li=0;ce.terrain&&fn.elevation&&(li=fn.elevation*ce.terrain.exaggeration());const Yn=(()=>{const Us=Ar.aabb;return ot.min=[...Us.min],ot.max=[...Us.max],ot.min[2]+=li,ot.max[2]+=li,o.af(ot.min,ot.min,An),o.af(ot.max,ot.max,An),ot})(),mn=Ar.evaluatedScale;if(mn[0]<=1&&mn[1]<=1&&mn[2]<=1&&Yn.intersects(zt)===0)continue;if(!Tt&>){const Us=.16666666666666666;Ar.cameraCollisionOpacity=Ge[0]>Yn.min[0]&&Ge[0]<Yn.max[0]&&Ge[1]>Yn.min[1]&&Ge[1]<Yn.max[1]&&Ge[2]*mt<Yn.max[2]&&fn.footprint&&o.c0(dn,fn.footprint)?Math.max(Ar.cameraCollisionOpacity-Us,0):Math.min(1,Ar.cameraCollisionOpacity+Us)}const Qr=[...An],Cr=1/o.d7(an.canonical),Kn=fn.anchor?fn.anchor[0]:0,vi=fn.anchor?fn.anchor[1]:0;o.br(Qr,Qr,[Kn*(mn[0]-1)+Ar.evaluatedTranslation[0]*Cr,vi*(mn[1]-1)+Ar.evaluatedTranslation[1]*Cr,li+Ar.evaluatedTranslation[2]]),o.cq(mn,o.eE)||o.cS(Qr,Qr,mn);const ni=o.aB([],Qr,fn.globalMatrix),Rn=o.aB([],pe.expandedFarZProjMatrix,ni),fo=o.aB([],pe.expandedFarZProjMatrix,Qr),Ms=o.aC([],[Kn,vi,li,1],Rn)[2];fn.hidden=!1;let Vi=Ce;Tt||(gt&&(Vi*=Ar.cameraCollisionOpacity,Vi*=Br(Qr,pe,Ar.aabb,wt)),Vi*=Xn(Kt,Ms)),Vi!==0?sn.push({nodeInfo:Ar,depth:Ms,opacity:Vi,wvpForNode:Rn,wvpForTile:fo,nodeModelMatrix:ni,tileModelMatrix:Qr}):fn.hidden=!0}Tt||sn.sort((Ar,fn)=>!gt||Ar.opacity===1&&fn.opacity===1?Ar.depth<fn.depth?-1:1:Ar.opacity===1?-1:fn.opacity===1?1:Ar.depth>fn.depth?-1:1);for(const Ar of sn){const fn=Ar.nodeInfo,li=fn.node;let Yn=o.aB([],Ne,Ar.tileModelMatrix);o.aB(Yn,et,Yn);const mn=o.bl([],Yn);o.eg(mn,mn),o.cS(mn,mn,$h),Yn=o.aB(Yn,Yn,li.globalMatrix);const Qr=ce.renderPass==="light-beam",Cr=ye.paint.get("model-color-use-theme").constantOr("default")==="none",Kn=bn&o.eI.HasMapboxMeshFeatures,vi=Kn?0:fn.evaluatedRMEA[0][2];for(let ni=0;ni<li.meshes.length;++ni){const Rn=li.meshes[ni],fo=ni===li.lightMeshIndex;let Ms=Ar.wvpForNode;if(fo){if(!Qr&&!ce.terrain&&ce.shadowRenderer){ce.currentLayer<ce.firstLightBeamLayer&&(ce.firstLightBeamLayer=ce.currentLayer);continue}Ms=Ar.wvpForTile}else if(Qr)continue;const Vi={defines:[]},Us=[];if(!Tt&&De&&(De.useNormalOffset=!!Rn.normalBuffer),Wp(Vi.defines,Us,Rn,ce,Cr?null:ye.lut),Kn||Vi.defines.push("DIFFUSE_SHADED"),pn&&Vi.defines.push("SHADOWS_SINGLE_CASCADE"),$t&&(Tt?$t.numRenderedVerticesInShadowPass+=Rn.vertexArray.length:$t.numRenderedVerticesInTransparentPass+=Rn.vertexArray.length),Tt){za(Rn,Ar.nodeModelMatrix,ce,ye);continue}let $s=null;if(Te){const bi=Hp(Ar.nodeModelMatrix,ce.transform);if($s=new Float32Array(bi),pe.projection.name!=="globe"){const Dn=Rn.aabb.min,Ci=Rn.aabb.max,[ci,ii]=Te.getOpacityForBounds(bi,Dn[0],Dn[1],Ci[0],Ci[1]);Vi.overrideFog=ci>=tt||ii>=tt}}const Ts=Rn.material;let Qo;Ts.occlusionTexture&&Ts.occlusionTexture.offsetScale&&(Qo=Ts.occlusionTexture.offsetScale,Vi.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const xa=ce.getOrCreateProgram("model",Vi);!Tt&&De&&De.setupShadowsFromMatrix(Ar.tileModelMatrix,xa,De.useNormalOffset),ce.uploadCommonUniforms(_e,xa,null,$s);const Eo=Ts.pbrMetallicRoughness;Eo.metallicFactor=.9,Eo.roughnessFactor=.5;const fi=uu(new Float32Array(Ms),new Float32Array(Yn),new Float32Array(mn),new Float32Array(li.globalMatrix),ce,Ar.opacity,Eo.baseColorFactor,Ts.emissiveFactor,Eo.metallicFactor,Eo.roughnessFactor,Ts,vi,ye,[0,0,0],Qo);!fo&&(fn.hasTranslucentParts||Ar.opacity<1)&&xa.draw(ce,_e.gl.TRIANGLES,Ke,pr.disabled,Er.disabled,fr.backCCW,fi,ye.id,Rn.vertexBuffer,Rn.indexBuffer,Rn.segments,ye.paint,ce.transform.zoom,void 0,Us),xa.draw(ce,_e.gl.TRIANGLES,fo?Ve:Ke,pr.disabled,fo||Ar.opacity<1||fn.hasTranslucentParts?Er.alphaBlended:Er.unblended,fr.backCCW,fi,ye.id,Rn.vertexBuffer,Rn.indexBuffer,Rn.segments,ye.paint,ce.transform.zoom,void 0,Us)}}}}()}(f,n,l,p),void N();if(B.type!=="model")return;const j=B.getModels(),H=[],G=f.transform.getFreeCameraOptions().position,Q=o.c5([],[G.x,G.y,G.z],f.transform.worldSize);o.ew(Q,Q);const J=[],ae=[];let de=0;for(const ce of j){const Se=n.getFeatureState("",ce.id),ye={type:"Unknown",id:ce.id,properties:ce.featureProperties},we=l.paint.get("model-rotation").evaluate(ye,Se),_e=l.paint.get("model-scale").evaluate(ye,Se),pe=l.paint.get("model-translation").evaluate(ye,Se),Te=l.paint.get("model-opacity").evaluate(ye,Se);Px(l,ce.id,Se,ce.featureProperties,ce.nodeOverrideNames,ce.nodeOverrides),Mx(l,ce.id,Se,ce.featureProperties,ce.materialOverrideNames,ce.materialOverrides),ce.nodeOverrides.size>0&&ce.computeBoundsAndApplyParent(),ce.computeModelMatrix(f,we,_e,pe,T,b,!1);const De=o.bA([]),Me=o.ef(ce.position.lat,f.transform.zoom),Ge=o.bq([],[1,1,1/Me]);o.br(De,De,Q),H.push({zScaleMatrix:Ge,negCameraPosMatrix:De});for(const He of ce.nodes)gu(f,He,ce.matrix,f.transform.expandedFarZProjMatrix,de,J,ae,ce.materialOverrides,Te);de++}if(J.sort((ce,Se)=>Se.depth-ce.depth),f.renderPass!=="shadow")Rx(f,l,J,ae,H),N();else{for(const ce of ae)za(ce.mesh,ce.nodeModelMatrix,f,l);for(const ce of J)za(ce.mesh,ce.nodeModelMatrix,f,l);N()}}},Xp={line:function(f,n,l){if(f.hasElevatedBuckets=!1,f.hasNonElevatedBuckets=!1,f._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||f._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(n){const p=n.getVisibleCoordinates();for(const y of p){const x=n.getTile(y).getBucket(f);if(x&&(x.elevationType!=="none"?f.hasElevatedBuckets=!0:f.hasNonElevatedBuckets=!0,f.hasElevatedBuckets&&f.hasNonElevatedBuckets))break}}}else f.hasNonElevatedBuckets=!0},model:function(f,n,l){const p=n.getSource();if(!p.loaded())return;if(p.type==="vector"||p.type==="geojson")return void(l.modelManager&&l.modelManager.upload(l,Uh(l,f)));if(p.type==="batched-model"||p.type!=="model")return;const y=p.getModels();for(const x of y)x.upload(l.context)},raster:function(f,n,l){const p=n.getSource();if(!(p instanceof Ys&&p.loaded()))return;const y=f.sourceLayer||p.rasterLayerIds&&p.rasterLayerIds[0];if(!y)return;const x=f.paint.get("raster-array-band")||p.getInitialBand(y);if(x==null)return;const b=n.getIds().map(T=>n.getTileByID(T));for(const T of b)T.updateNeeded(f.id,x)&&p.prepareTile(T,y,f.id,x)},"raster-particle":function(f,n,l){const p=n.getSource();if(!(p instanceof Ys&&p.loaded()))return;const y=f.sourceLayer||p.rasterLayerIds&&p.rasterLayerIds[0];if(!y)return;const x=f.paint.get("raster-particle-array-band")||p.getInitialBand(y);if(x==null)return;const b=n.getIds().map(T=>n.getTileByID(T));for(const T of b)T.updateNeeded(f.id,x)&&p.prepareTile(T,y,f.id,x)}},Jo={fill:zp},Yp={fill:function(f,n,l,p){if(!l.layout||l.layout.get("fill-elevation-reference")==="none"||l.paint.get("fill-opacity").constantOr(1)===0)return;const y=f.context.gl,x=new Xt(y.LEQUAL,Xt.ReadOnly,f.depthRangeFor3D),b=new pr({func:y.ALWAYS,mask:255},255,255,y.KEEP,y.KEEP,y.REPLACE),T=f.transform.getFreeCameraOptions().position,A=f.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const M of p){const D=n.getTile(M),N=D.getBucket(l);if(!N)continue;const B=N.elevatedStructures;if(!B||B.depthSegments.segments[0].primitiveLength===0)continue;const j=wx(M.toUnwrapped(),T),H=f.translatePosMatrix(M.projMatrix,D,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor")),G=cu(H,j,0,1,0);A.draw(f,y.TRIANGLES,x,b,Er.disabled,fr.disabled,G,l.id,B.vertexBuffer,B.indexBuffer,B.depthSegments,l.paint,f.transform.zoom)}}};class Jp{constructor(n,l,p,y,x){this.context=new ld(n,l),this.transform=p,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=o.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const b=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const A of b)this._debugParams.enabledLayers[A]=!0;for(const A of b);this.occlusionParams=new ud,this.setup(),this.numSublayers=Oo.maxUnderzooming+Oo.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new o.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Xu(this),this._wireframeDebugCache=new Cc,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const T=new o.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new o.T(this.context,T,n.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=y,this.worldview=x,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(n,l){const p=!!n&&!!n.terrain&&this.transform.projection.supportsTerrain;if(!(p||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new z_(this,n));const y=this._terrain;this.transform.elevation=p?y:null,y.update(n,this.transform,l),this.transform.elevation&&!y.enabled&&(this.transform.elevation=null)}_updateFog(n){const l=n.fog;if(!l||this.transform.projection.name==="globe"||l.getOpacity(this.transform.pitch)<1||l.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[p,y]=l.getFovAdjustedRange(this.transform._fov);if(p>y)return void(this.transform.fogCullDistSq=null);const x=p+.78*(y-p);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(n){n&&!this._terrain&&(this._terrain=new z_(this,this.style)),this._forceTerrainMode=n}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(n,l){if(this.width=n*o.o.devicePixelRatio,this.height=l*o.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const p of this.style.order)this.style._mergedLayers[p].resize()}setup(){const n=this.context,l=new o.bd;l.emplaceBack(0,0),l.emplaceBack(o.al,0),l.emplaceBack(0,o.al),l.emplaceBack(o.al,o.al),this.tileExtentBuffer=n.createVertexBuffer(l,o.bf.members),this.tileExtentSegments=o.bg.simpleSegment(0,0,4,2);const p=new o.bd;p.emplaceBack(0,0),p.emplaceBack(o.al,0),p.emplaceBack(0,o.al),p.emplaceBack(o.al,o.al),this.debugBuffer=n.createVertexBuffer(p,o.bf.members),this.debugSegments=o.bg.simpleSegment(0,0,4,5);const y=new o.bd;y.emplaceBack(-1,-1),y.emplaceBack(1,-1),y.emplaceBack(-1,1),y.emplaceBack(1,1),this.viewportBuffer=n.createVertexBuffer(y,o.bf.members),this.viewportSegments=o.bg.simpleSegment(0,0,4,2);const x=new o.b1;x.emplaceBack(0,0,0,0),x.emplaceBack(o.al,0,o.al,0),x.emplaceBack(0,o.al,0,o.al),x.emplaceBack(o.al,o.al,o.al,o.al),this.mercatorBoundsBuffer=n.createVertexBuffer(x,o.bi.members),this.mercatorBoundsSegments=o.bg.simpleSegment(0,0,4,2);const b=new o.b0;b.emplaceBack(0,1,2),b.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=n.createIndexBuffer(b);const T=new o.be;for(const M of[0,1,3,2,0])T.emplaceBack(M);this.debugIndexBuffer=n.createIndexBuffer(T),this.emptyTexture=new o.T(n,new o.q({width:1,height:1},Uint8Array.of(0,0,0,0)),n.gl.RGBA8),this.identityMat=o.bC();const A=this.context.gl;this.stencilClearMode=new pr({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(n){return n._makeTileBoundsBuffers(this.context,this.transform.projection),n._tileBoundsBuffer?{tileBoundsBuffer:n._tileBoundsBuffer,tileBoundsIndexBuffer:n._tileBoundsIndexBuffer,tileBoundsSegments:n._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const n=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,n.TRIANGLES,Xt.disabled,this.stencilClearMode,Er.disabled,fr.disabled,Lh(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(n,l,p){if(!l||this.currentStencilSource===l.id||!n.isTileClipped()||!p||p.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let T=!1;for(const A of p)if(this._tileClippingMaskIDs[A.key]===void 0){T=!0;break}if(!T)return}this.currentStencilSource=l.id;const y=this.context,x=y.gl;this.nextStencilID+p.length>256&&this.clearStencil(),y.setColorMode(Er.disabled),y.setDepthMode(Xt.disabled);const b=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const T of p){const A=l.getTile(T),M=this._tileClippingMaskIDs[T.key]=this.nextStencilID++,{tileBoundsBuffer:D,tileBoundsIndexBuffer:N,tileBoundsSegments:B}=this.getTileBoundsBuffers(A);b.draw(this,x.TRIANGLES,Xt.disabled,new pr({func:x.ALWAYS,mask:0},M,255,x.KEEP,x.KEEP,x.REPLACE),Er.disabled,fr.disabled,Lh(T.projMatrix),"$clipping",D,N,B)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const n=this.nextStencilID++,l=this.context.gl;return new pr({func:l.NOTEQUAL,mask:255},n,255,l.KEEP,l.KEEP,l.REPLACE)}stencilModeForClipping(n){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(n);const l=this.context.gl;return new pr({func:l.EQUAL,mask:255},this._tileClippingMaskIDs[n.key],0,l.KEEP,l.KEEP,l.REPLACE)}stencilConfigForOverlap(n){const l=this.context.gl,p=n.sort((b,T)=>T.overscaledZ-b.overscaledZ),y=p[p.length-1].overscaledZ,x=p[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const b={};for(let T=0;T<x;T++)b[T+y]=new pr({func:l.GEQUAL,mask:255},T+this.nextStencilID,255,l.KEEP,l.KEEP,l.REPLACE);return this.nextStencilID+=x,[b,p]}return[{[y]:pr.disabled},p]}colorModeForRenderPass(){const n=this.context.gl;return this._showOverdrawInspector?new Er([n.CONSTANT_COLOR,n.ONE,n.CONSTANT_COLOR,n.ONE],new o.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Er.unblended:Er.alphaBlended}colorModeForDrapableLayerRenderPass(n){const l=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?n!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new Er([l.ONE,l.ONE_MINUS_SRC_ALPHA,l.CONSTANT_ALPHA,l.ONE_MINUS_SRC_ALPHA],new o.ao(0,0,0,n??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new Er([l.ONE,l.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,l.ONE_MINUS_SRC_ALPHA],o.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(n,l,p,y=!1){if(this.depthOcclusion)return new Xt(this.context.gl.GREATER,Xt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!y)return Xt.disabled;const x=1-((1+this.currentLayer)*this.numSublayers+n)*this.depthEpsilon;return new Xt(p||this.context.gl.LEQUAL,l,[x,x])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const n=this.context.gl,l=Math.ceil(this.width),p=Math.ceil(this.height),y=this.context.bindFramebuffer.get(),x=n.getParameter(n.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===l&&this.depthFBO.height===p||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),l!==0&&p!==0&&(this.depthFBO=new xx(this.context,l,p,0,"texture"),this.depthTexture=new o.T(this.context,{width:l,height:p,data:null},n.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(y),n.bindTexture(n.TEXTURE_2D,x),this.depthFBO&&(n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),n.blitFramebuffer(0,0,l,p,0,0,l,p,n.DEPTH_BUFFER_BIT,n.NEAREST),n.bindFramebuffer(n.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((n,l)=>n+l/this._fpsHistory.length,0))}render(n,l){const p=o.o.now();this._dt=p-this._timeStamp,this._timeStamp=p,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=n.map.repaint,this.style=n,this.options=l;const y=this.style._mergedLayers,x=!(!this.terrain||!this.terrain.enabled),b=()=>this.style._getOrder(x).filter(Ne=>{const Ce=y[Ne];return!(Ce.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Ce.type]});let T=b(),A=!1,M=!1,D=null,N=0,B=!1;for(const Ne of T){const Ce=y[Ne];Ce.visibility!=="none"&&(Ce.type==="circle"?A=!0:Ce.type==="building"?(D=Ce,++N):Ce.type==="symbol"&&(Ce.hasOcclusionOpacityProperties?M=!0:A=!0))}this.updateEmissiveMode();let j=T.map(Ne=>y[Ne]);const H=this.style._mergedSourceCaches;this.imageManager=n.imageManager,this.modelManager=n.modelManager,this.symbolFadeChange=n.placement.symbolFadeChange(o.o.now()),this.imageManager.beginFrame();for(const Ne in H){const Ce=H[Ne];Ce.used&&(Ce.prepare(this.context),Ce.getSource().usedInConflation&&++N)}let G=!1;for(const Ne of j)Ne.isHidden(this.transform.zoom)||(Ne.type==="clip"&&(G=!0),this.prepareLayer(Ne));const Q={},J={},ae={},de={},ce={};for(const Ne in H){const Ce=H[Ne];Q[Ne]=Ce.getVisibleCoordinates(),J[Ne]=Q[Ne].slice().reverse(),ae[Ne]=Ce.getVisibleCoordinates(!0).reverse(),de[Ne]=Ce.getShadowCasterCoordinates(),ce[Ne]=Ce.sortCoordinatesByDistance(Q[Ne])}const Se=Ne=>{const Ce=this.style.getLayerSourceCache(Ne);return Ce&&Ce.used?Ce.getSource():null};if(N||G||this._clippingActiveLastFrame){const Ne=[],Ce=[];let Ke=0;for(const Ve of j)this.isSourceForClippingOrConflation(Ve,Se(Ve))&&(Ne.push(Ve),Ce.push(Ke)),Ke++;if(Ne&&(G||Ne.length>1)||this._clippingActiveLastFrame){G=!1;const Ve=[];for(let ot=0;ot<Ne.length;ot++){const Tt=Ne[ot],zt=Ce[ot],wt=this.style.getLayerSourceCache(Tt);if(!wt||!wt.used||!wt.getSource().usedInConflation&&Tt.type!=="clip"&&Tt.type!=="building")continue;let gt=o.eQ,Kt=o.b_.None;const $t=[];let Dt=!0;if(Tt.type==="building")gt=o.eS;else if(Tt.type==="clip"){gt=zt;for(const Bt of Tt.layout.get("clip-layer-types"))Kt|=Bt==="model"?o.b_.Model:Bt==="symbol"?o.b_.Symbol:o.b_.FillExtrusion;for(const Bt of Tt.layout.get("clip-layer-scope"))$t.push(Bt);Tt.isHidden(this.transform.zoom)?Dt=!1:G=!0}Dt&&Ve.push({layer:Tt.fqid,cache:wt,order:gt,clipMask:Kt,clipScope:$t})}this.replacementSource.setSources(Ve),B=!0}}this._clippingActiveLastFrame=G,B||this.replacementSource.clear(),this.conflationActive=B,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Ne=0;Ne<j.length;Ne++){const Ce=j[Ne];if(Ce.visibility==="none")continue;const Ke=Ce.cutoffRange();if(this.longestCutoffRange=Math.max(Ke,this.longestCutoffRange),Ke>0){const Ve=Se(Ce);Ve&&(this.minCutoffZoom=Math.max(Ve.minzoom,this.minCutoffZoom)),Ce.minzoom&&(this.minCutoffZoom=Math.max(Ce.minzoom,this.minCutoffZoom))}Ce.is3D(x)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Ne),this._lastOcclusionLayer=Ne)}const ye=this.style&&this.style.fog;ye?(this._fogVisible=ye.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ye.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(ae),this.opaquePassCutoff=0,T=b(),j=T.map(Ne=>y[Ne]));const we=this._shadowRenderer;if(we){we.updateShadowParameters(this.transform,this.style.directionalLight);for(const Ne in H)for(const Ce of Q[Ne]){let Ke={min:0,max:0};this.terrain&&(Ke=this.terrain.getMinMaxForTile(Ce)||Ke),we.addShadowReceiver(Ce.toUnwrapped(),Ke.min,Ke.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new o.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Ix(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const _e=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),pe=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(_e&&!this._snow&&(this._snow=new J_(this)),!_e&&this._snow&&(this._snow.destroy(),delete this._snow),pe&&!this._rain&&(this._rain=new Zp(this)),!pe&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),D){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Gp);const Ne=this.style.getLayerSourceCache(D);this.buildingTileBorderManager.updateBorders(Ne,D)}if(!Ki.has(this.context.gl))return;this.renderPass="offscreen";for(const Ne of j){const Ce=n.getLayerSourceCache(Ne);if(!Ne.hasOffscreenPass()||Ne.isHidden(this.transform.zoom))continue;const Ke=Ce?J[Ce.id]:void 0;(Ne.type==="custom"||Ne.type==="raster"||Ne.type==="raster-particle"||Ne.isSky()||Ke&&Ke.length)&&this.renderLayer(this,Ce,Ne,Ke)}this.depthRangeFor3D=[0,1-(j.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,de)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const Te=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),De=(()=>{if(l.showOverdrawInspector)return o.ao.black;const Ne=this.style.fog;if(Ne&&this.transform.projection.supportsFog){const Ce=this.style.getLut(Ne.scope);if(!Te){const Ke=Ne.properties.get("color-use-theme")==="none",Ve=Ne.properties.get("color").toNonPremultipliedRenderColor(Ke?null:Ce).toArray01();return new o.ao(...Ve)}if(Te){const Ke=Ne.properties.get("space-color-use-theme")==="none",Ve=Ne.properties.get("space-color").toNonPremultipliedRenderColor(Ke?null:Ce).toArray01();return new o.ao(...Ve)}}return o.ao.transparent})();if(this.context.clear({color:De,depth:1}),this.clearStencil(),this._showOverdrawInspector=l.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Te&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=T.length-1;this.currentLayer>=0;this.currentLayer--){const Ne=j[this.currentLayer],Ce=n.getLayerSourceCache(Ne);if(Ne.isSky())continue;const Ke=Ce?(Ne.is3D(x)?ce:J)[Ce.id]:void 0;this._renderTileClippingMasks(Ne,Ce,Ke),this.renderLayer(this,Ce,Ne,Ke)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Te&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||o.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<T.length;this.currentLayer++){const Ne=j[this.currentLayer],Ce=n.getLayerSourceCache(Ne);Ne.isSky()&&this.renderLayer(this,Ce,Ne,Ce?J[Ce.id]:void 0)}function Me(Ne,Ce){let Ke;return Ce&&(Ke=(Ne.type==="symbol"?ae:Ne.is3D(x)?ce:J)[Ce.id]),Ke}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<T.length;){const Ne=j[this.currentLayer];if(Ne.type==="raster"||Ne.type==="raster-particle"){const Ce=n.getLayerSourceCache(Ne);this.renderLayer(this,Ce,Ne,Me(Ne,Ce))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Ge=0;we&&(Ge=we.getShadowCastingLayerCount());let He=!1,et=-1;for(let Ne=0;Ne<T.length;++Ne){const Ce=j[Ne];Ce.isHidden(this.transform.zoom)||Ce.is3D(x)&&(et=Ne)}M&&et===-1&&(A=!0);let mt=!1;for(;this.currentLayer<T.length;){const Ne=j[this.currentLayer],Ce=n.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(!mt&&Ne.is3D(x)&&!x){const Ke=this.currentLayer,Ve=ot=>{for(this.currentLayer=0;this.currentLayer<j.length;this.currentLayer++){const Tt=j[this.currentLayer];if(Jo[Tt.type]){const zt=this.style.getLayerSourceCache(Tt);Jo[Tt.type](this,zt,Tt,Me(Tt,zt),ot)}}};Ve("initialize"),Ve("reset"),this.currentLayer=Ke,mt=!0}if(A&&!He&&this.terrain&&!this.transform.isOrthographic&&(He=!0,this.blitDepth()),M&&et!==-1&&this.currentLayer===et+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(Ne,Ce,Ce?Q[Ce.id]:void 0),this.renderLayer(this,Ce,Ne,Me(Ne,Ce)),!this.terrain&&we&&Ge>0&&Ne.hasShadowPass()&&--Ge==0){{this.clearStencil(),this.resetStencilClippingMasks();const Ke=this.currentLayer;for(this.currentLayer=0;this.currentLayer<j.length;this.currentLayer++){const Ve=j[this.currentLayer];if(Yp[Ve.type]){const ot=this.style.getLayerSourceCache(Ve);Yp[Ve.type](this,ot,Ve,Me(Ve,ot))}}this.currentLayer=Ke}if(we.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Ke=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Ke;this.currentLayer++){const Ve=j[this.currentLayer];if(!Ve.hasLightBeamPass())continue;const ot=n.getLayerSourceCache(Ve);this.renderLayer(this,ot,Ve,ot?J[ot.id]:void 0)}this.currentLayer=Ke,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Ke=this.currentLayer;this.depthOcclusion=!0;for(const Ve of this.layersWithOcclusionOpacity){this.currentLayer=Ve;const ot=j[this.currentLayer],Tt=n.getLayerSourceCache(ot),zt=Tt?J[Tt.id]:void 0;this.terrain||this._renderTileClippingMasks(ot,Tt,Tt?Q[Tt.id]:void 0),this.renderLayer(this,Tt,ot,zt)}this.depthOcclusion=!1,this.currentLayer=Ke,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Ne=null;j.forEach(Ce=>{const Ke=n.getLayerSourceCache(Ce);Ke&&!Ce.isHidden(this.transform.zoom)&&Ke.getVisibleCoordinates().length&&(!Ne||Ne.getSource().maxzoom<Ke.getSource().maxzoom)&&(Ne=Ke)}),Ne&&this.options.showTileBoundaries&&vt(this,Ne,Ne.getVisibleCoordinates(),o.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&vt(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new o.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(Ne){const Ce=Ne.transform.padding;pu(Ne,Ne.transform.height-(Ce.top||0),3,Tx),pu(Ne,Ce.bottom||0,3,Ex),hi(Ne,Ce.left||0,3,kx),hi(Ne,Ne.transform.width-(Ce.right||0),3,hu);const Ke=Ne.transform.centerPoint;(function(Ve,ot,Tt,zt){ze(Ve,ot-1,Tt-10,2,20,zt),ze(Ve,ot-10,Tt-1,20,2,zt)})(Ne,Ke.x,Ne.transform.height-Ke.y,fu)}(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()),B||(this.conflationActive=!1)}prepareLayer(n){this.gpuTimingStart(n);const{unsupportedLayers:l}=this.transform.projection,p=!l||!l.includes(n.type);if(Xp[n.type]&&(p||this.terrain&&n.type==="custom")){const y=this.style.getLayerSourceCache(n);Xp[n.type](n,y,this)}this.gpuTimingEnd()}renderLayer(n,l,p,y){p.isHidden(this.transform.zoom)||(p.type==="background"||p.type==="sky"||p.type==="custom"||p.type==="model"||p.type==="raster"||p.type==="raster-particle"||y&&y.length)&&(this.id=p.id,this.gpuTimingStart(p),n.transform.projection.unsupportedLayers&&n.transform.projection.unsupportedLayers.includes(p.type)&&(!n.terrain||p.type!=="custom")||p.type==="clip"||Ic[p.type](n,l,p,y,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(n){if(!this.options.gpuTiming)return;const l=this.context.extTimerQuery,p=this.context.gl;let y=this.gpuTimers[n.id];y||(y=this.gpuTimers[n.id]={calls:0,cpuTime:0,query:p.createQuery()}),y.calls++,p.beginQuery(l.TIME_ELAPSED_EXT,y.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const n=this.context.extTimerQuery,l=this.context.gl,p=l.createQuery();this.deferredRenderGpuTimeQueries.push(p),l.beginQuery(n.TIME_ELAPSED_EXT,p)}}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 n=this.gpuTimers;return this.gpuTimers={},n}collectDeferredRenderGpuQueries(){const n=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],n}queryGpuTimers(n){const l={};for(const p in n){const y=n[p],x=this.context.extTimerQuery,b=x.getQueryParameter(y.query,this.context.gl.QUERY_RESULT)/1e6;x.deleteQueryEXT(y.query),l[p]=b}return l}queryGpuTimeDeferredRender(n){if(!this.options.gpuTimingDeferredRender)return 0;const l=this.context.gl;let p=0;for(const y of n)p+=l.getQueryParameter(y,l.QUERY_RESULT)/1e6,l.deleteQuery(y);return p}translatePosMatrix(n,l,p,y,x){if(!p[0]&&!p[1])return n;const b=x?y==="map"?this.transform.angle:0:y==="viewport"?-this.transform.angle:0;if(b){const M=Math.sin(b),D=Math.cos(b);p=[p[0]*D-p[1]*M,p[0]*M+p[1]*D]}const T=[x?p[0]:o.ay(l,p[0],this.transform.zoom),x?p[1]:o.ay(l,p[1],this.transform.zoom),0],A=new Float32Array(16);return o.br(A,n,T),A}saveTileTexture(n){if(n.context!==this.context)return;const l=n.size[0],p=this._tileTextures[l];p?p.push(n):this._tileTextures[l]=[n]}getTileTexture(n){const l=this._tileTextures[n];return l&&l.length>0?l.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(n,l,p){const y=p===void 0?this.terrain&&this.terrain.renderingToTexture:p,x=[];return this.style&&this.style.enable3dLights()&&(n==="globeRaster"||n==="terrainRaster"?(x.push("LIGHTING_3D_MODE"),x.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):y||x.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||x.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(x.push("TERRAIN"),this.linearFloatFilteringSupported()&&x.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&x.push("GLOBE"),!this._fogVisible||y||l!==void 0&&!l||x.push("FOG","FOG_DITHERING"),y&&x.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&x.push("OVERDRAW_INSPECTOR"),x}getOrCreateProgram(n,l){this.cache=this.cache||{};const p=l&&l.defines||[],y=l&&l.config,x=this.currentGlobalDefines(n,l&&l.overrideFog,l&&l.overrideRtt).concat(p),b=lx.cacheKey(S_[n],n,x,y);return this.cache[b]||(this.cache[b]=new lx(this.context,n,S_[n],y,Op[n],x)),this.cache[b]}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 n=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(n.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(n,l){if(this.style.enable3dLights()){const p=this.style.directionalLight,y=this.style.ambientLight;if(p&&y){const x=((b,T,A)=>{const M=b.properties.get("direction"),D=b.properties.get("color-use-theme")==="none",N=b.properties.get("color").toNonPremultipliedRenderColor(D?null:A.getLut(b.scope)).toArray01(),B=b.properties.get("intensity"),j=T.properties.get("color-use-theme")==="none",H=T.properties.get("color").toNonPremultipliedRenderColor(j?null:A.getLut(T.scope)).toArray01(),G=T.properties.get("intensity"),Q=[M.x,M.y,M.z],J=o.dN(H,G),ae=o.dN(N,B);return{u_lighting_ambient_color:J,u_lighting_directional_dir:Q,u_lighting_directional_color:ae,u_ground_radiance:sd(Q,ae,J)}})(p,y,this.style);l.setLightsUniformValues(n,x)}}}uploadCommonUniforms(n,l,p,y,x){if(this.uploadCommonLightUniforms(n,l),this.terrain&&this.terrain.renderingToTexture)return;const b=this.style.fog;if(b){const T=b.getOpacity(this.transform.pitch),A=((M,D,N,B,j,H,G,Q,J,ae,de,ce)=>{const Se=M.transform,ye=D.properties.get("color-use-theme")==="none",we=D.properties.get("color").toNonPremultipliedRenderColor(ye?null:M.style.getLut(D.scope)).toArray01();we[3]=B;const _e=M.frameCounter/1e3%1,[pe,Te]=D.properties.get("vertical-range");return{u_fog_matrix:N?Se.calculateFogTileMatrix(N):ce||M.identityMat,u_fog_range:D.getFovAdjustedRange(Se._fov),u_fog_color:we,u_fog_horizon_blend:D.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(pe,Te),Te],u_fog_temporal_offset:_e,u_frustum_tl:j,u_frustum_tr:H,u_frustum_br:G,u_frustum_bl:Q,u_globe_pos:J,u_globe_radius:ae,u_viewport:de,u_globe_transition:o.aj(Se.zoom),u_is_globe:+(Se.projection.name==="globe")}})(this,b,p,T,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*o.o.devicePixelRatio,this.transform.height*o.o.devicePixelRatio],y);l.setFogUniformValues(n,A)}x&&l.setCutoffUniformValues(n,x.uniformValues)}setTileLoadedFlag(n){this.tileLoaded=n}saveCanvasCopy(){const n=this.canvasCopy();n&&(this.frameCopies.push(n),this.tileLoaded=!1)}canvasCopy(){const n=this.context.gl,l=n.createTexture();return n.bindTexture(n.TEXTURE_2D,l),n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,0,0,n.drawingBufferWidth,n.drawingBufferHeight,0),l}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const n=this.style&&this.style.fog;return!!n&&n.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const n=this._backgroundTiles,l=this._backgroundTiles={},p=this.transform.coveringTiles({tileSize:512});for(const y of p)l[y.key]=n[y.key]||new ru(y,512,this.transform.tileZoom,this,void 0,this.worldview);return l}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(n,l){return!(!n.is3D(!(!this.terrain||!this.terrain.enabled))||n.type!=="clip"&&n.type!=="building"&&(n.minzoom&&n.minzoom>this.transform.zoom||(this.style._clipLayerPresent||n.sourceLayer!=="building"&&n.sourceLayer!=="procedural_buildings")&&(!l||l.type!=="batched-model")))}isTileAffectedByFog(n){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let l=this._cachedTileFogOpacities[n.key];return l||(this._cachedTileFogOpacities[n.key]=l=this.style.fog.getOpacityForTile(n)),l[0]>=tt||l[1]>=tt}setupDepthForOcclusion(n,l,p){const y=this.context,x=y.gl,b=!!p;var T;p||(p={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),y.activeTexture.set(x.TEXTURE3),n&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(x.NEAREST,x.CLAMP_TO_EDGE),p.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],p.u_depth_range_unpack=[2/((T=this.depthRangeFor3D)[1]-T[0]),-1-2*T[0]/(T[1]-T[0])],p.u_occluder_half_size=.5*this.occlusionParams.occluderSize,p.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(x.NEAREST,x.CLAMP_TO_EDGE),y.activeTexture.set(x.TEXTURE0),b||l.setTerrainUniformValues(y,p)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const n=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=n?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function Qp(f,n){let l=!1,p=null;const y=()=>{p=null,l&&(f(),p=setTimeout(y,n),l=!1)};return()=>(l=!0,p||y(),p)}class Q_{constructor(n){this._hashName=n&&encodeURIComponent(n),o.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Qp(this._updateHashUnthrottled.bind(this),300)}addTo(n){return this._map=n,window.addEventListener("hashchange",this._onHashChange,!1),n.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 n=this._map;if(!n)return"";const l=Ni(n);if(this._hashName){const p=this._hashName;let y=!1;const x=location.hash.slice(1).split("&").map(b=>{const T=b.split("=")[0];return T===p?(y=!0,`${T}=${l}`):b}).filter(b=>b);return y||x.push(`${p}=${l}`),`#${x.join("&")}`}return`#${l}`}_getCurrentHash(){const n=location.hash.replace("#","");if(this._hashName){let l;return n.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(l=p)}),(l&&l[1]||"").split("/")}return n.split("/")}_onHashChange(){const n=this._map;if(!n)return!1;const l=this._getCurrentHash();if(l.length>=3&&!l.some(p=>isNaN(Number(p)))){const p=n.dragRotate.isEnabled()&&n.touchZoomRotate.isEnabled()?+(l[3]||0):n.getBearing();return n.jumpTo({center:[+l[2],+l[1]],zoom:+l[0],bearing:p,pitch:+(l[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Ni(f,n){const l=f.getCenter(),p=Math.round(100*f.getZoom())/100,y=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),b=Math.round(l.lng*x)/x,T=Math.round(l.lat*x)/x,A=f.getBearing(),M=f.getPitch();let D=n?`/${b}/${T}/${p}`:`${p}/${T}/${b}`;return(A||M)&&(D+="/"+Math.round(10*A)/10),M&&(D+=`/${Math.round(M)}`),D}const hd={linearity:.3,easing:o.eT(0,0,.3,1)},ey=Object.assign({deceleration:2500,maxSpeed:1400},hd),ty=Object.assign({deceleration:20,maxSpeed:1400},hd),yu=Object.assign({deceleration:1e3,maxSpeed:360},hd),ry=Object.assign({deceleration:1e3,maxSpeed:90},hd);class ny{constructor(n){this._map=n,this.clear()}clear(){this._inertiaBuffer=[]}record(n){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.o.now(),settings:n})}_drainInertiaBuffer(){const n=this._inertiaBuffer,l=o.o.now();for(;n.length>0&&l-n[0].time>160;)n.shift()}_onMoveEnd(n){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const l={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)l.zoom+=x.zoomDelta||0,l.bearing+=x.bearingDelta||0,l.pitch+=x.pitchDelta||0,x.panDelta&&l.pan._add(x.panDelta),x.around&&(l.around=x.around),x.pinchAround&&(l.pinchAround=x.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(l.pan.mag()){const x=ul(l.pan.mag(),p,Object.assign({},ey,n||{}));y.offset=l.pan.mult(x.amount/l.pan.mag()),y.center=this._map.transform.center,fd(y,x)}if(l.zoom){const x=ul(l.zoom,p,ty);y.zoom=this._map.transform.zoom+x.amount,fd(y,x)}if(l.bearing){const x=ul(l.bearing,p,yu);y.bearing=this._map.transform.bearing+o.aA(x.amount,-179,179),fd(y,x)}if(l.pitch){const x=ul(l.pitch,p,ry);y.pitch=this._map.transform.pitch+x.amount,fd(y,x)}if(y.zoom||y.bearing){const x=l.pinchAround===void 0?l.around:l.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),y.noMoveStart=!0,y}}function fd(f,n){(!f.duration||f.duration<n.duration)&&(f.duration=n.duration,f.easing=n.easing)}function ul(f,n,l){const{maxSpeed:p,linearity:y,deceleration:x}=l,b=o.aA(f*y/(n/1e3),-p,p),T=Math.abs(b)/(x*y);return{easing:l.easing,duration:1e3*T,amount:b*(T/2)}}class To extends o.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(n,l,p,y={}){const x=Je(l.getCanvasContainer(),p),b=l.unproject(x);super(n,Object.assign({point:x,lngLat:b,originalEvent:p},y)),this._defaultPrevented=!1,this.target=l}}class Pc extends o.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(n,l,p){const y=n==="touchend"?p.changedTouches:p.touches,x=ft(l.getCanvasContainer(),y),b=x.map(A=>l.unproject(A)),T=x.reduce((A,M,D,N)=>A.add(M.div(N.length)),new o.P(0,0));super(n,{points:x,point:T,lngLats:b,lngLat:l.unproject(T),originalEvent:p}),this._defaultPrevented=!1}}class iy extends o.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(n,l){super("wheel",{originalEvent:l}),this._defaultPrevented=!1}}class em{constructor(n,l){this._map=n,this._clickTolerance=l.clickTolerance}reset(){this._mousedownPos=void 0}wheel(n){return this._firePreventable(new iy(this._map,n))}mousedown(n,l){return this._mousedownPos=l,this._firePreventable(new To(n.type,this._map,n))}mouseup(n){this._map.fire(new To(n.type,this._map,n))}preclick(n){const l=new MouseEvent("preclick",n);this._map.fire(new To(l.type,this._map,l))}click(n,l){this._mousedownPos&&this._mousedownPos.dist(l)>=this._clickTolerance||(this.preclick(n),this._map.fire(new To(n.type,this._map,n)))}dblclick(n){return this._firePreventable(new To(n.type,this._map,n))}mouseover(n){this._map.fire(new To(n.type,this._map,n))}mouseout(n){this._map.fire(new To(n.type,this._map,n))}touchstart(n){return this._firePreventable(new Pc(n.type,this._map,n))}touchmove(n){this._map.fire(new Pc(n.type,this._map,n))}touchend(n){this._map.fire(new Pc(n.type,this._map,n))}touchcancel(n){this._map.fire(new Pc(n.type,this._map,n))}_firePreventable(n){if(this._map.fire(n),n.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class sy{constructor(n){this._map=n}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(n){this._map.fire(new To(n.type,this._map,n))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new To("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(n){this._delayContextMenu?this._contextMenuEvent=n:this._map.fire(new To(n.type,this._map,n)),this._map.listens("contextmenu")&&n.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class tm{constructor(n,l){this._map=n,this._el=n.getCanvasContainer(),this._container=n.getContainer(),this._clickTolerance=l.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(n,l){this.isEnabled()&&n.shiftKey&&n.button===0&&(he(),this._startPos=this._lastPos=l,this._active=!0)}mousemoveWindow(n,l){if(!this._active)return;const p=l,y=this._startPos,x=this._lastPos;if(!y||!x||x.equals(p)||!this._box&&p.dist(y)<this._clickTolerance)return;this._lastPos=p,this._box||(this._box=Z("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",n));const b=Math.min(y.x,p.x),T=Math.max(y.x,p.x),A=Math.min(y.y,p.y),M=Math.max(y.y,p.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${b}px,${A}px)`,this._box.style.width=T-b+"px",this._box.style.height=M-A+"px")})}mouseupWindow(n,l){if(!this._active)return;const p=this._startPos,y=l;if(p&&n.button===0){if(this.reset(),je(),p.x!==y.x||p.y!==y.y)return this._map.fire(new o.z("boxzoomend",{originalEvent:n})),{cameraAnimation:x=>x.fitScreenCoordinates(p,y,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",n)}}keydown(n){this._active&&n.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",n))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Ie(),delete this._startPos,delete this._lastPos}_fireEvent(n,l){return this._map.fire(new o.z(n,{originalEvent:l}))}}function rm(f,n){const l={};for(let p=0;p<f.length;p++)l[f[p].identifier]=n[p];return l}class zx{constructor(n){this.reset(),this.numTouches=n.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(n,l,p){(this.centroid||p.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=n.timeStamp),p.length===this.numTouches&&(this.centroid=function(y){const x=new o.P(0,0);for(const b of y)x._add(b);return x.div(y.length)}(l),this.touches=rm(p,l)))}touchmove(n,l,p){if(this.aborted||!this.centroid)return;const y=rm(p,l);for(const x in this.touches){const b=y[x];(!b||b.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(n,l,p){if((!this.centroid||n.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class nm{constructor(n){this.singleTap=new zx(n),this.numTaps=n.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(n,l,p){this.singleTap.touchstart(n,l,p)}touchmove(n,l,p){this.singleTap.touchmove(n,l,p)}touchend(n,l,p){const y=this.singleTap.touchend(n,l,p);if(y){const x=n.timeStamp-this.lastTime<500,b=!this.lastTap||this.lastTap.dist(y)<30;if(x&&b||this.reset(),this.count++,this.lastTime=n.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Fx{constructor(){this._zoomIn=new nm({numTouches:1,numTaps:2}),this._zoomOut=new nm({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(n,l,p){this._zoomIn.touchstart(n,l,p),this._zoomOut.touchstart(n,l,p)}touchmove(n,l,p){this._zoomIn.touchmove(n,l,p),this._zoomOut.touchmove(n,l,p)}touchend(n,l,p){const y=this._zoomIn.touchend(n,l,p),x=this._zoomOut.touchend(n,l,p);return y?(this._active=!0,n.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()+1,around:b.unproject(y)},{originalEvent:n})}):x?(this._active=!0,n.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()-1,around:b.unproject(x)},{originalEvent:n})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Bx={0:1,2:2},oy={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class im{constructor(n){this.reset(),this._clickTolerance=n.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(n,l){return!1}_move(n,l){return{}}mousedown(n,l){if(this._lastPoint)return;const p=kt(n);this._correctButton(n,p)&&(this._lastPoint=l,this._eventButton=p)}mousemoveWindow(n,l){const p=this._lastPoint;if(p){if(n.preventDefault(),this._eventButton!=null&&function(y,x){const b=Bx[x];return y.buttons===void 0||(y.buttons&b)!==b}(n,this._eventButton))this.reset();else if(this._moved||!(l.dist(p)<this._clickTolerance))return this._moved=!0,this._lastPoint=l,this._move(p,l)}}mouseupWindow(n){this._lastPoint&&kt(n)===this._eventButton&&(this._moved&&je(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nx extends im{mousedown(n,l){super.mousedown(n,l),this._lastPoint&&(this._active=!0)}_correctButton(n,l){return l===0&&!n.ctrlKey}_move(n,l){return{around:l,panDelta:l.sub(n)}}}class ay extends im{constructor(n){super(n),this._pitchRotateKey=n.pitchRotateKey?oy[n.pitchRotateKey]:void 0}_correctButton(n,l){return this._pitchRotateKey?l===0&&n[this._pitchRotateKey]:l===0&&n.ctrlKey||l===2}_move(n,l){const p=.8*(l.x-n.x);if(p)return this._active=!0,{bearingDelta:p}}contextmenu(n){this._pitchRotateKey||n.preventDefault()}}class ly extends im{constructor(n){super(n),this._pitchRotateKey=n.pitchRotateKey?oy[n.pitchRotateKey]:void 0}_correctButton(n,l){return this._pitchRotateKey?l===0&&n[this._pitchRotateKey]:l===0&&n.ctrlKey||l===2}_move(n,l){const p=-.5*(l.y-n.y);if(p)return this._active=!0,{pitchDelta:p}}contextmenu(n){this._pitchRotateKey||n.preventDefault()}}class jx{constructor(n,l){this._map=n,this._el=n.getCanvasContainer(),this._minTouches=1,this._clickTolerance=l.clickTolerance||1,this.reset(),o.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}touchstart(n,l,p){return this._calculateTransform(n,l,p)}touchmove(n,l,p){if(this._active&&!(p.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(p.length===1&&!o.eU())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return n.cancelable&&n.preventDefault(),this._calculateTransform(n,l,p)}}touchend(n,l,p){this._calculateTransform(n,l,p),this._active&&p.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(n,l,p){p.length>0&&(this._active=!0);const y=rm(p,l),x=new o.P(0,0),b=new o.P(0,0);let T=0;for(const M in y){const D=y[M],N=this._touches[M];N&&(x._add(D),b._add(D.sub(N)),T++,y[M]=D)}if(this._touches=y,T<this._minTouches||!b.mag())return;const A=b.div(T);return this._sum._add(A),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(T),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=Z("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 sm{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(n){}_move(n,l,p){return{}}touchstart(n,l,p){this._firstTwoTouches||p.length<2||(this._firstTwoTouches=[p[0].identifier,p[1].identifier],this._start([l[0],l[1]]))}touchmove(n,l,p){const y=this._firstTwoTouches;if(!y)return;n.preventDefault();const[x,b]=y,T=Gh(p,l,x),A=Gh(p,l,b);if(!T||!A)return;const M=this._aroundCenter?null:T.add(A).div(2);return this._move([T,A],M,n)}touchend(n,l,p){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,b=Gh(p,l,y),T=Gh(p,l,x);b&&T||(this._active&&je(),this.reset())}touchcancel(){this.reset()}enable(n){this._enabled=!0,this._aroundCenter=!!n&&n.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Gh(f,n,l){for(let p=0;p<f.length;p++)if(f[p].identifier===l)return n[p]}function Vx(f,n){return Math.log2(f/n)}class US extends sm{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(n){this._startDistance=this._distance=n[0].dist(n[1])}_move(n,l){const p=this._distance;if(this._distance=n[0].dist(n[1]),this._active||!(Math.abs(Vx(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Vx(this._distance,p),pinchAround:l}}}function Ux(f,n){return 180*f.angleWith(n)/Math.PI}class ri extends sm{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(n){this._startVector=this._vector=n[0].sub(n[1]),this._minDiameter=n[0].dist(n[1])}_move(n,l){const p=this._vector;if(this._vector=n[0].sub(n[1]),p&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Ux(this._vector,p),pinchAround:l}}_isBelowThreshold(n){this._minDiameter=Math.min(this._minDiameter,n.mag());const l=25/(Math.PI*this._minDiameter)*360,p=this._startVector;if(!p)return!1;const y=Ux(n,p);return Math.abs(y)<l}}function om(f){return Math.abs(f.y)>Math.abs(f.x)}class $S extends sm{constructor(n){super(),this._map=n}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(n){this._lastPoints=n,om(n[0].sub(n[1]))&&(this._valid=!1)}_move(n,l,p){const y=this._lastPoints;if(!y)return;const x=n[0].sub(y[0]),b=n[1].sub(y[1]);return this._map._cooperativeGestures&&!o.eU()&&p.touches.length<3||(this._valid=this.gestureBeginsVertically(x,b,p.timeStamp),!this._valid)?void 0:(this._lastPoints=n,this._active=!0,{pitchDelta:(x.y+b.y)/2*-.5})}gestureBeginsVertically(n,l,p){if(this._valid!==void 0)return this._valid;const y=n.mag()>=2,x=l.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove==null&&(this._firstMove=p),p-this._firstMove<100&&void 0;const b=n.y>0==l.y>0;return om(n)&&om(l)&&b}}const GS={panStep:100,bearingStep:15,pitchStep:10};class HS{constructor(){const n=GS;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(n){if(n.altKey||n.ctrlKey||n.metaKey)return;let l=0,p=0,y=0,x=0,b=0;switch(n.keyCode){case 61:case 107:case 171:case 187:l=1;break;case 189:case 109:case 173:l=-1;break;case 37:n.shiftKey?p=-1:(n.preventDefault(),x=-1);break;case 39:n.shiftKey?p=1:(n.preventDefault(),x=1);break;case 38:n.shiftKey?y=1:(n.preventDefault(),b=-1);break;case 40:n.shiftKey?y=-1:(n.preventDefault(),b=1);break;default:return}return this._rotationDisabled&&(p=0,y=0),{cameraAnimation:T=>{const A=T.getZoom();T.easeTo({duration:300,easeId:"keyboardHandler",easing:Hh,zoom:l?Math.round(A)+l*(n.shiftKey?2:1):A,bearing:T.getBearing()+p*this._bearingStep,pitch:T.getPitch()+y*this._pitchStep,offset:[-x*this._panStep,-b*this._panStep],center:T.getCenter()},{originalEvent:n})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Hh(f){return f*(2-f)}const cy=4.000244140625,uy=1/450;class am{constructor(n,l){this._map=n,this._el=n.getCanvasContainer(),this._handler=l,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=uy,o.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(n){this._defaultZoomRate=n}setWheelZoomRate(n){this._wheelZoomRate=n}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(n){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!n&&n.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(n){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(n.ctrlKey||n.metaKey||this.isZooming()||o.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let l=n.deltaMode===WheelEvent.DOM_DELTA_LINE?40*n.deltaY:n.deltaY;const p=o.o.now(),y=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,l!==0&&l%cy==0?this._type="wheel":l!==0&&Math.abs(l)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=l,this._timeout=window.setTimeout(this._onTimeout,40,n)):this._type||(this._type=Math.abs(y*l)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,l+=this._lastValue)),n.shiftKey&&l&&(l/=4),this._type&&(this._lastWheelEvent=n,this._delta-=l,this._active||this._start(n)),n.preventDefault()}_onTimeout(n){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(n)}_start(n){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 l=Je(this._el,n);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:l,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 n=this._map.transform;this._type==="wheel"&&n.projection.wrap&&(n._center.lng>=180||n._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const l=()=>n._terrainEnabled()&&this._aroundCoord?n.computeZoomRelativeTo(this._aroundCoord):n.zoom;if(this._delta!==0){const M=this._type==="wheel"&&Math.abs(this._delta)>cy?this._wheelZoomRate:this._defaultZoomRate;let D=2/(1+Math.exp(-Math.abs(this._delta*M)));this._delta<0&&D!==0&&(D=1/D);const N=l(),B=Math.pow(2,N),j=typeof this._targetZoom=="number"?n.zoomScale(this._targetZoom):B;this._targetZoom=Math.min(n.maxZoom,Math.max(n.minZoom,n.scaleZoom(j*D))),this._type==="wheel"&&(this._startZoom=N,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const p=typeof this._targetZoom=="number"?this._targetZoom:l(),y=this._startZoom,x=this._easing;let b,T=!1;if(this._type==="wheel"&&y&&x){const M=Math.min((o.o.now()-this._lastWheelEventTime)/200,1),D=x(M);b=o.ak(y,p,D),M<1?this._frameId||(this._frameId=!0):T=!0}else b=p,T=!0;this._active=!0,T&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let A=b-l();return A*this._lastDelta<0&&(A=0),{noInertia:!0,needsRenderFrame:!T,zoomDelta:A,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(n){let l=o.eV;if(this._prevEase){const p=this._prevEase,y=(o.o.now()-p.start)/p.duration,x=p.easing(y+.01)-p.easing(y),b=.27/Math.sqrt(x*x+1e-4)*.01,T=Math.sqrt(.0729-b*b);l=o.eT(b,T,.25,1)}return this._prevEase={start:o.o.now(),duration:n,easing:l},l}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Z("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(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 Ol{constructor(n,l){this._clickZoom=n,this._tapZoom=l}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 lm{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(n,l){return n.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:p.getZoom()+(n.shiftKey?-1:1),around:p.unproject(l)},{originalEvent:n})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ji{constructor(){this._tap=new nm({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(n,l,p){this._swipePoint||(this._tapTime&&n.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?p.length>0&&(this._swipePoint=l[0],this._swipeTouch=p[0].identifier):this._tap.touchstart(n,l,p))}touchmove(n,l,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const y=l[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,n.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(n,l,p)}touchend(n,l,p){this._tapTime?this._swipePoint&&p.length===0&&this.reset():this._tap.touchend(n,l,p)&&(this._tapTime=n.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class dl{constructor(n,l,p){this._el=n,this._mousePan=l,this._touchPan=p}enable(n){this._inertiaOptions=n||{},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 Wh{constructor(n,l,p){this._pitchWithRotate=n.pitchWithRotate,this._mouseRotate=l,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class cm{constructor(n,l,p,y){this._el=n,this._touchZoom=l,this._touchRotate=p,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(n){this._touchZoom.enable(n),this._rotationDisabled||this._touchRotate.enable(n),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const qh=f=>f.zoom||f.drag||f.pitch||f.rotate;class WS extends o.z{}class Kh{constructor(){this.constants=[1,1,.01],this.radius=0}setup(n,l){const p=o.av([],l,n);this.radius=o.ag(p[2]<0?o.eX([],p,this.constants):[p[0],p[1],0])}projectRay(n){o.eX(n,n,this.constants),o.aw(n,n),o.eY(n,n,this.constants);const l=o.c5([],n,this.radius);if(l[2]>0){const p=o.c5([],[0,0,1],o.bJ(l,[0,0,1])),y=o.c5([],o.aw([],[l[0],l[1],0]),this.radius),x=o.d8([],l,o.c5([],o.av([],o.d8([],y,p),l),2));l[0]=x[0],l[1]=x[1]}return l}}function um(f){return f.panDelta&&f.panDelta.mag()||f.zoomDelta||f.bearingDelta||f.pitchDelta}class qS{constructor(n,l){this._map=n,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ny(n),this._bearingSnap=l.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Kh,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(l),o.aY(["handleEvent","handleWindowEvent"],this);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,b]of this._listeners){const T=y===document?this.handleWindowEvent:this.handleEvent;y.addEventListener(x,T,b)}}destroy(){for(const[n,l,p]of this._listeners){const y=n===document?this.handleWindowEvent:this.handleEvent;n.removeEventListener(l,y,p)}}_addDefaultHandlers(n){const l=this._map,p=l.getCanvasContainer();this._add("mapEvent",new em(l,n));const y=l.boxZoom=new tm(l,n);this._add("boxZoom",y);const x=new Fx,b=new lm;l.doubleClickZoom=new Ol(b,x),this._add("tapZoom",x),this._add("clickZoom",b);const T=new ji;this._add("tapDragZoom",T);const A=l.touchPitch=new $S(l);this._add("touchPitch",A);const M=new ay(n),D=new ly(n);l.dragRotate=new Wh(n,M,D),this._add("mouseRotate",M,["mousePitch"]),this._add("mousePitch",D,["mouseRotate"]);const N=new Nx(n),B=new jx(l,n);l.dragPan=new dl(p,N,B),this._add("mousePan",N),this._add("touchPan",B,["touchZoom","touchRotate"]);const j=new ri,H=new US;l.touchZoomRotate=new cm(p,H,j,T),this._add("touchRotate",j,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),this._add("blockableMapEvent",new sy(l));const G=l.scrollZoom=new am(l,this);this._add("scrollZoom",G,["mousePan"]);const Q=l.keyboard=new HS;this._add("keyboard",Q);for(const J of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])n.interactive&&n[J]&&l[J].enable(n[J])}_add(n,l,p){this._handlers.push({handlerName:n,handler:l,allowed:p}),this._handlersById[n]=l}stop(n){if(!this._updatingCamera){for(const{handler:l}of this._handlers)l.reset();this._inertia.clear(),this._fireEvents({},{},n),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:n}of this._handlers)if(n.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qh(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(n,l,p){for(const y in n)if(y!==p&&(!l||l.indexOf(y)<0))return!0;return!1}handleWindowEvent(n){this.handleEvent(n,`${n.type}Window`)}_getMapTouches(n){const l=[];for(const p of n)this._el.contains(p.target)&&l.push(p);return l}handleEvent(n,l){this._updatingCamera=!0;const p=n.type==="renderFrame",y=p?void 0:n,x={needsRenderFrame:!1},b={},T={},A=n.touches?this._getMapTouches(n.touches):void 0,M=A?ft(this._el,A):p?void 0:Je(this._el,n);for(const{handlerName:B,handler:j,allowed:H}of this._handlers){if(!j.isEnabled())continue;let G;this._blockedByActive(T,H,B)?j.reset():j[l||n.type]&&(G=j[l||n.type](n,M,A),this.mergeHandlerResult(x,b,G,B,y),G&&G.needsRenderFrame&&this._triggerRenderFrame()),(G||j.isActive())&&(T[B]=j)}const D={};for(const B in this._previousActiveHandlers)T[B]||(D[B]=y);this._previousActiveHandlers=T,(Object.keys(D).length||um(x))&&(this._changes.push([x,b,D]),this._triggerRenderFrame()),(Object.keys(T).length||um(x))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:N}=x;N&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],N(this._map))}mergeHandlerResult(n,l,p,y,x){if(!p)return;Object.assign(n,p);const b={handlerName:y,originalEvent:p.originalEvent||x};p.zoomDelta!==void 0&&(l.zoom=b),p.panDelta!==void 0&&(l.drag=b),p.pitchDelta!==void 0&&(l.pitch=b),p.bearingDelta!==void 0&&(l.rotate=b)}_applyChanges(){const n={},l={},p={};for(const[y,x,b]of this._changes)y.panDelta&&(n.panDelta=(n.panDelta||new o.P(0,0))._add(y.panDelta)),y.zoomDelta&&(n.zoomDelta=(n.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(n.bearingDelta=(n.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(n.pitchDelta=(n.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(n.around=y.around),y.aroundCoord!==void 0&&(n.aroundCoord=y.aroundCoord),y.pinchAround!==void 0&&(n.pinchAround=y.pinchAround),y.noInertia&&(n.noInertia=y.noInertia),Object.assign(l,x),Object.assign(p,b);this._updateMapTransform(n,l,p),this._changes=[]}_updateMapTransform(n,l,p){const y=this._map,x=y.transform,b=ae=>[ae.x,ae.y,ae.z];if((ae=>{const de=this._eventsInProgress.drag;return de&&!this._handlersById[de.handlerName].isActive()})()&&!um(n)){const ae=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"),ae!==x.zoom&&this._map._update(!0)}if(x._isCameraConstrained&&y._stop(!0),!um(n))return void this._fireEvents(l,p,!0);let{panDelta:T,zoomDelta:A,bearingDelta:M,pitchDelta:D,around:N,aroundCoord:B,pinchAround:j}=n;x._isCameraConstrained&&(A>0&&(A=0),x._isCameraConstrained=!1),j!==void 0&&(N=j),(A||(ae=>l[ae]&&!this._eventsInProgress[ae])("drag"))&&N&&(this._dragOrigin=b(x.pointCoordinate3D(N)),this._originalZoom=x.zoom,this._trackingEllipsoid.setup(x._camera.position,this._dragOrigin)),x.cameraElevationReference="sea",y._stop(!0),N=N||y.transform.centerPoint,M&&(x.bearing+=M),D&&(x.pitch+=D),x._updateCameraState();const H=[0,0,0];if(T)if(x.projection.name==="mercator"){const ae=this._trackingEllipsoid.projectRay(x.screenPointToMercatorRay(N).dir),de=this._trackingEllipsoid.projectRay(x.screenPointToMercatorRay(N.sub(T)).dir);H[0]=de[0]-ae[0],H[1]=de[1]-ae[1]}else{const ae=x.pointCoordinate(N);if(x.projection.name==="globe"){T=T.rotate(-x.angle);const de=x._pixelsPerMercatorPixel/x.worldSize;H[0]=-T.x*o.eW(o.a$(ae.y))*de,H[1]=-T.y*o.eW(x.center.lat)*de}else{const de=x.pointCoordinate(N.sub(T));ae&&de&&(H[0]=de.x-ae.x,H[1]=de.y-ae.y)}}const G=x.zoom,Q=[0,0,0];if(A){const ae=b(B||x.pointCoordinate3D(N)),de={dir:o.aw([],o.av([],ae,x._camera.position))};if(de.dir[2]<0){const ce=x.zoomDeltaToMovement(ae,A);o.c5(Q,de.dir,ce)}}const J=o.d8(H,H,Q);x._translateCameraConstrained(J),A&&Math.abs(x.zoom-G)>1e-4&&x.recenterOnTerrain(),x.cameraElevationReference="ground",this._map._update(),n.noInertia||this._inertia.record(n),this._fireEvents(l,p,!0)}_fireEvents(n,l,p){const y=qh(this._eventsInProgress),x=qh(n),b={};for(const D in n){const{originalEvent:N}=n[D];this._eventsInProgress[D]||(b[`${D}start`]=N),this._eventsInProgress[D]=n[D]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const D in b)this._fireEvent(D,b[D]);x&&this._fireEvent("move",x.originalEvent);for(const D in n){const{originalEvent:N}=n[D];this._fireEvent(D,N)}const T={};let A;for(const D in this._eventsInProgress){const{handlerName:N,originalEvent:B}=this._eventsInProgress[D];this._handlersById[N].isActive()||(delete this._eventsInProgress[D],A=l[N]||B,T[`${D}end`]=A)}for(const D in T)this._fireEvent(D,T[D]);const M=qh(this._eventsInProgress);if(p&&(y||x)&&!M){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),N=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;D?(N(D.bearing||this._map.getBearing())&&(D.bearing=0),this._map.easeTo(D,{originalEvent:A})):(this._map.fire(new o.z("moveend",{originalEvent:A})),N(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(n,l){this._map.fire(new o.z(n,l?{originalEvent:l}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(n=>{this._frameId=void 0,this.handleEvent(new WS("renderFrame",{timeStamp:n})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const dm="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class dy extends o.E{constructor(n,l){super(),this._moving=!1,this._zooming=!1,this.transform=n,this._bearingSnap=l.bearingSnap,this._respectPrefersReducedMotion=l.respectPrefersReducedMotion!==!1,o.aY(["_renderFrameCallback"],this)}getCenter(){return new o.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(n,l){return this.jumpTo({center:n},l)}panBy(n,l,p){return n=o.P.convert(n).mult(-1),this.panTo(this.transform.center,Object.assign({offset:n},l),p)}panTo(n,l,p){return this.easeTo(Object.assign({center:n},l),p)}getZoom(){return this.transform.zoom}setZoom(n,l){return this.jumpTo({zoom:n},l),this}zoomTo(n,l,p){return this.easeTo(Object.assign({zoom:n},l),p)}zoomIn(n,l){return this.zoomTo(this.getZoom()+1,n,l),this}zoomOut(n,l){return this.zoomTo(this.getZoom()-1,n,l),this}getBearing(){return this.transform.bearing}setBearing(n,l){return this.jumpTo({bearing:n},l),this}getPadding(){return this.transform.padding}setPadding(n,l){return this.jumpTo({padding:n},l),this}rotateTo(n,l,p){return this.easeTo(Object.assign({bearing:n},l),p)}resetNorth(n,l){return this.rotateTo(0,Object.assign({duration:1e3},n),l),this}resetNorthPitch(n,l){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},n),l),this}snapToNorth(n,l){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(n,l):this}getPitch(){return this.transform.pitch}setPitch(n,l){return this.jumpTo({pitch:n},l),this}cameraForBounds(n,l){n=o.aI.convert(n);const p=l&&l.bearing||0,y=l&&l.pitch||0,x=n.getNorthWest(),b=n.getSouthEast();return this._cameraForBounds(this.transform,x,b,p,y,l)}_extendPadding(n){const l={top:0,right:0,bottom:0,left:0};return n==null?Object.assign({},l,this.transform.padding):typeof n=="number"?{top:n,bottom:n,right:n,left:n}:Object.assign({},l,n)}_extendCameraOptions(n){return(n=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding=this._extendPadding(n.padding),n}_minimumAABBFrustumDistance(n,l){const p=l.max[0]-l.min[0],y=l.max[1]-l.min[1];return p/y>n.aspect?p/(2*Math.tan(.5*n.fovX)*n.aspect):y/(2*Math.tan(.5*n.fovY)*n.aspect)}_cameraForBoundsOnGlobe(n,l,p,y,x,b){const T=n.clone(),A=this._extendCameraOptions(b);T.bearing=y,T.pitch=x;const M=o.aT.convert(l),D=o.aT.convert(p),N=.5*(M.lat+D.lat),B=.5*(M.lng+D.lng),j=o.eZ(N,B),H=o.aw([],j),G=o.aw([],o.bI([],H,[0,1,0])),Q=o.bI([],G,H),J=[G[0],G[1],G[2],0,Q[0],Q[1],Q[2],0,H[0],H[1],H[2],0,0,0,0,1],ae=[j,o.eZ(M.lat,M.lng),o.eZ(D.lat,M.lng),o.eZ(D.lat,D.lng),o.eZ(M.lat,D.lng),o.eZ(N,M.lng),o.eZ(N,D.lng),o.eZ(M.lat,B),o.eZ(D.lat,B)];let de=o.d9.fromPoints(ae.map(Ve=>[o.bJ(G,Ve),o.bJ(Q,Ve),o.bJ(H,Ve)]));const ce=o.af([],de.center,J);o.e_(ce)===0&&o.e$(ce,0,0,1),o.aw(ce,ce),o.c5(ce,ce,o.aD),T.center=o.f0(ce);const Se=T.getWorldToCameraMatrix(),ye=o.bl(new Float64Array(16),Se);de=o.d9.applyTransform(de,o.aB([],Se,J));const we=this._extendAABB(de,T,A,y);if(!we)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");de=we,o.af(ce,ce,Se);const _e=.5*(de.max[2]-de.min[2]),pe=this._minimumAABBFrustumDistance(T,de),Te=o.c5([],[0,0,1],_e),De=o.d8(Te,ce,Te),Me=pe+(T.pitch===0?0:o.bG(ce,De)),Ge=T.globeCenterInViewSpace,He=o.av([],ce,[Ge[0],Ge[1],Ge[2]]);o.aw(He,He),o.c5(He,He,Me);const et=o.d8([],ce,He);o.af(et,et,ye);const mt=o.eM/o.aD,Ne=o.ag(et),Ce=o.cf(Math.max(Ne*mt-o.eM,Number.EPSILON),0),Ke=Math.min(T.zoomFromMercatorZAdjusted(Ce),A.maxZoom);return Ke>.5*(o.c_+o.cL)?(T.setProjection({name:"mercator"}),T.zoom=Ke,this._cameraForBounds(T,l,p,y,x,b)):{center:T.center,zoom:Ke,bearing:y,pitch:x}}_extendAABB(n,l,p,y){const x=.5*((p.padding.left||0)+(p.padding.right||0)),b=.5*((p.padding.top||0)+(p.padding.bottom||0)),T=b,A=x,M=x,D=b,N=l.width-(A+M),B=l.height-(T+D),j=o.av([],n.max,n.min),H=Math.min(N/j[0],B/j[1]),G=Math.min(l.scaleZoom(l.scale*H),p.maxZoom);if(isNaN(G))return null;const Q=l.scale/l.zoomScale(G),J=new o.d9([n.min[0]-A*Q,n.min[1]-D*Q,n.min[2]],[n.max[0]+M*Q,n.max[1]+T*Q,n.max[2]]),ae=(typeof p.offset.x=="number"&&typeof p.offset.y=="number"?new o.P(p.offset.x,p.offset.y):o.P.convert(p.offset)).rotate(-o.an(y));return J.center[0]-=ae.x*Q,J.center[1]+=ae.y*Q,J}queryTerrainElevation(n,l){const p=this.transform.elevation;return p?(l=Object.assign({},{exaggerated:!0},l),p.getAtPoint(o.ae.fromLngLat(n),null,l.exaggerated)):null}_cameraForBounds(n,l,p,y,x,b){if(n.projection.name==="globe")return this._cameraForBoundsOnGlobe(n,l,p,y,x,b);const T=n.clone(),A=this._extendCameraOptions(b);T.bearing=y,T.pitch=x;const M=o.aT.convert(l),D=o.aT.convert(p),N=new o.aT(M.lng,D.lat),B=new o.aT(D.lng,M.lat),j=T.project(M),H=T.project(D),G=this.queryTerrainElevation(M),Q=this.queryTerrainElevation(D),J=this.queryTerrainElevation(N),ae=this.queryTerrainElevation(B),de=[[j.x,j.y,Math.min(G||0,Q||0,J||0,ae||0)],[H.x,H.y,Math.max(G||0,Q||0,J||0,ae||0)]];let ce=o.d9.fromPoints(de);const Se=T.getWorldToCameraMatrix(),ye=o.bl(new Float64Array(16),Se);ce=o.d9.applyTransform(ce,Se);const we=this._extendAABB(ce,T,A,y);if(!we)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");ce=we;const _e=.5*o.av([],ce.max,ce.min)[2],pe=this._minimumAABBFrustumDistance(T,ce),Te=[0,0,1,0];o.aC(Te,Te,Se),o.f1(Te,Te);const De=o.c5([],Te,pe+_e),Me=o.d8([],ce.center,De);o.af(ce.center,ce.center,ye),o.af(Me,Me,ye);const Ge=T.unproject(new o.P(ce.center[0],ce.center[1])),He=o.f2(T.projection,Ge),et=Math.pow(2,He),mt=Math.min(T._zoomFromMercatorZ(Me[2]*T.pixelsPerMeter*et/T.worldSize),A.maxZoom);return T.mercatorFromTransition&&mt<.5*(o.c_+o.cL)?(T.setProjection({name:"globe"}),T.zoom=mt,this._cameraForBounds(T,l,p,y,x,b)):{center:Ge,zoom:mt,bearing:y,pitch:x}}fitBounds(n,l,p){const y=this.cameraForBounds(n,l);return this._fitInternal(y,l,p)}fitScreenCoordinates(n,l,p,y,x){const b=o.P.convert(n),T=o.P.convert(l),A=new o.P(Math.min(b.x,T.x),Math.min(b.y,T.y)),M=new o.P(Math.max(b.x,T.x),Math.max(b.y,T.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(b,T))return this;const D=this.transform.pointLocation3D(A),N=this.transform.pointLocation3D(M),B=this.transform.pointLocation3D(new o.P(A.x,M.y)),j=this.transform.pointLocation3D(new o.P(M.x,A.y)),H=[Math.min(D.lng,N.lng,B.lng,j.lng),Math.min(D.lat,N.lat,B.lat,j.lat)],G=[Math.max(D.lng,N.lng,B.lng,j.lng),Math.max(D.lat,N.lat,B.lat,j.lat)],Q=y&&y.pitch?y.pitch:this.getPitch(),J=this._cameraForBounds(this.transform,H,G,p,Q,y);return this._fitInternal(J,y,x)}_fitInternal(n,l,p){return n?(l=Object.assign(n,l)).linear?this.easeTo(l,p):this.flyTo(l,p):this}jumpTo(n,l){this.stop();const p=n.preloadOnly?this.transform.clone():this.transform;let y=!1,x=!1,b=!1;"zoom"in n&&p.zoom!==+n.zoom&&(y=!0,p.zoom=+n.zoom),n.center!==void 0&&(p.center=o.aT.convert(n.center)),"bearing"in n&&p.bearing!==+n.bearing&&(x=!0,p.bearing=+n.bearing),"pitch"in n&&p.pitch!==+n.pitch&&(b=!0,p.pitch=+n.pitch);const T=typeof n.padding=="number"?this._extendPadding(n.padding):n.padding;if(n.padding!=null&&!p.isPaddingEqual(T))if(n.retainPadding===!1){const A=p.clone();A.padding=T,p.setLocationAtPoint(p.center,A.centerPoint)}else p.padding=T;return n.preloadOnly?(this._preloadTiles(p),this):(this.fire(new o.z("movestart",l)).fire(new o.z("move",l)),y&&this.fire(new o.z("zoomstart",l)).fire(new o.z("zoom",l)).fire(new o.z("zoomend",l)),x&&this.fire(new o.z("rotatestart",l)).fire(new o.z("rotate",l)).fire(new o.z("rotateend",l)),b&&this.fire(new o.z("pitchstart",l)).fire(new o.z("pitch",l)).fire(new o.z("pitchend",l)),this.fire(new o.z("moveend",l)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||o.w(dm),this.transform.getFreeCameraOptions()}setFreeCameraOptions(n,l){const p=this.transform;if(!p.projection.supportsFreeCamera)return o.w(dm),this;this.stop();const y=p.zoom,x=p.pitch,b=p.bearing;p.setFreeCameraOptions(n);const T=y!==p.zoom,A=x!==p.pitch,M=b!==p.bearing;return this.fire(new o.z("movestart",l)).fire(new o.z("move",l)),T&&this.fire(new o.z("zoomstart",l)).fire(new o.z("zoom",l)).fire(new o.z("zoomend",l)),M&&this.fire(new o.z("rotatestart",l)).fire(new o.z("rotate",l)).fire(new o.z("rotateend",l)),A&&this.fire(new o.z("pitchstart",l)).fire(new o.z("pitch",l)).fire(new o.z("pitchend",l)),this.fire(new o.z("moveend",l)),this}easeTo(n,l){this._stop(!1,n.easeId),((n=Object.assign({offset:[0,0],duration:500,easing:o.eV},n)).animate===!1||this._prefersReducedMotion(n))&&(n.duration=0);const p=this.transform,y=this.getZoom(),x=this.getBearing(),b=this.getPitch(),T=this.getPadding(),A="zoom"in n?+n.zoom:y,M="bearing"in n?this._normalizeBearing(n.bearing,x):x,D="pitch"in n?+n.pitch:b,N=this._extendPadding(n.padding),B=o.P.convert(n.offset);let j,H,G;if(p.projection.name==="globe"){const Te=o.ae.fromLngLat(p.center),De=B.rotate(-p.angle);Te.x+=De.x/p.worldSize,Te.y+=De.y/p.worldSize;const Me=Te.toLngLat(),Ge=o.aT.convert(n.center||Me);this._normalizeCenter(Ge),j=p.centerPoint.add(De),H=new o.P(Te.x,Te.y).mult(p.worldSize),G=new o.P(o.aF(Ge.lng),o.aJ(Ge.lat)).mult(p.worldSize).sub(H)}else{j=p.centerPoint.add(B);const Te=p.pointLocation(j),De=o.aT.convert(n.center||Te);this._normalizeCenter(De),H=p.project(Te),G=p.project(De).sub(H)}const Q=p.zoomScale(A-y);let J,ae;n.around&&(J=o.aT.convert(n.around),ae=p.locationPoint(J));const de=this._zooming||A!==y,ce=this._rotating||x!==M,Se=this._pitching||D!==b,ye=!p.isPaddingEqual(N),we=n.retainPadding===!1?p.clone():p,_e=Te=>De=>{if(de&&(Te.zoom=o.ak(y,A,De)),ce&&(Te.bearing=o.ak(x,M,De)),Se&&(Te.pitch=o.ak(b,D,De)),ye&&(we.interpolatePadding(T,N,De),j=we.centerPoint.add(B)),J)Te.setLocationAtPoint(J,ae);else{const Me=Te.zoomScale(Te.zoom-y),Ge=A>y?Math.min(2,Q):Math.max(.5,Q),He=Math.pow(Ge,1-De),et=Te.unproject(H.add(G.mult(De*He)).mult(Me));Te.setLocationAtPoint(Te.renderWorldCopies?et.wrap():et,j)}return n.preloadOnly||this._fireMoveEvents(l),Te};if(n.preloadOnly){const Te=this._emulate(_e,n.duration,p);return this._preloadTiles(Te),this}const pe={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=de,this._rotating=ce,this._pitching=Se,this._padding=ye,this._easeId=n.easeId,this._prepareEase(l,n.noMoveStart,pe),this._ease(_e(p),Te=>{p.cameraElevationReference==="sea"&&p.recenterOnTerrain(),this._afterEase(l,Te)},n),this}_prepareEase(n,l,p={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),l||p.moving||this.fire(new o.z("movestart",n)),this._zooming&&!p.zooming&&this.fire(new o.z("zoomstart",n)),this._rotating&&!p.rotating&&this.fire(new o.z("rotatestart",n)),this._pitching&&!p.pitching&&this.fire(new o.z("pitchstart",n))}_fireMoveEvents(n){this.fire(new o.z("move",n)),this._zooming&&this.fire(new o.z("zoom",n)),this._rotating&&this.fire(new o.z("rotate",n)),this._pitching&&this.fire(new o.z("pitch",n))}_afterEase(n,l){if(this._easeId&&l&&this._easeId===l)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const p=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new o.z("zoomend",n)),y&&this.fire(new o.z("rotateend",n)),x&&this.fire(new o.z("pitchend",n)),this.fire(new o.z("moveend",n))}flyTo(n,l){if(this._prefersReducedMotion(n)){const Ve=o.aH(n,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ve,l)}this.stop(),n=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:o.eV},n);const p=this.transform,y=this.getZoom(),x=this.getBearing(),b=this.getPitch(),T=this.getPadding(),A="zoom"in n?o.aA(+n.zoom,p.minZoom,p.maxZoom):y,M="bearing"in n?this._normalizeBearing(n.bearing,x):x,D="pitch"in n?+n.pitch:b,N=this._extendPadding(n.padding),B=p.zoomScale(A-y),j=o.P.convert(n.offset);let H=p.centerPoint.add(j);const G=p.pointLocation(H),Q=o.aT.convert(n.center||G);this._normalizeCenter(Q);const J=p.project(G),ae=p.project(Q).sub(J);let de=n.curve;const ce=Math.max(p.width,p.height),Se=ce/B,ye=ae.mag();if("minZoom"in n){const Ve=o.aA(Math.min(n.minZoom,y,A),p.minZoom,p.maxZoom),ot=ce/p.zoomScale(Ve-y);de=Math.sqrt(ot/ye*2)}const we=de*de;function _e(Ve){const ot=(Se*Se-ce*ce+(Ve?-1:1)*we*we*ye*ye)/(2*(Ve?Se:ce)*we*ye);return Math.log(Math.sqrt(ot*ot+1)-ot)}function pe(Ve){return(Math.exp(Ve)-Math.exp(-Ve))/2}function Te(Ve){return(Math.exp(Ve)+Math.exp(-Ve))/2}const De=_e(0);let Me=function(Ve){return Te(De)/Te(De+de*Ve)},Ge=function(Ve){return ce*((Te(De)*(pe(ot=De+de*Ve)/Te(ot))-pe(De))/we)/ye;var ot},He=(_e(1)-De)/de;if(Math.abs(ye)<1e-6||!isFinite(He)){if(Math.abs(ce-Se)<1e-6)return this.easeTo(n,l);const Ve=Se<ce?-1:1;He=Math.abs(Math.log(Se/ce))/de,Ge=function(){return 0},Me=function(ot){return Math.exp(Ve*de*ot)}}n.duration="duration"in n?+n.duration:1e3*He/("screenSpeed"in n?+n.screenSpeed/de:+n.speed),n.maxDuration&&n.duration>n.maxDuration&&(n.duration=0);const et=x!==M,mt=D!==b,Ne=!p.isPaddingEqual(N),Ce=n.retainPadding===!1?p.clone():p,Ke=Ve=>ot=>{const Tt=ot*He,zt=1/Me(Tt);Ve.zoom=ot===1?A:y+Ve.scaleZoom(zt),et&&(Ve.bearing=o.ak(x,M,ot)),mt&&(Ve.pitch=o.ak(b,D,ot)),Ne&&(Ce.interpolatePadding(T,N,ot),H=Ce.centerPoint.add(j));const wt=ot===1?Q:Ve.unproject(J.add(ae.mult(Ge(Tt))).mult(zt));return Ve.setLocationAtPoint(Ve.renderWorldCopies?wt.wrap():wt,H),Ve._updateCameraOnTerrain(),n.preloadOnly||this._fireMoveEvents(l),Ve};if(n.preloadOnly){const Ve=this._emulate(Ke,n.duration,p);return this._preloadTiles(Ve),this}return this._zooming=!0,this._rotating=et,this._pitching=mt,this._padding=Ne,this._prepareEase(l,!1),this._ease(Ke(p),()=>this._afterEase(l),n),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(n){}_cancelRenderFrame(n){}_stop(n,l){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const p=this._onEaseEnd;this._onEaseEnd=void 0,p.call(this,l)}if(!n){const p=this.handlers;p&&p.stop(!1)}return this}_ease(n,l,p){p.animate===!1||p.duration===0?(n(1),l()):(this._easeStart=o.o.now(),this._easeOptions=p,this._onEaseFrame=n,this._onEaseEnd=l,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const n=Math.min((o.o.now()-this._easeStart)/this._easeOptions.duration,1),l=this._onEaseFrame;l&&l(this._easeOptions.easing(n)),n<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(n,l){n=o.bT(n,-180,180);const p=Math.abs(n-l);return Math.abs(n-360-l)<p&&(n-=360),Math.abs(n+360-l)<p&&(n+=360),n}_normalizeCenter(n){const l=this.transform;if(l.maxBounds||l.projection.name!=="globe"&&!l.renderWorldCopies)return;const p=n.lng-l.center.lng;n.lng+=p>180?-360:p<-180?360:0}_prefersReducedMotion(n){return this._respectPrefersReducedMotion&&o.o.prefersReducedMotion&&!(n&&n.essential)}_emulate(n,l,p){const y=Math.ceil(15*l/1e3),x=[],b=n(p.clone());for(let T=0;T<=y;T++){const A=b(T/y);x.push(A.clone())}return x}_preloadTiles(n,l){}}class Zh{constructor(n={}){this.options=n,o.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(n){const l=this.options&&this.options.compact,p=n._getUIString("AttributionControl.ToggleAttribution");this._map=n,this._container=Z("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Z("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",p);const y=Z("span","mapboxgl-ctrl-icon",this._compactButton);return y.setAttribute("aria-hidden","true"),y.setAttribute("title",p),this._innerContainer=Z("div","mapboxgl-ctrl-attrib-inner",this._container),l&&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),l===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 n=this._editLink;n||(n=this._editLink=this._container.querySelector(".mapbox-improve-map"));const l=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.e.ACCESS_TOKEN}];if(n){const p=l.reduce((y,x,b)=>(x.value&&(y+=`${x.key}=${x.value}${b<l.length-1?"&":""}`),y),"?");n.href=`${o.e.FEEDBACK_URL}/${p}#${Ni(this._map,!0)}`,n.rel="noopener nofollow"}}_updateData(n){!n||(n.dataType!=="source"||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility")&&n.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let n=[];if(this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const l=this._map.style._mergedSourceCaches;for(const y in l){const x=l[y];if(x.used){const b=x.getSource();b.attribution&&n.indexOf(b.attribution)<0&&n.push(b.attribution)}}n.sort((y,x)=>y.length-x.length),n=n.filter((y,x)=>{for(let b=x+1;b<n.length;b++)if(n[b].indexOf(y)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?n=[...this.options.customAttribution,...n]:n.unshift(this.options.customAttribution));const p=n.map(y=>function(x){const b=new DOMParser().parseFromString(x,"text/html");return Array.from(b.body.querySelectorAll("*")).forEach(T=>{const A=T.textContent||"";if(T.tagName!=="A")return void T.replaceWith(b.createTextNode(A));const M=T.getAttribute("href");if(!M||!/^(https?:|mailto:)/i.test(M))return void T.replaceWith(b.createTextNode(A));const D=b.createElement("a");D.href=M,D.textContent=A,D.rel="noopener nofollow";const N=T.getAttribute("class");N&&(D.className=N),T.replaceWith(D)}),b.body.innerHTML}(y)).join(" | ");p!==this._attribHTML&&(this._attribHTML=p,n.length?(this._innerContainer.innerHTML=p,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 Xh{constructor(){o.aY(["_updateLogo","_updateCompact"],this)}onAdd(n){this._map=n,this._container=Z("div","mapboxgl-ctrl");const l=Z("a","mapboxgl-ctrl-logo");return l.target="_blank",l.rel="noopener nofollow",l.href="https://www.mapbox.com/",l.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),l.setAttribute("rel","noopener nofollow"),this._container.appendChild(l),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(n){n&&n.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const n=this._map.style._sourceCaches;if(Object.entries(n).length===0)return!0;for(const l in n){const p=n[l].getSource();if(p.hasOwnProperty("mapbox_logo")&&!p.mapbox_logo)return!1}return!0}_updateCompact(){const n=this._container.children;if(n.length){const l=n[0];this._map.getCanvasContainer().offsetWidth<250?l.classList.add("mapboxgl-compact"):l.classList.remove("mapboxgl-compact")}}}class pd{constructor(){o.aY(["_onIndoorUpdate"],this)}onAdd(n){return this._map=n,this._container=Z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",l=>this._onIndoorUpdate(l)),this._container}_createButton(n,l){const p=Z("button",n,this._container);return p.type="button",p.addEventListener("click",l),p}_createSeparator(){return Z("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(n,l){this._map&&(n.setAttribute("aria-label",l),n.textContent=l)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(n){if(!n||!n.floors)return this._model=n,void(this._container.style.display="none");const l=this._model;this._model=n,this._container.style.display="inline-block",this._container.style.borderRadius="8px",l&&Array.from(this._container.children).forEach(p=>p.remove()),n.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(n.floors,n.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const n=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const l=this._map;this._model&&l&&l._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});Z("span","mapboxgl-ctrl-icon",n).setAttribute("aria-hidden","true"),n.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&n.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(n),this._createSeparator()}_updateBuildingsButtonState(){const n=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");n&&this._model&&(this._model.activeFloorsVisible?n.classList.remove("mapboxgl-ctrl-level-button-selected"):n.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(n,l){for(let p=0;p<n.length;p++){const y=n[p],x=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(y.id)});this._setButtonTitle(x,y.zIndex.toString()),this._model&&y.id===this._model.selectedFloorId&&l&&x.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(x),p<n.length-1&&this._createSeparator()}}}class zl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(n){const l=++this._id;return this._queue.push({callback:n,id:l,cancelled:!1}),l}remove(n){const l=this._currentlyRunning,p=l?this._queue.concat(l):this._queue;for(const y of p)if(y.id===n)return void(y.cancelled=!0)}run(n=0){const l=this._currentlyRunning=this._queue;this._queue=[];for(const p of l)if(!p.cancelled&&(p.callback(n),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Fl{constructor(n){this.jumpTo(n)}getValue(n){if(n<=this._startTime)return this._start;if(n>=this._endTime)return this._end;const l=o.dD((n-this._startTime)/(this._endTime-this._startTime));return this._start*(1-l)+this._end*l}isEasing(n){return n>=this._startTime&&n<=this._endTime}jumpTo(n){this._startTime=-1/0,this._endTime=-1/0,this._start=n,this._end=n}easeTo(n,l,p){this._start=this.getValue(l),this._end=n,this._startTime=l,this._endTime=l+p}}const Bl={"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 Mc extends o.z{constructor(n,l,p,y){const{point:x,lngLat:b,originalEvent:T,target:A}=n;super(n.type,{point:x,lngLat:b,originalEvent:T,target:A}),this.preventDefault=()=>{n.preventDefault()},this.id=l,this.interaction=p,this.feature=y}}class Fa{constructor(n){this.map=n,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(n,l){if(this.typeById.has(n))throw new Error(`Interaction id "${n}" already exists.`);const p=l.filter;let y=l.type;p&&this.filters.set(n,o.b6(p)),y==="mouseover"&&(y="mouseenter"),y==="mouseout"&&(y="mouseleave");const x=this.interactionsByType.get(y)||new Map;y==="mouseenter"||y==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(n,l)):x.size===0&&this.map.on(y,this.handleType),x.size===0&&this.interactionsByType.set(y,x),x.set(n,l),this.typeById.set(n,y)}get(n){const l=this.typeById.get(n);if(!l)return;const p=this.interactionsByType.get(l);return p?p.get(n):void 0}remove(n){const l=this.typeById.get(n);if(!l)return;this.typeById.delete(n),this.filters.delete(n);const p=this.interactionsByType.get(l);p&&(p.delete(n),l==="mouseenter"||l==="mouseleave"?(this.delegatedInteractions.delete(n),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):p.size===0&&this.map.off(l,this.handleType))}queryTargets(n,l){const p=[];for(const[y,x]of l)x.target&&p.push({targetId:y,target:x.target,filter:this.filters.get(y)});return this.map.style.queryRenderedTargets(n,p,this.map.transform)}handleMove(n){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const l=this.queryTargets(n.point,Array.from(this.delegatedInteractions).reverse());l.length&&(n.type="mouseenter",this.handleType(n,l));const p=new Map;for(const[y,{feature:x}]of this.prevHoveredFeatures)this.hoveredFeatures.has(y)||p.set(x.id,x);p.size&&(n.type="mouseleave",this.handleType(n,Array.from(p.values())))}handleOut(n){const l=Array.from(this.hoveredFeatures.values()).map(({feature:p})=>p);l.length&&(n.type="mouseleave",this.handleType(n,l)),this.hoveredFeatures.clear()}handleType(n,l){const p=n.type==="mouseenter";if(p&&!this.interactionsByType.has(n.type))return void o.w("mouseenter interaction required for mouseleave to work.");const y=Array.from(this.interactionsByType.get(n.type)).reverse(),x=!!l;l=l||this.queryTargets(n.point,y);let b=!1;const T=new Set;for(const A of l){for(const[M,D]of y){if(!D.target)continue;const N=A.variants?A.variants[M]:null;if(N){for(const B of N){if(Wu(B,A,T,M))continue;const j=new o.dx(A,B),H=eu(B,A,M);x&&j.id!==void 0&&(j.state=this.map.getFeatureState(j));const G=p?this.prevHoveredFeatures.get(H):null,Q=new Mc(n,M,D,j),J=G?G.stop:D.handler(Q);if(p&&this.hoveredFeatures.set(H,{feature:A,stop:J}),J!==!1){b=!0;break}}if(b)break}}if(b)break}if(!b)for(const[A,M]of y){const{handler:D,target:N}=M;if(!N&&D(new Mc(n,A,M,null))!==!1)break}}}function KS(f,n){if(Array.isArray(f)&&Array.isArray(n)){const l=new Set(f),p=new Set(n);return l.size===p.size&&f.every(y=>p.has(y))}return o.by(f,n)}const ZS={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},XS={showCompass:!0,showZoom:!0,visualizePitch:!1};class YS{constructor(n,l,p=!1){this._clickTolerance=10,this.element=l,this.mouseRotate=new ay({clickTolerance:n.dragRotate._mouseRotate._clickTolerance}),this.map=n,p&&(this.mousePitch=new ly({clickTolerance:n.dragRotate._mousePitch._clickTolerance})),o.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),l.addEventListener("mousedown",this.mousedown),l.addEventListener("touchstart",this.touchstart,{passive:!1}),l.addEventListener("touchmove",this.touchmove),l.addEventListener("touchend",this.touchend),l.addEventListener("touchcancel",this.reset)}down(n,l){this.mouseRotate.mousedown(n,l),this.mousePitch&&this.mousePitch.mousedown(n,l),he()}move(n,l){const p=this.map,y=this.mouseRotate.mousemoveWindow(n,l),x=y&&y.bearingDelta;if(x&&p.setBearing(p.getBearing()+x),this.mousePitch){const b=this.mousePitch.mousemoveWindow(n,l),T=b&&b.pitchDelta;T&&p.setPitch(p.getPitch()+T)}}off(){const n=this.element;n.removeEventListener("mousedown",this.mousedown),n.removeEventListener("touchstart",this.touchstart),n.removeEventListener("touchmove",this.touchmove),n.removeEventListener("touchend",this.touchend),n.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Ie(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(n){this.down(Object.assign({},n,{ctrlKey:!0,preventDefault:()=>n.preventDefault()}),Je(this.element,n)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(n){this.move(n,Je(this.element,n))}mouseup(n){this.mouseRotate.mouseupWindow(n),this.mousePitch&&this.mousePitch.mouseupWindow(n),this.offTemp()}touchstart(n){n.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ft(this.element,n.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>n.preventDefault()},this._startPos))}touchmove(n){n.targetTouches.length!==1?this.reset():(this._lastPos=ft(this.element,n.targetTouches)[0],this.move({preventDefault:()=>n.preventDefault()},this._lastPos))}touchend(n){n.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 hy(f,n,l){if(f=new o.aT(f.lng,f.lat),n){const p=new o.aT(f.lng-360,f.lat),y=new o.aT(f.lng+360,f.lat),x=360*Math.ceil(Math.abs(f.lng-l.center.lng)/360),b=l.locationPoint3D(f).distSqr(n),T=n.x<0||n.y<0||n.x>l.width||n.y>l.height;l.locationPoint3D(p).distSqr(n)<b&&(T||Math.abs(p.lng-l.center.lng)<x)?f=p:l.locationPoint3D(y).distSqr(n)<b&&(T||Math.abs(y.lng-l.center.lng)<x)&&(f=y)}for(;Math.abs(f.lng-l.center.lng)>180;){const p=l.locationPoint3D(f);if(p.x>=0&&p.y>=0&&p.x<=l.width&&p.y<=l.height)break;f.lng>l.center.lng?f.lng-=360:f.lng+=360}return f}const Vs={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%)"},_a={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class hm extends o.E{constructor(n,l){super(),(n instanceof HTMLElement||l)&&(n=Object.assign({element:n},l)),o.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:p="center",color:y="#3FB1CE",scale:x=1,draggable:b=!1,clickTolerance:T=0,rotation:A=_a.rotation,rotationAlignment:M=_a.rotationAlignment,pitchAlignment:D=_a.pitchAlignment,occludedOpacity:N=_a.occludedOpacity,altitude:B=_a.altitude}=n||{};this._anchor=p,this._color=y,this._scale=x,this._draggable=b,this._clickTolerance=T,this._rotation=A,this._rotationAlignment=M,this._pitchAlignment=D,this._occludedOpacity=N,this._altitude=B,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),n&&n.element?(this._element=n.element,this._offset=o.P.convert(n&&n.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=o.P.convert(n&&n.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",G=>{G.preventDefault()}),this._element.addEventListener("mousedown",G=>{G.preventDefault()});const j=this._element.classList;for(const G in Vs)j.remove(`mapboxgl-marker-anchor-${G}`);j.add(`mapboxgl-marker-anchor-${this._anchor}`);const H=n&&n.className?n.className.trim().split(/\s+/):[];j.add(...H),this._popup=null}_createDefaultMarker(){const n=Z("div"),l=se("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},n);if(this._altitude===0){const p=se("radialGradient",{id:"shadowGradient"},se("defs",{},l));se("stop",{offset:"10%","stop-opacity":.4},p),se("stop",{offset:"100%","stop-opacity":.05},p),se("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},l)}return se("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"},l),se("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"},l),se("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},l),n}addTo(n){return n===this._map||(this.remove(),this._map=n,n.getCanvasContainer().appendChild(this._element),n.on("move",this._updateMoving),n.on("moveend",this._update),n.on("remove",this._clearFadeTimer),n._addMarker(this),this.setDraggable(this._draggable),this._update(),n.on("click",this._onMapClick)),this}remove(){const n=this._map;return n&&(n.off("click",this._onMapClick),n.off("move",this._updateMoving),n.off("moveend",this._update),n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler),n.off("mouseup",this._onUp),n.off("touchend",this._onUp),n.off("mousemove",this._onMove),n.off("touchmove",this._onMove),n.off("remove",this._clearFadeTimer),n._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(n){return this._lngLat=o.aT.convert(n),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(n){return n===this._altitude||(this._defaultMarker&&(this._altitude===0&&n!==0||this._altitude!==0&&n===0)&&(this._element=this._createDefaultMarker()),this._altitude=n||_a.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(n){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")),n){if(!("offset"in n.options)){const y=Math.sqrt(Math.pow(13.5,2)/2);n.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=n,n._marker=this,n._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(n){const l=n.code,p=n.charCode||n.keyCode;l!=="Space"&&l!=="Enter"&&p!==32&&p!==13||this.togglePopup()}_onMapClick(n){const l=n.originalEvent.target,p=this._element;this._popup&&(l===p||p.contains(l))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const n=this._popup;return n?(n.isOpen()?(n.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(n.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const n=this._map,l=this._pos;if(!n||!l)return!1;const p=n.unproject(l,this._altitude),y=n.getFreeCameraOptions();if(!y.position)return!1;const x=y.position.toLngLat();return x.distanceTo(p)<.9*x.distanceTo(this._lngLat)}_evaluateOpacity(){const n=this._map;if(!n)return;const l=this._pos;if(!l||l.x<0||l.x>n.transform.width||l.y<0||l.y>n.transform.height)return void this._clearFadeTimer();const p=n.unproject(l,this._altitude);let y;n._showingGlobe()&&o.f5(n.transform,this._lngLat)?y=0:(y=1-n._queryFogOpacity(p),n.transform._terrainEnabled()&&n.getTerrain()&&this._behindTerrain()&&(y*=this._occludedOpacity)),this._element.style.opacity=`${y}`,this._element.style.pointerEvents=y>0?"auto":"none",this._popup&&this._popup._setOpacity(y),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const n=this._pos;if(!n||!this._map)return;const l=this._offset.mult(this._scale);this._element.style.transform=`
|
||
translate(${n.x}px,${n.y}px)
|
||
${Vs[this._anchor]}
|
||
${this._calculateXYTransform()} ${this._calculateZTransform()}
|
||
translate(${l.x}px,${l.y}px)
|
||
`}_calculateXYTransform(){const n=this._pos,l=this._map,p=this.getPitchAlignment();if(!l||!n||p!=="map")return"";if(!l._showingGlobe()){const A=l.getPitch();return A?`rotateX(${A}deg)`:""}const y=o.cX(o.f6(l.transform,this._lngLat)),x=n.sub(o.f7(l.transform)),b=Math.abs(x.x)+Math.abs(x.y);if(b===0)return"";const T=y/b;return`rotateX(${-x.y*T}deg) rotateY(${x.x*T}deg)`}_calculateZTransform(){const n=this._pos,l=this._map;if(!l||!n)return"";let p=0;const y=this.getRotationAlignment();if(y==="map")if(l._showingGlobe()){const x=l.project(new o.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),b=l.project(new o.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(x);p=o.cX(Math.atan2(b.y,b.x))-90}else p=-l.getBearing();else if(y==="horizon"){const x=o.ah(4,6,l.getZoom()),b=o.f7(l.transform);b.y+=x*l.transform.height;const T=n.sub(b),A=o.cX(Math.atan2(T.y,T.x));p=(A>90?A-270:A+90)*(1-x)}return p+=this._rotation,p?`rotateZ(${p}deg)`:""}_update(n){cancelAnimationFrame(this._updateFrameId);const l=this._map;l&&(l.transform.renderWorldCopies&&(this._lngLat=hy(this._lngLat,this._pos,l.transform)),this._pos=l.project(this._lngLat,this._altitude),n===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),l._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(l._showingGlobe()||l.getTerrain()||l.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(n){return this._offset=o.P.convert(n),this._update(),this}addClassName(n){return this._element.classList.add(n),this}removeClassName(n){return this._element.classList.remove(n),this}toggleClassName(n){return this._element.classList.toggle(n)}_onMove(n){const l=this._map;if(!l)return;const p=this._pointerdownPos,y=this._positionDelta;if(p&&y){if(!this._isDragging){const x=this._clickTolerance||l._clickTolerance;if(n.point.dist(p)<x)return;this._isDragging=!0}this._pos=n.point.sub(y),this._lngLat=l.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.z("dragstart"))),this.fire(new o.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const n=this._map;n&&(n.off("mousemove",this._onMove),n.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new o.z("dragend")),this._state="inactive"}_addDragHandler(n){const l=this._map,p=this._pos;l&&p&&this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(p),this._pointerdownPos=n.point,this._state="pending",l.on("mousemove",this._onMove),l.on("touchmove",this._onMove),l.once("mouseup",this._onUp),l.once("touchend",this._onUp))}setDraggable(n){this._draggable=!!n;const l=this._map;return l&&(n?(l.on("mousedown",this._addDragHandler),l.on("touchstart",this._addDragHandler)):(l.off("mousedown",this._addDragHandler),l.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(n){return this._rotation=n||_a.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(n){return this._rotationAlignment=n||_a.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(n){return this._pitchAlignment=n||_a.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(n){return this._occludedOpacity=n||_a.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const JS={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},md={maxWidth:100,unit:"metric"},fy={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},ya={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},va=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function vu(f=new o.P(0,0),n="bottom"){if(typeof f=="number"){const l=Math.round(Math.sqrt(.5*Math.pow(f,2)));switch(n){case"top":return new o.P(0,f);case"top-left":return new o.P(l,l);case"top-right":return new o.P(-l,l);case"bottom":return new o.P(0,-f);case"bottom-left":return new o.P(l,-l);case"bottom-right":return new o.P(-l,-l);case"left":return new o.P(f,0);case"right":return new o.P(-f,0)}return new o.P(0,0)}return f instanceof o.P||Array.isArray(f)?o.P.convert(f):o.P.convert(f[n]||[0,0])}return{version:k,supported:Y.supported,setRTLTextPlugin:o.fb,getRTLTextPluginStatus:o.fa,Map:class extends dy{constructor(f){O.mark(P.create);const n=f;if((f=Object.assign({},ZS,f)).minZoom!=null&&f.maxZoom!=null&&f.minZoom>f.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(f.minPitch!=null&&f.maxPitch!=null&&f.minPitch>f.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(f.minPitch!=null&&f.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(f.maxPitch!=null&&f.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(f.antialias&&o.f3(window)&&(f.antialias=!1,o.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new g_(f.minZoom,f.maxZoom,f.minPitch,f.maxPitch,f.renderWorldCopies,null,null),f),this._repaint=!!f.repaint,this._interactive=f.interactive,this._minTileCacheSize=f.minTileCacheSize,this._maxTileCacheSize=f.maxTileCacheSize,this._failIfMajorPerformanceCaveat=f.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=f.preserveDrawingBuffer,this._antialias=f.antialias,this._trackResize=f.trackResize,this._bearingSnap=f.bearingSnap,this._refreshExpiredTiles=f.refreshExpiredTiles,this._fadeDuration=f.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=f.crossSourceCollisions,this._collectResourceTiming=f.collectResourceTiming,this._language=this._parseLanguage(f.language),this._worldview=f.worldview,this._renderTaskQueue=new zl,this._domRenderTaskQueue=new zl,this._controls=[],this._markers=[],this._popups=[],this._mapId=o.b2(),this._locale=Object.assign({},Bl,f.locale),this._clickTolerance=f.clickTolerance,this._cooperativeGestures=f.cooperativeGestures,this._performanceMetricsCollection=f.performanceMetricsCollection,this._tessellationStep=f.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=f.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Fl(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=f.scaleFactor,this._requestManager=new xt(f.transformRequest,f.accessToken,f.testMode),this._silenceAuthErrors=!!f.testMode,this._contextCreateOptions=f.contextCreateOptions?Object.assign({},f.contextCreateOptions):{},typeof f.container=="string"){const l=document.getElementById(f.container);if(!l)throw new Error(`Container '${f.container.toString()}' not found.`);this._container=l}else{if(!(f.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=f.container}if(this._container.childNodes.length>0&&o.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),f.maxBounds&&this.setMaxBounds(f.maxBounds),this._spriteFormat=f.spriteFormat,o.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new qS(this,f),this._localFontFamily=f.localFontFamily,this._localIdeographFontFamily=f.localIdeographFontFamily,(f.style||!f.testMode)&&this.setStyle(f.style||o.e.DEFAULT_STYLE,{config:f.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),f.projection&&this.setProjection(f.projection),f.hash&&(this._hash=new Q_(typeof f.hash=="string"&&f.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){n.center==null&&n.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch});const l=f.bounds;l&&(this.resize(),this.fitBounds(l,Object.assign({},f.fitBoundsOptions,{duration:0})))}this.resize(),f.attributionControl&&this.addControl(new Zh({customAttribution:f.customAttribution})),this._logoControl=new Xh,this.addControl(this._logoControl,f.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new o.z(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new o.z(`${l.dataType}dataloading`,l))}),this._interactions=new Fa(this)}_getMapId(){return this._mapId}addControl(f,n){if(n===void 0&&(n=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!f||!f.onAdd)return this.fire(new o.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const l=f.onAdd(this);this._controls.push(f);const p=this._controlPositions[n];return n.indexOf("bottom")!==-1?p.insertBefore(l,p.firstChild):p.appendChild(l),this}removeControl(f){if(!f||!f.onRemove)return this.fire(new o.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(f);return n>-1&&this._controls.splice(n,1),f.onRemove(this),this}hasControl(f){return this._controls.indexOf(f)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(f){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const n=!this._moving;return n&&this.fire(new o.z("movestart",f)).fire(new o.z("move",f)),this.fire(new o.z("resize",f)),n&&this.fire(new o.z("moveend",f)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(f){return this.transform.setMaxBounds(o.aI.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom)return this.transform.minZoom=f,this._update(),this.getZoom()<f?this.setZoom(f):this.fire(new o.z("zoomstart")).fire(new o.z("zoom")).fire(new o.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(f){if((f=f??22)>=this.transform.minZoom)return this.transform.maxZoom=f,this._update(),this.getZoom()>f?this.setZoom(f):this.fire(new o.z("zoomstart")).fire(new o.z("zoom")).fire(new o.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch)return this.transform.minPitch=f,this._update(),this.getPitch()<f?this.setPitch(f):this.fire(new o.z("pitchstart")).fire(new o.z("pitch")).fire(new o.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(f){if((f=f??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(f>=this.transform.minPitch)return this.transform.maxPitch=f,this._update(),this.getPitch()>f?this.setPitch(f):this.fire(new o.z("pitchstart")).fire(new o.z("pitch")).fire(new o.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(f){return this._scaleFactor=f,this.painter.scaleFactor=f,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(n=>n.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.renderWorldCopies=f,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(f){return f==="auto"?navigator.language:Array.isArray(f)?f.length===0?void 0:f.map(n=>n==="auto"?navigator.language:n):f}setLanguage(f){const n=this._parseLanguage(f);if(!this.style||n===this._language)return this;this._language=n,this.style.reloadSources();for(const l of this._controls)l._setLanguage&&l._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(f){return this.style&&f!==this._worldview?(this._worldview=f,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(f){return this._lazyInitEmptyStyle(),f?typeof f=="string"&&(f={name:f}):f=null,this._useExplicitProjection=!!f,this._prioritizeAndUpdateProjection(f,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const f=this.transform,n=f.projection.name;let l;n==="globe"&&f.zoom>=o.cL?(f.setMercatorFromTransition(),l=!0):n==="mercator"&&f.zoom<o.cL&&(f.setProjection({name:"globe"}),l=!0),l&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(f,n){return this._updateProjection(f||n||{name:"mercator"})}_updateProjection(f){let n;const l=this.transform.mercatorFromTransition;n=f.name==="globe"&&this.transform.zoom>=o.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(f),this.style.applyProjectionUpdate();const p=this.transform.getProjection().name==="mercator"&&l!==this.transform.mercatorFromTransition;return(n||p)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(f,n){return this.transform.locationPoint3D(o.aT.convert(f),n)}unproject(f,n){return this.transform.pointLocation3D(o.P.convert(f),n)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(f,n,l){const p=y=>{let x=[];if(Array.isArray(n)){const b=n.filter(T=>this.getLayer(T));x=b.length?this.queryRenderedFeatures(y,{layers:b}):[]}else x=this.queryRenderedFeatures(y,{target:n});return x};if(f==="mouseenter"||f==="mouseover"){let y=!1;return{listener:l,targets:n,delegates:{mousemove:b=>{const T=p(b.point);T.length?y||(y=!0,l.call(this,new To(f,this,b.originalEvent,{features:T}))):y=!1},mouseout:()=>{y=!1}}}}if(f==="mouseleave"||f==="mouseout"){let y=!1;return{listener:l,targets:n,delegates:{mousemove:T=>{p(T.point).length?y=!0:y&&(y=!1,l.call(this,new To(f,this,T.originalEvent)))},mouseout:T=>{y&&(y=!1,l.call(this,new To(f,this,T.originalEvent)))}}}}{const y=x=>{const b=p(x.point);b.length&&(x.features=b,l.call(this,x),delete x.features)};return{listener:l,targets:n,delegates:{[f]:y}}}}on(f,n,l){if(typeof n=="function"||l===void 0)return super.on(f,n);if(typeof n=="string"&&(n=[n]),!this._areTargetsValid(n))return this;const p=this._createDelegatedListener(f,n,l);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[f]=this._delegatedListeners[f]||[],this._delegatedListeners[f].push(p);for(const y in p.delegates)this.on(y,p.delegates[y]);return this}once(f,n,l){if(typeof n=="function"||l===void 0)return super.once(f,n);if(typeof n=="string"&&(n=[n]),!this._areTargetsValid(n))return this;const p=this._createDelegatedListener(f,n,l);for(const y in p.delegates)this.once(y,p.delegates[y]);return this}off(f,n,l){if(typeof n=="function"||l===void 0)return super.off(f,n);if(typeof n=="string"&&(n=[n]),!this._areTargetsValid(n))return this;const p=this._delegatedListeners?this._delegatedListeners[f]:void 0;return p&&(y=>{for(let x=0;x<y.length;x++){const b=y[x];if(b.listener===l&&KS(b.targets,n)){for(const T in b.delegates)this.off(T,b.delegates[T]);return y.splice(x,1),this}}})(p),this}queryRenderedFeatures(f,n){if(!this.style)return[];if(f===void 0||f instanceof o.P||Array.isArray(f)||n!==void 0||(n=f,f=void 0),f=f||[[0,0],[this.transform.width,this.transform.height]],!n){const x=this.style.queryRenderedFeatures(f,void 0,this.transform),b=this.style.queryRenderedFeatureset(f,void 0,this.transform);return x.concat(b)}let l=!0;if(n.target&&(l=this._isTargetValid(n.target),l&&!n.layers))return this.style.queryRenderedFeatureset(f,n,this.transform);let p=!0;if(n.layers&&Array.isArray(n.layers)){for(const x of n.layers)if(!this._isValidId(x)){p=!1;break}if(p&&!n.target)return this.style.queryRenderedFeatures(f,n,this.transform)}let y=[];return p&&(y=y.concat(this.style.queryRenderedFeatures(f,n,this.transform))),l&&(y=y.concat(this.style.queryRenderedFeatureset(f,n,this.transform))),y}querySourceFeatures(f,n){return!f||typeof f=="string"&&!this._isValidId(f)?[]:this.style.querySourceFeatures(f,n)}queryRasterValue(f,n,l){return this._isValidId(f)?this.style.queryRasterValue(f,n,l):Promise.resolve(null)}isPointOnSurface(f){const{name:n}=this.transform.projection;return n!=="globe"&&n!=="mercator"&&o.w(`${n} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(o.P.convert(f))}addInteraction(f,n){return this._interactions.add(f,n),this}removeInteraction(f){return this._interactions.remove(f),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(f){return this._cooperativeGestures=f,this}setStyle(f,n){return n=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},n),this.style&&f&&n.diff!==!1&&n.localFontFamily===this._localFontFamily&&n.localIdeographFontFamily===this._localIdeographFontFamily&&!n.config?(this.style._diffStyle(f,(l,p)=>{if(l){const y=typeof l=="string"?l:l instanceof Error?l.message:l.error;o.w(`Unable to perform style diff: ${y}. Rebuilding the style from scratch.`),this._updateStyle(f,n)}else p&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._localFontFamily=n.localFontFamily,this._updateStyle(f,n))}_getUIString(f){const n=this._locale[f];if(n==null)throw new Error(`Missing UI string '${f}'`);return n}_updateStyle(f,n){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),f){const l=Object.assign({},n);n&&n.config&&(l.initialConfig=n.config,delete l.config),this.style=new ga(this,l).load(f),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new ga(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():(o.w("There is no style added to the map."),!1)}_isValidId(f){return f==null?(this.fire(new o.y(new Error("IDs can't be empty."))),!1):!o.dr(f)||(this.fire(new o.y(new Error(`IDs can't contain special symbols: "${f}".`))),!1)}_isTargetValid(f){return"featuresetId"in f?this._isValidId("importId"in f?f.importId:f.featuresetId):"layerId"in f&&this._isValidId(f.layerId)}_areTargetsValid(f){if(Array.isArray(f)){for(const n of f)if(!this._isValidId(n))return!1;return!0}return this._isTargetValid(f)}addSource(f,n){return this._isValidId(f)?(this._lazyInitEmptyStyle(),this.style.addSource(f,n),this._update(!0)):this}isSourceLoaded(f){return!!this._isValidId(f)&&!!this.style&&this.style._isSourceCacheLoaded(f)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(f,n,l){this._lazyInitEmptyStyle(),this.style.addSourceType(f,n,l)}removeSource(f){return this._isValidId(f)?(this.style.removeSource(f),this._updateTerrain(),this._update(!0)):this}getSource(f){return this._isValidId(f)?this.style.getOwnSource(f):null}addImage(f,n,{pixelRatio:l=1,sdf:p=!1,stretchX:y,stretchY:x,content:b}={}){this._lazyInitEmptyStyle();const T=o.I.from(f);if(n instanceof HTMLImageElement||ImageBitmap&&n instanceof ImageBitmap){const{width:A,height:M,data:D}=o.o.getImageData(n);this.style.addImage(T,{data:new o.q({width:A,height:M},D),pixelRatio:l,stretchX:y,stretchY:x,content:b,sdf:p,version:0,usvg:!1})}else if(n.width===void 0||n.height===void 0)this.fire(new o.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:A,height:M}=n,D=n;this.style.addImage(T,{data:new o.q({width:A,height:M},new Uint8Array(D.data)),pixelRatio:l,stretchX:y,stretchY:x,content:b,sdf:p,usvg:!1,version:0,userImage:D}),D.onAdd&&D.onAdd(this,f)}}updateImage(f,n){this._lazyInitEmptyStyle();const l=o.I.from(f),p=this.style.getImage(l);if(!p)return void this.fire(new o.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const y=n instanceof HTMLImageElement||ImageBitmap&&n instanceof ImageBitmap?o.o.getImageData(n):n,{width:x,height:b,data:T}=y;if(x===void 0||b===void 0)return void this.fire(new o.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(x!==(p.usvg?p.icon.usvg_tree.width:p.data.width)||b!==(p.usvg?p.icon.usvg_tree.height:p.data.height))return void this.fire(new o.y(new Error(`The width and height of the updated image (${x}, ${b})
|
||
must be that same as the previous version of the image
|
||
(${p.data.width}, ${p.data.height})`)));const A=!(n instanceof HTMLImageElement||ImageBitmap&&n instanceof ImageBitmap);let M=!1;p.usvg?(p.data=new o.q({width:x,height:b},new Uint8Array(T)),p.usvg=!1,p.icon=void 0,M=!0):p.data.replace(T,A),this.style.updateImage(l,p,M)}hasImage(f){return f?!!this.style&&!!this.style.getImage(o.I.from(f)):(this.fire(new o.y(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(o.I.from(f))}loadImage(f,n){o.n(this._requestManager.transformRequest(f,o.R.Image),(l,p)=>{n(l,p instanceof HTMLImageElement?o.o.getImageData(p):p)})}listImages(){return this.style.listImages().map(f=>f.name)}addModel(f,n){this._lazyInitEmptyStyle(),this.style.addModel(f,n)}hasModel(f){return f?this.style.hasModel(f):(this.fire(new o.y(new Error("Missing required model id"))),!1)}removeModel(f){this.style.removeModel(f)}listModels(){return this.style.listModels()}addLayer(f,n){return this._isValidId(f.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(f,n),this._update(!0)):this}getSlot(f){const n=this.getLayer(f);return n&&n.slot||null}setSlot(f,n){return this.style.setSlot(f,n),this.style.mergeLayers(),this._update(!0)}addImport(f,n){return this.style.addImport(f,n).catch(l=>this.fire(new o.y(new Error("Failed to add import",l)))),this}updateImport(f,n){return typeof n!="string"&&n.id!==f?(this.removeImport(f),this.addImport(n)):(this.style.updateImport(f,n),this._update(!0))}removeImport(f){return this.style.removeImport(f),this}moveImport(f,n){return this.style.moveImport(f,n),this._update(!0)}moveLayer(f,n){return this._isValidId(f)?(this.style.moveLayer(f,n),this._update(!0)):this}removeLayer(f){return this._isValidId(f)?(this.style.removeLayer(f),this._update(!0)):this}getLayer(f){if(!this._isValidId(f))return null;const n=this.style.getOwnLayer(f);return n?n.type==="custom"?n.implementation:n.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(f,n,l){return this._isValidId(f)?(this.style.setLayerZoomRange(f,n,l),this._update(!0)):this}setFilter(f,n,l={}){return this._isValidId(f)?(this.style.setFilter(f,n,l),this._update(!0)):this}getFilter(f){return this._isValidId(f)?this.style.getFilter(f):null}setPaintProperty(f,n,l,p={}){return this._isValidId(f)?(this.style.setPaintProperty(f,n,l,p),this._update(!0)):this}getPaintProperty(f,n){return this._isValidId(f)?this.style.getPaintProperty(f,n):null}setLayoutProperty(f,n,l,p={}){return this._isValidId(f)?(this.style.setLayoutProperty(f,n,l,p),this._update(!0)):this}getLayoutProperty(f,n){return this._isValidId(f)?this.style.getLayoutProperty(f,n):null}setLayerProperty(f,n,l,p={}){return this._isValidId(f)?(n==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(f,n,l,p),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(f){return this.style.setGlyphsUrl(f),this._update(!0)}getSchema(f){return this.style.getSchema(f)}setSchema(f,n){return this.style.setSchema(f,n),this._update(!0)}getConfig(f){return this.style.getConfig(f)}setConfig(f,n){return this.style.setConfig(f,n),this._update(!0)}getConfigProperty(f,n){return this.style.getConfigProperty(f,n)}setConfigProperty(f,n,l){return this.style.setConfigProperty(f,n,l),this._update(!0)}getFeaturesetDescriptors(f){return this.style.getFeaturesetDescriptors(f)}setLights(f){if(this._lazyInitEmptyStyle(),f&&f.length===1&&f[0].type==="flat"){const n=f[0];n.properties?this.style.setFlatLight(n.properties,n.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(f),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const f=this.style.getLights()||[];return f.length===0&&f.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),f}setLight(f,n={}){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:f}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(f){return this._lazyInitEmptyStyle(),!f&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(f),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(f){return this._lazyInitEmptyStyle(),this.style.setFog(f),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(f){return this._lazyInitEmptyStyle(),this.style.setSnow(f),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(f){return this._lazyInitEmptyStyle(),this.style.setRain(f),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(f){return this._lazyInitEmptyStyle(),this.style.setColorTheme(f),this._update(!0)}setImportColorTheme(f,n){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(f,n),this._update(!0)}setCamera(f){return this.style.setCamera(f),this._triggerCameraUpdate(f)}_triggerCameraUpdate(f){return this._update(this.transform.setOrthographicProjectionAtLowPitch(f["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(f){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(o.aT.convert(f),this.transform):0}setFeatureState(f,n){return f.source&&!this._isValidId(f.source)?this:(this.style.setFeatureState(f,n),this._update())}removeFeatureState(f,n){return f.source&&!this._isValidId(f.source)?this:(this.style.removeFeatureState(f,n),this._update())}getFeatureState(f){return f.source&&!this._isValidId(f.source)?null:this.style.getFeatureState(f)}_selectIndoorFloor(f){this.indoor.selectFloor(f)}_setIndoorActiveFloorsVisibility(f){this.indoor.setActiveFloorsVisibility(f)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new pd),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const f=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300;let l,p,y,x=this._container;for(;x&&(!p||!y);){const b=window.getComputedStyle(x).transform;b&&b!=="none"&&(l=b.match(/matrix.*\((.+)\)/)[1].split(", "),l[0]&&l[0]!=="0"&&l[0]!=="1"&&(p=l[0]),l[3]&&l[3]!=="0"&&l[3]!=="1"&&(y=l[3])),x=x.parentElement}this._containerWidth=p?Math.abs(f/p):f,this._containerHeight=y?Math.abs(n/y):n}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&o.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new X0(this.style),this.on("load",()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}),this.on("idle",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})}))}_setupContainer(){const f=this._container;f.classList.add("mapboxgl-map"),(this._missingCSSCanary=Z("div","mapboxgl-canary",f)).style.visibility="hidden",this._detectMissingCSS();const n=this._canvasContainer=Z("div","mapboxgl-canvas-container",f);this._canvas=Z("canvas","mapboxgl-canvas",n),this._interactive&&(n.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 l=this._controlContainer=Z("div","mapboxgl-control-container",f),p=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(y=>{p[y]=Z("div",`mapboxgl-ctrl-${y}`,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(f,n){const l=o.o.devicePixelRatio||1;this._canvas.width=l*Math.ceil(f),this._canvas.height=l*Math.ceil(n),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${n}px`}_addMarker(f){this._markers.push(f)}_removeMarker(f){const n=this._markers.indexOf(f);n!==-1&&this._markers.splice(n,1)}_addPopup(f){this._popups.push(f)}_removePopup(f){const n=this._popups.indexOf(f);n!==-1&&this._popups.splice(n,1)}_setupPainter(){const f=Object.assign({},Y.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl2",f);n?(Zi(n,!0),this.painter=new Jp(n,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",l=>{l.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),o.k.testSupport(n)):this.fire(new o.y(new Error("Failed to initialize WebGL")))}_contextLost(f){f.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.z("webglcontextlost",{originalEvent:f}))}_contextRestored(f){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new o.z("webglcontextrestored",{originalEvent:f}))}_onMapScroll(f){if(f.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(f){return this.style?(this._styleDirty=this._styleDirty||f,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_requestDomTask(f){!this.loaded()||this.loaded()&&!this.isMoving()?f():this._domRenderTaskQueue.add(f)}_render(f){let n;this.fire(new o.z("renderstart")),++this._frameId;const l=this.painter.context.extTimerQuery,p=o.o.now(),y=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(n=y.createQuery(),y.beginQuery(l.TIME_ELAPSED_EXT,n)),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(f),this._domRenderTaskQueue.run(f),this._removed)return;this._updateProjectionTransition();const x=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const M=this.transform.zoom,D=this.transform.pitch,N=o.o.now(),B=new o.ac(M,{now:N,fadeDuration:x,pitch:D,transition:this.style.transition,worldview:this._worldview});this.style.update(B)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let b=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),b=this._updateAverageElevation(p),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):b=this._updateAverageElevation(p);const T=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,x,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),T&&(this._placementDirty=T.needsRerender),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 o.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,O.mark(P.load),this.fire(new o.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){const M=o.o.now()-p;y.endQuery(l.TIME_ELAPSED_EXT),setTimeout(()=>{const D=y.getQueryParameter(n,y.QUERY_RESULT)/1e6;y.deleteQuery(n),this.fire(new o.z("gpu-timing-frame",{cpuTime:M,gpuTime:D}))},50)}if(this.listens("gpu-timing-layer")){const M=this.painter.collectGpuTimers();setTimeout(()=>{const D=this.painter.queryGpuTimers(M);this.fire(new o.z("gpu-timing-layer",{layerTimes:D}))},50)}if(this.listens("gpu-timing-deferred-render")){const M=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const D=this.painter.queryGpuTimeDeferredRender(M);this.fire(new o.z("gpu-timing-deferred-render",{gpuTime:D}))},50)}const A=this._sourcesDirty||this._styleDirty||this._placementDirty||b;if(A||this._repaint)this.triggerRepaint();else{const M=this.idle();if(M&&(b=this._updateAverageElevation(p,!0)),b)this.triggerRepaint();else if(this._triggerFrame(!1),M&&(this.fire(new o.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const D=this._calculateSpeedIndex();this.fire(new o.z("speedindexcompleted",{speedIndex:D})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||A||(this._fullyLoaded=!0,O.mark(P.fullLoad),this._performanceMetricsCollection&&Un(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(f){for(const n of this._markers)f&&!this.getRenderWorldCopies()&&(n._lngLat=n._lngLat.wrap()),n._update();for(const n of this._popups)!f||this.getRenderWorldCopies()||n._trackPointer||(n._lngLat=n._lngLat.wrap()),n._update()}_updateAverageElevation(f,n=!1){const l=y=>(this.transform.averageElevation=y,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&l(0);const p=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(p||(n||f-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(f)){const y=this.transform.averageElevation;let x=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(x)?x=0:this._averageElevationLastSampledAt=f;const b=Math.abs(y-x);if(b>1){if(this._isInitialLoad||p)return this._averageElevation.jumpTo(x),l(x);this._averageElevation.easeTo(x,f,300)}else if(b>1e-4)return this._averageElevation.jumpTo(x),l(x)}return!!this._averageElevation.isEasing(f)&&l(this._averageElevation.getValue(f))}_authenticate(){so(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,f=>{if(f&&(f.message===Qe||f.status===401)){const n=this.painter.context.gl;Zi(n,!1),this._logoControl instanceof Xh&&this._logoControl._updateLogo(),n&&n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT|n.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new o.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),mi(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&xn(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&un(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){gi(this._requestManager._customAccessToken)}_updateTerrain(){const f=this._isDragging();this.painter.updateTerrain(this.style,f)}_calculateSpeedIndex(){const f=this.painter.canvasCopy(),n=this.painter.getCanvasCopiesAndTimestamps();n.timeStamps.push(performance.now());const l=this.painter.context.gl,p=l.createFramebuffer();function y(x){l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,x,0);const b=new Uint8Array(l.drawingBufferWidth*l.drawingBufferHeight*4);return l.readPixels(0,0,l.drawingBufferWidth,l.drawingBufferHeight,l.RGBA,l.UNSIGNED_BYTE,b),b}return l.bindFramebuffer(l.FRAMEBUFFER,p),this._canvasPixelComparison(y(f),n.canvasCopies.map(y),n.timeStamps)}_canvasPixelComparison(f,n,l){let p=l[1]-l[0];const y=f.length/4;for(let x=0;x<n.length;x++){const b=n[x];let T=0;for(let A=0;A<b.length;A+=4)b[A]===f[A]&&b[A+1]===f[A+1]&&b[A+2]===f[A+2]&&b[A+3]===f[A+3]&&(T+=1);p+=(l[x+2]-l[x+1])*(1-T/y)}return p}remove(){this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor&&this.indoor.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 f=this.painter.context.gl.getExtension("WEBGL_lose_context");f&&f.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),Ki.delete(this.painter.context.gl),io.remove(),Gr.remove(),this._removed=!0,this.fire(new o.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(f){this._renderNextFrame=this._renderNextFrame||f,this.style&&!this._frame&&(this._frame=o.o.frame(n=>{const l=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,l&&this._render(n)}))}_preloadTiles(f){const n=this.style?this.style.getSourceCaches():[];return o.bw(n,(l,p)=>l._preloadTiles(f,p),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(f){this._trackResize&&this.resize({originalEvent:f})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(f){this._showParseStatus!==f&&(this._showParseStatus=f,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(f){this._showTerrainWireframe!==f&&(this._showTerrainWireframe=f,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(f){this._showLayers2DWireframe!==f&&(this._showLayers2DWireframe=f,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(f){this._showLayers3DWireframe!==f&&(this._showLayers3DWireframe=f,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(f){this._speedIndexTiming!==f&&(this._speedIndexTiming=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,this.style&&f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(f){this._showTileAABBs!==f&&(this._showTileAABBs=f,f&&this._update())}_setCacheLimits(f,n){o.f4(f,n)}get version(){return k}},NavigationControl:class{constructor(f={}){this.options=Object.assign({},XS,f),this._container=Z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",n=>n.preventDefault()),this.options.showZoom&&(o.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",n=>{this._map&&this._map.zoomIn({},{originalEvent:n})}),Z("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",n=>{this._map&&this._map.zoomOut({},{originalEvent:n})}),Z("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",n=>{const l=this._map;l&&(this.options.visualizePitch?l.resetNorthPitch({},{originalEvent:n}):l.resetNorth({},{originalEvent:n}))}),this._compassIcon=Z("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const f=this._map;if(!f)return;const n=f.getZoom(),l=n===f.getMaxZoom(),p=n===f.getMinZoom();this._zoomInButton.disabled=l,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",l.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())}_rotateCompassArrow(){const f=this._map;if(!f)return;const n=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(f.transform.pitch*(Math.PI/180)),.5)}) rotateX(${f.transform.pitch}deg) rotateZ(${f.transform.angle*(180/Math.PI)}deg)`:`rotate(${f.transform.angle*(180/Math.PI)}deg)`;f._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=n)})}onAdd(f){return this._map=f,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),f.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&f.on("pitch",this._rotateCompassArrow),f.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new YS(f,this._compass,this.options.visualizePitch)),this._container}onRemove(){const f=this._map;f&&(this._container.remove(),this.options.showZoom&&f.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&f.off("pitch",this._rotateCompassArrow),f.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(f,n){const l=Z("button",f,this._container);return l.type="button",l.addEventListener("click",n),l}_setButtonTitle(f,n){if(!this._map)return;const l=this._map._getUIString(`NavigationControl.${n}`);f.setAttribute("aria-label",l),f.firstElementChild&&f.firstElementChild.setAttribute("title",l)}},GeolocateControl:class extends o.E{constructor(f={}){super();const n=navigator.geolocation;this.options=Object.assign({geolocation:n},JS,f),o.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Qp(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(f){return this._map=f,this._container=Z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(f){const n=(l=!!this.options.geolocation)=>{this._supportsGeolocation=l,f(l)};this._supportsGeolocation!==void 0?f(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(l=>n(l.state!=="denied")).catch(()=>n()):n()}_isOutOfMapMaxBounds(f){const n=this._map.getMaxBounds(),l=f.coords;return!!n&&(l.longitude<n.getWest()||l.longitude>n.getEast()||l.latitude<n.getSouth()||l.latitude>n.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(f){if(this._map){if(this._isOutOfMapMaxBounds(f))return this._setErrorState(),this.fire(new o.z("outofmaxbounds",f)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=f,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(f),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(f),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.z("geolocate",Object.assign({coords:f.coords,timestamp:f.timestamp},f.toJSON?{toJSON:f.toJSON.bind(f)}:{}))),this._finish()}}_updateCamera(f){const n=new o.aT(f.coords.longitude,f.coords.latitude),l=f.coords.accuracy,p=this._map.getBearing(),y=Object.assign({bearing:p},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(l),y,{geolocateSource:!0})}_updateMarker(f){if(f){const n=new o.aT(f.coords.longitude,f.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=f.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const f=this._map.transform,n=o.cf(1,f._center.lat)*f.worldSize,l=Math.ceil(2*this._accuracy*n);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}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(f){if(this._map){if(this.options.trackUserLocation)if(f.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(f.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.z("error",f)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(f){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",n=>n.preventDefault()),this._geolocateButton=Z("button","mapboxgl-ctrl-geolocate",this._container),Z("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",f===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Z("div","mapboxgl-user-location"),this._dotElement.appendChild(Z("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Z("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new hm({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Z("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new hm({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.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 o.z("trackuserlocationend")))})}}_onDeviceOrientation(f){this._userLocationDotMarker&&(f.webkitCompassHeading?this._heading=f.webkitCompassHeading:f.absolute===!0&&(this._heading=-1*f.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let f;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(f={maximumAge:6e5,timeout:0},this._noTimeout=!0):(f=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,f),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const f=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(n=>{n==="granted"&&f()}).catch(console.error):f()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Zh,ScaleControl:class{constructor(f={}){this.options=Object.assign({},md,f),o.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const f=this.options.maxWidth||100,n=this._map,l=n._containerHeight/2,p=n._containerWidth/2-f/2,y=n.unproject([p,l]),x=n.unproject([p+f,l]),b=y.distanceTo(x);if(this.options.unit==="imperial"){const T=3.2808*b;T>5280?this._setScale(f,T/5280,"mile"):this._setScale(f,T,"foot")}else this.options.unit==="nautical"?this._setScale(f,b/1852,"nautical-mile"):b>=1e3?this._setScale(f,b/1e3,"kilometer"):this._setScale(f,b,"meter")}_setScale(f,n,l){this._map._requestDomTask(()=>{const p=function(x){const b=Math.pow(10,`${Math.floor(x)}`.length-1);let T=x/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(A){const M=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*M)/M}(T),b*T}(n),y=p/n;this._container.innerHTML=l!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:l}).format(p):`${p} ${fy[l]}`,this._container.style.width=f*y+"px"})}onAdd(f){return this._map=f,this._language=f.getLanguage(),this._container=Z("div","mapboxgl-ctrl mapboxgl-ctrl-scale",f.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(f){this._language=f,this._update()}setUnit(f){this.options.unit=f,this._update()}},FullscreenControl:class{constructor(f={}){this._fullscreen=!1,f&&f.container&&(f.container instanceof HTMLElement?this._container=f.container:o.w("Full screen control 'container' must be a DOM element.")),o.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=Z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const f=this._fullscreenButton=Z("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Z("span","mapboxgl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",f)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(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:pd,Popup:class extends o.E{constructor(f){super(),this.options=Object.assign(Object.create(ya),f),this._altitude=this.options.altitude,o.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(f&&f.className?f.className.trim().split(/\s+/):[])}addTo(f){return this._map&&this.remove(),this._map=f,this.options.closeOnClick&&f.on("preclick",this._onClose),this.options.closeOnMove&&f.on("move",this._onClose),f.on("remove",this.remove),this._update(),f._addPopup(this),this._focusFirstElement(),this._trackPointer?(f.on("mousemove",this._onMouseEvent),f.on("mouseup",this._onMouseEvent),f._canvasContainer.classList.add("mapboxgl-track-pointer")):f.on("move",this._update),this.fire(new o.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const f=this._map;return f&&(f.off("move",this._update),f.off("move",this._onClose),f.off("preclick",this._onClose),f.off("click",this._onClose),f.off("remove",this.remove),f.off("mousemove",this._onMouseEvent),f.off("mouseup",this._onMouseEvent),f.off("drag",this._onMouseEvent),f._canvasContainer&&f._canvasContainer.classList.remove("mapboxgl-track-pointer"),f._removePopup(this),this._map=void 0),this.fire(new o.z("close")),this}getLngLat(){return this._lngLat}setLngLat(f){this._lngLat=o.aT.convert(f),this._pos=null,this._trackPointer=!1,this._update();const n=this._map;return n&&(n.on("move",this._update),n.off("mousemove",this._onMouseEvent),n._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(f){return this._altitude=f,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const f=this._map;return f&&(f.off("move",this._update),f.on("mousemove",this._onMouseEvent),f.on("drag",this._onMouseEvent),f._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const n=document.createDocumentFragment(),l=document.createElement("body");let p;for(l.innerHTML=f;p=l.firstChild,p;)n.appendChild(p);return this.setDOMContent(n)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){let n=this._content;if(n)for(;n.hasChildNodes();)n.firstChild&&n.removeChild(n.firstChild);else n=this._content=Z("div","mapboxgl-popup-content",this._container||void 0);if(n.appendChild(f),this.options.closeButton){const l=this._closeButton=Z("button","mapboxgl-popup-close-button",n);l.type="button",l.setAttribute("aria-label","Close popup"),l.innerHTML='<span aria-hidden="true">×</span>',l.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(f){return this._classList.add(f),this._updateClassList(),this}removeClassName(f){return this._classList.delete(f),this._updateClassList(),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){let n;return this._classList.delete(f)?n=!1:(this._classList.add(f),n=!0),this._updateClassList(),n}_onMouseEvent(f){this._update(f.point)}_getAnchor(f){if(this.options.anchor)return this.options.anchor;const n=this._map,l=this._container,p=this._pos;if(!n||!l||!p)return"bottom";const y=l.offsetWidth,x=l.offsetHeight,b=p.x<y/2,T=p.x>n.transform.width-y/2;if(p.y+f<x)return b?"top-left":T?"top-right":"top";if(p.y>n.transform.height-x){if(b)return"bottom-left";if(T)return"bottom-right"}return b?"left":T?"right":"bottom"}_updateClassList(){const f=this._container;if(!f)return;const n=[...this._classList];n.push("mapboxgl-popup"),this._anchor&&n.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&n.push("mapboxgl-popup-track-pointer"),f.className=n.join(" ")}_update(f){const n=this._map,l=this._content;if(!n||!this._lngLat&&!this._trackPointer||!l)return;let p=this._container;if(p||(p=this._container=Z("div","mapboxgl-popup",n.getContainer()),this._tip=Z("div","mapboxgl-popup-tip",p),p.appendChild(l)),this.options.maxWidth&&p.style.maxWidth!==this.options.maxWidth&&(p.style.maxWidth=this.options.maxWidth),n.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=hy(this._lngLat,this._pos,n.transform)),!this._trackPointer||f){const y=this._pos=this._trackPointer&&f instanceof o.P?f:n.project(this._lngLat,this._altitude),x=vu(this.options.offset),b=this._anchor=this._getAnchor(x.y),T=vu(this.options.offset,b),A=y.add(T).round();n._requestDomTask(()=>{this._container&&b&&(this._container.style.transform=`${Vs[b]} translate(${A.x}px,${A.y}px)`)})}if(!this._marker&&n._showingGlobe()){const y=o.f5(n.transform,this._lngLat)?0:1;this._setOpacity(y)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(va);f&&f.focus()}_onClose(){this.remove()}_setOpacity(f){this._container&&(this._container.style.opacity=`${f}`),this._content&&(this._content.style.pointerEvents=f?"auto":"none")}},Marker:hm,Style:ga,LngLat:o.aT,LngLatBounds:o.aI,Point:o.P,MercatorCoordinate:o.ae,FreeCameraOptions:co,Evented:o.E,config:o.e,prewarm:o.f9,clearPrewarmedResources:o.f8,get accessToken(){return o.e.ACCESS_TOKEN},set accessToken(f){o.e.ACCESS_TOKEN=f},get baseApiUrl(){return o.e.API_URL},set baseApiUrl(f){o.e.API_URL=f},get workerCount(){return o.fi.workerCount},set workerCount(f){o.fi.workerCount=f},get maxParallelImageRequests(){return o.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(f){o.e.MAX_PARALLEL_IMAGE_REQUESTS=f},clearStorage(f){o.fh(f)},get workerUrl(){return o.fg.workerUrl},set workerUrl(f){o.fg.workerUrl=f},get workerClass(){return o.fg.workerClass},set workerClass(f){o.fg.workerClass=f},get workerParams(){return o.fg.workerParams},set workerParams(f){o.fg.workerParams=f},get dracoUrl(){return o.ff()},set dracoUrl(f){o.fe(f)},get meshoptUrl(){return o.fd()},set meshoptUrl(f){o.fc(f)},setNow:o.o.setNow,restoreNow:o.o.restoreNow}});var w=h;return w})})(_4);var BY=_4.exports;const Eu=FA(BY),NY="https://api.quixzoom.com/api/qz/mapbox-token",jY="pk.eyJ1IjoiY2VydGlmaWVkMTIiLCJhIjoiY21qbnNiN3o3MWZrcDNlc2RocDY2c2hocSJ9.KUWxgt0u05f8jYUrOLaADA";let lb=null,JO=0;const VY=5*60*1e3;async function v4(){if(lb&&Date.now()<JO)return lb;try{const t=new AbortController,e=window.setTimeout(()=>t.abort(),4e3),s=await fetch(NY,{signal:t.signal});if(window.clearTimeout(e),s.ok){const u=await s.json();if(u!=null&&u.token)return lb=u.token,JO=Date.now()+VY,lb}}catch(t){console.warn("[mapToken] AMOS fetch failed, using fallback:",t)}return jY}const UY=FC("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"}}),$a=X.forwardRef(({className:t,variant:e,size:s,asChild:u=!1,...h},_)=>{const w=u?HW:"button";return le.jsx(w,{className:ki(UY({variant:e,size:s,className:t})),ref:_,...h})});$a.displayName="Button";const Jk=X.forwardRef(({className:t,...e},s)=>le.jsx("div",{ref:s,className:ki("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Jk.displayName="Card";const $Y=X.forwardRef(({className:t,...e},s)=>le.jsx("div",{ref:s,className:ki("flex flex-col space-y-1.5 p-6",t),...e}));$Y.displayName="CardHeader";const GY=X.forwardRef(({className:t,...e},s)=>le.jsx("h3",{ref:s,className:ki("text-2xl font-semibold leading-none tracking-tight",t),...e}));GY.displayName="CardTitle";const HY=X.forwardRef(({className:t,...e},s)=>le.jsx("p",{ref:s,className:ki("text-sm text-muted-foreground",t),...e}));HY.displayName="CardDescription";const WY=X.forwardRef(({className:t,...e},s)=>le.jsx("div",{ref:s,className:ki("p-6 pt-0",t),...e}));WY.displayName="CardContent";const qY=X.forwardRef(({className:t,...e},s)=>le.jsx("div",{ref:s,className:ki("flex items-center p-6 pt-0",t),...e}));qY.displayName="CardFooter";const x4=X.createContext({});function KY(t){const e=X.useRef(null);return e.current===null&&(e.current=t()),e.current}const rI=typeof window<"u",ZY=rI?X.useLayoutEffect:X.useEffect,nI=X.createContext(null);function iI(t,e){t.indexOf(e)===-1&&t.push(e)}function sI(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const Vu=(t,e,s)=>s>e?e:s<t?t:s;let oI=()=>{};const Uu={},w4=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function b4(t){return typeof t=="object"&&t!==null}const S4=t=>/^0[^.\s]+$/u.test(t);function aI(t){let e;return()=>(e===void 0&&(e=t()),e)}const bl=t=>t,XY=(t,e)=>s=>e(t(s)),L0=(...t)=>t.reduce(XY),h0=(t,e,s)=>{const u=e-t;return u===0?1:(s-t)/u};class lI{constructor(){this.subscriptions=[]}add(e){return iI(this.subscriptions,e),()=>sI(this.subscriptions,e)}notify(e,s,u){const h=this.subscriptions.length;if(h)if(h===1)this.subscriptions[0](e,s,u);else for(let _=0;_<h;_++){const w=this.subscriptions[_];w&&w(e,s,u)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Kc=t=>t*1e3,xl=t=>t/1e3;function T4(t,e){return e?t*(1e3/e):0}const E4=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,YY=1e-7,JY=12;function QY(t,e,s,u,h){let _,w,o=0;do w=e+(s-e)/2,_=E4(w,u,h)-t,_>0?s=w:e=w;while(Math.abs(_)>YY&&++o<JY);return w}function O0(t,e,s,u){if(t===e&&s===u)return bl;const h=_=>QY(_,0,1,t,s);return _=>_===0||_===1?_:E4(h(_),e,u)}const k4=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,A4=t=>e=>1-t(1-e),C4=O0(.33,1.53,.69,.99),cI=A4(C4),I4=k4(cI),P4=t=>(t*=2)<1?.5*cI(t):.5*(2-Math.pow(2,-10*(t-1))),uI=t=>1-Math.sin(Math.acos(t)),M4=A4(uI),R4=k4(uI),eJ=O0(.42,0,1,1),tJ=O0(0,0,.58,1),D4=O0(.42,0,.58,1),rJ=t=>Array.isArray(t)&&typeof t[0]!="number",L4=t=>Array.isArray(t)&&typeof t[0]=="number",nJ={linear:bl,easeIn:eJ,easeInOut:D4,easeOut:tJ,circIn:uI,circInOut:R4,circOut:M4,backIn:cI,backInOut:I4,backOut:C4,anticipate:P4},iJ=t=>typeof t=="string",QO=t=>{if(L4(t)){oI(t.length===4);const[e,s,u,h]=t;return O0(e,s,u,h)}else if(iJ(t))return nJ[t];return t},cb=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function sJ(t,e){let s=new Set,u=new Set,h=!1,_=!1;const w=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function k(O){w.has(O)&&(P.schedule(O),t()),O(o)}const P={schedule:(O,F=!1,V=!1)=>{const Y=V&&h?s:u;return F&&w.add(O),Y.has(O)||Y.add(O),O},cancel:O=>{u.delete(O),w.delete(O)},process:O=>{if(o=O,h){_=!0;return}h=!0,[s,u]=[u,s],s.forEach(k),s.clear(),h=!1,_&&(_=!1,P.process(O))}};return P}const oJ=40;function O4(t,e){let s=!1,u=!0;const h={delta:0,timestamp:0,isProcessing:!1},_=()=>s=!0,w=cb.reduce((oe,he)=>(oe[he]=sJ(_),oe),{}),{setup:o,read:k,resolveKeyframes:P,preUpdate:O,update:F,preRender:V,render:$,postRender:Y}=w,Z=()=>{const oe=Uu.useManualTiming?h.timestamp:performance.now();s=!1,Uu.useManualTiming||(h.delta=u?1e3/60:Math.max(Math.min(oe-h.timestamp,oJ),1)),h.timestamp=oe,h.isProcessing=!0,o.process(h),k.process(h),P.process(h),O.process(h),F.process(h),V.process(h),$.process(h),Y.process(h),h.isProcessing=!1,s&&e&&(u=!1,t(Z))},se=()=>{s=!0,u=!0,h.isProcessing||t(Z)};return{schedule:cb.reduce((oe,he)=>{const Ie=w[he];return oe[he]=(Be,je=!1,Je=!1)=>(s||se(),Ie.schedule(Be,je,Je)),oe},{}),cancel:oe=>{for(let he=0;he<cb.length;he++)w[cb[he]].cancel(oe)},state:h,steps:w}}const{schedule:ls,cancel:ah,state:Po,steps:nE}=O4(typeof requestAnimationFrame<"u"?requestAnimationFrame:bl,!0);let Fb;function aJ(){Fb=void 0}const ka={now:()=>(Fb===void 0&&ka.set(Po.isProcessing||Uu.useManualTiming?Po.timestamp:performance.now()),Fb),set:t=>{Fb=t,queueMicrotask(aJ)}},z4=t=>e=>typeof e=="string"&&e.startsWith(t),F4=z4("--"),lJ=z4("var(--"),dI=t=>lJ(t)?cJ.test(t.split("/*")[0].trim()):!1,cJ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,n_={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},f0={...n_,transform:t=>Vu(0,1,t)},ub={...n_,default:1},Lv=t=>Math.round(t*1e5)/1e5,hI=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function uJ(t){return t==null}const dJ=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,fI=(t,e)=>s=>!!(typeof s=="string"&&dJ.test(s)&&s.startsWith(t)||e&&!uJ(s)&&Object.prototype.hasOwnProperty.call(s,e)),B4=(t,e,s)=>u=>{if(typeof u!="string")return u;const[h,_,w,o]=u.match(hI);return{[t]:parseFloat(h),[e]:parseFloat(_),[s]:parseFloat(w),alpha:o!==void 0?parseFloat(o):1}},hJ=t=>Vu(0,255,t),iE={...n_,transform:t=>Math.round(hJ(t))},bf={test:fI("rgb","red"),parse:B4("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:u=1})=>"rgba("+iE.transform(t)+", "+iE.transform(e)+", "+iE.transform(s)+", "+Lv(f0.transform(u))+")"};function fJ(t){let e="",s="",u="",h="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),u=t.substring(5,7),h=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),u=t.substring(3,4),h=t.substring(4,5),e+=e,s+=s,u+=u,h+=h),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(u,16),alpha:h?parseInt(h,16)/255:1}}const Qk={test:fI("#"),parse:fJ,transform:bf.transform},z0=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Md=z0("deg"),Zc=z0("%"),Dr=z0("px"),pJ=z0("vh"),mJ=z0("vw"),ez={...Zc,parse:t=>Zc.parse(t)/100,transform:t=>Zc.transform(t*100)},cg={test:fI("hsl","hue"),parse:B4("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:u=1})=>"hsla("+Math.round(t)+", "+Zc.transform(Lv(e))+", "+Zc.transform(Lv(s))+", "+Lv(f0.transform(u))+")"},Ws={test:t=>bf.test(t)||Qk.test(t)||cg.test(t),parse:t=>bf.test(t)?bf.parse(t):cg.test(t)?cg.parse(t):Qk.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?bf.transform(t):cg.transform(t),getAnimatableNone:t=>{const e=Ws.parse(t);return e.alpha=0,Ws.transform(e)}},gJ=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function _J(t){var e,s;return isNaN(t)&&typeof t=="string"&&(((e=t.match(hI))==null?void 0:e.length)||0)+(((s=t.match(gJ))==null?void 0:s.length)||0)>0}const N4="number",j4="color",yJ="var",vJ="var(",tz="${}",xJ=/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 p0(t){const e=t.toString(),s=[],u={color:[],number:[],var:[]},h=[];let _=0;const o=e.replace(xJ,k=>(Ws.test(k)?(u.color.push(_),h.push(j4),s.push(Ws.parse(k))):k.startsWith(vJ)?(u.var.push(_),h.push(yJ),s.push(k)):(u.number.push(_),h.push(N4),s.push(parseFloat(k))),++_,tz)).split(tz);return{values:s,split:o,indexes:u,types:h}}function V4(t){return p0(t).values}function U4(t){const{split:e,types:s}=p0(t),u=e.length;return h=>{let _="";for(let w=0;w<u;w++)if(_+=e[w],h[w]!==void 0){const o=s[w];o===N4?_+=Lv(h[w]):o===j4?_+=Ws.transform(h[w]):_+=h[w]}return _}}const wJ=t=>typeof t=="number"?0:Ws.test(t)?Ws.getAnimatableNone(t):t;function bJ(t){const e=V4(t);return U4(t)(e.map(wJ))}const lh={test:_J,parse:V4,createTransformer:U4,getAnimatableNone:bJ};function sE(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function SJ({hue:t,saturation:e,lightness:s,alpha:u}){t/=360,e/=100,s/=100;let h=0,_=0,w=0;if(!e)h=_=w=s;else{const o=s<.5?s*(1+e):s+e-s*e,k=2*s-o;h=sE(k,o,t+1/3),_=sE(k,o,t),w=sE(k,o,t-1/3)}return{red:Math.round(h*255),green:Math.round(_*255),blue:Math.round(w*255),alpha:u}}function E1(t,e){return s=>s>0?e:t}const vs=(t,e,s)=>t+(e-t)*s,oE=(t,e,s)=>{const u=t*t,h=s*(e*e-u)+u;return h<0?0:Math.sqrt(h)},TJ=[Qk,bf,cg],EJ=t=>TJ.find(e=>e.test(t));function rz(t){const e=EJ(t);if(!e)return!1;let s=e.parse(t);return e===cg&&(s=SJ(s)),s}const nz=(t,e)=>{const s=rz(t),u=rz(e);if(!s||!u)return E1(t,e);const h={...s};return _=>(h.red=oE(s.red,u.red,_),h.green=oE(s.green,u.green,_),h.blue=oE(s.blue,u.blue,_),h.alpha=vs(s.alpha,u.alpha,_),bf.transform(h))},eA=new Set(["none","hidden"]);function kJ(t,e){return eA.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function AJ(t,e){return s=>vs(t,e,s)}function pI(t){return typeof t=="number"?AJ:typeof t=="string"?dI(t)?E1:Ws.test(t)?nz:PJ:Array.isArray(t)?$4:typeof t=="object"?Ws.test(t)?nz:CJ:E1}function $4(t,e){const s=[...t],u=s.length,h=t.map((_,w)=>pI(_)(_,e[w]));return _=>{for(let w=0;w<u;w++)s[w]=h[w](_);return s}}function CJ(t,e){const s={...t,...e},u={};for(const h in s)t[h]!==void 0&&e[h]!==void 0&&(u[h]=pI(t[h])(t[h],e[h]));return h=>{for(const _ in u)s[_]=u[_](h);return s}}function IJ(t,e){const s=[],u={color:0,var:0,number:0};for(let h=0;h<e.values.length;h++){const _=e.types[h],w=t.indexes[_][u[_]],o=t.values[w]??0;s[h]=o,u[_]++}return s}const PJ=(t,e)=>{const s=lh.createTransformer(e),u=p0(t),h=p0(e);return u.indexes.var.length===h.indexes.var.length&&u.indexes.color.length===h.indexes.color.length&&u.indexes.number.length>=h.indexes.number.length?eA.has(t)&&!h.values.length||eA.has(e)&&!u.values.length?kJ(t,e):L0($4(IJ(u,h),h.values),s):E1(t,e)};function G4(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?vs(t,e,s):pI(t)(t,e)}const MJ=t=>{const e=({timestamp:s})=>t(s);return{start:(s=!0)=>ls.update(e,s),stop:()=>ah(e),now:()=>Po.isProcessing?Po.timestamp:ka.now()}},H4=(t,e,s=10)=>{let u="";const h=Math.max(Math.round(e/s),2);for(let _=0;_<h;_++)u+=Math.round(t(_/(h-1))*1e4)/1e4+", ";return`linear(${u.substring(0,u.length-2)})`},k1=2e4;function mI(t){let e=0;const s=50;let u=t.next(e);for(;!u.done&&e<k1;)e+=s,u=t.next(e);return e>=k1?1/0:e}function RJ(t,e=100,s){const u=s({...t,keyframes:[0,e]}),h=Math.min(mI(u),k1);return{type:"keyframes",ease:_=>u.next(h*_).value/e,duration:xl(h)}}const DJ=5;function W4(t,e,s){const u=Math.max(e-DJ,0);return T4(s-t(u),e-u)}const As={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},aE=.001;function LJ({duration:t=As.duration,bounce:e=As.bounce,velocity:s=As.velocity,mass:u=As.mass}){let h,_,w=1-e;w=Vu(As.minDamping,As.maxDamping,w),t=Vu(As.minDuration,As.maxDuration,xl(t)),w<1?(h=P=>{const O=P*w,F=O*t,V=O-s,$=tA(P,w),Y=Math.exp(-F);return aE-V/$*Y},_=P=>{const F=P*w*t,V=F*s+s,$=Math.pow(w,2)*Math.pow(P,2)*t,Y=Math.exp(-F),Z=tA(Math.pow(P,2),w);return(-h(P)+aE>0?-1:1)*((V-$)*Y)/Z}):(h=P=>{const O=Math.exp(-P*t),F=(P-s)*t+1;return-aE+O*F},_=P=>{const O=Math.exp(-P*t),F=(s-P)*(t*t);return O*F});const o=5/t,k=zJ(h,_,o);if(t=Kc(t),isNaN(k))return{stiffness:As.stiffness,damping:As.damping,duration:t};{const P=Math.pow(k,2)*u;return{stiffness:P,damping:w*2*Math.sqrt(u*P),duration:t}}}const OJ=12;function zJ(t,e,s){let u=s;for(let h=1;h<OJ;h++)u=u-t(u)/e(u);return u}function tA(t,e){return t*Math.sqrt(1-e*e)}const FJ=["duration","bounce"],BJ=["stiffness","damping","mass"];function iz(t,e){return e.some(s=>t[s]!==void 0)}function NJ(t){let e={velocity:As.velocity,stiffness:As.stiffness,damping:As.damping,mass:As.mass,isResolvedFromDuration:!1,...t};if(!iz(t,BJ)&&iz(t,FJ))if(t.visualDuration){const s=t.visualDuration,u=2*Math.PI/(s*1.2),h=u*u,_=2*Vu(.05,1,1-(t.bounce||0))*Math.sqrt(h);e={...e,mass:As.mass,stiffness:h,damping:_}}else{const s=LJ(t);e={...e,...s,mass:As.mass},e.isResolvedFromDuration=!0}return e}function A1(t=As.visualDuration,e=As.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:u,restDelta:h}=s;const _=s.keyframes[0],w=s.keyframes[s.keyframes.length-1],o={done:!1,value:_},{stiffness:k,damping:P,mass:O,duration:F,velocity:V,isResolvedFromDuration:$}=NJ({...s,velocity:-xl(s.velocity||0)}),Y=V||0,Z=P/(2*Math.sqrt(k*O)),se=w-_,te=xl(Math.sqrt(k/O)),ee=Math.abs(se)<5;u||(u=ee?As.restSpeed.granular:As.restSpeed.default),h||(h=ee?As.restDelta.granular:As.restDelta.default);let oe;if(Z<1){const Ie=tA(te,Z);oe=Be=>{const je=Math.exp(-Z*te*Be);return w-je*((Y+Z*te*se)/Ie*Math.sin(Ie*Be)+se*Math.cos(Ie*Be))}}else if(Z===1)oe=Ie=>w-Math.exp(-te*Ie)*(se+(Y+te*se)*Ie);else{const Ie=te*Math.sqrt(Z*Z-1);oe=Be=>{const je=Math.exp(-Z*te*Be),Je=Math.min(Ie*Be,300);return w-je*((Y+Z*te*se)*Math.sinh(Je)+Ie*se*Math.cosh(Je))/Ie}}const he={calculatedDuration:$&&F||null,next:Ie=>{const Be=oe(Ie);if($)o.done=Ie>=F;else{let je=Ie===0?Y:0;Z<1&&(je=Ie===0?Kc(Y):W4(oe,Ie,Be));const Je=Math.abs(je)<=u,ft=Math.abs(w-Be)<=h;o.done=Je&&ft}return o.value=o.done?w:Be,o},toString:()=>{const Ie=Math.min(mI(he),k1),Be=H4(je=>he.next(Ie*je).value,Ie,30);return Ie+"ms "+Be},toTransition:()=>{}};return he}A1.applyToOptions=t=>{const e=RJ(t,100,A1);return t.ease=e.ease,t.duration=Kc(e.duration),t.type="keyframes",t};function rA({keyframes:t,velocity:e=0,power:s=.8,timeConstant:u=325,bounceDamping:h=10,bounceStiffness:_=500,modifyTarget:w,min:o,max:k,restDelta:P=.5,restSpeed:O}){const F=t[0],V={done:!1,value:F},$=Je=>o!==void 0&&Je<o||k!==void 0&&Je>k,Y=Je=>o===void 0?k:k===void 0||Math.abs(o-Je)<Math.abs(k-Je)?o:k;let Z=s*e;const se=F+Z,te=w===void 0?se:w(se);te!==se&&(Z=te-F);const ee=Je=>-Z*Math.exp(-Je/u),oe=Je=>te+ee(Je),he=Je=>{const ft=ee(Je),kt=oe(Je);V.done=Math.abs(ft)<=P,V.value=V.done?te:kt};let Ie,Be;const je=Je=>{$(V.value)&&(Ie=Je,Be=A1({keyframes:[V.value,Y(V.value)],velocity:W4(oe,Je,V.value),damping:h,stiffness:_,restDelta:P,restSpeed:O}))};return je(0),{calculatedDuration:null,next:Je=>{let ft=!1;return!Be&&Ie===void 0&&(ft=!0,he(Je),je(Je)),Ie!==void 0&&Je>=Ie?Be.next(Je-Ie):(!ft&&he(Je),V)}}}function jJ(t,e,s){const u=[],h=s||Uu.mix||G4,_=t.length-1;for(let w=0;w<_;w++){let o=h(t[w],t[w+1]);if(e){const k=Array.isArray(e)?e[w]||bl:e;o=L0(k,o)}u.push(o)}return u}function VJ(t,e,{clamp:s=!0,ease:u,mixer:h}={}){const _=t.length;if(oI(_===e.length),_===1)return()=>e[0];if(_===2&&e[0]===e[1])return()=>e[1];const w=t[0]===t[1];t[0]>t[_-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=jJ(e,u,h),k=o.length,P=O=>{if(w&&O<t[0])return e[0];let F=0;if(k>1)for(;F<t.length-2&&!(O<t[F+1]);F++);const V=h0(t[F],t[F+1],O);return o[F](V)};return s?O=>P(Vu(t[0],t[_-1],O)):P}function UJ(t,e){const s=t[t.length-1];for(let u=1;u<=e;u++){const h=h0(0,e,u);t.push(vs(s,1,h))}}function $J(t){const e=[0];return UJ(e,t.length-1),e}function GJ(t,e){return t.map(s=>s*e)}function HJ(t,e){return t.map(()=>e||D4).splice(0,t.length-1)}function Ov({duration:t=300,keyframes:e,times:s,ease:u="easeInOut"}){const h=rJ(u)?u.map(QO):QO(u),_={done:!1,value:e[0]},w=GJ(s&&s.length===e.length?s:$J(e),t),o=VJ(w,e,{ease:Array.isArray(h)?h:HJ(e,h)});return{calculatedDuration:t,next:k=>(_.value=o(k),_.done=k>=t,_)}}const WJ=t=>t!==null;function gI(t,{repeat:e,repeatType:s="loop"},u,h=1){const _=t.filter(WJ),o=h<0||e&&s!=="loop"&&e%2===1?0:_.length-1;return!o||u===void 0?_[o]:u}const qJ={decay:rA,inertia:rA,tween:Ov,keyframes:Ov,spring:A1};function q4(t){typeof t.type=="string"&&(t.type=qJ[t.type])}class _I{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,s){return this.finished.then(e,s)}}const KJ=t=>t/100;class yI extends _I{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var u,h;const{motionValue:s}=this.options;s&&s.updatedAt!==ka.now()&&this.tick(ka.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(h=(u=this.options).onStop)==null||h.call(u))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;q4(e);const{type:s=Ov,repeat:u=0,repeatDelay:h=0,repeatType:_,velocity:w=0}=e;let{keyframes:o}=e;const k=s||Ov;k!==Ov&&typeof o[0]!="number"&&(this.mixKeyframes=L0(KJ,G4(o[0],o[1])),o=[0,100]);const P=k({...e,keyframes:o});_==="mirror"&&(this.mirroredGenerator=k({...e,keyframes:[...o].reverse(),velocity:-w})),P.calculatedDuration===null&&(P.calculatedDuration=mI(P));const{calculatedDuration:O}=P;this.calculatedDuration=O,this.resolvedDuration=O+h,this.totalDuration=this.resolvedDuration*(u+1)-h,this.generator=P}updateTime(e){const s=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(e,s=!1){const{generator:u,totalDuration:h,mixKeyframes:_,mirroredGenerator:w,resolvedDuration:o,calculatedDuration:k}=this;if(this.startTime===null)return u.next(0);const{delay:P=0,keyframes:O,repeat:F,repeatType:V,repeatDelay:$,type:Y,onUpdate:Z,finalKeyframe:se}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-h/this.speed,this.startTime)),s?this.currentTime=e:this.updateTime(e);const te=this.currentTime-P*(this.playbackSpeed>=0?1:-1),ee=this.playbackSpeed>=0?te<0:te>h;this.currentTime=Math.max(te,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=h);let oe=this.currentTime,he=u;if(F){const Je=Math.min(this.currentTime,h)/o;let ft=Math.floor(Je),kt=Je%1;!kt&&Je>=1&&(kt=1),kt===1&&ft--,ft=Math.min(ft,F+1),!!(ft%2)&&(V==="reverse"?(kt=1-kt,$&&(kt-=$/o)):V==="mirror"&&(he=w)),oe=Vu(0,1,kt)*o}const Ie=ee?{done:!1,value:O[0]}:he.next(oe);_&&(Ie.value=_(Ie.value));let{done:Be}=Ie;!ee&&k!==null&&(Be=this.playbackSpeed>=0?this.currentTime>=h:this.currentTime<=0);const je=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Be);return je&&Y!==rA&&(Ie.value=gI(O,this.options,se,this.speed)),Z&&Z(Ie.value),je&&this.finish(),Ie}then(e,s){return this.finished.then(e,s)}get duration(){return xl(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+xl(e)}get time(){return xl(this.currentTime)}set time(e){var s;e=Kc(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(s=this.driver)==null||s.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(ka.now());const s=this.playbackSpeed!==e;this.playbackSpeed=e,s&&(this.time=xl(this.currentTime))}play(){var h,_;if(this.isStopped)return;const{driver:e=MJ,startTime:s}=this.options;this.driver||(this.driver=e(w=>this.tick(w))),(_=(h=this.options).onPlay)==null||_.call(h);const u=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=u):this.holdTime!==null?this.startTime=u-this.holdTime:this.startTime||(this.startTime=s??u),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ka.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,s;this.notifyFinished(),this.teardown(),this.state="finished",(s=(e=this.options).onComplete)==null||s.call(e)}cancel(){var e,s;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(s=(e=this.options).onCancel)==null||s.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var s;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(s=this.driver)==null||s.stop(),e.observe(this)}}function ZJ(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Sf=t=>t*180/Math.PI,nA=t=>{const e=Sf(Math.atan2(t[1],t[0]));return iA(e)},XJ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:nA,rotateZ:nA,skewX:t=>Sf(Math.atan(t[1])),skewY:t=>Sf(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},iA=t=>(t=t%360,t<0&&(t+=360),t),sz=nA,oz=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),az=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),YJ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:oz,scaleY:az,scale:t=>(oz(t)+az(t))/2,rotateX:t=>iA(Sf(Math.atan2(t[6],t[5]))),rotateY:t=>iA(Sf(Math.atan2(-t[2],t[0]))),rotateZ:sz,rotate:sz,skewX:t=>Sf(Math.atan(t[4])),skewY:t=>Sf(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function sA(t){return t.includes("scale")?1:0}function oA(t,e){if(!t||t==="none")return sA(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let u,h;if(s)u=YJ,h=s;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);u=XJ,h=o}if(!h)return sA(e);const _=u[e],w=h[1].split(",").map(QJ);return typeof _=="function"?_(w):w[_]}const JJ=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return oA(s,e)};function QJ(t){return parseFloat(t.trim())}const i_=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],s_=new Set(i_),lz=t=>t===n_||t===Dr,eQ=new Set(["x","y","z"]),tQ=i_.filter(t=>!eQ.has(t));function rQ(t){const e=[];return tQ.forEach(s=>{const u=t.getValue(s);u!==void 0&&(e.push([s,u.get()]),u.set(s.startsWith("scale")?1:0))}),e}const Lf={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>oA(e,"x"),y:(t,{transform:e})=>oA(e,"y")};Lf.translateX=Lf.x;Lf.translateY=Lf.y;const Of=new Set;let aA=!1,lA=!1,cA=!1;function K4(){if(lA){const t=Array.from(Of).filter(u=>u.needsMeasurement),e=new Set(t.map(u=>u.element)),s=new Map;e.forEach(u=>{const h=rQ(u);h.length&&(s.set(u,h),u.render())}),t.forEach(u=>u.measureInitialState()),e.forEach(u=>{u.render();const h=s.get(u);h&&h.forEach(([_,w])=>{var o;(o=u.getValue(_))==null||o.set(w)})}),t.forEach(u=>u.measureEndState()),t.forEach(u=>{u.suspendedScrollY!==void 0&&window.scrollTo(0,u.suspendedScrollY)})}lA=!1,aA=!1,Of.forEach(t=>t.complete(cA)),Of.clear()}function Z4(){Of.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(lA=!0)})}function nQ(){cA=!0,Z4(),K4(),cA=!1}class vI{constructor(e,s,u,h,_,w=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=u,this.motionValue=h,this.element=_,this.isAsync=w}scheduleResolve(){this.state="scheduled",this.isAsync?(Of.add(this),aA||(aA=!0,ls.read(Z4),ls.resolveKeyframes(K4))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:u,motionValue:h}=this;if(e[0]===null){const _=h==null?void 0:h.get(),w=e[e.length-1];if(_!==void 0)e[0]=_;else if(u&&s){const o=u.readValue(s,w);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=w),h&&_===void 0&&h.set(e[0])}ZJ(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Of.delete(this)}cancel(){this.state==="scheduled"&&(Of.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const iQ=t=>t.startsWith("--");function sQ(t,e,s){iQ(e)?t.style.setProperty(e,s):t.style[e]=s}const oQ=aI(()=>window.ScrollTimeline!==void 0),aQ={};function lQ(t,e){const s=aI(t);return()=>aQ[e]??s()}const X4=lQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xv=([t,e,s,u])=>`cubic-bezier(${t}, ${e}, ${s}, ${u})`,cz={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xv([0,.65,.55,1]),circOut:xv([.55,0,1,.45]),backIn:xv([.31,.01,.66,-.59]),backOut:xv([.33,1.53,.69,.99])};function Y4(t,e){if(t)return typeof t=="function"?X4()?H4(t,e):"ease-out":L4(t)?xv(t):Array.isArray(t)?t.map(s=>Y4(s,e)||cz.easeOut):cz[t]}function cQ(t,e,s,{delay:u=0,duration:h=300,repeat:_=0,repeatType:w="loop",ease:o="easeOut",times:k}={},P=void 0){const O={[e]:s};k&&(O.offset=k);const F=Y4(o,h);Array.isArray(F)&&(O.easing=F);const V={delay:u,duration:h,easing:Array.isArray(F)?"linear":F,fill:"both",iterations:_+1,direction:w==="reverse"?"alternate":"normal"};return P&&(V.pseudoElement=P),t.animate(O,V)}function J4(t){return typeof t=="function"&&"applyToOptions"in t}function uQ({type:t,...e}){return J4(t)&&X4()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class dQ extends _I{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:s,name:u,keyframes:h,pseudoElement:_,allowFlatten:w=!1,finalKeyframe:o,onComplete:k}=e;this.isPseudoElement=!!_,this.allowFlatten=w,this.options=e,oI(typeof e.type!="string");const P=uQ(e);this.animation=cQ(s,u,h,P,_),P.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!_){const O=gI(h,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(O):sQ(s,u,O),this.animation.cancel()}k==null||k(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,s;(s=(e=this.animation).finish)==null||s.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,s;this.isPseudoElement||(s=(e=this.animation).commitStyles)==null||s.call(e)}get duration(){var s,u;const e=((u=(s=this.animation.effect)==null?void 0:s.getComputedTiming)==null?void 0:u.call(s).duration)||0;return xl(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+xl(e)}get time(){return xl(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Kc(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:s}){var u;return this.allowFlatten&&((u=this.animation.effect)==null||u.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&oQ()?(this.animation.timeline=e,bl):s(this)}}const Q4={anticipate:P4,backInOut:I4,circInOut:R4};function hQ(t){return t in Q4}function fQ(t){typeof t.ease=="string"&&hQ(t.ease)&&(t.ease=Q4[t.ease])}const uz=10;class pQ extends dQ{constructor(e){fQ(e),q4(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:s,onUpdate:u,onComplete:h,element:_,...w}=this.options;if(!s)return;if(e!==void 0){s.set(e);return}const o=new yI({...w,autoplay:!1}),k=Kc(this.finishedTime??this.time);s.setWithVelocity(o.sample(k-uz).value,o.sample(k).value,uz),o.stop()}}const dz=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(lh.test(t)||t==="0")&&!t.startsWith("url("));function mQ(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function gQ(t,e,s,u){const h=t[0];if(h===null)return!1;if(e==="display"||e==="visibility")return!0;const _=t[t.length-1],w=dz(h,e),o=dz(_,e);return!w||!o?!1:mQ(t)||(s==="spring"||J4(s))&&u}function uA(t){t.duration=0,t.type="keyframes"}const _Q=new Set(["opacity","clipPath","filter","transform"]),yQ=aI(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function vQ(t){var O;const{motionValue:e,name:s,repeatDelay:u,repeatType:h,damping:_,type:w}=t;if(!(((O=e==null?void 0:e.owner)==null?void 0:O.current)instanceof HTMLElement))return!1;const{onUpdate:k,transformTemplate:P}=e.owner.getProps();return yQ()&&s&&_Q.has(s)&&(s!=="transform"||!P)&&!k&&!u&&h!=="mirror"&&_!==0&&w!=="inertia"}const xQ=40;class wQ extends _I{constructor({autoplay:e=!0,delay:s=0,type:u="keyframes",repeat:h=0,repeatDelay:_=0,repeatType:w="loop",keyframes:o,name:k,motionValue:P,element:O,...F}){var Y;super(),this.stop=()=>{var Z,se;this._animation&&(this._animation.stop(),(Z=this.stopTimeline)==null||Z.call(this)),(se=this.keyframeResolver)==null||se.cancel()},this.createdAt=ka.now();const V={autoplay:e,delay:s,type:u,repeat:h,repeatDelay:_,repeatType:w,name:k,motionValue:P,element:O,...F},$=(O==null?void 0:O.KeyframeResolver)||vI;this.keyframeResolver=new $(o,(Z,se,te)=>this.onKeyframesResolved(Z,se,V,!te),k,P,O),(Y=this.keyframeResolver)==null||Y.scheduleResolve()}onKeyframesResolved(e,s,u,h){this.keyframeResolver=void 0;const{name:_,type:w,velocity:o,delay:k,isHandoff:P,onUpdate:O}=u;this.resolvedAt=ka.now(),gQ(e,_,w,o)||((Uu.instantAnimations||!k)&&(O==null||O(gI(e,u,s))),e[0]=e[e.length-1],uA(u),u.repeat=0);const V={startTime:h?this.resolvedAt?this.resolvedAt-this.createdAt>xQ?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...u,keyframes:e},$=!P&&vQ(V)?new pQ({...V,element:V.motionValue.owner.current}):new yI(V);$.finished.then(()=>this.notifyFinished()).catch(bl),this.pendingTimeline&&(this.stopTimeline=$.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=$}get finished(){return this._animation?this.animation.finished:this._finished}then(e,s){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),nQ()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const bQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function SQ(t){const e=bQ.exec(t);if(!e)return[,];const[,s,u,h]=e;return[`--${s??u}`,h]}function ej(t,e,s=1){const[u,h]=SQ(t);if(!u)return;const _=window.getComputedStyle(e).getPropertyValue(u);if(_){const w=_.trim();return w4(w)?parseFloat(w):w}return dI(h)?ej(h,e,s+1):h}function xI(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const tj=new Set(["width","height","top","left","right","bottom",...i_]),TQ={test:t=>t==="auto",parse:t=>t},rj=t=>e=>e.test(t),nj=[n_,Dr,Zc,Md,mJ,pJ,TQ],hz=t=>nj.find(rj(t));function EQ(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S4(t):!0}const kQ=new Set(["brightness","contrast","saturate","opacity"]);function AQ(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[u]=s.match(hI)||[];if(!u)return t;const h=s.replace(u,"");let _=kQ.has(e)?1:0;return u!==s&&(_*=100),e+"("+_+h+")"}const CQ=/\b([a-z-]*)\(.*?\)/gu,dA={...lh,getAnimatableNone:t=>{const e=t.match(CQ);return e?e.map(AQ).join(" "):t}},fz={...n_,transform:Math.round},IQ={rotate:Md,rotateX:Md,rotateY:Md,rotateZ:Md,scale:ub,scaleX:ub,scaleY:ub,scaleZ:ub,skew:Md,skewX:Md,skewY:Md,distance:Dr,translateX:Dr,translateY:Dr,translateZ:Dr,x:Dr,y:Dr,z:Dr,perspective:Dr,transformPerspective:Dr,opacity:f0,originX:ez,originY:ez,originZ:Dr},wI={borderWidth:Dr,borderTopWidth:Dr,borderRightWidth:Dr,borderBottomWidth:Dr,borderLeftWidth:Dr,borderRadius:Dr,radius:Dr,borderTopLeftRadius:Dr,borderTopRightRadius:Dr,borderBottomRightRadius:Dr,borderBottomLeftRadius:Dr,width:Dr,maxWidth:Dr,height:Dr,maxHeight:Dr,top:Dr,right:Dr,bottom:Dr,left:Dr,inset:Dr,insetBlock:Dr,insetBlockStart:Dr,insetBlockEnd:Dr,insetInline:Dr,insetInlineStart:Dr,insetInlineEnd:Dr,padding:Dr,paddingTop:Dr,paddingRight:Dr,paddingBottom:Dr,paddingLeft:Dr,paddingBlock:Dr,paddingBlockStart:Dr,paddingBlockEnd:Dr,paddingInline:Dr,paddingInlineStart:Dr,paddingInlineEnd:Dr,margin:Dr,marginTop:Dr,marginRight:Dr,marginBottom:Dr,marginLeft:Dr,marginBlock:Dr,marginBlockStart:Dr,marginBlockEnd:Dr,marginInline:Dr,marginInlineStart:Dr,marginInlineEnd:Dr,backgroundPositionX:Dr,backgroundPositionY:Dr,...IQ,zIndex:fz,fillOpacity:f0,strokeOpacity:f0,numOctaves:fz},PQ={...wI,color:Ws,backgroundColor:Ws,outlineColor:Ws,fill:Ws,stroke:Ws,borderColor:Ws,borderTopColor:Ws,borderRightColor:Ws,borderBottomColor:Ws,borderLeftColor:Ws,filter:dA,WebkitFilter:dA},ij=t=>PQ[t];function sj(t,e){let s=ij(t);return s!==dA&&(s=lh),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const MQ=new Set(["auto","none","0"]);function RQ(t,e,s){let u=0,h;for(;u<t.length&&!h;){const _=t[u];typeof _=="string"&&!MQ.has(_)&&p0(_).values.length&&(h=t[u]),u++}if(h&&s)for(const _ of e)t[_]=sj(s,h)}class DQ extends vI{constructor(e,s,u,h,_){super(e,s,u,h,_,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:u}=this;if(!s||!s.current)return;super.readKeyframes();for(let k=0;k<e.length;k++){let P=e[k];if(typeof P=="string"&&(P=P.trim(),dI(P))){const O=ej(P,s.current);O!==void 0&&(e[k]=O),k===e.length-1&&(this.finalKeyframe=P)}}if(this.resolveNoneKeyframes(),!tj.has(u)||e.length!==2)return;const[h,_]=e,w=hz(h),o=hz(_);if(w!==o)if(lz(w)&&lz(o))for(let k=0;k<e.length;k++){const P=e[k];typeof P=="string"&&(e[k]=parseFloat(P))}else Lf[u]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,u=[];for(let h=0;h<e.length;h++)(e[h]===null||EQ(e[h]))&&u.push(h);u.length&&RQ(e,u,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:u}=this;if(!e||!e.current)return;u==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Lf[u](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const h=s[s.length-1];h!==void 0&&e.getValue(u,h).jump(h,!1)}measureEndState(){var o;const{element:e,name:s,unresolvedKeyframes:u}=this;if(!e||!e.current)return;const h=e.getValue(s);h&&h.jump(this.measuredOrigin,!1);const _=u.length-1,w=u[_];u[_]=Lf[s](e.measureViewportBox(),window.getComputedStyle(e.current)),w!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=w),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEach(([k,P])=>{e.getValue(k).set(P)}),this.resolveNoneKeyframes()}}function LQ(t,e,s){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let u=document;const h=(s==null?void 0:s[t])??u.querySelectorAll(t);return h?Array.from(h):[]}return Array.from(t)}const oj=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function OQ(t){return b4(t)&&"offsetHeight"in t}const pz=30,zQ=t=>!isNaN(parseFloat(t));class FQ{constructor(e,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=u=>{var _;const h=ka.now();if(this.updatedAt!==h&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(u),this.current!==this.prev&&((_=this.events.change)==null||_.notify(this.current),this.dependents))for(const w of this.dependents)w.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=ka.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=zQ(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new lI);const u=this.events[e].add(s);return e==="change"?()=>{u(),ls.read(()=>{this.events.change.getSize()||this.stop()})}:u}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,s,u){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-u}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=ka.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pz)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,pz);return T4(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(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(){var e,s;(e=this.dependents)==null||e.clear(),(s=this.events.destroy)==null||s.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Gg(t,e){return new FQ(t,e)}const{schedule:bI}=O4(queueMicrotask,!1),Ql={x:!1,y:!1};function aj(){return Ql.x||Ql.y}function BQ(t){return t==="x"||t==="y"?Ql[t]?null:(Ql[t]=!0,()=>{Ql[t]=!1}):Ql.x||Ql.y?null:(Ql.x=Ql.y=!0,()=>{Ql.x=Ql.y=!1})}function lj(t,e){const s=LQ(t),u=new AbortController,h={passive:!0,...e,signal:u.signal};return[s,h,()=>u.abort()]}function mz(t){return!(t.pointerType==="touch"||aj())}function NQ(t,e,s={}){const[u,h,_]=lj(t,s),w=o=>{if(!mz(o))return;const{target:k}=o,P=e(k,o);if(typeof P!="function"||!k)return;const O=F=>{mz(F)&&(P(F),k.removeEventListener("pointerleave",O))};k.addEventListener("pointerleave",O,h)};return u.forEach(o=>{o.addEventListener("pointerenter",w,h)}),_}const cj=(t,e)=>e?t===e?!0:cj(t,e.parentElement):!1,SI=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,jQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function VQ(t){return jQ.has(t.tagName)||t.tabIndex!==-1}const Bb=new WeakSet;function gz(t){return e=>{e.key==="Enter"&&t(e)}}function lE(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const UQ=(t,e)=>{const s=t.currentTarget;if(!s)return;const u=gz(()=>{if(Bb.has(s))return;lE(s,"down");const h=gz(()=>{lE(s,"up")}),_=()=>lE(s,"cancel");s.addEventListener("keyup",h,e),s.addEventListener("blur",_,e)});s.addEventListener("keydown",u,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",u),e)};function _z(t){return SI(t)&&!aj()}function $Q(t,e,s={}){const[u,h,_]=lj(t,s),w=o=>{const k=o.currentTarget;if(!_z(o))return;Bb.add(k);const P=e(k,o),O=($,Y)=>{window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",V),Bb.has(k)&&Bb.delete(k),_z($)&&typeof P=="function"&&P($,{success:Y})},F=$=>{O($,k===window||k===document||s.useGlobalTarget||cj(k,$.target))},V=$=>{O($,!1)};window.addEventListener("pointerup",F,h),window.addEventListener("pointercancel",V,h)};return u.forEach(o=>{(s.useGlobalTarget?window:o).addEventListener("pointerdown",w,h),OQ(o)&&(o.addEventListener("focus",P=>UQ(P,h)),!VQ(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),_}function uj(t){return b4(t)&&"ownerSVGElement"in t}function GQ(t){return uj(t)&&t.tagName==="svg"}const $o=t=>!!(t&&t.getVelocity),HQ=[...nj,Ws,lh],WQ=t=>HQ.find(rj(t)),dj=X.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function qQ(t=!0){const e=X.useContext(nI);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:u,register:h}=e,_=X.useId();X.useEffect(()=>{if(t)return h(_)},[t]);const w=X.useCallback(()=>t&&u&&u(_),[_,u,t]);return!s&&u?[!1,w]:[!0]}const hj=X.createContext({strict:!1}),yz={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"]},Hg={};for(const t in yz)Hg[t]={isEnabled:e=>yz[t].some(s=>!!e[s])};function KQ(t){for(const e in t)Hg[e]={...Hg[e],...t[e]}}const ZQ=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 C1(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||ZQ.has(t)}let fj=t=>!C1(t);function XQ(t){typeof t=="function"&&(fj=e=>e.startsWith("on")?!C1(e):t(e))}try{XQ(require("@emotion/is-prop-valid").default)}catch{}function YQ(t,e,s){const u={};for(const h in t)h==="values"&&typeof t.values=="object"||(fj(h)||s===!0&&C1(h)||!e&&!C1(h)||t.draggable&&h.startsWith("onDrag"))&&(u[h]=t[h]);return u}const dS=X.createContext({});function hS(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function m0(t){return typeof t=="string"||Array.isArray(t)}const TI=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],EI=["initial",...TI];function fS(t){return hS(t.animate)||EI.some(e=>m0(t[e]))}function pj(t){return!!(fS(t)||t.variants)}function JQ(t,e){if(fS(t)){const{initial:s,animate:u}=t;return{initial:s===!1||m0(s)?s:void 0,animate:m0(u)?u:void 0}}return t.inherit!==!1?e:{}}function QQ(t){const{initial:e,animate:s}=JQ(t,X.useContext(dS));return X.useMemo(()=>({initial:e,animate:s}),[vz(e),vz(s)])}function vz(t){return Array.isArray(t)?t.join(" "):t}function xz(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const fv={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Dr.test(t))t=parseFloat(t);else return t;const s=xz(t,e.target.x),u=xz(t,e.target.y);return`${s}% ${u}%`}},eee={correct:(t,{treeScale:e,projectionDelta:s})=>{const u=t,h=lh.parse(t);if(h.length>5)return u;const _=lh.createTransformer(t),w=typeof h[0]!="number"?1:0,o=s.x.scale*e.x,k=s.y.scale*e.y;h[0+w]/=o,h[1+w]/=k;const P=vs(o,k,.5);return typeof h[2+w]=="number"&&(h[2+w]/=P),typeof h[3+w]=="number"&&(h[3+w]/=P),_(h)}},hA={borderRadius:{...fv,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:fv,borderTopRightRadius:fv,borderBottomLeftRadius:fv,borderBottomRightRadius:fv,boxShadow:eee};function mj(t,{layout:e,layoutId:s}){return s_.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!hA[t]||t==="opacity")}const tee={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ree=i_.length;function nee(t,e,s){let u="",h=!0;for(let _=0;_<ree;_++){const w=i_[_],o=t[w];if(o===void 0)continue;let k=!0;if(typeof o=="number"?k=o===(w.startsWith("scale")?1:0):k=parseFloat(o)===0,!k||s){const P=oj(o,wI[w]);if(!k){h=!1;const O=tee[w]||w;u+=`${O}(${P}) `}s&&(e[w]=P)}}return u=u.trim(),s?u=s(e,h?"":u):h&&(u="none"),u}function kI(t,e,s){const{style:u,vars:h,transformOrigin:_}=t;let w=!1,o=!1;for(const k in e){const P=e[k];if(s_.has(k)){w=!0;continue}else if(F4(k)){h[k]=P;continue}else{const O=oj(P,wI[k]);k.startsWith("origin")?(o=!0,_[k]=O):u[k]=O}}if(e.transform||(w||s?u.transform=nee(e,t.transform,s):u.transform&&(u.transform="none")),o){const{originX:k="50%",originY:P="50%",originZ:O=0}=_;u.transformOrigin=`${k} ${P} ${O}`}}const AI=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function gj(t,e,s){for(const u in e)!$o(e[u])&&!mj(u,s)&&(t[u]=e[u])}function iee({transformTemplate:t},e){return X.useMemo(()=>{const s=AI();return kI(s,e,t),Object.assign({},s.vars,s.style)},[e])}function see(t,e){const s=t.style||{},u={};return gj(u,s,t),Object.assign(u,iee(t,e)),u}function oee(t,e){const s={},u=see(t,e);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,u.userSelect=u.WebkitUserSelect=u.WebkitTouchCallout="none",u.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=u,s}const aee={offset:"stroke-dashoffset",array:"stroke-dasharray"},lee={offset:"strokeDashoffset",array:"strokeDasharray"};function cee(t,e,s=1,u=0,h=!0){t.pathLength=1;const _=h?aee:lee;t[_.offset]=Dr.transform(-u);const w=Dr.transform(e),o=Dr.transform(s);t[_.array]=`${w} ${o}`}function _j(t,{attrX:e,attrY:s,attrScale:u,pathLength:h,pathSpacing:_=1,pathOffset:w=0,...o},k,P,O){if(kI(t,o,P),k){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:F,style:V}=t;F.transform&&(V.transform=F.transform,delete F.transform),(V.transform||F.transformOrigin)&&(V.transformOrigin=F.transformOrigin??"50% 50%",delete F.transformOrigin),V.transform&&(V.transformBox=(O==null?void 0:O.transformBox)??"fill-box",delete F.transformBox),e!==void 0&&(F.x=e),s!==void 0&&(F.y=s),u!==void 0&&(F.scale=u),h!==void 0&&cee(F,h,_,w,!1)}const yj=()=>({...AI(),attrs:{}}),vj=t=>typeof t=="string"&&t.toLowerCase()==="svg";function uee(t,e,s,u){const h=X.useMemo(()=>{const _=yj();return _j(_,e,vj(u),t.transformTemplate,t.style),{..._.attrs,style:{..._.style}}},[e]);if(t.style){const _={};gj(_,t.style,t),h.style={..._,...h.style}}return h}const dee=["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 CI(t){return typeof t!="string"||t.includes("-")?!1:!!(dee.indexOf(t)>-1||/[A-Z]/u.test(t))}function hee(t,e,s,{latestValues:u},h,_=!1,w){const k=(w??CI(t)?uee:oee)(e,u,h,t),P=YQ(e,typeof t=="string",_),O=t!==X.Fragment?{...P,...k,ref:s}:{},{children:F}=e,V=X.useMemo(()=>$o(F)?F.get():F,[F]);return X.createElement(t,{...O,children:V})}function wz(t){const e=[{},{}];return t==null||t.values.forEach((s,u)=>{e[0][u]=s.get(),e[1][u]=s.getVelocity()}),e}function II(t,e,s,u){if(typeof e=="function"){const[h,_]=wz(u);e=e(s!==void 0?s:t.custom,h,_)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[h,_]=wz(u);e=e(s!==void 0?s:t.custom,h,_)}return e}function Nb(t){return $o(t)?t.get():t}function fee({scrapeMotionValuesFromProps:t,createRenderState:e},s,u,h){return{latestValues:pee(s,u,h,t),renderState:e()}}function pee(t,e,s,u){const h={},_=u(t,{});for(const V in _)h[V]=Nb(_[V]);let{initial:w,animate:o}=t;const k=fS(t),P=pj(t);e&&P&&!k&&t.inherit!==!1&&(w===void 0&&(w=e.initial),o===void 0&&(o=e.animate));let O=s?s.initial===!1:!1;O=O||w===!1;const F=O?o:w;if(F&&typeof F!="boolean"&&!hS(F)){const V=Array.isArray(F)?F:[F];for(let $=0;$<V.length;$++){const Y=II(t,V[$]);if(Y){const{transitionEnd:Z,transition:se,...te}=Y;for(const ee in te){let oe=te[ee];if(Array.isArray(oe)){const he=O?oe.length-1:0;oe=oe[he]}oe!==null&&(h[ee]=oe)}for(const ee in Z)h[ee]=Z[ee]}}}return h}const xj=t=>(e,s)=>{const u=X.useContext(dS),h=X.useContext(nI),_=()=>fee(t,e,u,h);return s?_():KY(_)};function PI(t,e,s){var _;const{style:u}=t,h={};for(const w in u)($o(u[w])||e.style&&$o(e.style[w])||mj(w,t)||((_=s==null?void 0:s.getValue(w))==null?void 0:_.liveStyle)!==void 0)&&(h[w]=u[w]);return h}const mee=xj({scrapeMotionValuesFromProps:PI,createRenderState:AI});function wj(t,e,s){const u=PI(t,e,s);for(const h in t)if($o(t[h])||$o(e[h])){const _=i_.indexOf(h)!==-1?"attr"+h.charAt(0).toUpperCase()+h.substring(1):h;u[_]=t[h]}return u}const gee=xj({scrapeMotionValuesFromProps:wj,createRenderState:yj}),_ee=Symbol.for("motionComponentSymbol");function ug(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function yee(t,e,s){return X.useCallback(u=>{u&&t.onMount&&t.onMount(u),e&&(u?e.mount(u):e.unmount()),s&&(typeof s=="function"?s(u):ug(s)&&(s.current=u))},[e])}const MI=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),vee="framerAppearId",bj="data-"+MI(vee),Sj=X.createContext({});function xee(t,e,s,u,h,_){var se,te;const{visualElement:w}=X.useContext(dS),o=X.useContext(hj),k=X.useContext(nI),P=X.useContext(dj).reducedMotion,O=X.useRef(null);u=u||o.renderer,!O.current&&u&&(O.current=u(t,{visualState:e,parent:w,props:s,presenceContext:k,blockInitialAnimation:k?k.initial===!1:!1,reducedMotionConfig:P,isSVG:_}));const F=O.current,V=X.useContext(Sj);F&&!F.projection&&h&&(F.type==="html"||F.type==="svg")&&wee(O.current,s,h,V);const $=X.useRef(!1);X.useInsertionEffect(()=>{F&&$.current&&F.update(s,k)});const Y=s[bj],Z=X.useRef(!!Y&&!((se=window.MotionHandoffIsComplete)!=null&&se.call(window,Y))&&((te=window.MotionHasOptimisedAnimation)==null?void 0:te.call(window,Y)));return ZY(()=>{F&&($.current=!0,window.MotionIsMounted=!0,F.updateFeatures(),F.scheduleRenderMicrotask(),Z.current&&F.animationState&&F.animationState.animateChanges())}),X.useEffect(()=>{F&&(!Z.current&&F.animationState&&F.animationState.animateChanges(),Z.current&&(queueMicrotask(()=>{var ee;(ee=window.MotionHandoffMarkAsComplete)==null||ee.call(window,Y)}),Z.current=!1),F.enteringChildren=void 0)}),F}function wee(t,e,s,u){const{layoutId:h,layout:_,drag:w,dragConstraints:o,layoutScroll:k,layoutRoot:P,layoutCrossfade:O}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:Tj(t.parent)),t.projection.setOptions({layoutId:h,layout:_,alwaysMeasureLayout:!!w||o&&ug(o),visualElement:t,animationType:typeof _=="string"?_:"both",initialPromotionConfig:u,crossfade:O,layoutScroll:k,layoutRoot:P})}function Tj(t){if(t)return t.options.allowProjection!==!1?t.projection:Tj(t.parent)}function cE(t,{forwardMotionProps:e=!1,type:s}={},u,h){u&&KQ(u);const _=s?s==="svg":CI(t),w=_?gee:mee;function o(P,O){let F;const V={...X.useContext(dj),...P,layoutId:bee(P)},{isStatic:$}=V,Y=QQ(P),Z=w(P,$);if(!$&&rI){See();const se=Tee(V);F=se.MeasureLayout,Y.visualElement=xee(t,Z,V,h,se.ProjectionNode,_)}return le.jsxs(dS.Provider,{value:Y,children:[F&&Y.visualElement?le.jsx(F,{visualElement:Y.visualElement,...V}):null,hee(t,P,yee(Z,Y.visualElement,O),Z,$,e,_)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const k=X.forwardRef(o);return k[_ee]=t,k}function bee({layoutId:t}){const e=X.useContext(x4).id;return e&&t!==void 0?e+"-"+t:t}function See(t,e){X.useContext(hj).strict}function Tee(t){const{drag:e,layout:s}=Hg;if(!e&&!s)return{};const u={...e,...s};return{MeasureLayout:e!=null&&e.isEnabled(t)||s!=null&&s.isEnabled(t)?u.MeasureLayout:void 0,ProjectionNode:u.ProjectionNode}}function Eee(t,e){if(typeof Proxy>"u")return cE;const s=new Map,u=(_,w)=>cE(_,w,t,e),h=(_,w)=>u(_,w);return new Proxy(h,{get:(_,w)=>w==="create"?u:(s.has(w)||s.set(w,cE(w,void 0,t,e)),s.get(w))})}function Ej({top:t,left:e,right:s,bottom:u}){return{x:{min:e,max:s},y:{min:t,max:u}}}function kee({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Aee(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),u=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:u.y,right:u.x}}function uE(t){return t===void 0||t===1}function fA({scale:t,scaleX:e,scaleY:s}){return!uE(t)||!uE(e)||!uE(s)}function pf(t){return fA(t)||kj(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function kj(t){return bz(t.x)||bz(t.y)}function bz(t){return t&&t!=="0%"}function I1(t,e,s){const u=t-s,h=e*u;return s+h}function Sz(t,e,s,u,h){return h!==void 0&&(t=I1(t,h,u)),I1(t,s,u)+e}function pA(t,e=0,s=1,u,h){t.min=Sz(t.min,e,s,u,h),t.max=Sz(t.max,e,s,u,h)}function Aj(t,{x:e,y:s}){pA(t.x,e.translate,e.scale,e.originPoint),pA(t.y,s.translate,s.scale,s.originPoint)}const Tz=.999999999999,Ez=1.0000000000001;function Cee(t,e,s,u=!1){const h=s.length;if(!h)return;e.x=e.y=1;let _,w;for(let o=0;o<h;o++){_=s[o],w=_.projectionDelta;const{visualElement:k}=_.options;k&&k.props.style&&k.props.style.display==="contents"||(u&&_.options.layoutScroll&&_.scroll&&_!==_.root&&hg(t,{x:-_.scroll.offset.x,y:-_.scroll.offset.y}),w&&(e.x*=w.x.scale,e.y*=w.y.scale,Aj(t,w)),u&&pf(_.latestValues)&&hg(t,_.latestValues))}e.x<Ez&&e.x>Tz&&(e.x=1),e.y<Ez&&e.y>Tz&&(e.y=1)}function dg(t,e){t.min=t.min+e,t.max=t.max+e}function kz(t,e,s,u,h=.5){const _=vs(t.min,t.max,h);pA(t,e,s,_,u)}function hg(t,e){kz(t.x,e.x,e.scaleX,e.scale,e.originX),kz(t.y,e.y,e.scaleY,e.scale,e.originY)}function Cj(t,e){return Ej(Aee(t.getBoundingClientRect(),e))}function Iee(t,e,s){const u=Cj(t,s),{scroll:h}=e;return h&&(dg(u.x,h.offset.x),dg(u.y,h.offset.y)),u}const Az=()=>({translate:0,scale:1,origin:0,originPoint:0}),fg=()=>({x:Az(),y:Az()}),Cz=()=>({min:0,max:0}),eo=()=>({x:Cz(),y:Cz()}),mA={current:null},Ij={current:!1};function Pee(){if(Ij.current=!0,!!rI)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>mA.current=t.matches;t.addEventListener("change",e),e()}else mA.current=!1}const Mee=new WeakMap;function Ree(t,e,s){for(const u in e){const h=e[u],_=s[u];if($o(h))t.addValue(u,h);else if($o(_))t.addValue(u,Gg(h,{owner:t}));else if(_!==h)if(t.hasValue(u)){const w=t.getValue(u);w.liveStyle===!0?w.jump(h):w.hasAnimated||w.set(h)}else{const w=t.getStaticValue(u);t.addValue(u,Gg(w!==void 0?w:h,{owner:t}))}}for(const u in s)e[u]===void 0&&t.removeValue(u);return e}const Iz=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Dee{scrapeMotionValuesFromProps(e,s,u){return{}}constructor({parent:e,props:s,presenceContext:u,reducedMotionConfig:h,blockInitialAnimation:_,visualState:w},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vI,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 V=ka.now();this.renderScheduledAt<V&&(this.renderScheduledAt=V,ls.render(this.render,!1,!0))};const{latestValues:k,renderState:P}=w;this.latestValues=k,this.baseTarget={...k},this.initialValues=s.initial?{...k}:{},this.renderState=P,this.parent=e,this.props=s,this.presenceContext=u,this.depth=e?e.depth+1:0,this.reducedMotionConfig=h,this.options=o,this.blockInitialAnimation=!!_,this.isControllingVariants=fS(s),this.isVariantNode=pj(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:O,...F}=this.scrapeMotionValuesFromProps(s,{},this);for(const V in F){const $=F[V];k[V]!==void 0&&$o($)&&$.set(k[V])}}mount(e){var s;this.current=e,Mee.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((u,h)=>this.bindToMotionValue(h,u)),Ij.current||Pee(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:mA.current,(s=this.parent)==null||s.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),ah(this.notifyUpdate),ah(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const u=this.features[s];u&&(u.unmount(),u.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,s){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const u=s_.has(e);u&&this.onBindTransform&&this.onBindTransform();const h=s.on("change",w=>{this.latestValues[e]=w,this.props.onUpdate&&ls.preRender(this.notifyUpdate),u&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let _;window.MotionCheckAppearSync&&(_=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{h(),_&&_(),s.owner&&s.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hg){const s=Hg[e];if(!s)continue;const{isEnabled:u,Feature:h}=s;if(!this.features[e]&&h&&u(this.props)&&(this.features[e]=new h(this)),this.features[e]){const _=this.features[e];_.isMounted?_.update():(_.mount(),_.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):eo()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let u=0;u<Iz.length;u++){const h=Iz[u];this.propEventSubscriptions[h]&&(this.propEventSubscriptions[h](),delete this.propEventSubscriptions[h]);const _="on"+h,w=e[_];w&&(this.propEventSubscriptions[h]=this.on(h,w))}this.prevMotionValues=Ree(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const u=this.values.get(e);s!==u&&(u&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let u=this.values.get(e);return u===void 0&&s!==void 0&&(u=Gg(s===null?void 0:s,{owner:this}),this.addValue(e,u)),u}readValue(e,s){let u=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return u!=null&&(typeof u=="string"&&(w4(u)||S4(u))?u=parseFloat(u):!WQ(u)&&lh.test(s)&&(u=sj(e,s)),this.setBaseTarget(e,$o(u)?u.get():u)),$o(u)?u.get():u}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){var _;const{initial:s}=this.props;let u;if(typeof s=="string"||typeof s=="object"){const w=II(this.props,s,(_=this.presenceContext)==null?void 0:_.custom);w&&(u=w[e])}if(s&&u!==void 0)return u;const h=this.getBaseTargetFromProps(this.props,e);return h!==void 0&&!$o(h)?h:this.initialValues[e]!==void 0&&u===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new lI),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){bI.render(this.render)}}class Pj extends Dee{constructor(){super(...arguments),this.KeyframeResolver=DQ}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){return e.style?e.style[s]:void 0}removeValueFromRenderState(e,{vars:s,style:u}){delete s[e],delete u[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;$o(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function Mj(t,{style:e,vars:s},u,h){const _=t.style;let w;for(w in e)_[w]=e[w];h==null||h.applyProjectionStyles(_,u);for(w in s)_.setProperty(w,s[w])}function Lee(t){return window.getComputedStyle(t)}class Oee extends Pj{constructor(){super(...arguments),this.type="html",this.renderInstance=Mj}readValueFromInstance(e,s){var u;if(s_.has(s))return(u=this.projection)!=null&&u.isProjecting?sA(s):JJ(e,s);{const h=Lee(e),_=(F4(s)?h.getPropertyValue(s):h[s])||0;return typeof _=="string"?_.trim():_}}measureInstanceViewportBox(e,{transformPagePoint:s}){return Cj(e,s)}build(e,s,u){kI(e,s,u.transformTemplate)}scrapeMotionValuesFromProps(e,s,u){return PI(e,s,u)}}const Rj=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 zee(t,e,s,u){Mj(t,e,void 0,u);for(const h in e.attrs)t.setAttribute(Rj.has(h)?h:MI(h),e.attrs[h])}class Fee extends Pj{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=eo}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(s_.has(s)){const u=ij(s);return u&&u.default||0}return s=Rj.has(s)?s:MI(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,u){return wj(e,s,u)}build(e,s,u){_j(e,s,this.isSVGTag,u.transformTemplate,u.style)}renderInstance(e,s,u,h){zee(e,s,u,h)}mount(e){this.isSVGTag=vj(e.tagName),super.mount(e)}}const Bee=(t,e)=>e.isSVG??CI(t)?new Fee(e):new Oee(e,{allowProjection:t!==X.Fragment});function Sg(t,e,s){const u=t.getProps();return II(u,e,s!==void 0?s:u.custom,t)}const gA=t=>Array.isArray(t);function Nee(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,Gg(s))}function jee(t){return gA(t)?t[t.length-1]||0:t}function Vee(t,e){const s=Sg(t,e);let{transitionEnd:u={},transition:h={},..._}=s||{};_={..._,...u};for(const w in _){const o=jee(_[w]);Nee(t,w,o)}}function Uee(t){return!!($o(t)&&t.add)}function _A(t,e){const s=t.getValue("willChange");if(Uee(s))return s.add(e);if(!s&&Uu.WillChange){const u=new Uu.WillChange("auto");t.addValue("willChange",u),u.add(e)}}function Dj(t){return t.props[bj]}const $ee=t=>t!==null;function Gee(t,{repeat:e,repeatType:s="loop"},u){const h=t.filter($ee),_=e&&s!=="loop"&&e%2===1?0:h.length-1;return h[_]}const Hee={type:"spring",stiffness:500,damping:25,restSpeed:10},Wee=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),qee={type:"keyframes",duration:.8},Kee={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Zee=(t,{keyframes:e})=>e.length>2?qee:s_.has(t)?t.startsWith("scale")?Wee(e[1]):Hee:Kee;function Xee({when:t,delay:e,delayChildren:s,staggerChildren:u,staggerDirection:h,repeat:_,repeatType:w,repeatDelay:o,from:k,elapsed:P,...O}){return!!Object.keys(O).length}const RI=(t,e,s,u={},h,_)=>w=>{const o=xI(u,t)||{},k=o.delay||u.delay||0;let{elapsed:P=0}=u;P=P-Kc(k);const O={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-P,onUpdate:V=>{e.set(V),o.onUpdate&&o.onUpdate(V)},onComplete:()=>{w(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:_?void 0:h};Xee(o)||Object.assign(O,Zee(t,O)),O.duration&&(O.duration=Kc(O.duration)),O.repeatDelay&&(O.repeatDelay=Kc(O.repeatDelay)),O.from!==void 0&&(O.keyframes[0]=O.from);let F=!1;if((O.type===!1||O.duration===0&&!O.repeatDelay)&&(uA(O),O.delay===0&&(F=!0)),(Uu.instantAnimations||Uu.skipAnimations)&&(F=!0,uA(O),O.delay=0),O.allowFlatten=!o.type&&!o.ease,F&&!_&&e.get()!==void 0){const V=Gee(O.keyframes,o);if(V!==void 0){ls.update(()=>{O.onUpdate(V),O.onComplete()});return}}return o.isSync?new yI(O):new wQ(O)};function Yee({protectedKeys:t,needsAnimating:e},s){const u=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,u}function Lj(t,e,{delay:s=0,transitionOverride:u,type:h}={}){let{transition:_=t.getDefaultTransition(),transitionEnd:w,...o}=e;u&&(_=u);const k=[],P=h&&t.animationState&&t.animationState.getState()[h];for(const O in o){const F=t.getValue(O,t.latestValues[O]??null),V=o[O];if(V===void 0||P&&Yee(P,O))continue;const $={delay:s,...xI(_||{},O)},Y=F.get();if(Y!==void 0&&!F.isAnimating&&!Array.isArray(V)&&V===Y&&!$.velocity)continue;let Z=!1;if(window.MotionHandoffAnimation){const te=Dj(t);if(te){const ee=window.MotionHandoffAnimation(te,O,ls);ee!==null&&($.startTime=ee,Z=!0)}}_A(t,O),F.start(RI(O,F,V,t.shouldReduceMotion&&tj.has(O)?{type:!1}:$,t,Z));const se=F.animation;se&&k.push(se)}return w&&Promise.all(k).then(()=>{ls.update(()=>{w&&Vee(t,w)})}),k}function Oj(t,e,s,u=0,h=1){const _=Array.from(t).sort((P,O)=>P.sortNodePosition(O)).indexOf(e),w=t.size,o=(w-1)*u;return typeof s=="function"?s(_,w):h===1?_*u:o-_*u}function yA(t,e,s={}){var k;const u=Sg(t,e,s.type==="exit"?(k=t.presenceContext)==null?void 0:k.custom:void 0);let{transition:h=t.getDefaultTransition()||{}}=u||{};s.transitionOverride&&(h=s.transitionOverride);const _=u?()=>Promise.all(Lj(t,u,s)):()=>Promise.resolve(),w=t.variantChildren&&t.variantChildren.size?(P=0)=>{const{delayChildren:O=0,staggerChildren:F,staggerDirection:V}=h;return Jee(t,e,P,O,F,V,s)}:()=>Promise.resolve(),{when:o}=h;if(o){const[P,O]=o==="beforeChildren"?[_,w]:[w,_];return P().then(()=>O())}else return Promise.all([_(),w(s.delay)])}function Jee(t,e,s=0,u=0,h=0,_=1,w){const o=[];for(const k of t.variantChildren)k.notify("AnimationStart",e),o.push(yA(k,e,{...w,delay:s+(typeof u=="function"?0:u)+Oj(t.variantChildren,k,u,h,_)}).then(()=>k.notify("AnimationComplete",e)));return Promise.all(o)}function Qee(t,e,s={}){t.notify("AnimationStart",e);let u;if(Array.isArray(e)){const h=e.map(_=>yA(t,_,s));u=Promise.all(h)}else if(typeof e=="string")u=yA(t,e,s);else{const h=typeof e=="function"?Sg(t,e,s.custom):e;u=Promise.all(Lj(t,h,s))}return u.then(()=>{t.notify("AnimationComplete",e)})}function zj(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let u=0;u<s;u++)if(e[u]!==t[u])return!1;return!0}const ete=EI.length;function Fj(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?Fj(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<ete;s++){const u=EI[s],h=t.props[u];(m0(h)||h===!1)&&(e[u]=h)}return e}const tte=[...TI].reverse(),rte=TI.length;function nte(t){return e=>Promise.all(e.map(({animation:s,options:u})=>Qee(t,s,u)))}function ite(t){let e=nte(t),s=Pz(),u=!0;const h=k=>(P,O)=>{var V;const F=Sg(t,O,k==="exit"?(V=t.presenceContext)==null?void 0:V.custom:void 0);if(F){const{transition:$,transitionEnd:Y,...Z}=F;P={...P,...Z,...Y}}return P};function _(k){e=k(t)}function w(k){const{props:P}=t,O=Fj(t.parent)||{},F=[],V=new Set;let $={},Y=1/0;for(let se=0;se<rte;se++){const te=tte[se],ee=s[te],oe=P[te]!==void 0?P[te]:O[te],he=m0(oe),Ie=te===k?ee.isActive:null;Ie===!1&&(Y=se);let Be=oe===O[te]&&oe!==P[te]&&he;if(Be&&u&&t.manuallyAnimateOnMount&&(Be=!1),ee.protectedKeys={...$},!ee.isActive&&Ie===null||!oe&&!ee.prevProp||hS(oe)||typeof oe=="boolean")continue;const je=ste(ee.prevProp,oe);let Je=je||te===k&&ee.isActive&&!Be&&he||se>Y&&he,ft=!1;const kt=Array.isArray(oe)?oe:[oe];let tr=kt.reduce(h(te),{});Ie===!1&&(tr={});const{prevResolvedValues:jt={}}=ee,Qe={...jt,...tr},xt=Et=>{Je=!0,V.has(Et)&&(ft=!0,V.delete(Et)),ee.needsAnimating[Et]=!0;const st=t.getValue(Et);st&&(st.liveStyle=!1)};for(const Et in Qe){const st=tr[Et],Pt=jt[Et];if($.hasOwnProperty(Et))continue;let qt=!1;gA(st)&&gA(Pt)?qt=!zj(st,Pt):qt=st!==Pt,qt?st!=null?xt(Et):V.add(Et):st!==void 0&&V.has(Et)?xt(Et):ee.protectedKeys[Et]=!0}ee.prevProp=oe,ee.prevResolvedValues=tr,ee.isActive&&($={...$,...tr}),u&&t.blockInitialAnimation&&(Je=!1);const It=Be&&je;Je&&(!It||ft)&&F.push(...kt.map(Et=>{const st={type:te};if(typeof Et=="string"&&u&&!It&&t.manuallyAnimateOnMount&&t.parent){const{parent:Pt}=t,qt=Sg(Pt,Et);if(Pt.enteringChildren&&qt){const{delayChildren:_r}=qt.transition||{};st.delay=Oj(Pt.enteringChildren,t,_r)}}return{animation:Et,options:st}}))}if(V.size){const se={};if(typeof P.initial!="boolean"){const te=Sg(t,Array.isArray(P.initial)?P.initial[0]:P.initial);te&&te.transition&&(se.transition=te.transition)}V.forEach(te=>{const ee=t.getBaseTarget(te),oe=t.getValue(te);oe&&(oe.liveStyle=!0),se[te]=ee??null}),F.push({animation:se})}let Z=!!F.length;return u&&(P.initial===!1||P.initial===P.animate)&&!t.manuallyAnimateOnMount&&(Z=!1),u=!1,Z?e(F):Promise.resolve()}function o(k,P){var F;if(s[k].isActive===P)return Promise.resolve();(F=t.variantChildren)==null||F.forEach(V=>{var $;return($=V.animationState)==null?void 0:$.setActive(k,P)}),s[k].isActive=P;const O=w(k);for(const V in s)s[V].protectedKeys={};return O}return{animateChanges:w,setActive:o,setAnimateFunction:_,getState:()=>s,reset:()=>{s=Pz()}}}function ste(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!zj(e,t):!1}function cf(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Pz(){return{animate:cf(!0),whileInView:cf(),whileHover:cf(),whileTap:cf(),whileDrag:cf(),whileFocus:cf(),exit:cf()}}class fh{constructor(e){this.isMounted=!1,this.node=e}update(){}}class ote extends fh{constructor(e){super(e),e.animationState||(e.animationState=ite(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();hS(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let ate=0;class lte extends fh{constructor(){super(...arguments),this.id=ate++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:u}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===u)return;const h=this.node.animationState.setActive("exit",!e);s&&!e&&h.then(()=>{s(this.id)})}mount(){const{register:e,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const cte={animation:{Feature:ote},exit:{Feature:lte}};function g0(t,e,s,u={passive:!0}){return t.addEventListener(e,s,u),()=>t.removeEventListener(e,s)}function F0(t){return{point:{x:t.pageX,y:t.pageY}}}const ute=t=>e=>SI(e)&&t(e,F0(e));function zv(t,e,s,u){return g0(t,e,ute(s),u)}const Bj=1e-4,dte=1-Bj,hte=1+Bj,Nj=.01,fte=0-Nj,pte=0+Nj;function oa(t){return t.max-t.min}function mte(t,e,s){return Math.abs(t-e)<=s}function Mz(t,e,s,u=.5){t.origin=u,t.originPoint=vs(e.min,e.max,t.origin),t.scale=oa(s)/oa(e),t.translate=vs(s.min,s.max,t.origin)-t.originPoint,(t.scale>=dte&&t.scale<=hte||isNaN(t.scale))&&(t.scale=1),(t.translate>=fte&&t.translate<=pte||isNaN(t.translate))&&(t.translate=0)}function Fv(t,e,s,u){Mz(t.x,e.x,s.x,u?u.originX:void 0),Mz(t.y,e.y,s.y,u?u.originY:void 0)}function Rz(t,e,s){t.min=s.min+e.min,t.max=t.min+oa(e)}function gte(t,e,s){Rz(t.x,e.x,s.x),Rz(t.y,e.y,s.y)}function Dz(t,e,s){t.min=e.min-s.min,t.max=t.min+oa(e)}function P1(t,e,s){Dz(t.x,e.x,s.x),Dz(t.y,e.y,s.y)}function ml(t){return[t("x"),t("y")]}const jj=({current:t})=>t?t.ownerDocument.defaultView:null,Lz=(t,e)=>Math.abs(t-e);function _te(t,e){const s=Lz(t.x,e.x),u=Lz(t.y,e.y);return Math.sqrt(s**2+u**2)}class Vj{constructor(e,s,{transformPagePoint:u,contextWindow:h=window,dragSnapToOrigin:_=!1,distanceThreshold:w=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const V=hE(this.lastMoveEventInfo,this.history),$=this.startEvent!==null,Y=_te(V.offset,{x:0,y:0})>=this.distanceThreshold;if(!$&&!Y)return;const{point:Z}=V,{timestamp:se}=Po;this.history.push({...Z,timestamp:se});const{onStart:te,onMove:ee}=this.handlers;$||(te&&te(this.lastMoveEvent,V),this.startEvent=this.lastMoveEvent),ee&&ee(this.lastMoveEvent,V)},this.handlePointerMove=(V,$)=>{this.lastMoveEvent=V,this.lastMoveEventInfo=dE($,this.transformPagePoint),ls.update(this.updatePoint,!0)},this.handlePointerUp=(V,$)=>{this.end();const{onEnd:Y,onSessionEnd:Z,resumeAnimation:se}=this.handlers;if(this.dragSnapToOrigin&&se&&se(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const te=hE(V.type==="pointercancel"?this.lastMoveEventInfo:dE($,this.transformPagePoint),this.history);this.startEvent&&Y&&Y(V,te),Z&&Z(V,te)},!SI(e))return;this.dragSnapToOrigin=_,this.handlers=s,this.transformPagePoint=u,this.distanceThreshold=w,this.contextWindow=h||window;const o=F0(e),k=dE(o,this.transformPagePoint),{point:P}=k,{timestamp:O}=Po;this.history=[{...P,timestamp:O}];const{onSessionStart:F}=s;F&&F(e,hE(k,this.history)),this.removeListeners=L0(zv(this.contextWindow,"pointermove",this.handlePointerMove),zv(this.contextWindow,"pointerup",this.handlePointerUp),zv(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ah(this.updatePoint)}}function dE(t,e){return e?{point:e(t.point)}:t}function Oz(t,e){return{x:t.x-e.x,y:t.y-e.y}}function hE({point:t},e){return{point:t,delta:Oz(t,Uj(e)),offset:Oz(t,yte(e)),velocity:vte(e,.1)}}function yte(t){return t[0]}function Uj(t){return t[t.length-1]}function vte(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,u=null;const h=Uj(t);for(;s>=0&&(u=t[s],!(h.timestamp-u.timestamp>Kc(e)));)s--;if(!u)return{x:0,y:0};const _=xl(h.timestamp-u.timestamp);if(_===0)return{x:0,y:0};const w={x:(h.x-u.x)/_,y:(h.y-u.y)/_};return w.x===1/0&&(w.x=0),w.y===1/0&&(w.y=0),w}function xte(t,{min:e,max:s},u){return e!==void 0&&t<e?t=u?vs(e,t,u.min):Math.max(t,e):s!==void 0&&t>s&&(t=u?vs(s,t,u.max):Math.min(t,s)),t}function zz(t,e,s){return{min:e!==void 0?t.min+e:void 0,max:s!==void 0?t.max+s-(t.max-t.min):void 0}}function wte(t,{top:e,left:s,bottom:u,right:h}){return{x:zz(t.x,s,h),y:zz(t.y,e,u)}}function Fz(t,e){let s=e.min-t.min,u=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,u]=[u,s]),{min:s,max:u}}function bte(t,e){return{x:Fz(t.x,e.x),y:Fz(t.y,e.y)}}function Ste(t,e){let s=.5;const u=oa(t),h=oa(e);return h>u?s=h0(e.min,e.max-u,t.min):u>h&&(s=h0(t.min,t.max-h,e.min)),Vu(0,1,s)}function Tte(t,e){const s={};return e.min!==void 0&&(s.min=e.min-t.min),e.max!==void 0&&(s.max=e.max-t.min),s}const vA=.35;function Ete(t=vA){return t===!1?t=0:t===!0&&(t=vA),{x:Bz(t,"left","right"),y:Bz(t,"top","bottom")}}function Bz(t,e,s){return{min:Nz(t,e),max:Nz(t,s)}}function Nz(t,e){return typeof t=="number"?t:t[e]||0}const kte=new WeakMap;class Ate{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=eo(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:s=!1,distanceThreshold:u}={}){const{presenceContext:h}=this.visualElement;if(h&&h.isPresent===!1)return;const _=F=>{const{dragSnapToOrigin:V}=this.getProps();V?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(F0(F).point)},w=(F,V)=>{const{drag:$,dragPropagation:Y,onDragStart:Z}=this.getProps();if($&&!Y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=BQ($),!this.openDragLock))return;this.latestPointerEvent=F,this.latestPanInfo=V,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ml(te=>{let ee=this.getAxisMotionValue(te).get()||0;if(Zc.test(ee)){const{projection:oe}=this.visualElement;if(oe&&oe.layout){const he=oe.layout.layoutBox[te];he&&(ee=oa(he)*(parseFloat(ee)/100))}}this.originPoint[te]=ee}),Z&&ls.postRender(()=>Z(F,V)),_A(this.visualElement,"transform");const{animationState:se}=this.visualElement;se&&se.setActive("whileDrag",!0)},o=(F,V)=>{this.latestPointerEvent=F,this.latestPanInfo=V;const{dragPropagation:$,dragDirectionLock:Y,onDirectionLock:Z,onDrag:se}=this.getProps();if(!$&&!this.openDragLock)return;const{offset:te}=V;if(Y&&this.currentDirection===null){this.currentDirection=Cte(te),this.currentDirection!==null&&Z&&Z(this.currentDirection);return}this.updateAxis("x",V.point,te),this.updateAxis("y",V.point,te),this.visualElement.render(),se&&se(F,V)},k=(F,V)=>{this.latestPointerEvent=F,this.latestPanInfo=V,this.stop(F,V),this.latestPointerEvent=null,this.latestPanInfo=null},P=()=>ml(F=>{var V;return this.getAnimationState(F)==="paused"&&((V=this.getAxisMotionValue(F).animation)==null?void 0:V.play())}),{dragSnapToOrigin:O}=this.getProps();this.panSession=new Vj(e,{onSessionStart:_,onStart:w,onMove:o,onSessionEnd:k,resumeAnimation:P},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:O,distanceThreshold:u,contextWindow:jj(this.visualElement)})}stop(e,s){const u=e||this.latestPointerEvent,h=s||this.latestPanInfo,_=this.isDragging;if(this.cancel(),!_||!h||!u)return;const{velocity:w}=h;this.startAnimation(w);const{onDragEnd:o}=this.getProps();o&&ls.postRender(()=>o(u,h))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:u}=this.getProps();!u&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}updateAxis(e,s,u){const{drag:h}=this.getProps();if(!u||!db(e,h,this.currentDirection))return;const _=this.getAxisMotionValue(e);let w=this.originPoint[e]+u[e];this.constraints&&this.constraints[e]&&(w=xte(w,this.constraints[e],this.elastic[e])),_.set(w)}resolveConstraints(){var _;const{dragConstraints:e,dragElastic:s}=this.getProps(),u=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(_=this.visualElement.projection)==null?void 0:_.layout,h=this.constraints;e&&ug(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&u?this.constraints=wte(u.layoutBox,e):this.constraints=!1,this.elastic=Ete(s),h!==this.constraints&&u&&this.constraints&&!this.hasMutatedConstraints&&ml(w=>{this.constraints!==!1&&this.getAxisMotionValue(w)&&(this.constraints[w]=Tte(u.layoutBox[w],this.constraints[w]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!ug(e))return!1;const u=e.current,{projection:h}=this.visualElement;if(!h||!h.layout)return!1;const _=Iee(u,h.root,this.visualElement.getTransformPagePoint());let w=bte(h.layout.layoutBox,_);if(s){const o=s(kee(w));this.hasMutatedConstraints=!!o,o&&(w=Ej(o))}return w}startAnimation(e){const{drag:s,dragMomentum:u,dragElastic:h,dragTransition:_,dragSnapToOrigin:w,onDragTransitionEnd:o}=this.getProps(),k=this.constraints||{},P=ml(O=>{if(!db(O,s,this.currentDirection))return;let F=k&&k[O]||{};w&&(F={min:0,max:0});const V=h?200:1e6,$=h?40:1e7,Y={type:"inertia",velocity:u?e[O]:0,bounceStiffness:V,bounceDamping:$,timeConstant:750,restDelta:1,restSpeed:10,..._,...F};return this.startAxisValueAnimation(O,Y)});return Promise.all(P).then(o)}startAxisValueAnimation(e,s){const u=this.getAxisMotionValue(e);return _A(this.visualElement,e),u.start(RI(e,u,0,s,this.visualElement,!1))}stopAnimation(){ml(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ml(e=>{var s;return(s=this.getAxisMotionValue(e).animation)==null?void 0:s.pause()})}getAnimationState(e){var s;return(s=this.getAxisMotionValue(e).animation)==null?void 0:s.state}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,u=this.visualElement.getProps(),h=u[s];return h||this.visualElement.getValue(e,(u.initial?u.initial[e]:void 0)||0)}snapToCursor(e){ml(s=>{const{drag:u}=this.getProps();if(!db(s,u,this.currentDirection))return;const{projection:h}=this.visualElement,_=this.getAxisMotionValue(s);if(h&&h.layout){const{min:w,max:o}=h.layout.layoutBox[s];_.set(e[s]-vs(w,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:u}=this.visualElement;if(!ug(s)||!u||!this.constraints)return;this.stopAnimation();const h={x:0,y:0};ml(w=>{const o=this.getAxisMotionValue(w);if(o&&this.constraints!==!1){const k=o.get();h[w]=Ste({min:k,max:k},this.constraints[w])}});const{transformTemplate:_}=this.visualElement.getProps();this.visualElement.current.style.transform=_?_({},""):"none",u.root&&u.root.updateScroll(),u.updateLayout(),this.resolveConstraints(),ml(w=>{if(!db(w,e,null))return;const o=this.getAxisMotionValue(w),{min:k,max:P}=this.constraints[w];o.set(vs(k,P,h[w]))})}addListeners(){if(!this.visualElement.current)return;kte.set(this.visualElement,this);const e=this.visualElement.current,s=zv(e,"pointerdown",k=>{const{drag:P,dragListener:O=!0}=this.getProps();P&&O&&this.start(k)}),u=()=>{const{dragConstraints:k}=this.getProps();ug(k)&&k.current&&(this.constraints=this.resolveRefConstraints())},{projection:h}=this.visualElement,_=h.addEventListener("measure",u);h&&!h.layout&&(h.root&&h.root.updateScroll(),h.updateLayout()),ls.read(u);const w=g0(window,"resize",()=>this.scalePositionWithinConstraints()),o=h.addEventListener("didUpdate",({delta:k,hasLayoutChanged:P})=>{this.isDragging&&P&&(ml(O=>{const F=this.getAxisMotionValue(O);F&&(this.originPoint[O]+=k[O].translate,F.set(F.get()+k[O].translate))}),this.visualElement.render())});return()=>{w(),s(),_(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:u=!1,dragPropagation:h=!1,dragConstraints:_=!1,dragElastic:w=vA,dragMomentum:o=!0}=e;return{...e,drag:s,dragDirectionLock:u,dragPropagation:h,dragConstraints:_,dragElastic:w,dragMomentum:o}}}function db(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function Cte(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class Ite extends fh{constructor(e){super(e),this.removeGroupControls=bl,this.removeListeners=bl,this.controls=new Ate(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bl}update(){const{dragControls:e}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};e!==s&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const jz=t=>(e,s)=>{t&&ls.postRender(()=>t(e,s))};class Pte extends fh{constructor(){super(...arguments),this.removePointerDownListener=bl}onPointerDown(e){this.session=new Vj(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jj(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:u,onPanEnd:h}=this.node.getProps();return{onSessionStart:jz(e),onStart:jz(s),onMove:u,onEnd:(_,w)=>{delete this.session,h&&ls.postRender(()=>h(_,w))}}}mount(){this.removePointerDownListener=zv(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const jb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let fE=!1;class Mte extends X.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:u,layoutId:h}=this.props,{projection:_}=e;_&&(s.group&&s.group.add(_),u&&u.register&&h&&u.register(_),fE&&_.root.didUpdate(),_.addEventListener("animationComplete",()=>{this.safeToRemove()}),_.setOptions({..._.options,onExitComplete:()=>this.safeToRemove()})),jb.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:u,drag:h,isPresent:_}=this.props,{projection:w}=u;return w&&(w.isPresent=_,fE=!0,h||e.layoutDependency!==s||s===void 0||e.isPresent!==_?w.willUpdate():this.safeToRemove(),e.isPresent!==_&&(_?w.promote():w.relegate()||ls.postRender(()=>{const o=w.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),bI.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:u}=this.props,{projection:h}=e;fE=!0,h&&(h.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(h),u&&u.deregister&&u.deregister(h))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function $j(t){const[e,s]=qQ(),u=X.useContext(x4);return le.jsx(Mte,{...t,layoutGroup:u,switchLayoutGroup:X.useContext(Sj),isPresent:e,safeToRemove:s})}function Rte(t,e,s){const u=$o(t)?t:Gg(t);return u.start(RI("",u,e,s)),u.animation}const Dte=(t,e)=>t.depth-e.depth;class Lte{constructor(){this.children=[],this.isDirty=!1}add(e){iI(this.children,e),this.isDirty=!0}remove(e){sI(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Dte),this.isDirty=!1,this.children.forEach(e)}}function Ote(t,e){const s=ka.now(),u=({timestamp:h})=>{const _=h-s;_>=e&&(ah(u),t(_-e))};return ls.setup(u,!0),()=>ah(u)}const Gj=["TopLeft","TopRight","BottomLeft","BottomRight"],zte=Gj.length,Vz=t=>typeof t=="string"?parseFloat(t):t,Uz=t=>typeof t=="number"||Dr.test(t);function Fte(t,e,s,u,h,_){h?(t.opacity=vs(0,s.opacity??1,Bte(u)),t.opacityExit=vs(e.opacity??1,0,Nte(u))):_&&(t.opacity=vs(e.opacity??1,s.opacity??1,u));for(let w=0;w<zte;w++){const o=`border${Gj[w]}Radius`;let k=$z(e,o),P=$z(s,o);if(k===void 0&&P===void 0)continue;k||(k=0),P||(P=0),k===0||P===0||Uz(k)===Uz(P)?(t[o]=Math.max(vs(Vz(k),Vz(P),u),0),(Zc.test(P)||Zc.test(k))&&(t[o]+="%")):t[o]=P}(e.rotate||s.rotate)&&(t.rotate=vs(e.rotate||0,s.rotate||0,u))}function $z(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Bte=Hj(0,.5,M4),Nte=Hj(.5,.95,bl);function Hj(t,e,s){return u=>u<t?0:u>e?1:s(h0(t,e,u))}function Gz(t,e){t.min=e.min,t.max=e.max}function Yl(t,e){Gz(t.x,e.x),Gz(t.y,e.y)}function Hz(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Wz(t,e,s,u,h){return t-=e,t=I1(t,1/s,u),h!==void 0&&(t=I1(t,1/h,u)),t}function jte(t,e=0,s=1,u=.5,h,_=t,w=t){if(Zc.test(e)&&(e=parseFloat(e),e=vs(w.min,w.max,e/100)-w.min),typeof e!="number")return;let o=vs(_.min,_.max,u);t===_&&(o-=e),t.min=Wz(t.min,e,s,o,h),t.max=Wz(t.max,e,s,o,h)}function qz(t,e,[s,u,h],_,w){jte(t,e[s],e[u],e[h],e.scale,_,w)}const Vte=["x","scaleX","originX"],Ute=["y","scaleY","originY"];function Kz(t,e,s,u){qz(t.x,e,Vte,s?s.x:void 0,u?u.x:void 0),qz(t.y,e,Ute,s?s.y:void 0,u?u.y:void 0)}function Zz(t){return t.translate===0&&t.scale===1}function Wj(t){return Zz(t.x)&&Zz(t.y)}function Xz(t,e){return t.min===e.min&&t.max===e.max}function $te(t,e){return Xz(t.x,e.x)&&Xz(t.y,e.y)}function Yz(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function qj(t,e){return Yz(t.x,e.x)&&Yz(t.y,e.y)}function Jz(t){return oa(t.x)/oa(t.y)}function Qz(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Gte{constructor(){this.members=[]}add(e){iI(this.members,e),e.scheduleRender()}remove(e){if(sI(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){const s=this.members.findIndex(h=>e===h);if(s===0)return!1;let u;for(let h=s;h>=0;h--){const _=this.members[h];if(_.isPresent!==!1){u=_;break}}return u?(this.promote(u),!0):!1}promote(e,s){const u=this.lead;if(e!==u&&(this.prevLead=u,this.lead=e,e.show(),u)){u.instance&&u.scheduleRender(),e.scheduleRender(),e.resumeFrom=u,s&&(e.resumeFrom.preserveOpacity=!0),u.snapshot&&(e.snapshot=u.snapshot,e.snapshot.latestValues=u.animationValues||u.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:h}=e.options;h===!1&&u.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:s,resumingFrom:u}=e;s.onExitComplete&&s.onExitComplete(),u&&u.options.onExitComplete&&u.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Hte(t,e,s){let u="";const h=t.x.translate/e.x,_=t.y.translate/e.y,w=(s==null?void 0:s.z)||0;if((h||_||w)&&(u=`translate3d(${h}px, ${_}px, ${w}px) `),(e.x!==1||e.y!==1)&&(u+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:P,rotate:O,rotateX:F,rotateY:V,skewX:$,skewY:Y}=s;P&&(u=`perspective(${P}px) ${u}`),O&&(u+=`rotate(${O}deg) `),F&&(u+=`rotateX(${F}deg) `),V&&(u+=`rotateY(${V}deg) `),$&&(u+=`skewX(${$}deg) `),Y&&(u+=`skewY(${Y}deg) `)}const o=t.x.scale*e.x,k=t.y.scale*e.y;return(o!==1||k!==1)&&(u+=`scale(${o}, ${k})`),u||"none"}const pE=["","X","Y","Z"],Wte=1e3;let qte=0;function mE(t,e,s,u){const{latestValues:h}=e;h[t]&&(s[t]=h[t],e.setStaticValue(t,0),u&&(u[t]=0))}function Kj(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=Dj(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:h,layoutId:_}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",ls,!(h||_))}const{parent:u}=t;u&&!u.hasCheckedOptimisedAppear&&Kj(u)}function Zj({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:u,resetTransform:h}){return class{constructor(w={},o=e==null?void 0:e()){this.id=qte++,this.animationId=0,this.animationCommitId=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.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Xte),this.nodes.forEach(ere),this.nodes.forEach(tre),this.nodes.forEach(Yte)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=w,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let k=0;k<this.path.length;k++)this.path[k].shouldResetTransform=!0;this.root===this&&(this.nodes=new Lte)}addEventListener(w,o){return this.eventHandlers.has(w)||this.eventHandlers.set(w,new lI),this.eventHandlers.get(w).add(o)}notifyListeners(w,...o){const k=this.eventHandlers.get(w);k&&k.notify(...o)}hasListeners(w){return this.eventHandlers.has(w)}mount(w){if(this.instance)return;this.isSVG=uj(w)&&!GQ(w),this.instance=w;const{layoutId:o,layout:k,visualElement:P}=this.options;if(P&&!P.current&&P.mount(w),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(k||o)&&(this.isLayoutDirty=!0),t){let O,F=0;const V=()=>this.root.updateBlockedByResize=!1;ls.read(()=>{F=window.innerWidth}),t(w,()=>{const $=window.innerWidth;$!==F&&(F=$,this.root.updateBlockedByResize=!0,O&&O(),O=Ote(V,250),jb.hasAnimatedSinceResize&&(jb.hasAnimatedSinceResize=!1,this.nodes.forEach(r3)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&P&&(o||k)&&this.addEventListener("didUpdate",({delta:O,hasLayoutChanged:F,hasRelativeLayoutChanged:V,layout:$})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const Y=this.options.transition||P.getDefaultTransition()||ore,{onLayoutAnimationStart:Z,onLayoutAnimationComplete:se}=P.getProps(),te=!this.targetLayout||!qj(this.targetLayout,$),ee=!F&&V;if(this.options.layoutRoot||this.resumeFrom||ee||F&&(te||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const oe={...xI(Y,"layout"),onPlay:Z,onComplete:se};(P.shouldReduceMotion||this.options.layoutRoot)&&(oe.delay=0,oe.type=!1),this.startAnimation(oe),this.setAnimationOrigin(O,ee)}else F||r3(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=$})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const w=this.getStack();w&&w.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ah(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(rre),this.animationId++)}getTransformTemplate(){const{visualElement:w}=this.options;return w&&w.getProps().transformTemplate}willUpdate(w=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Kj(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let O=0;O<this.path.length;O++){const F=this.path[O];F.shouldResetTransform=!0,F.updateScroll("snapshot"),F.options.layoutRoot&&F.willUpdate(!1)}const{layoutId:o,layout:k}=this.options;if(o===void 0&&!k)return;const P=this.getTransformTemplate();this.prevTransformTemplateValue=P?P(this.latestValues,""):void 0,this.updateSnapshot(),w&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(e3);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(t3);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Qte),this.nodes.forEach(Kte),this.nodes.forEach(Zte)):this.nodes.forEach(t3),this.clearAllSnapshots();const o=ka.now();Po.delta=Vu(0,1e3/60,o-Po.timestamp),Po.timestamp=o,Po.isProcessing=!0,nE.update.process(Po),nE.preRender.process(Po),nE.render.process(Po),Po.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bI.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Jte),this.sharedNodes.forEach(nre)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ls.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ls.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!oa(this.snapshot.measuredBox.x)&&!oa(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let k=0;k<this.path.length;k++)this.path[k].updateScroll();const w=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=eo(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,w?w.layoutBox:void 0)}updateScroll(w="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===w&&(o=!1),o&&this.instance){const k=u(this.instance);this.scroll={animationId:this.root.animationId,phase:w,isRoot:k,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:k}}}resetTransform(){if(!h)return;const w=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!Wj(this.projectionDelta),k=this.getTransformTemplate(),P=k?k(this.latestValues,""):void 0,O=P!==this.prevTransformTemplateValue;w&&this.instance&&(o||pf(this.latestValues)||O)&&(h(this.instance,P),this.shouldResetTransform=!1,this.scheduleRender())}measure(w=!0){const o=this.measurePageBox();let k=this.removeElementScroll(o);return w&&(k=this.removeTransform(k)),are(k),{animationId:this.root.animationId,measuredBox:o,layoutBox:k,latestValues:{},source:this.id}}measurePageBox(){var P;const{visualElement:w}=this.options;if(!w)return eo();const o=w.measureViewportBox();if(!(((P=this.scroll)==null?void 0:P.wasRoot)||this.path.some(lre))){const{scroll:O}=this.root;O&&(dg(o.x,O.offset.x),dg(o.y,O.offset.y))}return o}removeElementScroll(w){var k;const o=eo();if(Yl(o,w),(k=this.scroll)!=null&&k.wasRoot)return o;for(let P=0;P<this.path.length;P++){const O=this.path[P],{scroll:F,options:V}=O;O!==this.root&&F&&V.layoutScroll&&(F.wasRoot&&Yl(o,w),dg(o.x,F.offset.x),dg(o.y,F.offset.y))}return o}applyTransform(w,o=!1){const k=eo();Yl(k,w);for(let P=0;P<this.path.length;P++){const O=this.path[P];!o&&O.options.layoutScroll&&O.scroll&&O!==O.root&&hg(k,{x:-O.scroll.offset.x,y:-O.scroll.offset.y}),pf(O.latestValues)&&hg(k,O.latestValues)}return pf(this.latestValues)&&hg(k,this.latestValues),k}removeTransform(w){const o=eo();Yl(o,w);for(let k=0;k<this.path.length;k++){const P=this.path[k];if(!P.instance||!pf(P.latestValues))continue;fA(P.latestValues)&&P.updateSnapshot();const O=eo(),F=P.measurePageBox();Yl(O,F),Kz(o,P.latestValues,P.snapshot?P.snapshot.layoutBox:void 0,O)}return pf(this.latestValues)&&Kz(o,this.latestValues),o}setTargetDelta(w){this.targetDelta=w,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(w){this.options={...this.options,...w,crossfade:w.crossfade!==void 0?w.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!==Po.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(w=!1){var $;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const k=!!this.resumingFrom||this!==o;if(!(w||k&&this.isSharedProjectionDirty||this.isProjectionDirty||($=this.parent)!=null&&$.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:O,layoutId:F}=this.options;if(!this.layout||!(O||F))return;this.resolvedRelativeTargetAt=Po.timestamp;const V=this.getClosestProjectingParent();V&&this.linkedParentVersion!==V.layoutVersion&&!V.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(V&&V.layout?this.createRelativeTarget(V,this.layout.layoutBox,V.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=eo(),this.targetWithTransforms=eo()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gte(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Yl(this.target,this.layout.layoutBox),Aj(this.target,this.targetDelta)):Yl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,V&&!!V.resumingFrom==!!this.resumingFrom&&!V.options.layoutScroll&&V.target&&this.animationProgress!==1?this.createRelativeTarget(V,this.target,V.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||fA(this.parent.latestValues)||kj(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(w,o,k){this.relativeParent=w,this.linkedParentVersion=w.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=eo(),this.relativeTargetOrigin=eo(),P1(this.relativeTargetOrigin,o,k),Yl(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var Y;const w=this.getLead(),o=!!this.resumingFrom||this!==w;let k=!0;if((this.isProjectionDirty||(Y=this.parent)!=null&&Y.isProjectionDirty)&&(k=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(k=!1),this.resolvedRelativeTargetAt===Po.timestamp&&(k=!1),k)return;const{layout:P,layoutId:O}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(P||O))return;Yl(this.layoutCorrected,this.layout.layoutBox);const F=this.treeScale.x,V=this.treeScale.y;Cee(this.layoutCorrected,this.treeScale,this.path,o),w.layout&&!w.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(w.target=w.layout.layoutBox,w.targetWithTransforms=eo());const{target:$}=w;if(!$){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Hz(this.prevProjectionDelta.x,this.projectionDelta.x),Hz(this.prevProjectionDelta.y,this.projectionDelta.y)),Fv(this.projectionDelta,this.layoutCorrected,$,this.latestValues),(this.treeScale.x!==F||this.treeScale.y!==V||!Qz(this.projectionDelta.x,this.prevProjectionDelta.x)||!Qz(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",$))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(w=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),w){const k=this.getStack();k&&k.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=fg(),this.projectionDelta=fg(),this.projectionDeltaWithTransform=fg()}setAnimationOrigin(w,o=!1){const k=this.snapshot,P=k?k.latestValues:{},O={...this.latestValues},F=fg();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const V=eo(),$=k?k.source:void 0,Y=this.layout?this.layout.source:void 0,Z=$!==Y,se=this.getStack(),te=!se||se.members.length<=1,ee=!!(Z&&!te&&this.options.crossfade===!0&&!this.path.some(sre));this.animationProgress=0;let oe;this.mixTargetDelta=he=>{const Ie=he/1e3;n3(F.x,w.x,Ie),n3(F.y,w.y,Ie),this.setTargetDelta(F),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(P1(V,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ire(this.relativeTarget,this.relativeTargetOrigin,V,Ie),oe&&$te(this.relativeTarget,oe)&&(this.isProjectionDirty=!1),oe||(oe=eo()),Yl(oe,this.relativeTarget)),Z&&(this.animationValues=O,Fte(O,P,this.latestValues,Ie,ee,te)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=Ie},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(w){var o,k,P;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(P=(k=this.resumingFrom)==null?void 0:k.currentAnimation)==null||P.stop(),this.pendingAnimation&&(ah(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ls.update(()=>{jb.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Gg(0)),this.currentAnimation=Rte(this.motionValue,[0,1e3],{...w,velocity:0,isSync:!0,onUpdate:O=>{this.mixTargetDelta(O),w.onUpdate&&w.onUpdate(O)},onStop:()=>{},onComplete:()=>{w.onComplete&&w.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 w=this.getStack();w&&w.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Wte),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const w=this.getLead();let{targetWithTransforms:o,target:k,layout:P,latestValues:O}=w;if(!(!o||!k||!P)){if(this!==w&&this.layout&&P&&Xj(this.options.animationType,this.layout.layoutBox,P.layoutBox)){k=this.target||eo();const F=oa(this.layout.layoutBox.x);k.x.min=w.target.x.min,k.x.max=k.x.min+F;const V=oa(this.layout.layoutBox.y);k.y.min=w.target.y.min,k.y.max=k.y.min+V}Yl(o,k),hg(o,O),Fv(this.projectionDeltaWithTransform,this.layoutCorrected,o,O)}}registerSharedNode(w,o){this.sharedNodes.has(w)||this.sharedNodes.set(w,new Gte),this.sharedNodes.get(w).add(o);const P=o.options.initialPromotionConfig;o.promote({transition:P?P.transition:void 0,preserveFollowOpacity:P&&P.shouldPreserveFollowOpacity?P.shouldPreserveFollowOpacity(o):void 0})}isLead(){const w=this.getStack();return w?w.lead===this:!0}getLead(){var o;const{layoutId:w}=this.options;return w?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:w}=this.options;return w?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:w}=this.options;if(w)return this.root.sharedNodes.get(w)}promote({needsReset:w,transition:o,preserveFollowOpacity:k}={}){const P=this.getStack();P&&P.promote(this,k),w&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const w=this.getStack();return w?w.relegate(this):!1}resetSkewAndRotation(){const{visualElement:w}=this.options;if(!w)return;let o=!1;const{latestValues:k}=w;if((k.z||k.rotate||k.rotateX||k.rotateY||k.rotateZ||k.skewX||k.skewY)&&(o=!0),!o)return;const P={};k.z&&mE("z",w,P,this.animationValues);for(let O=0;O<pE.length;O++)mE(`rotate${pE[O]}`,w,P,this.animationValues),mE(`skew${pE[O]}`,w,P,this.animationValues);w.render();for(const O in P)w.setStaticValue(O,P[O]),this.animationValues&&(this.animationValues[O]=P[O]);w.scheduleRender()}applyProjectionStyles(w,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){w.visibility="hidden";return}const k=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,w.visibility="",w.opacity="",w.pointerEvents=Nb(o==null?void 0:o.pointerEvents)||"",w.transform=k?k(this.latestValues,""):"none";return}const P=this.getLead();if(!this.projectionDelta||!this.layout||!P.target){this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=Nb(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!pf(this.latestValues)&&(w.transform=k?k({},""):"none",this.hasProjected=!1);return}w.visibility="";const O=P.animationValues||P.latestValues;this.applyTransformsToTarget();let F=Hte(this.projectionDeltaWithTransform,this.treeScale,O);k&&(F=k(O,F)),w.transform=F;const{x:V,y:$}=this.projectionDelta;w.transformOrigin=`${V.origin*100}% ${$.origin*100}% 0`,P.animationValues?w.opacity=P===this?O.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:O.opacityExit:w.opacity=P===this?O.opacity!==void 0?O.opacity:"":O.opacityExit!==void 0?O.opacityExit:0;for(const Y in hA){if(O[Y]===void 0)continue;const{correct:Z,applyTo:se,isCSSVariable:te}=hA[Y],ee=F==="none"?O[Y]:Z(O[Y],P);if(se){const oe=se.length;for(let he=0;he<oe;he++)w[se[he]]=ee}else te?this.options.visualElement.renderState.vars[Y]=ee:w[Y]=ee}this.options.layoutId&&(w.pointerEvents=P===this?Nb(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(w=>{var o;return(o=w.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(e3),this.root.sharedNodes.clear()}}}function Kte(t){t.updateLayout()}function Zte(t){var s;const e=((s=t.resumeFrom)==null?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:u,measuredBox:h}=t.layout,{animationType:_}=t.options,w=e.source!==t.layout.source;_==="size"?ml(F=>{const V=w?e.measuredBox[F]:e.layoutBox[F],$=oa(V);V.min=u[F].min,V.max=V.min+$}):Xj(_,e.layoutBox,u)&&ml(F=>{const V=w?e.measuredBox[F]:e.layoutBox[F],$=oa(u[F]);V.max=V.min+$,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[F].max=t.relativeTarget[F].min+$)});const o=fg();Fv(o,u,e.layoutBox);const k=fg();w?Fv(k,t.applyTransform(h,!0),e.measuredBox):Fv(k,u,e.layoutBox);const P=!Wj(o);let O=!1;if(!t.resumeFrom){const F=t.getClosestProjectingParent();if(F&&!F.resumeFrom){const{snapshot:V,layout:$}=F;if(V&&$){const Y=eo();P1(Y,e.layoutBox,V.layoutBox);const Z=eo();P1(Z,u,$.layoutBox),qj(Y,Z)||(O=!0),F.options.layoutRoot&&(t.relativeTarget=Z,t.relativeTargetOrigin=Y,t.relativeParent=F)}}}t.notifyListeners("didUpdate",{layout:u,snapshot:e,delta:k,layoutDelta:o,hasLayoutChanged:P,hasRelativeLayoutChanged:O})}else if(t.isLead()){const{onExitComplete:u}=t.options;u&&u()}t.options.transition=void 0}function Xte(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Yte(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Jte(t){t.clearSnapshot()}function e3(t){t.clearMeasurements()}function t3(t){t.isLayoutDirty=!1}function Qte(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function r3(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ere(t){t.resolveTargetDelta()}function tre(t){t.calcProjection()}function rre(t){t.resetSkewAndRotation()}function nre(t){t.removeLeadSnapshot()}function n3(t,e,s){t.translate=vs(e.translate,0,s),t.scale=vs(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function i3(t,e,s,u){t.min=vs(e.min,s.min,u),t.max=vs(e.max,s.max,u)}function ire(t,e,s,u){i3(t.x,e.x,s.x,u),i3(t.y,e.y,s.y,u)}function sre(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ore={duration:.45,ease:[.4,0,.1,1]},s3=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),o3=s3("applewebkit/")&&!s3("chrome/")?Math.round:bl;function a3(t){t.min=o3(t.min),t.max=o3(t.max)}function are(t){a3(t.x),a3(t.y)}function Xj(t,e,s){return t==="position"||t==="preserve-aspect"&&!mte(Jz(e),Jz(s),.2)}function lre(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const cre=Zj({attachResizeListener:(t,e)=>g0(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),gE={current:void 0},Yj=Zj({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!gE.current){const t=new cre({});t.mount(window),t.setOptions({layoutScroll:!0}),gE.current=t}return gE.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),ure={pan:{Feature:Pte},drag:{Feature:Ite,ProjectionNode:Yj,MeasureLayout:$j}};function l3(t,e,s){const{props:u}=t;t.animationState&&u.whileHover&&t.animationState.setActive("whileHover",s==="Start");const h="onHover"+s,_=u[h];_&&ls.postRender(()=>_(e,F0(e)))}class dre extends fh{mount(){const{current:e}=this.node;e&&(this.unmount=NQ(e,(s,u)=>(l3(this.node,u,"Start"),h=>l3(this.node,h,"End"))))}unmount(){}}class hre extends fh{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=L0(g0(this.node.current,"focus",()=>this.onFocus()),g0(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function c3(t,e,s){const{props:u}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&u.whileTap&&t.animationState.setActive("whileTap",s==="Start");const h="onTap"+(s==="End"?"":s),_=u[h];_&&ls.postRender(()=>_(e,F0(e)))}class fre extends fh{mount(){const{current:e}=this.node;e&&(this.unmount=$Q(e,(s,u)=>(c3(this.node,u,"Start"),(h,{success:_})=>c3(this.node,h,_?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const xA=new WeakMap,_E=new WeakMap,pre=t=>{const e=xA.get(t.target);e&&e(t)},mre=t=>{t.forEach(pre)};function gre({root:t,...e}){const s=t||document;_E.has(s)||_E.set(s,{});const u=_E.get(s),h=JSON.stringify(e);return u[h]||(u[h]=new IntersectionObserver(mre,{root:t,...e})),u[h]}function _re(t,e,s){const u=gre(e);return xA.set(t,s),u.observe(t),()=>{xA.delete(t),u.unobserve(t)}}const yre={some:0,all:1};class vre extends fh{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:s,margin:u,amount:h="some",once:_}=e,w={root:s?s.current:void 0,rootMargin:u,threshold:typeof h=="number"?h:yre[h]},o=k=>{const{isIntersecting:P}=k;if(this.isInView===P||(this.isInView=P,_&&!P&&this.hasEnteredView))return;P&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",P);const{onViewportEnter:O,onViewportLeave:F}=this.node.getProps(),V=P?O:F;V&&V(k)};return _re(this.node.current,w,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(xre(e,s))&&this.startObserver()}unmount(){}}function xre({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const wre={inView:{Feature:vre},tap:{Feature:fre},focus:{Feature:hre},hover:{Feature:dre}},bre={layout:{ProjectionNode:Yj,MeasureLayout:$j}},Sre={...cte,...wre,...ure,...bre},_0=Eee(Sre,Bee);function Tre(t,e,s){return t===0?{icon:Jq,label:s("weather.clear"),isRaining:!1}:t<=2?{icon:Uq,label:s("weather.partlyCloudy"),isRaining:!1}:t===3?{icon:Rk,label:s("weather.cloudy"),isRaining:!1}:t>=45&&t<=48?{icon:Vq,label:s("weather.fog"),isRaining:!1}:t>=51&&t<=55?{icon:Om,label:s("weather.drizzle"),isRaining:!0}:t>=56&&t<=57?{icon:Om,label:s("weather.freezingRain"),isRaining:!0}:t>=61&&t<=65?{icon:Om,label:s("weather.rain"),isRaining:!0}:t>=66&&t<=67?{icon:Om,label:s("weather.freezingRain"),isRaining:!0}:t>=71&&t<=77?{icon:iO,label:s("weather.snow"),isRaining:!1}:t>=80&&t<=82?{icon:Om,label:s("weather.rainShowers"),isRaining:!0}:t>=85&&t<=86?{icon:iO,label:s("weather.snowShowers"),isRaining:!1}:t>=95&&t<=99?{icon:Om,label:s("weather.thunderstorm"),isRaining:!0}:{icon:Rk,label:s("weather.unknown"),isRaining:!1}}const Jj=X.forwardRef((t,e)=>{const[s,u]=X.useState(null),[h,_]=X.useState(!0),{latitude:w,longitude:o}=tI(),{t:k}=Kf();if(X.useEffect(()=>{if(!w||!o)return;const V=async()=>{var Y,Z,se;try{const te=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${w}&longitude=${o}¤t_weather=true`);if(!te.ok)return;const ee=await te.json();u({temperature:Math.round(((Y=ee.current_weather)==null?void 0:Y.temperature)??0),weatherCode:((Z=ee.current_weather)==null?void 0:Z.weathercode)??0,isDay:((se=ee.current_weather)==null?void 0:se.is_day)===1})}catch(te){console.error("Failed to fetch weather:",te)}finally{_(!1)}};V();const $=setInterval(V,10*60*1e3);return()=>clearInterval($)},[w,o]),h||!s)return le.jsx("div",{ref:e,className:"flex items-center justify-center w-12 h-8",children:le.jsx(Rk,{className:"w-5 h-5 text-muted-foreground/50 animate-pulse"})});const{icon:P,label:O,isRaining:F}=Tre(s.weatherCode,s.isDay,k);return le.jsxs(_0.div,{ref:e,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"relative flex items-center justify-center",title:O,children:[le.jsxs("div",{className:"relative",children:[le.jsx(P,{className:"w-7 h-7 text-muted-foreground"}),le.jsx("div",{className:"absolute inset-0 flex items-center justify-center pt-0.5",children:le.jsxs("span",{className:"text-[9px] font-bold text-foreground",children:[s.temperature,"°"]})})]}),F&&le.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 flex gap-0.5",children:[0,1,2].map(V=>le.jsx(_0.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:V*.15,repeat:1/0}},V))})]})});Jj.displayName="WeatherIndicator";function Ere(){const[t,e]=X.useState(null),[s,u]=X.useState(!1),[h,_]=X.useState(null),w=X.useCallback(async(k,P,O,F,V)=>{u(!0),_(null);try{const $=await v4();if(!$)throw new Error("Kunde inte hämta karttoken");const Z=`https://api.mapbox.com/directions/v5/mapbox/${V==="driving"?"driving":V==="cycling"?"cycling":"walking"}/${P},${k};${F},${O}?geometries=geojson&steps=true&language=sv&access_token=${$}`,se=await fetch(Z);if(!se.ok)throw new Error(`Kunde inte hämta rutt: ${se.status}`);const te=await se.json();if(!te.routes||te.routes.length===0)throw new Error("Ingen rutt hittades");const ee=te.routes[0],oe=ee.legs[0].steps.map(he=>({instruction:he.maneuver.instruction||kre(he.maneuver.type,he.maneuver.modifier),distance:he.distance,duration:he.duration,maneuver:he.maneuver.type}));e({distance:ee.distance,duration:ee.duration,steps:oe,geometry:ee.geometry})}catch($){console.error("Routing error:",$),_($ instanceof Error?$.message:"Kunde inte beräkna rutt")}finally{u(!1)}},[]),o=X.useCallback(()=>{e(null),_(null)},[]);return{route:t,loading:s,error:h,fetchRoute:w,clearRoute:o}}function kre(t,e){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"},u=e?`${t}-${e}`:t;return s[u]||s[t]||"Fortsätt"}function Are(t){if(t<60)return`${Math.round(t)} sek`;const e=Math.floor(t/60);if(e<60)return`${e} min`;const s=Math.floor(e/60),u=e%60;if(s<24)return u>0?`${s} tim ${u} min`:`${s} tim`;const h=Math.floor(s/24),_=s%24;return _>0?`${h} d ${_} tim`:`${h} dagar`}function Cre(t){if(t<1e3)return`${Math.round(t)} m`;const e=t/1e3;return e<10?`${e.toFixed(1)} km`:`${Math.round(e)} km`}var Uc=function(){return Uc=Object.assign||function(e){for(var s,u=1,h=arguments.length;u<h;u++){s=arguments[u];for(var _ in s)Object.prototype.hasOwnProperty.call(s,_)&&(e[_]=s[_])}return e},Uc.apply(this,arguments)};function o_(t,e){var s={};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&e.indexOf(u)<0&&(s[u]=t[u]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var h=0,u=Object.getOwnPropertySymbols(t);h<u.length;h++)e.indexOf(u[h])<0&&Object.prototype.propertyIsEnumerable.call(t,u[h])&&(s[u[h]]=t[u[h]]);return s}function Ire(t,e,s,u){function h(_){return _ instanceof s?_:new s(function(w){w(_)})}return new(s||(s=Promise))(function(_,w){function o(O){try{P(u.next(O))}catch(F){w(F)}}function k(O){try{P(u.throw(O))}catch(F){w(F)}}function P(O){O.done?_(O.value):h(O.value).then(o,k)}P((u=u.apply(t,e||[])).next())})}function Pre(t,e,s){if(s||arguments.length===2)for(var u=0,h=e.length,_;u<h;u++)(_||!(u in e))&&(_||(_=Array.prototype.slice.call(e,0,u)),_[u]=e[u]);return t.concat(_||Array.prototype.slice.call(e))}const Mre=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class DI extends Error{constructor(e,s="FunctionsError",u){super(e),this.name=s,this.context=u}}class Rre extends DI{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class u3 extends DI{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class d3 extends DI{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var wA;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(wA||(wA={}));class Dre{constructor(e,{headers:s={},customFetch:u,region:h=wA.Any}={}){this.url=e,this.headers=s,this.region=h,this.fetch=Mre(u)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ire(this,arguments,void 0,function*(s,u={}){var h;let _,w;try{const{headers:o,method:k,body:P,signal:O,timeout:F}=u;let V={},{region:$}=u;$||($=this.region);const Y=new URL(`${this.url}/${s}`);$&&$!=="any"&&(V["x-region"]=$,Y.searchParams.set("forceFunctionRegion",$));let Z;P&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&P instanceof Blob||P instanceof ArrayBuffer?(V["Content-Type"]="application/octet-stream",Z=P):typeof P=="string"?(V["Content-Type"]="text/plain",Z=P):typeof FormData<"u"&&P instanceof FormData?Z=P:(V["Content-Type"]="application/json",Z=JSON.stringify(P)):Z=P;let se=O;F&&(w=new AbortController,_=setTimeout(()=>w.abort(),F),O?(se=w.signal,O.addEventListener("abort",()=>w.abort())):se=w.signal);const te=yield this.fetch(Y.toString(),{method:k||"POST",headers:Object.assign(Object.assign(Object.assign({},V),this.headers),o),body:Z,signal:se}).catch(Ie=>{throw new Rre(Ie)}),ee=te.headers.get("x-relay-error");if(ee&&ee==="true")throw new u3(te);if(!te.ok)throw new d3(te);let oe=((h=te.headers.get("Content-Type"))!==null&&h!==void 0?h:"text/plain").split(";")[0].trim(),he;return oe==="application/json"?he=yield te.json():oe==="application/octet-stream"||oe==="application/pdf"?he=yield te.blob():oe==="text/event-stream"?he=te:oe==="multipart/form-data"?he=yield te.formData():he=yield te.text(),{data:he,error:null,response:te}}catch(o){return{data:null,error:o,response:o instanceof d3||o instanceof u3?o.context:void 0}}finally{_&&clearTimeout(_)}})}}var Lre=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},Ore=class{constructor(t){var e,s;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(s=t.isMaybeSingle)!==null&&s!==void 0?s:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var s=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const u=this.fetch;let h=u(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async _=>{let w=null,o=null,k=null,P=_.status,O=_.statusText;if(_.ok){var F,V;if(s.method!=="HEAD"){var $;const te=await _.text();te===""||(s.headers.get("Accept")==="text/csv"||s.headers.get("Accept")&&(!(($=s.headers.get("Accept"))===null||$===void 0)&&$.includes("application/vnd.pgrst.plan+text"))?o=te:o=JSON.parse(te))}const Z=(F=s.headers.get("Prefer"))===null||F===void 0?void 0:F.match(/count=(exact|planned|estimated)/),se=(V=_.headers.get("content-range"))===null||V===void 0?void 0:V.split("/");Z&&se&&se.length>1&&(k=parseInt(se[1])),s.isMaybeSingle&&s.method==="GET"&&Array.isArray(o)&&(o.length>1?(w={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,k=null,P=406,O="Not Acceptable"):o.length===1?o=o[0]:o=null)}else{var Y;const Z=await _.text();try{w=JSON.parse(Z),Array.isArray(w)&&_.status===404&&(o=[],w=null,P=200,O="OK")}catch{_.status===404&&Z===""?(P=204,O="No Content"):w={message:Z}}if(w&&s.isMaybeSingle&&(!(w==null||(Y=w.details)===null||Y===void 0)&&Y.includes("0 rows"))&&(w=null,P=200,O="OK"),w&&s.shouldThrowOnError)throw new Lre(w)}return{error:w,data:o,count:k,status:P,statusText:O}});return this.shouldThrowOnError||(h=h.catch(_=>{var w;let o="";const k=_==null?void 0:_.cause;if(k){var P,O,F,V;const Y=(P=k==null?void 0:k.message)!==null&&P!==void 0?P:"",Z=(O=k==null?void 0:k.code)!==null&&O!==void 0?O:"";o=`${(F=_==null?void 0:_.name)!==null&&F!==void 0?F:"FetchError"}: ${_==null?void 0:_.message}`,o+=`
|
||
|
||
Caused by: ${(V=k==null?void 0:k.name)!==null&&V!==void 0?V:"Error"}: ${Y}`,Z&&(o+=` (${Z})`),k!=null&&k.stack&&(o+=`
|
||
${k.stack}`)}else{var $;o=($=_==null?void 0:_.stack)!==null&&$!==void 0?$:""}return{error:{message:`${(w=_==null?void 0:_.name)!==null&&w!==void 0?w:"FetchError"}: ${_==null?void 0:_.message}`,details:o,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),h.then(t,e)}returns(){return this}overrideTypes(){return this}},zre=class extends Ore{select(t){let e=!1;const s=(t??"*").split("").map(u=>/\s/.test(u)&&!e?"":(u==='"'&&(e=!e),u)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:s,foreignTable:u,referencedTable:h=u}={}){const _=h?`${h}.order`:"order",w=this.url.searchParams.get(_);return this.url.searchParams.set(_,`${w?`${w},`:""}${t}.${e?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:s=e}={}){const u=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(u,`${t}`),this}range(t,e,{foreignTable:s,referencedTable:u=s}={}){const h=typeof u>"u"?"offset":`${u}.offset`,_=typeof u>"u"?"limit":`${u}.limit`;return this.url.searchParams.set(h,`${t}`),this.url.searchParams.set(_,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:s=!1,buffers:u=!1,wal:h=!1,format:_="text"}={}){var w;const o=[t?"analyze":null,e?"verbose":null,s?"settings":null,u?"buffers":null,h?"wal":null].filter(Boolean).join("|"),k=(w=this.headers.get("Accept"))!==null&&w!==void 0?w:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${_}; for="${k}"; options=${o};`),_==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const h3=new RegExp("[,()]");var Km=class extends zre{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const s=Array.from(new Set(e)).map(u=>typeof u=="string"&&h3.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(t,`in.(${s})`),this}notIn(t,e){const s=Array.from(new Set(e)).map(u=>typeof u=="string"&&h3.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(t,`not.in.(${s})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:s,type:u}={}){let h="";u==="plain"?h="pl":u==="phrase"?h="ph":u==="websearch"&&(h="w");const _=s===void 0?"":`(${s})`;return this.url.searchParams.append(t,`${h}fts${_}.${e}`),this}match(t){return Object.entries(t).forEach(([e,s])=>{this.url.searchParams.append(e,`eq.${s}`)}),this}not(t,e,s){return this.url.searchParams.append(t,`not.${e}.${s}`),this}or(t,{foreignTable:e,referencedTable:s=e}={}){const u=s?`${s}.or`:"or";return this.url.searchParams.append(u,`(${t})`),this}filter(t,e,s){return this.url.searchParams.append(t,`${e}.${s}`),this}},Fre=class{constructor(t,{headers:e={},schema:s,fetch:u}){this.url=t,this.headers=new Headers(e),this.schema=s,this.fetch=u}select(t,e){const{head:s=!1,count:u}=e??{},h=s?"HEAD":"GET";let _=!1;const w=(t??"*").split("").map(o=>/\s/.test(o)&&!_?"":(o==='"'&&(_=!_),o)).join("");return this.url.searchParams.set("select",w),u&&this.headers.append("Prefer",`count=${u}`),new Km({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:s=!0}={}){var u;const h="POST";if(e&&this.headers.append("Prefer",`count=${e}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const _=t.reduce((w,o)=>w.concat(Object.keys(o)),[]);if(_.length>0){const w=[...new Set(_)].map(o=>`"${o}"`);this.url.searchParams.set("columns",w.join(","))}}return new Km({method:h,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:s=!1,count:u,defaultToNull:h=!0}={}){var _;const w="POST";if(this.headers.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),u&&this.headers.append("Prefer",`count=${u}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((k,P)=>k.concat(Object.keys(P)),[]);if(o.length>0){const k=[...new Set(o)].map(P=>`"${P}"`);this.url.searchParams.set("columns",k.join(","))}}return new Km({method:w,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(_=this.fetch)!==null&&_!==void 0?_:fetch})}update(t,{count:e}={}){var s;const u="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new Km({method:u,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}delete({count:t}={}){var e;const s="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new Km({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},Bre=class Qj{constructor(e,{headers:s={},schema:u,fetch:h}={}){this.url=e,this.headers=new Headers(s),this.schemaName=u,this.fetch=h}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Fre(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new Qj(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,s={},{head:u=!1,get:h=!1,count:_}={}){var w;let o;const k=new URL(`${this.url}/rpc/${e}`);let P;u||h?(o=u?"HEAD":"GET",Object.entries(s).filter(([F,V])=>V!==void 0).map(([F,V])=>[F,Array.isArray(V)?`{${V.join(",")}}`:`${V}`]).forEach(([F,V])=>{k.searchParams.append(F,V)})):(o="POST",P=s);const O=new Headers(this.headers);return _&&O.set("Prefer",`count=${_}`),new Km({method:o,url:k,headers:O,schema:this.schemaName,body:P,fetch:(w=this.fetch)!==null&&w!==void 0?w:fetch})}};class Nre{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const s=process.versions;if(s&&s.node){const u=s.node,h=parseInt(u.replace(/^v/,"").split(".")[0]);return h>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${h} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${h} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
||
import ws from "ws"
|
||
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let s=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(s+=`
|
||
|
||
Suggested solution: ${e.workaround}`),new Error(s)}static createWebSocket(e,s){const u=this.getWebSocketConstructor();return new u(e,s)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const jre="2.89.0",Vre=`realtime-js/${jre}`,eV="1.0.0",Ure="2.0.0",f3=eV,bA=1e4,$re=1e3,Gre=100;var Od;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Od||(Od={}));var Qs;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Qs||(Qs={}));var oc;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(oc||(oc={}));var SA;(function(t){t.websocket="websocket"})(SA||(SA={}));var _f;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(_f||(_f={}));class Hre{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,s){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(e));let u=[e.join_ref,e.ref,e.topic,e.event,e.payload];return s(JSON.stringify(u))}_binaryEncodeUserBroadcastPush(e){var s;return this._isArrayBuffer((s=e.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var s,u;const h=(u=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&u!==void 0?u:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,h)}_encodeJsonUserBroadcastPush(e){var s,u;const h=(u=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&u!==void 0?u:{},w=new TextEncoder().encode(JSON.stringify(h)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,w)}_encodeUserBroadcastPush(e,s,u){var h,_;const w=e.topic,o=(h=e.ref)!==null&&h!==void 0?h:"",k=(_=e.join_ref)!==null&&_!==void 0?_:"",P=e.payload.event,O=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},F=Object.keys(O).length===0?"":JSON.stringify(O);if(k.length>255)throw new Error(`joinRef length ${k.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(w.length>255)throw new Error(`topic length ${w.length} exceeds maximum of 255`);if(P.length>255)throw new Error(`userEvent length ${P.length} exceeds maximum of 255`);if(F.length>255)throw new Error(`metadata length ${F.length} exceeds maximum of 255`);const V=this.USER_BROADCAST_PUSH_META_LENGTH+k.length+o.length+w.length+P.length+F.length,$=new ArrayBuffer(this.HEADER_LENGTH+V);let Y=new DataView($),Z=0;Y.setUint8(Z++,this.KINDS.userBroadcastPush),Y.setUint8(Z++,k.length),Y.setUint8(Z++,o.length),Y.setUint8(Z++,w.length),Y.setUint8(Z++,P.length),Y.setUint8(Z++,F.length),Y.setUint8(Z++,s),Array.from(k,te=>Y.setUint8(Z++,te.charCodeAt(0))),Array.from(o,te=>Y.setUint8(Z++,te.charCodeAt(0))),Array.from(w,te=>Y.setUint8(Z++,te.charCodeAt(0))),Array.from(P,te=>Y.setUint8(Z++,te.charCodeAt(0))),Array.from(F,te=>Y.setUint8(Z++,te.charCodeAt(0)));var se=new Uint8Array($.byteLength+u.byteLength);return se.set(new Uint8Array($),0),se.set(new Uint8Array(u),$.byteLength),se.buffer}decode(e,s){if(this._isArrayBuffer(e)){let u=this._binaryDecode(e);return s(u)}if(typeof e=="string"){const u=JSON.parse(e),[h,_,w,o,k]=u;return s({join_ref:h,ref:_,topic:w,event:o,payload:k})}return s({})}_binaryDecode(e){const s=new DataView(e),u=s.getUint8(0),h=new TextDecoder;switch(u){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,s,h)}}_decodeUserBroadcast(e,s,u){const h=s.getUint8(1),_=s.getUint8(2),w=s.getUint8(3),o=s.getUint8(4);let k=this.HEADER_LENGTH+4;const P=u.decode(e.slice(k,k+h));k=k+h;const O=u.decode(e.slice(k,k+_));k=k+_;const F=u.decode(e.slice(k,k+w));k=k+w;const V=e.slice(k,e.byteLength),$=o===this.JSON_ENCODING?JSON.parse(u.decode(V)):V,Y={type:this.BROADCAST_EVENT,event:O,payload:$};return w>0&&(Y.meta=JSON.parse(F)),{join_ref:null,ref:null,topic:P,event:this.BROADCAST_EVENT,payload:Y}}_isArrayBuffer(e){var s;return e instanceof ArrayBuffer||((s=e==null?void 0:e.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(e,s){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([u])=>s.includes(u)))}}class tV{constructor(e,s){this.callback=e,this.timerCalc=s,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=s}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Hi;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Hi||(Hi={}));const p3=(t,e,s={})=>{var u;const h=(u=s.skipTypes)!==null&&u!==void 0?u:[];return e?Object.keys(e).reduce((_,w)=>(_[w]=Wre(w,t,e,h),_),{}):{}},Wre=(t,e,s,u)=>{const h=e.find(o=>o.name===t),_=h==null?void 0:h.type,w=s[t];return _&&!u.includes(_)?rV(_,w):TA(w)},rV=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return Xre(e,s)}switch(t){case Hi.bool:return qre(e);case Hi.float4:case Hi.float8:case Hi.int2:case Hi.int4:case Hi.int8:case Hi.numeric:case Hi.oid:return Kre(e);case Hi.json:case Hi.jsonb:return Zre(e);case Hi.timestamp:return Yre(e);case Hi.abstime:case Hi.date:case Hi.daterange:case Hi.int4range:case Hi.int8range:case Hi.money:case Hi.reltime:case Hi.text:case Hi.time:case Hi.timestamptz:case Hi.timetz:case Hi.tsrange:case Hi.tstzrange:return TA(e);default:return TA(e)}},TA=t=>t,qre=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Kre=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Zre=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Xre=(t,e)=>{if(typeof t!="string")return t;const s=t.length-1,u=t[s];if(t[0]==="{"&&u==="}"){let _;const w=t.slice(1,s);try{_=JSON.parse("["+w+"]")}catch{_=w?w.split(","):[]}return _.map(o=>rV(e,o))}return t},Yre=t=>typeof t=="string"?t.replace(" ","T"):t,nV=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class yE{constructor(e,s,u={},h=bA){this.channel=e,this.event=s,this.payload=u,this.timeout=h,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,s){var u;return this._hasReceived(e)&&s((u=this.receivedResp)===null||u===void 0?void 0:u.response),this.recHooks.push({status:e,callback:s}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=s=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=s,this._matchReceive(s)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,s){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:s})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:s}){this.recHooks.filter(u=>u.status===e).forEach(u=>u.callback(s))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var m3;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(m3||(m3={}));class Bv{constructor(e,s){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const u=(s==null?void 0:s.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(u.state,{},h=>{const{onJoin:_,onLeave:w,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Bv.syncState(this.state,h,_,w),this.pendingDiffs.forEach(k=>{this.state=Bv.syncDiff(this.state,k,_,w)}),this.pendingDiffs=[],o()}),this.channel._on(u.diff,{},h=>{const{onJoin:_,onLeave:w,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(h):(this.state=Bv.syncDiff(this.state,h,_,w),o())}),this.onJoin((h,_,w)=>{this.channel._trigger("presence",{event:"join",key:h,currentPresences:_,newPresences:w})}),this.onLeave((h,_,w)=>{this.channel._trigger("presence",{event:"leave",key:h,currentPresences:_,leftPresences:w})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,s,u,h){const _=this.cloneDeep(e),w=this.transformState(s),o={},k={};return this.map(_,(P,O)=>{w[P]||(k[P]=O)}),this.map(w,(P,O)=>{const F=_[P];if(F){const V=O.map(se=>se.presence_ref),$=F.map(se=>se.presence_ref),Y=O.filter(se=>$.indexOf(se.presence_ref)<0),Z=F.filter(se=>V.indexOf(se.presence_ref)<0);Y.length>0&&(o[P]=Y),Z.length>0&&(k[P]=Z)}else o[P]=O}),this.syncDiff(_,{joins:o,leaves:k},u,h)}static syncDiff(e,s,u,h){const{joins:_,leaves:w}={joins:this.transformState(s.joins),leaves:this.transformState(s.leaves)};return u||(u=()=>{}),h||(h=()=>{}),this.map(_,(o,k)=>{var P;const O=(P=e[o])!==null&&P!==void 0?P:[];if(e[o]=this.cloneDeep(k),O.length>0){const F=e[o].map($=>$.presence_ref),V=O.filter($=>F.indexOf($.presence_ref)<0);e[o].unshift(...V)}u(o,O,k)}),this.map(w,(o,k)=>{let P=e[o];if(!P)return;const O=k.map(F=>F.presence_ref);P=P.filter(F=>O.indexOf(F.presence_ref)<0),e[o]=P,h(o,P,k),P.length===0&&delete e[o]}),e}static map(e,s){return Object.getOwnPropertyNames(e).map(u=>s(u,e[u]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((s,u)=>{const h=e[u];return"metas"in h?s[u]=h.metas.map(_=>(_.presence_ref=_.phx_ref,delete _.phx_ref,delete _.phx_ref_prev,_)):s[u]=h,s},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var g3;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(g3||(g3={}));var Nv;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Nv||(Nv={}));var Cu;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Cu||(Cu={}));class pg{constructor(e,s={config:{}},u){var h,_;if(this.topic=e,this.params=s,this.socket=u,this.bindings={},this.state=Qs.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.timeout=this.socket.timeout,this.joinPush=new yE(this,oc.join,this.params,this.timeout),this.rejoinTimer=new tV(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Qs.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(w=>w.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Qs.closed,this.socket._remove(this)}),this._onError(w=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,w),this.state=Qs.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Qs.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",w=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,w),this.state=Qs.errored,this.rejoinTimer.scheduleTimeout())}),this._on(oc.reply,{},(w,o)=>{this._trigger(this._replyEventName(o),w)}),this.presence=new Bv(this),this.broadcastEndpointURL=nV(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((_=(h=this.params.config)===null||h===void 0?void 0:h.broadcast)===null||_===void 0)&&_.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,s=this.timeout){var u,h,_;if(this.socket.isConnected()||this.socket.connect(),this.state==Qs.closed){const{config:{broadcast:w,presence:o,private:k}}=this.params,P=(h=(u=this.bindings.postgres_changes)===null||u===void 0?void 0:u.map($=>$.filter))!==null&&h!==void 0?h:[],O=!!this.bindings[Nv.PRESENCE]&&this.bindings[Nv.PRESENCE].length>0||((_=this.params.config.presence)===null||_===void 0?void 0:_.enabled)===!0,F={},V={broadcast:w,presence:Object.assign(Object.assign({},o),{enabled:O}),postgres_changes:P,private:k};this.socket.accessTokenValue&&(F.access_token=this.socket.accessTokenValue),this._onError($=>e==null?void 0:e(Cu.CHANNEL_ERROR,$)),this._onClose(()=>e==null?void 0:e(Cu.CLOSED)),this.updateJoinPayload(Object.assign({config:V},F)),this.joinedOnce=!0,this._rejoin(s),this.joinPush.receive("ok",async({postgres_changes:$})=>{var Y;if(this.socket._isManualToken()||this.socket.setAuth(),$===void 0){e==null||e(Cu.SUBSCRIBED);return}else{const Z=this.bindings.postgres_changes,se=(Y=Z==null?void 0:Z.length)!==null&&Y!==void 0?Y:0,te=[];for(let ee=0;ee<se;ee++){const oe=Z[ee],{filter:{event:he,schema:Ie,table:Be,filter:je}}=oe,Je=$&&$[ee];if(Je&&Je.event===he&&pg.isFilterValueEqual(Je.schema,Ie)&&pg.isFilterValueEqual(Je.table,Be)&&pg.isFilterValueEqual(Je.filter,je))te.push(Object.assign(Object.assign({},oe),{id:Je.id}));else{this.unsubscribe(),this.state=Qs.errored,e==null||e(Cu.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=te,e&&e(Cu.SUBSCRIBED);return}}).receive("error",$=>{this.state=Qs.errored,e==null||e(Cu.CHANNEL_ERROR,new Error(JSON.stringify(Object.values($).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Cu.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,s={}){return await this.send({type:"presence",event:"track",payload:e},s.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,s,u){return this.state===Qs.joined&&e===Nv.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,s,u)}async httpSend(e,s,u={}){var h;if(s==null)return Promise.reject("Payload is required for httpSend()");const _={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(_.Authorization=`Bearer ${this.socket.accessTokenValue}`);const w={method:"POST",headers:_,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:s,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,w,(h=u.timeout)!==null&&h!==void 0?h:this.timeout);if(o.status===202)return{success:!0};let k=o.statusText;try{const P=await o.json();k=P.error||P.message||k}catch{}return Promise.reject(new Error(k))}async send(e,s={}){var u,h;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:_,payload:w}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const k={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:_,payload:w,private:this.private}]})};try{const P=await this._fetchWithTimeout(this.broadcastEndpointURL,k,(u=s.timeout)!==null&&u!==void 0?u:this.timeout);return await((h=P.body)===null||h===void 0?void 0:h.cancel()),P.ok?"ok":"error"}catch(P){return P.name==="AbortError"?"timed out":"error"}}else return new Promise(_=>{var w,o,k;const P=this._push(e.type,e,s.timeout||this.timeout);e.type==="broadcast"&&!(!((k=(o=(w=this.params)===null||w===void 0?void 0:w.config)===null||o===void 0?void 0:o.broadcast)===null||k===void 0)&&k.ack)&&_("ok"),P.receive("ok",()=>_("ok")),P.receive("error",()=>_("error")),P.receive("timeout",()=>_("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Qs.leaving;const s=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(oc.close,"leave",this._joinRef())};this.joinPush.destroy();let u=null;return new Promise(h=>{u=new yE(this,oc.leave,{},e),u.receive("ok",()=>{s(),h("ok")}).receive("timeout",()=>{s(),h("timed out")}).receive("error",()=>{h("error")}),u.send(),this._canPush()||u.trigger("ok",{})}).finally(()=>{u==null||u.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Qs.closed,this.bindings={}}async _fetchWithTimeout(e,s,u){const h=new AbortController,_=setTimeout(()=>h.abort(),u),w=await this.socket.fetch(e,Object.assign(Object.assign({},s),{signal:h.signal}));return clearTimeout(_),w}_push(e,s,u=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let h=new yE(this,e,s,u);return this._canPush()?h.send():this._addToPushBuffer(h),h}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Gre){const s=this.pushBuffer.shift();s&&(s.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload))}}_onMessage(e,s,u){return s}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,s,u){var h,_;const w=e.toLocaleLowerCase(),{close:o,error:k,leave:P,join:O}=oc;if(u&&[o,k,P,O].indexOf(w)>=0&&u!==this._joinRef())return;let V=this._onMessage(w,s,u);if(s&&!V)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(w)?(h=this.bindings.postgres_changes)===null||h===void 0||h.filter($=>{var Y,Z,se;return((Y=$.filter)===null||Y===void 0?void 0:Y.event)==="*"||((se=(Z=$.filter)===null||Z===void 0?void 0:Z.event)===null||se===void 0?void 0:se.toLocaleLowerCase())===w}).map($=>$.callback(V,u)):(_=this.bindings[w])===null||_===void 0||_.filter($=>{var Y,Z,se,te,ee,oe;if(["broadcast","presence","postgres_changes"].includes(w))if("id"in $){const he=$.id,Ie=(Y=$.filter)===null||Y===void 0?void 0:Y.event;return he&&((Z=s.ids)===null||Z===void 0?void 0:Z.includes(he))&&(Ie==="*"||(Ie==null?void 0:Ie.toLocaleLowerCase())===((se=s.data)===null||se===void 0?void 0:se.type.toLocaleLowerCase()))}else{const he=(ee=(te=$==null?void 0:$.filter)===null||te===void 0?void 0:te.event)===null||ee===void 0?void 0:ee.toLocaleLowerCase();return he==="*"||he===((oe=s==null?void 0:s.event)===null||oe===void 0?void 0:oe.toLocaleLowerCase())}else return $.type.toLocaleLowerCase()===w}).map($=>{if(typeof V=="object"&&"ids"in V){const Y=V.data,{schema:Z,table:se,commit_timestamp:te,type:ee,errors:oe}=Y;V=Object.assign(Object.assign({},{schema:Z,table:se,commit_timestamp:te,eventType:ee,new:{},old:{},errors:oe}),this._getPayloadRecords(Y))}$.callback(V,u)})}_isClosed(){return this.state===Qs.closed}_isJoined(){return this.state===Qs.joined}_isJoining(){return this.state===Qs.joining}_isLeaving(){return this.state===Qs.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,s,u){const h=e.toLocaleLowerCase(),_={type:h,filter:s,callback:u};return this.bindings[h]?this.bindings[h].push(_):this.bindings[h]=[_],this}_off(e,s){const u=e.toLocaleLowerCase();return this.bindings[u]&&(this.bindings[u]=this.bindings[u].filter(h=>{var _;return!(((_=h.type)===null||_===void 0?void 0:_.toLocaleLowerCase())===u&&pg.isEqual(h.filter,s))})),this}static isEqual(e,s){if(Object.keys(e).length!==Object.keys(s).length)return!1;for(const u in e)if(e[u]!==s[u])return!1;return!0}static isFilterValueEqual(e,s){return(e??void 0)===(s??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(oc.close,{},e)}_onError(e){this._on(oc.error,{},s=>e(s))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Qs.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const s={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(s.new=p3(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=p3(e.columns,e.old_record)),s}}const vE=()=>{},hb={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Jre=[1e3,2e3,5e3,1e4],Qre=1e4,ene=`
|
||
addEventListener("message", (e) => {
|
||
if (e.data.event === "start") {
|
||
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
||
}
|
||
});`;class tne{constructor(e,s){var u;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=bA,this.transport=null,this.heartbeatIntervalMs=hb.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=vE,this.ref=0,this.reconnectTimer=null,this.vsn=f3,this.logger=vE,this.conn=null,this.sendBuffer=[],this.serializer=new Hre,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=h=>h?(..._)=>h(..._):(..._)=>fetch(..._),!(!((u=s==null?void 0:s.params)===null||u===void 0)&&u.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey,this.endPoint=`${e}/${SA.websocket}`,this.httpEndpoint=nV(e),this._initializeOptions(s),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(s==null?void 0:s.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Nre.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const s=e.message;throw s.includes("Node.js")?new Error(`${s}
|
||
|
||
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
||
|
||
Option 1: Use Node.js 22+ which has native WebSocket support
|
||
Option 2: Install and provide the "ws" package:
|
||
|
||
npm install ws
|
||
|
||
import ws from "ws"
|
||
const client = new RealtimeClient(url, {
|
||
...options,
|
||
transport: ws
|
||
})`):new Error(`WebSocket not available: ${s}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,s){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const u=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(u),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,s??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const s=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),s}async removeAllChannels(){const e=await Promise.all(this.channels.map(s=>s.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,s,u){this.logger(e,s,u)}connectionState(){switch(this.conn&&this.conn.readyState){case Od.connecting:return _f.Connecting;case Od.open:return _f.Open;case Od.closing:return _f.Closing;default:return _f.Closed}}isConnected(){return this.connectionState()===_f.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,s={config:{}}){const u=`realtime:${e}`,h=this.getChannels().find(_=>_.topic===u);if(h)return h;{const _=new pg(`realtime:${e}`,s,this);return this.channels.push(_),_}}push(e){const{topic:s,event:u,payload:h,ref:_}=e,w=()=>{this.encode(e,o=>{var k;(k=this.conn)===null||k===void 0||k.send(o)})};this.log("push",`${s} ${u} (${_})`,h),this.isConnected()?w():this.sendBuffer.push(w)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(s){this.log("error","error in heartbeat callback",s)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(s){this.log("error","error in heartbeat callback",s)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close($re,"heartbeat timeout"),setTimeout(()=>{var s;this.isConnected()||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout()},hb.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(s){this.log("error","error in heartbeat callback",s)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let s=this.channels.find(u=>u.topic===e&&(u._isJoined()||u._isJoining()));s&&(this.log("transport",`leaving duplicate topic "${e}"`),s.unsubscribe())}_remove(e){this.channels=this.channels.filter(s=>s.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,s=>{if(s.topic==="phoenix"&&s.event==="phx_reply")try{this.heartbeatCallback(s.payload.status==="ok"?"ok":"error")}catch(P){this.log("error","error in heartbeat callback",P)}s.ref&&s.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:u,event:h,payload:_,ref:w}=s,o=w?`(${w})`:"",k=_.status||"";this.log("receive",`${k} ${u} ${h} ${o}`.trim(),_),this.channels.filter(P=>P._isMember(u)).forEach(P=>P._trigger(h,_,w)),this._triggerStateCallbacks("message",s)})}_clearTimer(e){var s;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((s=this.reconnectTimer)===null||s===void 0||s.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Od.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Od.open||this.conn.readyState===Od.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(s=>{this.log("error","error waiting for auth on connect",s),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=s=>{this.log("worker","worker error",s.message),this._terminateWorker()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var s;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(oc.error))}_appendParams(e,s){if(Object.keys(s).length===0)return e;const u=e.match(/\?/)?"&":"?",h=new URLSearchParams(s);return`${e}${u}${h}`}_workerObjectUrl(e){let s;if(e)s=e;else{const u=new Blob([ene],{type:"application/javascript"});s=URL.createObjectURL(u)}return s}_setConnectionState(e,s=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=s)}async _performAuth(e=null){let s,u=!1;if(e)s=e,u=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(h){this.log("error","Error fetching access token from callback",h),s=this.accessTokenValue}else s=this.accessTokenValue;u?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(h=>{const _={access_token:s,version:Vre};s&&h.updateJoinPayload(_),h.joinedOnce&&h._isJoined()&&h._push(oc.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${e}`,s)})}_triggerStateCallbacks(e,s){try{this.stateChangeCallbacks[e].forEach(u=>{try{u(s)}catch(h){this.log("error",`error in ${e} callback`,h)}})}catch(u){this.log("error",`error triggering ${e} callbacks`,u)}}_setupReconnectionTimer(){this.reconnectTimer=new tV(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},hb.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var s,u,h,_,w,o,k,P,O,F,V,$;switch(this.transport=(s=e==null?void 0:e.transport)!==null&&s!==void 0?s:null,this.timeout=(u=e==null?void 0:e.timeout)!==null&&u!==void 0?u:bA,this.heartbeatIntervalMs=(h=e==null?void 0:e.heartbeatIntervalMs)!==null&&h!==void 0?h:hb.HEARTBEAT_INTERVAL,this.worker=(_=e==null?void 0:e.worker)!==null&&_!==void 0?_:!1,this.accessToken=(w=e==null?void 0:e.accessToken)!==null&&w!==void 0?w:null,this.heartbeatCallback=(o=e==null?void 0:e.heartbeatCallback)!==null&&o!==void 0?o:vE,this.vsn=(k=e==null?void 0:e.vsn)!==null&&k!==void 0?k:f3,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(P=e==null?void 0:e.reconnectAfterMs)!==null&&P!==void 0?P:Y=>Jre[Y-1]||Qre,this.vsn){case eV:this.encode=(O=e==null?void 0:e.encode)!==null&&O!==void 0?O:(Y,Z)=>Z(JSON.stringify(Y)),this.decode=(F=e==null?void 0:e.decode)!==null&&F!==void 0?F:(Y,Z)=>Z(JSON.parse(Y));break;case Ure:this.encode=(V=e==null?void 0:e.encode)!==null&&V!==void 0?V:this.serializer.encode.bind(this.serializer),this.decode=($=e==null?void 0:e.decode)!==null&&$!==void 0?$:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var y0=class extends Error{constructor(t,e){var s;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((s=e.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function rne(t,e,s){const u=new URL(e,t);if(s)for(const[h,_]of Object.entries(s))_!==void 0&&u.searchParams.set(h,_);return u.toString()}async function nne(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function ine(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:u,query:h,body:_,headers:w}){const o=rne(t.baseUrl,u,h),k=await nne(t.auth),P=await e(o,{method:s,headers:{..._?{"Content-Type":"application/json"}:{},...k,...w},body:_?JSON.stringify(_):void 0}),O=await P.text(),F=(P.headers.get("content-type")||"").includes("application/json"),V=F&&O?JSON.parse(O):O;if(!P.ok){const $=F?V:void 0,Y=$==null?void 0:$.error;throw new y0((Y==null?void 0:Y.message)??`Request failed with status ${P.status}`,{status:P.status,icebergType:Y==null?void 0:Y.type,icebergCode:Y==null?void 0:Y.code,details:$})}return{status:P.status,headers:P.headers,data:V}}}}function fb(t){return t.join("")}var sne=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:fb(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(u=>({namespace:u}))}async createNamespace(t,e){const s={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${fb(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${fb(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${fb(t.namespace)}`}),!0}catch(e){if(e instanceof y0&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof y0&&s.status===409)return;throw s}}};function Fm(t){return t.join("")}var one=class{constructor(t,e="",s){this.client=t,this.prefix=e,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Fm(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Fm(t.namespace)}/tables`,body:e,headers:s})).data.metadata}async updateTable(t,e){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Fm(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Fm(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Fm(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Fm(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof y0&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof y0&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},ane=class{constructor(t){var u;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=ine({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(u=t.accessDelegation)==null?void 0:u.join(","),this.namespaceOps=new sne(this.client,e),this.tableOps=new one(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},pS=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function _s(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var lne=class extends pS{constructor(t,e,s){super(t),this.name="StorageApiError",this.status=e,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},EA=class extends pS{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const LI=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),cne=()=>Response,kA=t=>{if(Array.isArray(t))return t.map(s=>kA(s));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([s,u])=>{const h=s.replace(/([-_][a-z])/gi,_=>_.toUpperCase().replace(/[-_]/g,""));e[h]=kA(u)}),e},une=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},dne=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function v0(t){"@babel/helpers - typeof";return v0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v0(t)}function hne(t,e){if(v0(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var u=s.call(t,e);if(v0(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fne(t){var e=hne(t,"string");return v0(e)=="symbol"?e:e+""}function pne(t,e,s){return(e=fne(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function _3(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);e&&(u=u.filter(function(h){return Object.getOwnPropertyDescriptor(t,h).enumerable})),s.push.apply(s,u)}return s}function yn(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?_3(Object(s),!0).forEach(function(u){pne(t,u,s[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):_3(Object(s)).forEach(function(u){Object.defineProperty(t,u,Object.getOwnPropertyDescriptor(s,u))})}return t}const xE=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},mne=async(t,e,s)=>{t instanceof await cne()&&!(s!=null&&s.noResolveJson)?t.json().then(u=>{const h=t.status||500,_=(u==null?void 0:u.statusCode)||h+"";e(new lne(xE(u),h,_))}).catch(u=>{e(new EA(xE(u),u))}):e(new EA(xE(t),t))},gne=(t,e,s,u)=>{const h={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!u?h:(une(u)?(h.headers=yn({"Content-Type":"application/json"},e==null?void 0:e.headers),h.body=JSON.stringify(u)):h.body=u,e!=null&&e.duplex&&(h.duplex=e.duplex),yn(yn({},h),s))};async function B0(t,e,s,u,h,_){return new Promise((w,o)=>{t(s,gne(e,u,h,_)).then(k=>{if(!k.ok)throw k;return u!=null&&u.noResolveJson?k:k.json()}).then(k=>w(k)).catch(k=>mne(k,o,u))})}async function x0(t,e,s,u){return B0(t,"GET",e,s,u)}async function rc(t,e,s,u,h){return B0(t,"POST",e,u,h,s)}async function AA(t,e,s,u,h){return B0(t,"PUT",e,u,h,s)}async function _ne(t,e,s,u){return B0(t,"HEAD",e,yn(yn({},s),{},{noResolveJson:!0}),u)}async function OI(t,e,s,u,h){return B0(t,"DELETE",e,u,h,s)}var yne=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(_s(e))return{data:null,error:e};throw e}}};let iV;iV=Symbol.toStringTag;var vne=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[iV]="BlobDownloadBuilder",this.promise=null}asStream(){return new yne(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(_s(e))return{data:null,error:e};throw e}}};const xne={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},y3={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var wne=class{constructor(t,e={},s,u){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=s,this.fetch=LI(u)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,s,u){var h=this;try{let _;const w=yn(yn({},y3),u);let o=yn(yn({},h.headers),t==="POST"&&{"x-upsert":String(w.upsert)});const k=w.metadata;typeof Blob<"u"&&s instanceof Blob?(_=new FormData,_.append("cacheControl",w.cacheControl),k&&_.append("metadata",h.encodeMetadata(k)),_.append("",s)):typeof FormData<"u"&&s instanceof FormData?(_=s,_.has("cacheControl")||_.append("cacheControl",w.cacheControl),k&&!_.has("metadata")&&_.append("metadata",h.encodeMetadata(k))):(_=s,o["cache-control"]=`max-age=${w.cacheControl}`,o["content-type"]=w.contentType,k&&(o["x-metadata"]=h.toBase64(h.encodeMetadata(k))),(typeof ReadableStream<"u"&&_ instanceof ReadableStream||_&&typeof _=="object"&&"pipe"in _&&typeof _.pipe=="function")&&!w.duplex&&(w.duplex="half")),u!=null&&u.headers&&(o=yn(yn({},o),u.headers));const P=h._removeEmptyFolders(e),O=h._getFinalPath(P),F=await(t=="PUT"?AA:rc)(h.fetch,`${h.url}/object/${O}`,_,yn({headers:o},w!=null&&w.duplex?{duplex:w.duplex}:{}));return{data:{path:P,id:F.Id,fullPath:F.Key},error:null}}catch(_){if(h.shouldThrowOnError)throw _;if(_s(_))return{data:null,error:_};throw _}}async upload(t,e,s){return this.uploadOrUpdate("POST",t,e,s)}async uploadToSignedUrl(t,e,s,u){var h=this;const _=h._removeEmptyFolders(t),w=h._getFinalPath(_),o=new URL(h.url+`/object/upload/sign/${w}`);o.searchParams.set("token",e);try{let k;const P=yn({upsert:y3.upsert},u),O=yn(yn({},h.headers),{"x-upsert":String(P.upsert)});return typeof Blob<"u"&&s instanceof Blob?(k=new FormData,k.append("cacheControl",P.cacheControl),k.append("",s)):typeof FormData<"u"&&s instanceof FormData?(k=s,k.append("cacheControl",P.cacheControl)):(k=s,O["cache-control"]=`max-age=${P.cacheControl}`,O["content-type"]=P.contentType),{data:{path:_,fullPath:(await AA(h.fetch,o.toString(),k,{headers:O})).Key},error:null}}catch(k){if(h.shouldThrowOnError)throw k;if(_s(k))return{data:null,error:k};throw k}}async createSignedUploadUrl(t,e){var s=this;try{let u=s._getFinalPath(t);const h=yn({},s.headers);e!=null&&e.upsert&&(h["x-upsert"]="true");const _=await rc(s.fetch,`${s.url}/object/upload/sign/${u}`,{},{headers:h}),w=new URL(s.url+_.url),o=w.searchParams.get("token");if(!o)throw new pS("No token returned by API");return{data:{signedUrl:w.toString(),path:t,token:o},error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(_s(u))return{data:null,error:u};throw u}}async update(t,e,s){return this.uploadOrUpdate("PUT",t,e,s)}async move(t,e,s){var u=this;try{return{data:await rc(u.fetch,`${u.url}/object/move`,{bucketId:u.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:u.headers}),error:null}}catch(h){if(u.shouldThrowOnError)throw h;if(_s(h))return{data:null,error:h};throw h}}async copy(t,e,s){var u=this;try{return{data:{path:(await rc(u.fetch,`${u.url}/object/copy`,{bucketId:u.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:u.headers})).Key},error:null}}catch(h){if(u.shouldThrowOnError)throw h;if(_s(h))return{data:null,error:h};throw h}}async createSignedUrl(t,e,s){var u=this;try{let h=u._getFinalPath(t),_=await rc(u.fetch,`${u.url}/object/sign/${h}`,yn({expiresIn:e},s!=null&&s.transform?{transform:s.transform}:{}),{headers:u.headers});const w=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return _={signedUrl:encodeURI(`${u.url}${_.signedURL}${w}`)},{data:_,error:null}}catch(h){if(u.shouldThrowOnError)throw h;if(_s(h))return{data:null,error:h};throw h}}async createSignedUrls(t,e,s){var u=this;try{const h=await rc(u.fetch,`${u.url}/object/sign/${u.bucketId}`,{expiresIn:e,paths:t},{headers:u.headers}),_=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:h.map(w=>yn(yn({},w),{},{signedUrl:w.signedURL?encodeURI(`${u.url}${w.signedURL}${_}`):null})),error:null}}catch(h){if(u.shouldThrowOnError)throw h;if(_s(h))return{data:null,error:h};throw h}}download(t,e){const s=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",u=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),h=u?`?${u}`:"",_=this._getFinalPath(t),w=()=>x0(this.fetch,`${this.url}/${s}/${_}${h}`,{headers:this.headers,noResolveJson:!0});return new vne(w,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);try{return{data:kA(await x0(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})),error:null}}catch(u){if(e.shouldThrowOnError)throw u;if(_s(u))return{data:null,error:u};throw u}}async exists(t){var e=this;const s=e._getFinalPath(t);try{return await _ne(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(u){if(e.shouldThrowOnError)throw u;if(_s(u)&&u instanceof EA){const h=u.originalError;if([400,404].includes(h==null?void 0:h.status))return{data:!1,error:u}}throw u}}getPublicUrl(t,e){const s=this._getFinalPath(t),u=[],h=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";h!==""&&u.push(h);const _=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",w=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});w!==""&&u.push(w);let o=u.join("&");return o!==""&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${_}/public/${s}${o}`)}}}async remove(t){var e=this;try{return{data:await OI(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}async list(t,e,s){var u=this;try{const h=yn(yn(yn({},xne),e),{},{prefix:t||""});return{data:await rc(u.fetch,`${u.url}/object/list/${u.bucketId}`,h,{headers:u.headers},s),error:null}}catch(h){if(u.shouldThrowOnError)throw h;if(_s(h))return{data:null,error:h};throw h}}async listV2(t,e){var s=this;try{const u=yn({},t);return{data:await rc(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,u,{headers:s.headers},e),error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(_s(u))return{data:null,error:u};throw u}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const sV="2.89.0",oV={"X-Client-Info":`storage-js/${sV}`};var bne=class{constructor(t,e={},s,u){this.shouldThrowOnError=!1;const h=new URL(t);u!=null&&u.useNewHostname&&/supabase\.(co|in|red)$/.test(h.hostname)&&!h.hostname.includes("storage.supabase.")&&(h.hostname=h.hostname.replace("supabase.","storage.supabase.")),this.url=h.href.replace(/\/$/,""),this.headers=yn(yn({},oV),e),this.fetch=LI(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const s=e.listBucketOptionsToQueryString(t);return{data:await x0(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}async getBucket(t){var e=this;try{return{data:await x0(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}async createBucket(t,e={public:!1}){var s=this;try{return{data:await rc(s.fetch,`${s.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}),error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(_s(u))return{data:null,error:u};throw u}}async updateBucket(t,e){var s=this;try{return{data:await AA(s.fetch,`${s.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}),error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(_s(u))return{data:null,error:u};throw u}}async emptyBucket(t){var e=this;try{return{data:await rc(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await OI(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Sne=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=yn(yn({},oV),e),this.fetch=LI(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await rc(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}async listBuckets(t){var e=this;try{const s=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&s.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&s.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&s.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&s.set("sortOrder",t.sortOrder),t!=null&&t.search&&s.set("search",t.search);const u=s.toString(),h=u?`${e.url}/bucket?${u}`:`${e.url}/bucket`;return{data:await x0(e.fetch,h,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await OI(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(_s(s))return{data:null,error:s};throw s}}from(t){var e=this;if(!dne(t))throw new pS("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const s=new ane({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),u=this.shouldThrowOnError;return new Proxy(s,{get(h,_){const w=h[_];return typeof w!="function"?w:async(...o)=>{try{return{data:await w.apply(h,o),error:null}}catch(k){if(u)throw k;return{data:null,error:k}}}}})}};const zI={"X-Client-Info":`storage-js/${sV}`,"Content-Type":"application/json"};var aV=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Ha(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var wE=class extends aV{constructor(t,e,s){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Tne=class extends aV{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const FI=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ene=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},v3=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),kne=async(t,e,s)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(s!=null&&s.noResolveJson)){const u=t.status||500,h=t;if(typeof h.json=="function")h.json().then(_=>{const w=(_==null?void 0:_.statusCode)||(_==null?void 0:_.code)||u+"";e(new wE(v3(_),u,w))}).catch(()=>{const _=u+"";e(new wE(h.statusText||`HTTP ${u} error`,u,_))});else{const _=u+"";e(new wE(h.statusText||`HTTP ${u} error`,u,_))}}else e(new Tne(v3(t),t))},Ane=(t,e,s,u)=>{const h={method:t,headers:(e==null?void 0:e.headers)||{}};return u?(Ene(u)?(h.headers=yn({"Content-Type":"application/json"},e==null?void 0:e.headers),h.body=JSON.stringify(u)):h.body=u,yn(yn({},h),s)):h};async function Cne(t,e,s,u,h,_){return new Promise((w,o)=>{t(s,Ane(e,u,h,_)).then(k=>{if(!k.ok)throw k;if(u!=null&&u.noResolveJson)return k;const P=k.headers.get("content-type");return!P||!P.includes("application/json")?{}:k.json()}).then(k=>w(k)).catch(k=>kne(k,o,u))})}async function Wa(t,e,s,u,h){return Cne(t,"POST",e,u,h,s)}var Ine=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=yn(yn({},zI),e),this.fetch=FI(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async getIndex(t,e){var s=this;try{return{data:await Wa(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers}),error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(Ha(u))return{data:null,error:u};throw u}}async listIndexes(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async deleteIndex(t,e){var s=this;try{return{data:await Wa(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers})||{},error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(Ha(u))return{data:null,error:u};throw u}}},Pne=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=yn(yn({},zI),e),this.fetch=FI(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Wa(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async getVectors(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Wa(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async queryVectors(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Wa(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}},Mne=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=yn(yn({},zI),e),this.fetch=FI(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async getBucket(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async listBuckets(t={}){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await Wa(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Ha(s))return{data:null,error:s};throw s}}},Rne=class extends Mne{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Dne(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,s=this;return e().call(s,t)}async getBucket(t){var e=()=>super.getBucket,s=this;return e().call(s,t)}async listBuckets(t={}){var e=()=>super.listBuckets,s=this;return e().call(s,t)}async deleteBucket(t){var e=()=>super.deleteBucket,s=this;return e().call(s,t)}},Dne=class extends Ine{constructor(t,e,s,u){super(t,e,u),this.vectorBucketName=s}async createIndex(t){var e=()=>super.createIndex,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,s=this;return e().call(s,s.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,s=this;return e().call(s,s.vectorBucketName,t)}index(t){return new Lne(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Lne=class extends Pne{constructor(t,e,s,u,h){super(t,e,h),this.vectorBucketName=s,this.indexName=u}async putVectors(t){var e=()=>super.putVectors,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(t){var e=()=>super.getVectors,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,s=this;return e().call(s,yn(yn({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},One=class extends bne{constructor(t,e={},s,u){super(t,e,s,u)}from(t){return new wne(this.url,this.headers,t,this.fetch)}get vectors(){return new Rne(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Sne(this.url+"/iceberg",this.headers,this.fetch)}};const lV="2.89.0",Zm=30*1e3,CA=3,bE=CA*Zm,zne="http://localhost:9999",Fne="supabase.auth.token",Bne={"X-Client-Info":`gotrue-js/${lV}`},IA="X-Supabase-Api-Version",cV={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Nne=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,jne=10*60*1e3;class w0 extends Error{constructor(e,s,u){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=u}}function Kr(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Vne extends w0{constructor(e,s,u){super(e,s,u),this.name="AuthApiError",this.status=s,this.code=u}}function Une(t){return Kr(t)&&t.name==="AuthApiError"}class yf extends w0{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class Hu extends w0{constructor(e,s,u,h){super(e,u,h),this.name=s,this.status=u}}class Va extends Hu{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function $ne(t){return Kr(t)&&t.name==="AuthSessionMissingError"}class Bm extends Hu{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class pb extends Hu{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class mb extends Hu{constructor(e,s=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Gne(t){return Kr(t)&&t.name==="AuthImplicitGrantRedirectError"}class x3 extends Hu{constructor(e,s=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Hne extends Hu{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class PA extends Hu{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function SE(t){return Kr(t)&&t.name==="AuthRetryableFetchError"}class w3 extends Hu{constructor(e,s,u){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=u}}class MA extends Hu{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const M1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),b3=`
|
||
\r=`.split(""),Wne=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<b3.length;e+=1)t[b3[e].charCodeAt(0)]=-2;for(let e=0;e<M1.length;e+=1)t[M1[e].charCodeAt(0)]=e;return t})();function S3(t,e,s){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const u=e.queue>>e.queuedBits-6&63;s(M1[u]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const u=e.queue>>e.queuedBits-6&63;s(M1[u]),e.queuedBits-=6}}function uV(t,e,s){const u=Wne[t];if(u>-1)for(e.queue=e.queue<<6|u,e.queuedBits+=6;e.queuedBits>=8;)s(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(u===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function T3(t){const e=[],s=w=>{e.push(String.fromCodePoint(w))},u={utf8seq:0,codepoint:0},h={queue:0,queuedBits:0},_=w=>{Zne(w,u,s)};for(let w=0;w<t.length;w+=1)uV(t.charCodeAt(w),h,_);return e.join("")}function qne(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Kne(t,e){for(let s=0;s<t.length;s+=1){let u=t.charCodeAt(s);if(u>55295&&u<=56319){const h=(u-55296)*1024&65535;u=(t.charCodeAt(s+1)-56320&65535|h)+65536,s+=1}qne(u,e)}}function Zne(t,e,s){if(e.utf8seq===0){if(t<=127){s(t);return}for(let u=1;u<6;u+=1)if(!(t>>7-u&1)){e.utf8seq=u;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&s(e.codepoint)}}function Tg(t){const e=[],s={queue:0,queuedBits:0},u=h=>{e.push(h)};for(let h=0;h<t.length;h+=1)uV(t.charCodeAt(h),s,u);return new Uint8Array(e)}function Xne(t){const e=[];return Kne(t,s=>e.push(s)),new Uint8Array(e)}function Tf(t){const e=[],s={queue:0,queuedBits:0},u=h=>{e.push(h)};return t.forEach(h=>S3(h,s,u)),S3(null,s,u),e.join("")}function Yne(t){return Math.round(Date.now()/1e3)+t}function Jne(){return Symbol("auth-callback")}const Co=()=>typeof window<"u"&&typeof document<"u",uf={tested:!1,writable:!1},dV=()=>{if(!Co())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(uf.tested)return uf.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),uf.tested=!0,uf.writable=!0}catch{uf.tested=!0,uf.writable=!1}return uf.writable};function Qne(t){const e={},s=new URL(t);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((h,_)=>{e[_]=h})}catch{}return s.searchParams.forEach((u,h)=>{e[h]=u}),e}const hV=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),eie=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Xm=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},df=async(t,e)=>{const s=await t.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return s}},Ao=async(t,e)=>{await t.removeItem(e)};class mS{constructor(){this.promise=new mS.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}mS.promiseConstructor=Promise;function TE(t){const e=t.split(".");if(e.length!==3)throw new MA("Invalid JWT structure");for(let u=0;u<e.length;u++)if(!Nne.test(e[u]))throw new MA("JWT not in base64url format");return{header:JSON.parse(T3(e[0])),payload:JSON.parse(T3(e[1])),signature:Tg(e[2]),raw:{header:e[0],payload:e[1]}}}async function tie(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function rie(t,e){return new Promise((u,h)=>{(async()=>{for(let _=0;_<1/0;_++)try{const w=await t(_);if(!e(_,null,w)){u(w);return}}catch(w){if(!e(_,w)){h(w);return}}})()})}function nie(t){return("0"+t.toString(16)).substr(-2)}function iie(){const e=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",u=s.length;let h="";for(let _=0;_<56;_++)h+=s.charAt(Math.floor(Math.random()*u));return h}return crypto.getRandomValues(e),Array.from(e,nie).join("")}async function sie(t){const s=new TextEncoder().encode(t),u=await crypto.subtle.digest("SHA-256",s),h=new Uint8Array(u);return Array.from(h).map(_=>String.fromCharCode(_)).join("")}async function oie(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const s=await sie(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Nm(t,e,s=!1){const u=iie();let h=u;s&&(h+="/PASSWORD_RECOVERY"),await Xm(t,`${e}-code-verifier`,h);const _=await oie(u);return[_,u===_?"plain":"s256"]}const aie=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function lie(t){const e=t.headers.get(IA);if(!e||!e.match(aie))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function cie(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function uie(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const die=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function jm(t){if(!die.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function EE(){const t={};return new Proxy(t,{get:(e,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const u=s.toString();if(u==="Symbol(Symbol.toPrimitive)"||u==="Symbol(Symbol.toStringTag)"||u==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function hie(t,e){return new Proxy(t,{get:(s,u,h)=>{if(u==="__isInsecureUserWarningProxy")return!0;if(typeof u=="symbol"){const _=u.toString();if(_==="Symbol(Symbol.toPrimitive)"||_==="Symbol(Symbol.toStringTag)"||_==="Symbol(util.inspect.custom)"||_==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,u,h)}return!e.value&&typeof u=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(s,u,h)}})}function E3(t){return JSON.parse(JSON.stringify(t))}const mf=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),fie=[502,503,504];async function k3(t){var e;if(!eie(t))throw new PA(mf(t),0);if(fie.includes(t.status))throw new PA(mf(t),t.status);let s;try{s=await t.json()}catch(_){throw new yf(mf(_),_)}let u;const h=lie(t);if(h&&h.getTime()>=cV["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?u=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(u=s.error_code),u){if(u==="weak_password")throw new w3(mf(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(u==="session_not_found")throw new Va}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((_,w)=>_&&typeof w=="string",!0))throw new w3(mf(s),t.status,s.weak_password.reasons);throw new Vne(mf(s),t.status||500,u)}const pie=(t,e,s,u)=>{const h={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?h:(h.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),h.body=JSON.stringify(u),Object.assign(Object.assign({},h),s))};async function _n(t,e,s,u){var h;const _=Object.assign({},u==null?void 0:u.headers);_[IA]||(_[IA]=cV["2024-01-01"].name),u!=null&&u.jwt&&(_.Authorization=`Bearer ${u.jwt}`);const w=(h=u==null?void 0:u.query)!==null&&h!==void 0?h:{};u!=null&&u.redirectTo&&(w.redirect_to=u.redirectTo);const o=Object.keys(w).length?"?"+new URLSearchParams(w).toString():"",k=await mie(t,e,s+o,{headers:_,noResolveJson:u==null?void 0:u.noResolveJson},{},u==null?void 0:u.body);return u!=null&&u.xform?u==null?void 0:u.xform(k):{data:Object.assign({},k),error:null}}async function mie(t,e,s,u,h,_){const w=pie(e,u,h,_);let o;try{o=await t(s,Object.assign({},w))}catch(k){throw console.error(k),new PA(mf(k),0)}if(o.ok||await k3(o),u!=null&&u.noResolveJson)return o;try{return await o.json()}catch(k){await k3(k)}}function Jl(t){var e;let s=null;yie(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=Yne(t.expires_in)));const u=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:u},error:null}}function A3(t){const e=Jl(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((s,u)=>s&&typeof u=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Bd(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function gie(t){return{data:t,error:null}}function _ie(t){const{action_link:e,email_otp:s,hashed_token:u,redirect_to:h,verification_type:_}=t,w=o_(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:s,hashed_token:u,redirect_to:h,verification_type:_},k=Object.assign({},w);return{data:{properties:o,user:k},error:null}}function C3(t){return t}function yie(t){return t.access_token&&t.refresh_token&&t.expires_in}const kE=["global","local","others"];class vie{constructor({url:e="",headers:s={},fetch:u}){this.url=e,this.headers=s,this.fetch=hV(u),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,s=kE[0]){if(kE.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${kE.join(", ")}`);try{return await _n(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(u){if(Kr(u))return{data:null,error:u};throw u}}async inviteUserByEmail(e,s={}){try{return await _n(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:Bd})}catch(u){if(Kr(u))return{data:{user:null},error:u};throw u}}async generateLink(e){try{const{options:s}=e,u=o_(e,["options"]),h=Object.assign(Object.assign({},u),s);return"newEmail"in u&&(h.new_email=u==null?void 0:u.newEmail,delete h.newEmail),await _n(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:h,headers:this.headers,xform:_ie,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(Kr(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await _n(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Bd})}catch(s){if(Kr(s))return{data:{user:null},error:s};throw s}}async listUsers(e){var s,u,h,_,w,o,k;try{const P={nextPage:null,lastPage:0,total:0},O=await _n(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(u=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&u!==void 0?u:"",per_page:(_=(h=e==null?void 0:e.perPage)===null||h===void 0?void 0:h.toString())!==null&&_!==void 0?_:""},xform:C3});if(O.error)throw O.error;const F=await O.json(),V=(w=O.headers.get("x-total-count"))!==null&&w!==void 0?w:0,$=(k=(o=O.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&k!==void 0?k:[];return $.length>0&&($.forEach(Y=>{const Z=parseInt(Y.split(";")[0].split("=")[1].substring(0,1)),se=JSON.parse(Y.split(";")[1].split("=")[1]);P[`${se}Page`]=Z}),P.total=parseInt(V)),{data:Object.assign(Object.assign({},F),P),error:null}}catch(P){if(Kr(P))return{data:{users:[]},error:P};throw P}}async getUserById(e){jm(e);try{return await _n(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Bd})}catch(s){if(Kr(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){jm(e);try{return await _n(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:Bd})}catch(u){if(Kr(u))return{data:{user:null},error:u};throw u}}async deleteUser(e,s=!1){jm(e);try{return await _n(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:Bd})}catch(u){if(Kr(u))return{data:{user:null},error:u};throw u}}async _listFactors(e){jm(e.userId);try{const{data:s,error:u}=await _n(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:h=>({data:{factors:h},error:null})});return{data:s,error:u}}catch(s){if(Kr(s))return{data:null,error:s};throw s}}async _deleteFactor(e){jm(e.userId),jm(e.id);try{return{data:await _n(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(Kr(s))return{data:null,error:s};throw s}}async _listOAuthClients(e){var s,u,h,_,w,o,k;try{const P={nextPage:null,lastPage:0,total:0},O=await _n(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(u=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&u!==void 0?u:"",per_page:(_=(h=e==null?void 0:e.perPage)===null||h===void 0?void 0:h.toString())!==null&&_!==void 0?_:""},xform:C3});if(O.error)throw O.error;const F=await O.json(),V=(w=O.headers.get("x-total-count"))!==null&&w!==void 0?w:0,$=(k=(o=O.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&k!==void 0?k:[];return $.length>0&&($.forEach(Y=>{const Z=parseInt(Y.split(";")[0].split("=")[1].substring(0,1)),se=JSON.parse(Y.split(";")[1].split("=")[1]);P[`${se}Page`]=Z}),P.total=parseInt(V)),{data:Object.assign(Object.assign({},F),P),error:null}}catch(P){if(Kr(P))return{data:{clients:[]},error:P};throw P}}async _createOAuthClient(e){try{return await _n(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Kr(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await _n(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Kr(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await _n(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:u=>({data:u,error:null})})}catch(u){if(Kr(u))return{data:null,error:u};throw u}}async _deleteOAuthClient(e){try{return await _n(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Kr(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await _n(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Kr(s))return{data:null,error:s};throw s}}}function I3(t={}){return{getItem:e=>t[e]||null,setItem:(e,s)=>{t[e]=s},removeItem:e=>{delete t[e]}}}const Vm={debug:!!(globalThis&&dV()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class fV extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class xie extends fV{}async function wie(t,e,s){Vm.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const u=new globalThis.AbortController;return e>0&&setTimeout(()=>{u.abort(),Vm.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:u.signal},async h=>{if(h){Vm.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,h.name);try{return await s()}finally{Vm.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,h.name)}}else{if(e===0)throw Vm.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new xie(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Vm.debug)try{const _=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(_,null," "))}catch(_){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",_)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await s()}}))}function bie(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function pV(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Sie(t){return parseInt(t,16)}function Tie(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,u=>u.toString(16).padStart(2,"0")).join("")}function Eie(t){var e;const{chainId:s,domain:u,expirationTime:h,issuedAt:_=new Date,nonce:w,notBefore:o,requestId:k,resources:P,scheme:O,uri:F,version:V}=t;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!u)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(w&&w.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${w}`);if(!F)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(V!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${V}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
||
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const $=pV(t.address),Y=O?`${O}://${u}`:u,Z=t.statement?`${t.statement}
|
||
`:"",se=`${Y} wants you to sign in with your Ethereum account:
|
||
${$}
|
||
|
||
${Z}`;let te=`URI: ${F}
|
||
Version: ${V}
|
||
Chain ID: ${s}${w?`
|
||
Nonce: ${w}`:""}
|
||
Issued At: ${_.toISOString()}`;if(h&&(te+=`
|
||
Expiration Time: ${h.toISOString()}`),o&&(te+=`
|
||
Not Before: ${o.toISOString()}`),k&&(te+=`
|
||
Request ID: ${k}`),P){let ee=`
|
||
Resources:`;for(const oe of P){if(!oe||typeof oe!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${oe}`);ee+=`
|
||
- ${oe}`}te+=ee}return`${se}
|
||
${te}`}class Hs extends Error{constructor({message:e,code:s,cause:u,name:h}){var _;super(e,{cause:u}),this.__isWebAuthnError=!0,this.name=(_=h??(u instanceof Error?u.name:void 0))!==null&&_!==void 0?_:"Unknown Error",this.code=s}}class R1 extends Hs{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function kie({error:t,options:e}){var s,u,h;const{publicKey:_}=e;if(!_)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Hs({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=_.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new Hs({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((u=_.authenticatorSelection)===null||u===void 0?void 0:u.userVerification)==="required")return new Hs({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((h=_.authenticatorSelection)===null||h===void 0?void 0:h.userVerification)==="required")return new Hs({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Hs({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Hs({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return _.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new Hs({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Hs({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const w=window.location.hostname;if(mV(w)){if(_.rp.id!==w)return new Hs({message:`The RP ID "${_.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Hs({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(_.user.id.byteLength<1||_.user.id.byteLength>64)return new Hs({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Hs({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Hs({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Aie({error:t,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Hs({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Hs({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const u=window.location.hostname;if(mV(u)){if(s.rpId!==u)return new Hs({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Hs({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Hs({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Hs({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Cie{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Iie=new Cie;function Pie(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:s,excludeCredentials:u}=t,h=o_(t,["challenge","user","excludeCredentials"]),_=Tg(e).buffer,w=Object.assign(Object.assign({},s),{id:Tg(s.id).buffer}),o=Object.assign(Object.assign({},h),{challenge:_,user:w});if(u&&u.length>0){o.excludeCredentials=new Array(u.length);for(let k=0;k<u.length;k++){const P=u[k];o.excludeCredentials[k]=Object.assign(Object.assign({},P),{id:Tg(P.id).buffer,type:P.type||"public-key",transports:P.transports})}}return o}function Mie(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:s}=t,u=o_(t,["challenge","allowCredentials"]),h=Tg(e).buffer,_=Object.assign(Object.assign({},u),{challenge:h});if(s&&s.length>0){_.allowCredentials=new Array(s.length);for(let w=0;w<s.length;w++){const o=s[w];_.allowCredentials[w]=Object.assign(Object.assign({},o),{id:Tg(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return _}function Rie(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t;return{id:t.id,rawId:t.id,response:{attestationObject:Tf(new Uint8Array(t.response.attestationObject)),clientDataJSON:Tf(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Die(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t,u=t.getClientExtensionResults(),h=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Tf(new Uint8Array(h.authenticatorData)),clientDataJSON:Tf(new Uint8Array(h.clientDataJSON)),signature:Tf(new Uint8Array(h.signature)),userHandle:h.userHandle?Tf(new Uint8Array(h.userHandle)):void 0},type:"public-key",clientExtensionResults:u,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function mV(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function P3(){var t,e;return!!(Co()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Lie(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new R1("Browser returned unexpected credential type",e)}:{data:null,error:new R1("Empty credential response",e)}}catch(e){return{data:null,error:kie({error:e,options:t})}}}async function Oie(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new R1("Browser returned unexpected credential type",e)}:{data:null,error:new R1("Empty credential response",e)}}catch(e){return{data:null,error:Aie({error:e,options:t})}}}const zie={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Fie={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function D1(...t){const e=h=>h!==null&&typeof h=="object"&&!Array.isArray(h),s=h=>h instanceof ArrayBuffer||ArrayBuffer.isView(h),u={};for(const h of t)if(h)for(const _ in h){const w=h[_];if(w!==void 0)if(Array.isArray(w))u[_]=w;else if(s(w))u[_]=w;else if(e(w)){const o=u[_];e(o)?u[_]=D1(o,w):u[_]=D1(w)}else u[_]=w}return u}function Bie(t,e){return D1(zie,t,e||{})}function Nie(t,e){return D1(Fie,t,e||{})}class jie{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:s,friendlyName:u,signal:h},_){try{const{data:w,error:o}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!w)return{data:null,error:o};const k=h??Iie.createNewAbortSignal();if(w.webauthn.type==="create"){const{user:P}=w.webauthn.credential_options.publicKey;P.name||(P.name=`${P.id}:${u}`),P.displayName||(P.displayName=P.name)}switch(w.webauthn.type){case"create":{const P=Bie(w.webauthn.credential_options.publicKey,_==null?void 0:_.create),{data:O,error:F}=await Lie({publicKey:P,signal:k});return O?{data:{factorId:e,challengeId:w.id,webauthn:{type:w.webauthn.type,credential_response:O}},error:null}:{data:null,error:F}}case"request":{const P=Nie(w.webauthn.credential_options.publicKey,_==null?void 0:_.request),{data:O,error:F}=await Oie(Object.assign(Object.assign({},w.webauthn.credential_options),{publicKey:P,signal:k}));return O?{data:{factorId:e,challengeId:w.id,webauthn:{type:w.webauthn.type,credential_response:O}},error:null}:{data:null,error:F}}}}catch(w){return Kr(w)?{data:null,error:w}:{data:null,error:new yf("Unexpected error in challenge",w)}}}async _verify({challengeId:e,factorId:s,webauthn:u}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:u})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:u=typeof window<"u"?[window.location.origin]:void 0,signal:h}={}},_){if(!s)return{data:null,error:new w0("rpId is required for WebAuthn authentication")};try{if(!P3())return{data:null,error:new yf("Browser does not support WebAuthn",null)};const{data:w,error:o}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:u},signal:h},{request:_});if(!w)return{data:null,error:o};const{webauthn:k}=w;return this._verify({factorId:e,challengeId:w.challengeId,webauthn:{type:k.type,rpId:s,rpOrigins:u,credential_response:k.credential_response}})}catch(w){return Kr(w)?{data:null,error:w}:{data:null,error:new yf("Unexpected error in authenticate",w)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:u=typeof window<"u"?[window.location.origin]:void 0,signal:h}={}},_){if(!s)return{data:null,error:new w0("rpId is required for WebAuthn registration")};try{if(!P3())return{data:null,error:new yf("Browser does not support WebAuthn",null)};const{data:w,error:o}=await this._enroll({friendlyName:e});if(!w)return await this.client.mfa.listFactors().then(O=>{var F;return(F=O.data)===null||F===void 0?void 0:F.all.find(V=>V.factor_type==="webauthn"&&V.friendly_name===e&&V.status!=="unverified")}).then(O=>O?this.client.mfa.unenroll({factorId:O==null?void 0:O.id}):void 0),{data:null,error:o};const{data:k,error:P}=await this._challenge({factorId:w.id,friendlyName:w.friendly_name,webauthn:{rpId:s,rpOrigins:u},signal:h},{create:_});return k?this._verify({factorId:w.id,challengeId:k.challengeId,webauthn:{rpId:s,rpOrigins:u,type:k.webauthn.type,credential_response:k.webauthn.credential_response}}):{data:null,error:P}}catch(w){return Kr(w)?{data:null,error:w}:{data:null,error:new yf("Unexpected error in register",w)}}}}bie();const Vie={url:zne,storageKey:Fne,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Bne,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function M3(t,e,s){return await s()}const Um={};class b0{get jwks(){var e,s;return(s=(e=Um[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){Um[this.storageKey]=Object.assign(Object.assign({},Um[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=Um[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Um[this.storageKey]=Object.assign(Object.assign({},Um[this.storageKey]),{cachedAt:e})}constructor(e){var s,u,h;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const _=Object.assign(Object.assign({},Vie),e);if(this.storageKey=_.storageKey,this.instanceID=(s=b0.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,b0.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!_.debug,typeof _.debug=="function"&&(this.logger=_.debug),this.instanceID>0&&Co()){const w=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(w),this.logDebugMessages&&console.trace(w)}if(this.persistSession=_.persistSession,this.autoRefreshToken=_.autoRefreshToken,this.admin=new vie({url:_.url,headers:_.headers,fetch:_.fetch}),this.url=_.url,this.headers=_.headers,this.fetch=hV(_.fetch),this.lock=_.lock||M3,this.detectSessionInUrl=_.detectSessionInUrl,this.flowType=_.flowType,this.hasCustomAuthorizationHeader=_.hasCustomAuthorizationHeader,this.throwOnError=_.throwOnError,_.lock?this.lock=_.lock:this.persistSession&&Co()&&(!((u=globalThis==null?void 0:globalThis.navigator)===null||u===void 0)&&u.locks)?this.lock=wie:this.lock=M3,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new jie(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(_.storage?this.storage=_.storage:dV()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=I3(this.memoryStorage)),_.userStorage&&(this.userStorage=_.userStorage)):(this.memoryStorage={},this.storage=I3(this.memoryStorage)),Co()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(w){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",w)}(h=this.broadcastChannel)===null||h===void 0||h.addEventListener("message",async w=>{this._debug("received broadcast notification from other tab or client",w),await this._notifyAllSubscribers(w.data.event,w.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${lV}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let s={},u="none";if(Co()&&(s=Qne(window.location.href),this._isImplicitGrantCallback(s)?u="implicit":await this._isPKCECallback(s)&&(u="pkce")),Co()&&this.detectSessionInUrl&&u!=="none"){const{data:h,error:_}=await this._getSessionFromURL(s,u);if(_){if(this._debug("#_initialize()","error detecting session from URL",_),Gne(_)){const k=(e=_.details)===null||e===void 0?void 0:e.code;if(k==="identity_already_exists"||k==="identity_not_found"||k==="single_identity_not_deletable")return{error:_}}return await this._removeSession(),{error:_}}const{session:w,redirectType:o}=h;return this._debug("#_initialize()","detected session in URL",w,"redirect type",o),await this._saveSession(w),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",w):await this._notifyAllSubscribers("SIGNED_IN",w)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return Kr(s)?this._returnResult({error:s}):this._returnResult({error:new yf("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,u,h;try{const _=await _n(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(u=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.data)!==null&&u!==void 0?u:{},gotrue_meta_security:{captcha_token:(h=e==null?void 0:e.options)===null||h===void 0?void 0:h.captchaToken}},xform:Jl}),{data:w,error:o}=_;if(o||!w)return this._returnResult({data:{user:null,session:null},error:o});const k=w.session,P=w.user;return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",k)),this._returnResult({data:{user:P,session:k},error:null})}catch(_){if(Kr(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async signUp(e){var s,u,h;try{let _;if("email"in e){const{email:O,password:F,options:V}=e;let $=null,Y=null;this.flowType==="pkce"&&([$,Y]=await Nm(this.storage,this.storageKey)),_=await _n(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:V==null?void 0:V.emailRedirectTo,body:{email:O,password:F,data:(s=V==null?void 0:V.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:V==null?void 0:V.captchaToken},code_challenge:$,code_challenge_method:Y},xform:Jl})}else if("phone"in e){const{phone:O,password:F,options:V}=e;_=await _n(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:O,password:F,data:(u=V==null?void 0:V.data)!==null&&u!==void 0?u:{},channel:(h=V==null?void 0:V.channel)!==null&&h!==void 0?h:"sms",gotrue_meta_security:{captcha_token:V==null?void 0:V.captchaToken}},xform:Jl})}else throw new pb("You must provide either an email or phone number and a password");const{data:w,error:o}=_;if(o||!w)return await Ao(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const k=w.session,P=w.user;return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",k)),this._returnResult({data:{user:P,session:k},error:null})}catch(_){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async signInWithPassword(e){try{let s;if("email"in e){const{email:_,password:w,options:o}=e;s=await _n(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:_,password:w,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:A3})}else if("phone"in e){const{phone:_,password:w,options:o}=e;s=await _n(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:_,password:w,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:A3})}else throw new pb("You must provide either an email or phone number and a password");const{data:u,error:h}=s;if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!u||!u.session||!u.user){const _=new Bm;return this._returnResult({data:{user:null,session:null},error:_})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:Object.assign({user:u.user,session:u.session},u.weak_password?{weakPassword:u.weak_password}:null),error:h})}catch(s){if(Kr(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,u,h,_;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(u=e.options)===null||u===void 0?void 0:u.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:(_=e.options)===null||_===void 0?void 0:_.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,u,h,_,w,o,k,P,O,F,V;let $,Y;if("message"in e)$=e.message,Y=e.signature;else{const{chain:Z,wallet:se,statement:te,options:ee}=e;let oe;if(Co())if(typeof se=="object")oe=se;else{const ft=window;if("ethereum"in ft&&typeof ft.ethereum=="object"&&"request"in ft.ethereum&&typeof ft.ethereum.request=="function")oe=ft.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof se!="object"||!(ee!=null&&ee.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");oe=se}const he=new URL((s=ee==null?void 0:ee.url)!==null&&s!==void 0?s:window.location.href),Ie=await oe.request({method:"eth_requestAccounts"}).then(ft=>ft).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!Ie||Ie.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Be=pV(Ie[0]);let je=(u=ee==null?void 0:ee.signInWithEthereum)===null||u===void 0?void 0:u.chainId;if(!je){const ft=await oe.request({method:"eth_chainId"});je=Sie(ft)}const Je={domain:he.host,address:Be,statement:te,uri:he.href,version:"1",chainId:je,nonce:(h=ee==null?void 0:ee.signInWithEthereum)===null||h===void 0?void 0:h.nonce,issuedAt:(w=(_=ee==null?void 0:ee.signInWithEthereum)===null||_===void 0?void 0:_.issuedAt)!==null&&w!==void 0?w:new Date,expirationTime:(o=ee==null?void 0:ee.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(k=ee==null?void 0:ee.signInWithEthereum)===null||k===void 0?void 0:k.notBefore,requestId:(P=ee==null?void 0:ee.signInWithEthereum)===null||P===void 0?void 0:P.requestId,resources:(O=ee==null?void 0:ee.signInWithEthereum)===null||O===void 0?void 0:O.resources};$=Eie(Je),Y=await oe.request({method:"personal_sign",params:[Tie($),Be]})}try{const{data:Z,error:se}=await _n(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:$,signature:Y},!((F=e.options)===null||F===void 0)&&F.captchaToken?{gotrue_meta_security:{captcha_token:(V=e.options)===null||V===void 0?void 0:V.captchaToken}}:null),xform:Jl});if(se)throw se;if(!Z||!Z.session||!Z.user){const te=new Bm;return this._returnResult({data:{user:null,session:null},error:te})}return Z.session&&(await this._saveSession(Z.session),await this._notifyAllSubscribers("SIGNED_IN",Z.session)),this._returnResult({data:Object.assign({},Z),error:se})}catch(Z){if(Kr(Z))return this._returnResult({data:{user:null,session:null},error:Z});throw Z}}async signInWithSolana(e){var s,u,h,_,w,o,k,P,O,F,V,$;let Y,Z;if("message"in e)Y=e.message,Z=e.signature;else{const{chain:se,wallet:te,statement:ee,options:oe}=e;let he;if(Co())if(typeof te=="object")he=te;else{const Be=window;if("solana"in Be&&typeof Be.solana=="object"&&("signIn"in Be.solana&&typeof Be.solana.signIn=="function"||"signMessage"in Be.solana&&typeof Be.solana.signMessage=="function"))he=Be.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof te!="object"||!(oe!=null&&oe.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");he=te}const Ie=new URL((s=oe==null?void 0:oe.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in he&&he.signIn){const Be=await he.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},oe==null?void 0:oe.signInWithSolana),{version:"1",domain:Ie.host,uri:Ie.href}),ee?{statement:ee}:null));let je;if(Array.isArray(Be)&&Be[0]&&typeof Be[0]=="object")je=Be[0];else if(Be&&typeof Be=="object"&&"signedMessage"in Be&&"signature"in Be)je=Be;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in je&&"signature"in je&&(typeof je.signedMessage=="string"||je.signedMessage instanceof Uint8Array)&&je.signature instanceof Uint8Array)Y=typeof je.signedMessage=="string"?je.signedMessage:new TextDecoder().decode(je.signedMessage),Z=je.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in he)||typeof he.signMessage!="function"||!("publicKey"in he)||typeof he!="object"||!he.publicKey||!("toBase58"in he.publicKey)||typeof he.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");Y=[`${Ie.host} wants you to sign in with your Solana account:`,he.publicKey.toBase58(),...ee?["",ee,""]:[""],"Version: 1",`URI: ${Ie.href}`,`Issued At: ${(h=(u=oe==null?void 0:oe.signInWithSolana)===null||u===void 0?void 0:u.issuedAt)!==null&&h!==void 0?h:new Date().toISOString()}`,...!((_=oe==null?void 0:oe.signInWithSolana)===null||_===void 0)&&_.notBefore?[`Not Before: ${oe.signInWithSolana.notBefore}`]:[],...!((w=oe==null?void 0:oe.signInWithSolana)===null||w===void 0)&&w.expirationTime?[`Expiration Time: ${oe.signInWithSolana.expirationTime}`]:[],...!((o=oe==null?void 0:oe.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${oe.signInWithSolana.chainId}`]:[],...!((k=oe==null?void 0:oe.signInWithSolana)===null||k===void 0)&&k.nonce?[`Nonce: ${oe.signInWithSolana.nonce}`]:[],...!((P=oe==null?void 0:oe.signInWithSolana)===null||P===void 0)&&P.requestId?[`Request ID: ${oe.signInWithSolana.requestId}`]:[],...!((F=(O=oe==null?void 0:oe.signInWithSolana)===null||O===void 0?void 0:O.resources)===null||F===void 0)&&F.length?["Resources",...oe.signInWithSolana.resources.map(je=>`- ${je}`)]:[]].join(`
|
||
`);const Be=await he.signMessage(new TextEncoder().encode(Y),"utf8");if(!Be||!(Be instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");Z=Be}}try{const{data:se,error:te}=await _n(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:Y,signature:Tf(Z)},!((V=e.options)===null||V===void 0)&&V.captchaToken?{gotrue_meta_security:{captcha_token:($=e.options)===null||$===void 0?void 0:$.captchaToken}}:null),xform:Jl});if(te)throw te;if(!se||!se.session||!se.user){const ee=new Bm;return this._returnResult({data:{user:null,session:null},error:ee})}return se.session&&(await this._saveSession(se.session),await this._notifyAllSubscribers("SIGNED_IN",se.session)),this._returnResult({data:Object.assign({},se),error:te})}catch(se){if(Kr(se))return this._returnResult({data:{user:null,session:null},error:se});throw se}}async _exchangeCodeForSession(e){const s=await df(this.storage,`${this.storageKey}-code-verifier`),[u,h]=(s??"").split("/");try{if(!u&&this.flowType==="pkce")throw new Hne;const{data:_,error:w}=await _n(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:u},xform:Jl});if(await Ao(this.storage,`${this.storageKey}-code-verifier`),w)throw w;if(!_||!_.session||!_.user){const o=new Bm;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign(Object.assign({},_),{redirectType:h??null}),error:w})}catch(_){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(_))return this._returnResult({data:{user:null,session:null,redirectType:null},error:_});throw _}}async signInWithIdToken(e){try{const{options:s,provider:u,token:h,access_token:_,nonce:w}=e,o=await _n(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:u,id_token:h,access_token:_,nonce:w,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:Jl}),{data:k,error:P}=o;if(P)return this._returnResult({data:{user:null,session:null},error:P});if(!k||!k.session||!k.user){const O=new Bm;return this._returnResult({data:{user:null,session:null},error:O})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:k,error:P})}catch(s){if(Kr(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,u,h,_,w;try{if("email"in e){const{email:o,options:k}=e;let P=null,O=null;this.flowType==="pkce"&&([P,O]=await Nm(this.storage,this.storageKey));const{error:F}=await _n(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(s=k==null?void 0:k.data)!==null&&s!==void 0?s:{},create_user:(u=k==null?void 0:k.shouldCreateUser)!==null&&u!==void 0?u:!0,gotrue_meta_security:{captcha_token:k==null?void 0:k.captchaToken},code_challenge:P,code_challenge_method:O},redirectTo:k==null?void 0:k.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:F})}if("phone"in e){const{phone:o,options:k}=e,{data:P,error:O}=await _n(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(h=k==null?void 0:k.data)!==null&&h!==void 0?h:{},create_user:(_=k==null?void 0:k.shouldCreateUser)!==null&&_!==void 0?_:!0,gotrue_meta_security:{captcha_token:k==null?void 0:k.captchaToken},channel:(w=k==null?void 0:k.channel)!==null&&w!==void 0?w:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:P==null?void 0:P.message_id},error:O})}throw new pb("You must provide either an email or phone number.")}catch(o){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var s,u;try{let h,_;"options"in e&&(h=(s=e.options)===null||s===void 0?void 0:s.redirectTo,_=(u=e.options)===null||u===void 0?void 0:u.captchaToken);const{data:w,error:o}=await _n(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:_}}),redirectTo:h,xform:Jl});if(o)throw o;if(!w)throw new Error("An error occurred on token verification.");const k=w.session,P=w.user;return k!=null&&k.access_token&&(await this._saveSession(k),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",k)),this._returnResult({data:{user:P,session:k},error:null})}catch(h){if(Kr(h))return this._returnResult({data:{user:null,session:null},error:h});throw h}}async signInWithSSO(e){var s,u,h,_,w;try{let o=null,k=null;this.flowType==="pkce"&&([o,k]=await Nm(this.storage,this.storageKey));const P=await _n(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(u=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&u!==void 0?u:void 0}),!((h=e==null?void 0:e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:k}),headers:this.headers,xform:gie});return!((_=P.data)===null||_===void 0)&&_.url&&Co()&&!(!((w=e.options)===null||w===void 0)&&w.skipBrowserRedirect)&&window.location.assign(P.data.url),this._returnResult(P)}catch(o){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:u}=e;if(u)throw u;if(!s)throw new Va;const{error:h}=await _n(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:h})})}catch(e){if(Kr(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:u,type:h,options:_}=e,{error:w}=await _n(this.fetch,"POST",s,{headers:this.headers,body:{email:u,type:h,gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken}},redirectTo:_==null?void 0:_.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:w})}else if("phone"in e){const{phone:u,type:h,options:_}=e,{data:w,error:o}=await _n(this.fetch,"POST",s,{headers:this.headers,body:{phone:u,type:h,gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:w==null?void 0:w.message_id},error:o})}throw new pb("You must provide either an email or phone number and a type")}catch(s){if(Kr(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const u=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),h=(async()=>(await u,await s()))();return this.pendingInLock.push((async()=>{try{await h}catch{}})()),h}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const u=s();for(this.pendingInLock.push((async()=>{try{await u}catch{}})()),await u;this.pendingInLock.length;){const h=[...this.pendingInLock];await Promise.all(h),this.pendingInLock.splice(0,h.length)}return await u}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await e(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const s=await df(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const u=e.expires_at?e.expires_at*1e3-Date.now()<bE:!1;if(this._debug("#__loadSession()",`session has${u?"":" not"} expired`,"expires_at",e.expires_at),!u){if(this.userStorage){const w=await df(this.userStorage,this.storageKey+"-user");w!=null&&w.user?e.user=w.user:e.user=EE()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const w={value:this.suppressGetSessionWarning};e.user=hie(e.user,w),w.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:h,error:_}=await this._callRefreshToken(e.refresh_token);return _?this._returnResult({data:{session:null},error:_}):this._returnResult({data:{session:h},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(-1,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await _n(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Bd}):await this._useSession(async s=>{var u,h,_;const{data:w,error:o}=s;if(o)throw o;return!(!((u=w.session)===null||u===void 0)&&u.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Va}:await _n(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(_=(h=w.session)===null||h===void 0?void 0:h.access_token)!==null&&_!==void 0?_:void 0,xform:Bd})})}catch(s){if(Kr(s))return $ne(s)&&(await this._removeSession(),await Ao(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async u=>{const{data:h,error:_}=u;if(_)throw _;if(!h.session)throw new Va;const w=h.session;let o=null,k=null;this.flowType==="pkce"&&e.email!=null&&([o,k]=await Nm(this.storage,this.storageKey));const{data:P,error:O}=await _n(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:k}),jwt:w.access_token,xform:Bd});if(O)throw O;return w.user=P.user,await this._saveSession(w),await this._notifyAllSubscribers("USER_UPDATED",w),this._returnResult({data:{user:w.user},error:null})})}catch(u){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(u))return this._returnResult({data:{user:null},error:u});throw u}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Va;const s=Date.now()/1e3;let u=s,h=!0,_=null;const{payload:w}=TE(e.access_token);if(w.exp&&(u=w.exp,h=u<=s),h){const{data:o,error:k}=await this._callRefreshToken(e.refresh_token);if(k)return this._returnResult({data:{user:null,session:null},error:k});if(!o)return{data:{user:null,session:null},error:null};_=o}else{const{data:o,error:k}=await this._getUser(e.access_token);if(k)throw k;_={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:u-s,expires_at:u},await this._saveSession(_),await this._notifyAllSubscribers("SIGNED_IN",_)}return this._returnResult({data:{user:_.user,session:_},error:null})}catch(s){if(Kr(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async s=>{var u;if(!e){const{data:w,error:o}=s;if(o)throw o;e=(u=w.session)!==null&&u!==void 0?u:void 0}if(!(e!=null&&e.refresh_token))throw new Va;const{data:h,error:_}=await this._callRefreshToken(e.refresh_token);return _?this._returnResult({data:{user:null,session:null},error:_}):h?this._returnResult({data:{user:h.user,session:h},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(Kr(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){try{if(!Co())throw new mb("No browser detected.");if(e.error||e.error_description||e.error_code)throw new mb(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new x3("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new mb("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new x3("No code detected.");const{data:ee,error:oe}=await this._exchangeCodeForSession(e.code);if(oe)throw oe;const he=new URL(window.location.href);return he.searchParams.delete("code"),window.history.replaceState(window.history.state,"",he.toString()),{data:{session:ee.session,redirectType:null},error:null}}const{provider_token:u,provider_refresh_token:h,access_token:_,refresh_token:w,expires_in:o,expires_at:k,token_type:P}=e;if(!_||!o||!w||!P)throw new mb("No session defined in URL");const O=Math.round(Date.now()/1e3),F=parseInt(o);let V=O+F;k&&(V=parseInt(k));const $=V-O;$*1e3<=Zm&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${$}s, should have been closer to ${F}s`);const Y=V-F;O-Y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",Y,V,O):O-Y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",Y,V,O);const{data:Z,error:se}=await this._getUser(_);if(se)throw se;const te={provider_token:u,provider_refresh_token:h,access_token:_,expires_in:F,expires_at:V,refresh_token:w,token_type:P,user:Z.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:te,redirectType:e.type},error:null})}catch(u){if(Kr(u))return this._returnResult({data:{session:null,redirectType:null},error:u});throw u}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const s=await df(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var u;const{data:h,error:_}=s;if(_)return this._returnResult({error:_});const w=(u=h.session)===null||u===void 0?void 0:u.access_token;if(w){const{error:o}=await this.admin.signOut(w,e);if(o&&!(Une(o)&&(o.status===404||o.status===401||o.status===403)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await Ao(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=Jne(),u={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,u),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:u}}}async _emitInitialSession(e){return await this._useSession(async s=>{var u,h;try{const{data:{session:_},error:w}=s;if(w)throw w;await((u=this.stateChangeEmitters.get(e))===null||u===void 0?void 0:u.callback("INITIAL_SESSION",_)),this._debug("INITIAL_SESSION","callback id",e,"session",_)}catch(_){await((h=this.stateChangeEmitters.get(e))===null||h===void 0?void 0:h.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",_),console.error(_)}})}async resetPasswordForEmail(e,s={}){let u=null,h=null;this.flowType==="pkce"&&([u,h]=await Nm(this.storage,this.storageKey,!0));try{return await _n(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:u,code_challenge_method:h,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(_){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(_))return this._returnResult({data:null,error:_});throw _}}async getUserIdentities(){var e;try{const{data:s,error:u}=await this.getUser();if(u)throw u;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:u,error:h}=await this._useSession(async _=>{var w,o,k,P,O;const{data:F,error:V}=_;if(V)throw V;const $=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(w=e.options)===null||w===void 0?void 0:w.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(k=e.options)===null||k===void 0?void 0:k.queryParams,skipBrowserRedirect:!0});return await _n(this.fetch,"GET",$,{headers:this.headers,jwt:(O=(P=F.session)===null||P===void 0?void 0:P.access_token)!==null&&O!==void 0?O:void 0})});if(h)throw h;return Co()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(u==null?void 0:u.url),this._returnResult({data:{provider:e.provider,url:u==null?void 0:u.url},error:null})}catch(u){if(Kr(u))return this._returnResult({data:{provider:e.provider,url:null},error:u});throw u}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var u;try{const{error:h,data:{session:_}}=s;if(h)throw h;const{options:w,provider:o,token:k,access_token:P,nonce:O}=e,F=await _n(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(u=_==null?void 0:_.access_token)!==null&&u!==void 0?u:void 0,body:{provider:o,id_token:k,access_token:P,nonce:O,link_identity:!0,gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:Jl}),{data:V,error:$}=F;return $?this._returnResult({data:{user:null,session:null},error:$}):!V||!V.session||!V.user?this._returnResult({data:{user:null,session:null},error:new Bm}):(V.session&&(await this._saveSession(V.session),await this._notifyAllSubscribers("USER_UPDATED",V.session)),this._returnResult({data:V,error:$}))}catch(h){if(await Ao(this.storage,`${this.storageKey}-code-verifier`),Kr(h))return this._returnResult({data:{user:null,session:null},error:h});throw h}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var u,h;const{data:_,error:w}=s;if(w)throw w;return await _n(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(h=(u=_.session)===null||u===void 0?void 0:u.access_token)!==null&&h!==void 0?h:void 0})})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const u=Date.now();return await rie(async h=>(h>0&&await tie(200*Math.pow(2,h-1)),this._debug(s,"refreshing attempt",h),await _n(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Jl})),(h,_)=>{const w=200*Math.pow(2,h);return _&&SE(_)&&Date.now()+w-u<Zm})}catch(u){if(this._debug(s,"error",u),Kr(u))return this._returnResult({data:{session:null,user:null},error:u});throw u}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const u=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",u),Co()&&!s.skipBrowserRedirect&&window.location.assign(u),{data:{provider:e,url:u},error:null}}async _recoverAndRefresh(){var e,s;const u="#_recoverAndRefresh()";this._debug(u,"begin");try{const h=await df(this.storage,this.storageKey);if(h&&this.userStorage){let w=await df(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!w&&(w={user:h.user},await Xm(this.userStorage,this.storageKey+"-user",w)),h.user=(e=w==null?void 0:w.user)!==null&&e!==void 0?e:EE()}else if(h&&!h.user&&!h.user){const w=await df(this.storage,this.storageKey+"-user");w&&(w!=null&&w.user)?(h.user=w.user,await Ao(this.storage,this.storageKey+"-user"),await Xm(this.storage,this.storageKey,h)):h.user=EE()}if(this._debug(u,"session from storage",h),!this._isValidSession(h)){this._debug(u,"session is not valid"),h!==null&&await this._removeSession();return}const _=((s=h.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<bE;if(this._debug(u,`session has${_?"":" not"} expired with margin of ${bE}s`),_){if(this.autoRefreshToken&&h.refresh_token){const{error:w}=await this._callRefreshToken(h.refresh_token);w&&(console.error(w),SE(w)||(this._debug(u,"refresh failed with a non-retryable error, removing the session",w),await this._removeSession()))}}else if(h.user&&h.user.__isUserNotAvailableProxy===!0)try{const{data:w,error:o}=await this._getUser(h.access_token);!o&&(w!=null&&w.user)?(h.user=w.user,await this._saveSession(h),await this._notifyAllSubscribers("SIGNED_IN",h)):this._debug(u,"could not get user data, skipping SIGNED_IN notification")}catch(w){console.error("Error getting user data:",w),this._debug(u,"error getting user data, skipping SIGNED_IN notification",w)}else await this._notifyAllSubscribers("SIGNED_IN",h)}catch(h){this._debug(u,"error",h),console.error(h);return}finally{this._debug(u,"end")}}async _callRefreshToken(e){var s,u;if(!e)throw new Va;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const h=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(h,"begin");try{this.refreshingDeferred=new mS;const{data:_,error:w}=await this._refreshAccessToken(e);if(w)throw w;if(!_.session)throw new Va;await this._saveSession(_.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",_.session);const o={data:_.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(_){if(this._debug(h,"error",_),Kr(_)){const w={data:null,error:_};return SE(_)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(w),w}throw(u=this.refreshingDeferred)===null||u===void 0||u.reject(_),_}finally{this.refreshingDeferred=null,this._debug(h,"end")}}async _notifyAllSubscribers(e,s,u=!0){const h=`#_notifyAllSubscribers(${e})`;this._debug(h,"begin",s,`broadcast = ${u}`);try{this.broadcastChannel&&u&&this.broadcastChannel.postMessage({event:e,session:s});const _=[],w=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,s)}catch(k){_.push(k)}});if(await Promise.all(w),_.length>0){for(let o=0;o<_.length;o+=1)console.error(_[o]);throw _[0]}}finally{this._debug(h,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Ao(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),u=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!u&&s.user&&await Xm(this.userStorage,this.storageKey+"-user",{user:s.user});const h=Object.assign({},s);delete h.user;const _=E3(h);await Xm(this.storage,this.storageKey,_)}else{const h=E3(s);await Xm(this.storage,this.storageKey,h)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ao(this.storage,this.storageKey),await Ao(this.storage,this.storageKey+"-code-verifier"),await Ao(this.storage,this.storageKey+"-user"),this.userStorage&&await Ao(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Co()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Zm);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async s=>{const{data:{session:u}}=s;if(!u||!u.refresh_token||!u.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const h=Math.floor((u.expires_at*1e3-e)/Zm);this._debug("#_autoRefreshTokenTick()",`access token expires in ${h} ticks, a tick lasts ${Zm}ms, refresh threshold is ${CA} ticks`),h<=CA&&await this._callRefreshToken(u.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof fV)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Co()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,s,u){const h=[`provider=${encodeURIComponent(s)}`];if(u!=null&&u.redirectTo&&h.push(`redirect_to=${encodeURIComponent(u.redirectTo)}`),u!=null&&u.scopes&&h.push(`scopes=${encodeURIComponent(u.scopes)}`),this.flowType==="pkce"){const[_,w]=await Nm(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(_)}`,code_challenge_method:`${encodeURIComponent(w)}`});h.push(o.toString())}if(u!=null&&u.queryParams){const _=new URLSearchParams(u.queryParams);h.push(_.toString())}return u!=null&&u.skipBrowserRedirect&&h.push(`skip_http_redirect=${u.skipBrowserRedirect}`),`${e}?${h.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var u;const{data:h,error:_}=s;return _?this._returnResult({data:null,error:_}):await _n(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(u=h==null?void 0:h.session)===null||u===void 0?void 0:u.access_token})})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var u,h;const{data:_,error:w}=s;if(w)return this._returnResult({data:null,error:w});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:k,error:P}=await _n(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(u=_==null?void 0:_.session)===null||u===void 0?void 0:u.access_token});return P?this._returnResult({data:null,error:P}):(e.factorType==="totp"&&k.type==="totp"&&(!((h=k==null?void 0:k.totp)===null||h===void 0)&&h.qr_code)&&(k.totp.qr_code=`data:image/svg+xml;utf-8,${k.totp.qr_code}`),this._returnResult({data:k,error:null}))})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var u;const{data:h,error:_}=s;if(_)return this._returnResult({data:null,error:_});const w=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Rie(e.webauthn.credential_response):Die(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:k}=await _n(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:w,headers:this.headers,jwt:(u=h==null?void 0:h.session)===null||u===void 0?void 0:u.access_token});return k?this._returnResult({data:null,error:k}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:k}))})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var u;const{data:h,error:_}=s;if(_)return this._returnResult({data:null,error:_});const w=await _n(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(u=h==null?void 0:h.session)===null||u===void 0?void 0:u.access_token});if(w.error)return w;const{data:o}=w;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Pie(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Mie(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:u}=await this._challenge({factorId:e.factorId});return u?this._returnResult({data:null,error:u}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:u}=await this.getUser();if(u)return{data:null,error:u};const h={all:[],phone:[],totp:[],webauthn:[]};for(const _ of(e=s==null?void 0:s.factors)!==null&&e!==void 0?e:[])h.all.push(_),_.status==="verified"&&h[_.factor_type].push(_);return{data:h,error:null}}async _getAuthenticatorAssuranceLevel(){var e,s;const{data:{session:u},error:h}=await this.getSession();if(h)return this._returnResult({data:null,error:h});if(!u)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:_}=TE(u.access_token);let w=null;_.aal&&(w=_.aal);let o=w;((s=(e=u.user.factors)===null||e===void 0?void 0:e.filter(O=>O.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(o="aal2");const P=_.amr||[];return{data:{currentLevel:w,nextLevel:o,currentAuthenticationMethods:P},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:u},error:h}=s;return h?this._returnResult({data:null,error:h}):u?await _n(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:u.access_token,xform:_=>({data:_,error:null})}):this._returnResult({data:null,error:new Va})})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async u=>{const{data:{session:h},error:_}=u;if(_)return this._returnResult({data:null,error:_});if(!h)return this._returnResult({data:null,error:new Va});const w=await _n(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:h.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return w.data&&w.data.redirect_url&&Co()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(w.data.redirect_url),w})}catch(u){if(Kr(u))return this._returnResult({data:null,error:u});throw u}}async _denyAuthorization(e,s){try{return await this._useSession(async u=>{const{data:{session:h},error:_}=u;if(_)return this._returnResult({data:null,error:_});if(!h)return this._returnResult({data:null,error:new Va});const w=await _n(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:h.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return w.data&&w.data.redirect_url&&Co()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(w.data.redirect_url),w})}catch(u){if(Kr(u))return this._returnResult({data:null,error:u});throw u}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:u}=e;return u?this._returnResult({data:null,error:u}):s?await _n(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:h=>({data:h,error:null})}):this._returnResult({data:null,error:new Va})})}catch(e){if(Kr(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:u},error:h}=s;return h?this._returnResult({data:null,error:h}):u?(await _n(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:u.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Va})})}catch(s){if(Kr(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let u=s.keys.find(o=>o.kid===e);if(u)return u;const h=Date.now();if(u=this.jwks.keys.find(o=>o.kid===e),u&&this.jwks_cached_at+jne>h)return u;const{data:_,error:w}=await _n(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(w)throw w;return!_.keys||_.keys.length===0||(this.jwks=_,this.jwks_cached_at=h,u=_.keys.find(o=>o.kid===e),!u)?null:u}async getClaims(e,s={}){try{let u=e;if(!u){const{data:$,error:Y}=await this.getSession();if(Y||!$.session)return this._returnResult({data:null,error:Y});u=$.session.access_token}const{header:h,payload:_,signature:w,raw:{header:o,payload:k}}=TE(u);s!=null&&s.allowExpired||cie(_.exp);const P=!h.alg||h.alg.startsWith("HS")||!h.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(h.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!P){const{error:$}=await this.getUser(u);if($)throw $;return{data:{claims:_,header:h,signature:w},error:null}}const O=uie(h.alg),F=await crypto.subtle.importKey("jwk",P,O,!0,["verify"]);if(!await crypto.subtle.verify(O,F,w,Xne(`${o}.${k}`)))throw new MA("Invalid JWT signature");return{data:{claims:_,header:h,signature:w},error:null}}catch(u){if(Kr(u))return this._returnResult({data:null,error:u});throw u}}}b0.nextInstanceID={};const Uie=b0,$ie="2.89.0";let wv="";typeof Deno<"u"?wv="deno":typeof document<"u"?wv="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wv="react-native":wv="node";const Gie={"X-Client-Info":`supabase-js-${wv}/${$ie}`},Hie={headers:Gie},Wie={schema:"public"},qie={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Kie={};function S0(t){"@babel/helpers - typeof";return S0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S0(t)}function Zie(t,e){if(S0(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var u=s.call(t,e);if(S0(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Xie(t){var e=Zie(t,"string");return S0(e)=="symbol"?e:e+""}function Yie(t,e,s){return(e=Xie(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function R3(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);e&&(u=u.filter(function(h){return Object.getOwnPropertyDescriptor(t,h).enumerable})),s.push.apply(s,u)}return s}function ks(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?R3(Object(s),!0).forEach(function(u){Yie(t,u,s[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):R3(Object(s)).forEach(function(u){Object.defineProperty(t,u,Object.getOwnPropertyDescriptor(s,u))})}return t}const Jie=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Qie=()=>Headers,ese=(t,e,s)=>{const u=Jie(s),h=Qie();return async(_,w)=>{var o;const k=(o=await e())!==null&&o!==void 0?o:t;let P=new h(w==null?void 0:w.headers);return P.has("apikey")||P.set("apikey",t),P.has("Authorization")||P.set("Authorization",`Bearer ${k}`),u(_,ks(ks({},w),{},{headers:P}))}};function tse(t){return t.endsWith("/")?t:t+"/"}function rse(t,e){var s,u;const{db:h,auth:_,realtime:w,global:o}=t,{db:k,auth:P,realtime:O,global:F}=e,V={db:ks(ks({},k),h),auth:ks(ks({},P),_),realtime:ks(ks({},O),w),storage:{},global:ks(ks(ks({},F),o),{},{headers:ks(ks({},(s=F==null?void 0:F.headers)!==null&&s!==void 0?s:{}),(u=o==null?void 0:o.headers)!==null&&u!==void 0?u:{})}),accessToken:async()=>""};return t.accessToken?V.accessToken=t.accessToken:delete V.accessToken,V}function nse(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(tse(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var ise=class extends Uie{constructor(t){super(t)}},sse=class{constructor(t,e,s){var u,h;this.supabaseUrl=t,this.supabaseKey=e;const _=nse(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",_),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",_),this.storageUrl=new URL("storage/v1",_),this.functionsUrl=new URL("functions/v1",_);const w=`sb-${_.hostname.split(".")[0]}-auth-token`,o={db:Wie,realtime:Kie,auth:ks(ks({},qie),{},{storageKey:w}),global:Hie},k=rse(s??{},o);if(this.storageKey=(u=k.auth.storageKey)!==null&&u!==void 0?u:"",this.headers=(h=k.global.headers)!==null&&h!==void 0?h:{},k.accessToken)this.accessToken=k.accessToken,this.auth=new Proxy({},{get:(O,F)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(F)} is not possible`)}});else{var P;this.auth=this._initSupabaseAuthClient((P=k.auth)!==null&&P!==void 0?P:{},this.headers,k.global.fetch)}this.fetch=ese(e,this._getAccessToken.bind(this),k.global.fetch),this.realtime=this._initRealtimeClient(ks({headers:this.headers,accessToken:this._getAccessToken.bind(this)},k.realtime)),this.accessToken&&this.accessToken().then(O=>this.realtime.setAuth(O)).catch(O=>console.warn("Failed to set initial Realtime auth token:",O)),this.rest=new Bre(new URL("rest/v1",_).href,{headers:this.headers,schema:k.db.schema,fetch:this.fetch}),this.storage=new One(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),k.accessToken||this._listenForAuthEvents()}get functions(){return new Dre(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:u}=await t.auth.getSession();return(e=(s=u.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:u,userStorage:h,storageKey:_,flowType:w,lock:o,debug:k,throwOnError:P},O,F){const V={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ise({url:this.authUrl.href,headers:ks(ks({},V),O),storageKey:_,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:u,userStorage:h,flowType:w,lock:o,debug:k,throwOnError:P,fetch:F,hasCustomAuthorizationHeader:Object.keys(this.headers).some($=>$.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new tne(this.realtimeUrl.href,ks(ks({},t),{},{params:ks(ks({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const ose=(t,e,s)=>new sse(t,e,s);function ase(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}ase()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const lse="https://tmmrlsaixtghdicmmpmp.supabase.co",cse="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRtbXJsc2FpeHRnaGRpY21tcG1wIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njc2Njk4ODQsImV4cCI6MjA4MzI0NTg4NH0.lKID0Mt0B-uyYWi57xldQJ56stbG7YopeOEy4ObKoMU",qd=ose(lse,cse,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),use=()=>{const[t,e]=X.useState([]),[s,u]=X.useState(!0);return X.useEffect(()=>{(async()=>{const _=new Date;_.setDate(_.getDate()-30);const{data:w,error:o}=await qd.from("mission_hotspots").select("*").gte("last_mission_at",_.toISOString()).order("intensity_score",{ascending:!1}).limit(50);!o&&w&&e(w),u(!1)})()},[]),{hotspots:t,loading:s}},dse=[{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 hse(){const t=X.useMemo(()=>dse,[]),e=X.useMemo(()=>t.filter(u=>u.type==="charity"),[t]),s=X.useMemo(()=>t.filter(u=>u.type==="sponsored"),[t]);return{realChangeMissions:t,charityMissions:e,sponsoredMissions:s}}function fse(t){const e=t.toLowerCase();return e.includes("livboj")||e.includes("lifebuoy")||e.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%)"}:e.includes("räddningsstation")||e.includes("rescue station")||e.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%)"}:e.includes("nödtelefon")||e.includes("emergency phone")||e.includes("sos")||e.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%)"}:e.includes("brygga")||e.includes("pier")||e.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%)"}:e.includes("strand")||e.includes("beach")||e.includes("bad")||e.includes("vatten")||e.includes("sjö")||e.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%)"}:e.includes("stege")||e.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%)"}:e.includes("utegym")||e.includes("outdoor gym")||e.includes("gym")||e.includes("träning")||e.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%)"}:e.includes("fotboll")||e.includes("football")||e.includes("soccer")||e.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%)"}:e.includes("tennis")||e.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%)"}:e.includes("basket")||e.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%)"}:e.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%)"}:e.includes("lekplats")||e.includes("playground")||e.includes("lek")||e.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%)"}:e.includes("löpar")||e.includes("running")||e.includes("track")||e.includes("bana")||e.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%)"}:e.includes("skate")||e.includes("skridskor")||e.includes("skridsko")||e.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%)"}:e.includes("staty")||e.includes("statue")||e.includes("monument")||e.includes("skulptur")||e.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%)"}:e.includes("mural")||e.includes("väggmålning")||e.includes("graffiti")||e.includes("gatukonst")||e.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%)"}:e.includes("museum")||e.includes("galleri")||e.includes("gallery")||e.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%)"}:e.includes("kyrka")||e.includes("church")||e.includes("katedral")||e.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%)"}:e.includes("fontän")||e.includes("fountain")||e.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%)"}:e.includes("skylt")||e.includes("sign")||e.includes("tavla")||e.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%)"}:e.includes("byggnad")||e.includes("building")||e.includes("fasad")||e.includes("facade")||e.includes("hus")||e.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%)"}:e.includes("butik")||e.includes("store")||e.includes("shop")||e.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%)"}:e.includes("restaurang")||e.includes("restaurant")||e.includes("mat")||e.includes("food")||e.includes("cafe")||e.includes("kafé")||e.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%)"}:e.includes("parkering")||e.includes("parking")||e.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%)"}:e.includes("bil")||e.includes("car")||e.includes("fordon")||e.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%)"}:e.includes("träd")||e.includes("tree")||e.includes("park")||e.includes("natur")||e.includes("nature")||e.includes("skog")||e.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%)"}:e.includes("blomma")||e.includes("flower")||e.includes("trädgård")||e.includes("garden")||e.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%)"}:e.includes("fågel")||e.includes("bird")||e.includes("djur")||e.includes("animal")||e.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%)"}:e.includes("event")||e.includes("händelse")||e.includes("festival")||e.includes("konsert")||e.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%)"}:e.includes("utrymningsväg")||e.includes("emergency exit")||e.includes("nödutgång")||e.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%)"}:e.includes("räcke")||e.includes("railing")||e.includes("ledstång")||e.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%)"}:e.includes("bro")||e.includes("bridge")||e.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%)"}:e.includes("kaj")||e.includes("quay")||e.includes("hamn")||e.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%)"}:e.includes("cykelställ")||e.includes("bicycle rack")||e.includes("bike rack")||e.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%)"}:e.includes("elskåp")||e.includes("teknikskåp")||e.includes("electrical cabinet")||e.includes("kopplingsskåp")||e.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%)"}:e.includes("handikappramp")||e.includes("ramp")||e.includes("handicap")||e.includes("tillgänglighet")||e.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%)"}:e.includes("brandpost")||e.includes("fire hydrant")||e.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%)"}:e.includes("bänk")||e.includes("bench")||e.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%)"}:e.includes("papperskorg")||e.includes("soptunna")||e.includes("trash")||e.includes("bin")||e.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%)"}:e.includes("belysning")||e.includes("lyktstolpe")||e.includes("street light")||e.includes("lampa")||e.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 pse(t={}){const{enabled:e=!0,autoNavigate:s=!0}=t,[u,h]=X.useState(!1),[_,w]=X.useState(!1),[o,k]=X.useState("idle"),[P,O]=X.useState(null),[F,V]=X.useState(null),$=X.useRef(null),Y=X.useRef(null),Z=X.useCallback(()=>{$.current&&($.current.pause(),$.current=null,w(!1))},[]),se=X.useCallback(async(Ie,Be,je)=>{if(!(!e||Ie==="idle")){Z(),h(!0),k(Ie);try{const Je=await fetch("https://tmmrlsaixtghdicmmpmp.supabase.co/functions/v1/voice-guide",{method:"POST",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRtbXJsc2FpeHRnaGRpY21tcG1wIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njc2Njk4ODQsImV4cCI6MjA4MzI0NTg4NH0.lKID0Mt0B-uyYWi57xldQJ56stbG7YopeOEy4ObKoMU",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRtbXJsc2FpeHRnaGRpY21tcG1wIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njc2Njk4ODQsImV4cCI6MjA4MzI0NTg4NH0.lKID0Mt0B-uyYWi57xldQJ56stbG7YopeOEy4ObKoMU"},body:JSON.stringify({state:Ie,missionTitle:Be.missionTitle,distanceMeters:Be.distanceMeters,targetDescription:Be.targetDescription,instructions:Be.instructions,criticalElements:Be.criticalElements,sponsorReward:Be.sponsorReward,sponsorBrand:Be.sponsorBrand,camera:Be.camera,position:Be.position,voiceId:je})});if(!Je.ok){if(Je.status===429){ro.error("Röstguide tillfälligt otillgänglig, försök igen om en stund");return}if(Je.status===402){ro.error("AI-krediter slut");return}throw new Error(`Voice guide request failed: ${Je.status}`)}const ft=decodeURIComponent(Je.headers.get("X-Generated-Text")||"");V(ft);const kt=await Je.blob(),tr=URL.createObjectURL(kt),jt=new Audio(tr);$.current=jt,jt.onplay=()=>w(!0),jt.onended=()=>{w(!1),O(Ie),URL.revokeObjectURL(tr),$.current=null},jt.onerror=()=>{w(!1),URL.revokeObjectURL(tr),$.current=null},await jt.play()}catch(Je){console.error("Voice guide error:",Je),ro.error("Kunde inte spela röstguide")}finally{h(!1)}}},[e,Z]),te=X.useCallback((Ie,Be)=>{if(!s||!e)return;const je=Y.current;Y.current=Ie;let Je="navigation";Ie<=10?Je="photo":Ie<=50&&(Je="positioning");const ft=Je!==o,kt=je!==null&&o==="navigation"&&Math.abs(Ie-je)>100;(ft||kt)&&(Je!==P||kt)&&se(Je,{...Be,distanceMeters:Ie})},[s,e,o,P,se]),ee=X.useCallback(Ie=>{se("completion",Ie)},[se]),oe=X.useCallback(Ie=>{Ie.sponsorReward&&Ie.sponsorBrand&&se("sponsor",Ie)},[se]),he=X.useCallback((Ie,Be)=>{se(Ie,Be)},[se]);return X.useEffect(()=>()=>{Z()},[Z]),{speak:se,stop:Z,updateNavigation:te,speakCompletion:ee,speakSponsorReward:oe,triggerState:he,isLoading:u,isPlaying:_,currentState:o,lastSpokenText:F,enabled:e}}const mse={idle:"Starta röstguide",navigation:"Navigerar...",positioning:"Positionering...",photo:"Fotoinstruktion...",completion:"Slutför...",sponsor:"Belöning..."};function gse({isLoading:t,isPlaying:e,currentState:s,onPlay:u,onStop:h,className:_,showLabel:w=!1}){const o=()=>{e?h():u()};return le.jsxs($a,{variant:e?"default":"outline",size:w?"sm":"icon",onClick:o,disabled:t,className:ki("transition-all gap-2",e&&"bg-primary animate-pulse",_),children:[t?le.jsx(p1,{className:"h-4 w-4 animate-spin"}):e?le.jsx(t9,{className:"h-4 w-4"}):le.jsx(e9,{className:"h-4 w-4"}),w&&le.jsx("span",{className:"text-xs",children:t?"Laddar...":e?mse[s]:"Röstguide"})]})}function _se(){const{t}=Kf(),[e,s]=X.useState({heading:null,accuracy:null,error:null,supported:!1,permissionGranted:!1}),u=X.useCallback(async()=>{if(typeof DeviceOrientationEvent.requestPermission=="function")try{return await DeviceOrientationEvent.requestPermission()==="granted"?(s(_=>({..._,permissionGranted:!0,error:null})),!0):(s(_=>({..._,error:t("compass.permissionDenied"),permissionGranted:!1})),!1)}catch{return s(_=>({..._,error:t("compass.couldNotRequest")})),!1}return s(h=>({...h,permissionGranted:!0})),!0},[t]);return X.useEffect(()=>{const h="DeviceOrientationEvent"in window;if(s(o=>({...o,supported:h})),!h){s(o=>({...o,error:t("compass.notSupported")}));return}const _=o=>{let k=null;"webkitCompassHeading"in o&&typeof o.webkitCompassHeading=="number"?k=o.webkitCompassHeading:(o.alpha!==null&&o.absolute||o.alpha!==null)&&(k=360-o.alpha),k!==null&&(k=(k%360+360)%360,s(P=>({...P,heading:k,accuracy:o.webkitCompassAccuracy??null,error:null,permissionGranted:!0})))};return(async()=>{typeof DeviceOrientationEvent.requestPermission=="function"?s(o=>({...o,permissionGranted:!1})):(window.addEventListener("deviceorientation",_,!0),s(o=>({...o,permissionGranted:!0})))})(),()=>{window.removeEventListener("deviceorientation",_,!0)}},[t]),X.useEffect(()=>{if(!e.permissionGranted||!e.supported)return;const h=_=>{let w=null;"webkitCompassHeading"in _&&typeof _.webkitCompassHeading=="number"?w=_.webkitCompassHeading:_.alpha!==null&&(w=360-_.alpha),w!==null&&(w=(w%360+360)%360,s(o=>({...o,heading:w,accuracy:_.webkitCompassAccuracy??null,error:null})))};return window.addEventListener("deviceorientation",h,!0),()=>{window.removeEventListener("deviceorientation",h,!0)}},[e.permissionGranted,e.supported]),{...e,requestPermission:u}}function AE(t,e,s,u){const h=V=>V*Math.PI/180,_=V=>V*180/Math.PI,w=h(u-e),o=h(t),k=h(s),P=Math.sin(w)*Math.cos(k),O=Math.cos(o)*Math.sin(k)-Math.sin(o)*Math.cos(k)*Math.cos(w);let F=_(Math.atan2(P,O));return F=(F%360+360)%360,F}function yse(t,e,s,u){const h=V=>V*Math.PI/180,_=V=>V*180/Math.PI,w=h(u-e),o=h(t),k=h(s),P=Math.sin(w)*Math.cos(k),O=Math.cos(o)*Math.sin(k)-Math.sin(o)*Math.cos(k)*Math.cos(w);return(_(Math.atan2(P,O))+360)%360}function vse(t,e,s,u){const _=O=>O*Math.PI/180,w=_(s-t),o=_(u-e),k=Math.sin(w/2)*Math.sin(w/2)+Math.cos(_(t))*Math.cos(_(s))*Math.sin(o/2)*Math.sin(o/2);return 6371e3*(2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k)))}function gV(t){const e=["N","NE","E","SE","S","SW","W","NW"],s=Math.round(t/45)%8;return e[s]}function xse(t){return{N:"Norr",NE:"Nordost",E:"Öster",SE:"Sydost",S:"Söder",SW:"Sydväst",W:"Väster",NW:"Nordväst"}[gV(t)]}function wse({userLocation:t,targetLocation:e,targetName:s,deviceHeading:u,className:h,style:_}){const w=X.useMemo(()=>{if(!t||!e)return null;const o=vse(t.latitude,t.longitude,e.latitude,e.longitude),k=yse(t.latitude,t.longitude,e.latitude,e.longitude);let P=k;return u!==null&&(P=(k-u+360)%360,P>180&&(P-=360)),{distance:o,bearing:k,relativeBearing:P,cardinalDirection:gV(k),swedishDirection:xse(k),isOnTarget:o<5,isClose:o<20,isPointingRight:u!==null&&Math.abs(P)<15}},[t,e,u]);return!w||!t||!e?null:le.jsxs("div",{className:ki("bg-card/95 backdrop-blur-md rounded-2xl shadow-xl border border-border p-4 animate-fade-in",h),style:_,children:[s&&le.jsxs("div",{className:"flex items-center gap-2 mb-3 pb-3 border-b border-border/50",children:[le.jsx(eN,{className:"w-4 h-4 text-primary"}),le.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s})]}),le.jsxs("div",{className:"flex items-center gap-4",children:[le.jsxs("div",{className:"flex-1",children:[le.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[le.jsx(m1,{className:ki("w-4 h-4",w.isOnTarget?"text-green-500":w.isClose?"text-amber-500":"text-primary")}),le.jsx("span",{className:"text-xs text-muted-foreground",children:"Avstånd"})]}),le.jsx("div",{className:ki("text-2xl font-bold",w.isOnTarget?"text-green-500":w.isClose?"text-amber-500":"text-foreground"),children:w.isOnTarget?le.jsxs("span",{className:"flex items-center gap-1",children:[le.jsx("span",{children:"✓"}),le.jsx("span",{className:"text-lg",children:"På plats"})]}):zb(w.distance)})]}),le.jsx("div",{className:"w-px h-12 bg-border"}),le.jsxs("div",{className:"flex-1",children:[le.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[le.jsx($q,{className:"w-4 h-4 text-primary"}),le.jsx("span",{className:"text-xs text-muted-foreground",children:"Riktning"})]}),le.jsxs("div",{className:"flex items-center gap-2",children:[le.jsx("span",{className:"text-2xl font-bold text-foreground",children:w.cardinalDirection}),le.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(w.bearing),"°"]})]})]}),le.jsx("div",{className:"w-px h-12 bg-border"}),le.jsxs("div",{className:"flex flex-col items-center justify-center w-16",children:[le.jsx("div",{className:ki("w-12 h-12 rounded-full flex items-center justify-center transition-all duration-300",w.isPointingRight?"bg-green-500/20 text-green-500":"bg-primary/20 text-primary"),children:le.jsx(Dk,{className:"w-6 h-6 transition-transform duration-300",style:{transform:u!==null?`rotate(${w.relativeBearing}deg)`:`rotate(${w.bearing-45}deg)`}})}),le.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:w.isPointingRight?"Rätt!":w.swedishDirection})]})]}),le.jsxs("div",{className:"mt-3 pt-3 border-t border-border/50",children:[le.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:le.jsx("div",{className:ki("h-full rounded-full transition-all duration-500",w.isOnTarget?"bg-green-500":w.isClose?"bg-amber-500":"bg-primary"),style:{width:`${Math.max(5,Math.min(100,100-w.distance/500*100))}%`}})}),le.jsxs("div",{className:"flex justify-between mt-1",children:[le.jsx("span",{className:"text-xs text-muted-foreground",children:"0m"}),le.jsx("span",{className:"text-xs text-muted-foreground",children:"500m+"})]})]})]})}const bse="mapbox://styles/mapbox/navigation-night-v1",Sse="mapbox://styles/mapbox/navigation-day-v1",D3=1.5,Tse=4.5,Ese=18,kse=13;function L3(t){const e=Math.min(Math.max(t,0),60)/60;return D3+(Tse-D3)*e}const pv=52,mv=-20,O3=[{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 z3(t){var e,s;try{const h=(s=(((e=t.getStyle())==null?void 0:e.layers)??[]).find(_=>{var w;return _.type==="symbol"&&((w=_.layout)==null?void 0:w["text-field"])}))==null?void 0:s.id;return t.getLayer("3d-buildings")||t.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}},h),t.getLayer("sky")||t.addLayer({id:"sky",type:"sky",paint:{"sky-type":"atmosphere","sky-atmosphere-sun":[0,0],"sky-atmosphere-sun-intensity":8}}),!0}catch(u){return console.warn("Failed to enable 3D view",u),!1}}function F3(t){try{t.getLayer("3d-buildings")&&t.removeLayer("3d-buildings"),t.getLayer("sky")&&t.removeLayer("sky"),t.easeTo({pitch:0,bearing:0,duration:500})}catch(e){console.warn("Failed to disable 3D view",e)}}const _V=X.forwardRef(({missions:t,userLocation:e,onMissionSelect:s,startAboveUser:u=!1,zoomToTarget:h=null,activeRoute:_=null,onStartNavigation:w,onClearNavigation:o,navigationLoading:k=!1,canStartNavigation:P=!1,isNavigating:O=!1,selectedTravelMode:F="walking",showHotspots:V=!0},$)=>{const{t:Y}=Kf(),Z=r_(),{resolvedTheme:se}=GX(),{hotspots:te}=use(),{realChangeMissions:ee}=hse(),oe=X.useRef(null),he=X.useRef(null),Ie=X.useRef([]),Be=X.useRef([]),je=X.useRef(null),Je=X.useRef(null),ft=X.useRef(!0),kt=X.useRef(!1),[tr,jt]=X.useState(!0),[Qe,xt]=X.useState(null),[It,Ot]=X.useState(null),[Et,st]=X.useState(!1),[Pt,qt]=X.useState(null),[_r,yr]=X.useState(0),[hr,Gr]=X.useState("walking"),[mi,Oi]=X.useState(null),[xn,zs]=X.useState(!1),un=X.useRef(!1),Nn=X.useRef(!1),gi=X.useRef(!1),[Ks,Un]=X.useState(!0),[io,so]=X.useState(!1),[Ki,Zi]=X.useState(!1),Zn=_se(),Is=pse({enabled:Ki,autoNavigate:!1}),ua=Ks&&!io,Ai=X.useMemo(()=>!e||t.length===0?null:t.reduce((At,sr)=>At?(sr.distance??1/0)<(At.distance??1/0)?sr:At:sr,t[0]),[t,e]),us=X.useMemo(()=>{if(t.length===0)return null;const At=.01,sr={};t.forEach(tn=>{const Wr=`${Math.floor(tn.latitude/At)}_${Math.floor(tn.longitude/At)}`;sr[Wr]||(sr[Wr]={lat:0,lng:0,count:0,missions:[]}),sr[Wr].lat+=tn.latitude,sr[Wr].lng+=tn.longitude,sr[Wr].count++,sr[Wr].missions.push(tn)});let Lr=null,Zr=0;for(const tn in sr)sr[tn].count>Zr&&(Zr=sr[tn].count,Lr=sr[tn]);return Lr?{lat:Lr.lat/Lr.count,lng:Lr.lng/Lr.count,count:Lr.count}:null},[t]),Fs=()=>{!Ai||!he.current||(ro.info(`${Y("map.flyingToNearest")}: ${Ai.title}`,{description:zb(Ai.distance)+" "+Y("map.fromHere"),duration:3e3}),xt(Ai),he.current.flyTo({center:[Ai.longitude,Ai.latitude],zoom:16,pitch:pv,bearing:mv,duration:2e3}))},rs=()=>{!us||!he.current||(ro.info(Y("map.flyingToCluster"),{description:`${us.count} ${Y("map.missionsHere")}`,duration:3e3}),Oi({lat:us.lat,lng:us.lng}),setTimeout(()=>Oi(null),4e3),he.current.flyTo({center:[us.lng,us.lat],zoom:13,pitch:60,bearing:mv,duration:2e3}))},Ho=()=>{if(!he.current)return;const At=O3.reduce((sr,Lr)=>Lr.missions>sr.missions?Lr:sr,O3[0]);ro.info(`${Y("map.flyingToPopular")}: ${At.name}`,{description:`${Y("map.popularArea")} ${At.missions} ${Y("map.previousMissions")}`,duration:3e3}),he.current.flyTo({center:[At.lng,At.lat],zoom:14.5,pitch:70,bearing:mv,duration:2e3})},ds=()=>{!he.current||!e||(xn?ro.info(Y("map.mapUnlocked"),{duration:2e3}):(he.current.flyTo({center:[e.longitude,e.latitude],zoom:16,pitch:ua?pv:0,duration:1e3}),ro.info(Y("map.mapLocked"),{duration:2e3})),zs(!xn))},bs=X.useCallback(()=>{const At=Qe||Ai;if(!At){ro.error("Inget uppdrag valt");return}if(Ki||Zi(!0),Is.isPlaying){Is.stop();return}let sr;if(e){const Wr=(At.latitude-e.latitude)*Math.PI/180,On=(At.longitude-e.longitude)*Math.PI/180,Zs=Math.sin(Wr/2)*Math.sin(Wr/2)+Math.cos(e.latitude*Math.PI/180)*Math.cos(At.latitude*Math.PI/180)*Math.sin(On/2)*Math.sin(On/2);sr=6371e3*(2*Math.atan2(Math.sqrt(Zs),Math.sqrt(1-Zs)))}let Lr="navigation";sr!==void 0&&(sr<=10?Lr="photo":sr<=50&&(Lr="positioning"));const Zr={missionTitle:At.title,distanceMeters:sr,targetDescription:At.target_description||void 0,instructions:At.instructions||void 0,camera:Zn.heading!==null&&e?{currentBearing:Zn.heading,targetBearing:AE(e.latitude,e.longitude,At.latitude,At.longitude)}:void 0,position:e?{userLatitude:e.latitude,userLongitude:e.longitude,targetLatitude:At.latitude,targetLongitude:At.longitude,positionError:sr}:void 0};Is.triggerState(Lr,Zr)},[Qe,Ai,e,Zn.heading,Is,Ki]);X.useEffect(()=>{if(!he.current||!Et||!e||gi.current||h)return;gi.current=!0;const At=he.current.getCenter(),sr=Math.abs(At.lat-e.latitude),Lr=Math.abs(At.lng-e.longitude),Zr=sr<.05&&Lr<.05,tn=setTimeout(()=>{!he.current||!ft.current||he.current.flyTo({center:[e.longitude,e.latitude],zoom:kse,pitch:pv,bearing:mv,duration:Zr?800:0,curve:1.4,easing:Wr=>Wr<.5?2*Wr*Wr:1-Math.pow(-2*Wr+2,2)/2})},300);return()=>clearTimeout(tn)},[Et,e,h]),X.useEffect(()=>{!xn||!he.current||!e||!Et||he.current.easeTo({center:[e.longitude,e.latitude],duration:500})},[xn,e,Et]),X.useEffect(()=>{if(!he.current||!Et)return;const At=()=>{un.current=!0,xn&&(zs(!1),ro.info(Y("map.mapUnlocked"),{duration:2e3}))},sr=()=>{un.current=!0},Lr=()=>{if(!he.current)return;const Zr=he.current.getPitch(),tn=L3(Zr);he.current.setMinZoom(tn),he.current.getZoom()<tn&&he.current.easeTo({zoom:tn,duration:300})};return he.current.on("dragstart",At),he.current.on("zoomstart",sr),he.current.on("pitchend",Lr),()=>{var Zr,tn,Wr;(Zr=he.current)==null||Zr.off("dragstart",At),(tn=he.current)==null||tn.off("zoomstart",sr),(Wr=he.current)==null||Wr.off("pitchend",Lr)}},[Et,xn]),X.useEffect(()=>{if(!(!he.current||!Et||!h||!ft.current)){if(_!=null&&_.geometry&&e){const At=setTimeout(()=>{var tn;if(!ft.current||!he.current)return;const sr=_.geometry.coordinates,Lr=sr.length>1?sr[1]:sr[0],Zr=AE(e.latitude,e.longitude,Lr[1],Lr[0]);(tn=he.current)==null||tn.flyTo({center:[e.longitude,e.latitude],zoom:17,pitch:52,bearing:Zr,duration:1400,curve:1.5})},200);return()=>clearTimeout(At)}if(_!=null&&_.geometry){const At=_.geometry.coordinates,sr=new Eu.LngLatBounds;At.forEach(Zr=>sr.extend(Zr));const Lr=setTimeout(()=>{var Zr;!ft.current||!he.current||(Zr=he.current)==null||Zr.fitBounds(sr,{padding:{top:100,bottom:150,left:50,right:50},pitch:45,duration:2e3})},300);return()=>clearTimeout(Lr)}he.current.flyTo({center:[h.longitude,h.latitude],zoom:16,pitch:45,bearing:20,duration:1500,curve:1.2,easing:At=>At<.5?2*At*At:1-Math.pow(-2*At+2,2)/2})}},[Et,h,_,e]),X.useEffect(()=>{if(!he.current||!Et||!ft.current)return;const At=he.current,sr="route-source",Lr="route-layer",Zr="route-outline-layer";try{At.getLayer(Lr)&&At.removeLayer(Lr),At.getLayer(Zr)&&At.removeLayer(Zr),At.getSource(sr)&&At.removeSource(sr)}catch{}if(_!=null&&_.geometry)return At.addSource(sr,{type:"geojson",data:{type:"Feature",properties:{},geometry:_.geometry}}),At.addLayer({id:Zr,type:"line",source:sr,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#ffffff","line-width":10,"line-opacity":.8}}),At.addLayer({id:Lr,type:"line",source:sr,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#8B7355","line-width":6,"line-opacity":1}}),()=>{try{At.getLayer(Lr)&&At.removeLayer(Lr),At.getLayer(Zr)&&At.removeLayer(Zr),At.getSource(sr)&&At.removeSource(sr)}catch{}}},[Et,_]),X.useEffect(()=>{if(!he.current||!Et||!V||!tr||!ft.current||te.length===0)return;const At=he.current,sr="hotspots-source",Lr="hotspots-heat";try{At.getLayer(Lr)&&At.removeLayer(Lr),At.getSource(sr)&&At.removeSource(sr)}catch{}const Zr={type:"FeatureCollection",features:te.map(tn=>({type:"Feature",properties:{intensity:tn.intensity_score},geometry:{type:"Point",coordinates:[Number(tn.longitude),Number(tn.latitude)]}}))};return At.addSource(sr,{type:"geojson",data:Zr}),At.addLayer({id:Lr,type:"heatmap",source:sr,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{At.getLayer(Lr)&&At.removeLayer(Lr),At.getSource(sr)&&At.removeSource(sr)}catch{}}},[Et,te,V,tr]),X.useEffect(()=>(ft.current=!0,()=>{ft.current=!1}),[]),X.useEffect(()=>{if(!oe.current||he.current||kt.current)return;kt.current=!0;const At=!!h;return(async()=>{if(!ft.current){kt.current=!1;return}try{ft.current&&qt(null);const Lr=await v4();if(!ft.current)return;if(!Lr){ft.current&&qt(Y("map.couldNotLoadMapToken"));return}const Zr=Eu.supported(),tn=Eu.supported({failIfMajorPerformanceCaveat:!0});if(!Zr){qt(Y("map.couldNotLoadMapWebGL"));return}tn||console.warn("WebGL available but with major performance caveat; continuing anyway");const Wr=se==="dark"?"mapbox/dark-v11":"mapbox/outdoors-v12";try{const Fr=new AbortController,Bi=window.setTimeout(()=>Fr.abort(),5e3),Pi=`https://api.mapbox.com/styles/v1/${Wr}?access_token=${encodeURIComponent(Lr)}`,Ss=await fetch(Pi,{method:"GET",signal:Fr.signal});if(window.clearTimeout(Bi),!Ss.ok){qt(`${Y("map.couldNotLoadMapStyle")}: ${Ss.status}`);return}}catch(Fr){console.error("Mapbox reachability check failed",Fr),qt(Y("map.couldNotLoadMapNetwork"));return}Eu.accessToken=Lr;let On=null;try{const Fr=localStorage.getItem("qz_last_position");if(Fr){const Bi=JSON.parse(Fr);Date.now()-Bi.ts<30*60*1e3&&(On=[Bi.longitude,Bi.latitude])}}catch{}const Zs=At?[h.longitude,h.latitude]:e?[e.longitude,e.latitude]:On??[18.0686,59.3293],qo=At||e||On?14:5,yo=0,Do=0,oo=se==="dark"?bse:Sse;he.current=new Eu.Map({container:oe.current,style:oo,center:Zs,zoom:qo,pitch:yo,bearing:Do,minZoom:L3(yo),maxZoom:Ese,attributionControl:!1,logoPosition:"bottom-left"});const vo=()=>{var Fr;try{(Fr=he.current)==null||Fr.resize()}catch{}};Je.current=new ResizeObserver(()=>vo()),Je.current.observe(oe.current),window.addEventListener("resize",vo),window.addEventListener("orientationchange",vo);const Lo=()=>{document.hidden||window.setTimeout(()=>vo(),250)};document.addEventListener("visibilitychange",Lo);const En=he.current.getCanvas(),zi=Fr=>{var Bi;(Bi=Fr.preventDefault)==null||Bi.call(Fr),console.error("Map WebGL context lost"),qt(Y("map.mapLostContext"))};En.addEventListener("webglcontextlost",zi,{passive:!1}),he.current.on("error",Fr=>{var Fe,K,ne;const Bi=((Fe=Fr==null?void 0:Fr.error)==null?void 0:Fe.message)||Y("map.unknownMapError");console.error("Mapbox error",(Fr==null?void 0:Fr.error)??Fr);const Pi=he.current;((K=Pi==null?void 0:Pi.loaded)==null?void 0:K.call(Pi))===!0||((ne=Pi==null?void 0:Pi.isStyleLoaded)==null?void 0:ne.call(Pi))===!0||qt(`${Y("map.couldNotLoadMap")}: ${Bi}`)});let on=!1;const Wn=()=>{on||!ft.current||(on=!0,ft.current&&st(!0),requestAnimationFrame(()=>vo()))},qn=Fr=>{var Bi;try{(((Bi=Fr.getStyle())==null?void 0:Bi.layers)??[]).forEach(Ss=>{Ss.id&&(Ss.id.includes("road-number-shield")||Ss.id.includes("road-exit-shield")||Ss.id.includes("hwy-shield")||Ss.id.includes("motorway-junction")||Ss.id.includes("shield"))&&Fr.setLayoutProperty(Ss.id,"visibility","none")})}catch(Pi){console.warn("Failed to hide road distance labels",Pi)}},Bs=Fr=>{const Bi=z3(Fr);return Bi||(console.warn("3D layer failed – falling back to 2D mode"),so(!0),F3(Fr)),qn(Fr),Bi},it=window.setTimeout(()=>{ft.current&&(console.error("Map load timed out"),ft.current&&(st(!0),qt(Y("map.mapLoadTimeout"))))},15e3);let hs=!1;const Xs=()=>{var Bi,Pi,Ss,Fe,K;if(hs)return;const Fr=he.current;if(Fr)try{const ne=((Bi=Fr.isStyleLoaded)==null?void 0:Bi.call(Fr))===!0,fe=((Pi=Fr.loaded)==null?void 0:Pi.call(Fr))===!0;let Ae=!1;if(ne)try{Ae=(((K=(Fe=(Ss=Fr.getStyle)==null?void 0:Ss.call(Fr))==null?void 0:Fe.layers)==null?void 0:K.length)??0)>0}catch{}(ne||fe||Ae)&&(hs=!0,window.clearTimeout(it),Bs(Fr),Wn())}catch(ne){console.warn("unblockIfLoaded check failed, will retry",ne)}};he.current.once("load",Xs),he.current.on("styledata",Xs),he.current.on("idle",Xs),he.current.once("render",Xs);const fs=window.setInterval(Xs,300);window.setTimeout(()=>window.clearInterval(fs),15e3);const zr=()=>{var Fr;try{(Fr=Je.current)==null||Fr.disconnect(),Je.current=null}catch{}window.removeEventListener("resize",vo),window.removeEventListener("orientationchange",vo),document.removeEventListener("visibilitychange",Lo);try{En.removeEventListener("webglcontextlost",zi)}catch{}};he.current.once("remove",zr)}catch(Lr){console.error("Map init failed",Lr),ft.current&&qt(Y("map.couldNotLoadMap"))}finally{kt.current=!1}})(),()=>{var Lr,Zr,tn;kt.current=!1;try{Ie.current.forEach(Wr=>Wr.remove())}catch{}Ie.current=[];try{(Lr=je.current)==null||Lr.remove()}catch{}je.current=null;try{(Zr=Je.current)==null||Zr.disconnect()}catch{}Je.current=null;try{(tn=he.current)==null||tn.remove()}catch{}he.current=null}},[_r]),X.useEffect(()=>{if(!(!he.current||!Et||!ft.current)){try{Ie.current.forEach(At=>At.remove())}catch{}if(Ie.current=[],t.forEach(At=>{var tn,Wr;const sr=document.createElement("div");if(sr.className="mission-marker",(tn=At.sponsor)==null?void 0:tn.logoUrl){const On=((Wr=At.sponsor)==null?void 0:Wr.colorPrimary)||"#6366f1";sr.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="${At.sponsor.logoUrl}"
|
||
alt="${At.sponsor.brandName}"
|
||
class="w-full h-full object-contain p-1.5"
|
||
onerror="this.style.display='none'; this.parentElement.style.background='linear-gradient(145deg, ${On}, ${On}dd)'; this.parentElement.innerHTML='<span style=\\'font-size:20px;font-weight:bold;color:white;\\'>${At.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, ${On}, ${On}cc); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
${At.reward_credits}kr
|
||
</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">
|
||
${At.sponsor.brandName}
|
||
</div>
|
||
</div>
|
||
`}else{const On=fse(At.title);sr.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, ${On.gradient} 0%, ${On.gradientDark} 100%);">
|
||
${On.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: ${On.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);">
|
||
${At.reward_credits}kr
|
||
</div>
|
||
</div>
|
||
`}if(sr.addEventListener("click",()=>{var On;ft.current&&(xt(At),(On=he.current)==null||On.flyTo({center:[At.longitude,At.latitude],zoom:15,pitch:60}))}),!he.current||!ft.current)return;const Zr=new Eu.Marker(sr).setLngLat([At.longitude,At.latitude]).addTo(he.current);Ie.current.push(Zr)}),t.length>1&&!Qe&&!h&&!un.current&&!Nn.current&&he.current&&ft.current)try{Nn.current=!0;const At=new Eu.LngLatBounds;t.forEach(sr=>At.extend([sr.longitude,sr.latitude])),e&&At.extend([e.longitude,e.latitude]),he.current.fitBounds(At,{padding:80,maxZoom:14,pitch:pv})}catch{}}},[t,Et]),X.useEffect(()=>{if(!he.current||!Et||!ft.current||!e)return;je.current&&(je.current.remove(),je.current=null);const At=document.createElement("div");At.className="user-location-marker",At.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>
|
||
`,je.current=new Eu.Marker({element:At,anchor:"center"}).setLngLat([e.longitude,e.latitude]).addTo(he.current)},[e,Et]),X.useEffect(()=>{if(!(!he.current||!Et||!ft.current)){try{Be.current.forEach(At=>At.remove())}catch{}Be.current=[],ee.forEach(At=>{const sr=document.createElement("div");sr.className="beauty-mission-marker";const Lr=At.type==="sponsored",Zr=Lr&&At.sponsorEmoji?`<span style="font-size: 16px;">${At.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>`,tn=At.themeColor;if(sr.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, ${tn}, ${tn}dd);">
|
||
${Zr}
|
||
</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: ${tn}; 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, ${tn}, ${tn}cc); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
${At.reward}kr
|
||
</div>
|
||
${Lr&&At.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: ${tn}; border: 1px solid rgba(255,255,255,0.2);">
|
||
${At.sponsor}
|
||
</div>
|
||
`:""}
|
||
</div>
|
||
`,sr.addEventListener("click",()=>{var On;ft.current&&(Ot(At),xt(null),(On=he.current)==null||On.flyTo({center:[At.longitude,At.latitude],zoom:15,pitch:60}))}),!he.current||!ft.current)return;const Wr=new Eu.Marker(sr).setLngLat([At.longitude,At.latitude]).addTo(he.current);Be.current.push(Wr)})}},[ee,Et]);const Wo=()=>{var At,sr,Lr;try{Ie.current.forEach(Zr=>Zr.remove()),Ie.current=[],Be.current.forEach(Zr=>Zr.remove()),Be.current=[],(At=je.current)==null||At.remove(),je.current=null,(sr=Je.current)==null||sr.disconnect(),Je.current=null,(Lr=he.current)==null||Lr.remove(),he.current=null}catch{}qt(null),st(!1),xt(null),Ot(null),yr(Zr=>Zr+1)};return le.jsxs("div",{ref:$,className:"relative w-full h-full",children:[le.jsx("div",{ref:oe,className:"absolute inset-0"}),mi&&le.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 flex items-center justify-center",children:le.jsxs("div",{className:"relative",children:[le.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"}),le.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"}}),le.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:le.jsx(oO,{className:"w-6 h-6 text-primary animate-bounce"})})]})}),!Et&&!Pt&&le.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/40 backdrop-blur-sm",children:le.jsx("div",{className:"text-sm text-muted-foreground",children:Y("map.loadingMap")})}),Pt&&le.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/40 backdrop-blur-sm p-6",children:le.jsxs("div",{className:"text-center text-muted-foreground max-w-sm bg-card/90 border border-border rounded-lg p-4 shadow-lg",children:[le.jsx(m1,{className:"w-10 h-10 mx-auto mb-2 opacity-60"}),le.jsx("p",{className:"text-sm leading-relaxed",children:Pt}),le.jsx($a,{onClick:Wo,className:"mt-3",variant:"outline",children:Y("map.reloadMap")})]})}),le.jsxs("div",{className:"absolute left-3 z-20 flex items-center gap-2",style:{top:"calc(env(safe-area-inset-top, 0px) + 12px)"},children:[le.jsx("div",{className:"bg-background/80 backdrop-blur-sm rounded-lg p-1.5 shadow-md border border-border/50",children:le.jsx(Jj,{})}),le.jsxs("button",{onClick:()=>{const At=he.current;!At||!Et||(Ks?(F3(At),Un(!1)):(z3(At)?(so(!1),At.easeTo({pitch:pv,bearing:mv,duration:800})):so(!0),Un(!0)))},disabled:!Et,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:[ua?"3D":"2D",io&&le.jsx("span",{className:"ml-1 text-muted-foreground",children:"(auto)"})]}),_&&e&&le.jsxs("button",{onClick:()=>{var Zr;const At=_.geometry.coordinates,sr=At.length>1?At[1]:At[0],Lr=AE(e.latitude,e.longitude,sr[1],sr[0]);(Zr=he.current)==null||Zr.flyTo({center:[e.longitude,e.latitude],zoom:17,pitch:52,bearing:Lr,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:[le.jsx(Gq,{className:"w-4 h-4"}),Y("map.centerOnMe")]})]}),P&&le.jsxs("div",{className:"absolute bottom-32 left-4 right-4 z-40 space-y-3 animate-fade-in",children:[le.jsxs("div",{className:"flex justify-center gap-2",children:[le.jsx("button",{onClick:()=>Gr("walking"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${hr==="walking"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:le.jsx(sO,{className:"w-6 h-6"})}),le.jsx("button",{onClick:()=>Gr("cycling"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${hr==="cycling"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:le.jsx(rO,{className:"w-6 h-6"})}),le.jsx("button",{onClick:()=>Gr("driving"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${hr==="driving"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:le.jsx(nO,{className:"w-6 h-6"})})]}),le.jsx($a,{onClick:()=>w==null?void 0:w(hr),disabled:k,className:"w-full h-14 text-base font-semibold rounded-2xl shadow-xl bg-primary hover:bg-primary/90",children:k?le.jsxs(le.Fragment,{children:[le.jsx(p1,{className:"w-5 h-5 mr-2 animate-spin"}),Y("map.calculating")]}):le.jsxs(le.Fragment,{children:[le.jsx(Dk,{className:"w-5 h-5 mr-2"}),Y("map.startNavigation")]})})]}),(O||k)&&le.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:le.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:[le.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:k?le.jsx(p1,{className:"w-5 h-5 text-primary animate-spin"}):le.jsxs(le.Fragment,{children:[F==="walking"&&le.jsx(sO,{className:"w-5 h-5 text-primary"}),F==="cycling"&&le.jsx(rO,{className:"w-5 h-5 text-primary"}),F==="driving"&&le.jsx(nO,{className:"w-5 h-5 text-primary"})]})}),le.jsx("div",{className:"flex flex-col",children:_?le.jsxs(le.Fragment,{children:[le.jsx("span",{className:"text-lg font-bold text-foreground",children:Are(_.duration)}),le.jsx("span",{className:"text-xs text-muted-foreground",children:Cre(_.distance)})]}):le.jsxs(le.Fragment,{children:[le.jsx("span",{className:"text-base font-medium text-foreground",children:Y("map.calculating")}),le.jsx("span",{className:"text-xs text-muted-foreground",children:Y("map.waitOrCancel")})]})}),le.jsx("button",{onClick:o,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:Y("map.cancelNavigation"),children:le.jsx(Df,{className:"w-5 h-5"})})]})}),(Qe||It)&&e&&O&&le.jsx(wse,{userLocation:e,targetLocation:Qe?{latitude:Qe.latitude,longitude:Qe.longitude}:It?{latitude:It.latitude,longitude:It.longitude}:null,targetName:(Qe==null?void 0:Qe.title)||(It==null?void 0:It.title),deviceHeading:Zn.heading,className:"absolute left-4 right-4 z-50",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 220px)"}}),le.jsxs("div",{className:"fixed left-0 right-0 z-30",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 72px)"},children:[le.jsx("div",{className:"h-px bg-border"}),le.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:le.jsxs("div",{className:"flex gap-3 justify-between items-center",children:[le.jsxs($a,{variant:"ghost",size:"sm",onClick:Fs,disabled:!Ai,className:"flex-1 h-12 text-sm",children:[le.jsx(Kq,{className:"w-5 h-5 mr-2"}),le.jsx("span",{className:"hidden sm:inline",children:Y("map.nearest")}),(Ai==null?void 0:Ai.distance)!==void 0&&le.jsx("span",{className:"ml-1 text-sm text-muted-foreground",children:zb(Ai.distance)})]}),le.jsx("div",{className:"w-px h-8 bg-border"}),le.jsxs($a,{variant:"ghost",size:"sm",onClick:rs,disabled:!us,className:"flex-1 h-12 text-sm",children:[le.jsx(oO,{className:"w-5 h-5 mr-2"}),le.jsx("span",{className:"hidden sm:inline",children:Y("map.cluster")}),us&&le.jsxs("span",{className:"ml-1 text-sm text-muted-foreground",children:[us.count," ",Y("map.missionCount")]})]}),le.jsx("div",{className:"w-px h-8 bg-border"}),le.jsxs($a,{variant:"ghost",size:"sm",onClick:Ho,className:"flex-1 h-12 text-sm",children:[le.jsx(qq,{className:"w-5 h-5 mr-2"}),le.jsx("span",{className:"hidden sm:inline",children:Y("map.popular")})]}),le.jsx("div",{className:"w-px h-8 bg-border"}),le.jsxs($a,{variant:xn?"default":"ghost",size:"sm",onClick:ds,disabled:!e,className:`flex-1 h-12 text-sm ${xn?"bg-primary text-primary-foreground":""}`,children:[xn?le.jsx(QB,{className:"w-5 h-5 mr-2"}):le.jsx(Zq,{className:"w-5 h-5 mr-2"}),le.jsx("span",{className:"hidden sm:inline",children:Y(xn?"map.locked":"map.lock")})]}),le.jsx("div",{className:"w-px h-8 bg-border"}),le.jsx(gse,{isLoading:Is.isLoading,isPlaying:Is.isPlaying,currentState:Is.currentState,onPlay:bs,onStop:Is.stop,className:"flex-1 h-12"})]})})]}),(Qe||It)&&le.jsx("div",{className:"absolute inset-0 z-40",onClick:()=>{xt(null),Ot(null)}}),Qe&&le.jsxs(Jk,{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:P?"calc(env(safe-area-inset-bottom, 0px) + 18rem)":"calc(env(safe-area-inset-bottom, 0px) + 5rem)"},onClick:At=>At.stopPropagation(),onTouchStart:At=>{At.currentTarget._touchStartY=At.touches[0].clientY},onTouchEnd:At=>{const sr=At.currentTarget._touchStartY??0;At.changedTouches[0].clientY-sr>60&&xt(null)},children:[le.jsx("div",{className:"flex justify-center mb-2",children:le.jsx("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/30"})}),le.jsx("button",{onClick:()=>xt(null),className:"absolute top-2 right-2 p-1 rounded-full hover:bg-muted",children:le.jsx(Df,{className:"w-4 h-4"})}),le.jsxs("div",{className:"pr-6",children:[le.jsx("h3",{className:"font-semibold text-lg mb-1",children:Qe.title}),Qe.organization&&le.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:Qe.organization.name}),le.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:Qe.description}),le.jsxs("div",{className:"flex items-center justify-between",children:[le.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[le.jsxs("span",{className:"flex items-center gap-1 text-primary font-medium",children:[le.jsx(JB,{className:"w-4 h-4"}),Qe.reward_credits," kr"]}),Qe.distance!==void 0&&le.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[le.jsx(Dk,{className:"w-4 h-4"}),zb(Qe.distance)]})]}),le.jsx($a,{size:"sm",onClick:()=>s==null?void 0:s(Qe),children:Y("map.viewMission")})]})]})]}),It&&le.jsxs(Jk,{className:"absolute left-4 right-4 p-4 border shadow-xl z-50",style:{bottom:P?"calc(env(safe-area-inset-bottom, 0px) + 18rem)":"calc(env(safe-area-inset-bottom, 0px) + 5rem)",background:`linear-gradient(135deg, hsl(var(--card)) 60%, ${It.themeColor}30)`,borderColor:It.themeColor+"60"},children:[le.jsx("button",{onClick:()=>Ot(null),className:"absolute top-2 right-2 p-1 rounded-full hover:bg-muted",children:le.jsx(Df,{className:"w-4 h-4"})}),le.jsxs("div",{className:"pr-6",children:[le.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[It.type==="sponsored"&&It.sponsorEmoji&&le.jsx("span",{className:"text-xl",children:It.sponsorEmoji}),It.type==="charity"&&le.jsx(Yq,{className:"w-5 h-5",style:{color:It.themeColor}}),le.jsx("h3",{className:"font-semibold text-lg",children:It.title})]}),It.sponsor&&le.jsx("p",{className:"text-sm font-medium mb-1",style:{color:It.themeColor},children:It.sponsor}),le.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:It.location}),le.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:It.description}),le.jsxs("div",{className:"flex items-center justify-between",children:[le.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[le.jsxs("span",{className:"flex items-center gap-1 font-bold px-2 py-1 rounded-full text-white",style:{background:It.themeColor},children:[It.reward," kr"]}),le.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:It.type==="charity"?`🎟️ ${Y("map.lottery")}`:`📸 ${Y("map.campaign")}`})]}),le.jsx($a,{size:"sm",onClick:()=>{Z("/real-change-mission")},style:{background:It.themeColor,color:"white"},children:Y("map.participate")})]})]})]}),le.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;
|
||
}
|
||
`})]})});_V.displayName="MissionMap";const CE="https://api.quixzoom.com/api/qz",Ase=3e4;function Cse(){const{user:t}=qf(),[e,s]=X.useState([]),[u,h]=X.useState(0),[_,w]=X.useState(!0),o=X.useRef(null),k=X.useCallback(async()=>{if(!t){w(!1);return}const F=Sa.getToken();if(!F){w(!1);return}try{const V=await fetch(`${CE}/notifications?limit=50`,{headers:{Authorization:`Bearer ${F}`}});if(V.ok){const $=await V.json();s($.notifications||[]),h($.unread??0)}else V.status===404?(s([]),h(0)):console.error("[useNotifications] fetch error:",V.status)}catch(V){console.error("[useNotifications] network error:",V)}finally{w(!1)}},[t]);return X.useEffect(()=>(k(),o.current=setInterval(k,Ase),()=>{o.current&&clearInterval(o.current)}),[k]),{notifications:e,unreadCount:u,isLoading:_,markAsRead:async F=>{const V=Sa.getToken();if(V)try{(await fetch(`${CE}/notifications/${encodeURIComponent(F)}`,{method:"PATCH",headers:{Authorization:`Bearer ${V}`}})).ok&&(s(Y=>Y.map(Z=>Z.id===F?{...Z,read:!0}:Z)),h(Y=>Math.max(0,Y-1)))}catch($){console.error("[useNotifications] markAsRead error:",$)}},markAllAsRead:async()=>{if(!t)return;const F=Sa.getToken();if(F)try{(await fetch(`${CE}/notifications/read-all`,{method:"PATCH",headers:{Authorization:`Bearer ${F}`}})).ok&&(s($=>$.map(Y=>({...Y,read:!0}))),h(0))}catch(V){console.error("[useNotifications] markAllAsRead error:",V)}}}}const Ise=()=>{const{user:t}=qf(),[e,s]=X.useState(null),[u,h]=X.useState(!0),[_,w]=X.useState(null),o=async()=>{if(!t){s(null),h(!1);return}try{h(!0);const{data:$,error:Y}=await qd.from("orderer_profiles").select("*").eq("user_id",t.id).maybeSingle();if(Y)throw Y;s($),w(null)}catch($){console.error("Error fetching orderer profile:",$),w("Kunde inte hämta beställarprofil")}finally{h(!1)}};X.useEffect(()=>{o()},[t]);const k=async $=>{if(!t)return{error:"Inte inloggad"};try{const{data:Y,error:Z}=await qd.from("orderer_profiles").insert({user_id:t.id,...$}).select().single();if(Z)throw Z;return s(Y),{data:Y,error:null}}catch(Y){return console.error("Error creating orderer profile:",Y),Y.code==="23505"?{error:"En beställarprofil finns redan för detta konto eller organisationsnummer"}:{error:"Kunde inte skapa beställarprofil"}}},P=async $=>{if(!t||!e)return{error:"Ingen beställarprofil att uppdatera"};try{const{data:Y,error:Z}=await qd.from("orderer_profiles").update($).eq("user_id",t.id).select().single();if(Z)throw Z;return s(Y),{data:Y,error:null}}catch(Y){return console.error("Error updating orderer profile:",Y),{error:"Kunde inte uppdatera beställarprofil"}}},O=(e==null?void 0:e.status)==="active",F=(e==null?void 0:e.status)==="pending",V=O&&(e.payment_method==="stripe"||e.credit_approved);return{ordererProfile:e,isLoading:u,error:_,isActiveOrderer:O,isPendingOrderer:F,canOrder:V,createOrdererProfile:k,updateOrdererProfile:P,refetch:o}},yV=X.forwardRef(({className:t},e)=>le.jsxs("div",{ref:e,className:`relative ${t}`,children:[le.jsx(YB,{className:"w-6 h-6"}),le.jsx(Hq,{className:"absolute -top-1 -left-1.5 w-3.5 h-3.5 stroke-[3]"})]}));yV.displayName="CameraDollarIcon";const vV=X.forwardRef((t,e)=>{const s=r_(),u=Wf(),{t:h}=Kf(),{user:_}=qf(),{unreadCount:w}=Cse();Ise();const o=!!_,P=[{id:"home",icon:yV,labelKey:"missions.title",path:"/"},{id:"map",icon:Wq,labelKey:"nav.map",path:"/map"},{id:"notifications",icon:Bq,labelKey:"nav.notifications",path:"/notifications"},{id:"wallet",icon:r9,labelKey:"nav.wallet",path:"/wallet"}],F=(()=>{const Y=u.pathname;if(Y==="/profile")return"profile";if(Y==="/auth")return"auth";if(Y.startsWith("/orderer/"))return"dashboard";const Z=P.find(se=>se.path===Y);return Z?Z.id:"home"})(),V=Y=>{if(Y.requiresAuth&&!o){ro.info(h("auth.loginRequired","Logga in för att använda denna funktion")),s("/auth");return}s(Y.path)},$=()=>{s(o?"/profile":"/auth")};return le.jsxs("nav",{ref:e,className:"fixed bottom-0 left-0 right-0 z-40 safe-area-x",children:[le.jsx("div",{className:"absolute inset-0 bg-background/95 backdrop-blur-xl border-t border-border/50"}),le.jsxs("div",{className:"relative flex items-center justify-around px-1 pt-3 pb-3 safe-area-bottom",children:[P.map(Y=>{const Z=F===Y.id,se=Y.icon,te=Y.requiresAuth&&!o,ee=Y.id==="notifications"&&w>0&&!te;return le.jsxs("button",{onClick:()=>V(Y),title:h(Y.labelKey),"aria-label":h(Y.labelKey),className:"relative flex items-center justify-center min-w-[56px] min-h-[48px] py-2 px-3 group touch-target",children:[Z&&!te&&le.jsx("div",{className:"absolute inset-0 rounded-2xl bg-primary/10"}),le.jsxs(_0.div,{animate:{scale:Z?1.1:1},transition:{type:"spring",stiffness:500,damping:30},className:"relative z-10",children:[le.jsx(se,{className:`w-6 h-6 transition-colors ${te?"text-muted-foreground/50":Z?"text-primary":"text-muted-foreground group-hover:text-foreground"}`}),ee&&le.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:w>9?"9+":w})]}),le.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:h(Y.labelKey)})]},Y.id)}),le.jsxs("button",{onClick:$,title:o?h("nav.profile"):h("auth.login","Logga in"),"aria-label":o?h("nav.profile"):h("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:[(F==="profile"&&o||F==="auth"&&!o)&&le.jsx("div",{className:"absolute inset-0 rounded-2xl bg-primary/10"}),le.jsx(_0.div,{whileTap:{scale:.95},className:"relative z-10",children:o?le.jsx(Qq,{className:`w-6 h-6 transition-colors ${F==="profile"?"text-primary":"text-muted-foreground group-hover:text-foreground"}`}):le.jsx(Xq,{className:"w-6 h-6 transition-colors text-primary"})}),le.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:o?h("nav.profile"):h("auth.login","Logga in")})]})]})]})});vV.displayName="BottomNav";const RA="https://api.quixzoom.com/api/qz",Pse=(t,e,s={})=>{const{isTooFast:u=!1,activeClaimMissionId:h=null}=s,[_,w]=X.useState([]),[o,k]=X.useState(!0),[P,O]=X.useState(null),[F,V]=X.useState(60),{user:$}=qf(),Y=X.useRef(F),Z=X.useRef(t),se=X.useRef(e),te=X.useRef(!1);X.useEffect(()=>{Y.current=F},[F]),X.useEffect(()=>{Z.current=t,se.current=e},[t,e]),X.useEffect(()=>{(async()=>{if(!$)return;const Ie=Sa.getToken();if(Ie)try{const Be=await fetch(`${RA}/missions/stats`,{headers:{Authorization:`Bearer ${Ie}`}});if(Be.ok){const je=await Be.json();(je==null?void 0:je.visibility_delay_seconds)!=null&&V(je.visibility_delay_seconds)}}catch{}})()},[$==null?void 0:$.id]);const ee=X.useCallback(async(he=!1)=>{he&&!te.current&&k(!0);try{const Ie=new URLSearchParams({limit:"200",status:"active"}),Be=Z.current,je=se.current,Je=await fetch(`${RA}/missions?${Ie.toString()}`);if(!Je.ok){const xt=await Je.json().catch(()=>({error:`HTTP ${Je.status}`}));O(xt.error||"Kunde inte hämta uppdrag"),k(!1);return}const kt=(await Je.json()).missions||[],tr=Date.now(),jt=Y.current;let Qe=kt.map(xt=>{const It=new Date(xt.created_at).getTime(),Ot=jt*1e3,Et=It+Ot,st=tr<Et,Pt=st?Math.ceil((Et-tr)/1e3):0,qt=parseFloat(String(xt.latitude??xt.lat??0)),_r=parseFloat(String(xt.longitude??xt.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,...xt,latitude:qt,longitude:_r,reward_credits:Number(xt.reward_credits??xt.credits??0),distance:Be&&je?NX(Be,je,qt,_r):void 0,isDelayed:st,delayRemaining:Pt,organization:null,sponsor:null}});Qe=Qe.filter(xt=>!xt.isDelayed),Be&&je&&(Qe=Qe.sort((xt,It)=>(xt.distance||1/0)-(It.distance||1/0))),w(Qe),O(null),te.current=!0}catch{O("Ett oväntat fel uppstod")}finally{k(!1)}},[]);return X.useEffect(()=>{ee(!0);const he=setInterval(()=>ee(!1),6e4);return()=>clearInterval(he)},[ee]),X.useEffect(()=>{te.current&&t!==null&&e!==null&&ee(!1)},[t,e,ee]),{missions:X.useMemo(()=>u?[]:h?_.filter(he=>he.id===h):_,[_,u,h]),allMissions:_,loading:o,error:P,visibilityDelay:F,isSpeedLocked:u,isFocusMode:!!h,refetch:()=>ee(!1)}},$ue=t=>{const[e,s]=X.useState(null),[u,h]=X.useState(!0),[_,w]=X.useState(null);return X.useEffect(()=>{if(!t){h(!1);return}(async()=>{h(!0);try{const k=await fetch(`${RA}/missions/${encodeURIComponent(t)}`);if(!k.ok){if(k.status===404)s(null);else{const V=await k.json().catch(()=>({error:`HTTP ${k.status}`}));w(V.error||"Kunde inte hämta uppdraget")}h(!1);return}const P=await k.json(),O="mission"in P&&P.mission?P.mission:P,F={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,...O,latitude:parseFloat(String(O.latitude??O.lat??0)),longitude:parseFloat(String(O.longitude??O.lon??0)),reward_credits:Number(O.reward_credits??O.credits??0),organization:null,sponsor:null};s(F)}catch{w("Nätverksfel")}finally{h(!1)}})()},[t]),{mission:e,loading:u,error:_}},B3="https://api.quixzoom.com/api/qz";function N3(t){return{id:t.id||"",user_id:t.id||"",email:t.email||"",display_name:t.display_name||t.name||null,phone_number:t.phone_number||t.phone||null,reach_meters:t.reach_meters??5e3,swish_number:t.swish_number||null,sms_notifications_enabled:t.sms_notifications_enabled??!1,voice_id:t.voice_id||null,self_accounting:t.self_accounting??!1,earnings_growth_enabled:t.earnings_growth_enabled??!1,earnings_growth_type:t.earnings_growth_type||"deposit",avatar_url:t.avatar_url||null,identity_verified:t.identity_verified??!1,identity_verified_at:t.identity_verified_at||null,city:t.city||null,gender:t.gender||null,birth_year:t.birth_year||null,global_mode:t.global_mode??!1}}const Mse=()=>{const[t,e]=X.useState(null),[s,u]=X.useState(!0),[h,_]=X.useState(null),w=X.useCallback(async()=>{const k=Sa.getToken();if(!k){e(null),u(!1);return}try{const P=await fetch(`${B3}/auth/me`,{headers:{Authorization:`Bearer ${k}`}});if(!P.ok){P.status===401?e(null):_(`Kunde inte hämta profil (${P.status})`),u(!1);return}const O=await P.json(),F=O.user||O;e(N3(F)),_(null)}catch{_("Nätverksfel — försök igen")}finally{u(!1)}},[]);return X.useEffect(()=>{w()},[w]),{profile:t,isLoading:s,error:h,updateProfile:async k=>{const P=Sa.getToken();if(!P)return{error:new Error("Not authenticated"),data:null};try{const O=await fetch(`${B3}/auth/me`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${P}`},body:JSON.stringify(k)});if(!O.ok){const Y=await O.json().catch(()=>({}));return{error:new Error(Y.error||`Update failed (${O.status})`),data:null}}const F=await O.json(),V=F.user||F,$=N3(V);return e($),{error:null,data:$}}catch(O){return{error:O instanceof Error?O:new Error("Network error"),data:null}}},refetch:w}},Rse="https://api.quixzoom.com/api/qz",Dse=15e3,Lse=t=>{const[e,s]=X.useState(null),[u,h]=X.useState(!0),{user:_}=qf(),w=X.useRef(null),o=X.useCallback(async()=>{if(!_){s(null),h(!1);return}const k=Sa.getToken();if(!k){s(null),h(!1);return}try{const P=t?`?mission_id=${encodeURIComponent(t)}`:"",O=await fetch(`${Rse}/missions/claims/active${P}`,{headers:{Authorization:`Bearer ${k}`}});if(O.ok){const F=await O.json();s(F.claim??null)}else O.status===404?s(null):console.error("[useActiveClaim] fetch error:",O.status)}catch(P){console.error("[useActiveClaim] network error:",P)}finally{h(!1)}},[_,t]);return X.useEffect(()=>(o(),w.current=setInterval(o,Dse),()=>{w.current&&clearInterval(w.current)}),[o]),{activeClaim:e,hasActiveClaim:!!e,loading:u,refetch:o}},Ose=({missionTitle:t,isVisible:e})=>{const{t:s}=Kf();return e?le.jsx(_0.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"fixed bottom-32 right-4 z-40 max-w-[280px]",children:le.jsx("div",{className:"bg-primary/95 backdrop-blur-sm text-primary-foreground rounded-xl px-4 py-3 shadow-lg border border-primary",children:le.jsxs("div",{className:"flex items-center gap-3",children:[le.jsx("div",{className:"p-2 bg-primary-foreground/20 rounded-full flex-shrink-0",children:le.jsx(eN,{className:"h-4 w-4"})}),le.jsxs("div",{className:"flex-1 min-w-0",children:[le.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[le.jsx(QB,{className:"h-3 w-3 flex-shrink-0"}),le.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide opacity-80",children:s("map.focusMode")})]}),le.jsx("p",{className:"text-sm font-medium leading-tight",title:t,children:t.length>30?t.slice(0,30)+"...":t})]})]})})}):null};var IE="focusScope.autoFocusOnMount",PE="focusScope.autoFocusOnUnmount",j3={bubbles:!1,cancelable:!0},zse="FocusScope",xV=X.forwardRef((t,e)=>{const{loop:s=!1,trapped:u=!1,onMountAutoFocus:h,onUnmountAutoFocus:_,...w}=t,[o,k]=X.useState(null),P=Xc(h),O=Xc(_),F=X.useRef(null),V=Os(e,Z=>k(Z)),$=X.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;X.useEffect(()=>{if(u){let Z=function(oe){if($.paused||!o)return;const he=oe.target;o.contains(he)?F.current=he:Rd(F.current,{select:!0})},se=function(oe){if($.paused||!o)return;const he=oe.relatedTarget;he!==null&&(o.contains(he)||Rd(F.current,{select:!0}))},te=function(oe){if(document.activeElement===document.body)for(const Ie of oe)Ie.removedNodes.length>0&&Rd(o)};document.addEventListener("focusin",Z),document.addEventListener("focusout",se);const ee=new MutationObserver(te);return o&&ee.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",Z),document.removeEventListener("focusout",se),ee.disconnect()}}},[u,o,$.paused]),X.useEffect(()=>{if(o){U3.add($);const Z=document.activeElement;if(!o.contains(Z)){const te=new CustomEvent(IE,j3);o.addEventListener(IE,P),o.dispatchEvent(te),te.defaultPrevented||(Fse(Use(wV(o)),{select:!0}),document.activeElement===Z&&Rd(o))}return()=>{o.removeEventListener(IE,P),setTimeout(()=>{const te=new CustomEvent(PE,j3);o.addEventListener(PE,O),o.dispatchEvent(te),te.defaultPrevented||Rd(Z??document.body,{select:!0}),o.removeEventListener(PE,O),U3.remove($)},0)}}},[o,P,O,$]);const Y=X.useCallback(Z=>{if(!s&&!u||$.paused)return;const se=Z.key==="Tab"&&!Z.altKey&&!Z.ctrlKey&&!Z.metaKey,te=document.activeElement;if(se&&te){const ee=Z.currentTarget,[oe,he]=Bse(ee);oe&&he?!Z.shiftKey&&te===he?(Z.preventDefault(),s&&Rd(oe,{select:!0})):Z.shiftKey&&te===oe&&(Z.preventDefault(),s&&Rd(he,{select:!0})):te===ee&&Z.preventDefault()}},[s,u,$.paused]);return le.jsx(qi.div,{tabIndex:-1,...w,ref:V,onKeyDown:Y})});xV.displayName=zse;function Fse(t,{select:e=!1}={}){const s=document.activeElement;for(const u of t)if(Rd(u,{select:e}),document.activeElement!==s)return}function Bse(t){const e=wV(t),s=V3(e,t),u=V3(e.reverse(),t);return[s,u]}function wV(t){const e=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const h=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||h?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)e.push(s.currentNode);return e}function V3(t,e){for(const s of t)if(!Nse(s,{upTo:e}))return s}function Nse(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function jse(t){return t instanceof HTMLInputElement&&"select"in t}function Rd(t,{select:e=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&jse(t)&&e&&t.select()}}var U3=Vse();function Vse(){let t=[];return{add(e){const s=t[0];e!==s&&(s==null||s.pause()),t=$3(t,e),t.unshift(e)},remove(e){var s;t=$3(t,e),(s=t[0])==null||s.resume()}}}function $3(t,e){const s=[...t],u=s.indexOf(e);return u!==-1&&s.splice(u,1),s}function Use(t){return t.filter(e=>e.tagName!=="A")}var ME=0;function $se(){X.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??G3()),document.body.insertAdjacentElement("beforeend",t[1]??G3()),ME++,()=>{ME===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),ME--}},[])}function G3(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Vb="right-scroll-bar-position",Ub="width-before-scroll-bar",Gse="with-scroll-bars-hidden",Hse="--removed-body-scroll-bar-size";function RE(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Wse(t,e){var s=X.useState(function(){return{value:t,callback:e,facade:{get current(){return s.value},set current(u){var h=s.value;h!==u&&(s.value=u,s.callback(u,h))}}}})[0];return s.callback=e,s.facade}var qse=typeof window<"u"?X.useLayoutEffect:X.useEffect,H3=new WeakMap;function Kse(t,e){var s=Wse(null,function(u){return t.forEach(function(h){return RE(h,u)})});return qse(function(){var u=H3.get(s);if(u){var h=new Set(u),_=new Set(t),w=s.current;h.forEach(function(o){_.has(o)||RE(o,null)}),_.forEach(function(o){h.has(o)||RE(o,w)})}H3.set(s,t)},[t]),s}function Zse(t){return t}function Xse(t,e){e===void 0&&(e=Zse);var s=[],u=!1,h={read:function(){if(u)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]:t},useMedium:function(_){var w=e(_,u);return s.push(w),function(){s=s.filter(function(o){return o!==w})}},assignSyncMedium:function(_){for(u=!0;s.length;){var w=s;s=[],w.forEach(_)}s={push:function(o){return _(o)},filter:function(){return s}}},assignMedium:function(_){u=!0;var w=[];if(s.length){var o=s;s=[],o.forEach(_),w=s}var k=function(){var O=w;w=[],O.forEach(_)},P=function(){return Promise.resolve().then(k)};P(),s={push:function(O){w.push(O),P()},filter:function(O){return w=w.filter(O),s}}}};return h}function Yse(t){t===void 0&&(t={});var e=Xse(null);return e.options=Uc({async:!0,ssr:!1},t),e}var bV=function(t){var e=t.sideCar,s=o_(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var u=e.read();if(!u)throw new Error("Sidecar medium not found");return X.createElement(u,Uc({},s))};bV.isSideCarExport=!0;function Jse(t,e){return t.useMedium(e),bV}var SV=Yse(),DE=function(){},gS=X.forwardRef(function(t,e){var s=X.useRef(null),u=X.useState({onScrollCapture:DE,onWheelCapture:DE,onTouchMoveCapture:DE}),h=u[0],_=u[1],w=t.forwardProps,o=t.children,k=t.className,P=t.removeScrollBar,O=t.enabled,F=t.shards,V=t.sideCar,$=t.noRelative,Y=t.noIsolation,Z=t.inert,se=t.allowPinchZoom,te=t.as,ee=te===void 0?"div":te,oe=t.gapMode,he=o_(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),Ie=V,Be=Kse([s,e]),je=Uc(Uc({},he),h);return X.createElement(X.Fragment,null,O&&X.createElement(Ie,{sideCar:SV,removeScrollBar:P,shards:F,noRelative:$,noIsolation:Y,inert:Z,setCallbacks:_,allowPinchZoom:!!se,lockRef:s,gapMode:oe}),w?X.cloneElement(X.Children.only(o),Uc(Uc({},je),{ref:Be})):X.createElement(ee,Uc({},je,{className:k,ref:Be}),o))});gS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gS.classNames={fullWidth:Ub,zeroRight:Vb};var Qse=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function eoe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Qse();return e&&t.setAttribute("nonce",e),t}function toe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function roe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var noe=function(){var t=0,e=null;return{add:function(s){t==0&&(e=eoe())&&(toe(e,s),roe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},ioe=function(){var t=noe();return function(e,s){X.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&s])}},TV=function(){var t=ioe(),e=function(s){var u=s.styles,h=s.dynamic;return t(u,h),null};return e},soe={left:0,top:0,right:0,gap:0},LE=function(t){return parseInt(t||"",10)||0},ooe=function(t){var e=window.getComputedStyle(document.body),s=e[t==="padding"?"paddingLeft":"marginLeft"],u=e[t==="padding"?"paddingTop":"marginTop"],h=e[t==="padding"?"paddingRight":"marginRight"];return[LE(s),LE(u),LE(h)]},aoe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return soe;var e=ooe(t),s=document.documentElement.clientWidth,u=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,u-s+e[2]-e[0])}},loe=TV(),Eg="data-scroll-locked",coe=function(t,e,s,u){var h=t.left,_=t.top,w=t.right,o=t.gap;return s===void 0&&(s="margin"),`
|
||
.`.concat(Gse,` {
|
||
overflow: hidden `).concat(u,`;
|
||
padding-right: `).concat(o,"px ").concat(u,`;
|
||
}
|
||
body[`).concat(Eg,`] {
|
||
overflow: hidden `).concat(u,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([e&&"position: relative ".concat(u,";"),s==="margin"&&`
|
||
padding-left: `.concat(h,`px;
|
||
padding-top: `).concat(_,`px;
|
||
padding-right: `).concat(w,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(o,"px ").concat(u,`;
|
||
`),s==="padding"&&"padding-right: ".concat(o,"px ").concat(u,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(Vb,` {
|
||
right: `).concat(o,"px ").concat(u,`;
|
||
}
|
||
|
||
.`).concat(Ub,` {
|
||
margin-right: `).concat(o,"px ").concat(u,`;
|
||
}
|
||
|
||
.`).concat(Vb," .").concat(Vb,` {
|
||
right: 0 `).concat(u,`;
|
||
}
|
||
|
||
.`).concat(Ub," .").concat(Ub,` {
|
||
margin-right: 0 `).concat(u,`;
|
||
}
|
||
|
||
body[`).concat(Eg,`] {
|
||
`).concat(Hse,": ").concat(o,`px;
|
||
}
|
||
`)},W3=function(){var t=parseInt(document.body.getAttribute(Eg)||"0",10);return isFinite(t)?t:0},uoe=function(){X.useEffect(function(){return document.body.setAttribute(Eg,(W3()+1).toString()),function(){var t=W3()-1;t<=0?document.body.removeAttribute(Eg):document.body.setAttribute(Eg,t.toString())}},[])},doe=function(t){var e=t.noRelative,s=t.noImportant,u=t.gapMode,h=u===void 0?"margin":u;uoe();var _=X.useMemo(function(){return aoe(h)},[h]);return X.createElement(loe,{styles:coe(_,!e,h,s?"":"!important")})},DA=!1;if(typeof window<"u")try{var gb=Object.defineProperty({},"passive",{get:function(){return DA=!0,!0}});window.addEventListener("test",gb,gb),window.removeEventListener("test",gb,gb)}catch{DA=!1}var $m=DA?{passive:!1}:!1,hoe=function(t){return t.tagName==="TEXTAREA"},EV=function(t,e){if(!(t instanceof Element))return!1;var s=window.getComputedStyle(t);return s[e]!=="hidden"&&!(s.overflowY===s.overflowX&&!hoe(t)&&s[e]==="visible")},foe=function(t){return EV(t,"overflowY")},poe=function(t){return EV(t,"overflowX")},q3=function(t,e){var s=e.ownerDocument,u=e;do{typeof ShadowRoot<"u"&&u instanceof ShadowRoot&&(u=u.host);var h=kV(t,u);if(h){var _=AV(t,u),w=_[1],o=_[2];if(w>o)return!0}u=u.parentNode}while(u&&u!==s.body);return!1},moe=function(t){var e=t.scrollTop,s=t.scrollHeight,u=t.clientHeight;return[e,s,u]},goe=function(t){var e=t.scrollLeft,s=t.scrollWidth,u=t.clientWidth;return[e,s,u]},kV=function(t,e){return t==="v"?foe(e):poe(e)},AV=function(t,e){return t==="v"?moe(e):goe(e)},_oe=function(t,e){return t==="h"&&e==="rtl"?-1:1},yoe=function(t,e,s,u,h){var _=_oe(t,window.getComputedStyle(e).direction),w=_*u,o=s.target,k=e.contains(o),P=!1,O=w>0,F=0,V=0;do{if(!o)break;var $=AV(t,o),Y=$[0],Z=$[1],se=$[2],te=Z-se-_*Y;(Y||te)&&kV(t,o)&&(F+=te,V+=Y);var ee=o.parentNode;o=ee&&ee.nodeType===Node.DOCUMENT_FRAGMENT_NODE?ee.host:ee}while(!k&&o!==document.body||k&&(e.contains(o)||e===o));return(O&&Math.abs(F)<1||!O&&Math.abs(V)<1)&&(P=!0),P},_b=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},K3=function(t){return[t.deltaX,t.deltaY]},Z3=function(t){return t&&"current"in t?t.current:t},voe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},xoe=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},woe=0,Gm=[];function boe(t){var e=X.useRef([]),s=X.useRef([0,0]),u=X.useRef(),h=X.useState(woe++)[0],_=X.useState(TV)[0],w=X.useRef(t);X.useEffect(function(){w.current=t},[t]),X.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(h));var Z=Pre([t.lockRef.current],(t.shards||[]).map(Z3),!0).filter(Boolean);return Z.forEach(function(se){return se.classList.add("allow-interactivity-".concat(h))}),function(){document.body.classList.remove("block-interactivity-".concat(h)),Z.forEach(function(se){return se.classList.remove("allow-interactivity-".concat(h))})}}},[t.inert,t.lockRef.current,t.shards]);var o=X.useCallback(function(Z,se){if("touches"in Z&&Z.touches.length===2||Z.type==="wheel"&&Z.ctrlKey)return!w.current.allowPinchZoom;var te=_b(Z),ee=s.current,oe="deltaX"in Z?Z.deltaX:ee[0]-te[0],he="deltaY"in Z?Z.deltaY:ee[1]-te[1],Ie,Be=Z.target,je=Math.abs(oe)>Math.abs(he)?"h":"v";if("touches"in Z&&je==="h"&&Be.type==="range")return!1;var Je=q3(je,Be);if(!Je)return!0;if(Je?Ie=je:(Ie=je==="v"?"h":"v",Je=q3(je,Be)),!Je)return!1;if(!u.current&&"changedTouches"in Z&&(oe||he)&&(u.current=Ie),!Ie)return!0;var ft=u.current||Ie;return yoe(ft,se,Z,ft==="h"?oe:he)},[]),k=X.useCallback(function(Z){var se=Z;if(!(!Gm.length||Gm[Gm.length-1]!==_)){var te="deltaY"in se?K3(se):_b(se),ee=e.current.filter(function(Ie){return Ie.name===se.type&&(Ie.target===se.target||se.target===Ie.shadowParent)&&voe(Ie.delta,te)})[0];if(ee&&ee.should){se.cancelable&&se.preventDefault();return}if(!ee){var oe=(w.current.shards||[]).map(Z3).filter(Boolean).filter(function(Ie){return Ie.contains(se.target)}),he=oe.length>0?o(se,oe[0]):!w.current.noIsolation;he&&se.cancelable&&se.preventDefault()}}},[]),P=X.useCallback(function(Z,se,te,ee){var oe={name:Z,delta:se,target:te,should:ee,shadowParent:Soe(te)};e.current.push(oe),setTimeout(function(){e.current=e.current.filter(function(he){return he!==oe})},1)},[]),O=X.useCallback(function(Z){s.current=_b(Z),u.current=void 0},[]),F=X.useCallback(function(Z){P(Z.type,K3(Z),Z.target,o(Z,t.lockRef.current))},[]),V=X.useCallback(function(Z){P(Z.type,_b(Z),Z.target,o(Z,t.lockRef.current))},[]);X.useEffect(function(){return Gm.push(_),t.setCallbacks({onScrollCapture:F,onWheelCapture:F,onTouchMoveCapture:V}),document.addEventListener("wheel",k,$m),document.addEventListener("touchmove",k,$m),document.addEventListener("touchstart",O,$m),function(){Gm=Gm.filter(function(Z){return Z!==_}),document.removeEventListener("wheel",k,$m),document.removeEventListener("touchmove",k,$m),document.removeEventListener("touchstart",O,$m)}},[]);var $=t.removeScrollBar,Y=t.inert;return X.createElement(X.Fragment,null,Y?X.createElement(_,{styles:xoe(h)}):null,$?X.createElement(doe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Soe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Toe=Jse(SV,boe);var CV=X.forwardRef(function(t,e){return X.createElement(gS,Uc({},t,{ref:e,sideCar:Toe}))});CV.classNames=gS.classNames;var Eoe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Hm=new WeakMap,yb=new WeakMap,vb={},OE=0,IV=function(t){return t&&(t.host||IV(t.parentNode))},koe=function(t,e){return e.map(function(s){if(t.contains(s))return s;var u=IV(s);return u&&t.contains(u)?u:(console.error("aria-hidden",s,"in not contained inside",t,". Doing nothing"),null)}).filter(function(s){return!!s})},Aoe=function(t,e,s,u){var h=koe(e,Array.isArray(t)?t:[t]);vb[s]||(vb[s]=new WeakMap);var _=vb[s],w=[],o=new Set,k=new Set(h),P=function(F){!F||o.has(F)||(o.add(F),P(F.parentNode))};h.forEach(P);var O=function(F){!F||k.has(F)||Array.prototype.forEach.call(F.children,function(V){if(o.has(V))O(V);else try{var $=V.getAttribute(u),Y=$!==null&&$!=="false",Z=(Hm.get(V)||0)+1,se=(_.get(V)||0)+1;Hm.set(V,Z),_.set(V,se),w.push(V),Z===1&&Y&&yb.set(V,!0),se===1&&V.setAttribute(s,"true"),Y||V.setAttribute(u,"true")}catch(te){console.error("aria-hidden: cannot operate on ",V,te)}})};return O(e),o.clear(),OE++,function(){w.forEach(function(F){var V=Hm.get(F)-1,$=_.get(F)-1;Hm.set(F,V),_.set(F,$),V||(yb.has(F)||F.removeAttribute(u),yb.delete(F)),$||F.removeAttribute(s)}),OE--,OE||(Hm=new WeakMap,Hm=new WeakMap,yb=new WeakMap,vb={})}},Coe=function(t,e,s){s===void 0&&(s="data-aria-hidden");var u=Array.from(Array.isArray(t)?t:[t]),h=Eoe(t);return h?(u.push.apply(u,Array.from(h.querySelectorAll("[aria-live]"))),Aoe(u,h,s,"aria-hidden")):function(){return null}},_S="Dialog",[PV,Gue]=Zg(_S),[Ioe,fc]=PV(_S),MV=t=>{const{__scopeDialog:e,children:s,open:u,defaultOpen:h,onOpenChange:_,modal:w=!0}=t,o=X.useRef(null),k=X.useRef(null),[P,O]=J1({prop:u,defaultProp:h??!1,onChange:_,caller:_S});return le.jsx(Ioe,{scope:e,triggerRef:o,contentRef:k,contentId:Lb(),titleId:Lb(),descriptionId:Lb(),open:P,onOpenChange:O,onOpenToggle:X.useCallback(()=>O(F=>!F),[O]),modal:w,children:s})};MV.displayName=_S;var RV="DialogTrigger",DV=X.forwardRef((t,e)=>{const{__scopeDialog:s,...u}=t,h=fc(RV,s),_=Os(e,h.triggerRef);return le.jsx(qi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":h.open,"aria-controls":h.contentId,"data-state":jI(h.open),...u,ref:_,onClick:Ei(t.onClick,h.onOpenToggle)})});DV.displayName=RV;var BI="DialogPortal",[Poe,LV]=PV(BI,{forceMount:void 0}),OV=t=>{const{__scopeDialog:e,forceMount:s,children:u,container:h}=t,_=fc(BI,e);return le.jsx(Poe,{scope:e,forceMount:s,children:X.Children.map(u,w=>le.jsx(Xg,{present:s||_.open,children:le.jsx(DC,{asChild:!0,container:h,children:w})}))})};OV.displayName=BI;var L1="DialogOverlay",zV=X.forwardRef((t,e)=>{const s=LV(L1,t.__scopeDialog),{forceMount:u=s.forceMount,...h}=t,_=fc(L1,t.__scopeDialog);return _.modal?le.jsx(Xg,{present:u||_.open,children:le.jsx(Roe,{...h,ref:e})}):null});zV.displayName=L1;var Moe=n0("DialogOverlay.RemoveScroll"),Roe=X.forwardRef((t,e)=>{const{__scopeDialog:s,...u}=t,h=fc(L1,s);return le.jsx(CV,{as:Moe,allowPinchZoom:!0,shards:[h.contentRef],children:le.jsx(qi.div,{"data-state":jI(h.open),...u,ref:e,style:{pointerEvents:"auto",...u.style}})})}),$f="DialogContent",FV=X.forwardRef((t,e)=>{const s=LV($f,t.__scopeDialog),{forceMount:u=s.forceMount,...h}=t,_=fc($f,t.__scopeDialog);return le.jsx(Xg,{present:u||_.open,children:_.modal?le.jsx(Doe,{...h,ref:e}):le.jsx(Loe,{...h,ref:e})})});FV.displayName=$f;var Doe=X.forwardRef((t,e)=>{const s=fc($f,t.__scopeDialog),u=X.useRef(null),h=Os(e,s.contentRef,u);return X.useEffect(()=>{const _=u.current;if(_)return Coe(_)},[]),le.jsx(BV,{...t,ref:h,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ei(t.onCloseAutoFocus,_=>{var w;_.preventDefault(),(w=s.triggerRef.current)==null||w.focus()}),onPointerDownOutside:Ei(t.onPointerDownOutside,_=>{const w=_.detail.originalEvent,o=w.button===0&&w.ctrlKey===!0;(w.button===2||o)&&_.preventDefault()}),onFocusOutside:Ei(t.onFocusOutside,_=>_.preventDefault())})}),Loe=X.forwardRef((t,e)=>{const s=fc($f,t.__scopeDialog),u=X.useRef(!1),h=X.useRef(!1);return le.jsx(BV,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:_=>{var w,o;(w=t.onCloseAutoFocus)==null||w.call(t,_),_.defaultPrevented||(u.current||(o=s.triggerRef.current)==null||o.focus(),_.preventDefault()),u.current=!1,h.current=!1},onInteractOutside:_=>{var k,P;(k=t.onInteractOutside)==null||k.call(t,_),_.defaultPrevented||(u.current=!0,_.detail.originalEvent.type==="pointerdown"&&(h.current=!0));const w=_.target;((P=s.triggerRef.current)==null?void 0:P.contains(w))&&_.preventDefault(),_.detail.originalEvent.type==="focusin"&&h.current&&_.preventDefault()}})}),BV=X.forwardRef((t,e)=>{const{__scopeDialog:s,trapFocus:u,onOpenAutoFocus:h,onCloseAutoFocus:_,...w}=t,o=fc($f,s),k=X.useRef(null),P=Os(e,k);return $se(),le.jsxs(le.Fragment,{children:[le.jsx(xV,{asChild:!0,loop:!0,trapped:u,onMountAutoFocus:h,onUnmountAutoFocus:_,children:le.jsx(Y1,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":jI(o.open),...w,ref:P,onDismiss:()=>o.onOpenChange(!1)})}),le.jsxs(le.Fragment,{children:[le.jsx(Ooe,{titleId:o.titleId}),le.jsx(Foe,{contentRef:k,descriptionId:o.descriptionId})]})]})}),NI="DialogTitle",NV=X.forwardRef((t,e)=>{const{__scopeDialog:s,...u}=t,h=fc(NI,s);return le.jsx(qi.h2,{id:h.titleId,...u,ref:e})});NV.displayName=NI;var jV="DialogDescription",VV=X.forwardRef((t,e)=>{const{__scopeDialog:s,...u}=t,h=fc(jV,s);return le.jsx(qi.p,{id:h.descriptionId,...u,ref:e})});VV.displayName=jV;var UV="DialogClose",$V=X.forwardRef((t,e)=>{const{__scopeDialog:s,...u}=t,h=fc(UV,s);return le.jsx(qi.button,{type:"button",...u,ref:e,onClick:Ei(t.onClick,()=>h.onOpenChange(!1))})});$V.displayName=UV;function jI(t){return t?"open":"closed"}var GV="DialogTitleWarning",[Hue,HV]=$W(GV,{contentName:$f,titleName:NI,docsSlug:"dialog"}),Ooe=({titleId:t})=>{const e=HV(GV),s=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
||
|
||
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||
|
||
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return X.useEffect(()=>{t&&(document.getElementById(t)||console.error(s))},[s,t]),null},zoe="DialogDescriptionWarning",Foe=({contentRef:t,descriptionId:e})=>{const u=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${HV(zoe).contentName}}.`;return X.useEffect(()=>{var _;const h=(_=t.current)==null?void 0:_.getAttribute("aria-describedby");e&&h&&(document.getElementById(e)||console.warn(u))},[u,t,e]),null},Boe=MV,Noe=DV,joe=OV,WV=zV,qV=FV,KV=NV,ZV=VV,Voe=$V;const Uoe=Boe,Wue=Noe,$oe=joe,XV=X.forwardRef(({className:t,...e},s)=>le.jsx(WV,{ref:s,className:ki("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",t),...e}));XV.displayName=WV.displayName;const YV=X.forwardRef(({className:t,children:e,...s},u)=>le.jsxs($oe,{children:[le.jsx(XV,{}),le.jsxs(qV,{ref:u,className:ki("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",t),...s,children:[e,le.jsxs(Voe,{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:[le.jsx(Df,{className:"h-4 w-4"}),le.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));YV.displayName=qV.displayName;const JV=({className:t,...e})=>le.jsx("div",{className:ki("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});JV.displayName="DialogHeader";const QV=X.forwardRef(({className:t,...e},s)=>le.jsx(KV,{ref:s,className:ki("text-lg font-semibold leading-none tracking-tight",t),...e}));QV.displayName=KV.displayName;const eU=X.forwardRef(({className:t,...e},s)=>le.jsx(ZV,{ref:s,className:ki("text-sm text-muted-foreground",t),...e}));eU.displayName=ZV.displayName;const tU=X.forwardRef(({className:t,type:e,...s},u)=>le.jsx("input",{type:e,className:ki("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",t),ref:u,...s}));tU.displayName="Input";const rU=X.forwardRef(({className:t,...e},s)=>le.jsx("textarea",{className:ki("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",t),ref:s,...e}));rU.displayName="Textarea";var Goe="Label",nU=X.forwardRef((t,e)=>le.jsx(qi.label,{...t,ref:e,onMouseDown:s=>{var h;s.target.closest("button, input, select, textarea")||((h=t.onMouseDown)==null||h.call(t,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));nU.displayName=Goe;var iU=nU;const Hoe=FC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),gf=X.forwardRef(({className:t,...e},s)=>le.jsx(iU,{ref:s,className:ki(Hoe(),t),...e}));gf.displayName=iU.displayName;function sU(t,[e,s]){return Math.min(s,Math.max(e,t))}var Woe=X.createContext(void 0);function qoe(t){const e=X.useContext(Woe);return t||e||"ltr"}function Koe(t){const e=X.useRef({value:t,previous:t});return X.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var oU=["PageUp","PageDown"],aU=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lU={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},a_="Slider",[LA,Zoe,Xoe]=TB(a_),[cU]=Zg(a_,[Xoe]),[Yoe,yS]=cU(a_),uU=X.forwardRef((t,e)=>{const{name:s,min:u=0,max:h=100,step:_=1,orientation:w="horizontal",disabled:o=!1,minStepsBetweenThumbs:k=0,defaultValue:P=[u],value:O,onValueChange:F=()=>{},onValueCommit:V=()=>{},inverted:$=!1,form:Y,...Z}=t,se=X.useRef(new Set),te=X.useRef(0),oe=w==="horizontal"?Joe:Qoe,[he=[],Ie]=J1({prop:O,defaultProp:P,onChange:tr=>{var Qe;(Qe=[...se.current][te.current])==null||Qe.focus(),F(tr)}}),Be=X.useRef(he);function je(tr){const jt=iae(he,tr);kt(tr,jt)}function Je(tr){kt(tr,te.current)}function ft(){const tr=Be.current[te.current];he[te.current]!==tr&&V(he)}function kt(tr,jt,{commit:Qe}={commit:!1}){const xt=lae(_),It=cae(Math.round((tr-u)/_)*_+u,xt),Ot=sU(It,[u,h]);Ie((Et=[])=>{const st=rae(Et,Ot,jt);if(aae(st,k*_)){te.current=st.indexOf(Ot);const Pt=String(st)!==String(Et);return Pt&&Qe&&V(st),Pt?st:Et}else return Et})}return le.jsx(Yoe,{scope:t.__scopeSlider,name:s,disabled:o,min:u,max:h,valueIndexToChangeRef:te,thumbs:se.current,values:he,orientation:w,form:Y,children:le.jsx(LA.Provider,{scope:t.__scopeSlider,children:le.jsx(LA.Slot,{scope:t.__scopeSlider,children:le.jsx(oe,{"aria-disabled":o,"data-disabled":o?"":void 0,...Z,ref:e,onPointerDown:Ei(Z.onPointerDown,()=>{o||(Be.current=he)}),min:u,max:h,inverted:$,onSlideStart:o?void 0:je,onSlideMove:o?void 0:Je,onSlideEnd:o?void 0:ft,onHomeKeyDown:()=>!o&&kt(u,0,{commit:!0}),onEndKeyDown:()=>!o&&kt(h,he.length-1,{commit:!0}),onStepKeyDown:({event:tr,direction:jt})=>{if(!o){const It=oU.includes(tr.key)||tr.shiftKey&&aU.includes(tr.key)?10:1,Ot=te.current,Et=he[Ot],st=_*It*jt;kt(Et+st,Ot,{commit:!0})}}})})})})});uU.displayName=a_;var[dU,hU]=cU(a_,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Joe=X.forwardRef((t,e)=>{const{min:s,max:u,dir:h,inverted:_,onSlideStart:w,onSlideMove:o,onSlideEnd:k,onStepKeyDown:P,...O}=t,[F,V]=X.useState(null),$=Os(e,oe=>V(oe)),Y=X.useRef(void 0),Z=qoe(h),se=Z==="ltr",te=se&&!_||!se&&_;function ee(oe){const he=Y.current||F.getBoundingClientRect(),Ie=[0,he.width],je=VI(Ie,te?[s,u]:[u,s]);return Y.current=he,je(oe-he.left)}return le.jsx(dU,{scope:t.__scopeSlider,startEdge:te?"left":"right",endEdge:te?"right":"left",direction:te?1:-1,size:"width",children:le.jsx(fU,{dir:Z,"data-orientation":"horizontal",...O,ref:$,style:{...O.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:oe=>{const he=ee(oe.clientX);w==null||w(he)},onSlideMove:oe=>{const he=ee(oe.clientX);o==null||o(he)},onSlideEnd:()=>{Y.current=void 0,k==null||k()},onStepKeyDown:oe=>{const Ie=lU[te?"from-left":"from-right"].includes(oe.key);P==null||P({event:oe,direction:Ie?-1:1})}})})}),Qoe=X.forwardRef((t,e)=>{const{min:s,max:u,inverted:h,onSlideStart:_,onSlideMove:w,onSlideEnd:o,onStepKeyDown:k,...P}=t,O=X.useRef(null),F=Os(e,O),V=X.useRef(void 0),$=!h;function Y(Z){const se=V.current||O.current.getBoundingClientRect(),te=[0,se.height],oe=VI(te,$?[u,s]:[s,u]);return V.current=se,oe(Z-se.top)}return le.jsx(dU,{scope:t.__scopeSlider,startEdge:$?"bottom":"top",endEdge:$?"top":"bottom",size:"height",direction:$?1:-1,children:le.jsx(fU,{"data-orientation":"vertical",...P,ref:F,style:{...P.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:Z=>{const se=Y(Z.clientY);_==null||_(se)},onSlideMove:Z=>{const se=Y(Z.clientY);w==null||w(se)},onSlideEnd:()=>{V.current=void 0,o==null||o()},onStepKeyDown:Z=>{const te=lU[$?"from-bottom":"from-top"].includes(Z.key);k==null||k({event:Z,direction:te?-1:1})}})})}),fU=X.forwardRef((t,e)=>{const{__scopeSlider:s,onSlideStart:u,onSlideMove:h,onSlideEnd:_,onHomeKeyDown:w,onEndKeyDown:o,onStepKeyDown:k,...P}=t,O=yS(a_,s);return le.jsx(qi.span,{...P,ref:e,onKeyDown:Ei(t.onKeyDown,F=>{F.key==="Home"?(w(F),F.preventDefault()):F.key==="End"?(o(F),F.preventDefault()):oU.concat(aU).includes(F.key)&&(k(F),F.preventDefault())}),onPointerDown:Ei(t.onPointerDown,F=>{const V=F.target;V.setPointerCapture(F.pointerId),F.preventDefault(),O.thumbs.has(V)?V.focus():u(F)}),onPointerMove:Ei(t.onPointerMove,F=>{F.target.hasPointerCapture(F.pointerId)&&h(F)}),onPointerUp:Ei(t.onPointerUp,F=>{const V=F.target;V.hasPointerCapture(F.pointerId)&&(V.releasePointerCapture(F.pointerId),_(F))})})}),pU="SliderTrack",mU=X.forwardRef((t,e)=>{const{__scopeSlider:s,...u}=t,h=yS(pU,s);return le.jsx(qi.span,{"data-disabled":h.disabled?"":void 0,"data-orientation":h.orientation,...u,ref:e})});mU.displayName=pU;var OA="SliderRange",gU=X.forwardRef((t,e)=>{const{__scopeSlider:s,...u}=t,h=yS(OA,s),_=hU(OA,s),w=X.useRef(null),o=Os(e,w),k=h.values.length,P=h.values.map(V=>vU(V,h.min,h.max)),O=k>1?Math.min(...P):0,F=100-Math.max(...P);return le.jsx(qi.span,{"data-orientation":h.orientation,"data-disabled":h.disabled?"":void 0,...u,ref:o,style:{...t.style,[_.startEdge]:O+"%",[_.endEdge]:F+"%"}})});gU.displayName=OA;var zA="SliderThumb",_U=X.forwardRef((t,e)=>{const s=Zoe(t.__scopeSlider),[u,h]=X.useState(null),_=Os(e,o=>h(o)),w=X.useMemo(()=>u?s().findIndex(o=>o.ref.current===u):-1,[s,u]);return le.jsx(eae,{...t,ref:_,index:w})}),eae=X.forwardRef((t,e)=>{const{__scopeSlider:s,index:u,name:h,..._}=t,w=yS(zA,s),o=hU(zA,s),[k,P]=X.useState(null),O=Os(e,ee=>P(ee)),F=k?w.form||!!k.closest("form"):!0,V=SN(k),$=w.values[u],Y=$===void 0?0:vU($,w.min,w.max),Z=nae(u,w.values.length),se=V==null?void 0:V[o.size],te=se?sae(se,Y,o.direction):0;return X.useEffect(()=>{if(k)return w.thumbs.add(k),()=>{w.thumbs.delete(k)}},[k,w.thumbs]),le.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${Y}% + ${te}px)`},children:[le.jsx(LA.ItemSlot,{scope:t.__scopeSlider,children:le.jsx(qi.span,{role:"slider","aria-label":t["aria-label"]||Z,"aria-valuemin":w.min,"aria-valuenow":$,"aria-valuemax":w.max,"aria-orientation":w.orientation,"data-orientation":w.orientation,"data-disabled":w.disabled?"":void 0,tabIndex:w.disabled?void 0:0,..._,ref:O,style:$===void 0?{display:"none"}:t.style,onFocus:Ei(t.onFocus,()=>{w.valueIndexToChangeRef.current=u})})}),F&&le.jsx(yU,{name:h??(w.name?w.name+(w.values.length>1?"[]":""):void 0),form:w.form,value:$},u)]})});_U.displayName=zA;var tae="RadioBubbleInput",yU=X.forwardRef(({__scopeSlider:t,value:e,...s},u)=>{const h=X.useRef(null),_=Os(h,u),w=Koe(e);return X.useEffect(()=>{const o=h.current;if(!o)return;const k=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(k,"value").set;if(w!==e&&O){const F=new Event("input",{bubbles:!0});O.call(o,e),o.dispatchEvent(F)}},[w,e]),le.jsx(qi.input,{style:{display:"none"},...s,ref:_,defaultValue:e})});yU.displayName=tae;function rae(t=[],e,s){const u=[...t];return u[s]=e,u.sort((h,_)=>h-_)}function vU(t,e,s){const _=100/(s-e)*(t-e);return sU(_,[0,100])}function nae(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function iae(t,e){if(t.length===1)return 0;const s=t.map(h=>Math.abs(h-e)),u=Math.min(...s);return s.indexOf(u)}function sae(t,e,s){const u=t/2,_=VI([0,50],[0,u]);return(u-_(e)*s)*s}function oae(t){return t.slice(0,-1).map((e,s)=>t[s+1]-e)}function aae(t,e){if(e>0){const s=oae(t);return Math.min(...s)>=e}return!0}function VI(t,e){return s=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const u=(e[1]-e[0])/(t[1]-t[0]);return e[0]+u*(s-t[0])}}function lae(t){return(String(t).split(".")[1]||"").length}function cae(t,e){const s=Math.pow(10,e);return Math.round(t*s)/s}var xU=uU,uae=mU,dae=gU,hae=_U;const $b=X.forwardRef(({className:t,...e},s)=>le.jsxs(xU,{ref:s,className:ki("relative flex w-full touch-none select-none items-center",t),...e,children:[le.jsx(uae,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:le.jsx(dae,{className:"absolute h-full bg-primary"})}),le.jsx(hae,{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"})]}));$b.displayName=xU.displayName;function fae({open:t,onOpenChange:e,location:s,onSuccess:u}){const{t:h}=Kf(),{user:_}=qf(),[w,o]=X.useState(""),[k,P]=X.useState(""),[O,F]=X.useState(1),[V,$]=X.useState(50),[Y,Z]=X.useState(100),[se,te]=X.useState(!1),[ee,oe]=X.useState([]),[he,Ie]=X.useState(!1),Be=X.useRef(null),je=X.useRef(null),Je=(Qe,xt)=>{const It=Qe.target.files;It&&(Array.from(It).forEach(Ot=>{if(Ot.size>5*1024*1024){ro.error(h("quickCreate.imageTooLarge"));return}const Et=new FileReader;Et.onload=st=>{oe(Pt=>{var qt;return[...Pt,{file:Ot,preview:(qt=st.target)==null?void 0:qt.result,type:xt}]})},Et.readAsDataURL(Ot)}),Qe.target.value="")},ft=Qe=>{oe(xt=>xt.filter((It,Ot)=>Ot!==Qe))},kt=()=>{oe([])},tr=async()=>{if(!s||!_){ro.error(h("quickCreate.loginAndLocationRequired"));return}if(!w.trim()){ro.error(h("quickCreate.titleRequiredError"));return}te(!0);try{const{data:Qe,error:xt}=await qd.from("missions").insert({title:w.trim(),description:k.trim()||null,latitude:s.latitude,longitude:s.longitude,required_photos:O,reward_credits:V,radius_meters:Y,status:"active",created_by:_.id}).select("id").single();if(xt)throw xt;if(ee.length>0&&Qe){Ie(!0);for(let It=0;It<ee.length;It++){const Ot=ee[It],Et=Ot.file.name.split(".").pop(),st=`${Qe.id}/${crypto.randomUUID()}.${Et}`,{error:Pt}=await qd.storage.from("mission-examples").upload(st,Ot.file,{contentType:Ot.file.type});if(!Pt){const{data:qt}=qd.storage.from("mission-examples").getPublicUrl(st);await qd.from("mission_example_images").insert({mission_id:Qe.id,image_url:qt.publicUrl,image_type:Ot.type,caption:Ot.type==="good"?h("quickCreate.goodExampleCaption"):h("quickCreate.badExampleCaption"),order_index:It})}}Ie(!1)}ro.success(h("quickCreate.missionCreated"),{description:h("quickCreate.missionOnMap",{title:w})}),o(""),P(""),F(1),$(50),Z(100),kt(),e(!1),u==null||u()}catch(Qe){console.error("Failed to create mission:",Qe),ro.error(h("quickCreate.couldNotCreate"),{description:Qe.message||h("quickCreate.tryAgain")})}finally{te(!1)}},jt=O>0?V/O:V;return le.jsx(Uoe,{open:t,onOpenChange:e,children:le.jsxs(YV,{className:"max-w-md",children:[le.jsxs(JV,{children:[le.jsxs(QV,{className:"flex items-center gap-2",children:[le.jsx(m1,{className:"h-5 w-5 text-primary"}),h("quickCreate.title")]}),le.jsx(eU,{children:h("quickCreate.description")})]}),le.jsxs("div",{className:"space-y-4 py-4",children:[s&&le.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 p-2 rounded-lg",children:[le.jsx(m1,{className:"h-4 w-4"}),le.jsxs("span",{children:[s.latitude.toFixed(5),", ",s.longitude.toFixed(5)]})]}),le.jsxs("div",{className:"space-y-2",children:[le.jsx(gf,{htmlFor:"title",children:h("quickCreate.titleRequired")}),le.jsx(tU,{id:"title",placeholder:h("quickCreate.titlePlaceholder"),value:w,onChange:Qe=>o(Qe.target.value),maxLength:100})]}),le.jsxs("div",{className:"space-y-2",children:[le.jsx(gf,{htmlFor:"description",children:h("quickCreate.descriptionLabel")}),le.jsx(rU,{id:"description",placeholder:h("quickCreate.descriptionPlaceholder"),value:k,onChange:Qe=>P(Qe.target.value),rows:3,maxLength:500})]}),le.jsxs("div",{className:"space-y-2",children:[le.jsxs("div",{className:"flex items-center justify-between",children:[le.jsxs(gf,{className:"flex items-center gap-2",children:[le.jsx(YB,{className:"h-4 w-4"}),h("quickCreate.photoCount")]}),le.jsx("span",{className:"text-sm font-medium",children:O})]}),le.jsx($b,{value:[O],onValueChange:([Qe])=>F(Qe),min:1,max:10,step:1})]}),le.jsxs("div",{className:"space-y-2",children:[le.jsxs("div",{className:"flex items-center justify-between",children:[le.jsxs(gf,{className:"flex items-center gap-2",children:[le.jsx(JB,{className:"h-4 w-4"}),h("quickCreate.reward")]}),le.jsxs("span",{className:"text-sm font-medium",children:[V," kr"]})]}),le.jsx($b,{value:[V],onValueChange:([Qe])=>$(Qe),min:10,max:300,step:10}),le.jsx("p",{className:"text-xs text-muted-foreground",children:h("quickCreate.creditsPerPhoto",{amount:jt.toFixed(0)})})]}),le.jsxs("div",{className:"space-y-2",children:[le.jsxs("div",{className:"flex items-center justify-between",children:[le.jsx(gf,{children:h("quickCreate.radius")}),le.jsxs("span",{className:"text-sm font-medium",children:[Y," m"]})]}),le.jsx($b,{value:[Y],onValueChange:([Qe])=>Z(Qe),min:25,max:500,step:25})]}),le.jsxs("div",{className:"space-y-3",children:[le.jsx(gf,{children:h("quickCreate.exampleImages")}),le.jsx("input",{ref:Be,type:"file",accept:"image/*",multiple:!0,onChange:Qe=>Je(Qe,"good"),className:"hidden"}),le.jsx("input",{ref:je,type:"file",accept:"image/*",multiple:!0,onChange:Qe=>Je(Qe,"bad"),className:"hidden"}),le.jsxs("div",{className:"space-y-2",children:[le.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-green-600 dark:text-green-400",children:[le.jsx(Nq,{className:"h-4 w-4"}),h("quickCreate.goodExamples")]}),le.jsxs("div",{className:"flex flex-wrap gap-2",children:[ee.map((Qe,xt)=>({img:Qe,index:xt})).filter(({img:Qe})=>Qe.type==="good").map(({img:Qe,index:xt})=>le.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden border-2 border-green-500/50",children:[le.jsx("img",{src:Qe.preview,alt:h("quickCreate.goodExampleAlt"),className:"w-full h-full object-cover"}),le.jsx("button",{type:"button",onClick:()=>ft(xt),className:"absolute top-1 right-1 p-0.5 bg-background/80 rounded-full hover:bg-background",children:le.jsx(Df,{className:"h-3 w-3"})})]},xt)),le.jsxs("button",{type:"button",onClick:()=>{var Qe;return(Qe=Be.current)==null?void 0:Qe.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:[le.jsx(Lk,{className:"h-5 w-5"}),le.jsx("span",{className:"text-[10px] mt-0.5",children:h("quickCreate.addImage")})]})]})]}),le.jsxs("div",{className:"space-y-2",children:[le.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-red-600 dark:text-red-400",children:[le.jsx(jq,{className:"h-4 w-4"}),h("quickCreate.badExamples")]}),le.jsxs("div",{className:"flex flex-wrap gap-2",children:[ee.map((Qe,xt)=>({img:Qe,index:xt})).filter(({img:Qe})=>Qe.type==="bad").map(({img:Qe,index:xt})=>le.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden border-2 border-red-500/50",children:[le.jsx("img",{src:Qe.preview,alt:h("quickCreate.badExampleAlt"),className:"w-full h-full object-cover"}),le.jsx("button",{type:"button",onClick:()=>ft(xt),className:"absolute top-1 right-1 p-0.5 bg-background/80 rounded-full hover:bg-background",children:le.jsx(Df,{className:"h-3 w-3"})})]},xt)),le.jsxs("button",{type:"button",onClick:()=>{var Qe;return(Qe=je.current)==null?void 0:Qe.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:[le.jsx(Lk,{className:"h-5 w-5"}),le.jsx("span",{className:"text-[10px] mt-0.5",children:h("quickCreate.addImage")})]})]})]}),le.jsx("p",{className:"text-xs text-muted-foreground",children:h("quickCreate.exampleHint")})]})]}),le.jsxs("div",{className:"flex gap-2",children:[le.jsx($a,{variant:"outline",className:"flex-1",onClick:()=>e(!1),disabled:se,children:h("quickCreate.cancel")}),le.jsx($a,{className:"flex-1",onClick:tr,disabled:se||!w.trim()||!s,children:se?le.jsxs(le.Fragment,{children:[le.jsx(p1,{className:"h-4 w-4 mr-2 animate-spin"}),h("quickCreate.creating")]}):h("quickCreate.createMission")})]})]})})}const pae=()=>{const{t}=Kf(),{user:e}=qf();Mse();const{latitude:s,longitude:u,requestPosition:h}=tI(),{activeClaim:_,hasActiveClaim:w}=Lse(),[o,k]=X.useState(""),[P,O]=X.useState(!1),{missions:F,isFocusMode:V,refetch:$}=Pse(s,u,{activeClaimMissionId:_==null?void 0:_.mission_id}),Y=r_(),[Z]=LX(),[se,te]=X.useState(null),[ee,oe]=X.useState(!1),[he,Ie]=X.useState("walking"),{route:Be,loading:je,fetchRoute:Je,clearRoute:ft}=Ere();X.useEffect(()=>{if(_!=null&&_.mission_id&&F.length>0){const It=F.find(Ot=>Ot.id===_.mission_id);It&&k(It.title)}},[_,F]);const kt=X.useMemo(()=>{const It=Z.get("zoom-to");if(!It)return null;const[Ot,Et]=It.split(",").map(Number);return isNaN(Ot)||isNaN(Et)?null:{latitude:Ot,longitude:Et}},[Z]);X.useEffect(()=>{if(kt){sessionStorage.removeItem("activeRoute"),te(null),oe(!1);return}const It=sessionStorage.getItem("activeRoute");if(It)try{const Ot=JSON.parse(It);te(Ot),oe(!0)}catch(Ot){console.error("Failed to parse route data:",Ot)}},[kt]);const tr=X.useCallback(async It=>{!s||!u||!kt||(Ie(It),oe(!0),await Je(s,u,kt.latitude,kt.longitude,It))},[s,u,kt,Je]),jt=X.useCallback(()=>{sessionStorage.removeItem("activeRoute"),te(null),oe(!1),ft()},[ft]);X.useEffect(()=>{Be&&ee&&(te(Be),sessionStorage.setItem("activeRoute",JSON.stringify(Be)))},[Be,ee]);const Qe=It=>{sessionStorage.removeItem("activeRoute"),te(null),Y(`/mission/${It.id}`)},xt=async()=>{if(!e){ro.error(t("map.loginToCreate")),Y("/auth");return}if((!s||!u)&&(ro.info(t("map.gettingLocation")),!await h())){ro.error(t("map.couldNotGetPosition"));return}O(!0)};return le.jsxs("div",{className:"h-screen w-full flex flex-col bg-background",children:[e&&le.jsx("div",{className:"absolute top-4 right-4 z-30",style:{top:"calc(env(safe-area-inset-top, 0px) + 16px)"},children:le.jsx($a,{size:"icon",onClick:xt,className:"h-10 w-10 rounded-full shadow-lg bg-primary hover:bg-primary/90",title:t("map.createMissionHere"),children:le.jsx(Lk,{className:"h-5 w-5"})})}),w&&o&&le.jsx(Ose,{missionTitle:o,isVisible:V}),le.jsx("div",{className:"flex-1 relative",children:le.jsx(_V,{missions:F,userLocation:s&&u?{latitude:s,longitude:u}:null,onMissionSelect:Qe,activeRoute:se,onStartNavigation:tr,onClearNavigation:jt,isNavigating:ee,navigationLoading:je,selectedTravelMode:he,zoomToTarget:kt})}),P&&s&&u&&le.jsx(fae,{open:P,onOpenChange:O,location:{latitude:s,longitude:u},onSuccess:()=>{O(!1),$()}}),le.jsx(vV,{})]})},mae=X.lazy(()=>cs(()=>import("./Index-B5xg3G3P.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),gae=X.lazy(()=>cs(()=>import("./Auth-Gib-waoR.js"),__vite__mapDeps([7,8,9]))),_ae=X.lazy(()=>cs(()=>import("./MissionDetail-C7kUviJC.js"),__vite__mapDeps([10,11,12,13,14,5,15,16,17,18,19,20,21,22,23,2,24,25,1]))),yae=X.lazy(()=>cs(()=>import("./Profile-C4xYBVXU.js"),__vite__mapDeps([26,27,4,3,17,28,29,12,30,1,2,31,9,32,33,34,35,8,16,5,36,37,38,39]))),vae=X.lazy(()=>cs(()=>import("./Wallet-DDpmfw68.js"),__vite__mapDeps([40,27,4,3,17,28,29,41,42,20,13,2,43,44,15,45,32,46,35,22,47,48,49,50,51,52,36,31,5]))),xae=X.lazy(()=>cs(()=>import("./Notifications-B8XGepdj.js"),__vite__mapDeps([53,42]))),wae=X.lazy(()=>cs(()=>import("./VerifyIdentity-Ro09dKVe.js"),__vite__mapDeps([54,16,49,2,14,5,15,17,37,23,13,1]))),bae=X.lazy(()=>cs(()=>import("./OrdererRegistration-BOhnJl4W.js"),__vite__mapDeps([55,56,4,28,23,5,36,57,37,49]))),Sae=X.lazy(()=>cs(()=>import("./CreateMission-8331plbz.js"),__vite__mapDeps([58,15,59,29,56,4,28,34,35,17,23,48,60,52,20,61]))),Tae=X.lazy(()=>cs(()=>import("./CreateCampaign-DUvMysdJ.js"),__vite__mapDeps([62,56,4,28,34,35,17,63,33,25,64,1,2,8,43,9,36,45,57,24,20,16,19,46,38,65,66,21,47,29,67,3,23,48,15,60,52]))),Eae=X.lazy(()=>cs(()=>import("./OrdererDashboard-5y9XrRsn.js"),__vite__mapDeps([68,29,69,4,70,71,34,35,17,31,15,9,61,22,33,72,16,5,23,2,73,19,6,65,1,24,51,49,50,74,75,36]))),kae=X.lazy(()=>cs(()=>import("./RealChangeMission-MIGek0JF.js"),__vite__mapDeps([76,63,38,45,33,36,32,77,6,15,23,18,20,2,21,52,24]))),Aae=X.lazy(()=>cs(()=>import("./OrdererMissionDetail-BnWG6WKo.js"),__vite__mapDeps([78,29,11,70,5,23,39,9,24,31,2,59,64]))),Cae=X.lazy(()=>cs(()=>import("./OperationsPopout-BuyROwwG.js"),__vite__mapDeps([79,29,69,4,70,23,33,24,2,5,1,9,51,73]))),Iae=X.lazy(()=>cs(()=>import("./AnalyticsPopout-C0wfA38E.js"),__vite__mapDeps([80,29,23,72,31,19,33,49,50,74]))),Pae=X.lazy(()=>cs(()=>import("./AdsPopout-DKNQbVOB.js"),__vite__mapDeps([81,71,29,34,35,17,31,15,9,61,23,24]))),Mae=X.lazy(()=>cs(()=>import("./Principles-C209eajW.js"),__vite__mapDeps([82,70,16,45,9,83,75,46,35,15,23]))),Rae=X.lazy(()=>cs(()=>import("./Policy-rMsjW2x7.js"),__vite__mapDeps([84,69,4,70,66,74,77,57,16,45,9,83,75,46,35,15]))),Dae=X.lazy(()=>cs(()=>import("./PhotoMarketplace-CAR9gpra.js"),__vite__mapDeps([85,29,34,35,17,47,86,23,67,9,50,45]))),Lae=X.lazy(()=>cs(()=>import("./PhotoDetail-CGO3w_xn.js"),__vite__mapDeps([87,29,86,23,45,9,50,22]))),Oae=X.lazy(()=>cs(()=>import("./PhotoContest-Dt4wePeS.js"),__vite__mapDeps([88,70,29,30,23,41,42,45,2,52,24,59]))),zae=X.lazy(()=>cs(()=>import("./IdentityDisclaimer-BQti7r70.js"),__vite__mapDeps([89,23,16,49,2,19]))),Fae=X.lazy(()=>cs(()=>import("./NotFound-BO4R1lJx.js"),[])),Bae=X.lazy(()=>cs(()=>import("./RedeemVoucher-NVDK1D_N.js"),__vite__mapDeps([90,44,13,5]))),Nae=()=>le.jsxs("div",{className:"min-h-screen bg-background p-4 space-y-4",children:[le.jsx(ob,{className:"h-12 w-3/4"}),le.jsx(ob,{className:"h-32 w-full"}),le.jsx(ob,{className:"h-32 w-full"}),le.jsx(ob,{className:"h-20 w-full"})]}),jae=new PZ({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1,retry:1}}}),Vae=()=>le.jsx(MZ,{client:jae,children:le.jsx($X,{children:le.jsx(OX,{children:le.jsxs(oZ,{children:[le.jsx(B9,{}),le.jsx(g7,{}),le.jsx(PX,{children:le.jsx(HX,{children:le.jsx(X.Suspense,{fallback:le.jsx(Nae,{}),children:le.jsxs(bX,{children:[le.jsx(Gi,{path:"/",element:le.jsx(mae,{})}),le.jsx(Gi,{path:"/auth",element:le.jsx(gae,{})}),le.jsx(Gi,{path:"/mission/:id",element:le.jsx(_ae,{})}),le.jsx(Gi,{path:"/profile",element:le.jsx(yae,{})}),le.jsx(Gi,{path:"/wallet",element:le.jsx(vae,{})}),le.jsx(Gi,{path:"/notifications",element:le.jsx(xae,{})}),le.jsx(Gi,{path:"/map",element:le.jsx(pae,{})}),le.jsx(Gi,{path:"/verify-identity",element:le.jsx(wae,{})}),le.jsx(Gi,{path:"/orderer/register",element:le.jsx(bae,{})}),le.jsx(Gi,{path:"/orderer/dashboard",element:le.jsx(Eae,{})}),le.jsx(Gi,{path:"/orderer/create-mission",element:le.jsx(Sae,{})}),le.jsx(Gi,{path:"/orderer/create-campaign",element:le.jsx(Tae,{})}),le.jsx(Gi,{path:"/orderer/mission/:id",element:le.jsx(Aae,{})}),le.jsx(Gi,{path:"/orderer/operations",element:le.jsx(Cae,{})}),le.jsx(Gi,{path:"/orderer/analytics",element:le.jsx(Iae,{})}),le.jsx(Gi,{path:"/orderer/ads",element:le.jsx(Pae,{})}),le.jsx(Gi,{path:"/real-change-mission",element:le.jsx(kae,{})}),le.jsx(Gi,{path:"/principer",element:le.jsx(Mae,{})}),le.jsx(Gi,{path:"/policy",element:le.jsx(Rae,{})}),le.jsx(Gi,{path:"/photo-marketplace",element:le.jsx(Dae,{})}),le.jsx(Gi,{path:"/photo/:id",element:le.jsx(Lae,{})}),le.jsx(Gi,{path:"/photo-contest/:contestId",element:le.jsx(Oae,{})}),le.jsx(Gi,{path:"/identity-disclaimer",element:le.jsx(zae,{})}),le.jsx(Gi,{path:"/redeem",element:le.jsx(Bae,{})}),le.jsx(Gi,{path:"*",element:le.jsx(Fae,{})})]})})})})]})})})}),{slice:Uae,forEach:$ae}=[];function Gae(t){return $ae.call(Uae.call(arguments,1),e=>{if(e)for(const s in e)t[s]===void 0&&(t[s]=e[s])}),t}function Hae(t){return typeof t!="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(t))}const X3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Wae=function(t,e){const u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},h=encodeURIComponent(e);let _=`${t}=${h}`;if(u.maxAge>0){const w=u.maxAge-0;if(Number.isNaN(w))throw new Error("maxAge should be a Number");_+=`; Max-Age=${Math.floor(w)}`}if(u.domain){if(!X3.test(u.domain))throw new TypeError("option domain is invalid");_+=`; Domain=${u.domain}`}if(u.path){if(!X3.test(u.path))throw new TypeError("option path is invalid");_+=`; Path=${u.path}`}if(u.expires){if(typeof u.expires.toUTCString!="function")throw new TypeError("option expires is invalid");_+=`; Expires=${u.expires.toUTCString()}`}if(u.httpOnly&&(_+="; HttpOnly"),u.secure&&(_+="; Secure"),u.sameSite)switch(typeof u.sameSite=="string"?u.sameSite.toLowerCase():u.sameSite){case!0:_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"strict":_+="; SameSite=Strict";break;case"none":_+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return u.partitioned&&(_+="; Partitioned"),_},Y3={create(t,e,s,u){let h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(h.expires=new Date,h.expires.setTime(h.expires.getTime()+s*60*1e3)),u&&(h.domain=u),document.cookie=Wae(t,e,h)},read(t){const e=`${t}=`,s=document.cookie.split(";");for(let u=0;u<s.length;u++){let h=s[u];for(;h.charAt(0)===" ";)h=h.substring(1,h.length);if(h.indexOf(e)===0)return h.substring(e.length,h.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var qae={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return Y3.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:s,cookieMinutes:u,cookieDomain:h,cookieOptions:_}=e;s&&typeof document<"u"&&Y3.create(s,t,u,h,_)}},Kae={name:"querystring",lookup(t){var u;let{lookupQuerystring:e}=t,s;if(typeof window<"u"){let{search:h}=window.location;!window.location.search&&((u=window.location.hash)==null?void 0:u.indexOf("?"))>-1&&(h=window.location.hash.substring(window.location.hash.indexOf("?")));const w=h.substring(1).split("&");for(let o=0;o<w.length;o++){const k=w[o].indexOf("=");k>0&&w[o].substring(0,k)===e&&(s=w[o].substring(k+1))}}return s}},Zae={name:"hash",lookup(t){var h;let{lookupHash:e,lookupFromHashIndex:s}=t,u;if(typeof window<"u"){const{hash:_}=window.location;if(_&&_.length>2){const w=_.substring(1);if(e){const o=w.split("&");for(let k=0;k<o.length;k++){const P=o[k].indexOf("=");P>0&&o[k].substring(0,P)===e&&(u=o[k].substring(P+1))}}if(u)return u;if(!u&&s>-1){const o=_.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?(h=o[typeof s=="number"?s:0])==null?void 0:h.replace("/",""):void 0}}}return u}};let Wm=null;const J3=()=>{if(Wm!==null)return Wm;try{if(Wm=typeof window<"u"&&window.localStorage!==null,!Wm)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Wm=!1}return Wm};var Xae={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&J3())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:s}=e;s&&J3()&&window.localStorage.setItem(s,t)}};let qm=null;const Q3=()=>{if(qm!==null)return qm;try{if(qm=typeof window<"u"&&window.sessionStorage!==null,!qm)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{qm=!1}return qm};var Yae={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Q3())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:s}=e;s&&Q3()&&window.sessionStorage.setItem(s,t)}},Jae={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:s,userLanguage:u,language:h}=navigator;if(s)for(let _=0;_<s.length;_++)e.push(s[_]);u&&e.push(u),h&&e.push(h)}return e.length>0?e:void 0}},Qae={name:"htmlTag",lookup(t){let{htmlTag:e}=t,s;const u=e||(typeof document<"u"?document.documentElement:null);return u&&typeof u.getAttribute=="function"&&(s=u.getAttribute("lang")),s}},ele={name:"path",lookup(t){var h;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(s)?(h=s[typeof e=="number"?e:0])==null?void 0:h.replace("/",""):void 0}},tle={name:"subdomain",lookup(t){var h,_;let{lookupFromSubdomainIndex:e}=t;const s=typeof e=="number"?e+1:1,u=typeof window<"u"&&((_=(h=window.location)==null?void 0:h.hostname)==null?void 0:_.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(u)return u[s]}};let wU=!1;try{document.cookie,wU=!0}catch{}const bU=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];wU||bU.splice(1,1);const rle=()=>({order:bU,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class SU{constructor(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,s)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Gae(s,this.options||{},rle()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=h=>h.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=u,this.addDetector(qae),this.addDetector(Kae),this.addDetector(Xae),this.addDetector(Yae),this.addDetector(Jae),this.addDetector(Qae),this.addDetector(ele),this.addDetector(tle),this.addDetector(Zae)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,s=[];return e.forEach(u=>{if(this.detectors[u]){let h=this.detectors[u].lookup(this.options);h&&typeof h=="string"&&(h=[h]),h&&(s=s.concat(h))}}),s=s.filter(u=>u!=null&&!Hae(u)).map(u=>this.options.convertDetectedLanguage(u)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}cacheUserLanguage(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||s.forEach(u=>{this.detectors[u]&&this.detectors[u].cacheUserLanguage(e,this.options)}))}}SU.type="languageDetector";const nle={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"}},ile={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"}},sle={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"}},ole={title:"Skänk till välgörenhet",description:"Gör skillnad med dina intjänade credits. 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}} kr 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 kr",notEnoughCredits:"Du har inte tillräckligt med credits",thanksDonation:"Tack! Du har donerat {{amount}} kr till {{name}} 💚",amount:"Belopp (kr)",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 kr = 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 kr = 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 kr = 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 kr = 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 kr = 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 kr = 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 kr = 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 kr = en mikroentreprenör får stöd"}},ale={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:"kr",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"},lle={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"},cle={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"},ule={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"},dle={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"},hle={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"},fle={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 kr",invalidSwishError:"Ange ett giltigt Swish-nummer",withdrawViaSwish:"Ta ut via Swish",amount:"Belopp",minAmount:"Minst 100 kr",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:"kr till Swish",tapForHistory:"Tryck för historik",completeMissionsToEarn:"Slutför uppdrag för att tjäna credits"},ple={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 credits 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:"Baserat på din GPS-position",selfAccountingLabel:"Egen redovisning",weHandleTax:"Vi hanterar skatten",taxAutoDeducted:"Automatiskt skatteavdrag (30%) görs innan utbetalning. Du får ett 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"},mle={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 kr...",loginToSee:"Logga in för att se dina notiser"},gle={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"},_le={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}} kr per foto (max 300 kr/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"},yle={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"},vle={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"},xle={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?"}},wle={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}} kr/foto",maxPerPhoto:"Max {{amount}} kr/foto",rewardTooHigh:"Ersättningen får inte överstiga {{max}} kr 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"},ble={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"},Sle={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}} kr",price:"{{price}} kr",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 ↓"},Tle={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"},Ele={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"},kle={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"},Ale={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"},Cle={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"},Ile={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"},Ple={title:"Topplista",total:"Totalt",thisWeek:"Denna vecka",thisMonth:"Denna månad",efficiency:"Effektivitet",rank:"Plats",earnings:"Intäkter",perMinute:"/min"},Mle={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"},Rle={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."},Dle={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"},Lle={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"},Ole={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"},zle={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"},Fle={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"},Ble={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"},Nle={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"},jle={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"}},Vle={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"}},Ule={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"},$le={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"},Gle={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"}}},Hle={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"},Wle={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."}}},qle={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".'}},Kle={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"},Zle={george:"Lugn, professionell man",sarah:"Vänlig, tydlig kvinna",liam:"Ung, energisk man",matilda:"Varm, förtroendeingivande kvinna",daniel:"Nyhetspresentatör, auktoritativ man"},Xle="Hej! Jag heter {{name}} och jag kommer att guida dig genom dina uppdrag.",Yle="Lyssna på rösten",Jle="Kunde inte spela upp rösten",Qle={actors:nle,cta:ile,realChange:sle,charity:ole,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:wle,campaign:ble,photoMarketplace:Sle,marketplace:Tle,contest:Ele,photoDetail:kle,time:Ale,errors:Cle,footer:Ile,leaderboard:Ple,hero:Mle,earningsHistory:Rle,earningsGrowth:Dle,performance:Lle,pwa:Ole,weather:zle,compass:Fle,ai:Ble,aesthetic:Nle,templates:jle,aiValidation:Vle,reasonGate:Ule,themeSelector:$le,missionTypes:Gle,workflow:Hle,selfProtection:Wle,repetitionControl:qle,principlesSection:Kle,voiceDescriptions:Zle,voiceSample:Xle,voicePreviewButton:Yle,voicePreviewError:Jle},ece={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"}},tce={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"}},rce={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"}},nce={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}} kr 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 kr",notEnoughCredits:"You don't have enough credits",thanksDonation:"Thank you! You donated {{amount}} kr to {{name}} 💚",amount:"Amount (kr)",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 krona helps children access education, clean water and healthcare.",impact:"100 kr = 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 kr = 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 kr = 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 kr = 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 kr = 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 kr = 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 kr = 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 kr = a micro-entrepreneur receives support"}},ice={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"},sce={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"},oce={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"},ace={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"},lce={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"},cce={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"},uce={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 kr",invalidSwishError:"Enter a valid Swish number",withdrawViaSwish:"Withdraw via Swish",amount:"Amount",minAmount:"Minimum 100 kr",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:"kr to Swish",tapForHistory:"Tap for history",completeMissionsToEarn:"Complete missions to earn credits"},dce={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:"Based on your GPS position",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"},hce={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"},fce={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"},pce={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}} SEK per photo (max 300 SEK/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"},mce={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"},gce={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"},_ce={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?"}},yce={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"},vce={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"},xce={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 ↓"},wce={title:"Marketplace",buyPhoto:"Buy photo",sellPhoto:"Sell photo",featured:"Featured",popular:"Popular",recent:"Recent",category:"Category",price:"Price",photographer:"Photographer",license:"License",download:"Download"},bce={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"},Sce={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"},Tce={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"},Ece={networkError:"Network error",serverError:"Server error",notFound:"Not found",unauthorized:"Unauthorized",forbidden:"Forbidden",tryAgain:"Try again",somethingWentWrong:"Something went wrong"},kce={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"},Ace={title:"Leaderboard",total:"Total",thisWeek:"This week",thisMonth:"This month",efficiency:"Efficiency",rank:"Rank",earnings:"Earnings",perMinute:"/min"},Cce={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"},Ice={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."},Pce={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"},Mce={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"},Rce={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"},Dce={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"},Lce={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"},Oce={couldNotFetch:"Could not fetch AI response",tooManyRequests:"Too many requests, please try again later",temporarilyUnavailable:"AI feature temporarily unavailable"},zce={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"},Fce={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"}},Bce={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"}},Nce={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"},jce={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"},Vce={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"}}},Uce={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"},$ce={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."}}},Gce={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".'}},Hce={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"},Wce={george:"Calm, professional man",sarah:"Friendly, clear woman",liam:"Young, energetic man",matilda:"Warm, trustworthy woman",daniel:"News presenter, authoritative man"},qce="Hi! My name is {{name}} and I will guide you through your missions.",Kce="Listen to voice",Zce="Could not play voice",Xce={actors:ece,cta:tce,realChange:rce,charity:nce,common:ice,nav:sce,auth:oce,home:ace,missions:lce,missionDetail:cce,wallet:uce,profile:dce,notifications:hce,map:fce,quickCreate:pce,camera:mce,validation:gce,orderer:_ce,createMission:yce,campaign:vce,photoMarketplace:xce,marketplace:wce,contest:bce,photoDetail:Sce,time:Tce,errors:Ece,footer:kce,leaderboard:Ace,hero:Cce,earningsHistory:Ice,earningsGrowth:Pce,performance:Mce,pwa:Rce,weather:Dce,compass:Lce,ai:Oce,aesthetic:zce,templates:Fce,aiValidation:Bce,reasonGate:Nce,themeSelector:jce,missionTypes:Vce,workflow:Uce,selfProtection:$ce,repetitionControl:Gce,principlesSection:Hce,voiceDescriptions:Wce,voiceSample:qce,voicePreviewButton:Kce,voicePreviewError:Zce},Yce={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"},Jce={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"},Qce={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"},eue={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"},tue={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"},rue={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"},nue={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"},iue={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"},sue={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"},oue={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"},aue={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"},lue={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"},cue={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"},uue={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"},due={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"},hue={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"},fue={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"}},pue={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 ↓"},mue={title:"Marktplatz",buyPhoto:"Foto kaufen",sellPhoto:"Foto verkaufen",featured:"Empfohlen",popular:"Beliebt",recent:"Neueste",category:"Kategorie",price:"Preis",photographer:"Fotograf",license:"Lizenz",download:"Herunterladen"},gue={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"},_ue={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"},yue={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"},vue={networkError:"Netzwerkfehler",serverError:"Serverfehler",notFound:"Nicht gefunden",unauthorized:"Nicht autorisiert",forbidden:"Verboten",tryAgain:"Erneut versuchen",somethingWentWrong:"Etwas ist schiefgelaufen"},xue={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"},wue={title:"Rangliste",total:"Gesamt",thisWeek:"Diese Woche",thisMonth:"Diesen Monat",efficiency:"Effizienz",rank:"Rang",earnings:"Einnahmen",perMinute:"/Min"},bue={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"},Sue={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."},Tue={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"},Eue={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"},kue={george:"Ruhiger, professioneller Mann",sarah:"Freundliche, klare Frau",liam:"Junger, energischer Mann",matilda:"Warme, vertrauenswürdige Frau",daniel:"Nachrichtensprecher, autoritativer Mann"},Aue="Hallo! Ich bin {{name}} und werde dich durch deine Aufträge führen.",Cue="Stimme anhören",Iue="Stimme konnte nicht abgespielt werden",Pue={common:Yce,nav:Jce,auth:Qce,home:eue,missions:tue,missionDetail:rue,wallet:nue,profile:iue,notifications:sue,map:oue,quickCreate:aue,camera:lue,validation:cue,orderer:uue,createMission:due,campaign:hue,charity:fue,photoMarketplace:pue,marketplace:mue,contest:gue,photoDetail:_ue,time:yue,errors:vue,footer:xue,leaderboard:wue,hero:bue,earningsHistory:Sue,earningsGrowth:Tue,performance:Eue,voiceDescriptions:kue,voiceSample:Aue,voicePreviewButton:Cue,voicePreviewError:Iue},Mue={sv:{translation:Qle},en:{translation:Xce},de:{translation:Pue}};_o.use(SU).use(bY).init({resources:Mue,lng:"sv",fallbackLng:"sv",supportedLngs:["en","sv","de"],detection:{order:["querystring","localStorage"],caches:["localStorage"],lookupLocalStorage:"i18nextLng",lookupQuerystring:"lang"},interpolation:{escapeValue:!1},react:{useSuspense:!1}});_o.on("languageChanged",t=>{document.documentElement.lang=t,document.documentElement.dir="ltr"});_o.language&&(document.documentElement.lang=_o.language);const que=[{code:"en",name:"English",flag:"🇬🇧"},{code:"sv",name:"Svenska",flag:"🇸🇪"},{code:"de",name:"Deutsch",flag:"🇩🇪"}];"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>t.forEach(e=>e.unregister())).catch(()=>{});"caches"in window&&caches.keys().then(t=>{t.filter(e=>e.includes("mapbox")||e.includes("workbox")).forEach(e=>caches.delete(e))});wB(document.getElementById("root")).render(le.jsx(Vae,{}));export{Nue as $,Nq as A,vV as B,YB as C,e9 as D,Gue as E,Boe as F,joe as G,Os as H,tU as I,qV as J,qW as K,p1 as L,m1 as M,KV as N,ZV as O,qi as P,Voe as Q,dr as R,Yq as S,eN as T,Qq as U,t9 as V,Hue as W,Df as X,WV as Y,Noe as Z,UY as _,Kf as a,zue as a$,Wf as a0,Mse as a1,$ue as a2,pse as a3,NX as a4,gse as a5,Dk as a6,jq as a7,Sa as a8,Koe as a9,Xc as aA,FK as aB,BK as aC,DC as aD,Coe as aE,EB as aF,$se as aG,CV as aH,n0 as aI,xV as aJ,Y1 as aK,NK as aL,jK as aM,bB as aN,Cse as aO,LX as aP,nO as aQ,rU as aR,rO as aS,sO as aT,Lue as aU,Oue as aV,aZ as aW,jue as aX,Lk as aY,qq as aZ,aS as a_,SN as aa,GX as ab,Jq as ac,Uq as ad,que as ae,Wq as af,$Y as ag,GY as ah,Eu as ai,v4 as aj,HY as ak,$b as al,Kq as am,Bq as an,Uoe as ao,YV as ap,JV as aq,QV as ar,Lb as as,Xg as at,Bu as au,eU as av,ob as aw,Wue as ax,TB as ay,EN as az,JB as b,a0 as b0,AZ as b1,sa as b2,Bue as b3,tc as b4,Fue as b5,oO as b6,r9 as b7,Vue as b8,dj as b9,OQ as ba,KY as bb,nI as bc,qQ as bd,ZY as be,x4 as bf,sU as bg,pq as bh,M0 as bi,yZ as bj,dZ as bk,Uk as bl,lS as bm,cZ as bn,uZ as bo,GN as bp,SZ as bq,fZ as br,J1 as c,Ei as d,Zg as e,zb as f,qoe as g,FC as h,ki as i,le as j,tI as k,Lse as l,Pse as m,Ise as n,ui as o,qf as p,_0 as q,X as r,gf as s,QB as t,r_ as u,$a as v,ro as w,Jk as x,WY as y,qd as z};
|